From 070809e4bfc437a7aa1d596b6b22165a1d774c93 Mon Sep 17 00:00:00 2001 From: "josh.bagwell" Date: Mon, 6 May 2024 17:44:25 -0600 Subject: [PATCH] chore: Updated examples to remove style props --- .../form-field/stories/examples/AllFields.tsx | 18 +++++---- .../stories/examples/RefForwarding.tsx | 10 ++++- .../stories/examples/ThemedErrors.tsx | 10 ++++- .../radio/stories/examples/Basic.tsx | 7 +++- .../radio/stories/examples/Custom.tsx | 25 +++++++++++-- .../radio/stories/examples/Inverse.tsx | 9 ++++- .../stories/examples/Emphasis.tsx | 8 +++- .../stories/examples/Icon.tsx | 8 +++- .../stories/examples/Overflow.tsx | 8 +++- .../stories/examples/Variants.tsx | 18 +++++++-- .../button/stories/button/examples/Delete.tsx | 9 ++++- .../examples/ExternalHyperlinkInverse.tsx | 9 ++++- .../button/examples/HyperlinkInverse.tsx | 9 ++++- .../stories/button/examples/Primary.tsx | 9 ++++- .../button/examples/PrimaryInverse.tsx | 10 ++++- .../stories/button/examples/Secondary.tsx | 9 ++++- .../button/examples/SecondaryInverse.tsx | 10 ++++- .../stories/button/examples/Tertiary.tsx | 9 ++++- .../button/examples/TertiaryInverse.tsx | 10 ++++- .../stories/examples/Indeterminate.tsx | 9 ++++- .../checkbox/stories/examples/Inverse.tsx | 10 ++++- .../stories/examples/Autocomplete.tsx | 23 ++++++++++-- .../icon/stories/examples/AccentIconList.tsx | 33 ++++++++++++----- .../icon/stories/examples/AppletIconList.tsx | 33 ++++++++++++----- .../react/icon/stories/examples/IconList.tsx | 34 ++++++++++++----- .../react/icon/stories/examples/Overview.tsx | 17 ++++++++- .../stories/examples/Accessible.tsx | 17 ++++++--- .../react/select/stories/examples/Alert.tsx | 7 +++- .../react/select/stories/examples/Basic.tsx | 7 +++- .../react/select/stories/examples/Complex.tsx | 7 +++- .../select/stories/examples/Disabled.tsx | 7 +++- .../stories/examples/DisabledOption.tsx | 7 +++- .../react/select/stories/examples/Error.tsx | 7 +++- .../stories/examples/FetchingDynamicItems.tsx | 8 +++- .../stories/examples/InitialSelectedItem.tsx | 7 +++- .../select/stories/examples/MenuHeight.tsx | 7 +++- .../select/stories/examples/Placeholder.tsx | 7 +++- .../select/stories/examples/Required.tsx | 7 +++- .../select/stories/examples/WithIcons.tsx | 14 ++++++- .../react/table/stories/examples/Basic.tsx | 10 ++++- .../stories/examples/BasicWithHeading.tsx | 17 +++++++-- .../table/stories/examples/FixedColumn.tsx | 37 +++++++++++-------- .../table/stories/examples/RightToLeft.tsx | 10 ++++- 43 files changed, 436 insertions(+), 111 deletions(-) diff --git a/modules/preview-react/form-field/stories/examples/AllFields.tsx b/modules/preview-react/form-field/stories/examples/AllFields.tsx index fb8376c5f2..6251291a48 100644 --- a/modules/preview-react/form-field/stories/examples/AllFields.tsx +++ b/modules/preview-react/form-field/stories/examples/AllFields.tsx @@ -7,17 +7,19 @@ import {Checkbox} from '@workday/canvas-kit-react/checkbox'; import {Select} from '@workday/canvas-kit-react/select'; import {TextArea} from '@workday/canvas-kit-react/text-area'; import {Switch} from '@workday/canvas-kit-react/switch'; +import {calc, createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', + gap: calc.subtract(system.space.x6, system.space.x1), + padding: calc.subtract(system.space.x10, system.space.x1), + borderRadius: system.space.x1, +}); export const AllFields = () => { return ( - + First Name diff --git a/modules/preview-react/form-field/stories/examples/RefForwarding.tsx b/modules/preview-react/form-field/stories/examples/RefForwarding.tsx index f86bd9fe38..e8be6a685f 100644 --- a/modules/preview-react/form-field/stories/examples/RefForwarding.tsx +++ b/modules/preview-react/form-field/stories/examples/RefForwarding.tsx @@ -4,6 +4,14 @@ import {Flex} from '@workday/canvas-kit-react/layout'; import {SecondaryButton} from '@workday/canvas-kit-react/button'; import {TextInput} from '@workday/canvas-kit-react/text-input'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x1, + alignItems: 'flex-start', + flexDirection: 'column', +}); export const RefForwarding = () => { const [value, setValue] = React.useState(''); @@ -18,7 +26,7 @@ export const RefForwarding = () => { }; return ( - + Email diff --git a/modules/preview-react/form-field/stories/examples/ThemedErrors.tsx b/modules/preview-react/form-field/stories/examples/ThemedErrors.tsx index 1e15ab38a4..5a4ecc0ef4 100644 --- a/modules/preview-react/form-field/stories/examples/ThemedErrors.tsx +++ b/modules/preview-react/form-field/stories/examples/ThemedErrors.tsx @@ -3,6 +3,12 @@ import {TextInput} from '@workday/canvas-kit-react/text-input'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common'; import {colors, space} from '@workday/canvas-kit-react/tokens'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const formFieldHintStyles = createStyles({ + paddingTop: system.space.x2, +}); export const ThemedError = () => { const [value, setValue] = React.useState(''); @@ -29,7 +35,9 @@ export const ThemedError = () => { Email - {!value && 'Please enter an email.'} + + {!value && 'Please enter an email.'} + ); diff --git a/modules/preview-react/radio/stories/examples/Basic.tsx b/modules/preview-react/radio/stories/examples/Basic.tsx index e09b4be6f8..a0b1e2d331 100644 --- a/modules/preview-react/radio/stories/examples/Basic.tsx +++ b/modules/preview-react/radio/stories/examples/Basic.tsx @@ -2,6 +2,11 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {RadioGroup} from '@workday/canvas-kit-preview-react/radio'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const formfieldInputStyles = createStyles({ + width: '200px', +}); export const Basic = () => { const [value, setValue] = React.useState('deep-dish'); @@ -18,10 +23,10 @@ export const Basic = () => { Choose Your Pizza Crust Deep dish diff --git a/modules/preview-react/radio/stories/examples/Custom.tsx b/modules/preview-react/radio/stories/examples/Custom.tsx index 74df7932ca..e8748131d2 100644 --- a/modules/preview-react/radio/stories/examples/Custom.tsx +++ b/modules/preview-react/radio/stories/examples/Custom.tsx @@ -2,6 +2,17 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {RadioGroup} from '@workday/canvas-kit-preview-react/radio'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base} from '@workday/canvas-tokens-web'; + +const styleOverrides = { + formfieldInputStyles: createStyles({ + width: '200px', + }), + radioGroupLabelTextStyles: createStyles({ + color: base.berrySmoothie400, + }), +}; export const Custom = () => { const [value, setValue] = React.useState('deep-dish'); @@ -21,20 +32,26 @@ export const Custom = () => { as={RadioGroup} name="pizza-crust-custom" onChange={handleChange} - width="200px" + cs={styleOverrides.formfieldInputStyles} value={value} > - Deep dish + + Deep dish + - Gluten free + + Gluten free + - Cauliflower + + Cauliflower + diff --git a/modules/preview-react/radio/stories/examples/Inverse.tsx b/modules/preview-react/radio/stories/examples/Inverse.tsx index 2405e731a3..9eff7afe82 100644 --- a/modules/preview-react/radio/stories/examples/Inverse.tsx +++ b/modules/preview-react/radio/stories/examples/Inverse.tsx @@ -4,6 +4,8 @@ import {RadioGroup} from '@workday/canvas-kit-preview-react/radio'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {styled, StyledType} from '@workday/canvas-kit-react/common'; import {colors} from '@workday/canvas-kit-react/tokens'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; const StyledFormField = styled(FormField)({ legend: { @@ -11,6 +13,11 @@ const StyledFormField = styled(FormField)({ }, }); +const parentContainerStyles = createStyles({ + backgroundColor: base.blueberry400, + padding: system.space.x4, +}); + export const Inverse = () => { const [value, setValue] = React.useState('deep-dish'); @@ -22,7 +29,7 @@ export const Inverse = () => { }; return ( - + Choose Your Pizza Crust diff --git a/modules/preview-react/status-indicator/stories/examples/Emphasis.tsx b/modules/preview-react/status-indicator/stories/examples/Emphasis.tsx index 7a1774afb0..4baedca4a9 100644 --- a/modules/preview-react/status-indicator/stories/examples/Emphasis.tsx +++ b/modules/preview-react/status-indicator/stories/examples/Emphasis.tsx @@ -3,10 +3,16 @@ import React from 'react'; import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator'; import {uploadCloudIcon} from '@workday/canvas-system-icons-web'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, +}); export const Emphasis = () => { return ( - + High Emphasis diff --git a/modules/preview-react/status-indicator/stories/examples/Icon.tsx b/modules/preview-react/status-indicator/stories/examples/Icon.tsx index 8c79898e11..84f599f862 100644 --- a/modules/preview-react/status-indicator/stories/examples/Icon.tsx +++ b/modules/preview-react/status-indicator/stories/examples/Icon.tsx @@ -3,10 +3,16 @@ import React from 'react'; import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator'; import {uploadCloudIcon} from '@workday/canvas-system-icons-web'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, +}); export const Icon = () => { return ( - + Unpublished diff --git a/modules/preview-react/status-indicator/stories/examples/Overflow.tsx b/modules/preview-react/status-indicator/stories/examples/Overflow.tsx index d54e3b9cfa..9704e43beb 100644 --- a/modules/preview-react/status-indicator/stories/examples/Overflow.tsx +++ b/modules/preview-react/status-indicator/stories/examples/Overflow.tsx @@ -3,11 +3,17 @@ import React from 'react'; import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator'; import {uploadCloudIcon} from '@workday/canvas-system-icons-web'; import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip'; +import {calc, createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const statusIndicatorStyles = createStyles({ + maxWidth: calc.add(system.space.x20, system.space.x4), +}); export const Overflow = () => { return ( - + Your workbook is currently in process of saving diff --git a/modules/preview-react/status-indicator/stories/examples/Variants.tsx b/modules/preview-react/status-indicator/stories/examples/Variants.tsx index 962a6b5c0c..1c52e9eeaa 100644 --- a/modules/preview-react/status-indicator/stories/examples/Variants.tsx +++ b/modules/preview-react/status-indicator/stories/examples/Variants.tsx @@ -3,11 +3,23 @@ import React from 'react'; import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator'; import {uploadCloudIcon} from '@workday/canvas-system-icons-web'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const styleOverrides = { + parentContainerStyles: createStyles({ + gap: system.space.x4, + flexDirection: 'column', + }), + innerContainerStyles: createStyles({ + gap: system.space.x4, + }), +}; export const Variants = () => { return ( - - + + Lorem ipsum dolor @@ -33,7 +45,7 @@ export const Variants = () => { - + Lorem ipsum dolor diff --git a/modules/react/button/stories/button/examples/Delete.tsx b/modules/react/button/stories/button/examples/Delete.tsx index 1d11e34ed8..0d71a82204 100644 --- a/modules/react/button/stories/button/examples/Delete.tsx +++ b/modules/react/button/stories/button/examples/Delete.tsx @@ -3,9 +3,16 @@ import React from 'react'; import {DeleteButton} from '@workday/canvas-kit-react/button'; import {Flex} from '@workday/canvas-kit-react/layout'; import {trashIcon} from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, +}); export const Delete = () => ( - + Delete Delete diff --git a/modules/react/button/stories/button/examples/ExternalHyperlinkInverse.tsx b/modules/react/button/stories/button/examples/ExternalHyperlinkInverse.tsx index 7ee9aef6f0..ce11a6c5fc 100644 --- a/modules/react/button/stories/button/examples/ExternalHyperlinkInverse.tsx +++ b/modules/react/button/stories/button/examples/ExternalHyperlinkInverse.tsx @@ -2,9 +2,16 @@ import React from 'react'; import {ExternalHyperlink} from '@workday/canvas-kit-react/button'; import {Box} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + backgroundColor: base.blueberry400, + padding: system.space.x4, +}); export const ExternalLinkInverse = () => ( - + Hyperlink diff --git a/modules/react/button/stories/button/examples/HyperlinkInverse.tsx b/modules/react/button/stories/button/examples/HyperlinkInverse.tsx index af0790264a..6de3cab294 100644 --- a/modules/react/button/stories/button/examples/HyperlinkInverse.tsx +++ b/modules/react/button/stories/button/examples/HyperlinkInverse.tsx @@ -2,9 +2,16 @@ import React from 'react'; import {Hyperlink} from '@workday/canvas-kit-react/button'; import {Box} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + backgroundColor: base.blueberry400, + padding: system.space.x4, +}); export const LinkInverse = () => ( - + Hyperlink diff --git a/modules/react/button/stories/button/examples/Primary.tsx b/modules/react/button/stories/button/examples/Primary.tsx index ede4ef219f..f7597c68d0 100644 --- a/modules/react/button/stories/button/examples/Primary.tsx +++ b/modules/react/button/stories/button/examples/Primary.tsx @@ -7,9 +7,16 @@ import { relatedActionsVerticalIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, +}); export const Primary = () => ( - + Primary Primary diff --git a/modules/react/button/stories/button/examples/PrimaryInverse.tsx b/modules/react/button/stories/button/examples/PrimaryInverse.tsx index c0589600b7..f91b81f897 100644 --- a/modules/react/button/stories/button/examples/PrimaryInverse.tsx +++ b/modules/react/button/stories/button/examples/PrimaryInverse.tsx @@ -7,9 +7,17 @@ import { relatedActionsVerticalIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + backgroundColor: base.blueberry400, + padding: system.space.x4, +}); export const PrimaryInverse = () => ( - + Primary Primary diff --git a/modules/react/button/stories/button/examples/Secondary.tsx b/modules/react/button/stories/button/examples/Secondary.tsx index cdeafc8c8c..466454826a 100644 --- a/modules/react/button/stories/button/examples/Secondary.tsx +++ b/modules/react/button/stories/button/examples/Secondary.tsx @@ -7,9 +7,16 @@ import { relatedActionsVerticalIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, +}); export const Secondary = () => ( - + Secondary Secondary diff --git a/modules/react/button/stories/button/examples/SecondaryInverse.tsx b/modules/react/button/stories/button/examples/SecondaryInverse.tsx index 4fa8bbc4fd..2a87814939 100644 --- a/modules/react/button/stories/button/examples/SecondaryInverse.tsx +++ b/modules/react/button/stories/button/examples/SecondaryInverse.tsx @@ -7,9 +7,17 @@ import { relatedActionsVerticalIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, + backgroundColor: base.blueberry400, +}); export const SecondaryInverse = () => ( - + Secondary Secondary diff --git a/modules/react/button/stories/button/examples/Tertiary.tsx b/modules/react/button/stories/button/examples/Tertiary.tsx index 40504b4dfd..f2f8c3e7c2 100644 --- a/modules/react/button/stories/button/examples/Tertiary.tsx +++ b/modules/react/button/stories/button/examples/Tertiary.tsx @@ -7,9 +7,16 @@ import { relatedActionsVerticalIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, +}); export const Tertiary = () => ( - + Tertiary Tertiary diff --git a/modules/react/button/stories/button/examples/TertiaryInverse.tsx b/modules/react/button/stories/button/examples/TertiaryInverse.tsx index d82dfc0e80..a8a2996d72 100644 --- a/modules/react/button/stories/button/examples/TertiaryInverse.tsx +++ b/modules/react/button/stories/button/examples/TertiaryInverse.tsx @@ -8,9 +8,17 @@ import { arrowRightIcon, caretDownIcon, } from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; + +const parentContainerStyles = createStyles({ + gap: system.space.x4, + padding: system.space.x4, + backgroundColor: base.blueberry400, +}); export const TertiaryInverse = () => ( - + Tertiary Tertiary diff --git a/modules/react/checkbox/stories/examples/Indeterminate.tsx b/modules/react/checkbox/stories/examples/Indeterminate.tsx index 27e776b163..e731fef97b 100644 --- a/modules/react/checkbox/stories/examples/Indeterminate.tsx +++ b/modules/react/checkbox/stories/examples/Indeterminate.tsx @@ -1,6 +1,13 @@ import React from 'react'; import {Checkbox} from '@workday/canvas-kit-react/checkbox'; import {Box} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; + +const styleOverrides = createStyles({ + marginLeft: system.space.x8, + marginTop: system.space.x2, +}); export const Indeterminate = () => { const [pizzaChecked, setPizzaChecked] = React.useState(false); @@ -58,7 +65,7 @@ export const Indeterminate = () => { label="Supreme Pizza Toppings" onChange={handlePizzaChange} /> - + {toppings.map((topping, index) => ( { const [checked, setChecked] = React.useState(false); @@ -10,7 +18,7 @@ export const Inverse = () => { }; return ( - + ; }); +const styleOverrides = { + inputGroupInner: createStyles({ + width: 20, + transition: 'opacity 100ms ease', + }), + loadingDots: createStyles({ + display: 'flex', + transform: 'scale(0.3)', + }), + comboboxMenuList: createStyles({ + maxHeight: 200, + }), +}; + export const Autocomplete = () => { const {model, loader} = useComboboxLoader( { @@ -95,12 +110,12 @@ export const Autocomplete = () => { - + @@ -112,7 +127,7 @@ export const Autocomplete = () => { No Results Found )} {model.state.items.length > 0 && ( - + {item => {item}} )} diff --git a/modules/react/icon/stories/examples/AccentIconList.tsx b/modules/react/icon/stories/examples/AccentIconList.tsx index 20cf7c5fe2..40eb28a833 100644 --- a/modules/react/icon/stories/examples/AccentIconList.tsx +++ b/modules/react/icon/stories/examples/AccentIconList.tsx @@ -3,11 +3,31 @@ import * as CanvasAccenttIcons from '@workday/canvas-accent-icons-web'; import {Box, Flex} from '@workday/canvas-kit-react/layout'; import {AccentIcon} from '@workday/canvas-kit-react/icon'; import {TextInput} from '@workday/canvas-kit-react/text-input'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; const ImportedIcons = Object.keys(CanvasAccenttIcons); const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasAccenttIcons'); +const styleOverrides = { + parentContainer: createStyles({ + flexDirection: 'column', + alignItems: 'center', + gap: system.space.x6, + }), + firstChildContainer: createStyles({ + flexWrap: 'wrap', + }), + secondChildContainer: createStyles({ + alignItems: 'center', + width: `max(320px,20%)`, + flexDirection: 'row', + gap: system.space.x3, + padding: system.space.x3, + }), +}; + export const AccentIconList = () => { const [value, setValue] = React.useState(''); @@ -16,9 +36,9 @@ export const AccentIconList = () => { }; return ( - + handleSearch(e)} placeholder="Search for an icon" /> - + {allIcons .filter(icon => { if (value === '') { @@ -29,14 +49,7 @@ export const AccentIconList = () => { }) .map((singleIcon, index) => { return ( - + diff --git a/modules/react/icon/stories/examples/AppletIconList.tsx b/modules/react/icon/stories/examples/AppletIconList.tsx index f8cac5d872..b14a088b6f 100644 --- a/modules/react/icon/stories/examples/AppletIconList.tsx +++ b/modules/react/icon/stories/examples/AppletIconList.tsx @@ -3,11 +3,31 @@ import * as CanvasAppletIcons from '@workday/canvas-applet-icons-web'; import {Box, Flex} from '@workday/canvas-kit-react/layout'; import {AppletIcon} from '@workday/canvas-kit-react/icon'; import {TextInput} from '@workday/canvas-kit-react/text-input'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; const ImportedIcons = Object.keys(CanvasAppletIcons); const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasAppletIcons'); +const styleOverrides = { + parentContainer: createStyles({ + flexDirection: 'column', + alignItems: 'center', + gap: system.space.x6, + }), + firstChildContainer: createStyles({ + flexWrap: 'wrap', + }), + secondChildContainer: createStyles({ + alignItems: 'center', + width: `max(320px,20%)`, + flexDirection: 'row', + gap: system.space.x3, + padding: system.space.x3, + }), +}; + export const AppletIconList = () => { const [value, setValue] = React.useState(''); @@ -16,9 +36,9 @@ export const AppletIconList = () => { }; return ( - + handleSearch(e)} placeholder="Search for an icon" /> - + {allIcons .filter(icon => { if (value === '') { @@ -29,14 +49,7 @@ export const AppletIconList = () => { }) .map((singleIcon, index) => { return ( - + diff --git a/modules/react/icon/stories/examples/IconList.tsx b/modules/react/icon/stories/examples/IconList.tsx index 041383a6cd..f7cc6265a2 100644 --- a/modules/react/icon/stories/examples/IconList.tsx +++ b/modules/react/icon/stories/examples/IconList.tsx @@ -3,10 +3,31 @@ import * as CanvasIcons from '@workday/canvas-system-icons-web'; import {Box, Flex} from '@workday/canvas-kit-react/layout'; import {SystemIcon} from '@workday/canvas-kit-react/icon'; import {TextInput} from '@workday/canvas-kit-react/text-input'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {system} from '@workday/canvas-tokens-web'; const ImportedIcons = Object.keys(CanvasIcons); const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasSystemIcons'); + +const styleOverrides = { + parentContainer: createStyles({ + flexDirection: 'column', + alignItems: 'center', + gap: system.space.x6, + }), + firstChildContainer: createStyles({ + flexWrap: 'wrap', + }), + secondChildContainer: createStyles({ + alignItems: 'center', + width: `max(320px,20%)`, + flexDirection: 'row', + gap: system.space.x3, + padding: system.space.x3, + }), +}; + export const SystemIconList = () => { const [value, setValue] = React.useState(''); @@ -15,9 +36,9 @@ export const SystemIconList = () => { }; return ( - + handleSearch(e)} placeholder="Search for an icon" /> - + {allIcons .filter(icon => { if (value === '') { @@ -28,14 +49,7 @@ export const SystemIconList = () => { }) .map((singleIcon, index) => { return ( - + diff --git a/modules/react/icon/stories/examples/Overview.tsx b/modules/react/icon/stories/examples/Overview.tsx index 08efeb65ed..3a4c389fce 100644 --- a/modules/react/icon/stories/examples/Overview.tsx +++ b/modules/react/icon/stories/examples/Overview.tsx @@ -8,6 +8,8 @@ import {CanvasGraphic, CanvasIconTypes} from '@workday/design-assets-types'; import {AccentIcon, AppletIcon, SystemIcon, SystemIconCircle, Graphic} from '../../index'; import {activityStreamIcon} from '@workday/canvas-system-icons-web'; +import {createStyles} from '@workday/canvas-kit-styling'; +import {base, system} from '@workday/canvas-tokens-web'; const graphicExample: CanvasGraphic = { name: 'badgeAchievement', @@ -18,11 +20,22 @@ const graphicExample: CanvasGraphic = { tags: [], }; +const styleOverrides = { + container: createStyles({ + flexDirection: 'row', + alignItems: 'center', + gap: system.space.x4, + }), + systemIconStyles: createStyles({ + background: base.berrySmoothie100, + }), +}; + export const Overview = () => ( - + - + diff --git a/modules/react/loading-dots/stories/examples/Accessible.tsx b/modules/react/loading-dots/stories/examples/Accessible.tsx index 5583647cd6..3417ad3f69 100644 --- a/modules/react/loading-dots/stories/examples/Accessible.tsx +++ b/modules/react/loading-dots/stories/examples/Accessible.tsx @@ -6,10 +6,15 @@ import {SecondaryButton} from '@workday/canvas-kit-react/button'; import {createStyles, cssVar} from '@workday/canvas-kit-styling'; import {AccessibleHide, AriaLiveRegion} from '@workday/canvas-kit-react/common'; -const loadingStyles = createStyles({ - backgroundColor: base.licorice300, - padding: system.space.x3, -}); +const styleOverrides = { + parentContainer: createStyles({ + gap: system.space.x4, + }), + loadingStyles: createStyles({ + backgroundColor: base.licorice300, + padding: system.space.x3, + }), +}; export const Accessible = () => { const [loadingState, setLoadingState] = React.useState('idle'); @@ -31,11 +36,11 @@ export const Accessible = () => { }; return ( - + Start {loadingState === 'loading' && ( - + )} {loadingState === 'success' && Complete.} diff --git a/modules/react/select/stories/examples/Alert.tsx b/modules/react/select/stories/examples/Alert.tsx index f1b5595254..b1ecd30947 100644 --- a/modules/react/select/stories/examples/Alert.tsx +++ b/modules/react/select/stories/examples/Alert.tsx @@ -2,6 +2,11 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {Select} from '@workday/canvas-kit-react/select'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', +}); const options = [ 'E-mail', @@ -19,7 +24,7 @@ export const Alert = () => { setValue(event.target.value); }; return ( - + Contact diff --git a/modules/react/select/stories/examples/Complex.tsx b/modules/react/select/stories/examples/Complex.tsx index 5fcdfda574..84789ebe5f 100644 --- a/modules/react/select/stories/examples/Complex.tsx +++ b/modules/react/select/stories/examples/Complex.tsx @@ -2,6 +2,11 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {Select} from '@workday/canvas-kit-react/select'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', +}); const options = [ {serverId: 'email', label: 'E-mail'}, @@ -25,7 +30,7 @@ export const Complex = () => { }; return ( - + Contact diff --git a/modules/react/select/stories/examples/DisabledOption.tsx b/modules/react/select/stories/examples/DisabledOption.tsx index 3d00786355..2c4582a720 100644 --- a/modules/react/select/stories/examples/DisabledOption.tsx +++ b/modules/react/select/stories/examples/DisabledOption.tsx @@ -2,6 +2,11 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {Select} from '@workday/canvas-kit-react/select'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', +}); const options = [ 'E-mail', @@ -20,7 +25,7 @@ export const DisabledOptions = () => { }; return ( - + Contact diff --git a/modules/react/select/stories/examples/FetchingDynamicItems.tsx b/modules/react/select/stories/examples/FetchingDynamicItems.tsx index ea10fa3815..412c0ade97 100644 --- a/modules/react/select/stories/examples/FetchingDynamicItems.tsx +++ b/modules/react/select/stories/examples/FetchingDynamicItems.tsx @@ -4,6 +4,12 @@ import {Select, useSelectModel} from '@workday/canvas-kit-react/select'; import {Flex} from '@workday/canvas-kit-react/layout'; import {PrimaryButton} from '@workday/canvas-kit-react/button'; import {useMount} from '@workday/canvas-kit-react/common'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', + maxWidth: 300, +}); const movieListItems = [ { @@ -68,7 +74,7 @@ export const FetchingDynamicItems = () => { }); return ( - + { handleChange(e)} /> diff --git a/modules/react/select/stories/examples/Required.tsx b/modules/react/select/stories/examples/Required.tsx index 74ea21d250..ddc12909ed 100644 --- a/modules/react/select/stories/examples/Required.tsx +++ b/modules/react/select/stories/examples/Required.tsx @@ -2,6 +2,11 @@ import React from 'react'; import {FormField} from '@workday/canvas-kit-preview-react/form-field'; import {Select} from '@workday/canvas-kit-react/select'; import {Flex} from '@workday/canvas-kit-react/layout'; +import {createStyles} from '@workday/canvas-kit-styling'; + +const parentContainerStyles = createStyles({ + flexDirection: 'column', +}); const options = [ 'E-mail', @@ -20,7 +25,7 @@ export const Required = () => { }; return ( - +