@oneplatformdev/ui 0.0.1-beta.7 → 0.0.1-beta.71

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 (117) hide show
  1. package/Accordion/Accordion.d.ts +2 -2
  2. package/Accordion/Accordion.mjs +23 -20
  3. package/AlertDialog/AlertDialogRoot.d.ts +2 -2
  4. package/AlertDialog/AlertDialogRoot.mjs +7 -7
  5. package/Button/buttonVariants.mjs +4 -4
  6. package/Calendar/Calendar.mjs +3 -2
  7. package/Checkbox/Checkbox.d.ts +5 -4
  8. package/Checkbox/Checkbox.mjs +48 -21
  9. package/Checkbox/Checkbox.types.d.ts +10 -0
  10. package/Checkbox/index.d.ts +2 -1
  11. package/Checkbox/index.mjs +3 -2
  12. package/Combobox/Combobox.d.ts +2 -2
  13. package/Combobox/Combobox.mjs +127 -87
  14. package/Combobox/Combobox.types.d.ts +13 -1
  15. package/Command/Command.d.ts +1 -1
  16. package/DataTable/DataTable.d.ts +10 -3
  17. package/DataTable/DataTable.mjs +33 -33
  18. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  19. package/DataTable/DataTableColumnFilter.mjs +31 -0
  20. package/DatePicker/DatePicker.mjs +2 -2
  21. package/Dialog/Dialog.d.ts +2 -2
  22. package/Dialog/Dialog.mjs +14 -12
  23. package/Dropzone/Dropzone.d.ts +22 -0
  24. package/Dropzone/Dropzone.mjs +151 -0
  25. package/Dropzone/Dropzone.types.d.ts +38 -0
  26. package/Dropzone/DropzoneFilePreview.d.ts +4 -0
  27. package/Dropzone/DropzoneFilePreview.mjs +9 -0
  28. package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
  29. package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
  30. package/Dropzone/DropzoneUtils.d.ts +5 -0
  31. package/Dropzone/DropzoneUtils.mjs +24 -0
  32. package/Dropzone/index.d.ts +2 -0
  33. package/Dropzone/index.mjs +7 -0
  34. package/Dropzone/package.json +7 -0
  35. package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
  36. package/Form/Form.d.ts +2 -2
  37. package/Form/Form.mjs +48 -45
  38. package/Form/FormRenderControl.d.ts +2 -3
  39. package/Form/FormRenderControl.mjs +10 -10
  40. package/Form/FormRenderControl.types.d.ts +5 -7
  41. package/FormCheckbox/FormCheckbox.d.ts +2 -3
  42. package/FormCheckbox/FormCheckbox.mjs +23 -23
  43. package/FormCheckbox/FormCheckbox.types.d.ts +3 -3
  44. package/FormCombobox/FormCombobox.d.ts +2 -2
  45. package/FormCombobox/FormCombobox.types.d.ts +2 -3
  46. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  47. package/FormDatePicker/FormDatePicker.mjs +20 -18
  48. package/FormDatePicker/FormDatePicker.types.d.ts +2 -3
  49. package/FormDropzone/FormDropzone.d.ts +4 -0
  50. package/FormDropzone/FormDropzone.mjs +19 -0
  51. package/FormDropzone/FormDropzone.types.d.ts +6 -0
  52. package/FormDropzone/index.d.ts +2 -0
  53. package/FormDropzone/index.mjs +4 -0
  54. package/FormDropzone/package.json +7 -0
  55. package/FormInput/FormInput.d.ts +2 -3
  56. package/FormInput/FormInput.mjs +25 -17
  57. package/FormInput/FormInput.types.d.ts +2 -3
  58. package/FormRadio/FormRadio.d.ts +4 -0
  59. package/FormRadio/FormRadio.mjs +40 -0
  60. package/FormRadio/FormRadio.types.d.ts +6 -0
  61. package/FormRadio/index.d.ts +2 -0
  62. package/FormRadio/index.mjs +4 -0
  63. package/FormRadio/package.json +7 -0
  64. package/FormSelect/FormSelect.d.ts +2 -3
  65. package/FormSelect/FormSelect.mjs +19 -17
  66. package/FormSelect/FormSelect.types.d.ts +2 -3
  67. package/FormTextarea/FormTextarea.d.ts +2 -3
  68. package/FormTextarea/FormTextarea.mjs +13 -12
  69. package/FormTextarea/FormTextarea.types.d.ts +2 -3
  70. package/Input/Input.mjs +40 -34
  71. package/Input/Input.types.d.ts +4 -1
  72. package/Input/inputVariants.mjs +9 -3
  73. package/Label/Label.d.ts +2 -2
  74. package/Label/labelVariants.mjs +7 -4
  75. package/LazyLoader/LazyLoader.mjs +5 -4
  76. package/LoadingMask/LoadingMask.d.ts +4 -1
  77. package/LoadingMask/LoadingMask.mjs +18 -56
  78. package/LoadingMask/LoadingMask.types.d.ts +5 -0
  79. package/LoadingMask/RenderLoadingMask.d.ts +3 -0
  80. package/LoadingMask/RenderLoadingMask.mjs +108 -0
  81. package/LoadingMask/index.d.ts +2 -0
  82. package/LoadingMask/index.mjs +4 -2
  83. package/Radio/Radio.d.ts +4 -0
  84. package/Radio/Radio.mjs +12 -0
  85. package/Radio/Radio.types.d.ts +11 -0
  86. package/Radio/index.d.ts +2 -0
  87. package/Radio/index.mjs +4 -0
  88. package/Radio/package.json +7 -0
  89. package/RadioGroup/RadioGroup.d.ts +9 -3
  90. package/RadioGroup/RadioGroup.mjs +37 -19
  91. package/RadioGroup/index.mjs +4 -3
  92. package/ScrollArea/ScrollArea.d.ts +2 -2
  93. package/ScrollArea/ScrollArea.mjs +26 -13
  94. package/Select/Select.mjs +93 -63
  95. package/Select/Select.types.d.ts +9 -2
  96. package/Select/SelectRoot.d.ts +2 -2
  97. package/Select/SelectRoot.mjs +1 -0
  98. package/TablePagination/TablePagination.d.ts +16 -0
  99. package/TablePagination/TablePagination.mjs +74 -0
  100. package/TablePagination/index.d.ts +1 -0
  101. package/TablePagination/index.mjs +4 -0
  102. package/TablePagination/package.json +7 -0
  103. package/Tabs/Tabs.d.ts +3 -2
  104. package/Tabs/Tabs.mjs +20 -6
  105. package/Tabs/Tabs.types.d.ts +5 -2
  106. package/Tabs/index.mjs +8 -7
  107. package/Textarea/Textarea.d.ts +1 -1
  108. package/Textarea/Textarea.mjs +71 -15
  109. package/Textarea/Textarea.types.d.ts +16 -2
  110. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  111. package/Textarea/useAutosizeTextArea.mjs +20 -0
  112. package/Toast/toastVariants.mjs +3 -3
  113. package/index.css +1 -1
  114. package/index.d.ts +3 -0
  115. package/index.mjs +332 -318
  116. package/package.json +9 -8
  117. package/tailwind.config.mjs +13 -13
