@oneplatformdev/ui 0.0.1-beta.12 → 0.0.1-beta.120

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 (147) hide show
  1. package/Accordion/Accordion.d.ts +5 -3
  2. package/Accordion/Accordion.mjs +27 -24
  3. package/AlertDialog/AlertDialogRoot.d.ts +2 -2
  4. package/AlertDialog/AlertDialogRoot.mjs +7 -7
  5. package/Button/Button.mjs +11 -10
  6. package/Button/buttonVariants.mjs +14 -8
  7. package/Calendar/Calendar.mjs +3 -2
  8. package/Card/Card.d.ts +1 -1
  9. package/Card/Card.mjs +24 -23
  10. package/Checkbox/Checkbox.d.ts +5 -4
  11. package/Checkbox/Checkbox.mjs +48 -21
  12. package/Checkbox/Checkbox.types.d.ts +10 -0
  13. package/Checkbox/index.d.ts +1 -0
  14. package/Checkbox/index.mjs +3 -2
  15. package/Combobox/Combobox.d.ts +2 -2
  16. package/Combobox/Combobox.mjs +12 -123
  17. package/Combobox/Combobox.types.d.ts +36 -1
  18. package/Combobox/ComboboxOptionItem.d.ts +5 -0
  19. package/Combobox/ComboboxOptionItem.mjs +69 -0
  20. package/Combobox/ComboboxOptions.d.ts +4 -0
  21. package/Combobox/ComboboxOptions.mjs +12 -0
  22. package/Combobox/index.mjs +1 -1
  23. package/Combobox-CkGEIfTD.js +325 -0
  24. package/Command/Command.d.ts +1 -1
  25. package/Command/Command.mjs +15 -7
  26. package/DataTable/DataTable.d.ts +10 -3
  27. package/DataTable/DataTable.mjs +33 -33
  28. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  29. package/DataTable/DataTableColumnFilter.mjs +31 -0
  30. package/DatePicker/DatePicker.mjs +2 -2
  31. package/Dialog/Dialog.d.ts +6 -3
  32. package/Dialog/Dialog.mjs +100 -64
  33. package/Dialog/DialogOverlayScope.d.ts +8 -0
  34. package/Dialog/DialogOverlayScope.mjs +7 -0
  35. package/Dialog/index.d.ts +1 -0
  36. package/Dialog/index.mjs +10 -8
  37. package/DropdownMenu/DropdownMenu.d.ts +2 -2
  38. package/DropdownMenu/DropdownMenu.mjs +30 -26
  39. package/Dropzone/Dropzone.d.ts +16 -10
  40. package/Dropzone/Dropzone.mjs +146 -113
  41. package/Dropzone/Dropzone.types.d.ts +33 -10
  42. package/Dropzone/DropzoneFilePreview.d.ts +4 -0
  43. package/Dropzone/DropzoneFilePreview.mjs +9 -0
  44. package/Dropzone/DropzoneSinglePickPreview.d.ts +10 -0
  45. package/Dropzone/DropzoneSinglePickPreview.mjs +44 -0
  46. package/Dropzone/DropzoneUtils.d.ts +5 -0
  47. package/Dropzone/DropzoneUtils.mjs +24 -0
  48. package/Dropzone/index.mjs +1 -1
  49. package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
  50. package/Form/Form.d.ts +2 -2
  51. package/Form/Form.mjs +48 -45
  52. package/Form/FormRenderControl.d.ts +2 -3
  53. package/Form/FormRenderControl.mjs +10 -10
  54. package/Form/FormRenderControl.types.d.ts +5 -7
  55. package/FormCheckbox/FormCheckbox.d.ts +2 -3
  56. package/FormCheckbox/FormCheckbox.mjs +23 -23
  57. package/FormCheckbox/FormCheckbox.types.d.ts +3 -3
  58. package/FormCombobox/FormCombobox.d.ts +2 -2
  59. package/FormCombobox/FormCombobox.mjs +6 -6
  60. package/FormCombobox/FormCombobox.types.d.ts +2 -3
  61. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  62. package/FormDatePicker/FormDatePicker.mjs +20 -18
  63. package/FormDatePicker/FormDatePicker.types.d.ts +2 -3
  64. package/FormDropzone/FormDropzone.d.ts +4 -0
  65. package/FormDropzone/FormDropzone.mjs +19 -0
  66. package/FormDropzone/FormDropzone.types.d.ts +6 -0
  67. package/FormDropzone/index.d.ts +2 -0
  68. package/FormDropzone/index.mjs +4 -0
  69. package/FormDropzone/package.json +7 -0
  70. package/FormInput/FormInput.d.ts +5 -3
  71. package/FormInput/FormInput.mjs +37 -16
  72. package/FormInput/FormInput.types.d.ts +2 -3
  73. package/FormRadio/FormRadio.d.ts +4 -0
  74. package/FormRadio/FormRadio.mjs +40 -0
  75. package/FormRadio/FormRadio.types.d.ts +6 -0
  76. package/FormRadio/index.d.ts +2 -0
  77. package/FormRadio/index.mjs +4 -0
  78. package/FormRadio/package.json +7 -0
  79. package/FormSelect/FormSelect.d.ts +2 -3
  80. package/FormSelect/FormSelect.mjs +19 -17
  81. package/FormSelect/FormSelect.types.d.ts +2 -3
  82. package/FormTextarea/FormTextarea.d.ts +2 -3
  83. package/FormTextarea/FormTextarea.mjs +13 -12
  84. package/FormTextarea/FormTextarea.types.d.ts +2 -3
  85. package/Input/Input.mjs +50 -38
  86. package/Input/Input.types.d.ts +6 -2
  87. package/Input/inputVariants.mjs +9 -3
  88. package/Label/Label.d.ts +2 -2
  89. package/Label/labelVariants.mjs +7 -4
  90. package/LazyLoader/LazyLoader.mjs +5 -4
  91. package/LoadedIcon/LoadedIcon.d.ts +11 -0
  92. package/LoadedIcon/LoadedIcon.mjs +27 -0
  93. package/LoadedIcon/index.d.ts +1 -0
  94. package/LoadedIcon/index.mjs +4 -0
  95. package/LoadedIcon/package.json +7 -0
  96. package/LoadingMask/LoadingMask.d.ts +4 -1
  97. package/LoadingMask/LoadingMask.mjs +18 -56
  98. package/LoadingMask/LoadingMask.types.d.ts +5 -0
  99. package/LoadingMask/RenderLoadingMask.d.ts +3 -0
  100. package/LoadingMask/RenderLoadingMask.mjs +108 -0
  101. package/LoadingMask/index.d.ts +2 -0
  102. package/LoadingMask/index.mjs +4 -2
  103. package/Popover/Popover.d.ts +2 -2
  104. package/Popover/Popover.mjs +29 -20
  105. package/Radio/Radio.d.ts +4 -0
  106. package/Radio/Radio.mjs +12 -0
  107. package/Radio/Radio.types.d.ts +11 -0
  108. package/Radio/index.d.ts +2 -0
  109. package/Radio/index.mjs +4 -0
  110. package/Radio/package.json +7 -0
  111. package/RadioGroup/RadioGroup.d.ts +9 -3
  112. package/RadioGroup/RadioGroup.mjs +37 -19
  113. package/RadioGroup/index.mjs +4 -3
  114. package/ScrollArea/ScrollArea.d.ts +2 -2
  115. package/ScrollArea/ScrollArea.mjs +26 -13
  116. package/Search/Search.d.ts +1 -2
  117. package/Search/Search.mjs +36 -21
  118. package/Search/Search.types.d.ts +1 -0
  119. package/Select/Select.mjs +94 -63
  120. package/Select/Select.types.d.ts +11 -3
  121. package/Select/SelectRoot.d.ts +2 -2
  122. package/Select/SelectRoot.mjs +29 -24
  123. package/Sheet/Sheet.d.ts +5 -2
  124. package/Sheet/Sheet.mjs +33 -33
  125. package/TablePagination/TablePagination.d.ts +16 -0
  126. package/TablePagination/TablePagination.mjs +74 -0
  127. package/TablePagination/index.d.ts +1 -0
  128. package/TablePagination/index.mjs +4 -0
  129. package/TablePagination/package.json +7 -0
  130. package/Tabs/Tabs.d.ts +3 -2
  131. package/Tabs/Tabs.mjs +20 -6
  132. package/Tabs/Tabs.types.d.ts +5 -2
  133. package/Tabs/index.mjs +8 -7
  134. package/Textarea/Textarea.d.ts +1 -1
  135. package/Textarea/Textarea.mjs +72 -15
  136. package/Textarea/Textarea.types.d.ts +16 -2
  137. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  138. package/Textarea/useAutosizeTextArea.mjs +20 -0
  139. package/Toast/toastVariants.mjs +3 -3
  140. package/index.css +1 -1
  141. package/index.d.ts +3 -0
  142. package/index.mjs +304 -291
  143. package/package.json +6 -6
  144. package/tailwind.config.mjs +13 -13
  145. package/Dropzone/FilePreview.d.ts +0 -15
  146. package/Dropzone/FilePreview.mjs +0 -7
  147. package/FilePreview-C6IeuOqo.js +0 -40
