@workday/canvas-kit-docs 14.0.0-alpha.1229-next.0 → 14.0.0-alpha.1233-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.
- package/dist/es6/lib/docs.js +266 -1710
- package/dist/mdx/14.0-UPGRADE-GUIDE.mdx +99 -30
- package/dist/mdx/labs-react/combobox/Combobox.mdx +1 -1
- package/dist/mdx/labs-react/search-form/SearchForm.mdx +14 -2
- package/dist/mdx/preview-react/_examples/mdx/examples/TextInputWithFormik.tsx +35 -28
- package/dist/mdx/preview-react/_examples/mdx/examples/TextInputWithReactHookForm.tsx +27 -21
- package/dist/mdx/react/_examples/mdx/examples/common/FilterListWithLiveStatus.tsx +8 -5
- package/dist/mdx/react/_examples/mdx/examples/common/HiddenLiveRegion.tsx +8 -5
- package/dist/mdx/react/_examples/mdx/examples/common/TextInputWithLiveError.tsx +11 -8
- package/dist/mdx/react/_examples/mdx/examples/common/VisibleLiveRegion.tsx +9 -5
- package/package.json +6 -6
- package/dist/mdx/preview-react/text-area/TextArea.mdx +0 -136
- package/dist/mdx/preview-react/text-area/examples/Alert.tsx +0 -35
- package/dist/mdx/preview-react/text-area/examples/Basic.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Disabled.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Error.tsx +0 -40
- package/dist/mdx/preview-react/text-area/examples/Grow.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/HiddenLabel.tsx +0 -22
- package/dist/mdx/preview-react/text-area/examples/LabelPositionHorizontal.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/LabelPositionVertical.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/Placeholder.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/RefForwarding.tsx +0 -28
- package/dist/mdx/preview-react/text-area/examples/Required.tsx +0 -17
- package/dist/mdx/preview-react/text-area/examples/ResizeConstraints.tsx +0 -22
- package/dist/mdx/preview-react/text-input/TextInput.mdx +0 -170
- package/dist/mdx/preview-react/text-input/examples/Alert.tsx +0 -33
- package/dist/mdx/preview-react/text-input/examples/Basic.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Disabled.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Error.tsx +0 -40
- package/dist/mdx/preview-react/text-input/examples/Grow.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Hidden.tsx +0 -11
- package/dist/mdx/preview-react/text-input/examples/HiddenLabel.tsx +0 -22
- package/dist/mdx/preview-react/text-input/examples/LabelPositionHorizontal.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/LabelPositionVertical.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Password.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/Placeholder.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/ReadOnly.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/RefForwarding.tsx +0 -28
- package/dist/mdx/preview-react/text-input/examples/Required.tsx +0 -17
- package/dist/mdx/preview-react/text-input/examples/ThemedAlert.tsx +0 -51
- package/dist/mdx/preview-react/text-input/examples/ThemedError.tsx +0 -40
- package/dist/mdx/react/_examples/mdx/SearchForm.mdx +0 -19
- package/dist/mdx/react/_examples/mdx/examples/SearchFormBasic.tsx +0 -35
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
import {space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
|
|
5
|
-
export default () => {
|
|
6
|
-
const [value, setValue] = React.useState('four');
|
|
7
|
-
const [hint, setHint] = React.useState('');
|
|
8
|
-
const [hasError, setHasError] = React.useState(false);
|
|
9
|
-
|
|
10
|
-
const validateInput = (value: string) => {
|
|
11
|
-
const stringLength = value.length;
|
|
12
|
-
if (stringLength !== 3) {
|
|
13
|
-
setHasError(true);
|
|
14
|
-
const hintStart = 'Word length must be';
|
|
15
|
-
setHint(stringLength < 3 ? `${hintStart} greater than 2` : `${hintStart} less than 4`);
|
|
16
|
-
} else {
|
|
17
|
-
setHasError(false);
|
|
18
|
-
setHint('');
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
React.useEffect(() => {
|
|
23
|
-
validateInput(value);
|
|
24
|
-
// Only run on load
|
|
25
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
29
|
-
validateInput(event.target.value);
|
|
30
|
-
setValue(event.target.value);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<TextInput error={hasError ? 'error' : undefined} orientation="vertical">
|
|
35
|
-
<TextInput.Label>A three letter word</TextInput.Label>
|
|
36
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
37
|
-
<TextInput.Hint paddingTop={space.xxs}>{hint}</TextInput.Hint>
|
|
38
|
-
</TextInput>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput orientation="vertical" alignItems="stretch">
|
|
13
|
-
<TextInput.Label>Street Address</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
return (
|
|
6
|
-
<>
|
|
7
|
-
<h2>Inspect Element to see the markup</h2>
|
|
8
|
-
<TextInput.Field value={'Secret'} type="hidden" />
|
|
9
|
-
</>
|
|
10
|
-
);
|
|
11
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
import {accessibleHide, styled} from '@workday/canvas-kit-react/common';
|
|
4
|
-
|
|
5
|
-
const StyledTextAreaLabel = styled(TextInput.Label)({
|
|
6
|
-
...accessibleHide,
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export default () => {
|
|
10
|
-
const [value, setValue] = React.useState('');
|
|
11
|
-
|
|
12
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
13
|
-
setValue(event.target.value);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<TextInput orientation="vertical" gap="zero">
|
|
18
|
-
<StyledTextAreaLabel>Email</StyledTextAreaLabel>
|
|
19
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
20
|
-
</TextInput>
|
|
21
|
-
);
|
|
22
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput orientation="horizontalStart">
|
|
13
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput orientation="vertical" gap="xxxs">
|
|
13
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('SuperSecret1');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput orientation="vertical">
|
|
13
|
-
<TextInput.Label>Password</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} type="password" />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput orientation="vertical">
|
|
13
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} placeholder="user@email.com" />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
return (
|
|
6
|
-
<TextInput orientation="vertical">
|
|
7
|
-
<TextInput.Label>Unwavering Opinion</TextInput.Label>
|
|
8
|
-
<TextInput.Field
|
|
9
|
-
value={'CKR is great'}
|
|
10
|
-
readOnly={true}
|
|
11
|
-
borderColor="transparent"
|
|
12
|
-
background="transparent"
|
|
13
|
-
cursor="default"
|
|
14
|
-
/>
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {changeFocus} from '@workday/canvas-kit-react/common';
|
|
3
|
-
import {Flex} from '@workday/canvas-kit-react/layout';
|
|
4
|
-
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
5
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
6
|
-
|
|
7
|
-
export default () => {
|
|
8
|
-
const [value, setValue] = React.useState('');
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
|
|
11
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
12
|
-
setValue(event.target.value);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const handleClick = () => {
|
|
16
|
-
changeFocus(ref.current);
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<Flex gap="xxxs" alignItems="flex-start" flexDirection="column">
|
|
21
|
-
<TextInput orientation="vertical">
|
|
22
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
23
|
-
<TextInput.Field onChange={handleChange} value={value} ref={ref} />
|
|
24
|
-
</TextInput>
|
|
25
|
-
<SecondaryButton onClick={handleClick}>Focus Text Input</SecondaryButton>
|
|
26
|
-
</Flex>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
|
|
4
|
-
export default () => {
|
|
5
|
-
const [value, setValue] = React.useState('');
|
|
6
|
-
|
|
7
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
8
|
-
setValue(event.target.value);
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
return (
|
|
12
|
-
<TextInput isRequired={true} orientation="vertical">
|
|
13
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
14
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
15
|
-
</TextInput>
|
|
16
|
-
);
|
|
17
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
import {
|
|
4
|
-
CanvasProvider,
|
|
5
|
-
PartialEmotionCanvasTheme,
|
|
6
|
-
useThemedRing,
|
|
7
|
-
} from '@workday/canvas-kit-react/common';
|
|
8
|
-
import {base, system} from '@workday/canvas-tokens-web';
|
|
9
|
-
import {cssVar} from '@workday/canvas-kit-styling';
|
|
10
|
-
|
|
11
|
-
export default () => {
|
|
12
|
-
const theme: PartialEmotionCanvasTheme = {
|
|
13
|
-
canvas: {
|
|
14
|
-
palette: {
|
|
15
|
-
alert: {
|
|
16
|
-
lightest: cssVar(system.color.static.green.softer),
|
|
17
|
-
},
|
|
18
|
-
common: {
|
|
19
|
-
focusOutline: cssVar(base.purple500),
|
|
20
|
-
alertInner: cssVar(base.green400),
|
|
21
|
-
alertOuter: cssVar(base.green500),
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
return (
|
|
27
|
-
<CanvasProvider theme={theme}>
|
|
28
|
-
<AlertInput />
|
|
29
|
-
</CanvasProvider>
|
|
30
|
-
);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const AlertInput = () => {
|
|
34
|
-
const [value, setValue] = React.useState('invalid@email');
|
|
35
|
-
|
|
36
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
37
|
-
setValue(event.target.value);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
const alertStyles = useThemedRing('alert');
|
|
41
|
-
|
|
42
|
-
return (
|
|
43
|
-
<TextInput error="alert" orientation="vertical">
|
|
44
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
45
|
-
<TextInput.Field cs={alertStyles} onChange={handleChange} value={value} />
|
|
46
|
-
<TextInput.Hint cs={{paddingTop: cssVar(system.space.x2)}}>
|
|
47
|
-
Please enter a valid email.
|
|
48
|
-
</TextInput.Hint>
|
|
49
|
-
</TextInput>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-preview-react/text-input';
|
|
3
|
-
import {CanvasProvider, PartialEmotionCanvasTheme} from '@workday/canvas-kit-react/common';
|
|
4
|
-
import {system, base} from '@workday/canvas-tokens-web';
|
|
5
|
-
import {cssVar} from '@workday/canvas-kit-styling';
|
|
6
|
-
|
|
7
|
-
export default () => {
|
|
8
|
-
const [value, setValue] = React.useState('');
|
|
9
|
-
|
|
10
|
-
const handleChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
11
|
-
setValue(event.target.value);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const theme: PartialEmotionCanvasTheme = {
|
|
15
|
-
canvas: {
|
|
16
|
-
palette: {
|
|
17
|
-
error: {
|
|
18
|
-
lightest: cssVar(base.purple100),
|
|
19
|
-
main: cssVar(base.purple600),
|
|
20
|
-
},
|
|
21
|
-
common: {
|
|
22
|
-
focusOutline: cssVar(system.color.static.green.default),
|
|
23
|
-
errorInner: cssVar(base.purple600),
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<CanvasProvider theme={theme}>
|
|
31
|
-
<TextInput error={!value ? 'error' : undefined} isRequired={true} orientation="vertical">
|
|
32
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
33
|
-
<TextInput.Field onChange={handleChange} value={value} />
|
|
34
|
-
<TextInput.Hint cs={{paddingTop: cssVar(system.space.x2)}}>
|
|
35
|
-
{!value && 'Please enter an email.'}
|
|
36
|
-
</TextInput.Hint>
|
|
37
|
-
</TextInput>
|
|
38
|
-
</CanvasProvider>
|
|
39
|
-
);
|
|
40
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {ExampleCodeBlock} from '@workday/canvas-kit-docs';
|
|
2
|
-
import SearchFormBasic from './examples/SearchFormBasic';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
# Canvas Kit Examples
|
|
6
|
-
|
|
7
|
-
## Search Form Basic
|
|
8
|
-
|
|
9
|
-
A search form has a couple unique attributes to work correctly across platforms.
|
|
10
|
-
|
|
11
|
-
If you are a SPA and use an `onSubmit` attritbute be sure to also include a `action="."` attribute
|
|
12
|
-
to get the correct keyboard on mobile devices.
|
|
13
|
-
|
|
14
|
-
The form should always have a `role="search"` and the input should be `type="search"`
|
|
15
|
-
|
|
16
|
-
If you want to use a CKR clear button you will need to hide the webkit default one using the
|
|
17
|
-
`::-webkit-search-cancel-button` pseudo selector.
|
|
18
|
-
|
|
19
|
-
<ExampleCodeBlock code={SearchFormBasic} />
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TertiaryButton} from '@workday/canvas-kit-react/button';
|
|
3
|
-
import {InputGroup} from '@workday/canvas-kit-react/text-input';
|
|
4
|
-
import {searchIcon} from '@workday/canvas-system-icons-web';
|
|
5
|
-
import {createStyles} from '@workday/canvas-kit-styling';
|
|
6
|
-
|
|
7
|
-
const hideNativeClearStyles = createStyles({
|
|
8
|
-
'&::-webkit-search-cancel-button': {
|
|
9
|
-
display: 'none',
|
|
10
|
-
},
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
export default () => {
|
|
14
|
-
const handleSubmit = (e: React.FormEvent) => {
|
|
15
|
-
e.preventDefault();
|
|
16
|
-
console.log(e.target[1]);
|
|
17
|
-
};
|
|
18
|
-
return (
|
|
19
|
-
<form role="search" action="." onSubmit={handleSubmit}>
|
|
20
|
-
<InputGroup>
|
|
21
|
-
<InputGroup.InnerStart>
|
|
22
|
-
<TertiaryButton size="small" aria-label="Search" icon={searchIcon} type="submit" />
|
|
23
|
-
</InputGroup.InnerStart>
|
|
24
|
-
<InputGroup.Input
|
|
25
|
-
type="search"
|
|
26
|
-
placeholder="Search for your favorite wine"
|
|
27
|
-
cs={hideNativeClearStyles}
|
|
28
|
-
/>
|
|
29
|
-
<InputGroup.InnerEnd>
|
|
30
|
-
<InputGroup.ClearButton />
|
|
31
|
-
</InputGroup.InnerEnd>
|
|
32
|
-
</InputGroup>
|
|
33
|
-
</form>
|
|
34
|
-
);
|
|
35
|
-
};
|