@workday/canvas-kit-docs 12.0.0-alpha.908-next.0 → 12.0.0-alpha.918-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.
@@ -1,3 +1,6 @@
1
+ import {Markdown} from '@storybook/blocks';
2
+
3
+
1
4
  # Canvas Kit 10.0 Upgrade Guide
2
5
 
3
6
  This guide contains an overview of the changes in Canvas Kit v10. Please
@@ -158,6 +161,8 @@ updated on a 1:1 basis. None of the base values have changed, only the unit.
158
161
  The table below shows what each token value is, what it corresponds to, and what the new `rem` value
159
162
  is in `px`:
160
163
 
164
+ <Markdown>
165
+ {`
161
166
  | px Value | rem Value | space Token |
162
167
  | -------- | --------- | ----------- |
163
168
  | 0 | 0 | zero |
@@ -170,17 +175,23 @@ is in `px`:
170
175
  | 40px | 2.5rem | xl |
171
176
  | 64px | 4rem | xxl |
172
177
  | 80px | 5rem | xxxl |
178
+ `}
179
+ </Markdown>
173
180
 
174
181
  You can convert a `px` value to a `rem` value by dividing your `px` value by `16`(if your default
175
182
  browser font size hasn't been updated, the value will be `16`).
176
183
 
177
184
  For example:
178
185
 
186
+ <Markdown>
187
+ {`
179
188
  | Equation | rem Value |
180
189
  | ----------- | --------- |
181
- | `16px/16px` | `1rem` |
182
- | `32px/16px` | `2rem` |
183
- | `8px/16px` | `0.5rem` |
190
+ | \`16px/16px\` | \`1rem\` |
191
+ | \`32px/16px\` | \`2rem\` |
192
+ | \`8px/16px\` | \`0.5rem\` |
193
+ `}
194
+ </Markdown>
184
195
 
185
196
  #### Why Did We Make This Change?
186
197
 
@@ -269,7 +280,7 @@ import {FormField} from '@workday/canvas-kit-react/form-field';
269
280
  <SelectOption label="Medium" value="medium" />
270
281
  <SelectOption label="Large" value="large" />
271
282
  </Select>
272
- </FormField>
283
+ </FormField>;
273
284
  ```
274
285
 
275
286
  ```tsx
@@ -290,7 +301,7 @@ import {FormField} from '@workday/canvas-kit-react/form-field';
290
301
  </Select.Card>
291
302
  </Select.Popper>
292
303
  </FormField>
293
- </Select>
304
+ </Select>;
294
305
  ```
295
306
 
296
307
  Notice that `Select` is now outside the `FormField`. This is due to the update in `Select` and how
@@ -38,9 +38,12 @@ A note to the reader:
38
38
  - [Form Field Container](#form-field-container)
39
39
  - [Removals](#removals)
40
40
  - [Input Icon Container](#input-icon-container)
41
+ - [Infrastructure](#infrastructure)
42
+ - [TypeScript](#typescript)
41
43
  - [Component Updates](#component-updates)
42
44
  - [Styling API and CSS Tokens](#styling-api-and-css-tokens)
43
45
  - [Avatar](#avatar)
46
+ - [Combobox](#combmbox)
44
47
  - [Form Field](#form-field)
45
48
  - [Form Field Group](#form-field-group)
46
49
  - [Form Field Field](#form-field-field)
@@ -48,6 +51,9 @@ A note to the reader:
48
51
  - [Search Form](#search-form)
49
52
  - [Select](#select)
50
53
  - [Text Area](#text-area)
54
+ - [Text Input](#text-input)
55
+ - [Collections](#collections)
56
+ - [Utility Updates](#utility-updates)
51
57
  - [Troubleshooting](#troubleshooting)
52
58
  - [Glossary](#glossary)
53
59
  - [Main](#main)
@@ -69,7 +75,7 @@ automatically update your code to work with most of the breaking changes in v12.
69
75
  handled by the codemod are marked with 🤖 in the Upgrade Guide.**
70
76
 
71
77
  > **Note: In v12, we have done some infrastructure updates with moving to Storybook 7, Webpack 5,
72
- > Typescript 4.9 and Cypress 13 . With these updates has come some formatting issues after running
78
+ > TypeScript 5.0 and Cypress 13 . With these updates has come some formatting issues after running
73
79
  > our codemods. We recommend running a formatter to address the format issues that have been
74
80
  > introduced in v12.**
75
81
 
@@ -185,6 +191,18 @@ from Main instead.
185
191
 
186
192
  ---
187
193
 
194
+ ## Infrastructure
195
+
196
+ ### TypeScript
197
+
198
+ **PR:** [#2908](https://github.com/Workday/canvas-kit/pull/2908)
199
+
200
+ We've upgraded to TypeScript 5.0 to make use of
201
+ [const Type Parameters](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#const-type-parameters).
202
+ You will need to upgrade to TypeScript 5.0+ to avoid any TypeScript syntax errors. TypeScript does
203
+ not follow semver, so 5.0 doesn't mean a large breaking change from 4.9. TypeScript doesn't have a
204
+ `x.10` release, they bump the `x.9` to `{x+1}.0`.
205
+
188
206
  ## Component Updates
189
207
 
190
208
  ### Styling API and CSS Tokens
@@ -233,6 +251,64 @@ The following changes have been made to the API:
233
251
  > union types. You will see a console warn message while in development if you're still using this.
234
252
  > Please update your types and usage before v13.
235
253
 
254
+ ### Combobox
255
+
256
+ **PR** [#2983](https://github.com/Workday/canvas-kit/pull/2983)
257
+
258
+ The `useComboboxInput` hook, and the `Combobox.Input` component used to automatically update the
259
+ input when an option was selected. This functionality has been split between
260
+ `useComboboxInputArbitrary` and `useComboboxInputConstrained` depending on the combobox's value
261
+ type. The `useComboboxInput` had the arbitrary functionality built in. This has been separated out.
262
+ The `<Select>` component has been updated to use `useComboboxInputConstrained` hook and the
263
+ `Autocomplete` example uses the `useComboboxInputArbitrary` hook. This is a breaking change if you
264
+ use the `Combobox.Input` component directly. You'll have to either pass the
265
+ `useComboboxInputArbitrary` elemProps hook directly to the `<Combbox.Input>` or create a new
266
+ component composing them.
267
+
268
+ ```tsx
269
+ // v11
270
+ <Combobox>
271
+ <Combobox.Input />
272
+ // ...
273
+ </Combobox>
274
+
275
+ // v12
276
+ <Combobox>
277
+ <Combobox.Input elemPropsHook={useComboboxInputArbitrary} />
278
+ // ...
279
+ </Combobox>
280
+
281
+ // Better - create a specialized component
282
+ const useMyComboboxInput = composeHooks(
283
+ // or your own model that extends `useComboboxModel`
284
+ createElemPropsHook(useComboboxModel)(model => {
285
+ return {
286
+ // anything you need your input to do
287
+ }
288
+ }),
289
+ useComboboxInputArbitrary,
290
+ useComboboxInput
291
+ )
292
+
293
+ const MyComboboxInput = createSubcomponent(TextInput)({
294
+ // or your own model that extends `useComboboxModel`
295
+ modelHook: useComboboxModel,
296
+ elemPropsHook: useMyComboboxInput,
297
+ })((elemProps, Element) => {
298
+ // return a TextInput
299
+ return <Element {...elemProps} />
300
+
301
+ // return an InputGroupgs
302
+ return (
303
+ <InputGroup>
304
+ <InputGroup.InnerStart>{/* Icon or something */}</InputGroup.InnerStart>
305
+ <InputGroup.Input as={Element} {...elemProps} />
306
+ <InputGroup.InnerEnd><InputGroup.ClearButton /></InputGroup.InnerEnd>
307
+ </InputGroup>
308
+ )
309
+ })
310
+ ```
311
+
236
312
  ### Form Field
237
313
 
238
314
  <div style={{display: 'inline-flex', gap: '.5rem'}}>
@@ -246,7 +322,8 @@ The following changes have been made to the API:
246
322
 
247
323
  **PRs:** [#2865](https://github.com/Workday/canvas-kit/pull/2865),
248
324
  [#2881](https://github.com/Workday/canvas-kit/pull/2881),
249
- [#2934](https://github.com/Workday/canvas-kit/pull/2934)
325
+ [#2934](https://github.com/Workday/canvas-kit/pull/2934),
326
+ [2973](https://github.com/Workday/canvas-kit/pull/2973)
250
327
 
251
328
  We've promoted FormField from [Preview](#preview) to [Main](#main). The following changes has been
252
329
  made to provide more flexibility and better explicit components when using inputs.
@@ -294,6 +371,7 @@ an example of how to **update** your code to match the new compound component AP
294
371
  labelPosition={FormField.LabelPosition.Left}
295
372
  useFieldSet={true}
296
373
  required={true}
374
+ inputId='input-id'
297
375
  hintId="hint-alert"
298
376
  hintText="Please enter a valid email."
299
377
  label="Email"
@@ -304,9 +382,10 @@ an example of how to **update** your code to match the new compound component AP
304
382
 
305
383
  // v12 Newly promoted FormField from Preview to Main
306
384
  <FormField
307
- error="error"
385
+ error="alert"
308
386
  orientation="horizontalStart"
309
387
  isRequired={true}
388
+ id='input-id'
310
389
  >
311
390
  <FormField.Label>Email</FormField.Label>
312
391
  <FormField.Field>
@@ -316,6 +395,34 @@ an example of how to **update** your code to match the new compound component AP
316
395
  </FormField>
317
396
  ```
318
397
 
398
+ - `FormField.LabelPosition.Hidden` is no longer valid. If you still want to hide the label, use the
399
+ prop `isHidden`.
400
+
401
+ ```tsx
402
+ // v11 FormField in Main
403
+ <FormField
404
+ error={FormField.ErrorType.Alert}
405
+ labelPosition={FormField.LabelPosition.Hidden}
406
+ useFieldSet={true}
407
+ required={true}
408
+ inputId="input-id"
409
+ label="Search"
410
+ >
411
+ <TextInput onChange={handleChange} value={value} />
412
+ </FormField>;
413
+
414
+ // v12 Newly promoted FormField from Preview to Main
415
+
416
+ //...
417
+
418
+ <FormField error="alert" orientation="horizontalStart" isRequired={true} id="input-id">
419
+ <FormField.Label isHidden>Search</FormField.Label>
420
+ <FormField.Field>
421
+ <FormField.Input as={TextInput} onChange={handleChange} value={value} />
422
+ </FormField.Field>
423
+ </FormField>;
424
+ ```
425
+
319
426
  **Noticeable changes:**
320
427
 
321
428
  - `error` prop takes in the following values: `"error" | "alert"`.
@@ -332,6 +439,10 @@ an example of how to **update** your code to match the new compound component AP
332
439
  - `label` is no longer a valid prop. Use `FormField.Label` sub component to render your label text.
333
440
  - Instead of rendering an input, ensure you use `FormField.Input` with the `as` prop. This ensures
334
441
  proper error handling and aria attributes for accessibility.
442
+ - `inputId` is no longer a valid prop. Use `id` if you want a custom `id`, otherwise, the component
443
+ will handle generating a unique id to associate each element for accessibility.
444
+ - `isHidden` has been added as a prop to `FormField.Label` in cases where you want to hide the label
445
+ while still meeting accessibility standards.
335
446
 
336
447
  🤖 The codemod will handle the change of `orientation="horizontal"` to
337
448
  `orientation="horizontalStart"` if you're using the string literal values. It will also handle
@@ -399,12 +510,12 @@ pass the interface that the `as` prop is pointing to.
399
510
  **PRs:** [#2934](https://github.com/Workday/canvas-kit/pull/2934),
400
511
 
401
512
  `SearchForm` is now using the newly promoted `FormField` component. `SearchForm` now uses `labelId`
402
- to set the appropiate aria attributes and `id` on the underlying input element. There should be no
403
- visual breaking changes and the API remains the same.
513
+ to set the appropiate aria attributes and `id` on the underlying input element.
404
514
 
405
515
  ### Select
406
516
 
407
- **PR:** [#2865](https://github.com/Workday/canvas-kit/pull/2865)
517
+ **PRs:** [#2865](https://github.com/Workday/canvas-kit/pull/2865),
518
+ [#2983](https://github.com/Workday/canvas-kit/pull/2983)
408
519
 
409
520
  As we transition to use our CSS tokens to provide better theming capabilities and our new styling
410
521
  methods, we're moving away from components extending `Themeable`. `Themeable` has been removed from
@@ -451,6 +562,9 @@ const theme: PartialEmotionCanvasTheme = {
451
562
  </CanvasProvider>;
452
563
  ```
453
564
 
565
+ `Select` has been refactored to use `useComboboxInputConstrained` to sync the model and the `input`
566
+ element regardless of the source. This makes the `Select` a controllable component.
567
+
454
568
  ### Text Area
455
569
 
456
570
  **PR:** [#2825](https://github.com/Workday/canvas-kit/pull/2825)
@@ -472,6 +586,110 @@ interface MyProps {
472
586
  }
473
587
  ```
474
588
 
589
+ `Themeable` has been removed from `TextAreaProps`. If you wish to theme `TextArea`, use our
590
+ `CanvasProvider` with the `theme` object.
591
+
592
+ ```tsx
593
+ const theme: PartialEmotionCanvasTheme = {
594
+ canvas: {
595
+ palette: {
596
+ common: {
597
+ focusOutline: 'pink',
598
+ },
599
+ primary: {
600
+ main: 'green',
601
+ light: 'lightgreen',
602
+ },
603
+ },
604
+ },
605
+ };
606
+
607
+ //...
608
+
609
+ <CanvasProvider theme={theme}>
610
+ <FormField>
611
+ <FormField.Label>Contact</FormField.Label>
612
+ <FormField.Input as={TextArea} onChange={handleChange} />
613
+ </FormField>
614
+ </CanvasProvider>;
615
+ ```
616
+
617
+ ### Text Input
618
+
619
+ **PR:** [#2825](https://github.com/Workday/canvas-kit/pull/2825)
620
+
621
+ `Themeable` has been removed from `TextInputProps`. If you wish to theme `TextInput`, use our
622
+ `CanvasProvider` with the `theme` object.
623
+
624
+ ```tsx
625
+ const theme: PartialEmotionCanvasTheme = {
626
+ canvas: {
627
+ palette: {
628
+ common: {
629
+ focusOutline: 'pink',
630
+ },
631
+ primary: {
632
+ main: 'green',
633
+ light: 'lightgreen',
634
+ },
635
+ },
636
+ },
637
+ };
638
+
639
+ //...
640
+
641
+ <CanvasProvider theme={theme}>
642
+ <FormField>
643
+ <FormField.Label>Contact</FormField.Label>
644
+ <FormField.Input as={TextInput} onChange={handleChange} />
645
+ </FormField>
646
+ </CanvasProvider>;
647
+ ```
648
+
649
+ ### Collections
650
+
651
+ **PR:** [#2982](https://github.com/Workday/canvas-kit/pull/2982)
652
+
653
+ The `navigation.getItem()` function can now return `undefined` instead of throwing an error when an
654
+ item is not found. Throwing an error caused lots of problems when it came to dynamic data. This is a
655
+ breaking change if your application uses `getItem`. It will now have to deal with the possibility of
656
+ an `undefined`.
657
+
658
+ ## Utility Updates
659
+
660
+ **PR:** [#2908](https://github.com/Workday/canvas-kit/pull/2908)
661
+
662
+ ### `mergeProps`
663
+
664
+ `mergeProps` had a bug where sometimes the returned props would be `never`. Also `mergeProps` would
665
+ not narrow types which would require you to add `as const`. We fixed the type signature to more
666
+ accurately reflect how `mergeProps` works. This may catch new type errors not caught before. There
667
+ is no way to codemod this. Let us know if you need help fixing new type errors introduced by this
668
+ change.
669
+
670
+ More information: https://github.com/Workday/canvas-kit/discussions/2979
671
+
672
+ ### `createElemPropsHook`
673
+
674
+ `createElemPropsHook` now uses
675
+ [const Type Parameters](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-0.html#const-type-parameters)
676
+ to narrow types in the object. This prevents requiring `as const` in some situations. This alone
677
+ should fix bugs instead of introduce them.
678
+
679
+ More information: https://github.com/Workday/canvas-kit/discussions/2979
680
+
681
+ ### `composeHooks`
682
+
683
+ `composeHooks` uses `mergeProps` and suffered the same bugs. If any hook in the `composeHooks` chain
684
+ used a `null` prop, the entire prop object returned was typed as `never`. This caused a bug where if
685
+ the Component required a prop, it wasn't being provided by the composed hook. Some of our components
686
+ manually added to the component's prop interface so the component's render function wouldn't
687
+ complain. This has been fixed. This may be a breaking change where before the spread `elemProps` was
688
+ `never`, so no type conflicts could exist with component props. Now all props are properly
689
+ represented which may mean TypeScript is now catching bugs it didn't before.
690
+
691
+ More information: https://github.com/Workday/canvas-kit/discussions/2979
692
+
475
693
  ## Troubleshooting
476
694
 
477
695
  ### My Styles Seem Broken?
@@ -1,3 +1,6 @@
1
+ import {Markdown} from '@storybook/blocks';
2
+
3
+
1
4
  # Canvas Kit 5.0 Upgrade Guide
2
5
 
3
6
  Below are the breaking changes made in Canvas Kit v5. Please
@@ -120,56 +123,51 @@ updated as you expect.
120
123
  tokens in `@workday/canvas-kit-labs-react-core`, but some are using the Legacy type in
121
124
  `@workday/canvas-kit-react-core`.
122
125
 
123
- | Beta Type (px) | Responsive Type (rem) |
124
- | --------------- | ----------------------------------------- |
125
- | `brand1` (56px) | `levels.title.large` ( 3.5rem \ 56px) |
126
- | `brand2` (48px) | `levels.title.medium` ( 3rem \ 48px) |
127
- | `h1` (40px) | `levels.title.small` ( 2.5rem \ 40px) |
128
- | `h2` (32px) | `levels.heading.large` ( 2rem \ 32px) |
129
- | `h3` (24px) | `levels.heading.small` ( 1.5rem \ 24px) |
130
- | `h4` (20px) | `levels.body.large` ( 1.25rem \ 20px) |
131
- | `h5` (20px) | `levels.body.large` ( 1.25rem \ 20px) |
132
- | `body` (16px) | `levels.body.small` ( 1rem \ 16px) |
133
- | `body2` (14px) | `levels.subtext.large` ( 0.875rem \ 14px) |
134
- | `small` (13px) | `levels.subtext.medium` ( 0.75rem \ 12px) |
135
-
136
- | Legacy Type (px) | Responsive Type (rem) |
137
- | ----------------- | ---------------------------------------- |
138
- | `dataViz1` (56px) | `levels.title.large` (3.5rem \ 56px) |
139
- | `dataViz2` (34px) | `levels.heading.large` (2rem \ 32px) |
140
- | `h1` (28px) | `levels.heading.medium` (1.75rem \ 28px) |
141
- | `h2` (24px) | `levels.heading.small` (1.5rem \ 24px) |
142
- | `h3` (20px) | `levels.body.large` (1.25rem,) \ 20px |
143
- | `h4` (16px) | `levels.body.small` (1rem \ 16px) |
144
- | `h5` (16px) | `levels.body.small` (1rem \ 16px) |
145
- | `body` (14px) | `levels.subtext.large` (0.875rem \ 14px) |
146
- | `body2` (13px) | `levels.subtext.medium` (0.75rem \ 12px) |
147
- | `small` (12px) | `levels.subtext.medium` (0.75rem \ 12px) |
126
+ <Markdown>{`
127
+ | Legacy Type (px) | Responsive Type (rem) |
128
+ | ----------------- | ---------------------------------------- |
129
+ | \`dataViz1\` (56px) | \`levels.title.large\` (3.5rem \ 56px) |
130
+ | \`dataViz2\` (34px) | \`levels.heading.large\` (2rem \ 32px) |
131
+ | \`h1\` (28px) | \`levels.heading.medium\` (1.75rem \ 28px) |
132
+ | \`h2\` (24px) | \`levels.heading.small\` (1.5rem \ 24px) |
133
+ | \`h3\` (20px) | \`levels.body.large\` (1.25rem,) \ 20px |
134
+ | \`h4\` (16px) | \`levels.body.small\` (1rem \ 16px) |
135
+ | \`h5\` (16px) | \`levels.body.small\` (1rem \ 16px) |
136
+ | \`body\` (14px) | \`levels.subtext.large\` (0.875rem \ 14px) |
137
+ | \`body2\` (13px) | \`levels.subtext.medium\` (0.75rem \ 12px) |
138
+ | \`small\` (12px) | \`levels.subtext.medium\` (0.75rem \ 12px) |
139
+ `}</Markdown>
148
140
 
149
141
  - 🤖 Property Updates
150
142
 
151
143
  All `fontFamily`, `fontSize`, and `fontWeight` property updates are handled by the codemod.
152
144
 
153
- | CSS Property | Corresponding Token | Notes |
145
+ <Markdown>
146
+ {`| CSS Property | Corresponding Token | Notes |
154
147
  | ------------ | ------------------------------ | --------------------------------------------------------------- |
155
- | `fontFamily` | `type.properties.fontFamilies` | `default` (Roboto) and `monospace` (Roboto Mono) are available |
156
- | `fontSize` | `type.properties.fontSizes` | please consult the type hierarchies above to map values |
157
- | `fontWeight` | `type.properties.fontWeights` | `regular` (400), `medium` (500), and `bold` (700) are available |
148
+ | \`fontFamily\` | \`type.properties.fontFamilies\` | \`default\` (Roboto) and \`monospace\` (Roboto Mono) are available |
149
+ | \`fontSize\` | \`type.properties.fontSizes\` | please consult the type hierarchies above to map values |
150
+ | \`fontWeight\` | \`type.properties.fontWeights\` | \`regular\` (400), \`medium\` (500), and \`bold\` (700) are available |`}
151
+ </Markdown>
158
152
 
159
153
  - 🤖 Variant Updates
160
154
 
161
155
  All `variant` updates _except `link`_ are handled by the codemod. Please see the
162
156
  [variants](#variants) section below for more information.
163
157
 
164
- | Variant | Transformation | Notes |
165
- | ---------------------- | ------------------------------------------------------------------------------ | --------------------------------------- |
166
- | `type.variant.error` | `type.variants.error` | name change only |
167
- | `type.variant.hint` | `type.variants.hint` | name change only |
168
- | `type.variant.inverse` | `type.variants.inverse` | name change only |
169
- | `type.variant.button` | `{fontWeight: type.properties.fontWeights.bold}` | variant deprecated, use type properties |
170
- | `type.variant.caps` | `{textTransform: 'uppercase', fontWeight: type.properties.fontWeights.medium}` | variant deprecated, use type properties |
171
- | `type.variant.label` | `{fontWeight: type.properties.fontWeights.medium}` | variant deprecated, use type properties |
172
- | `type.variant.mono` | `{fontFamily: type.properties.fontFamilies.monospace}` | variant deprecated, use type properties |
158
+ <Markdown>
159
+ {`
160
+ | Variant | Transformation | Notes |
161
+ | ---------------------- | ------------------------------------------------------------------------------ | --------------------------------------- |
162
+ | \`type.variant.error\` | \`type.variants.error\` | name change only |
163
+ | \`type.variant.hint\` | \`type.variants.hint\` | name change only |
164
+ | \`type.variant.inverse\` | \`type.variants.inverse\` | name change only |
165
+ | \`type.variant.button\` | \`{fontWeight: type.properties.fontWeights.bold}\` | variant deprecated, use type properties |
166
+ | \`type.variant.caps\` | \`{textTransform: 'uppercase', fontWeight: type.properties.fontWeights.medium}\` | variant deprecated, use type properties |
167
+ | \`type.variant.label\` | \`{fontWeight: type.properties.fontWeights.medium}\` | variant deprecated, use type properties |
168
+ | \`type.variant.mono\` | \`{fontFamily: type.properties.fontFamilies.monospace}\` | variant deprecated, use type properties |
169
+ `}
170
+ </Markdown>
173
171
 
174
172
  #### Manual Updates
175
173
 
@@ -637,14 +635,20 @@ types (which were too generic) and their JSDoc hints.
637
635
 
638
636
  The following table describes each update:
639
637
 
638
+ <Markdown>
639
+ {`
640
640
  | Before | After | Change Description |
641
641
  | --------------------- | ------------------------- | -------------------------------- |
642
- | `spacing` | `space` | name change only |
643
- | `spacingNumbers` | `spaceNumbers` | name change only |
644
- | `CanvasSpacing` | `CanvasSpace` | name change and improved types\* |
645
- | `CanvasSpacingValue` | `CanvasSpaceValues` | name change only |
646
- | `CanvasSpacingNumber` | `CanvasSpaceNumbers` | name change and improved types\* |
647
- | `n/a` | `CanvasSpaceNumberValues` | new type! |
642
+ | \`spacing\` | \`space\` | name change only |
643
+ | \`spacingNumbers\` | \`spaceNumbers\` | name change only |
644
+ | \`CanvasSpacing\` | \`CanvasSpace\` | name change and improved types\* |
645
+ | \`CanvasSpacingValue\` | \`CanvasSpaceValues\` | name change only |
646
+ | \`CanvasSpacingNumber\` | \`CanvasSpaceNumbers\` | name change and improved types\* |
647
+ | \`n/a\` | \`CanvasSpaceNumberValues\` | new type! |
648
+
649
+ `}
650
+
651
+ </Markdown>
648
652
 
649
653
  \* Before, the types were too generic and not very useful. They now better reflect the values they
650
654
  represent.
@@ -1197,14 +1201,18 @@ Pass a `css` prop or a styled button instead to have a custom styled button. You
1197
1201
 
1198
1202
  If you were using `usePopup` before, here's a list of equivalent APIs:
1199
1203
 
1204
+ <Markdown>
1205
+ {`
1200
1206
  | Before | After |
1201
1207
  | ----------------------------------------------------------------------- | ------------------------------------- |
1202
- | `const { popperProps, targetProps, closePopup, stackRef } = usePopup()` | `const model = usePopupModel()` |
1203
- | `popperProps.open` | `model.state.visibility !== 'hidden'` |
1204
- | `closePopup()` | `model.events.hide()` |
1205
- | `stackRef` or `popperProps.ref` | `model.state.stackRef` |
1206
- | `popperProps.anchorElement` | `model.state.targetRef.current` |
1207
- | `targetProps.onClick` | `usePopupTarget(model).onClick` |
1208
+ | \`const { popperProps, targetProps, closePopup, stackRef } = usePopup()\` | \`const model = usePopupModel()\` |
1209
+ | \`popperProps.open\` | \`model.state.visibility !== 'hidden'\` |
1210
+ | \`closePopup()\` | \`model.events.hide()\` |
1211
+ | \`stackRef\` or \`popperProps.ref\` | \`model.state.stackRef\` |
1212
+ | \`popperProps.anchorElement\` | \`model.state.targetRef.current\` |
1213
+ | \`targetProps.onClick\` | \`usePopupTarget(model).onClick\` |
1214
+ `}
1215
+ </Markdown>
1208
1216
 
1209
1217
  #### New Focus Management
1210
1218
 
@@ -1279,11 +1287,16 @@ model and behaviors, the following is equivalent:
1279
1287
 
1280
1288
  `Popup.Card` uses `Card`, which is now using `Box`. Consequently, the following props have changed:
1281
1289
 
1290
+ <Markdown>
1291
+ {`
1282
1292
  | Before | After |
1283
1293
  | ------------------------------ | ------------------------------------------ |
1284
- | `padding={Popup.Padding.zero}` | `padding="zero"` or `padding={space.zero}` |
1285
- | `depth={depth[0]}` | `depth={0}` |
1286
- | `popupRef={ref}` | `ref={ref}` |
1294
+ | \`padding={Popup.Padding.zero}\` | \`padding="zero"\` or \`padding={space.zero}\` |
1295
+ | \`depth={depth[0]}\` | \`depth={0}\` |
1296
+ | \`popupRef={ref}\` | \`ref={ref}\` |
1297
+ `}
1298
+
1299
+ </Markdown>
1287
1300
 
1288
1301
  #### Transitioning
1289
1302
 
@@ -1,3 +1,6 @@
1
+ import {Markdown} from '@storybook/blocks';
2
+
3
+
1
4
  # Canvas Kit 6.0 Upgrade Guide
2
5
 
3
6
  Below are the breaking changes made in Canvas Kit v6. Please
@@ -365,13 +368,17 @@ layout. If you have questions about this testing, please reach out to our team.
365
368
 
366
369
  Below is a reference table for the V5 and V6 breakpoint values.
367
370
 
371
+ <Markdown>
372
+ {`
368
373
  | Breakpoint Name | V5 Value (px) | V6 Value (px) |
369
374
  | --------------- | ------------- | ------------- |
370
- | `zero` | 0 | 0 |
371
- | `s` | 600 | 320 |
372
- | `m` | 900 | 768 |
373
- | `l` | 1280 | 1024 |
374
- | `xl` | 1920 | 1440 |
375
+ | \`zero\` | 0 | 0 |
376
+ | \`s\` | 600 | 320 |
377
+ | \`m\` | 900 | 768 |
378
+ | \`l\` | 1280 | 1024 |
379
+ | \`xl\` | 1920 | 1440 |
380
+ `}
381
+ </Markdown>
375
382
 
376
383
  Also for reference, these are our viewport ranges:
377
384
 
@@ -1,3 +1,6 @@
1
+ import {Markdown} from '@storybook/blocks';
2
+
3
+
1
4
  # Canvas Kit 7.0 Upgrade Guide
2
5
 
3
6
  This guide contains breaking changes in Canvas Kit v7. Please
@@ -559,15 +562,19 @@ To consolidate Button APIs, we've removed `IconButton` in favor of `SecondaryBut
559
562
  `TertiaryButton`. The following table shows how `IconButton` variants in v6 map to their
560
563
  corresponding buttons in v7.
561
564
 
562
- | v6 `IconButton` variant | v7 button (and variant, if necessary) |
565
+ <Markdown>
566
+ {`
567
+ | v6 \`IconButton\` variant | v7 button (and variant, if necessary) |
563
568
  | -------------------------- | ---------------------------------------- |
564
- | `circle` (default variant) | `TertiaryButton` |
565
- | `circleFilled` | `SecondaryButton` |
566
- | `inverse` | `TertiaryButton` with `inverse` variant |
567
- | `inverseFilled` | `SecondaryButton` with `inverse` variant |
568
- | `plain` | Unsupported |
569
- | `square` | Unsupported |
570
- | `squareFilled` | Unsupported |
569
+ | \`circle\` (default variant) | \`TertiaryButton\` |
570
+ | \`circleFilled\` | \`SecondaryButton\` |
571
+ | \`inverse\` | \`TertiaryButton\` with \`inverse\` variant |
572
+ | \`inverseFilled\` | \`SecondaryButton\` with \`inverse\` variant |
573
+ | \`plain\` | Unsupported |
574
+ | \`square\` | Unsupported |
575
+ | \`squareFilled\` | Unsupported |
576
+ `}
577
+ </Markdown>
571
578
 
572
579
  > Note: See below for more information about how to manually migrate from
573
580
  > [unsupported v6 variants](#unsupported-iconbutton-variants).