@workday/canvas-kit-labs-react 16.2.0-0652-next.0 → 16.2.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/accessory/index.ts +6 -0
- package/accessory/lib/Accessory.tsx +156 -0
- package/accessory/lib/AccessoryCalendar.tsx +114 -0
- package/accessory/lib/AccessoryFavicon.tsx +156 -0
- package/accessory/lib/AccessoryFile.tsx +140 -0
- package/accessory/lib/AccessoryIcon.tsx +213 -0
- package/accessory/lib/AccessoryMedia.tsx +142 -0
- package/accessory/package.json +6 -0
- package/dist/commonjs/accessory/index.d.ts +7 -0
- package/dist/commonjs/accessory/index.d.ts.map +1 -0
- package/dist/commonjs/accessory/index.js +22 -0
- package/dist/commonjs/accessory/lib/Accessory.d.ts +157 -0
- package/dist/commonjs/accessory/lib/Accessory.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/Accessory.js +51 -0
- package/dist/commonjs/accessory/lib/AccessoryCalendar.d.ts +80 -0
- package/dist/commonjs/accessory/lib/AccessoryCalendar.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/AccessoryCalendar.js +48 -0
- package/dist/commonjs/accessory/lib/AccessoryFavicon.d.ts +75 -0
- package/dist/commonjs/accessory/lib/AccessoryFavicon.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/AccessoryFavicon.js +74 -0
- package/dist/commonjs/accessory/lib/AccessoryFile.d.ts +65 -0
- package/dist/commonjs/accessory/lib/AccessoryFile.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/AccessoryFile.js +58 -0
- package/dist/commonjs/accessory/lib/AccessoryIcon.d.ts +119 -0
- package/dist/commonjs/accessory/lib/AccessoryIcon.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/AccessoryIcon.js +61 -0
- package/dist/commonjs/accessory/lib/AccessoryMedia.d.ts +72 -0
- package/dist/commonjs/accessory/lib/AccessoryMedia.d.ts.map +1 -0
- package/dist/commonjs/accessory/lib/AccessoryMedia.js +59 -0
- package/dist/commonjs/ai-ingress-button/lib/AIIngressButton.js +5 -5
- package/dist/commonjs/index.d.ts +1 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +1 -0
- package/dist/commonjs/kbd/lib/KBD.js +6 -6
- package/dist/commonjs/kbd/lib/KBDItem.js +6 -6
- package/dist/commonjs/selection-group/lib/SelectionGroupIcon.js +1 -1
- package/dist/commonjs/selection-group/lib/SelectionGroupItem.js +4 -4
- package/dist/commonjs/selection-group/lib/SelectionGroupList.js +6 -6
- package/dist/commonjs/version/lib/version.js +1 -1
- package/dist/es6/accessory/index.d.ts +7 -0
- package/dist/es6/accessory/index.d.ts.map +1 -0
- package/dist/es6/accessory/index.js +6 -0
- package/dist/es6/accessory/lib/Accessory.d.ts +157 -0
- package/dist/es6/accessory/lib/Accessory.d.ts.map +1 -0
- package/dist/es6/accessory/lib/Accessory.js +48 -0
- package/dist/es6/accessory/lib/AccessoryCalendar.d.ts +80 -0
- package/dist/es6/accessory/lib/AccessoryCalendar.d.ts.map +1 -0
- package/dist/es6/accessory/lib/AccessoryCalendar.js +45 -0
- package/dist/es6/accessory/lib/AccessoryFavicon.d.ts +75 -0
- package/dist/es6/accessory/lib/AccessoryFavicon.d.ts.map +1 -0
- package/dist/es6/accessory/lib/AccessoryFavicon.js +71 -0
- package/dist/es6/accessory/lib/AccessoryFile.d.ts +65 -0
- package/dist/es6/accessory/lib/AccessoryFile.d.ts.map +1 -0
- package/dist/es6/accessory/lib/AccessoryFile.js +55 -0
- package/dist/es6/accessory/lib/AccessoryIcon.d.ts +119 -0
- package/dist/es6/accessory/lib/AccessoryIcon.d.ts.map +1 -0
- package/dist/es6/accessory/lib/AccessoryIcon.js +58 -0
- package/dist/es6/accessory/lib/AccessoryMedia.d.ts +72 -0
- package/dist/es6/accessory/lib/AccessoryMedia.d.ts.map +1 -0
- package/dist/es6/accessory/lib/AccessoryMedia.js +53 -0
- package/dist/es6/ai-ingress-button/lib/AIIngressButton.js +5 -5
- package/dist/es6/index.d.ts +1 -0
- package/dist/es6/index.d.ts.map +1 -1
- package/dist/es6/index.js +1 -0
- package/dist/es6/kbd/lib/KBD.js +6 -6
- package/dist/es6/kbd/lib/KBDItem.js +6 -6
- package/dist/es6/selection-group/lib/SelectionGroupIcon.js +1 -1
- package/dist/es6/selection-group/lib/SelectionGroupItem.js +4 -4
- package/dist/es6/selection-group/lib/SelectionGroupList.js +6 -6
- package/dist/es6/version/lib/version.js +1 -1
- package/index.ts +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import {createComponent} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {SystemIcon, SystemIconProps, systemIconStencil} from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import {createStencil, cssVar, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
4
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
5
|
+
|
|
6
|
+
import {Accessory, AccessoryProps, accessoryStencil} from './Accessory';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The color treatment of `AccessoryIcon`.
|
|
10
|
+
*/
|
|
11
|
+
export type AccessoryIconVariant =
|
|
12
|
+
| 'grey'
|
|
13
|
+
| 'green'
|
|
14
|
+
| 'blue'
|
|
15
|
+
| 'purple'
|
|
16
|
+
| 'amber'
|
|
17
|
+
| 'magenta'
|
|
18
|
+
| 'red'
|
|
19
|
+
| 'orange'
|
|
20
|
+
| 'outline';
|
|
21
|
+
|
|
22
|
+
export interface AccessoryIconProps extends AccessoryProps {
|
|
23
|
+
/**
|
|
24
|
+
* The icon to display from `@workday/canvas-system-icons-web`.
|
|
25
|
+
*/
|
|
26
|
+
icon: SystemIconProps['icon'];
|
|
27
|
+
/**
|
|
28
|
+
* The color treatment of the icon and, at `medium` and above, the tile fill. `color` and
|
|
29
|
+
* `background` from `Accessory` override these. Variant fills stay hidden at `small` and
|
|
30
|
+
* `extraSmall` unless `background` is set.
|
|
31
|
+
* @default 'grey'
|
|
32
|
+
*/
|
|
33
|
+
variant?: AccessoryIconVariant;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Color treatment for `AccessoryIcon`. `variant` paints the icon part. `extraSmall` and `small`
|
|
38
|
+
* clear that fill and border unless `background` sets the tile variable. `color` and `background`
|
|
39
|
+
* on `Accessory` still override the variant.
|
|
40
|
+
*/
|
|
41
|
+
export const accessoryIconStencil = createStencil({
|
|
42
|
+
parts: {
|
|
43
|
+
icon: 'accessory-icon',
|
|
44
|
+
},
|
|
45
|
+
base: {},
|
|
46
|
+
modifiers: {
|
|
47
|
+
variant: {
|
|
48
|
+
grey: ({iconPart}) => ({
|
|
49
|
+
[iconPart]: {
|
|
50
|
+
backgroundColor: cssVar(
|
|
51
|
+
accessoryStencil.vars.tileBackground,
|
|
52
|
+
system.legacy.color.surface.alt.strong
|
|
53
|
+
),
|
|
54
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
55
|
+
accessoryStencil.vars.iconColor,
|
|
56
|
+
base.legacy.slate800
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
}),
|
|
60
|
+
green: ({iconPart}) => ({
|
|
61
|
+
[iconPart]: {
|
|
62
|
+
backgroundColor: cssVar(
|
|
63
|
+
accessoryStencil.vars.tileBackground,
|
|
64
|
+
system.legacy.color.surface.success.strong
|
|
65
|
+
),
|
|
66
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
67
|
+
accessoryStencil.vars.iconColor,
|
|
68
|
+
base.legacy.green800
|
|
69
|
+
),
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
blue: ({iconPart}) => ({
|
|
73
|
+
[iconPart]: {
|
|
74
|
+
backgroundColor: cssVar(
|
|
75
|
+
accessoryStencil.vars.tileBackground,
|
|
76
|
+
system.legacy.color.surface.info.strong
|
|
77
|
+
),
|
|
78
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
79
|
+
accessoryStencil.vars.iconColor,
|
|
80
|
+
system.legacy.color.fg.info.strong
|
|
81
|
+
),
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
purple: ({iconPart}) => ({
|
|
85
|
+
[iconPart]: {
|
|
86
|
+
backgroundColor: cssVar(accessoryStencil.vars.tileBackground, base.legacy.purpleA50),
|
|
87
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
88
|
+
accessoryStencil.vars.iconColor,
|
|
89
|
+
base.legacy.purple700
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
}),
|
|
93
|
+
amber: ({iconPart}) => ({
|
|
94
|
+
[iconPart]: {
|
|
95
|
+
backgroundColor: cssVar(
|
|
96
|
+
accessoryStencil.vars.tileBackground,
|
|
97
|
+
system.legacy.color.surface.warning.strong
|
|
98
|
+
),
|
|
99
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
100
|
+
accessoryStencil.vars.iconColor,
|
|
101
|
+
system.legacy.color.fg.warning.strong
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
}),
|
|
105
|
+
magenta: ({iconPart}) => ({
|
|
106
|
+
[iconPart]: {
|
|
107
|
+
backgroundColor: cssVar(accessoryStencil.vars.tileBackground, base.legacy.magentaA50),
|
|
108
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
109
|
+
accessoryStencil.vars.iconColor,
|
|
110
|
+
base.legacy.magenta800
|
|
111
|
+
),
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
red: ({iconPart}) => ({
|
|
115
|
+
[iconPart]: {
|
|
116
|
+
backgroundColor: cssVar(
|
|
117
|
+
accessoryStencil.vars.tileBackground,
|
|
118
|
+
system.legacy.color.surface.danger.strong
|
|
119
|
+
),
|
|
120
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
121
|
+
accessoryStencil.vars.iconColor,
|
|
122
|
+
system.legacy.color.fg.danger.strong
|
|
123
|
+
),
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
orange: ({iconPart}) => ({
|
|
127
|
+
[iconPart]: {
|
|
128
|
+
backgroundColor: cssVar(accessoryStencil.vars.tileBackground, base.legacy.orangeA50),
|
|
129
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
130
|
+
accessoryStencil.vars.iconColor,
|
|
131
|
+
base.legacy.orange700
|
|
132
|
+
),
|
|
133
|
+
},
|
|
134
|
+
}),
|
|
135
|
+
outline: ({iconPart}) => ({
|
|
136
|
+
[iconPart]: {
|
|
137
|
+
backgroundColor: cssVar(
|
|
138
|
+
accessoryStencil.vars.tileBackground,
|
|
139
|
+
system.legacy.color.surface.transparent
|
|
140
|
+
),
|
|
141
|
+
[systemIconStencil.vars.color]: cssVar(
|
|
142
|
+
accessoryStencil.vars.iconColor,
|
|
143
|
+
base.legacy.slate800
|
|
144
|
+
),
|
|
145
|
+
borderWidth: px2rem(1),
|
|
146
|
+
borderStyle: 'solid',
|
|
147
|
+
borderColor: system.legacy.color.border.default,
|
|
148
|
+
},
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
size: {
|
|
152
|
+
extraSmall: {},
|
|
153
|
+
small: {},
|
|
154
|
+
medium: {},
|
|
155
|
+
large: {},
|
|
156
|
+
extraLarge: {},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
compound: [
|
|
160
|
+
{
|
|
161
|
+
modifiers: {size: 'extraSmall'},
|
|
162
|
+
styles: ({iconPart}) => ({
|
|
163
|
+
[iconPart]: {
|
|
164
|
+
backgroundColor: cssVar(accessoryStencil.vars.tileBackground, 'transparent'),
|
|
165
|
+
borderWidth: 0,
|
|
166
|
+
},
|
|
167
|
+
}),
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
modifiers: {size: 'small'},
|
|
171
|
+
styles: ({iconPart}) => ({
|
|
172
|
+
[iconPart]: {
|
|
173
|
+
backgroundColor: cssVar(accessoryStencil.vars.tileBackground, 'transparent'),
|
|
174
|
+
borderWidth: 0,
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* `AccessoryIcon` renders a system icon in an accessory tile. `variant` sets the tile fill and
|
|
183
|
+
* icon color. `color` and `background` on the shared `Accessory` props override the variant. The
|
|
184
|
+
* glyph size comes from `size` on `Accessory` through the icon `data-part`. Always decorative.
|
|
185
|
+
*/
|
|
186
|
+
export const AccessoryIcon = createComponent('span')({
|
|
187
|
+
displayName: 'AccessoryIcon',
|
|
188
|
+
Component: (
|
|
189
|
+
{
|
|
190
|
+
icon,
|
|
191
|
+
size = 'extraLarge',
|
|
192
|
+
variant = 'grey',
|
|
193
|
+
color,
|
|
194
|
+
background,
|
|
195
|
+
...elemProps
|
|
196
|
+
}: AccessoryIconProps,
|
|
197
|
+
ref,
|
|
198
|
+
Element
|
|
199
|
+
) => {
|
|
200
|
+
return (
|
|
201
|
+
<Accessory
|
|
202
|
+
as={Element}
|
|
203
|
+
ref={ref}
|
|
204
|
+
background={background}
|
|
205
|
+
color={color}
|
|
206
|
+
size={size}
|
|
207
|
+
{...handleCsProp(elemProps, accessoryIconStencil({size, variant}))}
|
|
208
|
+
>
|
|
209
|
+
<SystemIcon icon={icon} {...accessoryStencil.parts.icon} />
|
|
210
|
+
</Accessory>
|
|
211
|
+
);
|
|
212
|
+
},
|
|
213
|
+
});
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import {cornerShapeStencil, createComponent} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
5
|
+
import {createStencil, cssVar, handleCsProp} from '@workday/canvas-kit-styling';
|
|
6
|
+
import {base, system} from '@workday/canvas-tokens-web';
|
|
7
|
+
|
|
8
|
+
import {Accessory, AccessoryProps, accessoryStencil} from './Accessory';
|
|
9
|
+
|
|
10
|
+
export interface AccessoryMediaProps extends AccessoryProps {
|
|
11
|
+
/**
|
|
12
|
+
* The URL of the image.
|
|
13
|
+
*/
|
|
14
|
+
src: string;
|
|
15
|
+
/**
|
|
16
|
+
* How the image is resized to fit the tile.
|
|
17
|
+
* @default 'cover'
|
|
18
|
+
*/
|
|
19
|
+
objectFit?: 'contain' | 'cover';
|
|
20
|
+
/**
|
|
21
|
+
* The icon to display from `@workday/canvas-system-icons-web`, centered over the image. When
|
|
22
|
+
* set, a scrim is painted under the icon for contrast. Uses `color` from `Accessory` for the
|
|
23
|
+
* glyph (`base.legacy.neutral0` by default).
|
|
24
|
+
*/
|
|
25
|
+
icon?: SystemIconProps['icon'];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Image treatment for `AccessoryMedia`. The image part stays hidden until `imageLoaded`. The scrim
|
|
30
|
+
* part sits under an optional icon. `background` overrides the tile fill.
|
|
31
|
+
*/
|
|
32
|
+
export const accessoryMediaStencil = createStencil({
|
|
33
|
+
vars: {
|
|
34
|
+
background: '',
|
|
35
|
+
},
|
|
36
|
+
parts: {
|
|
37
|
+
image: 'accessory-media-image',
|
|
38
|
+
scrim: 'accessory-media-scrim',
|
|
39
|
+
},
|
|
40
|
+
base: ({background, imagePart, scrimPart}) => ({
|
|
41
|
+
backgroundColor: cssVar(background, system.legacy.color.surface.alt.default),
|
|
42
|
+
[imagePart]: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
inset: 0,
|
|
45
|
+
width: '100%',
|
|
46
|
+
height: '100%',
|
|
47
|
+
objectFit: 'cover',
|
|
48
|
+
overflow: 'hidden',
|
|
49
|
+
borderRadius: cornerShapeStencil.vars.shape,
|
|
50
|
+
cornerShape: 'superellipse(1.1)',
|
|
51
|
+
},
|
|
52
|
+
[scrimPart]: {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
inset: 0,
|
|
55
|
+
backgroundColor: system.legacy.color.surface.overlay.scrim,
|
|
56
|
+
borderRadius: cornerShapeStencil.vars.shape,
|
|
57
|
+
cornerShape: 'superellipse(1.1)',
|
|
58
|
+
pointerEvents: 'none',
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
modifiers: {
|
|
62
|
+
imageLoaded: {
|
|
63
|
+
false: ({imagePart}) => ({
|
|
64
|
+
[imagePart]: {
|
|
65
|
+
display: 'none',
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
68
|
+
true: {},
|
|
69
|
+
},
|
|
70
|
+
objectFit: {
|
|
71
|
+
cover: ({imagePart}) => ({
|
|
72
|
+
[imagePart]: {
|
|
73
|
+
objectFit: 'cover',
|
|
74
|
+
},
|
|
75
|
+
}),
|
|
76
|
+
contain: ({imagePart}) => ({
|
|
77
|
+
[imagePart]: {
|
|
78
|
+
objectFit: 'contain',
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* `AccessoryMedia` fills an accessory tile with an image. Pass `icon` to center a decorative icon
|
|
87
|
+
* on a contrast scrim. The image stays hidden until it loads; a failed load keeps the tile
|
|
88
|
+
* background. Always decorative.
|
|
89
|
+
*/
|
|
90
|
+
export const AccessoryMedia = createComponent('span')({
|
|
91
|
+
displayName: 'AccessoryMedia',
|
|
92
|
+
Component: (
|
|
93
|
+
{
|
|
94
|
+
src,
|
|
95
|
+
size = 'extraLarge',
|
|
96
|
+
objectFit = 'cover',
|
|
97
|
+
icon,
|
|
98
|
+
color = base.legacy.neutral0,
|
|
99
|
+
background,
|
|
100
|
+
...elemProps
|
|
101
|
+
}: AccessoryMediaProps,
|
|
102
|
+
ref,
|
|
103
|
+
Element
|
|
104
|
+
) => {
|
|
105
|
+
// Track the loaded URL so a `src` change hides the image again without a mount effect that
|
|
106
|
+
// can race a synchronous `onLoad` (cached images and data URLs).
|
|
107
|
+
const [loadedSrc, setLoadedSrc] = React.useState<string | null>(null);
|
|
108
|
+
const imageRef = React.useRef<HTMLImageElement>(null);
|
|
109
|
+
const imageLoaded = loadedSrc === src;
|
|
110
|
+
|
|
111
|
+
React.useEffect(() => {
|
|
112
|
+
const image = imageRef.current;
|
|
113
|
+
if (image?.complete && image.naturalWidth > 0) {
|
|
114
|
+
setLoadedSrc(src);
|
|
115
|
+
}
|
|
116
|
+
}, [src]);
|
|
117
|
+
|
|
118
|
+
return (
|
|
119
|
+
<Accessory
|
|
120
|
+
as={Element}
|
|
121
|
+
ref={ref}
|
|
122
|
+
color={icon ? color : undefined}
|
|
123
|
+
size={size}
|
|
124
|
+
{...handleCsProp(elemProps, accessoryMediaStencil({background, imageLoaded, objectFit}))}
|
|
125
|
+
>
|
|
126
|
+
<img
|
|
127
|
+
ref={imageRef}
|
|
128
|
+
alt=""
|
|
129
|
+
onLoad={() => setLoadedSrc(src)}
|
|
130
|
+
src={src}
|
|
131
|
+
{...accessoryMediaStencil.parts.image}
|
|
132
|
+
/>
|
|
133
|
+
{icon && (
|
|
134
|
+
<>
|
|
135
|
+
<span {...accessoryMediaStencil.parts.scrim} />
|
|
136
|
+
<SystemIcon icon={icon} {...accessoryStencil.parts.icon} />
|
|
137
|
+
</>
|
|
138
|
+
)}
|
|
139
|
+
</Accessory>
|
|
140
|
+
);
|
|
141
|
+
},
|
|
142
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './lib/Accessory';
|
|
2
|
+
export * from './lib/AccessoryCalendar';
|
|
3
|
+
export * from './lib/AccessoryFavicon';
|
|
4
|
+
export * from './lib/AccessoryFile';
|
|
5
|
+
export * from './lib/AccessoryIcon';
|
|
6
|
+
export * from './lib/AccessoryMedia';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../accessory/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./lib/Accessory"), exports);
|
|
18
|
+
__exportStar(require("./lib/AccessoryCalendar"), exports);
|
|
19
|
+
__exportStar(require("./lib/AccessoryFavicon"), exports);
|
|
20
|
+
__exportStar(require("./lib/AccessoryFile"), exports);
|
|
21
|
+
__exportStar(require("./lib/AccessoryIcon"), exports);
|
|
22
|
+
__exportStar(require("./lib/AccessoryMedia"), exports);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { CSProps } from '@workday/canvas-kit-styling';
|
|
2
|
+
/**
|
|
3
|
+
* The size of an `Accessory` tile.
|
|
4
|
+
*
|
|
5
|
+
* * `extraSmall` — 16px tile, 16px icon
|
|
6
|
+
* * `small` — 20px tile, 18px icon
|
|
7
|
+
* * `medium` — 24px tile, 16px icon
|
|
8
|
+
* * `large` — 32px tile, 18px icon
|
|
9
|
+
* * `extraLarge` — 40px tile, 20px icon
|
|
10
|
+
*/
|
|
11
|
+
export type AccessorySize = 'extraSmall' | 'small' | 'medium' | 'large' | 'extraLarge';
|
|
12
|
+
export interface AccessoryProps extends CSProps {
|
|
13
|
+
/**
|
|
14
|
+
* The size of the tile. Icon glyph size follows the tile through the icon `data-part`: 16px,
|
|
15
|
+
* 18px, 16px, 18px, and 20px from `extraSmall` to `extraLarge`.
|
|
16
|
+
*
|
|
17
|
+
* * `extraSmall` — 16px
|
|
18
|
+
* * `small` — 20px
|
|
19
|
+
* * `medium` — 24px
|
|
20
|
+
* * `large` — 32px
|
|
21
|
+
* * `extraLarge` — 40px
|
|
22
|
+
*
|
|
23
|
+
* @default 'extraLarge'
|
|
24
|
+
*/
|
|
25
|
+
size?: AccessorySize;
|
|
26
|
+
/**
|
|
27
|
+
* The color of the icon. When set, this overrides the icon color from `variant` on
|
|
28
|
+
* `AccessoryIcon`. Inherited by the icon `data-part` via a CSS variable.
|
|
29
|
+
*/
|
|
30
|
+
color?: string;
|
|
31
|
+
/**
|
|
32
|
+
* The background color of the icon tile. When set, this overrides the fill from `variant` and is
|
|
33
|
+
* painted at every size, including `small` and `extraSmall`. Inherited by the icon `data-part`
|
|
34
|
+
* via a CSS variable.
|
|
35
|
+
*/
|
|
36
|
+
background?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Tile shell for accessory visuals. Owns size, corner radius, icon glyph size, and optional icon
|
|
40
|
+
* color / fill overrides through the icon `data-part`. Prefer `AccessoryIcon`, `AccessoryFile`, or
|
|
41
|
+
* `AccessoryMedia`, which render this shell.
|
|
42
|
+
*/
|
|
43
|
+
export declare const accessoryStencil: import("@workday/canvas-kit-styling").Stencil<{
|
|
44
|
+
size: {
|
|
45
|
+
extraSmall: ({ iconPart, tileBackground }: {
|
|
46
|
+
shape: `--${string}`;
|
|
47
|
+
iconColor: `--${string}`;
|
|
48
|
+
tileBackground: `--${string}`;
|
|
49
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{
|
|
50
|
+
readonly icon: "accessory-icon";
|
|
51
|
+
}>) => {
|
|
52
|
+
[x: string]: "var(--cnvs-sys-size-xxxs, var(--cnvs-sys-space-x4, 1rem))" | "var(--cnvs-sys-shape-sm, var(--cnvs-sys-shape-x1, 0.25rem))" | {
|
|
53
|
+
[x: string]: number | "var(--cnvs-base-size-200, 1rem)" | `var(--${string}, transparent)`;
|
|
54
|
+
backgroundColor: `var(--${string}, transparent)`;
|
|
55
|
+
borderWidth: number;
|
|
56
|
+
};
|
|
57
|
+
width: "var(--cnvs-sys-size-xxxs, var(--cnvs-sys-space-x4, 1rem))";
|
|
58
|
+
height: "var(--cnvs-sys-size-xxxs, var(--cnvs-sys-space-x4, 1rem))";
|
|
59
|
+
"[data-part=\"accessory-icon\"]": {
|
|
60
|
+
[x: string]: number | "var(--cnvs-base-size-200, 1rem)" | `var(--${string}, transparent)`;
|
|
61
|
+
backgroundColor: `var(--${string}, transparent)`;
|
|
62
|
+
borderWidth: number;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
small: ({ iconPart, tileBackground }: {
|
|
66
|
+
shape: `--${string}`;
|
|
67
|
+
iconColor: `--${string}`;
|
|
68
|
+
tileBackground: `--${string}`;
|
|
69
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{
|
|
70
|
+
readonly icon: "accessory-icon";
|
|
71
|
+
}>) => {
|
|
72
|
+
[x: string]: "var(--cnvs-sys-shape-sm, var(--cnvs-sys-shape-x1, 0.25rem))" | "var(--cnvs-sys-size-xxs, var(--cnvs-sys-space-x5, 1.25rem))" | {
|
|
73
|
+
[x: string]: number | "var(--cnvs-base-size-225, 1.125rem)" | `var(--${string}, transparent)`;
|
|
74
|
+
backgroundColor: `var(--${string}, transparent)`;
|
|
75
|
+
borderWidth: number;
|
|
76
|
+
};
|
|
77
|
+
width: "var(--cnvs-sys-size-xxs, var(--cnvs-sys-space-x5, 1.25rem))";
|
|
78
|
+
height: "var(--cnvs-sys-size-xxs, var(--cnvs-sys-space-x5, 1.25rem))";
|
|
79
|
+
"[data-part=\"accessory-icon\"]": {
|
|
80
|
+
[x: string]: number | "var(--cnvs-base-size-225, 1.125rem)" | `var(--${string}, transparent)`;
|
|
81
|
+
backgroundColor: `var(--${string}, transparent)`;
|
|
82
|
+
borderWidth: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
medium: ({ iconPart }: {
|
|
86
|
+
shape: `--${string}`;
|
|
87
|
+
iconColor: `--${string}`;
|
|
88
|
+
tileBackground: `--${string}`;
|
|
89
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{
|
|
90
|
+
readonly icon: "accessory-icon";
|
|
91
|
+
}>) => {
|
|
92
|
+
[x: string]: "var(--cnvs-sys-size-xs, var(--cnvs-sys-space-x6, 1.5rem))" | "var(--cnvs-sys-shape-md, var(--cnvs-sys-shape-x2, 0.5rem))" | {
|
|
93
|
+
[x: string]: "var(--cnvs-component-system-icon-size-xs, var(--cnvs-sys-space-x4, 1rem))";
|
|
94
|
+
};
|
|
95
|
+
width: "var(--cnvs-sys-size-xs, var(--cnvs-sys-space-x6, 1.5rem))";
|
|
96
|
+
height: "var(--cnvs-sys-size-xs, var(--cnvs-sys-space-x6, 1.5rem))";
|
|
97
|
+
"[data-part=\"accessory-icon\"]": {
|
|
98
|
+
[x: string]: "var(--cnvs-component-system-icon-size-xs, var(--cnvs-sys-space-x4, 1rem))";
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
large: ({ iconPart }: {
|
|
102
|
+
shape: `--${string}`;
|
|
103
|
+
iconColor: `--${string}`;
|
|
104
|
+
tileBackground: `--${string}`;
|
|
105
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{
|
|
106
|
+
readonly icon: "accessory-icon";
|
|
107
|
+
}>) => {
|
|
108
|
+
[x: string]: "var(--cnvs-base-size-125, 0.625rem)" | "var(--cnvs-sys-size-sm, var(--cnvs-sys-space-x8, 2rem))" | {
|
|
109
|
+
[x: string]: "var(--cnvs-component-system-icon-size-sm, 1.125rem)";
|
|
110
|
+
};
|
|
111
|
+
width: "var(--cnvs-sys-size-sm, var(--cnvs-sys-space-x8, 2rem))";
|
|
112
|
+
height: "var(--cnvs-sys-size-sm, var(--cnvs-sys-space-x8, 2rem))";
|
|
113
|
+
"[data-part=\"accessory-icon\"]": {
|
|
114
|
+
[x: string]: "var(--cnvs-component-system-icon-size-sm, 1.125rem)";
|
|
115
|
+
};
|
|
116
|
+
};
|
|
117
|
+
extraLarge: ({ iconPart }: {
|
|
118
|
+
shape: `--${string}`;
|
|
119
|
+
iconColor: `--${string}`;
|
|
120
|
+
tileBackground: `--${string}`;
|
|
121
|
+
} & import("@workday/canvas-kit-styling").StencilVarsParts<{
|
|
122
|
+
readonly icon: "accessory-icon";
|
|
123
|
+
}>) => {
|
|
124
|
+
[x: string]: "var(--cnvs-sys-size-md, var(--cnvs-sys-space-x10, 2.5rem))" | "var(--cnvs-sys-shape-lg, 0.75rem)" | {
|
|
125
|
+
[x: string]: "var(--cnvs-component-system-icon-size-md, var(--cnvs-sys-space-x5, 1.25rem))";
|
|
126
|
+
};
|
|
127
|
+
width: "var(--cnvs-sys-size-md, var(--cnvs-sys-space-x10, 2.5rem))";
|
|
128
|
+
height: "var(--cnvs-sys-size-md, var(--cnvs-sys-space-x10, 2.5rem))";
|
|
129
|
+
"[data-part=\"accessory-icon\"]": {
|
|
130
|
+
[x: string]: "var(--cnvs-component-system-icon-size-md, var(--cnvs-sys-space-x5, 1.25rem))";
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
}, {
|
|
135
|
+
readonly icon: "accessory-icon";
|
|
136
|
+
}, {
|
|
137
|
+
iconColor: string;
|
|
138
|
+
tileBackground: string;
|
|
139
|
+
}, import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{}, {
|
|
140
|
+
shape: string;
|
|
141
|
+
}, never>, {}, {
|
|
142
|
+
shape: string;
|
|
143
|
+
}, never, never>, never>;
|
|
144
|
+
/**
|
|
145
|
+
* `Accessory` is the small rounded visual that sits beside text, most often the leading element in
|
|
146
|
+
* a list item or other row. It owns the tile size and corner radius so a system icon, file type,
|
|
147
|
+
* image, site favicon, calendar date, or custom content stays one consistent shape.
|
|
148
|
+
* `AccessoryIcon`, `AccessoryFile`, `AccessoryMedia`, `AccessoryFavicon`, and `AccessoryCalendar`
|
|
149
|
+
* render this shell. Accessories are
|
|
150
|
+
* decorative and always hidden from assistive technology.
|
|
151
|
+
*
|
|
152
|
+
* ```tsx
|
|
153
|
+
* <AccessoryIcon icon={activityIcon} />
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
export declare const Accessory: import("@workday/canvas-kit-react/common").ElementComponent<"span", AccessoryProps>;
|
|
157
|
+
//# sourceMappingURL=Accessory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Accessory.d.ts","sourceRoot":"","sources":["../../../../accessory/lib/Accessory.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,OAAO,EAAsC,MAAM,6BAA6B,CAAC;AAGzF;;;;;;;;GAQG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,YAAY,CAAC;AAEvF,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBA2E3B,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,SAAS,qFAkBpB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Accessory = exports.accessoryStencil = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const common_1 = require("@workday/canvas-kit-react/common");
|
|
6
|
+
const icon_1 = require("@workday/canvas-kit-react/icon");
|
|
7
|
+
const canvas_kit_styling_1 = require("@workday/canvas-kit-styling");
|
|
8
|
+
const canvas_tokens_web_1 = require("@workday/canvas-tokens-web");
|
|
9
|
+
/**
|
|
10
|
+
* Tile shell for accessory visuals. Owns size, corner radius, icon glyph size, and optional icon
|
|
11
|
+
* color / fill overrides through the icon `data-part`. Prefer `AccessoryIcon`, `AccessoryFile`, or
|
|
12
|
+
* `AccessoryMedia`, which render this shell.
|
|
13
|
+
*/
|
|
14
|
+
exports.accessoryStencil = (0, canvas_kit_styling_1.createStencil)({
|
|
15
|
+
extends: common_1.cornerShapeStencil,
|
|
16
|
+
vars: {
|
|
17
|
+
iconColor: '',
|
|
18
|
+
tileBackground: '',
|
|
19
|
+
},
|
|
20
|
+
parts: {
|
|
21
|
+
icon: 'accessory-icon',
|
|
22
|
+
},
|
|
23
|
+
base: { name: "gv5qf", styles: "box-sizing:border-box;display:inline-flex;position:relative;align-items:center;justify-content:center;flex-shrink:0;vertical-align:middle;[data-part=\"accessory-icon\"]{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;border-radius:var(--shape-corner-shape-ccab68);corner-shape:superellipse(1.1);--color-system-icon-c9acc3:var(--iconColor-accessory-05fc46);}" },
|
|
24
|
+
modifiers: {
|
|
25
|
+
size: {
|
|
26
|
+
extraSmall: { name: "3n1ci6", styles: "width:var(--cnvs-sys-size-xxxs, var(--cnvs-sys-space-x4, 1rem));height:var(--cnvs-sys-size-xxxs, var(--cnvs-sys-space-x4, 1rem));--shape-corner-shape-ccab68:var(--cnvs-sys-shape-sm, var(--cnvs-sys-shape-x1, 0.25rem));[data-part=\"accessory-icon\"]{--size-svg-bca693:var(--cnvs-base-size-200, 1rem);background-color:var(--tileBackground-accessory-05fc46, transparent);border-width:0;}" },
|
|
27
|
+
small: { name: "1bphix", styles: "width:var(--cnvs-sys-size-xxs, var(--cnvs-sys-space-x5, 1.25rem));height:var(--cnvs-sys-size-xxs, var(--cnvs-sys-space-x5, 1.25rem));--shape-corner-shape-ccab68:var(--cnvs-sys-shape-sm, var(--cnvs-sys-shape-x1, 0.25rem));[data-part=\"accessory-icon\"]{--size-svg-bca693:var(--cnvs-base-size-225, 1.125rem);background-color:var(--tileBackground-accessory-05fc46, transparent);border-width:0;}" },
|
|
28
|
+
medium: { name: "yrqbg", styles: "width:var(--cnvs-sys-size-xs, var(--cnvs-sys-space-x6, 1.5rem));height:var(--cnvs-sys-size-xs, var(--cnvs-sys-space-x6, 1.5rem));--shape-corner-shape-ccab68:var(--cnvs-sys-shape-md, var(--cnvs-sys-shape-x2, 0.5rem));[data-part=\"accessory-icon\"]{--size-svg-bca693:var(--cnvs-component-system-icon-size-xs, var(--cnvs-sys-space-x4, 1rem));}" },
|
|
29
|
+
large: { name: "i7ht8", styles: "width:var(--cnvs-sys-size-sm, var(--cnvs-sys-space-x8, 2rem));height:var(--cnvs-sys-size-sm, var(--cnvs-sys-space-x8, 2rem));--shape-corner-shape-ccab68:var(--cnvs-base-size-125, 0.625rem);[data-part=\"accessory-icon\"]{--size-svg-bca693:var(--cnvs-component-system-icon-size-sm, 1.125rem);}" },
|
|
30
|
+
extraLarge: { name: "3zn1qe", styles: "width:var(--cnvs-sys-size-md, var(--cnvs-sys-space-x10, 2.5rem));height:var(--cnvs-sys-size-md, var(--cnvs-sys-space-x10, 2.5rem));--shape-corner-shape-ccab68:var(--cnvs-sys-shape-lg, 0.75rem);[data-part=\"accessory-icon\"]{--size-svg-bca693:var(--cnvs-component-system-icon-size-md, var(--cnvs-sys-space-x5, 1.25rem));}" }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}, "accessory-05fc46");
|
|
34
|
+
/**
|
|
35
|
+
* `Accessory` is the small rounded visual that sits beside text, most often the leading element in
|
|
36
|
+
* a list item or other row. It owns the tile size and corner radius so a system icon, file type,
|
|
37
|
+
* image, site favicon, calendar date, or custom content stays one consistent shape.
|
|
38
|
+
* `AccessoryIcon`, `AccessoryFile`, `AccessoryMedia`, `AccessoryFavicon`, and `AccessoryCalendar`
|
|
39
|
+
* render this shell. Accessories are
|
|
40
|
+
* decorative and always hidden from assistive technology.
|
|
41
|
+
*
|
|
42
|
+
* ```tsx
|
|
43
|
+
* <AccessoryIcon icon={activityIcon} />
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
exports.Accessory = (0, common_1.createComponent)('span')({
|
|
47
|
+
displayName: 'Accessory',
|
|
48
|
+
Component: ({ size = 'extraLarge', color, background, ...elemProps }, ref, Element) => {
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(Element, { ref: ref, ...(0, canvas_kit_styling_1.handleCsProp)(elemProps, (0, exports.accessoryStencil)({ size, iconColor: color, tileBackground: background })), "aria-hidden": true }));
|
|
50
|
+
},
|
|
51
|
+
});
|