@oneplatformdev/ui 0.0.1-beta.4 → 0.0.1-beta.41

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 (67) hide show
  1. package/AlertDialog/AlertDialog.d.ts +14 -0
  2. package/AlertDialog/AlertDialog.mjs +58 -60
  3. package/Button/buttonVariants.mjs +3 -3
  4. package/Combobox/Combobox.mjs +81 -70
  5. package/Combobox/Combobox.types.d.ts +7 -0
  6. package/DataTable/DataTable.mjs +32 -51
  7. package/DataTable/DataTableColumnFilter.d.ts +4 -0
  8. package/DataTable/DataTableColumnFilter.mjs +31 -0
  9. package/Dropzone/Dropzone.d.ts +22 -0
  10. package/Dropzone/Dropzone.mjs +151 -0
  11. package/Dropzone/Dropzone.types.d.ts +38 -0
  12. package/Dropzone/DropzoneFilePreview.d.ts +4 -0
  13. package/Dropzone/DropzoneFilePreview.mjs +9 -0
  14. package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
  15. package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
  16. package/Dropzone/DropzoneUtils.d.ts +5 -0
  17. package/Dropzone/DropzoneUtils.mjs +24 -0
  18. package/Dropzone/index.d.ts +2 -0
  19. package/Dropzone/index.mjs +7 -0
  20. package/Dropzone/package.json +7 -0
  21. package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
  22. package/Form/FormRenderControl.d.ts +1 -2
  23. package/Form/FormRenderControl.mjs +10 -10
  24. package/Form/FormRenderControl.types.d.ts +4 -3
  25. package/FormCheckbox/FormCheckbox.d.ts +1 -2
  26. package/FormCheckbox/FormCheckbox.types.d.ts +1 -2
  27. package/FormCombobox/FormCombobox.d.ts +2 -2
  28. package/FormCombobox/FormCombobox.types.d.ts +1 -2
  29. package/FormDatePicker/FormDatePicker.d.ts +2 -2
  30. package/FormDatePicker/FormDatePicker.types.d.ts +1 -2
  31. package/FormDropzone/FormDropzone.d.ts +4 -0
  32. package/FormDropzone/FormDropzone.mjs +19 -0
  33. package/FormDropzone/FormDropzone.types.d.ts +6 -0
  34. package/FormDropzone/index.d.ts +2 -0
  35. package/FormDropzone/index.mjs +4 -0
  36. package/FormDropzone/package.json +7 -0
  37. package/FormInput/FormInput.d.ts +1 -2
  38. package/FormInput/FormInput.mjs +6 -7
  39. package/FormInput/FormInput.types.d.ts +1 -2
  40. package/FormSelect/FormSelect.d.ts +1 -2
  41. package/FormSelect/FormSelect.mjs +19 -17
  42. package/FormSelect/FormSelect.types.d.ts +1 -2
  43. package/FormTextarea/FormTextarea.d.ts +1 -2
  44. package/FormTextarea/FormTextarea.mjs +13 -12
  45. package/FormTextarea/FormTextarea.types.d.ts +1 -2
  46. package/Input/Input.mjs +42 -37
  47. package/Input/Input.types.d.ts +3 -1
  48. package/Input/index.d.ts +0 -1
  49. package/Input/index.mjs +5 -7
  50. package/Search/Search.mjs +5 -6
  51. package/Select/Select.mjs +28 -28
  52. package/Select/Select.types.d.ts +7 -1
  53. package/Sidebar/Sidebar.mjs +0 -1
  54. package/Tabs/Tabs.d.ts +3 -2
  55. package/Tabs/Tabs.mjs +20 -6
  56. package/Tabs/Tabs.types.d.ts +5 -2
  57. package/Tabs/index.mjs +8 -7
  58. package/Textarea/Textarea.d.ts +1 -1
  59. package/Textarea/Textarea.mjs +71 -15
  60. package/Textarea/Textarea.types.d.ts +16 -2
  61. package/Textarea/useAutosizeTextArea.d.ts +3 -0
  62. package/Textarea/useAutosizeTextArea.mjs +20 -0
  63. package/Toast/toastVariants.mjs +3 -3
  64. package/index.css +1 -1
  65. package/index.d.ts +2 -0
  66. package/index.mjs +315 -309
  67. package/package.json +9 -8
