Skip to content

Commit

Permalink
feat(doc): separate validityState in custom control group
Browse files Browse the repository at this point in the history
  • Loading branch information
dpellier committed Nov 28, 2024
1 parent e6d1801 commit 8e4a898
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions packages/storybook/src/constants/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ enum CONTROL_CATEGORY {
design = 'Design',
general = 'General',
slot = 'Slot',
validation = 'Validation',
}

export {
Expand Down
3 changes: 2 additions & 1 deletion packages/storybook/src/helpers/controls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ const orderedControlCategories = [
CONTROL_CATEGORY.slot,
CONTROL_CATEGORY.general,
CONTROL_CATEGORY.accessibility,
CONTROL_CATEGORY.validation,
];

function orderControls(control: Record<string, any>) {
try {
return Object.entries(control)
.sort((a, b) => {
return orderedControlCategories.indexOf(a[1].category) - orderedControlCategories.indexOf(b[1].category);
return orderedControlCategories.indexOf(a[1].table.category) - orderedControlCategories.indexOf(b[1].table.category);
})
.reduce((res, entry) => {
res[entry[0]] = entry[1];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
3 changes: 1 addition & 2 deletions packages/storybook/stories/components/input/input.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ const meta: Meta = {

export default meta;


export const Demo: StoryObj = {
render: (arg) => {
return html`
Expand Down Expand Up @@ -193,7 +192,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
4 changes: 2 additions & 2 deletions packages/storybook/stories/components/range/range.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down Expand Up @@ -220,7 +220,7 @@ export const DemoDual: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down Expand Up @@ -163,7 +163,7 @@ export const DemoMultiple: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export const Demo: StoryObj = {
},
validityState: {
table: {
category: CONTROL_CATEGORY.accessibility,
category: CONTROL_CATEGORY.validation,
defaultValue: { summary: false },
type: { summary: 'boolean' },
},
Expand Down

0 comments on commit 8e4a898

Please sign in to comment.