@workday/canvas-kit-preview-react 7.0.0-alpha.95-next.21 → 7.0.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/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/pill/index.d.ts +3 -0
- package/dist/commonjs/pill/index.d.ts.map +1 -0
- package/dist/commonjs/pill/index.js +14 -0
- package/dist/commonjs/pill/lib/Pill.d.ts +58 -0
- package/dist/commonjs/pill/lib/Pill.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/Pill.js +164 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts +11 -0
- package/dist/commonjs/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillAvatar.js +29 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts +5 -0
- package/dist/commonjs/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillCount.js +45 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts +17 -0
- package/dist/commonjs/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIcon.js +40 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts +17 -0
- package/dist/commonjs/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillIconButton.js +88 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts +13 -0
- package/dist/commonjs/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/PillLabel.js +47 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts +58 -0
- package/dist/commonjs/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/commonjs/pill/lib/usePillModel.js +31 -0
- package/dist/commonjs/select/index.d.ts +1 -1
- package/dist/commonjs/select/index.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectBase.d.ts +20 -1
- package/dist/commonjs/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/commonjs/select/lib/SelectBase.js +6 -4
- 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/pill/index.d.ts +3 -0
- package/dist/es6/pill/index.d.ts.map +1 -0
- package/dist/es6/pill/index.js +2 -0
- package/dist/es6/pill/lib/Pill.d.ts +58 -0
- package/dist/es6/pill/lib/Pill.d.ts.map +1 -0
- package/dist/es6/pill/lib/Pill.js +158 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts +12 -0
- package/dist/es6/pill/lib/PillAvatar.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillAvatar.js +23 -0
- package/dist/es6/pill/lib/PillCount.d.ts +5 -0
- package/dist/es6/pill/lib/PillCount.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillCount.js +39 -0
- package/dist/es6/pill/lib/PillIcon.d.ts +18 -0
- package/dist/es6/pill/lib/PillIcon.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIcon.js +34 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts +18 -0
- package/dist/es6/pill/lib/PillIconButton.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillIconButton.js +82 -0
- package/dist/es6/pill/lib/PillLabel.d.ts +14 -0
- package/dist/es6/pill/lib/PillLabel.d.ts.map +1 -0
- package/dist/es6/pill/lib/PillLabel.js +41 -0
- package/dist/es6/pill/lib/usePillModel.d.ts +58 -0
- package/dist/es6/pill/lib/usePillModel.d.ts.map +1 -0
- package/dist/es6/pill/lib/usePillModel.js +28 -0
- package/dist/es6/select/index.d.ts +1 -1
- package/dist/es6/select/index.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectBase.d.ts +20 -1
- package/dist/es6/select/lib/SelectBase.d.ts.map +1 -1
- package/dist/es6/select/lib/SelectBase.js +6 -4
- package/index.ts +1 -0
- package/package.json +4 -4
- package/pill/LICENSE +52 -0
- package/pill/README.md +5 -0
- package/pill/index.ts +2 -0
- package/pill/lib/Pill.tsx +218 -0
- package/pill/lib/PillAvatar.tsx +26 -0
- package/pill/lib/PillCount.tsx +39 -0
- package/pill/lib/PillIcon.tsx +32 -0
- package/pill/lib/PillIconButton.tsx +96 -0
- package/pill/lib/PillLabel.tsx +35 -0
- package/pill/lib/usePillModel.tsx +21 -0
- package/pill/package.json +5 -0
- package/select/index.ts +6 -1
- package/select/lib/SelectBase.tsx +27 -3
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export declare const usePillModel: (<TT_Special_Generic>(config?: (Partial<{
|
|
2
|
+
/**
|
|
3
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
4
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
5
|
+
*/
|
|
6
|
+
maxWidth: string | number;
|
|
7
|
+
/**
|
|
8
|
+
* Use to disable a pill.
|
|
9
|
+
*/
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
}> & {} & {}) | undefined) => {
|
|
12
|
+
state: {
|
|
13
|
+
/**
|
|
14
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
15
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
16
|
+
*/
|
|
17
|
+
maxWidth: string | number;
|
|
18
|
+
/**
|
|
19
|
+
* Use to disable a pill.
|
|
20
|
+
*/
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
};
|
|
23
|
+
events: {};
|
|
24
|
+
}) & import("@workday/canvas-kit-react/common").ModelExtras<{
|
|
25
|
+
/**
|
|
26
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
27
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
28
|
+
*/
|
|
29
|
+
maxWidth: string | number;
|
|
30
|
+
/**
|
|
31
|
+
* Use to disable a pill.
|
|
32
|
+
*/
|
|
33
|
+
disabled: boolean;
|
|
34
|
+
}, {}, {
|
|
35
|
+
/**
|
|
36
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
37
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
38
|
+
*/
|
|
39
|
+
maxWidth: string | number;
|
|
40
|
+
/**
|
|
41
|
+
* Use to disable a pill.
|
|
42
|
+
*/
|
|
43
|
+
disabled: boolean;
|
|
44
|
+
}, {}, {
|
|
45
|
+
state: {
|
|
46
|
+
/**
|
|
47
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
48
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
49
|
+
*/
|
|
50
|
+
maxWidth: string | number;
|
|
51
|
+
/**
|
|
52
|
+
* Use to disable a pill.
|
|
53
|
+
*/
|
|
54
|
+
disabled: boolean;
|
|
55
|
+
};
|
|
56
|
+
events: {};
|
|
57
|
+
}>;
|
|
58
|
+
//# sourceMappingURL=usePillModel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePillModel.d.ts","sourceRoot":"","sources":["../../../../pill/lib/usePillModel.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;IAErB;;;OAGG;;IAEH;;OAEG;;;;QAPH;;;WAGG;;QAEH;;WAEG;;;;;IAPH;;;OAGG;;IAEH;;OAEG;;;IAPH;;;OAGG;;IAEH;;OAEG;;;;QAPH;;;WAGG;;QAEH;;WAEG;;;;EASL,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.usePillModel = void 0;
|
|
15
|
+
var common_1 = require("@workday/canvas-kit-react/common");
|
|
16
|
+
exports.usePillModel = common_1.createModelHook({
|
|
17
|
+
defaultConfig: {
|
|
18
|
+
/**
|
|
19
|
+
* Determines the max width of the pill. If the pill text is longer than the max width,
|
|
20
|
+
* text will be truncated and a tooltip will show the rest of the content when hovered over
|
|
21
|
+
*/
|
|
22
|
+
maxWidth: 200,
|
|
23
|
+
/**
|
|
24
|
+
* Use to disable a pill.
|
|
25
|
+
*/
|
|
26
|
+
disabled: false,
|
|
27
|
+
},
|
|
28
|
+
})(function (config) {
|
|
29
|
+
var state = __assign({}, config);
|
|
30
|
+
return { state: state, events: {} };
|
|
31
|
+
});
|
|
@@ -2,5 +2,5 @@ import Select from './lib/Select';
|
|
|
2
2
|
export default Select;
|
|
3
3
|
export { Select };
|
|
4
4
|
export * from './lib/Select';
|
|
5
|
-
export { Option, RenderableOption, RenderOptionFunction } from './lib/SelectBase';
|
|
5
|
+
export { Option, RenderableOption, RenderOptionFunction, RenderSelectedFunction, } from './lib/SelectBase';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../select/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,eAAe,MAAM,CAAC;AACtB,OAAO,EAAC,MAAM,EAAC,CAAC;AAChB,cAAc,cAAc,CAAC;AAE7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../select/index.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC,eAAe,MAAM,CAAC;AACtB,OAAO,EAAC,MAAM,EAAC,CAAC;AAChB,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,MAAM,EACN,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC"}
|
|
@@ -17,6 +17,9 @@ export interface NormalizedOption extends Option {
|
|
|
17
17
|
id: string;
|
|
18
18
|
label: string;
|
|
19
19
|
}
|
|
20
|
+
export interface RenderSelectedFunction {
|
|
21
|
+
(option: NormalizedOption): React.ReactNode;
|
|
22
|
+
}
|
|
20
23
|
export interface RenderableOption extends NormalizedOption {
|
|
21
24
|
focused: boolean;
|
|
22
25
|
selected: boolean;
|
|
@@ -47,6 +50,22 @@ export interface CoreSelectBaseProps extends Themeable, GrowthBehavior, Pick<Rea
|
|
|
47
50
|
* @default defaultRenderOption
|
|
48
51
|
*/
|
|
49
52
|
renderOption?: RenderOptionFunction;
|
|
53
|
+
/**
|
|
54
|
+
* The function called to render the selected option.
|
|
55
|
+
*
|
|
56
|
+
* The `option` argument passed to the function is an object which contains the following:
|
|
57
|
+
*
|
|
58
|
+
* * `data: object` (data object carried over from the corresponding option originally passed into the component)
|
|
59
|
+
* * `disabled: boolean`
|
|
60
|
+
* * `id: string`
|
|
61
|
+
* * `label: string`
|
|
62
|
+
* * `value: string`
|
|
63
|
+
*
|
|
64
|
+
* If you omit the `renderSelected` prop, each option will be rendered using a `defaultRenderSelected` function provided by the component.
|
|
65
|
+
*
|
|
66
|
+
* @default defaultRenderSelected
|
|
67
|
+
*/
|
|
68
|
+
renderSelected?: RenderSelectedFunction;
|
|
50
69
|
/**
|
|
51
70
|
* The value of the Select.
|
|
52
71
|
*/
|
|
@@ -118,6 +137,6 @@ export interface SelectBaseProps extends CoreSelectBaseProps, StyledType {
|
|
|
118
137
|
}
|
|
119
138
|
export declare const buttonBorderWidth = 1;
|
|
120
139
|
export declare const buttonDefaultWidth = 280;
|
|
121
|
-
declare const SelectBase: ({ "aria-labelledby": ariaLabelledBy, "aria-required": ariaRequired, as, forwardedButtonRef, localButtonRef, disabled, error, focusedOptionIndex, grow, inputRef, menuPlacement, menuRef, menuVisibility, onChange, onKeyDown, onClose, onOptionSelection, options, renderOption, required, shouldMenuAutoFlip, shouldMenuAutoFocus, value, ...elemProps }: SelectBaseProps) => JSX.Element;
|
|
140
|
+
declare const SelectBase: ({ "aria-labelledby": ariaLabelledBy, "aria-required": ariaRequired, as, forwardedButtonRef, localButtonRef, disabled, error, focusedOptionIndex, grow, inputRef, menuPlacement, menuRef, menuVisibility, onChange, onKeyDown, onClose, onOptionSelection, options, renderOption, renderSelected, required, shouldMenuAutoFlip, shouldMenuAutoFocus, value, ...elemProps }: SelectBaseProps) => JSX.Element;
|
|
122
141
|
export default SelectBase;
|
|
123
142
|
//# sourceMappingURL=SelectBase.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBase.d.ts","sourceRoot":"","sources":["../../../../select/lib/SelectBase.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,OAAO,EACL,cAAc,EACd,SAAS,EACT,UAAU,EACV,SAAS,EAIV,MAAM,kCAAkC,CAAC;AAe1C,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAGtD,UAAU,UAAU;IAIlB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,MAAM;IAE9C,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,CAAC,MAA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AC9D;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;OAEG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C;;;;;;;OAOG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,kBAAkB,MAAM,CAAC;AA8GtC,QAAA,MAAM,UAAU,8WA0Bb,eAAe,gBAgKjB,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -126,10 +126,13 @@ var SelectWrapper = common_1.styled('div')({
|
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
var defaultRenderOption = function (option) {
|
|
129
|
-
return react_1.default.createElement("div", null, option
|
|
129
|
+
return react_1.default.createElement("div", null, defaultRenderSelected(option));
|
|
130
|
+
};
|
|
131
|
+
var defaultRenderSelected = function (option) {
|
|
132
|
+
return option.label;
|
|
130
133
|
};
|
|
131
134
|
var SelectBase = function (_a) {
|
|
132
|
-
var ariaLabelledBy = _a["aria-labelledby"], ariaRequired = _a["aria-required"], as = _a.as, forwardedButtonRef = _a.forwardedButtonRef, localButtonRef = _a.localButtonRef, disabled = _a.disabled, error = _a.error, _b = _a.focusedOptionIndex, focusedOptionIndex = _b === void 0 ? 0 : _b, grow = _a.grow, inputRef = _a.inputRef, _c = _a.menuPlacement, menuPlacement = _c === void 0 ? 'bottom' : _c, menuRef = _a.menuRef, _d = _a.menuVisibility, menuVisibility = _d === void 0 ? 'closed' : _d, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onClose = _a.onClose, onOptionSelection = _a.onOptionSelection, options = _a.options, _e = _a.renderOption, renderOption = _e === void 0 ? defaultRenderOption : _e, required = _a.required,
|
|
135
|
+
var ariaLabelledBy = _a["aria-labelledby"], ariaRequired = _a["aria-required"], as = _a.as, forwardedButtonRef = _a.forwardedButtonRef, localButtonRef = _a.localButtonRef, disabled = _a.disabled, error = _a.error, _b = _a.focusedOptionIndex, focusedOptionIndex = _b === void 0 ? 0 : _b, grow = _a.grow, inputRef = _a.inputRef, _c = _a.menuPlacement, menuPlacement = _c === void 0 ? 'bottom' : _c, menuRef = _a.menuRef, _d = _a.menuVisibility, menuVisibility = _d === void 0 ? 'closed' : _d, onChange = _a.onChange, onKeyDown = _a.onKeyDown, onClose = _a.onClose, onOptionSelection = _a.onOptionSelection, options = _a.options, _e = _a.renderOption, renderOption = _e === void 0 ? defaultRenderOption : _e, _f = _a.renderSelected, renderSelected = _f === void 0 ? defaultRenderSelected : _f, required = _a.required, _g = _a.shouldMenuAutoFlip, shouldMenuAutoFlip = _g === void 0 ? true : _g, _h = _a.shouldMenuAutoFocus, shouldMenuAutoFocus = _h === void 0 ? true : _h, value = _a.value, elemProps = __rest(_a, ['aria-labelledby', 'aria-required', "as", "forwardedButtonRef", "localButtonRef", "disabled", "error", "focusedOptionIndex", "grow", "inputRef", "menuPlacement", "menuRef", "menuVisibility", "onChange", "onKeyDown", "onClose", "onOptionSelection", "options", "renderOption", "renderSelected", "required", "shouldMenuAutoFlip", "shouldMenuAutoFocus", "value"]);
|
|
133
136
|
var focusedOptionRef = react_1.default.useRef(null);
|
|
134
137
|
var menuId = common_1.useUniqueId();
|
|
135
138
|
var renderOptions = function (renderOption) {
|
|
@@ -204,7 +207,6 @@ var SelectBase = function (_a) {
|
|
|
204
207
|
// Do a bit of error-checking in case options weren't provided
|
|
205
208
|
var hasOptions = options.length > 0;
|
|
206
209
|
var selectedOption = hasOptions ? options[utils_1.getCorrectedIndexByValue(options, value)] : null;
|
|
207
|
-
var selectedOptionLabel = selectedOption ? selectedOption.label : '';
|
|
208
210
|
var selectedOptionValue = selectedOption ? selectedOption.value : '';
|
|
209
211
|
return (react_1.default.createElement(SelectWrapper, { grow: grow, disabled: disabled },
|
|
210
212
|
react_1.default.createElement(SelectButton, __assign({ "aria-expanded": menuVisibility !== 'closed' ? 'true' : undefined, "aria-haspopup": "listbox", "aria-controls": menuVisibility !== 'closed' ? menuId : undefined, as: as, disabled: disabled, error: error, grow: grow, menuVisibility: menuVisibility, onKeyDown: onKeyDown,
|
|
@@ -213,7 +215,7 @@ var SelectBase = function (_a) {
|
|
|
213
215
|
// the menu)
|
|
214
216
|
onKeyUp: function (e) {
|
|
215
217
|
e.preventDefault();
|
|
216
|
-
}, ref: forwardedButtonRef, type: "button", value: selectedOptionValue }, elemProps),
|
|
218
|
+
}, ref: forwardedButtonRef, type: "button", value: selectedOptionValue }, elemProps), !!selectedOption && renderSelected(selectedOption)),
|
|
217
219
|
react_1.default.createElement(SelectInput, { onChange: onChange, ref: inputRef, type: "text", value: selectedOptionValue }),
|
|
218
220
|
hasOptions && menuVisibility !== 'closed' && (react_1.default.createElement(SelectMenu_1.default, { "aria-activedescendant": options[focusedOptionIndex].id, "aria-labelledby": ariaLabelledBy, "aria-required": ariaRequired || required ? true : undefined, buttonRef: localButtonRef, id: menuId, error: error, menuRef: menuRef, onKeyDown: onKeyDown, onClose: onClose, placement: menuPlacement, shouldAutoFlip: shouldMenuAutoFlip, shouldAutoFocus: shouldMenuAutoFocus, visibility: menuVisibility }, renderOptions(renderOption))),
|
|
219
221
|
react_1.default.createElement(SelectMenuIcon, { className: "menu-icon", icon: canvas_system_icons_web_1.caretDownSmallIcon, color: disabled ? tokens_1.colors.licorice100 : tokens_1.colors.licorice200, colorHover: disabled ? tokens_1.colors.licorice100 : tokens_1.colors.licorice500, size: menuIconSize })));
|
package/dist/es6/index.d.ts
CHANGED
package/dist/es6/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
package/dist/es6/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../pill/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BoxProps } from '@workday/canvas-kit-react/layout';
|
|
3
|
+
export interface PillProps extends BoxProps {
|
|
4
|
+
/**
|
|
5
|
+
* Defines what kind of pill to render stylistically and its interaction states
|
|
6
|
+
* @default 'default'
|
|
7
|
+
*/
|
|
8
|
+
variant?: 'default' | 'readOnly' | 'removable';
|
|
9
|
+
}
|
|
10
|
+
export declare const Pill: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillProps & Partial<{
|
|
11
|
+
maxWidth: React.ReactText;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
}> & {} & {}, {
|
|
14
|
+
state: {
|
|
15
|
+
maxWidth: React.ReactText;
|
|
16
|
+
disabled: boolean;
|
|
17
|
+
};
|
|
18
|
+
events: {};
|
|
19
|
+
}> & {
|
|
20
|
+
Context: React.Context<{
|
|
21
|
+
state: {
|
|
22
|
+
maxWidth: React.ReactText;
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
};
|
|
25
|
+
events: {};
|
|
26
|
+
}>;
|
|
27
|
+
} & {
|
|
28
|
+
Icon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillIcon").PillIconProps, {
|
|
29
|
+
state: {
|
|
30
|
+
maxWidth: React.ReactText;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
};
|
|
33
|
+
events: {};
|
|
34
|
+
}>;
|
|
35
|
+
Avatar: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillAvatar").PillAvatarProps, {
|
|
36
|
+
state: {
|
|
37
|
+
maxWidth: React.ReactText;
|
|
38
|
+
disabled: boolean;
|
|
39
|
+
};
|
|
40
|
+
events: {};
|
|
41
|
+
}>;
|
|
42
|
+
Count: import("@workday/canvas-kit-react/common").ElementComponent<"span", import("./PillCount").PillCountProps>;
|
|
43
|
+
Label: import("@workday/canvas-kit-react/common").ElementComponentM<"span", import("./PillLabel").PillLabelProps, {
|
|
44
|
+
state: {
|
|
45
|
+
maxWidth: React.ReactText;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
};
|
|
48
|
+
events: {};
|
|
49
|
+
}>;
|
|
50
|
+
IconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", import("./PillIconButton").PillIconButtonProps, {
|
|
51
|
+
state: {
|
|
52
|
+
maxWidth: React.ReactText;
|
|
53
|
+
disabled: boolean;
|
|
54
|
+
};
|
|
55
|
+
events: {};
|
|
56
|
+
}>;
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=Pill.d.ts.map
|
|
@@ -0,0 +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;AAgID,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Df,CAAC"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { BaseButton } from '@workday/canvas-kit-react/button';
|
|
25
|
+
import { createContainer, focusRing, mouseFocusBehavior, styled, } from '@workday/canvas-kit-react/common';
|
|
26
|
+
import { boxStyleFn, HStack, Stack } from '@workday/canvas-kit-react/layout';
|
|
27
|
+
import { borderRadius, colors, space, type } from '@workday/canvas-kit-react/tokens';
|
|
28
|
+
import { usePillModel } from './usePillModel';
|
|
29
|
+
import { PillIcon } from './PillIcon';
|
|
30
|
+
import { PillIconButton } from './PillIconButton';
|
|
31
|
+
import { PillCount } from './PillCount';
|
|
32
|
+
import { PillAvatar } from './PillAvatar';
|
|
33
|
+
import { PillLabel } from './PillLabel';
|
|
34
|
+
var getButtonPillColors = function () {
|
|
35
|
+
return {
|
|
36
|
+
default: {
|
|
37
|
+
background: colors.soap300,
|
|
38
|
+
icon: colors.licorice200,
|
|
39
|
+
label: colors.blackPepper400,
|
|
40
|
+
border: colors.licorice200,
|
|
41
|
+
},
|
|
42
|
+
hover: {
|
|
43
|
+
icon: colors.licorice500,
|
|
44
|
+
background: colors.soap400,
|
|
45
|
+
border: colors.licorice400,
|
|
46
|
+
},
|
|
47
|
+
active: {
|
|
48
|
+
icon: colors.licorice500,
|
|
49
|
+
background: colors.soap500,
|
|
50
|
+
border: colors.licorice500,
|
|
51
|
+
},
|
|
52
|
+
focus: {
|
|
53
|
+
icon: colors.licorice500,
|
|
54
|
+
background: colors.soap300,
|
|
55
|
+
border: colors.blueberry400,
|
|
56
|
+
focusRing: focusRing({
|
|
57
|
+
width: 0,
|
|
58
|
+
inset: 'inner',
|
|
59
|
+
innerColor: colors.blueberry400,
|
|
60
|
+
outerColor: colors.blueberry400,
|
|
61
|
+
separation: 1,
|
|
62
|
+
}),
|
|
63
|
+
},
|
|
64
|
+
disabled: {
|
|
65
|
+
icon: colors.licorice100,
|
|
66
|
+
label: colors.licorice100,
|
|
67
|
+
background: colors.soap100,
|
|
68
|
+
border: colors.licorice100,
|
|
69
|
+
opacity: '1',
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
var getRemovablePillColors = function (disabled) {
|
|
74
|
+
return {
|
|
75
|
+
default: {
|
|
76
|
+
background: disabled ? colors.soap100 : colors.soap300,
|
|
77
|
+
icon: disabled ? colors.licorice100 : colors.licorice200,
|
|
78
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
79
|
+
border: disabled ? colors.licorice100 : colors.licorice200,
|
|
80
|
+
},
|
|
81
|
+
hover: {
|
|
82
|
+
icon: disabled ? colors.licorice100 : colors.licorice500,
|
|
83
|
+
background: disabled ? colors.soap100 : colors.soap300,
|
|
84
|
+
border: disabled ? colors.licorice100 : colors.licorice200,
|
|
85
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
86
|
+
},
|
|
87
|
+
active: {
|
|
88
|
+
icon: disabled ? colors.licorice100 : colors.licorice500,
|
|
89
|
+
background: disabled ? colors.soap100 : colors.soap500,
|
|
90
|
+
border: disabled ? colors.licorice100 : colors.licorice500,
|
|
91
|
+
label: disabled ? colors.licorice100 : colors.blackPepper400,
|
|
92
|
+
},
|
|
93
|
+
focus: {
|
|
94
|
+
icon: colors.licorice200,
|
|
95
|
+
background: colors.soap300,
|
|
96
|
+
label: colors.blackPepper400,
|
|
97
|
+
focusRing: focusRing({
|
|
98
|
+
width: 0,
|
|
99
|
+
innerColor: 'transparent',
|
|
100
|
+
outerColor: 'transparent',
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
103
|
+
disabled: {},
|
|
104
|
+
};
|
|
105
|
+
};
|
|
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
|
+
var StyledBasePill = styled(BaseButton.as('button'))(__assign(__assign(__assign({}, pillBaseStyles), { '&:focus': {
|
|
108
|
+
borderColor: colors.blueberry400,
|
|
109
|
+
'span[data-count="ck-pill-count"]': {
|
|
110
|
+
borderTop: "1px solid " + colors.blueberry400,
|
|
111
|
+
borderBottom: "1px solid " + colors.blueberry400,
|
|
112
|
+
borderRight: "1px solid " + colors.blueberry400,
|
|
113
|
+
},
|
|
114
|
+
}, '&:active, &:active:hover, &:active:focus': {
|
|
115
|
+
'span[data-count="ck-pill-count"]': {
|
|
116
|
+
backgroundColor: colors.soap600,
|
|
117
|
+
border: 'none',
|
|
118
|
+
},
|
|
119
|
+
} }), mouseFocusBehavior({
|
|
120
|
+
'&:focus': {
|
|
121
|
+
'span[data-count="ck-pill-count"]': {
|
|
122
|
+
border: 'none',
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
})), boxStyleFn);
|
|
126
|
+
var StyledNonInteractivePill = styled(StyledBasePill)({
|
|
127
|
+
cursor: 'default',
|
|
128
|
+
overflow: 'revert',
|
|
129
|
+
});
|
|
130
|
+
export var Pill = createContainer('button')({
|
|
131
|
+
modelHook: usePillModel,
|
|
132
|
+
subComponents: {
|
|
133
|
+
Icon: PillIcon,
|
|
134
|
+
Avatar: PillAvatar,
|
|
135
|
+
Count: PillCount,
|
|
136
|
+
Label: PillLabel,
|
|
137
|
+
IconButton: PillIconButton,
|
|
138
|
+
},
|
|
139
|
+
})(function (_a, Element, model) {
|
|
140
|
+
var _b = _a.variant, variant = _b === void 0 ? 'default' : _b, maxWidth = _a.maxWidth, elemProps = __rest(_a, ["variant", "maxWidth"]);
|
|
141
|
+
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),
|
|
143
|
+
React.createElement(PillLabel, null, elemProps.children))),
|
|
144
|
+
variant === 'default' && (React.createElement(StyledBasePill, __assign({ colors: getButtonPillColors(), as: Element }, elemProps, { disabled: model.state.disabled }),
|
|
145
|
+
React.createElement(HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center" }, React.Children.map(elemProps.children, function (child, index) {
|
|
146
|
+
if (typeof child === 'string') {
|
|
147
|
+
return React.createElement(PillLabel, { key: index }, child);
|
|
148
|
+
}
|
|
149
|
+
return (React.createElement(Stack.Item, { key: index, display: "inline-flex" }, child));
|
|
150
|
+
})))),
|
|
151
|
+
variant === 'removable' && (React.createElement(StyledNonInteractivePill, __assign({ colors: getRemovablePillColors(model.state.disabled), as: Element !== 'button' ? Element : 'span' }, elemProps),
|
|
152
|
+
React.createElement(HStack, { spacing: "xxxs", display: "inline-flex", alignItems: "center", justifyContent: "center" }, React.Children.map(elemProps.children, function (child, index) {
|
|
153
|
+
if (typeof child === 'string') {
|
|
154
|
+
return React.createElement(PillLabel, { key: index }, child);
|
|
155
|
+
}
|
|
156
|
+
return React.createElement(Stack.Item, { key: index }, child);
|
|
157
|
+
}))))));
|
|
158
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvatarProps } from '@workday/canvas-kit-react/avatar';
|
|
3
|
+
export interface PillAvatarProps extends AvatarProps {
|
|
4
|
+
}
|
|
5
|
+
export declare const PillAvatar: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillAvatarProps, {
|
|
6
|
+
state: {
|
|
7
|
+
maxWidth: React.ReactText;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
events: {};
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=PillAvatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PillAvatar.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillAvatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAS,WAAW,EAAC,MAAM,kCAAkC,CAAC;AAGrE,MAAM,WAAW,eAAgB,SAAQ,WAAW;CAAG;AAKvD,eAAO,MAAM,UAAU;;;;;;EAcrB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React from 'react';
|
|
13
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
14
|
+
import { Avatar } from '@workday/canvas-kit-react/avatar';
|
|
15
|
+
import { usePillModel } from './usePillModel';
|
|
16
|
+
// When the component is created, it needs to be a button element to match AvatarProps.
|
|
17
|
+
// Once Avatar becomes a `createComponent` we can default the element type to a `div`
|
|
18
|
+
// and the types should be properly extracted
|
|
19
|
+
export var PillAvatar = createSubcomponent('button')({
|
|
20
|
+
modelHook: usePillModel,
|
|
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));
|
|
23
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FlexProps } from '@workday/canvas-kit-react/layout';
|
|
2
|
+
export interface PillCountProps extends FlexProps {
|
|
3
|
+
}
|
|
4
|
+
export declare const PillCount: import("@workday/canvas-kit-react/common").ElementComponent<"span", PillCountProps>;
|
|
5
|
+
//# sourceMappingURL=PillCount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PillCount.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillCount.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAO,SAAS,EAAC,MAAM,kCAAkC,CAAC;AAGjE,MAAM,WAAW,cAAe,SAAQ,SAAS;CAAG;AASpD,eAAO,MAAM,SAAS,qFAuBpB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { createComponent, styled } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { Flex } from '@workday/canvas-kit-react/layout';
|
|
26
|
+
import { borderRadius, colors, space } from '@workday/canvas-kit-react/tokens';
|
|
27
|
+
var StyledCountContainer = styled(Flex.as('span'))({
|
|
28
|
+
borderTopLeftRadius: borderRadius.zero,
|
|
29
|
+
borderTopRightRadius: borderRadius.m,
|
|
30
|
+
borderBottomLeftRadius: borderRadius.zero,
|
|
31
|
+
borderBottomRightRadius: borderRadius.m,
|
|
32
|
+
});
|
|
33
|
+
export var PillCount = createComponent('span')({
|
|
34
|
+
displayName: 'Pill.Avatar',
|
|
35
|
+
Component: function (_a, ref, Element) {
|
|
36
|
+
var children = _a.children, elemProps = __rest(_a, ["children"]);
|
|
37
|
+
return (React.createElement(StyledCountContainer, __assign({ display: "inline-flex", alignItems: "center", justifyContent: "center", as: Element, height: 22, minWidth: 22, padding: "0 " + space.xxxs, marginInlineEnd: "-" + space.xxs, marginInlineStart: "" + space.xxxs, backgroundColor: colors.soap500, "data-count": "ck-pill-count", ref: ref }, elemProps), children));
|
|
38
|
+
},
|
|
39
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
+
export interface PillIconProps extends Omit<SystemIconProps, 'icon'> {
|
|
5
|
+
/**
|
|
6
|
+
* The system icon rendered by the component
|
|
7
|
+
* @default `plusIcon`
|
|
8
|
+
*/
|
|
9
|
+
icon?: CanvasSystemIcon;
|
|
10
|
+
}
|
|
11
|
+
export declare const PillIcon: import("@workday/canvas-kit-react/common").ElementComponentM<"span", PillIconProps, {
|
|
12
|
+
state: {
|
|
13
|
+
maxWidth: React.ReactText;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
events: {};
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=PillIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PillIcon.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,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;;;;;;EAanB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import { createSubcomponent } from '@workday/canvas-kit-react/common';
|
|
25
|
+
import { SystemIcon } from '@workday/canvas-kit-react/icon';
|
|
26
|
+
import { usePillModel } from './usePillModel';
|
|
27
|
+
import { plusIcon } from '@workday/canvas-system-icons-web';
|
|
28
|
+
import { space } from '@workday/canvas-kit-react/tokens';
|
|
29
|
+
export var PillIcon = createSubcomponent('span')({
|
|
30
|
+
modelHook: usePillModel,
|
|
31
|
+
})(function (_a, Element) {
|
|
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)));
|
|
34
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SystemIconProps } from '@workday/canvas-kit-react/icon';
|
|
3
|
+
import { CanvasSystemIcon } from '@workday/design-assets-types';
|
|
4
|
+
export interface PillIconButtonProps extends Omit<SystemIconProps, 'icon'> {
|
|
5
|
+
/**
|
|
6
|
+
* The system icon rendered by the button
|
|
7
|
+
* @default `xSmallIcon`
|
|
8
|
+
*/
|
|
9
|
+
icon?: CanvasSystemIcon;
|
|
10
|
+
}
|
|
11
|
+
export declare const PillIconButton: import("@workday/canvas-kit-react/common").ElementComponentM<"button", PillIconButtonProps, {
|
|
12
|
+
state: {
|
|
13
|
+
maxWidth: React.ReactText;
|
|
14
|
+
disabled: boolean;
|
|
15
|
+
};
|
|
16
|
+
events: {};
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=PillIconButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PillIconButton.d.ts","sourceRoot":"","sources":["../../../../pill/lib/PillIconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,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;CACzB;AAuDD,eAAO,MAAM,cAAc;;;;;;EAuB1B,CAAC"}
|