@workday/canvas-kit-docs 5.3.0-next.3 → 5.3.0-next.32

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 (105) hide show
  1. package/LICENSE +1 -1
  2. package/dist/commonjs/lib/specs.js +429 -33
  3. package/dist/es6/lib/specs.js +429 -33
  4. package/dist/mdx/5.0-MIGRATION-GUIDE.mdx +81 -7
  5. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +560 -0
  6. package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
  7. package/dist/mdx/CONTRIBUTING.mdx +90 -63
  8. package/dist/mdx/TESTING.mdx +29 -5
  9. package/dist/mdx/labs-react/search-form/SearchForm.mdx +64 -0
  10. package/dist/mdx/labs-react/search-form/examples/Basic.tsx +61 -0
  11. package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +72 -0
  12. package/dist/mdx/labs-react/search-form/examples/Grow.tsx +62 -0
  13. package/dist/mdx/labs-react/search-form/examples/PropTables.splitProps.tsx +4 -0
  14. package/dist/mdx/labs-react/search-form/examples/RTL.tsx +70 -0
  15. package/dist/mdx/labs-react/search-form/examples/Theming.tsx +64 -0
  16. package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
  17. package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
  18. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
  19. package/dist/mdx/preview-react/menu/Menu.mdx +17 -9
  20. package/dist/mdx/preview-react/menu/examples/Basic.tsx +65 -10
  21. package/dist/mdx/preview-react/menu/examples/ContextMenu.tsx +47 -29
  22. package/dist/mdx/preview-react/menu/examples/CustomMenuItem.tsx +2 -2
  23. package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
  24. package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +2 -2
  25. package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
  26. package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
  27. package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
  28. package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
  29. package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
  30. package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
  31. package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
  32. package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
  33. package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
  34. package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
  35. package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
  36. package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
  37. package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
  38. package/dist/mdx/preview-react/text-input/TextInput.mdx +145 -0
  39. package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
  40. package/dist/mdx/preview-react/text-input/examples/Basic.tsx +17 -0
  41. package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
  42. package/dist/mdx/preview-react/text-input/examples/Error.tsx +40 -0
  43. package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
  44. package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
  45. package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
  46. package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
  47. package/dist/mdx/preview-react/text-input/examples/LoginForm.tsx +105 -0
  48. package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
  49. package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
  50. package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +28 -0
  51. package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
  52. package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
  53. package/dist/mdx/preview-react/text-input/examples/ThemedError.tsx +37 -0
  54. package/dist/mdx/react/_examples/CookieBanner.mdx +8 -0
  55. package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
  56. package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
  57. package/dist/mdx/react/_examples/examples/CookieBanner.tsx +97 -0
  58. package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
  59. package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
  60. package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
  61. package/dist/mdx/react/button/button/Button.mdx +34 -9
  62. package/dist/mdx/react/button/button/examples/Primary.tsx +11 -1
  63. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +14 -0
  64. package/dist/mdx/react/button/button/examples/Secondary.tsx +10 -1
  65. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +14 -0
  66. package/dist/mdx/react/button/button/examples/Tertiary.tsx +10 -1
  67. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +14 -0
  68. package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
  69. package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
  70. package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
  71. package/dist/mdx/react/pagination/PropTables.splitprops.tsx +47 -0
  72. package/dist/mdx/react/pagination/examples/{StepControls.tsx → Basic.tsx} +1 -1
  73. package/dist/mdx/react/pagination/examples/GoToForm.tsx +1 -1
  74. package/dist/mdx/react/pagination/examples/HoistedModel.tsx +36 -22
  75. package/dist/mdx/react/pagination/examples/RTL.tsx +1 -1
  76. package/dist/mdx/react/pagination/pagination.mdx +225 -474
  77. package/dist/mdx/react/popup/Popup.mdx +96 -36
  78. package/dist/mdx/react/popup/examples/FullScreen.tsx +115 -0
  79. package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
  80. package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
  81. package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
  82. package/dist/mdx/react/radio/examples/Error.tsx +3 -3
  83. package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
  84. package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
  85. package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
  86. package/dist/mdx/react/radio/examples/Required.tsx +3 -3
  87. package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
  88. package/dist/mdx/react/tabs/Tabs.mdx +67 -36
  89. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  90. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +82 -38
  91. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  92. package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
  93. package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
  94. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
  95. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  96. package/dist/mdx/react/text-area/TextArea.mdx +1 -1
  97. package/dist/mdx/react/toast/toast.mdx +1 -17
  98. package/dist/mdx/react/tooltip/Tooltip.mdx +9 -1
  99. package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
  100. package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
  101. package/package.json +5 -4
  102. package/dist/mdx/CODE_OF_CONDUCT.md +0 -68
  103. package/dist/mdx/preview-react/menu/examples/ContextMenuTarget.tsx +0 -33
  104. package/dist/mdx/preview-react/menu/examples/ControlButton.tsx +0 -84
  105. package/dist/mdx/react/pagination/examples/ShowAdditionalDetails.tsx +0 -52
