-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* docs: Add WIP v4.0 migration guide * docs: Add changelog entry for 4.0.0-beta.0 * chore: Bump modules to v4.0.0-beta.0 * docs: Add latest PR to changelog
- Loading branch information
Showing
64 changed files
with
420 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
# Canvas Kit 4.0 Migration Guide | ||
|
||
Below are the breaking changes made in Canvas Kit v4. Please reach out if you have any questions | ||
about the update. | ||
|
||
CSS users rejoice! :tada: No breaking changes in this release. The following changes all relate to | ||
our React infrastructure and components. | ||
|
||
## Infrastructure Upgrades | ||
|
||
Breaking: | ||
|
||
- React & ReactDOM upgraded to 16.12 (https://github.com/Workday/canvas-kit/pull/533) | ||
- We are now fully adopting hooks, so <= 16.7 is no longer supported | ||
|
||
Non-breaking: | ||
|
||
- Typescript upgraded to v3.8 (https://github.com/Workday/canvas-kit/pull/533) | ||
- [downlevel-dts](https://github.com/sandersn/downlevel-dts) was used to resolve breaking changes | ||
in `typescript@3.7`, so older versions of typescript are still supported. However, it is | ||
recommended to use v3.8. | ||
|
||
## Breaking Component Changes | ||
|
||
### Button | ||
|
||
We've refactored our Button components to simplify logic and add support for theming. | ||
|
||
PRs: | ||
|
||
- https://github.com/Workday/canvas-kit/pull/471 | ||
- https://github.com/Workday/canvas-kit/pull/509 | ||
- https://github.com/Workday/canvas-kit/pull/527 | ||
|
||
#### Changes | ||
|
||
- Some of the button variants have been split into different components to prevent invalid API | ||
combinations. `DeleteButton`, `HighlightButton`, and `OutlineButton` are now separate components | ||
with their own interface. Here are some of the invalid prop combinations that are no longer | ||
possible: | ||
|
||
- Delete button with a data label or icon | ||
- Dropdown button with a data label or icon | ||
- Highlight button with a data label | ||
- Highlight button without an icon | ||
- Dropdown with variants other than primary and secondary | ||
- Small buttons with an icon or data label | ||
- Small Highlight button | ||
- Small Dropdown button | ||
- etc. | ||
|
||
- **Required changes:** | ||
- `<Button variant={Button.Variant.Delete}>` > `<DeleteButton>` | ||
- `<Button variant={Button.Variant.Highlight}>` > `<HighlightButton>` | ||
- `<Button variant={Button.Variant.OutlineSecondary}>` > `<OutlineButton>` | ||
- `<Button variant={Button.Variant.OutlinePrimary}>` > | ||
`<OutlineButton variant={OutlineButton.Variant.Primary}>` | ||
- `<Button variant={Button.Variant.OutlineInverse}>` > | ||
`<OutlineButton variant={OutlineButton.Variant.Inverse}>` | ||
- All invalid prop combinations (noted above) will need to be remedied | ||
|
||
- The majority of the button variant types have changed. `BaseButtonProps` is no longer available as | ||
each button variant has their own interface. | ||
- React >= 16.8 required for hooks | ||
- Spacing within buttons has been corrected to match the specs. This may cause horizontal flow | ||
changes | ||
- `TextButton` now only allows `TextButtonSize.Small` and `TextButtonSize.Medium`. **Required | ||
changes:** | ||
- `TextButtonSize.Medium` > `"small"` or `TextButtonSize.Small` | ||
- `TextButtonSize.Large` > `"medium"` or `TextButtonSize.Medium` | ||
- All caps variants for TextButton have been turned into a prop | ||
- **Required changes:** | ||
- `<TextButton variant={TextButton.Variant.AllCaps}>` > `<TextButton allCaps={true}>` | ||
- `<TextButton variant={TextButton.Variant.InverseAllCaps}>` > | ||
`<TextButton variant={TextButton.Variant.Inverse} allCaps={true}>` | ||
- All caps large/medium text buttons now correctly use 16px font (up from 14) | ||
|
||
#### Quality of Life changes: | ||
|
||
With the new components for variants and the simpler types for sizes, the code for complex buttons | ||
is much more concise. | ||
|
||
Before: | ||
|
||
```tsx | ||
<Button variant={Button.Variant.OutlineSecondary} size={Button.Size.Large}> | ||
Label | ||
</Button> | ||
``` | ||
|
||
After: | ||
|
||
```tsx | ||
<OutlineButton size="large">Label</OutlineButton> | ||
``` | ||
|
||
--- | ||
|
||
### IconButtonToggleGroup | ||
|
||
This component has been renamed to `SegmentedControl` and has been converted into it's own component | ||
(`@workday/canvas-kit-react-segmented-control`). `IconButtonToggleGroup` is no longer exported from | ||
`@workday/canvas-kit-react-button`. | ||
|
||
PRs: | ||
|
||
- https://github.com/Workday/canvas-kit/pull/505 | ||
- https://github.com/Workday/canvas-kit/pull/524 | ||
|
||
Before: | ||
|
||
```tsx | ||
import {IconButtonToggleGroup} from '@workday/canvas-kit-react-button'; | ||
|
||
<IconButtonToggleGroup> | ||
<IconButton icon={listViewIcon} title="List View" aria-label="List View" /> | ||
<IconButton icon={worksheetsIcon} title="Worksheets" aria-label="Worksheets" /> | ||
</IconButtonToggleGroup>; | ||
``` | ||
|
||
After: | ||
|
||
```tsx | ||
import {SegmentedControl} from '@workday/canvas-kit-labs-react-segmented-control'; | ||
|
||
<SegmentedControl> | ||
<IconButton icon={listViewIcon} title="List View" aria-label="List View" /> | ||
<IconButton icon={worksheetsIcon} title="Worksheets" aria-label="Worksheets" /> | ||
</SegmentedControl>; | ||
``` | ||
|
||
--- | ||
|
||
### Modal | ||
|
||
Modal now uses React Portals which could cause a visual breaking change related to z-indexing | ||
|
||
PRs: | ||
|
||
- https://github.com/Workday/canvas-kit/pull/419 | ||
|
||
--- | ||
|
||
**More to come! Check out [our 4.0 tracking issue](https://github.com/Workday/canvas-kit/issues/483) | ||
for all planned changes.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.