@@ -6,6 +6,10 @@ import { FC, PropsWithChildren } from 'react';
6
6
  * @public
7
7
  * @see [Documentation](#)
8
8
  * @example
9
+ * > Import:
10
+ * ```tsx
11
+ * import { AlertDialog } from '@oneplatformdev/ui/AlertDialog';
12
+ * ```
9
13
  * > Simple example:
10
14
  * ```tsx
11
15
  * <AlertDialog
@@ -25,6 +29,16 @@ import { FC, PropsWithChildren } from 'react';
25
29
  * onConfirm={(event) => console.log(event, 'Confirm')}
26
30
  * />
27
31
  * ```
32
+ * > Trigger example: Button with icon children
33
+ * ```tsx
34
+ * <AlertDialog
35
+ * trigger={<Button variant="outline" size="icon"><PencilLine /></Button>}
36
+ * title="Dialog title with icon trigger"
37
+ * description="Description text..."
38
+ * onCancel={(event) => console.log(event, 'Cancel')}
39
+ * onConfirm={(event) => console.log(event, 'Confirm')}
40
+ * />
41
+ * ```
28
42
  *
29
43
  * > Full content example:
30
44
  * ```tsx
@@ -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",
@@ -25,5 +25,5 @@ const t = e(
25
25
  }
26
26
  );
27
27
  export {
28
- t as buttonVariants
28
+ r as buttonVariants
29
29
  };
@@ -1,111 +1,122 @@
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 } from "react/jsx-runtime";
2
+ import n, { useRef as R, useEffect as U, useCallback as l, useLayoutEffect as _ } from "react";
3
+ import { LoadingMask as B } 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 A, CommandList as H, CommandEmpty as J, CommandGroup as K, CommandItem as Q } from "../Command/Command.mjs";
8
+ import { cn as x } from "@oneplatformdev/utils";
9
+ import { useDebounceCallback as W } from "@oneplatformdev/hooks";
10
+ import { X as Y, ChevronsUpDown as Z, Check as $ } from "lucide-react";
11
+ const de = (N) => {
12
+ var w;
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: S,
16
+ placeholder: L,
17
+ disabled: k,
18
+ searchLabel: O,
19
+ fetchOptions: P,
20
+ options: o,
21
+ emptyLabel: j = "No options",
22
+ onMount: p
23
+ } = N, c = R(!1), [s, h] = n.useState(!1), [D, f] = n.useState(""), [b, i] = n.useState([]), [d, v] = n.useState(), [C, g] = n.useState(!1);
24
+ U(() => {
25
+ o != null && o.length && i(o);
26
+ }, [o]);
27
+ const E = async () => {
28
+ s || (y(), f(""));
29
+ }, y = l(async (e) => {
30
+ g(!0);
30
31
  try {
31
- const i = await L(e);
32
- h(i);
33
- } catch (i) {
34
- console.error("Unexpected error while get option:", i);
32
+ const u = await P(e);
33
+ i(u);
34
+ } catch (u) {
35
+ console.error("Unexpected error while get option:", u);
35
36
  } finally {
36
- b(!1);
37
+ g(!1);
37
38
  }
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,
39
+ }, []), M = W(y, 1e3, { leading: !1, trailing: !0 }), T = l((e) => {
40
+ f(e), M(e);
41
+ }, []), m = l((e) => {
42
+ S(e.value), v(e);
43
+ }, []), G = l(() => {
44
+ m({ value: "", label: "" }), v(void 0);
45
+ }, []), I = l(() => {
46
+ if (!p) {
47
+ c.current = !0;
48
+ return;
49
+ }
50
+ p({ setOptions: i }).finally(() => {
51
+ c.current = !0;
52
+ });
53
+ }, []);
54
+ return _(() => (I(), () => {
55
+ c.current = !1;
56
+ }), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ r(
57
+ F,
47
58
  {
48
- open: l,
59
+ open: s,
49
60
  onOpenChange: (e) => {
50
- d(e), e && j();
61
+ h(e), e && E();
51
62
  },
52
63
  children: [
53
- /* @__PURE__ */ a(_, { asChild: !0, className: "border-border", children: /* @__PURE__ */ t(
54
- F,
64
+ /* @__PURE__ */ a(V, { asChild: !0, className: "border-input", children: /* @__PURE__ */ r(
65
+ q,
55
66
  {
56
67
  variant: "outline",
57
68
  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"
69
+ "aria-expanded": s,
70
+ className: x(
71
+ "w-full justify-between font-normal text-sm border bg-transparent",
72
+ s ? "border-2 border-sidebar-accent" : "border-border"
62
73
  ),
63
- disabled: N,
74
+ disabled: k,
64
75
  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,
76
+ /* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((w = b.find((e) => e.value === t)) == null ? void 0 : w.label) || (d == null ? void 0 : d.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: L }) }),
77
+ t ? /* @__PURE__ */ a(
78
+ Y,
68
79
  {
69
80
  className: "opacity-50 w-4 h-4 cursor-pointer hover:opacity-100",
70
81
  onClick: (e) => {
71
- e.stopPropagation(), T();
82
+ e.stopPropagation(), G();
72
83
  }
73
84
  }
74
- ) : /* @__PURE__ */ a(A, { className: "opacity-50 w-4 h-4" })
85
+ ) : /* @__PURE__ */ a(Z, { className: "opacity-50 w-4 h-4" })
75
86
  ]
76
87
  }
77
88
  ) }),
78
89
  /* @__PURE__ */ a(
79
- B,
90
+ X,
80
91
  {
81
92
  className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
82
93
  align: "start",
83
- children: /* @__PURE__ */ t(G, { shouldFilter: !1, children: [
94
+ children: /* @__PURE__ */ r(z, { shouldFilter: !1, children: [
84
95
  /* @__PURE__ */ a(
85
- M,
96
+ A,
86
97
  {
87
- placeholder: S,
88
- value: P,
89
- onValueChange: D
98
+ placeholder: O,
99
+ value: D,
100
+ onValueChange: T
90
101
  }
91
102
  ),
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,
103
+ /* @__PURE__ */ r(H, { children: [
104
+ !C && /* @__PURE__ */ a(J, { children: j }),
105
+ /* @__PURE__ */ a(K, { children: C ? /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(B, {}) }) : b.map((e) => /* @__PURE__ */ r(
106
+ Q,
96
107
  {
97
108
  value: e.value,
98
109
  onSelect: () => {
99
- o === e.value ? c({ value: "", label: "" }) : c(e), d(!1);
110
+ t === e.value ? m({ value: "", label: "" }) : m(e), h(!1);
100
111
  },
101
112
  children: [
102
113
  e.label,
103
114
  /* @__PURE__ */ a(
104
- H,
115
+ $,
105
116
  {
106
- className: g(
117
+ className: x(
107
118
  "ml-auto",
108
- o === e.value ? "opacity-100" : "opacity-0"
119
+ t === e.value ? "opacity-100" : "opacity-0"
109
120
  )
110
121
  }
111
122
  )
@@ -122,5 +133,5 @@ const te = (w) => {
122
133
  ) });
123
134
  };
124
135
  export {
125
- te as Combobox
136
+ de as Combobox
126
137
  };
@@ -1,7 +1,12 @@
1
+ import { Dispatch, 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;
@@ -12,4 +17,6 @@ export interface ComboboxProps {
12
17
  options?: ComboboxOption[];
13
18
  /** CommandEmpty label*/
14
19
  emptyLabel?: string;
20
+ /** Callback for load data on start component */
21
+ onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
15
22
  }
@@ -1,64 +1,45 @@
1
- import { jsxs as r, jsx as l } from "react/jsx-runtime";
2
- import { flexRender as d } from "@tanstack/react-table";
3
- import { ChevronDown as u } from "lucide-react";
4
- import { Button as p } from "../Button/Button.mjs";
5
- import "../Button/buttonVariants.mjs";
6
- import { DropdownMenu as g, DropdownMenuTrigger as b, DropdownMenuContent as C, DropdownMenuCheckboxItem as f } from "../DropdownMenu/DropdownMenu.mjs";
7
- import { Table as w, TableHeader as x, TableRow as o, TableHead as T, TableBody as D, TableCell as a } from "../Table/Table.mjs";
8
- const B = (s) => {
9
- var i;
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { flexRender as i } from "@tanstack/react-table";
3
+ import { Table as h, TableHeader as u, TableRow as n, TableHead as b, TableBody as g, TableCell as c } from "../Table/Table.mjs";
4
+ import { DataTableColumnFilter as f } from "./DataTableColumnFilter.mjs";
5
+ const N = (d) => {
6
+ var o;
10
7
  const {
11
- table: t,
12
- ToolBar: c,
13
- columnsLabel: m = "Columns",
14
- noResultLabel: h = "No results"
15
- } = s;
16
- return /* @__PURE__ */ r("div", { className: "w-full", children: [
17
- /* @__PURE__ */ r("div", { className: "flex items-center py-4", children: [
18
- c,
19
- /* @__PURE__ */ r(g, { children: [
20
- /* @__PURE__ */ l(b, { asChild: !0, children: /* @__PURE__ */ r(p, { variant: "outline", className: "ml-auto", children: [
21
- m,
22
- /* @__PURE__ */ l(u, { className: "ml-2 h-4 w-4" })
23
- ] }) }),
24
- /* @__PURE__ */ l(C, { align: "end", children: t.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ l(
25
- f,
26
- {
27
- className: "capitalize",
28
- checked: e.getIsVisible(),
29
- onCheckedChange: (n) => e.toggleVisibility(!!n),
30
- children: e.id
31
- },
32
- e.id
33
- )) })
34
- ] })
8
+ table: r,
9
+ ToolBar: s,
10
+ noResultLabel: m = "No results"
11
+ } = d;
12
+ return /* @__PURE__ */ a("div", { className: "w-full", children: [
13
+ /* @__PURE__ */ a("div", { className: "flex items-center py-4", children: [
14
+ s,
15
+ /* @__PURE__ */ e(f, { ...d })
35
16
  ] }),
36
- /* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */ r(w, { children: [
37
- /* @__PURE__ */ l(x, { children: t.getHeaderGroups().map((e) => /* @__PURE__ */ l(o, { children: e.headers.map((n) => /* @__PURE__ */ l(T, { children: n.isPlaceholder ? null : d(
38
- n.column.columnDef.header,
39
- n.getContext()
40
- ) }, n.id)) }, e.id)) }),
41
- /* @__PURE__ */ l(D, { children: (i = t.getRowModel().rows) != null && i.length ? t.getRowModel().rows.map((e) => /* @__PURE__ */ l(
42
- o,
17
+ /* @__PURE__ */ e("div", { className: "rounded-md border", children: /* @__PURE__ */ a(h, { children: [
18
+ /* @__PURE__ */ e(u, { children: r.getHeaderGroups().map((t) => /* @__PURE__ */ e(n, { children: t.headers.map((l) => /* @__PURE__ */ e(b, { children: l.isPlaceholder ? null : i(
19
+ l.column.columnDef.header,
20
+ l.getContext()
21
+ ) }, l.id)) }, t.id)) }),
22
+ /* @__PURE__ */ e(g, { children: (o = r.getRowModel().rows) != null && o.length ? r.getRowModel().rows.map((t) => /* @__PURE__ */ e(
23
+ n,
43
24
  {
44
- "data-state": e.getIsSelected() && "selected",
45
- children: e.getVisibleCells().map((n) => /* @__PURE__ */ l(a, { children: d(
46
- n.column.columnDef.cell,
47
- n.getContext()
48
- ) }, n.id))
25
+ "data-state": t.getIsSelected() && "selected",
26
+ children: t.getVisibleCells().map((l) => /* @__PURE__ */ e(c, { children: i(
27
+ l.column.columnDef.cell,
28
+ l.getContext()
29
+ ) }, l.id))
49
30
  },
50
- e.id
51
- )) : /* @__PURE__ */ l(o, { children: /* @__PURE__ */ l(
52
- a,
31
+ t.id
32
+ )) : /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
33
+ c,
53
34
  {
54
- colSpan: t.getAllColumns().length,
35
+ colSpan: r.getAllColumns().length,
55
36
  className: "h-24 text-center",
56
- children: h
37
+ children: m
57
38
  }
58
39
  ) }) })
59
40
  ] }) })
60
41
  ] });
61
42
  };
62
43
  export {
63
- B as DataTable
44
+ N as DataTable
64
45
  };
@@ -0,0 +1,4 @@
1
+ import { DataTableProps } from './DataTable.types';
2
+ import { FC } from 'react';
3
+
4
+ export declare const DataTableColumnFilter: FC<DataTableProps>;
@@ -0,0 +1,31 @@
1
+ import { jsx as n, jsxs as t } from "react/jsx-runtime";
2
+ import { ChevronDown as m } from "lucide-react";
3
+ import { useMemo as s } from "react";
4
+ import { Button as d } from "../Button/Button.mjs";
5
+ import "../Button/buttonVariants.mjs";
6
+ import { DropdownMenuCheckboxItem as c, DropdownMenu as u, DropdownMenuTrigger as h, DropdownMenuContent as p } from "../DropdownMenu/DropdownMenu.mjs";
7
+ const x = (i) => {
8
+ const {
9
+ table: r,
10
+ columnsLabel: l = "Columns"
11
+ } = i, o = s(() => r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ n(
12
+ c,
13
+ {
14
+ className: "capitalize",
15
+ checked: e.getIsVisible(),
16
+ onCheckedChange: (a) => e.toggleVisibility(!!a),
17
+ children: e.id
18
+ },
19
+ e.id
20
+ )), [r]);
21
+ return o.length ? /* @__PURE__ */ t(u, { children: [
22
+ /* @__PURE__ */ n(h, { asChild: !0, children: /* @__PURE__ */ t(d, { variant: "outline", className: "ml-auto", children: [
23
+ l,
24
+ /* @__PURE__ */ n(m, { className: "ml-2 h-4 w-4" })
25
+ ] }) }),
26
+ /* @__PURE__ */ n(p, { align: "end", children: o })
27
+ ] }) : null;
28
+ };
29
+ export {
30
+ x as DataTableColumnFilter
31
+ };
@@ -0,0 +1,22 @@
1
+ import { DropzoneProps } from './Dropzone.types';
2
+
3
+ /**
4
+ * Dropzone component - A drag-and-drop file upload area with image previews, error handling, and localization.
5
+ *
6
+ * @component
7
+ * @param {DropzoneProps} props - The props for the Dropzone component.
8
+ * @param {string[]} [props.acceptTypes=DEFAULT_FILE_TYPES] - Allowed file MIME types.
9
+ * @param {number} props.maxSizeMB - Maximum allowed file size in megabytes.
10
+ * @param {number} [props.maxFiles=1] - Maximum number of files that can be uploaded.
11
+ * @param {DropzoneTranslations} props.translations - Translations for text labels.
12
+ * @param {(errors: FileRejection[]) => void} [props.onErrors] - Callback triggered when file errors occur.
13
+ * @param {boolean} [props.hideErrors=false] - Whether to hide error messages.
14
+ * @param {boolean} [props.disabled=false] - Whether the dropzone is disabled.
15
+ * @param {DropzoneStyles} [props.classNames] - Custom classNames for different dropzone states.
16
+ * @param {DropzoneValueItem[]} [props.value=[]] - Current selected files or URLs.
17
+ * @param {(items: DropzoneValueItem[]) => void} [props.onChangeValue] - Callback triggered when file selection changes.
18
+ * @param {string} [props.className] - Additional class names for styling.
19
+ * @param {React.Ref<HTMLDivElement>} ref - Ref for the root dropzone container.
20
+ * @returns {JSX.Element} The rendered Dropzone component.
21
+ */
22
+ export declare const Dropzone: import('react').ForwardRefExoticComponent<DropzoneProps & import('react').RefAttributes<HTMLDivElement>>;