@workday/canvas-kit-react 12.0.0-alpha.852-next.0 → 12.0.0-alpha.862-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/avatar/lib/Avatar.tsx +210 -147
- package/dist/commonjs/avatar/lib/Avatar.d.ts +149 -44
- package/dist/commonjs/avatar/lib/Avatar.d.ts.map +1 -1
- package/dist/commonjs/avatar/lib/Avatar.js +68 -80
- package/dist/commonjs/text-area/lib/TextArea.d.ts +66 -33
- package/dist/commonjs/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/commonjs/text-area/lib/TextArea.js +26 -49
- package/dist/commonjs/text-input/lib/TextInput.d.ts +37 -2
- package/dist/commonjs/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/commonjs/text-input/lib/TextInput.js +20 -48
- package/dist/es6/avatar/lib/Avatar.d.ts +149 -44
- package/dist/es6/avatar/lib/Avatar.d.ts.map +1 -1
- package/dist/es6/avatar/lib/Avatar.js +70 -79
- package/dist/es6/text-area/lib/TextArea.d.ts +66 -33
- package/dist/es6/text-area/lib/TextArea.d.ts.map +1 -1
- package/dist/es6/text-area/lib/TextArea.js +25 -48
- package/dist/es6/text-input/lib/TextInput.d.ts +37 -2
- package/dist/es6/text-input/lib/TextInput.d.ts.map +1 -1
- package/dist/es6/text-input/lib/TextInput.js +20 -48
- package/package.json +4 -4
- package/text-area/lib/TextArea.tsx +40 -80
- package/text-input/lib/TextInput.tsx +80 -58
|
@@ -1,62 +1,167 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { Property } from 'csstype';
|
|
3
|
-
|
|
4
|
-
export declare enum AvatarVariant {
|
|
5
|
-
Light = 0,
|
|
6
|
-
Dark = 1
|
|
7
|
-
}
|
|
8
|
-
export interface AvatarProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
2
|
+
export interface AvatarProps {
|
|
9
3
|
/**
|
|
10
|
-
* The variant of the
|
|
11
|
-
* @default
|
|
4
|
+
* The variant of the avatar. Use `light` on dark backgrounds and `dark` on light backgrounds.
|
|
5
|
+
* @default "light"
|
|
12
6
|
*/
|
|
13
|
-
variant?:
|
|
7
|
+
variant?: 'light' | 'dark';
|
|
14
8
|
/**
|
|
15
9
|
* The size of the Avatar.
|
|
16
|
-
*
|
|
10
|
+
* - `extraExtraLarge`: 7.5rem x 7.5rem (120px x 120px)
|
|
11
|
+
* - `extraLarge`: 4.5rem x 4.5rem (64px x 64px)
|
|
12
|
+
* - `large`: 2.5rem x 2.5rem (40px x 40px)
|
|
13
|
+
* - `medium`: 2rem x 2rem (32px x 32px)
|
|
14
|
+
* - `small`: 1.5rem x 1.5rem (24px x 24px)
|
|
15
|
+
* - `small`: 1rem x 1rem (16px x 16px)
|
|
16
|
+
* @default "medium"
|
|
17
17
|
*/
|
|
18
|
-
size?:
|
|
18
|
+
size?: /** size of small */ 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge' | 'extraExtraLarge' | (string & {});
|
|
19
19
|
/**
|
|
20
|
-
* The alt text of the Avatar image. This prop is also used for the aria-label
|
|
20
|
+
* The alt text of the Avatar image. This prop is also used for the aria-label.
|
|
21
21
|
* @default Avatar
|
|
22
22
|
*/
|
|
23
23
|
altText?: string;
|
|
24
24
|
/**
|
|
25
|
-
* The
|
|
25
|
+
* The URL of the user's photo. For best fit, use square images.
|
|
26
26
|
*/
|
|
27
27
|
url?: string;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
as?: 'div';
|
|
33
|
-
/**
|
|
34
|
-
* The object-fit CSS property sets how the content of a replaced element,
|
|
35
|
-
* such as an `<img>` or `<video>`, should be resized to fit its container.
|
|
36
|
-
* See [object-fit](https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit).
|
|
37
|
-
* If your image is not a square, you can use this property to ensure the image is rendered properly.
|
|
29
|
+
* An objectFit property that can customize how to resize your image to fit its container.
|
|
30
|
+
* @default "contain"
|
|
38
31
|
*/
|
|
39
32
|
objectFit?: Property.ObjectFit;
|
|
40
33
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
34
|
+
export declare const avatarStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
35
|
+
variant: {
|
|
36
|
+
light: {
|
|
37
|
+
backgroundColor: "--cnvs-sys-color-bg-alt-default";
|
|
38
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
39
|
+
[x: string]: "--cnvs-sys-color-fg-default";
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
dark: {
|
|
43
|
+
backgroundColor: "--cnvs-sys-color-bg-primary-default";
|
|
44
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
45
|
+
[x: string]: "--cnvs-sys-color-fg-inverse";
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
size: {
|
|
50
|
+
extraSmall: {
|
|
51
|
+
width: "--cnvs-sys-space-x4";
|
|
52
|
+
height: "--cnvs-sys-space-x4";
|
|
53
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
54
|
+
[x: string]: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
small: {
|
|
58
|
+
width: "--cnvs-sys-space-x6";
|
|
59
|
+
height: "--cnvs-sys-space-x6";
|
|
60
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
61
|
+
[x: string]: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
medium: {
|
|
65
|
+
width: "--cnvs-sys-space-x8";
|
|
66
|
+
height: "--cnvs-sys-space-x8";
|
|
67
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
68
|
+
[x: string]: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
large: {
|
|
72
|
+
width: "--cnvs-sys-space-x10";
|
|
73
|
+
height: "--cnvs-sys-space-x10";
|
|
74
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
75
|
+
[x: string]: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
extraLarge: {
|
|
79
|
+
width: "--cnvs-sys-space-x16";
|
|
80
|
+
height: "--cnvs-sys-space-x16";
|
|
81
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
82
|
+
[x: string]: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
extraExtraLarge: {
|
|
86
|
+
width: string;
|
|
87
|
+
height: string;
|
|
88
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
89
|
+
[x: string]: string;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
objectFit: {
|
|
94
|
+
contain: {
|
|
95
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
96
|
+
objectFit: "contain";
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
fill: {
|
|
100
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
101
|
+
objectFit: "fill";
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
cover: {
|
|
105
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
106
|
+
objectFit: "cover";
|
|
107
|
+
};
|
|
108
|
+
};
|
|
109
|
+
"scale-down": {
|
|
110
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
111
|
+
objectFit: "scale-down";
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
none: {
|
|
115
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
116
|
+
objectFit: "none";
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
"-moz-initial": {
|
|
120
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
121
|
+
objectFit: "-moz-initial";
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
initial: {
|
|
125
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
126
|
+
objectFit: "initial";
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
inherit: {
|
|
130
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
131
|
+
objectFit: "inherit";
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
revert: {
|
|
135
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
136
|
+
objectFit: "revert";
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
unset: {
|
|
140
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
141
|
+
objectFit: "unset";
|
|
142
|
+
};
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
isImageLoaded: {
|
|
146
|
+
true: {
|
|
147
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
148
|
+
opacity: number;
|
|
149
|
+
};
|
|
150
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
151
|
+
opacity: number;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
false: {
|
|
155
|
+
"& [data-slot=\"avatar-icon\"]": {
|
|
156
|
+
opacity: number;
|
|
157
|
+
};
|
|
158
|
+
"& [data-slot=\"avatar-image\"]": {
|
|
159
|
+
opacity: number;
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
}, {
|
|
164
|
+
size: string;
|
|
165
|
+
}, never, never>;
|
|
166
|
+
export declare const Avatar: import("@workday/canvas-kit-react/common").ElementComponent<"button", AvatarProps>;
|
|
62
167
|
//# sourceMappingURL=Avatar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../avatar/lib/Avatar.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../../../avatar/lib/Avatar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AAUjC,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC3B;;;;;;;;;OASG;IACH,IAAI,CAAC,EACL,AADO,oBAAoB,CAC3B,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,GAAG,iBAAiB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAC/F;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,CAAC,EAAE,QAAQ,CAAC,SAAS,CAAC;CAChC;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA+KxB,CAAC;AAEH,eAAO,MAAM,MAAM,oFAqCjB,CAAC"}
|
|
@@ -1,83 +1,74 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { createComponent, focusRing } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStencil, calc } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { mergeStyles } from '@workday/canvas-kit-react/layout';
|
|
5
|
+
import { borderRadius } from '@workday/canvas-kit-react/tokens';
|
|
6
|
+
import { SystemIcon, systemIconStencil } from '@workday/canvas-kit-react/icon';
|
|
6
7
|
import { userIcon } from '@workday/canvas-system-icons-web';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(AvatarVariant || (AvatarVariant = {}));
|
|
12
|
-
const fadeTransition = 'opacity 150ms linear';
|
|
13
|
-
const StyledContainer = styled('button', {
|
|
14
|
-
shouldForwardProp: prop => isPropValid(prop) && prop !== 'size',
|
|
15
|
-
})({
|
|
16
|
-
background: colors.soap200,
|
|
17
|
-
position: 'relative',
|
|
18
|
-
display: 'flex',
|
|
19
|
-
alignItems: 'center',
|
|
20
|
-
justifyContent: 'center',
|
|
21
|
-
padding: 0,
|
|
22
|
-
border: 0,
|
|
23
|
-
boxSizing: 'border-box',
|
|
24
|
-
overflow: 'hidden',
|
|
25
|
-
borderRadius: borderRadius.circle,
|
|
26
|
-
'&:not([disabled])': {
|
|
27
|
-
'&:focus': {
|
|
28
|
-
outline: 'none',
|
|
29
|
-
...focusRing({ separation: 2 }),
|
|
30
|
-
},
|
|
8
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
9
|
+
export const avatarStencil = createStencil({
|
|
10
|
+
vars: {
|
|
11
|
+
size: '',
|
|
31
12
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}, ({ isLoaded, objectFit }) => ({
|
|
62
|
-
opacity: isLoaded ? 1 : 0,
|
|
63
|
-
objectFit,
|
|
64
|
-
}));
|
|
65
|
-
export const Avatar = React.forwardRef(({ variant = AvatarVariant.Light, size = SystemIconCircleSize.m, altText = 'Avatar', url, onClick, objectFit, ...elemProps }, ref) => {
|
|
66
|
-
const [imageLoaded, setImageLoaded] = useState(false);
|
|
67
|
-
const loadImage = () => {
|
|
68
|
-
if (!imageLoaded) {
|
|
69
|
-
setImageLoaded(true);
|
|
13
|
+
base: { name: "b532d4", styles: "box-sizing:border-box;background:var(--cnvs-sys-color-bg-caution-default);position:relative;display:flex;align-items:center;justify-content:center;padding:0;border:0;overflow:hidden;cursor:default;border-radius:var(--cnvs-sys-shape-round);width:var(--size-avatar-f68c19);height:var(--size-avatar-f68c19);&:focus-visible:not([disabled]), &.focus:not([disabled]){outline:none;box-shadow:0 0 0 2px var(--cnvs-base-palette-french-vanilla-100, rgba(255,255,255,1)), 0 0 0 4px var(--cnvs-brand-common-focus-outline, rgba(8,117,225,1));}:is(button){cursor:pointer;}& > [data-slot=\"avatar-icon\"]{transition:opacity 150ms linear;display:flex;align-items:center;justify-content:center;--size-svg-a30d66:calc(var(--size-avatar-f68c19) * 0.625);}& > [data-slot=\"avatar-image\"]{position:absolute;width:100%;height:100%;border-radius:999px;transition:opacity 150ms linear;}" },
|
|
14
|
+
modifiers: {
|
|
15
|
+
variant: {
|
|
16
|
+
light: { name: "93f2f0", styles: "background-color:var(--cnvs-sys-color-bg-alt-default);& [data-slot=\"avatar-icon\"]{--color-system-icon-583fae:var(--cnvs-sys-color-fg-default);}" },
|
|
17
|
+
dark: { name: "094953", styles: "background-color:var(--cnvs-sys-color-bg-primary-default);& [data-slot=\"avatar-icon\"]{--color-system-icon-583fae:var(--cnvs-sys-color-fg-inverse);}" }
|
|
18
|
+
},
|
|
19
|
+
size: {
|
|
20
|
+
extraSmall: { name: "dd6bba", styles: "width:var(--cnvs-sys-space-x4);height:var(--cnvs-sys-space-x4);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x4) * 0.625);}" },
|
|
21
|
+
small: { name: "8bd568", styles: "width:var(--cnvs-sys-space-x6);height:var(--cnvs-sys-space-x6);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x6) * 0.625);}" },
|
|
22
|
+
medium: { name: "73d354", styles: "width:var(--cnvs-sys-space-x8);height:var(--cnvs-sys-space-x8);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x8) * 0.625);}" },
|
|
23
|
+
large: { name: "b1ab3d", styles: "width:var(--cnvs-sys-space-x10);height:var(--cnvs-sys-space-x10);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x10) * 0.625);}" },
|
|
24
|
+
extraLarge: { name: "51b4a9", styles: "width:var(--cnvs-sys-space-x16);height:var(--cnvs-sys-space-x16);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(var(--cnvs-sys-space-x16) * 0.625);}" },
|
|
25
|
+
extraExtraLarge: { name: "271180", styles: "width:calc(var(--cnvs-sys-space-x10) * 3);height:calc(var(--cnvs-sys-space-x10) * 3);& [data-slot=\"avatar-icon\"]{--size-svg-a30d66:calc(calc(var(--cnvs-sys-space-x10) * 3) * 0.625);}" }
|
|
26
|
+
},
|
|
27
|
+
objectFit: {
|
|
28
|
+
contain: { name: "ec34b8", styles: "& [data-slot=\"avatar-image\"]{object-fit:contain;}" },
|
|
29
|
+
fill: { name: "f2ce94", styles: "& [data-slot=\"avatar-image\"]{object-fit:fill;}" },
|
|
30
|
+
cover: { name: "f01d16", styles: "& [data-slot=\"avatar-image\"]{object-fit:cover;}" },
|
|
31
|
+
['scale-down']: { name: "b72ff8", styles: "& [data-slot=\"avatar-image\"]{object-fit:scale-down;}" },
|
|
32
|
+
none: { name: "6349a5", styles: "& [data-slot=\"avatar-image\"]{object-fit:none;}" },
|
|
33
|
+
['-moz-initial']: { name: "8d0a0d", styles: "& [data-slot=\"avatar-image\"]{object-fit:-moz-initial;}" },
|
|
34
|
+
['initial']: { name: "23e1a7", styles: "& [data-slot=\"avatar-image\"]{object-fit:initial;}" },
|
|
35
|
+
['inherit']: { name: "1be8d9", styles: "& [data-slot=\"avatar-image\"]{object-fit:inherit;}" },
|
|
36
|
+
['revert']: { name: "1f00e3", styles: "& [data-slot=\"avatar-image\"]{object-fit:revert;}" },
|
|
37
|
+
['unset']: { name: "6f1eb7", styles: "& [data-slot=\"avatar-image\"]{object-fit:unset;}" }
|
|
38
|
+
},
|
|
39
|
+
isImageLoaded: {
|
|
40
|
+
true: { name: "6ab642", styles: "& [data-slot=\"avatar-icon\"]{opacity:0;}& [data-slot=\"avatar-image\"]{opacity:1;}" },
|
|
41
|
+
false: { name: "53c2af", styles: "& [data-slot=\"avatar-icon\"]{opacity:1;}& [data-slot=\"avatar-image\"]{opacity:0;}" }
|
|
70
42
|
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
43
|
+
},
|
|
44
|
+
defaultModifiers: {
|
|
45
|
+
variant: 'light',
|
|
46
|
+
size: 'medium',
|
|
47
|
+
isImageLoaded: 'false',
|
|
48
|
+
objectFit: 'contain',
|
|
49
|
+
}
|
|
50
|
+
}, "avatar-f68c19");
|
|
51
|
+
export const Avatar = createComponent('button')({
|
|
52
|
+
displayName: 'Avatar',
|
|
53
|
+
Component: ({ variant, size, altText = 'Avatar', url, objectFit, ...elemProps }, ref, Element) => {
|
|
54
|
+
const [imageLoaded, setImageLoaded] = useState(false);
|
|
55
|
+
const loadImage = () => {
|
|
56
|
+
if (!imageLoaded) {
|
|
57
|
+
setImageLoaded(true);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
React.useLayoutEffect(() => {
|
|
61
|
+
setImageLoaded(false);
|
|
62
|
+
}, [url]);
|
|
63
|
+
return (React.createElement(Element, Object.assign({ ref: ref, "aria-label": altText }, mergeStyles(elemProps, [
|
|
64
|
+
avatarStencil({
|
|
65
|
+
variant,
|
|
66
|
+
size,
|
|
67
|
+
objectFit,
|
|
68
|
+
isImageLoaded: imageLoaded,
|
|
69
|
+
}),
|
|
70
|
+
])),
|
|
71
|
+
React.createElement(SystemIcon, { icon: userIcon, "data-slot": "avatar-icon" }),
|
|
72
|
+
url && React.createElement("img", { "data-slot": "avatar-image", src: url, alt: altText, onLoad: loadImage })));
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -1,46 +1,79 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export interface TextAreaProps extends
|
|
4
|
-
/**
|
|
5
|
-
* If true, set the TextArea to the disabled state.
|
|
6
|
-
* @default false
|
|
7
|
-
*/
|
|
8
|
-
disabled?: boolean;
|
|
1
|
+
import { GrowthBehavior, ErrorType } from '@workday/canvas-kit-react/common';
|
|
2
|
+
export declare type ValueOf<T> = T[keyof T];
|
|
3
|
+
export interface TextAreaProps extends GrowthBehavior {
|
|
9
4
|
/**
|
|
10
5
|
* The type of error associated with the TextArea (if applicable).
|
|
11
6
|
*/
|
|
12
7
|
error?: ErrorType;
|
|
13
|
-
/**
|
|
14
|
-
* The function called when the TextArea state changes.
|
|
15
|
-
*/
|
|
16
|
-
onChange?: (e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
17
|
-
/**
|
|
18
|
-
* The placeholder text of the TextArea.
|
|
19
|
-
*/
|
|
20
|
-
placeholder?: string;
|
|
21
|
-
/**
|
|
22
|
-
* If true, set the TextArea to read-only. The user will be unable to interact with the TextArea.
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
readOnly?: boolean;
|
|
26
8
|
/**
|
|
27
9
|
* The resize constraints of the TextArea.
|
|
28
10
|
* @default TextArea.ResizeDirection.Both
|
|
29
11
|
*/
|
|
30
|
-
resize?: TextAreaResizeDirection
|
|
31
|
-
/**
|
|
32
|
-
* The value of the TextArea.
|
|
33
|
-
*/
|
|
34
|
-
value?: any;
|
|
35
|
-
}
|
|
36
|
-
export declare enum TextAreaResizeDirection {
|
|
37
|
-
None = "none",
|
|
38
|
-
Both = "both",
|
|
39
|
-
Horizontal = "horizontal",
|
|
40
|
-
Vertical = "vertical"
|
|
12
|
+
resize?: ValueOf<typeof TextAreaResizeDirection>;
|
|
41
13
|
}
|
|
14
|
+
export declare const TextAreaResizeDirection: {
|
|
15
|
+
readonly None: "none";
|
|
16
|
+
readonly Both: "both";
|
|
17
|
+
readonly Horizontal: "horizontal";
|
|
18
|
+
readonly Vertical: "vertical";
|
|
19
|
+
};
|
|
20
|
+
export declare const textAreaStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
21
|
+
resize: {
|
|
22
|
+
both: {
|
|
23
|
+
resize: "both";
|
|
24
|
+
};
|
|
25
|
+
horizontal: {
|
|
26
|
+
resize: "horizontal";
|
|
27
|
+
};
|
|
28
|
+
vertical: {
|
|
29
|
+
resize: "vertical";
|
|
30
|
+
};
|
|
31
|
+
none: {
|
|
32
|
+
resize: "none";
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
}, {}, import("@workday/canvas-kit-styling").Stencil<{
|
|
36
|
+
grow: {
|
|
37
|
+
true: {
|
|
38
|
+
width: string;
|
|
39
|
+
resize: "vertical";
|
|
40
|
+
};
|
|
41
|
+
false: {
|
|
42
|
+
width: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
error: {
|
|
46
|
+
error: {
|
|
47
|
+
borderColor: "--cnvs-brand-error-base";
|
|
48
|
+
boxShadow: string;
|
|
49
|
+
'&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
50
|
+
borderColor: "--cnvs-brand-error-base";
|
|
51
|
+
};
|
|
52
|
+
'&:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
53
|
+
boxShadow: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
alert: {
|
|
57
|
+
borderColor: "--cnvs-brand-alert-darkest";
|
|
58
|
+
boxShadow: string;
|
|
59
|
+
'&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
60
|
+
borderColor: "--cnvs-brand-alert-darkest";
|
|
61
|
+
};
|
|
62
|
+
'&:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
63
|
+
boxShadow: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
width: string;
|
|
69
|
+
}, never, never>, never>;
|
|
42
70
|
export declare const TextArea: import("@workday/canvas-kit-react/common").ElementComponent<"textarea", TextAreaProps> & {
|
|
43
71
|
ErrorType: typeof ErrorType;
|
|
44
|
-
ResizeDirection:
|
|
72
|
+
ResizeDirection: {
|
|
73
|
+
readonly None: "none";
|
|
74
|
+
readonly Both: "both";
|
|
75
|
+
readonly Horizontal: "horizontal";
|
|
76
|
+
readonly Vertical: "vertical";
|
|
77
|
+
};
|
|
45
78
|
};
|
|
46
79
|
//# sourceMappingURL=TextArea.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TextArea.d.ts","sourceRoot":"","sources":["../../../../text-area/lib/TextArea.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5F,oBAAY,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpC,MAAM,WAAW,aAAc,SAAQ,cAAc;IACnD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,uBAAuB,CAAC,CAAC;CAClD;AAED,eAAO,MAAM,uBAAuB;;;;;CAK1B,CAAC;AAEX,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA6B1B,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;CAWnB,CAAC"}
|
|
@@ -1,55 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { createComponent, ErrorType
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
display:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
margin: 0,
|
|
23
|
-
'&::webkit-resizer': {
|
|
24
|
-
display: 'none',
|
|
2
|
+
import { createComponent, ErrorType } from '@workday/canvas-kit-react/common';
|
|
3
|
+
import { createStencil, calc, handleCsProp } from '@workday/canvas-kit-styling';
|
|
4
|
+
import { system } from '@workday/canvas-tokens-web';
|
|
5
|
+
import { textInputStencil } from '@workday/canvas-kit-react/text-input';
|
|
6
|
+
export const TextAreaResizeDirection = {
|
|
7
|
+
None: 'none',
|
|
8
|
+
Both: 'both',
|
|
9
|
+
Horizontal: 'horizontal',
|
|
10
|
+
Vertical: 'vertical',
|
|
11
|
+
};
|
|
12
|
+
export const textAreaStencil = createStencil({
|
|
13
|
+
extends: textInputStencil,
|
|
14
|
+
base: { name: "22b420", styles: "box-sizing:border-box;min-height:var(--cnvs-sys-space-x16);min-width:calc(calc(var(--cnvs-sys-space-x20) * 3) + var(--cnvs-sys-space-x10));&::webkit-resizer{display:none;}" },
|
|
15
|
+
modifiers: {
|
|
16
|
+
resize: {
|
|
17
|
+
both: { name: "7c01d6", styles: "resize:both;" },
|
|
18
|
+
horizontal: { name: "5904a0", styles: "resize:horizontal;" },
|
|
19
|
+
vertical: { name: "d5a9dd", styles: "resize:vertical;" },
|
|
20
|
+
none: { name: "1997d7", styles: "resize:none;" }
|
|
21
|
+
}
|
|
25
22
|
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
borderColor: inputColors.hoverBorder,
|
|
31
|
-
},
|
|
32
|
-
'&:focus:not([disabled])': {
|
|
33
|
-
borderColor: theme.canvas.palette.common.focusOutline,
|
|
34
|
-
boxShadow: `inset 0 0 0 1px ${theme.canvas.palette.common.focusOutline}`,
|
|
35
|
-
outline: 'none',
|
|
36
|
-
},
|
|
37
|
-
'&:disabled': {
|
|
38
|
-
backgroundColor: inputColors.disabled.background,
|
|
39
|
-
borderColor: inputColors.disabled.border,
|
|
40
|
-
color: inputColors.disabled.text,
|
|
41
|
-
'&::placeholder': {
|
|
42
|
-
color: inputColors.disabled.text,
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
...errorRing(error, theme),
|
|
46
|
-
}), ({ resize, grow }) => ({
|
|
47
|
-
width: grow ? '100%' : undefined,
|
|
48
|
-
resize: grow ? TextAreaResizeDirection.Vertical : resize,
|
|
49
|
-
}));
|
|
23
|
+
defaultModifiers: {
|
|
24
|
+
resize: 'both',
|
|
25
|
+
}
|
|
26
|
+
}, "text-area-3e725a");
|
|
50
27
|
export const TextArea = createComponent('textarea')({
|
|
51
28
|
displayName: 'TextArea',
|
|
52
|
-
Component: ({ resize = TextAreaResizeDirection.Both, grow, ...elemProps }, ref, Element) => React.createElement(
|
|
29
|
+
Component: ({ resize = TextAreaResizeDirection.Both, grow, error, ...elemProps }, ref, Element) => React.createElement(Element, Object.assign({ ref: ref }, handleCsProp(elemProps, textAreaStencil({ error, grow, resize })))),
|
|
53
30
|
subComponents: {
|
|
54
31
|
ErrorType,
|
|
55
32
|
ResizeDirection: TextAreaResizeDirection,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { GrowthBehavior, ErrorType
|
|
2
|
-
export interface TextInputProps extends
|
|
1
|
+
import { GrowthBehavior, ErrorType } from '@workday/canvas-kit-react/common';
|
|
2
|
+
export interface TextInputProps extends GrowthBehavior {
|
|
3
3
|
/**
|
|
4
4
|
* The type of error associated with the TextInput (if applicable).
|
|
5
5
|
*/
|
|
@@ -9,6 +9,41 @@ export interface TextInputProps extends Themeable, GrowthBehavior {
|
|
|
9
9
|
*/
|
|
10
10
|
width?: number | string;
|
|
11
11
|
}
|
|
12
|
+
export declare const textInputStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
13
|
+
grow: {
|
|
14
|
+
true: {
|
|
15
|
+
width: string;
|
|
16
|
+
resize: "vertical";
|
|
17
|
+
};
|
|
18
|
+
false: {
|
|
19
|
+
width: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
error: {
|
|
23
|
+
error: {
|
|
24
|
+
borderColor: "--cnvs-brand-error-base";
|
|
25
|
+
boxShadow: string;
|
|
26
|
+
'&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
27
|
+
borderColor: "--cnvs-brand-error-base";
|
|
28
|
+
};
|
|
29
|
+
'&:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
30
|
+
boxShadow: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
alert: {
|
|
34
|
+
borderColor: "--cnvs-brand-alert-darkest";
|
|
35
|
+
boxShadow: string;
|
|
36
|
+
'&:hover, &.hover, &:disabled, &.disabled, &:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
37
|
+
borderColor: "--cnvs-brand-alert-darkest";
|
|
38
|
+
};
|
|
39
|
+
'&:focus-visible:not([disabled]), &.focus:not([disabled])': {
|
|
40
|
+
boxShadow: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
}, {
|
|
45
|
+
width: string;
|
|
46
|
+
}, never, never>;
|
|
12
47
|
export declare const TextInput: import("@workday/canvas-kit-react/common").ElementComponent<"input", TextInputProps> & {
|
|
13
48
|
ErrorType: typeof ErrorType;
|
|
14
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../../../text-input/lib/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,cAAc,EAAE,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAI5F,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAqF3B,CAAC;AAEH,eAAO,MAAM,SAAS;;CAepB,CAAC"}
|