Skip to content

Commit

Permalink
[WNMGDS-2713] Add default value overrides to Storybook (#3216)
Browse files Browse the repository at this point in the history
* Initial set of default values added to props tables

* Updated storybook snaps
  • Loading branch information
jack-ryan-nava-pbc committed Sep 5, 2024
1 parent e3b2e45 commit 2af3184
Show file tree
Hide file tree
Showing 16 changed files with 149 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,34 @@ const meta: Meta<typeof Autocomplete> = {
component: Autocomplete,
args: {
// setting some defaults so controls turn on by default
ariaClearLabel: 'Clear search',
clearInputText: 'Clear search',
clearSearchButton: true,
loadingMessage: 'Loading...',
noResultsMessage: 'No results',
} as any,
argTypes: {
ariaClearLabel: {
table: {
defaultValue: { summary: 'Clear search to try again' },
},
},
clearInputText: {
table: {
defaultValue: { summary: 'Clear Search' },
},
},
loadingMessage: {
table: {
defaultValue: { summary: 'Loading...' },
},
},
noResultsMessage: {
table: {
defaultValue: { summary: 'No results' },
},
},
},
};
export default meta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@ const meta: Meta<typeof MultiInputDateField> = {
errorMessage: { control: 'text' },
hint: { control: 'text' },
requirementLabel: { control: 'text' },
dayLabel: {
table: {
defaultValue: { summary: 'Day' },
},
},
monthLabel: {
table: {
defaultValue: { summary: 'Month' },
},
},
yearLabel: {
table: {
defaultValue: { summary: 'Year' },
},
},
},
args: {
label: 'Enter your date of birth.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ const meta: Meta<typeof Dialog> = {
),
heading: 'Dialog Heading',
},
argTypes: {
ariaCloseLabel: {
table: {
defaultValue: { summary: 'Close modal dialog' },
},
},
},
parameters: {
docs: {
source: {
Expand Down
21 changes: 21 additions & 0 deletions packages/design-system/src/components/Drawer/Drawer.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,27 @@ const meta: Meta<typeof Drawer> = {
disable: true,
},
},
ariaLabel: {
table: {
defaultValue: {
summary: 'Close help drawer',
},
},
},
closeButtonText: {
table: {
defaultValue: {
summary: 'Close',
},
},
},
headingLevel: {
table: {
defaultValue: {
summary: '3',
},
},
},
},
args: {
footerTitle: 'Footer Title',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ const meta: Meta<typeof FilterChip> = {
args: {
label: 'Example Filter Chip',
},
argTypes: {
ariaClearLabel: {
table: {
defaultValue: {
summary: 'Remove',
},
},
},
},
};
export default meta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,43 @@ const meta: Meta<typeof Pagination> = {
currentPage: 1,
totalPages: 15,
},
argTypes: {
ariaLabel: {
table: {
defaultValue: {
summary: 'Pagination results',
},
},
},
endAriaLabel: {
table: {
defaultValue: {
summary: 'Next Page',
},
},
},
endLabelText: {
table: {
defaultValue: {
summary: 'Next',
},
},
},
startAriaLabel: {
table: {
defaultValue: {
summary: 'Previous Page',
},
},
},
startLabelText: {
table: {
defaultValue: {
summary: 'Previous',
},
},
},
},
render: function Component(args) {
const [{ currentPage }, updateArgs] = useArgs();
const handleSetPage = (evt, page) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ const meta: Meta<typeof Review> = {
args: {
headingLevel: '3',
},
argTypes: {
editText: {
table: {
defaultValue: {
summary: 'Edit',
},
},
},
},
};
export default meta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ const meta: Meta<typeof SkipNav> = {
args: {
href: '#main',
},
argTypes: {
children: {
table: {
defaultValue: {
summary: 'Skip to main content',
},
},
},
},
};
export default meta;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[
"ariaClearLabel",
"Screen reader-specific label for the Clear search <button>. Intended to provide a longer, more descriptive explanation of the button's behavior.\nstring",
"-"
"Clear search to try again"
],
[
"autoCompleteLabel",
Expand All @@ -36,7 +36,7 @@
[
"clearInputText",
"Text rendered on the page if clearInput prop is passed. Default is \"Clear search\".\nReactNode",
"-"
"Clear Search"
],
[
"clearSearchButton",
Expand Down Expand Up @@ -91,12 +91,12 @@
[
"loadingMessage",
"Message users will see when the loading prop is passed to Autocomplete.\nReactNode",
"-"
"Loading..."
],
[
"noResultsMessage",
"Message users will see when the items array returns empty and the loading prop is passed to <Autocomplete />.\nReactNode",
"-"
"No results"
],
[
"onChange",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[
"ariaCloseLabel",
"Aria label for the close button\nstring",
"-"
"Close modal dialog"
],
[
"backdropClickExits",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
"ariaLabel",
"Gives more context to screen readers on the Drawer close button.\nstring",
"-"
"Close help drawer"
],
[
"className",
Expand All @@ -12,7 +12,7 @@
[
"closeButtonText",
"ReactNode",
"-"
"Close"
],
[
"closeButtonVariation",
Expand Down Expand Up @@ -47,7 +47,7 @@
[
"headingLevel",
"Heading type to override default <h3>\n\"1\"\n\"2\"\n\"3\"\n\"4\"\n\"5\"",
"\"'3' as const\""
"3"
],
[
"headingRef",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
"ariaClearLabel",
"Labels filter action, i.e., \"Remove.\" For screenreader support.\nstring",
"-"
"Remove"
],
[
"className",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
[
"dayLabel",
"Label for the day field\nReactNode",
"-"
"Day"
],
[
"dayName",
Expand Down Expand Up @@ -117,7 +117,7 @@
[
"monthLabel",
"Label for the month field\nReactNode",
"-"
"Month"
],
[
"monthName",
Expand Down Expand Up @@ -167,7 +167,7 @@
[
"yearLabel",
"Label for the year input field\nReactNode",
"-"
"Year"
],
[
"yearName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
"ariaLabel",
"Defines aria-label on the screen-reader heading for this element, which precedes the page count readout. Since this exists on a <nav> element, the word \"navigation\" should be omitted from this label. Optional.\nstring",
"-"
"Pagination results"
],
[
"className",
Expand All @@ -22,12 +22,12 @@
[
"endAriaLabel",
"Sets custom ARIA label on end navigation. Added for language support. Label structure should be the equivalent of: Next Page. Optional.\nstring",
"-"
"Next Page"
],
[
"endLabelText",
"Sets custom label on end navigation. Added for language support. Optional.\nstring",
"-"
"Next"
],
[
"headingLevel",
Expand Down Expand Up @@ -57,12 +57,12 @@
[
"startAriaLabel",
"Sets custom ARIA label on start navigation. Added for language support. Label structure should be the equivalent of: Previous Page. Optional.\nstring",
"-"
"Previous Page"
],
[
"startLabelText",
"Sets custom label on start navigation. Added for language support. Optional.\nstring",
"-"
"Previous"
],
[
"totalPages*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[
"editText",
"ReactNode",
"-"
"Edit"
],
[
"heading",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
[
"children",
"Skip nav label\nReactNode",
"-"
"Skip to main content"
],
[
"href*",
Expand Down

0 comments on commit 2af3184

Please sign in to comment.