@workday/canvas-kit-docs 13.0.0-alpha.998-next.0 → 13.0.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.
- package/dist/es6/lib/ExampleCodeBlock.d.ts +1 -2
- package/dist/es6/lib/ExampleCodeBlock.d.ts.map +1 -1
- package/dist/es6/lib/ExampleCodeBlock.js +53 -28
- package/dist/es6/lib/MDXElements.d.ts +1 -2
- package/dist/es6/lib/MDXElements.d.ts.map +1 -1
- package/dist/es6/lib/MDXElements.js +6 -6
- package/dist/es6/lib/MoreTooltip.d.ts +1 -1
- package/dist/es6/lib/MoreTooltip.d.ts.map +1 -1
- package/dist/es6/lib/MoreTooltip.js +11 -12
- package/dist/es6/lib/Specifications.d.ts +1 -2
- package/dist/es6/lib/Specifications.d.ts.map +1 -1
- package/dist/es6/lib/Specifications.js +3 -20
- package/dist/es6/lib/StylePropsTable.d.ts +1 -2
- package/dist/es6/lib/StylePropsTable.d.ts.map +1 -1
- package/dist/es6/lib/StylePropsTable.js +6 -16
- package/dist/es6/lib/Table.d.ts.map +1 -1
- package/dist/es6/lib/Table.js +7 -7
- package/dist/es6/lib/Value.d.ts +3 -3
- package/dist/es6/lib/Value.d.ts.map +1 -1
- package/dist/es6/lib/Value.js +16 -51
- package/dist/es6/lib/docs.js +270155 -169429
- package/dist/es6/lib/stackblitzFiles/.eslintrc.cjs.txt +15 -0
- package/dist/es6/lib/stackblitzFiles/App.d.ts +2 -0
- package/dist/es6/lib/stackblitzFiles/App.d.ts.map +1 -0
- package/dist/es6/lib/stackblitzFiles/App.js +17 -0
- package/dist/es6/lib/stackblitzFiles/App.tsx +33 -0
- package/dist/es6/lib/stackblitzFiles/Demo.d.ts +2 -0
- package/dist/es6/lib/stackblitzFiles/Demo.d.ts.map +1 -0
- package/dist/es6/lib/stackblitzFiles/Demo.js +2 -0
- package/dist/es6/lib/stackblitzFiles/Demo.tsx +1 -0
- package/dist/es6/lib/stackblitzFiles/index.html +13 -0
- package/dist/es6/lib/stackblitzFiles/main.d.ts +4 -0
- package/dist/es6/lib/stackblitzFiles/main.d.ts.map +1 -0
- package/dist/es6/lib/stackblitzFiles/main.js +25 -0
- package/dist/es6/lib/stackblitzFiles/main.tsx +27 -0
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.d.ts +2 -0
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.d.ts.map +1 -0
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.js +42 -0
- package/dist/es6/lib/stackblitzFiles/packageJSONFile.ts +42 -0
- package/dist/es6/lib/stackblitzFiles/tsconfig.json +26 -0
- package/dist/es6/lib/stackblitzFiles/tsconfig.node.json +12 -0
- package/dist/es6/lib/stackblitzFiles/vite-env.d.ts +1 -0
- package/dist/es6/lib/stackblitzFiles/vite.config.d.ts +4 -0
- package/dist/es6/lib/stackblitzFiles/vite.config.d.ts.map +1 -0
- package/dist/es6/lib/stackblitzFiles/vite.config.js +7 -0
- package/dist/es6/lib/stackblitzFiles/vite.config.ts +10 -0
- package/dist/es6/lib/widgetUtils.d.ts +5 -5
- package/dist/es6/lib/widgetUtils.d.ts.map +1 -1
- package/dist/es6/lib/widgetUtils.js +25 -54
- package/dist/es6/lib/widgets/array.js +2 -4
- package/dist/es6/lib/widgets/callExpression.js +2 -14
- package/dist/es6/lib/widgets/canvasColor.js +2 -2
- package/dist/es6/lib/widgets/component.js +2 -4
- package/dist/es6/lib/widgets/conditional.js +2 -12
- package/dist/es6/lib/widgets/enhancedComponent.js +15 -67
- package/dist/es6/lib/widgets/external.js +2 -4
- package/dist/es6/lib/widgets/function.js +7 -26
- package/dist/es6/lib/widgets/intersection.js +2 -3
- package/dist/es6/lib/widgets/model.js +3 -19
- package/dist/es6/lib/widgets/object.js +2 -2
- package/dist/es6/lib/widgets/parenthesis.js +2 -5
- package/dist/es6/lib/widgets/primitives.js +9 -27
- package/dist/es6/lib/widgets/qualifiedName.js +2 -5
- package/dist/es6/lib/widgets/symbol.js +2 -2
- package/dist/es6/lib/widgets/tuple.js +2 -5
- package/dist/es6/lib/widgets/typeParameter.js +2 -13
- package/dist/es6/lib/widgets/union.js +4 -10
- package/dist/es6/mdx/installBlock.d.ts +1 -2
- package/dist/es6/mdx/installBlock.d.ts.map +1 -1
- package/dist/es6/mdx/installBlock.js +2 -6
- package/dist/es6/mdx/style-props/examples/Background.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Background.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Background.js +2 -5
- package/dist/es6/mdx/style-props/examples/Border.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Border.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Border.js +2 -5
- package/dist/es6/mdx/style-props/examples/Color.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Color.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Color.js +2 -5
- package/dist/es6/mdx/style-props/examples/Depth.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Depth.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Depth.js +2 -5
- package/dist/es6/mdx/style-props/examples/Flex.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Flex.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Flex.js +2 -14
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/FlexItem.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/FlexItem.js +2 -13
- package/dist/es6/mdx/style-props/examples/Grid.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Grid.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Grid.js +2 -6
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/GridItem.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/GridItem.js +2 -6
- package/dist/es6/mdx/style-props/examples/Layout.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Layout.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Layout.js +2 -5
- package/dist/es6/mdx/style-props/examples/Other.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Other.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Other.js +2 -5
- package/dist/es6/mdx/style-props/examples/Position.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Position.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Position.js +2 -5
- package/dist/es6/mdx/style-props/examples/Space.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Space.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Space.js +2 -8
- package/dist/es6/mdx/style-props/examples/Text.d.ts +1 -2
- package/dist/es6/mdx/style-props/examples/Text.d.ts.map +1 -1
- package/dist/es6/mdx/style-props/examples/Text.js +2 -5
- package/dist/es6/mdx/versionsTable.d.ts +1 -2
- package/dist/es6/mdx/versionsTable.d.ts.map +1 -1
- package/dist/es6/mdx/versionsTable.js +23 -49
- package/dist/es6/mdx/welcomePage.d.ts +1 -2
- package/dist/es6/mdx/welcomePage.d.ts.map +1 -1
- package/dist/es6/mdx/welcomePage.js +37 -49
- package/dist/mdx/12.0-UPGRADE-GUIDE.mdx +1 -1
- package/dist/mdx/13.0-UPGRADE-GUIDE.mdx +454 -0
- package/dist/mdx/CODEMODS.mdx +58 -0
- package/dist/mdx/CONTRIBUTING.mdx +8 -0
- package/dist/mdx/TESTING.mdx +34 -0
- package/dist/mdx/preview-react/_examples/mdx/{Forms.mdx → FormLibraryExample.mdx} +0 -2
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Basic.tsx +1 -1
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Body.tsx +1 -1
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Caution.tsx +1 -2
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Critical.tsx +5 -12
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/CustomIconCritical.tsx +1 -1
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Heading.tsx +1 -1
- package/dist/mdx/preview-react/information-highlight/examples/Informational.tsx +55 -0
- package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/RTL.tsx +1 -1
- package/dist/mdx/preview-react/loading-sparkles/examples/Basic.tsx +2 -2
- package/dist/mdx/preview-react/multi-select/examples/Basic.tsx +1 -1
- package/dist/mdx/preview-react/multi-select/examples/Complex.tsx +1 -1
- package/dist/mdx/preview-react/multi-select/examples/Controlled.tsx +1 -1
- package/dist/mdx/preview-react/multi-select/examples/Icons.tsx +1 -1
- package/dist/mdx/preview-react/multi-select/examples/Searching.tsx +1 -1
- package/dist/mdx/preview-react/pill/Pill.mdx +18 -9
- package/dist/mdx/preview-react/pill/examples/Basic.tsx +14 -8
- package/dist/mdx/preview-react/pill/examples/CustomStyles.tsx +45 -0
- package/dist/mdx/preview-react/pill/examples/WithAvatar.tsx +16 -10
- package/dist/mdx/preview-react/pill/examples/WithCount.tsx +12 -6
- package/dist/mdx/preview-react/pill/examples/WithList.tsx +15 -5
- package/dist/mdx/preview-react/pill/examples/WithReadOnly.tsx +8 -5
- package/dist/mdx/preview-react/pill/examples/WithRemovable.tsx +23 -11
- package/dist/mdx/preview-react/segmented-control/examples/Disabled.tsx +0 -1
- package/dist/mdx/preview-react/segmented-control/examples/RTL.tsx +0 -1
- package/dist/mdx/preview-react/segmented-control/examples/Vertical.tsx +0 -1
- package/dist/mdx/preview-react/select/examples/Left Label/DefaultWithCustomOptionsLeft.tsx +1 -1
- package/dist/mdx/preview-react/select/examples/Left Label/DefaultWithSimpleOptionsLeft.tsx +1 -1
- package/dist/mdx/preview-react/select/examples/Top Label/Alert.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/Default.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/DefaultWithCustomOptions.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/DefaultWithSimpleOptions.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/Disabled.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/Error.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/Grow.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/Top Label/Scrollable.tsx +0 -2
- package/dist/mdx/preview-react/select/examples/storiesData.tsx +0 -1
- package/dist/mdx/preview-react/side-panel/SidePanel.mdx +28 -3
- package/dist/mdx/preview-react/side-panel/examples/AlwaysOpen.tsx +36 -17
- package/dist/mdx/preview-react/side-panel/examples/Basic.tsx +40 -34
- package/dist/mdx/preview-react/side-panel/examples/ExternalControl.tsx +47 -23
- package/dist/mdx/preview-react/side-panel/examples/HiddenName.tsx +24 -5
- package/dist/mdx/preview-react/side-panel/examples/OnExpandedChange.tsx +22 -6
- package/dist/mdx/preview-react/side-panel/examples/OnStateTransition.tsx +24 -9
- package/dist/mdx/preview-react/side-panel/examples/RightOrigin.tsx +39 -40
- package/dist/mdx/preview-react/side-panel/examples/Variant.tsx +36 -36
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +1 -4
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +1 -4
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +1 -4
- package/dist/mdx/react/_examples/Tooltips.mdx +15 -0
- package/dist/mdx/react/_examples/examples/Tooltips/ListOfUploadedFiles.tsx +38 -0
- package/dist/mdx/react/_examples/mdx/SidePanel.mdx +18 -1
- package/dist/mdx/react/_examples/mdx/examples/GlobalHeader.tsx +1 -1
- package/dist/mdx/react/_examples/mdx/examples/SidePanelWithNavigation.tsx +154 -116
- package/dist/mdx/react/_examples/mdx/examples/SidePanelWithOverlay.tsx +33 -15
- package/dist/mdx/react/_examples/mdx/examples/Table/WithSelectableRows.tsx +1 -1
- package/dist/mdx/react/action-bar/examples/Basic.tsx +0 -1
- package/dist/mdx/react/action-bar/examples/DeleteAction.tsx +0 -2
- package/dist/mdx/react/action-bar/examples/Icons.tsx +0 -2
- package/dist/mdx/react/avatar/avatar/examples/Basic.tsx +2 -3
- package/dist/mdx/react/avatar/avatar/examples/Button.tsx +3 -4
- package/dist/mdx/react/avatar/avatar/examples/CustomStyles.tsx +2 -3
- package/dist/mdx/react/avatar/avatar/examples/Image.tsx +7 -8
- package/dist/mdx/react/avatar/avatar/examples/LazyLoad.tsx +7 -2
- package/dist/mdx/react/avatar/avatar/examples/ObjectFit.tsx +9 -4
- package/dist/mdx/react/avatar/avatar/examples/Size.tsx +10 -11
- package/dist/mdx/react/avatar/avatar/examples/Variant.tsx +2 -3
- package/dist/mdx/react/banner/examples/Error.tsx +0 -2
- package/dist/mdx/react/banner/examples/Sticky.tsx +0 -1
- package/dist/mdx/react/banner/examples/StickyAnimation.tsx +42 -26
- package/dist/mdx/react/breadcrumbs/examples/Basic.tsx +0 -1
- package/dist/mdx/react/button/button/Button.mdx +5 -1
- package/dist/mdx/react/button/button/examples/CustomStyles.tsx +1 -3
- package/dist/mdx/react/button/button/examples/Delete.tsx +0 -2
- package/dist/mdx/react/button/button/examples/ExternalHyperlink.tsx +3 -3
- package/dist/mdx/react/button/button/examples/ExternalHyperlinkInverse.tsx +5 -1
- package/dist/mdx/react/button/button/examples/Hyperlink.tsx +0 -2
- package/dist/mdx/react/button/button/examples/Primary.tsx +0 -2
- package/dist/mdx/react/button/button/examples/ThemeOverrides.tsx +14 -17
- package/dist/mdx/react/collection/mdx/examples/MultiSelection.tsx +2 -1
- package/dist/mdx/react/collection/mdx/examples/Selection.tsx +2 -1
- package/dist/mdx/react/color-picker/color-preview/examples/Basic.tsx +0 -1
- package/dist/mdx/react/dialog/examples/DialogWithFallbackPlacements.tsx +0 -1
- package/dist/mdx/{labs-react → react}/expandable/Expandable.mdx +2 -2
- package/dist/mdx/{labs-react → react}/expandable/examples/Avatar.tsx +5 -7
- package/dist/mdx/{labs-react → react}/expandable/examples/Depth.tsx +1 -4
- package/dist/mdx/{labs-react → react}/expandable/examples/EndIcon.tsx +1 -3
- package/dist/mdx/{labs-react → react}/expandable/examples/HoistedModel.tsx +1 -1
- package/dist/mdx/{labs-react → react}/expandable/examples/LongTitle.tsx +2 -4
- package/dist/mdx/{labs-react → react}/expandable/examples/RTL.tsx +1 -3
- package/dist/mdx/{labs-react → react}/expandable/examples/StartIcon.tsx +1 -3
- package/dist/mdx/react/menu/Menu.mdx +34 -0
- package/dist/mdx/react/menu/examples/Grouping.tsx +32 -0
- package/dist/mdx/react/menu/examples/Icons.tsx +1 -1
- package/dist/mdx/react/menu/examples/Nested.tsx +49 -0
- package/dist/mdx/react/menu/examples/NestedDynamic.tsx +105 -0
- package/dist/mdx/react/modal/examples/Basic.tsx +0 -2
- package/dist/mdx/react/modal/examples/IframeTest.tsx +0 -1
- package/dist/mdx/react/modal/examples/ModalWithPopup.tsx +0 -1
- package/dist/mdx/react/modal/examples/StackedModals.tsx +0 -1
- package/dist/mdx/react/pagination/examples/CustomRange.tsx +0 -1
- package/dist/mdx/react/pagination/examples/GoToForm.tsx +0 -1
- package/dist/mdx/react/pagination/examples/JumpControls.tsx +0 -1
- package/dist/mdx/react/popup/examples/Basic.tsx +0 -2
- package/dist/mdx/react/popup/examples/CloseOnTargetHiddenTest.tsx +0 -1
- package/dist/mdx/react/popup/examples/ComboboxWithinPopup.tsx +0 -1
- package/dist/mdx/react/popup/examples/MultiplePopups.tsx +0 -2
- package/dist/mdx/react/popup/examples/PopupWithFallbackPlacements.tsx +0 -1
- package/dist/mdx/react/popup/examples/PopupWithNonHidablePopup.tsx +0 -1
- package/dist/mdx/react/popup/examples/ReturnFocusTest.tsx +8 -6
- package/dist/mdx/react/popup/examples/TooltipReturnFocus.tsx +0 -1
- package/dist/mdx/react/select/examples/Basic.tsx +1 -0
- package/dist/mdx/react/select/examples/MenuHeight.tsx +0 -1
- package/dist/mdx/react/table/Table.mdx +14 -1
- package/dist/mdx/react/table/examples/BaseHtmlTable.tsx +46 -0
- package/dist/mdx/react/tabs/examples/Basic.tsx +0 -1
- package/dist/mdx/react/tabs/examples/DisabledTab.tsx +0 -1
- package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +3 -2
- package/dist/mdx/react/tabs/examples/NamedTabs.tsx +0 -1
- package/dist/mdx/react/tabs/examples/RightToLeft.tsx +0 -1
- package/dist/mdx/react/text-input/examples/Basic.tsx +0 -3
- package/dist/mdx/react/toast/examples/Basic.tsx +0 -2
- package/dist/mdx/react/toast/examples/ToastAlert.tsx +0 -2
- package/dist/mdx/react/toast/examples/ToastDialog.tsx +0 -2
- package/dist/mdx/react/tokens/Tokens.mdx +1 -1
- package/dist/mdx/react/tooltip/Tooltip.mdx +31 -1
- package/dist/mdx/react/tooltip/examples/Default.tsx +0 -2
- package/dist/mdx/react/tooltip/examples/DescribeType.tsx +0 -2
- package/dist/mdx/react/tooltip/examples/DescriptionType.tsx +20 -0
- package/dist/mdx/react/tooltip/examples/Muted.tsx +0 -2
- package/dist/mdx/react/tooltip/examples/Placements.tsx +14 -11
- package/dist/mdx/style-props/examples/Background.tsx +2 -3
- package/dist/mdx/style-props/examples/Border.tsx +2 -3
- package/dist/mdx/style-props/examples/Color.tsx +2 -3
- package/dist/mdx/style-props/examples/Depth.tsx +2 -3
- package/dist/mdx/style-props/examples/Flex.tsx +0 -1
- package/dist/mdx/style-props/examples/FlexItem.tsx +0 -1
- package/dist/mdx/style-props/examples/Grid.tsx +0 -1
- package/dist/mdx/style-props/examples/GridItem.tsx +0 -1
- package/dist/mdx/style-props/examples/Layout.tsx +0 -1
- package/dist/mdx/style-props/examples/Other.tsx +0 -1
- package/dist/mdx/style-props/examples/Position.tsx +2 -3
- package/dist/mdx/style-props/examples/Space.tsx +2 -3
- package/dist/mdx/style-props/examples/Text.tsx +0 -1
- package/lib/ExampleCodeBlock.tsx +57 -19
- package/lib/MDXElements.tsx +3 -3
- package/lib/StylePropsTable.tsx +1 -2
- package/lib/Table.tsx +0 -1
- package/lib/stackblitzFiles/.eslintrc.cjs.txt +15 -0
- package/lib/stackblitzFiles/App.tsx +33 -0
- package/lib/stackblitzFiles/Demo.tsx +1 -0
- package/lib/stackblitzFiles/index.html +13 -0
- package/lib/stackblitzFiles/main.tsx +27 -0
- package/lib/stackblitzFiles/packageJSONFile.ts +42 -0
- package/lib/stackblitzFiles/tsconfig.json +26 -0
- package/lib/stackblitzFiles/tsconfig.node.json +12 -0
- package/lib/stackblitzFiles/types/custom-imports.d.ts +13 -0
- package/lib/stackblitzFiles/vite-env.d.ts +1 -0
- package/lib/stackblitzFiles/vite.config.ts +10 -0
- package/lib/widgets/array.tsx +0 -2
- package/lib/widgets/canvasColor.tsx +0 -2
- package/lib/widgets/component.tsx +0 -2
- package/lib/widgets/conditional.tsx +0 -2
- package/lib/widgets/enhancedComponent.tsx +1 -1
- package/lib/widgets/external.tsx +3 -2
- package/lib/widgets/model.tsx +0 -2
- package/lib/widgets/parenthesis.tsx +0 -2
- package/lib/widgets/primitives.tsx +1 -5
- package/lib/widgets/qualifiedName.tsx +0 -2
- package/lib/widgets/symbol.tsx +0 -2
- package/lib/widgets/tuple.tsx +0 -2
- package/lib/widgets/typeParameter.tsx +0 -2
- package/package.json +8 -7
- package/dist/mdx/preview-react/InformationHighlight/examples/Informational.tsx +0 -27
- /package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/InformationHighlight.mdx +0 -0
- /package/dist/mdx/{labs-react → react}/expandable/examples/test-avatar.png +0 -0
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import {Table} from '@workday/canvas-kit-react/table';
|
|
2
|
+
import {base, brand, system} from '@workday/canvas-tokens-web';
|
|
3
|
+
import {StatusIndicator} from '@workday/canvas-kit-preview-react/status-indicator';
|
|
4
|
+
import {cssVar} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {Box} from '@workday/canvas-kit-react/layout';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# Canvas Kit 13.0 Upgrade Guide
|
|
9
|
+
|
|
10
|
+
This guide contains an overview of the changes in Canvas Kit v13. Please
|
|
11
|
+
[reach out](https://github.com/Workday/canvas-kit/issues/new?labels=bug&template=bug.md) if you have
|
|
12
|
+
any questions. For common upgrade issues, please see the [Troubleshooting](#troubleshooting) section
|
|
13
|
+
at the end of this guide.
|
|
14
|
+
|
|
15
|
+
## Why You Should Upgrade
|
|
16
|
+
|
|
17
|
+
We're really excited about the updates in Canvas Kit v13! In this release, we:
|
|
18
|
+
|
|
19
|
+
- refactored components to use our Canvas tokens and styling API
|
|
20
|
+
- made several accessibilty improvements
|
|
21
|
+
- updated our brand logos
|
|
22
|
+
- improved our infrastructure
|
|
23
|
+
|
|
24
|
+
### Refactored Components to Use Our Styling API
|
|
25
|
+
|
|
26
|
+
We've continued refactoring our components to use our new styling API and new Canvas tokens. This
|
|
27
|
+
allows us to provide a more consistent styling experience across our components.
|
|
28
|
+
|
|
29
|
+
### Updated Brand Logos
|
|
30
|
+
|
|
31
|
+
As part of Workday's brand refresh, we've updated our Workday logos to align with our new brand
|
|
32
|
+
design.
|
|
33
|
+
|
|
34
|
+
### Improved Support for ES Modules
|
|
35
|
+
|
|
36
|
+
We've updated the `jsx` flag in our `tsconfig` to `react-jsx` to provide better support for newer
|
|
37
|
+
technologies including `Vite`. As part of this change, we've also updated our `react` peer
|
|
38
|
+
dependencies to a minimum version of `17.0.0`.
|
|
39
|
+
|
|
40
|
+
## Table of Contents
|
|
41
|
+
|
|
42
|
+
- [Codemod](#codemod)
|
|
43
|
+
- [Instructions](#instructions)
|
|
44
|
+
- [Component Updates](#component-updates)
|
|
45
|
+
- [Styling API and CSS Tokens](#styling-api-and-canvas-tokens-)
|
|
46
|
+
- [Avatar](#avatar-)
|
|
47
|
+
- [Expandable](#expandable-)
|
|
48
|
+
- [External Hyperlink](#external-hyperlink-)
|
|
49
|
+
- [Form Field and Form Field Group](#form-field-and-form-field-group-)
|
|
50
|
+
- [Pill (Preview)](#pill-preview-)
|
|
51
|
+
- [SidePanel (Preview)](#side-panel-preview-)
|
|
52
|
+
- [Tabs](#tabs-)
|
|
53
|
+
- [Brand Refresh](#brand-refresh)
|
|
54
|
+
- [Logo Updates](#logo-updates-)
|
|
55
|
+
- [Infrastructure](#infrastructure)
|
|
56
|
+
- [Supporting react-jsx](#supporting-react-jsx-)
|
|
57
|
+
- [Troubleshooting](#troubleshooting)
|
|
58
|
+
- [Contributors](#contributors)
|
|
59
|
+
- [Glossary](#glossary)
|
|
60
|
+
- [Main](#main)
|
|
61
|
+
- [Preview](#preview)
|
|
62
|
+
- [Labs](#labs)
|
|
63
|
+
|
|
64
|
+
## Codemod
|
|
65
|
+
|
|
66
|
+
We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
|
|
67
|
+
automatically update your code to work with most of the breaking changes in v13. **Breaking changes
|
|
68
|
+
handled by the codemod are marked with 🤖 in the Upgrade Guide.**
|
|
69
|
+
|
|
70
|
+
### Instructions
|
|
71
|
+
|
|
72
|
+
The easiest way to run our codemod is to use `npx` in your terminal.
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
npx @workday/canvas-kit-codemod v13 [path]
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
79
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
80
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
81
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
82
|
+
`[path]`.
|
|
83
|
+
|
|
84
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
85
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
86
|
+
finished.
|
|
87
|
+
|
|
88
|
+
```sh
|
|
89
|
+
yarn add @workday/canvas-kit-codemod --dev
|
|
90
|
+
yarn canvas-kit-codemod v13 [path]
|
|
91
|
+
yarn remove @workday/canvas-kit-codemod
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Having trouble running our codemods? View our
|
|
95
|
+
[docs](https://workday.github.io/canvas-kit/?path=/docs/guides-codemods--docs) for more information!
|
|
96
|
+
|
|
97
|
+
## Component Updates
|
|
98
|
+
|
|
99
|
+
### Styling API and Canvas Tokens 💅
|
|
100
|
+
|
|
101
|
+
Several components have been refactored to use our
|
|
102
|
+
[Canvas tokens](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs) and
|
|
103
|
+
[styling API](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--docs#createstyles-api).
|
|
104
|
+
The React interface **has not changed**, but Canvas Tokens are now used for dynamic properties.
|
|
105
|
+
|
|
106
|
+
> **Note:** These components also support our `cs` prop for styling. Learn more about styling with
|
|
107
|
+
> `cs` in our
|
|
108
|
+
> [documentation](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--docs#cs-prop).
|
|
109
|
+
|
|
110
|
+
The following components have been updated:
|
|
111
|
+
|
|
112
|
+
- `ActionBar` [#3205](https://github.com/Workday/canvas-kit/pull/3205)
|
|
113
|
+
- `Banner` [#3210](https://github.com/Workday/canvas-kit/pull/3210)
|
|
114
|
+
- `Expandable` [#3128](https://github.com/Workday/canvas-kit/pull/3128 )
|
|
115
|
+
- `ExternalHyperlink` [#3101](https://github.com/Workday/canvas-kit/pull/3101)
|
|
116
|
+
- `LoadingSparkles` [#3120](https://github.com/Workday/canvas-kit/pull/3120)
|
|
117
|
+
- `Menu` [#3114](https://github.com/Workday/canvas-kit/pull/3114)
|
|
118
|
+
- `Pill` [#3140](https://github.com/Workday/canvas-kit/pull/3104)
|
|
119
|
+
- `Select` [#3240](https://github.com/Workday/canvas-kit/pull/3240)
|
|
120
|
+
- `SidePanel (Preview)` [#3123](https://github.com/Workday/canvas-kit/pull/3123)
|
|
121
|
+
- `Skeleton` [#3088](https://github.com/Workday/canvas-kit/pull/3088)
|
|
122
|
+
- `Tabs` [#3119](https://github.com/Workday/canvas-kit/pull/3119)
|
|
123
|
+
- `Tooltip` [#3164](https://github.com/Workday/canvas-kit/pull/3164)
|
|
124
|
+
|
|
125
|
+
### Avatar 🚨
|
|
126
|
+
|
|
127
|
+
**PR:** [#3231](https://github.com/Workday/canvas-kit/pull/3231)
|
|
128
|
+
|
|
129
|
+
The following change has been made to `Avatar` to ensure proper accessibility.
|
|
130
|
+
|
|
131
|
+
- The `altText` prop no longer has a default value of `"Avatar"` for better internalization. This
|
|
132
|
+
default phrase caused some to accidentally omit translations which caused translation issues.
|
|
133
|
+
|
|
134
|
+
> **Note:** This change also impacts `Pill.Avatar` and `Expandable.Avatar`. You must provide a value
|
|
135
|
+
> to `altText` to ensure proper accessibility. Our examples have been updated to reflect this
|
|
136
|
+
> change.
|
|
137
|
+
|
|
138
|
+
**Before in v12**
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
// Avatar component always had a default altText of "Avatar"
|
|
142
|
+
<Avatar as="div" />
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**After in v13**
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// You must provide alt text to the `altText` prop. Please choose a apt description based on your `Avatar`'s usage.
|
|
149
|
+
<Avatar altText="User profile avatar" as="div" />
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Expandable ⚡️
|
|
153
|
+
|
|
154
|
+
**PR:** [#3217](https://github.com/Workday/canvas-kit/pull/3217)
|
|
155
|
+
|
|
156
|
+
We've promoted `Expandable` from [Labs](#labs) to [Main](#main).
|
|
157
|
+
|
|
158
|
+
**Before in v12**
|
|
159
|
+
|
|
160
|
+
```tsx
|
|
161
|
+
import {Expandable} from '@workday/canvas-kit-labs-react/expandable';
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**After in v13**
|
|
165
|
+
|
|
166
|
+
```tsx
|
|
167
|
+
import {Expandable} from '@workday/canvas-kit-react/expandable';
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
> 🤖 The codemod will handle the change of imports as shown above.
|
|
171
|
+
|
|
172
|
+
### External Hyperlink 🚨
|
|
173
|
+
|
|
174
|
+
**PR:** [#3101](https://github.com/Workday/canvas-kit/pull/3101)
|
|
175
|
+
|
|
176
|
+
The following change has been made to `ExternalHyperlink` to ensure proper accessibility.
|
|
177
|
+
|
|
178
|
+
- The `iconLabel` prop no longer has a default value of `"Opens link in new window"`. This default
|
|
179
|
+
phrase caused some to accidentally omit translations which caused translation issues.
|
|
180
|
+
|
|
181
|
+
> **Note:** While the prop is not required, you _must_ provide an `iconLabel` for `<ExternalHyperlink />` to ensure proper
|
|
182
|
+
> accessibility. Our examples have been updated to reflect this change.
|
|
183
|
+
|
|
184
|
+
**Before in v12**
|
|
185
|
+
|
|
186
|
+
```tsx
|
|
187
|
+
<ExternalHyperlink href="https://workday.com">External Hyperlink</ExternalHyperlink>
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
**After in v13**
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
<ExternalHyperlink href="https://workday.com" iconLabel="Navigate to Workday">
|
|
194
|
+
External Hyperlink
|
|
195
|
+
</ExternalHyperlink>
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Form Field and Form Field Group 🚨
|
|
199
|
+
|
|
200
|
+
**PR:** [#3254](https://github.com/Workday/canvas-kit/pull/3254)
|
|
201
|
+
|
|
202
|
+
The `orientation` prop on the `FormField` component no longer accepts the deprecrated `horizontal`
|
|
203
|
+
value. You must update your code to use `horizontalStart`. Our v12 release included a codemod to
|
|
204
|
+
update `horizontal` to `horizontalStart`, but we kept the prop backwards-compatible. In v13, we
|
|
205
|
+
dropped `horizontal` as a value, and it now requires an update.
|
|
206
|
+
|
|
207
|
+
**Before in v12**
|
|
208
|
+
|
|
209
|
+
```tsx
|
|
210
|
+
<FormField orientation="horizontal">
|
|
211
|
+
<FormField.Label>Label</FormField.Label>
|
|
212
|
+
<FormField.Field>
|
|
213
|
+
<FormField.Input as={TextInput} />
|
|
214
|
+
<FormField.Field>
|
|
215
|
+
</FormField>
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
**After in v13**
|
|
219
|
+
|
|
220
|
+
```tsx
|
|
221
|
+
<FormField orientation="horizontalStart">
|
|
222
|
+
<FormField.Label>Label</FormField.Label>
|
|
223
|
+
<FormField.Field>
|
|
224
|
+
<FormField.Input as={TextInput} />
|
|
225
|
+
<FormField.Field>
|
|
226
|
+
</FormField>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
### Pill (Preview) 🚨
|
|
231
|
+
|
|
232
|
+
**PR:** [#3104](https://github.com/Workday/canvas-kit/pull/3104)
|
|
233
|
+
|
|
234
|
+
A few changes have been made to `Pill` to ensure proper accessibility and styling.
|
|
235
|
+
|
|
236
|
+
- The border color on hover has been updated from `licorice400` to
|
|
237
|
+
`system.color.border.input.strong` (`licorice500`) to match our design specs.
|
|
238
|
+
- We've removed extra elements and now use
|
|
239
|
+
[flex box](https://developer.mozilla.org/en-US/docs/Learn_web_development/Core/CSS_layout/Flexbox)
|
|
240
|
+
to ensure only the label receives text overflow styles when needed.
|
|
241
|
+
- Setting `maxWidth` on the parent `Pill` component now styles the child elements correctly. Before
|
|
242
|
+
v13, `maxWidth` wasn't calculating the width of all its elements and wasn't a true pixel value.
|
|
243
|
+
|
|
244
|
+
#### Breaking Changes
|
|
245
|
+
|
|
246
|
+
- `maxWidth` has been removed from the `usePillModel`. This config was used to style subcomponents.
|
|
247
|
+
With the refactor to use `data-part` and
|
|
248
|
+
[stencils](https://workday.github.io/canvas-kit/?path=/docs/styling-basics--docs#create-stencil),
|
|
249
|
+
it is no longer needed on the model. You can still apply `maxWidth` on the parent `Pill` component
|
|
250
|
+
and the child elements will be styled accordingly.
|
|
251
|
+
- `Pill.Icon`'s no longer has a default value of `"add"` for the `aria-label`. You _must_ provide an
|
|
252
|
+
`aria-label` for `Pill.Icon` to ensure proper accessibility. Our examples have been updated to
|
|
253
|
+
reflect this change.
|
|
254
|
+
- `Pill.IconButton` no longer has a default `aria-label="remove"`. You _must_ provide an
|
|
255
|
+
`aria-label` for `Pill.IconButton` to ensure proper accessibility. Our examples have been updated
|
|
256
|
+
to reflect this change.
|
|
257
|
+
- `Pill.Label` is a _required_ element when using other subcomponents such as `Pill.Icon` to ensure
|
|
258
|
+
that the label truncates correctly.
|
|
259
|
+
|
|
260
|
+
**Before in v12**
|
|
261
|
+
|
|
262
|
+
```tsx
|
|
263
|
+
import {Pill, usePillModel} from '@workday/canvas-kit-preview-react/pill';
|
|
264
|
+
|
|
265
|
+
const model = usePillModel({
|
|
266
|
+
maxWidth: 200,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
<Pill model={model}>
|
|
270
|
+
<Pill.Icon />
|
|
271
|
+
Shoes
|
|
272
|
+
</Pill>;
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
**After in v13**
|
|
276
|
+
|
|
277
|
+
```tsx
|
|
278
|
+
import {Pill} from '@workday/canvas-kit-preview-react/pill';
|
|
279
|
+
|
|
280
|
+
<Pill maxWidth={200}>
|
|
281
|
+
<Pill.Icon aria-label='Add Shoes' />
|
|
282
|
+
<Pill.Label>Shoes</Pill.Label>
|
|
283
|
+
</Pill>
|
|
284
|
+
|
|
285
|
+
<Pill maxWidth={200}>
|
|
286
|
+
<Pill.Label>Shirts</Pill.Label>
|
|
287
|
+
<Pill.IconButton aria-label='Remove Shirts' />
|
|
288
|
+
</Pill>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
> 🤖 The codemod will handle the change adding `Pill.Label` if `Pill.Icon` or `Pill.IconButton` is
|
|
292
|
+
> being used.
|
|
293
|
+
|
|
294
|
+
### Side Panel (Preview) 🚨
|
|
295
|
+
|
|
296
|
+
**PR:** [#3258](https://github.com/Workday/canvas-kit/pull/3258)
|
|
297
|
+
|
|
298
|
+
When we supported IE 11 we needed to use [CSS Animation](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_animations/Using_CSS_animations) to support animation events. Since we dropped support for IE11, we can now use [CSS Transitions](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_transitions/Using_CSS_transitions) to animate the `width` of the `SidePanel` when it's expanding or collapsing.
|
|
299
|
+
As part of this change, we also removed the `onAnimationStart` prop. Since moving to transitions, React doesn't support `onTransitionStart`, therefore the prop is no longer needed.
|
|
300
|
+
|
|
301
|
+
### Tabs 💅
|
|
302
|
+
|
|
303
|
+
**PR:** [#3119](https://github.com/Workday/canvas-kit/pull/3119)
|
|
304
|
+
|
|
305
|
+
- The `disabled` icon color has been updated to use `system.color.fg.disabled`. This darker icon
|
|
306
|
+
color provides better contrast.
|
|
307
|
+
|
|
308
|
+
> **Note:** There should be no developer impact, and the visual changes are safe to accept.
|
|
309
|
+
|
|
310
|
+
## Brand Refresh ⚡️
|
|
311
|
+
|
|
312
|
+
We've also updated our logos to align with Workday's brand refresh.
|
|
313
|
+
|
|
314
|
+
### Logo Updates
|
|
315
|
+
|
|
316
|
+
We've removed the outdated Dub logos in Main and promoted the new logos that were previously in our
|
|
317
|
+
Preview package to Main as part of the brand refresh.
|
|
318
|
+
|
|
319
|
+
| Old Logo Name | New Logo Name |
|
|
320
|
+
| --------------- | ------------------ |
|
|
321
|
+
| `dubLogoBlue` | `dubLogoPrimary` |
|
|
322
|
+
| `dubLogoWhite` | `dubLogoReversed` |
|
|
323
|
+
| `wdayLogoBlue` | `wdayLogoPrimary` |
|
|
324
|
+
| `wdayLogoWhite` | `wdayLogoReversed` |
|
|
325
|
+
|
|
326
|
+
**Before in v12**
|
|
327
|
+
|
|
328
|
+
```tsx
|
|
329
|
+
// Importing from Main common
|
|
330
|
+
import {dubLogoBlue} from "@workday/canvas-kit-react/common"
|
|
331
|
+
|
|
332
|
+
<div dangerouslySetInnerHTML={__html: dubLogoBlue} />
|
|
333
|
+
|
|
334
|
+
// Importing from Preview common
|
|
335
|
+
import {dubLogoPrimary} from "@workday/canvas-kit-preview-react/common"
|
|
336
|
+
|
|
337
|
+
<div dangerouslySetInnerHTML={__html: dubLogoPrimary} />
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**After in v13**
|
|
341
|
+
|
|
342
|
+
```tsx
|
|
343
|
+
// New logos have been promoted to Main common AND renamed
|
|
344
|
+
import {dubLogoPrimary} from "@workday/canvas-kit-preview-react/common"
|
|
345
|
+
|
|
346
|
+
<div dangerouslySetInnerHTML={__html: dubLogoPrimary} />
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
> 🤖 The codemod will handle the renaming all the imports and updating the import path.
|
|
350
|
+
|
|
351
|
+
## Infrastructure
|
|
352
|
+
|
|
353
|
+
We've also made some updates to our dependencies and infrastructure.
|
|
354
|
+
|
|
355
|
+
### Supporting `react-jsx` 🚨
|
|
356
|
+
|
|
357
|
+
We've updated the `jsx` flag in our `tsconfig` to `react-jsx`. As part of this change, we've also
|
|
358
|
+
updated our peer dependencies for our packages to a minimum version of `react@17.0.0`. This change
|
|
359
|
+
is to provide support for modern technologies like `vite` and ES modules.
|
|
360
|
+
|
|
361
|
+
#### Breaking Changes
|
|
362
|
+
|
|
363
|
+
If you're using `react@16.x.x`, you'll need to upgrade to `react@17.x.x` to use Canvas Kit v13.
|
|
364
|
+
|
|
365
|
+
**Note:** Because of this update, you may have issues with how your code is transpiles. In that
|
|
366
|
+
case, you will likely also need to update the way `jsx` transpiles. To do this you'll need to set
|
|
367
|
+
the `runtime` config to `automatic` in your Babel config presets. This feature is enabled through
|
|
368
|
+
the `@babel/preset-react` preset and handles importing functions which JSX transpiles. Make sure you
|
|
369
|
+
have this dev dependency installed before proceeding: `yarn add -D @babel/preset-react`. For more
|
|
370
|
+
information on setting an automatic runtime for React, please
|
|
371
|
+
[review Babel's documentation](https://babeljs.io/docs/babel-preset-react#react-automatic-runtime).
|
|
372
|
+
|
|
373
|
+
Here's an example Babel config. Your configuration may vary based on your application setup.
|
|
374
|
+
|
|
375
|
+
```json
|
|
376
|
+
// babel.config.json
|
|
377
|
+
{
|
|
378
|
+
"presets": [
|
|
379
|
+
[
|
|
380
|
+
"@babel/preset-react",
|
|
381
|
+
{
|
|
382
|
+
"runtime": "automatic"
|
|
383
|
+
}
|
|
384
|
+
]
|
|
385
|
+
]
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
## Troubleshooting
|
|
390
|
+
|
|
391
|
+
- When upgrading to the latest major version of Canvas Kit, all related Canvas Kit packages should
|
|
392
|
+
be updated at the same time:
|
|
393
|
+
- `"@workday/canvas-kit-react": "^12.5.6"` -> `"@workday/canvas-kit-react": "^13.0.0"`
|
|
394
|
+
- `"@workday/canvas-kit-styling": "^12.5.6"` -> `"@workday/canvas-kit-styling": "^13.0.0"`
|
|
395
|
+
- `"@workday/canvas-kit-preview-react": "^12.5.6"` ->
|
|
396
|
+
`"@workday/canvas-kit-preview-react": "^13.0.0"`
|
|
397
|
+
- `"@workday/canvas-kit-labs-react": "^12.5.6"` -> `"@workday/canvas-kit-labs-react": "^13.0.0"`
|
|
398
|
+
- Our components rely on the `@workday/canvas-tokens-web` package which provides our CSS variables
|
|
399
|
+
and ensures the correct styling of our components. Make sure to upgrade to the latest version of
|
|
400
|
+
Canvas Tokens Web and install it correctly. For more information,
|
|
401
|
+
[view our docs](https://workday.github.io/canvas-tokens/?path=/docs/docs-getting-started--docs).
|
|
402
|
+
|
|
403
|
+
## Contributors
|
|
404
|
+
|
|
405
|
+
This release was made possible by the following contributors:
|
|
406
|
+
- [@williamjstanton](https://github.com/williamjstanton)
|
|
407
|
+
- [@NehaAhujaa](https://github.com/NehaAhujaa)
|
|
408
|
+
- [@JaredMaione](https://github.com/JaredMaione)
|
|
409
|
+
- [@thunguyen19](https://github.com/thunguyen19)
|
|
410
|
+
|
|
411
|
+
## Glossary
|
|
412
|
+
|
|
413
|
+
Below is a glossary of common terms we use in this upgrade guide.
|
|
414
|
+
|
|
415
|
+
### Main
|
|
416
|
+
|
|
417
|
+
Our Main package of Canvas Kit (`@workday/canvas-kit-react`) provides components and utilities that
|
|
418
|
+
have undergone a full design and a11y review and is approved for use in product.
|
|
419
|
+
|
|
420
|
+
Breaking changes to code in Main will only occur during major version updates and will always be
|
|
421
|
+
communicated in advance and accompanied by migration strategies.
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
### Preview
|
|
426
|
+
|
|
427
|
+
Our Preview package of Canvas Kit (`@workday/canvas-kit-preview-react`) provides components and
|
|
428
|
+
utilities that have undergone a full design and a11y review and are approved for use in product. But
|
|
429
|
+
it may not be up to the high code standards upheld in the [Main](#main) package. Preview is
|
|
430
|
+
analagous to code in beta.
|
|
431
|
+
|
|
432
|
+
Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
|
|
433
|
+
triggering a major version update. Though we will communicate those changes in advance and provide
|
|
434
|
+
migration strategies.
|
|
435
|
+
|
|
436
|
+
Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
|
|
437
|
+
Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
|
|
438
|
+
example, see Segmented Control which is currently in
|
|
439
|
+
[Preview](/components/buttons/segmented-control/) and
|
|
440
|
+
[Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
|
|
441
|
+
In these cases, Preview serves as a staging ground for an improved version of the component with a
|
|
442
|
+
different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
### Labs
|
|
447
|
+
|
|
448
|
+
Our Labs package of Canvas Kit (`@workday/canvas-kit-labs-react`) provides components and utilities
|
|
449
|
+
that have **not** undergone a full design and a11y review. Labs serves as an incubator space for new
|
|
450
|
+
and experimental code and is analagous to code in alpha.
|
|
451
|
+
|
|
452
|
+
Breaking changes can be deployed to Labs at any time without triggering a major version update and
|
|
453
|
+
may not be subject to the same rigor in communcation and migration strategies reserved for breaking
|
|
454
|
+
changes in [Preview](#preview) and [Main](#main).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# What is a Codemod?
|
|
2
|
+
|
|
3
|
+
A codemod is a script that makes programmatic transformations on your codebase by traversing the
|
|
4
|
+
[AST](https://www.codeshiftcommunity.com/docs/understanding-asts), identifying patterns, and making
|
|
5
|
+
prescribed changes. This greatly decreases opportunities for error and reduces the number of manual
|
|
6
|
+
updates, which allows you to focus on changes that need your attention. **We highly recommend you
|
|
7
|
+
use the codemod for these reasons.**
|
|
8
|
+
|
|
9
|
+
If you're new to running codemods or if it's been a minute since you've used one, there are a few
|
|
10
|
+
things you'll want to keep in mind.
|
|
11
|
+
|
|
12
|
+
- Our codemods are meant to be run sequentially. For example, if you're using v8 of Canvas Kit,
|
|
13
|
+
you'll need to run the v9 codemod before you run v10 and so on.
|
|
14
|
+
- The codemod will update your code to be compatible with the specified version, but it will **not**
|
|
15
|
+
remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
|
|
16
|
+
dependencies on your own.
|
|
17
|
+
- We recommend upgrading dependencies before running the codemod.
|
|
18
|
+
- Always review your `package.json` files to make sure your dependency versions look correct.
|
|
19
|
+
- The codemod will not handle every breaking change in v13. You will likely need to make some manual
|
|
20
|
+
changes to be compatible. Use our Upgrade Guide as a checklist.
|
|
21
|
+
- Codemods are not bulletproof.
|
|
22
|
+
- Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
|
|
23
|
+
- As a safety precaution, we recommend committing the changes from the codemod as a single
|
|
24
|
+
isolated commit (separate from other changes) so you can roll back more easily if necessary.
|
|
25
|
+
|
|
26
|
+
We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
|
|
27
|
+
our team. We'd be very happy to walk you through the process to set you up for success.
|
|
28
|
+
|
|
29
|
+
## Running a Codemod
|
|
30
|
+
|
|
31
|
+
### Instructions
|
|
32
|
+
|
|
33
|
+
The easiest way to run our codemod is to use `npx` in your terminal.
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
npx @workday/canvas-kit-codemod v${canvasKitMajorVersionNumber} [path]
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Be sure to provide specific directories that need to be updated via the `[path]` argument. This
|
|
40
|
+
decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
|
|
41
|
+
having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
|
|
42
|
+
if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
|
|
43
|
+
`[path]`.
|
|
44
|
+
|
|
45
|
+
Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
|
|
46
|
+
codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
|
|
47
|
+
finished.
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
yarn add @workday/canvas-kit-codemod --dev
|
|
51
|
+
yarn canvas-kit-codemod v${canvasKitMajorVersion} [path]
|
|
52
|
+
yarn remove @workday/canvas-kit-codemod
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
> **Note**: The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
|
|
56
|
+
> manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
|
|
57
|
+
> after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
|
|
58
|
+
> your project conventions.
|
|
@@ -71,6 +71,14 @@ for each contribution.
|
|
|
71
71
|
`my-feature`).
|
|
72
72
|
- Prefer dashes over camelCasing in branch names.
|
|
73
73
|
|
|
74
|
+
We maintain three major versions of Canvas Kit at any given time: the previous major, the current
|
|
75
|
+
major, and the next major version. These versions live in four branches:
|
|
76
|
+
|
|
77
|
+
- `support` - the previous major version - patches only, no new features or breaking changes
|
|
78
|
+
- `master` - the current major version - patches and small updates only
|
|
79
|
+
- `prerelease/minor` - the current major version - new features are added here and released in a new minor version.
|
|
80
|
+
- `prerelease/major` - the next major version - patches, new features, and major breaking changes
|
|
81
|
+
|
|
74
82
|
#### Commit Message Format
|
|
75
83
|
|
|
76
84
|
Canvas Kit relies on the
|
package/dist/mdx/TESTING.mdx
CHANGED
|
@@ -160,6 +160,40 @@ This will ensure snapshot tests have stable ids for each snapshot. It is still p
|
|
|
160
160
|
changing if you add an additional component that uses id generation - subsequent ids will be
|
|
161
161
|
different, but this will prevent snapshot tests that don't have any changes from showing diffs.
|
|
162
162
|
|
|
163
|
+
The Canvas Kit Styling package uses CSS Variables and multiple class names with unique hashes.
|
|
164
|
+
The following snapshot serializers handle styling. Setting unique seeds will not effect static style
|
|
165
|
+
hashes because the styles are created before any test code is run. These serializers ignore the
|
|
166
|
+
hashes instead.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
// Handle `css-{hash}` class names
|
|
170
|
+
const emotionClassnameRegex = /(css-[a-zA-Z0-9]{1,7})/g;
|
|
171
|
+
expect.addSnapshotSerializer({
|
|
172
|
+
test: (val) => typeof val === "string" && emotionClassnameRegex.test(val),
|
|
173
|
+
print: (val) => {
|
|
174
|
+
return `"${val.replaceAll(emotionClassnameRegex, "css-xxxxx")}"`;
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Handle `m{hash}` class names
|
|
179
|
+
const emotionModifierClassnameRegex = /^m[a-zA-Z0-9]{5,7}/g;
|
|
180
|
+
expect.addSnapshotSerializer({
|
|
181
|
+
test: (val) => typeof val === "string" && emotionModifierClassnameRegex.test(val),
|
|
182
|
+
print: (val) => {
|
|
183
|
+
return `"${val.replaceAll(emotionModifierClassnameRegex, "m-xxxxx")}"`;
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
// Handle `--myVariableName-{hash}` CSS variables used by Stencils
|
|
188
|
+
const cssVariableRegex = /(^--([a-zA-Z-]+)-[a-zA-Z0-9]{1,7})/g;
|
|
189
|
+
expect.addSnapshotSerializer({
|
|
190
|
+
test: (val) => typeof val === "string" && cssVariableRegex.test(val),
|
|
191
|
+
print: (val) => {
|
|
192
|
+
return `"${val.replaceAll(cssVariableRegex, "--$2-xxxxx")}"`;
|
|
193
|
+
},
|
|
194
|
+
});
|
|
195
|
+
```
|
|
196
|
+
|
|
163
197
|
## Functional tests
|
|
164
198
|
|
|
165
199
|
Canvas Kit uses [Cypress](https://cypress.io) for browser-based behavior testing (additional info:
|
|
@@ -2,8 +2,6 @@ import {ExampleCodeBlock} from '@workday/canvas-kit-docs';
|
|
|
2
2
|
import TextInputWithReactHookForm from './examples/TextInputWithReactHookForm';
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
# Canvas Kit Forms Examples
|
|
6
|
-
|
|
7
5
|
## Uncontrolled Text Inputs Using React Hook Form
|
|
8
6
|
|
|
9
7
|
<ExampleCodeBlock code={TextInputWithReactHookForm} />
|
package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Caution.tsx
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
-
import {InformationHighlight} from '@workday/canvas-kit-preview-react/
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
4
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
5
4
|
|
|
6
5
|
export default () => {
|
package/dist/mdx/preview-react/{InformationHighlight → information-highlight}/examples/Critical.tsx
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
3
|
-
import {InformationHighlight} from '@workday/canvas-kit-preview-react/
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
4
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
5
4
|
|
|
6
5
|
export default () => {
|
|
@@ -8,23 +7,17 @@ export default () => {
|
|
|
8
7
|
<Flex flexDirection={'column'} gap={system.space.x2}>
|
|
9
8
|
<InformationHighlight variant={'critical'}>
|
|
10
9
|
<InformationHighlight.Icon />
|
|
11
|
-
<InformationHighlight.Heading>
|
|
12
|
-
{' '}
|
|
13
|
-
Attention! Highlight Something{' '}
|
|
14
|
-
</InformationHighlight.Heading>
|
|
10
|
+
<InformationHighlight.Heading>Attention! Highlight Something</InformationHighlight.Heading>
|
|
15
11
|
<InformationHighlight.Body>
|
|
16
|
-
If you select the link below it will
|
|
12
|
+
If you select the link below it will reroute you back to this page.
|
|
17
13
|
</InformationHighlight.Body>
|
|
18
14
|
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
19
15
|
</InformationHighlight>
|
|
20
16
|
<InformationHighlight variant={'critical'} emphasis={'high'}>
|
|
21
17
|
<InformationHighlight.Icon />
|
|
22
|
-
<InformationHighlight.Heading>
|
|
23
|
-
{' '}
|
|
24
|
-
Attention! Highlight Something{' '}
|
|
25
|
-
</InformationHighlight.Heading>
|
|
18
|
+
<InformationHighlight.Heading>Attention! Highlight Something</InformationHighlight.Heading>
|
|
26
19
|
<InformationHighlight.Body>
|
|
27
|
-
If you select the link below it will
|
|
20
|
+
If you select the link below it will reroute you back to this page.
|
|
28
21
|
</InformationHighlight.Body>
|
|
29
22
|
<InformationHighlight.Link href="#hyperlink">View the Docs</InformationHighlight.Link>
|
|
30
23
|
</InformationHighlight>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {InformationHighlight} from '@workday/canvas-kit-preview-react/
|
|
2
|
+
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
3
3
|
import {chartIcon} from '@workday/canvas-system-icons-web';
|
|
4
4
|
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {system} from '@workday/canvas-tokens-web';
|