@workday/canvas-kit-react 16.0.0-alpha.0485-next.0 → 16.0.0-alpha.0486-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/badge/lib/CountBadge.tsx +5 -8
- package/banner/lib/Banner.tsx +23 -16
- package/banner/lib/hooks/useBannerIcon.tsx +1 -1
- package/dist/commonjs/badge/lib/CountBadge.d.ts.map +1 -1
- package/dist/commonjs/badge/lib/CountBadge.js +5 -5
- package/dist/commonjs/banner/lib/Banner.d.ts +5 -1
- package/dist/commonjs/banner/lib/Banner.d.ts.map +1 -1
- package/dist/commonjs/banner/lib/Banner.js +11 -7
- package/dist/commonjs/banner/lib/hooks/useBannerIcon.d.ts +1 -1
- package/dist/commonjs/banner/lib/hooks/useBannerIcon.js +1 -1
- package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts +83 -13
- package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/InformationHighlight.js +28 -10
- package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +26 -5
- package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.js +11 -1
- package/dist/commonjs/information-highlight/lib/parts/Body.d.ts +8 -1
- package/dist/commonjs/information-highlight/lib/parts/Body.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Body.js +16 -6
- package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts +8 -1
- package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Heading.js +16 -6
- package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts +2 -1
- package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Icon.js +3 -2
- package/dist/commonjs/information-highlight/lib/parts/Link.d.ts +8 -1
- package/dist/commonjs/information-highlight/lib/parts/Link.d.ts.map +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Link.js +16 -6
- package/dist/commonjs/pill/lib/Pill.d.ts +1 -11
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +2 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts +10 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -1
- package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.js +3 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts +16 -2
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -1
- package/dist/commonjs/skeleton/lib/parts/SkeletonShape.js +11 -3
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.d.ts +12 -3
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.d.ts.map +1 -1
- package/dist/commonjs/skeleton/lib/parts/SkeletonText.js +10 -5
- package/dist/es6/badge/lib/CountBadge.d.ts.map +1 -1
- package/dist/es6/badge/lib/CountBadge.js +5 -5
- package/dist/es6/banner/lib/Banner.d.ts +5 -1
- package/dist/es6/banner/lib/Banner.d.ts.map +1 -1
- package/dist/es6/banner/lib/Banner.js +12 -8
- package/dist/es6/banner/lib/hooks/useBannerIcon.d.ts +1 -1
- package/dist/es6/banner/lib/hooks/useBannerIcon.js +1 -1
- package/dist/es6/information-highlight/lib/InformationHighlight.d.ts +83 -13
- package/dist/es6/information-highlight/lib/InformationHighlight.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/InformationHighlight.js +30 -12
- package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +26 -5
- package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.js +11 -1
- package/dist/es6/information-highlight/lib/parts/Body.d.ts +8 -1
- package/dist/es6/information-highlight/lib/parts/Body.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/parts/Body.js +17 -7
- package/dist/es6/information-highlight/lib/parts/Heading.d.ts +8 -1
- package/dist/es6/information-highlight/lib/parts/Heading.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/parts/Heading.js +17 -7
- package/dist/es6/information-highlight/lib/parts/Icon.d.ts +2 -1
- package/dist/es6/information-highlight/lib/parts/Icon.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/parts/Icon.js +4 -3
- package/dist/es6/information-highlight/lib/parts/Link.d.ts +8 -1
- package/dist/es6/information-highlight/lib/parts/Link.d.ts.map +1 -1
- package/dist/es6/information-highlight/lib/parts/Link.js +17 -7
- package/dist/es6/pill/lib/Pill.d.ts +1 -11
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
- package/dist/es6/pill/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +3 -3
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts +10 -2
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -1
- package/dist/es6/skeleton/lib/parts/SkeletonHeader.js +4 -3
- package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts +16 -2
- package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -1
- package/dist/es6/skeleton/lib/parts/SkeletonShape.js +10 -2
- package/dist/es6/skeleton/lib/parts/SkeletonText.d.ts +12 -3
- package/dist/es6/skeleton/lib/parts/SkeletonText.d.ts.map +1 -1
- package/dist/es6/skeleton/lib/parts/SkeletonText.js +10 -5
- package/information-highlight/lib/InformationHighlight.tsx +67 -14
- package/information-highlight/lib/hooks/useInformationHighlightModel.ts +11 -1
- package/information-highlight/lib/parts/Body.tsx +32 -19
- package/information-highlight/lib/parts/Heading.tsx +32 -19
- package/information-highlight/lib/parts/Icon.tsx +4 -1
- package/information-highlight/lib/parts/Link.tsx +33 -18
- package/package.json +4 -4
- package/pill/lib/Pill.tsx +21 -23
- package/pill/lib/PillIcon.tsx +1 -1
- package/pill/lib/PillIconButton.tsx +21 -15
- package/skeleton/lib/parts/SkeletonHeader.tsx +5 -5
- package/skeleton/lib/parts/SkeletonShape.tsx +20 -3
- package/skeleton/lib/parts/SkeletonText.tsx +24 -14
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-react",
|
|
3
|
-
"version": "16.0.0-alpha.
|
|
3
|
+
"version": "16.0.0-alpha.0486-next.0",
|
|
4
4
|
"description": "The parent module that contains all Workday Canvas Kit React components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@tanstack/react-virtual": "^3.13.9",
|
|
54
54
|
"@workday/canvas-colors-web": "^2.0.0",
|
|
55
55
|
"@workday/canvas-expressive-icons-web": "1.0.2",
|
|
56
|
-
"@workday/canvas-kit-popup-stack": "^16.0.0-alpha.
|
|
57
|
-
"@workday/canvas-kit-styling": "^16.0.0-alpha.
|
|
56
|
+
"@workday/canvas-kit-popup-stack": "^16.0.0-alpha.0486-next.0",
|
|
57
|
+
"@workday/canvas-kit-styling": "^16.0.0-alpha.0486-next.0",
|
|
58
58
|
"@workday/canvas-system-icons-web": "5.0.1",
|
|
59
59
|
"@workday/canvas-tokens-web": "4.4.0-beta.7",
|
|
60
60
|
"@workday/design-assets-types": "^0.3.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
70
70
|
"@workday/canvas-applet-icons-web": "^2.0.0"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "8be87645060c8ea1b56dc5bebceecc64fa33bfc2"
|
|
73
73
|
}
|
package/pill/lib/Pill.tsx
CHANGED
|
@@ -35,13 +35,9 @@ export const pillStencil = createStencil({
|
|
|
35
35
|
flexDirection: 'row',
|
|
36
36
|
alignItems: 'center',
|
|
37
37
|
borderRadius: system.legacy.shape.sm,
|
|
38
|
-
|
|
39
|
-
fontSize: system.legacy.fontSize.subtext.lg,
|
|
40
|
-
letterSpacing: system.legacy.letterSpacing.subtext.lg,
|
|
41
|
-
lineHeight: system.legacy.lineHeight.subtext.sm, // ensure correct line height when there's no elements and just text
|
|
38
|
+
...system.legacy.type.subtext.md,
|
|
42
39
|
boxShadow: 'none',
|
|
43
40
|
outline: 'none',
|
|
44
|
-
fontWeight: system.fontWeight.medium,
|
|
45
41
|
WebkitFontSmoothing: 'antialiased',
|
|
46
42
|
MozOsxFontSmoothing: 'grayscale',
|
|
47
43
|
width: 'fit-content',
|
|
@@ -53,7 +49,7 @@ export const pillStencil = createStencil({
|
|
|
53
49
|
whiteSpace: 'nowrap',
|
|
54
50
|
textOverflow: 'ellipsis',
|
|
55
51
|
overflow: 'hidden',
|
|
56
|
-
[buttonStencil.vars.background]: system.legacy.color.surface.alt.
|
|
52
|
+
[buttonStencil.vars.background]: system.legacy.color.surface.alt.default,
|
|
57
53
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
58
54
|
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
59
55
|
[systemIconStencil.vars.color]: 'currentColor',
|
|
@@ -61,14 +57,14 @@ export const pillStencil = createStencil({
|
|
|
61
57
|
|
|
62
58
|
'&:has(span)': {
|
|
63
59
|
display: 'flex',
|
|
64
|
-
lineHeight: system.legacy.lineHeight.subtext.
|
|
60
|
+
lineHeight: system.legacy.lineHeight.subtext.md, // ensure correct line height
|
|
65
61
|
},
|
|
66
62
|
'&:hover, &.hover': {
|
|
67
63
|
[buttonStencil.vars.background]: colorSpace.darken({
|
|
68
|
-
color: system.legacy.color.surface.alt.
|
|
69
|
-
fallback: system.color.
|
|
64
|
+
color: system.legacy.color.surface.alt.default,
|
|
65
|
+
fallback: system.legacy.color.surface.alt.default,
|
|
70
66
|
mixinColor: system.legacy.color.surface.overlay.mixin,
|
|
71
|
-
mixinValue:
|
|
67
|
+
mixinValue: '0.0392',
|
|
72
68
|
}),
|
|
73
69
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
74
70
|
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
@@ -77,12 +73,12 @@ export const pillStencil = createStencil({
|
|
|
77
73
|
},
|
|
78
74
|
'&:active, &.active': {
|
|
79
75
|
[buttonStencil.vars.background]: colorSpace.darken({
|
|
80
|
-
color: system.legacy.color.surface.alt.
|
|
81
|
-
fallback: system.color.
|
|
76
|
+
color: system.legacy.color.surface.alt.default,
|
|
77
|
+
fallback: system.legacy.color.surface.alt.default,
|
|
82
78
|
mixinColor: system.legacy.color.surface.overlay.mixin,
|
|
83
|
-
mixinValue:
|
|
79
|
+
mixinValue: '0.0745',
|
|
84
80
|
}),
|
|
85
|
-
[buttonStencil.vars.label]: system.color.fg.
|
|
81
|
+
[buttonStencil.vars.label]: system.color.fg.stronger,
|
|
86
82
|
[systemIconStencil.vars.color]: 'currentColor',
|
|
87
83
|
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
88
84
|
},
|
|
@@ -100,10 +96,11 @@ export const pillStencil = createStencil({
|
|
|
100
96
|
}),
|
|
101
97
|
},
|
|
102
98
|
'&:disabled, &.disabled': {
|
|
103
|
-
[buttonStencil.vars.
|
|
104
|
-
[buttonStencil.vars.
|
|
99
|
+
[buttonStencil.vars.opacity]: system.opacity.disabled,
|
|
100
|
+
[buttonStencil.vars.background]: system.legacy.color.surface.alt.default,
|
|
101
|
+
[buttonStencil.vars.label]: system.color.fg.strong,
|
|
105
102
|
[systemIconStencil.vars.color]: 'currentColor',
|
|
106
|
-
[pillCountStencil.vars.backgroundColor]: system.legacy.color.surface.alt.
|
|
103
|
+
[pillCountStencil.vars.backgroundColor]: system.legacy.color.surface.alt.default,
|
|
107
104
|
[pillCountStencil.vars.borderColor]: 'transparent',
|
|
108
105
|
},
|
|
109
106
|
}),
|
|
@@ -113,6 +110,7 @@ export const pillStencil = createStencil({
|
|
|
113
110
|
border: `${px2rem(1)} solid ${system.legacy.color.border.default}`,
|
|
114
111
|
cursor: 'default',
|
|
115
112
|
[buttonStencil.vars.background]: system.color.bg.default,
|
|
113
|
+
[buttonStencil.vars.label]: system.color.fg.default,
|
|
116
114
|
'&:hover, &.hover': {
|
|
117
115
|
borderColor: system.legacy.color.border.default,
|
|
118
116
|
[buttonStencil.vars.background]: system.color.bg.default,
|
|
@@ -136,19 +134,19 @@ export const pillStencil = createStencil({
|
|
|
136
134
|
},
|
|
137
135
|
'&:hover, &.hover': {
|
|
138
136
|
[buttonStencil.vars.background]: colorSpace.darken({
|
|
139
|
-
color: system.legacy.color.surface.alt.
|
|
140
|
-
fallback: system.color.
|
|
137
|
+
color: system.legacy.color.surface.alt.default,
|
|
138
|
+
fallback: system.legacy.color.surface.alt.default,
|
|
141
139
|
mixinColor: system.legacy.color.surface.overlay.mixin,
|
|
142
|
-
mixinValue:
|
|
140
|
+
mixinValue: '0.0392',
|
|
143
141
|
}),
|
|
144
142
|
[pillCountStencil.vars.backgroundColor]: system.legacy.color.surface.transparent,
|
|
145
143
|
},
|
|
146
144
|
'&:active, &.active': {
|
|
147
145
|
[buttonStencil.vars.background]: colorSpace.darken({
|
|
148
|
-
color: system.legacy.color.surface.alt.
|
|
149
|
-
fallback: system.color.
|
|
146
|
+
color: system.legacy.color.surface.alt.default,
|
|
147
|
+
fallback: system.legacy.color.surface.alt.default,
|
|
150
148
|
mixinColor: system.legacy.color.surface.overlay.mixin,
|
|
151
|
-
mixinValue:
|
|
149
|
+
mixinValue: '0.0745',
|
|
152
150
|
}),
|
|
153
151
|
[pillCountStencil.vars.backgroundColor]: system.legacy.color.surface.transparent,
|
|
154
152
|
},
|
package/pill/lib/PillIcon.tsx
CHANGED
|
@@ -13,7 +13,7 @@ export const pillIconStencil = createStencil({
|
|
|
13
13
|
extends: systemIconStencil,
|
|
14
14
|
base: {
|
|
15
15
|
marginInlineStart: calc.negate(system.legacy.gap.xs),
|
|
16
|
-
[systemIconStencil.vars.size]: component.legacy.systemIcon.size.
|
|
16
|
+
[systemIconStencil.vars.size]: component.legacy.systemIcon.size.xs,
|
|
17
17
|
flex: '0 0 auto',
|
|
18
18
|
},
|
|
19
19
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {buttonStencil} from '@workday/canvas-kit-react/button';
|
|
2
|
-
import {createSubcomponent
|
|
2
|
+
import {createSubcomponent} from '@workday/canvas-kit-react/common';
|
|
3
3
|
import {SystemIcon, SystemIconProps, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
4
4
|
import {mergeStyles} from '@workday/canvas-kit-react/layout';
|
|
5
5
|
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
@@ -19,34 +19,40 @@ export const pillIconButtonStencil = createStencil({
|
|
|
19
19
|
extends: buttonStencil,
|
|
20
20
|
base: {
|
|
21
21
|
marginInlineEnd: calc.negate(px2rem(7)), // visually pull in the pill to the right size by -7px
|
|
22
|
-
marginInlineStart:
|
|
23
|
-
borderRadius:
|
|
24
|
-
height: system.legacy.size.
|
|
25
|
-
width: system.legacy.size.
|
|
22
|
+
marginInlineStart: 0, // leave room for the 24x24 focus ring
|
|
23
|
+
[buttonStencil.vars.borderRadius]: system.legacy.shape.sm,
|
|
24
|
+
height: system.legacy.size.xxxs,
|
|
25
|
+
width: system.legacy.size.xxxs,
|
|
26
26
|
padding: 0,
|
|
27
27
|
overflow: 'visible',
|
|
28
28
|
flex: '0 0 auto',
|
|
29
29
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
30
30
|
[buttonStencil.vars.background]: system.legacy.color.surface.transparent,
|
|
31
31
|
|
|
32
|
-
[systemIconStencil.vars.color]: system.color.fg.
|
|
33
|
-
[systemIconStencil.vars.size]: component.legacy.systemIcon.size.
|
|
32
|
+
[systemIconStencil.vars.color]: system.color.fg.default,
|
|
33
|
+
[systemIconStencil.vars.size]: component.legacy.systemIcon.size.xs,
|
|
34
34
|
'::after': {
|
|
35
35
|
content: '""',
|
|
36
|
-
|
|
37
|
-
width: system.legacy.size.sm,
|
|
36
|
+
boxSizing: 'border-box',
|
|
38
37
|
position: 'absolute',
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
top: calc.negate(px2rem(5)),
|
|
39
|
+
right: calc.negate(px2rem(5)),
|
|
40
|
+
bottom: calc.negate(px2rem(5)),
|
|
41
|
+
left: calc.negate(px2rem(5)),
|
|
41
42
|
margin: 0,
|
|
42
43
|
pointerEvents: 'all',
|
|
44
|
+
borderRadius: system.legacy.shape.sm,
|
|
45
|
+
borderStyle: 'solid',
|
|
46
|
+
borderWidth: px2rem(2),
|
|
47
|
+
borderColor: 'transparent',
|
|
43
48
|
},
|
|
44
49
|
|
|
45
50
|
'&:focus-visible, &.focus': {
|
|
46
51
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
boxShadow: 'none',
|
|
53
|
+
'::after': {
|
|
54
|
+
borderColor: system.legacy.color.brand.border.primary,
|
|
55
|
+
},
|
|
50
56
|
},
|
|
51
57
|
'&:hover, &.hover': {
|
|
52
58
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
@@ -56,7 +62,7 @@ export const pillIconButtonStencil = createStencil({
|
|
|
56
62
|
},
|
|
57
63
|
'&:disabled, &.disabled': {
|
|
58
64
|
[buttonStencil.vars.border]: system.color.border.transparent,
|
|
59
|
-
[systemIconStencil.vars.color]: system.color.fg.
|
|
65
|
+
[systemIconStencil.vars.color]: system.color.fg.strong,
|
|
60
66
|
},
|
|
61
67
|
},
|
|
62
68
|
});
|
|
@@ -2,12 +2,12 @@ import {createComponent} from '@workday/canvas-kit-react/common';
|
|
|
2
2
|
import {CSProps, createStencil, cssVar, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
3
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
4
4
|
|
|
5
|
-
import {SkeletonShape} from './SkeletonShape';
|
|
5
|
+
import {SkeletonShape, skeletonSurfaceFillStencil} from './SkeletonShape';
|
|
6
6
|
|
|
7
7
|
export interface SkeletonHeaderProps extends CSProps {
|
|
8
8
|
/**
|
|
9
9
|
* The background color of the skeleton
|
|
10
|
-
* @default `
|
|
10
|
+
* @default Surface shimmer gradient (`surface.alt.strong` → `surface.loading`); override with a solid color
|
|
11
11
|
*/
|
|
12
12
|
backgroundColor?: string;
|
|
13
13
|
/**
|
|
@@ -23,14 +23,14 @@ export interface SkeletonHeaderProps extends CSProps {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
export const skeletonHeaderStencil = createStencil({
|
|
26
|
+
extends: skeletonSurfaceFillStencil,
|
|
26
27
|
vars: {
|
|
27
28
|
width: '',
|
|
28
29
|
height: '',
|
|
29
30
|
backgroundColor: '',
|
|
30
31
|
},
|
|
31
|
-
base: ({width,
|
|
32
|
-
|
|
33
|
-
borderRadius: system.legacy.shape.md,
|
|
32
|
+
base: ({width, height}) => ({
|
|
33
|
+
borderRadius: system.legacy.shape.sm,
|
|
34
34
|
height: cssVar(height, system.legacy.size.xs),
|
|
35
35
|
width: width,
|
|
36
36
|
marginBlockEnd: system.legacy.size.xxxs,
|
|
@@ -2,6 +2,23 @@ import {createComponent} from '@workday/canvas-kit-react/common';
|
|
|
2
2
|
import {CSProps, createStencil, cssVar, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
3
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
4
4
|
|
|
5
|
+
/** Default Surface/Shimmer fill for skeleton placeholders (Shape, Header, Text lines). */
|
|
6
|
+
export const skeletonSurfaceFillStencil = createStencil({
|
|
7
|
+
vars: {
|
|
8
|
+
backgroundColor: '',
|
|
9
|
+
},
|
|
10
|
+
base: ({backgroundColor}) => ({
|
|
11
|
+
background: cssVar(
|
|
12
|
+
backgroundColor,
|
|
13
|
+
`linear-gradient(to left, ${system.legacy.color.surface.alt.strong}, ${system.legacy.color.surface.loading})`
|
|
14
|
+
),
|
|
15
|
+
border: `${px2rem(1)} solid transparent`,
|
|
16
|
+
'@media (forced-colors: active)': {
|
|
17
|
+
borderColor: 'CanvasText',
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
|
|
5
22
|
export interface SkeletonShapeProps extends CSProps {
|
|
6
23
|
/**
|
|
7
24
|
* The width of the shape in `px` or `%`.
|
|
@@ -20,20 +37,20 @@ export interface SkeletonShapeProps extends CSProps {
|
|
|
20
37
|
borderRadius?: number | string;
|
|
21
38
|
/**
|
|
22
39
|
* The background color of the skeleton
|
|
23
|
-
* @default `
|
|
40
|
+
* @default Surface shimmer gradient (`surface.alt.strong` → `surface.loading`); override with a solid color
|
|
24
41
|
*/
|
|
25
42
|
backgroundColor?: string;
|
|
26
43
|
}
|
|
27
44
|
|
|
28
45
|
export const skeletonShapeStencil = createStencil({
|
|
46
|
+
extends: skeletonSurfaceFillStencil,
|
|
29
47
|
vars: {
|
|
30
48
|
width: '',
|
|
31
49
|
height: '',
|
|
32
50
|
borderRadius: '',
|
|
33
51
|
backgroundColor: '',
|
|
34
52
|
},
|
|
35
|
-
base: ({width, height, borderRadius
|
|
36
|
-
backgroundColor: cssVar(backgroundColor, system.legacy.color.surface.loading),
|
|
53
|
+
base: ({width, height, borderRadius}) => ({
|
|
37
54
|
borderRadius: cssVar(borderRadius, '0'),
|
|
38
55
|
height: cssVar(height, '100%'),
|
|
39
56
|
width: width,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
2
|
-
import {CSProps, createStencil,
|
|
2
|
+
import {CSProps, createStencil, handleCsProp} from '@workday/canvas-kit-styling';
|
|
3
3
|
import {system} from '@workday/canvas-tokens-web';
|
|
4
4
|
|
|
5
|
+
import {skeletonSurfaceFillStencil} from './SkeletonShape';
|
|
6
|
+
|
|
5
7
|
export interface SkeletonTextProps extends CSProps {
|
|
6
8
|
/**
|
|
7
9
|
* The number of "lines" that SkeletonText will display. If there is more than one line, the last line will have a width of `60%`.
|
|
@@ -10,25 +12,29 @@ export interface SkeletonTextProps extends CSProps {
|
|
|
10
12
|
lineCount?: number;
|
|
11
13
|
/**
|
|
12
14
|
* The background color of the skeleton
|
|
13
|
-
* @default `
|
|
15
|
+
* @default Surface shimmer gradient (`surface.alt.strong` → `surface.loading`); override with a solid color
|
|
14
16
|
*/
|
|
15
17
|
backgroundColor?: string;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
|
-
export const
|
|
20
|
+
export const skeletonTextLineStencil = createStencil({
|
|
21
|
+
extends: skeletonSurfaceFillStencil,
|
|
19
22
|
vars: {
|
|
20
23
|
backgroundColor: '',
|
|
21
24
|
},
|
|
22
|
-
base: (
|
|
25
|
+
base: () => ({
|
|
26
|
+
height: system.legacy.size.xxxs,
|
|
27
|
+
// We do not have a `gap` token for 0.75rem so `padding` is being used here
|
|
28
|
+
marginBlockEnd: system.legacy.padding.sm,
|
|
29
|
+
borderRadius: system.legacy.shape.xxxl,
|
|
30
|
+
width: '100%',
|
|
31
|
+
display: 'block',
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
export const skeletonTextStencil = createStencil({
|
|
36
|
+
base: () => ({
|
|
23
37
|
marginBlockEnd: system.legacy.size.xs,
|
|
24
|
-
'& [data-part="skeleton-text-lines"]': {
|
|
25
|
-
backgroundColor: cssVar(backgroundColor, system.legacy.color.surface.loading),
|
|
26
|
-
height: system.legacy.size.xxxs,
|
|
27
|
-
// We do not have a `gap` token for 0.75rem so `padding` is being used here
|
|
28
|
-
marginBlockEnd: system.legacy.padding.sm,
|
|
29
|
-
borderRadius: system.legacy.shape.md,
|
|
30
|
-
width: '100%',
|
|
31
|
-
},
|
|
32
38
|
'& [data-part="skeleton-text-lines"]:last-child': {
|
|
33
39
|
width: '60%',
|
|
34
40
|
},
|
|
@@ -40,9 +46,13 @@ export const SkeletonText = createComponent('div')({
|
|
|
40
46
|
Component: ({backgroundColor, lineCount = 2, ...elemProps}: SkeletonTextProps, ref, Element) => {
|
|
41
47
|
const lines = new Array(lineCount).fill(null);
|
|
42
48
|
return lineCount > 0 ? (
|
|
43
|
-
<Element ref={ref} {...handleCsProp(elemProps, skeletonTextStencil(
|
|
49
|
+
<Element ref={ref} {...handleCsProp(elemProps, skeletonTextStencil())}>
|
|
44
50
|
{lines.map((_value, index) => (
|
|
45
|
-
<div
|
|
51
|
+
<div
|
|
52
|
+
data-part="skeleton-text-lines"
|
|
53
|
+
key={index}
|
|
54
|
+
{...handleCsProp({}, skeletonTextLineStencil({backgroundColor}))}
|
|
55
|
+
/>
|
|
46
56
|
))}
|
|
47
57
|
</Element>
|
|
48
58
|
) : null;
|