@snack-uikit/chips 0.16.3 → 0.16.4-preview-71543426.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/cjs/components/ChipAssist/ChipAssist.js +73 -0
- package/dist/cjs/components/ChipAssist/index.js +25 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceBase/ChipChoiceBase.js +128 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceBase/index.js +25 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceCustom.js +77 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceDate.js +85 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceDateRange.js +93 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceMultiple.js +146 -0
- package/dist/cjs/components/ChipChoice/components/ChipChoiceSingle.js +131 -0
- package/dist/cjs/components/ChipChoice/components/index.js +29 -0
- package/dist/cjs/components/ChipChoice/constants.js +32 -0
- package/dist/cjs/components/ChipChoice/hooks.js +47 -0
- package/dist/cjs/components/ChipChoice/index.js +46 -0
- package/dist/cjs/components/ChipChoice/types.js +5 -0
- package/dist/cjs/components/ChipChoice/utils/index.js +26 -0
- package/dist/cjs/components/ChipChoice/utils/options.js +85 -0
- package/dist/cjs/components/ChipChoice/utils/typeGuards.js +25 -0
- package/dist/cjs/components/ChipChoice/utils/utils.js +49 -0
- package/dist/cjs/components/ChipChoiceRow/ChipChoiceRow.js +84 -0
- package/dist/cjs/components/ChipChoiceRow/components/ForwardedChipChoice.js +12 -0
- package/dist/cjs/components/ChipChoiceRow/components/constants.js +15 -0
- package/dist/cjs/components/ChipChoiceRow/components/index.js +25 -0
- package/dist/cjs/components/ChipChoiceRow/constants.js +22 -0
- package/dist/cjs/components/ChipChoiceRow/index.js +25 -0
- package/dist/cjs/components/ChipChoiceRow/types.js +5 -0
- package/dist/cjs/components/ChipToggle/ChipToggle.js +82 -0
- package/dist/cjs/components/ChipToggle/index.js +25 -0
- package/dist/cjs/components/index.js +28 -0
- package/dist/cjs/constants.js +43 -0
- package/dist/cjs/helperComponents/ButtonClearValue/ButtonClearValue.js +42 -0
- package/dist/cjs/helperComponents/ButtonClearValue/index.js +25 -0
- package/dist/cjs/helperComponents/index.js +25 -0
- package/dist/cjs/index.js +25 -0
- package/dist/cjs/types.js +5 -0
- package/dist/esm/components/ChipAssist/ChipAssist.d.ts +11 -0
- package/dist/esm/components/ChipAssist/index.js +1 -0
- package/dist/esm/components/ChipAssist/styles.module.css +159 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceBase/ChipChoiceBase.d.ts +20 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceBase/index.js +1 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceBase/styles.module.css +410 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceCustom.d.ts +25 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceDate.d.ts +15 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceDateRange.d.ts +15 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceMultiple.d.ts +8 -0
- package/dist/esm/components/ChipChoice/components/ChipChoiceSingle.d.ts +8 -0
- package/dist/esm/components/ChipChoice/components/index.js +5 -0
- package/dist/esm/components/ChipChoice/constants.d.ts +18 -0
- package/dist/esm/components/ChipChoice/hooks.d.ts +11 -0
- package/dist/esm/components/ChipChoice/index.d.ts +11 -0
- package/dist/esm/components/ChipChoice/styles.module.css +203 -0
- package/dist/esm/components/ChipChoice/types.d.ts +76 -0
- package/dist/esm/components/ChipChoice/utils/index.js +2 -0
- package/dist/esm/components/ChipChoice/utils/options.d.ts +9 -0
- package/dist/esm/components/ChipChoice/utils/typeGuards.d.ts +6 -0
- package/dist/esm/components/ChipChoice/utils/utils.d.ts +19 -0
- package/dist/esm/components/ChipChoiceRow/ChipChoiceRow.d.ts +22 -0
- package/dist/esm/components/ChipChoiceRow/components/ForwardedChipChoice.d.ts +2 -0
- package/dist/esm/components/ChipChoiceRow/components/constants.d.ts +7 -0
- package/dist/esm/components/ChipChoiceRow/components/index.js +1 -0
- package/dist/esm/components/ChipChoiceRow/constants.d.ts +12 -0
- package/dist/esm/components/ChipChoiceRow/index.js +1 -0
- package/dist/esm/components/ChipChoiceRow/styles.module.css +6 -0
- package/dist/esm/components/ChipChoiceRow/types.d.ts +29 -0
- package/dist/esm/components/ChipToggle/ChipToggle.d.ts +13 -0
- package/dist/esm/components/ChipToggle/index.js +1 -0
- package/dist/esm/components/ChipToggle/styles.module.css +219 -0
- package/dist/esm/components/index.js +4 -0
- package/dist/esm/constants.d.ts +37 -0
- package/dist/esm/helperComponents/ButtonClearValue/ButtonClearValue.d.ts +11 -0
- package/dist/esm/helperComponents/ButtonClearValue/styles.module.css +43 -0
- package/dist/esm/helperComponents/index.d.ts +1 -0
- package/dist/esm/helperComponents/index.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/styles.module.css +0 -0
- package/dist/esm/types.d.ts +20 -0
- package/package.json +14 -12
- /package/dist/{components → cjs/components}/ChipAssist/ChipAssist.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipAssist/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipAssist/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceBase/ChipChoiceBase.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceBase/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceBase/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceCustom.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceDate.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceDateRange.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceMultiple.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/ChipChoiceSingle.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/components/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/constants.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/hooks.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/types.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/utils/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/utils/options.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/utils/typeGuards.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoice/utils/utils.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/ChipChoiceRow.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/components/ForwardedChipChoice.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/components/constants.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/components/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/constants.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/ChipChoiceRow/types.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipToggle/ChipToggle.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipToggle/index.d.ts +0 -0
- /package/dist/{components → cjs/components}/ChipToggle/styles.module.css +0 -0
- /package/dist/{components → cjs/components}/index.d.ts +0 -0
- /package/dist/{constants.d.ts → cjs/constants.d.ts} +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/ButtonClearValue/ButtonClearValue.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/ButtonClearValue/index.d.ts +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/ButtonClearValue/styles.module.css +0 -0
- /package/dist/{helperComponents → cjs/helperComponents}/index.d.ts +0 -0
- /package/dist/{index.d.ts → cjs/index.d.ts} +0 -0
- /package/dist/{styles.module.css → cjs/styles.module.css} +0 -0
- /package/dist/{types.d.ts → cjs/types.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipAssist/ChipAssist.js +0 -0
- /package/dist/{components/ChipAssist/index.js → esm/components/ChipAssist/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceBase/ChipChoiceBase.js +0 -0
- /package/dist/{components/ChipChoice/components/ChipChoiceBase/index.js → esm/components/ChipChoice/components/ChipChoiceBase/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceCustom.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceDate.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceDateRange.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceMultiple.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/components/ChipChoiceSingle.js +0 -0
- /package/dist/{components/ChipChoice/components/index.js → esm/components/ChipChoice/components/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoice/constants.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/hooks.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/index.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/types.js +0 -0
- /package/dist/{components/ChipChoice/utils/index.js → esm/components/ChipChoice/utils/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoice/utils/options.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/utils/typeGuards.js +0 -0
- /package/dist/{components → esm/components}/ChipChoice/utils/utils.js +0 -0
- /package/dist/{components → esm/components}/ChipChoiceRow/ChipChoiceRow.js +0 -0
- /package/dist/{components → esm/components}/ChipChoiceRow/components/ForwardedChipChoice.js +0 -0
- /package/dist/{components → esm/components}/ChipChoiceRow/components/constants.js +0 -0
- /package/dist/{components/ChipChoiceRow/components/index.js → esm/components/ChipChoiceRow/components/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoiceRow/constants.js +0 -0
- /package/dist/{components/ChipChoiceRow/index.js → esm/components/ChipChoiceRow/index.d.ts} +0 -0
- /package/dist/{components → esm/components}/ChipChoiceRow/types.js +0 -0
- /package/dist/{components → esm/components}/ChipToggle/ChipToggle.js +0 -0
- /package/dist/{components/ChipToggle/index.js → esm/components/ChipToggle/index.d.ts} +0 -0
- /package/dist/{components/index.js → esm/components/index.d.ts} +0 -0
- /package/dist/{constants.js → esm/constants.js} +0 -0
- /package/dist/{helperComponents → esm/helperComponents}/ButtonClearValue/ButtonClearValue.js +0 -0
- /package/dist/{helperComponents/ButtonClearValue/index.js → esm/helperComponents/ButtonClearValue/index.d.ts} +0 -0
- /package/dist/{helperComponents → esm/helperComponents/ButtonClearValue}/index.js +0 -0
- /package/dist/{index.js → esm/index.d.ts} +0 -0
- /package/dist/{types.js → esm/types.js} +0 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.defaultSingleValueFormatter = defaultSingleValueFormatter;
|
|
15
|
+
exports.ChipChoiceSingle = ChipChoiceSingle;
|
|
16
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
17
|
+
const react_1 = require("react");
|
|
18
|
+
const list_1 = require("@snack-uikit/list");
|
|
19
|
+
const locale_1 = require("@snack-uikit/locale");
|
|
20
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
21
|
+
const constants_1 = require("../../../constants");
|
|
22
|
+
const constants_2 = require("../constants");
|
|
23
|
+
const hooks_1 = require("../hooks");
|
|
24
|
+
const utils_2 = require("../utils");
|
|
25
|
+
const options_1 = require("../utils/options");
|
|
26
|
+
const ChipChoiceBase_1 = require("./ChipChoiceBase");
|
|
27
|
+
function defaultSingleValueFormatter(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
label,
|
|
30
|
+
allLabel
|
|
31
|
+
} = _ref;
|
|
32
|
+
return label !== null && label !== void 0 ? label : allLabel;
|
|
33
|
+
}
|
|
34
|
+
function ChipChoiceSingle(_a) {
|
|
35
|
+
var {
|
|
36
|
+
value: valueProp,
|
|
37
|
+
defaultValue,
|
|
38
|
+
options,
|
|
39
|
+
onChange: onChangeProp,
|
|
40
|
+
valueRender,
|
|
41
|
+
size = constants_1.SIZE.S,
|
|
42
|
+
label,
|
|
43
|
+
searchable,
|
|
44
|
+
contentRender,
|
|
45
|
+
dropDownClassName
|
|
46
|
+
} = _a,
|
|
47
|
+
rest = __rest(_a, ["value", "defaultValue", "options", "onChange", "valueRender", "size", "label", "searchable", "contentRender", "dropDownClassName"]);
|
|
48
|
+
const [value, setValue] = (0, utils_1.useValueControl)({
|
|
49
|
+
value: valueProp,
|
|
50
|
+
defaultValue,
|
|
51
|
+
onChange: onChangeProp
|
|
52
|
+
});
|
|
53
|
+
const flattenOptions = (0, react_1.useMemo)(() => {
|
|
54
|
+
const {
|
|
55
|
+
flattenOptions
|
|
56
|
+
} = (0, utils_2.kindFlattenOptions)({
|
|
57
|
+
options
|
|
58
|
+
});
|
|
59
|
+
return flattenOptions;
|
|
60
|
+
}, [options]);
|
|
61
|
+
const {
|
|
62
|
+
t
|
|
63
|
+
} = (0, locale_1.useLocale)('Chips');
|
|
64
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
65
|
+
const handleOnKeyDown = (0, hooks_1.useHandleOnKeyDown)({
|
|
66
|
+
setOpen
|
|
67
|
+
});
|
|
68
|
+
const flatMapOptions = (0, react_1.useMemo)(() => Object.values(flattenOptions), [flattenOptions]);
|
|
69
|
+
const selectedOption = (0, react_1.useMemo)(() => value ? flattenOptions[value] : {}, [flattenOptions, value]);
|
|
70
|
+
const [searchValue, setSearchValue] = (0, react_1.useState)('');
|
|
71
|
+
const valueToRender = valueRender ? valueRender(selectedOption) : defaultSingleValueFormatter({
|
|
72
|
+
label: selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label,
|
|
73
|
+
allLabel: t('allLabel')
|
|
74
|
+
});
|
|
75
|
+
const fuzzySearch = (0, hooks_1.useFuzzySearch)(options, flatMapOptions);
|
|
76
|
+
const result = (0, react_1.useMemo)(() => !searchable || valueToRender === searchValue ? options : fuzzySearch(searchValue), [fuzzySearch, options, searchValue, searchable, valueToRender]);
|
|
77
|
+
const items = (0, react_1.useMemo)(() => (0, options_1.transformOptionsToItems)(result, contentRender), [contentRender, result]);
|
|
78
|
+
const clearValue = () => setValue(undefined);
|
|
79
|
+
const chipRef = (0, react_1.useRef)(null);
|
|
80
|
+
const handleSelectionChange = (0, react_1.useCallback)(newValue => {
|
|
81
|
+
var _a;
|
|
82
|
+
if (newValue !== undefined) {
|
|
83
|
+
(_a = chipRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
84
|
+
setOpen(false);
|
|
85
|
+
setValue(newValue);
|
|
86
|
+
setSearchValue('');
|
|
87
|
+
}
|
|
88
|
+
}, [setSearchValue, setValue]);
|
|
89
|
+
(0, react_1.useEffect)(() => {
|
|
90
|
+
if (searchValue && !open) {
|
|
91
|
+
setSearchValue('');
|
|
92
|
+
}
|
|
93
|
+
}, [searchable, open, searchValue]);
|
|
94
|
+
return (0, jsx_runtime_1.jsx)(list_1.Droplist, Object.assign({}, rest, {
|
|
95
|
+
items: items,
|
|
96
|
+
selection: {
|
|
97
|
+
value,
|
|
98
|
+
onChange: handleSelectionChange,
|
|
99
|
+
mode: 'single'
|
|
100
|
+
},
|
|
101
|
+
"data-test-id": constants_1.CHIP_CHOICE_TEST_IDS.droplist,
|
|
102
|
+
size: constants_2.DROPLIST_SIZE_MAP[size],
|
|
103
|
+
trigger: 'click',
|
|
104
|
+
placement: 'bottom-start',
|
|
105
|
+
className: dropDownClassName,
|
|
106
|
+
closeDroplistOnItemClick: true,
|
|
107
|
+
widthStrategy: 'gte',
|
|
108
|
+
open: open,
|
|
109
|
+
onOpenChange: open => {
|
|
110
|
+
if (!open) {
|
|
111
|
+
setSearchValue('');
|
|
112
|
+
}
|
|
113
|
+
setOpen(open);
|
|
114
|
+
},
|
|
115
|
+
scroll: true,
|
|
116
|
+
search: searchable ? {
|
|
117
|
+
value: searchValue,
|
|
118
|
+
onChange: setSearchValue
|
|
119
|
+
} : undefined,
|
|
120
|
+
children: (0, jsx_runtime_1.jsx)(ChipChoiceBase_1.ChipChoiceBase, Object.assign({}, rest, {
|
|
121
|
+
ref: chipRef,
|
|
122
|
+
onClearButtonClick: clearValue,
|
|
123
|
+
value: value,
|
|
124
|
+
valueToRender: valueToRender,
|
|
125
|
+
label: label,
|
|
126
|
+
loading: rest.loading,
|
|
127
|
+
size: size,
|
|
128
|
+
onKeyDown: handleOnKeyDown()
|
|
129
|
+
}))
|
|
130
|
+
}));
|
|
131
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ChipChoiceCustom"), exports);
|
|
26
|
+
__exportStar(require("./ChipChoiceSingle"), exports);
|
|
27
|
+
__exportStar(require("./ChipChoiceMultiple"), exports);
|
|
28
|
+
__exportStar(require("./ChipChoiceDate"), exports);
|
|
29
|
+
__exportStar(require("./ChipChoiceDateRange"), exports);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CHIP_CHOICE_TYPE = exports.DROPLIST_SIZE_MAP = exports.CALENDAR_SIZE_MAP = exports.BUTTON_CLEAR_VALUE_SIZE_MAP = void 0;
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
exports.BUTTON_CLEAR_VALUE_SIZE_MAP = {
|
|
9
|
+
[constants_1.SIZE.Xs]: constants_1.BUTTON_SIZE.Xxs,
|
|
10
|
+
[constants_1.SIZE.S]: constants_1.BUTTON_SIZE.Xs,
|
|
11
|
+
[constants_1.SIZE.M]: constants_1.BUTTON_SIZE.Xs,
|
|
12
|
+
[constants_1.SIZE.L]: constants_1.BUTTON_SIZE.Xs
|
|
13
|
+
};
|
|
14
|
+
exports.CALENDAR_SIZE_MAP = {
|
|
15
|
+
[constants_1.SIZE.Xs]: 's',
|
|
16
|
+
[constants_1.SIZE.S]: 's',
|
|
17
|
+
[constants_1.SIZE.M]: 'm',
|
|
18
|
+
[constants_1.SIZE.L]: 'm'
|
|
19
|
+
};
|
|
20
|
+
exports.DROPLIST_SIZE_MAP = {
|
|
21
|
+
[constants_1.SIZE.Xs]: 's',
|
|
22
|
+
[constants_1.SIZE.S]: 's',
|
|
23
|
+
[constants_1.SIZE.M]: 'm',
|
|
24
|
+
[constants_1.SIZE.L]: 'l'
|
|
25
|
+
};
|
|
26
|
+
exports.CHIP_CHOICE_TYPE = {
|
|
27
|
+
Multiple: 'multiple',
|
|
28
|
+
Date: 'date',
|
|
29
|
+
DateRange: 'date-range',
|
|
30
|
+
Single: 'single',
|
|
31
|
+
Custom: 'custom'
|
|
32
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
4
|
+
return mod && mod.__esModule ? mod : {
|
|
5
|
+
"default": mod
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.useHandleOnKeyDown = useHandleOnKeyDown;
|
|
12
|
+
exports.useFuzzySearch = useFuzzySearch;
|
|
13
|
+
const fuzzy_search_1 = __importDefault(require("fuzzy-search"));
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
function useHandleOnKeyDown(_ref) {
|
|
16
|
+
let {
|
|
17
|
+
setOpen
|
|
18
|
+
} = _ref;
|
|
19
|
+
return (0, react_1.useCallback)(onKeyDown => e => {
|
|
20
|
+
if (e.code === 'Space') {
|
|
21
|
+
e.stopPropagation();
|
|
22
|
+
} else {
|
|
23
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(e);
|
|
24
|
+
}
|
|
25
|
+
if (['ArrowDown'].includes(e.key)) {
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
setOpen(true);
|
|
28
|
+
}
|
|
29
|
+
if (['ArrowUp'].includes(e.key)) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
setOpen(false);
|
|
32
|
+
}
|
|
33
|
+
if (e.key === 'Tab') {
|
|
34
|
+
setOpen(false);
|
|
35
|
+
}
|
|
36
|
+
}, [setOpen]);
|
|
37
|
+
}
|
|
38
|
+
const DEFAULT_MIN_SEARCH_INPUT_LENGTH = 2;
|
|
39
|
+
/**
|
|
40
|
+
* Нечеткий поиск среди айтемов по полям 'content.option', 'content.caption', 'content.description', 'label'
|
|
41
|
+
*/
|
|
42
|
+
function useFuzzySearch(options, flatMapOptions, minSearchInputLength) {
|
|
43
|
+
return (0, react_1.useCallback)(search => {
|
|
44
|
+
const searcher = new fuzzy_search_1.default(flatMapOptions, ['label', 'contentRenderProps.description', 'contentRenderProps.caption'], {});
|
|
45
|
+
return search.length > (minSearchInputLength !== null && minSearchInputLength !== void 0 ? minSearchInputLength : DEFAULT_MIN_SEARCH_INPUT_LENGTH) ? searcher.search(search) : options;
|
|
46
|
+
}, [flatMapOptions, minSearchInputLength, options]);
|
|
47
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isNextListOption = exports.isGroupSelectOption = exports.isGroupOption = exports.isBaseOption = exports.isAccordionOption = exports.ChipChoice = void 0;
|
|
7
|
+
const components_1 = require("./components");
|
|
8
|
+
var ChipChoice;
|
|
9
|
+
(function (ChipChoice) {
|
|
10
|
+
ChipChoice.Custom = components_1.ChipChoiceCustom;
|
|
11
|
+
ChipChoice.Single = components_1.ChipChoiceSingle;
|
|
12
|
+
ChipChoice.Multiple = components_1.ChipChoiceMultiple;
|
|
13
|
+
ChipChoice.Date = components_1.ChipChoiceDate;
|
|
14
|
+
ChipChoice.DateRange = components_1.ChipChoiceDateRange;
|
|
15
|
+
})(ChipChoice || (exports.ChipChoice = ChipChoice = {}));
|
|
16
|
+
var utils_1 = require("./utils");
|
|
17
|
+
Object.defineProperty(exports, "isAccordionOption", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () {
|
|
20
|
+
return utils_1.isAccordionOption;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperty(exports, "isBaseOption", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return utils_1.isBaseOption;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "isGroupOption", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return utils_1.isGroupOption;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(exports, "isGroupSelectOption", {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function () {
|
|
38
|
+
return utils_1.isGroupSelectOption;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
Object.defineProperty(exports, "isNextListOption", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return utils_1.isNextListOption;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./typeGuards"), exports);
|
|
26
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", {
|
|
12
|
+
value: true
|
|
13
|
+
});
|
|
14
|
+
exports.transformOptionsToItems = transformOptionsToItems;
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const list_1 = require("@snack-uikit/list");
|
|
17
|
+
const typeGuards_1 = require("./typeGuards");
|
|
18
|
+
function transformOptionsToItems(options, contentRender) {
|
|
19
|
+
return options.map(option => {
|
|
20
|
+
if ((0, typeGuards_1.isAccordionOption)(option) || (0, typeGuards_1.isNextListOption)(option)) {
|
|
21
|
+
const {
|
|
22
|
+
label,
|
|
23
|
+
options,
|
|
24
|
+
id,
|
|
25
|
+
contentRenderProps,
|
|
26
|
+
disabled
|
|
27
|
+
} = option,
|
|
28
|
+
rest = __rest(option, ["label", "options", "id", "contentRenderProps", "disabled"]);
|
|
29
|
+
return Object.assign(Object.assign({}, rest), {
|
|
30
|
+
disabled,
|
|
31
|
+
id,
|
|
32
|
+
content: contentRender ? contentRender({
|
|
33
|
+
label,
|
|
34
|
+
contentRenderProps,
|
|
35
|
+
disabled
|
|
36
|
+
}) : (0, jsx_runtime_1.jsx)(list_1.ItemContent, Object.assign({
|
|
37
|
+
option: label
|
|
38
|
+
}, contentRenderProps, {
|
|
39
|
+
disabled: disabled
|
|
40
|
+
})),
|
|
41
|
+
items: transformOptionsToItems(options)
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
if ((0, typeGuards_1.isGroupSelectOption)(option)) {
|
|
45
|
+
const {
|
|
46
|
+
options
|
|
47
|
+
} = option,
|
|
48
|
+
rest = __rest(option, ["options"]);
|
|
49
|
+
return Object.assign(Object.assign({}, rest), {
|
|
50
|
+
items: transformOptionsToItems(options)
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if ((0, typeGuards_1.isGroupOption)(option)) {
|
|
54
|
+
const {
|
|
55
|
+
options
|
|
56
|
+
} = option,
|
|
57
|
+
rest = __rest(option, ["options"]);
|
|
58
|
+
return Object.assign(Object.assign({}, rest), {
|
|
59
|
+
items: transformOptionsToItems(options)
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
const _a = option,
|
|
63
|
+
{
|
|
64
|
+
label,
|
|
65
|
+
value,
|
|
66
|
+
contentRenderProps,
|
|
67
|
+
disabled
|
|
68
|
+
} = _a,
|
|
69
|
+
rest = __rest(_a, ["label", "value", "contentRenderProps", "disabled"]);
|
|
70
|
+
return Object.assign(Object.assign({}, rest), {
|
|
71
|
+
disabled,
|
|
72
|
+
id: value,
|
|
73
|
+
content: contentRender ? contentRender({
|
|
74
|
+
label,
|
|
75
|
+
contentRenderProps,
|
|
76
|
+
disabled,
|
|
77
|
+
value
|
|
78
|
+
}) : (0, jsx_runtime_1.jsx)(list_1.ItemContent, Object.assign({
|
|
79
|
+
option: label
|
|
80
|
+
}, contentRenderProps, {
|
|
81
|
+
disabled: disabled
|
|
82
|
+
}))
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isBaseOption = isBaseOption;
|
|
7
|
+
exports.isAccordionOption = isAccordionOption;
|
|
8
|
+
exports.isNextListOption = isNextListOption;
|
|
9
|
+
exports.isGroupOption = isGroupOption;
|
|
10
|
+
exports.isGroupSelectOption = isGroupSelectOption;
|
|
11
|
+
function isBaseOption(option) {
|
|
12
|
+
return !('options' in option);
|
|
13
|
+
}
|
|
14
|
+
function isAccordionOption(option) {
|
|
15
|
+
return option && 'options' in option && option['type'] === 'collapse';
|
|
16
|
+
}
|
|
17
|
+
function isNextListOption(option) {
|
|
18
|
+
return option && 'options' in option && option['type'] === 'next-list';
|
|
19
|
+
}
|
|
20
|
+
function isGroupOption(option) {
|
|
21
|
+
return option && 'options' in option && option['type'] === 'group';
|
|
22
|
+
}
|
|
23
|
+
function isGroupSelectOption(option) {
|
|
24
|
+
return option && 'options' in option && option['type'] === 'group-select';
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.kindFlattenOptions = kindFlattenOptions;
|
|
7
|
+
const typeGuards_1 = require("./typeGuards");
|
|
8
|
+
function kindFlattenOptions(_ref) {
|
|
9
|
+
let {
|
|
10
|
+
options
|
|
11
|
+
} = _ref;
|
|
12
|
+
const flattenOptions = {};
|
|
13
|
+
function flatten(option) {
|
|
14
|
+
if ((0, typeGuards_1.isBaseOption)(option)) {
|
|
15
|
+
const {
|
|
16
|
+
value,
|
|
17
|
+
label,
|
|
18
|
+
contentRenderProps,
|
|
19
|
+
disabled,
|
|
20
|
+
afterContent,
|
|
21
|
+
beforeContent,
|
|
22
|
+
hidden
|
|
23
|
+
} = option;
|
|
24
|
+
flattenOptions[value] = {
|
|
25
|
+
value,
|
|
26
|
+
label,
|
|
27
|
+
contentRenderProps,
|
|
28
|
+
disabled,
|
|
29
|
+
afterContent,
|
|
30
|
+
beforeContent,
|
|
31
|
+
hidden
|
|
32
|
+
};
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const {
|
|
36
|
+
options
|
|
37
|
+
} = option;
|
|
38
|
+
for (let idx = 0; idx < options.length; idx++) {
|
|
39
|
+
flatten(options[idx]);
|
|
40
|
+
}
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
for (let idx = 0; idx < options.length; idx++) {
|
|
44
|
+
flatten(options[idx]);
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
flattenOptions
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
4
|
+
var t = {};
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = void 0 && (void 0).__importDefault || function (mod) {
|
|
12
|
+
return mod && mod.__esModule ? mod : {
|
|
13
|
+
"default": mod
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", {
|
|
17
|
+
value: true
|
|
18
|
+
});
|
|
19
|
+
exports.ChipChoiceRow = ChipChoiceRow;
|
|
20
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
21
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
22
|
+
const uncontrollable_1 = require("uncontrollable");
|
|
23
|
+
const button_1 = require("@snack-uikit/button");
|
|
24
|
+
const icons_1 = require("@snack-uikit/icons");
|
|
25
|
+
const locale_1 = require("@snack-uikit/locale");
|
|
26
|
+
const utils_1 = require("@snack-uikit/utils");
|
|
27
|
+
const constants_1 = require("../../constants");
|
|
28
|
+
const components_1 = require("./components");
|
|
29
|
+
const constants_2 = require("./constants");
|
|
30
|
+
const styles_module_scss_1 = __importDefault(require('./styles.module.css'));
|
|
31
|
+
function ChipChoiceRow(_a) {
|
|
32
|
+
var {
|
|
33
|
+
filters,
|
|
34
|
+
onChange,
|
|
35
|
+
showClearAllButton = true,
|
|
36
|
+
clearAllButtonLabel: clearAllButtonLabelProp,
|
|
37
|
+
className,
|
|
38
|
+
value,
|
|
39
|
+
defaultValue,
|
|
40
|
+
size = constants_2.CHIP_CHOICE_ROW_SIZE.S
|
|
41
|
+
} = _a,
|
|
42
|
+
rest = __rest(_a, ["filters", "onChange", "showClearAllButton", "clearAllButtonLabel", "className", "value", "defaultValue", "size"]);
|
|
43
|
+
const {
|
|
44
|
+
t
|
|
45
|
+
} = (0, locale_1.useLocale)('Chips');
|
|
46
|
+
const clearAllButtonLabel = clearAllButtonLabelProp !== null && clearAllButtonLabelProp !== void 0 ? clearAllButtonLabelProp : t('clearAllButton');
|
|
47
|
+
const [state, setState] = (0, uncontrollable_1.useUncontrolledProp)(value, defaultValue !== null && defaultValue !== void 0 ? defaultValue : {}, newState => {
|
|
48
|
+
const result = typeof newState === 'function' ? newState(state) : newState;
|
|
49
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(result);
|
|
50
|
+
});
|
|
51
|
+
const handleChange = (fieldId, value) => {
|
|
52
|
+
setState(state => Object.assign(Object.assign({}, state), {
|
|
53
|
+
[fieldId]: value
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
const handleFiltersClear = () => {
|
|
57
|
+
setState({});
|
|
58
|
+
};
|
|
59
|
+
const hasAnyFilter = Object.values(state).some(filter => {
|
|
60
|
+
if (Array.isArray(filter)) {
|
|
61
|
+
return filter.length > 0 && Object.values(filter).some(Boolean);
|
|
62
|
+
}
|
|
63
|
+
if (filter && typeof filter === 'object') {
|
|
64
|
+
return Object.values(filter).some(Boolean) || filter instanceof Date;
|
|
65
|
+
}
|
|
66
|
+
return Boolean(filter);
|
|
67
|
+
});
|
|
68
|
+
return (0, jsx_runtime_1.jsxs)("div", Object.assign({
|
|
69
|
+
className: (0, classnames_1.default)(styles_module_scss_1.default.chipChoiceRow, className)
|
|
70
|
+
}, (0, utils_1.extractSupportProps)(rest), {
|
|
71
|
+
children: [filters.map(filter => (0, jsx_runtime_1.jsx)(components_1.ForwardedChipChoice, Object.assign({}, filter, {
|
|
72
|
+
value: state[filter.id],
|
|
73
|
+
size: constants_2.MAP_ROW_SIZE_TO_CHOICE_SIZE[size],
|
|
74
|
+
onChange: value => handleChange(filter.id, value)
|
|
75
|
+
}), filter.id)), showClearAllButton && hasAnyFilter && (0, jsx_runtime_1.jsx)(button_1.ButtonFunction, {
|
|
76
|
+
onClick: handleFiltersClear,
|
|
77
|
+
label: clearAllButtonLabel,
|
|
78
|
+
icon: (0, jsx_runtime_1.jsx)(icons_1.CrossSVG, {}),
|
|
79
|
+
iconPosition: 'before',
|
|
80
|
+
size: constants_2.MAP_ROW_SIZE_TO_BUTTON_SIZE[size],
|
|
81
|
+
"data-test-id": constants_1.CHIP_CHOICE_ROW_IDS.clearAllButton
|
|
82
|
+
})]
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ForwardedChipChoice = ForwardedChipChoice;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const constants_1 = require("./constants");
|
|
9
|
+
function ForwardedChipChoice(props) {
|
|
10
|
+
const Component = constants_1.MAP_CHIP_TYPE_TO_COMPONENT[props.type];
|
|
11
|
+
return (0, jsx_runtime_1.jsx)(Component, Object.assign({}, props));
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAP_CHIP_TYPE_TO_COMPONENT = void 0;
|
|
7
|
+
const ChipChoice_1 = require("../../ChipChoice");
|
|
8
|
+
const constants_1 = require("../../ChipChoice/constants");
|
|
9
|
+
exports.MAP_CHIP_TYPE_TO_COMPONENT = {
|
|
10
|
+
[constants_1.CHIP_CHOICE_TYPE.Single]: ChipChoice_1.ChipChoice.Single,
|
|
11
|
+
[constants_1.CHIP_CHOICE_TYPE.Multiple]: ChipChoice_1.ChipChoice.Multiple,
|
|
12
|
+
[constants_1.CHIP_CHOICE_TYPE.Date]: ChipChoice_1.ChipChoice.Date,
|
|
13
|
+
[constants_1.CHIP_CHOICE_TYPE.DateRange]: ChipChoice_1.ChipChoice.DateRange,
|
|
14
|
+
[constants_1.CHIP_CHOICE_TYPE.Custom]: ChipChoice_1.ChipChoice.Custom
|
|
15
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ForwardedChipChoice"), exports);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MAP_ROW_SIZE_TO_BUTTON_SIZE = exports.MAP_ROW_SIZE_TO_CHOICE_SIZE = exports.CHIP_CHOICE_ROW_SIZE = void 0;
|
|
7
|
+
const constants_1 = require("../../constants");
|
|
8
|
+
exports.CHIP_CHOICE_ROW_SIZE = {
|
|
9
|
+
Xs: 'xs',
|
|
10
|
+
S: 's',
|
|
11
|
+
M: 'm'
|
|
12
|
+
};
|
|
13
|
+
exports.MAP_ROW_SIZE_TO_CHOICE_SIZE = {
|
|
14
|
+
[exports.CHIP_CHOICE_ROW_SIZE.Xs]: constants_1.SIZE.Xs,
|
|
15
|
+
[exports.CHIP_CHOICE_ROW_SIZE.S]: constants_1.SIZE.S,
|
|
16
|
+
[exports.CHIP_CHOICE_ROW_SIZE.M]: constants_1.SIZE.M
|
|
17
|
+
};
|
|
18
|
+
exports.MAP_ROW_SIZE_TO_BUTTON_SIZE = {
|
|
19
|
+
[exports.CHIP_CHOICE_ROW_SIZE.Xs]: 'xs',
|
|
20
|
+
[exports.CHIP_CHOICE_ROW_SIZE.S]: 's',
|
|
21
|
+
[exports.CHIP_CHOICE_ROW_SIZE.M]: 'm'
|
|
22
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __createBinding = void 0 && (void 0).__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
} : function (o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
});
|
|
19
|
+
var __exportStar = void 0 && (void 0).__exportStar || function (m, exports) {
|
|
20
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
21
|
+
};
|
|
22
|
+
Object.defineProperty(exports, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
});
|
|
25
|
+
__exportStar(require("./ChipChoiceRow"), exports);
|