@workday/canvas-kit-preview-react 8.0.0-alpha.116-next.1 → 8.0.0-alpha.118-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commonjs/pill/lib/Pill.d.ts +7 -0
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/Pill.js +11 -4
- package/dist/commonjs/pill/lib/PillAvatar.d.ts +1 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
- package/dist/commonjs/pill/lib/PillIcon.d.ts +1 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.d.ts +6 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +17 -24
- package/dist/commonjs/pill/lib/PillLabel.d.ts +1 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/PillLabel.js +1 -1
- package/dist/commonjs/pill/lib/usePillModel.d.ts +13 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts.map +1 -1
- package/dist/commonjs/pill/lib/usePillModel.js +7 -1
- package/dist/es6/pill/lib/Pill.d.ts +7 -0
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -1
- package/dist/es6/pill/lib/Pill.js +11 -4
- package/dist/es6/pill/lib/PillAvatar.d.ts +1 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillAvatar.js +1 -1
- package/dist/es6/pill/lib/PillIcon.d.ts +1 -0
- package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.d.ts +6 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +18 -25
- package/dist/es6/pill/lib/PillLabel.d.ts +1 -0
- package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -1
- package/dist/es6/pill/lib/PillLabel.js +1 -1
- package/dist/es6/pill/lib/usePillModel.d.ts +13 -0
- package/dist/es6/pill/lib/usePillModel.d.ts.map +1 -1
- package/dist/es6/pill/lib/usePillModel.js +8 -2
- package/package.json +7 -6
- package/pill/lib/Pill.tsx +10 -2
- package/pill/lib/PillAvatar.tsx +1 -0
- package/pill/lib/PillIcon.tsx +2 -0
- package/pill/lib/PillIconButton.tsx +36 -32
- package/pill/lib/PillLabel.tsx +1 -0
- package/pill/lib/usePillModel.tsx +8 -1
|
@@ -10,8 +10,10 @@ export interface PillProps extends BoxProps {
|
|
|
10
10
|
export declare const Pill: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillProps & Partial<{
|
|
11
11
|
maxWidth: string | number;
|
|
12
12
|
disabled: boolean;
|
|
13
|
+
id: string;
|
|
13
14
|
}> & {} & {}, {
|
|
14
15
|
state: {
|
|
16
|
+
id: string;
|
|
15
17
|
maxWidth: string | number;
|
|
16
18
|
disabled: boolean;
|
|
17
19
|
};
|
|
@@ -19,6 +21,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
19
21
|
}> & {
|
|
20
22
|
Context: React.Context<{
|
|
21
23
|
state: {
|
|
24
|
+
id: string;
|
|
22
25
|
maxWidth: string | number;
|
|
23
26
|
disabled: boolean;
|
|
24
27
|
};
|
|
@@ -27,6 +30,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
27
30
|
} & {
|
|
28
31
|
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillIcon").PillIconProps, {
|
|
29
32
|
state: {
|
|
33
|
+
id: string;
|
|
30
34
|
maxWidth: string | number;
|
|
31
35
|
disabled: boolean;
|
|
32
36
|
};
|
|
@@ -34,6 +38,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
34
38
|
}>;
|
|
35
39
|
Avatar: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillAvatar").PillAvatarProps, {
|
|
36
40
|
state: {
|
|
41
|
+
id: string;
|
|
37
42
|
maxWidth: string | number;
|
|
38
43
|
disabled: boolean;
|
|
39
44
|
};
|
|
@@ -42,6 +47,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
42
47
|
Count: import("@workday/canvas-kit-react/common").ElementComponent<"span", import("./PillCount").PillCountProps>;
|
|
43
48
|
Label: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillLabel").PillLabelProps, {
|
|
44
49
|
state: {
|
|
50
|
+
id: string;
|
|
45
51
|
maxWidth: string | number;
|
|
46
52
|
disabled: boolean;
|
|
47
53
|
};
|
|
@@ -49,6 +55,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
49
55
|
}>;
|
|
50
56
|
IconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillIconButton").PillIconButtonProps, {
|
|
51
57
|
state: {
|
|
58
|
+
id: string;
|
|
52
59
|
maxWidth: string | number;
|
|
53
60
|
disabled: boolean;
|
|
54
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../pill/lib/Pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAC,QAAQ,EAA4B,MAAM,kCAAkC,CAAC;AAWrF,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../pill/lib/Pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAC,QAAQ,EAA4B,MAAM,kCAAkC,CAAC;AAWrF,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;CAChD;AAsID,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Df,CAAC"}
|
|
@@ -111,7 +111,6 @@ var getRemovablePillColors = function (disabled) {
|
|
|
111
111
|
};
|
|
112
112
|
var pillBaseStyles = __assign(__assign({ display: 'inline-flex', alignItems: 'center', borderRadius: tokens_1.borderRadius.m, flexShrink: 0 }, tokens_1.type.levels.subtext.large), { color: tokens_1.colors.blackPepper400, boxShadow: 'none', outline: 'none', fontWeight: tokens_1.type.properties.fontWeights.medium, WebkitFontSmoothing: 'antialiased', MozOsxFontSmoothing: 'grayscale', width: 'fit-content', padding: "2px " + tokens_1.space.xxs, height: tokens_1.space.m, position: 'relative' });
|
|
113
113
|
var StyledBasePill = common_1.styled(button_1.BaseButton.as('button'))(__assign(__assign(__assign({}, pillBaseStyles), { '&:focus': {
|
|
114
|
-
borderColor: tokens_1.colors.blueberry400,
|
|
115
114
|
'span[data-count="ck-pill-count"]': {
|
|
116
115
|
borderTop: "1px solid " + tokens_1.colors.blueberry400,
|
|
117
116
|
borderBottom: "1px solid " + tokens_1.colors.blueberry400,
|
|
@@ -128,10 +127,18 @@ var StyledBasePill = common_1.styled(button_1.BaseButton.as('button'))(__assign(
|
|
|
128
127
|
border: 'none',
|
|
129
128
|
},
|
|
130
129
|
},
|
|
131
|
-
})),
|
|
130
|
+
})), function (_a) {
|
|
131
|
+
var variant = _a.variant;
|
|
132
|
+
return ({
|
|
133
|
+
'&:focus': {
|
|
134
|
+
borderColor: variant === 'removable' ? undefined : tokens_1.colors.blueberry400,
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}, layout_1.boxStyleFn);
|
|
132
138
|
var StyledNonInteractivePill = common_1.styled(StyledBasePill)({
|
|
133
139
|
cursor: 'default',
|
|
134
140
|
overflow: 'revert',
|
|
141
|
+
position: 'relative',
|
|
135
142
|
});
|
|
136
143
|
exports.Pill = common_1.createContainer('button')({
|
|
137
144
|
modelHook: usePillModel_1.usePillModel,
|
|
@@ -145,7 +152,7 @@ exports.Pill = common_1.createContainer('button')({
|
|
|
145
152
|
})(function (_a, Element, model) {
|
|
146
153
|
var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, maxWidth = _a.maxWidth, elemProps = __rest(_a, ["variant", "maxWidth"]);
|
|
147
154
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
148
|
-
variant === 'readOnly' && (react_1.default.createElement(StyledNonInteractivePill, __assign({ maxWidth: model.state.maxWidth, as: Element !== 'button' ? Element : 'span', border: "1px solid " + tokens_1.colors.licorice200 }, elemProps),
|
|
155
|
+
variant === 'readOnly' && (react_1.default.createElement(StyledNonInteractivePill, __assign({ maxWidth: model.state.maxWidth, as: Element !== 'button' ? Element : 'span', border: "1px solid " + tokens_1.colors.licorice200, id: model.state.id }, elemProps),
|
|
149
156
|
react_1.default.createElement(PillLabel_1.PillLabel, null, elemProps.children))),
|
|
150
157
|
variant === 'default' && (react_1.default.createElement(StyledBasePill, __assign({ colors: getButtonPillColors(), as: Element }, elemProps, { disabled: model.state.disabled }),
|
|
151
158
|
react_1.default.createElement(layout_1.HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center" }, react_1.default.Children.map(elemProps.children, function (child, index) {
|
|
@@ -154,7 +161,7 @@ exports.Pill = common_1.createContainer('button')({
|
|
|
154
161
|
}
|
|
155
162
|
return (react_1.default.createElement(layout_1.Stack.Item, { key: index, display: "inline-flex" }, child));
|
|
156
163
|
})))),
|
|
157
|
-
variant === 'removable' && (react_1.default.createElement(StyledNonInteractivePill, __assign({ colors: getRemovablePillColors(model.state.disabled), as: Element !== 'button' ? Element : 'span' }, elemProps),
|
|
164
|
+
variant === 'removable' && (react_1.default.createElement(StyledNonInteractivePill, __assign({ colors: getRemovablePillColors(model.state.disabled), as: Element !== 'button' ? Element : 'span', variant: variant }, elemProps),
|
|
158
165
|
react_1.default.createElement(layout_1.HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center", justifyContent: "center" }, react_1.default.Children.map(elemProps.children, function (child, index) {
|
|
159
166
|
if (typeof child === 'string') {
|
|
160
167
|
return react_1.default.createElement(PillLabel_1.PillLabel, { key: index }, child);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillAvatar.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillAvatar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAKvD,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"PillAvatar.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillAvatar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAKvD,eAAO,MAAM,UAAU;;;;;;;EAerB,CAAC"}
|
|
@@ -25,5 +25,5 @@ var usePillModel_1 = require("./usePillModel");
|
|
|
25
25
|
exports.PillAvatar = common_1.createSubcomponent('button')({
|
|
26
26
|
modelHook: usePillModel_1.usePillModel,
|
|
27
27
|
})(function (elemProps, Element, model) {
|
|
28
|
-
return (react_1.default.createElement(avatar_1.Avatar, __assign({ style: { opacity: model.state.disabled ? '.7' : '1' }, as: "div", size: 18 }, elemProps, { disabled: model.state.disabled }), elemProps.children));
|
|
28
|
+
return (react_1.default.createElement(avatar_1.Avatar, __assign({ style: { opacity: model.state.disabled ? '.7' : '1' }, as: "div", size: 18, altText: undefined }, elemProps, { disabled: model.state.disabled }), elemProps.children));
|
|
29
29
|
});
|
|
@@ -9,6 +9,7 @@ export interface PillIconProps extends Omit<SystemIconProps, 'icon'> {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const PillIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", PillIconProps, {
|
|
11
11
|
state: {
|
|
12
|
+
id: string;
|
|
12
13
|
maxWidth: string | number;
|
|
13
14
|
disabled: boolean;
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillIcon.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"PillIcon.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ;;;;;;;EAenB,CAAC"}
|
|
@@ -36,5 +36,5 @@ exports.PillIcon = common_1.createSubcomponent('span')({
|
|
|
36
36
|
modelHook: usePillModel_1.usePillModel,
|
|
37
37
|
})(function (_a, Element) {
|
|
38
38
|
var size = _a.size, icon = _a.icon, elemProps = __rest(_a, ["size", "icon"]);
|
|
39
|
-
return (react_1.default.createElement(icon_1.SystemIcon, __assign({ marginInlineStart: "-" + tokens_1.space.xxxs, display: "flex", as: Element, size: 20, icon: icon || canvas_system_icons_web_1.plusIcon }, elemProps)));
|
|
39
|
+
return (react_1.default.createElement(icon_1.SystemIcon, __assign({ marginInlineStart: "-" + tokens_1.space.xxxs, display: "flex", as: Element, size: 20, role: "img", "aria-label": "add", icon: icon || canvas_system_icons_web_1.plusIcon }, elemProps)));
|
|
40
40
|
});
|
|
@@ -6,9 +6,15 @@ export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
|
6
6
|
* @default `xSmallIcon`
|
|
7
7
|
*/
|
|
8
8
|
icon?: CanvasSystemIcon;
|
|
9
|
+
/**
|
|
10
|
+
* The aria label for the removable icon
|
|
11
|
+
* @default 'remove'
|
|
12
|
+
*/
|
|
13
|
+
'aria-label'?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const PillIconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillIconButtonProps, {
|
|
11
16
|
state: {
|
|
17
|
+
id: string;
|
|
12
18
|
maxWidth: string | number;
|
|
13
19
|
disabled: boolean;
|
|
14
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillIconButton.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIconButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PillIconButton.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIconButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA6CD,eAAO,MAAM,cAAc;;;;;;;EAgC1B,CAAC"}
|
|
@@ -47,9 +47,7 @@ var getIconColors = function () {
|
|
|
47
47
|
focus: {
|
|
48
48
|
icon: tokens_1.colors.licorice500,
|
|
49
49
|
focusRing: common_1.focusRing({
|
|
50
|
-
width: 0,
|
|
51
50
|
innerColor: 'transparent',
|
|
52
|
-
outerColor: 'transparent',
|
|
53
51
|
}),
|
|
54
52
|
},
|
|
55
53
|
disabled: {
|
|
@@ -58,31 +56,26 @@ var getIconColors = function () {
|
|
|
58
56
|
},
|
|
59
57
|
};
|
|
60
58
|
};
|
|
61
|
-
var StyledFocusTarget = common_1.styled('span')({
|
|
62
|
-
height: 20,
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
right: '5px',
|
|
65
|
-
left: tokens_1.space.xxxs,
|
|
66
|
-
margin: 0,
|
|
67
|
-
borderRadius: tokens_1.borderRadius.m,
|
|
68
|
-
'&:focus': __assign({ outline: 'none' }, common_1.focusRing({
|
|
69
|
-
outerColor: tokens_1.colors.blueberry400,
|
|
70
|
-
innerColor: 'transparent',
|
|
71
|
-
separation: 0,
|
|
72
|
-
width: 2,
|
|
73
|
-
inset: 'inner',
|
|
74
|
-
})),
|
|
75
|
-
});
|
|
76
59
|
var StyledIconButton = common_1.styled(button_1.BaseButton)({
|
|
77
|
-
marginInlineEnd: '-
|
|
78
|
-
|
|
79
|
-
|
|
60
|
+
marginInlineEnd: '-7px',
|
|
61
|
+
marginInlineStart: "-2px",
|
|
62
|
+
overflow: 'visible',
|
|
63
|
+
'::after': {
|
|
64
|
+
content: '""',
|
|
65
|
+
height: tokens_1.space.l,
|
|
66
|
+
width: tokens_1.space.l,
|
|
67
|
+
position: 'absolute',
|
|
68
|
+
left: '-7px',
|
|
69
|
+
bottom: '-7px',
|
|
70
|
+
margin: 0,
|
|
71
|
+
pointerEvents: 'all',
|
|
72
|
+
cursor: 'pointer',
|
|
73
|
+
},
|
|
80
74
|
});
|
|
81
75
|
exports.PillIconButton = common_1.createSubcomponent('button')({
|
|
82
76
|
modelHook: usePillModel_1.usePillModel,
|
|
83
77
|
})(function (_a, Element, model) {
|
|
84
|
-
var size = _a.size, _b = _a.icon, icon = _b === void 0 ? canvas_system_icons_web_1.xSmallIcon : _b, maxWidth = _a.maxWidth, children = _a.children, elemProps = __rest(_a, ["size", "icon", "maxWidth", "children"]);
|
|
85
|
-
return (react_1.default.createElement(StyledIconButton, __assign({ borderRadius: "s", height:
|
|
86
|
-
react_1.default.createElement(
|
|
87
|
-
react_1.default.createElement(icon_1.SystemIcon, { icon: icon, size: 24 })));
|
|
78
|
+
var size = _a.size, _b = _a.icon, icon = _b === void 0 ? canvas_system_icons_web_1.xSmallIcon : _b, maxWidth = _a.maxWidth, children = _a.children, _c = _a["aria-label"], ariaLabel = _c === void 0 ? 'remove' : _c, elemProps = __rest(_a, ["size", "icon", "maxWidth", "children", 'aria-label']);
|
|
79
|
+
return (react_1.default.createElement(StyledIconButton, __assign({ borderRadius: "s", height: 20, width: 20, padding: "zero", disabled: model.state.disabled, colors: getIconColors(), "aria-labelledby": "removable-" + model.state.id + " label-" + model.state.id, as: Element, position: "relative" }, elemProps),
|
|
80
|
+
react_1.default.createElement(icon_1.SystemIcon, { "aria-label": ariaLabel, id: "removable-" + model.state.id, icon: icon, size: tokens_1.space.m, "aria-hidden": true, role: "img" })));
|
|
88
81
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillLabel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAKxF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;CACvD;AAQD,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"PillLabel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAKxF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;CACvD;AAQD,eAAO,MAAM,SAAS;;;;;;;EAgBpB,CAAC"}
|
|
@@ -43,5 +43,5 @@ exports.PillLabel = common_1.createSubcomponent('span')({
|
|
|
43
43
|
})(function (_a, Element, model) {
|
|
44
44
|
var tooltipProps = _a.tooltipProps, elemProps = __rest(_a, ["tooltipProps"]);
|
|
45
45
|
return (react_1.default.createElement(tooltip_1.OverflowTooltip, __assign({}, tooltipProps),
|
|
46
|
-
react_1.default.createElement(StyledLabelContainer, __assign({ color: model.state.disabled ? tokens_1.colors.licorice100 : 'inherit', maxWidth: model.state.maxWidth, as: Element }, elemProps), elemProps.children)));
|
|
46
|
+
react_1.default.createElement(StyledLabelContainer, __assign({ color: model.state.disabled ? tokens_1.colors.licorice100 : 'inherit', maxWidth: model.state.maxWidth, as: Element, id: "label-" + model.state.id }, elemProps), elemProps.children)));
|
|
47
47
|
});
|
|
@@ -8,8 +8,14 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
8
8
|
* Use to disable a pill.
|
|
9
9
|
*/
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* ID used to add accessibility labels to pill elements.
|
|
13
|
+
* @default `useUniqueId()`
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
11
16
|
}> & {} & {}) | undefined) => {
|
|
12
17
|
state: {
|
|
18
|
+
id: string;
|
|
13
19
|
/**
|
|
14
20
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
15
21
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -31,7 +37,13 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
31
37
|
* Use to disable a pill.
|
|
32
38
|
*/
|
|
33
39
|
disabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* ID used to add accessibility labels to pill elements.
|
|
42
|
+
* @default `useUniqueId()`
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
34
45
|
}, {}, {
|
|
46
|
+
id: string;
|
|
35
47
|
/**
|
|
36
48
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
37
49
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -43,6 +55,7 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
43
55
|
disabled: boolean;
|
|
44
56
|
}, {}, {
|
|
45
57
|
state: {
|
|
58
|
+
id: string;
|
|
46
59
|
/**
|
|
47
60
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
48
61
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePillModel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/usePillModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;IAErB;;;OAGG;;IAEH;;OAEG
|
|
1
|
+
{"version":3,"file":"usePillModel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/usePillModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;IAErB;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;QAZH;;;WAGG;;QAEH;;WAEG;;;;;IAPH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;IAZH;;;OAGG;;IAEH;;OAEG;;;;;QAPH;;;WAGG;;QAEH;;WAEG;;;;EAgBL,CAAC"}
|
|
@@ -24,8 +24,14 @@ exports.usePillModel = common_1.createModelHook({
|
|
|
24
24
|
* Use to disable a pill.
|
|
25
25
|
*/
|
|
26
26
|
disabled: false,
|
|
27
|
+
/**
|
|
28
|
+
* ID used to add accessibility labels to pill elements.
|
|
29
|
+
* @default `useUniqueId()`
|
|
30
|
+
*/
|
|
31
|
+
id: '',
|
|
27
32
|
},
|
|
28
33
|
})(function (config) {
|
|
29
|
-
var
|
|
34
|
+
var id = common_1.useUniqueId(config.id);
|
|
35
|
+
var state = __assign(__assign({}, config), { id: id });
|
|
30
36
|
return { state: state, events: {} };
|
|
31
37
|
});
|
|
@@ -10,8 +10,10 @@ export interface PillProps extends BoxProps {
|
|
|
10
10
|
export declare const Pill: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillProps & Partial<{
|
|
11
11
|
maxWidth: string | number;
|
|
12
12
|
disabled: boolean;
|
|
13
|
+
id: string;
|
|
13
14
|
}> & {} & {}, {
|
|
14
15
|
state: {
|
|
16
|
+
id: string;
|
|
15
17
|
maxWidth: string | number;
|
|
16
18
|
disabled: boolean;
|
|
17
19
|
};
|
|
@@ -19,6 +21,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
19
21
|
}> & {
|
|
20
22
|
Context: React.Context<{
|
|
21
23
|
state: {
|
|
24
|
+
id: string;
|
|
22
25
|
maxWidth: string | number;
|
|
23
26
|
disabled: boolean;
|
|
24
27
|
};
|
|
@@ -27,6 +30,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
27
30
|
} & {
|
|
28
31
|
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillIcon").PillIconProps, {
|
|
29
32
|
state: {
|
|
33
|
+
id: string;
|
|
30
34
|
maxWidth: string | number;
|
|
31
35
|
disabled: boolean;
|
|
32
36
|
};
|
|
@@ -34,6 +38,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
34
38
|
}>;
|
|
35
39
|
Avatar: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillAvatar").PillAvatarProps, {
|
|
36
40
|
state: {
|
|
41
|
+
id: string;
|
|
37
42
|
maxWidth: string | number;
|
|
38
43
|
disabled: boolean;
|
|
39
44
|
};
|
|
@@ -42,6 +47,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
42
47
|
Count: import("@workday/canvas-kit-react/common").ElementComponent<"span", import("./PillCount").PillCountProps>;
|
|
43
48
|
Label: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillLabel").PillLabelProps, {
|
|
44
49
|
state: {
|
|
50
|
+
id: string;
|
|
45
51
|
maxWidth: string | number;
|
|
46
52
|
disabled: boolean;
|
|
47
53
|
};
|
|
@@ -49,6 +55,7 @@ export declare const Pill: import("@workday/canvas-kit-react/common").ElementCom
|
|
|
49
55
|
}>;
|
|
50
56
|
IconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillIconButton").PillIconButtonProps, {
|
|
51
57
|
state: {
|
|
58
|
+
id: string;
|
|
52
59
|
maxWidth: string | number;
|
|
53
60
|
disabled: boolean;
|
|
54
61
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../pill/lib/Pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAC,QAAQ,EAA4B,MAAM,kCAAkC,CAAC;AAWrF,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;CAChD;
|
|
1
|
+
{"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../pill/lib/Pill.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,OAAO,EAAC,QAAQ,EAA4B,MAAM,kCAAkC,CAAC;AAWrF,MAAM,WAAW,SAAU,SAAQ,QAAQ;IACzC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC;CAChD;AAsID,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Df,CAAC"}
|
|
@@ -105,7 +105,6 @@ var getRemovablePillColors = function (disabled) {
|
|
|
105
105
|
};
|
|
106
106
|
var pillBaseStyles = __assign(__assign({ display: 'inline-flex', alignItems: 'center', borderRadius: borderRadius.m, flexShrink: 0 }, type.levels.subtext.large), { color: colors.blackPepper400, boxShadow: 'none', outline: 'none', fontWeight: type.properties.fontWeights.medium, WebkitFontSmoothing: 'antialiased', MozOsxFontSmoothing: 'grayscale', width: 'fit-content', padding: "2px " + space.xxs, height: space.m, position: 'relative' });
|
|
107
107
|
var StyledBasePill = styled(BaseButton.as('button'))(__assign(__assign(__assign({}, pillBaseStyles), { '&:focus': {
|
|
108
|
-
borderColor: colors.blueberry400,
|
|
109
108
|
'span[data-count="ck-pill-count"]': {
|
|
110
109
|
borderTop: "1px solid " + colors.blueberry400,
|
|
111
110
|
borderBottom: "1px solid " + colors.blueberry400,
|
|
@@ -122,10 +121,18 @@ var StyledBasePill = styled(BaseButton.as('button'))(__assign(__assign(__assign(
|
|
|
122
121
|
border: 'none',
|
|
123
122
|
},
|
|
124
123
|
},
|
|
125
|
-
})),
|
|
124
|
+
})), function (_a) {
|
|
125
|
+
var variant = _a.variant;
|
|
126
|
+
return ({
|
|
127
|
+
'&:focus': {
|
|
128
|
+
borderColor: variant === 'removable' ? undefined : colors.blueberry400,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}, boxStyleFn);
|
|
126
132
|
var StyledNonInteractivePill = styled(StyledBasePill)({
|
|
127
133
|
cursor: 'default',
|
|
128
134
|
overflow: 'revert',
|
|
135
|
+
position: 'relative',
|
|
129
136
|
});
|
|
130
137
|
export var Pill = createContainer('button')({
|
|
131
138
|
modelHook: usePillModel,
|
|
@@ -139,7 +146,7 @@ export var Pill = createContainer('button')({
|
|
|
139
146
|
})(function (_a, Element, model) {
|
|
140
147
|
var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, maxWidth = _a.maxWidth, elemProps = __rest(_a, ["variant", "maxWidth"]);
|
|
141
148
|
return (React.createElement(React.Fragment, null,
|
|
142
|
-
variant === 'readOnly' && (React.createElement(StyledNonInteractivePill, __assign({ maxWidth: model.state.maxWidth, as: Element !== 'button' ? Element : 'span', border: "1px solid " + colors.licorice200 }, elemProps),
|
|
149
|
+
variant === 'readOnly' && (React.createElement(StyledNonInteractivePill, __assign({ maxWidth: model.state.maxWidth, as: Element !== 'button' ? Element : 'span', border: "1px solid " + colors.licorice200, id: model.state.id }, elemProps),
|
|
143
150
|
React.createElement(PillLabel, null, elemProps.children))),
|
|
144
151
|
variant === 'default' && (React.createElement(StyledBasePill, __assign({ colors: getButtonPillColors(), as: Element }, elemProps, { disabled: model.state.disabled }),
|
|
145
152
|
React.createElement(HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center" }, React.Children.map(elemProps.children, function (child, index) {
|
|
@@ -148,7 +155,7 @@ export var Pill = createContainer('button')({
|
|
|
148
155
|
}
|
|
149
156
|
return (React.createElement(Stack.Item, { key: index, display: "inline-flex" }, child));
|
|
150
157
|
})))),
|
|
151
|
-
variant === 'removable' && (React.createElement(StyledNonInteractivePill, __assign({ colors: getRemovablePillColors(model.state.disabled), as: Element !== 'button' ? Element : 'span' }, elemProps),
|
|
158
|
+
variant === 'removable' && (React.createElement(StyledNonInteractivePill, __assign({ colors: getRemovablePillColors(model.state.disabled), as: Element !== 'button' ? Element : 'span', variant: variant }, elemProps),
|
|
152
159
|
React.createElement(HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center", justifyContent: "center" }, React.Children.map(elemProps.children, function (child, index) {
|
|
153
160
|
if (typeof child === 'string') {
|
|
154
161
|
return React.createElement(PillLabel, { key: index }, child);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillAvatar.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillAvatar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAKvD,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"PillAvatar.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillAvatar.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAS,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAKvD,eAAO,MAAM,UAAU;;;;;;;EAerB,CAAC"}
|
|
@@ -19,5 +19,5 @@ import { usePillModel } from './usePillModel';
|
|
|
19
19
|
export var PillAvatar = createSubcomponent('button')({
|
|
20
20
|
modelHook: usePillModel,
|
|
21
21
|
})(function (elemProps, Element, model) {
|
|
22
|
-
return (React.createElement(Avatar, __assign({ style: { opacity: model.state.disabled ? '.7' : '1' }, as: "div", size: 18 }, elemProps, { disabled: model.state.disabled }), elemProps.children));
|
|
22
|
+
return (React.createElement(Avatar, __assign({ style: { opacity: model.state.disabled ? '.7' : '1' }, as: "div", size: 18, altText: undefined }, elemProps, { disabled: model.state.disabled }), elemProps.children));
|
|
23
23
|
});
|
|
@@ -9,6 +9,7 @@ export interface PillIconProps extends Omit<SystemIconProps, 'icon'> {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const PillIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", PillIconProps, {
|
|
11
11
|
state: {
|
|
12
|
+
id: string;
|
|
12
13
|
maxWidth: string | number;
|
|
13
14
|
disabled: boolean;
|
|
14
15
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillIcon.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"PillIcon.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIcon.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAG9D,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IAClE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;CACzB;AAED,eAAO,MAAM,QAAQ;;;;;;;EAenB,CAAC"}
|
|
@@ -30,5 +30,5 @@ export var PillIcon = createSubcomponent('span')({
|
|
|
30
30
|
modelHook: usePillModel,
|
|
31
31
|
})(function (_a, Element) {
|
|
32
32
|
var size = _a.size, icon = _a.icon, elemProps = __rest(_a, ["size", "icon"]);
|
|
33
|
-
return (React.createElement(SystemIcon, __assign({ marginInlineStart: "-" + space.xxxs, display: "flex", as: Element, size: 20, icon: icon || plusIcon }, elemProps)));
|
|
33
|
+
return (React.createElement(SystemIcon, __assign({ marginInlineStart: "-" + space.xxxs, display: "flex", as: Element, size: 20, role: "img", "aria-label": "add", icon: icon || plusIcon }, elemProps)));
|
|
34
34
|
});
|
|
@@ -6,9 +6,15 @@ export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
|
6
6
|
* @default `xSmallIcon`
|
|
7
7
|
*/
|
|
8
8
|
icon?: CanvasSystemIcon;
|
|
9
|
+
/**
|
|
10
|
+
* The aria label for the removable icon
|
|
11
|
+
* @default 'remove'
|
|
12
|
+
*/
|
|
13
|
+
'aria-label'?: string;
|
|
9
14
|
}
|
|
10
15
|
export declare const PillIconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillIconButtonProps, {
|
|
11
16
|
state: {
|
|
17
|
+
id: string;
|
|
12
18
|
maxWidth: string | number;
|
|
13
19
|
disabled: boolean;
|
|
14
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillIconButton.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIconButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PillIconButton.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIconButton.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAG3E,OAAO,EAAC,gBAAgB,EAAC,MAAM,8BAA8B,CAAC;AAI9D,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE;;;OAGG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AA6CD,eAAO,MAAM,cAAc;;;;;;;EAgC1B,CAAC"}
|
|
@@ -25,7 +25,7 @@ import { focusRing, styled, createSubcomponent } from '@workday/canvas-kit-react
|
|
|
25
25
|
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
26
26
|
import { usePillModel } from './usePillModel';
|
|
27
27
|
import { xSmallIcon } from '@workday/canvas-system-icons-web';
|
|
28
|
-
import {
|
|
28
|
+
import { colors, space } from '@workday/canvas-kit-react/tokens';
|
|
29
29
|
import { BaseButton } from '@workday/canvas-kit-react/button';
|
|
30
30
|
var getIconColors = function () {
|
|
31
31
|
return {
|
|
@@ -41,9 +41,7 @@ var getIconColors = function () {
|
|
|
41
41
|
focus: {
|
|
42
42
|
icon: colors.licorice500,
|
|
43
43
|
focusRing: focusRing({
|
|
44
|
-
width: 0,
|
|
45
44
|
innerColor: 'transparent',
|
|
46
|
-
outerColor: 'transparent',
|
|
47
45
|
}),
|
|
48
46
|
},
|
|
49
47
|
disabled: {
|
|
@@ -52,31 +50,26 @@ var getIconColors = function () {
|
|
|
52
50
|
},
|
|
53
51
|
};
|
|
54
52
|
};
|
|
55
|
-
var StyledFocusTarget = styled('span')({
|
|
56
|
-
height: 20,
|
|
57
|
-
position: 'absolute',
|
|
58
|
-
right: '5px',
|
|
59
|
-
left: space.xxxs,
|
|
60
|
-
margin: 0,
|
|
61
|
-
borderRadius: borderRadius.m,
|
|
62
|
-
'&:focus': __assign({ outline: 'none' }, focusRing({
|
|
63
|
-
outerColor: colors.blueberry400,
|
|
64
|
-
innerColor: 'transparent',
|
|
65
|
-
separation: 0,
|
|
66
|
-
width: 2,
|
|
67
|
-
inset: 'inner',
|
|
68
|
-
})),
|
|
69
|
-
});
|
|
70
53
|
var StyledIconButton = styled(BaseButton)({
|
|
71
|
-
marginInlineEnd: '-
|
|
72
|
-
|
|
73
|
-
|
|
54
|
+
marginInlineEnd: '-7px',
|
|
55
|
+
marginInlineStart: "-2px",
|
|
56
|
+
overflow: 'visible',
|
|
57
|
+
'::after': {
|
|
58
|
+
content: '""',
|
|
59
|
+
height: space.l,
|
|
60
|
+
width: space.l,
|
|
61
|
+
position: 'absolute',
|
|
62
|
+
left: '-7px',
|
|
63
|
+
bottom: '-7px',
|
|
64
|
+
margin: 0,
|
|
65
|
+
pointerEvents: 'all',
|
|
66
|
+
cursor: 'pointer',
|
|
67
|
+
},
|
|
74
68
|
});
|
|
75
69
|
export var PillIconButton = createSubcomponent('button')({
|
|
76
70
|
modelHook: usePillModel,
|
|
77
71
|
})(function (_a, Element, model) {
|
|
78
|
-
var size = _a.size, _b = _a.icon, icon = _b === void 0 ? xSmallIcon : _b, maxWidth = _a.maxWidth, children = _a.children, elemProps = __rest(_a, ["size", "icon", "maxWidth", "children"]);
|
|
79
|
-
return (React.createElement(StyledIconButton, __assign({ borderRadius: "s", height:
|
|
80
|
-
React.createElement(
|
|
81
|
-
React.createElement(SystemIcon, { icon: icon, size: 24 })));
|
|
72
|
+
var size = _a.size, _b = _a.icon, icon = _b === void 0 ? xSmallIcon : _b, maxWidth = _a.maxWidth, children = _a.children, _c = _a["aria-label"], ariaLabel = _c === void 0 ? 'remove' : _c, elemProps = __rest(_a, ["size", "icon", "maxWidth", "children", 'aria-label']);
|
|
73
|
+
return (React.createElement(StyledIconButton, __assign({ borderRadius: "s", height: 20, width: 20, padding: "zero", disabled: model.state.disabled, colors: getIconColors(), "aria-labelledby": "removable-" + model.state.id + " label-" + model.state.id, as: Element, position: "relative" }, elemProps),
|
|
74
|
+
React.createElement(SystemIcon, { "aria-label": ariaLabel, id: "removable-" + model.state.id, icon: icon, size: space.m, "aria-hidden": true, role: "img" })));
|
|
82
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PillLabel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAKxF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;CACvD;AAQD,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"PillLabel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillLabel.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAM,QAAQ,EAAC,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAkB,oBAAoB,EAAC,MAAM,mCAAmC,CAAC;AAKxF,MAAM,WAAW,cAAe,SAAQ,QAAQ;IAC9C,YAAY,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC;CACvD;AAQD,eAAO,MAAM,SAAS;;;;;;;EAgBpB,CAAC"}
|
|
@@ -37,5 +37,5 @@ export var PillLabel = createSubcomponent('span')({
|
|
|
37
37
|
})(function (_a, Element, model) {
|
|
38
38
|
var tooltipProps = _a.tooltipProps, elemProps = __rest(_a, ["tooltipProps"]);
|
|
39
39
|
return (React.createElement(OverflowTooltip, __assign({}, tooltipProps),
|
|
40
|
-
React.createElement(StyledLabelContainer, __assign({ color: model.state.disabled ? colors.licorice100 : 'inherit', maxWidth: model.state.maxWidth, as: Element }, elemProps), elemProps.children)));
|
|
40
|
+
React.createElement(StyledLabelContainer, __assign({ color: model.state.disabled ? colors.licorice100 : 'inherit', maxWidth: model.state.maxWidth, as: Element, id: "label-" + model.state.id }, elemProps), elemProps.children)));
|
|
41
41
|
});
|
|
@@ -8,8 +8,14 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
8
8
|
* Use to disable a pill.
|
|
9
9
|
*/
|
|
10
10
|
disabled: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* ID used to add accessibility labels to pill elements.
|
|
13
|
+
* @default `useUniqueId()`
|
|
14
|
+
*/
|
|
15
|
+
id: string;
|
|
11
16
|
}> & {} & {}) | undefined) => {
|
|
12
17
|
state: {
|
|
18
|
+
id: string;
|
|
13
19
|
/**
|
|
14
20
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
15
21
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -31,7 +37,13 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
31
37
|
* Use to disable a pill.
|
|
32
38
|
*/
|
|
33
39
|
disabled: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* ID used to add accessibility labels to pill elements.
|
|
42
|
+
* @default `useUniqueId()`
|
|
43
|
+
*/
|
|
44
|
+
id: string;
|
|
34
45
|
}, {}, {
|
|
46
|
+
id: string;
|
|
35
47
|
/**
|
|
36
48
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
37
49
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -43,6 +55,7 @@ export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
|
43
55
|
disabled: boolean;
|
|
44
56
|
}, {}, {
|
|
45
57
|
state: {
|
|
58
|
+
id: string;
|
|
46
59
|
/**
|
|
47
60
|
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
48
61
|
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePillModel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/usePillModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;IAErB;;;OAGG;;IAEH;;OAEG
|
|
1
|
+
{"version":3,"file":"usePillModel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/usePillModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;IAErB;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;;QAZH;;;WAGG;;QAEH;;WAEG;;;;;IAPH;;;OAGG;;IAEH;;OAEG;;IAEH;;;OAGG;;;;IAZH;;;OAGG;;IAEH;;OAEG;;;;;QAPH;;;WAGG;;QAEH;;WAEG;;;;EAgBL,CAAC"}
|
|
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { createModelHook } from '@workday/canvas-kit-react/common';
|
|
12
|
+
import { createModelHook, useUniqueId } from '@workday/canvas-kit-react/common';
|
|
13
13
|
export var usePillModel = createModelHook({
|
|
14
14
|
defaultConfig: {
|
|
15
15
|
/**
|
|
@@ -21,8 +21,14 @@ export var usePillModel = createModelHook({
|
|
|
21
21
|
* Use to disable a pill.
|
|
22
22
|
*/
|
|
23
23
|
disabled: false,
|
|
24
|
+
/**
|
|
25
|
+
* ID used to add accessibility labels to pill elements.
|
|
26
|
+
* @default `useUniqueId()`
|
|
27
|
+
*/
|
|
28
|
+
id: '',
|
|
24
29
|
},
|
|
25
30
|
})(function (config) {
|
|
26
|
-
var
|
|
31
|
+
var id = useUniqueId(config.id);
|
|
32
|
+
var state = __assign(__assign({}, config), { id: id });
|
|
27
33
|
return { state: state, events: {} };
|
|
28
34
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-preview-react",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.118-next.1+d45e9ab1",
|
|
4
4
|
"description": "Canvas Kit Preview is made up of components that have the full design and a11y review, are part of the DS ecosystem and are approved for use in product. The API's could be subject to change, but not without strong communication and migration strategies.",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
"types": "dist/es6/index.d.ts",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "
|
|
13
|
+
"url": "https://github.com/workday/canvas-kit.git",
|
|
14
|
+
"directory": "modules/preview-react"
|
|
14
15
|
},
|
|
15
16
|
"files": [
|
|
16
17
|
"*/package.json",
|
|
@@ -45,15 +46,15 @@
|
|
|
45
46
|
"dependencies": {
|
|
46
47
|
"@emotion/react": "^11.7.1",
|
|
47
48
|
"@emotion/styled": "^11.6.0",
|
|
48
|
-
"@workday/canvas-kit-react": "^8.0.0-alpha.
|
|
49
|
+
"@workday/canvas-kit-react": "^8.0.0-alpha.118-next.1+d45e9ab1",
|
|
49
50
|
"@workday/canvas-system-icons-web": "^3.0.0",
|
|
50
|
-
"@workday/design-assets-types": "^0.2.
|
|
51
|
+
"@workday/design-assets-types": "^0.2.8"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@workday/canvas-accent-icons-web": "^3.0.0",
|
|
54
|
-
"@workday/canvas-kit-labs-react": "^8.0.0-alpha.
|
|
55
|
+
"@workday/canvas-kit-labs-react": "^8.0.0-alpha.118-next.1+d45e9ab1",
|
|
55
56
|
"formik": "^2.2.9",
|
|
56
57
|
"yup": "^0.31.1"
|
|
57
58
|
},
|
|
58
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "d45e9ab1446a7c0c4bf7403f0c75db8d3793d4f1"
|
|
59
60
|
}
|
package/pill/lib/Pill.tsx
CHANGED
|
@@ -92,6 +92,7 @@ const getRemovablePillColors = (disabled?: boolean) => {
|
|
|
92
92
|
icon: colors.licorice200,
|
|
93
93
|
background: colors.soap300,
|
|
94
94
|
label: colors.blackPepper400,
|
|
95
|
+
|
|
95
96
|
focusRing: focusRing({
|
|
96
97
|
width: 0,
|
|
97
98
|
innerColor: 'transparent',
|
|
@@ -124,7 +125,6 @@ const StyledBasePill = styled(BaseButton.as('button'))<StyledType & PillProps>(
|
|
|
124
125
|
{
|
|
125
126
|
...pillBaseStyles,
|
|
126
127
|
'&:focus': {
|
|
127
|
-
borderColor: colors.blueberry400,
|
|
128
128
|
'span[data-count="ck-pill-count"]': {
|
|
129
129
|
borderTop: `1px solid ${colors.blueberry400}`,
|
|
130
130
|
borderBottom: `1px solid ${colors.blueberry400}`,
|
|
@@ -146,12 +146,18 @@ const StyledBasePill = styled(BaseButton.as('button'))<StyledType & PillProps>(
|
|
|
146
146
|
},
|
|
147
147
|
}),
|
|
148
148
|
},
|
|
149
|
+
({variant}) => ({
|
|
150
|
+
'&:focus': {
|
|
151
|
+
borderColor: variant === 'removable' ? undefined : colors.blueberry400,
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
149
154
|
boxStyleFn
|
|
150
155
|
);
|
|
151
156
|
|
|
152
|
-
const StyledNonInteractivePill = styled(StyledBasePill)({
|
|
157
|
+
const StyledNonInteractivePill = styled(StyledBasePill)<StyledType>({
|
|
153
158
|
cursor: 'default',
|
|
154
159
|
overflow: 'revert', // override BaseButton overflow styles so the click target exists outside the pill for removable
|
|
160
|
+
position: 'relative',
|
|
155
161
|
});
|
|
156
162
|
|
|
157
163
|
export const Pill = createContainer('button')({
|
|
@@ -171,6 +177,7 @@ export const Pill = createContainer('button')({
|
|
|
171
177
|
maxWidth={model.state.maxWidth}
|
|
172
178
|
as={Element !== 'button' ? Element : 'span'}
|
|
173
179
|
border={`1px solid ${colors.licorice200}`}
|
|
180
|
+
id={model.state.id}
|
|
174
181
|
{...elemProps}
|
|
175
182
|
>
|
|
176
183
|
<PillLabel>{elemProps.children}</PillLabel>
|
|
@@ -201,6 +208,7 @@ export const Pill = createContainer('button')({
|
|
|
201
208
|
<StyledNonInteractivePill
|
|
202
209
|
colors={getRemovablePillColors(model.state.disabled)}
|
|
203
210
|
as={Element !== 'button' ? Element : 'span'}
|
|
211
|
+
variant={variant}
|
|
204
212
|
{...elemProps}
|
|
205
213
|
>
|
|
206
214
|
<HStack spacing="xxxs" display="inline-flex" alignItems="center" justifyContent="center">
|
package/pill/lib/PillAvatar.tsx
CHANGED
package/pill/lib/PillIcon.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import {SystemIcon, SystemIconProps} from '@workday/canvas-kit-react/icon';
|
|
|
6
6
|
import {usePillModel} from './usePillModel';
|
|
7
7
|
import {xSmallIcon} from '@workday/canvas-system-icons-web';
|
|
8
8
|
import {CanvasSystemIcon} from '@workday/design-assets-types';
|
|
9
|
-
import {
|
|
9
|
+
import {colors, space} from '@workday/canvas-kit-react/tokens';
|
|
10
10
|
import {BaseButton} from '@workday/canvas-kit-react/button';
|
|
11
11
|
|
|
12
12
|
export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
@@ -15,6 +15,11 @@ export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
|
15
15
|
* @default `xSmallIcon`
|
|
16
16
|
*/
|
|
17
17
|
icon?: CanvasSystemIcon;
|
|
18
|
+
/**
|
|
19
|
+
* The aria label for the removable icon
|
|
20
|
+
* @default 'remove'
|
|
21
|
+
*/
|
|
22
|
+
'aria-label'?: string;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
const getIconColors = () => {
|
|
@@ -33,9 +38,7 @@ const getIconColors = () => {
|
|
|
33
38
|
icon: colors.licorice500,
|
|
34
39
|
|
|
35
40
|
focusRing: focusRing({
|
|
36
|
-
width: 0,
|
|
37
41
|
innerColor: 'transparent',
|
|
38
|
-
outerColor: 'transparent',
|
|
39
42
|
}),
|
|
40
43
|
},
|
|
41
44
|
disabled: {
|
|
@@ -45,51 +48,52 @@ const getIconColors = () => {
|
|
|
45
48
|
};
|
|
46
49
|
};
|
|
47
50
|
|
|
48
|
-
const StyledFocusTarget = styled('span')<StyledType & PillIconButtonProps>({
|
|
49
|
-
height: 20,
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
right: '5px',
|
|
52
|
-
left: space.xxxs,
|
|
53
|
-
margin: 0,
|
|
54
|
-
borderRadius: borderRadius.m,
|
|
55
|
-
'&:focus': {
|
|
56
|
-
outline: 'none',
|
|
57
|
-
...focusRing({
|
|
58
|
-
outerColor: colors.blueberry400,
|
|
59
|
-
innerColor: 'transparent',
|
|
60
|
-
separation: 0,
|
|
61
|
-
width: 2,
|
|
62
|
-
inset: 'inner',
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
65
|
-
});
|
|
66
|
-
|
|
67
51
|
const StyledIconButton = styled(BaseButton)<StyledType & PillIconButtonProps>({
|
|
68
|
-
marginInlineEnd: '-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
marginInlineEnd: '-7px', // visually pull in the pill to the right size
|
|
53
|
+
marginInlineStart: `-2px`, // visually create space between label and the button
|
|
54
|
+
overflow: 'visible',
|
|
55
|
+
'::after': {
|
|
56
|
+
content: '""',
|
|
57
|
+
height: space.l,
|
|
58
|
+
width: space.l,
|
|
59
|
+
position: 'absolute',
|
|
60
|
+
left: '-7px',
|
|
61
|
+
bottom: '-7px',
|
|
62
|
+
margin: 0,
|
|
63
|
+
pointerEvents: 'all',
|
|
64
|
+
cursor: 'pointer',
|
|
65
|
+
},
|
|
71
66
|
});
|
|
72
67
|
|
|
73
68
|
export const PillIconButton = createSubcomponent('button')({
|
|
74
69
|
modelHook: usePillModel,
|
|
75
70
|
})<PillIconButtonProps>(
|
|
76
|
-
(
|
|
71
|
+
(
|
|
72
|
+
{size, icon = xSmallIcon, maxWidth, children, 'aria-label': ariaLabel = 'remove', ...elemProps},
|
|
73
|
+
Element,
|
|
74
|
+
model
|
|
75
|
+
) => {
|
|
77
76
|
return (
|
|
78
77
|
<StyledIconButton
|
|
79
78
|
borderRadius="s"
|
|
80
|
-
height={
|
|
81
|
-
width={
|
|
79
|
+
height={20}
|
|
80
|
+
width={20}
|
|
82
81
|
padding="zero"
|
|
83
82
|
disabled={model.state.disabled}
|
|
84
83
|
colors={getIconColors()}
|
|
85
|
-
|
|
84
|
+
aria-labelledby={`removable-${model.state.id} label-${model.state.id}`}
|
|
86
85
|
as={Element}
|
|
87
86
|
position="relative"
|
|
88
87
|
{...elemProps}
|
|
89
88
|
>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
<SystemIcon
|
|
90
|
+
aria-label={ariaLabel}
|
|
91
|
+
id={`removable-${model.state.id}`}
|
|
92
|
+
icon={icon}
|
|
93
|
+
size={space.m}
|
|
94
|
+
aria-hidden // This works for Chrome but not needed in Safari
|
|
95
|
+
role="img"
|
|
96
|
+
/>
|
|
93
97
|
</StyledIconButton>
|
|
94
98
|
);
|
|
95
99
|
}
|
package/pill/lib/PillLabel.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {createModelHook} from '@workday/canvas-kit-react/common';
|
|
1
|
+
import {createModelHook, useUniqueId} from '@workday/canvas-kit-react/common';
|
|
2
2
|
|
|
3
3
|
export const usePillModel = createModelHook({
|
|
4
4
|
defaultConfig: {
|
|
@@ -11,10 +11,17 @@ export const usePillModel = createModelHook({
|
|
|
11
11
|
* Use to disable a pill.
|
|
12
12
|
*/
|
|
13
13
|
disabled: false,
|
|
14
|
+
/**
|
|
15
|
+
* ID used to add accessibility labels to pill elements.
|
|
16
|
+
* @default `useUniqueId()`
|
|
17
|
+
*/
|
|
18
|
+
id: '',
|
|
14
19
|
},
|
|
15
20
|
})(config => {
|
|
21
|
+
const id = useUniqueId(config.id);
|
|
16
22
|
const state = {
|
|
17
23
|
...config,
|
|
24
|
+
id,
|
|
18
25
|
};
|
|
19
26
|
|
|
20
27
|
return {state, events: {}};
|