@trsys-tech/matrix-library 0.5.1-alpha.0 → 0.5.1-beta.1

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.
Files changed (42) hide show
  1. package/dist/combobox.es.js +1 -1
  2. package/dist/combobox.es.js.map +1 -1
  3. package/dist/components/duration/Duration.d.ts +61 -0
  4. package/dist/components/duration/Duration.d.ts.map +1 -0
  5. package/dist/components/form-duration/FormDuration.d.ts +21 -0
  6. package/dist/components/form-duration/FormDuration.d.ts.map +1 -0
  7. package/dist/components/form-multi-select/FormMultiSelect.d.ts +3 -3
  8. package/dist/components/form-multi-select/FormMultiSelect.d.ts.map +1 -1
  9. package/dist/components/multi-select/MultiSelect.d.ts +11 -7
  10. package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
  11. package/dist/desktopdatepicker.es.js +1 -1
  12. package/dist/desktopdatepicker.es.js.map +1 -1
  13. package/dist/desktopdaterangepicker.es.js +1 -1
  14. package/dist/desktopdaterangepicker.es.js.map +1 -1
  15. package/dist/desktoptimepicker.es.js +1 -1
  16. package/dist/desktoptimepicker.es.js.map +1 -1
  17. package/dist/duration.es.js +116 -0
  18. package/dist/duration.es.js.map +1 -0
  19. package/dist/formduration.es.js +40 -0
  20. package/dist/formduration.es.js.map +1 -0
  21. package/dist/formmultiselect.es.js +43 -45
  22. package/dist/formmultiselect.es.js.map +1 -1
  23. package/dist/index.d.ts +2 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.es.js +155 -151
  26. package/dist/index.es.js.map +1 -1
  27. package/dist/mobiledatepicker.es.js +1 -1
  28. package/dist/mobiledatepicker.es.js.map +1 -1
  29. package/dist/mobiledaterangepicker.es.js +5 -5
  30. package/dist/mobiledaterangepicker.es.js.map +1 -1
  31. package/dist/mobiletimepicker.es.js +1 -1
  32. package/dist/mobiletimepicker.es.js.map +1 -1
  33. package/dist/multiselect.es.js +161 -163
  34. package/dist/multiselect.es.js.map +1 -1
  35. package/dist/select.es.js +8 -8
  36. package/dist/select.es.js.map +1 -1
  37. package/dist/styles.css +1 -1
  38. package/dist/textfield.es.js +1 -1
  39. package/dist/textfield.es.js.map +1 -1
  40. package/dist/timepickercontent.es.js +3 -3
  41. package/dist/timepickercontent.es.js.map +1 -1
  42. package/package.json +2 -2
package/dist/select.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsx as t, jsxs as n } from "react/jsx-runtime";
2
2
  import * as l from "react";
3
- import { Check as x, ChevronDown as m, ChevronUp as b, XMark as w } from "@trsys-tech/matrix-icons";
3
+ import { Check as g, ChevronDown as m, ChevronUp as b, XMark as w } from "@trsys-tech/matrix-icons";
4
4
  import * as e from "@radix-ui/react-select";
5
5
  import { cn as s } from "./utils.es.js";
