@workday/canvas-kit-docs 12.3.3 → 13.0.0-alpha.1007-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 +1 @@
1
- {"version":3,"file":"versionsTable.d.ts","sourceRoot":"","sources":["../../../mdx/versionsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAsE1B,eAAO,MAAM,YAAY,yBAgCxB,CAAC"}
1
+ {"version":3,"file":"versionsTable.d.ts","sourceRoot":"","sources":["../../../mdx/versionsTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AA0C1B,eAAO,MAAM,YAAY,yBAmDxB,CAAC"}
@@ -3,37 +3,6 @@ import { Table } from '@workday/canvas-kit-react';
3
3
  import { StatusIndicator } from '@workday/canvas-kit-preview-react';
4
4
  // @ts-ignore: Cannot find module error
5
5
  import { version } from '../../../lerna.json';
6
- // When we release a new version, add the support version before the first item.
7
- const allVersions = [
8
- {
9
- versionNumber: version,
10
- documentation: 'https://github.com/Workday/canvas-kit',
11
- },
12
- {
13
- versionNumber: 11,
14
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v11/?path=/docs/welcome--page',
15
- },
16
- {
17
- versionNumber: 10,
18
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v10/?path=/docs/welcome--page',
19
- },
20
- {
21
- versionNumber: 9,
22
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v9/?path=/docs/welcome--page',
23
- },
24
- {
25
- versionNumber: 8,
26
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/welcome--page',
27
- },
28
- {
29
- versionNumber: 7,
30
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v7/?path=/story/welcome-getting-started--page',
31
- },
32
- {
33
- versionNumber: 6,
34
- documentation: 'https://d2krrudi3mmzzw.cloudfront.net/v7/?path=/story/welcome-getting-started--page',
35
- },
36
- ];
37
6
  const statusIndicators = {
38
7
  stable: {
39
8
  variant: 'blue',
@@ -64,20 +33,38 @@ function getVersionStatusIndicator(versionNumber) {
64
33
  }
65
34
  }
66
35
  export const VersionTable = () => {
36
+ const [versions, setVersions] = React.useState([]);
37
+ const minVersion = 6;
38
+ const currentMajorVersion = Number(version === null || version === void 0 ? void 0 : version.split('.')[0]);
39
+ React.useEffect(() => {
40
+ let arr = [];
41
+ for (let i = minVersion; i <= currentMajorVersion; i++) {
42
+ arr.push({
43
+ versionNumber: i,
44
+ versionUrl: i === currentMajorVersion
45
+ ? 'https://canvas.workday.com/'
46
+ : `https://canvas.workday.com/v${i}/`,
47
+ });
48
+ }
49
+ setVersions(arr);
50
+ }, []);
67
51
  return (React.createElement(Table, null,
68
52
  React.createElement(Table.Head, null,
69
53
  React.createElement(Table.Row, null,
70
54
  React.createElement(Table.Header, { scope: "col" }, "Version"),
71
55
  React.createElement(Table.Header, { scope: "col" }, "Documentation"),
72
56
  React.createElement(Table.Header, { scope: "col" }, "Status"))),
73
- React.createElement(Table.Body, null, allVersions.map(item => {
57
+ React.createElement(Table.Body, null, versions
58
+ .slice()
59
+ .reverse()
60
+ .map(item => {
74
61
  const { label, variant } = getVersionStatusIndicator(item.versionNumber);
75
62
  return (React.createElement(Table.Row, null,
76
63
  React.createElement(Table.Cell, null,
77
64
  "v",
78
65
  item.versionNumber),
79
66
  React.createElement(Table.Cell, null,
80
- React.createElement("a", { href: item.documentation, target: "_blank", rel: "noreferrer" }, "Documentation")),
67
+ React.createElement("a", { href: item.versionUrl, target: "_blank", rel: "noreferrer" }, "Documentation")),
81
68
  React.createElement(Table.Cell, null,
82
69
  React.createElement(StatusIndicator, { variant: variant },
83
70
  React.createElement(StatusIndicator.Label, null, label)))));
@@ -0,0 +1,130 @@
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.
13
+
14
+
15
+ ## Table of contents
16
+
17
+ - [Codemod](#codemod)
18
+ - [Instructions](#instructions)
19
+ - [Troubleshooting](#troubleshooting)
20
+ - [Glossary](#glossary)
21
+ - [Main](#main)
22
+ - [Preview](#preview)
23
+ - [Labs](#labs)
24
+
25
+ ## Codemod
26
+
27
+ We've provided a [codemod](https://github.com/Workday/canvas-kit/tree/master/modules/codemod) to
28
+ automatically update your code to work with most of the breaking changes in v13. **Breaking changes
29
+ handled by the codemod are marked with 🤖 in the Upgrade Guide.**
30
+
31
+ A codemod is a script that makes programmatic transformations on your codebase by traversing the
32
+ [AST](https://www.codeshiftcommunity.com/docs/understanding-asts), identifying patterns, and making
33
+ prescribed changes. This greatly decreases opportunities for error and reduces the number of manual
34
+ updates, which allows you to focus on changes that need your attention. **We highly recommend you
35
+ use the codemod for these reasons.**
36
+
37
+ If you're new to running codemods or if it's been a minute since you've used one, there are a few
38
+ things you'll want to keep in mind.
39
+
40
+ - Our codemods are meant to be run sequentially. For example, if you're using v8 of Canvas Kit,
41
+ you'll need to run the v9 codemod before you run v10 and so on.
42
+ - The codemod will update your code to be compatible with the specified version, but it will **not**
43
+ remove outdated dependencies or upgrade dependencies to the latest version. You'll need to upgrade
44
+ dependencies on your own.
45
+ - We recommend upgrading dependencies before running the codemod.
46
+ - Always review your `package.json` files to make sure your dependency versions look correct.
47
+ - The codemod will not handle every breaking change in v13. You will likely need to make some manual
48
+ changes to be compatible. Use our Upgrade Guide as a checklist.
49
+ - Codemods are not bulletproof.
50
+ - Conduct a thorough PR and QA review of all changes to ensure no regressions were introduced.
51
+ - As a safety precaution, we recommend committing the changes from the codemod as a single
52
+ isolated commit (separate from other changes) so you can roll back more easily if necessary.
53
+
54
+ We're here to help! Automatic changes to your codebase can feel scary. You can always reach out to
55
+ our team. We'd be very happy to walk you through the process to set you up for success.
56
+
57
+ ### Instructions
58
+
59
+ The easiest way to run our codemod is to use `npx` in your terminal.
60
+
61
+ ```sh
62
+ npx @workday/canvas-kit-codemod v13 [path]
63
+ ```
64
+
65
+ Be sure to provide specific directories that need to be updated via the `[path]` argument. This
66
+ decreases the amount of AST the codemod needs to traverse and reduces the chances of the script
67
+ having an error. For example, if your source code lives in `src/`, use `src/` as your `[path]`. Or,
68
+ if you have a monorepo with three packages using Canvas Kit, provide those specific packages as your
69
+ `[path]`.
70
+
71
+ Alternatively, if you're unable to run the codemod successfully using `npx`, you can install the
72
+ codemod package as a dev dependency, run it with `yarn`, and then remove the package after you're
73
+ finished.
74
+
75
+ ```sh
76
+ yarn add @workday/canvas-kit-codemod --dev
77
+ yarn canvas-kit-codemod v13 [path]
78
+ yarn remove @workday/canvas-kit-codemod
79
+ ```
80
+
81
+ > **Note**: The codemod only works on `.js`, `.jsx`, `.ts`, and `.tsx` files. You'll need to
82
+ > manually edit other file types (`.json`, `.mdx`, `.md`, etc.). You may need to run your linter
83
+ > after executing the codemod, as its resulting formatting (spacing, quotes, etc.) may not match
84
+ > your project conventions.
85
+
86
+
87
+ ## Troubleshooting
88
+
89
+ ## Glossary
90
+
91
+ ### Main
92
+
93
+ Our Main package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-react` has
94
+ undergone a full design and a11y review and is approved for use in product.
95
+
96
+ Breaking changes to code in Main will only occur during major version updates and will always be
97
+ communicated in advance and accompanied by migration strategies.
98
+
99
+ ---
100
+
101
+ ### Preview
102
+
103
+ Our Preview package of Canvas Kit tokens, components, and utilities at
104
+ `@workday/canvas-kit-preview-react` has undergone a full design and a11y review and is approved for
105
+ use in product, but may not be up to the high code standards upheld in the [Main](#main) package.
106
+ Preview is analagous to code in beta.
107
+
108
+ Breaking changes are unlikely, but possible, and can be deployed to Preview at any time without
109
+ triggering a major version update, though such changes will be communicated in advance and
110
+ accompanied by migration strategies.
111
+
112
+ Generally speaking, our goal is to eventually promote code from Preview to [Main](#main).
113
+ Occasionally, a component with the same name will exist in both [Main](#main) and Preview (for
114
+ example, see Segmented Control in [Preview](/components/buttons/segmented-control/) and
115
+ [Main](https://d2krrudi3mmzzw.cloudfront.net/v8/?path=/docs/components-buttons-segmented-control--basic)).
116
+ In these cases, Preview serves as a staging ground for an improved version of the component with a
117
+ different API. The component in [Main](#main) will eventually be replaced with the one in Preview.
118
+
119
+ ---
120
+
121
+ ### Labs
122
+
123
+ Our Labs package of Canvas Kit tokens, components, and utilities at `@workday/canvas-kit-labs-react`
124
+ has **not** undergone a full design and a11y review. Labs serves as an incubator space for new and
125
+ experimental code and is analagous to code in alpha.
126
+
127
+ Breaking changes can be deployed to Labs at any time without triggering a major version update and
128
+ may not be subject to the same rigor in communcation and migration strategies reserved for breaking
129
+ changes in [Preview](#preview) and [Main](#main).
130
+ `import { opacity } from "@workday/canvas-tokens-web/dist/es6/system"`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "12.3.3",
3
+ "version": "13.0.0-alpha.1007-next.0",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -44,10 +44,10 @@
44
44
  "dependencies": {
45
45
  "@emotion/styled": "^11.6.0",
46
46
  "@storybook/csf": "0.0.1",
47
- "@workday/canvas-kit-labs-react": "^12.3.3",
48
- "@workday/canvas-kit-preview-react": "^12.3.3",
49
- "@workday/canvas-kit-react": "^12.3.3",
50
- "@workday/canvas-kit-styling": "^12.3.3",
47
+ "@workday/canvas-kit-labs-react": "^13.0.0-alpha.1007-next.0",
48
+ "@workday/canvas-kit-preview-react": "^13.0.0-alpha.1007-next.0",
49
+ "@workday/canvas-kit-react": "^13.0.0-alpha.1007-next.0",
50
+ "@workday/canvas-kit-styling": "^13.0.0-alpha.1007-next.0",
51
51
  "@workday/canvas-system-icons-web": "^3.0.0",
52
52
  "@workday/canvas-tokens-web": "^2.1.0",
53
53
  "markdown-to-jsx": "^7.2.0",
@@ -60,5 +60,5 @@
60
60
  "mkdirp": "^1.0.3",
61
61
  "typescript": "5.0"
62
62
  },
63
- "gitHead": "813b84599c30a0c575cbdd5f958fbf5321412c90"
63
+ "gitHead": "b069877352a0d8b64fe2e045a208b5833d713ce9"
64
64
  }