@workday/canvas-kit-docs 7.0.0-alpha.89-next.16 → 7.0.0-alpha.90-next.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/commonjs/lib/specs.js +131 -0
  2. package/dist/es6/lib/specs.js +131 -0
  3. package/dist/mdx/7.0-MIGRATION-GUIDE.mdx +311 -1
  4. package/dist/mdx/changelog.stories.mdx +1 -0
  5. package/dist/mdx/preview-react/form-field/examples/Custom.tsx +3 -4
  6. package/dist/mdx/preview-react/menu/Menu.mdx +1 -1
  7. package/dist/mdx/preview-react/menu/examples/Icons.tsx +0 -1
  8. package/dist/mdx/react/collection/Collection.mdx +136 -0
  9. package/dist/mdx/react/collection/examples/Basic.tsx +12 -0
  10. package/dist/mdx/react/collection/examples/BasicVirtual.tsx +24 -0
  11. package/dist/mdx/react/collection/examples/DynamicItems.tsx +20 -0
  12. package/dist/mdx/react/collection/examples/IdentifiedItems.tsx +12 -0
  13. package/dist/mdx/react/collection/examples/MultiSelection.tsx +56 -0
  14. package/dist/mdx/react/collection/examples/RovingFocus.tsx +39 -0
  15. package/dist/mdx/react/collection/examples/Selection.tsx +58 -0
  16. package/dist/mdx/react/menu/Menu.mdx +123 -0
  17. package/dist/mdx/react/menu/examples/Basic.tsx +26 -0
  18. package/dist/mdx/react/menu/examples/ContextMenu.tsx +25 -0
  19. package/dist/mdx/react/menu/examples/Icons.tsx +41 -0
  20. package/dist/mdx/react/modal/examples/ReturnFocus.tsx +1 -1
  21. package/dist/mdx/react/popup/examples/InitialFocus.tsx +4 -2
  22. package/dist/mdx/react/popup/examples/NestedPopups.tsx +17 -17
  23. package/dist/mdx/react/popup/examples/RTL.tsx +6 -3
  24. package/dist/mdx/react/tabs/Tabs.mdx +4 -8
  25. package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +4 -7
  26. package/dist/mdx/react/tabs/examples/HoistedModel.tsx +8 -8
  27. package/dist/mdx/react/tabs/examples/Icons.tsx +4 -4
  28. package/dist/mdx/react/tabs/examples/NamedTabs.tsx +10 -10
  29. package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +2 -2
  30. package/dist/mdx/react/text-input/examples/Basic.tsx +3 -0
  31. package/package.json +7 -16
  32. package/ts3.5/dist/commonjs/index.d.ts +0 -4
  33. package/ts3.5/dist/commonjs/lib/Specifications.d.ts +0 -6
  34. package/ts3.5/dist/commonjs/lib/docs.d.ts +0 -5
  35. package/ts3.5/dist/commonjs/lib/specs.d.ts +0 -16
  36. package/ts3.5/dist/es6/index.d.ts +0 -4
  37. package/ts3.5/dist/es6/lib/Specifications.d.ts +0 -6
  38. package/ts3.5/dist/es6/lib/docs.d.ts +0 -5
  39. package/ts3.5/dist/es6/lib/specs.d.ts +0 -16
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import {SecondaryButton, DeleteButton} from '@workday/canvas-kit-react/button';
4
4
  import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
5
5
  import {Popup} from '@workday/canvas-kit-react/popup';
6
+ import {HStack} from '@workday/canvas-kit-react/layout';
6
7
 
