@oneplatformdev/ui 0.0.1-beta.5 → 0.0.1-beta.50

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 (69) hide show
  1. package/Accordion/Accordion.d.ts +2 -2
  2. package/Accordion/Accordion.mjs +23 -20
  3. package/AlertDialog/AlertDialog.mjs +58 -60
  4. package/Button/buttonVariants.mjs +5 -5
  5. package/Calendar/Calendar.mjs +3 -2
  6. package/Combobox/Combobox.mjs +106 -82
  7. package/Combobox/Combobox.types.d.ts +10 -1
  8. package/Command/Command.d.ts +1 -1
  9. package/DataTable/DataTable.mjs +32 -51
  10. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  11. package/DataTable/DataTableColumnFilter.mjs +31 -0
  12. package/DatePicker/DatePicker.mjs +2 -2
  13. package/Dropzone/Dropzone.d.ts +22 -0
  14. package/Dropzone/Dropzone.mjs +151 -0
  15. package/Dropzone/Dropzone.types.d.ts +38 -0
  16. package/Dropzone/DropzoneFilePreview.d.ts +4 -0
  17. package/Dropzone/DropzoneFilePreview.mjs +9 -0
  18. package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
  19. package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
  20. package/Dropzone/DropzoneUtils.d.ts +5 -0
  21. package/Dropzone/DropzoneUtils.mjs +24 -0
  22. package/Dropzone/index.d.ts +2 -0
  23. package/Dropzone/index.mjs +7 -0
  24. package/Dropzone/package.json +7 -0
  25. package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
  26. package/Form/FormRenderControl.d.ts +1 -2
  27. package/Form/FormRenderControl.mjs +10 -10
  28. package/Form/FormRenderControl.types.d.ts +4 -3
  29. package/FormCheckbox/FormCheckbox.d.ts +1 -2
  30. package/FormCheckbox/FormCheckbox.types.d.ts +1 -2
  31. package/FormCombobox/FormCombobox.d.ts +2 -2
  32. package/FormCombobox/FormCombobox.types.d.ts +1 -2
  33. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  34. package/FormDatePicker/FormDatePicker.mjs +20 -18
  35. package/FormDatePicker/FormDatePicker.types.d.ts +1 -2
  36. package/FormDropzone/FormDropzone.d.ts +4 -0
  37. package/FormDropzone/FormDropzone.mjs +19 -0
  38. package/FormDropzone/FormDropzone.types.d.ts +6 -0
  39. package/FormDropzone/index.d.ts +2 -0
  40. package/FormDropzone/index.mjs +4 -0
  41. package/FormDropzone/package.json +7 -0
  42. package/FormInput/FormInput.d.ts +1 -2
  43. package/FormInput/FormInput.types.d.ts +1 -2
  44. package/FormSelect/FormSelect.d.ts +1 -2
  45. package/FormSelect/FormSelect.mjs +19 -17
  46. package/FormSelect/FormSelect.types.d.ts +1 -2
  47. package/FormTextarea/FormTextarea.d.ts +1 -2
  48. package/FormTextarea/FormTextarea.mjs +13 -12
  49. package/FormTextarea/FormTextarea.types.d.ts +1 -2
  50. package/Input/Input.mjs +42 -37
  51. package/Input/Input.types.d.ts +3 -1
  52. package/Select/Select.mjs +44 -42
  53. package/Select/Select.types.d.ts +7 -1
  54. package/Select/SelectRoot.d.ts +2 -2
  55. package/Select/SelectRoot.mjs +1 -0
  56. package/Tabs/Tabs.d.ts +3 -2
  57. package/Tabs/Tabs.mjs +20 -6
  58. package/Tabs/Tabs.types.d.ts +5 -2
  59. package/Tabs/index.mjs +8 -7
  60. package/Textarea/Textarea.d.ts +1 -1
  61. package/Textarea/Textarea.mjs +71 -15
  62. package/Textarea/Textarea.types.d.ts +16 -2
  63. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  64. package/Textarea/useAutosizeTextArea.mjs +20 -0
  65. package/Toast/toastVariants.mjs +3 -3
  66. package/index.css +1 -1
  67. package/index.d.ts +2 -0
  68. package/index.mjs +233 -225
  69. package/package.json +9 -8
