@workday/canvas-kit-docs 11.0.0-alpha.792-next.0 → 11.0.0-alpha.793-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/mdx/preview-react/form-field/examples/AllFields.tsx +10 -8
  2. package/dist/mdx/preview-react/form-field/examples/RefForwarding.tsx +9 -1
  3. package/dist/mdx/preview-react/form-field/examples/ThemedErrors.tsx +9 -1
  4. package/dist/mdx/preview-react/radio/examples/Basic.tsx +6 -1
  5. package/dist/mdx/preview-react/radio/examples/Custom.tsx +21 -4
  6. package/dist/mdx/preview-react/radio/examples/Inverse.tsx +16 -10
  7. package/dist/mdx/preview-react/status-indicator/examples/Emphasis.tsx +7 -1
  8. package/dist/mdx/preview-react/status-indicator/examples/Icon.tsx +7 -1
  9. package/dist/mdx/preview-react/status-indicator/examples/Overflow.tsx +7 -1
  10. package/dist/mdx/preview-react/status-indicator/examples/Variants.tsx +15 -3
  11. package/dist/mdx/react/button/button/examples/Delete.tsx +8 -1
  12. package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +8 -1
  13. package/dist/mdx/react/button/button/examples/HyperlinkInverse.tsx +8 -1
  14. package/dist/mdx/react/button/button/examples/Primary.tsx +8 -1
  15. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +9 -1
  16. package/dist/mdx/react/button/button/examples/Secondary.tsx +8 -1
  17. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +9 -1
  18. package/dist/mdx/react/button/button/examples/Tertiary.tsx +8 -1
  19. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +9 -2
  20. package/dist/mdx/react/checkbox/examples/Indeterminate.tsx +8 -1
  21. package/dist/mdx/react/checkbox/examples/Inverse.tsx +9 -1
  22. package/dist/mdx/react/combobox/examples/Autocomplete.tsx +20 -4
  23. package/dist/mdx/react/icon/examples/AccentIconList.tsx +23 -10
  24. package/dist/mdx/react/icon/examples/AppletIconList.tsx +23 -10
  25. package/dist/mdx/react/icon/examples/IconList.tsx +24 -10
  26. package/dist/mdx/react/icon/examples/Overview.tsx +15 -2
  27. package/dist/mdx/react/loading-dots/examples/Accessible.tsx +12 -7
  28. package/dist/mdx/react/select/examples/Alert.tsx +6 -1
  29. package/dist/mdx/react/select/examples/Basic.tsx +6 -1
  30. package/dist/mdx/react/select/examples/Complex.tsx +6 -1
  31. package/dist/mdx/react/select/examples/Disabled.tsx +6 -1
  32. package/dist/mdx/react/select/examples/DisabledOption.tsx +6 -1
  33. package/dist/mdx/react/select/examples/Error.tsx +6 -1
  34. package/dist/mdx/react/select/examples/FetchingDynamicItems.tsx +7 -1
  35. package/dist/mdx/react/select/examples/InitialSelectedItem.tsx +6 -1
  36. package/dist/mdx/react/select/examples/MenuHeight.tsx +6 -1
  37. package/dist/mdx/react/select/examples/Placeholder.tsx +6 -1
  38. package/dist/mdx/react/select/examples/Required.tsx +6 -1
  39. package/dist/mdx/react/select/examples/WithIcons.tsx +12 -2
  40. package/dist/mdx/react/table/examples/Basic.tsx +8 -2
  41. package/dist/mdx/react/table/examples/BasicWithHeading.tsx +14 -3
  42. package/dist/mdx/react/table/examples/FixedColumn.tsx +21 -17
  43. package/dist/mdx/react/table/examples/RightToLeft.tsx +8 -2
  44. package/package.json +6 -6
@@ -7,17 +7,19 @@ import {Checkbox} from '@workday/canvas-kit-react/checkbox';
7
7
  import {Select} from '@workday/canvas-kit-react/select';
8
8
  import {TextArea} from '@workday/canvas-kit-react/text-area';
9
9
  import {Switch} from '@workday/canvas-kit-react/switch';
10
+ import {calc, createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ flexDirection: 'column',
15
+ gap: calc.subtract(system.space.x6, system.space.x1),
16
+ padding: calc.subtract(system.space.x10, system.space.x1),
17
+ borderRadius: system.space.x1,
18
+ });
10
19
 