7
8
  export default () => {
8
9
  return (
@@ -11,10 +12,12 @@ export default () => {
11
12
  <Popup.CloseIcon aria-label="סגור" />
12
13
  <Popup.Heading>למחוק פריט</Popup.Heading>
13
14
  <Popup.Body>
14
- <p style={{marginBottom: '24px'}}>האם ברצונך למחוק פריט זה</p>
15
- <DeleteButton style={{marginLeft: '16px'}}>לִמְחוֹק</DeleteButton>
16
- <SecondaryButton>לְבַטֵל</SecondaryButton>
15
+ <p>האם ברצונך למחוק פריט זה</p>
17
16
  </Popup.Body>
17
+ <HStack spacing="s">
18
+ <DeleteButton>לִמְחוֹק</DeleteButton>
19
+ <SecondaryButton>לְבַטֵל</SecondaryButton>
20
+ </HStack>
18
21
  </Popup.Card>
19
22
  </CanvasProvider>
20
23
  );
@@ -95,9 +95,7 @@ Set the `disabled` prop of a `Tabs.Item` to `true` to disable it.
95
95
 
96
96
  ### Tab Icons
97
97
 
98
- Tabs can have icons. You must set `hasIcon` on the `Tabs.Item` and use the `Icon` and `Text`
99
- subcomponent. The `hasIcon` changes the `Tabs.Item` to change where overflow detection is from the
100
- `Tabs.Item` element to the `Tabs.Item.Text` element.
98
+ Tabs can have icons. Use the `Icon` and `Text` subcomponents.
101
99
 
102
100
  <ExampleCodeBlock code={Icons} />
103
101
 
@@ -139,17 +137,15 @@ array.
139
137
  its subcomponents using React context. It does not represent a real element.
140
138
 
141
139
  ```tsx
142
- <Tabs onActivate={({data}) => console.log('Activated tab', data.tab)}>
143
- {/* Child components */}
144
- </Tabs>
140
+ <Tabs onSelect={data => console.log('Activated tab', data.id)}>{/* Child components */}</Tabs>
145
141
  ```
146
142
 
147
143
  Alternatively, you may pass in a model using the hoisted model pattern.
148
144
 
149
145
  ```tsx
150
146
  const model = useTabsModel({
151
- onActivate({data}) {
152
- console.log('Activated Tab', data.tab);
147
+ onSelect(data) {
148
+ console.log('Activated Tab', data.id);
153
149
  },
154
150
  });
155
151
 
@@ -1,8 +1,6 @@
1
1
  import React from 'react';
2
- import {space} from '@workday/canvas-kit-react/tokens';
3
2
 
4
- import {Tabs, useTabsModel, TabsModel} from '@workday/canvas-kit-react/tabs';
5
- import {SelectionModel} from '../../lib/selection';
3
+ import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
6
4
 
7
5
  type Tab = {
8
6
  tab: string;
@@ -19,7 +17,7 @@ export default () => {
19
17
  const addedRef = React.useRef(tabs.length - 1);
20
18
  const model = useTabsModel({
21
19
  items: tabs,
22
- shouldSelect: ({data}) => data.id !== 'add',
20
+ shouldSelect: data => data.id !== 'add',
23
21
  });
24
22
 
25
23
  // A ref of the model for the render functions to work around the caching done to lists
@@ -33,9 +31,8 @@ export default () => {
33
31
  * * **Item is selected**: Selection will be moved to the next item in the list
34
32
  * @param id The id of the item that will be removed
35
33
  */
36
- const removeItem = <T extends unknown>(id: string, model: SelectionModel<T>) => {
34
+ const removeItem = <T extends unknown>(id: string, model: ReturnType<typeof useTabsModel>) => {
37
35
  const index = model.state.items.findIndex(item => model.getId(item) === model.state.cursorId);
38
- console.log('index', index, id, model.state.cursorId, model.state.items);
39
36
  const nextIndex = index === model.state.items.length - 1 ? index - 1 : index + 1;
40
37
  const nextId = model.getId(model.state.items[nextIndex]);
41
38
  if (model.state.selectedIds[0] === id) {
@@ -94,7 +91,7 @@ export default () => {
94
91
  </Tabs.Menu.Popper>
95
92
  <Tabs.Panels>
96
93
  {(item: Tab) => (
97
- <Tabs.Panel marginTop="m" name={item.id}>
94
+ <Tabs.Panel marginTop="m" data-id={item.id}>
98
95
  Contents of {item.tab}
99
96
  </Tabs.Panel>
100
97
  )}
@@ -6,8 +6,8 @@ import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
6
6
 
7
7
  export default () => {
8
8
  const model = useTabsModel({
9
- onSelect({data, prevState}) {
10
- console.log('Selected Tab', data, prevState);
9
+ onSelect(data, prevState) {
10
+ console.log('Selected Tab', data.id, prevState);
11
11
  },
12
12
  });
13
13
 
@@ -15,14 +15,14 @@ export default () => {
15
15
  <>
16
16
  <Tabs model={model}>
17
17
  <Tabs.List>
18
- <Tabs.Item name="first">First Tab</Tabs.Item>
19
- <Tabs.Item name="second">Second Tab</Tabs.Item>
20
- <Tabs.Item name="third">Third Tab</Tabs.Item>
18
+ <Tabs.Item data-id="first">First Tab</Tabs.Item>
19
+ <Tabs.Item data-id="second">Second Tab</Tabs.Item>
20
+ <Tabs.Item data-id="third">Third Tab</Tabs.Item>
21
21
  </Tabs.List>
22
22
  <div style={{marginTop: space.m}}>
23
- <Tabs.Panel name="first">Contents of First Tab</Tabs.Panel>
24
- <Tabs.Panel name="second">Contents of Second Tab</Tabs.Panel>
25
- <Tabs.Panel name="third">Contents of Third Tab</Tabs.Panel>
23
+ <Tabs.Panel data-id="first">Contents of First Tab</Tabs.Panel>
24
+ <Tabs.Panel data-id="second">Contents of Second Tab</Tabs.Panel>
25
+ <Tabs.Panel data-id="third">Contents of Third Tab</Tabs.Panel>
26
26
  </div>
27
27
  </Tabs>
28
28
  <SecondaryButton
@@ -8,19 +8,19 @@ export default () => {
8
8
  return (
9
9
  <Tabs>
10
10
  <Tabs.List>
11
- <Tabs.Item hasIcon>
11
+ <Tabs.Item>
12
12
  <Tabs.Item.Icon icon={starIcon} />
13
13
  <Tabs.Item.Text>First Tab</Tabs.Item.Text>
14
14
  </Tabs.Item>
15
- <Tabs.Item hasIcon>
15
+ <Tabs.Item>
16
16
  <Tabs.Item.Icon icon={searchIcon} />
17
17
  <Tabs.Item.Text>Second Tab</Tabs.Item.Text>
18
18
  </Tabs.Item>
19
- <Tabs.Item hasIcon>
19
+ <Tabs.Item>
20
20
  <Tabs.Item.Icon icon={selectIcon} />
21
21
  <Tabs.Item.Text>Third Tab</Tabs.Item.Text>
22
22
  </Tabs.Item>
23
- <Tabs.Item hasIcon>
23
+ <Tabs.Item>
24
24
  <Tabs.Item.Icon icon={shareIcon} />
25
25
  <Tabs.Item.Text>Fourth Tab</Tabs.Item.Text>
26
26
  </Tabs.Item>
@@ -7,18 +7,18 @@ export default () => {
7
7
  return (
8
8
  <Tabs>
9
9
  <Tabs.List>
10
- <Tabs.Item name="first">First Tab</Tabs.Item>
11
- <Tabs.Item name="second">Second Tab</Tabs.Item>
12
- <Tabs.Item name="third">Third Tab</Tabs.Item>
13
- <Tabs.Item name="fourth">Fourth Tab</Tabs.Item>
14
- <Tabs.Item name="fifth">Fifth Tab</Tabs.Item>
10
+ <Tabs.Item data-id="first">First Tab</Tabs.Item>
11
+ <Tabs.Item data-id="second">Second Tab</Tabs.Item>
12
+ <Tabs.Item data-id="third">Third Tab</Tabs.Item>
13
+ <Tabs.Item data-id="fourth">Fourth Tab</Tabs.Item>
14
+ <Tabs.Item data-id="fifth">Fifth Tab</Tabs.Item>
15
15
  </Tabs.List>
16
16
  <div style={{marginTop: space.m}}>
17
- <Tabs.Panel name="first">Contents of First Tab</Tabs.Panel>
18
- <Tabs.Panel name="second">Contents of Second Tab</Tabs.Panel>
19
- <Tabs.Panel name="third">Contents of Third Tab</Tabs.Panel>
20
- <Tabs.Panel name="fourth">Contents of Fourth Tab</Tabs.Panel>
21
- <Tabs.Panel name="fifth">Contents of Fifth Tab</Tabs.Panel>
17
+ <Tabs.Panel data-id="first">Contents of First Tab</Tabs.Panel>
18
+ <Tabs.Panel data-id="second">Contents of Second Tab</Tabs.Panel>
19
+ <Tabs.Panel data-id="third">Contents of Third Tab</Tabs.Panel>
20
+ <Tabs.Panel data-id="fourth">Contents of Fourth Tab</Tabs.Panel>
21
+ <Tabs.Panel data-id="fifth">Contents of Fifth Tab</Tabs.Panel>
22
22
  </div>
23
23
  </Tabs>
24
24
  );
@@ -28,7 +28,7 @@ export default () => {
28
28
  <div style={{width: containerWidth}}>
29
29
  <Tabs model={model}>
30
30
  <Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
31
- {(item: MyTabItem) => <Tabs.Item name={item.id}>{item.text}</Tabs.Item>}
31
+ {(item: MyTabItem) => <Tabs.Item data-id={item.id}>{item.text}</Tabs.Item>}
32
32
  </Tabs.List>
33
33
  <Tabs.Menu.Popper>
34
34
  <Tabs.Menu.Card maxWidth={300} maxHeight={200}>
@@ -39,7 +39,7 @@ export default () => {
39
39
  </Tabs.Menu.Popper>
40
40
  <Tabs.Panels>
41
41
  {(item: MyTabItem) => (
42
- <Tabs.Panel marginTop="m" name={item.id}>
42
+ <Tabs.Panel marginTop="m" data-id={item.id}>
43
43
  {item.contents}
44
44
  </Tabs.Panel>
45
45
  )}
@@ -1,3 +1,6 @@
1
+ /** @jsxRuntime classic */
2
+ /** @jsx jsx */
3
+ import {css, jsx} from '@emotion/react';
1
4
  import React from 'react';
2
5
  import {FormField} from '@workday/canvas-kit-react/form-field';
3
6
  import {TextInput} from '@workday/canvas-kit-react/text-input';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workday/canvas-kit-docs",
3
- "version": "7.0.0-alpha.89-next.16+b786927d",
3
+ "version": "7.0.0-alpha.90-next.17+1c0258d7",
4
4
  "description": "Documentation components of Canvas Kit components",
5
5
  "author": "Workday, Inc. (https://www.workday.com)",
6
6
  "license": "Apache-2.0",
@@ -15,26 +15,17 @@
15
15
  "files": [
16
16
  "dist/",
17
17
  "lib/",
18
- "index.ts",
19
- "ts3.5/**/*"
18
+ "index.ts"
20
19
  ],
21
- "typesVersions": {
22
- "<=3.5": {
23
- "*": [
24
- "ts3.5/*"
25
- ]
26
- }
27
- },
28
20
  "scripts": {
29
21
  "watch": "yarn build:es6 -w",
30
- "clean": "rimraf dist && rimraf ts3.5 && rimraf .build-info && mkdirp dist && mkdirp ts3.5/dist",
22
+ "clean": "rimraf dist && rimraf .build-info && mkdirp dist",
31
23
  "build:mdx": "node ./utils/build-mdx.js mdx/",
32
24
  "build:cjs": "tsc -p tsconfig.cjs.json",
33
25
  "build:es6": "tsc -p tsconfig.es6.json",
34
26
  "build:rebuild": "npm-run-all clean build",
35
27
  "build:specs": "node ./utils/build-specifications.js",
36
- "build:downlevel-dts": "yarn run downlevel-dts dist ts3.5/dist",
37
- "build": "npm-run-all --parallel build:cjs build:es6 build:mdx --sequential build:specs build:downlevel-dts",
28
+ "build": "npm-run-all --parallel build:cjs build:es6 build:mdx --sequential build:specs",
38
29
  "depcheck": "node ../../utils/check-dependencies-exist.js",
39
30
  "typecheck:src": "tsc -p . --noEmit --incremental false"
40
31
  },
@@ -50,13 +41,13 @@
50
41
  ],
51
42
  "dependencies": {
52
43
  "@storybook/csf": "0.0.1",
53
- "@workday/canvas-kit-react": "^7.0.0-alpha.89-next.16+b786927d"
44
+ "@workday/canvas-kit-react": "^7.0.0-alpha.90-next.17+1c0258d7"
54
45
  },
55
46
  "devDependencies": {
56
47
  "fs-extra": "^10.0.0",
57
48
  "glob": "^7.1.6",
58
49
  "mkdirp": "^1.0.3",
59
- "typescript": "^3.8.3"
50
+ "typescript": "4.1"
60
51
  },
61
- "gitHead": "b786927d54a293fcb6f6e745f1831317e101371d"
52
+ "gitHead": "1c0258d72c737b6a42791bad140183c01d736c03"
62
53
  }
@@ -1,4 +0,0 @@
1
- export * from './lib/specs';
2
- export * from './lib/Specifications';
3
- export * from './lib/docs';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- export interface SpecificationsProps {
2
- file: string;
3
- name?: string;
4
- }
5
- export declare const Specifications: ({ file, name }: SpecificationsProps) => JSX.Element | null;
6
- //# sourceMappingURL=Specifications.d.ts.map
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- export declare const GithubUrl: React.Context<string>;
3
- export declare const GithubBranch: React.Context<string>;
4
- export declare const StorybookUrl: React.Context<string>;
5
- //# sourceMappingURL=docs.d.ts.map
@@ -1,16 +0,0 @@
1
- export interface SpecIt {
2
- type: 'it';
3
- name: string;
4
- }
5
- export interface SpecDescribe {
6
- type: 'describe';
7
- name: string;
8
- children: (SpecDescribe | SpecIt)[];
9
- }
10
- export interface SpecFile {
11
- type: 'file';
12
- name: string;
13
- children: (SpecDescribe | SpecIt)[];
14
- }
15
- export declare const specifications: SpecFile[];
16
- //# sourceMappingURL=specs.d.ts.map
@@ -1,4 +0,0 @@
1
- export * from './lib/specs';
2
- export * from './lib/Specifications';
3
- export * from './lib/docs';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,6 +0,0 @@
1
- export interface SpecificationsProps {
2
- file: string;
3
- name?: string;
4
- }
5
- export declare const Specifications: ({ file, name }: SpecificationsProps) => JSX.Element | null;
6
- //# sourceMappingURL=Specifications.d.ts.map
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- export declare const GithubUrl: React.Context<string>;
3
- export declare const GithubBranch: React.Context<string>;
4
- export declare const StorybookUrl: React.Context<string>;
5
- //# sourceMappingURL=docs.d.ts.map
@@ -1,16 +0,0 @@
1
- export interface SpecIt {
2
- type: 'it';
3
- name: string;
4
- }
5
- export interface SpecDescribe {
6
- type: 'describe';
7
- name: string;
8
- children: (SpecDescribe | SpecIt)[];
9
- }
10
- export interface SpecFile {
11
- type: 'file';
12
- name: string;
13
- children: (SpecDescribe | SpecIt)[];
14
- }
15
- export declare const specifications: SpecFile[];
16
- //# sourceMappingURL=specs.d.ts.map