@@ -1,5 +1,5 @@
1
- import * as React from "react";
2
- import * as AccordionPrimitive from "@radix-ui/react-accordion";
1
+ import * as React from 'react';
2
+ import * as AccordionPrimitive from '@radix-ui/react-accordion';
3
3
  declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
4
4
  declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
@@ -1,46 +1,49 @@
1
1
  import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
- import * as i from "react";
2
+ import * as s from "react";
3
3
  import * as e from "@radix-ui/react-accordion";
4
4
  import { ChevronDown as m } from "lucide-react";
5
- import { cn as s } from "@oneplatformdev/utils";
6
- const g = e.Root, c = i.forwardRef(({ className: o, ...t }, r) => /* @__PURE__ */ a(
5
+ import { cn as c } from "@oneplatformdev/utils";
6
+ const u = e.Root, l = s.forwardRef(({ className: t, ...o }, r) => /* @__PURE__ */ a(
7
7
  e.Item,
8
8
  {
9
9
  ref: r,
10
- className: s("border-b", o),
11
- ...t
10
+ className: c("border-b", t),
11
+ ...o
12
12
  }
13
13
  ));
14
- c.displayName = "AccordionItem";
15
- const l = i.forwardRef(({ className: o, children: t, ...r }, n) => /* @__PURE__ */ a(e.Header, { className: "flex", children: /* @__PURE__ */ d(
14
+ l.displayName = "AccordionItem";
15
+ const f = s.forwardRef(({ className: t, children: o, ...r }, i) => /* @__PURE__ */ a(e.Header, { className: "flex", children: /* @__PURE__ */ d(
16
16
  e.Trigger,
17
17
  {
18
- ref: n,
19
- className: s(
18
+ ref: i,
19
+ className: c(
20
20
  "flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline text-left [&[data-state=open]>svg]:rotate-180",
21
- o
21
+ t
22
22
  ),
23
+ onKeyDown: (n) => {
24
+ n.key === " " && n.target === n.currentTarget && n.preventDefault();
25
+ },
23
26
  ...r,
24
27
  children: [
25
- t,
28
+ o,
26
29
  /* @__PURE__ */ a(m, { className: "h-4 w-4 shrink-0 text-muted-foreground transition-transform duration-200" })
27
30
  ]
28
31
  }
29
32
  ) }));
30
- l.displayName = e.Trigger.displayName;
31
- const f = i.forwardRef(({ className: o, children: t, ...r }, n) => /* @__PURE__ */ a(
33
+ f.displayName = e.Trigger.displayName;
34
+ const p = s.forwardRef(({ className: t, children: o, ...r }, i) => /* @__PURE__ */ a(
32
35
  e.Content,
33
36
  {
34
- ref: n,
37
+ ref: i,
35
38
  className: "overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",
36
39
  ...r,
37
- children: /* @__PURE__ */ a("div", { className: s("pb-4 pt-0", o), children: t })
40
+ children: /* @__PURE__ */ a("div", { className: c("pb-4 pt-0", t), children: o })
38
41
  }
39
42
  ));
40
- f.displayName = e.Content.displayName;
43
+ p.displayName = e.Content.displayName;
41
44
  export {
42
- g as Accordion,
43
- f as AccordionContent,
44
- c as AccordionItem,
45
- l as AccordionTrigger
45
+ u as Accordion,
46
+ p as AccordionContent,
47
+ l as AccordionItem,
48
+ f as AccordionTrigger
46
49
  };
@@ -1,99 +1,97 @@
1
- import { jsxs as u, jsx as t } from "react/jsx-runtime";
2
- import { cloneElement as a, useId as y, Children as E } from "react";
3
- import { AlertDialogRoot as F, AlertDialogContent as h, AlertDialogTrigger as f, AlertDialogHeader as m, AlertDialogTitle as B, AlertDialogDescription as R, AlertDialogFooter as A, AlertDialogAction as C, AlertDialogCancel as k } from "./AlertDialogRoot.mjs";
4
- import { Button as x } from "../Button/Button.mjs";
5
- import "../Button/buttonVariants.mjs";
6
- import { isValidReactElement as l } from "@oneplatformdev/utils";
7
- const H = (n) => {
8
- const { slotProps: e = {}, children: r } = n, o = e.trigger ?? {};
9
- return l(r, f) ? a(
1
+ import { jsxs as g, jsx as t } from "react/jsx-runtime";
2
+ import { cloneElement as a, useId as j, Children as y } from "react";
3
+ import { AlertDialogRoot as E, AlertDialogContent as u, AlertDialogTrigger as v, AlertDialogHeader as f, AlertDialogTitle as B, AlertDialogDescription as R, AlertDialogFooter as A, AlertDialogAction as D, AlertDialogCancel as k } from "./AlertDialogRoot.mjs";
4
+ import { isValidReactElement as s } from "@oneplatformdev/utils";
5
+ const F = (o) => {
6
+ const { slotProps: e = {}, children: r } = o, i = e.trigger ?? {};
7
+ return s(r, v) ? a(
10
8
  r,
11
9
  {
12
10
  ...r.props || {},
13
- ...o
11
+ ...i
14
12
  }
15
- ) : l(r, x) ? /* @__PURE__ */ t(f, { asChild: !0, ...o, children: r }) : /* @__PURE__ */ t(f, { asChild: !0, children: /* @__PURE__ */ t(x, { variant: "outline", ...o, children: r }) });
16
- }, I = (n) => {
13
+ ) : /* @__PURE__ */ t(v, { asChild: !0, children: r });
14
+ }, H = (o) => {
17
15
  const {
18
16
  title: e = "",
19
17
  description: r = "",
20
- slotProps: o = {},
21
- children: c
22
- } = n, i = o.header ?? {}, d = o.title ?? {}, s = o.description ?? {};
23
- return c ? l(c, m) ? a(
24
- c,
25
- { ...c.props || {}, ...i }
26
- ) : /* @__PURE__ */ t(m, { ...i, children: c }) : /* @__PURE__ */ u(m, { children: [
27
- e && l(e, B) ? a(
18
+ slotProps: i = {},
19
+ children: l
20
+ } = o, n = i.header ?? {}, d = i.title ?? {}, c = i.description ?? {};
21
+ return l ? s(l, f) ? a(
22
+ l,
23
+ { ...l.props || {}, ...n }
24
+ ) : /* @__PURE__ */ t(f, { ...n, children: l }) : /* @__PURE__ */ g(f, { children: [
25
+ e && s(e, B) ? a(
28
26
  e,
29
27
  { ...e.props || {}, ...d }
30
28
  ) : /* @__PURE__ */ t(B, { ...d, children: e }),
31
- r && l(r, R) ? a(
29
+ r && s(r, R) ? a(
32
30
  r,
33
- { ...r.props || {}, ...s }
34
- ) : /* @__PURE__ */ t(R, { ...s, children: r })
31
+ { ...r.props || {}, ...c }
32
+ ) : /* @__PURE__ */ t(R, { ...c, children: r })
35
33
  ] });
36
- }, L = (n) => {
34
+ }, I = (o) => {
37
35
  const {
38
36
  slotProps: e = {},
39
37
  children: r,
40
- onCancel: o,
41
- onConfirm: c,
42
- cancelLabel: i = "Cancel",
38
+ onCancel: i,
39
+ onConfirm: l,
40
+ cancelLabel: n = "Cancel",
43
41
  actionLabel: d = "Continue",
44
- variant: s = "confirm"
45
- } = n, T = y(), D = e.footer ?? {}, b = e.cancelButton ?? {}, P = e.actionButton ?? {};
46
- return r ? l(r, A) ? a(
42
+ variant: c = "confirm"
43
+ } = o, x = j(), m = e.footer ?? {}, T = e.cancelButton ?? {}, C = e.actionButton ?? {};
44
+ return r ? s(r, A) ? a(
47
45
  r,
48
- { ...r.props || {}, ...D }
49
- ) : /* @__PURE__ */ t(A, { ...D, children: E.map(r, (p, j) => {
50
- if (!p || !l(p)) return;
51
- const g = p, v = a(g, { ...g.props || {}, key: g.key || `footer-${T}-action-${j}` });
52
- return l(p, C) || l(p, k) ? v : /* @__PURE__ */ t(C, { asChild: !0, children: v });
53
- }) }) : /* @__PURE__ */ u(A, { children: [
54
- s !== "alert" && /* @__PURE__ */ t(
46
+ { ...r.props || {}, ...m }
47
+ ) : /* @__PURE__ */ t(A, { ...m, children: y.map(r, (p, b) => {
48
+ if (!p || !s(p)) return;
49
+ const h = p, P = a(h, { ...h.props || {}, key: h.key || `footer-${x}-action-${b}` });
50
+ return s(p, D) || s(p, k) ? P : /* @__PURE__ */ t(D, { asChild: !0, children: P });
51
+ }) }) : /* @__PURE__ */ g(A, { children: [
52
+ c !== "alert" && /* @__PURE__ */ t(
55
53
  k,
56
54
  {
57
55
  variant: "ghost",
58
- onClick: o,
59
- ...b,
60
- children: i
56
+ onClick: i,
57
+ ...T,
58
+ children: n
61
59
  }
62
60
  ),
63
61
  /* @__PURE__ */ t(
64
- C,
62
+ D,
65
63
  {
66
- onClick: c,
67
- ...P,
68
- variant: P.variant || s === "destructive" ? "destructive" : "default",
64
+ onClick: l,
65
+ ...C,
66
+ variant: C.variant || c === "destructive" ? "destructive" : "default",
69
67
  children: d
70
68
  }
71
69
  )
72
70
  ] });
73
- }, J = (n) => {
71
+ }, w = (o) => {
74
72
  const {
75
73
  trigger: e,
76
74
  header: r,
77
- footer: o,
78
- slotProps: c = {},
79
- children: i,
75
+ footer: i,
76
+ slotProps: l = {},
77
+ children: n,
80
78
  ...d
81
- } = n, s = c.content ?? {};
82
- return /* @__PURE__ */ u(F, { ...d, children: [
83
- /* @__PURE__ */ t(H, { ...n, children: e }),
84
- i ? l(i, h) ? a(
85
- i,
79
+ } = o, c = l.content ?? {};
80
+ return /* @__PURE__ */ g(E, { ...d, children: [
81
+ /* @__PURE__ */ t(F, { ...o, children: e }),
82
+ n ? s(n, u) ? a(
83
+ n,
86
84
  {
87
- ...i.props || {},
88
- ...s
85
+ ...n.props || {},
86
+ ...c
89
87
  }
90
- ) : /* @__PURE__ */ t(h, { ...s, children: i }) : /* @__PURE__ */ u(h, { ...s, children: [
91
- /* @__PURE__ */ t(I, { ...n, children: r }),
92
- /* @__PURE__ */ t(L, { ...n, children: o })
88
+ ) : /* @__PURE__ */ t(u, { ...c, children: n }) : /* @__PURE__ */ g(u, { ...c, children: [
89
+ /* @__PURE__ */ t(H, { ...o, children: r }),
90
+ /* @__PURE__ */ t(I, { ...o, children: i })
93
91
  ] })
94
92
  ] });
95
93
  };
96
94
  export {
97
- J as AlertDialog,
98
- J as default
95
+ w as AlertDialog,
96
+ w as default
99
97
  };
@@ -1,10 +1,10 @@
1
1
  import { cva as e } from "class-variance-authority";
2
- const t = e(
2
+ const r = e(
3
3
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
4
4
  {
5
5
  variants: {
6
6
  variant: {
7
- default: "bg-primary text-primary-foreground shadow hover:bg-primary/90",
7
+ default: "bg-primary text-primary-foreground shadow hover:opacity-[.8]",
8
8
  destructive: "bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
9
9
  outline: "border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
10
10
  secondary: "bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
@@ -13,8 +13,8 @@ const t = e(
13
13
  },
14
14
  size: {
15
15
  default: "h-9 px-4 py-2",
16
- sm: "h-8 rounded-md px-3 text-xs",
17
- lg: "h-10 rounded-md px-8",
16
+ sm: "h-8 rounded-md px-3 text-xs [&_svg]:size-4",
17
+ lg: "h-10 rounded-md px-8 [&_svg]:size-5 px-3 py-2",
18
18
  icon: "h-9 w-9"
19
19
  }
20
20
  },
@@ -25,5 +25,5 @@ const t = e(
25
25
  }
26
26
  );
27
27
  export {
28
- t as buttonVariants
28
+ r as buttonVariants
29
29
  };
@@ -16,10 +16,11 @@ function u({
16
16
  showOutsideDays: c,
17
17
  className: e("p-3", n),
18
18
  classNames: {
19
+ caption_dropdowns: "flex flex-col gap-1",
19
20
  months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
20
21
  month: "space-y-4",
21
- caption: "flex justify-center pt-1 relative items-center",
22
- caption_label: "text-sm font-medium",
22
+ caption: "flex justify-center pt-1 relative items-center gap-4",
23
+ caption_label: "text-sm font-medium hidden",
23
24
  nav: "space-x-1 flex items-center",
24
25
  nav_button: e(
25
26
  o({ variant: "outline" }),
@@ -1,118 +1,142 @@
1
- import { jsx as a, jsxs as t } from "react/jsx-runtime";
2
- import n, { useEffect as E } from "react";
3
- import { LoadingMask as I } from "../LoadingMask/LoadingMask.mjs";
4
- import { Popover as U, PopoverTrigger as _, PopoverContent as B } from "../Popover/Popover.mjs";
5
- import { Button as F } from "../Button/Button.mjs";
1
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import s, { useRef as R, useEffect as U, useCallback as c, useLayoutEffect as _ } from "react";
3
+ import { LoadingMask as A } from "../LoadingMask/LoadingMask.mjs";
4
+ import { Popover as F, PopoverTrigger as V, PopoverContent as X } from "../Popover/Popover.mjs";
5
+ import { Button as q } from "../Button/Button.mjs";
6
6
  import "../Button/buttonVariants.mjs";
7
- import { Command as G, CommandInput as M, CommandList as R, CommandEmpty as V, CommandGroup as W, CommandItem as X } from "../Command/Command.mjs";
8
- import { cn as g } from "@oneplatformdev/utils";
9
- import { useDebounceCallback as q } from "@oneplatformdev/hooks";
10
- import { X as z, ChevronsUpDown as A, Check as H } from "lucide-react";
11
- const te = (w) => {
12
- var C;
7
+ import { Command as z, CommandInput as H, CommandList as J, CommandEmpty as K, CommandGroup as Q, CommandItem as W } from "../Command/Command.mjs";
8
+ import { cn as v } from "@oneplatformdev/utils";
9
+ import { useDebounceCallback as Y } from "@oneplatformdev/hooks";
10
+ import { X as Z, ChevronsUpDown as $, Check as ee } from "lucide-react";
11
+ const me = (L) => {
12
+ var S;
13
13
  const {
14
- value: o,
15
- onChange: y,
16
- placeholder: x,
17
- disabled: N,
18
- searchLabel: S,
19
- fetchOptions: L,
20
- options: r,
21
- emptyLabel: O = "No options"
22
- } = w, [l, d] = n.useState(!1), [P, m] = n.useState(""), [p, h] = n.useState([]), [s, u] = n.useState(), [f, b] = n.useState(!1);
23
- E(() => {
24
- r != null && r.length && h(r);
25
- }, [r]);
26
- const j = async () => {
27
- l || (v(), m(""));
28
- }, v = async (e) => {
29
- b(!0);
14
+ value: t,
15
+ onChange: k,
16
+ placeholder: B,
17
+ disabled: O,
18
+ searchLabel: P = "Type to search...",
19
+ fetchOptions: j,
20
+ options: n,
21
+ emptyLabel: D = "No options",
22
+ emptyAction: i,
23
+ onMount: C
24
+ } = L, p = R(!1), [d, y] = s.useState(!1), [h, w] = s.useState(""), [r, m] = s.useState([]), [f, x] = s.useState(), [u, l] = s.useState(!1);
25
+ U(() => {
26
+ n != null && n.length && m(n);
27
+ }, [n]);
28
+ const T = async () => {
29
+ d || (N(), w(""));
30
+ }, N = c(async (e) => {
31
+ l(!0);
30
32
  try {
31
- const i = await L(e);
32
- h(i);
33
- } catch (i) {
34
- console.error("Unexpected error while get option:", i);
33
+ const g = await j(e);
34
+ m(g);
35
+ } catch (g) {
36
+ console.error("Unexpected error while get option:", g);
35
37
  } finally {
36
- b(!1);
38
+ l(!1);
37
39
  }
38
- }, k = q(v, 1e3), D = (e) => {
39
- m(e), k(e);
40
- }, c = (e) => {
41
- y(e.value), u(e);
42
- }, T = () => {
43
- c({ value: "", label: "" }), u(void 0);
44
- };
45
- return /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ t(
46
- U,
40
+ }, []), E = Y(N, 1e3, { leading: !1, trailing: !0 }), M = c((e) => {
41
+ l(!0), w(e), E(e);
42
+ }, []), b = c((e) => {
43
+ k(e.value), x(e), l(!1);
44
+ }, []), G = c(() => {
45
+ b({ value: "", label: "" }), x(void 0), l(!1);
46
+ }, []), I = c(() => {
47
+ if (!C) {
48
+ p.current = !0;
49
+ return;
50
+ }
51
+ C({ setOptions: m }).finally(() => {
52
+ p.current = !0;
53
+ });
54
+ }, []);
55
+ return _(() => (I(), () => {
56
+ p.current = !1;
57
+ }), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ o(
58
+ F,
47
59
  {
48
- open: l,
60
+ open: d,
49
61
  onOpenChange: (e) => {
50
- d(e), e && j();
62
+ y(e), e && T();
51
63
  },
52
64
  children: [
53
- /* @__PURE__ */ a(_, { asChild: !0, className: "border-border", children: /* @__PURE__ */ t(
54
- F,
65
+ /* @__PURE__ */ a(V, { asChild: !0, className: "border-input", children: /* @__PURE__ */ o(
66
+ q,
55
67
  {
56
68
  variant: "outline",
57
69
  role: "combobox",
58
- "aria-expanded": l,
59
- className: g(
60
- "w-full justify-between font-normal text-sm border bg-input",
61
- l ? "border-2 border-sidebar-accent" : "border-border"
70
+ "aria-expanded": d,
71
+ className: v(
72
+ "w-full justify-between font-normal text-sm border bg-transparent",
73
+ d ? "border-2 border-sidebar-accent" : "border-border"
62
74
  ),
63
- disabled: N,
75
+ disabled: O,
64
76
  children: [
65
- /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: o ? ((C = p.find((e) => e.value === o)) == null ? void 0 : C.label) || (s == null ? void 0 : s.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: x }) }),
66
- o ? /* @__PURE__ */ a(
67
- z,
77
+ /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((S = r.find((e) => e.value === t)) == null ? void 0 : S.label) || (f == null ? void 0 : f.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: B }) }),
78
+ t ? /* @__PURE__ */ a(
79
+ Z,
68
80
  {
69
81
  className: "opacity-50 w-4 h-4 cursor-pointer hover:opacity-100",
70
82
  onClick: (e) => {
71
- e.stopPropagation(), T();
83
+ e.stopPropagation(), G();
72
84
  }
73
85
  }
74
- ) : /* @__PURE__ */ a(A, { className: "opacity-50 w-4 h-4" })
86
+ ) : /* @__PURE__ */ a($, { className: "opacity-50 w-4 h-4" })
75
87
  ]
76
88
  }
77
89
  ) }),
78
90
  /* @__PURE__ */ a(
79
- B,
91
+ X,
80
92
  {
81
93
  className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
82
94
  align: "start",
83
- children: /* @__PURE__ */ t(G, { shouldFilter: !1, children: [
95
+ children: /* @__PURE__ */ o(z, { shouldFilter: !1, children: [
84
96
  /* @__PURE__ */ a(
85
- M,
97
+ H,
86
98
  {
87
- placeholder: S,
88
- value: P,
89
- onValueChange: D
99
+ placeholder: P,
100
+ value: h,
101
+ onValueChange: M
90
102
  }
91
103
  ),
92
- /* @__PURE__ */ t(R, { children: [
93
- !f && /* @__PURE__ */ a(V, { children: O }),
94
- /* @__PURE__ */ a(W, { children: f ? /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(I, {}) }) : p.map((e) => /* @__PURE__ */ t(
95
- X,
104
+ /* @__PURE__ */ o(J, { children: [
105
+ !u && !!h && /* @__PURE__ */ a(K, { children: D }),
106
+ /* @__PURE__ */ o(
107
+ Q,
96
108
  {
97
- value: e.value,
98
- onSelect: () => {
99
- o === e.value ? c({ value: "", label: "" }) : c(e), d(!1);
100
- },
109
+ className: v(
110
+ !r.length && "p-0 shadow-none"
111
+ ),
101
112
  children: [
102
- e.label,
103
- /* @__PURE__ */ a(
104
- H,
113
+ u && /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(A, {}) }),
114
+ !u && !r.length && !!h && !!i && /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: typeof i == "function" ? i({ setOptions: m }) : i }),
115
+ !u && !!r.length && r.map((e) => /* @__PURE__ */ o(
116
+ W,
105
117
  {
106
- className: g(
107
- "ml-auto",
108
- o === e.value ? "opacity-100" : "opacity-0"
109
- )
110
- }
111
- )
118
+ value: e.value,
119
+ onSelect: () => {
120
+ t === e.value ? b({ value: "", label: "" }) : b(e), y(!1);
121
+ },
122
+ children: [
123
+ e.label,
124
+ /* @__PURE__ */ a(
125
+ ee,
126
+ {
127
+ className: v(
128
+ "ml-auto",
129
+ t === e.value ? "opacity-100" : "opacity-0"
130
+ )
131
+ }
132
+ )
133
+ ]
134
+ },
135
+ e.value
136
+ ))
112
137
  ]
113
- },
114
- e.value
115
- )) })
138
+ }
139
+ )
116
140
  ] })
117
141
  ] })
118
142
  }
@@ -122,5 +146,5 @@ const te = (w) => {
122
146
  ) });
123
147
  };
124
148
  export {
125
- te as Combobox
149
+ me as Combobox
126
150
  };
@@ -1,7 +1,12 @@
1
+ import { Dispatch, ReactNode, SetStateAction } from 'react';
2
+
1
3
  export interface ComboboxOption {
2
4
  value: string;
3
5
  label: string;
4
6
  }
7
+ export interface ComboboxPropsOnMountParams {
8
+ setOptions: Dispatch<SetStateAction<ComboboxOption[]>>;
9
+ }
5
10
  export interface ComboboxProps {
6
11
  value: string;
7
12
  onChange: (value: string) => void;
@@ -10,6 +15,10 @@ export interface ComboboxProps {
10
15
  disabled?: boolean;
11
16
  fetchOptions: (search?: string) => Promise<ComboboxOption[]>;
12
17
  options?: ComboboxOption[];
13
- /** CommandEmpty label*/
18
+ /** Command Empty list label*/
14
19
  emptyLabel?: string;
20
+ /** Command Empty list action */
21
+ emptyAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
22
+ /** Callback for load data on start component */
23
+ onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
15
24
  }
@@ -1,5 +1,5 @@
1
1
  import { DialogProps } from '@radix-ui/react-dialog';
2
- import * as React from "react";
2
+ import * as React from 'react';
3
3
  declare const Command: React.ForwardRefExoticComponent<Omit<{
4
4
  children?: React.ReactNode;
5
5
  } & Pick<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & {