@workday/canvas-kit-docs 5.3.0 → 5.3.4

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 (47) hide show
  1. package/dist/commonjs/lib/specs.js +18 -232
  2. package/dist/es6/lib/specs.js +18 -232
  3. package/dist/mdx/COMPOUND_COMPONENTS.mdx +30 -31
  4. package/dist/mdx/react/button/button/Button.mdx +2 -27
  5. package/dist/mdx/react/button/button/examples/Primary.tsx +1 -10
  6. package/dist/mdx/react/button/button/examples/Secondary.tsx +1 -10
  7. package/dist/mdx/react/button/button/examples/Tertiary.tsx +1 -10
  8. package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
  9. package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
  10. package/dist/mdx/react/tabs/Tabs.mdx +5 -31
  11. package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
  12. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +13 -41
  13. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
  14. package/dist/mdx/react/tabs/examples/{NamedTabs.tsx → NamedKeys.tsx} +0 -0
  15. package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
  16. package/dist/mdx/react/text-area/TextArea.mdx +1 -1
  17. package/dist/mdx/react/tooltip/Tooltip.mdx +8 -0
  18. package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
  19. package/package.json +3 -3
  20. package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +0 -554
  21. package/dist/mdx/labs-react/search-form/SearchForm.mdx +0 -64
  22. package/dist/mdx/labs-react/search-form/examples/Basic.tsx +0 -61
  23. package/dist/mdx/labs-react/search-form/examples/CustomTheme.tsx +0 -72
  24. package/dist/mdx/labs-react/search-form/examples/Grow.tsx +0 -62
  25. package/dist/mdx/labs-react/search-form/examples/PropTables.splitProps.tsx +0 -4
  26. package/dist/mdx/labs-react/search-form/examples/RTL.tsx +0 -70
  27. package/dist/mdx/labs-react/search-form/examples/Theming.tsx +0 -64
  28. package/dist/mdx/labs-react/text-input/TextInput.mdx +0 -123
  29. package/dist/mdx/labs-react/text-input/examples/Alert.tsx +0 -46
  30. package/dist/mdx/labs-react/text-input/examples/Basic.tsx +0 -20
  31. package/dist/mdx/labs-react/text-input/examples/Disabled.tsx +0 -20
  32. package/dist/mdx/labs-react/text-input/examples/Error.tsx +0 -43
  33. package/dist/mdx/labs-react/text-input/examples/Grow.tsx +0 -20
  34. package/dist/mdx/labs-react/text-input/examples/HiddenLabel.tsx +0 -17
  35. package/dist/mdx/labs-react/text-input/examples/LabelPosition.tsx +0 -20
  36. package/dist/mdx/labs-react/text-input/examples/LoginForm.tsx +0 -100
  37. package/dist/mdx/labs-react/text-input/examples/Password.tsx +0 -20
  38. package/dist/mdx/labs-react/text-input/examples/Placeholder.tsx +0 -20
  39. package/dist/mdx/labs-react/text-input/examples/RefForwarding.tsx +0 -27
  40. package/dist/mdx/labs-react/text-input/examples/Required.tsx +0 -20
  41. package/dist/mdx/labs-react/text-input/examples/ThemedAlert.tsx +0 -51
  42. package/dist/mdx/labs-react/text-input/examples/ThemedError.tsx +0 -40
  43. package/dist/mdx/react/button/button/examples/PrimaryInverse.tsx +0 -14
  44. package/dist/mdx/react/button/button/examples/SecondaryInverse.tsx +0 -14
  45. package/dist/mdx/react/button/button/examples/TertiaryInverse.tsx +0 -14
  46. package/dist/mdx/react/tabs/examples/Icons.tsx +0 -36
  47. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +0 -58