6
6
  const p = l.createContext({ onClear: () => {
@@ -13,15 +13,15 @@ const p = l.createContext({ onClear: () => {
13
13
  N.displayName = e.Root.displayName;
14
14
  const P = e.Group, k = e.Value, v = l.forwardRef(
15
15
  ({ className: r, children: o, clearable: a, ...d }, i) => {
16
- const { onClear: h, value: c } = l.useContext(p), y = (g) => {
17
- g.stopPropagation();
16
+ const { onClear: h, value: c } = l.useContext(p), x = (y) => {
17
+ y.stopPropagation();
18
18
  };
19
19
  return /* @__PURE__ */ n(
20
20
  e.Trigger,
21
21
  {
22
22
  ref: i,
23
23
  className: s(
24
- "group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-none [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300",
24
+ "group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-2 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-none [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300",
25
25
  r
26
26
  ),
27
27
  "data-value": c,
@@ -29,7 +29,7 @@ const P = e.Group, k = e.Value, v = l.forwardRef(
29
29
  children: [
30
30
  o,
31
31
  /* @__PURE__ */ n("div", { className: "flex items-center gap-2", children: [
32
- a && c ? /* @__PURE__ */ t(e.Icon, { asChild: !0, onPointerDown: y, onClickCapture: h, children: /* @__PURE__ */ t(w, { className: "h-4.5 w-4.5" }) }) : null,
32
+ a && c ? /* @__PURE__ */ t(e.Icon, { asChild: !0, onPointerDown: x, onClickCapture: h, children: /* @__PURE__ */ t(w, { className: "h-4.5 w-4.5" }) }) : null,
33
33
  /* @__PURE__ */ t(e.Icon, { asChild: !0, children: /* @__PURE__ */ t(m, { className: "h-4.5 w-4.5 text-primary group-data-[state=open]:rotate-180 transition-transform" }) })
34
34
  ] })
35
35
  ]
@@ -68,7 +68,7 @@ const S = l.forwardRef(({ className: r, children: o, position: a = "popper", ...
68
68
  ) }));
69
69
  S.displayName = e.Content.displayName;
70
70
  const C = l.forwardRef(
71
- ({ className: r, ...o }, a) => /* @__PURE__ */ t(e.Label, { ref: a, className: s("px-2 py-1.5 text-sm font-semibold", r), ...o })
71
+ ({ className: r, ...o }, a) => /* @__PURE__ */ t(e.Label, { ref: a, className: s("px-2 py-1.5 text-xs font-semibold", r), ...o })
72
72
  );
73
73
  C.displayName = e.Label.displayName;
74
74
  const R = l.forwardRef(
@@ -77,12 +77,12 @@ const R = l.forwardRef(
77
77
  {
78
78
  ref: d,
79
79
  className: s(
80
- "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-200 data-[active=true]:bg-gray-300 data-[active=true]:font-bold data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
80
+ "relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-xs outline-none focus:bg-gray-200 data-[active=true]:bg-gray-300 data-[active=true]:font-bold data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
81
81
  r
82
82
  ),
83
83
  ...a,
84
84
  children: [
85
- /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(x, { className: "h-4 w-4" }) }) }),
85
+ /* @__PURE__ */ t("span", { className: "absolute right-2 flex h-3.5 w-3.5 items-center justify-center", children: /* @__PURE__ */ t(e.ItemIndicator, { children: /* @__PURE__ */ t(g, { className: "h-4 w-4" }) }) }),
86
86
  /* @__PURE__ */ t(e.ItemText, { children: o })
87
87
  ]
88
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"select.es.js","sources":["../src/components/select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Check, ChevronDown, ChevronUp, XMark } from \"@trsys-tech/matrix-icons\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport type { SelectValueProps, SelectGroupProps } from \"@radix-ui/react-select\";\n\nimport { cn } from \"../../lib/utils\";\n\ntype ClearSelectContextValue = {\n onClear: () => void;\n value: string | undefined;\n};\n\nconst SelectContext = React.createContext<ClearSelectContextValue>({ onClear: () => {}, value: undefined });\n\nconst Select = ({ onValueChange, value, ...props }: SelectPrimitive.SelectProps) => {\n const onClear = () => {\n onValueChange?.(\"\");\n };\n\n return (\n <SelectContext.Provider value={{ onClear, value }}>\n <SelectPrimitive.Root {...props} value={value} onValueChange={onValueChange} />\n </SelectContext.Provider>\n );\n};\nSelect.displayName = SelectPrimitive.Root.displayName;\ntype SelectProps = React.ComponentProps<typeof Select>;\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\ntype SelectTriggerProps = React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n clearable?: boolean;\n};\n\nconst SelectTrigger = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Trigger>, SelectTriggerProps>(\n ({ className, children, clearable, ...props }: SelectTriggerProps, ref) => {\n const { onClear, value } = React.useContext(SelectContext);\n\n const handlePointerDown = (e: React.PointerEvent) => {\n e.stopPropagation();\n };\n\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-none [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\n className,\n )}\n data-value={value}\n {...props}\n >\n {children}\n <div className=\"flex items-center gap-2\">\n {clearable && value ? (\n <SelectPrimitive.Icon asChild onPointerDown={handlePointerDown} onClickCapture={onClear}>\n <XMark className=\"h-4.5 w-4.5\" />\n </SelectPrimitive.Icon>\n ) : null}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4.5 w-4.5 text-primary group-data-[state=open]:rotate-180 transition-transform\" />\n </SelectPrimitive.Icon>\n </div>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n// type SelectTriggerProps = React.ComponentProps<typeof SelectTrigger>;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton ref={ref} className={cn(\"flex cursor-default items-center justify-center py-1\", className)} {...props}>\n <ChevronUp />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\ntype SelectScrollUpButtonProps = React.ComponentProps<typeof SelectScrollUpButton>;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton ref={ref} className={cn(\"flex cursor-default items-center justify-center py-1\", className)} {...props}>\n <ChevronDown />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\ntype SelectScrollDownButtonProps = React.ComponentProps<typeof SelectScrollDownButton>;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1 max-h-[--radix-select-content-available-height]\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\"p-1\", position === \"popper\" && \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\")}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\ntype SelectContentProps = React.ComponentProps<typeof SelectContent>;\n\nconst SelectLabel = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Label>, React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>>(\n ({ className, ...props }, ref) => <SelectPrimitive.Label ref={ref} className={cn(\"px-2 py-1.5 text-sm font-semibold\", className)} {...props} />,\n);\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\ntype SelectLabelProps = React.ComponentProps<typeof SelectLabel>;\n\nconst SelectItem = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Item>, React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>(\n ({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-gray-200 data-[active=true]:bg-gray-300 data-[active=true]:font-bold data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n ),\n);\nSelectItem.displayName = SelectPrimitive.Item.displayName;\ntype SelectItemProps = React.ComponentProps<typeof SelectItem>;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => <SelectPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-muted\", className)} {...props} />);\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\ntype SelectSeparatorProps = React.ComponentProps<typeof SelectSeparator>;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n type SelectProps,\n type SelectGroupProps,\n type SelectValueProps,\n type SelectTriggerProps,\n type SelectContentProps,\n type SelectLabelProps,\n type SelectItemProps,\n type SelectSeparatorProps,\n type SelectScrollUpButtonProps,\n type SelectScrollDownButtonProps,\n};\n"],"names":["SelectContext","React","Select","onValueChange","value","props","onClear","jsx","SelectPrimitive","SelectGroup","SelectValue","SelectTrigger","className","children","clearable","ref","handlePointerDown","e","jsxs","cn","XMark","ChevronDown","SelectScrollUpButton","ChevronUp","SelectScrollDownButton","SelectContent","position","SelectLabel","SelectItem","Check","SelectSeparator"],"mappings":";;;;;AAcA,MAAMA,IAAgBC,EAAM,cAAuC,EAAE,SAAS,MAAM;AAAC,GAAG,OAAO,QAAW,GAEpGC,IAAS,CAAC,EAAE,eAAAC,GAAe,OAAAC,GAAO,GAAGC,QAAyC;AAClF,QAAMC,IAAU,MAAM;AACpB,IAAAH,IAAgB,EAAE;AAAA,EACpB;AAEA,2BACGH,EAAc,UAAd,EAAuB,OAAO,EAAE,SAAAM,GAAS,OAAAF,KACxC,UAAA,gBAAAG,EAACC,EAAgB,MAAhB,EAAsB,GAAGH,GAAO,OAAAD,GAAc,eAAAD,GAA8B,GAC/E;AAEJ;AACAD,EAAO,cAAcM,EAAgB,KAAK;AAG1C,MAAMC,IAAcD,EAAgB,OAE9BE,IAAcF,EAAgB,OAM9BG,IAAgBV,EAAM;AAAA,EAC1B,CAAC,EAAE,WAAAW,GAAW,UAAAC,GAAU,WAAAC,GAAW,GAAGT,EAAA,GAA6BU,MAAQ;AACzE,UAAM,EAAE,SAAAT,GAAS,OAAAF,EAAA,IAAUH,EAAM,WAAWD,CAAa,GAEnDgB,IAAoB,CAACC,MAA0B;AACnD,MAAAA,EAAE,gBAAA;AAAA,IACJ;AAEA,WACE,gBAAAC;AAAA,MAACV,EAAgB;AAAA,MAAhB;AAAA,QACC,KAAAO;AAAA,QACA,WAAWI;AAAA,UACT;AAAA,UACAP;AAAA,QAAA;AAAA,QAEF,cAAYR;AAAA,QACX,GAAGC;AAAA,QAEH,UAAA;AAAA,UAAAQ;AAAA,UACD,gBAAAK,E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AkB7B,EAAM,WAG5B,CAAC,EAAE,WAAAW,GAAW,GAAGP,EAAA,GAASU,MAAQ,gBAAAR,EAACC,EAAgB,WAAhB,EAA0B,KAAAO,GAAU,WAAWI,EAAG,4BAA4BP,CAAS,GAAI,GAAGP,GAAO,CAAE;AAC5IyB,EAAgB,cAActB,EAAgB,UAAU;"}
1
+ {"version":3,"file":"select.es.js","sources":["../src/components/select/Select.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Check, ChevronDown, ChevronUp, XMark } from \"@trsys-tech/matrix-icons\";\nimport * as SelectPrimitive from \"@radix-ui/react-select\";\nimport type { SelectValueProps, SelectGroupProps } from \"@radix-ui/react-select\";\n\nimport { cn } from \"../../lib/utils\";\n\ntype ClearSelectContextValue = {\n onClear: () => void;\n value: string | undefined;\n};\n\nconst SelectContext = React.createContext<ClearSelectContextValue>({ onClear: () => {}, value: undefined });\n\nconst Select = ({ onValueChange, value, ...props }: SelectPrimitive.SelectProps) => {\n const onClear = () => {\n onValueChange?.(\"\");\n };\n\n return (\n <SelectContext.Provider value={{ onClear, value }}>\n <SelectPrimitive.Root {...props} value={value} onValueChange={onValueChange} />\n </SelectContext.Provider>\n );\n};\nSelect.displayName = SelectPrimitive.Root.displayName;\ntype SelectProps = React.ComponentProps<typeof Select>;\n\nconst SelectGroup = SelectPrimitive.Group;\n\nconst SelectValue = SelectPrimitive.Value;\n\ntype SelectTriggerProps = React.ComponentProps<typeof SelectPrimitive.Trigger> & {\n clearable?: boolean;\n};\n\nconst SelectTrigger = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Trigger>, SelectTriggerProps>(\n ({ className, children, clearable, ...props }: SelectTriggerProps, ref) => {\n const { onClear, value } = React.useContext(SelectContext);\n\n const handlePointerDown = (e: React.PointerEvent) => {\n e.stopPropagation();\n };\n\n return (\n <SelectPrimitive.Trigger\n ref={ref}\n className={cn(\n \"group flex h-8 w-full items-center justify-between whitespace-nowrap rounded-sm border border-input bg-transparent px-3 py-2 text-xs ring-offset-background data-[placeholder]:text-muted-foreground hover:border hover:border-primary focus:border focus:border-primary focus:outline-none focus:ring focus:ring-primary-100 disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-text-300 disabled:border-none [&>span]:line-clamp-1 [&_svg]:disabled:text-text-300\",\n className,\n )}\n data-value={value}\n {...props}\n >\n {children}\n <div className=\"flex items-center gap-2\">\n {clearable && value ? (\n <SelectPrimitive.Icon asChild onPointerDown={handlePointerDown} onClickCapture={onClear}>\n <XMark className=\"h-4.5 w-4.5\" />\n </SelectPrimitive.Icon>\n ) : null}\n <SelectPrimitive.Icon asChild>\n <ChevronDown className=\"h-4.5 w-4.5 text-primary group-data-[state=open]:rotate-180 transition-transform\" />\n </SelectPrimitive.Icon>\n </div>\n </SelectPrimitive.Trigger>\n );\n },\n);\nSelectTrigger.displayName = SelectPrimitive.Trigger.displayName;\n// type SelectTriggerProps = React.ComponentProps<typeof SelectTrigger>;\n\nconst SelectScrollUpButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollUpButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollUpButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollUpButton ref={ref} className={cn(\"flex cursor-default items-center justify-center py-1\", className)} {...props}>\n <ChevronUp />\n </SelectPrimitive.ScrollUpButton>\n));\nSelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;\ntype SelectScrollUpButtonProps = React.ComponentProps<typeof SelectScrollUpButton>;\n\nconst SelectScrollDownButton = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.ScrollDownButton>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.ScrollDownButton>\n>(({ className, ...props }, ref) => (\n <SelectPrimitive.ScrollDownButton ref={ref} className={cn(\"flex cursor-default items-center justify-center py-1\", className)} {...props}>\n <ChevronDown />\n </SelectPrimitive.ScrollDownButton>\n));\nSelectScrollDownButton.displayName = SelectPrimitive.ScrollDownButton.displayName;\ntype SelectScrollDownButtonProps = React.ComponentProps<typeof SelectScrollDownButton>;\n\nconst SelectContent = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Content>\n>(({ className, children, position = \"popper\", ...props }, ref) => (\n <SelectPrimitive.Portal>\n <SelectPrimitive.Content\n ref={ref}\n className={cn(\n \"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2\",\n position === \"popper\" &&\n \"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1 max-h-[--radix-select-content-available-height]\",\n className,\n )}\n position={position}\n {...props}\n >\n <SelectScrollUpButton />\n <SelectPrimitive.Viewport\n className={cn(\"p-1\", position === \"popper\" && \"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]\")}\n >\n {children}\n </SelectPrimitive.Viewport>\n <SelectScrollDownButton />\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n));\nSelectContent.displayName = SelectPrimitive.Content.displayName;\ntype SelectContentProps = React.ComponentProps<typeof SelectContent>;\n\nconst SelectLabel = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Label>, React.ComponentPropsWithoutRef<typeof SelectPrimitive.Label>>(\n ({ className, ...props }, ref) => <SelectPrimitive.Label ref={ref} className={cn(\"px-2 py-1.5 text-xs font-semibold\", className)} {...props} />,\n);\nSelectLabel.displayName = SelectPrimitive.Label.displayName;\ntype SelectLabelProps = React.ComponentProps<typeof SelectLabel>;\n\nconst SelectItem = React.forwardRef<React.ElementRef<typeof SelectPrimitive.Item>, React.ComponentPropsWithoutRef<typeof SelectPrimitive.Item>>(\n ({ className, children, ...props }, ref) => (\n <SelectPrimitive.Item\n ref={ref}\n className={cn(\n \"relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-xs outline-none focus:bg-gray-200 data-[active=true]:bg-gray-300 data-[active=true]:font-bold data-[disabled]:pointer-events-none data-[disabled]:opacity-50\",\n className,\n )}\n {...props}\n >\n <span className=\"absolute right-2 flex h-3.5 w-3.5 items-center justify-center\">\n <SelectPrimitive.ItemIndicator>\n <Check className=\"h-4 w-4\" />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n ),\n);\nSelectItem.displayName = SelectPrimitive.Item.displayName;\ntype SelectItemProps = React.ComponentProps<typeof SelectItem>;\n\nconst SelectSeparator = React.forwardRef<\n React.ElementRef<typeof SelectPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof SelectPrimitive.Separator>\n>(({ className, ...props }, ref) => <SelectPrimitive.Separator ref={ref} className={cn(\"-mx-1 my-1 h-px bg-muted\", className)} {...props} />);\nSelectSeparator.displayName = SelectPrimitive.Separator.displayName;\ntype SelectSeparatorProps = React.ComponentProps<typeof SelectSeparator>;\n\nexport {\n Select,\n SelectGroup,\n SelectValue,\n SelectTrigger,\n SelectContent,\n SelectLabel,\n SelectItem,\n SelectSeparator,\n SelectScrollUpButton,\n SelectScrollDownButton,\n type SelectProps,\n type SelectGroupProps,\n type SelectValueProps,\n type SelectTriggerProps,\n type SelectContentProps,\n type SelectLabelProps,\n type SelectItemProps,\n type SelectSeparatorProps,\n type SelectScrollUpButtonProps,\n type SelectScrollDownButtonProps,\n};\n"],"names":["SelectContext","React","Select","onValueChange","value","props","onClear","jsx","SelectPrimitive","SelectGroup","SelectValue","SelectTrigger","className","children","clearable","ref","handlePointerDown","e","jsxs","cn","XMark","ChevronDown","SelectScrollUpButton","ChevronUp","Sel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