@donkit-ai/design-system 1.4.71 → 1.4.73
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.d.ts +1 -0
- package/dist/index.es.js +46 -37
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -159,7 +159,7 @@ function jt() {
|
|
|
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
|
)), f = this.props.ref, f !== void 0 ? f : null;
|
|
161
161
|
}
|
|
162
|
-
function d(f, T, O, Y,
|
|
162
|
+
function d(f, T, O, Y, te, oe) {
|
|
163
163
|
var H = O.ref;
|
|
164
164
|
return f = {
|
|
165
165
|
$$typeof: x,
|
|
@@ -184,7 +184,7 @@ function jt() {
|
|
|
184
184
|
configurable: !1,
|
|
185
185
|
enumerable: !1,
|
|
186
186
|
writable: !0,
|
|
187
|
-
value:
|
|
187
|
+
value: te
|
|
188
188
|
}), Object.defineProperty(f, "_debugTask", {
|
|
189
189
|
configurable: !1,
|
|
190
190
|
enumerable: !1,
|
|
@@ -192,7 +192,7 @@ function jt() {
|
|
|
192
192
|
value: oe
|
|
193
193
|
}), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
|
|
194
194
|
}
|
|
195
|
-
function u(f, T, O, Y,
|
|
195
|
+
function u(f, T, O, Y, te, oe) {
|
|
196
196
|
var H = T.children;
|
|
197
197
|
if (H !== void 0)
|
|
198
198
|
if (Y)
|
|
@@ -236,7 +236,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
236
236
|
H,
|
|
237
237
|
O,
|
|
238
238
|
a(),
|
|
239
|
-
|
|
239
|
+
te,
|
|
240
240
|
oe
|
|
241
241
|
);
|
|
242
242
|
}
|
|
@@ -463,9 +463,9 @@ function us({
|
|
|
463
463
|
var oe;
|
|
464
464
|
const E = (oe = S.current) == null ? void 0 : oe.getBoundingClientRect();
|
|
465
465
|
if (!E) return;
|
|
466
|
-
const f = window.innerHeight, T = f - E.bottom, O = E.top,
|
|
467
|
-
_(
|
|
468
|
-
|
|
466
|
+
const f = window.innerHeight, T = f - E.bottom, O = E.top, te = T < 300 && O > T;
|
|
467
|
+
_(te ? "up" : "down"), g(
|
|
468
|
+
te ? { bottom: f - E.top + 4, left: E.left, width: E.width } : { top: E.bottom + 4, left: E.left, width: E.width }
|
|
469
469
|
);
|
|
470
470
|
};
|
|
471
471
|
P(() => {
|
|
@@ -1715,25 +1715,33 @@ const ve = Ze({ collapsed: !1, side: "left" }), we = Ze(!1), Vs = Je(function({
|
|
|
1715
1715
|
collapsed: n = !1,
|
|
1716
1716
|
side: r = "left",
|
|
1717
1717
|
onExpand: a,
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1718
|
+
onCollapse: o,
|
|
1719
|
+
className: i = "",
|
|
1720
|
+
...l
|
|
1721
|
+
}, c) {
|
|
1722
|
+
const d = [
|
|
1722
1723
|
"ds-nav-rail",
|
|
1723
1724
|
n && "ds-nav-rail--collapsed",
|
|
1724
1725
|
`ds-nav-rail--${r}`,
|
|
1725
|
-
|
|
1726
|
-
].filter(Boolean).join(" "),
|
|
1727
|
-
|
|
1728
|
-
|
|
1726
|
+
i
|
|
1727
|
+
].filter(Boolean).join(" "), u = le((p) => {
|
|
1728
|
+
if (!p.target.closest('button, a, input, select, textarea, [role="button"], [tabindex]')) {
|
|
1729
|
+
if (n && a) {
|
|
1730
|
+
a();
|
|
1731
|
+
return;
|
|
1732
|
+
}
|
|
1733
|
+
!n && o && o();
|
|
1734
|
+
}
|
|
1735
|
+
}, [n, a, o]);
|
|
1729
1736
|
return /* @__PURE__ */ e.jsx(ve.Provider, { value: { collapsed: n, side: r }, children: /* @__PURE__ */ e.jsx(
|
|
1730
1737
|
"nav",
|
|
1731
1738
|
{
|
|
1732
|
-
ref:
|
|
1733
|
-
className:
|
|
1734
|
-
onClick:
|
|
1739
|
+
ref: c,
|
|
1740
|
+
className: d,
|
|
1741
|
+
onClick: u,
|
|
1735
1742
|
"data-expandable": n && a ? "" : void 0,
|
|
1736
|
-
|
|
1743
|
+
"data-collapsible": !n && o ? "" : void 0,
|
|
1744
|
+
...l,
|
|
1737
1745
|
children: s
|
|
1738
1746
|
}
|
|
1739
1747
|
) });
|
|
@@ -2583,13 +2591,13 @@ function pn({
|
|
|
2583
2591
|
V((X) => [...X, { id: L, msg: w }]), setTimeout(() => V((X) => X.filter((J) => J.id !== L)), 6e3);
|
|
2584
2592
|
}, v = (w) => V((L) => L.filter((X) => X.id !== w)), k = (w) => w.type.startsWith("image/"), A = () => !0, U = b ?? k, G = g ?? A, E = (w) => {
|
|
2585
2593
|
const L = [], X = [], J = [], Z = [];
|
|
2586
|
-
let
|
|
2587
|
-
for (const
|
|
2588
|
-
U(
|
|
2589
|
-
return { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded:
|
|
2594
|
+
let se = 0, ue = $ != null ? $ - ((u == null ? void 0 : u.length) ?? 0) : 1 / 0;
|
|
2595
|
+
for (const ne of w)
|
|
2596
|
+
U(ne) ? _ && ne.size > _ ? J.push(ne.name) : ue > 0 ? (L.push(ne), ue--) : se++ : G(ne) ? X.push(ne) : Z.push(ne.name);
|
|
2597
|
+
return { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded: se };
|
|
2590
2598
|
}, f = (w) => {
|
|
2591
|
-
const { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded:
|
|
2592
|
-
J.length && D(`File${J.length > 1 ? "s" : ""} too large${_ ? ` (max ${_ / 1024 / 1024}MB)` : ""}: ${J.join(", ")}`), Z.length && D(`Skipped unsupported file${Z.length > 1 ? "s" : ""}: ${Z.join(", ")}`),
|
|
2599
|
+
const { imageFiles: L, docFiles: X, tooLarge: J, skipped: Z, limitExceeded: se } = E(w);
|
|
2600
|
+
J.length && D(`File${J.length > 1 ? "s" : ""} too large${_ ? ` (max ${_ / 1024 / 1024}MB)` : ""}: ${J.join(", ")}`), Z.length && D(`Skipped unsupported file${Z.length > 1 ? "s" : ""}: ${Z.join(", ")}`), se && D(`Max ${$} images per message`), h && L.length && h(L);
|
|
2593
2601
|
const ue = X.concat(h ? [] : L);
|
|
2594
2602
|
p && ue.length && p(ue);
|
|
2595
2603
|
};
|
|
@@ -2598,10 +2606,10 @@ function pn({
|
|
|
2598
2606
|
w && (w.style.height = "auto", w.style.height = `${Math.min(w.scrollHeight, 200)}px`);
|
|
2599
2607
|
}, [t]), P(() => {
|
|
2600
2608
|
const w = (L) => {
|
|
2601
|
-
var J, Z,
|
|
2609
|
+
var J, Z, se;
|
|
2602
2610
|
if (o || i) return;
|
|
2603
2611
|
const X = (J = L.target) == null ? void 0 : J.tagName;
|
|
2604
|
-
X === "INPUT" || X === "TEXTAREA" || X === "SELECT" || (Z = L.target) != null && Z.isContentEditable || L.ctrlKey || L.metaKey || L.altKey || L.key.length !== 1 && L.key !== "Backspace" && L.key !== "Delete" || (
|
|
2612
|
+
X === "INPUT" || X === "TEXTAREA" || X === "SELECT" || (Z = L.target) != null && Z.isContentEditable || L.ctrlKey || L.metaKey || L.altKey || L.key.length !== 1 && L.key !== "Backspace" && L.key !== "Delete" || (se = W.current) == null || se.focus();
|
|
2605
2613
|
};
|
|
2606
2614
|
return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
|
|
2607
2615
|
}, [o, i]);
|
|
@@ -2609,7 +2617,7 @@ function pn({
|
|
|
2609
2617
|
w.preventDefault(), z.current++, w.dataTransfer.types.includes("Files") && F(!0);
|
|
2610
2618
|
}, O = (w) => {
|
|
2611
2619
|
w.preventDefault(), z.current--, z.current === 0 && F(!1);
|
|
2612
|
-
}, Y = (w) => w.preventDefault(),
|
|
2620
|
+
}, Y = (w) => w.preventDefault(), te = (w) => {
|
|
2613
2621
|
w.preventDefault(), z.current = 0, F(!1);
|
|
2614
2622
|
const L = Array.from(w.dataTransfer.files);
|
|
2615
2623
|
L.length && f(L);
|
|
@@ -2617,9 +2625,9 @@ function pn({
|
|
|
2617
2625
|
const L = Array.from(w.target.files || []);
|
|
2618
2626
|
M.current && (M.current.value = ""), L.length && f(L);
|
|
2619
2627
|
}, H = (w) => {
|
|
2620
|
-
var
|
|
2628
|
+
var ne;
|
|
2621
2629
|
if (!h) return;
|
|
2622
|
-
const L = (
|
|
2630
|
+
const L = (ne = w.clipboardData) == null ? void 0 : ne.items;
|
|
2623
2631
|
if (!L) return;
|
|
2624
2632
|
const X = [];
|
|
2625
2633
|
for (const st of L) {
|
|
@@ -2627,8 +2635,8 @@ function pn({
|
|
|
2627
2635
|
Me && X.push(Me);
|
|
2628
2636
|
}
|
|
2629
2637
|
if (X.length === 0) return;
|
|
2630
|
-
const { imageFiles: J, tooLarge: Z, skipped:
|
|
2631
|
-
Z.length && D(`File${Z.length > 1 ? "s" : ""} too large: ${Z.join(", ")}`),
|
|
2638
|
+
const { imageFiles: J, tooLarge: Z, skipped: se, limitExceeded: ue } = E(X);
|
|
2639
|
+
Z.length && D(`File${Z.length > 1 ? "s" : ""} too large: ${Z.join(", ")}`), se.length && D(`Skipped unsupported file${se.length > 1 ? "s" : ""}: ${se.join(", ")}`), ue && D(`Max ${$} images per message`), J.length && (w.preventDefault(), h(J));
|
|
2632
2640
|
}, Q = !o && !i && !!(c != null && c.length) && t.length === 0, ie = Ht({
|
|
2633
2641
|
prompts: c ?? [],
|
|
2634
2642
|
enabled: Q
|
|
@@ -2668,7 +2676,7 @@ function pn({
|
|
|
2668
2676
|
onDragEnter: T,
|
|
2669
2677
|
onDragLeave: O,
|
|
2670
2678
|
onDragOver: Y,
|
|
2671
|
-
onDrop:
|
|
2679
|
+
onDrop: te,
|
|
2672
2680
|
children: [
|
|
2673
2681
|
j && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__drag-overlay", children: "Drop files here" }),
|
|
2674
2682
|
/* @__PURE__ */ e.jsx(
|
|
@@ -3258,8 +3266,8 @@ function as(t, s, n, r, a) {
|
|
|
3258
3266
|
default:
|
|
3259
3267
|
l = s.top + s.height / 2 - n / 2, c = s.right + a;
|
|
3260
3268
|
}
|
|
3261
|
-
const d = Math.max(ce, Math.min(o - r - ce, c));
|
|
3262
|
-
return { top:
|
|
3269
|
+
const d = Math.max(ce, Math.min(o - r - ce, c)), u = Math.max(ce, Math.min(i - n - ce, l));
|
|
3270
|
+
return { top: u, left: d, arrowOffset: c - d, arrowOffsetY: l - u };
|
|
3263
3271
|
}
|
|
3264
3272
|
function yn({
|
|
3265
3273
|
steps: t,
|
|
@@ -3284,14 +3292,15 @@ function yn({
|
|
|
3284
3292
|
if (!D || !x.current) return;
|
|
3285
3293
|
const v = ns(D.target);
|
|
3286
3294
|
if (!v) return;
|
|
3287
|
-
const k = v.getBoundingClientRect(), U = x.current.getBoundingClientRect().height || 160, G = ke, E = $.current ? es : ts, f = D.position || rs(k, U, G, E), { top: T, left: O, arrowOffset: Y } = as(f, k, U, G, E);
|
|
3295
|
+
const k = v.getBoundingClientRect(), U = x.current.getBoundingClientRect().height || 160, G = ke, E = $.current ? es : ts, f = D.position || rs(k, U, G, E), { top: T, left: O, arrowOffset: Y, arrowOffsetY: te } = as(f, k, U, G, E);
|
|
3288
3296
|
M(f), S({
|
|
3289
3297
|
position: "fixed",
|
|
3290
3298
|
top: T,
|
|
3291
3299
|
left: O,
|
|
3292
3300
|
width: ke,
|
|
3293
3301
|
visibility: "visible",
|
|
3294
|
-
"--arrow-offset": `${Y}px
|
|
3302
|
+
"--arrow-offset": `${Y}px`,
|
|
3303
|
+
"--arrow-offset-y": `${te}px`
|
|
3295
3304
|
}), z({
|
|
3296
3305
|
top: k.top - Ne,
|
|
3297
3306
|
left: k.left - Ne,
|