@@ -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,6 +1,6 @@
1
1
  import { ButtonProps } from '../Button';
2
- import * as React from "react";
3
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
2
+ import * as React from 'react';
3
+ import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
4
4
  declare const AlertDialogRoot: React.FC<AlertDialogPrimitive.AlertDialogProps>;
5
5
  declare const AlertDialogTrigger: React.ForwardRefExoticComponent<AlertDialogPrimitive.AlertDialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  declare const AlertDialogPortal: React.FC<AlertDialogPrimitive.AlertDialogPortalProps>;
@@ -38,7 +38,7 @@ const g = ({
38
38
  "div",
39
39
  {
40
40
  className: s(
41
- "flex flex-col space-y-2 text-center sm:text-left",
41
+ "w-full min-w-0 flex flex-col space-y-2 text-center sm:text-left",
42
42
  a
43
43
  ),
44
44
  ...t
@@ -77,7 +77,7 @@ const x = i.forwardRef(({ className: a, ...t }, o) => /* @__PURE__ */ l(
77
77
  }
78
78
  ));
79
79
  x.displayName = e.Description.displayName;
80
- const A = i.forwardRef(({ className: a, variant: t, size: o, ...r }, d) => /* @__PURE__ */ l(
80
+ const u = i.forwardRef(({ className: a, variant: t, size: o, ...r }, d) => /* @__PURE__ */ l(
81
81
  e.Action,
82
82
  {
83
83
  ref: d,
@@ -85,8 +85,8 @@ const A = i.forwardRef(({ className: a, variant: t, size: o, ...r }, d) => /* @_
85
85
  ...r
86
86
  }
87
87
  ));
88
- A.displayName = e.Action.displayName;
89
- const D = i.forwardRef(({ className: a, variant: t = "outline", size: o, ...r }, d) => /* @__PURE__ */ l(
88
+ u.displayName = e.Action.displayName;
89
+ const A = i.forwardRef(({ className: a, variant: t = "outline", size: o, ...r }, d) => /* @__PURE__ */ l(
90
90
  e.Cancel,
91
91
  {
92
92
  ref: d,
@@ -98,10 +98,10 @@ const D = i.forwardRef(({ className: a, variant: t = "outline", size: o, ...r },
98
98
  ...r
99
99
  }
100
100
  ));
101
- D.displayName = e.Cancel.displayName;
101
+ A.displayName = e.Cancel.displayName;
102
102
  export {
103
- A as AlertDialogAction,
104
- D as AlertDialogCancel,
103
+ u as AlertDialogAction,
104
+ A as AlertDialogCancel,
105
105
  p as AlertDialogContent,
106
106
  x as AlertDialogDescription,
107
107
  N as AlertDialogFooter,
@@ -4,7 +4,7 @@ const t = e(
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,14 +13,14 @@ 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
  },
21
21
  defaultVariants: {
22
22
  variant: "default",
23
- size: "default"
23
+ size: "lg"
24
24
  }
25
25
  }
26
26
  );
@@ -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,4 +1,5 @@
1
- import * as React from "react";
2
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
- declare const Checkbox: React.ForwardRefExoticComponent<Omit<CheckboxPrimitive.CheckboxProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
4
- export { Checkbox };
1
+ import { CheckboxLabelProps, CheckboxProps } from './Checkbox.types';
2
+ import * as React from 'react';
3
+ declare const Checkbox: React.ForwardRefExoticComponent<CheckboxProps & React.RefAttributes<HTMLButtonElement>>;
4
+ declare const CheckboxLabel: React.ForwardRefExoticComponent<CheckboxLabelProps & React.RefAttributes<HTMLLabelElement>>;
5
+ export { Checkbox, CheckboxLabel };
@@ -1,27 +1,54 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import * as s from "react";
3
- import * as r from "@radix-ui/react-checkbox";
4
- import { Check as c } from "lucide-react";
5
- import { cn as o } from "@oneplatformdev/utils";
6
- const d = s.forwardRef(({ className: i, ...t }, a) => /* @__PURE__ */ e(
7
- r.Root,
1
+ import { jsx as r, jsxs as n } from "react/jsx-runtime";
2
+ import * as s from "@radix-ui/react-checkbox";
3
+ import { MinusIcon as l, CheckIcon as h } from "lucide-react";
4
+ import * as m from "react";
5
+ import { cn as a } from "@oneplatformdev/utils";
6
+ import { Label as u } from "../Label/Label.mjs";
7
+ import "../Label/labelVariants.mjs";
8
+ const d = m.forwardRef(({ className: t, checked: c, indeterminate: e, ...i }, o) => {
9
+ const f = e ? l : h;
10
+ return /* @__PURE__ */ r(
11
+ s.Root,
12
+ {
13
+ ref: o,
14
+ className: a(
15
+ "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
16
+ t
17
+ ),
18
+ ...i,
19
+ checked: c || e,
20
+ children: /* @__PURE__ */ r(
21
+ s.Indicator,
22
+ {
23
+ className: a("flex items-center justify-center text-current"),
24
+ children: /* @__PURE__ */ r(f, { className: "h-4 w-4" })
25
+ }
26
+ )
27
+ }
28
+ );
29
+ });
30
+ d.displayName = s.Root.displayName;
31
+ const x = m.forwardRef(({ label: t = "", children: c, labelProps: e, ...i }, o) => /* @__PURE__ */ n(
32
+ u,
8
33
  {
9
- ref: a,
10
- className: o(
11
- "peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
12
- i
34
+ ref: o,
35
+ ...e,
36
+ className: a(
37
+ "flex w-full items-start gap-3 font-normal py-3 cursor-pointer",
38
+ e == null ? void 0 : e.className
13
39
  ),
14
- ...t,
15
- children: /* @__PURE__ */ e(
16
- r.Indicator,
17
- {
18
- className: o("flex items-center justify-center text-current"),
19
- children: /* @__PURE__ */ e(c, { className: "h-4 w-4" })
20
- }
21
- )
40
+ style: e == null ? void 0 : e.style,
41
+ children: [
42
+ /* @__PURE__ */ r(d, { ...i }),
43
+ /* @__PURE__ */ n("div", { className: "flex flex-col w-full gap-3", children: [
44
+ /* @__PURE__ */ r("span", { className: "flex flex-col justify-start leading-[16px]", children: t }),
45
+ c
46
+ ] })
47
+ ]
22
48
  }
23
49
  ));
24
- d.displayName = r.Root.displayName;
50
+ x.displayName = "CheckboxLabel";
25
51
  export {
26
- d as Checkbox
52
+ d as Checkbox,
53
+ x as CheckboxLabel
27
54
  };
@@ -0,0 +1,10 @@
1
+ import { Label } from '../Label';
2
+ import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
3
+ import * as React from 'react';
4
+ export interface CheckboxProps extends React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root> {
5
+ indeterminate?: boolean;
6
+ }
7
+ export interface CheckboxLabelProps extends CheckboxProps {
8
+ label?: string;
9
+ labelProps?: React.ComponentPropsWithoutRef<typeof Label>;
10
+ }
@@ -1 +1,2 @@
1
- export * from './Checkbox';
1
+ export * from './Checkbox.tsx';
2
+ export type * from './Checkbox.types.ts';
@@ -1,4 +1,5 @@
1
- import { Checkbox as r } from "./Checkbox.mjs";
1
+ import { Checkbox as b, CheckboxLabel as x } from "./Checkbox.mjs";
2
2
  export {
3
- r as Checkbox
3
+ b as Checkbox,
4
+ x as CheckboxLabel
4
5
  };
@@ -1,4 +1,4 @@
1
1
  import { ComboboxProps } from './Combobox.types';
2
- import { FC } from 'react';
2
+ import { default as React } from 'react';
3
3
 
4
- export declare const Combobox: FC<ComboboxProps>;
4
+ export declare const Combobox: React.ForwardRefExoticComponent<ComboboxProps & React.RefAttributes<HTMLDivElement>>;
@@ -1,126 +1,166 @@
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 r, Fragment as G } from "react/jsx-runtime";
2
+ import s, { forwardRef as I, useRef as U, useEffect as q, useCallback as c, useLayoutEffect as A } from "react";
3
+ import { LoadingMask as V } from "../LoadingMask/LoadingMask.mjs";
4
+ import "../LoadingMask/RenderLoadingMask.mjs";
5
+ import { Popover as X, PopoverTrigger as H, PopoverContent as J } from "../Popover/Popover.mjs";
6
+ import { Button as K } from "../Button/Button.mjs";
6
7
  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;
8
+ import { Command as Q, CommandInput as W, CommandList as Y, CommandGroup as Z, CommandEmpty as j, CommandItem as $ } from "../Command/Command.mjs";
9
+ import { cn as h } from "@oneplatformdev/utils";
10
+ import { useDebounceCallback as ee } from "@oneplatformdev/hooks";
11
+ import { X as ae, ChevronsUpDown as te, Check as re } from "lucide-react";
12
+ const fe = I((k, O) => {
13
+ var L;
13
14
  const {
14
15
  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);
16
+ onChange: P,
17
+ placeholder: D,
18
+ disabled: T,
19
+ searchLabel: B = "Type to search...",
20
+ fetchOptions: E,
21
+ options: n,
22
+ emptyLabel: C = "No options",
23
+ emptyAction: i,
24
+ onMount: x
25
+ } = k, f = U(!1), [t, d] = s.useState(!1), [m, w] = s.useState(""), [p, u] = s.useState([]), [b, N] = s.useState(), [g, l] = s.useState(!1);
26
+ q(() => {
27
+ n != null && n.length && u(n);
28
+ }, [n]);
29
+ const M = async () => {
30
+ t || (S(), w(""));
31
+ }, S = c(async (e) => {
32
+ l(!0);
30
33
  try {
31
- const i = await L(e);
32
- h(i);
33
- } catch (i) {
34
- console.error("Unexpected error while get option:", i);
34
+ const y = await E(e);
35
+ u(y);
36
+ } catch (y) {
37
+ console.error("Unexpected error while get option:", y);
35
38
  } finally {
36
- b(!1);
39
+ l(!1);
37
40
  }
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,
41
+ }, []), R = ee(S, 1e3, {
42
+ leading: !1,
43
+ trailing: !0
44
+ }), _ = c((e) => {
45
+ l(!0), w(e), R(e);
46
+ }, []), v = c((e) => {
47
+ P(e.value), N(e), l(!1);
48
+ }, []), z = c(() => {
49
+ v({ value: "", label: "" }), N(void 0), l(!1);
50
+ }, []), F = c(() => {
51
+ if (!x) {
52
+ f.current = !0;
53
+ return;
54
+ }
55
+ x({ setOptions: u, search: m || "", open: t, setOpen: d }).finally(
56
+ () => {
57
+ f.current = !0;
58
+ }
59
+ );
60
+ }, []);
61
+ return A(() => (F(), () => {
62
+ f.current = !1;
63
+ }), []), /* @__PURE__ */ a("div", { className: "w-full", ref: O, children: /* @__PURE__ */ r(
64
+ X,
47
65
  {
48
- open: l,
66
+ open: t,
49
67
  onOpenChange: (e) => {
50
- d(e), e && j();
68
+ d(e), e && M();
51
69
  },
52
70
  children: [
53
- /* @__PURE__ */ a(_, { asChild: !0, className: "border-border", children: /* @__PURE__ */ t(
54
- F,
71
+ /* @__PURE__ */ a(H, { asChild: !0, className: "border-input", children: /* @__PURE__ */ r(
72
+ K,
55
73
  {
56
74
  variant: "outline",
57
75
  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"
76
+ size: "lg",
77
+ "aria-expanded": t,
78
+ className: h(
79
+ "w-full justify-between font-normal text-sm border bg-transparent relative p-3",
80
+ t ? "border-2 border-sidebar-accent" : "border-border"
62
81
  ),
63
- disabled: N,
82
+ disabled: T,
64
83
  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 }) }),
84
+ /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: o ? ((L = p.find((e) => e.value === o)) == null ? void 0 : L.label) || (b == null ? void 0 : b.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: D }) }),
66
85
  o ? /* @__PURE__ */ a(
67
- z,
86
+ "div",
68
87
  {
69
- className: "opacity-50 w-4 h-4 cursor-pointer hover:opacity-100",
88
+ className: h(
89
+ "absolute top-0 right-1",
90
+ "flex items-center justify-center",
91
+ "w-9 aspect-square [&_svg]:size-5",
92
+ "opacity-50 cursor-pointer hover:opacity-100"
93
+ ),
70
94
  onClick: (e) => {
71
- e.stopPropagation(), T();
72
- }
95
+ e.stopPropagation(), z();
96
+ },
97
+ children: /* @__PURE__ */ a(ae, {})
73
98
  }
74
- ) : /* @__PURE__ */ a(A, { className: "opacity-50 w-4 h-4" })
99
+ ) : /* @__PURE__ */ a(te, { className: "opacity-50 w-4 h-4" })
75
100
  ]
76
101
  }
77
102
  ) }),
78
103
  /* @__PURE__ */ a(
79
- B,
104
+ J,
80
105
  {
81
106
  className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
82
107
  align: "start",
83
- children: /* @__PURE__ */ t(G, { shouldFilter: !1, children: [
108
+ children: /* @__PURE__ */ r(Q, { shouldFilter: !1, children: [
84
109
  /* @__PURE__ */ a(
85
- M,
110
+ W,
86
111
  {
87
- placeholder: S,
88
- value: P,
89
- onValueChange: D
112
+ placeholder: B,
113
+ value: m,
114
+ onValueChange: _
90
115
  }
91
116
  ),
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,
96
- {
97
- value: e.value,
98
- onSelect: () => {
99
- o === e.value ? c({ value: "", label: "" }) : c(e), d(!1);
100
- },
101
- children: [
102
- e.label,
103
- /* @__PURE__ */ a(
104
- H,
105
- {
106
- className: g(
107
- "ml-auto",
108
- o === e.value ? "opacity-100" : "opacity-0"
117
+ /* @__PURE__ */ a(Y, { children: /* @__PURE__ */ r(
118
+ Z,
119
+ {
120
+ className: h(!p.length && "p-0 shadow-none"),
121
+ children: [
122
+ g && /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(V, {}) }),
123
+ !g && !!m && /* @__PURE__ */ a(G, { children: i ? /* @__PURE__ */ r(j, { className: "flex flex-col gap-3 py-5 px-3 items-center", children: [
124
+ /* @__PURE__ */ a("span", { children: C }),
125
+ typeof i == "function" ? i({
126
+ setOptions: u,
127
+ search: m || "",
128
+ open: t,
129
+ setOpen: d
130
+ }) : i
131
+ ] }) : /* @__PURE__ */ a(j, { children: C }) }),
132
+ !g && !!p.length && p.map((e) => /* @__PURE__ */ r(
133
+ $,
134
+ {
135
+ value: e.value,
136
+ onSelect: () => {
137
+ o === e.value ? v({ value: "", label: "" }) : v(e), d(!1);
138
+ },
139
+ children: [
140
+ e.label,
141
+ /* @__PURE__ */ a(
142
+ re,
143
+ {
144
+ className: h(
145
+ "ml-auto",
146
+ o === e.value ? "opacity-100" : "opacity-0"
147
+ )
148
+ }
109
149
  )
110
- }
111
- )
112
- ]
113
- },
114
- e.value
115
- )) })
116
- ] })
150
+ ]
151
+ },
152
+ e.value
153
+ ))
154
+ ]
155
+ }
156
+ ) })
117
157
  ] })
118
158
  }
119
159
  )
120
160
  ]
121
161
  }
122
162
  ) });
123
- };
163
+ });
124
164
  export {
125
- te as Combobox
165
+ fe as Combobox
126
166
  };