@@ -1,24 +1,33 @@
1
1
  import { jsx as t } from "react/jsx-runtime";
2
- import * as n from "react";
2
+ import * as m from "react";
3
3
  import * as o from "@radix-ui/react-popover";
4
- import { cn as s } from "@oneplatformdev/utils";
5
- const l = o.Root, c = o.Trigger, g = o.Anchor, m = n.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, ...d }, i) => /* @__PURE__ */ t(o.Portal, { children: /* @__PURE__ */ t(
6
- o.Content,
7
- {
8
- ref: i,
9
- align: a,
10
- sideOffset: r,
11
- className: s(
12
- "z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
13
- e
14
- ),
15
- ...d
16
- }
17
- ) }));
18
- m.displayName = o.Content.displayName;
4
+ import { cn as p } from "@oneplatformdev/utils";
5
+ import "../Dialog/Dialog.mjs";
6
+ import { useDialogOverlayContainer as l } from "../Dialog/DialogOverlayScope.mjs";
7
+ const P = o.Root, h = o.Trigger, b = o.Anchor, c = m.forwardRef(({ className: e, align: a = "center", sideOffset: r = 4, style: n, ...i }, d) => {
8
+ const s = l();
9
+ return /* @__PURE__ */ t(o.Portal, { container: s ?? void 0, children: /* @__PURE__ */ t(
10
+ o.Content,
11
+ {
12
+ ref: d,
13
+ align: a,
14
+ sideOffset: r,
15
+ className: p(
16
+ "z-70 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none 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",
17
+ e
18
+ ),
19
+ style: {
20
+ pointerEvents: "auto",
21
+ ...n
22
+ },
23
+ ...i
24
+ }
25
+ ) });
26
+ });
27
+ c.displayName = o.Content.displayName;
19
28
  export {
20
- l as Popover,
21
- g as PopoverAnchor,
22
- m as PopoverContent,
23
- c as PopoverTrigger
29
+ P as Popover,
30
+ b as PopoverAnchor,
31
+ c as PopoverContent,
32
+ h as PopoverTrigger
24
33
  };
