@oneplatformdev/ui 0.0.1-beta.6 → 0.0.1-beta.60
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/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.mjs +23 -20
- package/Button/buttonVariants.mjs +5 -5
- package/Calendar/Calendar.mjs +3 -2
- package/Combobox/Combobox.mjs +124 -86
- package/Combobox/Combobox.types.d.ts +13 -1
- package/Command/Command.d.ts +1 -1
- package/DataTable/DataTable.d.ts +10 -3
- package/DataTable/DataTable.mjs +33 -33
- package/DataTable/DataTableColumnFilter.d.ts +4 -0
- package/DataTable/DataTableColumnFilter.mjs +31 -0
- package/DatePicker/DatePicker.mjs +2 -2
- package/Dropzone/Dropzone.d.ts +22 -0
- package/Dropzone/Dropzone.mjs +151 -0
- package/Dropzone/Dropzone.types.d.ts +38 -0
- package/Dropzone/DropzoneFilePreview.d.ts +4 -0
- package/Dropzone/DropzoneFilePreview.mjs +9 -0
- package/Dropzone/DropzoneSinglePickPreview.d.ts +9 -0
- package/Dropzone/DropzoneSinglePickPreview.mjs +38 -0
- package/Dropzone/DropzoneUtils.d.ts +5 -0
- package/Dropzone/DropzoneUtils.mjs +24 -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.mjs +20 -18
- 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.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/Select/Select.mjs +93 -63
- package/Select/Select.types.d.ts +9 -2
- package/Select/SelectRoot.d.ts +2 -2
- package/Select/SelectRoot.mjs +1 -0
- package/TablePagination/TablePagination.d.ts +16 -0
- package/TablePagination/TablePagination.mjs +74 -0
- package/TablePagination/index.d.ts +1 -0
- package/TablePagination/index.mjs +4 -0
- package/TablePagination/package.json +7 -0
- 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 +3 -0
- package/index.mjs +235 -225
- package/package.json +9 -8
package/Accordion/Accordion.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as React from
|
2
|
-
import * as AccordionPrimitive from
|
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>>;
|
package/Accordion/Accordion.mjs
CHANGED
@@ -1,46 +1,49 @@
|
|
1
1
|
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
2
|
-
import * as
|
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
|
6
|
-
const
|
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:
|
11
|
-
...
|
10
|
+
className: c("border-b", t),
|
11
|
+
...o
|
12
12
|
}
|
13
13
|
));
|
14
|
-
|
15
|
-
const
|
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:
|
19
|
-
className:
|
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
|
-
|
21
|
+
t
|
22
22
|
),
|
23
|
+
onKeyDown: (n) => {
|
24
|
+
n.key === " " && n.target === n.currentTarget && n.preventDefault();
|
25
|
+
},
|
23
26
|
...r,
|
24
27
|
children: [
|
25
|
-
|
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
|
-
|
31
|
-
const
|
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:
|
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:
|
40
|
+
children: /* @__PURE__ */ a("div", { className: c("pb-4 pt-0", t), children: o })
|
38
41
|
}
|
39
42
|
));
|
40
|
-
|
43
|
+
p.displayName = e.Content.displayName;
|
41
44
|
export {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
45
|
+
u as Accordion,
|
46
|
+
p as AccordionContent,
|
47
|
+
l as AccordionItem,
|
48
|
+
f as AccordionTrigger
|
46
49
|
};
|
@@ -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",
|
@@ -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
|
-
|
28
|
+
r as buttonVariants
|
29
29
|
};
|
package/Calendar/Calendar.mjs
CHANGED
@@ -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" }),
|
package/Combobox/Combobox.mjs
CHANGED
@@ -1,119 +1,157 @@
|
|
1
|
-
import { jsx as a, jsxs as
|
2
|
-
import
|
3
|
-
import { LoadingMask as
|
4
|
-
import { Popover as
|
5
|
-
import { Button as
|
1
|
+
import { jsx as a, jsxs as o, Fragment as I } from "react/jsx-runtime";
|
2
|
+
import s, { useRef as R, useEffect as U, useCallback as c, useLayoutEffect as q } from "react";
|
3
|
+
import { LoadingMask as z } from "../LoadingMask/LoadingMask.mjs";
|
4
|
+
import { Popover as A, PopoverTrigger as V, PopoverContent as X } from "../Popover/Popover.mjs";
|
5
|
+
import { Button as H } 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 J, CommandInput as K, CommandList as Q, CommandGroup as W, CommandEmpty as k, CommandItem as Y } from "../Command/Command.mjs";
|
8
|
+
import { cn as h } from "@oneplatformdev/utils";
|
9
|
+
import { useDebounceCallback as Z } from "@oneplatformdev/hooks";
|
10
|
+
import { X as $, ChevronsUpDown as ee, Check as ae } from "lucide-react";
|
11
|
+
const ue = (O) => {
|
12
|
+
var j;
|
13
13
|
const {
|
14
|
-
value:
|
15
|
-
onChange:
|
16
|
-
placeholder:
|
17
|
-
disabled:
|
18
|
-
searchLabel:
|
19
|
-
fetchOptions:
|
14
|
+
value: n,
|
15
|
+
onChange: P,
|
16
|
+
placeholder: D,
|
17
|
+
disabled: T,
|
18
|
+
searchLabel: B = "Type to search...",
|
19
|
+
fetchOptions: E,
|
20
20
|
options: r,
|
21
|
-
emptyLabel:
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
emptyLabel: C = "No options",
|
22
|
+
emptyAction: i,
|
23
|
+
onMount: x
|
24
|
+
} = O, f = R(!1), [t, d] = s.useState(!1), [m, w] = s.useState(""), [u, p] = s.useState([]), [b, N] = s.useState(), [g, l] = s.useState(!1);
|
25
|
+
U(() => {
|
26
|
+
r != null && r.length && p(r);
|
25
27
|
}, [r]);
|
26
|
-
const
|
27
|
-
|
28
|
-
},
|
29
|
-
|
28
|
+
const M = async () => {
|
29
|
+
t || (S(), w(""));
|
30
|
+
}, S = c(async (e) => {
|
31
|
+
l(!0);
|
30
32
|
try {
|
31
|
-
const
|
32
|
-
|
33
|
-
} catch (
|
34
|
-
console.error("Unexpected error while get option:",
|
33
|
+
const y = await E(e);
|
34
|
+
p(y);
|
35
|
+
} catch (y) {
|
36
|
+
console.error("Unexpected error while get option:", y);
|
35
37
|
} finally {
|
36
|
-
|
38
|
+
l(!1);
|
37
39
|
}
|
38
|
-
},
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
40
|
+
}, []), _ = Z(S, 1e3, {
|
41
|
+
leading: !1,
|
42
|
+
trailing: !0
|
43
|
+
}), F = c((e) => {
|
44
|
+
l(!0), w(e), _(e);
|
45
|
+
}, []), v = c((e) => {
|
46
|
+
P(e.value), N(e), l(!1);
|
47
|
+
}, []), L = c(() => {
|
48
|
+
console.log("handleClearSelection", L), v({ value: "", label: "" }), N(void 0), l(!1);
|
49
|
+
}, []), G = c(() => {
|
50
|
+
if (!x) {
|
51
|
+
f.current = !0;
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
x({ setOptions: p, search: m || "", open: t, setOpen: d }).finally(
|
55
|
+
() => {
|
56
|
+
f.current = !0;
|
57
|
+
}
|
58
|
+
);
|
59
|
+
}, []);
|
60
|
+
return q(() => (G(), () => {
|
61
|
+
f.current = !1;
|
62
|
+
}), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ o(
|
63
|
+
A,
|
47
64
|
{
|
48
|
-
open:
|
65
|
+
open: t,
|
49
66
|
onOpenChange: (e) => {
|
50
|
-
d(e), e &&
|
67
|
+
d(e), e && M();
|
51
68
|
},
|
52
69
|
children: [
|
53
|
-
/* @__PURE__ */ a(
|
54
|
-
|
70
|
+
/* @__PURE__ */ a(V, { asChild: !0, className: "border-input", children: /* @__PURE__ */ o(
|
71
|
+
H,
|
55
72
|
{
|
56
73
|
variant: "outline",
|
57
74
|
role: "combobox",
|
58
|
-
"aria-expanded":
|
59
|
-
className:
|
60
|
-
"w-full justify-between font-normal text-sm border bg-
|
61
|
-
|
75
|
+
"aria-expanded": t,
|
76
|
+
className: h(
|
77
|
+
"w-full justify-between font-normal text-sm border bg-transparent relative",
|
78
|
+
t ? "border-2 border-sidebar-accent" : "border-border"
|
62
79
|
),
|
63
|
-
disabled:
|
80
|
+
disabled: T,
|
64
81
|
children: [
|
65
|
-
/* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children:
|
66
|
-
|
67
|
-
|
82
|
+
/* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: n ? ((j = u.find((e) => e.value === n)) == null ? void 0 : j.label) || (b == null ? void 0 : b.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: D }) }),
|
83
|
+
n ? /* @__PURE__ */ a(
|
84
|
+
"div",
|
68
85
|
{
|
69
|
-
className:
|
86
|
+
className: h(
|
87
|
+
"absolute top-0 right-1",
|
88
|
+
"flex items-center justify-center",
|
89
|
+
"w-9 aspect-square [&_svg]:size-5",
|
90
|
+
"opacity-50 cursor-pointer hover:opacity-100"
|
91
|
+
),
|
70
92
|
onClick: (e) => {
|
71
|
-
e.stopPropagation(),
|
72
|
-
}
|
93
|
+
e.stopPropagation(), L();
|
94
|
+
},
|
95
|
+
children: /* @__PURE__ */ a($, {})
|
73
96
|
}
|
74
|
-
) : /* @__PURE__ */ a(
|
97
|
+
) : /* @__PURE__ */ a(ee, { className: "opacity-50 w-4 h-4" })
|
75
98
|
]
|
76
99
|
}
|
77
100
|
) }),
|
78
101
|
/* @__PURE__ */ a(
|
79
|
-
|
102
|
+
X,
|
80
103
|
{
|
81
104
|
className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
|
82
105
|
align: "start",
|
83
|
-
children: /* @__PURE__ */
|
106
|
+
children: /* @__PURE__ */ o(J, { shouldFilter: !1, children: [
|
84
107
|
/* @__PURE__ */ a(
|
85
|
-
|
108
|
+
K,
|
86
109
|
{
|
87
|
-
placeholder:
|
88
|
-
value:
|
89
|
-
onValueChange:
|
110
|
+
placeholder: B,
|
111
|
+
value: m,
|
112
|
+
onValueChange: F
|
90
113
|
}
|
91
114
|
),
|
92
|
-
/* @__PURE__ */
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
115
|
+
/* @__PURE__ */ a(Q, { children: /* @__PURE__ */ o(
|
116
|
+
W,
|
117
|
+
{
|
118
|
+
className: h(!u.length && "p-0 shadow-none"),
|
119
|
+
children: [
|
120
|
+
g && /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(z, {}) }),
|
121
|
+
!g && !!m && /* @__PURE__ */ a(I, { children: i ? /* @__PURE__ */ o(k, { className: "flex flex-col gap-3 py-5 px-3 items-center", children: [
|
122
|
+
/* @__PURE__ */ a("span", { children: C }),
|
123
|
+
typeof i == "function" ? i({
|
124
|
+
setOptions: p,
|
125
|
+
search: m || "",
|
126
|
+
open: t,
|
127
|
+
setOpen: d
|
128
|
+
}) : i
|
129
|
+
] }) : /* @__PURE__ */ a(k, { children: C }) }),
|
130
|
+
!g && !!u.length && u.map((e) => /* @__PURE__ */ o(
|
131
|
+
Y,
|
132
|
+
{
|
133
|
+
value: e.value,
|
134
|
+
onSelect: () => {
|
135
|
+
n === e.value ? v({ value: "", label: "" }) : v(e), d(!1);
|
136
|
+
},
|
137
|
+
children: [
|
138
|
+
e.label,
|
139
|
+
/* @__PURE__ */ a(
|
140
|
+
ae,
|
141
|
+
{
|
142
|
+
className: h(
|
143
|
+
"ml-auto",
|
144
|
+
n === e.value ? "opacity-100" : "opacity-0"
|
145
|
+
)
|
146
|
+
}
|
109
147
|
)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
148
|
+
]
|
149
|
+
},
|
150
|
+
e.value
|
151
|
+
))
|
152
|
+
]
|
153
|
+
}
|
154
|
+
) })
|
117
155
|
] })
|
118
156
|
}
|
119
157
|
)
|
@@ -122,5 +160,5 @@ const te = (w) => {
|
|
122
160
|
) });
|
123
161
|
};
|
124
162
|
export {
|
125
|
-
|
163
|
+
ue as Combobox
|
126
164
|
};
|
@@ -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
|
-
/**
|
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
|
}
|
package/Command/Command.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { DialogProps } from '@radix-ui/react-dialog';
|
2
|
-
import * as React from
|
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>> & {
|
package/DataTable/DataTable.d.ts
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { default as React, FC } from 'react';
|
2
|
+
import { Table as ReactTable } from '@tanstack/react-table';
|
3
3
|
|
4
|
-
|
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 {};
|
package/DataTable/DataTable.mjs
CHANGED
@@ -1,28 +1,28 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import {
|
3
|
-
import { ChevronDown as u } from "lucide-react";
|
4
|
-
import { Button as p } from "../Button/Button.mjs";
|
1
|
+
import { jsxs as i, jsx as l } from "react/jsx-runtime";
|
2
|
+
import { Button as h } from "../Button/Button.mjs";
|
5
3
|
import "../Button/buttonVariants.mjs";
|
6
|
-
import { DropdownMenu as
|
7
|
-
import { Table as
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
4
|
+
import { DropdownMenu as p, DropdownMenuTrigger as g, DropdownMenuContent as u, DropdownMenuCheckboxItem as C } from "../DropdownMenu/DropdownMenu.mjs";
|
5
|
+
import { Table as f, TableHeader as w, TableRow as t, TableHead as x, TableBody as b, TableCell as d } from "../Table/Table.mjs";
|
6
|
+
import { flexRender as a } from "@tanstack/react-table";
|
7
|
+
import { ChevronDown as D } from "lucide-react";
|
8
|
+
const y = ({
|
9
|
+
table: r,
|
10
|
+
ToolBar: s,
|
11
|
+
tColumns: c = "Columns",
|
12
|
+
tNoResults: m = "No results"
|
13
|
+
}) => {
|
14
|
+
var o;
|
15
|
+
return /* @__PURE__ */ i("div", { className: "w-full", children: [
|
16
|
+
/* @__PURE__ */ i("div", { className: "flex items-center py-4", children: [
|
17
|
+
s,
|
18
|
+
/* @__PURE__ */ i(p, { children: [
|
19
|
+
/* @__PURE__ */ l(g, { asChild: !0, children: /* @__PURE__ */ i(h, { variant: "outline", className: "ml-auto", children: [
|
20
|
+
c,
|
21
|
+
" ",
|
22
|
+
/* @__PURE__ */ l(D, { className: "ml-2 h-4 w-4" })
|
23
23
|
] }) }),
|
24
|
-
/* @__PURE__ */ l(
|
25
|
-
|
24
|
+
/* @__PURE__ */ l(u, { align: "end", children: r.getAllColumns().filter((e) => e.getCanHide()).map((e) => /* @__PURE__ */ l(
|
25
|
+
C,
|
26
26
|
{
|
27
27
|
className: "capitalize",
|
28
28
|
checked: e.getIsVisible(),
|
@@ -33,32 +33,32 @@ const B = (s) => {
|
|
33
33
|
)) })
|
34
34
|
] })
|
35
35
|
] }),
|
36
|
-
/* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */
|
37
|
-
/* @__PURE__ */ l(
|
36
|
+
/* @__PURE__ */ l("div", { className: "rounded-md border", children: /* @__PURE__ */ i(f, { children: [
|
37
|
+
/* @__PURE__ */ l(w, { children: r.getHeaderGroups().map((e) => /* @__PURE__ */ l(t, { children: e.headers.map((n) => /* @__PURE__ */ l(x, { children: n.isPlaceholder ? null : a(
|
38
38
|
n.column.columnDef.header,
|
39
39
|
n.getContext()
|
40
40
|
) }, n.id)) }, e.id)) }),
|
41
|
-
/* @__PURE__ */ l(
|
42
|
-
|
41
|
+
/* @__PURE__ */ l(b, { children: (o = r.getRowModel().rows) != null && o.length ? r.getRowModel().rows.map((e) => /* @__PURE__ */ l(
|
42
|
+
t,
|
43
43
|
{
|
44
44
|
"data-state": e.getIsSelected() && "selected",
|
45
|
-
children: e.getVisibleCells().map((n) => /* @__PURE__ */ l(
|
45
|
+
children: e.getVisibleCells().map((n) => /* @__PURE__ */ l(d, { children: a(
|
46
46
|
n.column.columnDef.cell,
|
47
47
|
n.getContext()
|
48
48
|
) }, n.id))
|
49
49
|
},
|
50
50
|
e.id
|
51
|
-
)) : /* @__PURE__ */ l(
|
52
|
-
|
51
|
+
)) : /* @__PURE__ */ l(t, { children: /* @__PURE__ */ l(
|
52
|
+
d,
|
53
53
|
{
|
54
|
-
colSpan:
|
54
|
+
colSpan: r.getAllColumns().length,
|
55
55
|
className: "h-24 text-center",
|
56
|
-
children:
|
56
|
+
children: m
|
57
57
|
}
|
58
58
|
) }) })
|
59
59
|
] }) })
|
60
60
|
] });
|
61
61
|
};
|
62
62
|
export {
|
63
|
-
|
63
|
+
y as DataTable
|
64
64
|
};
|
@@ -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
|
+
};
|
@@ -669,7 +669,7 @@ const J = (t, e, n) => {
|
|
669
669
|
disabled: i,
|
670
670
|
variant: "outline",
|
671
671
|
className: C(
|
672
|
-
"w-full justify-start text-left font-normal border-
|
672
|
+
"w-full justify-start text-left font-normal border h-10",
|
673
673
|
!n && "text-muted-foreground"
|
674
674
|
),
|
675
675
|
children: [
|
@@ -678,7 +678,7 @@ const J = (t, e, n) => {
|
|
678
678
|
]
|
679
679
|
}
|
680
680
|
) }),
|
681
|
-
/* @__PURE__ */ d(L, { align: "start", className: "
|
681
|
+
/* @__PURE__ */ d(L, { align: "start", className: "w-auto p-0", children: /* @__PURE__ */ d(
|
682
682
|
O,
|
683
683
|
{
|
684
684
|
mode: "single",
|
@@ -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>>;
|