@workday/canvas-kit-react 16.0.0-alpha.0484-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.
Files changed (96) hide show
  1. package/badge/lib/CountBadge.tsx +5 -8
  2. package/banner/lib/Banner.tsx +23 -16
  3. package/banner/lib/hooks/useBannerIcon.tsx +1 -1
  4. package/dist/commonjs/badge/lib/CountBadge.d.ts.map +1 -1
  5. package/dist/commonjs/badge/lib/CountBadge.js +5 -5
  6. package/dist/commonjs/banner/lib/Banner.d.ts +5 -1
  7. package/dist/commonjs/banner/lib/Banner.d.ts.map +1 -1
  8. package/dist/commonjs/banner/lib/Banner.js +11 -7
  9. package/dist/commonjs/banner/lib/hooks/useBannerIcon.d.ts +1 -1
  10. package/dist/commonjs/banner/lib/hooks/useBannerIcon.js +1 -1
  11. package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts +83 -13
  12. package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts.map +1 -1
  13. package/dist/commonjs/information-highlight/lib/InformationHighlight.js +28 -10
  14. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +26 -5
  15. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -1
  16. package/dist/commonjs/information-highlight/lib/hooks/useInformationHighlightModel.js +11 -1
  17. package/dist/commonjs/information-highlight/lib/parts/Body.d.ts +8 -1
  18. package/dist/commonjs/information-highlight/lib/parts/Body.d.ts.map +1 -1
  19. package/dist/commonjs/information-highlight/lib/parts/Body.js +16 -6
  20. package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts +8 -1
  21. package/dist/commonjs/information-highlight/lib/parts/Heading.d.ts.map +1 -1
  22. package/dist/commonjs/information-highlight/lib/parts/Heading.js +16 -6
  23. package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts +2 -1
  24. package/dist/commonjs/information-highlight/lib/parts/Icon.d.ts.map +1 -1
  25. package/dist/commonjs/information-highlight/lib/parts/Icon.js +3 -2
  26. package/dist/commonjs/information-highlight/lib/parts/Link.d.ts +8 -1
  27. package/dist/commonjs/information-highlight/lib/parts/Link.d.ts.map +1 -1
  28. package/dist/commonjs/information-highlight/lib/parts/Link.js +16 -6
  29. package/dist/commonjs/pill/lib/Pill.d.ts +1 -11
  30. package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
  31. package/dist/commonjs/pill/lib/Pill.js +3 -3
  32. package/dist/commonjs/pill/lib/PillIcon.js +1 -1
  33. package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -1
  34. package/dist/commonjs/pill/lib/PillIconButton.js +2 -2
  35. package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts +10 -2
  36. package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -1
  37. package/dist/commonjs/skeleton/lib/parts/SkeletonHeader.js +3 -2
  38. package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts +16 -2
  39. package/dist/commonjs/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -1
  40. package/dist/commonjs/skeleton/lib/parts/SkeletonShape.js +11 -3
  41. package/dist/commonjs/skeleton/lib/parts/SkeletonText.d.ts +12 -3
  42. package/dist/commonjs/skeleton/lib/parts/SkeletonText.d.ts.map +1 -1
  43. package/dist/commonjs/skeleton/lib/parts/SkeletonText.js +10 -5
  44. package/dist/es6/badge/lib/CountBadge.d.ts.map +1 -1
  45. package/dist/es6/badge/lib/CountBadge.js +5 -5
  46. package/dist/es6/banner/lib/Banner.d.ts +5 -1
  47. package/dist/es6/banner/lib/Banner.d.ts.map +1 -1
  48. package/dist/es6/banner/lib/Banner.js +12 -8
  49. package/dist/es6/banner/lib/hooks/useBannerIcon.d.ts +1 -1
  50. package/dist/es6/banner/lib/hooks/useBannerIcon.js +1 -1
  51. package/dist/es6/information-highlight/lib/InformationHighlight.d.ts +83 -13
  52. package/dist/es6/information-highlight/lib/InformationHighlight.d.ts.map +1 -1
  53. package/dist/es6/information-highlight/lib/InformationHighlight.js +30 -12
  54. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts +26 -5
  55. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.d.ts.map +1 -1
  56. package/dist/es6/information-highlight/lib/hooks/useInformationHighlightModel.js +11 -1
  57. package/dist/es6/information-highlight/lib/parts/Body.d.ts +8 -1
  58. package/dist/es6/information-highlight/lib/parts/Body.d.ts.map +1 -1
  59. package/dist/es6/information-highlight/lib/parts/Body.js +17 -7
  60. package/dist/es6/information-highlight/lib/parts/Heading.d.ts +8 -1
  61. package/dist/es6/information-highlight/lib/parts/Heading.d.ts.map +1 -1
  62. package/dist/es6/information-highlight/lib/parts/Heading.js +17 -7
  63. package/dist/es6/information-highlight/lib/parts/Icon.d.ts +2 -1
  64. package/dist/es6/information-highlight/lib/parts/Icon.d.ts.map +1 -1
  65. package/dist/es6/information-highlight/lib/parts/Icon.js +4 -3
  66. package/dist/es6/information-highlight/lib/parts/Link.d.ts +8 -1
  67. package/dist/es6/information-highlight/lib/parts/Link.d.ts.map +1 -1
  68. package/dist/es6/information-highlight/lib/parts/Link.js +17 -7
  69. package/dist/es6/pill/lib/Pill.d.ts +1 -11
  70. package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
  71. package/dist/es6/pill/lib/Pill.js +3 -3
  72. package/dist/es6/pill/lib/PillIcon.js +1 -1
  73. package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
  74. package/dist/es6/pill/lib/PillIconButton.js +3 -3
  75. package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts +10 -2
  76. package/dist/es6/skeleton/lib/parts/SkeletonHeader.d.ts.map +1 -1
  77. package/dist/es6/skeleton/lib/parts/SkeletonHeader.js +4 -3
  78. package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts +16 -2
  79. package/dist/es6/skeleton/lib/parts/SkeletonShape.d.ts.map +1 -1
  80. package/dist/es6/skeleton/lib/parts/SkeletonShape.js +10 -2
  81. package/dist/es6/skeleton/lib/parts/SkeletonText.d.ts +12 -3
  82. package/dist/es6/skeleton/lib/parts/SkeletonText.d.ts.map +1 -1
  83. package/dist/es6/skeleton/lib/parts/SkeletonText.js +10 -5
  84. package/information-highlight/lib/InformationHighlight.tsx +67 -14
  85. package/information-highlight/lib/hooks/useInformationHighlightModel.ts +11 -1
  86. package/information-highlight/lib/parts/Body.tsx +32 -19
  87. package/information-highlight/lib/parts/Heading.tsx +32 -19
  88. package/information-highlight/lib/parts/Icon.tsx +4 -1
  89. package/information-highlight/lib/parts/Link.tsx +33 -18
  90. package/package.json +5 -5
  91. package/pill/lib/Pill.tsx +21 -23
  92. package/pill/lib/PillIcon.tsx +1 -1
  93. package/pill/lib/PillIconButton.tsx +21 -15
  94. package/skeleton/lib/parts/SkeletonHeader.tsx +5 -5
  95. package/skeleton/lib/parts/SkeletonShape.tsx +20 -3
  96. 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.0484-next.0",
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,9 +53,9 @@
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.0484-next.0",
57
- "@workday/canvas-kit-styling": "^16.0.0-alpha.0484-next.0",
58
- "@workday/canvas-system-icons-web": "4.0.4",
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
+ "@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",
61
61
  "chroma-js": "^2.2.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": "3e56c1d93edfd1fe6f2c896ce52884919f1df7f5"
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
- fontFamily: system.fontFamily.default,
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.strong,
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.lg, // ensure correct line height
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.strong,
69
- fallback: system.color.bg.alt.strong,
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: system.legacy.opacity.surface.hover,
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.strong,
81
- fallback: system.color.bg.alt.stronger,
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: system.legacy.opacity.surface.pressed,
79
+ mixinValue: '0.0745',
84
80
  }),