@@ -0,0 +1,4 @@
1
+ import { RadioProps } from './Radio.types';
2
+ import { FC } from 'react';
3
+
4
+ export declare const Radio: FC<RadioProps>;
@@ -0,0 +1,12 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { RadioGroup as c, RadioGroupLabel as u } from "../RadioGroup/RadioGroup.mjs";
3
+ const l = (e) => {
4
+ const { options: f = [], renderOption: r, ...s } = e;
5
+ return /* @__PURE__ */ a(c, { ...s, children: f.map((t) => {
6
+ const o = /* @__PURE__ */ a(u, { ...t }, t.value);
7
+ return !r || typeof r != "function" || !(r != null && r(t, u)) ? o : r == null ? void 0 : r(t, u);
8
+ }) });
9
+ };
10
+ export {
11
+ l as Radio
12
+ };
@@ -0,0 +1,11 @@
1
+ import { RadioGroup, RadioGroupLabel } from '../RadioGroup/RadioGroup';
2
+ import { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
3
+
4
+ export interface RadioOptionProps<Value extends string | number = string> {
5
+ value: Value;
6
+ label: ReactNode;
7
+ }
8
+ export interface RadioProps extends Partial<ComponentPropsWithoutRef<typeof RadioGroup>> {
9
+ options?: RadioOptionProps[];
10
+ renderOption?: (option: RadioOptionProps, DefaultOptionComponent: FC<ComponentPropsWithoutRef<typeof RadioGroupLabel>>) => ReactNode | null;
11
+ }
@@ -0,0 +1,2 @@
1
+ export * from './Radio';
2
+ export type * from './Radio.types.ts';
@@ -0,0 +1,4 @@
1
+ import { Radio as a } from "./Radio.mjs";
2
+ export {
3
+ a as Radio
4
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "sideEffects": false,
3
+ "main": "./index.mjs",
4
+ "module": "./index.mjs",
5
+ "default": "./index.mjs",
6
+ "types": "./index.d.ts"
7
+ }
@@ -1,5 +1,11 @@
1
- import * as React from "react";
2
- import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
1
+ import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
2
+ import * as React from 'react';
3
3
  declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.RadioGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
- export { RadioGroup, RadioGroupItem };
5
+ declare const RadioGroupLabel: React.ForwardRefExoticComponent<{
6
+ label: React.ReactNode;
7
+ value: string;
8
+ } & {
9
+ children?: React.ReactNode | undefined;
10
+ } & React.RefAttributes<HTMLLabelElement>>;
11
+ export { RadioGroup, RadioGroupItem, RadioGroupLabel };
@@ -1,31 +1,49 @@
1
- import { jsx as e } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as l } from "react/jsx-runtime";
2
+ import * as i from "@radix-ui/react-radio-group";
3
+ import { Circle as c } from "lucide-react";
2
4
  import * as s from "react";
