@oneplatformdev/ui 0.0.1-beta.4 → 0.0.1-beta.40
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.
- package/AlertDialog/AlertDialog.d.ts +14 -0
- package/AlertDialog/AlertDialog.mjs +58 -60
- package/Button/buttonVariants.mjs +3 -3
- package/Combobox/Combobox.mjs +81 -70
- package/Combobox/Combobox.types.d.ts +7 -0
- package/DataTable/DataTable.mjs +32 -51
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -0
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +136 -0
- package/Dropzone/Dropzone.types.d.ts +36 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneUtils.d.ts +4 -0
- package/Dropzone/DropzoneUtils.mjs +15 -0
- package/Dropzone/index.d.ts +2 -0
- package/Dropzone/index.mjs +7 -0
- package/Dropzone/package.json +7 -0
- package/DropzoneFilePreview-Dhtv8F4u.js +67 -0
- package/Form/FormRenderControl.d.ts +1 -2
- package/Form/FormRenderControl.mjs +10 -10
- package/Form/FormRenderControl.types.d.ts +4 -3
- package/FormCheckbox/FormCheckbox.d.ts +1 -2
- package/FormCheckbox/FormCheckbox.types.d.ts +1 -2
- package/FormCombobox/FormCombobox.d.ts +2 -2
- package/FormCombobox/FormCombobox.types.d.ts +1 -2
- package/FormDatePicker/FormDatePicker.d.ts +2 -2
- package/FormDatePicker/FormDatePicker.types.d.ts +1 -2
- package/FormDropzone/FormDropzone.d.ts +4 -0
- package/FormDropzone/FormDropzone.mjs +19 -0
- package/FormDropzone/FormDropzone.types.d.ts +6 -0
- package/FormDropzone/index.d.ts +2 -0
- package/FormDropzone/index.mjs +4 -0
- package/FormDropzone/package.json +7 -0
- package/FormInput/FormInput.d.ts +1 -2
- package/FormInput/FormInput.mjs +6 -7
- package/FormInput/FormInput.types.d.ts +1 -2
- package/FormSelect/FormSelect.d.ts +1 -2
- package/FormSelect/FormSelect.mjs +19 -17
- package/FormSelect/FormSelect.types.d.ts +1 -2
- package/FormTextarea/FormTextarea.d.ts +1 -2
- package/FormTextarea/FormTextarea.mjs +13 -12
- package/FormTextarea/FormTextarea.types.d.ts +1 -2
- package/Input/Input.mjs +42 -37
- package/Input/Input.types.d.ts +3 -1
- package/Input/index.d.ts +0 -1
- package/Input/index.mjs +5 -7
- package/Search/Search.mjs +5 -6
- package/Select/Select.mjs +28 -28
- package/Select/Select.types.d.ts +7 -1
- package/Sidebar/Sidebar.mjs +0 -1
- package/Tabs/Tabs.d.ts +3 -2
- package/Tabs/Tabs.mjs +20 -6
- package/Tabs/Tabs.types.d.ts +5 -2
- package/Tabs/index.mjs +8 -7
- package/Textarea/Textarea.d.ts +1 -1
- package/Textarea/Textarea.mjs +71 -15
- package/Textarea/Textarea.types.d.ts +16 -2
- package/Textarea/useAutosizeTextArea.d.ts +3 -0
- package/Textarea/useAutosizeTextArea.mjs +20 -0
- package/Toast/toastVariants.mjs +3 -3
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.mjs +315 -309
- 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
|
2
|
-
import { cloneElement as a, useId as
|
3
|
-
import { AlertDialogRoot as
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
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
|
-
...
|
11
|
+
...i
|
14
12
|
}
|
15
|
-
) :
|
16
|
-
},
|
13
|
+
) : /* @__PURE__ */ t(v, { asChild: !0, children: r });
|
14
|
+
}, H = (o) => {
|
17
15
|
const {
|
18
16
|
title: e = "",
|
19
17
|
description: r = "",
|
20
|
-
slotProps:
|
21
|
-
children:
|
22
|
-
} =
|
23
|
-
return
|
24
|
-
|
25
|
-
{ ...
|
26
|
-
) : /* @__PURE__ */ t(
|
27
|
-
e &&
|
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 &&
|
29
|
+
r && s(r, R) ? a(
|
32
30
|
r,
|
33
|
-
{ ...r.props || {}, ...
|
34
|
-
) : /* @__PURE__ */ t(R, { ...
|
31
|
+
{ ...r.props || {}, ...c }
|
32
|
+
) : /* @__PURE__ */ t(R, { ...c, children: r })
|
35
33
|
] });
|
36
|
-
},
|
34
|
+
}, I = (o) => {
|
37
35
|
const {
|
38
36
|
slotProps: e = {},
|
39
37
|
children: r,
|
40
|
-
onCancel:
|
41
|
-
onConfirm:
|
42
|
-
cancelLabel:
|
38
|
+
onCancel: i,
|
39
|
+
onConfirm: l,
|
40
|
+
cancelLabel: n = "Cancel",
|
43
41
|
actionLabel: d = "Continue",
|
44
|
-
variant:
|
45
|
-
} =
|
46
|
-
return r ?
|
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 || {}, ...
|
49
|
-
) : /* @__PURE__ */ t(A, { ...
|
50
|
-
if (!p || !
|
51
|
-
const
|
52
|
-
return
|
53
|
-
}) }) : /* @__PURE__ */
|
54
|
-
|
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:
|
59
|
-
...
|
60
|
-
children:
|
56
|
+
onClick: i,
|
57
|
+
...T,
|
58
|
+
children: n
|
61
59
|
}
|
62
60
|
),
|
63
61
|
/* @__PURE__ */ t(
|
64
|
-
|
62
|
+
D,
|
65
63
|
{
|
66
|
-
onClick:
|
67
|
-
...
|
68
|
-
variant:
|
64
|
+
onClick: l,
|
65
|
+
...C,
|
66
|
+
variant: C.variant || c === "destructive" ? "destructive" : "default",
|
69
67
|
children: d
|
70
68
|
}
|
71
69
|
)
|
72
70
|
] });
|
73
|
-
},
|
71
|
+
}, w = (o) => {
|
74
72
|
const {
|
75
73
|
trigger: e,
|
76
74
|
header: r,
|
77
|
-
footer:
|
78
|
-
slotProps:
|
79
|
-
children:
|
75
|
+
footer: i,
|
76
|
+
slotProps: l = {},
|
77
|
+
children: n,
|
80
78
|
...d
|
81
|
-
} =
|
82
|
-
return /* @__PURE__ */
|
83
|
-
/* @__PURE__ */ t(
|
84
|
-
|
85
|
-
|
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
|
-
...
|
88
|
-
...
|
85
|
+
...n.props || {},
|
86
|
+
...c
|
89
87
|
}
|
90
|
-
) : /* @__PURE__ */ t(
|
91
|
-
/* @__PURE__ */ t(
|
92
|
-
/* @__PURE__ */ t(
|
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
|
-
|
98
|
-
|
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
|
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:
|
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
|
-
|
28
|
+
r as buttonVariants
|
29
29
|
};
|
package/Combobox/Combobox.mjs
CHANGED
@@ -1,111 +1,122 @@
|
|
1
|
-
import { jsx as a, jsxs as
|
2
|
-
import n, { useEffect as
|
3
|
-
import { LoadingMask as
|
4
|
-
import { Popover as
|
5
|
-
import { Button as
|
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
|
8
|
-
import { cn as
|
9
|
-
import { useDebounceCallback as
|
10
|
-
import { X as
|
11
|
-
const
|
12
|
-
var
|
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:
|
15
|
-
onChange:
|
16
|
-
placeholder:
|
17
|
-
disabled:
|
18
|
-
searchLabel:
|
19
|
-
fetchOptions:
|
20
|
-
options:
|
21
|
-
emptyLabel:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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
|
32
|
-
|
33
|
-
} catch (
|
34
|
-
console.error("Unexpected error while get option:",
|
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
|
-
|
37
|
+
g(!1);
|
37
38
|
}
|
38
|
-
},
|
39
|
-
|
40
|
-
},
|
41
|
-
|
42
|
-
},
|
43
|
-
|
44
|
-
}
|
45
|
-
|
46
|
-
|
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:
|
59
|
+
open: s,
|
49
60
|
onOpenChange: (e) => {
|
50
|
-
|
61
|
+
h(e), e && E();
|
51
62
|
},
|
52
63
|
children: [
|
53
|
-
/* @__PURE__ */ a(
|
54
|
-
|
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":
|
59
|
-
className:
|
60
|
-
"w-full justify-between font-normal text-sm border bg-
|
61
|
-
|
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:
|
74
|
+
disabled: k,
|
64
75
|
children: [
|
65
|
-
/* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children:
|
66
|
-
|
67
|
-
|
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(),
|
82
|
+
e.stopPropagation(), G();
|
72
83
|
}
|
73
84
|
}
|
74
|
-
) : /* @__PURE__ */ a(
|
85
|
+
) : /* @__PURE__ */ a(Z, { className: "opacity-50 w-4 h-4" })
|
75
86
|
]
|
76
87
|
}
|
77
88
|
) }),
|
78
89
|
/* @__PURE__ */ a(
|
79
|
-
|
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__ */
|
94
|
+
children: /* @__PURE__ */ r(z, { shouldFilter: !1, children: [
|
84
95
|
/* @__PURE__ */ a(
|
85
|
-
|
96
|
+
A,
|
86
97
|
{
|
87
|
-
placeholder:
|
88
|
-
value:
|
89
|
-
onValueChange:
|
98
|
+
placeholder: O,
|
99
|
+
value: D,
|
100
|
+
onValueChange: T
|
90
101
|
}
|
91
102
|
),
|
92
|
-
/* @__PURE__ */
|
93
|
-
!
|
94
|
-
/* @__PURE__ */ a(
|
95
|
-
|
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
|
-
|
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
|
-
|
115
|
+
$,
|
105
116
|
{
|
106
|
-
className:
|
117
|
+
className: x(
|
107
118
|
"ml-auto",
|
108
|
-
|
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
|
-
|
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
|
}
|
package/DataTable/DataTable.mjs
CHANGED
@@ -1,64 +1,45 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { flexRender as
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
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:
|
12
|
-
ToolBar:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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__ */
|
37
|
-
/* @__PURE__ */
|
38
|
-
|
39
|
-
|
40
|
-
) },
|
41
|
-
/* @__PURE__ */
|
42
|
-
|
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":
|
45
|
-
children:
|
46
|
-
|
47
|
-
|
48
|
-
) },
|
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
|
-
|
51
|
-
)) : /* @__PURE__ */
|
52
|
-
|
31
|
+
t.id
|
32
|
+
)) : /* @__PURE__ */ e(n, { children: /* @__PURE__ */ e(
|
33
|
+
c,
|
53
34
|
{
|
54
|
-
colSpan:
|
35
|
+
colSpan: r.getAllColumns().length,
|
55
36
|
className: "h-24 text-center",
|
56
|
-
children:
|
37
|
+
children: m
|
57
38
|
}
|
58
39
|
) }) })
|
59
40
|
] }) })
|
60
41
|
] });
|
61
42
|
};
|
62
43
|
export {
|
63
|
-
|
44
|
+
N as DataTable
|
64
45
|
};
|
@@ -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>>;
|