@workday/canvas-kit-docs 6.0.7 → 6.1.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/commonjs/lib/specs.js +136 -2
- package/dist/es6/lib/specs.js +136 -2
- 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/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/package.json +3 -3
- 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
|
@@ -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
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {TextInput} from '@workday/canvas-kit-labs-react/text-input';
|
|
3
|
-
import {useThemedRing} from '@workday/canvas-kit-labs-react/common';
|
|
4
|
-
import {VStack} from '@workday/canvas-kit-labs-react/layout';
|
|
5
|
-
import {CanvasProvider, PartialEmotionCanvasTheme, styled} from '@workday/canvas-kit-react/common';
|
|
6
|
-
import {colors, CSSProperties, space} from '@workday/canvas-kit-react/tokens';
|
|
7
|
-
|
|
8
|
-
export default () => {
|
|
9
|
-
const theme: PartialEmotionCanvasTheme = {
|
|
10
|
-
canvas: {
|
|
11
|
-
palette: {
|
|
12
|
-
common: {
|
|
13
|
-
focusOutline: colors.grapeSoda300,
|
|
14
|
-
},
|
|
15
|
-
alert: {
|
|
16
|
-
main: colors.kiwi500,
|
|
17
|
-
darkest: colors.kiwi600,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
return (
|
|
23
|
-
<CanvasProvider theme={theme}>
|
|
24
|
-
<AlertInput />
|
|
25
|
-
</CanvasProvider>
|
|
26
|
-
);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const StyledField = styled(TextInput.Field)<{alertStyles?: CSSProperties}>(
|
|
30
|
-
({alertStyles}) => alertStyles
|
|
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
|
-
<VStack spacing="xxxs" alignItems="flex-start">
|
|
44
|
-
<TextInput>
|
|
45
|
-
<TextInput.Label>Email</TextInput.Label>
|
|
46
|
-
<StyledField alertStyles={alertStyles} onChange={handleChange} value={value} />
|
|
47
|
-
<TextInput.Hint paddingTop={space.xxs}>Please enter a valid email.</TextInput.Hint>
|
|
48
|
-
</TextInput>
|
|
49
|
-
</VStack>
|
|
50
|
-
);
|
|
51
|
-
};
|