3
- import * as r from "@radix-ui/react-radio-group";
4
- import { Circle as m } from "lucide-react";
5
5
  import { cn as t } from "@oneplatformdev/utils";
6
- const d = s.forwardRef(({ className: o, ...i }, a) => /* @__PURE__ */ e(
7
- r.Root,
6
+ import { Label as p } from "../Label/Label.mjs";
7
+ const f = s.forwardRef(({ className: r, ...a }, o) => /* @__PURE__ */ e(
8
+ i.Root,
8
9
  {
9
- className: t("grid gap-2", o),
10
- ...i,
11
- ref: a
10
+ className: t("grid gap-0", r),
11
+ ...a,
12
+ ref: o
12
13
  }
13
14
  ));
14
- d.displayName = r.Root.displayName;
15
- const l = s.forwardRef(({ className: o, ...i }, a) => /* @__PURE__ */ e(
16
- r.Item,
15
+ f.displayName = i.Root.displayName;
16
+ const m = s.forwardRef(({ className: r, ...a }, o) => /* @__PURE__ */ e(
17
+ i.Item,
17
18
  {
18
- ref: a,
19
+ ref: o,
19
20
  className: t(
20
- "aspect-square h-4 w-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
21
- o
21
+ "aspect-square size-4 rounded-full border border-primary text-primary shadow focus:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
22
+ r
22
23
  ),
23
- ...i,
24
- children: /* @__PURE__ */ e(r.Indicator, { className: "flex items-center justify-center", children: /* @__PURE__ */ e(m, { className: "h-3.5 w-3.5 fill-primary" }) })
24
+ ...a,
25
+ children: /* @__PURE__ */ e(i.Indicator, { className: "flex items-center justify-center ", children: /* @__PURE__ */ e(c, { className: "size-2.5 fill-primary" }) })
25
26
  }
26
27
  ));
27
- l.displayName = r.Item.displayName;
28
+ m.displayName = i.Item.displayName;
29
+ const n = s.forwardRef(({ value: r, label: a, children: o }, d) => /* @__PURE__ */ l(
30
+ p,
31
+ {
32
+ ref: d,
33
+ htmlFor: r,
34
+ className: "flex w-full items-start gap-3 font-normal py-3 cursor-pointer",
35
+ children: [
36
+ /* @__PURE__ */ e(m, { value: r, id: r }),
37
+ /* @__PURE__ */ l("div", { className: "flex flex-col w-full gap-3", children: [
38
+ /* @__PURE__ */ e("span", { className: "flex flex-col justify-start leading-[16px]", children: a }),
39
+ o
40
+ ] })
41
+ ]
42
+ }
43
+ ));
44
+ n.displayName = "RadioGroupLabel";
28
45
  export {
29
- d as RadioGroup,
30
- l as RadioGroupItem
46
+ f as RadioGroup,
47
+ m as RadioGroupItem,
48
+ n as RadioGroupLabel
31
49
  };
@@ -1,5 +1,6 @@
1
- import { RadioGroup as p, RadioGroupItem as a } from "./RadioGroup.mjs";
1
+ import { RadioGroup as a, RadioGroupItem as p, RadioGroupLabel as d } from "./RadioGroup.mjs";
2
2
  export {
3
- p as RadioGroup,
4
- a as RadioGroupItem
3
+ a as RadioGroup,
4
+ p as RadioGroupItem,
5
+ d as RadioGroupLabel
5
6
  };
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
1
+ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
2
+ import * as React from 'react';
3
3
  declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
4
  declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  export { ScrollArea, ScrollBar };
@@ -1,38 +1,51 @@
1
- import { jsxs as d, jsx as e } from "react/jsx-runtime";
2
- import * as s from "react";
1
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
3
2
  import * as r from "@radix-ui/react-scroll-area";
4
- import { cn as t } from "@oneplatformdev/utils";
5
- const m = s.forwardRef(({ className: o, children: l, ...a }, c) => /* @__PURE__ */ d(
3
+ import * as t from "react";
4
+ import { cn as s } from "@oneplatformdev/utils";
5
+ const m = t.forwardRef(({ className: o, children: l, ...a }, c) => /* @__PURE__ */ i(
6
6
  r.Root,
7
7
  {
8
8
  ref: c,
9
- className: t("relative overflow-hidden", o),
9
+ className: s(
10
+ "relative overflow-hidden pr-2",
11
+ // '[&:has([data-orientation=vertical])]:pr-2',
12
+ o
13
+ ),
10
14
  ...a,
11
15
  children: [
12
16
  /* @__PURE__ */ e(r.Viewport, { className: "h-full w-full rounded-[inherit]", children: l }),
13
- /* @__PURE__ */ e(i, {}),
17
+ /* @__PURE__ */ e(d, {}),
14
18
  /* @__PURE__ */ e(r.Corner, {})
15
19
  ]
16
20
  }
17
21
  ));
18
22
  m.displayName = r.Root.displayName;
19
- const i = s.forwardRef(({ className: o, orientation: l = "vertical", ...a }, c) => /* @__PURE__ */ e(
23
+ const d = t.forwardRef(({ className: o, orientation: l = "vertical", ...a }, c) => /* @__PURE__ */ e(
20
24
  r.ScrollAreaScrollbar,
21
25
  {
22
26
  ref: c,
23
27
  orientation: l,
24
- className: t(
28
+ className: s(
25
29
  "flex touch-none select-none transition-colors",
26
- l === "vertical" && "h-full w-2.5 border-l border-l-transparent p-[1px]",
27
- l === "horizontal" && "h-2.5 flex-col border-t border-t-transparent p-[1px]",
30
+ "p-[1px] bg-[#DCDDE1] rounded-full",
31
+ l === "vertical" && "h-full w-1.5 border-l border-l-transparent",
32
+ l === "horizontal" && "h-1.5 flex-col border-t border-t-transparent",
28
33
  o
29
34
  ),
30
35
  ...a,
31
- children: /* @__PURE__ */ e(r.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-border" })
36
+ children: /* @__PURE__ */ e(
37
+ r.ScrollAreaThumb,
38
+ {
39
+ className: s(
40
+ "relative flex-1 rounded-full bg-border",
41
+ "bg-[#FCFCFC]"
42
+ )
43
+ }
44
+ )
32
45
  }
33
46
  ));
34
- i.displayName = r.ScrollAreaScrollbar.displayName;
47
+ d.displayName = r.ScrollAreaScrollbar.displayName;
35
48
  export {
36
49
  m as ScrollArea,
37
- i as ScrollBar
50
+ d as ScrollBar
38
51
  };
@@ -1,4 +1,3 @@
1
1
  import { SearchProps } from './Search.types';
2
- import { FC } from 'react';
3
2
 
4
- export declare const Search: FC<SearchProps>;
3
+ export declare const Search: (props: SearchProps) => import("react/jsx-runtime").JSX.Element;
package/Search/Search.mjs CHANGED
@@ -1,30 +1,45 @@
1
- import { jsx as o } from "react/jsx-runtime";
2
- import { useState as S } from "react";
3
- import { Input as f } from "../Input/Input.mjs";
4
- import { useDebounceCallback as v } from "@oneplatformdev/hooks";
5
- import { cn as d } from "@oneplatformdev/utils";
6
- const j = (t) => {
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { useState as g } from "react";
3
+ import { Input as v } from "../Input/Input.mjs";
4
+ import { useDebounceCallback as b } from "@oneplatformdev/hooks";
5
+ import { cn as x } from "@oneplatformdev/utils";
6
+ import { SearchIcon as I } from "lucide-react";
7
+ import { LoadedIcon as C } from "../LoadedIcon/LoadedIcon.mjs";
8
+ const L = (a) => {
7
9
  const {
8
- search: a,
9
- onChange: e,
10
- onSearch: c,
10
+ search: c,
11
+ onChange: r,
12
+ onSearch: n,
11
13
  placeholder: s = "Search",
12
- className: n,
13
- ...m
14
- } = t, [i, l] = S(a), h = v(c, 1e3), p = (r) => {
15
- const u = r.target.value;
16
- l(u), e == null || e(r), h(r.target.value);
14
+ className: m,
15
+ loading: i = !1,
16
+ slotProps: e,
17
+ name: p = "search",
18
+ ...l
19
+ } = a, [h, u] = g(c), f = b(n, 1e3), d = (o) => {
20
+ const S = o.target.value;
21
+ u(S), r == null || r(o), f(o.target.value);
17
22
  };
18
- return /* @__PURE__ */ o("div", { className: d("space-y-4", n), children: /* @__PURE__ */ o(
19
- f,
23
+ return /* @__PURE__ */ t(
24
+ v,
20
25
  {
26
+ name: p,
21
27
  placeholder: s,
22
- value: i,
23
- onChange: p,
24
- ...m
28
+ value: h,
29
+ className: x("min-w-[340px]", m),
30
+ onChange: d,
31
+ ...l,
32
+ ...e || {},
33
+ slotProps: {
34
+ ...e || {},
35
+ input: {
36
+ startAdornment: /* @__PURE__ */ t(C, { loading: i, size: "sm", children: /* @__PURE__ */ t(I, {}) }),
37
+ ...(e == null ? void 0 : e.input) || {}
38
+ }
39
+ }
25
40
  }
26
- ) });
41
+ );
27
42
  };
28
43
  export {
29
- j as Search
44
+ L as Search
30
45
  };
@@ -3,4 +3,5 @@ import { InputProps } from '../Input';
3
3
  export interface SearchProps extends InputProps {
4
4
  search: string;
5
5
  onSearch: (value?: string) => void;
6
+ loading?: boolean;
6
7
  }
package/Select/Select.mjs CHANGED
@@ -1,72 +1,103 @@
1
- import { jsxs as d, jsx as a } from "react/jsx-runtime";
2
- import { Button as f } from "../Button/Button.mjs";
1
+ import { jsxs as u, jsx as i, Fragment as x } from "react/jsx-runtime";
2
+ import { createElement as f, isValidElement as S } from "react";
3
+ import { Button as y } from "../Button/Button.mjs";
3
4
  import "../Button/buttonVariants.mjs";
4
- import { SelectRoot as p, SelectContent as h, SelectItem as u, SelectTrigger as g, SelectValue as v } from "./SelectRoot.mjs";
5
- import { isValidReactElement as i } from "@oneplatformdev/utils";
6
- const S = (o) => {
7
- const { placeholder: t, renderTrigger: e } = o, n = /* @__PURE__ */ a(g, { children: /* @__PURE__ */ a(v, { placeholder: t }) });
8
- return e && typeof e == "function" && i(e(o, n)) ? e(o, n) : n;
9
- }, C = (o) => {
10
- const { renderOption: t, option: e, index: n, options: l, ...c } = o, r = /* @__PURE__ */ a(u, { value: e.value, children: e.label }, e.value);
11
- return t && typeof t == "function" && i(t(
12
- e,
13
- n,
14
- l,
15
- { ...c, options: l },
16
- r
17
- )) ? i(t(
18
- e,
19
- n,
20
- l,
21
- { ...c, options: l },
22
- r
23
- ), u) ? i(t(
24
- e,
25
- n,
26
- l,
27
- { ...c, options: l },
28
- r
29
- )) : /* @__PURE__ */ a(u, { value: e.value, children: t(
30
- e,
31
- n,
32
- l,
33
- { ...c, options: l },
34
- r
35
- ) }, e.value) : r;
36
- }, T = (o) => {
37
- const {
38
- value: t,
39
- options: e,
40
- onChange: n,
41
- nullable: l = !1,
42
- clearLabel: c = "Clear",
43
- disabled: r
44
- } = o;
45
- return /* @__PURE__ */ d(
5
+ import { SelectRoot as b, SelectContent as R, SelectTrigger as C, SelectValue as V, SelectItem as p } from "./SelectRoot.mjs";
6
+ import { isValidReactElement as k } from "@oneplatformdev/utils";
7
+ const B = (t) => {
8
+ const { placeholder: n, renderTrigger: e, slotProps: l } = t, r = /* @__PURE__ */ i(C, { ...(l == null ? void 0 : l.triggerProps) || {}, children: /* @__PURE__ */ i(V, { placeholder: n }) });
9
+ return e && typeof e == "function" && k(e(t, r)) ? e(t, r) : r;
10
+ }, d = (t) => {
11
+ const { children: n, option: e, deep: l = 0 } = t;
12
+ return /* @__PURE__ */ u(
46
13
  p,
47
14
  {
48
- value: t,
49
- onValueChange: n,
50
- disabled: r,
15
+ value: e.value,
16
+ disabled: e.disabled,
17
+ className: "cursor-pointer",
18
+ style: { paddingLeft: `calc(8px + ${(l || 0) * 8}px)` },
51
19
  children: [
52
- /* @__PURE__ */ a(S, { ...o }),
53
- /* @__PURE__ */ d(h, { children: [
54
- l && /* @__PURE__ */ a(f, { className: "w-full px-2", variant: "secondary", size: "sm", onClick: () => {
55
- n("");
56
- }, children: c }),
57
- e.map((s, m) => /* @__PURE__ */ a(
58
- C,
59
- {
60
- ...o,
61
- option: s,
62
- index: m
63
- }
64
- ))
65
- ] })
20
+ !n && e.label,
21
+ n && /* @__PURE__ */ i(x, { children: typeof n == "function" ? n({ ...t }) : n })
66
22
  ]
67
- }
23
+ },
24
+ e.value
68
25
  );
26
+ }, g = (t) => {
27
+ var a, o;
28
+ const { renderOption: n, option: e, index: l, options: r, deep: m = 0, ...c } = t;
29
+ return n && typeof n == "function" && S(
30
+ n(
31
+ e,
32
+ l,
33
+ r,
34
+ { ...c, options: r },
35
+ /* @__PURE__ */ i(d, { ...t })
36
+ )
37
+ ) ? /* @__PURE__ */ i(p, { value: e.value, children: n(
38
+ e,
39
+ l,
40
+ r,
41
+ { ...c, options: r },
42
+ /* @__PURE__ */ i(d, { ...t })
43
+ ) }, e.value) : (a = e.children) != null && a.length ? /* @__PURE__ */ u(
44
+ "div",
45
+ {
46
+ className: "flex flex-col gap-1 truncate line-clamp-2",
47
+ children: [
48
+ /* @__PURE__ */ i(d, { ...t }),
49
+ (o = e.children) == null ? void 0 : o.map((s, h, v) => /* @__PURE__ */ f(
50
+ g,
51
+ {
52
+ ...t,
53
+ key: s.value,
54
+ option: s,
55
+ options: v,
56
+ index: h,
57
+ deep: (m || 0) + 1
58
+ }
59
+ ))
60
+ ]
61
+ },
62
+ e.value
63
+ ) : /* @__PURE__ */ i(d, { ...t });
64
+ }, w = (t) => {
65
+ const {
66
+ value: n,
67
+ options: e,
68
+ onChange: l,
69
+ nullable: r = !1,
70
+ clearLabel: m = "Clear",
71
+ disabled: c
72
+ } = t;
73
+ return /* @__PURE__ */ u(b, { value: n, onValueChange: l, disabled: c, children: [
74
+ /* @__PURE__ */ i(B, { ...t }),
75
+ /* @__PURE__ */ u(R, { children: [
76
+ r && /* @__PURE__ */ i(
77
+ y,
78
+ {
79
+ className: "w-full px-2",
80
+ variant: "secondary",
81
+ size: "sm",
82
+ onClick: () => {
83
+ l == null || l("");
84
+ },
85
+ children: m
86
+ }
87
+ ),
88
+ e.map((a, o) => /* @__PURE__ */ f(
89
+ g,
90
+ {
91
+ ...t,
92
+ key: a.value,
93
+ option: a,
94
+ index: o,
95
+ deep: 0
96
+ }
97
+ ))
98
+ ] })
99
+ ] });
69
100
  };
70
101
  export {
71
- T as Select
102
+ w as Select
72
103
  };
@@ -1,9 +1,12 @@
1
- import { ReactNode } from 'react';
1
+ import { ComponentPropsWithoutRef, ReactNode } from 'react';
2
2
 
3
- export interface SelectOption<ExtendOptionData> {
3
+ import * as SelectPrimitive from '@radix-ui/react-select';
4
+ export interface SelectOption<ExtendOptionData = unknown> {
4
5
  value: string;
5
6
  label?: ReactNode;
7
+ disabled?: boolean;
6
8
  data?: ExtendOptionData;
9
+ children?: SelectOption<ExtendOptionData>[];
7
10
  }
8
11
  export type SelectRenderTrigger<ExtendOptionData> = (props: Omit<SelectProps<ExtendOptionData>, 'renderTrigger'>, defaultComponent: ReactNode) => ReactNode;
9
12
  export type SelectRenderOption<ExtendOptionData> = (option: SelectOption<ExtendOptionData>, index: number, options: SelectOption<ExtendOptionData>[], props: Omit<SelectProps<ExtendOptionData>, 'renderOption'>, defaultComponent: ReactNode) => ReactNode;
@@ -15,7 +18,7 @@ export interface SelectProps<ExtendOptionData> {
15
18
  /** Select placeholder string. */
16
19
  placeholder?: string;
17
20
  /** Select Root onValueChange handler. */
18
- onChange: (value: SelectOption<ExtendOptionData>['value']) => void;
21
+ onChange?: (value: SelectOption<ExtendOptionData>['value']) => void;
19
22
  /** Show reset select item button. */
20
23
  disabled?: boolean;
21
24
  /** Show reset select item button. */
@@ -26,4 +29,9 @@ export interface SelectProps<ExtendOptionData> {
26
29
  renderTrigger?: SelectRenderTrigger<ExtendOptionData>;
27
30
  /** Render custom option. */
28
31
  renderOption?: SelectRenderOption<ExtendOptionData>;
32
+ /** Select Slot props */
33
+ slotProps?: {
34
+ /** Select Default Trigger Props */
35
+ triggerProps?: ComponentPropsWithoutRef<typeof SelectPrimitive.Trigger>;
36
+ };
29
37
  }
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as SelectPrimitive from "@radix-ui/react-select";
1
+ import * as React from 'react';
2
+ import * as SelectPrimitive from '@radix-ui/react-select';
3
3
  declare const SelectRoot: React.FC<SelectPrimitive.SelectProps>;
4
4
  declare const SelectGroup: React.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
5
5
  declare const SelectValue: React.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React.RefAttributes<HTMLSpanElement>>;