laif-ds 0.1.97 → 0.1.98
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/dist/_virtual/index3.js +5 -5
- package/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +4 -4
- package/dist/components/ui/async-select.js +249 -167
- package/dist/index.d.ts +27 -2
- package/dist/node_modules/eventemitter3/index.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/recharts/es6/util/Events.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +1 -1
package/dist/_virtual/index3.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as t } from "../node_modules/eventemitter3/index2.js";
|
|
4
|
+
var r = t();
|
|
5
|
+
const m = /* @__PURE__ */ e(r);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
m as default
|
|
8
8
|
};
|
package/dist/_virtual/index4.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { getDefaultExportFromCjs as
|
|
3
|
-
import { __require as
|
|
4
|
-
var t =
|
|
5
|
-
const
|
|
2
|
+
import { getDefaultExportFromCjs as r } from "./_commonjsHelpers.js";
|
|
3
|
+
import { __require as e } from "../node_modules/style-to-js/cjs/index.js";
|
|
4
|
+
var t = e();
|
|
5
|
+
const a = /* @__PURE__ */ r(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
a as default
|
|
8
8
|
};
|
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { getDefaultExportFromCjs as e } from "./_commonjsHelpers.js";
|
|
3
|
-
import { __require as
|
|
4
|
-
var
|
|
5
|
-
const
|
|
3
|
+
import { __require as r } from "../node_modules/extend/index.js";
|
|
4
|
+
var t = r();
|
|
5
|
+
const x = /* @__PURE__ */ e(t);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
x as default
|
|
8
8
|
};
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import * as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useDebounce as
|
|
6
|
-
import { cva as
|
|
7
|
-
import { cn as
|
|
8
|
-
import { Label as
|
|
9
|
-
import { Popover as
|
|
10
|
-
import { Command as
|
|
11
|
-
import { Icon as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
2
|
+
import { jsxs as d, jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import * as A from "react";
|
|
4
|
+
import { useState as N, useEffect as j, useCallback as $ } from "react";
|
|
5
|
+
import { useDebounce as ae } from "../../hooks/use-debounce.js";
|
|
6
|
+
import { cva as ce } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
7
|
+
import { cn as L } from "../../lib/utils.js";
|
|
8
|
+
import { Label as le } from "./label.js";
|
|
9
|
+
import { Popover as ie, PopoverTrigger as de, PopoverContent as fe } from "./popover.js";
|
|
10
|
+
import { Command as me, CommandInput as ue, CommandList as he, CommandEmpty as pe, CommandGroup as q, CommandItem as H } from "./command.js";
|
|
11
|
+
import { Icon as X } from "./icon.js";
|
|
12
|
+
import { Checkbox as ge } from "./checkbox.js";
|
|
13
|
+
import xe from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
|
|
14
|
+
import we from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
15
|
+
const ye = ce(
|
|
15
16
|
"flex items-center justify-between whitespace-nowrap rounded-md border border-d-input bg-d-input px-3 py-2 data-[placeholder]:text-muted-foreground focus:outline-none disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1 ",
|
|
16
17
|
{
|
|
17
18
|
variants: {
|
|
@@ -26,141 +27,157 @@ const ue = ne(
|
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
29
|
);
|
|
29
|
-
function
|
|
30
|
-
fetcher:
|
|
31
|
-
preload:
|
|
32
|
-
filterFn:
|
|
33
|
-
renderOption:
|
|
34
|
-
getOptionValue:
|
|
35
|
-
getDisplayValue:
|
|
36
|
-
notFound:
|
|
37
|
-
loadingSkeleton:
|
|
38
|
-
label:
|
|
39
|
-
labelClassName:
|
|
40
|
-
placeholder:
|
|
41
|
-
value:
|
|
42
|
-
onChange:
|
|
43
|
-
disabled:
|
|
44
|
-
width:
|
|
45
|
-
triggerClassName:
|
|
46
|
-
noResultsMessage:
|
|
47
|
-
clearable:
|
|
48
|
-
|
|
30
|
+
function De({
|
|
31
|
+
fetcher: a,
|
|
32
|
+
preload: c,
|
|
33
|
+
filterFn: f,
|
|
34
|
+
renderOption: k,
|
|
35
|
+
getOptionValue: m,
|
|
36
|
+
getDisplayValue: s,
|
|
37
|
+
notFound: u,
|
|
38
|
+
loadingSkeleton: M,
|
|
39
|
+
label: h,
|
|
40
|
+
labelClassName: p,
|
|
41
|
+
placeholder: _ = "Select...",
|
|
42
|
+
value: r,
|
|
43
|
+
onChange: i,
|
|
44
|
+
disabled: T = !1,
|
|
45
|
+
width: x = "200px",
|
|
46
|
+
triggerClassName: z,
|
|
47
|
+
noResultsMessage: D,
|
|
48
|
+
clearable: b = !0,
|
|
49
|
+
multiple: l = !1,
|
|
50
|
+
size: J
|
|
49
51
|
}) {
|
|
50
|
-
const [
|
|
52
|
+
const [g, O] = N(!1), C = x === "auto", P = A.useRef(null), E = A.useRef(null), Q = A.useRef(null), Y = A.useRef(null), [Z, v] = N({ loading: !1, error: null }), [K, V] = N(""), S = ae(K, c ? 0 : 300), [I, F] = N(/* @__PURE__ */ new Map()), [w, R] = N([]), [B, ee] = N(
|
|
51
53
|
void 0
|
|
52
|
-
),
|
|
53
|
-
|
|
54
|
+
), [G, ne] = N([]), W = A.useMemo(() => l || !r || w.length === 0 ? null : w.find((n) => m(n) === r) || null, [r, w, m, l]);
|
|
55
|
+
j(() => {
|
|
56
|
+
if (l && Array.isArray(r) && w.length > 0) {
|
|
57
|
+
const n = w.filter(
|
|
58
|
+
(t) => r.includes(m(t))
|
|
59
|
+
);
|
|
60
|
+
ne(n);
|
|
61
|
+
}
|
|
62
|
+
}, [r, w, m, l]), j(() => ((async () => {
|
|
54
63
|
try {
|
|
55
|
-
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
} catch (
|
|
59
|
-
|
|
64
|
+
v({ loading: !0, error: null });
|
|
65
|
+
const t = c ? "__preload__" : "", o = await a("");
|
|
66
|
+
F((y) => new Map(y).set(t, o)), R(o);
|
|
67
|
+
} catch (t) {
|
|
68
|
+
v({
|
|
60
69
|
loading: !1,
|
|
61
|
-
error:
|
|
70
|
+
error: t instanceof Error ? t.message : "Failed to fetch options"
|
|
62
71
|
});
|
|
63
72
|
} finally {
|
|
64
|
-
|
|
73
|
+
v((t) => ({ ...t, loading: !1 }));
|
|
65
74
|
}
|
|
66
75
|
})(), () => {
|
|
67
|
-
|
|
68
|
-
}), [
|
|
69
|
-
if (
|
|
70
|
-
if (
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
(
|
|
76
|
+
R([]), F(/* @__PURE__ */ new Map());
|
|
77
|
+
}), [a, c]), j(() => {
|
|
78
|
+
if (g)
|
|
79
|
+
if (c) {
|
|
80
|
+
const n = I.get("__preload__") || [];
|
|
81
|
+
if (S) {
|
|
82
|
+
const t = n.filter(
|
|
83
|
+
(o) => f ? f(o, S) : String(s(o)).toLowerCase().includes(S.toLowerCase())
|
|
75
84
|
);
|
|
76
|
-
|
|
85
|
+
R(t);
|
|
77
86
|
} else
|
|
78
|
-
|
|
87
|
+
R(n);
|
|
79
88
|
} else {
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
|
|
89
|
+
const n = S || "";
|
|
90
|
+
if (I.has(n)) {
|
|
91
|
+
const t = I.get(n);
|
|
92
|
+
R(t);
|
|
84
93
|
} else
|
|
85
94
|
(async () => {
|
|
86
95
|
try {
|
|
87
|
-
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
} catch (
|
|
91
|
-
|
|
96
|
+
v({ loading: !0, error: null });
|
|
97
|
+
const o = await a(S);
|
|
98
|
+
F((y) => new Map(y).set(n, o)), R(o);
|
|
99
|
+
} catch (o) {
|
|
100
|
+
v({
|
|
92
101
|
loading: !1,
|
|
93
|
-
error:
|
|
102
|
+
error: o instanceof Error ? o.message : "Failed to fetch options"
|
|
94
103
|
});
|
|
95
104
|
} finally {
|
|
96
|
-
|
|
105
|
+
v((o) => ({ ...o, loading: !1 }));
|
|
97
106
|
}
|
|
98
107
|
})();
|
|
99
108
|
}
|
|
100
109
|
}, [
|
|
101
|
-
a,
|
|
102
|
-
m,
|
|
103
110
|
g,
|
|
104
111
|
S,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
a
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
c,
|
|
113
|
+
f,
|
|
114
|
+
I,
|
|
115
|
+
s,
|
|
116
|
+
a
|
|
117
|
+
]), j(() => {
|
|
118
|
+
g && P.current && P.current.focus();
|
|
119
|
+
}, [g]), j(() => {
|
|
120
|
+
if (g && E.current && C) {
|
|
121
|
+
const n = E.current.getBoundingClientRect();
|
|
122
|
+
ee(n.width);
|
|
114
123
|
}
|
|
115
|
-
}, [
|
|
116
|
-
const
|
|
117
|
-
(
|
|
118
|
-
|
|
124
|
+
}, [g, C]);
|
|
125
|
+
const re = $(
|
|
126
|
+
(n) => {
|
|
127
|
+
i?.(b && n === r ? "" : n), O(!1);
|
|
128
|
+
},
|
|
129
|
+
[r, i, b]
|
|
130
|
+
), te = $(
|
|
131
|
+
(n) => {
|
|
132
|
+
if (!l) return;
|
|
133
|
+
const t = r, o = t.includes(n);
|
|
134
|
+
let y;
|
|
135
|
+
o ? y = t.filter((oe) => oe !== n) : y = [...t, n], i?.(y);
|
|
119
136
|
},
|
|
120
|
-
[
|
|
121
|
-
),
|
|
122
|
-
(
|
|
123
|
-
|
|
137
|
+
[r, i, l]
|
|
138
|
+
), se = $(
|
|
139
|
+
(n) => {
|
|
140
|
+
n.stopPropagation(), n.preventDefault(), i?.(l ? [] : ""), O(!1);
|
|
124
141
|
},
|
|
125
|
-
[
|
|
126
|
-
),
|
|
127
|
-
return /* @__PURE__ */
|
|
142
|
+
[i]
|
|
143
|
+
), U = A.useId();
|
|
144
|
+
return /* @__PURE__ */ d(
|
|
128
145
|
"div",
|
|
129
146
|
{
|
|
130
|
-
className:
|
|
147
|
+
className: L("grid grid-cols-1 space-y-1.5", C && "w-full"),
|
|
131
148
|
children: [
|
|
132
|
-
|
|
133
|
-
/* @__PURE__ */
|
|
134
|
-
/* @__PURE__ */
|
|
149
|
+
h && /* @__PURE__ */ e(le, { htmlFor: U, className: L(p, "w-fit"), children: h }),
|
|
150
|
+
/* @__PURE__ */ e("div", { ref: Q, className: "relative", "data-slot": "async-select", children: /* @__PURE__ */ d(ie, { open: g, onOpenChange: O, children: [
|
|
151
|
+
/* @__PURE__ */ e(de, { asChild: !0, children: /* @__PURE__ */ e(
|
|
135
152
|
"button",
|
|
136
153
|
{
|
|
137
|
-
id:
|
|
138
|
-
ref:
|
|
154
|
+
id: U,
|
|
155
|
+
ref: E,
|
|
139
156
|
type: "button",
|
|
140
|
-
disabled:
|
|
141
|
-
className:
|
|
142
|
-
|
|
157
|
+
disabled: T,
|
|
158
|
+
className: L(
|
|
159
|
+
ye({ size: J }),
|
|
143
160
|
"!border-d-border/50 border !shadow-none",
|
|
144
|
-
|
|
145
|
-
|
|
161
|
+
T && "cursor-not-allowed opacity-50",
|
|
162
|
+
z,
|
|
146
163
|
"font-normal",
|
|
147
|
-
|
|
164
|
+
C && "w-full",
|
|
148
165
|
"focus-visible:ring-d-ring focus-visible:ring-1",
|
|
149
|
-
|
|
166
|
+
g && "ring-d-ring ring-1"
|
|
150
167
|
),
|
|
151
|
-
style:
|
|
152
|
-
children: /* @__PURE__ */
|
|
153
|
-
|
|
154
|
-
/* @__PURE__ */
|
|
155
|
-
|
|
168
|
+
style: C ? void 0 : { width: x },
|
|
169
|
+
children: /* @__PURE__ */ d("div", { className: "flex w-full flex-1 items-center justify-between overflow-hidden", children: [
|
|
170
|
+
l ? Array.isArray(r) && r.length > 0 ? /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-left", children: r.length === 1 ? G[0] && s(G[0]) : `${r.length} elementi selezionati` }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground truncate text-left", children: _ }) : W ? /* @__PURE__ */ e("div", { className: "min-w-0 flex-1 truncate text-left", children: s(W) }) : /* @__PURE__ */ e("span", { className: "text-d-muted-foreground truncate text-left", children: _ }),
|
|
171
|
+
/* @__PURE__ */ d("div", { className: "flex flex-shrink-0 items-center justify-end gap-1", children: [
|
|
172
|
+
b && (l && Array.isArray(r) && r.length > 0 || !l && W) && /* @__PURE__ */ e(
|
|
156
173
|
"div",
|
|
157
174
|
{
|
|
158
175
|
className: "border-d-input bg-d-accent cursor-pointer rounded-full p-1",
|
|
159
|
-
onClick:
|
|
160
|
-
onMouseDown: (
|
|
176
|
+
onClick: se,
|
|
177
|
+
onMouseDown: (n) => n.preventDefault(),
|
|
161
178
|
"aria-label": "Clear selection",
|
|
162
|
-
children: /* @__PURE__ */
|
|
163
|
-
|
|
179
|
+
children: /* @__PURE__ */ e(
|
|
180
|
+
X,
|
|
164
181
|
{
|
|
165
182
|
name: "X",
|
|
166
183
|
size: "xs",
|
|
@@ -169,8 +186,8 @@ function _e({
|
|
|
169
186
|
)
|
|
170
187
|
}
|
|
171
188
|
),
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
|
|
189
|
+
/* @__PURE__ */ e(
|
|
190
|
+
X,
|
|
174
191
|
{
|
|
175
192
|
name: "ChevronsUpDown",
|
|
176
193
|
size: "xs",
|
|
@@ -181,62 +198,38 @@ function _e({
|
|
|
181
198
|
] })
|
|
182
199
|
}
|
|
183
200
|
) }),
|
|
184
|
-
/* @__PURE__ */
|
|
185
|
-
|
|
201
|
+
/* @__PURE__ */ e(
|
|
202
|
+
fe,
|
|
186
203
|
{
|
|
187
|
-
className:
|
|
204
|
+
className: L("p-0"),
|
|
188
205
|
style: {
|
|
189
|
-
width:
|
|
206
|
+
width: C ? B ? `${B}px` : void 0 : typeof x == "number" ? `${x}px` : x
|
|
190
207
|
},
|
|
191
208
|
align: "start",
|
|
192
209
|
side: "bottom",
|
|
193
210
|
sideOffset: 4,
|
|
194
|
-
onWheel: (
|
|
211
|
+
onWheel: (n) => n.stopPropagation(),
|
|
195
212
|
avoidCollisions: !1,
|
|
196
|
-
children: /* @__PURE__ */
|
|
197
|
-
|
|
213
|
+
children: /* @__PURE__ */ e(
|
|
214
|
+
be,
|
|
198
215
|
{
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
!o.loading && !o.error && l.length === 0 && (B || /* @__PURE__ */ t(de, { children: q || "No results found." })),
|
|
217
|
-
!o.loading && !o.error && l.length > 0 && /* @__PURE__ */ t($, { children: l.map((e) => /* @__PURE__ */ t(
|
|
218
|
-
A,
|
|
219
|
-
{
|
|
220
|
-
value: x(e),
|
|
221
|
-
onSelect: V,
|
|
222
|
-
className: "cursor-pointer",
|
|
223
|
-
children: /* @__PURE__ */ s("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
|
|
224
|
-
/* @__PURE__ */ t("div", { className: "min-w-0 flex-1", children: M ? /* @__PURE__ */ t("div", { className: "truncate", children: M(e) }) : /* @__PURE__ */ t("span", { className: "truncate", children: N(e) }) }),
|
|
225
|
-
/* @__PURE__ */ t(
|
|
226
|
-
me,
|
|
227
|
-
{
|
|
228
|
-
className: v(
|
|
229
|
-
"ml-2 h-4 w-4 flex-shrink-0",
|
|
230
|
-
c === x(e) ? "opacity-100" : "opacity-0"
|
|
231
|
-
)
|
|
232
|
-
}
|
|
233
|
-
)
|
|
234
|
-
] })
|
|
235
|
-
},
|
|
236
|
-
x(e)
|
|
237
|
-
)) })
|
|
238
|
-
] })
|
|
239
|
-
]
|
|
216
|
+
inputRef: P,
|
|
217
|
+
commandListRef: Y,
|
|
218
|
+
placeholder: _,
|
|
219
|
+
searchTerm: K,
|
|
220
|
+
onSearchTermChange: V,
|
|
221
|
+
fetchState: Z,
|
|
222
|
+
options: w,
|
|
223
|
+
loadingSkeleton: M,
|
|
224
|
+
notFound: u,
|
|
225
|
+
noResultsMessage: D,
|
|
226
|
+
multiple: l,
|
|
227
|
+
value: r,
|
|
228
|
+
getOptionValue: m,
|
|
229
|
+
getDisplayValue: s,
|
|
230
|
+
renderOption: k,
|
|
231
|
+
onSelect: re,
|
|
232
|
+
onSelectMultiple: te
|
|
240
233
|
}
|
|
241
234
|
)
|
|
242
235
|
}
|
|
@@ -246,16 +239,105 @@ function _e({
|
|
|
246
239
|
}
|
|
247
240
|
);
|
|
248
241
|
}
|
|
249
|
-
function
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
242
|
+
function Ne({
|
|
243
|
+
option: a,
|
|
244
|
+
multiple: c,
|
|
245
|
+
value: f,
|
|
246
|
+
getOptionValue: k,
|
|
247
|
+
getDisplayValue: m,
|
|
248
|
+
renderOption: s,
|
|
249
|
+
onSelect: u,
|
|
250
|
+
onSelectMultiple: M
|
|
251
|
+
}) {
|
|
252
|
+
const h = k(a);
|
|
253
|
+
let p = !1;
|
|
254
|
+
return c ? p = Array.isArray(f) && f.includes(h) : p = f === h, /* @__PURE__ */ e(
|
|
255
|
+
H,
|
|
256
|
+
{
|
|
257
|
+
value: h,
|
|
258
|
+
onSelect: c ? M : u,
|
|
259
|
+
className: "cursor-pointer",
|
|
260
|
+
children: /* @__PURE__ */ d("div", { className: "flex w-full items-center justify-between overflow-hidden", children: [
|
|
261
|
+
/* @__PURE__ */ d("div", { className: "flex min-w-0 flex-1 items-center gap-2", children: [
|
|
262
|
+
c && /* @__PURE__ */ e(ge, { checked: p }),
|
|
263
|
+
s ? /* @__PURE__ */ e("div", { className: "truncate", children: s(a) }) : /* @__PURE__ */ e("span", { className: "truncate", children: m(a) })
|
|
264
|
+
] }),
|
|
265
|
+
/* @__PURE__ */ e(
|
|
266
|
+
we,
|
|
267
|
+
{
|
|
268
|
+
className: L(
|
|
269
|
+
"ml-2 h-4 w-4 flex-shrink-0",
|
|
270
|
+
p ? "opacity-100" : "opacity-0"
|
|
271
|
+
)
|
|
272
|
+
}
|
|
273
|
+
)
|
|
274
|
+
] })
|
|
275
|
+
},
|
|
276
|
+
h
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
function be({
|
|
280
|
+
inputRef: a,
|
|
281
|
+
commandListRef: c,
|
|
282
|
+
placeholder: f,
|
|
283
|
+
searchTerm: k,
|
|
284
|
+
onSearchTermChange: m,
|
|
285
|
+
fetchState: s,
|
|
286
|
+
options: u,
|
|
287
|
+
loadingSkeleton: M,
|
|
288
|
+
notFound: h,
|
|
289
|
+
noResultsMessage: p,
|
|
290
|
+
multiple: _,
|
|
291
|
+
value: r,
|
|
292
|
+
getOptionValue: i,
|
|
293
|
+
getDisplayValue: T,
|
|
294
|
+
renderOption: x,
|
|
295
|
+
onSelect: z,
|
|
296
|
+
onSelectMultiple: D
|
|
297
|
+
}) {
|
|
298
|
+
return /* @__PURE__ */ d(me, { shouldFilter: !1, className: "w-full border-none shadow-sm", children: [
|
|
299
|
+
/* @__PURE__ */ e(
|
|
300
|
+
ue,
|
|
301
|
+
{
|
|
302
|
+
ref: a,
|
|
303
|
+
placeholder: f,
|
|
304
|
+
className: "placeholder:text-d-muted-foreground",
|
|
305
|
+
value: k,
|
|
306
|
+
onValueChange: m
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
s.loading && u.length > 0 && /* @__PURE__ */ e("div", { className: "flex items-center justify-center p-2", children: /* @__PURE__ */ e(xe, { className: "h-4 w-4 animate-spin" }) }),
|
|
310
|
+
/* @__PURE__ */ d(he, { ref: c, children: [
|
|
311
|
+
s.error && /* @__PURE__ */ e("div", { className: "text-d-destructive p-3 text-center", children: s.error }),
|
|
312
|
+
s.loading && u.length === 0 && (M || /* @__PURE__ */ e(Ce, {})),
|
|
313
|
+
!s.loading && !s.error && u.length === 0 && (h || /* @__PURE__ */ e(pe, { children: p || "No results found." })),
|
|
314
|
+
!s.loading && !s.error && u.length > 0 && /* @__PURE__ */ e(q, { children: u.map((b) => /* @__PURE__ */ e(
|
|
315
|
+
Ne,
|
|
316
|
+
{
|
|
317
|
+
option: b,
|
|
318
|
+
multiple: _,
|
|
319
|
+
value: r,
|
|
320
|
+
getOptionValue: i,
|
|
321
|
+
getDisplayValue: T,
|
|
322
|
+
renderOption: x,
|
|
323
|
+
onSelect: z,
|
|
324
|
+
onSelectMultiple: D
|
|
325
|
+
},
|
|
326
|
+
i(b)
|
|
327
|
+
)) })
|
|
328
|
+
] })
|
|
329
|
+
] });
|
|
330
|
+
}
|
|
331
|
+
function Ce() {
|
|
332
|
+
return /* @__PURE__ */ e(q, { children: [1, 2, 3].map((a) => /* @__PURE__ */ e(H, { disabled: !0, children: /* @__PURE__ */ d("div", { className: "flex w-full items-center gap-2", children: [
|
|
333
|
+
/* @__PURE__ */ e("div", { className: "bg-d-secondary h-6 w-6 animate-pulse rounded-full" }),
|
|
334
|
+
/* @__PURE__ */ d("div", { className: "flex flex-1 flex-col gap-1", children: [
|
|
335
|
+
/* @__PURE__ */ e("div", { className: "bg-d-secondary h-4 w-24 animate-pulse rounded" }),
|
|
336
|
+
/* @__PURE__ */ e("div", { className: "bg-d-secondary h-3 w-16 animate-pulse rounded" })
|
|
255
337
|
] })
|
|
256
|
-
] }) },
|
|
338
|
+
] }) }, a)) });
|
|
257
339
|
}
|
|
258
340
|
export {
|
|
259
|
-
|
|
260
|
-
|
|
341
|
+
De as AsyncSelect,
|
|
342
|
+
ye as selectTriggerVariants
|
|
261
343
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -189,9 +189,34 @@ export declare function AspectRatio({ ...props }: AspectRatioProps): JSX.Element
|
|
|
189
189
|
|
|
190
190
|
declare type AspectRatioProps = React.ComponentProps<typeof AspectRatioPrimitive.Root>;
|
|
191
191
|
|
|
192
|
-
export declare function AsyncSelect<T>({ fetcher, preload, filterFn, renderOption, getOptionValue, getDisplayValue, notFound, loadingSkeleton, label, labelClassName, placeholder, value, onChange, disabled, width, triggerClassName, noResultsMessage, clearable, size, }: AsyncSelectProps<T>): JSX.Element;
|
|
192
|
+
export declare function AsyncSelect<T>({ fetcher, preload, filterFn, renderOption, getOptionValue, getDisplayValue, notFound, loadingSkeleton, label, labelClassName, placeholder, value, onChange, disabled, width, triggerClassName, noResultsMessage, clearable, multiple, size, }: AsyncSelectProps<T>): JSX.Element;
|
|
193
193
|
|
|
194
|
-
declare interface
|
|
194
|
+
declare interface AsyncSelectMultipleProps<T> extends VariantProps<typeof selectTriggerVariants> {
|
|
195
|
+
multiple: true;
|
|
196
|
+
fetcher: (query?: string) => Promise<T[]>;
|
|
197
|
+
preload?: boolean;
|
|
198
|
+
filterFn?: (option: T, query: string) => boolean;
|
|
199
|
+
renderOption: (option: T) => React_2.ReactNode;
|
|
200
|
+
getOptionValue: (option: T) => string;
|
|
201
|
+
getDisplayValue: (option: T) => React_2.ReactNode;
|
|
202
|
+
notFound?: React_2.ReactNode;
|
|
203
|
+
loadingSkeleton?: React_2.ReactNode;
|
|
204
|
+
value?: string[];
|
|
205
|
+
onChange?: (value: string[]) => void;
|
|
206
|
+
label?: string | React_2.ReactNode;
|
|
207
|
+
labelClassName?: string;
|
|
208
|
+
placeholder?: string;
|
|
209
|
+
disabled?: boolean;
|
|
210
|
+
width?: string | number | "auto";
|
|
211
|
+
triggerClassName?: string;
|
|
212
|
+
noResultsMessage?: string;
|
|
213
|
+
clearable?: boolean;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
declare type AsyncSelectProps<T> = AsyncSelectSingleProps<T> | AsyncSelectMultipleProps<T>;
|
|
217
|
+
|
|
218
|
+
declare interface AsyncSelectSingleProps<T> extends VariantProps<typeof selectTriggerVariants> {
|
|
219
|
+
multiple?: false;
|
|
195
220
|
fetcher: (query?: string) => Promise<T[]>;
|
|
196
221
|
preload?: boolean;
|
|
197
222
|
filterFn?: (option: T, query: string) => boolean;
|
|
@@ -3,7 +3,7 @@ import { stringify as w } from "../../comma-separated-tokens/index.js";
|
|
|
3
3
|
import { ok as u } from "../../devlop/lib/default.js";
|
|
4
4
|
import { svg as m, html as C } from "../../property-information/index.js";
|
|
5
5
|
import { stringify as N } from "../../space-separated-tokens/index.js";
|
|
6
|
-
import S from "../../../_virtual/
|
|
6
|
+
import S from "../../../_virtual/index4.js";
|
|
7
7
|
import { whitespace as j } from "../../hast-util-whitespace/lib/index.js";
|
|
8
8
|
import { name as x } from "../../estree-util-is-identifier-name/lib/index.js";
|
|
9
9
|
import { VFileMessage as h } from "../../vfile-message/lib/index.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { bail as P } from "../../bail/index.js";
|
|
3
|
-
import y from "../../../_virtual/
|
|
3
|
+
import y from "../../../_virtual/index5.js";
|
|
4
4
|
import z from "../../is-plain-obj/index.js";
|
|
5
5
|
import { CallableInstance as C } from "./callable-instance.js";
|
|
6
6
|
import { trough as A } from "../../trough/lib/index.js";
|