@workday/canvas-kit-docs 6.0.0-alpha.0-next.30 → 6.0.0-alpha.0-next.36
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/LICENSE +1 -1
- package/dist/commonjs/lib/specs.js +295 -33
- package/dist/es6/lib/specs.js +295 -33
- package/dist/mdx/6.0-MIGRATION-GUIDE.mdx +117 -14
- package/dist/mdx/7.0-MIGRATION-GUIDE.mdx +33 -0
- package/dist/mdx/COMPOUND_COMPONENTS.mdx +31 -30
- package/dist/mdx/CONTRIBUTING.mdx +90 -63
- package/dist/mdx/preview-react/breadcrumbs/Breadcrumbs.mdx +1 -1
- package/dist/mdx/preview-react/form-field/FormField.mdx +27 -0
- package/dist/mdx/preview-react/form-field/examples/Custom.tsx +57 -0
- package/dist/mdx/preview-react/menu/examples/Icons.tsx +1 -1
- package/dist/mdx/preview-react/menu/examples/ManyItems.tsx +1 -1
- package/dist/mdx/preview-react/text-area/TextArea.mdx +122 -0
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +31 -0
- package/dist/mdx/preview-react/text-area/examples/Basic.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Error.tsx +40 -0
- package/dist/mdx/preview-react/text-area/examples/Grow.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +20 -0
- package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +21 -0
- package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +28 -0
- package/dist/mdx/preview-react/text-area/examples/Required.tsx +17 -0
- package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +22 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/TextInput.mdx +40 -18
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +40 -0
- package/dist/mdx/{labs-react/text-input/examples/HiddenLabel.tsx → preview-react/text-input/examples/Basic.tsx} +3 -3
- package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/Error.tsx +6 -9
- package/dist/mdx/preview-react/text-input/examples/Grow.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +20 -0
- package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/LoginForm.tsx +10 -5
- package/dist/mdx/preview-react/text-input/examples/Password.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +17 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/RefForwarding.tsx +7 -6
- package/dist/mdx/preview-react/text-input/examples/Required.tsx +17 -0
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +46 -0
- package/dist/mdx/{labs-react → preview-react}/text-input/examples/ThemedError.tsx +8 -11
- package/dist/mdx/react/_examples/GlobalHeader.mdx +9 -0
- package/dist/mdx/react/_examples/PageHeader.mdx +8 -0
- package/dist/mdx/react/_examples/examples/GlobalHeader.tsx +66 -0
- package/dist/mdx/react/_examples/examples/PageHeader.tsx +63 -0
- package/dist/mdx/react/action-bar/ActionBar.mdx +1 -1
- package/dist/mdx/react/button/button/Button.mdx +7 -7
- package/dist/mdx/react/button/icon-button/IconButton.mdx +1 -1
- package/dist/mdx/react/loading-animation/LoadingAnimation.mdx +5 -0
- package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
- package/dist/mdx/react/pagination/PropTables.splitprops.tsx +47 -0
- package/dist/mdx/react/pagination/examples/{StepControls.tsx → Basic.tsx} +1 -1
- package/dist/mdx/react/pagination/examples/GoToForm.tsx +1 -1
- package/dist/mdx/react/pagination/examples/HoistedModel.tsx +36 -22
- package/dist/mdx/react/pagination/examples/RTL.tsx +1 -1
- package/dist/mdx/react/pagination/pagination.mdx +225 -474
- package/dist/mdx/react/popup/Popup.mdx +34 -36
- package/dist/mdx/react/radio/examples/Alert.tsx +3 -3
- package/dist/mdx/react/radio/examples/Basic.tsx +3 -3
- package/dist/mdx/react/radio/examples/Disabled.tsx +3 -3
- package/dist/mdx/react/radio/examples/Error.tsx +3 -3
- package/dist/mdx/react/radio/examples/LabelPosition.tsx +3 -3
- package/dist/mdx/react/radio/examples/NoValue.tsx +3 -3
- package/dist/mdx/react/radio/examples/RefForwarding.tsx +3 -3
- package/dist/mdx/react/radio/examples/Required.tsx +3 -3
- package/dist/mdx/react/segmented-control/SegmentedControl.mdx +1 -1
- package/dist/mdx/react/tabs/Tabs.mdx +67 -36
- package/dist/mdx/react/tabs/examples/DisabledTab.tsx +1 -1
- package/dist/mdx/react/tabs/examples/DynamicTabs.tsx +41 -13
- package/dist/mdx/react/tabs/examples/HoistedModel.tsx +4 -4
- package/dist/mdx/react/tabs/examples/Icons.tsx +36 -0
- package/dist/mdx/react/tabs/examples/{NamedKeys.tsx → NamedTabs.tsx} +0 -0
- package/dist/mdx/react/tabs/examples/OverflowTabs.tsx +58 -0
- package/dist/mdx/react/tabs/examples/SinglePanel.tsx +1 -1
- package/dist/mdx/react/toast/toast.mdx +1 -17
- package/dist/mdx/react/tooltip/Tooltip.mdx +9 -1
- package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
- package/dist/mdx/react/tooltip/examples/Ellipsis.tsx +6 -0
- package/package.json +5 -4
- package/dist/mdx/CODE_OF_CONDUCT.md +0 -68
- package/dist/mdx/labs-react/text-input/examples/Alert.tsx +0 -46
- package/dist/mdx/labs-react/text-input/examples/Basic.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Disabled.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Grow.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/LabelPosition.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Password.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Placeholder.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/Required.tsx +0 -20
- package/dist/mdx/labs-react/text-input/examples/ThemedAlert.tsx +0 -51
- package/dist/mdx/react/pagination/examples/ShowAdditionalDetails.tsx +0 -52
|
@@ -1,22 +1,50 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
3
3
|
|
|
4
|
-
import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
|
|
4
|
+
import {Tabs, useTabsModel, TabsModel} from '@workday/canvas-kit-react/tabs';
|
|
5
|
+
import {SelectionModel} from '../../lib/selection';
|
|
5
6
|
|
|
6
7
|
export default () => {
|
|
7
8
|
const [tabs, setTabs] = React.useState([
|
|
8
|
-
{tab: 'Tab 1',
|
|
9
|
-
{tab: 'Tab 2',
|
|
10
|
-
{tab: 'Tab 3',
|
|
9
|
+
{tab: 'Tab 1', id: 'tab-1'},
|
|
10
|
+
{tab: 'Tab 2', id: 'tab-2'},
|
|
11
|
+
{tab: 'Tab 3', id: 'tab-3'},
|
|
11
12
|
]);
|
|
12
13
|
const addedRef = React.useRef(tabs.length);
|
|
13
14
|
const model = useTabsModel({
|
|
14
|
-
|
|
15
|
+
shouldSelect: ({data}) => data.id !== 'last',
|
|
15
16
|
});
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Helper function that should be called when an item is programmatically removed. The following
|
|
20
|
+
* side effects depend on state of the model:
|
|
21
|
+
* * **Item is focused**: Focus will be moved to next item in the list
|
|
22
|
+
* * **Item is selected**: Selection will be moved to the next item in the list
|
|
23
|
+
* @param id The id of the item that will be removed
|
|
24
|
+
*/
|
|
25
|
+
const removeItem = (id: string, model: SelectionModel) => {
|
|
26
|
+
const index = model.state.items.findIndex(item => model.getId(item) === model.state.cursorId);
|
|
27
|
+
const nextIndex = index === model.state.items.length - 1 ? index - 1 : index + 1;
|
|
28
|
+
const nextId = model.getId(model.state.items[nextIndex]);
|
|
29
|
+
if (model.state.selectedIds[0] === id) {
|
|
30
|
+
// We're removing the currently selected item. Select next item
|
|
31
|
+
model.events.select({id: nextId});
|
|
32
|
+
}
|
|
33
|
+
if (model.state.cursorId === id) {
|
|
34
|
+
// We're removing the currently focused item. Focus next item
|
|
35
|
+
model.events.goTo({id: nextId});
|
|
36
|
+
|
|
37
|
+
// wait for stabilization of state
|
|
38
|
+
requestAnimationFrame(() => {
|
|
39
|
+
document.querySelector<HTMLElement>(`#${model.state.id}-${nextId}`)?.focus();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onKeyDown = (e: React.KeyboardEvent<HTMLElement>, id: string) => {
|
|
45
|
+
if (e.key === 'Delete') {
|
|
46
|
+
setTabs(tabs.filter(item => item.id !== id));
|
|
47
|
+
removeItem(id, model);
|
|
20
48
|
}
|
|
21
49
|
};
|
|
22
50
|
|
|
@@ -25,10 +53,10 @@ export default () => {
|
|
|
25
53
|
<Tabs.List>
|
|
26
54
|
{tabs.map((item, index) => (
|
|
27
55
|
<Tabs.Item
|
|
28
|
-
key={item.
|
|
29
|
-
name={item.
|
|
56
|
+
key={item.id}
|
|
57
|
+
name={item.id}
|
|
30
58
|
index={index}
|
|
31
|
-
onKeyDown={e => onKeyDown(e, item.
|
|
59
|
+
onKeyDown={e => onKeyDown(e, item.id)}
|
|
32
60
|
>
|
|
33
61
|
{item.tab}
|
|
34
62
|
</Tabs.Item>
|
|
@@ -40,7 +68,7 @@ export default () => {
|
|
|
40
68
|
onClick={() => {
|
|
41
69
|
addedRef.current += 1;
|
|
42
70
|
setTabs(tabs =>
|
|
43
|
-
tabs.concat({tab: `Tab ${addedRef.current}`,
|
|
71
|
+
tabs.concat({tab: `Tab ${addedRef.current}`, id: `tab-${addedRef.current}`})
|
|
44
72
|
);
|
|
45
73
|
model.events.goTo({id: 'last'});
|
|
46
74
|
}}
|
|
@@ -50,7 +78,7 @@ export default () => {
|
|
|
50
78
|
</Tabs.List>
|
|
51
79
|
<div style={{marginTop: space.m}}>
|
|
52
80
|
{tabs.map((item, index) => (
|
|
53
|
-
<Tabs.Panel key={item.
|
|
81
|
+
<Tabs.Panel key={item.id} name={item.id}>
|
|
54
82
|
Contents of {item.tab}
|
|
55
83
|
</Tabs.Panel>
|
|
56
84
|
))}
|
|
@@ -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
|
-
|
|
10
|
-
console.log('
|
|
9
|
+
onSelect({data, prevState}) {
|
|
10
|
+
console.log('Selected Tab', data, prevState);
|
|
11
11
|
},
|
|
12
12
|
});
|
|
13
13
|
|
|
@@ -27,10 +27,10 @@ export default () => {
|
|
|
27
27
|
</Tabs>
|
|
28
28
|
<SecondaryButton
|
|
29
29
|
onClick={() => {
|
|
30
|
-
model.events.
|
|
30
|
+
model.events.select({id: 'third'});
|
|
31
31
|
}}
|
|
32
32
|
>
|
|
33
|
-
|
|
33
|
+
Select Third Tab
|
|
34
34
|
</SecondaryButton>
|
|
35
35
|
</>
|
|
36
36
|
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
import {starIcon, searchIcon, selectIcon, shareIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
+
import {Tabs} from '@workday/canvas-kit-react/tabs';
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
return (
|
|
9
|
+
<Tabs>
|
|
10
|
+
<Tabs.List>
|
|
11
|
+
<Tabs.Item hasIcon>
|
|
12
|
+
<Tabs.Item.Icon icon={starIcon} />
|
|
13
|
+
<Tabs.Item.Text>First Tab</Tabs.Item.Text>
|
|
14
|
+
</Tabs.Item>
|
|
15
|
+
<Tabs.Item hasIcon>
|
|
16
|
+
<Tabs.Item.Icon icon={searchIcon} />
|
|
17
|
+
<Tabs.Item.Text>Second Tab</Tabs.Item.Text>
|
|
18
|
+
</Tabs.Item>
|
|
19
|
+
<Tabs.Item hasIcon>
|
|
20
|
+
<Tabs.Item.Icon icon={selectIcon} />
|
|
21
|
+
<Tabs.Item.Text>Third Tab</Tabs.Item.Text>
|
|
22
|
+
</Tabs.Item>
|
|
23
|
+
<Tabs.Item hasIcon>
|
|
24
|
+
<Tabs.Item.Icon icon={shareIcon} />
|
|
25
|
+
<Tabs.Item.Text>Fourth Tab</Tabs.Item.Text>
|
|
26
|
+
</Tabs.Item>
|
|
27
|
+
</Tabs.List>
|
|
28
|
+
<div style={{marginTop: space.m}}>
|
|
29
|
+
<Tabs.Panel>Contents of First Tab</Tabs.Panel>
|
|
30
|
+
<Tabs.Panel>Contents of Second Tab</Tabs.Panel>
|
|
31
|
+
<Tabs.Panel>Contents of Third Tab</Tabs.Panel>
|
|
32
|
+
<Tabs.Panel>Contents of Fourth Tab</Tabs.Panel>
|
|
33
|
+
</div>
|
|
34
|
+
</Tabs>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {Tabs, useTabsModel} from '@workday/canvas-kit-react/tabs';
|
|
4
|
+
import {HStack} from '@workday/canvas-kit-labs-react';
|
|
5
|
+
import {SecondaryButton} from '../../../button';
|
|
6
|
+
|
|
7
|
+
type MyTabItem = {
|
|
8
|
+
id: string;
|
|
9
|
+
text: React.ReactNode;
|
|
10
|
+
contents: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default () => {
|
|
14
|
+
const [items] = React.useState<MyTabItem[]>([
|
|
15
|
+
{id: 'first', text: 'First Tab', contents: 'Contents of First Tab'},
|
|
16
|
+
{id: 'second', text: 'Second Tab', contents: 'Contents of Second Tab'},
|
|
17
|
+
{id: 'third', text: 'Third Tab', contents: 'Contents of Third Tab'},
|
|
18
|
+
{id: 'fourth', text: 'Fourth Tab', contents: 'Contents of Fourth Tab'},
|
|
19
|
+
{id: 'fifth', text: 'Fifth Tab', contents: 'Contents of Fifth Tab'},
|
|
20
|
+
{id: 'sixth', text: 'Sixth Tab', contents: 'Contents of Sixth Tab'},
|
|
21
|
+
{id: 'seventh', text: 'Seventh Tab', contents: 'Contents of Seventh Tab'},
|
|
22
|
+
]);
|
|
23
|
+
const model = useTabsModel({
|
|
24
|
+
items,
|
|
25
|
+
});
|
|
26
|
+
const [containerWidth, setContainerWidth] = React.useState('100%');
|
|
27
|
+
return (
|
|
28
|
+
<div style={{width: containerWidth}}>
|
|
29
|
+
<Tabs model={model}>
|
|
30
|
+
<Tabs.List overflowButton={<Tabs.OverflowButton>More</Tabs.OverflowButton>}>
|
|
31
|
+
{(item: MyTabItem) => <Tabs.Item name={item.id}>{item.text}</Tabs.Item>}
|
|
32
|
+
</Tabs.List>
|
|
33
|
+
<Tabs.Menu.Popper>
|
|
34
|
+
<Tabs.Menu.Card maxWidth={300} maxHeight={200}>
|
|
35
|
+
<Tabs.Menu.List>
|
|
36
|
+
{(item: MyTabItem) => <Tabs.Menu.Item name={item.id}>{item.text}</Tabs.Menu.Item>}
|
|
37
|
+
</Tabs.Menu.List>
|
|
38
|
+
</Tabs.Menu.Card>
|
|
39
|
+
</Tabs.Menu.Popper>
|
|
40
|
+
<Tabs.Panels>
|
|
41
|
+
{(item: MyTabItem) => (
|
|
42
|
+
<Tabs.Panel marginTop="m" name={item.id}>
|
|
43
|
+
{item.contents}
|
|
44
|
+
</Tabs.Panel>
|
|
45
|
+
)}
|
|
46
|
+
</Tabs.Panels>
|
|
47
|
+
</Tabs>
|
|
48
|
+
<hr />
|
|
49
|
+
<h4>Change tab container size</h4>
|
|
50
|
+
<HStack spacing="xs">
|
|
51
|
+
<SecondaryButton onClick={() => setContainerWidth('100%')}>100%</SecondaryButton>
|
|
52
|
+
<SecondaryButton onClick={() => setContainerWidth('500px')}>500px</SecondaryButton>
|
|
53
|
+
<SecondaryButton onClick={() => setContainerWidth('235px')}>235px</SecondaryButton>
|
|
54
|
+
<SecondaryButton onClick={() => setContainerWidth('150px')}>150px</SecondaryButton>
|
|
55
|
+
</HStack>
|
|
56
|
+
</div>
|
|
57
|
+
);
|
|
58
|
+
};
|
|
@@ -29,52 +29,36 @@ Below are examples we expect will work for most use cases. Note that all example
|
|
|
29
29
|
they are an important signifier to communicate meaning. For this reason, Toast notifications should
|
|
30
30
|
always include an icon.
|
|
31
31
|
|
|
32
|
-
---
|
|
33
|
-
|
|
34
32
|
#### Complete Example with Popper
|
|
35
33
|
|
|
36
34
|
We use Popper to position Toast. Here's an example of how to use them together.
|
|
37
35
|
|
|
38
36
|
<ExampleCodeBlock code={WithPopper} />
|
|
39
37
|
|
|
40
|
-
---
|
|
41
|
-
|
|
42
38
|
#### Success
|
|
43
39
|
|
|
44
40
|
<ExampleCodeBlock code={Success} />
|
|
45
41
|
|
|
46
|
-
---
|
|
47
|
-
|
|
48
42
|
#### Error
|
|
49
43
|
|
|
50
44
|
<ExampleCodeBlock code={Error} />
|
|
51
45
|
|
|
52
|
-
---
|
|
53
|
-
|
|
54
46
|
#### WithCloseButton
|
|
55
47
|
|
|
56
48
|
<ExampleCodeBlock code={WithCloseButton} />
|
|
57
49
|
|
|
58
|
-
---
|
|
59
|
-
|
|
60
50
|
#### With an Action Link
|
|
61
51
|
|
|
62
52
|
<ExampleCodeBlock code={WithActionLink} />
|
|
63
53
|
|
|
64
|
-
---
|
|
65
|
-
|
|
66
54
|
#### With an Action Link and CloseIcon
|
|
67
55
|
|
|
68
56
|
<ExampleCodeBlock code={WithActionLinkAndCloseIcon} />
|
|
69
57
|
|
|
70
|
-
---
|
|
71
|
-
|
|
72
58
|
#### With RTL
|
|
73
59
|
|
|
74
60
|
<ExampleCodeBlock code={RTL} />
|
|
75
61
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
## Component Props
|
|
62
|
+
## Props
|
|
79
63
|
|
|
80
64
|
<ArgsTable of={Toast} />
|
|
@@ -3,6 +3,7 @@ import {Specifications} from '@workday/canvas-kit-docs';
|
|
|
3
3
|
|
|
4
4
|
import Default from './examples/Default';
|
|
5
5
|
import CustomContent from './examples/CustomContent';
|
|
6
|
+
import DelayedTooltip from './examples/DelayedTooltip';
|
|
6
7
|
import DescribeType from './examples/DescribeType';
|
|
7
8
|
import Muted from './examples/Muted';
|
|
8
9
|
import Placements from './examples/Placements';
|
|
@@ -87,6 +88,13 @@ a dialog instead.
|
|
|
87
88
|
|
|
88
89
|
<ExampleCodeBlock code={CustomContent} />
|
|
89
90
|
|
|
91
|
+
### Delayed Tooltip
|
|
92
|
+
|
|
93
|
+
The default delay for showing and hiding a tooltip are 300ms and 100ms, respectively. You can
|
|
94
|
+
control the length of the delay by providing custom `showDelay` and `hideDelay` in ms.
|
|
95
|
+
|
|
96
|
+
<ExampleCodeBlock code={DelayedTooltip} />
|
|
97
|
+
|
|
90
98
|
### Placements
|
|
91
99
|
|
|
92
100
|
The tooltip allows for a `placement` configuration. The tooltip uses
|
|
@@ -168,7 +176,7 @@ example uses those parts directly while being functionally equivalent to the ori
|
|
|
168
176
|
|
|
169
177
|
<ExampleCodeBlock code={UseTooltip} />
|
|
170
178
|
|
|
171
|
-
##
|
|
179
|
+
## Props
|
|
172
180
|
|
|
173
181
|
<ArgsTable of={Tooltip} />
|
|
174
182
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
4
|
+
import {Tooltip} from '@workday/canvas-kit-react/tooltip';
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
return (
|
|
8
|
+
<React.Fragment>
|
|
9
|
+
<Tooltip type="describe" title="Tooltip Text" showDelay={2000} hideDelay={1000}>
|
|
10
|
+
<SecondaryButton>
|
|
11
|
+
Tooltip appears after 2 seconds and disappears after 1 second
|
|
12
|
+
</SecondaryButton>
|
|
13
|
+
</Tooltip>
|
|
14
|
+
</React.Fragment>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
4
4
|
import {OverflowTooltip} from '@workday/canvas-kit-react/tooltip';
|
|
5
5
|
import {space} from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
import {resetIcon} from '@workday/canvas-system-icons-web';
|
|
6
7
|
|
|
7
8
|
const CustomContent = ({...elemProps}) => (
|
|
8
9
|
<button
|
|
@@ -30,6 +31,11 @@ export default () => {
|
|
|
30
31
|
Super Mega Ultra Long Content With Max Width On The Button
|
|
31
32
|
</SecondaryButton>
|
|
32
33
|
</OverflowTooltip>
|
|
34
|
+
<OverflowTooltip>
|
|
35
|
+
<SecondaryButton icon={resetIcon} style={{maxWidth: 200}}>
|
|
36
|
+
Super Mega Ultra Long Content With Max Width On The Button with Icon
|
|
37
|
+
</SecondaryButton>
|
|
38
|
+
</OverflowTooltip>
|
|
33
39
|
<OverflowTooltip>
|
|
34
40
|
<button
|
|
35
41
|
style={{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "6.0.0-alpha.0-next.
|
|
3
|
+
"version": "6.0.0-alpha.0-next.36+5890bf68",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
"build:specs": "node ./utils/build-specifications.js",
|
|
36
36
|
"build:downlevel-dts": "yarn run downlevel-dts dist ts3.5/dist",
|
|
37
37
|
"build": "npm-run-all --parallel build:cjs build:es6 build:mdx --sequential build:specs build:downlevel-dts",
|
|
38
|
-
"depcheck": "node ../../utils/check-dependencies-exist.js"
|
|
38
|
+
"depcheck": "node ../../utils/check-dependencies-exist.js",
|
|
39
|
+
"typecheck:src": "tsc -p . --noEmit --incremental false"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
@@ -49,7 +50,7 @@
|
|
|
49
50
|
],
|
|
50
51
|
"dependencies": {
|
|
51
52
|
"@storybook/csf": "0.0.1",
|
|
52
|
-
"@workday/canvas-kit-react": "^6.0.0-alpha.0-next.
|
|
53
|
+
"@workday/canvas-kit-react": "^6.0.0-alpha.0-next.36+5890bf68"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"fs-extra": "^10.0.0",
|
|
@@ -57,5 +58,5 @@
|
|
|
57
58
|
"mkdirp": "^1.0.3",
|
|
58
59
|
"typescript": "^3.8.3"
|
|
59
60
|
},
|
|
60
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "5890bf680def9c37d6e386472634cc3e1b6d81e9"
|
|
61
62
|
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers
|
|
6
|
-
pledge to making participation in our project and our community a harassment-free experience for
|
|
7
|
-
everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity
|
|
8
|
-
and expression, level of experience, education, socio-economic status, nationality, personal
|
|
9
|
-
appearance, race, religion, or sexual identity and orientation.
|
|
10
|
-
|
|
11
|
-
## Our Standards
|
|
12
|
-
|
|
13
|
-
Examples of behavior that contributes to creating a positive environment include:
|
|
14
|
-
|
|
15
|
-
- Using welcoming and inclusive language
|
|
16
|
-
- Being respectful of differing viewpoints and experiences
|
|
17
|
-
- Gracefully accepting constructive criticism
|
|
18
|
-
- Focusing on what is best for the community
|
|
19
|
-
- Showing empathy towards other community members
|
|
20
|
-
|
|
21
|
-
Examples of unacceptable behavior by participants include:
|
|
22
|
-
|
|
23
|
-
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
|
24
|
-
- Trolling, insulting/derogatory comments, and personal or political attacks
|
|
25
|
-
- Public or private harassment
|
|
26
|
-
- Publishing others' private information, such as a physical or electronic address, without explicit
|
|
27
|
-
permission
|
|
28
|
-
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
|
29
|
-
|
|
30
|
-
## Our Responsibilities
|
|
31
|
-
|
|
32
|
-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are
|
|
33
|
-
expected to take appropriate and fair corrective action in response to any instances of unacceptable
|
|
34
|
-
behavior.
|
|
35
|
-
|
|
36
|
-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits,
|
|
37
|
-
code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or
|
|
38
|
-
to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate,
|
|
39
|
-
threatening, offensive, or harmful.
|
|
40
|
-
|
|
41
|
-
## Scope
|
|
42
|
-
|
|
43
|
-
This Code of Conduct applies both within project spaces and in public spaces when an individual is
|
|
44
|
-
representing the project or its community. Examples of representing a project or community include
|
|
45
|
-
using an official project e-mail address, posting via an official social media account, or acting as
|
|
46
|
-
an appointed representative at an online or offline event. Representation of a project may be
|
|
47
|
-
further defined and clarified by project maintainers.
|
|
48
|
-
|
|
49
|
-
## Enforcement
|
|
50
|
-
|
|
51
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting
|
|
52
|
-
the project team at design@workday.com. All complaints will be reviewed and investigated and will
|
|
53
|
-
result in a response that is deemed necessary and appropriate to the circumstances. The project team
|
|
54
|
-
is obligated to maintain confidentiality with regard to the reporter of an incident. Further details
|
|
55
|
-
of specific enforcement policies may be posted separately.
|
|
56
|
-
|
|
57
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face
|
|
58
|
-
temporary or permanent repercussions as determined by other members of the project's leadership.
|
|
59
|
-
|
|
60
|
-
## Attribution
|
|
61
|
-
|
|
62
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at
|
|
63
|
-
https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
|
64
|
-
|
|
65
|
-
[homepage]: https://www.contributor-covenant.org
|
|
66
|
-
|
|
67
|
-
For answers to common questions about this code of conduct, see
|
|
68
|
-
https://www.contributor-covenant.org/faq
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
import {styled} from '@workday/canvas-kit-react/common';
|
|
5
|
-
import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
|
|
6
|
-
import {CSSProperties, space} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
|
|
8
|
-
const StyledField = styled(TextInput.Field)<{alertStyles?: CSSProperties}>(
|
|
9
|
-
({alertStyles}) => alertStyles
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export default () => {
|
|
13
|
-
const [value, setValue] = React.useState('foo');
|
|
14
|
-
|
|
15
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
16
|
-
setValue(event.target.value);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const alertStyles = useThemedRing(
|
|
20
|
-
value.length < 3 ? 'error' : value.length < 5 ? 'alert' : 'success'
|
|
21
|
-
);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
25
|
-
<TextInput>
|
|
26
|
-
<TextInput.Label>Password</TextInput.Label>
|
|
27
|
-
<StyledField
|
|
28
|
-
alertStyles={alertStyles}
|
|
29
|
-
onChange={handleChange}
|
|
30
|
-
value={value}
|
|
31
|
-
type="password"
|
|
32
|
-
/>
|
|
33
|
-
<TextInput.Hint paddingTop={space.xxs}>
|
|
34
|
-
<strong>Password Strength: </strong>
|
|
35
|
-
{value.length < 3 ? (
|
|
36
|
-
<span>Weak</span>
|
|
37
|
-
) : value.length < 5 ? (
|
|
38
|
-
<span>Average</span>
|
|
39
|
-
) : (
|
|
40
|
-
<span>Strong</span>
|
|
41
|
-
)}
|
|
42
|
-
</TextInput.Hint>
|
|
43
|
-
</TextInput>
|
|
44
|
-
</VStack>
|
|
45
|
-
);
|
|
46
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} disabled />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Street Address</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {HStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<HStack spacing="l" alignItems="center">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</HStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('SuperSecret1');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Password</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} type="password" />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
14
|
-
<TextInput>
|
|
15
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} placeholder="user@email.com" />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('');
|
|
7
|
-
|
|
8
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
9
|
-
setValue(event.target.value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
14
|
-
<TextInput isRequired={true}>
|
|
15
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
16
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
17
|
-
</TextInput>
|
|
18
|
-
</VStack>
|
|
19
|
-
);
|
|
20
|
-
};
|