11
20
  export default () => {
12
21
  return (
13
- <Flex
14
- cs={{
15
- flexDirection: 'column',
16
- gap: '20px',
17
- padding: '36px',
18
- borderRadius: '4px',
19
- }}
20
- >
22
+ <Flex cs={parentContainerStyles}>
21
23
  <FormField grow>
22
24
  <FormField.Label>First Name</FormField.Label>
23
25
  <FormField.Input as={TextInput} />
@@ -4,6 +4,14 @@ import {Flex} from '@workday/canvas-kit-react/layout';
4
4
  import {SecondaryButton} from '@workday/canvas-kit-react/button';
5
5
  import {TextInput} from '@workday/canvas-kit-react/text-input';
6
6
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
7
+ import {createStyles} from '@workday/canvas-kit-styling';
8
+ import {system} from '@workday/canvas-tokens-web';
9
+
10
+ const parentContainerStyles = createStyles({
11
+ gap: system.space.x1,
12
+ alignItems: 'flex-start',
13
+ flexDirection: 'column',
14
+ });
7
15
 
8
16
  export default () => {
9
17
  const [value, setValue] = React.useState('');
@@ -18,7 +26,7 @@ export default () => {
18
26
  };
19
27
 
20
28
  return (
21
- <Flex gap="xxxs" alignItems="flex-start" flexDirection="column">
29
+ <Flex cs={parentContainerStyles}>
22
30
  <FormField>
23
31
  <FormField.Label>Email</FormField.Label>
24
32
  <FormField.Input as={TextInput} onChange={handleChange} value={value} ref={ref} />
@@ -3,6 +3,12 @@ import {TextInput} from '@workday/canvas-kit-react/text-input';
3
3
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
4
4
  import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
5
5
  import {colors, space} from '@workday/canvas-kit-react/tokens';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const formFieldHintStyles = createStyles({
10
+ paddingTop: system.space.x2,
11
+ });
6
12
 
7
13
  export default () => {
8
14
  const [value, setValue] = React.useState('');
@@ -29,7 +35,9 @@ export default () => {
29
35
  <FormField error={!value ? 'error' : undefined} isRequired={true} orientation="vertical">
30
36
  <FormField.Label>Email</FormField.Label>
31
37
  <FormField.Input as={TextInput} onChange={handleChange} value={value} />
32
- <FormField.Hint paddingTop={space.xxs}>{!value && 'Please enter an email.'}</FormField.Hint>
38
+ <FormField.Hint cs={formFieldHintStyles}>
39
+ {!value && 'Please enter an email.'}
40
+ </FormField.Hint>
33
41
  </FormField>
34
42
  </CanvasProvider>
35
43
  );
@@ -2,6 +2,11 @@ import React from 'react';
2
2
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
4
4
  import {Flex} from '@workday/canvas-kit-react/layout';
5
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
6
+
7
+ const formfieldInputStyles = createStyles({
8
+ width: px2rem(200),
9
+ });
5
10
 
6
11
  export default () => {
7
12
  const [value, setValue] = React.useState<string | number>('deep-dish');
@@ -18,10 +23,10 @@ export default () => {
18
23
  <FormField as="fieldset">
19
24
  <FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
20
25
  <FormField.Input
26
+ cs={formfieldInputStyles}
21
27
  as={RadioGroup}
22
28
  name="pizza-crust"
23
29
  onChange={handleChange}
24
- width="200px"
25
30
  value={value}
26
31
  >
27
32
  <RadioGroup.RadioButton value="deep-dish">Deep dish</RadioGroup.RadioButton>
@@ -2,6 +2,17 @@ import React from 'react';
2
2
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
3
3
  import {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
4
4
  import {Flex} from '@workday/canvas-kit-react/layout';
5
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
6
+ import {base} from '@workday/canvas-tokens-web';
7
+
8
+ const styleOverrides = {
9
+ formfieldInputStyles: createStyles({
10
+ width: px2rem(200),
11
+ }),
12
+ radioGroupLabelTextStyles: createStyles({
13
+ color: base.berrySmoothie400,
14
+ }),
15
+ };
5
16
 
6
17
  export default () => {
7
18
  const [value, setValue] = React.useState<string | number>('deep-dish');
@@ -21,20 +32,26 @@ export default () => {
21
32
  as={RadioGroup}
22
33
  name="pizza-crust-custom"
23
34
  onChange={handleChange}
24
- width="200px"
35
+ cs={styleOverrides.formfieldInputStyles}
25
36
  value={value}
26
37
  >
27
38
  <RadioGroup.Label>
28
39
  <RadioGroup.Label.Input value="deep-dish" />
29
- <RadioGroup.Label.Text color="berrySmoothie400">Deep dish</RadioGroup.Label.Text>
40
+ <RadioGroup.Label.Text cs={styleOverrides.radioGroupLabelTextStyles}>
41
+ Deep dish
42
+ </RadioGroup.Label.Text>
30
43
  </RadioGroup.Label>
31
44
  <RadioGroup.Label>
32
45
  <RadioGroup.Label.Input value="gluten-free" />
33
- <RadioGroup.Label.Text color="berrySmoothie400">Gluten free</RadioGroup.Label.Text>
46
+ <RadioGroup.Label.Text cs={styleOverrides.radioGroupLabelTextStyles}>
47
+ Gluten free
48
+ </RadioGroup.Label.Text>
34
49
  </RadioGroup.Label>
35
50
  <RadioGroup.Label>
36
51
  <RadioGroup.Label.Input value="cauliflower" />
37
- <RadioGroup.Label.Text color="berrySmoothie400">Cauliflower</RadioGroup.Label.Text>
52
+ <RadioGroup.Label.Text cs={styleOverrides.radioGroupLabelTextStyles}>
53
+ Cauliflower
54
+ </RadioGroup.Label.Text>
38
55
  </RadioGroup.Label>
39
56
  </FormField.Input>
40
57
  </FormField>
@@ -2,14 +2,20 @@ import React from 'react';
2
2
  import {Box} from '@workday/canvas-kit-react/layout';
3
3
  import {RadioGroup} from '@workday/canvas-kit-preview-react/radio';
4
4
  import {FormField} from '@workday/canvas-kit-preview-react/form-field';
5
- import {styled, StyledType} from '@workday/canvas-kit-react/common';
6
- import {colors} from '@workday/canvas-kit-react/tokens';
5
+ import {createStyles} from '@workday/canvas-kit-styling';
6
+ import {system} from '@workday/canvas-tokens-web';
7
7
 
8
- const StyledFormField = styled(FormField)<StyledType>({
9
- legend: {
10
- color: colors.frenchVanilla100,
11
- },
12
- });
8
+ const styleOverrides = {
9
+ containerStyles: createStyles({
10
+ backgroundColor: system.color.bg.primary.default,
11
+ padding: system.space.x4,
12
+ }),
13
+ formFieldStyles: createStyles({
14
+ legend: {
15
+ color: system.color.text.inverse,
16
+ },
17
+ }),
18
+ };
13
19
 
14
20
  export default () => {
15
21
  const [value, setValue] = React.useState<string | number>('deep-dish');
@@ -22,8 +28,8 @@ export default () => {
22
28
  };
23
29
 
24
30
  return (
25
- <Box backgroundColor="blueberry400" padding="s">
26
- <StyledFormField as="fieldset">
31
+ <Box cs={styleOverrides.containerStyles}>
32
+ <FormField cs={styleOverrides.formFieldStyles} as="fieldset">
27
33
  <FormField.Label as="legend">Choose Your Pizza Crust</FormField.Label>
28
34
  <FormField.Input as={RadioGroup} name="crust-inverse" onChange={handleChange} value={value}>
29
35
  <RadioGroup.RadioButton variant="inverse" value="deep-dish">
@@ -39,7 +45,7 @@ export default () => {
39
45
  Cauliflower
40
46
  </RadioGroup.RadioButton>
41
47
  </FormField.Input>
42
- </StyledFormField>
48
+ </FormField>
43
49
  </Box>
44
50
  );
45
51
  };
@@ -3,10 +3,16 @@ import React from 'react';
3
3
  import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
4
4
  import {uploadCloudIcon} from '@workday/canvas-system-icons-web';
5
5
  import {Flex} from '@workday/canvas-kit-react/layout';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const parentContainerStyles = createStyles({
10
+ gap: system.space.x4,
11
+ });
6
12
 
7
13
  export default () => {
8
14
  return (
9
- <Flex gap="s">
15
+ <Flex cs={parentContainerStyles}>
10
16
  <StatusIndicator emphasis="high">
11
17
  <StatusIndicator.Icon icon={uploadCloudIcon} />
12
18
  <StatusIndicator.Label>High Emphasis</StatusIndicator.Label>
@@ -3,10 +3,16 @@ import React from 'react';
3
3
  import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
4
4
  import {uploadCloudIcon} from '@workday/canvas-system-icons-web';
5
5
  import {Flex} from '@workday/canvas-kit-react/layout';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const parentContainerStyles = createStyles({
10
+ gap: system.space.x4,
11
+ });
6
12
 
7
13
  export default () => {
8
14
  return (
9
- <Flex gap="s">
15
+ <Flex cs={parentContainerStyles}>
10
16
  <StatusIndicator>
11
17
  <StatusIndicator.Icon aria-label="unpublished" icon={uploadCloudIcon} />
12
18
  <StatusIndicator.Label>Unpublished</StatusIndicator.Label>
@@ -3,11 +3,17 @@ import React from 'react';
3
3
  import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
4
4
  import {uploadCloudIcon} from '@workday/canvas-system-icons-web';
5
5
  import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
6
+ import {calc, createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const statusIndicatorStyles = createStyles({
10
+ maxWidth: calc.add(system.space.x20, system.space.x4),
11
+ });
6
12
 
7
13
  export default () => {
8
14
  return (
9
15
  <OverflowTooltip>
10
- <StatusIndicator tabIndex={0} style={{maxWidth: '6rem'}}>
16
+ <StatusIndicator tabIndex={0} cs={statusIndicatorStyles}>
11
17
  <StatusIndicator.Icon icon={uploadCloudIcon} />
12
18
  <StatusIndicator.Label>
13
19
  Your workbook is currently in process of saving
@@ -3,11 +3,23 @@ import React from 'react';
3
3
  import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
4
4
  import {uploadCloudIcon} from '@workday/canvas-system-icons-web';
5
5
  import {Flex} from '@workday/canvas-kit-react/layout';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const styleOverrides = {
10
+ parentContainerStyles: createStyles({
11
+ gap: system.space.x4,
12
+ flexDirection: 'column',
13
+ }),
14
+ innerContainerStyles: createStyles({
15
+ gap: system.space.x4,
16
+ }),
17
+ };
6
18
 
7
19
  export default () => {
8
20
  return (
9
- <Flex gap="s" flexDirection="column">
10
- <Flex gap="s">
21
+ <Flex cs={styleOverrides.parentContainerStyles}>
22
+ <Flex cs={styleOverrides.innerContainerStyles}>
11
23
  <StatusIndicator>
12
24
  <StatusIndicator.Label>Lorem ipsum dolor</StatusIndicator.Label>
13
25
  <StatusIndicator.Icon icon={uploadCloudIcon} />
@@ -33,7 +45,7 @@ export default () => {
33
45
  <StatusIndicator.Icon icon={uploadCloudIcon} />
34
46
  </StatusIndicator>
35
47
  </Flex>
36
- <Flex gap="s">
48
+ <Flex cs={styleOverrides.innerContainerStyles}>
37
49
  <StatusIndicator emphasis="high">
38
50
  <StatusIndicator.Label>Lorem ipsum dolor</StatusIndicator.Label>
39
51
  <StatusIndicator.Icon icon={uploadCloudIcon} />
@@ -3,9 +3,16 @@ import React from 'react';
3
3
  import {DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import {Flex} from '@workday/canvas-kit-react/layout';
5
5
  import {trashIcon} from '@workday/canvas-system-icons-web';
6
+ import {createStyles} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
8
+
9
+ const parentContainerStyles = createStyles({
10
+ gap: system.space.x4,
11
+ padding: system.space.x4,
12
+ });
6
13
 
7
14
  export default () => (
8
- <Flex gap="s" padding="s">
15
+ <Flex cs={parentContainerStyles}>
9
16
  <DeleteButton>Delete</DeleteButton>
10
17
  <DeleteButton icon={trashIcon} iconPosition="start">
11
18
  Delete
@@ -2,9 +2,16 @@ import React from 'react';
2
2
 
3
3
  import {ExternalHyperlink} from '@workday/canvas-kit-react/button';
4
4
  import {Box} from '@workday/canvas-kit-react/layout';
5
+ import {createStyles} from '@workday/canvas-kit-styling';
6
+ import {system} from '@workday/canvas-tokens-web';
7
+
8
+ const parentContainerStyles = createStyles({
9
+ backgroundColor: system.color.bg.primary.default,
10
+ padding: system.space.x4,
11
+ });
5
12
 
6
13
  export default () => (
7
- <Box backgroundColor="blueberry400" padding="s">
14
+ <Box cs={parentContainerStyles}>
8
15
  <ExternalHyperlink href="https://workday.com" variant="inverse">
9
16
  Hyperlink
10
17
  </ExternalHyperlink>
@@ -2,9 +2,16 @@ import React from 'react';
2
2
 
3
3
  import {Hyperlink} from '@workday/canvas-kit-react/button';
4
4
  import {Box} from '@workday/canvas-kit-react/layout';
5
+ import {createStyles} from '@workday/canvas-kit-styling';
6
+ import {system} from '@workday/canvas-tokens-web';
7
+
8
+ const parentContainerStyles = createStyles({
9
+ backgroundColor: system.color.bg.primary.default,
10
+ padding: system.space.x4,
11
+ });
5
12
 
6
13
  export default () => (
7
- <Box backgroundColor="blueberry400" padding="s">
14
+ <Box cs={parentContainerStyles}>
8
15
  <Hyperlink href="#hyperlink" variant="inverse">
9
16
  Hyperlink
10
17
  </Hyperlink>
@@ -7,9 +7,16 @@ import {
7
7
  relatedActionsVerticalIcon,
8
8
  caretDownIcon,
9
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ padding: system.space.x4,
16
+ });
10
17
 
11
18
  export default () => (
12
- <Flex gap="s" padding="s">
19
+ <Flex cs={parentContainerStyles}>
13
20
  <PrimaryButton>Primary</PrimaryButton>
14
21
  <PrimaryButton icon={plusIcon} iconPosition="start">
15
22
  Primary
@@ -7,9 +7,17 @@ import {
7
7
  relatedActionsVerticalIcon,
8
8
  caretDownIcon,
9
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ backgroundColor: system.color.bg.primary.default,
16
+ padding: system.space.x4,
17
+ });
10
18
 
11
19
  export default () => (
12
- <Flex gap="s" backgroundColor="blueberry400" padding="s">
20
+ <Flex cs={parentContainerStyles}>
13
21
  <PrimaryButton variant="inverse">Primary</PrimaryButton>
14
22
  <PrimaryButton icon={plusIcon} iconPosition="start" variant="inverse">
15
23
  Primary
@@ -7,9 +7,16 @@ import {
7
7
  relatedActionsVerticalIcon,
8
8
  caretDownIcon,
9
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ padding: system.space.x4,
16
+ });
10
17
 
11
18
  export default () => (
12
- <Flex gap="s" padding="s">
19
+ <Flex cs={parentContainerStyles}>
13
20
  <SecondaryButton>Secondary</SecondaryButton>
14
21
  <SecondaryButton icon={plusIcon} iconPosition="start">
15
22
  Secondary
@@ -7,9 +7,17 @@ import {
7
7
  relatedActionsVerticalIcon,
8
8
  caretDownIcon,
9
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ padding: system.space.x4,
16
+ backgroundColor: system.color.bg.primary.default,
17
+ });
10
18
 
11
19
  export default () => (
12
- <Flex gap="s" backgroundColor="blueberry400" padding="s">
20
+ <Flex cs={parentContainerStyles}>
13
21
  <SecondaryButton variant="inverse">Secondary</SecondaryButton>
14
22
  <SecondaryButton icon={plusIcon} variant="inverse">
15
23
  Secondary
@@ -7,9 +7,16 @@ import {
7
7
  relatedActionsVerticalIcon,
8
8
  caretDownIcon,
9
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ padding: system.space.x4,
16
+ });
10
17
 
11
18
  export default () => (
12
- <Flex gap="s" padding="s">
19
+ <Flex cs={parentContainerStyles}>
13
20
  <TertiaryButton>Tertiary</TertiaryButton>
14
21
  <TertiaryButton icon={plusIcon} iconPosition="start">
15
22
  Tertiary
@@ -5,12 +5,19 @@ import {Flex} from '@workday/canvas-kit-react/layout';
5
5
  import {
6
6
  plusIcon,
7
7
  relatedActionsVerticalIcon,
8
- arrowRightIcon,
9
8
  caretDownIcon,
10
9
  } from '@workday/canvas-system-icons-web';
10
+ import {createStyles} from '@workday/canvas-kit-styling';
11
+ import {system} from '@workday/canvas-tokens-web';
12
+
13
+ const parentContainerStyles = createStyles({
14
+ gap: system.space.x4,
15
+ padding: system.space.x4,
16
+ backgroundColor: system.color.bg.primary.default,
17
+ });
11
18
 
12
19
  export default () => (
13
- <Flex gap="s" backgroundColor="blueberry400" padding="s">
20
+ <Flex cs={parentContainerStyles}>
14
21
  <TertiaryButton variant="inverse">Tertiary</TertiaryButton>
15
22
  <TertiaryButton icon={plusIcon} iconPosition="start" variant="inverse">
16
23
  Tertiary
@@ -1,6 +1,13 @@
1
1
  import React from 'react';
2
2
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
3
  import {Box} from '@workday/canvas-kit-react/layout';
4
+ import {createStyles} from '@workday/canvas-kit-styling';
5
+ import {system} from '@workday/canvas-tokens-web';
6
+
7
+ const styleOverrides = createStyles({
8
+ marginInlineLeft: system.space.x8,
9
+ marginTop: system.space.x2,
10
+ });
4
11
 
5
12
  export default () => {
6
13
  const [pizzaChecked, setPizzaChecked] = React.useState(false);
@@ -58,7 +65,7 @@ export default () => {
58
65
  label="Supreme Pizza Toppings"
59
66
  onChange={handlePizzaChange}
60
67
  />
61
- <Box marginLeft="l" marginTop="xxs">
68
+ <Box cs={styleOverrides}>
62
69
  {toppings.map((topping, index) => (
63
70
  <Checkbox
64
71
  checked={topping.checked}
@@ -1,6 +1,14 @@
1
1
  import React from 'react';
2
2
  import {Checkbox} from '@workday/canvas-kit-react/checkbox';
3
3
  import {Flex} from '@workday/canvas-kit-react/layout';
4
+ import {createStyles} from '@workday/canvas-kit-styling';
5
+ import {system} from '@workday/canvas-tokens-web';
6
+
7
+ const styleOverrides = createStyles({
8
+ gap: system.space.x4,
9
+ backgroundColor: system.color.bg.primary.default,
10
+ padding: system.space.x4,
11
+ });
4
12
 
5
13
  export default () => {
6
14
  const [checked, setChecked] = React.useState(false);
@@ -10,7 +18,7 @@ export default () => {
10
18
  };
11
19
 
12
20
  return (
13
- <Flex gap="s" backgroundColor="blueberry400" padding="s">
21
+ <Flex cs={styleOverrides}>
14
22
  <Checkbox
15
23
  variant="inverse"
16
24
  checked={checked}
@@ -17,6 +17,8 @@ import {FormField} from '@workday/canvas-kit-preview-react/form-field';
17
17
  import {StyledMenuItem} from '@workday/canvas-kit-react/menu';
18
18
  import {LoadingDots} from '@workday/canvas-kit-react/loading-dots';
19
19
  import {InputGroup, TextInput} from '@workday/canvas-kit-react/text-input';
20
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
21
+ import {system} from '@workday/canvas-tokens-web';
20
22
 
21
23
  const colors = ['Red', 'Blue', 'Purple', 'Green', 'Pink'];
22
24
  const fruits = ['Apple', 'Orange', 'Banana', 'Grape', 'Lemon', 'Lime'];
@@ -44,6 +46,20 @@ const AutoCompleteInput = createSubcomponent(TextInput)({
44
46
  return <Combobox.Input as={Element} {...elemProps} />;
45
47
  });
46
48
 
49
+ const styleOverrides = {
50
+ inputGroupInner: createStyles({
51
+ width: px2rem(20),
52
+ transition: 'opacity 100ms ease',
53
+ }),
54
+ loadingDots: createStyles({
55
+ display: 'flex',
56
+ transform: 'scale(0.3)',
57
+ }),
58
+ comboboxMenuList: createStyles({
59
+ maxHeight: px2rem(200),
60
+ }),
61
+ };
62
+
47
63
  export default () => {
48
64
  const {model, loader} = useComboboxLoader(
49
65
  {
@@ -95,12 +111,12 @@ export default () => {
95
111
  <InputGroup>
96
112
  <InputGroup.Input as={FormField.Input.as(AutoCompleteInput)} />
97
113
  <InputGroup.InnerEnd
114
+ cs={styleOverrides.inputGroupInner}
98
115
  pointerEvents="none"
99
- style={{opacity: loader.isLoading ? 1 : 0, transition: 'opacity 100ms ease'}}
100
- width={20}
116
+ style={{opacity: loader.isLoading ? system.opacity.full : system.opacity.zero}}
101
117
  data-loading={loader.isLoading}
102
118
  >
103
- <LoadingDots style={{display: 'flex', transform: 'scale(0.3)'}} />
119
+ <LoadingDots cs={styleOverrides.loadingDots} />
104
120
  </InputGroup.InnerEnd>
105
121
  <InputGroup.InnerEnd>
106
122
  <InputGroup.ClearButton data-testid="clear" />
@@ -112,7 +128,7 @@ export default () => {
112
128
  <StyledMenuItem as="span">No Results Found</StyledMenuItem>
113
129
  )}
114
130
  {model.state.items.length > 0 && (
115
- <Combobox.Menu.List maxHeight={200}>
131
+ <Combobox.Menu.List cs={styleOverrides.comboboxMenuList}>
116
132
  {item => <Combobox.Menu.Item>{item}</Combobox.Menu.Item>}
117
133
  </Combobox.Menu.List>
118
134
  )}
@@ -3,11 +3,31 @@ import * as CanvasAccenttIcons from '@workday/canvas-accent-icons-web';
3
3
  import {Box, Flex} from '@workday/canvas-kit-react/layout';
4
4
  import {AccentIcon} from '@workday/canvas-kit-react/icon';
5
5
  import {TextInput} from '@workday/canvas-kit-react/text-input';
6
+ import {createStyles, px2rem} from '@workday/canvas-kit-styling';
7
+ import {system} from '@workday/canvas-tokens-web';
6
8
 
7
9
  const ImportedIcons = Object.keys(CanvasAccenttIcons);
8
10
 
9
11
  const allIcons = ImportedIcons.filter(icon => icon !== 'CanvasAccenttIcons');
10
12
 
13
+ const styleOverrides = {
14
+ parentContainer: createStyles({
15
+ flexDirection: 'column',
16
+ alignItems: 'center',
17
+ gap: system.space.x6,
18
+ }),
19
+ iconGroupContainer: createStyles({
20
+ flexWrap: 'wrap',
21
+ }),
22
+ individualIconContainer: createStyles({
23
+ alignItems: 'center',
24
+ width: `max(${px2rem(320)},20%)`,
25
+ flexDirection: 'row',
26
+ gap: system.space.x3,
27
+ padding: system.space.x3,
28
+ }),
29
+ };
30
+
11
31
  export default () => {
12
32
  const [value, setValue] = React.useState('');
13
33
 
@@ -16,9 +36,9 @@ export default () => {
16
36
  };
17
37
 
18
38
  return (
19
- <Flex flexDirection="column" alignItems="center" gap="m">
39
+ <Flex cs={styleOverrides.parentContainer}>
20
40
  <TextInput onKeyDown={e => handleSearch(e)} placeholder="Search for an icon" />
21
- <Flex flexWrap="wrap">
41
+ <Flex cs={styleOverrides.iconGroupContainer}>
22
42
  {allIcons
23
43
  .filter(icon => {
24
44
  if (value === '') {
@@ -29,14 +49,7 @@ export default () => {
29
49
  })
30
50
  .map((singleIcon, index) => {
31
51
  return (
32
- <Flex
33
- alignItems="center"
34
- width={'max(320px,20%)'}
35
- flexDirection="row"
36
- gap="xs"
37
- padding="xs"
38
- key={index}
39
- >
52
+ <Flex cs={styleOverrides.individualIconContainer} key={index}>
40
53
  <Box>
41
54
  <AccentIcon icon={CanvasAccenttIcons[singleIcon]} />
42
55
  </Box>