@oneplatformdev/ui 0.0.1-beta.103 → 0.0.1-beta.104
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/Combobox/Combobox.mjs +1 -1
- package/Combobox/Combobox.types.d.ts +2 -0
- package/Combobox/ComboboxOptionItem.mjs +1 -1
- package/Combobox/ComboboxOptions.mjs +1 -1
- package/Combobox/index.mjs +1 -1
- package/{Combobox-Dfbnw0oF.js → Combobox-B9bMpp7r.js} +93 -91
- package/FormCombobox/FormCombobox.mjs +1 -1
- package/index.mjs +1 -1
- package/package.json +1 -1
package/Combobox/Combobox.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import "../Command/Command.mjs";
|
|
|
9
9
|
import "@oneplatformdev/utils";
|
|
10
10
|
import "@oneplatformdev/hooks";
|
|
11
11
|
import "lucide-react";
|
|
12
|
-
import { C as c } from "../Combobox-
|
|
12
|
+
import { C as c } from "../Combobox-B9bMpp7r.js";
|
|
13
13
|
export {
|
|
14
14
|
c as Combobox
|
|
15
15
|
};
|
|
@@ -33,6 +33,8 @@ export interface ComboboxProps {
|
|
|
33
33
|
emptyLabel?: string;
|
|
34
34
|
/** Command Empty list action */
|
|
35
35
|
emptyAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
|
|
36
|
+
/** Command Input footer action */
|
|
37
|
+
commandInputAction?: ((params: ComboboxPropsOnMountParams) => ReactNode) | ReactNode;
|
|
36
38
|
/** Callback for load data on start component */
|
|
37
39
|
onMount?: (params: ComboboxPropsOnMountParams) => Promise<void>;
|
|
38
40
|
}
|
|
@@ -20,7 +20,7 @@ import "../Card/Card.mjs";
|
|
|
20
20
|
import "../Carousel/Carousel.mjs";
|
|
21
21
|
import "../Checkbox/Checkbox.mjs";
|
|
22
22
|
import "@radix-ui/react-collapsible";
|
|
23
|
-
import { a as no } from "../Combobox-
|
|
23
|
+
import { a as no } from "../Combobox-B9bMpp7r.js";
|
|
24
24
|
import "../Command/Command.mjs";
|
|
25
25
|
import "../DropdownMenu/DropdownMenu.mjs";
|
|
26
26
|
import "../Table/Table.mjs";
|
|
@@ -3,7 +3,7 @@ import "../Button/Button.mjs";
|
|
|
3
3
|
import "../Button/buttonVariants.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import "../Collapsible/Collapsible.mjs";
|
|
6
|
-
import { c as a, b as e } from "../Combobox-
|
|
6
|
+
import { c as a, b as e } from "../Combobox-B9bMpp7r.js";
|
|
7
7
|
import "lucide-react";
|
|
8
8
|
import "@oneplatformdev/utils";
|
|
9
9
|
export {
|
package/Combobox/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import f, { forwardRef as y, useState as
|
|
3
|
-
import { LoadingMask as
|
|
1
|
+
import { jsxs as l, jsx as e, Fragment as W } from "react/jsx-runtime";
|
|
2
|
+
import f, { forwardRef as y, useState as X, useRef as H, useEffect as J, useCallback as b, useMemo as K, useLayoutEffect as Q } from "react";
|
|
3
|
+
import { LoadingMask as Y } from "./LoadingMask/LoadingMask.mjs";
|
|
4
4
|
import "./LoadingMask/RenderLoadingMask.mjs";
|
|
5
|
-
import { Popover as
|
|
6
|
-
import { Button as
|
|
5
|
+
import { Popover as Z, PopoverTrigger as $, PopoverContent as ee } from "./Popover/Popover.mjs";
|
|
6
|
+
import { Button as R } from "./Button/Button.mjs";
|
|
7
7
|
import "./Button/buttonVariants.mjs";
|
|
8
|
-
import { CommandItem as
|
|
8
|
+
import { CommandItem as te, Command as oe, CommandInput as re, CommandList as ae, CommandGroup as ne, CommandEmpty as F } from "./Command/Command.mjs";
|
|
9
9
|
import { cn as p } from "@oneplatformdev/utils";
|
|
10
|
-
import { useDebounceCallback as
|
|
11
|
-
import { Check as
|
|
12
|
-
import { Collapsible as
|
|
10
|
+
import { useDebounceCallback as ie } from "@oneplatformdev/hooks";
|
|
11
|
+
import { Check as se, ChevronDownIcon as le, X as pe, ChevronsUpDown as me } from "lucide-react";
|
|
12
|
+
import { Collapsible as ce, CollapsibleTrigger as de, CollapsibleContent as ue } from "./Collapsible/Collapsible.mjs";
|
|
13
13
|
import "./Accordion/Accordion.mjs";
|
|
14
14
|
import "./Alert/Alert.mjs";
|
|
15
15
|
import "./AlertDialog/AlertDialogRoot.mjs";
|
|
@@ -63,18 +63,18 @@ import "./Toggle/Toggle.mjs";
|
|
|
63
63
|
import "./ToggleGroup/ToggleGroup.mjs";
|
|
64
64
|
import "./Tooltip/TooltipRoot.mjs";
|
|
65
65
|
import "./Dropzone/Dropzone.mjs";
|
|
66
|
-
const
|
|
67
|
-
const { children: t, setOpen: m, option: o, onChangeOption:
|
|
68
|
-
return /* @__PURE__ */
|
|
69
|
-
|
|
66
|
+
const he = 8, _ = y((i, s) => {
|
|
67
|
+
const { children: t, setOpen: m, option: o, onChangeOption: n, value: c = "", deep: a = 0 } = i;
|
|
68
|
+
return /* @__PURE__ */ l(
|
|
69
|
+
te,
|
|
70
70
|
{
|
|
71
|
-
ref:
|
|
71
|
+
ref: s,
|
|
72
72
|
value: o.value,
|
|
73
73
|
onSelect: () => {
|
|
74
|
-
c === o.value ?
|
|
74
|
+
c === o.value ? n == null || n({ value: "", label: "" }) : n == null || n(o), m(!1);
|
|
75
75
|
},
|
|
76
76
|
style: {
|
|
77
|
-
paddingLeft: (a + 1) *
|
|
77
|
+
paddingLeft: (a + 1) * he
|
|
78
78
|
},
|
|
79
79
|
children: [
|
|
80
80
|
t,
|
|
@@ -88,7 +88,7 @@ const ce = 8, I = y((n, l) => {
|
|
|
88
88
|
}
|
|
89
89
|
),
|
|
90
90
|
/* @__PURE__ */ e(
|
|
91
|
-
|
|
91
|
+
se,
|
|
92
92
|
{
|
|
93
93
|
className: p(
|
|
94
94
|
"ml-auto",
|
|
@@ -100,23 +100,23 @@ const ce = 8, I = y((n, l) => {
|
|
|
100
100
|
},
|
|
101
101
|
o.value
|
|
102
102
|
);
|
|
103
|
-
}),
|
|
103
|
+
}), q = y((i, s) => {
|
|
104
104
|
var c;
|
|
105
|
-
const { option: t, deep: m = 0 } =
|
|
106
|
-
return (c = t == null ? void 0 : t.items) != null && c.length ? /* @__PURE__ */
|
|
107
|
-
|
|
105
|
+
const { option: t, deep: m = 0 } = i, [o, n] = X(!0);
|
|
106
|
+
return (c = t == null ? void 0 : t.items) != null && c.length ? /* @__PURE__ */ l(
|
|
107
|
+
ce,
|
|
108
108
|
{
|
|
109
|
-
ref:
|
|
109
|
+
ref: s,
|
|
110
110
|
open: o,
|
|
111
|
-
onOpenChange:
|
|
111
|
+
onOpenChange: n,
|
|
112
112
|
"data-opened": o,
|
|
113
113
|
className: p("group/collapsible"),
|
|
114
114
|
children: [
|
|
115
|
-
/* @__PURE__ */ e(
|
|
116
|
-
|
|
115
|
+
/* @__PURE__ */ e(_, { ...i, children: /* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ l(
|
|
116
|
+
R,
|
|
117
117
|
{
|
|
118
118
|
onClick: (a) => {
|
|
119
|
-
a == null || a.preventDefault(), a == null || a.stopPropagation(),
|
|
119
|
+
a == null || a.preventDefault(), a == null || a.stopPropagation(), n((d) => !d);
|
|
120
120
|
},
|
|
121
121
|
type: "button",
|
|
122
122
|
variant: "ghost",
|
|
@@ -124,7 +124,7 @@ const ce = 8, I = y((n, l) => {
|
|
|
124
124
|
className: p("aspect-square size-6", "transition-transform"),
|
|
125
125
|
children: [
|
|
126
126
|
/* @__PURE__ */ e(
|
|
127
|
-
|
|
127
|
+
le,
|
|
128
128
|
{
|
|
129
129
|
className: p(
|
|
130
130
|
"!size-5",
|
|
@@ -137,10 +137,10 @@ const ce = 8, I = y((n, l) => {
|
|
|
137
137
|
]
|
|
138
138
|
}
|
|
139
139
|
) }) }),
|
|
140
|
-
/* @__PURE__ */ e(
|
|
141
|
-
|
|
140
|
+
/* @__PURE__ */ e(ue, { children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-0", children: t == null ? void 0 : t.items.map((a) => /* @__PURE__ */ e(
|
|
141
|
+
q,
|
|
142
142
|
{
|
|
143
|
-
...
|
|
143
|
+
...i,
|
|
144
144
|
deep: m + 1,
|
|
145
145
|
option: a
|
|
146
146
|
},
|
|
@@ -148,31 +148,32 @@ const ce = 8, I = y((n, l) => {
|
|
|
148
148
|
)) }) })
|
|
149
149
|
]
|
|
150
150
|
}
|
|
151
|
-
) : /* @__PURE__ */ e(
|
|
152
|
-
}),
|
|
153
|
-
const { options: t = [], ...m } =
|
|
154
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
155
|
-
}),
|
|
156
|
-
(
|
|
151
|
+
) : /* @__PURE__ */ e(_, { ...i, ref: s });
|
|
152
|
+
}), fe = y((i, s) => {
|
|
153
|
+
const { options: t = [], ...m } = i;
|
|
154
|
+
return /* @__PURE__ */ e("div", { ref: s, className: "flex flex-col gap-0", children: t.map((o) => /* @__PURE__ */ e(q, { ...m, option: o }, o.value)) });
|
|
155
|
+
}), Dt = y(
|
|
156
|
+
(i, s) => {
|
|
157
157
|
var j;
|
|
158
158
|
const {
|
|
159
159
|
value: t,
|
|
160
160
|
onChange: m,
|
|
161
161
|
placeholder: o,
|
|
162
|
-
disabled:
|
|
162
|
+
disabled: n,
|
|
163
163
|
searchLabel: c = "Type to search...",
|
|
164
164
|
fetchOptions: a,
|
|
165
165
|
options: d,
|
|
166
166
|
emptyLabel: L = "No options",
|
|
167
|
-
emptyAction:
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
emptyAction: g,
|
|
168
|
+
commandInputAction: w,
|
|
169
|
+
onMount: T
|
|
170
|
+
} = i, N = H(!1), [u, v] = f.useState(!1), [C, k] = f.useState(""), [S, x] = f.useState([]), [O, E] = f.useState(), [P, h] = f.useState(!1);
|
|
171
|
+
J(() => {
|
|
171
172
|
d != null && d.length && x(d);
|
|
172
173
|
}, [d]);
|
|
173
|
-
const
|
|
174
|
-
u || (
|
|
175
|
-
},
|
|
174
|
+
const A = async () => {
|
|
175
|
+
u || (z(), k(""));
|
|
176
|
+
}, z = b(async (r) => {
|
|
176
177
|
h(!0);
|
|
177
178
|
try {
|
|
178
179
|
const D = await a(r);
|
|
@@ -182,38 +183,43 @@ const ce = 8, I = y((n, l) => {
|
|
|
182
183
|
} finally {
|
|
183
184
|
h(!1);
|
|
184
185
|
}
|
|
185
|
-
}, []),
|
|
186
|
+
}, []), B = ie(z, 1e3, {
|
|
186
187
|
leading: !1,
|
|
187
188
|
trailing: !0
|
|
188
|
-
}),
|
|
189
|
-
h(!0),
|
|
190
|
-
}, []),
|
|
191
|
-
m(r.value),
|
|
192
|
-
}, []),
|
|
193
|
-
|
|
194
|
-
}, []),
|
|
195
|
-
|
|
196
|
-
|
|
189
|
+
}), G = b((r) => {
|
|
190
|
+
h(!0), k(r), B(r);
|
|
191
|
+
}, []), I = b((r) => {
|
|
192
|
+
m(r.value), E(r), h(!1);
|
|
193
|
+
}, []), U = b(() => {
|
|
194
|
+
I({ value: "", label: "" }), E(void 0), h(!1);
|
|
195
|
+
}, []), M = K(() => ({
|
|
196
|
+
setOptions: x,
|
|
197
|
+
search: C || "",
|
|
198
|
+
open: u,
|
|
199
|
+
setOpen: v
|
|
200
|
+
}), []), V = b(() => {
|
|
201
|
+
if (!T) {
|
|
202
|
+
N.current = !0;
|
|
197
203
|
return;
|
|
198
204
|
}
|
|
199
|
-
|
|
205
|
+
T({ setOptions: x, search: C || "", open: u, setOpen: v }).finally(
|
|
200
206
|
() => {
|
|
201
|
-
|
|
207
|
+
N.current = !0;
|
|
202
208
|
}
|
|
203
209
|
);
|
|
204
210
|
}, []);
|
|
205
|
-
return
|
|
206
|
-
|
|
207
|
-
}), []), /* @__PURE__ */ e("div", { className: "w-full", ref:
|
|
208
|
-
|
|
211
|
+
return Q(() => (V(), () => {
|
|
212
|
+
N.current = !1;
|
|
213
|
+
}), []), /* @__PURE__ */ e("div", { className: "w-full", ref: s, children: /* @__PURE__ */ l(
|
|
214
|
+
Z,
|
|
209
215
|
{
|
|
210
216
|
open: u,
|
|
211
217
|
onOpenChange: (r) => {
|
|
212
|
-
v(r), r &&
|
|
218
|
+
v(r), r && A();
|
|
213
219
|
},
|
|
214
220
|
children: [
|
|
215
|
-
/* @__PURE__ */ e(
|
|
216
|
-
|
|
221
|
+
/* @__PURE__ */ e($, { asChild: !0, className: "border-input", children: /* @__PURE__ */ l(
|
|
222
|
+
R,
|
|
217
223
|
{
|
|
218
224
|
variant: "outline",
|
|
219
225
|
role: "combobox",
|
|
@@ -225,9 +231,9 @@ const ce = 8, I = y((n, l) => {
|
|
|
225
231
|
u && "border-2 outline-none ring-1 ring-ring",
|
|
226
232
|
"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
227
233
|
),
|
|
228
|
-
disabled:
|
|
234
|
+
disabled: n,
|
|
229
235
|
children: [
|
|
230
|
-
/* @__PURE__ */ e("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((j =
|
|
236
|
+
/* @__PURE__ */ e("span", { className: "truncate max-w-[calc(100%-1.5rem)] overflow-hidden whitespace-nowrap", children: t ? ((j = S.find((r) => r.value === t)) == null ? void 0 : j.label) || (O == null ? void 0 : O.label) : /* @__PURE__ */ e("span", { className: "text-gray-400", children: o }) }),
|
|
231
237
|
t ? /* @__PURE__ */ e(
|
|
232
238
|
"div",
|
|
233
239
|
{
|
|
@@ -238,49 +244,45 @@ const ce = 8, I = y((n, l) => {
|
|
|
238
244
|
"opacity-50 cursor-pointer hover:opacity-100"
|
|
239
245
|
),
|
|
240
246
|
onClick: (r) => {
|
|
241
|
-
r.stopPropagation(),
|
|
247
|
+
r.stopPropagation(), U();
|
|
242
248
|
},
|
|
243
|
-
children: /* @__PURE__ */ e(
|
|
249
|
+
children: /* @__PURE__ */ e(pe, {})
|
|
244
250
|
}
|
|
245
|
-
) : /* @__PURE__ */ e(
|
|
251
|
+
) : /* @__PURE__ */ e(me, { className: "opacity-50 w-4 h-4" })
|
|
246
252
|
]
|
|
247
253
|
}
|
|
248
254
|
) }),
|
|
249
255
|
/* @__PURE__ */ e(
|
|
250
|
-
|
|
256
|
+
ee,
|
|
251
257
|
{
|
|
252
258
|
className: "w-[var(--radix-popper-anchor-width)] max-w-none p-0",
|
|
253
259
|
align: "start",
|
|
254
|
-
children: /* @__PURE__ */
|
|
260
|
+
children: /* @__PURE__ */ l(oe, { shouldFilter: !1, children: [
|
|
255
261
|
/* @__PURE__ */ e(
|
|
256
|
-
|
|
262
|
+
re,
|
|
257
263
|
{
|
|
258
264
|
placeholder: c,
|
|
259
265
|
value: C,
|
|
260
|
-
onValueChange:
|
|
266
|
+
onValueChange: G
|
|
261
267
|
}
|
|
262
268
|
),
|
|
263
|
-
|
|
264
|
-
|
|
269
|
+
typeof w == "function" ? w(M) : w,
|
|
270
|
+
/* @__PURE__ */ e(ae, { children: /* @__PURE__ */ l(
|
|
271
|
+
ne,
|
|
265
272
|
{
|
|
266
|
-
className: p(!
|
|
273
|
+
className: p(!S.length && "p-0 shadow-none"),
|
|
267
274
|
children: [
|
|
268
|
-
|
|
269
|
-
!
|
|
275
|
+
P && /* @__PURE__ */ e(Y, { fullWidth: !0 }),
|
|
276
|
+
!P && !!C && /* @__PURE__ */ e(W, { children: g ? /* @__PURE__ */ l(F, { className: "flex flex-col gap-3 py-5 px-3 items-center", children: [
|
|
270
277
|
/* @__PURE__ */ e("span", { children: L }),
|
|
271
|
-
typeof
|
|
272
|
-
setOptions: x,
|
|
273
|
-
search: C || "",
|
|
274
|
-
open: u,
|
|
275
|
-
setOpen: v
|
|
276
|
-
}) : b
|
|
278
|
+
typeof g == "function" ? g(M) : g
|
|
277
279
|
] }) : /* @__PURE__ */ e(F, { children: L }) }),
|
|
278
|
-
!
|
|
279
|
-
|
|
280
|
+
!P && /* @__PURE__ */ e(
|
|
281
|
+
fe,
|
|
280
282
|
{
|
|
281
283
|
value: t,
|
|
282
|
-
options:
|
|
283
|
-
onChangeOption:
|
|
284
|
+
options: S,
|
|
285
|
+
onChangeOption: I,
|
|
284
286
|
setOpen: v
|
|
285
287
|
}
|
|
286
288
|
)
|
|
@@ -296,8 +298,8 @@ const ce = 8, I = y((n, l) => {
|
|
|
296
298
|
}
|
|
297
299
|
);
|
|
298
300
|
export {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
301
|
+
Dt as C,
|
|
302
|
+
_ as a,
|
|
303
|
+
q as b,
|
|
304
|
+
fe as c
|
|
303
305
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { FormControl as a } from "../Form/Form.mjs";
|
|
3
3
|
import { FormRenderControl as b } from "../Form/FormRenderControl.mjs";
|
|
4
|
-
import { C as p } from "../Combobox-
|
|
4
|
+
import { C as p } from "../Combobox-B9bMpp7r.js";
|
|
5
5
|
const x = (m) => {
|
|
6
6
|
const { form: n, label: e, name: t, ...C } = m;
|
|
7
7
|
return /* @__PURE__ */ o(
|
package/index.mjs
CHANGED
|
@@ -20,7 +20,7 @@ import { Carousel as go, CarouselContent as xo, CarouselItem as fo, CarouselNext
|
|
|
20
20
|
import { ChartContainer as To, ChartLegend as Do, ChartLegendContent as co, ChartStyle as Mo, ChartTooltip as Po, ChartTooltipContent as Ao } from "./Chart/Chart.mjs";
|
|
21
21
|
import { Checkbox as wo, CheckboxLabel as ho } from "./Checkbox/Checkbox.mjs";
|
|
22
22
|
import { Collapsible as Fo, CollapsibleContent as Lo, CollapsibleTrigger as Ro } from "./Collapsible/Collapsible.mjs";
|
|
23
|
-
import { C as Go } from "./Combobox-
|
|
23
|
+
import { C as Go } from "./Combobox-B9bMpp7r.js";
|
|
24
24
|
import { Command as Ho, CommandDialog as No, CommandEmpty as Vo, CommandGroup as yo, CommandInput as Eo, CommandItem as Oo, CommandList as zo, CommandSeparator as _o, CommandShortcut as Uo } from "./Command/Command.mjs";
|
|
25
25
|
import { DataTable as jo } from "./DataTable/DataTable.mjs";
|
|
26
26
|
import { DatePicker as Jo } from "./DatePicker/DatePicker.mjs";
|