@@ -1,7 +1,15 @@
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
+ search: string;
10
+ open: boolean;
11
+ setOpen: Dispatch<SetStateAction<boolean>>;
12
+ }
5
13
  export interface ComboboxProps {
6
14
  value: string;
7
15
  onChange: (value: string) => void;
@@ -10,6 +18,10 @@ export interface ComboboxProps {
10
18
  disabled?: boolean;
11
19
  fetchOptions: (search?: string) => Promise<ComboboxOption[]>;
12
20
  options?: ComboboxOption[];
13
- /** CommandEmpty label*/
21
+ /** Command Empty list label*/
14
22
  emptyLabel?: string;
23
+ /** Command Empty list action */
24
+ emptyAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
25
+ /** Callback for load data on start component */
26
+ onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
15
27
  }
@@ -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>> & {
@@ -1,4 +1,11 @@
1
- import { DataTableProps } from './DataTable.types';
2
- import { FC } from 'react';
1
+ import { default as React, FC } from 'react';
2
+ import { Table as ReactTable } from '@tanstack/react-table';
3
3
 
4
- export declare const DataTable: FC<DataTableProps>;
4
+ interface IProps {
5
+ table: ReactTable<any>;
6
+ ToolBar?: React.ReactNode;
7
+ tColumns?: string;
8
+ tNoResults?: string;
9
+ }
10
+ export declare const DataTable: FC<IProps>;
11
+ export {};