@jars-labs/jars-components 1.0.9 → 1.0.11
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/{index-Bsn_EcYJ.js → index-COG80HZJ.js} +143 -80
- package/dist/index-COG80HZJ.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{lottie-uxb8tIPw.js → lottie-BBj9Bhzx.js} +2 -2
- package/dist/{lottie-uxb8tIPw.js.map → lottie-BBj9Bhzx.js.map} +1 -1
- package/dist/types/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/types/Badge/Badge.d.ts.map +1 -1
- package/dist/types/Icons/Icon.d.ts.map +1 -1
- package/dist/types/LinkModal/LinkModal.d.ts.map +1 -1
- package/dist/types/Multiselect/Multiselect.d.ts +4 -1
- package/dist/types/Multiselect/Multiselect.d.ts.map +1 -1
- package/dist/types/NavBar/NavBar.d.ts +7 -2
- package/dist/types/NavBar/NavBar.d.ts.map +1 -1
- package/dist/types/StatusBadge/StatusBadge.d.ts.map +1 -1
- package/dist/types/Text/Text.d.ts +1 -1
- package/dist/types/Text/Text.d.ts.map +1 -1
- package/package.json +6 -6
- package/dist/index-Bsn_EcYJ.js.map +0 -1
|
@@ -85,8 +85,7 @@ var Icon = function (_a) {
|
|
|
85
85
|
var parent_1 = svgRef.current.parentElement;
|
|
86
86
|
var isParentContent = false;
|
|
87
87
|
while (parent_1) {
|
|
88
|
-
if (parent_1.classList.contains('mantine-Accordion-root')
|
|
89
|
-
parent_1.classList.contains('mantine-Tabs-panel')) {
|
|
88
|
+
if (parent_1.classList.contains('mantine-Accordion-root')) {
|
|
90
89
|
isParentContent = true;
|
|
91
90
|
break;
|
|
92
91
|
}
|
|
@@ -161,7 +160,7 @@ var Animation = function (_a) {
|
|
|
161
160
|
var refVector = useRef(null);
|
|
162
161
|
var _b = useState(null), lottie = _b[0], setLottie = _b[1];
|
|
163
162
|
useEffect(function () {
|
|
164
|
-
import('./lottie-
|
|
163
|
+
import('./lottie-BBj9Bhzx.js').then(function (n) { return n.l; }).then(function (Lottie) { return setLottie(Lottie.default); });
|
|
165
164
|
}, []);
|
|
166
165
|
useEffect(function () {
|
|
167
166
|
if (lottie && refVector.current) {
|
|
@@ -338,7 +337,7 @@ var Info = function (props) {
|
|
|
338
337
|
return (jsxs(Icon, __assign({}, props, { children: [jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M11.999 8C11.861 8 11.749 8.112 11.75 8.25C11.75 8.388 11.862 8.5 12 8.5C12.138 8.5 12.25 8.388 12.25 8.25C12.25 8.112 12.138 8 11.999 8" }), jsx("path", { fillRule: "evenodd", stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 21V21C7.029 21 3 16.971 3 12V12C3 7.029 7.029 3 12 3V3C16.971 3 21 7.029 21 12V12C21 16.971 16.971 21 12 21Z", clipRule: "evenodd" }), jsx("path", { stroke: props.stroke, strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 12V17" })] })));
|
|
339
338
|
};
|
|
340
339
|
|
|
341
|
-
var styles$j = {"text":"Text-module_text__3xRq3","h1":"Text-module_h1__RkLfx","h2":"Text-module_h2__fAm7L","h3":"Text-module_h3__o11c2","h4":"Text-module_h4__RIwZg","m":"Text-module_m__nlfmp","s":"Text-module_s__t9q3d","xs":"Text-module_xs__ZU2jV","xxs":"Text-module_xxs__hmZHQ","bold":"Text-module_bold__N75tZ","medium":"Text-module_medium__Q8kf4","regular":"Text-module_regular__-EdPk"};
|
|
340
|
+
var styles$j = {"text":"Text-module_text__3xRq3","h1":"Text-module_h1__RkLfx","h2":"Text-module_h2__fAm7L","h3":"Text-module_h3__o11c2","h4":"Text-module_h4__RIwZg","m":"Text-module_m__nlfmp","s":"Text-module_s__t9q3d","xs":"Text-module_xs__ZU2jV","xxs":"Text-module_xxs__hmZHQ","bold":"Text-module_bold__N75tZ","medium":"Text-module_medium__Q8kf4","regular":"Text-module_regular__-EdPk","title0":"Text-module_title0__NvhiO","title0-mobile":"Text-module_title0-mobile__y1sTi","title1":"Text-module_title1__Oa54p","title1-500":"Text-module_title1-500__Md7EO","title1-500-mobile":"Text-module_title1-500-mobile__Y78Lk","l-medium":"Text-module_l-medium__U22ra","l-regular":"Text-module_l-regular__ihWaL","xxxl-medium":"Text-module_xxxl-medium__O3TD0","xxl-medium":"Text-module_xxl-medium__DWGly","xl-medium":"Text-module_xl-medium__cobLu","base-regular":"Text-module_base-regular__TwXtn","base-medium":"Text-module_base-medium__-4t3q","m-regular":"Text-module_m-regular__Lx6ru","m-medium":"Text-module_m-medium__upYpJ","s-light":"Text-module_s-light__oSwjg","xs-light":"Text-module_xs-light__rLaCR","xxs-normal":"Text-module_xxs-normal__TQEfr","xxs-light":"Text-module_xxs-light__4hw2o","xxs-bold":"Text-module_xxs-bold__LiO7o","title2":"Text-module_title2__vmM-P","title3":"Text-module_title3__r5irn","headline":"Text-module_headline__bgILl","headline-xxl":"Text-module_headline-xxl__uINnx","subheader":"Text-module_subheader__3CmmH","subheader-bold":"Text-module_subheader-bold__nUCe5","input":"Text-module_input__uD4E2"};
|
|
342
341
|
|
|
343
342
|
var elementType = {
|
|
344
343
|
h1: 'h1',
|
|
@@ -469,18 +468,20 @@ var Autocomplete = function (_a) {
|
|
|
469
468
|
store.openDropdown();
|
|
470
469
|
}
|
|
471
470
|
if (event.currentTarget.value === '') {
|
|
471
|
+
store.resetSelectedOption();
|
|
472
472
|
store.closeDropdown();
|
|
473
473
|
}
|
|
474
474
|
}, value: searchValue, holdSpace: false, leftSection: jsx(Search, {}), rightSection: jsx(ActionIcon, { radius: "sm", variant: "light", onClick: function () {
|
|
475
475
|
onSearchChange('');
|
|
476
476
|
onOptionSubmit === null || onOptionSubmit === undefined ? undefined : onOptionSubmit('');
|
|
477
|
+
store.resetSelectedOption();
|
|
477
478
|
store.closeDropdown();
|
|
478
479
|
}, style: { visibility: searchValue ? 'visible' : 'hidden' }, children: jsx(Close, {}) }), onKeyDown: function (event) {
|
|
479
480
|
if (event.key === 'Enter' && options.length !== 1) {
|
|
480
481
|
handleOptionSubmit(searchValue);
|
|
481
482
|
store.toggleDropdown();
|
|
482
483
|
}
|
|
483
|
-
else if (event.key === 'Enter') {
|
|
484
|
+
else if (event.key === 'Enter' && !loading) {
|
|
484
485
|
handleOptionSubmit(options[0]);
|
|
485
486
|
store.toggleDropdown();
|
|
486
487
|
}
|
|
@@ -525,7 +526,7 @@ var badgeVariantMap = {
|
|
|
525
526
|
var sizeMap$1 = {
|
|
526
527
|
small: {
|
|
527
528
|
textVariant: 'xxs',
|
|
528
|
-
padding: '
|
|
529
|
+
padding: '8px 12px',
|
|
529
530
|
},
|
|
530
531
|
medium: {
|
|
531
532
|
textVariant: 'xs',
|
|
@@ -533,7 +534,7 @@ var sizeMap$1 = {
|
|
|
533
534
|
},
|
|
534
535
|
large: {
|
|
535
536
|
textVariant: 's',
|
|
536
|
-
padding: '
|
|
537
|
+
padding: '8px 16px',
|
|
537
538
|
},
|
|
538
539
|
};
|
|
539
540
|
var Badge = forwardRef(function (_a, ref) {
|
|
@@ -542,7 +543,7 @@ var Badge = forwardRef(function (_a, ref) {
|
|
|
542
543
|
var backgroundColor = (_b = badgeVariantMap[variant]) === null || _b === undefined ? undefined : _b.backgroundColor;
|
|
543
544
|
var color = (_c = badgeVariantMap[variant]) === null || _c === undefined ? undefined : _c.color;
|
|
544
545
|
var sizeStyles = sizeMap$1[size || 'small'];
|
|
545
|
-
return (jsxs(Flex, { gap: 8, w: 'fit-content', bg: backgroundColor, p: sizeStyles.padding, style: __assign(__assign({}, style), { borderRadius: 999, alignItems: 'center' }), ref: ref, children: [icon, jsx(Text, { variant: sizeStyles.textVariant,
|
|
546
|
+
return (jsxs(Flex, { gap: 8, w: 'fit-content', bg: backgroundColor, p: sizeStyles.padding, style: __assign(__assign({}, style), { borderRadius: 999, alignItems: 'center' }), ref: ref, children: [icon, jsx(Text, { variant: sizeStyles.textVariant, color: color, children: label })] }));
|
|
546
547
|
});
|
|
547
548
|
|
|
548
549
|
var styles$i = {"button":"Button-module_button__7BLGt","label":"Button-module_label__447Ll","button-flex":"Button-module_button-flex__bzVRB","button--filled":"Button-module_button--filled__BKGu2","label-color--filled":"Button-module_label-color--filled__wJHlw","label-color--filled--disabled":"Button-module_label-color--filled--disabled__BbMbV","button--outlined":"Button-module_button--outlined__QZysw","label-color--outlined":"Button-module_label-color--outlined__seGi5","label-color--outlined--disabled":"Button-module_label-color--outlined--disabled__qXPjI","button--underlined":"Button-module_button--underlined__BsY5s","label-color--underlined":"Button-module_label-color--underlined__ymMfq","label-color--underlined--disabled":"Button-module_label-color--underlined--disabled__TBDd8","button--underlined-neutral":"Button-module_button--underlined-neutral__30A91","label-color--underlined-neutral":"Button-module_label-color--underlined-neutral__1xWMY","label-color--underlined-neutral--disabled":"Button-module_label-color--underlined-neutral--disabled__RQKW7","button--delete":"Button-module_button--delete__Xqpbl","label-color--delete":"Button-module_label-color--delete__iPB3X","label-color--delete--disabled":"Button-module_label-color--delete--disabled__lJkM6","button--small":"Button-module_button--small__3npYU","button--medium":"Button-module_button--medium__WRSIQ","button--large":"Button-module_button--large__bGVS1"};
|
|
@@ -881,7 +882,7 @@ var IncrementNumber = function (props) {
|
|
|
881
882
|
return (jsxs("div", { className: styles$a['flex'], children: [props.disableDecrease ? (jsx("div", { style: { width: 24 } })) : (jsx("button", { className: styles$a['increment-button'], onClick: function () { return props.handleDecrease(props.value); }, children: jsx("img", { src: props.minusIconPath, width: 24, height: 24, alt: "-", style: {
|
|
882
883
|
maxWidth: '100%',
|
|
883
884
|
height: 'auto',
|
|
884
|
-
} }) })), jsx(Text, { variant: "m
|
|
885
|
+
} }) })), jsx(Text, { variant: "m-regular", style: { minWidth: 120 }, children: formatter.format(props.value) }), props.disableIncrease ? (jsx("div", { style: { width: 24 } })) : (jsx("button", { className: styles$a['increment-button'], onClick: function () { return props.handleIncrease(props.value); }, children: jsx("img", { src: props.plusIconPath, width: 24, height: 24, alt: "+", style: {
|
|
885
886
|
maxWidth: '100%',
|
|
886
887
|
height: 'auto',
|
|
887
888
|
} }) }))] }));
|
|
@@ -978,7 +979,8 @@ var Modal = function (_a) {
|
|
|
978
979
|
|
|
979
980
|
var LinkModal = function (props) {
|
|
980
981
|
var _a = t.useState(false), modalIsOpen = _a[0], setModalIsOpen = _a[1];
|
|
981
|
-
return (jsxs(Fragment, { children: [jsx("a", { onClick: function () { return setModalIsOpen(!modalIsOpen); }, children: jsx(Text, { variant: "xs
|
|
982
|
+
return (jsxs(Fragment, { children: [jsx("a", { onClick: function () { return setModalIsOpen(!modalIsOpen); }, children: jsx(Text, { variant: "xs-light", style: {
|
|
983
|
+
color: 'var(--color-primary-300)',
|
|
982
984
|
textDecoration: 'underline',
|
|
983
985
|
}, children: props.label }) }), jsx(Modal, { isOpen: modalIsOpen, onClose: function () { return setModalIsOpen(false); }, children: props.children })] }));
|
|
984
986
|
};
|
|
@@ -1029,8 +1031,8 @@ var Umbrello = function (props) {
|
|
|
1029
1031
|
};
|
|
1030
1032
|
|
|
1031
1033
|
var NavBar = function (_a) {
|
|
1032
|
-
var children = _a.children;
|
|
1033
|
-
return (jsxs(Flex, { p: "24px 120px", bg: "var(--color-white)", align: "center", justify: "space-between", children: [jsx("a", { href:
|
|
1034
|
+
var children = _a.children, logo = _a.logo, homePath = _a.homePath, rest = __rest(_a, ["children", "logo", "homePath"]);
|
|
1035
|
+
return (jsxs(Flex, __assign({ p: "24px 120px", bg: "var(--color-white)", align: "center", justify: "space-between", component: "nav" }, rest, { children: [jsx("a", { href: homePath || '/', children: logo || (jsx(Umbrello, { fill: "var(--color-neutral-600)", width: "200", height: "40", viewBox: "0 0 200 40" })) }), children] })));
|
|
1034
1036
|
};
|
|
1035
1037
|
|
|
1036
1038
|
var Pagination = function (_a) {
|
|
@@ -1163,7 +1165,7 @@ var StatusBadge = function (props) {
|
|
|
1163
1165
|
var _a, _b;
|
|
1164
1166
|
var backgroundColor = ((_a = variantMap[props.variant]) === null || _a === undefined ? undefined : _a.backgroundColor) || 'var(--color-neutral-400)';
|
|
1165
1167
|
var color = ((_b = variantMap[props.variant]) === null || _b === undefined ? undefined : _b.color) || 'var(--color-jet-black)';
|
|
1166
|
-
return (jsxs("div", { style: __assign(__assign({}, props.style), { backgroundColor: backgroundColor, padding: "".concat(props.small ? 0 : 6, "px 14px"), borderRadius: 999, width: 'fit-content', display: 'flex', alignItems: 'center', gap: 8 }), children: [props.icon, jsx(Text, { variant: "
|
|
1168
|
+
return (jsxs("div", { style: __assign(__assign({}, props.style), { backgroundColor: backgroundColor, padding: "".concat(props.small ? 0 : 6, "px 14px"), borderRadius: 999, width: 'fit-content', display: 'flex', alignItems: 'center', gap: 8 }), children: [props.icon, jsx(Text, { variant: "input", style: {
|
|
1167
1169
|
color: color,
|
|
1168
1170
|
lineHeight: '16px',
|
|
1169
1171
|
margin: '8px 0',
|
|
@@ -1291,7 +1293,7 @@ var Tooltip = function (_a) {
|
|
|
1291
1293
|
}, offset: 4, children: children })));
|
|
1292
1294
|
};
|
|
1293
1295
|
|
|
1294
|
-
var multiselectStyles = {"input":"Multiselect-module_input__lwmrJ","disabled":"Multiselect-module_disabled__DyqLt","pill":"Multiselect-module_pill__NwXcT"};
|
|
1296
|
+
var multiselectStyles = {"input":"Multiselect-module_input__lwmrJ","inputFocused":"Multiselect-module_inputFocused__rm-OP","disabled":"Multiselect-module_disabled__DyqLt","pill":"Multiselect-module_pill__NwXcT"};
|
|
1295
1297
|
|
|
1296
1298
|
/**
|
|
1297
1299
|
* MultiSelect component, use it to select multiple options from a list of options
|
|
@@ -1303,99 +1305,160 @@ var multiselectStyles = {"input":"Multiselect-module_input__lwmrJ","disabled":"M
|
|
|
1303
1305
|
* @param {string} placeholder - The placeholder of the select
|
|
1304
1306
|
* @param {string} error - The error message to display
|
|
1305
1307
|
* @param {string} description - The description to display
|
|
1308
|
+
* @param {boolean} disabled - Whether the select is disabled
|
|
1309
|
+
* @param {number} maxPills - The maximum number of pills to display, the rest will be displayed as a single pill with the number of remaining items
|
|
1306
1310
|
*
|
|
1307
1311
|
* @returns {React.ReactElement} The MultiSelect component
|
|
1308
1312
|
*
|
|
1309
1313
|
*/
|
|
1310
1314
|
var Multiselect = function (_a) {
|
|
1311
|
-
var data = _a.data, onApply = _a.onApply, error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, onBlur = _a.onBlur, _b = _a.disabled, disabled = _b === undefined ? false : _b;
|
|
1315
|
+
var data = _a.data, onApply = _a.onApply, error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, onBlur = _a.onBlur, _b = _a.disabled, disabled = _b === undefined ? false : _b, _c = _a.maxPills, maxPills = _c === undefined ? 3 : _c;
|
|
1312
1316
|
var dataKey = useMemo(function () { return data.map(function (o) { return o.value; }).join('_'); }, [data]);
|
|
1313
|
-
return (jsx(MultiselectInternal, { data: data, onApply: onApply, error: error, description: description, label: label, placeholder: placeholder, onBlur: onBlur, disabled: disabled }, dataKey));
|
|
1317
|
+
return (jsx(MultiselectInternal, { data: data, onApply: onApply, error: error, description: description, label: label, placeholder: placeholder, onBlur: onBlur, disabled: disabled, maxPills: maxPills }, dataKey));
|
|
1314
1318
|
};
|
|
1315
1319
|
/**
|
|
1316
|
-
*
|
|
1320
|
+
* The internal component that maintains:
|
|
1321
|
+
* - committedOptions (pills shown when dropdown is closed)
|
|
1322
|
+
* - temporaryOptions (draft selection while dropdown is open)
|
|
1323
|
+
* - searchTerm (to filter the dropdown’s list)
|
|
1317
1324
|
*/
|
|
1318
1325
|
var MultiselectInternal = function (_a) {
|
|
1319
|
-
var data = _a.data, onApply = _a.onApply, error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, onBlur = _a.onBlur, disabled = _a.disabled;
|
|
1320
|
-
|
|
1321
|
-
var
|
|
1322
|
-
|
|
1323
|
-
var
|
|
1324
|
-
|
|
1325
|
-
var
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1326
|
+
var data = _a.data, onApply = _a.onApply, error = _a.error, description = _a.description, label = _a.label, placeholder = _a.placeholder, onBlur = _a.onBlur, disabled = _a.disabled, maxPills = _a.maxPills;
|
|
1327
|
+
// Final selection that shows up as pills when closed / after Apply
|
|
1328
|
+
var _b = useState(data), committedOptions = _b[0], setCommittedOptions = _b[1];
|
|
1329
|
+
// Draft selection while dropdown is open
|
|
1330
|
+
var _c = useState(data), temporaryOptions = _c[0], setTemporaryOptions = _c[1];
|
|
1331
|
+
var _d = useState(''), searchTerm = _d[0], setSearchTerm = _d[1];
|
|
1332
|
+
var _e = useState(false), isFocused = _e[0], setIsFocused = _e[1];
|
|
1333
|
+
var _f = useState(false), isHovered = _f[0], setIsHovered = _f[1];
|
|
1334
|
+
var hasSelectedOptions = committedOptions.some(function (opt) { return opt.selected; });
|
|
1335
|
+
/* -----------------------------------
|
|
1336
|
+
* Handlers
|
|
1337
|
+
* ----------------------------------- */
|
|
1338
|
+
var handleBlur = function () {
|
|
1339
|
+
setIsFocused(false);
|
|
1340
|
+
onBlur === null || onBlur === undefined ? undefined : onBlur();
|
|
1341
|
+
};
|
|
1342
|
+
/** Toggle a checkbox in the *draft* list */
|
|
1343
|
+
var handleDraftToggle = function (option) {
|
|
1344
|
+
setTemporaryOptions(function (prev) {
|
|
1345
|
+
return prev.map(function (o) {
|
|
1346
|
+
return o.value === option.value ? __assign(__assign({}, o), { selected: !o.selected }) : o;
|
|
1347
|
+
});
|
|
1331
1348
|
});
|
|
1332
|
-
setTemporaryOptions(newOptions);
|
|
1333
1349
|
};
|
|
1350
|
+
/** Click "Apply" => copy draft to pills (committed) and call onApply */
|
|
1334
1351
|
var handleApply = function (closeDropdown) {
|
|
1352
|
+
setCommittedOptions(temporaryOptions);
|
|
1335
1353
|
onApply(temporaryOptions);
|
|
1336
1354
|
closeDropdown();
|
|
1337
1355
|
};
|
|
1356
|
+
/** Click "Clear" => reset the *draft* selection (not pills yet) */
|
|
1338
1357
|
var handleClear = function () {
|
|
1339
|
-
var
|
|
1340
|
-
setTemporaryOptions(
|
|
1358
|
+
var reset = data.map(function (o) { return (__assign(__assign({}, o), { selected: false })); });
|
|
1359
|
+
setTemporaryOptions(reset);
|
|
1341
1360
|
};
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
}
|
|
1347
|
-
};
|
|
1348
|
-
var handleDeselect = function (optionId) {
|
|
1349
|
-
var newOptions = temporaryOptions.map(function (option) {
|
|
1350
|
-
if (option.value === optionId) {
|
|
1351
|
-
return __assign(__assign({}, option), { selected: false });
|
|
1352
|
-
}
|
|
1353
|
-
return option;
|
|
1361
|
+
/** Clicking the "X" on a pill => remove from *committed* immediately */
|
|
1362
|
+
var handleDeselectPill = function (optionId) {
|
|
1363
|
+
var newCommitted = committedOptions.map(function (o) {
|
|
1364
|
+
return o.value === optionId ? __assign(__assign({}, o), { selected: false }) : o;
|
|
1354
1365
|
});
|
|
1355
|
-
|
|
1356
|
-
|
|
1366
|
+
setCommittedOptions(newCommitted);
|
|
1367
|
+
setTemporaryOptions(newCommitted);
|
|
1368
|
+
onApply(newCommitted);
|
|
1357
1369
|
};
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1370
|
+
/* -----------------------------------
|
|
1371
|
+
* Search / Filtering
|
|
1372
|
+
* ----------------------------------- */
|
|
1373
|
+
var filteredTempOptions = useMemo(function () {
|
|
1374
|
+
if (!searchTerm.trim())
|
|
1375
|
+
return temporaryOptions;
|
|
1376
|
+
return temporaryOptions.filter(function (o) {
|
|
1377
|
+
return o.label.toLowerCase().includes(searchTerm.toLowerCase());
|
|
1378
|
+
});
|
|
1379
|
+
}, [searchTerm, temporaryOptions]);
|
|
1380
|
+
// Build the actual dropdown checkboxes from the filtered list
|
|
1381
|
+
var dropdownOptions = useMemo(function () {
|
|
1382
|
+
var allSelected = filteredTempOptions.length > 0 &&
|
|
1383
|
+
filteredTempOptions.every(function (o) { return o.selected; });
|
|
1384
|
+
var selectAllOption = (jsx(Dropdown.Option, { value: "select_all", py: 12, onClick: function (e) { return e.stopPropagation(); }, children: jsx(Checkbox, { label: "Select All", checked: allSelected, onChange: function (e) {
|
|
1385
|
+
e.stopPropagation();
|
|
1386
|
+
setTemporaryOptions(function (prev) {
|
|
1387
|
+
return prev.map(function (item) { return (__assign(__assign({}, item), { selected: !allSelected })); });
|
|
1388
|
+
});
|
|
1389
|
+
}, w: "100%" }) }, "select_all"));
|
|
1390
|
+
// Now build the rest of the normal checkboxes
|
|
1391
|
+
var normalOptions = filteredTempOptions.map(function (option) { return (jsx(Dropdown.Option, { value: option.value, py: 12, disabled: option.disabled,
|
|
1392
|
+
// Don’t close on click
|
|
1393
|
+
onClick: function (e) { return e.stopPropagation(); }, children: jsx(Checkbox, { label: option.label, checked: option.selected, disabled: option.disabled, onChange: function (e) {
|
|
1394
|
+
e.stopPropagation();
|
|
1395
|
+
handleDraftToggle(option);
|
|
1396
|
+
}, w: "100%" }, option.value) }, option.value)); });
|
|
1397
|
+
var emptyOptions = (jsx(Dropdown.Option, { value: "No options found", style: { cursor: 'not-allowed', pointerEvents: 'none' }, children: "No matches found, try something else." }));
|
|
1398
|
+
return normalOptions.length > 0
|
|
1399
|
+
? __spreadArray([selectAllOption], normalOptions, true) : [emptyOptions];
|
|
1400
|
+
}, [filteredTempOptions]);
|
|
1401
|
+
/* -----------------------------------
|
|
1402
|
+
* Sections
|
|
1403
|
+
* ----------------------------------- */
|
|
1404
|
+
/**
|
|
1405
|
+
* The main "input" area, showing:
|
|
1406
|
+
* - Pills (from committedOptions) if the dropdown is closed (or open),
|
|
1407
|
+
* but we specifically adjust layout if open.
|
|
1408
|
+
* - If the dropdown is open, also show a search input alongside the pills.
|
|
1409
|
+
*/
|
|
1410
|
+
var PillAndSearchSection = function (_a) {
|
|
1411
|
+
var store = _a.store, _b = _a.maxPills, maxPills = _b === undefined ? 3 : _b;
|
|
1412
|
+
var selected = committedOptions.filter(function (opt) { return opt.selected; });
|
|
1413
|
+
var dropdownOpened = store.dropdownOpened;
|
|
1414
|
+
var allSelected = selected.length === data.length;
|
|
1415
|
+
var searchInputRef = useRef(null);
|
|
1416
|
+
useEffect(function () {
|
|
1417
|
+
var _a;
|
|
1418
|
+
if (dropdownOpened) {
|
|
1419
|
+
(_a = searchInputRef.current) === null || _a === undefined ? undefined : _a.focus();
|
|
1420
|
+
}
|
|
1421
|
+
}, [dropdownOpened]);
|
|
1422
|
+
// If the dropdown is closed and everything is selected => single "All {placeholder}" pill
|
|
1423
|
+
if (!dropdownOpened && allSelected) {
|
|
1424
|
+
return (jsx(Flex, { gap: 8, align: "center", wrap: "wrap", style: { flexGrow: 1, minHeight: 32 }, children: jsxs("span", { className: multiselectStyles.pill, children: [jsxs(Text, { variant: "xs", children: ["All ", placeholder] }), jsx(ActionIcon$1, { variant: "transparent", onClick: function (e) {
|
|
1425
|
+
e.stopPropagation();
|
|
1426
|
+
var newCommitted = committedOptions.map(function (o) { return (__assign(__assign({}, o), { selected: false })); });
|
|
1427
|
+
setCommittedOptions(newCommitted);
|
|
1428
|
+
setTemporaryOptions(newCommitted);
|
|
1429
|
+
onApply(newCommitted);
|
|
1430
|
+
}, children: jsx(Close, { height: "20px", width: "20px", stroke: "var(--color-neutral-600)" }) })] }) }));
|
|
1431
|
+
}
|
|
1432
|
+
// Otherwise, render original logic:
|
|
1433
|
+
return (jsxs(Flex, { gap: 8, align: "center", wrap: "wrap", style: { flexGrow: 1, minHeight: 32 }, children: [selected.length === 0 && !dropdownOpened && (jsx(Text, { variant: "s", children: label })), selected.slice(0, maxPills).map(function (option) { return (jsxs("span", { className: multiselectStyles.pill, children: [jsx(Text, { variant: "xs", children: option.label }), jsx(ActionIcon$1, { variant: "transparent", onClick: function (e) {
|
|
1434
|
+
e.stopPropagation();
|
|
1435
|
+
handleDeselectPill(option.value);
|
|
1436
|
+
}, children: jsx(Close, { height: "20px", width: "20px", stroke: "var(--color-neutral-600)" }) })] }, option.value)); }), selected.length > maxPills && (jsx(Tooltip, { label: selected
|
|
1437
|
+
.slice(maxPills, selected.length)
|
|
1438
|
+
.map(function (o) { return o.label; })
|
|
1439
|
+
.join(', '), position: "bottom", children: jsx("span", { className: multiselectStyles.pill, children: jsxs(Text, { variant: "xs", children: ["+", selected.length - maxPills] }) }, "more") })), dropdownOpened && (jsx("input", { ref: searchInputRef, type: "text", placeholder: "Search ".concat(placeholder, "..."), value: searchTerm, onChange: function (e) { return setSearchTerm(e.target.value); }, style: {
|
|
1440
|
+
flexGrow: 1,
|
|
1441
|
+
minWidth: 80,
|
|
1442
|
+
border: '1px solid var(--color-gray-200)',
|
|
1443
|
+
borderRadius: 4,
|
|
1444
|
+
padding: '4px 8px',
|
|
1445
|
+
outline: 'none',
|
|
1446
|
+
}, onClick: function (e) { return e.stopPropagation(); } }))] }));
|
|
1377
1447
|
};
|
|
1378
1448
|
var ErrorSection = (jsxs(Flex, { className: styles$k.error, gap: 4, ml: 16, mt: 8, style: { visibility: error ? 'visible' : 'hidden' }, children: [jsx(Info, { width: "18px", height: "18px", viewBox: "0 0 24 24", stroke: "var(--color-red-300)" }), jsx(Text, { variant: "xs", className: classNames(styles$k.errorText), children: error })] }));
|
|
1379
1449
|
var DescriptionSection = (jsx(Flex, { className: styles$k.description, gap: 4, ml: 16, mt: 8, style: { visibility: description ? 'visible' : 'hidden' }, children: jsx(Text, { variant: "xs", children: description }) }));
|
|
1380
|
-
var
|
|
1381
|
-
|
|
1382
|
-
return (jsx(Dropdown.Option, { value: option.value, py: 12, disabled: option.disabled, onClick: function (e) {
|
|
1383
|
-
e.stopPropagation();
|
|
1384
|
-
}, children: jsx(Checkbox, { label: option.label, checked: option.selected, disabled: option.disabled, onChange: function (e) {
|
|
1385
|
-
handleOptionClick(option);
|
|
1386
|
-
e.stopPropagation();
|
|
1387
|
-
}, w: "100%" }, option.value) }, option.value));
|
|
1388
|
-
});
|
|
1389
|
-
}, [temporaryOptions]);
|
|
1390
|
-
return (jsx(Dropdown, { options: options, maxHeight: 300, footer: function (store) { return (jsxs(Flex, { justify: "flex-end", py: 8, gap: 8, children: [jsx(Button, { variant: "outlined", label: "Clear", size: "small", onClick: handleClear }), jsx(Button, { variant: "filled", label: "Apply", size: "small", onClick: function () { return handleApply(store.closeDropdown); } })] })); }, children: function (store) {
|
|
1450
|
+
var dropdownFooter = function (store) { return (jsxs(Flex, { justify: "flex-end", py: 8, gap: 8, children: [jsx(Button, { variant: "outlined", label: "Clear", size: "small", onClick: handleClear }), jsx(Button, { variant: "filled", label: "Apply", size: "small", onClick: function () { return handleApply(store.closeDropdown); } })] })); };
|
|
1451
|
+
return (jsx(Dropdown, { options: dropdownOptions, maxHeight: 300, footer: dropdownFooter, children: function (store) {
|
|
1391
1452
|
var _a, _b;
|
|
1392
|
-
|
|
1453
|
+
var floatLabel = store.dropdownOpened || hasSelectedOptions;
|
|
1454
|
+
return (jsxs("div", { className: styles$k.container, children: [floatLabel && (jsx("label", { className: classNames(styles$k.label, (_a = {},
|
|
1393
1455
|
_a[styles$k.labelError] = error && !isFocused,
|
|
1394
1456
|
_a[styles$k.labelFocused] = isFocused || isHovered,
|
|
1395
1457
|
_a)), children: label })), jsxs(Box, { className: classNames(styles$k.input, multiselectStyles.input, (_b = {},
|
|
1396
1458
|
_b[styles$k.inputError] = error && !isFocused,
|
|
1459
|
+
_b[multiselectStyles.inputFocused] = isFocused || store.dropdownOpened,
|
|
1397
1460
|
_b[multiselectStyles.disabled] = disabled,
|
|
1398
|
-
_b)), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: function () { return store.toggleDropdown(); }, onFocus: function () { return setIsFocused(true); }, onBlur: handleBlur, tabIndex: 0, children: [jsx(
|
|
1461
|
+
_b)), onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); }, onClick: function () { return store.toggleDropdown(); }, onFocus: function () { return setIsFocused(true); }, onBlur: handleBlur, tabIndex: 0, children: [jsx(PillAndSearchSection, { store: store, maxPills: maxPills }), jsx(Chevron, { rotate: store.dropdownOpened ? 90 : 270 })] }), error ? ErrorSection : DescriptionSection] }));
|
|
1399
1462
|
} }));
|
|
1400
1463
|
};
|
|
1401
1464
|
|
|
@@ -1413,7 +1476,7 @@ var Attachment = function (props) {
|
|
|
1413
1476
|
|
|
1414
1477
|
var Bell = function (_a) {
|
|
1415
1478
|
var _b = _a.width, width = _b === undefined ? '32px' : _b, _c = _a.height, height = _c === undefined ? '32px' : _c, _d = _a.viewBox, viewBox = _d === undefined ? '0 0 32 32' : _d, _e = _a.alert, alert = _e === undefined ? false : _e;
|
|
1416
|
-
return (jsxs(Icon, { width: width, height: height, viewBox: viewBox, children: [jsx("path", { d: "M14.1429 27.8572H17.5714", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M22.7143 15C22.7143 13.1813 21.9919 11.4372 20.7059 10.1512C19.4199 8.86527 17.6758 8.14282 15.8572 8.14282C14.0385 8.14282 12.2944 8.86527 11.0084 10.1512C9.72247 11.4372 9.00002 13.1813 9.00002 15V21C9.00002 21.6819 8.72909 22.3361 8.24686 22.8183C7.76463 23.3005 7.11057 23.5714 6.42859 23.5714H25.2857C24.6038 23.5714 23.9496 23.3005 23.4674 22.8183C22.9852 22.3361 22.7143 21.6819 22.7143 21V15Z", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M4.71429 14.777C4.71522 13.1453 5.10435 11.5372 5.84956 10.0855C6.59476 8.63384 7.67464 7.38032 9.00001 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M25.8648 10.0855C25.1196 8.63384 24.0396 7.38032 22.7143 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), alert && (jsx("circle", { cx: "22.2857", cy: "9.14282", r: "5.5", fill: "
|
|
1479
|
+
return (jsxs(Icon, { width: width, height: height, viewBox: viewBox, children: [jsx("path", { d: "M14.1429 27.8572H17.5714", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M22.7143 15C22.7143 13.1813 21.9919 11.4372 20.7059 10.1512C19.4199 8.86527 17.6758 8.14282 15.8572 8.14282C14.0385 8.14282 12.2944 8.86527 11.0084 10.1512C9.72247 11.4372 9.00002 13.1813 9.00002 15V21C9.00002 21.6819 8.72909 22.3361 8.24686 22.8183C7.76463 23.3005 7.11057 23.5714 6.42859 23.5714H25.2857C24.6038 23.5714 23.9496 23.3005 23.4674 22.8183C22.9852 22.3361 22.7143 21.6819 22.7143 21V15Z", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M4.71429 14.777C4.71522 13.1453 5.10435 11.5372 5.84956 10.0855C6.59476 8.63384 7.67464 7.38032 9.00001 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), jsx("path", { d: "M25.8648 10.0855C25.1196 8.63384 24.0396 7.38032 22.7143 6.42847", stroke: "black", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), alert && (jsx("circle", { cx: "22.2857", cy: "9.14282", r: "5.5", fill: "#7B34D6", stroke: "white" }))] }));
|
|
1417
1480
|
};
|
|
1418
1481
|
|
|
1419
1482
|
var Cat = function (props) {
|
|
@@ -1535,4 +1598,4 @@ var World = function (_a) {
|
|
|
1535
1598
|
};
|
|
1536
1599
|
|
|
1537
1600
|
export { Document as $, Accordion as A, Badge as B, Card as C, DateInput as D, EnterCodeInput as E, FileInput as F, Multiselect as G, Alert as H, IncrementNumber as I, Arrow as J, Attachment as K, Link as L, Message as M, NavBar as N, AvatarPlaceholder as O, PasswordInput as P, Bell as Q, RadioButton as R, SegmentedControl as S, Table as T, Calendar as U, Cat as V, Chevron as W, Clock as X, Close as Y, Cloud as Z, Delete as _, AccordionItem as a, Dog as a0, EyeHide as a1, EyeShow as a2, Fingerprint as a3, Google as a4, Grid as a5, HappyFace as a6, House as a7, HouseTime as a8, Identification as a9, Info as aa, Location as ab, Mail as ac, Menu as ad, MenuTouched as ae, Notification as af, Open as ag, Pets as ah, Phone as ai, Plaid as aj, Plus as ak, Remove as al, Search as am, ThreeDots as an, ThumbsDown as ao, Tick as ap, Umbrello as aq, Upload as ar, Visa as as, Warning as at, World as au, capitalizeFirstSentenceLetter as av, AccordionControl as b, AccordionPanel as c, ActionIcon as d, Animation as e, Autocomplete as f, getDefaultExportFromCjs as g, badgeVariantMap as h, Button as i, cardStatusVariantMap as j, CardStatus as k, Checkbox as l, Dropdown as m, FileUpload as n, Input as o, LinkModal as p, Loader as q, Modal as r, Pagination as s, Select as t, StatusBadge as u, Tabs as v, Text as w, Textarea as x, ToastContainer as y, Tooltip as z };
|
|
1538
|
-
//# sourceMappingURL=index-
|
|
1601
|
+
//# sourceMappingURL=index-COG80HZJ.js.map
|