lecom-ui 5.4.31 → 5.4.32
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/README.md +1 -1
- package/dist/components/Combobox/Combobox.js +42 -178
- package/dist/components/DataTable/DataTable.js +2 -2
- package/dist/components/DataTable/DataTable.utils.js +1 -1
- package/dist/components/DataTable/Table.js +1 -1
- package/dist/components/Header/SearchInput.js +1 -4
- package/dist/components/Input/Input.js +2 -2
- package/dist/components/Layout/Layout.js +0 -3
- package/dist/components/MultiSelect/MultiSelect.js +124 -238
- package/dist/components/Pagination/Pagination.js +5 -20
- package/dist/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/components/TagInput/TagInput.js +12 -36
- package/dist/i18n/locales/en_us.js +2 -4
- package/dist/i18n/locales/es_es.js +2 -4
- package/dist/i18n/locales/pt_br.js +2 -4
- package/dist/index.d.ts +5 -11
- package/dist/plugin/extend.js +79 -79
- package/dist/plugin/fontFaces.js +172 -172
- package/dist/plugin/general.js +12 -12
- package/dist/plugin/pluginDev.cjs +5 -5
- package/dist/plugin/pluginNext.cjs +5 -5
- package/dist/plugin/pluginNextTurbo.cjs +5 -5
- package/dist/plugin/pluginVite.cjs +5 -5
- package/dist/plugin/template.js +31 -31
- package/dist/plugin/typographies.js +152 -152
- package/dist/plugin/varsTheme.js +79 -79
- package/dist/style.min.css +1 -1
- package/package.json +1 -1
- package/dist/components/Collapse/Collapse.js +0 -94
- package/dist/components/CustomIcon/Icons/CadastroFacil.js +0 -23
- package/dist/components/CustomIcon/Icons/LogoLecom.js +0 -30
- package/dist/components/CustomIcon/Icons/LogoLecomBrand.js +0 -23
- package/dist/components/CustomIcon/Icons/ModoTeste.js +0 -23
- package/dist/components/CustomIcon/Icons/Rpa.js +0 -23
- package/dist/components/CustomIcon/Icons/SairModoTeste.js +0 -31
- package/dist/components/IconHandler/IconHandler.js +0 -99
|
@@ -56,17 +56,13 @@ const MultiSelect = React.forwardRef(
|
|
|
56
56
|
allowTypoDistance = 0,
|
|
57
57
|
groupedOptions,
|
|
58
58
|
classNameContent,
|
|
59
|
-
size = "medium"
|
|
60
|
-
disabled = false,
|
|
61
|
-
readOnly = false
|
|
59
|
+
size = "medium"
|
|
62
60
|
}, ref) => {
|
|
63
61
|
const { t } = useTranslation();
|
|
64
62
|
const [selectedValues, setSelectedValues] = React.useState(value);
|
|
65
63
|
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
|
|
66
64
|
const [query, setQuery] = React.useState("");
|
|
67
|
-
const [dynamicMaxCount, setDynamicMaxCount] = React.useState(
|
|
68
|
-
selectedValues.length || 1
|
|
69
|
-
);
|
|
65
|
+
const [dynamicMaxCount, setDynamicMaxCount] = React.useState(selectedValues.length || 1);
|
|
70
66
|
const buttonRef = React.useRef(null);
|
|
71
67
|
React.useEffect(() => {
|
|
72
68
|
const shallowEqual = (a, b) => {
|
|
@@ -170,13 +166,11 @@ const MultiSelect = React.forwardRef(
|
|
|
170
166
|
}
|
|
171
167
|
};
|
|
172
168
|
const toggleOption = (option) => {
|
|
173
|
-
if (readOnly) return;
|
|
174
169
|
const newSelectedValues = selectedValues.includes(option) ? selectedValues.filter((value2) => value2 !== option) : [...selectedValues, option];
|
|
175
170
|
setSelectedValues(newSelectedValues);
|
|
176
171
|
onValueChange(newSelectedValues);
|
|
177
172
|
};
|
|
178
173
|
const handleClear = () => {
|
|
179
|
-
if (readOnly) return;
|
|
180
174
|
setSelectedValues([]);
|
|
181
175
|
onValueChange([]);
|
|
182
176
|
};
|
|
@@ -184,7 +178,6 @@ const MultiSelect = React.forwardRef(
|
|
|
184
178
|
setIsPopoverOpen((prev) => !prev);
|
|
185
179
|
};
|
|
186
180
|
const toggleAll = () => {
|
|
187
|
-
if (readOnly) return;
|
|
188
181
|
if (treeOptions && treeOptions.length) {
|
|
189
182
|
const gather = (acc, nodes) => {
|
|
190
183
|
for (const n of nodes) {
|
|
@@ -347,10 +340,7 @@ const MultiSelect = React.forwardRef(
|
|
|
347
340
|
if (!node.children || node.children.length === 0) {
|
|
348
341
|
return [node.value];
|
|
349
342
|
}
|
|
350
|
-
return [
|
|
351
|
-
node.value,
|
|
352
|
-
...node.children.flatMap((c) => collectAllValues(c))
|
|
353
|
-
];
|
|
343
|
+
return [node.value, ...node.children.flatMap((c) => collectAllValues(c))];
|
|
354
344
|
}
|
|
355
345
|
};
|
|
356
346
|
const isNodeFullySelected = (node) => {
|
|
@@ -381,7 +371,6 @@ const MultiSelect = React.forwardRef(
|
|
|
381
371
|
}
|
|
382
372
|
};
|
|
383
373
|
const toggleTreeNode = (node) => {
|
|
384
|
-
if (readOnly) return;
|
|
385
374
|
if (treeSelectionStrategy === "all") {
|
|
386
375
|
const isSelected = selectedValues.includes(node.value);
|
|
387
376
|
const next = isSelected ? selectedValues.filter((v) => v !== node.value) : [...selectedValues, node.value];
|
|
@@ -465,8 +454,7 @@ const MultiSelect = React.forwardRef(
|
|
|
465
454
|
{
|
|
466
455
|
className: cn(
|
|
467
456
|
"flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm text-grey-800 hover:bg-grey-100",
|
|
468
|
-
(fully || isSelectedLeaf) && "bg-blue-50"
|
|
469
|
-
readOnly && "cursor-default hover:bg-transparent"
|
|
457
|
+
(fully || isSelectedLeaf) && "bg-blue-50"
|
|
470
458
|
),
|
|
471
459
|
style: { paddingLeft: depth * 14 + 8 }
|
|
472
460
|
},
|
|
@@ -479,9 +467,7 @@ const MultiSelect = React.forwardRef(
|
|
|
479
467
|
),
|
|
480
468
|
onClick: (e) => {
|
|
481
469
|
e.stopPropagation();
|
|
482
|
-
|
|
483
|
-
toggleTreeNode(n);
|
|
484
|
-
}
|
|
470
|
+
toggleTreeNode(n);
|
|
485
471
|
}
|
|
486
472
|
},
|
|
487
473
|
fully && /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }),
|
|
@@ -494,9 +480,7 @@ const MultiSelect = React.forwardRef(
|
|
|
494
480
|
className: "flex-1 truncate cursor-pointer overflow-hidden",
|
|
495
481
|
onClick: (e) => {
|
|
496
482
|
e.stopPropagation();
|
|
497
|
-
|
|
498
|
-
toggleTreeNode(n);
|
|
499
|
-
}
|
|
483
|
+
toggleTreeNode(n);
|
|
500
484
|
},
|
|
501
485
|
title: n.label
|
|
502
486
|
},
|
|
@@ -530,62 +514,40 @@ const MultiSelect = React.forwardRef(
|
|
|
530
514
|
transition-all duration-300 outline-none
|
|
531
515
|
[&_svg]:pointer-events-auto`,
|
|
532
516
|
maxCount === void 0 && TRIGGER_HEIGHT_CLASSES[size],
|
|
533
|
-
disabled && "opacity-50 cursor-not-allowed pointer-events-none",
|
|
534
|
-
readOnly && !disabled && "opacity-50 hover:border-grey-400",
|
|
535
517
|
className
|
|
536
518
|
),
|
|
537
|
-
"aria-expanded": isPopoverOpen
|
|
538
|
-
"aria-readonly": readOnly,
|
|
539
|
-
disabled
|
|
519
|
+
"aria-expanded": isPopoverOpen
|
|
540
520
|
},
|
|
541
521
|
selectedValues.length > 0 ? /* @__PURE__ */ React.createElement("div", { className: "flex justify-between items-center w-full" }, /* @__PURE__ */ React.createElement("div", { className: "flex flex-wrap items-center gap-1" }, selectedValues.slice(0, dynamicMaxCount).map((value2) => {
|
|
542
|
-
const selectedOption = options.find(
|
|
543
|
-
(option) => option.value === value2
|
|
544
|
-
);
|
|
522
|
+
const selectedOption = options.find((option) => option.value === value2);
|
|
545
523
|
const label = findTreeLabel(value2) || selectedOption?.label || value2;
|
|
546
524
|
const prefix = selectedOption?.prefix;
|
|
547
|
-
return /* @__PURE__ */ React.createElement(
|
|
548
|
-
|
|
525
|
+
return /* @__PURE__ */ React.createElement(Tag, { key: value2, color: "blue", className: "focus:ring-0 flex items-center gap-2 max-w-[15.625rem]" }, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate min-w-0" }, prefix && /* @__PURE__ */ React.createElement(
|
|
526
|
+
Typography,
|
|
549
527
|
{
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
className: "focus:ring-0 flex items-center gap-2 max-w-[15.625rem]"
|
|
528
|
+
className: "flex items-center flex-shrink-0 [&_svg]:text-blue-600",
|
|
529
|
+
textColor: "text-blue-600"
|
|
553
530
|
},
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
!disabled && !readOnly && /* @__PURE__ */ React.createElement(
|
|
571
|
-
X,
|
|
572
|
-
{
|
|
573
|
-
className: "h-4 w-4 cursor-pointer flex-shrink-0",
|
|
574
|
-
onClick: (event) => {
|
|
575
|
-
event.stopPropagation();
|
|
576
|
-
toggleOption(value2);
|
|
577
|
-
}
|
|
531
|
+
prefix
|
|
532
|
+
), /* @__PURE__ */ React.createElement(
|
|
533
|
+
Typography,
|
|
534
|
+
{
|
|
535
|
+
variant: getFontVariant(size),
|
|
536
|
+
textColor: "text-blue-600",
|
|
537
|
+
className: "truncate"
|
|
538
|
+
},
|
|
539
|
+
label
|
|
540
|
+
)), /* @__PURE__ */ React.createElement(
|
|
541
|
+
X,
|
|
542
|
+
{
|
|
543
|
+
className: "h-4 w-4 cursor-pointer flex-shrink-0",
|
|
544
|
+
onClick: (event) => {
|
|
545
|
+
event.stopPropagation();
|
|
546
|
+
toggleOption(value2);
|
|
578
547
|
}
|
|
579
|
-
|
|
580
|
-
);
|
|
581
|
-
}), selectedValues.length > dynamicMaxCount && /* @__PURE__ */ React.createElement(Tag, { color: "blue", className: "focus:ring-0" }, /* @__PURE__ */ React.createElement(
|
|
582
|
-
Typography,
|
|
583
|
-
{
|
|
584
|
-
variant: getFontVariant(size),
|
|
585
|
-
className: "text-blue-600"
|
|
586
|
-
},
|
|
587
|
-
`+ ${selectedValues.length - dynamicMaxCount}`
|
|
588
|
-
))), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, !disabled && !readOnly && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
548
|
+
}
|
|
549
|
+
));
|
|
550
|
+
}), selectedValues.length > dynamicMaxCount && /* @__PURE__ */ React.createElement(Tag, { color: "blue", className: "focus:ring-0" }, /* @__PURE__ */ React.createElement(Typography, { variant: getFontVariant(size), className: "text-blue-600" }, `+ ${selectedValues.length - dynamicMaxCount}`))), /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between" }, /* @__PURE__ */ React.createElement(
|
|
589
551
|
X,
|
|
590
552
|
{
|
|
591
553
|
className: "h-4 w-4 cursor-pointer text-grey-800",
|
|
@@ -600,11 +562,11 @@ const MultiSelect = React.forwardRef(
|
|
|
600
562
|
orientation: "vertical",
|
|
601
563
|
className: "flex min-h-4 mx-1 h-full"
|
|
602
564
|
}
|
|
603
|
-
)
|
|
565
|
+
), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 w-4 cursor-pointer text-grey-800" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 w-4 cursor-pointer text-grey-800" }))) : /* @__PURE__ */ React.createElement("div", { className: "flex items-center justify-between w-full mx-auto" }, /* @__PURE__ */ React.createElement(
|
|
604
566
|
Typography,
|
|
605
567
|
{
|
|
606
568
|
variant: getFontVariant(size),
|
|
607
|
-
className: "text-grey-
|
|
569
|
+
className: "text-grey-800 mx-3"
|
|
608
570
|
},
|
|
609
571
|
placeholder
|
|
610
572
|
), isPopoverOpen ? /* @__PURE__ */ React.createElement(ChevronUp, { className: "h-4 cursor-pointer text-grey-800 mx-2" }) : /* @__PURE__ */ React.createElement(ChevronDown, { className: "h-4 cursor-pointer text-grey-800 mx-2" }))
|
|
@@ -621,165 +583,114 @@ const MultiSelect = React.forwardRef(
|
|
|
621
583
|
align: "start",
|
|
622
584
|
onEscapeKeyDown: () => setIsPopoverOpen(false)
|
|
623
585
|
},
|
|
624
|
-
!isTree && /* @__PURE__ */ React.createElement(
|
|
625
|
-
|
|
586
|
+
!isTree && /* @__PURE__ */ React.createElement(Command, { shouldFilter: false, className: SEARCH_INPUT_CLASSES[size] }, /* @__PURE__ */ React.createElement(
|
|
587
|
+
CommandInput,
|
|
626
588
|
{
|
|
627
|
-
|
|
628
|
-
|
|
589
|
+
placeholder: treeSearchPlaceholder || t("multiSelect.search"),
|
|
590
|
+
onKeyDown: handleInputKeyDown,
|
|
591
|
+
value: query,
|
|
592
|
+
onValueChange: (v) => setQuery(v)
|
|
593
|
+
}
|
|
594
|
+
), /* @__PURE__ */ React.createElement(CommandList, null, /* @__PURE__ */ React.createElement(CommandGroup, null, (effectiveOptions.length === 0 || query && filteredOptions.length === 0) && /* @__PURE__ */ React.createElement(CommandEmpty, { className: cn("p-4 text-center text-grey-800", getFontVariant(size)) }, t("multiSelect.empty")), !query && effectiveOptions.length > 0 && /* @__PURE__ */ React.createElement(
|
|
595
|
+
CommandItem,
|
|
596
|
+
{
|
|
597
|
+
key: "all",
|
|
598
|
+
onSelect: toggleAll,
|
|
599
|
+
className: "cursor-pointer"
|
|
629
600
|
},
|
|
630
601
|
/* @__PURE__ */ React.createElement(
|
|
631
|
-
|
|
632
|
-
{
|
|
633
|
-
placeholder: treeSearchPlaceholder || t("multiSelect.search"),
|
|
634
|
-
onKeyDown: handleInputKeyDown,
|
|
635
|
-
value: query,
|
|
636
|
-
onValueChange: (v) => setQuery(v),
|
|
637
|
-
disabled: readOnly
|
|
638
|
-
}
|
|
639
|
-
),
|
|
640
|
-
/* @__PURE__ */ React.createElement(CommandList, null, /* @__PURE__ */ React.createElement(CommandGroup, null, (effectiveOptions.length === 0 || query && filteredOptions.length === 0) && /* @__PURE__ */ React.createElement(
|
|
641
|
-
CommandEmpty,
|
|
602
|
+
"div",
|
|
642
603
|
{
|
|
643
604
|
className: cn(
|
|
644
|
-
"
|
|
645
|
-
|
|
605
|
+
"flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800",
|
|
606
|
+
selectedValues.length > 0 ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
646
607
|
)
|
|
647
608
|
},
|
|
648
|
-
|
|
649
|
-
),
|
|
650
|
-
|
|
609
|
+
selectedValues.length === effectiveOptions.length ? /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }) : /* @__PURE__ */ React.createElement(Minus, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
|
|
610
|
+
),
|
|
611
|
+
/* @__PURE__ */ React.createElement(
|
|
612
|
+
Typography,
|
|
651
613
|
{
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
614
|
+
variant: getFontVariant(size),
|
|
615
|
+
className: "text-grey-800"
|
|
616
|
+
},
|
|
617
|
+
selectAllLabel ?? t("multiSelect.selectAll")
|
|
618
|
+
)
|
|
619
|
+
), isGrouped ? Object.entries(groupedOptions).map(
|
|
620
|
+
([categoryName, categoryOptions]) => {
|
|
621
|
+
const filtered = categoryOptions.filter(
|
|
622
|
+
(opt) => !query || effectiveOptions.some(
|
|
623
|
+
(eff) => eff.value === opt.value && filteredOptions.some(
|
|
624
|
+
(filt) => filt.value === opt.value
|
|
625
|
+
)
|
|
657
626
|
)
|
|
627
|
+
);
|
|
628
|
+
if (!filtered.length) return null;
|
|
629
|
+
return /* @__PURE__ */ React.createElement("div", { key: categoryName }, /* @__PURE__ */ React.createElement("div", { className: "px-2 py-2 text-xs font-medium text-muted-foreground" }, categoryName), filtered.map((option) => {
|
|
630
|
+
const isSelected = selectedValues.includes(
|
|
631
|
+
option.value
|
|
632
|
+
);
|
|
633
|
+
return /* @__PURE__ */ React.createElement(
|
|
634
|
+
CommandItem,
|
|
635
|
+
{
|
|
636
|
+
key: option.value,
|
|
637
|
+
onSelect: () => toggleOption(option.value),
|
|
638
|
+
className: "cursor-pointer"
|
|
639
|
+
},
|
|
640
|
+
/* @__PURE__ */ React.createElement(
|
|
641
|
+
"div",
|
|
642
|
+
{
|
|
643
|
+
className: cn(
|
|
644
|
+
"flex h-4 w-4 items-center justify-center rounded-sm border-2 border-grey-400 flex-shrink-0",
|
|
645
|
+
isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
646
|
+
)
|
|
647
|
+
},
|
|
648
|
+
/* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
|
|
649
|
+
),
|
|
650
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate min-w-0" }, option.prefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center flex-shrink-0" }, option.prefix), /* @__PURE__ */ React.createElement(
|
|
651
|
+
Typography,
|
|
652
|
+
{
|
|
653
|
+
variant: getFontVariant(size),
|
|
654
|
+
className: "text-grey-800 truncate overflow-hidden",
|
|
655
|
+
title: option.label
|
|
656
|
+
},
|
|
657
|
+
highlight(option.label, query)
|
|
658
|
+
))
|
|
659
|
+
);
|
|
660
|
+
}));
|
|
661
|
+
}
|
|
662
|
+
) : filteredOptions.map((option) => {
|
|
663
|
+
const isSelected = selectedValues.includes(
|
|
664
|
+
option.value
|
|
665
|
+
);
|
|
666
|
+
return /* @__PURE__ */ React.createElement(
|
|
667
|
+
CommandItem,
|
|
668
|
+
{
|
|
669
|
+
key: option.value,
|
|
670
|
+
onSelect: () => toggleOption(option.value),
|
|
671
|
+
className: "cursor-pointer"
|
|
658
672
|
},
|
|
659
673
|
/* @__PURE__ */ React.createElement(
|
|
660
674
|
"div",
|
|
661
675
|
{
|
|
662
676
|
className: cn(
|
|
663
|
-
"flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800",
|
|
664
|
-
|
|
677
|
+
"flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800 flex-shrink-0",
|
|
678
|
+
isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
665
679
|
)
|
|
666
680
|
},
|
|
667
|
-
|
|
668
|
-
Check,
|
|
669
|
-
{
|
|
670
|
-
className: "!h-3 !w-3 !text-white",
|
|
671
|
-
strokeWidth: 3
|
|
672
|
-
}
|
|
673
|
-
) : /* @__PURE__ */ React.createElement(
|
|
674
|
-
Minus,
|
|
675
|
-
{
|
|
676
|
-
className: "!h-3 !w-3 !text-white",
|
|
677
|
-
strokeWidth: 3
|
|
678
|
-
}
|
|
679
|
-
)
|
|
681
|
+
/* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
|
|
680
682
|
),
|
|
681
|
-
/* @__PURE__ */ React.createElement(
|
|
683
|
+
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate min-w-0" }, option.prefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center flex-shrink-0" }, option.prefix), /* @__PURE__ */ React.createElement(
|
|
682
684
|
Typography,
|
|
683
685
|
{
|
|
684
686
|
variant: getFontVariant(size),
|
|
685
|
-
className: "text-grey-800"
|
|
687
|
+
className: "text-grey-800 truncate overflow-hidden",
|
|
688
|
+
title: option.label
|
|
686
689
|
},
|
|
687
|
-
|
|
688
|
-
)
|
|
689
|
-
)
|
|
690
|
-
|
|
691
|
-
const filtered = categoryOptions.filter(
|
|
692
|
-
(opt) => !query || effectiveOptions.some(
|
|
693
|
-
(eff) => eff.value === opt.value && filteredOptions.some(
|
|
694
|
-
(filt) => filt.value === opt.value
|
|
695
|
-
)
|
|
696
|
-
)
|
|
697
|
-
);
|
|
698
|
-
if (!filtered.length) return null;
|
|
699
|
-
return /* @__PURE__ */ React.createElement("div", { key: categoryName }, /* @__PURE__ */ React.createElement("div", { className: "px-2 py-2 text-xs font-medium text-muted-foreground" }, categoryName), filtered.map((option) => {
|
|
700
|
-
const isSelected = selectedValues.includes(
|
|
701
|
-
option.value
|
|
702
|
-
);
|
|
703
|
-
return /* @__PURE__ */ React.createElement(
|
|
704
|
-
CommandItem,
|
|
705
|
-
{
|
|
706
|
-
key: option.value,
|
|
707
|
-
onSelect: readOnly ? void 0 : () => toggleOption(option.value),
|
|
708
|
-
className: cn(
|
|
709
|
-
"cursor-pointer",
|
|
710
|
-
readOnly && "cursor-default pointer-events-none hover:bg-transparent"
|
|
711
|
-
)
|
|
712
|
-
},
|
|
713
|
-
/* @__PURE__ */ React.createElement(
|
|
714
|
-
"div",
|
|
715
|
-
{
|
|
716
|
-
className: cn(
|
|
717
|
-
"flex h-4 w-4 items-center justify-center rounded-sm border-2 border-grey-400 flex-shrink-0",
|
|
718
|
-
isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
719
|
-
)
|
|
720
|
-
},
|
|
721
|
-
/* @__PURE__ */ React.createElement(
|
|
722
|
-
Check,
|
|
723
|
-
{
|
|
724
|
-
className: "!h-3 !w-3 !text-white",
|
|
725
|
-
strokeWidth: 3
|
|
726
|
-
}
|
|
727
|
-
)
|
|
728
|
-
),
|
|
729
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate min-w-0" }, option.prefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center flex-shrink-0" }, option.prefix), /* @__PURE__ */ React.createElement(
|
|
730
|
-
Typography,
|
|
731
|
-
{
|
|
732
|
-
variant: getFontVariant(size),
|
|
733
|
-
className: "text-grey-800 truncate overflow-hidden",
|
|
734
|
-
title: option.label
|
|
735
|
-
},
|
|
736
|
-
highlight(option.label, query)
|
|
737
|
-
))
|
|
738
|
-
);
|
|
739
|
-
}));
|
|
740
|
-
}
|
|
741
|
-
) : filteredOptions.map((option) => {
|
|
742
|
-
const isSelected = selectedValues.includes(
|
|
743
|
-
option.value
|
|
744
|
-
);
|
|
745
|
-
return /* @__PURE__ */ React.createElement(
|
|
746
|
-
CommandItem,
|
|
747
|
-
{
|
|
748
|
-
key: option.value,
|
|
749
|
-
onSelect: readOnly ? void 0 : () => toggleOption(option.value),
|
|
750
|
-
className: cn(
|
|
751
|
-
"cursor-pointer",
|
|
752
|
-
readOnly && "cursor-default pointer-events-none hover:bg-transparent"
|
|
753
|
-
)
|
|
754
|
-
},
|
|
755
|
-
/* @__PURE__ */ React.createElement(
|
|
756
|
-
"div",
|
|
757
|
-
{
|
|
758
|
-
className: cn(
|
|
759
|
-
"flex h-4 w-4 items-center justify-center rounded-sm border border-grey-800 flex-shrink-0",
|
|
760
|
-
isSelected ? "bg-blue-600 border-blue-600 text-primary-foreground" : "opacity-50 [&_svg]:invisible"
|
|
761
|
-
)
|
|
762
|
-
},
|
|
763
|
-
/* @__PURE__ */ React.createElement(
|
|
764
|
-
Check,
|
|
765
|
-
{
|
|
766
|
-
className: "!h-3 !w-3 !text-white",
|
|
767
|
-
strokeWidth: 3
|
|
768
|
-
}
|
|
769
|
-
)
|
|
770
|
-
),
|
|
771
|
-
/* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2 truncate min-w-0" }, option.prefix && /* @__PURE__ */ React.createElement(Typography, { className: "flex items-center flex-shrink-0" }, option.prefix), /* @__PURE__ */ React.createElement(
|
|
772
|
-
Typography,
|
|
773
|
-
{
|
|
774
|
-
variant: getFontVariant(size),
|
|
775
|
-
className: "text-grey-800 truncate overflow-hidden",
|
|
776
|
-
title: option.label
|
|
777
|
-
},
|
|
778
|
-
highlight(option.label, query)
|
|
779
|
-
))
|
|
780
|
-
);
|
|
781
|
-
})))
|
|
782
|
-
),
|
|
690
|
+
highlight(option.label, query)
|
|
691
|
+
))
|
|
692
|
+
);
|
|
693
|
+
})))),
|
|
783
694
|
isTree && /* @__PURE__ */ React.createElement("div", { className: "min-w-[260px] max-h-80 overflow-hidden flex flex-col" }, treeSearch && /* @__PURE__ */ React.createElement("div", { className: "px-1 pt-2 pb-0 border-b border-grey-300 flex-shrink-0" }, /* @__PURE__ */ React.createElement("div", { className: "relative" }, /* @__PURE__ */ React.createElement(
|
|
784
695
|
"svg",
|
|
785
696
|
{
|
|
@@ -804,7 +715,6 @@ const MultiSelect = React.forwardRef(
|
|
|
804
715
|
value: treeQuery,
|
|
805
716
|
onChange: (e) => setTreeQuery(e.target.value),
|
|
806
717
|
placeholder: treeSearchPlaceholder || t("multiSelect.search"),
|
|
807
|
-
disabled: readOnly,
|
|
808
718
|
className: cn(
|
|
809
719
|
"w-full pl-9 pr-3 border-0 focus:outline-none focus:ring-0 bg-transparent placeholder:text-muted-foreground",
|
|
810
720
|
getFontVariant(size),
|
|
@@ -814,11 +724,8 @@ const MultiSelect = React.forwardRef(
|
|
|
814
724
|
))), /* @__PURE__ */ React.createElement("div", { className: "px-2 pb-1 overflow-y-auto overflow-x-hidden [&::-webkit-scrollbar]:w-1.5 [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar-thumb]:bg-grey-300 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb:hover]:bg-grey-400" }, !treeQuery && treeOptions && treeOptions.length > 0 && /* @__PURE__ */ React.createElement(
|
|
815
725
|
"div",
|
|
816
726
|
{
|
|
817
|
-
className:
|
|
818
|
-
|
|
819
|
-
readOnly && "cursor-default hover:bg-transparent pointer-events-none"
|
|
820
|
-
),
|
|
821
|
-
onClick: readOnly ? void 0 : toggleAll
|
|
727
|
+
className: "flex items-center gap-2 px-2 py-1 cursor-pointer rounded-sm hover:bg-accent",
|
|
728
|
+
onClick: toggleAll
|
|
822
729
|
},
|
|
823
730
|
/* @__PURE__ */ React.createElement(
|
|
824
731
|
"div",
|
|
@@ -838,19 +745,7 @@ const MultiSelect = React.forwardRef(
|
|
|
838
745
|
acc += treeSelectionStrategy === "all" ? 1 + countAll(n.children) : countAll(n.children);
|
|
839
746
|
}
|
|
840
747
|
return acc;
|
|
841
|
-
}(treeOptions) ? /* @__PURE__ */ React.createElement(
|
|
842
|
-
Check,
|
|
843
|
-
{
|
|
844
|
-
className: "!h-3 !w-3 !text-white",
|
|
845
|
-
strokeWidth: 3
|
|
846
|
-
}
|
|
847
|
-
) : /* @__PURE__ */ React.createElement(
|
|
848
|
-
Minus,
|
|
849
|
-
{
|
|
850
|
-
className: "!h-3 !w-3 !text-white",
|
|
851
|
-
strokeWidth: 3
|
|
852
|
-
}
|
|
853
|
-
)
|
|
748
|
+
}(treeOptions) ? /* @__PURE__ */ React.createElement(Check, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 }) : /* @__PURE__ */ React.createElement(Minus, { className: "!h-3 !w-3 !text-white", strokeWidth: 3 })
|
|
854
749
|
),
|
|
855
750
|
/* @__PURE__ */ React.createElement(
|
|
856
751
|
Typography,
|
|
@@ -860,16 +755,7 @@ const MultiSelect = React.forwardRef(
|
|
|
860
755
|
},
|
|
861
756
|
selectAllLabel ?? t("multiSelect.selectAll")
|
|
862
757
|
)
|
|
863
|
-
), !treeOptions || treeOptions.length === 0 || treeQuery && displayedTree.length === 0 ? /* @__PURE__ */ React.createElement(
|
|
864
|
-
"div",
|
|
865
|
-
{
|
|
866
|
-
className: cn(
|
|
867
|
-
"p-4 text-center text-grey-800",
|
|
868
|
-
getFontVariant(size)
|
|
869
|
-
)
|
|
870
|
-
},
|
|
871
|
-
t("multiSelect.empty")
|
|
872
|
-
) : renderTree(displayedTree)))
|
|
758
|
+
), !treeOptions || treeOptions.length === 0 || treeQuery && displayedTree.length === 0 ? /* @__PURE__ */ React.createElement("div", { className: cn("p-4 text-center text-grey-800", getFontVariant(size)) }, t("multiSelect.empty")) : renderTree(displayedTree)))
|
|
873
759
|
)
|
|
874
760
|
);
|
|
875
761
|
}
|
|
@@ -145,8 +145,7 @@ const PaginationPerPage = ({
|
|
|
145
145
|
className,
|
|
146
146
|
onChangePerPage,
|
|
147
147
|
perPage,
|
|
148
|
-
totalRowsSelected = 0
|
|
149
|
-
maxSelection
|
|
148
|
+
totalRowsSelected = 0
|
|
150
149
|
}) => {
|
|
151
150
|
const { t } = useTranslation();
|
|
152
151
|
const perPageOptions = [
|
|
@@ -166,12 +165,6 @@ const PaginationPerPage = ({
|
|
|
166
165
|
if (!onChangePerPage) {
|
|
167
166
|
return null;
|
|
168
167
|
}
|
|
169
|
-
const getSelectedText = () => {
|
|
170
|
-
if (maxSelection === 1 && totalRowsSelected === 1) {
|
|
171
|
-
return `${totalRowsSelected} ${t("pagination.selectedItemSingular")}`;
|
|
172
|
-
}
|
|
173
|
-
return `${totalRowsSelected} ${t("pagination.selectedProcess")}`;
|
|
174
|
-
};
|
|
175
168
|
return /* @__PURE__ */ React.createElement("div", { className: cn("flex items-center gap-4", className) }, /* @__PURE__ */ React.createElement(DropdownMenu, null, /* @__PURE__ */ React.createElement(DropdownMenuTrigger, { asChild: true }, /* @__PURE__ */ React.createElement(Button, { size: "small", color: "grey", variant: "outlined" }, /* @__PURE__ */ React.createElement("span", { className: "max-md:hidden" }, t("pagination.show")), " ", perPage, /* @__PURE__ */ React.createElement(ChevronDown, { size: 20 }))), /* @__PURE__ */ React.createElement(DropdownMenuContent, { side: "top", align: "center" }, perPageOptions.map((option) => /* @__PURE__ */ React.createElement(
|
|
176
169
|
DropdownMenuItem,
|
|
177
170
|
{
|
|
@@ -181,7 +174,7 @@ const PaginationPerPage = ({
|
|
|
181
174
|
}
|
|
182
175
|
},
|
|
183
176
|
option.value.toString()
|
|
184
|
-
)))), totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" },
|
|
177
|
+
)))), totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" }, totalRowsSelected, " ", t("pagination.selectedProcess")));
|
|
185
178
|
};
|
|
186
179
|
PaginationPerPage.displayName = "PaginationPerPage";
|
|
187
180
|
const Pagination = ({
|
|
@@ -192,8 +185,7 @@ const Pagination = ({
|
|
|
192
185
|
onChangePerPage,
|
|
193
186
|
className,
|
|
194
187
|
activeColor,
|
|
195
|
-
showPerPageSelector = true
|
|
196
|
-
maxSelection
|
|
188
|
+
showPerPageSelector = true
|
|
197
189
|
}) => {
|
|
198
190
|
const { t } = useTranslation();
|
|
199
191
|
const mapPaginationItem = (item) => {
|
|
@@ -223,12 +215,6 @@ const Pagination = ({
|
|
|
223
215
|
};
|
|
224
216
|
return React.createElement(mappedComponents[item.type], componentProps);
|
|
225
217
|
};
|
|
226
|
-
const getSelectedText = () => {
|
|
227
|
-
if (maxSelection === 1 && totalRowsSelected === 1) {
|
|
228
|
-
return `${totalRowsSelected} ${t("pagination.selectedItemSingular")}`;
|
|
229
|
-
}
|
|
230
|
-
return `${totalRowsSelected} ${t("pagination.selectedProcess")}`;
|
|
231
|
-
};
|
|
232
218
|
return /* @__PURE__ */ React.createElement(
|
|
233
219
|
"div",
|
|
234
220
|
{
|
|
@@ -239,11 +225,10 @@ const Pagination = ({
|
|
|
239
225
|
{
|
|
240
226
|
onChangePerPage,
|
|
241
227
|
perPage,
|
|
242
|
-
totalRowsSelected
|
|
243
|
-
maxSelection
|
|
228
|
+
totalRowsSelected
|
|
244
229
|
}
|
|
245
230
|
),
|
|
246
|
-
!showPerPageSelector && totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" },
|
|
231
|
+
!showPerPageSelector && totalRowsSelected > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "heading-xxsmall-600", textColor: "text-grey-800" }, totalRowsSelected, " ", t("pagination.selectedProcess")),
|
|
247
232
|
/* @__PURE__ */ React.createElement("nav", { role: "navigation", "aria-label": "pagination" }, /* @__PURE__ */ React.createElement(PaginationContent, null, itemsPage.map((item) => /* @__PURE__ */ React.createElement(PaginationItem, { key: item.id }, mapPaginationItem(item)))))
|
|
248
233
|
);
|
|
249
234
|
};
|
|
@@ -27,7 +27,7 @@ const ScrollBar = React.forwardRef(({ className, orientation = "vertical", ...pr
|
|
|
27
27
|
),
|
|
28
28
|
...props
|
|
29
29
|
},
|
|
30
|
-
/* @__PURE__ */ React.createElement(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border
|
|
30
|
+
/* @__PURE__ */ React.createElement(ScrollAreaPrimitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
|
|
31
31
|
));
|
|
32
32
|
ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName;
|
|
33
33
|
|