85
- [buttonStencil.vars.label]: system.color.fg.strong,
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.background]: system.legacy.color.surface.alt.strong,
104
- [buttonStencil.vars.label]: system.color.fg.disabled,
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.strong,
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.strong,
140
- fallback: system.color.bg.alt.strong,
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: system.legacy.opacity.surface.hover,
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.strong,
149
- fallback: system.color.bg.alt.stronger,
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: system.legacy.opacity.surface.pressed,
149
+ mixinValue: '0.0745',
152
150
  }),
153
151
  [pillCountStencil.vars.backgroundColor]: system.legacy.color.surface.transparent,
154
152
  },
@@ -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.sm,
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, focusRing} from '@workday/canvas-kit-react/common';
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: calc.negate(px2rem(2)), // visually create space between label and the button by -2px
23
- borderRadius: px2rem(2),
24
- height: system.legacy.size.xxs,
25
- width: system.legacy.size.xxs,
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.strong,
33
- [systemIconStencil.vars.size]: component.legacy.systemIcon.size.sm,
32
+ [systemIconStencil.vars.color]: system.color.fg.default,
33
+ [systemIconStencil.vars.size]: component.legacy.systemIcon.size.xs,
34
34
  '::after': {
35
35
  content: '""',
36
- height: system.legacy.size.sm,
37
- width: system.legacy.size.sm,
36
+ boxSizing: 'border-box',
38
37
  position: 'absolute',
39
- left: calc.negate(px2rem(7)),
40
- bottom: calc.negate(px2rem(7)),
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
- ...focusRing({
48
- innerColor: system.color.border.transparent,
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.disabled,
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 `system.color.bg.alt.strong`
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, backgroundColor, height}) => ({
32
- backgroundColor: cssVar(backgroundColor, system.legacy.color.surface.loading),
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 `system.color.bg.alt.strong`
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, backgroundColor}) => ({
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, cssVar, handleCsProp} from '@workday/canvas-kit-styling';
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 `system.color.bg.alt.strong`
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 skeletonTextStencil = createStencil({
20
+ export const skeletonTextLineStencil = createStencil({
21
+ extends: skeletonSurfaceFillStencil,
19
22
  vars: {
20
23
  backgroundColor: '',
21
24
  },
22
- base: ({backgroundColor}) => ({
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({backgroundColor}))}>
49
+ <Element ref={ref} {...handleCsProp(elemProps, skeletonTextStencil())}>
44
50
  {lines.map((_value, index) => (
45
- <div data-part={'skeleton-text-lines'} key={index}></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;