@workday/canvas-kit-docs 6.0.4 → 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/6.0-MIGRATION-GUIDE.mdx +6 -0
- 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/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/loading-animation/LoadingAnimation.mdx +5 -0
- package/dist/mdx/react/loading-animation/examples/RTL.tsx +16 -0
- package/dist/mdx/react/tooltip/Tooltip.mdx +8 -0
- package/dist/mdx/react/tooltip/examples/DelayedTooltip.tsx +16 -0
- package/package.json +5 -4
- 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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {styled, createComponent, dubLogoBlue} from '@workday/canvas-kit-react/common';
|
|
3
|
+
import {colors, depth, space, type} from '@workday/canvas-kit-react/tokens';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
notificationsIcon,
|
|
7
|
+
inboxIcon,
|
|
8
|
+
justifyIcon,
|
|
9
|
+
assistantIcon,
|
|
10
|
+
} from '@workday/canvas-system-icons-web';
|
|
11
|
+
|
|
12
|
+
import {IconButton, Hyperlink} from '@workday/canvas-kit-react/button';
|
|
13
|
+
import {Avatar} from '@workday/canvas-kit-react/avatar';
|
|
14
|
+
import {SearchForm, HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
|
|
15
|
+
|
|
16
|
+
interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
|
|
17
|
+
spacing?: StackSpacing;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default () => (
|
|
21
|
+
<GlobalHeader>
|
|
22
|
+
<GlobalHeader.Item>
|
|
23
|
+
<IconButton aria-label="menu" icon={justifyIcon} />
|
|
24
|
+
<Hyperlink>
|
|
25
|
+
<WorkdayLogo dangerouslySetInnerHTML={{__html: dubLogoBlue}} />
|
|
26
|
+
</Hyperlink>
|
|
27
|
+
</GlobalHeader.Item>
|
|
28
|
+
<GlobalHeader.Item margin="auto" width="100%" maxWidth={`calc(${space.xxxl} * 6)`}>
|
|
29
|
+
<SearchForm onSubmit={() => 1} />
|
|
30
|
+
</GlobalHeader.Item>
|
|
31
|
+
<GlobalHeader.Item>
|
|
32
|
+
<IconButton aria-label="messages" icon={assistantIcon} />
|
|
33
|
+
<IconButton aria-label="notifications" icon={notificationsIcon} />
|
|
34
|
+
<IconButton aria-label="inbox" icon={inboxIcon} />
|
|
35
|
+
<Avatar size={Avatar.Size.m} variant={Avatar.Variant.Light} />
|
|
36
|
+
</GlobalHeader.Item>
|
|
37
|
+
</GlobalHeader>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const GlobalHeaderItem = createComponent('div')({
|
|
41
|
+
displayName: 'GlobalHeader.Item',
|
|
42
|
+
Component: ({spacing = 's', ...props}: HeaderItemProps, ref) => (
|
|
43
|
+
<HStack spacing={spacing} alignItems="center" marginX={space.xs} ref={ref} {...props} />
|
|
44
|
+
),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const GlobalHeader = createComponent('header')({
|
|
48
|
+
displayName: 'GlobalHeader',
|
|
49
|
+
Component: (props, ref, Element) => <HeaderWrapper ref={ref} as={Element} {...props} />,
|
|
50
|
+
subComponents: {Item: GlobalHeaderItem},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const HeaderWrapper = styled('header')({
|
|
54
|
+
display: 'flex',
|
|
55
|
+
alignItems: 'center',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
boxSizing: 'border-box',
|
|
58
|
+
...type.levels.subtext.large,
|
|
59
|
+
WebkitFontSmoothing: 'antialiased',
|
|
60
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
61
|
+
backgroundColor: colors.frenchVanilla100,
|
|
62
|
+
...depth[1],
|
|
63
|
+
padding: space.xxs,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const WorkdayLogo = styled('span')({lineHeight: 0});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import {styled, createComponent} from '@workday/canvas-kit-react/common';
|
|
3
|
+
|
|
4
|
+
import {colors, gradients, space, type} from '@workday/canvas-kit-react/tokens';
|
|
5
|
+
|
|
6
|
+
import {HStack, HStackProps, StackSpacing} from '@workday/canvas-kit-labs-react';
|
|
7
|
+
import {IconButton} from '@workday/canvas-kit-react/button';
|
|
8
|
+
import {justifyIcon, notificationsIcon} from '@workday/canvas-system-icons-web';
|
|
9
|
+
|
|
10
|
+
interface HeaderItemProps extends Omit<HStackProps, 'spacing'> {
|
|
11
|
+
spacing?: StackSpacing;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default () => (
|
|
15
|
+
<PageHeader>
|
|
16
|
+
<PageHeader.Title>Page Header</PageHeader.Title>
|
|
17
|
+
<PageHeader.Item>
|
|
18
|
+
<IconButton aria-label="notifications" icon={notificationsIcon} variant="inverse" />
|
|
19
|
+
<IconButton aria-label="menu" icon={justifyIcon} variant="inverse" />
|
|
20
|
+
</PageHeader.Item>
|
|
21
|
+
</PageHeader>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const PageHeaderItem = createComponent('div')({
|
|
25
|
+
displayName: 'PageHeader.Item',
|
|
26
|
+
Component: ({spacing = 'xxs', ...props}: HeaderItemProps, ref, Element) => (
|
|
27
|
+
<HStack spacing={spacing} ref={ref} as={Element} {...props} />
|
|
28
|
+
),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const PageHeaderTitle = createComponent('h2')({
|
|
32
|
+
displayName: 'PageHeader.Title',
|
|
33
|
+
Component: ({children, ...props}, ref, Element) => (
|
|
34
|
+
<Title ref={ref} as={Element} {...props}>
|
|
35
|
+
{children}
|
|
36
|
+
</Title>
|
|
37
|
+
),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
const PageHeader = createComponent('header')({
|
|
41
|
+
displayName: 'PageHeader',
|
|
42
|
+
Component: (props, ref, Element) => <Header ref={ref} as={Element} {...props} />,
|
|
43
|
+
subComponents: {Item: PageHeaderItem, Title: PageHeaderTitle},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const Header = styled('header')({
|
|
47
|
+
padding: `${space.xs} ${space.xl}`,
|
|
48
|
+
backgroundImage: gradients.blueberry,
|
|
49
|
+
color: colors.frenchVanilla100,
|
|
50
|
+
WebkitFontSmoothing: 'antialiased',
|
|
51
|
+
MozOsxFontSmoothing: 'grayscale',
|
|
52
|
+
display: 'flex',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const Title = styled('h2')({
|
|
58
|
+
...type.levels.heading.medium,
|
|
59
|
+
color: colors.frenchVanilla100,
|
|
60
|
+
padding: `${space.xs} 0`,
|
|
61
|
+
margin: 0,
|
|
62
|
+
whiteSpace: 'nowrap',
|
|
63
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {LoadingAnimation} from '@workday/canvas-kit-react/loading-animation';
|
|
2
2
|
|
|
3
3
|
import Basic from './examples/Basic';
|
|
4
|
+
import RTL from './examples/RTL';
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
# Canvas Kit Loading Animation
|
|
@@ -22,6 +23,10 @@ yarn add @workday/canvas-kit-react
|
|
|
22
23
|
|
|
23
24
|
<ExampleCodeBlock code={Basic} />
|
|
24
25
|
|
|
26
|
+
### Right-to-Left (RTL)
|
|
27
|
+
|
|
28
|
+
<ExampleCodeBlock code={RTL} />
|
|
29
|
+
|
|
25
30
|
## Props
|
|
26
31
|
|
|
27
32
|
Loading Animation does not have any documented props. Undocumented props are spread to its outermost
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {LoadingAnimation} from '@workday/canvas-kit-react/loading-animation';
|
|
3
|
+
import {CanvasProvider, ContentDirection} from '@workday/canvas-kit-react/common';
|
|
4
|
+
|
|
5
|
+
export default () => {
|
|
6
|
+
const theme = {
|
|
7
|
+
canvas: {
|
|
8
|
+
direction: ContentDirection.RTL,
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
return (
|
|
12
|
+
<CanvasProvider theme={theme}>
|
|
13
|
+
<LoadingAnimation />
|
|
14
|
+
</CanvasProvider>
|
|
15
|
+
);
|
|
16
|
+
};
|
|
@@ -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
|
|
@@ -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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.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",
|
|
@@ -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
|
|
53
|
+
"@workday/canvas-kit-react": "^6.1.0"
|
|
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": "6c78b250ea2d0dffd52c6502e6ea1f2d6cce71ed"
|
|
61
62
|
}
|
|
@@ -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
|
-
};
|