@donkit-ai/design-system 1.4.50 → 1.4.51
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 +127 -129
- package/dist/tokens.css +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -8,7 +8,7 @@ const I = {
|
|
|
8
8
|
4: 28,
|
|
9
9
|
5: 48
|
|
10
10
|
};
|
|
11
|
-
var
|
|
11
|
+
var je = { exports: {} }, fe = {};
|
|
12
12
|
/**
|
|
13
13
|
* @license React
|
|
14
14
|
* react-jsx-runtime.production.js
|
|
@@ -76,7 +76,7 @@ function is() {
|
|
|
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 _:
|
|
80
80
|
return "Portal";
|
|
81
81
|
case T:
|
|
82
82
|
return c.displayName || "Context";
|
|
@@ -246,7 +246,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
246
246
|
function h(c) {
|
|
247
247
|
return typeof c == "object" && c !== null && c.$$typeof === b;
|
|
248
248
|
}
|
|
249
|
-
var u = U, b = Symbol.for("react.transitional.element"),
|
|
249
|
+
var u = U, b = Symbol.for("react.transitional.element"), _ = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), E = Symbol.for("react.strict_mode"), L = Symbol.for("react.profiler"), y = Symbol.for("react.consumer"), T = Symbol.for("react.context"), z = Symbol.for("react.forward_ref"), A = Symbol.for("react.suspense"), q = Symbol.for("react.suspense_list"), H = Symbol.for("react.memo"), F = Symbol.for("react.lazy"), v = Symbol.for("react.activity"), C = Symbol.for("react.client.reference"), X = u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, V = Object.prototype.hasOwnProperty, x = Array.isArray, N = console.createTask ? console.createTask : function() {
|
|
250
250
|
return null;
|
|
251
251
|
};
|
|
252
252
|
u = {
|
|
@@ -281,8 +281,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
281
281
|
};
|
|
282
282
|
}()), me;
|
|
283
283
|
}
|
|
284
|
-
process.env.NODE_ENV === "production" ?
|
|
285
|
-
var e =
|
|
284
|
+
process.env.NODE_ENV === "production" ? je.exports = os() : je.exports = is();
|
|
285
|
+
var e = je.exports;
|
|
286
286
|
function ls({ size: s = "m", color: t = "default", className: r = "", ...o }) {
|
|
287
287
|
return /* @__PURE__ */ e.jsx(
|
|
288
288
|
"span",
|
|
@@ -310,7 +310,7 @@ function ce({
|
|
|
310
310
|
className: p = "",
|
|
311
311
|
...h
|
|
312
312
|
}) {
|
|
313
|
-
const u = a && !s, b = i === "loading",
|
|
313
|
+
const u = a && !s, b = i === "loading", _ = i === "success", R = i === "error", E = b || _ || R, L = r === "xs" ? "s" : "m", y = t === "danger" ? "on-accent" : "default", T = cs[r] ?? 16, z = b ? /* @__PURE__ */ e.jsx(ls, { size: L, color: y }) : _ ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(we, { size: T, strokeWidth: 2.5 }) }) : R ? /* @__PURE__ */ e.jsx("span", { className: "ds-button__icon", "aria-hidden": "true", children: /* @__PURE__ */ e.jsx(te, { size: T, strokeWidth: 2.5 }) }) : null, A = [
|
|
314
314
|
"ds-button",
|
|
315
315
|
`ds-button--${t}`,
|
|
316
316
|
`ds-button--${r}`,
|
|
@@ -448,7 +448,7 @@ function qs({
|
|
|
448
448
|
id: d,
|
|
449
449
|
...f
|
|
450
450
|
}) {
|
|
451
|
-
const [p, h] = D(!1), [u, b] = D(!1), [
|
|
451
|
+
const [p, h] = D(!1), [u, b] = D(!1), [_, R] = D({}), [E, L] = D("down"), [y, T] = D(-1), z = k(null), A = k(null), q = k(null), H = k(null), F = d || `select-${U.useId()}`, v = `${F}-label`, C = n ? `${F}-error` : void 0, X = 150, V = (g = !1) => {
|
|
452
452
|
u || (b(!0), T(-1), H.current = setTimeout(() => {
|
|
453
453
|
var c;
|
|
454
454
|
h(!1), b(!1), g && ((c = q.current) == null || c.focus());
|
|
@@ -522,7 +522,7 @@ function qs({
|
|
|
522
522
|
`ds-select-dropdown--${E}`,
|
|
523
523
|
u && "ds-select-dropdown--closing"
|
|
524
524
|
].filter(Boolean).join(" "),
|
|
525
|
-
style:
|
|
525
|
+
style: _,
|
|
526
526
|
children: o.map((g, c) => /* @__PURE__ */ e.jsx(
|
|
527
527
|
"button",
|
|
528
528
|
{
|
|
@@ -623,14 +623,14 @@ function Hs({
|
|
|
623
623
|
"ds-stepper-wrapper",
|
|
624
624
|
l && "ds-stepper-wrapper--disabled",
|
|
625
625
|
d && "ds-stepper-wrapper--error"
|
|
626
|
-
].filter(Boolean).join(" "),
|
|
626
|
+
].filter(Boolean).join(" "), _ = [
|
|
627
627
|
"ds-stepper",
|
|
628
628
|
`ds-stepper--${i}`,
|
|
629
629
|
l && "ds-stepper--disabled"
|
|
630
630
|
].filter(Boolean).join(" "), R = i === "xs" ? I[1] : i === "small" ? I[2] : I[3];
|
|
631
631
|
return /* @__PURE__ */ e.jsxs("div", { className: b, children: [
|
|
632
632
|
s && /* @__PURE__ */ e.jsx("label", { className: "ds-stepper-label", children: s }),
|
|
633
|
-
/* @__PURE__ */ e.jsxs("div", { className:
|
|
633
|
+
/* @__PURE__ */ e.jsxs("div", { className: _, children: [
|
|
634
634
|
/* @__PURE__ */ e.jsx(
|
|
635
635
|
"button",
|
|
636
636
|
{
|
|
@@ -808,16 +808,16 @@ function st({
|
|
|
808
808
|
}, fs));
|
|
809
809
|
};
|
|
810
810
|
B(() => {
|
|
811
|
-
const
|
|
811
|
+
const _ = (E) => {
|
|
812
812
|
E.key === "Escape" && p();
|
|
813
813
|
}, R = (E) => {
|
|
814
814
|
l.current && !l.current.contains(E.target) && !E.target.closest("[data-ds-portal]") && p();
|
|
815
815
|
};
|
|
816
|
-
return document.addEventListener("keydown",
|
|
817
|
-
document.removeEventListener("keydown",
|
|
816
|
+
return document.addEventListener("keydown", _), document.addEventListener("mousedown", R), () => {
|
|
817
|
+
document.removeEventListener("keydown", _), document.removeEventListener("mousedown", R);
|
|
818
818
|
};
|
|
819
819
|
}, [r, d]);
|
|
820
|
-
const h = U.Children.toArray(s), u = h.find((
|
|
820
|
+
const h = U.Children.toArray(s), u = h.find((_) => (_ == null ? void 0 : _.type) === he), b = h.filter((_) => (_ == null ? void 0 : _.type) !== he);
|
|
821
821
|
return /* @__PURE__ */ e.jsx("div", { className: ["ds-modal-overlay", d && "ds-modal-overlay--closing"].filter(Boolean).join(" "), ...i, children: /* @__PURE__ */ e.jsxs(
|
|
822
822
|
"div",
|
|
823
823
|
{
|
|
@@ -827,20 +827,19 @@ function st({
|
|
|
827
827
|
"aria-modal": "true",
|
|
828
828
|
"aria-labelledby": t ? m : void 0,
|
|
829
829
|
children: [
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
] }),
|
|
830
|
+
r && /* @__PURE__ */ e.jsx(
|
|
831
|
+
ce,
|
|
832
|
+
{
|
|
833
|
+
className: "ds-modal__close",
|
|
834
|
+
variant: "ghost",
|
|
835
|
+
size: "small",
|
|
836
|
+
icon: /* @__PURE__ */ e.jsx(te, { size: I[2], strokeWidth: 1.5 }),
|
|
837
|
+
onClick: p,
|
|
838
|
+
"aria-label": "Close modal"
|
|
839
|
+
}
|
|
840
|
+
),
|
|
841
|
+
(t || n) && /* @__PURE__ */ e.jsxs("div", { className: "ds-modal__header", children: [
|
|
842
|
+
t && /* @__PURE__ */ e.jsx("h3", { id: m, className: "ds-modal__title", children: t }),
|
|
844
843
|
n && /* @__PURE__ */ e.jsx("div", { className: "ds-modal__subheader", children: n })
|
|
845
844
|
] }),
|
|
846
845
|
/* @__PURE__ */ e.jsx("div", { className: "ds-modal__body ds-scrollable", children: b }),
|
|
@@ -866,10 +865,10 @@ function tt({
|
|
|
866
865
|
}, ms));
|
|
867
866
|
};
|
|
868
867
|
B(() => {
|
|
869
|
-
const u = (
|
|
870
|
-
|
|
871
|
-
}, b = (
|
|
872
|
-
n.current && !n.current.contains(
|
|
868
|
+
const u = (_) => {
|
|
869
|
+
_.key === "Escape" && d();
|
|
870
|
+
}, b = (_) => {
|
|
871
|
+
n.current && !n.current.contains(_.target) && !_.target.closest("[data-ds-portal]") && d();
|
|
873
872
|
};
|
|
874
873
|
return document.addEventListener("keydown", u), document.addEventListener("mousedown", b), () => {
|
|
875
874
|
document.removeEventListener("keydown", u), document.removeEventListener("mousedown", b);
|
|
@@ -891,20 +890,19 @@ function tt({
|
|
|
891
890
|
"aria-labelledby": t ? i : void 0,
|
|
892
891
|
children: [
|
|
893
892
|
/* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__handle", "aria-hidden": "true" }),
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
] }),
|
|
893
|
+
r && /* @__PURE__ */ e.jsx(
|
|
894
|
+
ce,
|
|
895
|
+
{
|
|
896
|
+
className: "ds-bottom-sheet__close",
|
|
897
|
+
variant: "ghost",
|
|
898
|
+
size: "small",
|
|
899
|
+
icon: /* @__PURE__ */ e.jsx(te, { size: I[2], strokeWidth: 1.5 }),
|
|
900
|
+
onClick: d,
|
|
901
|
+
"aria-label": "Close"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
(t || o) && /* @__PURE__ */ e.jsxs("div", { className: "ds-bottom-sheet__header", children: [
|
|
905
|
+
t && /* @__PURE__ */ e.jsx("h3", { id: i, className: "ds-bottom-sheet__title", children: t }),
|
|
908
906
|
o && /* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__subheader", children: o })
|
|
909
907
|
] }),
|
|
910
908
|
/* @__PURE__ */ e.jsx("div", { className: "ds-bottom-sheet__body ds-scrollable", children: h }),
|
|
@@ -1029,7 +1027,7 @@ function it({ options: s, value: t, onChange: r, size: o = "m", disabled: a = !1
|
|
|
1029
1027
|
if (!n.current) return;
|
|
1030
1028
|
const u = n.current.querySelector(`[data-value="${t}"]`);
|
|
1031
1029
|
if (!u) return;
|
|
1032
|
-
const b = n.current.getBoundingClientRect(),
|
|
1030
|
+
const b = n.current.getBoundingClientRect(), _ = u.getBoundingClientRect(), R = _.left - b.left, E = _.width;
|
|
1033
1031
|
i.current ? (i.current.style.transition = d.current ? "left var(--transition-normal), width var(--transition-normal)" : "none", i.current.style.left = R + "px", i.current.style.width = E + "px", d.current = !1) : (m(!0), requestAnimationFrame(() => {
|
|
1034
1032
|
if (!i.current || !n.current) return;
|
|
1035
1033
|
const L = n.current.querySelector(`[data-value="${t}"]`);
|
|
@@ -1161,7 +1159,7 @@ function xs(s, t, r) {
|
|
|
1161
1159
|
function lt({ children: s, content: t, position: r, ...o }) {
|
|
1162
1160
|
const [a, n] = D(!1), [i, l] = D({ visibility: "hidden" }), [m, d] = D(r || "top"), f = k(null), p = k(null), h = k(!1), u = () => {
|
|
1163
1161
|
if (!f.current || !p.current) return;
|
|
1164
|
-
const
|
|
1162
|
+
const _ = f.current.getBoundingClientRect(), R = p.current.getBoundingClientRect(), E = r || xs(_, R.height, R.width), { top: L, left: y, arrowOffset: T } = hs(E, _, R);
|
|
1165
1163
|
d(E), l({
|
|
1166
1164
|
position: "fixed",
|
|
1167
1165
|
top: L,
|
|
@@ -1173,16 +1171,16 @@ function lt({ children: s, content: t, position: r, ...o }) {
|
|
|
1173
1171
|
if (B(() => {
|
|
1174
1172
|
if (!a) return;
|
|
1175
1173
|
l({ position: "fixed", visibility: "hidden" });
|
|
1176
|
-
const
|
|
1174
|
+
const _ = requestAnimationFrame(u);
|
|
1177
1175
|
return window.addEventListener("scroll", u, !0), window.addEventListener("resize", u), () => {
|
|
1178
|
-
cancelAnimationFrame(
|
|
1176
|
+
cancelAnimationFrame(_), window.removeEventListener("scroll", u, !0), window.removeEventListener("resize", u);
|
|
1179
1177
|
};
|
|
1180
1178
|
}, [a, r]), B(() => {
|
|
1181
1179
|
if (!a) return;
|
|
1182
|
-
const
|
|
1180
|
+
const _ = (R) => {
|
|
1183
1181
|
f.current && !f.current.contains(R.target) && n(!1);
|
|
1184
1182
|
};
|
|
1185
|
-
return document.addEventListener("touchstart",
|
|
1183
|
+
return document.addEventListener("touchstart", _), () => document.removeEventListener("touchstart", _);
|
|
1186
1184
|
}, [a]), !t) return s;
|
|
1187
1185
|
const b = a && /* @__PURE__ */ e.jsx(
|
|
1188
1186
|
"div",
|
|
@@ -1207,7 +1205,7 @@ function lt({ children: s, content: t, position: r, ...o }) {
|
|
|
1207
1205
|
h.current || n(!1);
|
|
1208
1206
|
},
|
|
1209
1207
|
onTouchStart: () => {
|
|
1210
|
-
h.current = !0, n((
|
|
1208
|
+
h.current = !0, n((_) => !_);
|
|
1211
1209
|
},
|
|
1212
1210
|
...o,
|
|
1213
1211
|
children: [
|
|
@@ -1332,7 +1330,7 @@ function bs({ width: s, height: t, shape: r = "rect", aspectRatio: o, className:
|
|
|
1332
1330
|
}
|
|
1333
1331
|
);
|
|
1334
1332
|
}
|
|
1335
|
-
function
|
|
1333
|
+
function _s({ lines: s = 1, lastLineWidth: t = "70%", gap: r, className: o = "", style: a = {}, ...n }) {
|
|
1336
1334
|
return /* @__PURE__ */ e.jsx(
|
|
1337
1335
|
"span",
|
|
1338
1336
|
{
|
|
@@ -1351,8 +1349,8 @@ function js({ lines: s = 1, lastLineWidth: t = "70%", gap: r, className: o = "",
|
|
|
1351
1349
|
}
|
|
1352
1350
|
);
|
|
1353
1351
|
}
|
|
1354
|
-
bs.Text =
|
|
1355
|
-
function
|
|
1352
|
+
bs.Text = _s;
|
|
1353
|
+
function js(s) {
|
|
1356
1354
|
let t = 2166136261;
|
|
1357
1355
|
for (let r = 0; r < s.length; r++)
|
|
1358
1356
|
t ^= s.charCodeAt(r), t = Math.imul(t, 16777619) >>> 0;
|
|
@@ -1364,7 +1362,7 @@ function vs(s) {
|
|
|
1364
1362
|
return t.length >= 2 ? (t[0][0] + t[1][0]).toUpperCase() : s[0].toUpperCase();
|
|
1365
1363
|
}
|
|
1366
1364
|
function ft({ seed: s, icon: t, src: r, size: o = 32, className: a = "", style: n = {}, ...i }) {
|
|
1367
|
-
const l =
|
|
1365
|
+
const l = js(s ?? ""), [m, d] = D(!1), f = t ?? /* @__PURE__ */ e.jsx("span", { className: "ds-avatar__initials", children: vs(s) });
|
|
1368
1366
|
return /* @__PURE__ */ e.jsx(
|
|
1369
1367
|
"div",
|
|
1370
1368
|
{
|
|
@@ -1434,7 +1432,7 @@ function xt({ children: s, interactive: t, selected: r, subheader: o, exiting: a
|
|
|
1434
1432
|
function bt({ children: s, colSpan: t = 999, ...r }) {
|
|
1435
1433
|
return /* @__PURE__ */ e.jsx("tr", { className: "ds-table-row ds-table-row--subheader", ...r, children: /* @__PURE__ */ e.jsx("td", { colSpan: t, children: s }) });
|
|
1436
1434
|
}
|
|
1437
|
-
function
|
|
1435
|
+
function _t({ children: s, align: t = "left", sortDir: r, onSort: o, width: a, className: n = "", style: i = {}, ...l }) {
|
|
1438
1436
|
const m = !!o || r !== void 0, d = r === "asc" ? He : r === "desc" ? xe : Ke;
|
|
1439
1437
|
return /* @__PURE__ */ e.jsx(
|
|
1440
1438
|
"th",
|
|
@@ -1456,7 +1454,7 @@ function jt({ children: s, align: t = "left", sortDir: r, onSort: o, width: a, c
|
|
|
1456
1454
|
}
|
|
1457
1455
|
);
|
|
1458
1456
|
}
|
|
1459
|
-
function
|
|
1457
|
+
function jt({ children: s, align: t = "left", secondary: r, muted: o, truncate: a, nowrap: n, className: i = "", ...l }) {
|
|
1460
1458
|
return /* @__PURE__ */ e.jsx(
|
|
1461
1459
|
"td",
|
|
1462
1460
|
{
|
|
@@ -1649,10 +1647,10 @@ function kt({
|
|
|
1649
1647
|
}, ws));
|
|
1650
1648
|
};
|
|
1651
1649
|
B(() => {
|
|
1652
|
-
const u = (
|
|
1653
|
-
|
|
1654
|
-
}, b = (
|
|
1655
|
-
n.current && !n.current.contains(
|
|
1650
|
+
const u = (_) => {
|
|
1651
|
+
_.key === "Escape" && d();
|
|
1652
|
+
}, b = (_) => {
|
|
1653
|
+
n.current && !n.current.contains(_.target) && !_.target.closest("[data-ds-portal]") && d();
|
|
1656
1654
|
};
|
|
1657
1655
|
return document.addEventListener("keydown", u), document.addEventListener("mousedown", b), () => {
|
|
1658
1656
|
document.removeEventListener("keydown", u), document.removeEventListener("mousedown", b);
|
|
@@ -1747,7 +1745,7 @@ function $t({
|
|
|
1747
1745
|
style: i,
|
|
1748
1746
|
...l
|
|
1749
1747
|
}) {
|
|
1750
|
-
const [m, d] = D(!1), [f, p] = D(!1), h = r !== void 0, u = h ? r : m, b = k(null),
|
|
1748
|
+
const [m, d] = D(!1), [f, p] = D(!1), h = r !== void 0, u = h ? r : m, b = k(null), _ = k(null), R = k(null), E = k(null), [L, y] = D({}), T = k(null), z = 150, A = () => {
|
|
1751
1749
|
if (h)
|
|
1752
1750
|
o == null || o(!1);
|
|
1753
1751
|
else {
|
|
@@ -1788,7 +1786,7 @@ function $t({
|
|
|
1788
1786
|
if (!u) return;
|
|
1789
1787
|
const x = ($) => {
|
|
1790
1788
|
var M, K;
|
|
1791
|
-
!((M = b.current) != null && M.contains($.target)) && !((K =
|
|
1789
|
+
!((M = b.current) != null && M.contains($.target)) && !((K = _.current) != null && K.contains($.target)) && A();
|
|
1792
1790
|
}, N = ($) => {
|
|
1793
1791
|
$.key === "Escape" && (A(), F());
|
|
1794
1792
|
};
|
|
@@ -1796,11 +1794,11 @@ function $t({
|
|
|
1796
1794
|
document.removeEventListener("mousedown", x), document.removeEventListener("keydown", N);
|
|
1797
1795
|
};
|
|
1798
1796
|
}, [u]), B(() => {
|
|
1799
|
-
if (!u || !E.current || !
|
|
1797
|
+
if (!u || !E.current || !_.current) return;
|
|
1800
1798
|
const x = v(), N = E.current === "last" ? x[x.length - 1] : x[0];
|
|
1801
1799
|
N == null || N.focus(), E.current = null;
|
|
1802
1800
|
}, [u]);
|
|
1803
|
-
const v = () =>
|
|
1801
|
+
const v = () => _.current ? [..._.current.querySelectorAll(
|
|
1804
1802
|
'button:not([disabled]), a[href]:not([aria-disabled="true"]), [tabindex]:not([tabindex="-1"])'
|
|
1805
1803
|
)] : [], C = (x) => {
|
|
1806
1804
|
var N, $;
|
|
@@ -1836,7 +1834,7 @@ function $t({
|
|
|
1836
1834
|
}, V = u && /* @__PURE__ */ e.jsx(
|
|
1837
1835
|
"div",
|
|
1838
1836
|
{
|
|
1839
|
-
ref:
|
|
1837
|
+
ref: _,
|
|
1840
1838
|
role: "menu",
|
|
1841
1839
|
"data-ds-portal": "",
|
|
1842
1840
|
className: [
|
|
@@ -2268,7 +2266,7 @@ function As({
|
|
|
2268
2266
|
betweenTime: n = 380,
|
|
2269
2267
|
manualPauseMs: i = 5e3
|
|
2270
2268
|
}) {
|
|
2271
|
-
const [l, m] = D(0), [d, f] = D(""), p = k("typing"), h = k(0), u = k(0), b = k(null),
|
|
2269
|
+
const [l, m] = D(0), [d, f] = D(""), p = k("typing"), h = k(0), u = k(0), b = k(null), _ = k(0);
|
|
2272
2270
|
B(() => {
|
|
2273
2271
|
u.current = l;
|
|
2274
2272
|
}, [l]), B(() => {
|
|
@@ -2278,8 +2276,8 @@ function As({
|
|
|
2278
2276
|
}
|
|
2279
2277
|
const T = () => {
|
|
2280
2278
|
const z = Date.now();
|
|
2281
|
-
if (
|
|
2282
|
-
b.current = setTimeout(T,
|
|
2279
|
+
if (_.current > z) {
|
|
2280
|
+
b.current = setTimeout(T, _.current - z);
|
|
2283
2281
|
return;
|
|
2284
2282
|
}
|
|
2285
2283
|
const A = s[u.current % s.length] ?? "";
|
|
@@ -2292,7 +2290,7 @@ function As({
|
|
|
2292
2290
|
const R = (T) => {
|
|
2293
2291
|
if (s.length === 0) return;
|
|
2294
2292
|
const z = (T % s.length + s.length) % s.length, A = s[z];
|
|
2295
|
-
u.current = z, h.current = A.length, p.current = "holding",
|
|
2293
|
+
u.current = z, h.current = A.length, p.current = "holding", _.current = Date.now() + i, m(z), f(A);
|
|
2296
2294
|
}, E = () => R(u.current + 1), L = () => R(u.current - 1), y = s[l % s.length] ?? "";
|
|
2297
2295
|
return { displayed: d, currentPrompt: y, index: l, next: E, prev: L };
|
|
2298
2296
|
}
|
|
@@ -2313,7 +2311,7 @@ function Ot({
|
|
|
2313
2311
|
onAttachImages: h,
|
|
2314
2312
|
onRemoveAttachment: u,
|
|
2315
2313
|
onRemoveImage: b,
|
|
2316
|
-
acceptImage:
|
|
2314
|
+
acceptImage: _,
|
|
2317
2315
|
acceptFile: R,
|
|
2318
2316
|
maxImages: E,
|
|
2319
2317
|
maxImageSize: L,
|
|
@@ -2322,48 +2320,48 @@ function Ot({
|
|
|
2322
2320
|
className: z = "",
|
|
2323
2321
|
...A
|
|
2324
2322
|
}) {
|
|
2325
|
-
const q = k(null), H = k(null), F = k(0), [v, C] = D(!1), [X, V] = D([]), x = (
|
|
2323
|
+
const q = k(null), H = k(null), F = k(0), [v, C] = D(!1), [X, V] = D([]), x = (j) => {
|
|
2326
2324
|
const S = ++Bs;
|
|
2327
|
-
V((Y) => [...Y, { id: S, msg:
|
|
2328
|
-
}, N = (
|
|
2325
|
+
V((Y) => [...Y, { id: S, msg: j }]), setTimeout(() => V((Y) => Y.filter((J) => J.id !== S)), 6e3);
|
|
2326
|
+
}, N = (j) => V((S) => S.filter((Y) => Y.id !== j)), $ = (j) => j.type.startsWith("image/"), M = () => !0, K = _ ?? $, G = R ?? M, g = (j) => {
|
|
2329
2327
|
const S = [], Y = [], J = [], Z = [];
|
|
2330
2328
|
let ee = 0, ie = E != null ? E - ((f == null ? void 0 : f.length) ?? 0) : 1 / 0;
|
|
2331
|
-
for (const se of
|
|
2329
|
+
for (const se of j)
|
|
2332
2330
|
K(se) ? L && se.size > L ? J.push(se.name) : ie > 0 ? (S.push(se), ie--) : ee++ : G(se) ? Y.push(se) : Z.push(se.name);
|
|
2333
2331
|
return { imageFiles: S, docFiles: Y, tooLarge: J, skipped: Z, limitExceeded: ee };
|
|
2334
|
-
}, c = (
|
|
2335
|
-
const { imageFiles: S, docFiles: Y, tooLarge: J, skipped: Z, limitExceeded: ee } = g(
|
|
2332
|
+
}, c = (j) => {
|
|
2333
|
+
const { imageFiles: S, docFiles: Y, tooLarge: J, skipped: Z, limitExceeded: ee } = g(j);
|
|
2336
2334
|
J.length && x(`File${J.length > 1 ? "s" : ""} too large${L ? ` (max ${L / 1024 / 1024}MB)` : ""}: ${J.join(", ")}`), Z.length && x(`Skipped unsupported file${Z.length > 1 ? "s" : ""}: ${Z.join(", ")}`), ee && x(`Max ${E} images per message`), h && S.length && h(S);
|
|
2337
2335
|
const ie = Y.concat(h ? [] : S);
|
|
2338
2336
|
p && ie.length && p(ie);
|
|
2339
2337
|
};
|
|
2340
2338
|
B(() => {
|
|
2341
|
-
const
|
|
2342
|
-
|
|
2339
|
+
const j = H.current;
|
|
2340
|
+
j && (j.style.height = "auto", j.style.height = `${Math.min(j.scrollHeight, 200)}px`);
|
|
2343
2341
|
}, [s]), B(() => {
|
|
2344
|
-
const
|
|
2342
|
+
const j = (S) => {
|
|
2345
2343
|
var J, Z, ee;
|
|
2346
2344
|
if (n || i) return;
|
|
2347
2345
|
const Y = (J = S.target) == null ? void 0 : J.tagName;
|
|
2348
2346
|
Y === "INPUT" || Y === "TEXTAREA" || Y === "SELECT" || (Z = S.target) != null && Z.isContentEditable || S.ctrlKey || S.metaKey || S.altKey || S.key.length !== 1 && S.key !== "Backspace" && S.key !== "Delete" || (ee = H.current) == null || ee.focus();
|
|
2349
2347
|
};
|
|
2350
|
-
return document.addEventListener("keydown",
|
|
2348
|
+
return document.addEventListener("keydown", j), () => document.removeEventListener("keydown", j);
|
|
2351
2349
|
}, [n, i]);
|
|
2352
|
-
const w = (
|
|
2353
|
-
|
|
2354
|
-
}, P = (
|
|
2355
|
-
|
|
2356
|
-
}, O = (
|
|
2357
|
-
|
|
2358
|
-
const S = Array.from(
|
|
2350
|
+
const w = (j) => {
|
|
2351
|
+
j.preventDefault(), F.current++, j.dataTransfer.types.includes("Files") && C(!0);
|
|
2352
|
+
}, P = (j) => {
|
|
2353
|
+
j.preventDefault(), F.current--, F.current === 0 && C(!1);
|
|
2354
|
+
}, O = (j) => j.preventDefault(), re = (j) => {
|
|
2355
|
+
j.preventDefault(), F.current = 0, C(!1);
|
|
2356
|
+
const S = Array.from(j.dataTransfer.files);
|
|
2359
2357
|
S.length && c(S);
|
|
2360
|
-
}, ae = (
|
|
2361
|
-
const S = Array.from(
|
|
2358
|
+
}, ae = (j) => {
|
|
2359
|
+
const S = Array.from(j.target.files || []);
|
|
2362
2360
|
q.current && (q.current.value = ""), S.length && c(S);
|
|
2363
|
-
}, W = (
|
|
2361
|
+
}, W = (j) => {
|
|
2364
2362
|
var se;
|
|
2365
2363
|
if (!h) return;
|
|
2366
|
-
const S = (se =
|
|
2364
|
+
const S = (se = j.clipboardData) == null ? void 0 : se.items;
|
|
2367
2365
|
if (!S) return;
|
|
2368
2366
|
const Y = [];
|
|
2369
2367
|
for (const Ue of S) {
|
|
@@ -2372,26 +2370,26 @@ function Ot({
|
|
|
2372
2370
|
}
|
|
2373
2371
|
if (Y.length === 0) return;
|
|
2374
2372
|
const { imageFiles: J, tooLarge: Z, skipped: ee, limitExceeded: ie } = g(Y);
|
|
2375
|
-
Z.length && x(`File${Z.length > 1 ? "s" : ""} too large: ${Z.join(", ")}`), ee.length && x(`Skipped unsupported file${ee.length > 1 ? "s" : ""}: ${ee.join(", ")}`), ie && x(`Max ${E} images per message`), J.length && (
|
|
2373
|
+
Z.length && x(`File${Z.length > 1 ? "s" : ""} too large: ${Z.join(", ")}`), ee.length && x(`Skipped unsupported file${ee.length > 1 ? "s" : ""}: ${ee.join(", ")}`), ie && x(`Max ${E} images per message`), J.length && (j.preventDefault(), h(J));
|
|
2376
2374
|
}, Q = !n && !i && !!(m != null && m.length) && s.length === 0, oe = As({
|
|
2377
2375
|
prompts: m ?? [],
|
|
2378
2376
|
enabled: Q
|
|
2379
|
-
}), be = (
|
|
2377
|
+
}), be = (j) => {
|
|
2380
2378
|
if (Q) {
|
|
2381
|
-
if (
|
|
2382
|
-
|
|
2379
|
+
if (j.key === "ArrowDown" || j.key === "ArrowRight") {
|
|
2380
|
+
j.preventDefault(), oe.next();
|
|
2383
2381
|
return;
|
|
2384
2382
|
}
|
|
2385
|
-
if (
|
|
2386
|
-
|
|
2383
|
+
if (j.key === "ArrowUp" || j.key === "ArrowLeft") {
|
|
2384
|
+
j.preventDefault(), oe.prev();
|
|
2387
2385
|
return;
|
|
2388
2386
|
}
|
|
2389
|
-
if (
|
|
2390
|
-
|
|
2387
|
+
if (j.key === "Tab" && !j.shiftKey) {
|
|
2388
|
+
j.preventDefault(), t == null || t(oe.currentPrompt);
|
|
2391
2389
|
return;
|
|
2392
2390
|
}
|
|
2393
2391
|
}
|
|
2394
|
-
a == null || a(
|
|
2392
|
+
a == null || a(j);
|
|
2395
2393
|
}, Ce = (s.trim() || (f == null ? void 0 : f.length) > 0 || (d == null ? void 0 : d.length) > 0) && !i, Te = p || h;
|
|
2396
2394
|
return /* @__PURE__ */ e.jsxs("div", { className: ["ds-prompt-input", z].filter(Boolean).join(" "), ...A, children: [
|
|
2397
2395
|
Te && /* @__PURE__ */ e.jsx(
|
|
@@ -2420,7 +2418,7 @@ function Ot({
|
|
|
2420
2418
|
{
|
|
2421
2419
|
ref: H,
|
|
2422
2420
|
value: s,
|
|
2423
|
-
onChange: (
|
|
2421
|
+
onChange: (j) => t == null ? void 0 : t(j.target.value),
|
|
2424
2422
|
onKeyDown: be,
|
|
2425
2423
|
onPaste: W,
|
|
2426
2424
|
placeholder: Q ? "" : l,
|
|
@@ -2433,8 +2431,8 @@ function Ot({
|
|
|
2433
2431
|
/* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__anim-text", children: oe.displayed }),
|
|
2434
2432
|
/* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__anim-cursor" })
|
|
2435
2433
|
] }),
|
|
2436
|
-
f && f.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__images", children: f.map((
|
|
2437
|
-
/* @__PURE__ */ e.jsx("img", { src:
|
|
2434
|
+
f && f.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__images", children: f.map((j, S) => /* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__image-thumb", children: [
|
|
2435
|
+
/* @__PURE__ */ e.jsx("img", { src: j.preview, alt: "" }),
|
|
2438
2436
|
/* @__PURE__ */ e.jsx(
|
|
2439
2437
|
"button",
|
|
2440
2438
|
{
|
|
@@ -2446,23 +2444,23 @@ function Ot({
|
|
|
2446
2444
|
}
|
|
2447
2445
|
)
|
|
2448
2446
|
] }, S)) }),
|
|
2449
|
-
X.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__warnings", children: X.map((
|
|
2450
|
-
/* @__PURE__ */ e.jsx("span", { children:
|
|
2447
|
+
X.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__warnings", children: X.map((j) => /* @__PURE__ */ e.jsxs("div", { className: "ds-prompt-input__warning", role: "alert", children: [
|
|
2448
|
+
/* @__PURE__ */ e.jsx("span", { children: j.msg }),
|
|
2451
2449
|
/* @__PURE__ */ e.jsx(
|
|
2452
2450
|
"button",
|
|
2453
2451
|
{
|
|
2454
2452
|
type: "button",
|
|
2455
2453
|
className: "ds-prompt-input__warning-close",
|
|
2456
|
-
onClick: () => N(
|
|
2454
|
+
onClick: () => N(j.id),
|
|
2457
2455
|
"aria-label": "Dismiss",
|
|
2458
2456
|
children: /* @__PURE__ */ e.jsx(te, { size: I[1], strokeWidth: 1.5 })
|
|
2459
2457
|
}
|
|
2460
2458
|
)
|
|
2461
|
-
] },
|
|
2462
|
-
d && d.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__attachments", children: d.map((
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2459
|
+
] }, j.id)) }),
|
|
2460
|
+
d && d.length > 0 && /* @__PURE__ */ e.jsx("div", { className: "ds-prompt-input__attachments", children: d.map((j, S) => /* @__PURE__ */ e.jsx(de, { size: "xs", children: /* @__PURE__ */ e.jsxs("span", { className: "ds-prompt-input__badge-content", children: [
|
|
2461
|
+
j.uploading ? /* @__PURE__ */ e.jsx(Qe, { size: I[1], strokeWidth: 1.5, className: "spin" }) : /* @__PURE__ */ e.jsx(Se, { size: I[1], strokeWidth: 1.5 }),
|
|
2462
|
+
j.filename,
|
|
2463
|
+
j.uploading ? /* @__PURE__ */ e.jsx("span", { className: "ds-prompt-input__uploading", children: "Uploading..." }) : /* @__PURE__ */ e.jsx(
|
|
2466
2464
|
"button",
|
|
2467
2465
|
{
|
|
2468
2466
|
type: "button",
|
|
@@ -2481,8 +2479,8 @@ function Ot({
|
|
|
2481
2479
|
icon: /* @__PURE__ */ e.jsx(Se, { size: I[2], strokeWidth: 1.5 }),
|
|
2482
2480
|
"aria-label": "Attach files",
|
|
2483
2481
|
onClick: () => {
|
|
2484
|
-
var
|
|
2485
|
-
return (
|
|
2482
|
+
var j;
|
|
2483
|
+
return (j = q.current) == null ? void 0 : j.click();
|
|
2486
2484
|
}
|
|
2487
2485
|
}
|
|
2488
2486
|
),
|
|
@@ -2527,7 +2525,7 @@ function Ft({
|
|
|
2527
2525
|
className: l = "",
|
|
2528
2526
|
...m
|
|
2529
2527
|
}) {
|
|
2530
|
-
const [d, f] = D(!1), p = k(null), h = k(null), u = k(null), [b,
|
|
2528
|
+
const [d, f] = D(!1), p = k(null), h = k(null), u = k(null), [b, _] = D({}), R = s.filter((v) => !a || v.name === "auto" ? !0 : (Me[v.tier] ?? 1) >= (Me[a] ?? 1)), E = R.find((v) => v.name === "auto"), L = R.filter((v) => v.name !== "auto"), y = s.find((v) => v.name === t), z = new Set(L.map((v) => v.tier).filter(Boolean)).size > 1;
|
|
2531
2529
|
B(() => {
|
|
2532
2530
|
if (!d) return;
|
|
2533
2531
|
const v = 320, C = () => {
|
|
@@ -2535,7 +2533,7 @@ function Ft({
|
|
|
2535
2533
|
const x = (M = h.current) == null ? void 0 : M.getBoundingClientRect();
|
|
2536
2534
|
if (!x) return;
|
|
2537
2535
|
const N = window.innerHeight - x.bottom, $ = N < v + 8 && x.top > N;
|
|
2538
|
-
|
|
2536
|
+
_({
|
|
2539
2537
|
position: "fixed",
|
|
2540
2538
|
zIndex: "var(--z-dropdown, 500)",
|
|
2541
2539
|
left: x.left,
|
|
@@ -2650,7 +2648,7 @@ function Wt({
|
|
|
2650
2648
|
const [n, i] = D(!1), l = Ms(s), m = l.length > o, d = n ? l : l.slice(0, o), f = s.some((h) => h.snippet), p = ["ds-sources-panel", t === "compact" && "ds-sources-panel--compact"].filter(Boolean).join(" ");
|
|
2651
2649
|
return t === "compact" ? /* @__PURE__ */ e.jsxs("div", { className: p, children: [
|
|
2652
2650
|
d.map((h) => {
|
|
2653
|
-
const u = h.items.map((
|
|
2651
|
+
const u = h.items.map((_) => _.page).filter(Boolean), b = !!a;
|
|
2654
2652
|
return /* @__PURE__ */ e.jsxs(
|
|
2655
2653
|
"div",
|
|
2656
2654
|
{
|
|
@@ -2673,18 +2671,18 @@ function Wt({
|
|
|
2673
2671
|
] }) : /* @__PURE__ */ e.jsxs("div", { className: p, children: [
|
|
2674
2672
|
r && /* @__PURE__ */ e.jsx("div", { className: "ds-sources-panel__title", children: r }),
|
|
2675
2673
|
d.map((h) => {
|
|
2676
|
-
const u = h.items.map((
|
|
2674
|
+
const u = h.items.map((_) => _.page).filter(Boolean), b = !!a;
|
|
2677
2675
|
return f ? /* @__PURE__ */ e.jsx(
|
|
2678
2676
|
$e,
|
|
2679
2677
|
{
|
|
2680
2678
|
title: /* @__PURE__ */ e.jsx(Ls, { filename: h.filename, pages: u }),
|
|
2681
2679
|
padding: "s",
|
|
2682
|
-
children: h.items.map((
|
|
2680
|
+
children: h.items.map((_, R) => /* @__PURE__ */ e.jsx(
|
|
2683
2681
|
"div",
|
|
2684
2682
|
{
|
|
2685
2683
|
className: `ds-sources-panel__snippet${b ? " ds-sources-panel__snippet--clickable" : ""}`,
|
|
2686
|
-
onClick: b ? () => a(
|
|
2687
|
-
children:
|
|
2684
|
+
onClick: b ? () => a(_) : void 0,
|
|
2685
|
+
children: _.snippet ?? `p. ${_.page}`
|
|
2688
2686
|
},
|
|
2689
2687
|
R
|
|
2690
2688
|
))
|
|
@@ -2782,7 +2780,7 @@ function Ut({
|
|
|
2782
2780
|
] });
|
|
2783
2781
|
}
|
|
2784
2782
|
const zs = { add: "+", remove: "-", context: " " };
|
|
2785
|
-
function
|
|
2783
|
+
function _e({ line: s, lineNumbers: t }) {
|
|
2786
2784
|
return /* @__PURE__ */ e.jsxs("div", { className: `ds-diff-view__line ds-diff-view__line--${s.type}`, children: [
|
|
2787
2785
|
t && s.lineNo != null && /* @__PURE__ */ e.jsx("span", { className: "ds-diff-view__lineno", children: s.lineNo }),
|
|
2788
2786
|
/* @__PURE__ */ e.jsx("span", { className: "ds-diff-view__prefix", children: zs[s.type] }),
|
|
@@ -2807,14 +2805,14 @@ function Vt({
|
|
|
2807
2805
|
return /* @__PURE__ */ e.jsxs("div", { className: i, children: [
|
|
2808
2806
|
n && /* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__title", children: n }),
|
|
2809
2807
|
/* @__PURE__ */ e.jsxs("div", { className: "ds-diff-view__body ds-scrollable", style: l, children: [
|
|
2810
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: m.map((f, p) => /* @__PURE__ */ e.jsx(
|
|
2811
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: d.map((f, p) => /* @__PURE__ */ e.jsx(
|
|
2808
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: m.map((f, p) => /* @__PURE__ */ e.jsx(_e, { line: f, lineNumbers: o }, p)) }),
|
|
2809
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__split-col ds-scrollable", children: d.map((f, p) => /* @__PURE__ */ e.jsx(_e, { line: f, lineNumbers: o }, p)) })
|
|
2812
2810
|
] })
|
|
2813
2811
|
] });
|
|
2814
2812
|
}
|
|
2815
2813
|
return /* @__PURE__ */ e.jsxs("div", { className: i, children: [
|
|
2816
2814
|
n && /* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__title", children: n }),
|
|
2817
|
-
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__body ds-scrollable", style: l, children: s.map((m, d) => /* @__PURE__ */ e.jsx(
|
|
2815
|
+
/* @__PURE__ */ e.jsx("div", { className: "ds-diff-view__body ds-scrollable", style: l, children: s.map((m, d) => /* @__PURE__ */ e.jsx(_e, { line: m, lineNumbers: o }, d)) })
|
|
2818
2816
|
] });
|
|
2819
2817
|
}
|
|
2820
2818
|
function Os({
|
|
@@ -3035,9 +3033,9 @@ export {
|
|
|
3035
3033
|
xt as TableRow,
|
|
3036
3034
|
bt as TableSubheaderRow,
|
|
3037
3035
|
at as Tabs,
|
|
3038
|
-
|
|
3036
|
+
jt as Td,
|
|
3039
3037
|
Ys as Textarea,
|
|
3040
|
-
|
|
3038
|
+
_t as Th,
|
|
3041
3039
|
qt as ThinkingDot,
|
|
3042
3040
|
It as ToastContainer,
|
|
3043
3041
|
ct as Toggle,
|