@@ -10,6 +10,7 @@ any questions about the update.
10
10
  - [Canvas Kit Preview](#canvas-kit-preview)
11
11
  - [Type Deprecations and Hierarchy Updates](#type-deprecations-and-hierarchy-updates)
12
12
  - [Canvas Kit CSS Maintenance Mode](#canvas-kit-css-maintenance-mode)
13
+ - [Prop Interfaces](#prop-interfaces)
13
14
  - [Component Changes](#component-changes)
14
15
  - [Component Promotions](#component-promotions)
15
16
  - [Core](#core)
@@ -423,6 +424,59 @@ provide more focused support and to dedicate our efforts to making bigger and be
423
424
  our most used components: Canvas Kit React. If you have questions or concerns, please
424
425
  [let us know](https://github.com/Workday/canvas-kit/issues/new?labels=&template=question.md).
425
426
 
427
+ ### Prop Interfaces
428
+
429
+ Many components were updated to be polymorphic using the `createComponent` utility function. Most
430
+ components in Canvas Kit extend from an HTML interface and spread extra props onto the HTML element.
431
+ Since these components are now polymorphic, the exported props no longer extend from an HTML
432
+ interface since the HTML interface is now determined by an optional `as` prop. It is common to wrap
433
+ Canvas Kit components with your own component and extend from the Canvas Kit component's prop
434
+ interface. To support this use-case in addition to polymorphic prop interfaces, `ExtractProp` was
435
+ introduced. `ExtractProp` understands these polymorphic components and will return the base props in
436
+ addition to the HTML interface. There is an optional second argument that can override the default
437
+ HTML interface if your wrapper component uses the `as`.
438
+
439
+ ```tsx
440
+ // v4
441
+ import {TextInput, TextInputProps} from '@workday/canvas-kit-react-text-input';
442
+
443
+ const FancyTextInput: React.FC<TextInputProps> = props => <TextInput {...props} />;
444
+
445
+ // v5
446
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
447
+ import {ExtractProps} from '@workday/canvas-kit-react/common';
448
+
449
+ const FancyTextInput: React.FC<ExtractProps<typeof TextInput>> = props => {};
450
+
451
+ // v5 via createComponent
452
+ import {TextInput} from '@workday/canvas-kit-react/text-input';
453
+ import {createComponent} from '@workday/canvas-kit-react/common';
454
+
455
+ const FancyTextInput = createComponent(TextInput)({
456
+ displayName: 'FancyTextInput',
457
+ Component((props) => <TextInput {...props} />)
458
+ })
459
+ ```
460
+
461
+ Components that made this change:
462
+
463
+ - Button
464
+ - IconButton
465
+ - Card
466
+ - Hyperlink
467
+ - Select
468
+ - TextArea
469
+ - TextInput
470
+ - Checkbox
471
+ - Radio
472
+ - ColorInput
473
+ - ColorPreview
474
+ - Modal
475
+ - Popup
476
+ - Skeleton
477
+ - Tabs
478
+ - Toast
479
+
426
480
  ## Component Changes
427
481
 
428
482
  ### Component Promotions
@@ -799,20 +853,25 @@ Button prop interface and accesses properties like `onClick`, you'll need to pro
799
853
  attribute yourself in order to avoid TypeScript issues (this doesn't affect runtime). This is not
800
854
  code-moddable since intent cannot be pre-determined.
801
855
 
856
+ #### Props
857
+
858
+ The exported props no longer extend from the `HTMLButtonElement` interface. Use
859
+ [ExtractProps](#prop-interfaces) instead.
860
+
802
861
  ```tsx
803
862
  interface MyButtonProps extends ButtonProps {}
804
863
 
805
864
  // onClick no longer exists in `ButtonProps`, so TypeScript will complain about onClick not
806
865
  // existing in `MyButtonProps` (`onClick` does exist as a prop on `<Button>`, however)
807
866
  const MyButton = ({children, onClick}: MyButtonProps) => (
808
- <Button onClick={onClick}>{children}</Button>
867
+ <SecondaryButton onClick={onClick}>{children}</SecondaryButton>
809
868
  );
810
869
 
811
870
  // After
812
- interface MyButtonProps extends ButtonProps, React.ButtonHTMLAttributes<HTMLButtonElement> {}
871
+ interface MyButtonProps extends ExtractProps<typeof SecondaryButton> {}
813
872
 
814
873
  // After (alternate fix)
815
- interface MyButtonProps extends ButtonProps {
874
+ interface MyButtonProps extends ExtractProps<> {
816
875
  onClick?: React.MouseEventHandler<HTMLButtonElement>;
817
876
  }
818
877
  ```
@@ -881,6 +940,21 @@ const props = {
881
940
  import {Card} from './Card' // where `Card` is a re-exported Canvas Kit `Card`
882
941
  ```
883
942
 
943
+ #### Props
944
+
945
+ The exported props no longer extend from the `HTMLDivElement` interface. Use
946
+ [ExtractProps](#prop-interfaces) instead.
947
+
948
+ ```tsx
949
+ // NOT handled by the codemod
950
+
951
+ // v4
952
+ interface MyCard extends CardProps {}
953
+
954
+ // v5
955
+ interface MyCard extends ExtractProps<typeof Card>
956
+ ```
957
+
884
958
  ---
885
959
 
886
960
  ### Inputs
@@ -924,14 +998,14 @@ element that `inputRef` was applied to previously. Select and Select (Preview) d
924
998
  `inputRef` in v4, but now support `ref` in v5. See each component's documentation for information on
925
999
  which element `ref` is forwarded to for that particular component.
926
1000
 
1001
+ #### Props
1002
+
927
1003
  Input component prop interfaces no longer extend directly from their underlying element interface
928
1004
  (e.g. `TextInputProps` no longer extends from `React.InputHTMLAttributes<HTMLInputElement>`).
929
1005
  `createComponent` returns a component that determines the element interface via the `as` prop. This
930
1006
  is why input component props no longer contain an element interface directly. If you extend from an
931
1007
  input component prop interface, or have code that uses an input component prop interface and
932
- accesses properties like `onClick`, you'll need to provide the input attribute yourself in order to
933
- avoid TypeScript issues (this doesn't affect runtime). This is not code-moddable since intent cannot
934
- be pre-determined.
1008
+ accesses properties like `onClick`, you'll need to use [ExtractProps](#prop-interfaces) instead.
935
1009
 
936
1010
  ```tsx
937
1011
  interface MyTextInputProps extends TextInputProps {}
@@ -941,7 +1015,7 @@ interface MyTextInputProps extends TextInputProps {}
941
1015
  const MyTextInput = ({onClick}: MyTextInputProps) => <TextInput onClick={onClick} />;
942
1016
 
943
1017
  // Fix
944
- interface MyTextInputProps extends TextInputProps, React.InputHTMLAttributes<HTMLInputElement> {}
1018
+ interface MyTextInputProps extends ExtractProps<typeof TextInput> {}
945
1019
 
946
1020
  // Alternate fix
947
1021
  interface MyTextInputProps extends TextInputProps {
@@ -0,0 +1,560 @@
1
+ # Canvas Kit 6.0 Migration Guide
2
+
3
+ Below are the breaking changes made in Canvas Kit v6. Please
4
+ [reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
5
+ any questions about the update.
6
+
7
+ - [Codemod](#codemod)
8
+ - [Component Deprecations](#component-deprecations)
9
+ - [Cookie Banner](#cookie-banner)
10
+ - [Header & Global Header](#header--global-header)
11
+ - [Page Header](#page-header)
12
+ - [Component Migrations](#component-migrations)
13
+ - [Search Bar](#search-bar)
14
+ - [Name Updates](#name-updates)
15
+ - [Depth Tokens](#depth-tokens)
16
+ - [Theme Breakpoint Updates](#theme-breakpoint-updates)
17
+ - [Action Bar](#action-bar)
18
+ - [Tabs Component](#tabs-component)
19
+ - [Button Updates](#button-updates)
20
+ - [Primary Button](#primary-button)
21
+ - [Primary Disabled](#primary-disabled)
22
+ - [Primary Large](#primary-large)
23
+ - [Primary Medium](#primary-medium)
24
+ - [Primary Small](#primary-small)
25
+ - [Primary Extra Small](#primary-extra-small)
26
+ - [Secondary Button](#secondary-button)
27
+ - [Secondary Disabled](#secondary-disabled)
28
+ - [Secondary Large](#secondary-large)
29
+ - [Secondary Medium](#secondary-medium)
30
+ - [Secondary Small](#secondary-small)
31
+ - [Secondary Extra Small](#secondary-extra-small)
32
+ - [Tertiary Button](#tertiary-button)
33
+ - [Tertiary Default](#tertiary-default)
34
+ - [Tertiary Disabled](#tertiary-disabled)
35
+ - [Tertiary Medium](#tertiary-medium)
36
+ - [Tertiary Small](#tertiary-small)
37
+ - [Tertiary Extra Small](#tertiary-extra-small)
38
+
39
+ ## Codemod
40
+
41
+ Please use our [codemod package](https://github.com/Workday/canvas-kit/tree/master/modules/codemod)
42
+ to automatically update your code to work with a majority of the breaking changes in the migration
43
+ from Canvas Kit v5 to v6:
44
+
45
+ ```sh
46
+ > npx @workday/canvas-kit-codemod v6 [path]
47
+ ```
48
+
49
+ > Note: This codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` extensions. You may need to make
50
+ > some manual changes in other file types (`.json`, `.mdx`, `.md`, etc.).
51
+
52
+ > Note: You may need to run your linter after executing the codemod, as it's resulting formatting
53
+ > (spacing, quotes, etc.) may not match your project's styling.
54
+
55
+ **Breaking changes accounted for by this codemod will be marked with a 🤖.**
56
+
57
+ **Please verify all changes made by the codemod. As a safety precaution, we recommend committing the
58
+ changes from the codemod as a single isolated commit (separate from other changes) so you can
59
+ rollback more easily if necessary.**
60
+
61
+ [Let us know](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you
62
+ encounter any issues or use cases that we've missed. The `@workday/canvas-kit-codemod` package will
63
+ help us maintain additional codemod transforms to make future migrations easier.
64
+
65
+ ## Component Deprecations
66
+
67
+ ### Deprecation Types
68
+
69
+ There are two types of deprecations: soft and hard.
70
+
71
+ #### Soft Deprecation
72
+
73
+ A soft-deprecated component is still available with its full functionality, but it will have been
74
+ renamed with a prefix to indicate its soft-deprecated status. It will also include a console warning
75
+ to announce its deprecation. This warning will only be triggered on the component's initial render.
76
+
77
+ Soft-deprecated types and utilities will also be renamed but generally will not trigger a console
78
+ warning.
79
+
80
+ #### Hard Deprecation
81
+
82
+ A hard-deprecated component or package is no longer available. You will need to follow the method
83
+ prescribed in our migration guide to update your application. Please reach out to our team directly
84
+ if you need additional help.
85
+
86
+ ### Cookie Banner
87
+
88
+ We are [soft deprecating](#soft-deprecation) `CookieBanner`. It has been renamed to
89
+ `DeprecatedCookieBanner`. Similarly, `CookieBannerProps` has been renamed to
90
+ `DeprecatedCookieBannerProps`. You may continue to use this component exactly as you did in v5, but
91
+ note that we plan to [hard-deprecate](#hard-deprecation) it in Canvas Kit v7.
92
+
93
+ 🤖 The codemod will rename `CookieBanner` and `CookieBannerProps` to their deprecated names:
94
+
95
+ ```tsx
96
+ // v5
97
+ import CookieBanner, {CookieBannerProps} from '@workday/canvas-kit-react/cookie-banner';
98
+
99
+ export const CustomCookieBanner = (props: CookieBannerProps) => {
100
+ return <CookieBanner notice={CookieBanner.DefaultNotice} {...props} />;
101
+ };
102
+
103
+ // v6
104
+ import DeprecatedCookieBanner, {
105
+ DeprecatedCookieBannerProps,
106
+ } from '@workday/canvas-kit-react/cookie-banner';
107
+
108
+ export const CustomCookieBanner = (props: DeprecatedCookieBannerProps) => {
109
+ return <DeprecatedCookieBanner notice={DeprecatedCookieBanner.DefaultNotice} {...props} />;
110
+ };
111
+ ```
112
+
113
+ ```tsx
114
+ // v5
115
+ import {CookieBanner, CookieBannerProps} from '@workday/canvas-kit-react';
116
+
117
+ interface CustomCookieBannerProps extends CookieBannerProps {
118
+ // custom page header props
119
+ }
120
+
121
+ export const CustomCookieBanner = (props: CustomCookieBannerProps) => {
122
+ return <CookieBanner notice={CookieBanner.DefaultNotice} {...props} />;
123
+ };
124
+
125
+ // v6
126
+ import {DeprecatedCookieBanner, DeprecatedCookieBannerProps} from '@workday/canvas-kit-react';
127
+
128
+ interface CustomCookieBannerProps extends DeprecatedCookieBannerProps {
129
+ // custom page header props
130
+ }
131
+
132
+ export const CustomCookieBanner = (props: CustomCookieBannerProps) => {
133
+ return <DeprecatedCookieBanner notice={DeprecatedCookieBanner.DefaultNotice} {...props} />;
134
+ };
135
+ ```
136
+
137
+ ### Header & Global Header
138
+
139
+ We are [soft deprecating](#soft-deprecation) `Header` and `GlobalHeader` and their related exports.
140
+ They has been renamed to `DeprecatedHeader` and `DeprecatedGlobalHeader`, respectively. You may
141
+ continue to use these components exactly as you did in v5, but note that we plan to
142
+ [hard-deprecate](#hard-deprecation) this package in Canvas Kit v7.
143
+
144
+ > Note: `SearchBar` is not being deprecated but will instead move to its own dedictated package. You
145
+ > can read more [here](#search-bar).
146
+
147
+ 🤖 The codemod will handle all these changes automatically:
148
+
149
+ - Rename import specifiers
150
+ - `DubLogoTitle` becomes `DeprecatedDubLogoTitle`
151
+ - `GlobalHeader` becomes `DeprecatedGlobalHeader`
152
+ - `Header` becomes `DeprecatedHeader`
153
+ - `HeaderHeight` becomes `DeprecatedHeaderHeight`
154
+ - `HeaderTheme` becomes `DeprecatedHeaderTheme`
155
+ - `HeaderVariant` becomes `DeprecatedHeaderVariant`
156
+ - `ThemeAttributes` becomes `DeprecatedHeaderThemeAttributes`
157
+ - `Themes` becomes `DeprecatedHeaderThemes`
158
+ - `WorkdayLogoTitle` becomes `DeprecatedWorkdayLogoTitle`
159
+ - `themes` becomes `deprecatedHeaderThemes`
160
+ - Rename JSX identifiers
161
+ - `<DubLogoTitle>` becomes `<DeprecatedDubLogoTitle>`
162
+ - `<GlobalHeader>` becomes `<DeprecatedGlobalHeader>`
163
+ - `<Header>` becomes `<DeprecatedHeader>`
164
+ - `<WorkdayLogoTitle>` becomes `<DeprecatedWorkdayLogoTitle>`
165
+ - Rename type references and interface declarations
166
+ - `type CustomHeaderHeight = HeaderHeight;` becomes
167
+ `type CustomHeaderHeight = DeprecatedHeaderHeight;`
168
+ - `type CustomHeaderTheme = HeaderTheme;` becomes
169
+ `type CustomHeaderTheme = DeprecatedHeaderTheme;`
170
+ - `type CustomHeaderVariant = HeaderVariant;` becomes
171
+ `type CustomHeaderVariant = DeprecatedHeaderVariant;`
172
+ - `type CustomThemeAttributes = ThemeAttributes;` becomes
173
+ `type CustomThemeAttributes = DeprecatedHeaderThemeAttributes;`
174
+ - `type CustomThemes = Themes;` becomes `type CustomThemes = DeprecatedHeaderThemes;`
175
+ - Rename member expressions
176
+ - `HeaderHeight.Small` becomes `DeprecatedHeaderHeight.Small`
177
+ - `HeaderTheme.White` becomes `DeprecatedHeaderTheme.White`
178
+ - `HeaderVariant.Full` becomes `DeprecatedHeaderVariant.Full`
179
+ - `themes.Blue` becomes `deprecatedHeaderThemes.Blue`
180
+ - `Header.Variant.Global` becomes `DeprecatedHeader.Variant.Global`
181
+
182
+ ```tsx
183
+ // v5
184
+ import Header, {DubLogoTitle, GlobalHeader} from '@workday/canvas-kit-labs-react/header';
185
+
186
+ const CustomGlobalHeader = props => {
187
+ return (
188
+ <GlobalHeader
189
+ brand={
190
+ <a href="#">
191
+ <DubLogoTitle themeColor={Header.Theme.White} />
192
+ </a>
193
+ }
194
+ {...props}
195
+ />
196
+ );
197
+ };
198
+
199
+ // v6
200
+ import DeprecatedHeader, {
201
+ DeprecatedDubLogoTitle,
202
+ DeprecatedGlobalHeader,
203
+ } from '@workday/canvas-kit-labs-react/header';
204
+
205
+ const CustomGlobalHeader = props => {
206
+ return (
207
+ <DeprecatedGlobalHeader
208
+ brand={
209
+ <a href="#">
210
+ <DeprecatedDubLogoTitle themeColor={DeprecatedHeader.Theme.White} />
211
+ </a>
212
+ }
213
+ {...props}
214
+ />
215
+ );
216
+ };
217
+ ```
218
+
219
+ You may continue to use this component exactly as you did in v5, but note that we plan to hard-deprecate it in Canvas Kit v7.
220
+ If you would like to migrate away from this deprecated component now, you can reference [this example](https://workday.github.io/canvas-kit/?path=/story/examples-global-header-react--basic) instead.
221
+
222
+ ### Page Header
223
+
224
+ We are [soft-deprecating](#soft-deprecation) `PageHeader`. It has been renamed to
225
+ `DeprecatedPageHeader`. Similarly, `PageHeaderProps` has been renamed to
226
+ `DeprecatedPageHeaderProps`. You may continue to use this component exactly as you did in v5, but
227
+ note that we plan to [hard-deprecate](#hard-deprecation) it in Canvas Kit v7.
228
+
229
+ 🤖 The codemod will rename `PageHeader` and `PageHeaderProps` to their deprecated names:
230
+
231
+ ```tsx
232
+ // v5
233
+ import PageHeader, {PageHeaderProps} from '@workday/canvas-kit-react/page-header';
234
+
235
+ export const CustomPageHeader = (props: PageHeaderProps) => {
236
+ return <PageHeader {...props} />;
237
+ };
238
+
239
+ // v6
240
+ import DeprecatedPageHeader, {
241
+ DeprecatedPageHeaderProps,
242
+ } from '@workday/canvas-kit-react/page-header';
243
+
244
+ export const CustomPageHeader = (props: DeprecatedPageHeaderProps) => {
245
+ return <DeprecatedPageHeader {...props} />;
246
+ };
247
+ ```
248
+
249
+ ```tsx
250
+ // v5
251
+ import {PageHeader, PageHeaderProps} from '@workday/canvas-kit-react';
252
+
253
+ interface CustomPageHeaderProps extends PageHeaderProps {
254
+ // custom page header props
255
+ }
256
+
257
+ export const CustomPageHeader = (props: CustomPageHeaderProps) => {
258
+ return <PageHeader {...props} />;
259
+ };
260
+
261
+ // v6
262
+ import {DeprecatedPageHeader, DeprecatedPageHeaderProps} from '@workday/canvas-kit-react';
263
+
264
+ interface CustomPageHeaderProps extends DeprecatedPageHeaderProps {
265
+ // custom page header props
266
+ }
267
+
268
+ export const CustomPageHeader = (props: CustomPageHeaderProps) => {
269
+ return <DeprecatedPageHeader {...props} />;
270
+ };
271
+ ```
272
+
273
+ You may continue to use this component exactly as you did in v5, but note that we plan to hard-deprecate it in Canvas Kit v7.
274
+ If you would like to migrate away from this deprecated component now, you can reference [this example](https://workday.github.io/canvas-kit/?path=/story/examples-page-header-react--basic) instead.
275
+
276
+ ## Component Migrations
277
+
278
+ ### Search Bar
279
+
280
+ `SeachBar` is being renamed to `SearchForm` and is moving out of
281
+ `@workday/canvas-kit-labs-react/header` into its own dedicated package,
282
+ `@workday/canvas-kit-labs-react/search-form`. The component has not been modified and you may
283
+ continue to use this component exactly as you did in v5.
284
+
285
+ 🤖 The codemod will handle all these changes automatically:
286
+
287
+ - Rename import sources
288
+ - `@workday/canvas-kit-labs-react/header` becomes `@workday/canvas-kit-labs-react/search-form`
289
+ - Rename import specifiers
290
+ - `SearchBar` becomes `SearchForm`
291
+ - `SearchBarProps` becomes `SearchFormProps`
292
+ - `SearchBarState` becomes `SearchFormState`
293
+ - Rename JSX identifiers
294
+ - `<SearchBar>` becomes `<SearchForm>`
295
+ - Rename type references and interface declarations
296
+ - `type CustomSearchProps = SearchBarProps;` becomes `type CustomSearchProps = SearchFormProps;`
297
+ - `interface CustomSearchProps extends SearchBarProps` becomes
298
+ `interface CustomSearchProps extends SearchFormProps`
299
+
300
+ ```tsx
301
+ // v5
302
+ import {
303
+ SearchBar,
304
+ SearchBarProps,
305
+ SearchBarState,
306
+ SearchThemeAttributes,
307
+ SearchTheme,
308
+ } from '@workday/canvas-kit-labs-react/header';
309
+
310
+ const CustomSearchForm = (props: SearchFormProps) => {
311
+ return <SearchForm searchTheme={SearchTheme.Dark} {...props} />;
312
+ };
313
+
314
+ // v6
315
+ import {
316
+ SearchForm,
317
+ SearchFormProps,
318
+ SearchFormState,
319
+ SearchThemeAttributes,
320
+ SearchTheme,
321
+ } from '@workday/canvas-kit-labs-react/search-form';
322
+
323
+ const CustomSearchForm = (props: SearchFormProps) => {
324
+ return <SearchForm searchTheme={SearchTheme.Dark} {...props} />;
325
+ };
326
+ ```
327
+
328
+ ## Name Updates
329
+
330
+ ### Depth Tokens
331
+
332
+ The `CanvasDepthValue` type has been renamed to `CanvasDepthValues` to be more consistent with our
333
+ other token type names, such as `CanvasBorderRadiusValues`, `CanvasSpaceValues`, and
334
+ `CanvasSpaceNumberValues`.
335
+
336
+ 🤖 The codemod will handle this rename transformation automatically:
337
+
338
+ ```ts
339
+ // v5
340
+ import {CanvasDepthValue} from '@workday/canvas-kit-react/tokens';
341
+
342
+ type CustomDepthValues = CanvasDepthValue;
343
+ interface OtherCustomDepthValues extends CanvasDepthValue {}
344
+
345
+ // v6
346
+ import {CanvasDepthValues} from '@workday/canvas-kit-react/tokens';
347
+
348
+ type CustomDepthValues = CanvasDepthValues;
349
+ interface OtherCustomDepthValues extends CanvasDepthValues {}
350
+ ```
351
+
352
+ ## Theme Breakpoint Updates
353
+
354
+ Our default theme breakpoints have been updated to match the viewport ranges described in our design
355
+ guidelines. We also updated `ActionBar`'s media query to align with this change. Those changes are
356
+ described in [the section below](#action-bar). If you are using these default breakpoints, you will
357
+ need to do visual regression testing to ensure there are no adverse effects to your application's
358
+ layout. If you have questions about this testing, please reach out to our team.
359
+
360
+ Below is a reference table for the V5 and V6 breakpoint values.
361
+
362
+ | Breakpoint Name | V5 Value (px) | V6 Value (px) |
363
+ | --------------- | ------------- | ------------- |
364
+ | `zero` | 0 | 0 |
365
+ | `s` | 600 | 320 |
366
+ | `m` | 900 | 768 |
367
+ | `l` | 1280 | 1024 |
368
+ | `xl` | 1920 | 1440 |
369
+
370
+ Also for reference, these are our viewport ranges:
371
+
372
+ - `small` (`320px` - `767px`) Used for mobile-sized screens
373
+ - `medium` (`768px` - `1023px`) Used for tablet-sized screens
374
+ - `large` - (`1024px` - `1439px`) Used for laptop and small desktop screens
375
+ - `extra-large` (`≥1440px`) Used for very large screens
376
+
377
+ ### Action Bar
378
+
379
+ `ActionBar` was updated to use the new breakpoint values. It previously had two media queries with
380
+ `max-width: 575px`. They now use `max-width: 767.5px` – the upper limit of the `small` range. This
381
+ will have two effects for this component:
382
+
383
+ - Container padding will decrease from `s` (`16px`) to `xxs` (`8px`) on all viewports less than `768px` wide
384
+ - This was previously happening only on viewports less than `576px` wide
385
+ - Button order will be reversed on all viewports less than `768px` wide
386
+ - This was previously happening only on viewports less than `576px` wide
387
+
388
+ These changes in behavior are intentional and expected.
389
+
390
+ ## Tabs Component
391
+
392
+ The Tabs API changed to support a responsive layout
393
+ ([#1325](https://github.com/Workday/canvas-kit/pull/1325)). The model API was updated to support
394
+ more generic behaviors to allow for other components to support responsive layouts using the same
395
+ models and behaviors. The most notable changes were concerning the state and events around tab
396
+ selection. The verb "select" was chosen to more accurately reflect selection for more component
397
+ types. Also selection of lists (which Tabs is based on) can support single or multiple selection.
398
+ Selection is now stored on state as an array of selected keys.
399
+
400
+ ```tsx
401
+ // v5
402
+ const model = useTabsModel({
403
+ shouldActivate,
404
+ onActivate,
405
+ });
406
+
407
+ console.log('Selected tab', model.state.activeTab);
408
+ model.events.activate({tab: tabName});
409
+
410
+ // v6
411
+ const model = useTabsModel({
412
+ shouldSelect,
413
+ onSelect,
414
+ });
415
+
416
+ console.log('Selected tab', model.state.selectedKey[0]);
417
+ model.events.select({id: tabName});
418
+ ```
419
+
420
+ The Tabs component can now handle responsive containers, but the support is not automatic. You must
421
+ use the dynamic API and provide an overflow menu subcomponent. The dynamic API doesn't know the
422
+ shape of your object, so render props must be used to instruct React how to render each item.
423
+
424
+ ```tsx
425
+ // Use `useState` because React will give the same reference each render
426
+ const [items] = React.useState([
427
+ {id: 'first', text: 'First Tab', contents: 'First Tab Content'},
428
+ {id: 'second', text: 'Second Tab', contents: 'Second Tab Content'},
429
+ ]);
430
+
431
+ return (
432
+ <Tabs items={items}>
433
+ <Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
434
+ {item => <Tabs.Item name={item.id}>{item.text}</Tabs.Item>}
435
+ </Tabs.List>
436
+ <Tabs.Menu.Popper>
437
+ <Tabs.Menu.Card maxWidth={300} maxHeight={200}>
438
+ <Tabs.Menu.List>
439
+ {(item: MyTabItem) => <Tabs.Menu.Item name={item.id}>{item.text}</Tabs.Menu.Item>}
440
+ </Tabs.Menu.List>
441
+ </Tabs.Menu.Card>
442
+ </Tabs.Menu.Popper>
443
+ </Tabs>
444
+ );
445
+ ```
446
+
447
+ ## Button Updates
448
+
449
+ All button updates for V6 are limited to our Primary, Secondary, and Tertiary buttons. Most of the
450
+ button updates are small visual adjustments:
451
+
452
+ - We tightened up tighten the spacing for visual balance and added our new type hierarchy.
453
+ - We adjusted icon sizes for uniformity:
454
+ - `large`: `24px` x `24px`
455
+ - `medium`: `20px` x `20px`
456
+ - `small`: `20px` x `20px`
457
+ - `extraSmall`: `18px` x `18px`
458
+ - We also adjusted the opacity for their disabled state so they behave more appropriately on varied
459
+ / dark backgrounds.
460
+
461
+ These changes are automatic when you upgrade and do not require any manual updates in your codebase.
462
+ However, they will likely cause any automated visual regression tests to fail, and you will need to
463
+ update your tests accordingly. We do not expect these minor adjustments to create significant layout
464
+ shifts in your UI. But, as with any visual update, you will want to review your UI to ensure there
465
+ are no adverse effects.
466
+
467
+ We also added some net-new features:
468
+
469
+ - All buttons have a new `extraSmall` size.
470
+ - Icons are now supported for all sizes.
471
+ - `PrimaryButton` has a new `inverse` variant.
472
+
473
+ All these changes are described in detail by button type in the sections below.
474
+
475
+ ### Primary Button
476
+
477
+ #### Primary Disabled State
478
+
479
+ Previously the button's disabled state had a `blueberry200` background, but it now uses the default
480
+ `blueberry400` and sets the entire button to 40% opacity. This creates more consistency for the
481
+ disabled states across all our buttons.
482
+
483
+ #### Primary Large
484
+
485
+ The padding for large `PrimaryButton`s has been slightly adjusted for more visual balance and to
486
+ take up a bit less layout space. Specifically we:
487
+
488
+ - decreased the space between the button icon and text from `12px` to `8px`
489
+ - decreased the space between the button container and the icon from `28px` to `24px`
490
+
491
+ #### Primary Medium
492
+
493
+ The icon size for medium `PrimaryButton`s has been decreased from `24px` to `20px`, but the overall
494
+ height of the button will remain the same.
495
+
496
+ #### Primary Small
497
+
498
+ We now support icons for small `PrimaryButton`s. The icons are `20px` x `20px`.
499
+
500
+ #### Primary Extra Small
501
+
502
+ We added a new size, `extraSmall` to our `PrimaryButton`s. These are particularly helpful for use
503
+ cases where you have dense UI or tight layout constraints such as tables.
504
+
505
+ ### Secondary Button
506
+
507
+ #### Secondary Large
508
+
509
+ The padding for large `SecondaryButton`s has been slightly adjusted for more visual balance and to
510
+ take up a bit less layout space. Specifically we:
511
+
512
+ - decreased the space between the button icon and text from `12px` to `8px`
513
+ - decreased the space between the button container and the icon from `28px` to `24px`
514
+
515
+ #### Secondary Medium
516
+
517
+ The icon size for medium `SecondaryButton`s has been decreased from `24px` to `20px`, but the
518
+ overall height of the button will remain the same.
519
+
520
+ #### Secondary Small
521
+
522
+ We now support icons for small `SecondaryButton`s. The icons are `20px` x `20px`.
523
+
524
+ #### Secondary Extra Small
525
+
526
+ We added a new size, `extraSmall` to our `SecondaryButton`s. These are particularly helpful for use
527
+ cases where you have dense UI or tight layout constraints such as tables.
528
+
529
+ ### Tertiary Button
530
+
531
+ #### Tertiary Default
532
+
533
+ We added an underline to the button text for all states to help distinguish it from the
534
+ `SecondaryButton` and create more visual consistency.
535
+
536
+ #### Tertiary Disabled
537
+
538
+ As with our other buttons, we updated the disabled state to set the entire button to 40% opacity.
539
+ They were previously using our light theme color at 50% opacity for icons and text.
540
+
541
+ #### Tertiary Medium
542
+
543
+ The medium `TertiaryButton` now uses our new type hierarchy and adjusted the padding, but the
544
+ overall size of the button will stay the same. Specifically, we:
545
+
546
+ - decreased the space between the button icon and text from `8px` to `4px`
547
+
548
+ #### Tertiary Small
549
+
550
+ The small `TertiaryButton` now uses our new type hierarchy and adjusted the padding, but the overall
551
+ size of the button will stay the same. Specifically, we:
552
+
553
+ - decreased the space between the button icon and text from `8px` to `4px`
554
+ - increased the container padding outside the button text when an icon is present from `8px` to
555
+ `12px`
556
+
557
+ #### Tertiary Extra Small
558
+
559
+ We added a new size, `extraSmall` to our `TertiaryButton`s. These are particularly helpful for use
560
+ cases where you have dense UI or tight layout constraints such as tables.