@oneplatformdev/ui 0.0.1-beta.5 → 0.0.1-beta.51
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/AlertDialog/AlertDialog.mjs +58 -60
- package/Button/buttonVariants.mjs +5 -5
- package/Calendar/Calendar.mjs +3 -2
- package/Combobox/Combobox.mjs +108 -84
- package/Combobox/Combobox.types.d.ts +10 -1
- package/Command/Command.d.ts +1 -1
- package/DataTable/DataTable.mjs +32 -51
- 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 +44 -42
- package/Select/Select.types.d.ts +7 -1
- package/Select/SelectRoot.d.ts +2 -2
- package/Select/SelectRoot.mjs +1 -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 +2 -0
- package/index.mjs +233 -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,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",
|
@@ -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,143 @@
|
|
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 R } from "react/jsx-runtime";
|
2
|
+
import l, { useRef as U, useEffect as _, useCallback as s, useLayoutEffect as A } from "react";
|
3
|
+
import { LoadingMask as V } from "../LoadingMask/LoadingMask.mjs";
|
4
|
+
import { Popover as X, PopoverTrigger as q, PopoverContent as z } from "../Popover/Popover.mjs";
|
5
|
+
import { Button as H } from "../Button/Button.mjs";
|
6
6
|
import "../Button/buttonVariants.mjs";
|
7
|
-
import { Command as
|
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
8
|
import { cn as g } from "@oneplatformdev/utils";
|
9
|
-
import { useDebounceCallback as
|
10
|
-
import { X as
|
11
|
-
const
|
12
|
-
var
|
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 L;
|
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: P,
|
16
|
+
placeholder: j,
|
17
|
+
disabled: D,
|
18
|
+
searchLabel: T = "Type to search...",
|
19
|
+
fetchOptions: B,
|
20
|
+
options: n,
|
21
|
+
emptyLabel: v = "No options",
|
22
|
+
emptyAction: c,
|
23
|
+
onMount: C
|
24
|
+
} = O, u = U(!1), [i, y] = l.useState(!1), [x, w] = l.useState(""), [d, m] = l.useState([]), [p, N] = l.useState(), [h, r] = l.useState(!1);
|
25
|
+
_(() => {
|
26
|
+
n != null && n.length && m(n);
|
27
|
+
}, [n]);
|
28
|
+
const E = async () => {
|
29
|
+
i || (S(), w(""));
|
30
|
+
}, S = s(async (e) => {
|
31
|
+
r(!0);
|
30
32
|
try {
|
31
|
-
const
|
32
|
-
|
33
|
-
} catch (
|
34
|
-
console.error("Unexpected error while get option:",
|
33
|
+
const b = await B(e);
|
34
|
+
m(b);
|
35
|
+
} catch (b) {
|
36
|
+
console.error("Unexpected error while get option:", b);
|
35
37
|
} finally {
|
36
|
-
|
38
|
+
r(!1);
|
37
39
|
}
|
38
|
-
},
|
39
|
-
|
40
|
-
},
|
41
|
-
|
42
|
-
},
|
43
|
-
|
44
|
-
}
|
45
|
-
|
46
|
-
|
40
|
+
}, []), M = Z(S, 1e3, { leading: !1, trailing: !0 }), F = s((e) => {
|
41
|
+
r(!0), w(e), M(e);
|
42
|
+
}, []), f = s((e) => {
|
43
|
+
P(e.value), N(e), r(!1);
|
44
|
+
}, []), G = s(() => {
|
45
|
+
f({ value: "", label: "" }), N(void 0), r(!1);
|
46
|
+
}, []), I = s(() => {
|
47
|
+
if (!C) {
|
48
|
+
u.current = !0;
|
49
|
+
return;
|
50
|
+
}
|
51
|
+
C({ setOptions: m }).finally(() => {
|
52
|
+
u.current = !0;
|
53
|
+
});
|
54
|
+
}, []);
|
55
|
+
return A(() => (I(), () => {
|
56
|
+
u.current = !1;
|
57
|
+
}), []), /* @__PURE__ */ a("div", { className: "w-full", children: /* @__PURE__ */ o(
|
58
|
+
X,
|
47
59
|
{
|
48
|
-
open:
|
60
|
+
open: i,
|
49
61
|
onOpenChange: (e) => {
|
50
|
-
|
62
|
+
y(e), e && E();
|
51
63
|
},
|
52
64
|
children: [
|
53
|
-
/* @__PURE__ */ a(
|
54
|
-
|
65
|
+
/* @__PURE__ */ a(q, { asChild: !0, className: "border-input", children: /* @__PURE__ */ o(
|
66
|
+
H,
|
55
67
|
{
|
56
68
|
variant: "outline",
|
57
69
|
role: "combobox",
|
58
|
-
"aria-expanded":
|
70
|
+
"aria-expanded": i,
|
59
71
|
className: g(
|
60
|
-
"w-full justify-between font-normal text-sm border bg-
|
61
|
-
|
72
|
+
"w-full justify-between font-normal text-sm border bg-transparent",
|
73
|
+
i ? "border-2 border-sidebar-accent" : "border-border"
|
62
74
|
),
|
63
|
-
disabled:
|
75
|
+
disabled: D,
|
64
76
|
children: [
|
65
|
-
/* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children:
|
66
|
-
|
67
|
-
|
77
|
+
/* @__PURE__ */ a("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((L = d.find((e) => e.value === t)) == null ? void 0 : L.label) || (p == null ? void 0 : p.label) : /* @__PURE__ */ a("span", { className: "text-gray-400", children: j }) }),
|
78
|
+
t ? /* @__PURE__ */ a(
|
79
|
+
$,
|
68
80
|
{
|
69
81
|
className: "opacity-50 w-4 h-4 cursor-pointer hover:opacity-100",
|
70
82
|
onClick: (e) => {
|
71
|
-
e.stopPropagation(),
|
83
|
+
e.stopPropagation(), G();
|
72
84
|
}
|
73
85
|
}
|
74
|
-
) : /* @__PURE__ */ a(
|
86
|
+
) : /* @__PURE__ */ a(ee, { className: "opacity-50 w-4 h-4" })
|
75
87
|
]
|
76
88
|
}
|
77
89
|
) }),
|
78
90
|
/* @__PURE__ */ a(
|
79
|
-
|
91
|
+
z,
|
80
92
|
{
|
81
93
|
className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
|
82
94
|
align: "start",
|
83
|
-
children: /* @__PURE__ */
|
95
|
+
children: /* @__PURE__ */ o(J, { shouldFilter: !1, children: [
|
84
96
|
/* @__PURE__ */ a(
|
85
|
-
|
97
|
+
K,
|
86
98
|
{
|
87
|
-
placeholder:
|
88
|
-
value:
|
89
|
-
onValueChange:
|
99
|
+
placeholder: T,
|
100
|
+
value: x,
|
101
|
+
onValueChange: F
|
90
102
|
}
|
91
103
|
),
|
92
|
-
/* @__PURE__ */
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
104
|
+
/* @__PURE__ */ a(Q, { children: /* @__PURE__ */ o(
|
105
|
+
W,
|
106
|
+
{
|
107
|
+
className: g(
|
108
|
+
!d.length && "p-0 shadow-none"
|
109
|
+
),
|
110
|
+
children: [
|
111
|
+
h && /* @__PURE__ */ a("div", { className: "flex justify-center", children: /* @__PURE__ */ a(V, {}) }),
|
112
|
+
!h && !!x && /* @__PURE__ */ a(R, { children: c ? /* @__PURE__ */ a("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ o(k, { className: "flex flex-col gap-2", children: [
|
113
|
+
/* @__PURE__ */ a("span", { children: v }),
|
114
|
+
typeof c == "function" ? c({ setOptions: m }) : c
|
115
|
+
] }) }) : /* @__PURE__ */ a(k, { children: v }) }),
|
116
|
+
!h && !!d.length && d.map((e) => /* @__PURE__ */ o(
|
117
|
+
Y,
|
118
|
+
{
|
119
|
+
value: e.value,
|
120
|
+
onSelect: () => {
|
121
|
+
t === e.value ? f({ value: "", label: "" }) : f(e), y(!1);
|
122
|
+
},
|
123
|
+
children: [
|
124
|
+
e.label,
|
125
|
+
/* @__PURE__ */ a(
|
126
|
+
ae,
|
127
|
+
{
|
128
|
+
className: g(
|
129
|
+
"ml-auto",
|
130
|
+
t === e.value ? "opacity-100" : "opacity-0"
|
131
|
+
)
|
132
|
+
}
|
109
133
|
)
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
134
|
+
]
|
135
|
+
},
|
136
|
+
e.value
|
137
|
+
))
|
138
|
+
]
|
139
|
+
}
|
140
|
+
) })
|
117
141
|
] })
|
118
142
|
}
|
119
143
|
)
|
@@ -122,5 +146,5 @@ const te = (w) => {
|
|
122
146
|
) });
|
123
147
|
};
|
124
148
|
export {
|
125
|
-
|
149
|
+
ue as Combobox
|
126
150
|
};
|
@@ -1,7 +1,12 @@
|
|
1
|
+
import { Dispatch, ReactNode, SetStateAction } from 'react';
|
2
|
+
|
1
3
|
export interface ComboboxOption {
|
2
4
|
value: string;
|
3
5
|
label: string;
|
4
6
|
}
|
7
|
+
export interface ComboboxPropsOnMountParams {
|
8
|
+
setOptions: Dispatch<SetStateAction<ComboboxOption[]>>;
|
9
|
+
}
|
5
10
|
export interface ComboboxProps {
|
6
11
|
value: string;
|
7
12
|
onChange: (value: string) => void;
|
@@ -10,6 +15,10 @@ export interface ComboboxProps {
|
|
10
15
|
disabled?: boolean;
|
11
16
|
fetchOptions: (search?: string) => Promise<ComboboxOption[]>;
|
12
17
|
options?: ComboboxOption[];
|
13
|
-
/**
|
18
|
+
/** Command Empty list label*/
|
14
19
|
emptyLabel?: string;
|
20
|
+
/** Command Empty list action */
|
21
|
+
emptyAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
|
22
|
+
/** Callback for load data on start component */
|
23
|
+
onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
|
15
24
|
}
|
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>> & {
|