@firecms/ui 3.0.0-canary.118 → 3.0.0-canary.119
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/components/Menu.d.ts +2 -0
- package/dist/components/MultiSelect.d.ts +1 -4
- package/dist/components/NewMultiSelect.d.ts +60 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/index.es.js +348 -51
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +350 -53
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Dialog.tsx +1 -1
- package/src/components/Menu.tsx +9 -2
- package/src/components/MultiSelect.tsx +3 -5
- package/src/components/NewMultiSelect.tsx +370 -0
- package/src/components/Select.tsx +4 -3
- package/src/components/index.tsx +1 -0
@@ -6,6 +6,8 @@ export type MenuProps = {
|
|
6
6
|
defaultOpen?: boolean;
|
7
7
|
onOpenChange?(open: boolean): void;
|
8
8
|
portalContainer?: HTMLElement | null;
|
9
|
+
side?: "top" | "right" | "bottom" | "left";
|
10
|
+
align?: "start" | "center" | "end";
|
9
11
|
};
|
10
12
|
declare const Menu: React.ForwardRefExoticComponent<MenuProps & React.RefAttributes<HTMLButtonElement>>;
|
11
13
|
export { Menu };
|
@@ -17,10 +17,7 @@ export type MultiSelectProps = {
|
|
17
17
|
disabled?: boolean;
|
18
18
|
error?: boolean;
|
19
19
|
position?: "item-aligned" | "popper";
|
20
|
-
endAdornment?: React.ReactNode;
|
21
20
|
inputRef?: React.RefObject<HTMLButtonElement>;
|
22
|
-
padding?: boolean;
|
23
|
-
includeFocusOutline?: boolean;
|
24
21
|
children?: React.ReactNode;
|
25
22
|
};
|
26
23
|
interface MultiSelectContextProps {
|
@@ -29,7 +26,7 @@ interface MultiSelectContextProps {
|
|
29
26
|
onValueChangeInternal: (v: string) => void;
|
30
27
|
}
|
31
28
|
export declare const MultiSelectContext: React.Context<MultiSelectContextProps>;
|
32
|
-
export declare function MultiSelect({ value, open, onMultiValueChange, size, label, disabled, renderValue, renderValues,
|
29
|
+
export declare function MultiSelect({ value, open, onMultiValueChange, size, label, disabled, renderValue, renderValues, containerClassName, className, children, error }: MultiSelectProps): import("react/jsx-runtime").JSX.Element;
|
33
30
|
export interface MultiSelectItemProps {
|
34
31
|
value: string;
|
35
32
|
children?: React.ReactNode;
|
@@ -0,0 +1,60 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
/**
|
3
|
+
* Props for MultiSelect component
|
4
|
+
*/
|
5
|
+
interface MultiSelectProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
6
|
+
/**
|
7
|
+
* An array of option objects to be displayed in the multi-select component.
|
8
|
+
* Each option object has a label, value, and an optional icon.
|
9
|
+
*/
|
10
|
+
options: {
|
11
|
+
/** The text to display for the option. */
|
12
|
+
label: string;
|
13
|
+
/** The unique value associated with the option. */
|
14
|
+
value: string;
|
15
|
+
}[];
|
16
|
+
/**
|
17
|
+
* Callback function triggered when the selected values change.
|
18
|
+
* Receives an array of the new selected values.
|
19
|
+
*/
|
20
|
+
onValueChange: (value: string[]) => void;
|
21
|
+
/** The default selected values when the component mounts. */
|
22
|
+
defaultValue: string[];
|
23
|
+
/**
|
24
|
+
* Placeholder text to be displayed when no values are selected.
|
25
|
+
* Optional, defaults to "Select options".
|
26
|
+
*/
|
27
|
+
placeholder?: string;
|
28
|
+
/**
|
29
|
+
* Animation duration in seconds for the visual effects (e.g., bouncing badges).
|
30
|
+
* Optional, defaults to 0 (no animation).
|
31
|
+
*/
|
32
|
+
animation?: number;
|
33
|
+
/**
|
34
|
+
* Maximum number of items to display. Extra selected items will be summarized.
|
35
|
+
* Optional, defaults to 3.
|
36
|
+
*/
|
37
|
+
maxCount?: number;
|
38
|
+
/**
|
39
|
+
* The modality of the popover. When set to true, interaction with outside elements
|
40
|
+
* will be disabled and only popover content will be visible to screen readers.
|
41
|
+
* Optional, defaults to false.
|
42
|
+
*/
|
43
|
+
modalPopover?: boolean;
|
44
|
+
/**
|
45
|
+
* If true, renders the multi-select component as a child of another component.
|
46
|
+
* Optional, defaults to false.
|
47
|
+
*/
|
48
|
+
asChild?: boolean;
|
49
|
+
/**
|
50
|
+
* Additional class names to apply custom styles to the multi-select component.
|
51
|
+
* Optional, can be used to add custom styles.
|
52
|
+
*/
|
53
|
+
className?: string;
|
54
|
+
size?: "small" | "medium";
|
55
|
+
invisible?: boolean;
|
56
|
+
disabled?: boolean;
|
57
|
+
variant?: "default" | "secondary" | "destructive";
|
58
|
+
}
|
59
|
+
export declare const NewMultiSelect: React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLButtonElement>>;
|
60
|
+
export {};
|
package/dist/index.es.js
CHANGED
@@ -16,13 +16,13 @@ import MarkdownIt from "markdown-it";
|
|
16
16
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
17
17
|
import * as MenubarPrimitive from "@radix-ui/react-menubar";
|
18
18
|
import { Command } from "cmdk";
|
19
|
+
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
20
|
+
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
19
21
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
20
22
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
21
|
-
import * as SeparatorPrimitive from "@radix-ui/react-separator";
|
22
23
|
import * as ReactDOM from "react-dom";
|
23
24
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
24
25
|
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
25
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
26
26
|
const focusedDisabled = "focus-visible:ring-0 focus-visible:ring-offset-0";
|
27
27
|
const focusedInvisibleMixin = "focus:bg-opacity-70 focus:bg-slate-100 focus:dark:bg-gray-800 focus:dark:bg-opacity-60";
|
28
28
|
const focusedClasses = "z-30 outline-none ring-2 ring-primary ring-opacity-75 ring-offset-2 ring-offset-transparent ";
|
@@ -14832,7 +14832,7 @@ const Dialog = ({
|
|
14832
14832
|
if (!open) {
|
14833
14833
|
const timeout = setTimeout(() => {
|
14834
14834
|
setDisplayed(false);
|
14835
|
-
},
|
14835
|
+
}, 150);
|
14836
14836
|
return () => clearTimeout(timeout);
|
14837
14837
|
} else {
|
14838
14838
|
setDisplayed(true);
|
@@ -15198,6 +15198,8 @@ const Menu = React__default.forwardRef(({
|
|
15198
15198
|
trigger,
|
15199
15199
|
open,
|
15200
15200
|
defaultOpen,
|
15201
|
+
side,
|
15202
|
+
align,
|
15201
15203
|
onOpenChange,
|
15202
15204
|
portalContainer
|
15203
15205
|
}, ref) => /* @__PURE__ */ jsxs(
|
@@ -15215,7 +15217,15 @@ const Menu = React__default.forwardRef(({
|
|
15215
15217
|
children: trigger
|
15216
15218
|
}
|
15217
15219
|
),
|
15218
|
-
/* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
|
15220
|
+
/* @__PURE__ */ jsx(DropdownMenu.Portal, { container: portalContainer, children: /* @__PURE__ */ jsx(
|
15221
|
+
DropdownMenu.Content,
|
15222
|
+
{
|
15223
|
+
side,
|
15224
|
+
align,
|
15225
|
+
className: cls(paperMixin, focusedDisabled, "shadow py-2 z-30"),
|
15226
|
+
children
|
15227
|
+
}
|
15228
|
+
) })
|
15219
15229
|
]
|
15220
15230
|
}
|
15221
15231
|
));
|
@@ -15507,7 +15517,6 @@ function MultiSelect({
|
|
15507
15517
|
disabled,
|
15508
15518
|
renderValue,
|
15509
15519
|
renderValues,
|
15510
|
-
includeFocusOutline = true,
|
15511
15520
|
containerClassName,
|
15512
15521
|
className,
|
15513
15522
|
children,
|
@@ -15606,38 +15615,46 @@ function MultiSelect({
|
|
15606
15615
|
]
|
15607
15616
|
}
|
15608
15617
|
),
|
15609
|
-
/* @__PURE__ */ jsx(
|
15610
|
-
|
15618
|
+
/* @__PURE__ */ jsx(
|
15619
|
+
DialogPrimitive.Root,
|
15611
15620
|
{
|
15612
|
-
|
15613
|
-
|
15614
|
-
|
15615
|
-
|
15616
|
-
|
15617
|
-
children: /* @__PURE__ */ jsx(
|
15618
|
-
"div",
|
15621
|
+
open: openInternal,
|
15622
|
+
modal: true,
|
15623
|
+
onOpenChange: setOpenInternal,
|
15624
|
+
children: /* @__PURE__ */ jsx(DialogPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
15625
|
+
MultiSelectContext.Provider,
|
15619
15626
|
{
|
15620
|
-
|
15621
|
-
|
15622
|
-
|
15623
|
-
|
15624
|
-
top: (usedBoundingRect?.top ?? 0) + (usedBoundingRect?.height ?? 0),
|
15625
|
-
left: usedBoundingRect?.left,
|
15626
|
-
// right: boundingRect?.right,
|
15627
|
-
width: usedBoundingRect?.width,
|
15628
|
-
maxHeight
|
15627
|
+
value: {
|
15628
|
+
fieldValue: value,
|
15629
|
+
setInputValue,
|
15630
|
+
onValueChangeInternal
|
15629
15631
|
},
|
15630
15632
|
children: /* @__PURE__ */ jsx(
|
15631
|
-
|
15633
|
+
"div",
|
15632
15634
|
{
|
15633
|
-
|
15634
|
-
|
15635
|
+
ref: listRef,
|
15636
|
+
className: "z-50 absolute overflow-auto outline-none",
|
15637
|
+
style: {
|
15638
|
+
pointerEvents: openInternal ? "auto" : "none",
|
15639
|
+
top: (usedBoundingRect?.top ?? 0) + (usedBoundingRect?.height ?? 0),
|
15640
|
+
left: usedBoundingRect?.left,
|
15641
|
+
// right: boundingRect?.right,
|
15642
|
+
width: usedBoundingRect?.width,
|
15643
|
+
maxHeight
|
15644
|
+
},
|
15645
|
+
children: /* @__PURE__ */ jsx(
|
15646
|
+
Command.Group,
|
15647
|
+
{
|
15648
|
+
className: "mt-2 text-slate-900 dark:text-white animate-in z-50 border border-slate-200 dark:border-slate-800 bg-white dark:bg-slate-800 p-2 rounded-lg shadow-lg flex flex-col outline-none w-full",
|
15649
|
+
children
|
15650
|
+
}
|
15651
|
+
)
|
15635
15652
|
}
|
15636
15653
|
)
|
15637
15654
|
}
|
15638
|
-
)
|
15655
|
+
) })
|
15639
15656
|
}
|
15640
|
-
)
|
15657
|
+
)
|
15641
15658
|
]
|
15642
15659
|
}
|
15643
15660
|
)
|
@@ -15672,6 +15689,305 @@ function MultiSelectItem({ children, value, className }) {
|
|
15672
15689
|
}
|
15673
15690
|
);
|
15674
15691
|
}
|
15692
|
+
function Separator({ orientation, decorative }) {
|
15693
|
+
if (orientation === "horizontal")
|
15694
|
+
return /* @__PURE__ */ jsx(
|
15695
|
+
SeparatorPrimitive.Root,
|
15696
|
+
{
|
15697
|
+
decorative,
|
15698
|
+
orientation: "horizontal",
|
15699
|
+
className: "dark:bg-opacity-50 bg-opacity-50 dark:bg-gray-600 bg-gray-300 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px my-[8px]"
|
15700
|
+
}
|
15701
|
+
);
|
15702
|
+
else
|
15703
|
+
return /* @__PURE__ */ jsx(
|
15704
|
+
SeparatorPrimitive.Root,
|
15705
|
+
{
|
15706
|
+
className: "dark:bg-opacity-50 bg-opacity-50 dark:bg-gray-600 bg-gray-300 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px mx-[8px]",
|
15707
|
+
decorative,
|
15708
|
+
orientation: "vertical"
|
15709
|
+
}
|
15710
|
+
);
|
15711
|
+
}
|
15712
|
+
const NewMultiSelect = React.forwardRef(
|
15713
|
+
({
|
15714
|
+
size,
|
15715
|
+
options,
|
15716
|
+
onValueChange,
|
15717
|
+
invisible,
|
15718
|
+
disabled,
|
15719
|
+
variant,
|
15720
|
+
defaultValue = [],
|
15721
|
+
placeholder = "Select options",
|
15722
|
+
animation = 0,
|
15723
|
+
maxCount = 3,
|
15724
|
+
modalPopover = false,
|
15725
|
+
asChild = false,
|
15726
|
+
className,
|
15727
|
+
...props
|
15728
|
+
}, ref) => {
|
15729
|
+
const [selectedValues, setSelectedValues] = React.useState(defaultValue);
|
15730
|
+
const [isPopoverOpen, setIsPopoverOpen] = React.useState(false);
|
15731
|
+
React.useEffect(() => {
|
15732
|
+
setSelectedValues(defaultValue);
|
15733
|
+
}, [defaultValue]);
|
15734
|
+
const handleInputKeyDown = (event) => {
|
15735
|
+
if (event.key === "Enter") {
|
15736
|
+
setIsPopoverOpen(true);
|
15737
|
+
} else if (event.key === "Backspace" && !event.currentTarget.value) {
|
15738
|
+
const newSelectedValues = [...selectedValues];
|
15739
|
+
newSelectedValues.pop();
|
15740
|
+
setSelectedValues(newSelectedValues);
|
15741
|
+
onValueChange(newSelectedValues);
|
15742
|
+
}
|
15743
|
+
};
|
15744
|
+
const toggleOption = (value) => {
|
15745
|
+
const newSelectedValues = selectedValues.includes(value) ? selectedValues.filter((v) => v !== value) : [...selectedValues, value];
|
15746
|
+
setSelectedValues(newSelectedValues);
|
15747
|
+
onValueChange(newSelectedValues);
|
15748
|
+
};
|
15749
|
+
const handleClear = () => {
|
15750
|
+
setSelectedValues([]);
|
15751
|
+
onValueChange([]);
|
15752
|
+
};
|
15753
|
+
const handleTogglePopover = () => {
|
15754
|
+
setIsPopoverOpen((prev) => !prev);
|
15755
|
+
};
|
15756
|
+
const clearExtraOptions = () => {
|
15757
|
+
const newSelectedValues = selectedValues.slice(0, maxCount);
|
15758
|
+
setSelectedValues(newSelectedValues);
|
15759
|
+
onValueChange(newSelectedValues);
|
15760
|
+
};
|
15761
|
+
const toggleAll = () => {
|
15762
|
+
if (selectedValues.length === options.length) {
|
15763
|
+
handleClear();
|
15764
|
+
} else {
|
15765
|
+
const allValues = options.map((option) => option.value);
|
15766
|
+
setSelectedValues(allValues);
|
15767
|
+
onValueChange(allValues);
|
15768
|
+
}
|
15769
|
+
};
|
15770
|
+
return /* @__PURE__ */ jsxs(
|
15771
|
+
PopoverPrimitive.Root,
|
15772
|
+
{
|
15773
|
+
open: isPopoverOpen,
|
15774
|
+
onOpenChange: setIsPopoverOpen,
|
15775
|
+
modal: modalPopover,
|
15776
|
+
children: [
|
15777
|
+
/* @__PURE__ */ jsx(PopoverPrimitive.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
15778
|
+
"button",
|
15779
|
+
{
|
15780
|
+
ref,
|
15781
|
+
...props,
|
15782
|
+
onClick: handleTogglePopover,
|
15783
|
+
className: cls(
|
15784
|
+
size === "small" ? "min-h-[42px]" : "min-h-[64px]",
|
15785
|
+
"select-none rounded-md text-sm",
|
15786
|
+
invisible ? fieldBackgroundInvisibleMixin : fieldBackgroundMixin,
|
15787
|
+
disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
|
15788
|
+
"relative flex items-center",
|
15789
|
+
className
|
15790
|
+
),
|
15791
|
+
children: selectedValues.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center w-full", children: [
|
15792
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center", children: [
|
15793
|
+
selectedValues.slice(0, maxCount).map((value) => {
|
15794
|
+
const option = options.find((o) => o.value === value);
|
15795
|
+
return /* @__PURE__ */ jsxs(
|
15796
|
+
Chip,
|
15797
|
+
{
|
15798
|
+
className: cls(
|
15799
|
+
"m-1 transition ease-in-out delay-150 hover:-translate-y-1 hover:scale-110 duration-300",
|
15800
|
+
{
|
15801
|
+
"border-foreground/10 text-foreground bg-card hover:bg-card/80": variant === "default",
|
15802
|
+
"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80": variant === "secondary",
|
15803
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80": variant === "destructive"
|
15804
|
+
}
|
15805
|
+
),
|
15806
|
+
style: { animationDuration: `${animation}s` },
|
15807
|
+
children: [
|
15808
|
+
option?.label,
|
15809
|
+
/* @__PURE__ */ jsx(
|
15810
|
+
CloseIcon,
|
15811
|
+
{
|
15812
|
+
size: "smallest",
|
15813
|
+
onClick: (event) => {
|
15814
|
+
event.stopPropagation();
|
15815
|
+
toggleOption(value);
|
15816
|
+
}
|
15817
|
+
}
|
15818
|
+
)
|
15819
|
+
]
|
15820
|
+
},
|
15821
|
+
value
|
15822
|
+
);
|
15823
|
+
}),
|
15824
|
+
selectedValues.length > maxCount && /* @__PURE__ */ jsxs(
|
15825
|
+
Chip,
|
15826
|
+
{
|
15827
|
+
className: cls(
|
15828
|
+
"bg-transparent text-foreground border-foreground/1 hover:bg-transparent",
|
15829
|
+
"m-1 transition ease-in-out delay-150 hover:-translate-y-1 hover:scale-110 duration-300",
|
15830
|
+
{
|
15831
|
+
"border-foreground/10 text-foreground bg-card hover:bg-card/80": variant === "default",
|
15832
|
+
"border-foreground/10 bg-secondary text-secondary-foreground hover:bg-secondary/80": variant === "secondary",
|
15833
|
+
"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80": variant === "destructive"
|
15834
|
+
}
|
15835
|
+
),
|
15836
|
+
style: { animationDuration: `${animation}s` },
|
15837
|
+
children: [
|
15838
|
+
`+ ${selectedValues.length - maxCount} more`,
|
15839
|
+
/* @__PURE__ */ jsx(
|
15840
|
+
CloseIcon,
|
15841
|
+
{
|
15842
|
+
size: "smallest",
|
15843
|
+
onClick: (event) => {
|
15844
|
+
event.stopPropagation();
|
15845
|
+
clearExtraOptions();
|
15846
|
+
}
|
15847
|
+
}
|
15848
|
+
)
|
15849
|
+
]
|
15850
|
+
}
|
15851
|
+
)
|
15852
|
+
] }),
|
15853
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
15854
|
+
/* @__PURE__ */ jsx(
|
15855
|
+
CloseIcon,
|
15856
|
+
{
|
15857
|
+
size: "small",
|
15858
|
+
onClick: (event) => {
|
15859
|
+
event.stopPropagation();
|
15860
|
+
handleClear();
|
15861
|
+
}
|
15862
|
+
}
|
15863
|
+
),
|
15864
|
+
/* @__PURE__ */ jsx(
|
15865
|
+
Separator,
|
15866
|
+
{
|
15867
|
+
orientation: "vertical"
|
15868
|
+
}
|
15869
|
+
),
|
15870
|
+
/* @__PURE__ */ jsx("div", { className: cls("px-2 h-full flex items-center"), children: /* @__PURE__ */ jsx(
|
15871
|
+
ExpandMoreIcon,
|
15872
|
+
{
|
15873
|
+
size: "small",
|
15874
|
+
className: cls("transition", isPopoverOpen ? "rotate-180" : "")
|
15875
|
+
}
|
15876
|
+
) })
|
15877
|
+
] })
|
15878
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between w-full mx-auto", children: [
|
15879
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground mx-3", children: placeholder }),
|
15880
|
+
/* @__PURE__ */ jsx("div", { className: cls("px-2 h-full flex items-center"), children: /* @__PURE__ */ jsx(
|
15881
|
+
ExpandMoreIcon,
|
15882
|
+
{
|
15883
|
+
size: "small",
|
15884
|
+
className: cls("transition", isPopoverOpen ? "rotate-180" : "")
|
15885
|
+
}
|
15886
|
+
) })
|
15887
|
+
] })
|
15888
|
+
}
|
15889
|
+
) }),
|
15890
|
+
/* @__PURE__ */ jsx(
|
15891
|
+
PopoverPrimitive.Content,
|
15892
|
+
{
|
15893
|
+
className: cls("z-50 relative overflow-hidden border bg-white dark:bg-gray-900 p-2 rounded-lg", defaultBorderMixin),
|
15894
|
+
align: "start",
|
15895
|
+
onEscapeKeyDown: () => setIsPopoverOpen(false),
|
15896
|
+
children: /* @__PURE__ */ jsxs(Command, { children: [
|
15897
|
+
/* @__PURE__ */ jsx(
|
15898
|
+
Command.Input,
|
15899
|
+
{
|
15900
|
+
className: cls(focusedDisabled, "bg-transparent outline-none flex-1 h-full w-full m-4"),
|
15901
|
+
placeholder: "Search...",
|
15902
|
+
onKeyDown: handleInputKeyDown
|
15903
|
+
}
|
15904
|
+
),
|
15905
|
+
/* @__PURE__ */ jsxs(Command.List, { children: [
|
15906
|
+
/* @__PURE__ */ jsx(Command.Empty, { children: "No results found." }),
|
15907
|
+
/* @__PURE__ */ jsxs(Command.Group, { children: [
|
15908
|
+
/* @__PURE__ */ jsxs(
|
15909
|
+
Command.Item,
|
15910
|
+
{
|
15911
|
+
onSelect: toggleAll,
|
15912
|
+
className: cls(
|
15913
|
+
// (fieldValue ?? []).includes(value) ? "bg-slate-200 dark:bg-slate-950" : "",
|
15914
|
+
"cursor-pointer",
|
15915
|
+
"flex flex-row items-center gap-2",
|
15916
|
+
"ring-offset-transparent",
|
15917
|
+
"p-1 rounded aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-offset-2",
|
15918
|
+
"aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
15919
|
+
"cursor-pointer p-1 rounded aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
15920
|
+
className
|
15921
|
+
),
|
15922
|
+
children: [
|
15923
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: selectedValues.length === options.length, size: "small" }),
|
15924
|
+
/* @__PURE__ */ jsx("span", { children: "(Select All)" })
|
15925
|
+
]
|
15926
|
+
},
|
15927
|
+
"all"
|
15928
|
+
),
|
15929
|
+
options.map((option) => {
|
15930
|
+
const isSelected = selectedValues.includes(option.value);
|
15931
|
+
return /* @__PURE__ */ jsxs(
|
15932
|
+
Command.Item,
|
15933
|
+
{
|
15934
|
+
onSelect: () => toggleOption(option.value),
|
15935
|
+
className: cls(
|
15936
|
+
// (fieldValue ?? []).includes(value) ? "bg-slate-200 dark:bg-slate-950" : "",
|
15937
|
+
"cursor-pointer",
|
15938
|
+
"flex flex-row items-center gap-2",
|
15939
|
+
"ring-offset-transparent",
|
15940
|
+
"p-1 rounded aria-[selected=true]:outline-none aria-[selected=true]:ring-2 aria-[selected=true]:ring-primary aria-[selected=true]:ring-opacity-75 aria-[selected=true]:ring-offset-2",
|
15941
|
+
"aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
15942
|
+
"cursor-pointer p-1 rounded aria-[selected=true]:bg-slate-100 aria-[selected=true]:dark:bg-slate-900",
|
15943
|
+
className
|
15944
|
+
),
|
15945
|
+
children: [
|
15946
|
+
/* @__PURE__ */ jsx(Checkbox, { checked: isSelected, size: "small" }),
|
15947
|
+
/* @__PURE__ */ jsx("span", { children: option.label })
|
15948
|
+
]
|
15949
|
+
},
|
15950
|
+
option.value
|
15951
|
+
);
|
15952
|
+
})
|
15953
|
+
] }),
|
15954
|
+
/* @__PURE__ */ jsx(Command.Separator, {}),
|
15955
|
+
/* @__PURE__ */ jsx(Command.Group, { children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
15956
|
+
selectedValues.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
15957
|
+
/* @__PURE__ */ jsx(
|
15958
|
+
Command.Item,
|
15959
|
+
{
|
15960
|
+
onSelect: handleClear,
|
15961
|
+
className: "flex-1 justify-center cursor-pointer",
|
15962
|
+
children: "Clear"
|
15963
|
+
}
|
15964
|
+
),
|
15965
|
+
/* @__PURE__ */ jsx(
|
15966
|
+
Separator,
|
15967
|
+
{
|
15968
|
+
orientation: "vertical"
|
15969
|
+
}
|
15970
|
+
)
|
15971
|
+
] }),
|
15972
|
+
/* @__PURE__ */ jsx(
|
15973
|
+
Command.Item,
|
15974
|
+
{
|
15975
|
+
onSelect: () => setIsPopoverOpen(false),
|
15976
|
+
className: "flex-1 justify-center cursor-pointer max-w-full",
|
15977
|
+
children: "Close"
|
15978
|
+
}
|
15979
|
+
)
|
15980
|
+
] }) })
|
15981
|
+
] })
|
15982
|
+
] })
|
15983
|
+
}
|
15984
|
+
)
|
15985
|
+
]
|
15986
|
+
}
|
15987
|
+
);
|
15988
|
+
}
|
15989
|
+
);
|
15990
|
+
NewMultiSelect.displayName = "MultiSelect";
|
15675
15991
|
function Paper({
|
15676
15992
|
children,
|
15677
15993
|
style,
|
@@ -15936,7 +16252,7 @@ const Select = forwardRef(({
|
|
15936
16252
|
SelectPrimitive.Content,
|
15937
16253
|
{
|
15938
16254
|
position,
|
15939
|
-
className: "z-50 relative overflow-hidden border
|
16255
|
+
className: cls("z-50 relative overflow-hidden border bg-white dark:bg-gray-900 p-2 rounded-lg", defaultBorderMixin),
|
15940
16256
|
children: /* @__PURE__ */ jsx(
|
15941
16257
|
SelectPrimitive.Viewport,
|
15942
16258
|
{
|
@@ -15971,8 +16287,8 @@ function SelectItem({
|
|
15971
16287
|
"w-full",
|
15972
16288
|
"relative flex items-center p-2 rounded-md text-sm text-slate-700 dark:text-slate-300",
|
15973
16289
|
"focus:z-10",
|
15974
|
-
"data-[state=checked]:bg-slate-100 data-[state=checked]:dark:bg-slate-
|
15975
|
-
"data-[state=checked]:focus:bg-slate-200 data-[state=checked]:dark:focus:bg-
|
16290
|
+
"data-[state=checked]:bg-slate-100 data-[state=checked]:dark:bg-slate-800 focus:bg-slate-100 dark:focus:bg-gray-950",
|
16291
|
+
"data-[state=checked]:focus:bg-slate-200 data-[state=checked]:dark:focus:bg-gray-950",
|
15976
16292
|
disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer",
|
15977
16293
|
"[&>*]:w-full",
|
15978
16294
|
"overflow-visible",
|
@@ -16012,26 +16328,6 @@ function SelectGroup({
|
|
16012
16328
|
children
|
16013
16329
|
] });
|
16014
16330
|
}
|
16015
|
-
function Separator({ orientation, decorative }) {
|
16016
|
-
if (orientation === "horizontal")
|
16017
|
-
return /* @__PURE__ */ jsx(
|
16018
|
-
SeparatorPrimitive.Root,
|
16019
|
-
{
|
16020
|
-
decorative,
|
16021
|
-
orientation: "horizontal",
|
16022
|
-
className: "dark:bg-opacity-50 bg-opacity-50 dark:bg-gray-600 bg-gray-300 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px my-[8px]"
|
16023
|
-
}
|
16024
|
-
);
|
16025
|
-
else
|
16026
|
-
return /* @__PURE__ */ jsx(
|
16027
|
-
SeparatorPrimitive.Root,
|
16028
|
-
{
|
16029
|
-
className: "dark:bg-opacity-50 bg-opacity-50 dark:bg-gray-600 bg-gray-300 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px mx-[8px]",
|
16030
|
-
decorative,
|
16031
|
-
orientation: "vertical"
|
16032
|
-
}
|
16033
|
-
);
|
16034
|
-
}
|
16035
16331
|
const Sheet = ({
|
16036
16332
|
children,
|
16037
16333
|
side = "right",
|
@@ -18992,6 +19288,7 @@ export {
|
|
18992
19288
|
NetworkWifiLockedIcon,
|
18993
19289
|
NeurologyIcon,
|
18994
19290
|
NewLabelIcon,
|
19291
|
+
NewMultiSelect,
|
18995
19292
|
NewReleasesIcon,
|
18996
19293
|
NewWindowIcon,
|
18997
19294
|
NewsIcon,
|