@overdoser/react-toolkit 0.8.1 → 0.9.0
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/AGENTS.md +6 -0
- package/CHANGELOG.md +84 -0
- package/components/Drawer/Drawer.js +88 -83
- package/components/Timeline/GanttTimeline.d.ts +144 -0
- package/components/Timeline/GanttTimeline.js +305 -0
- package/components/Timeline/GanttTimeline.module.scss.js +55 -0
- package/components/Timeline/HistoryTimeline.d.ts +184 -0
- package/components/Timeline/HistoryTimeline.js +445 -0
- package/components/Timeline/HistoryTimeline.module.scss.js +59 -0
- package/components/Timeline/Timeline.module.scss.js +111 -0
- package/components/Timeline/TimelineShared.d.ts +79 -0
- package/components/Timeline/TimelineShared.js +173 -0
- package/components/Timeline/TraceTimeline.d.ts +180 -0
- package/components/Timeline/TraceTimeline.js +511 -0
- package/components/Timeline/TraceTimeline.module.scss.js +105 -0
- package/components/Timeline/demoData.d.ts +42 -0
- package/components/Timeline/historyLayout.d.ts +82 -0
- package/components/Timeline/historyLayout.js +264 -0
- package/components/Timeline/index.d.ts +7 -0
- package/components/Timeline/timelineCore.d.ts +90 -0
- package/components/Timeline/timelineCore.js +135 -0
- package/components/Timeline/traceLayout.d.ts +72 -0
- package/components/Timeline/traceLayout.js +92 -0
- package/components/Timeline/useTimeline.d.ts +39 -0
- package/components/Timeline/useTimeline.js +81 -0
- package/components/inputs/Select/Select.js +158 -154
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +93 -87
- package/index.layered.css +1 -1
- package/llms.txt +113 -0
- package/manifest.json +323 -0
- package/package.json +1 -1
- package/recipes/live-timeline-feed.tsx +147 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as ne, useState as
|
|
1
|
+
import { jsx as s, jsxs as P, Fragment as me } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ne, useState as U, useRef as w, useId as le, useCallback as S, useMemo as ae, useEffect as $ } from "react";
|
|
3
3
|
import { createPortal as ie } from "react-dom";
|
|
4
4
|
import f from "clsx";
|
|
5
5
|
import e from "./Select.module.scss.js";
|
|
6
|
-
import { usePortalPosition as
|
|
7
|
-
const
|
|
6
|
+
import { usePortalPosition as se } from "../../../hooks/usePortalPosition.js";
|
|
7
|
+
const oe = ne(
|
|
8
8
|
({
|
|
9
9
|
inputSize: h = "md",
|
|
10
10
|
error: b = !1,
|
|
11
11
|
options: p,
|
|
12
|
-
placeholder:
|
|
12
|
+
placeholder: q,
|
|
13
13
|
classes: u,
|
|
14
|
-
className:
|
|
15
|
-
style:
|
|
14
|
+
className: W,
|
|
15
|
+
style: B,
|
|
16
16
|
children: y,
|
|
17
17
|
searchable: g,
|
|
18
18
|
searchPlaceholder: ee,
|
|
@@ -20,37 +20,37 @@ const se = ne(
|
|
|
20
20
|
onValueChange: v,
|
|
21
21
|
...L
|
|
22
22
|
}, N) => {
|
|
23
|
-
const
|
|
24
|
-
te?.(
|
|
23
|
+
const M = te || v ? (o) => {
|
|
24
|
+
te?.(o), v?.(o.target.value);
|
|
25
25
|
} : void 0;
|
|
26
|
-
return /* @__PURE__ */ P("div", { className: f(e.wrapper, e[h], b && e.error, u?.wrapper,
|
|
26
|
+
return /* @__PURE__ */ P("div", { className: f(e.wrapper, e[h], b && e.error, u?.wrapper, W), style: B, children: [
|
|
27
27
|
/* @__PURE__ */ P(
|
|
28
28
|
"select",
|
|
29
29
|
{
|
|
30
30
|
ref: N,
|
|
31
31
|
className: f(e.root, e[h], b && e.error, u?.root),
|
|
32
|
-
onChange:
|
|
32
|
+
onChange: M,
|
|
33
33
|
...L,
|
|
34
34
|
children: [
|
|
35
|
-
|
|
36
|
-
p ? p.map((
|
|
35
|
+
q && /* @__PURE__ */ s("option", { value: "", disabled: !0, children: q }),
|
|
36
|
+
p ? p.map((o) => /* @__PURE__ */ s("option", { value: o.value, disabled: o.disabled, children: o.label }, o.value)) : y
|
|
37
37
|
]
|
|
38
38
|
}
|
|
39
39
|
),
|
|
40
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ s("span", { className: f(e.arrow, u?.arrow) })
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
43
|
);
|
|
44
|
-
|
|
44
|
+
oe.displayName = "NativeSelect";
|
|
45
45
|
const ce = ne(
|
|
46
46
|
({
|
|
47
47
|
inputSize: h = "md",
|
|
48
48
|
error: b = !1,
|
|
49
49
|
options: p = [],
|
|
50
|
-
placeholder:
|
|
50
|
+
placeholder: q = "Select...",
|
|
51
51
|
classes: u,
|
|
52
|
-
className:
|
|
53
|
-
style:
|
|
52
|
+
className: W,
|
|
53
|
+
style: B,
|
|
54
54
|
value: y,
|
|
55
55
|
disabled: g,
|
|
56
56
|
id: ee,
|
|
@@ -58,77 +58,79 @@ const ce = ne(
|
|
|
58
58
|
onChange: v,
|
|
59
59
|
onValueChange: L,
|
|
60
60
|
portal: N = !0
|
|
61
|
-
},
|
|
62
|
-
const [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
61
|
+
}, M) => {
|
|
62
|
+
const [o, X] = U(!1), [A, T] = U(""), [c, d] = U(0), j = w(null), I = w(null), _ = w(null), R = w(null), k = w(null), Q = le(), K = se(j, o && N), H = w(null), re = (r) => {
|
|
63
|
+
H.current = r, typeof M == "function" ? M(r) : M && (M.current = r);
|
|
64
|
+
}, z = w(!1);
|
|
65
|
+
$(() => {
|
|
66
|
+
z.current && !o && _.current?.focus(), z.current = o;
|
|
67
|
+
}, [o]);
|
|
66
68
|
const C = S(() => {
|
|
67
|
-
|
|
69
|
+
X(!1), T(""), d(0);
|
|
68
70
|
}, []), G = S(() => {
|
|
69
|
-
g || (
|
|
71
|
+
g || (X(!0), T(""), d(0), setTimeout(() => I.current?.focus(), 0));
|
|
70
72
|
}, [g]), J = S(
|
|
71
|
-
(
|
|
72
|
-
if (L?.(
|
|
73
|
+
(r) => {
|
|
74
|
+
if (L?.(r), H.current) {
|
|
73
75
|
Object.getOwnPropertyDescriptor(
|
|
74
76
|
HTMLSelectElement.prototype,
|
|
75
77
|
"value"
|
|
76
|
-
)?.set?.call(
|
|
77
|
-
const
|
|
78
|
-
|
|
78
|
+
)?.set?.call(H.current, r);
|
|
79
|
+
const n = new Event("change", { bubbles: !0 });
|
|
80
|
+
H.current.dispatchEvent(n), v?.(n);
|
|
79
81
|
}
|
|
80
82
|
C();
|
|
81
83
|
},
|
|
82
|
-
[L, v,
|
|
84
|
+
[L, v, H, C]
|
|
83
85
|
), x = ae(() => {
|
|
84
|
-
if (!
|
|
85
|
-
const
|
|
86
|
-
return p.filter((a) => a.label.toLowerCase().includes(
|
|
87
|
-
}, [p,
|
|
88
|
-
|
|
89
|
-
const
|
|
90
|
-
d(
|
|
91
|
-
}, [x]),
|
|
92
|
-
if (!
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
95
|
-
|
|
96
|
-
}, [c,
|
|
86
|
+
if (!A) return p;
|
|
87
|
+
const r = A.toLowerCase();
|
|
88
|
+
return p.filter((a) => a.label.toLowerCase().includes(r));
|
|
89
|
+
}, [p, A]);
|
|
90
|
+
$(() => {
|
|
91
|
+
const r = x.findIndex((a) => !a.disabled);
|
|
92
|
+
d(r >= 0 ? r : 0);
|
|
93
|
+
}, [x]), $(() => {
|
|
94
|
+
if (!o) return;
|
|
95
|
+
const r = k.current;
|
|
96
|
+
if (!r) return;
|
|
97
|
+
r.querySelectorAll('[role="option"]')[c]?.scrollIntoView?.({ block: "nearest" });
|
|
98
|
+
}, [c, o]);
|
|
97
99
|
const E = S(
|
|
98
|
-
(
|
|
99
|
-
const a = x.map((
|
|
100
|
+
(r) => {
|
|
101
|
+
const a = x.map((n, m) => n.disabled ? -1 : m).filter((n) => n >= 0);
|
|
100
102
|
if (a.length !== 0)
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
const m = a.indexOf(
|
|
103
|
+
if (r.key === "ArrowDown")
|
|
104
|
+
r.preventDefault(), d((n) => {
|
|
105
|
+
const m = a.indexOf(n);
|
|
104
106
|
return m < a.length - 1 ? a[m + 1] : a[0];
|
|
105
107
|
});
|
|
106
|
-
else if (
|
|
107
|
-
|
|
108
|
-
const m = a.indexOf(
|
|
108
|
+
else if (r.key === "ArrowUp")
|
|
109
|
+
r.preventDefault(), d((n) => {
|
|
110
|
+
const m = a.indexOf(n);
|
|
109
111
|
return m > 0 ? a[m - 1] : a[a.length - 1];
|
|
110
112
|
});
|
|
111
|
-
else if (
|
|
112
|
-
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
} else
|
|
113
|
+
else if (r.key === "Enter") {
|
|
114
|
+
r.preventDefault();
|
|
115
|
+
const n = x[c];
|
|
116
|
+
n && !n.disabled && J(n.value);
|
|
117
|
+
} else r.key === "Escape" && (r.preventDefault(), C());
|
|
116
118
|
},
|
|
117
119
|
[x, c, J, C]
|
|
118
120
|
);
|
|
119
|
-
|
|
120
|
-
if (!
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
121
|
+
$(() => {
|
|
122
|
+
if (!o) return;
|
|
123
|
+
const r = (a) => {
|
|
124
|
+
const n = a.target;
|
|
125
|
+
j.current?.contains(n) || R.current?.contains(n) || C();
|
|
124
126
|
};
|
|
125
|
-
return document.addEventListener("mousedown",
|
|
126
|
-
}, [
|
|
127
|
-
const
|
|
127
|
+
return document.addEventListener("mousedown", r), () => document.removeEventListener("mousedown", r);
|
|
128
|
+
}, [o, C]);
|
|
129
|
+
const O = p.find((r) => r.value === y)?.label, Y = x.filter((r) => !r.disabled);
|
|
128
130
|
return /* @__PURE__ */ P(
|
|
129
131
|
"div",
|
|
130
132
|
{
|
|
131
|
-
ref:
|
|
133
|
+
ref: j,
|
|
132
134
|
className: f(
|
|
133
135
|
e.wrapper,
|
|
134
136
|
e.searchableWrapper,
|
|
@@ -136,14 +138,14 @@ const ce = ne(
|
|
|
136
138
|
b && e.error,
|
|
137
139
|
g && e.disabled,
|
|
138
140
|
u?.wrapper,
|
|
139
|
-
|
|
141
|
+
W
|
|
140
142
|
),
|
|
141
|
-
style:
|
|
143
|
+
style: B,
|
|
142
144
|
children: [
|
|
143
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ s(
|
|
144
146
|
"select",
|
|
145
147
|
{
|
|
146
|
-
ref:
|
|
148
|
+
ref: re,
|
|
147
149
|
className: e.hiddenSelect,
|
|
148
150
|
value: y ?? "",
|
|
149
151
|
disabled: g,
|
|
@@ -151,36 +153,36 @@ const ce = ne(
|
|
|
151
153
|
"aria-hidden": "true",
|
|
152
154
|
onChange: () => {
|
|
153
155
|
},
|
|
154
|
-
children: p.map((
|
|
156
|
+
children: p.map((r) => /* @__PURE__ */ s("option", { value: r.value, children: r.label }, r.value))
|
|
155
157
|
}
|
|
156
158
|
),
|
|
157
159
|
/* @__PURE__ */ P(
|
|
158
160
|
"button",
|
|
159
161
|
{
|
|
160
|
-
ref:
|
|
162
|
+
ref: _,
|
|
161
163
|
id: ee,
|
|
162
164
|
type: "button",
|
|
163
165
|
className: f(
|
|
164
166
|
e.root,
|
|
165
167
|
e.searchableTrigger,
|
|
166
168
|
e[h],
|
|
167
|
-
|
|
169
|
+
o && e.triggerOpen,
|
|
168
170
|
b && e.error,
|
|
169
|
-
|
|
171
|
+
o && e.visuallyHidden,
|
|
170
172
|
u?.root
|
|
171
173
|
),
|
|
172
174
|
onClick: G,
|
|
173
175
|
disabled: g,
|
|
174
|
-
"aria-expanded":
|
|
176
|
+
"aria-expanded": o,
|
|
175
177
|
"aria-haspopup": "listbox",
|
|
176
|
-
"aria-controls":
|
|
178
|
+
"aria-controls": o ? Q : void 0,
|
|
177
179
|
children: [
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
/* @__PURE__ */
|
|
180
|
+
/* @__PURE__ */ s("span", { className: f(e.triggerLabel, !O && e.placeholder), children: O || q }),
|
|
181
|
+
/* @__PURE__ */ s("span", { className: f(e.arrow, e.arrowInline, u?.arrow) })
|
|
180
182
|
]
|
|
181
183
|
}
|
|
182
184
|
),
|
|
183
|
-
|
|
185
|
+
o && /* @__PURE__ */ s(
|
|
184
186
|
"input",
|
|
185
187
|
{
|
|
186
188
|
ref: I,
|
|
@@ -195,52 +197,52 @@ const ce = ne(
|
|
|
195
197
|
u?.root,
|
|
196
198
|
u?.search
|
|
197
199
|
),
|
|
198
|
-
placeholder:
|
|
199
|
-
value:
|
|
200
|
-
onChange: (
|
|
200
|
+
placeholder: O || q,
|
|
201
|
+
value: A,
|
|
202
|
+
onChange: (r) => T(r.target.value),
|
|
201
203
|
onKeyDown: E,
|
|
202
204
|
"aria-expanded": !0,
|
|
203
205
|
"aria-haspopup": "listbox",
|
|
204
|
-
"aria-controls":
|
|
206
|
+
"aria-controls": Q,
|
|
205
207
|
"aria-activedescendant": Y.length > 0 ? `select-option-${x[c]?.value}` : void 0
|
|
206
208
|
}
|
|
207
209
|
),
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
+
o && (() => {
|
|
211
|
+
const r = N ? {
|
|
210
212
|
position: "fixed",
|
|
211
|
-
top:
|
|
212
|
-
left:
|
|
213
|
+
top: K.top + 4,
|
|
214
|
+
left: K.left,
|
|
213
215
|
right: "auto",
|
|
214
|
-
width:
|
|
216
|
+
width: K.width,
|
|
215
217
|
zIndex: "var(--crk-z-floating)"
|
|
216
|
-
} : void 0, a = /* @__PURE__ */
|
|
218
|
+
} : void 0, a = /* @__PURE__ */ s(
|
|
217
219
|
"div",
|
|
218
220
|
{
|
|
219
|
-
id:
|
|
221
|
+
id: Q,
|
|
220
222
|
ref: R,
|
|
221
223
|
className: f(e.menu, u?.menu),
|
|
222
|
-
style:
|
|
224
|
+
style: r,
|
|
223
225
|
role: "listbox",
|
|
224
|
-
children: /* @__PURE__ */
|
|
226
|
+
children: /* @__PURE__ */ s("div", { className: e.menuItems, ref: k, children: x.length === 0 ? /* @__PURE__ */ s("div", { className: e.noResults, children: "No results" }) : x.map((n, m) => /* @__PURE__ */ s(
|
|
225
227
|
"button",
|
|
226
228
|
{
|
|
227
|
-
id: `select-option-${
|
|
229
|
+
id: `select-option-${n.value}`,
|
|
228
230
|
type: "button",
|
|
229
231
|
role: "option",
|
|
230
|
-
"aria-selected":
|
|
232
|
+
"aria-selected": n.value === y,
|
|
231
233
|
className: f(
|
|
232
234
|
e.item,
|
|
233
|
-
|
|
234
|
-
|
|
235
|
+
n.disabled && e.itemDisabled,
|
|
236
|
+
n.value === y && e.itemSelected,
|
|
235
237
|
m === c && e.itemHighlighted,
|
|
236
238
|
u?.item
|
|
237
239
|
),
|
|
238
|
-
disabled:
|
|
239
|
-
onClick: () => J(
|
|
240
|
+
disabled: n.disabled,
|
|
241
|
+
onClick: () => J(n.value),
|
|
240
242
|
onMouseEnter: () => d(m),
|
|
241
|
-
children:
|
|
243
|
+
children: n.content ?? n.label
|
|
242
244
|
},
|
|
243
|
-
|
|
245
|
+
n.value
|
|
244
246
|
)) })
|
|
245
247
|
}
|
|
246
248
|
);
|
|
@@ -257,10 +259,10 @@ const ue = ne(
|
|
|
257
259
|
inputSize: h = "md",
|
|
258
260
|
error: b = !1,
|
|
259
261
|
options: p = [],
|
|
260
|
-
placeholder:
|
|
262
|
+
placeholder: q = "Select...",
|
|
261
263
|
classes: u,
|
|
262
|
-
className:
|
|
263
|
-
style:
|
|
264
|
+
className: W,
|
|
265
|
+
style: B,
|
|
264
266
|
value: y,
|
|
265
267
|
disabled: g,
|
|
266
268
|
id: ee,
|
|
@@ -268,22 +270,24 @@ const ue = ne(
|
|
|
268
270
|
onValuesChange: v,
|
|
269
271
|
clearSearchOnSelect: L = !0,
|
|
270
272
|
closeOnSelect: N = !0,
|
|
271
|
-
allowCreate:
|
|
272
|
-
onCreate:
|
|
273
|
-
createLabel:
|
|
274
|
-
portal:
|
|
275
|
-
},
|
|
276
|
-
const c = Array.isArray(y) ? y : y ? [y] : [], [d,
|
|
277
|
-
|
|
278
|
-
},
|
|
279
|
-
|
|
273
|
+
allowCreate: M = !1,
|
|
274
|
+
onCreate: o,
|
|
275
|
+
createLabel: X,
|
|
276
|
+
portal: A = !0
|
|
277
|
+
}, T) => {
|
|
278
|
+
const c = Array.isArray(y) ? y : y ? [y] : [], [d, j] = U(!1), [I, _] = U(""), [R, k] = U(0), Q = w(null), K = w(null), H = w(null), re = w(null), z = w(null), C = le(), G = se(z, d && A), J = w(null), x = (t) => {
|
|
279
|
+
J.current = t, typeof T == "function" ? T(t) : T && (T.current = t);
|
|
280
|
+
}, E = S(() => {
|
|
281
|
+
j(!1), _(""), k(0);
|
|
282
|
+
}, []), O = S(() => {
|
|
283
|
+
g || (j(!0), _(""), k(0), setTimeout(() => K.current?.focus(), 0));
|
|
280
284
|
}, [g]), Y = S(
|
|
281
285
|
(t) => {
|
|
282
286
|
const i = c.includes(t) ? c.filter((l) => l !== t) : [...c, t];
|
|
283
|
-
v?.(i), N ? E() : L &&
|
|
287
|
+
v?.(i), N ? E() : L && _("");
|
|
284
288
|
},
|
|
285
289
|
[c, v, N, E, L]
|
|
286
|
-
),
|
|
290
|
+
), r = S(
|
|
287
291
|
(t, i) => {
|
|
288
292
|
i.stopPropagation(), v?.(c.filter((l) => l !== t));
|
|
289
293
|
},
|
|
@@ -292,17 +296,17 @@ const ue = ne(
|
|
|
292
296
|
if (!I) return p;
|
|
293
297
|
const t = I.toLowerCase();
|
|
294
298
|
return p.filter((i) => i.label.toLowerCase().includes(t));
|
|
295
|
-
}, [p, I]),
|
|
296
|
-
(t) => t.label.toLowerCase() ===
|
|
297
|
-
) && !c.includes(
|
|
298
|
-
|
|
299
|
-
}, [
|
|
300
|
-
|
|
299
|
+
}, [p, I]), n = I.trim(), m = M && n.length > 0 && !p.some(
|
|
300
|
+
(t) => t.label.toLowerCase() === n.toLowerCase() || t.value === n
|
|
301
|
+
) && !c.includes(n), F = S(() => {
|
|
302
|
+
n && (c.includes(n) || (o?.(n), v?.([...c, n]), N ? E() : L && _("")));
|
|
303
|
+
}, [n, c, o, v, N, E, L]);
|
|
304
|
+
$(() => {
|
|
301
305
|
const t = a.findIndex((i) => !i.disabled);
|
|
302
306
|
k(t >= 0 ? t : 0);
|
|
303
|
-
}, [a]),
|
|
307
|
+
}, [a]), $(() => {
|
|
304
308
|
if (!d) return;
|
|
305
|
-
const t =
|
|
309
|
+
const t = re.current;
|
|
306
310
|
if (!t) return;
|
|
307
311
|
t.querySelectorAll('[role="option"]')[R]?.scrollIntoView?.({ block: "nearest" });
|
|
308
312
|
}, [R, d]);
|
|
@@ -316,7 +320,7 @@ const ue = ne(
|
|
|
316
320
|
if (i.length !== 0)
|
|
317
321
|
if (t.key === "ArrowDown") {
|
|
318
322
|
if (t.preventDefault(), !d) {
|
|
319
|
-
|
|
323
|
+
O();
|
|
320
324
|
return;
|
|
321
325
|
}
|
|
322
326
|
k((l) => {
|
|
@@ -330,20 +334,20 @@ const ue = ne(
|
|
|
330
334
|
});
|
|
331
335
|
else if (t.key === "Enter") {
|
|
332
336
|
if (t.preventDefault(), m && R === Z) {
|
|
333
|
-
|
|
337
|
+
F();
|
|
334
338
|
return;
|
|
335
339
|
}
|
|
336
340
|
const l = a[R];
|
|
337
|
-
l && !l.disabled ? Y(l.value) : m &&
|
|
341
|
+
l && !l.disabled ? Y(l.value) : m && F();
|
|
338
342
|
} else t.key === "Escape" && (t.preventDefault(), E());
|
|
339
343
|
},
|
|
340
|
-
[a, R, Y, E, I, c, v, d,
|
|
344
|
+
[a, R, Y, E, I, c, v, d, O, m, F, Z]
|
|
341
345
|
);
|
|
342
|
-
|
|
346
|
+
$(() => {
|
|
343
347
|
if (!d) return;
|
|
344
348
|
const t = (i) => {
|
|
345
349
|
const l = i.target;
|
|
346
|
-
|
|
350
|
+
Q.current?.contains(l) || H.current?.contains(l) || E();
|
|
347
351
|
};
|
|
348
352
|
return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
|
|
349
353
|
}, [d, E]);
|
|
@@ -351,7 +355,7 @@ const ue = ne(
|
|
|
351
355
|
return /* @__PURE__ */ P(
|
|
352
356
|
"div",
|
|
353
357
|
{
|
|
354
|
-
ref:
|
|
358
|
+
ref: Q,
|
|
355
359
|
className: f(
|
|
356
360
|
e.wrapper,
|
|
357
361
|
e.searchableWrapper,
|
|
@@ -359,11 +363,11 @@ const ue = ne(
|
|
|
359
363
|
b && e.error,
|
|
360
364
|
g && e.disabled,
|
|
361
365
|
u?.wrapper,
|
|
362
|
-
|
|
366
|
+
W
|
|
363
367
|
),
|
|
364
|
-
style:
|
|
368
|
+
style: B,
|
|
365
369
|
children: [
|
|
366
|
-
/* @__PURE__ */
|
|
370
|
+
/* @__PURE__ */ s(
|
|
367
371
|
"select",
|
|
368
372
|
{
|
|
369
373
|
ref: x,
|
|
@@ -375,7 +379,7 @@ const ue = ne(
|
|
|
375
379
|
"aria-hidden": "true",
|
|
376
380
|
onChange: () => {
|
|
377
381
|
},
|
|
378
|
-
children: p.map((t) => /* @__PURE__ */
|
|
382
|
+
children: p.map((t) => /* @__PURE__ */ s("option", { value: t.value, children: t.label }, t.value))
|
|
379
383
|
}
|
|
380
384
|
),
|
|
381
385
|
/* @__PURE__ */ P(
|
|
@@ -391,7 +395,7 @@ const ue = ne(
|
|
|
391
395
|
u?.root
|
|
392
396
|
),
|
|
393
397
|
onClick: () => {
|
|
394
|
-
d ?
|
|
398
|
+
d ? K.current?.focus() : O();
|
|
395
399
|
},
|
|
396
400
|
role: "combobox",
|
|
397
401
|
"aria-expanded": d,
|
|
@@ -399,59 +403,59 @@ const ue = ne(
|
|
|
399
403
|
"aria-controls": d ? C : void 0,
|
|
400
404
|
children: [
|
|
401
405
|
fe.map((t) => /* @__PURE__ */ P("span", { className: f(e.chip, u?.chip), children: [
|
|
402
|
-
/* @__PURE__ */
|
|
403
|
-
/* @__PURE__ */
|
|
406
|
+
/* @__PURE__ */ s("span", { className: e.chipLabel, children: t.content ?? t.label }),
|
|
407
|
+
/* @__PURE__ */ s(
|
|
404
408
|
"button",
|
|
405
409
|
{
|
|
406
410
|
type: "button",
|
|
407
411
|
className: f(e.chipRemove, u?.chipRemove),
|
|
408
|
-
onClick: (i) =>
|
|
412
|
+
onClick: (i) => r(t.value, i),
|
|
409
413
|
"aria-label": `Remove ${t.label}`,
|
|
410
414
|
tabIndex: -1,
|
|
411
415
|
children: "×"
|
|
412
416
|
}
|
|
413
417
|
)
|
|
414
418
|
] }, t.value)),
|
|
415
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ s(
|
|
416
420
|
"input",
|
|
417
421
|
{
|
|
418
|
-
ref:
|
|
422
|
+
ref: K,
|
|
419
423
|
id: ee,
|
|
420
424
|
type: "text",
|
|
421
425
|
className: e.multiSearch,
|
|
422
|
-
placeholder: c.length === 0 ?
|
|
426
|
+
placeholder: c.length === 0 ? q : "",
|
|
423
427
|
value: I,
|
|
424
428
|
onChange: (t) => {
|
|
425
|
-
|
|
429
|
+
_(t.target.value), d || O();
|
|
426
430
|
},
|
|
427
431
|
onKeyDown: de,
|
|
428
432
|
disabled: g,
|
|
429
433
|
"aria-label": "Search options"
|
|
430
434
|
}
|
|
431
435
|
),
|
|
432
|
-
/* @__PURE__ */
|
|
436
|
+
/* @__PURE__ */ s("span", { className: f(e.arrow, e.arrowMulti, u?.arrow) })
|
|
433
437
|
]
|
|
434
438
|
}
|
|
435
439
|
),
|
|
436
440
|
d && (() => {
|
|
437
|
-
const t =
|
|
441
|
+
const t = A ? {
|
|
438
442
|
position: "fixed",
|
|
439
443
|
top: G.top + 4,
|
|
440
444
|
left: G.left,
|
|
441
445
|
right: "auto",
|
|
442
446
|
width: G.width,
|
|
443
447
|
zIndex: "var(--crk-z-floating)"
|
|
444
|
-
} : void 0, i = /* @__PURE__ */
|
|
448
|
+
} : void 0, i = /* @__PURE__ */ s(
|
|
445
449
|
"div",
|
|
446
450
|
{
|
|
447
451
|
id: C,
|
|
448
|
-
ref:
|
|
452
|
+
ref: H,
|
|
449
453
|
className: f(e.menu, u?.menu),
|
|
450
454
|
style: t,
|
|
451
455
|
role: "listbox",
|
|
452
456
|
"aria-multiselectable": "true",
|
|
453
|
-
children: /* @__PURE__ */ P("div", { className: e.menuItems, ref:
|
|
454
|
-
a.length === 0 && !m && /* @__PURE__ */
|
|
457
|
+
children: /* @__PURE__ */ P("div", { className: e.menuItems, ref: re, children: [
|
|
458
|
+
a.length === 0 && !m && /* @__PURE__ */ s("div", { className: e.noResults, children: "No results" }),
|
|
455
459
|
a.map((l, D) => {
|
|
456
460
|
const V = c.includes(l.value);
|
|
457
461
|
return /* @__PURE__ */ P(
|
|
@@ -472,14 +476,14 @@ const ue = ne(
|
|
|
472
476
|
onClick: () => Y(l.value),
|
|
473
477
|
onMouseEnter: () => k(D),
|
|
474
478
|
children: [
|
|
475
|
-
V && /* @__PURE__ */
|
|
479
|
+
V && /* @__PURE__ */ s("span", { className: e.itemCheck, "aria-hidden": "true" }),
|
|
476
480
|
l.content ?? l.label
|
|
477
481
|
]
|
|
478
482
|
},
|
|
479
483
|
l.value
|
|
480
484
|
);
|
|
481
485
|
}),
|
|
482
|
-
m && /* @__PURE__ */
|
|
486
|
+
m && /* @__PURE__ */ s(
|
|
483
487
|
"button",
|
|
484
488
|
{
|
|
485
489
|
type: "button",
|
|
@@ -490,11 +494,11 @@ const ue = ne(
|
|
|
490
494
|
R === Z && e.itemHighlighted,
|
|
491
495
|
u?.item
|
|
492
496
|
),
|
|
493
|
-
onClick:
|
|
497
|
+
onClick: F,
|
|
494
498
|
onMouseEnter: () => k(Z),
|
|
495
|
-
children:
|
|
499
|
+
children: X ? X(n) : /* @__PURE__ */ P(me, { children: [
|
|
496
500
|
"Create “",
|
|
497
|
-
/* @__PURE__ */
|
|
501
|
+
/* @__PURE__ */ s("strong", { children: n }),
|
|
498
502
|
"”"
|
|
499
503
|
] })
|
|
500
504
|
},
|
|
@@ -503,7 +507,7 @@ const ue = ne(
|
|
|
503
507
|
] })
|
|
504
508
|
}
|
|
505
509
|
);
|
|
506
|
-
return
|
|
510
|
+
return A && typeof document < "u" ? ie(i, document.body) : i;
|
|
507
511
|
})()
|
|
508
512
|
]
|
|
509
513
|
}
|
|
@@ -512,7 +516,7 @@ const ue = ne(
|
|
|
512
516
|
);
|
|
513
517
|
ue.displayName = "MultiSelect";
|
|
514
518
|
const he = ne(
|
|
515
|
-
(h, b) => h.multiple ? /* @__PURE__ */
|
|
519
|
+
(h, b) => h.multiple ? /* @__PURE__ */ s(ue, { ref: b, ...h }) : h.searchable ? /* @__PURE__ */ s(ce, { ref: b, ...h }) : /* @__PURE__ */ s(oe, { ref: b, ...h })
|
|
516
520
|
);
|
|
517
521
|
he.displayName = "Select";
|
|
518
522
|
export {
|