@spear-ai/spectral 1.4.13 → 1.4.15
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/Accordion.js +4 -4
- package/dist/Button.js +1 -1
- package/dist/Dialog.d.ts +16 -11
- package/dist/Dialog.js +68 -50
- package/dist/Drawer.js +1 -1
- package/dist/HoverCard.js +4 -4
- package/dist/Popover.js +28 -29
- package/dist/RadioGroup.js +5 -5
- package/dist/Select.js +1 -1
- package/dist/Slider.js +3 -3
- package/dist/Tooltip.js +6 -6
- package/dist/Tray.js +1 -1
- package/dist/index-BFu0M-5-.js +240 -0
- package/dist/{index-y6Br5T4h.js → index-BRDfoF8s.js} +1 -1
- package/dist/{index-7IR9qVCR.js → index-BSCg4Mei.js} +34 -35
- package/dist/{index-CVSxKOPp.js → index-CDYW5LDR.js} +1 -1
- package/dist/{index-BhufZRa2.js → index-CfypDjr2.js} +6 -6
- package/dist/index-CpUJ8sN0.js +677 -0
- package/dist/{index-B2oBi8ng.js → index-D-PVGGln.js} +1 -1
- package/dist/{index-NzygPVvJ.js → index-DMDsy0y2.js} +2 -2
- package/dist/{index-6Abv_Flm.js → index-DdOwqCfb.js} +1 -1
- package/dist/{index-UEFPWH8U.js → index-DvqEQspb.js} +7 -7
- package/dist/{index-CGALWSq_.js → index-bcth-MVh.js} +1 -1
- package/dist/index-jgQ7sgLl.js +1037 -0
- package/dist/primitives/select.js +1 -1
- package/dist/styles/main.css +1 -1
- package/package.json +2 -1
- package/dist/Combination-BtmnusWq.js +0 -480
- package/dist/Dialog/DialogBase.d.ts +0 -86
- package/dist/Dialog/DialogBase.js +0 -216
- package/dist/index-Dc8KxzeM.js +0 -1266
- package/dist/index-MZS7zxk4.js +0 -200
package/dist/index-MZS7zxk4.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import "./styles/main.css";
|
|
2
|
-
import * as v from "react";
|
|
3
|
-
import { a as D, P as W } from "./index-BhufZRa2.js";
|
|
4
|
-
import { u as P } from "./index-0ioNhtNM.js";
|
|
5
|
-
import { jsx as H } from "react/jsx-runtime";
|
|
6
|
-
var w = "focusScope.autoFocusOnMount", C = "focusScope.autoFocusOnUnmount", g = { bubbles: !1, cancelable: !0 }, j = "FocusScope", q = v.forwardRef((e, n) => {
|
|
7
|
-
const {
|
|
8
|
-
loop: t = !1,
|
|
9
|
-
trapped: r = !1,
|
|
10
|
-
onMountAutoFocus: f,
|
|
11
|
-
onUnmountAutoFocus: E,
|
|
12
|
-
...A
|
|
13
|
-
} = e, [o, N] = v.useState(null), h = P(f), y = P(E), s = v.useRef(null), a = D(n, (u) => N(u)), c = v.useRef({
|
|
14
|
-
paused: !1,
|
|
15
|
-
pause() {
|
|
16
|
-
this.paused = !0;
|
|
17
|
-
},
|
|
18
|
-
resume() {
|
|
19
|
-
this.paused = !1;
|
|
20
|
-
}
|
|
21
|
-
}).current;
|
|
22
|
-
v.useEffect(() => {
|
|
23
|
-
if (r) {
|
|
24
|
-
let u = function(l) {
|
|
25
|
-
if (c.paused || !o) return;
|
|
26
|
-
const d = l.target;
|
|
27
|
-
o.contains(d) ? s.current = d : m(s.current, { select: !0 });
|
|
28
|
-
}, p = function(l) {
|
|
29
|
-
if (c.paused || !o) return;
|
|
30
|
-
const d = l.relatedTarget;
|
|
31
|
-
d !== null && (o.contains(d) || m(s.current, { select: !0 }));
|
|
32
|
-
}, i = function(l) {
|
|
33
|
-
if (document.activeElement === document.body)
|
|
34
|
-
for (const L of l)
|
|
35
|
-
L.removedNodes.length > 0 && m(o);
|
|
36
|
-
};
|
|
37
|
-
document.addEventListener("focusin", u), document.addEventListener("focusout", p);
|
|
38
|
-
const F = new MutationObserver(i);
|
|
39
|
-
return o && F.observe(o, { childList: !0, subtree: !0 }), () => {
|
|
40
|
-
document.removeEventListener("focusin", u), document.removeEventListener("focusout", p), F.disconnect();
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}, [r, o, c.paused]), v.useEffect(() => {
|
|
44
|
-
if (o) {
|
|
45
|
-
U.add(c);
|
|
46
|
-
const u = document.activeElement;
|
|
47
|
-
if (!o.contains(u)) {
|
|
48
|
-
const i = new CustomEvent(w, g);
|
|
49
|
-
o.addEventListener(w, h), o.dispatchEvent(i), i.defaultPrevented || (G(Q(K(o)), { select: !0 }), document.activeElement === u && m(o));
|
|
50
|
-
}
|
|
51
|
-
return () => {
|
|
52
|
-
o.removeEventListener(w, h), setTimeout(() => {
|
|
53
|
-
const i = new CustomEvent(C, g);
|
|
54
|
-
o.addEventListener(C, y), o.dispatchEvent(i), i.defaultPrevented || m(u ?? document.body, { select: !0 }), o.removeEventListener(C, y), U.remove(c);
|
|
55
|
-
}, 0);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}, [o, h, y, c]);
|
|
59
|
-
const S = v.useCallback(
|
|
60
|
-
(u) => {
|
|
61
|
-
if (!t && !r || c.paused) return;
|
|
62
|
-
const p = u.key === "Tab" && !u.altKey && !u.ctrlKey && !u.metaKey, i = document.activeElement;
|
|
63
|
-
if (p && i) {
|
|
64
|
-
const F = u.currentTarget, [l, d] = V(F);
|
|
65
|
-
l && d ? !u.shiftKey && i === d ? (u.preventDefault(), t && m(l, { select: !0 })) : u.shiftKey && i === l && (u.preventDefault(), t && m(d, { select: !0 })) : i === F && u.preventDefault();
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
[t, r, c.paused]
|
|
69
|
-
);
|
|
70
|
-
return /* @__PURE__ */ H(W.div, { tabIndex: -1, ...A, ref: a, onKeyDown: S });
|
|
71
|
-
});
|
|
72
|
-
q.displayName = j;
|
|
73
|
-
function G(e, { select: n = !1 } = {}) {
|
|
74
|
-
const t = document.activeElement;
|
|
75
|
-
for (const r of e)
|
|
76
|
-
if (m(r, { select: n }), document.activeElement !== t) return;
|
|
77
|
-
}
|
|
78
|
-
function V(e) {
|
|
79
|
-
const n = K(e), t = k(n, e), r = k(n.reverse(), e);
|
|
80
|
-
return [t, r];
|
|
81
|
-
}
|
|
82
|
-
function K(e) {
|
|
83
|
-
const n = [], t = document.createTreeWalker(e, NodeFilter.SHOW_ELEMENT, {
|
|
84
|
-
acceptNode: (r) => {
|
|
85
|
-
const f = r.tagName === "INPUT" && r.type === "hidden";
|
|
86
|
-
return r.disabled || r.hidden || f ? NodeFilter.FILTER_SKIP : r.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
for (; t.nextNode(); ) n.push(t.currentNode);
|
|
90
|
-
return n;
|
|
91
|
-
}
|
|
92
|
-
function k(e, n) {
|
|
93
|
-
for (const t of e)
|
|
94
|
-
if (!B(t, { upTo: n })) return t;
|
|
95
|
-
}
|
|
96
|
-
function B(e, { upTo: n }) {
|
|
97
|
-
if (getComputedStyle(e).visibility === "hidden") return !0;
|
|
98
|
-
for (; e; ) {
|
|
99
|
-
if (n !== void 0 && e === n) return !1;
|
|
100
|
-
if (getComputedStyle(e).display === "none") return !0;
|
|
101
|
-
e = e.parentElement;
|
|
102
|
-
}
|
|
103
|
-
return !1;
|
|
104
|
-
}
|
|
105
|
-
function z(e) {
|
|
106
|
-
return e instanceof HTMLInputElement && "select" in e;
|
|
107
|
-
}
|
|
108
|
-
function m(e, { select: n = !1 } = {}) {
|
|
109
|
-
if (e && e.focus) {
|
|
110
|
-
const t = document.activeElement;
|
|
111
|
-
e.focus({ preventScroll: !0 }), e !== t && z(e) && n && e.select();
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
var U = J();
|
|
115
|
-
function J() {
|
|
116
|
-
let e = [];
|
|
117
|
-
return {
|
|
118
|
-
add(n) {
|
|
119
|
-
const t = e[0];
|
|
120
|
-
n !== t && t?.pause(), e = x(e, n), e.unshift(n);
|
|
121
|
-
},
|
|
122
|
-
remove(n) {
|
|
123
|
-
e = x(e, n), e[0]?.resume();
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
function x(e, n) {
|
|
128
|
-
const t = [...e], r = t.indexOf(n);
|
|
129
|
-
return r !== -1 && t.splice(r, 1), t;
|
|
130
|
-
}
|
|
131
|
-
function Q(e) {
|
|
132
|
-
return e.filter((n) => n.tagName !== "A");
|
|
133
|
-
}
|
|
134
|
-
var M = 0;
|
|
135
|
-
function ne() {
|
|
136
|
-
v.useEffect(() => {
|
|
137
|
-
const e = document.querySelectorAll("[data-radix-focus-guard]");
|
|
138
|
-
return document.body.insertAdjacentElement("afterbegin", e[0] ?? R()), document.body.insertAdjacentElement("beforeend", e[1] ?? R()), M++, () => {
|
|
139
|
-
M === 1 && document.querySelectorAll("[data-radix-focus-guard]").forEach((n) => n.remove()), M--;
|
|
140
|
-
};
|
|
141
|
-
}, []);
|
|
142
|
-
}
|
|
143
|
-
function R() {
|
|
144
|
-
const e = document.createElement("span");
|
|
145
|
-
return e.setAttribute("data-radix-focus-guard", ""), e.tabIndex = 0, e.style.outline = "none", e.style.opacity = "0", e.style.position = "fixed", e.style.pointerEvents = "none", e;
|
|
146
|
-
}
|
|
147
|
-
var X = function(e) {
|
|
148
|
-
if (typeof document > "u")
|
|
149
|
-
return null;
|
|
150
|
-
var n = Array.isArray(e) ? e[0] : e;
|
|
151
|
-
return n.ownerDocument.body;
|
|
152
|
-
}, b = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), O = {}, I = 0, _ = function(e) {
|
|
153
|
-
return e && (e.host || _(e.parentNode));
|
|
154
|
-
}, Y = function(e, n) {
|
|
155
|
-
return n.map(function(t) {
|
|
156
|
-
if (e.contains(t))
|
|
157
|
-
return t;
|
|
158
|
-
var r = _(t);
|
|
159
|
-
return r && e.contains(r) ? r : (console.error("aria-hidden", t, "in not contained inside", e, ". Doing nothing"), null);
|
|
160
|
-
}).filter(function(t) {
|
|
161
|
-
return !!t;
|
|
162
|
-
});
|
|
163
|
-
}, Z = function(e, n, t, r) {
|
|
164
|
-
var f = Y(n, Array.isArray(e) ? e : [e]);
|
|
165
|
-
O[t] || (O[t] = /* @__PURE__ */ new WeakMap());
|
|
166
|
-
var E = O[t], A = [], o = /* @__PURE__ */ new Set(), N = new Set(f), h = function(s) {
|
|
167
|
-
!s || o.has(s) || (o.add(s), h(s.parentNode));
|
|
168
|
-
};
|
|
169
|
-
f.forEach(h);
|
|
170
|
-
var y = function(s) {
|
|
171
|
-
!s || N.has(s) || Array.prototype.forEach.call(s.children, function(a) {
|
|
172
|
-
if (o.has(a))
|
|
173
|
-
y(a);
|
|
174
|
-
else
|
|
175
|
-
try {
|
|
176
|
-
var c = a.getAttribute(r), S = c !== null && c !== "false", u = (b.get(a) || 0) + 1, p = (E.get(a) || 0) + 1;
|
|
177
|
-
b.set(a, u), E.set(a, p), A.push(a), u === 1 && S && T.set(a, !0), p === 1 && a.setAttribute(t, "true"), S || a.setAttribute(r, "true");
|
|
178
|
-
} catch (i) {
|
|
179
|
-
console.error("aria-hidden: cannot operate on ", a, i);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
return y(n), o.clear(), I++, function() {
|
|
184
|
-
A.forEach(function(s) {
|
|
185
|
-
var a = b.get(s) - 1, c = E.get(s) - 1;
|
|
186
|
-
b.set(s, a), E.set(s, c), a || (T.has(s) || s.removeAttribute(r), T.delete(s)), c || s.removeAttribute(t);
|
|
187
|
-
}), I--, I || (b = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), O = {});
|
|
188
|
-
};
|
|
189
|
-
}, re = function(e, n, t) {
|
|
190
|
-
t === void 0 && (t = "data-aria-hidden");
|
|
191
|
-
var r = Array.from(Array.isArray(e) ? e : [e]), f = X(e);
|
|
192
|
-
return f ? (r.push.apply(r, Array.from(f.querySelectorAll("[aria-live], script"))), Z(r, f, t, "aria-hidden")) : function() {
|
|
193
|
-
return null;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
export {
|
|
197
|
-
q as F,
|
|
198
|
-
re as h,
|
|
199
|
-
ne as u
|
|
200
|
-
};
|