@donkit-ai/design-system 1.4.14 → 1.4.16
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/index.cjs.js +2 -2
- package/dist/index.es.js +190 -190
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -69,25 +69,25 @@ function os() {
|
|
|
69
69
|
return "Suspense";
|
|
70
70
|
case Y:
|
|
71
71
|
return "SuspenseList";
|
|
72
|
-
case
|
|
72
|
+
case b:
|
|
73
73
|
return "Activity";
|
|
74
74
|
}
|
|
75
75
|
if (typeof c == "object")
|
|
76
76
|
switch (typeof c.tag == "number" && console.error(
|
|
77
77
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
78
78
|
), c.$$typeof) {
|
|
79
|
-
case
|
|
79
|
+
case v:
|
|
80
80
|
return "Portal";
|
|
81
81
|
case $:
|
|
82
82
|
return c.displayName || "Context";
|
|
83
83
|
case y:
|
|
84
84
|
return (c._context.displayName || "Context") + ".Consumer";
|
|
85
|
-
case
|
|
85
|
+
case z:
|
|
86
86
|
var w = c.render;
|
|
87
87
|
return c = c.displayName, c || (c = w.displayName || w.name || "", c = c !== "" ? "ForwardRef(" + c + ")" : "ForwardRef"), c;
|
|
88
|
-
case
|
|
88
|
+
case H:
|
|
89
89
|
return w = c.displayName || null, w !== null ? w : s(c.type) || "Memo";
|
|
90
|
-
case
|
|
90
|
+
case F:
|
|
91
91
|
w = c._payload, c = c._init;
|
|
92
92
|
try {
|
|
93
93
|
return s(c(w));
|
|
@@ -108,17 +108,17 @@ function os() {
|
|
|
108
108
|
}
|
|
109
109
|
if (w) {
|
|
110
110
|
w = console;
|
|
111
|
-
var
|
|
112
|
-
return
|
|
111
|
+
var L = w.error, O = typeof Symbol == "function" && Symbol.toStringTag && c[Symbol.toStringTag] || c.constructor.name || "Object";
|
|
112
|
+
return L.call(
|
|
113
113
|
w,
|
|
114
114
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
115
|
-
|
|
115
|
+
O
|
|
116
116
|
), t(c);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
function i(c) {
|
|
120
120
|
if (c === S) return "<>";
|
|
121
|
-
if (typeof c == "object" && c !== null && c.$$typeof ===
|
|
121
|
+
if (typeof c == "object" && c !== null && c.$$typeof === F)
|
|
122
122
|
return "<...>";
|
|
123
123
|
try {
|
|
124
124
|
var w = s(c);
|
|
@@ -142,31 +142,31 @@ function os() {
|
|
|
142
142
|
return c.key !== void 0;
|
|
143
143
|
}
|
|
144
144
|
function l(c, w) {
|
|
145
|
-
function
|
|
145
|
+
function L() {
|
|
146
146
|
k || (k = !0, console.error(
|
|
147
147
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
148
148
|
w
|
|
149
149
|
));
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
get:
|
|
151
|
+
L.isReactWarning = !0, Object.defineProperty(c, "key", {
|
|
152
|
+
get: L,
|
|
153
153
|
configurable: !0
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
function m() {
|
|
157
157
|
var c = s(this.type);
|
|
158
|
-
return
|
|
158
|
+
return P[c] || (P[c] = !0, console.error(
|
|
159
159
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
160
160
|
)), c = this.props.ref, c !== void 0 ? c : null;
|
|
161
161
|
}
|
|
162
|
-
function d(c, w,
|
|
163
|
-
var W =
|
|
162
|
+
function d(c, w, L, O, te, ae) {
|
|
163
|
+
var W = L.ref;
|
|
164
164
|
return c = {
|
|
165
165
|
$$typeof: _,
|
|
166
166
|
type: c,
|
|
167
167
|
key: w,
|
|
168
|
-
props:
|
|
169
|
-
_owner:
|
|
168
|
+
props: L,
|
|
169
|
+
_owner: O
|
|
170
170
|
}, (W !== void 0 ? W : null) !== null ? Object.defineProperty(c, "ref", {
|
|
171
171
|
enumerable: !1,
|
|
172
172
|
get: m
|
|
@@ -192,13 +192,13 @@ function os() {
|
|
|
192
192
|
value: ae
|
|
193
193
|
}), Object.freeze && (Object.freeze(c.props), Object.freeze(c)), c;
|
|
194
194
|
}
|
|
195
|
-
function f(c, w,
|
|
195
|
+
function f(c, w, L, O, te, ae) {
|
|
196
196
|
var W = w.children;
|
|
197
197
|
if (W !== void 0)
|
|
198
|
-
if (
|
|
198
|
+
if (O)
|
|
199
199
|
if (x(W)) {
|
|
200
|
-
for (
|
|
201
|
-
p(W[
|
|
200
|
+
for (O = 0; O < W.length; O++)
|
|
201
|
+
p(W[O]);
|
|
202
202
|
Object.freeze && Object.freeze(W);
|
|
203
203
|
} else
|
|
204
204
|
console.error(
|
|
@@ -210,43 +210,43 @@ function os() {
|
|
|
210
210
|
var Q = Object.keys(w).filter(function(xe) {
|
|
211
211
|
return xe !== "key";
|
|
212
212
|
});
|
|
213
|
-
|
|
213
|
+
O = 0 < Q.length ? "{key: someKey, " + Q.join(": ..., ") + ": ...}" : "{key: someKey}", g[W + O] || (Q = 0 < Q.length ? "{" + Q.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
214
214
|
`A props object containing a "key" prop is being spread into JSX:
|
|
215
215
|
let props = %s;
|
|
216
216
|
<%s {...props} />
|
|
217
217
|
React keys must be passed directly to JSX without using spread:
|
|
218
218
|
let props = %s;
|
|
219
219
|
<%s key={someKey} {...props} />`,
|
|
220
|
-
|
|
220
|
+
O,
|
|
221
221
|
W,
|
|
222
222
|
Q,
|
|
223
223
|
W
|
|
224
|
-
), g[W +
|
|
224
|
+
), g[W + O] = !0);
|
|
225
225
|
}
|
|
226
|
-
if (W = null,
|
|
227
|
-
|
|
226
|
+
if (W = null, L !== void 0 && (n(L), W = "" + L), o(w) && (n(w.key), W = "" + w.key), "key" in w) {
|
|
227
|
+
L = {};
|
|
228
228
|
for (var ie in w)
|
|
229
|
-
ie !== "key" && (
|
|
230
|
-
} else
|
|
229
|
+
ie !== "key" && (L[ie] = w[ie]);
|
|
230
|
+
} else L = w;
|
|
231
231
|
return W && l(
|
|
232
|
-
|
|
232
|
+
L,
|
|
233
233
|
typeof c == "function" ? c.displayName || c.name || "Unknown" : c
|
|
234
234
|
), d(
|
|
235
235
|
c,
|
|
236
236
|
W,
|
|
237
|
-
|
|
237
|
+
L,
|
|
238
238
|
a(),
|
|
239
239
|
te,
|
|
240
240
|
ae
|
|
241
241
|
);
|
|
242
242
|
}
|
|
243
243
|
function p(c) {
|
|
244
|
-
h(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof ===
|
|
244
|
+
h(c) ? c._store && (c._store.validated = 1) : typeof c == "object" && c !== null && c.$$typeof === F && (c._payload.status === "fulfilled" ? h(c._payload.value) && c._payload.value._store && (c._payload.value._store.validated = 1) : c._store && (c._store.validated = 1));
|
|
245
245
|
}
|
|
246
246
|
function h(c) {
|
|
247
247
|
return typeof c == "object" && c !== null && c.$$typeof === _;
|
|
248
248
|
}
|
|
249
|
-
var u = K, _ = Symbol.for("react.transitional.element"),
|
|
249
|
+
var u = K, _ = Symbol.for("react.transitional.element"), v = Symbol.for("react.portal"), S = Symbol.for("react.fragment"), R = Symbol.for("react.strict_mode"), B = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), $ = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), Y = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), b = Symbol.for("react.activity"), C = Symbol.for("react.client.reference"), X = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, U = Object.prototype.hasOwnProperty, x = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
250
250
|
return null;
|
|
251
251
|
};
|
|
252
252
|
u = {
|
|
@@ -254,29 +254,29 @@ React keys must be passed directly to JSX without using spread:
|
|
|
254
254
|
return c();
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
|
-
var k,
|
|
257
|
+
var k, P = {}, q = u.react_stack_bottom_frame.bind(
|
|
258
258
|
u,
|
|
259
259
|
r
|
|
260
|
-
)(), G =
|
|
261
|
-
fe.Fragment = S, fe.jsx = function(c, w,
|
|
262
|
-
var
|
|
260
|
+
)(), G = N(i(r)), g = {};
|
|
261
|
+
fe.Fragment = S, fe.jsx = function(c, w, L) {
|
|
262
|
+
var O = 1e4 > X.recentlyCreatedOwnerStacks++;
|
|
263
263
|
return f(
|
|
264
264
|
c,
|
|
265
265
|
w,
|
|
266
|
-
|
|
266
|
+
L,
|
|
267
267
|
!1,
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
O ? Error("react-stack-top-frame") : q,
|
|
269
|
+
O ? N(i(c)) : G
|
|
270
270
|
);
|
|
271
|
-
}, fe.jsxs = function(c, w,
|
|
272
|
-
var
|
|
271
|
+
}, fe.jsxs = function(c, w, L) {
|
|
272
|
+
var O = 1e4 > X.recentlyCreatedOwnerStacks++;
|
|
273
273
|
return f(
|
|
274
274
|
c,
|
|
275
275
|
w,
|
|
276
|
-
|
|
276
|
+
L,
|
|
277
277
|
!0,
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
O ? Error("react-stack-top-frame") : q,
|
|
279
|
+
O ? N(i(c)) : G
|
|
280
280
|
);
|
|
281
281
|
};
|
|
282
282
|
}()), fe;
|
|
@@ -310,37 +310,37 @@ function me({
|
|
|
310
310
|
className: p = "",
|
|
311
311
|
...h
|
|
312
312
|
}) {
|
|
313
|
-
const u = a && !s, _ = o === "loading",
|
|
313
|
+
const u = a && !s, _ = o === "loading", v = o === "success", S = o === "error", R = _ || v || S, B = n === "xs" ? "s" : "m", y = t === "danger" ? "on-accent" : "default", $ = cs[n] ?? 16, z = _ ? /* @__PURE__ */ e.jsx(ls, { size: B, color: y }) : v ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(Ne, { size: $, strokeWidth: 2.5 }) }) : S ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(re, { size: $, strokeWidth: 2.5 }) }) : null, A = [
|
|
314
314
|
"ds-button",
|
|
315
315
|
`ds-button--${t}`,
|
|
316
316
|
`ds-button--${n}`,
|
|
317
317
|
i && "ds-button--full",
|
|
318
318
|
u && "ds-button--icon-only",
|
|
319
319
|
p
|
|
320
|
-
].filter(Boolean).join(" "),
|
|
321
|
-
R ?
|
|
320
|
+
].filter(Boolean).join(" "), Y = o !== "idle" ? o : void 0, H = /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
321
|
+
R ? z : a && /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: a }),
|
|
322
322
|
s
|
|
323
323
|
] });
|
|
324
324
|
if (d) {
|
|
325
|
-
const
|
|
325
|
+
const F = (b) => {
|
|
326
326
|
if (r || _) {
|
|
327
|
-
|
|
327
|
+
b.preventDefault();
|
|
328
328
|
return;
|
|
329
329
|
}
|
|
330
|
-
|
|
330
|
+
b.metaKey || b.ctrlKey || b.button === 1 || (b.preventDefault(), l == null || l(b));
|
|
331
331
|
};
|
|
332
332
|
return /* @__PURE__ */ e.jsx(
|
|
333
333
|
"a",
|
|
334
334
|
{
|
|
335
|
-
className:
|
|
335
|
+
className: A,
|
|
336
336
|
href: r || _ ? void 0 : d,
|
|
337
|
-
onClick:
|
|
337
|
+
onClick: F,
|
|
338
338
|
"aria-label": f,
|
|
339
339
|
"aria-disabled": r || _ ? "true" : void 0,
|
|
340
340
|
"aria-busy": _ ? "true" : void 0,
|
|
341
|
-
"data-state":
|
|
341
|
+
"data-state": Y,
|
|
342
342
|
...h,
|
|
343
|
-
children:
|
|
343
|
+
children: H
|
|
344
344
|
}
|
|
345
345
|
);
|
|
346
346
|
}
|
|
@@ -348,14 +348,14 @@ function me({
|
|
|
348
348
|
"button",
|
|
349
349
|
{
|
|
350
350
|
type: m,
|
|
351
|
-
className:
|
|
351
|
+
className: A,
|
|
352
352
|
disabled: r,
|
|
353
353
|
onClick: _ ? void 0 : l,
|
|
354
354
|
"aria-label": f,
|
|
355
355
|
"aria-busy": _ ? "true" : void 0,
|
|
356
|
-
"data-state":
|
|
356
|
+
"data-state": Y,
|
|
357
357
|
...h,
|
|
358
|
-
children:
|
|
358
|
+
children: H
|
|
359
359
|
}
|
|
360
360
|
);
|
|
361
361
|
}
|
|
@@ -448,34 +448,34 @@ function Ys({
|
|
|
448
448
|
id: d,
|
|
449
449
|
...f
|
|
450
450
|
}) {
|
|
451
|
-
const [p, h] = D(!1), [u, _] = D(!1), [
|
|
452
|
-
u || (_(!0), $(-1),
|
|
451
|
+
const [p, h] = D(!1), [u, _] = D(!1), [v, S] = D({}), [R, B] = D("down"), [y, $] = D(-1), z = E(null), A = E(null), Y = E(null), H = E(null), F = d || `select-${K.useId()}`, b = `${F}-label`, C = r ? `${F}-error` : void 0, X = 150, U = (g = !1) => {
|
|
452
|
+
u || (_(!0), $(-1), H.current = setTimeout(() => {
|
|
453
453
|
var c;
|
|
454
454
|
h(!1), _(!1), g && ((c = Y.current) == null || c.focus());
|
|
455
455
|
}, X));
|
|
456
456
|
}, x = (g) => {
|
|
457
|
-
clearTimeout(
|
|
457
|
+
clearTimeout(H.current), _(!1);
|
|
458
458
|
const c = g !== void 0 ? g : Math.max(i.findIndex((w) => w.value === t), 0);
|
|
459
459
|
$(c), h(!0);
|
|
460
460
|
};
|
|
461
|
-
M(() => () => clearTimeout(
|
|
462
|
-
const
|
|
461
|
+
M(() => () => clearTimeout(H.current), []);
|
|
462
|
+
const N = () => {
|
|
463
463
|
var ae;
|
|
464
|
-
const g = (ae =
|
|
464
|
+
const g = (ae = z.current) == null ? void 0 : ae.getBoundingClientRect();
|
|
465
465
|
if (!g) return;
|
|
466
|
-
const c = window.innerHeight, w = c - g.bottom,
|
|
466
|
+
const c = window.innerHeight, w = c - g.bottom, L = g.top, te = w < 300 && L > w;
|
|
467
467
|
B(te ? "up" : "down"), S(
|
|
468
468
|
te ? { bottom: c - g.top + 4, left: g.left, width: g.width } : { top: g.bottom + 4, left: g.left, width: g.width }
|
|
469
469
|
);
|
|
470
470
|
};
|
|
471
471
|
M(() => {
|
|
472
472
|
if (p)
|
|
473
|
-
return
|
|
474
|
-
window.removeEventListener("scroll",
|
|
473
|
+
return N(), window.addEventListener("scroll", N, !0), window.addEventListener("resize", N), () => {
|
|
474
|
+
window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N);
|
|
475
475
|
};
|
|
476
476
|
}, [p]), M(() => {
|
|
477
477
|
const g = (c) => {
|
|
478
|
-
|
|
478
|
+
z.current && !z.current.contains(c.target) && A.current && !A.current.contains(c.target) && U();
|
|
479
479
|
};
|
|
480
480
|
return document.addEventListener("mousedown", g), () => document.removeEventListener("mousedown", g);
|
|
481
481
|
}, [u]), M(() => {
|
|
@@ -508,12 +508,12 @@ function Ys({
|
|
|
508
508
|
p && U(!1);
|
|
509
509
|
break;
|
|
510
510
|
}
|
|
511
|
-
},
|
|
511
|
+
}, P = i.find((g) => g.value === t), q = l === "xs" ? I[1] : l === "small" ? I[2] : I[3], G = p && /* @__PURE__ */ e.jsx(
|
|
512
512
|
"div",
|
|
513
513
|
{
|
|
514
514
|
ref: A,
|
|
515
515
|
role: "listbox",
|
|
516
|
-
"aria-labelledby": s ?
|
|
516
|
+
"aria-labelledby": s ? b : void 0,
|
|
517
517
|
tabIndex: -1,
|
|
518
518
|
className: [
|
|
519
519
|
"ds-select-dropdown",
|
|
@@ -521,11 +521,11 @@ function Ys({
|
|
|
521
521
|
`ds-select-dropdown--${R}`,
|
|
522
522
|
u && "ds-select-dropdown--closing"
|
|
523
523
|
].filter(Boolean).join(" "),
|
|
524
|
-
style:
|
|
524
|
+
style: v,
|
|
525
525
|
children: i.map((g, c) => /* @__PURE__ */ e.jsx(
|
|
526
526
|
"button",
|
|
527
527
|
{
|
|
528
|
-
id: `${
|
|
528
|
+
id: `${F}-opt-${c}`,
|
|
529
529
|
type: "button",
|
|
530
530
|
role: "option",
|
|
531
531
|
tabIndex: -1,
|
|
@@ -546,18 +546,18 @@ function Ys({
|
|
|
546
546
|
}
|
|
547
547
|
);
|
|
548
548
|
return /* @__PURE__ */ e.jsxs("div", { className: `ds-select-wrapper ${o ? "ds-select-wrapper--full" : ""} ${m ? "ds-select-wrapper--disabled" : ""}`, children: [
|
|
549
|
-
s && /* @__PURE__ */ e.jsx("label", { id:
|
|
550
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-select-container", ref:
|
|
549
|
+
s && /* @__PURE__ */ e.jsx("label", { id: b, className: "ds-select-label", children: s }),
|
|
550
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-select-container", ref: z, children: /* @__PURE__ */ e.jsxs(
|
|
551
551
|
"button",
|
|
552
552
|
{
|
|
553
553
|
ref: Y,
|
|
554
554
|
type: "button",
|
|
555
|
-
id:
|
|
555
|
+
id: F,
|
|
556
556
|
role: "combobox",
|
|
557
557
|
"aria-haspopup": "listbox",
|
|
558
558
|
"aria-expanded": p,
|
|
559
|
-
"aria-activedescendant": p && y >= 0 ? `${
|
|
560
|
-
"aria-labelledby": s ?
|
|
559
|
+
"aria-activedescendant": p && y >= 0 ? `${F}-opt-${y}` : void 0,
|
|
560
|
+
"aria-labelledby": s ? b : void 0,
|
|
561
561
|
"aria-invalid": r ? "true" : "false",
|
|
562
562
|
"aria-describedby": C,
|
|
563
563
|
className: `ds-select-trigger ds-select-trigger--${l} ${r ? "ds-select-trigger--error" : ""}`,
|
|
@@ -568,11 +568,11 @@ function Ys({
|
|
|
568
568
|
disabled: m,
|
|
569
569
|
...f,
|
|
570
570
|
children: [
|
|
571
|
-
/* @__PURE__ */ e.jsx("span", { className:
|
|
571
|
+
/* @__PURE__ */ e.jsx("span", { className: P ? "" : "ds-select-placeholder", children: (P == null ? void 0 : P.label) || a }),
|
|
572
572
|
/* @__PURE__ */ e.jsx(
|
|
573
573
|
he,
|
|
574
574
|
{
|
|
575
|
-
size:
|
|
575
|
+
size: q,
|
|
576
576
|
strokeWidth: 1.5,
|
|
577
577
|
className: `ds-select-icon ${p && R === "down" ? "ds-select-icon--open" : ""} ${p && R === "up" ? "ds-select-icon--up" : ""}`,
|
|
578
578
|
"aria-hidden": "true"
|
|
@@ -622,14 +622,14 @@ function Hs({
|
|
|
622
622
|
"ds-stepper-wrapper",
|
|
623
623
|
l && "ds-stepper-wrapper--disabled",
|
|
624
624
|
d && "ds-stepper-wrapper--error"
|
|
625
|
-
].filter(Boolean).join(" "),
|
|
625
|
+
].filter(Boolean).join(" "), v = [
|
|
626
626
|
"ds-stepper",
|
|
627
627
|
`ds-stepper--${o}`,
|
|
628
628
|
l && "ds-stepper--disabled"
|
|
629
629
|
].filter(Boolean).join(" "), S = o === "xs" ? I[1] : o === "small" ? I[2] : I[3];
|
|
630
630
|
return /* @__PURE__ */ e.jsxs("div", { className: _, children: [
|
|
631
631
|
s && /* @__PURE__ */ e.jsx("label", { className: "ds-stepper-label", children: s }),
|
|
632
|
-
/* @__PURE__ */ e.jsxs("div", { className:
|
|
632
|
+
/* @__PURE__ */ e.jsxs("div", { className: v, children: [
|
|
633
633
|
/* @__PURE__ */ e.jsx(
|
|
634
634
|
"button",
|
|
635
635
|
{
|
|
@@ -805,10 +805,10 @@ function et({
|
|
|
805
805
|
}, fs));
|
|
806
806
|
};
|
|
807
807
|
M(() => {
|
|
808
|
-
const u = (
|
|
809
|
-
|
|
810
|
-
}, _ = (
|
|
811
|
-
r.current && !r.current.contains(
|
|
808
|
+
const u = (v) => {
|
|
809
|
+
v.key === "Escape" && d();
|
|
810
|
+
}, _ = (v) => {
|
|
811
|
+
r.current && !r.current.contains(v.target) && d();
|
|
812
812
|
};
|
|
813
813
|
return document.addEventListener("keydown", u), document.addEventListener("mousedown", _), () => {
|
|
814
814
|
document.removeEventListener("keydown", u), document.removeEventListener("mousedown", _);
|
|
@@ -960,7 +960,7 @@ function at({ options: s, value: t, onChange: n, size: i = "m", disabled: a = !1
|
|
|
960
960
|
if (!r.current) return;
|
|
961
961
|
const u = r.current.querySelector(`[data-value="${t}"]`);
|
|
962
962
|
if (!u) return;
|
|
963
|
-
const _ = r.current.getBoundingClientRect(),
|
|
963
|
+
const _ = r.current.getBoundingClientRect(), v = u.getBoundingClientRect(), S = v.left - _.left, R = v.width;
|
|
964
964
|
o.current ? (o.current.style.transition = d.current ? "left var(--transition-normal), width var(--transition-normal)" : "none", o.current.style.left = S + "px", o.current.style.width = R + "px", d.current = !1) : (m(!0), requestAnimationFrame(() => {
|
|
965
965
|
if (!o.current || !r.current) return;
|
|
966
966
|
const B = r.current.querySelector(`[data-value="${t}"]`);
|
|
@@ -1092,7 +1092,7 @@ function hs(s, t, n) {
|
|
|
1092
1092
|
function it({ children: s, content: t, position: n, ...i }) {
|
|
1093
1093
|
const [a, r] = D(!1), [o, l] = D({ visibility: "hidden" }), [m, d] = D(n || "top"), f = E(null), p = E(null), h = E(!1), u = () => {
|
|
1094
1094
|
if (!f.current || !p.current) return;
|
|
1095
|
-
const
|
|
1095
|
+
const v = f.current.getBoundingClientRect(), S = p.current.getBoundingClientRect(), R = n || hs(v, S.height, S.width), { top: B, left: y, arrowOffset: $ } = ps(R, v, S);
|
|
1096
1096
|
d(R), l({
|
|
1097
1097
|
position: "fixed",
|
|
1098
1098
|
top: B,
|
|
@@ -1104,16 +1104,16 @@ function it({ children: s, content: t, position: n, ...i }) {
|
|
|
1104
1104
|
if (M(() => {
|
|
1105
1105
|
if (!a) return;
|
|
1106
1106
|
l({ position: "fixed", visibility: "hidden" });
|
|
1107
|
-
const
|
|
1107
|
+
const v = requestAnimationFrame(u);
|
|
1108
1108
|
return window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
|
|
1109
|
-
cancelAnimationFrame(
|
|
1109
|
+
cancelAnimationFrame(v), window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
|
|
1110
1110
|
};
|
|
1111
1111
|
}, [a, n]), M(() => {
|
|
1112
1112
|
if (!a) return;
|
|
1113
|
-
const
|
|
1113
|
+
const v = (S) => {
|
|
1114
1114
|
f.current && !f.current.contains(S.target) && r(!1);
|
|
1115
1115
|
};
|
|
1116
|
-
return document.addEventListener("touchstart",
|
|
1116
|
+
return document.addEventListener("touchstart", v), () => document.removeEventListener("touchstart", v);
|
|
1117
1117
|
}, [a]), !t) return s;
|
|
1118
1118
|
const _ = a && /* @__PURE__ */ e.jsx(
|
|
1119
1119
|
"div",
|
|
@@ -1137,7 +1137,7 @@ function it({ children: s, content: t, position: n, ...i }) {
|
|
|
1137
1137
|
h.current || r(!1);
|
|
1138
1138
|
},
|
|
1139
1139
|
onTouchStart: () => {
|
|
1140
|
-
h.current = !0, r((
|
|
1140
|
+
h.current = !0, r((v) => !v);
|
|
1141
1141
|
},
|
|
1142
1142
|
...i,
|
|
1143
1143
|
children: [
|
|
@@ -1579,10 +1579,10 @@ function gt({
|
|
|
1579
1579
|
}, Ns));
|
|
1580
1580
|
};
|
|
1581
1581
|
M(() => {
|
|
1582
|
-
const u = (
|
|
1583
|
-
|
|
1584
|
-
}, _ = (
|
|
1585
|
-
r.current && !r.current.contains(
|
|
1582
|
+
const u = (v) => {
|
|
1583
|
+
v.key === "Escape" && d();
|
|
1584
|
+
}, _ = (v) => {
|
|
1585
|
+
r.current && !r.current.contains(v.target) && d();
|
|
1586
1586
|
};
|
|
1587
1587
|
return document.addEventListener("keydown", u), document.addEventListener("mousedown", _), () => {
|
|
1588
1588
|
document.removeEventListener("keydown", u), document.removeEventListener("mousedown", _);
|
|
@@ -1677,39 +1677,39 @@ function kt({
|
|
|
1677
1677
|
style: o,
|
|
1678
1678
|
...l
|
|
1679
1679
|
}) {
|
|
1680
|
-
const [m, d] = D(!1), [f, p] = D(!1), h = n !== void 0, u = h ? n : m, _ = E(null),
|
|
1680
|
+
const [m, d] = D(!1), [f, p] = D(!1), h = n !== void 0, u = h ? n : m, _ = E(null), v = E(null), S = E(null), R = E(null), [B, y] = D({}), $ = E(null), z = 150, A = () => {
|
|
1681
1681
|
if (h)
|
|
1682
1682
|
i == null || i(!1);
|
|
1683
1683
|
else {
|
|
1684
1684
|
if (f) return;
|
|
1685
1685
|
p(!0), $.current = setTimeout(() => {
|
|
1686
1686
|
d(!1), p(!1);
|
|
1687
|
-
},
|
|
1687
|
+
}, z);
|
|
1688
1688
|
}
|
|
1689
1689
|
}, Y = () => {
|
|
1690
1690
|
const x = !u;
|
|
1691
1691
|
h ? i == null || i(x) : x ? (clearTimeout($.current), p(!1), d(!0)) : A();
|
|
1692
|
-
},
|
|
1692
|
+
}, H = () => {
|
|
1693
1693
|
u || (h ? i == null || i(!0) : (clearTimeout($.current), p(!1), d(!0)));
|
|
1694
1694
|
};
|
|
1695
1695
|
M(() => () => clearTimeout($.current), []), M(() => {
|
|
1696
1696
|
if (!u) return;
|
|
1697
|
-
const x = 300,
|
|
1697
|
+
const x = 300, N = () => {
|
|
1698
1698
|
var G;
|
|
1699
1699
|
const k = (G = _.current) == null ? void 0 : G.getBoundingClientRect();
|
|
1700
1700
|
if (!k) return;
|
|
1701
|
-
const
|
|
1701
|
+
const P = window.innerHeight - k.bottom, q = P < x + 8 && k.top > P;
|
|
1702
1702
|
y(
|
|
1703
|
-
a === "right" ?
|
|
1703
|
+
a === "right" ? q ? { bottom: window.innerHeight - k.top + 4, top: "auto", right: window.innerWidth - k.right } : { top: k.bottom + 4, bottom: "auto", right: window.innerWidth - k.right } : q ? { bottom: window.innerHeight - k.top + 4, top: "auto", left: k.left } : { top: k.bottom + 4, bottom: "auto", left: k.left }
|
|
1704
1704
|
);
|
|
1705
1705
|
};
|
|
1706
|
-
return
|
|
1707
|
-
window.removeEventListener("scroll",
|
|
1706
|
+
return N(), window.addEventListener("scroll", N, !0), window.addEventListener("resize", N), () => {
|
|
1707
|
+
window.removeEventListener("scroll", N, !0), window.removeEventListener("resize", N);
|
|
1708
1708
|
};
|
|
1709
1709
|
}, [u, a]);
|
|
1710
|
-
const
|
|
1711
|
-
var
|
|
1712
|
-
const x = (
|
|
1710
|
+
const F = () => {
|
|
1711
|
+
var N;
|
|
1712
|
+
const x = (N = S.current) == null ? void 0 : N.querySelector(
|
|
1713
1713
|
'button:not([disabled]), [href], [tabindex]:not([tabindex="-1"]), input, select, textarea'
|
|
1714
1714
|
);
|
|
1715
1715
|
x == null || x.focus();
|
|
@@ -1717,47 +1717,47 @@ function kt({
|
|
|
1717
1717
|
M(() => {
|
|
1718
1718
|
if (!u) return;
|
|
1719
1719
|
const x = (k) => {
|
|
1720
|
-
var
|
|
1721
|
-
!((
|
|
1722
|
-
},
|
|
1723
|
-
k.key === "Escape" && (A(),
|
|
1720
|
+
var P, q;
|
|
1721
|
+
!((P = _.current) != null && P.contains(k.target)) && !((q = v.current) != null && q.contains(k.target)) && A();
|
|
1722
|
+
}, N = (k) => {
|
|
1723
|
+
k.key === "Escape" && (A(), F());
|
|
1724
1724
|
};
|
|
1725
|
-
return document.addEventListener("mousedown", x), document.addEventListener("keydown",
|
|
1726
|
-
document.removeEventListener("mousedown", x), document.removeEventListener("keydown",
|
|
1725
|
+
return document.addEventListener("mousedown", x), document.addEventListener("keydown", N), () => {
|
|
1726
|
+
document.removeEventListener("mousedown", x), document.removeEventListener("keydown", N);
|
|
1727
1727
|
};
|
|
1728
1728
|
}, [u]), M(() => {
|
|
1729
|
-
if (!u || !R.current || !
|
|
1730
|
-
const x =
|
|
1731
|
-
|
|
1729
|
+
if (!u || !R.current || !v.current) return;
|
|
1730
|
+
const x = b(), N = R.current === "last" ? x[x.length - 1] : x[0];
|
|
1731
|
+
N == null || N.focus(), R.current = null;
|
|
1732
1732
|
}, [u]);
|
|
1733
|
-
const
|
|
1733
|
+
const b = () => v.current ? [...v.current.querySelectorAll(
|
|
1734
1734
|
'button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])'
|
|
1735
1735
|
)] : [], C = (x) => {
|
|
1736
|
-
var
|
|
1736
|
+
var N, k;
|
|
1737
1737
|
if (x.key === "ArrowDown")
|
|
1738
|
-
x.preventDefault(), u ? (
|
|
1738
|
+
x.preventDefault(), u ? (N = b()[0]) == null || N.focus() : (R.current = "first", H());
|
|
1739
1739
|
else if (x.key === "ArrowUp")
|
|
1740
1740
|
if (x.preventDefault(), !u)
|
|
1741
|
-
R.current = "last",
|
|
1741
|
+
R.current = "last", H();
|
|
1742
1742
|
else {
|
|
1743
|
-
const
|
|
1744
|
-
(k =
|
|
1743
|
+
const P = b();
|
|
1744
|
+
(k = P[P.length - 1]) == null || k.focus();
|
|
1745
1745
|
}
|
|
1746
1746
|
}, X = (x) => {
|
|
1747
|
-
var
|
|
1748
|
-
const
|
|
1747
|
+
var P, q, G, g;
|
|
1748
|
+
const N = b(), k = N.findIndex((c) => c === document.activeElement);
|
|
1749
1749
|
switch (x.key) {
|
|
1750
1750
|
case "ArrowDown":
|
|
1751
|
-
x.preventDefault(), (
|
|
1751
|
+
x.preventDefault(), (P = N[Math.min(k + 1, N.length - 1)]) == null || P.focus();
|
|
1752
1752
|
break;
|
|
1753
1753
|
case "ArrowUp":
|
|
1754
|
-
x.preventDefault(), k <= 0 ?
|
|
1754
|
+
x.preventDefault(), k <= 0 ? F() : (q = N[k - 1]) == null || q.focus();
|
|
1755
1755
|
break;
|
|
1756
1756
|
case "Home":
|
|
1757
|
-
x.preventDefault(), (G =
|
|
1757
|
+
x.preventDefault(), (G = N[0]) == null || G.focus();
|
|
1758
1758
|
break;
|
|
1759
1759
|
case "End":
|
|
1760
|
-
x.preventDefault(), (g =
|
|
1760
|
+
x.preventDefault(), (g = N[N.length - 1]) == null || g.focus();
|
|
1761
1761
|
break;
|
|
1762
1762
|
case "Tab":
|
|
1763
1763
|
A();
|
|
@@ -1766,7 +1766,7 @@ function kt({
|
|
|
1766
1766
|
}, U = u && /* @__PURE__ */ e.jsx(
|
|
1767
1767
|
"div",
|
|
1768
1768
|
{
|
|
1769
|
-
ref:
|
|
1769
|
+
ref: v,
|
|
1770
1770
|
role: "menu",
|
|
1771
1771
|
className: [
|
|
1772
1772
|
"ds-dropdown__menu",
|
|
@@ -1775,24 +1775,24 @@ function kt({
|
|
|
1775
1775
|
].filter(Boolean).join(" "),
|
|
1776
1776
|
style: B,
|
|
1777
1777
|
onKeyDown: X,
|
|
1778
|
-
children: t.map((x,
|
|
1778
|
+
children: t.map((x, N) => {
|
|
1779
1779
|
if (x.separator)
|
|
1780
|
-
return /* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__separator" },
|
|
1780
|
+
return /* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__separator" }, N);
|
|
1781
1781
|
if (x.type === "section")
|
|
1782
1782
|
return /* @__PURE__ */ e.jsxs("div", { className: "ds-dropdown__section", children: [
|
|
1783
1783
|
x.label && /* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__section-label", children: x.label }),
|
|
1784
1784
|
/* @__PURE__ */ e.jsx("div", { className: "ds-dropdown__section-content", children: x.content })
|
|
1785
|
-
] },
|
|
1786
|
-
const k = !!x.href,
|
|
1785
|
+
] }, N);
|
|
1786
|
+
const k = !!x.href, P = k ? "a" : "button", q = k ? { href: x.disabled ? void 0 : x.href, "aria-disabled": x.disabled ? "true" : void 0 } : { type: "button", disabled: x.disabled };
|
|
1787
1787
|
return /* @__PURE__ */ e.jsxs(
|
|
1788
|
-
|
|
1788
|
+
P,
|
|
1789
1789
|
{
|
|
1790
1790
|
role: "menuitem",
|
|
1791
1791
|
className: [
|
|
1792
1792
|
"ds-dropdown__item",
|
|
1793
1793
|
x.danger && "ds-dropdown__item--danger"
|
|
1794
1794
|
].filter(Boolean).join(" "),
|
|
1795
|
-
...
|
|
1795
|
+
...q,
|
|
1796
1796
|
onClick: () => {
|
|
1797
1797
|
var G;
|
|
1798
1798
|
(G = x.onClick) == null || G.call(x), A();
|
|
@@ -1803,7 +1803,7 @@ function kt({
|
|
|
1803
1803
|
x.shortcut && /* @__PURE__ */ e.jsx("span", { className: "ds-dropdown__item-shortcut", children: x.shortcut })
|
|
1804
1804
|
]
|
|
1805
1805
|
},
|
|
1806
|
-
|
|
1806
|
+
N
|
|
1807
1807
|
);
|
|
1808
1808
|
})
|
|
1809
1809
|
}
|
|
@@ -2197,7 +2197,7 @@ function As({
|
|
|
2197
2197
|
betweenTime: r = 380,
|
|
2198
2198
|
manualPauseMs: o = 5e3
|
|
2199
2199
|
}) {
|
|
2200
|
-
const [l, m] = D(0), [d, f] = D(""), p = E("typing"), h = E(0), u = E(0), _ = E(null),
|
|
2200
|
+
const [l, m] = D(0), [d, f] = D(""), p = E("typing"), h = E(0), u = E(0), _ = E(null), v = E(0);
|
|
2201
2201
|
M(() => {
|
|
2202
2202
|
u.current = l;
|
|
2203
2203
|
}, [l]), M(() => {
|
|
@@ -2206,9 +2206,9 @@ function As({
|
|
|
2206
2206
|
return;
|
|
2207
2207
|
}
|
|
2208
2208
|
const $ = () => {
|
|
2209
|
-
const
|
|
2210
|
-
if (
|
|
2211
|
-
_.current = setTimeout($,
|
|
2209
|
+
const z = Date.now();
|
|
2210
|
+
if (v.current > z) {
|
|
2211
|
+
_.current = setTimeout($, v.current - z);
|
|
2212
2212
|
return;
|
|
2213
2213
|
}
|
|
2214
2214
|
const A = s[u.current % s.length] ?? "";
|
|
@@ -2220,8 +2220,8 @@ function As({
|
|
|
2220
2220
|
}, [t, s, n, i, a, r]);
|
|
2221
2221
|
const S = ($) => {
|
|
2222
2222
|
if (s.length === 0) return;
|
|
2223
|
-
const
|
|
2224
|
-
u.current =
|
|
2223
|
+
const z = ($ % s.length + s.length) % s.length, A = s[z];
|
|
2224
|
+
u.current = z, h.current = A.length, p.current = "holding", v.current = Date.now() + o, m(z), f(A);
|
|
2225
2225
|
}, R = () => S(u.current + 1), B = () => S(u.current - 1), y = s[l % s.length] ?? "";
|
|
2226
2226
|
return { displayed: d, currentPrompt: y, index: l, next: R, prev: B };
|
|
2227
2227
|
}
|
|
@@ -2242,23 +2242,23 @@ function Lt({
|
|
|
2242
2242
|
onAttachImages: h,
|
|
2243
2243
|
onRemoveAttachment: u,
|
|
2244
2244
|
onRemoveImage: _,
|
|
2245
|
-
acceptImage:
|
|
2245
|
+
acceptImage: v,
|
|
2246
2246
|
acceptFile: S,
|
|
2247
2247
|
maxImages: R,
|
|
2248
2248
|
maxImageSize: B,
|
|
2249
2249
|
leftSlot: y,
|
|
2250
2250
|
rightSlot: $,
|
|
2251
|
-
className:
|
|
2251
|
+
className: z = "",
|
|
2252
2252
|
...A
|
|
2253
2253
|
}) {
|
|
2254
|
-
const Y = E(null),
|
|
2254
|
+
const Y = E(null), H = E(null), F = E(0), [b, C] = D(!1), [X, U] = D([]), x = (j) => {
|
|
2255
2255
|
const T = ++Is;
|
|
2256
2256
|
U((V) => [...V, { id: T, msg: j }]), setTimeout(() => U((V) => V.filter((J) => J.id !== T)), 6e3);
|
|
2257
|
-
},
|
|
2257
|
+
}, N = (j) => U((T) => T.filter((V) => V.id !== j)), k = (j) => j.type.startsWith("image/"), P = () => !0, q = v ?? k, G = S ?? P, g = (j) => {
|
|
2258
2258
|
const T = [], V = [], J = [], Z = [];
|
|
2259
2259
|
let ee = 0, oe = R != null ? R - ((f == null ? void 0 : f.length) ?? 0) : 1 / 0;
|
|
2260
2260
|
for (const se of j)
|
|
2261
|
-
|
|
2261
|
+
q(se) ? B && se.size > B ? J.push(se.name) : oe > 0 ? (T.push(se), oe--) : ee++ : G(se) ? V.push(se) : Z.push(se.name);
|
|
2262
2262
|
return { imageFiles: T, docFiles: V, tooLarge: J, skipped: Z, limitExceeded: ee };
|
|
2263
2263
|
}, c = (j) => {
|
|
2264
2264
|
const { imageFiles: T, docFiles: V, tooLarge: J, skipped: Z, limitExceeded: ee } = g(j);
|
|
@@ -2267,23 +2267,23 @@ function Lt({
|
|
|
2267
2267
|
p && oe.length && p(oe);
|
|
2268
2268
|
};
|
|
2269
2269
|
M(() => {
|
|
2270
|
-
const j =
|
|
2270
|
+
const j = H.current;
|
|
2271
2271
|
j && (j.style.height = "auto", j.style.height = `${Math.min(j.scrollHeight, 200)}px`);
|
|
2272
2272
|
}, [s]), M(() => {
|
|
2273
2273
|
const j = (T) => {
|
|
2274
2274
|
var J, Z, ee;
|
|
2275
2275
|
if (r || o) return;
|
|
2276
2276
|
const V = (J = T.target) == null ? void 0 : J.tagName;
|
|
2277
|
-
V === "INPUT" || V === "TEXTAREA" || V === "SELECT" || (Z = T.target) != null && Z.isContentEditable || T.ctrlKey || T.metaKey || T.altKey || T.key.length !== 1 && T.key !== "Backspace" && T.key !== "Delete" || (ee =
|
|
2277
|
+
V === "INPUT" || V === "TEXTAREA" || V === "SELECT" || (Z = T.target) != null && Z.isContentEditable || T.ctrlKey || T.metaKey || T.altKey || T.key.length !== 1 && T.key !== "Backspace" && T.key !== "Delete" || (ee = H.current) == null || ee.focus();
|
|
2278
2278
|
};
|
|
2279
2279
|
return document.addEventListener("keydown", j), () => document.removeEventListener("keydown", j);
|
|
2280
2280
|
}, [r, o]);
|
|
2281
2281
|
const w = (j) => {
|
|
2282
|
-
j.preventDefault(),
|
|
2283
|
-
},
|
|
2284
|
-
j.preventDefault(),
|
|
2285
|
-
},
|
|
2286
|
-
j.preventDefault(),
|
|
2282
|
+
j.preventDefault(), F.current++, j.dataTransfer.types.includes("Files") && C(!0);
|
|
2283
|
+
}, L = (j) => {
|
|
2284
|
+
j.preventDefault(), F.current--, F.current === 0 && C(!1);
|
|
2285
|
+
}, O = (j) => j.preventDefault(), te = (j) => {
|
|
2286
|
+
j.preventDefault(), F.current = 0, C(!1);
|
|
2287
2287
|
const T = Array.from(j.dataTransfer.files);
|
|
2288
2288
|
T.length && c(T);
|
|
2289
2289
|
}, ae = (j) => {
|
|
@@ -2322,7 +2322,7 @@ function Lt({
|
|
|
2322
2322
|
}
|
|
2323
2323
|
a == null || a(j);
|
|
2324
2324
|
}, Ce = (s.trim() || (f == null ? void 0 : f.length) > 0 || (d == null ? void 0 : d.length) > 0) && !o, $e = p || h;
|
|
2325
|
-
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-prompt-input",
|
|
2325
|
+
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-prompt-input", z].filter(Boolean).join(" "), ...A, children: [
|
|
2326
2326
|
$e && /* @__PURE__ */ e.jsx(
|
|
2327
2327
|
"input",
|
|
2328
2328
|
{
|
|
@@ -2337,17 +2337,17 @@ function Lt({
|
|
|
2337
2337
|
/* @__PURE__ */ e.jsxs(
|
|
2338
2338
|
"div",
|
|
2339
2339
|
{
|
|
2340
|
-
className: ["ds-prompt-input__box",
|
|
2340
|
+
className: ["ds-prompt-input__box", b && "ds-prompt-input__box--dragging"].filter(Boolean).join(" "),
|
|
2341
2341
|
onDragEnter: w,
|
|
2342
|
-
onDragLeave:
|
|
2343
|
-
onDragOver:
|
|
2342
|
+
onDragLeave: L,
|
|
2343
|
+
onDragOver: O,
|
|
2344
2344
|
onDrop: te,
|
|
2345
2345
|
children: [
|
|
2346
|
-
|
|
2346
|
+
b && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__drag-overlay", children: "Drop files here" }),
|
|
2347
2347
|
/* @__PURE__ */ e.jsx(
|
|
2348
2348
|
"textarea",
|
|
2349
2349
|
{
|
|
2350
|
-
ref:
|
|
2350
|
+
ref: H,
|
|
2351
2351
|
value: s,
|
|
2352
2352
|
onChange: (j) => t == null ? void 0 : t(j.target.value),
|
|
2353
2353
|
onKeyDown: xe,
|
|
@@ -2382,7 +2382,7 @@ function Lt({
|
|
|
2382
2382
|
{
|
|
2383
2383
|
type: "button",
|
|
2384
2384
|
className: "ds-prompt-input__warning-close",
|
|
2385
|
-
onClick: () =>
|
|
2385
|
+
onClick: () => N(j.id),
|
|
2386
2386
|
"aria-label": "Dismiss",
|
|
2387
2387
|
children: /* @__PURE__ */ e.jsx(re, { size: I[1], strokeWidth: 1.5 })
|
|
2388
2388
|
}
|
|
@@ -2456,15 +2456,15 @@ function zt({
|
|
|
2456
2456
|
className: l = "",
|
|
2457
2457
|
...m
|
|
2458
2458
|
}) {
|
|
2459
|
-
const [d, f] = D(!1), p = E(null), h = E(null), u = E(null), [_,
|
|
2459
|
+
const [d, f] = D(!1), p = E(null), h = E(null), u = E(null), [_, v] = D({}), S = s.filter((b) => !a || b.name === "auto" ? !0 : (Pe[b.tier] ?? 1) >= (Pe[a] ?? 1)), R = S.find((b) => b.name === "auto"), B = S.filter((b) => b.name !== "auto"), y = s.find((b) => b.name === t), z = new Set(B.map((b) => b.tier).filter(Boolean)).size > 1;
|
|
2460
2460
|
M(() => {
|
|
2461
2461
|
if (!d) return;
|
|
2462
|
-
const
|
|
2463
|
-
var
|
|
2464
|
-
const x = (
|
|
2462
|
+
const b = 320, C = () => {
|
|
2463
|
+
var P;
|
|
2464
|
+
const x = (P = h.current) == null ? void 0 : P.getBoundingClientRect();
|
|
2465
2465
|
if (!x) return;
|
|
2466
|
-
const
|
|
2467
|
-
|
|
2466
|
+
const N = window.innerHeight - x.bottom, k = N < b + 8 && x.top > N;
|
|
2467
|
+
v({
|
|
2468
2468
|
position: "fixed",
|
|
2469
2469
|
zIndex: "var(--z-dropdown, 500)",
|
|
2470
2470
|
left: x.left,
|
|
@@ -2473,8 +2473,8 @@ function zt({
|
|
|
2473
2473
|
};
|
|
2474
2474
|
C(), window.addEventListener("scroll", C, !0), window.addEventListener("resize", C);
|
|
2475
2475
|
const X = (x) => {
|
|
2476
|
-
var
|
|
2477
|
-
!((
|
|
2476
|
+
var N, k;
|
|
2477
|
+
!((N = p.current) != null && N.contains(x.target)) && !((k = u.current) != null && k.contains(x.target)) && f(!1);
|
|
2478
2478
|
}, U = (x) => {
|
|
2479
2479
|
x.key === "Escape" && f(!1);
|
|
2480
2480
|
};
|
|
@@ -2482,31 +2482,31 @@ function zt({
|
|
|
2482
2482
|
window.removeEventListener("scroll", C, !0), window.removeEventListener("resize", C), document.removeEventListener("mousedown", X), document.removeEventListener("keydown", U);
|
|
2483
2483
|
};
|
|
2484
2484
|
}, [d]);
|
|
2485
|
-
const A = (
|
|
2486
|
-
n == null || n(
|
|
2487
|
-
}, Y = (
|
|
2485
|
+
const A = (b) => {
|
|
2486
|
+
n == null || n(b), f(!1);
|
|
2487
|
+
}, Y = (b) => /* @__PURE__ */ e.jsxs(
|
|
2488
2488
|
"button",
|
|
2489
2489
|
{
|
|
2490
2490
|
type: "button",
|
|
2491
2491
|
className: [
|
|
2492
2492
|
"ds-model-picker__item",
|
|
2493
|
-
|
|
2493
|
+
b.name === t && "ds-model-picker__item--active"
|
|
2494
2494
|
].filter(Boolean).join(" "),
|
|
2495
|
-
onClick: () => A(
|
|
2495
|
+
onClick: () => A(b.name),
|
|
2496
2496
|
children: [
|
|
2497
|
-
|
|
2498
|
-
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children:
|
|
2499
|
-
|
|
2497
|
+
b.icon ? /* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-icon", children: b.icon }) : /* @__PURE__ */ e.jsx(Se, { size: 12, strokeWidth: 1.5, className: "ds-model-picker__item-icon" }),
|
|
2498
|
+
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__item-name", children: b.displayName || b.name }),
|
|
2499
|
+
z && b.tier && /* @__PURE__ */ e.jsx(ce, { size: "xs", variant: Le[b.tier] || "default", children: b.tier })
|
|
2500
2500
|
]
|
|
2501
2501
|
},
|
|
2502
|
-
|
|
2503
|
-
),
|
|
2504
|
-
const C = B.filter((X) => X.tier ===
|
|
2502
|
+
b.name
|
|
2503
|
+
), H = () => !o || !z ? B.map(Y) : ["fast", "standard", "premium"].flatMap((b) => {
|
|
2504
|
+
const C = B.filter((X) => X.tier === b);
|
|
2505
2505
|
return C.length ? [
|
|
2506
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__group-label", "data-tier":
|
|
2506
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__group-label", "data-tier": b, children: b.charAt(0).toUpperCase() + b.slice(1) }, `lbl-${b}`),
|
|
2507
2507
|
...C.map(Y)
|
|
2508
2508
|
] : [];
|
|
2509
|
-
}),
|
|
2509
|
+
}), F = d && /* @__PURE__ */ e.jsxs("div", { ref: u, className: "ds-model-picker__menu", style: _, children: [
|
|
2510
2510
|
r && R && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
|
|
2511
2511
|
/* @__PURE__ */ e.jsxs(
|
|
2512
2512
|
"button",
|
|
@@ -2526,7 +2526,7 @@ function zt({
|
|
|
2526
2526
|
),
|
|
2527
2527
|
B.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-model-picker__separator" })
|
|
2528
2528
|
] }),
|
|
2529
|
-
|
|
2529
|
+
H()
|
|
2530
2530
|
] });
|
|
2531
2531
|
return /* @__PURE__ */ e.jsxs(
|
|
2532
2532
|
"div",
|
|
@@ -2541,17 +2541,17 @@ function zt({
|
|
|
2541
2541
|
ref: h,
|
|
2542
2542
|
type: "button",
|
|
2543
2543
|
className: "ds-model-picker__trigger",
|
|
2544
|
-
onClick: () => f((
|
|
2544
|
+
onClick: () => f((b) => !b),
|
|
2545
2545
|
"aria-haspopup": "listbox",
|
|
2546
2546
|
"aria-expanded": d,
|
|
2547
2547
|
children: [
|
|
2548
2548
|
y != null && y.icon ? /* @__PURE__ */ e.jsx("span", { children: y.icon }) : /* @__PURE__ */ e.jsx(Se, { size: 12, strokeWidth: 1.5 }),
|
|
2549
2549
|
/* @__PURE__ */ e.jsx("span", { className: "ds-model-picker__trigger-name", children: (y == null ? void 0 : y.displayName) || (y == null ? void 0 : y.name) || t }),
|
|
2550
|
-
|
|
2550
|
+
z && (y == null ? void 0 : y.tier) && /* @__PURE__ */ e.jsx(ce, { size: "xs", variant: Le[y.tier] || "default", children: y.tier })
|
|
2551
2551
|
]
|
|
2552
2552
|
}
|
|
2553
2553
|
),
|
|
2554
|
-
typeof document < "u" && pe.createPortal(
|
|
2554
|
+
typeof document < "u" && pe.createPortal(F, document.body)
|
|
2555
2555
|
]
|
|
2556
2556
|
}
|
|
2557
2557
|
);
|
|
@@ -2579,7 +2579,7 @@ function Ot({
|
|
|
2579
2579
|
const [r, o] = D(!1), l = Ms(s), m = l.length > i, d = r ? l : l.slice(0, i), f = s.some((h) => h.snippet), p = ["ds-sources-panel", t === "compact" && "ds-sources-panel--compact"].filter(Boolean).join(" ");
|
|
2580
2580
|
return t === "compact" ? /* @__PURE__ */ e.jsxs("div", { className: p, children: [
|
|
2581
2581
|
d.map((h) => {
|
|
2582
|
-
const u = h.items.map((
|
|
2582
|
+
const u = h.items.map((v) => v.page).filter(Boolean), _ = !!a;
|
|
2583
2583
|
return /* @__PURE__ */ e.jsxs(
|
|
2584
2584
|
"div",
|
|
2585
2585
|
{
|
|
@@ -2602,18 +2602,18 @@ function Ot({
|
|
|
2602
2602
|
] }) : /* @__PURE__ */ e.jsxs("div", { className: p, children: [
|
|
2603
2603
|
n && /* @__PURE__ */ e.jsx("div", { className: "ds-sources-panel__title", children: n }),
|
|
2604
2604
|
d.map((h) => {
|
|
2605
|
-
const u = h.items.map((
|
|
2605
|
+
const u = h.items.map((v) => v.page).filter(Boolean), _ = !!a;
|
|
2606
2606
|
return f ? /* @__PURE__ */ e.jsx(
|
|
2607
2607
|
Ee,
|
|
2608
2608
|
{
|
|
2609
2609
|
title: /* @__PURE__ */ e.jsx(Bs, { filename: h.filename, pages: u }),
|
|
2610
2610
|
padding: "s",
|
|
2611
|
-
children: h.items.map((
|
|
2611
|
+
children: h.items.map((v, S) => /* @__PURE__ */ e.jsx(
|
|
2612
2612
|
"div",
|
|
2613
2613
|
{
|
|
2614
2614
|
className: `ds-sources-panel__snippet${_ ? " ds-sources-panel__snippet--clickable" : ""}`,
|
|
2615
|
-
onClick: _ ? () => a(
|
|
2616
|
-
children:
|
|
2615
|
+
onClick: _ ? () => a(v) : void 0,
|
|
2616
|
+
children: v.snippet ?? `p. ${v.page}`
|
|
2617
2617
|
},
|
|
2618
2618
|
S
|
|
2619
2619
|
))
|