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