@@ -1,554 +0,0 @@
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
- ### Page Header
220
-
221
- We are [soft-deprecating](#soft-deprecation) `PageHeader`. It has been renamed to
222
- `DeprecatedPageHeader`. Similarly, `PageHeaderProps` has been renamed to
223
- `DeprecatedPageHeaderProps`. You may continue to use this component exactly as you did in v5, but
224
- note that we plan to [hard-deprecate](#hard-deprecation) it in Canvas Kit v7.
225
-
226
- 🤖 The codemod will rename `PageHeader` and `PageHeaderProps` to their deprecated names:
227
-
228
- ```tsx
229
- // v5
230
- import PageHeader, {PageHeaderProps} from '@workday/canvas-kit-react/page-header';
231
-
232
- export const CustomPageHeader = (props: PageHeaderProps) => {
233
- return <PageHeader {...props} />;
234
- };
235
-
236
- // v6
237
- import DeprecatedPageHeader, {
238
- DeprecatedPageHeaderProps,
239
- } from '@workday/canvas-kit-react/page-header';
240
-
241
- export const CustomPageHeader = (props: DeprecatedPageHeaderProps) => {
242
- return <DeprecatedPageHeader {...props} />;
243
- };
244
- ```
245
-
246
- ```tsx
247
- // v5
248
- import {PageHeader, PageHeaderProps} from '@workday/canvas-kit-react';
249
-
250
- interface CustomPageHeaderProps extends PageHeaderProps {
251
- // custom page header props
252
- }
253
-
254
- export const CustomPageHeader = (props: CustomPageHeaderProps) => {
255
- return <PageHeader {...props} />;
256
- };
257
-
258
- // v6
259
- import {DeprecatedPageHeader, DeprecatedPageHeaderProps} from '@workday/canvas-kit-react';
260
-
261
- interface CustomPageHeaderProps extends DeprecatedPageHeaderProps {
262
- // custom page header props
263
- }
264
-
265
- export const CustomPageHeader = (props: CustomPageHeaderProps) => {
266
- return <DeprecatedPageHeader {...props} />;
267
- };
268
- ```
269
-
270
- ## Component Migrations
271
-
272
- ### Search Bar
273
-
274
- `SeachBar` is being renamed to `SearchForm` and is moving out of
275
- `@workday/canvas-kit-labs-react/header` into its own dedicated package,
276
- `@workday/canvas-kit-labs-react/search-form`. The component has not been modified and you may
277
- continue to use this component exactly as you did in v5.
278
-
279
- 🤖 The codemod will handle all these changes automatically:
280
-
281
- - Rename import sources
282
- - `@workday/canvas-kit-labs-react/header` becomes `@workday/canvas-kit-labs-react/search-form`
283
- - Rename import specifiers
284
- - `SearchBar` becomes `SearchForm`
285
- - `SearchBarProps` becomes `SearchFormProps`
286
- - `SearchBarState` becomes `SearchFormState`
287
- - Rename JSX identifiers
288
- - `<SearchBar>` becomes `<SearchForm>`
289
- - Rename type references and interface declarations
290
- - `type CustomSearchProps = SearchBarProps;` becomes `type CustomSearchProps = SearchFormProps;`
291
- - `interface CustomSearchProps extends SearchBarProps` becomes
292
- `interface CustomSearchProps extends SearchFormProps`
293
-
294
- ```tsx
295
- // v5
296
- import {
297
- SearchBar,
298
- SearchBarProps,
299
- SearchBarState,
300
- SearchThemeAttributes,
301
- SearchTheme,
302
- } from '@workday/canvas-kit-labs-react/header';
303
-
304
- const CustomSearchForm = (props: SearchFormProps) => {
305
- return <SearchForm searchTheme={SearchTheme.Dark} {...props} />;
306
- };
307
-
308
- // v6
309
- import {
310
- SearchForm,
311
- SearchFormProps,
312
- SearchFormState,
313
- SearchThemeAttributes,
314
- SearchTheme,
315
- } from '@workday/canvas-kit-labs-react/search-form';
316
-
317
- const CustomSearchForm = (props: SearchFormProps) => {
318
- return <SearchForm searchTheme={SearchTheme.Dark} {...props} />;
319
- };
320
- ```
321
-
322
- ## Name Updates
323
-
324
- ### Depth Tokens
325
-
326
- The `CanvasDepthValue` type has been renamed to `CanvasDepthValues` to be more consistent with our
327
- other token type names, such as `CanvasBorderRadiusValues`, `CanvasSpaceValues`, and
328
- `CanvasSpaceNumberValues`.
329
-
330
- 🤖 The codemod will handle this rename transformation automatically:
331
-
332
- ```ts
333
- // v5
334
- import {CanvasDepthValue} from '@workday/canvas-kit-react/tokens';
335
-
336
- type CustomDepthValues = CanvasDepthValue;
337
- interface OtherCustomDepthValues extends CanvasDepthValue {}
338
-
339
- // v6
340
- import {CanvasDepthValues} from '@workday/canvas-kit-react/tokens';
341
-
342
- type CustomDepthValues = CanvasDepthValues;
343
- interface OtherCustomDepthValues extends CanvasDepthValues {}
344
- ```
345
-
346
- ## Theme Breakpoint Updates
347
-
348
- Our default theme breakpoints have been updated to match the viewport ranges described in our design
349
- guidelines. We also updated `ActionBar`'s media query to align with this change. Those changes are
350
- described in [the section below](#action-bar). If you are using these default breakpoints, you will
351
- need to do visual regression testing to ensure there are no adverse effects to your application's
352
- layout. If you have questions about this testing, please reach out to our team.
353
-
354
- Below is a reference table for the V5 and V6 breakpoint values.
355
-
356
- | Breakpoint Name | V5 Value (px) | V6 Value (px) |
357
- | --------------- | ------------- | ------------- |
358
- | `zero` | 0 | 0 |
359
- | `s` | 600 | 320 |
360
- | `m` | 900 | 768 |
361
- | `l` | 1280 | 1024 |
362
- | `xl` | 1920 | 1440 |
363
-
364
- Also for reference, these are our viewport ranges:
365
-
366
- - `small` (`320px` - `767px`) Used for mobile-sized screens
367
- - `medium` (`768px` - `1023px`) Used for tablet-sized screens
368
- - `large` - (`1024px` - `1439px`) Used for laptop and small desktop screens
369
- - `extra-large` (`≥1440px`) Used for very large screens
370
-
371
- ### Action Bar
372
-
373
- `ActionBar` was updated to use the new breakpoint values. It previously had two media queries with
374
- `max-width: 575px`. They now use `max-width: 767.5px` – the upper limit of the `small` range. This
375
- will have two effects for this component:
376
-
377
- - Container padding will decrease from `s` (`16px`) to `xxs` (`8px`) on all viewports less than `768px` wide
378
- - This was previously happening only on viewports less than `576px` wide
379
- - Button order will be reversed on all viewports less than `768px` wide
380
- - This was previously happening only on viewports less than `576px` wide
381
-
382
- These changes in behavior are intentional and expected.
383
-
384
- ## Tabs Component
385
-
386
- The Tabs API changed to support a responsive layout
387
- ([#1325](https://github.com/Workday/canvas-kit/pull/1325)). The model API was updated to support
388
- more generic behaviors to allow for other components to support responsive layouts using the same
389
- models and behaviors. The most notable changes were concerning the state and events around tab
390
- selection. The verb "select" was chosen to more accurately reflect selection for more component
391
- types. Also selection of lists (which Tabs is based on) can support single or multiple selection.
392
- Selection is now stored on state as an array of selected keys.
393
-
394
- ```tsx
395
- // v5
396
- const model = useTabsModel({
397
- shouldActivate,
398
- onActivate,
399
- });
400
-
401
- console.log('Selected tab', model.state.activeTab);
402
- model.events.activate({tab: tabName});
403
-
404
- // v6
405
- const model = useTabsModel({
406
- shouldSelect,
407
- onSelect,
408
- });
409
-
410
- console.log('Selected tab', model.state.selectedKey[0]);
411
- model.events.select({id: tabName});
412
- ```
413
-
414
- The Tabs component can now handle responsive containers, but the support is not automatic. You must
415
- use the dynamic API and provide an overflow menu subcomponent. The dynamic API doesn't know the
416
- shape of your object, so render props must be used to instruct React how to render each item.
417
-
418
- ```tsx
419
- // Use `useState` because React will give the same reference each render
420
- const [items] = React.useState([
421
- {id: 'first', text: 'First Tab', contents: 'First Tab Content'},
422
- {id: 'second', text: 'Second Tab', contents: 'Second Tab Content'},
423
- ]);
424
-
425
- return (
426
- <Tabs items={items}>
427
- <Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
428
- {item => <Tabs.Item name={item.id}>{item.text}</Tabs.Item>}
429
- </Tabs.List>
430
- <Tabs.Menu.Popper>
431
- <Tabs.Menu.Card maxWidth={300} maxHeight={200}>
432
- <Tabs.Menu.List>
433
- {(item: MyTabItem) => <Tabs.Menu.Item name={item.id}>{item.text}</Tabs.Menu.Item>}
434
- </Tabs.Menu.List>
435
- </Tabs.Menu.Card>
436
- </Tabs.Menu.Popper>
437
- </Tabs>
438
- );
439
- ```
440
-
441
- ## Button Updates
442
-
443
- All button updates for V6 are limited to our Primary, Secondary, and Tertiary buttons. Most of the
444
- button updates are small visual adjustments:
445
-
446
- - We tightened up tighten the spacing for visual balance and added our new type hierarchy.
447
- - We adjusted icon sizes for uniformity:
448
- - `large`: `24px` x `24px`
449
- - `medium`: `20px` x `20px`
450
- - `small`: `20px` x `20px`
451
- - `extraSmall`: `18px` x `18px`
452
- - We also adjusted the opacity for their disabled state so they behave more appropriately on varied
453
- / dark backgrounds.
454
-
455
- These changes are automatic when you upgrade and do not require any manual updates in your codebase.
456
- However, they will likely cause any automated visual regression tests to fail, and you will need to
457
- update your tests accordingly. We do not expect these minor adjustments to create significant layout
458
- shifts in your UI. But, as with any visual update, you will want to review your UI to ensure there
459
- are no adverse effects.
460
-
461
- We also added some net-new features:
462
-
463
- - All buttons have a new `extraSmall` size.
464
- - Icons are now supported for all sizes.
465
- - `PrimaryButton` has a new `inverse` variant.
466
-
467
- All these changes are described in detail by button type in the sections below.
468
-
469
- ### Primary Button
470
-
471
- #### Primary Disabled State
472
-
473
- Previously the button's disabled state had a `blueberry200` background, but it now uses the default
474
- `blueberry400` and sets the entire button to 40% opacity. This creates more consistency for the
475
- disabled states across all our buttons.
476
-
477
- #### Primary Large
478
-
479
- The padding for large `PrimaryButton`s has been slightly adjusted for more visual balance and to
480
- take up a bit less layout space. Specifically we:
481
-
482
- - decreased the space between the button icon and text from `12px` to `8px`
483
- - decreased the space between the button container and the icon from `28px` to `24px`
484
-
485
- #### Primary Medium
486
-
487
- The icon size for medium `PrimaryButton`s has been decreased from `24px` to `20px`, but the overall
488
- height of the button will remain the same.
489
-
490
- #### Primary Small
491
-
492
- We now support icons for small `PrimaryButton`s. The icons are `20px` x `20px`.
493
-
494
- #### Primary Extra Small
495
-
496
- We added a new size, `extraSmall` to our `PrimaryButton`s. These are particularly helpful for use
497
- cases where you have dense UI or tight layout constraints such as tables.
498
-
499
- ### Secondary Button
500
-
501
- #### Secondary Large
502
-
503
- The padding for large `SecondaryButton`s has been slightly adjusted for more visual balance and to
504
- take up a bit less layout space. Specifically we:
505
-
506
- - decreased the space between the button icon and text from `12px` to `8px`
507
- - decreased the space between the button container and the icon from `28px` to `24px`
508
-
509
- #### Secondary Medium
510
-
511
- The icon size for medium `SecondaryButton`s has been decreased from `24px` to `20px`, but the
512
- overall height of the button will remain the same.
513
-
514
- #### Secondary Small
515
-
516
- We now support icons for small `SecondaryButton`s. The icons are `20px` x `20px`.
517
-
518
- #### Secondary Extra Small
519
-
520
- We added a new size, `extraSmall` to our `SecondaryButton`s. These are particularly helpful for use
521
- cases where you have dense UI or tight layout constraints such as tables.
522
-
523
- ### Tertiary Button
524
-
525
- #### Tertiary Default
526
-
527
- We added an underline to the button text for all states to help distinguish it from the
528
- `SecondaryButton` and create more visual consistency.
529
-
530
- #### Tertiary Disabled
531
-
532
- As with our other buttons, we updated the disabled state to set the entire button to 40% opacity.
533
- They were previously using our light theme color at 50% opacity for icons and text.
534
-
535
- #### Tertiary Medium
536
-
537
- The medium `TertiaryButton` now uses our new type hierarchy and adjusted the padding, but the
538
- overall size of the button will stay the same. Specifically, we:
539
-
540
- - decreased the space between the button icon and text from `8px` to `4px`
541
-
542
- #### Tertiary Small
543
-
544
- The small `TertiaryButton` now uses our new type hierarchy and adjusted the padding, but the overall
545
- size of the button will stay the same. Specifically, we:
546
-
547
- - decreased the space between the button icon and text from `8px` to `4px`
548
- - increased the container padding outside the button text when an icon is present from `8px` to
549
- `12px`
550
-
551
- #### Tertiary Extra Small
552
-
553
- We added a new size, `extraSmall` to our `TertiaryButton`s. These are particularly helpful for use
554
- cases where you have dense UI or tight layout constraints such as tables.
@@ -1,64 +0,0 @@
1
- import {SearchForm} from '@workday/canvas-kit-labs-react/search-form';
2
- // examples
3
- import Basic from './examples/Basic';
4
- import CustomTheme from './examples/CustomTheme';
5
- import Grow from './examples/Grow';
6
- import RTL from './examples/RTL';
7
- import Theming from './examples/Theming';
8
- import ThemeAttributes from './examples/PropTables.splitProps';
9
-
10
-
11
- # Canvas Kit Search Form
12
-
13
- `SearchForm` is a search form that contains a `Combobox` for rendering search results. It's
14
- primarily intended to be used within a `Header`.
15
-
16
- ## Installation
17
-
18
- ```sh
19
- yarn add @workday/canvas-kit-labs-react
20
- ```
21
-
22
- ## Usage
23
-
24
- ### Basic Example
25
-
26
- You will most likely use `SearchForm` within the context of a `Header` component, but it's helpful
27
- to see its functionality as a standalone component. Below is a basic example that filters results
28
- based on search input.
29
-
30
- <ExampleCodeBlock code={Basic} />
31
-
32
- ### Grow
33
-
34
- If you'd like `SearchForm` to grow to the width of its container, set the `grow` prop to
35
- `true`.
36
-
37
- <ExampleCodeBlock code={Grow} />
38
-
39
- ### Theming
40
-
41
- `SearchForm` can be themed to use one of the preset `SearchThemes`: `Light`, `Dark`, or
42
- `Transparent`. Below is an example of `SearchForm` using the `Dark` theme.
43
-
44
- <ExampleCodeBlock code={Theming} />
45
-
46
- You can also provide more specific theming values by providing specific `SearchThemeAttributes`.
47
-
48
- <ExampleCodeBlock code={CustomTheme} />
49
-
50
- Below is a table of attributes that can be supplied to `SearchForm`:
51
-
52
- <ArgsTable of={ThemeAttributes} />
53
-
54
-
55
- ### RTL (Right-To-Left)
56
-
57
- `SearchForm` provides bidirectional support out of the box. You shouldn't need to provide any
58
- additional configuration.
59
-
60
- <ExampleCodeBlock code={RTL} />
61
-
62
- ## Props
63
-
64
- <ArgsTable of={SearchForm} />
@@ -1,61 +0,0 @@
1
- import * as React from 'react';
2
- import {MenuItem} from '@workday/canvas-kit-preview-react/menu';
3
- import {SearchForm} from '@workday/canvas-kit-labs-react/search-form';
4
- import {Flex} from '@workday/canvas-kit-labs-react/layout';
5
-
6
- const initialWineList = [
7
- 'Beaujolais',
8
- 'Bordeaux',
9
- 'Cabernet Sauvignon',
10
- 'Champagne',
11
- 'Chardonnay',
12
- 'Chianti',
13
- 'Malbec',
14
- 'Merlot',
15
- 'Pinot Grigio',
16
- 'Pinot Gris',
17
- 'Pinot Noir',
18
- 'Primitivo',
19
- 'Prosecco',
20
- 'Riesling',
21
- 'Rioja',
22
- 'Rosé',
23
- 'Sauvignon Blanc',
24
- 'Syrah',
25
- 'Zinfandel',
26
- ];
27
-
28
- export default () => {
29
- const [wineList, setWineList] = React.useState(initialWineList);
30
- // Tracking the input value for onSubmit
31
- const [searchInput, setSearchInput] = React.useState('');
32
- const menuItems = wineList.map(wine => <MenuItem key={wine}>{wine}</MenuItem>);
33
-
34
- const filterMenuItems = e => {
35
- setSearchInput(e.target.value);
36
- const formattedValue = e.target.value.toLowerCase();
37
-
38
- // Reset the list if the input is cleared
39
- if (!formattedValue.length) {
40
- setWineList(initialWineList);
41
- } else {
42
- const filteredItems = wineList.filter(wine => wine.toLowerCase().startsWith(formattedValue));
43
- setWineList(filteredItems);
44
- }
45
- };
46
-
47
- const handleSubmit = () => {
48
- // We don't need to prevent the default event because SearchForm handles that internally
49
- console.log(`Searching for: ${searchInput}`);
50
- };
51
-
52
- return (
53
- <Flex minHeight={200} alignItems="flex-start" padding="xs">
54
- <SearchForm
55
- autocompleteItems={menuItems}
56
- onInputChange={filterMenuItems}
57
- onSubmit={handleSubmit}
58
- />
59
- </Flex>
60
- );
61
- };