@spear-ai/spectral 1.4.12 → 1.4.13

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.
@@ -4,8 +4,9 @@ import i, { useMemo as Ye, useLayoutEffect as je, useEffect as qe } from "react"
4
4
  import { c as Xe, e as Ge, P as gt, a as Lt, b as mt, g as Ke, u as Je } from "./index-BhufZRa2.js";
5
5
  import { u as At } from "./index-CVSxKOPp.js";
6
6
  import { D as Ze, P as Qe } from "./index-B2oBi8ng.js";
7
- import { R as tn, h as en, u as nn, F as rn } from "./index-B-GQStVW.js";
7
+ import { h as tn, u as en, F as nn } from "./index-MZS7zxk4.js";
8
8
  import { P as Ft } from "./index-6Abv_Flm.js";
9
+ import { R as rn } from "./Combination-BtmnusWq.js";
9
10
  import { jsx as A, jsxs as Zt, Fragment as Qt } from "react/jsx-runtime";
10
11
  var Et = "Dialog", [ae] = Xe(Et), [an, q] = ae(Et), oe = (t) => {
11
12
  const {
@@ -78,7 +79,7 @@ var sn = Ge("DialogOverlay.RemoveScroll"), ln = O.forwardRef(
78
79
  return (
79
80
  // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
80
81
  // ie. when `Overlay` and `Content` are siblings
81
- /* @__PURE__ */ A(tn, { as: sn, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ A(
82
+ /* @__PURE__ */ A(rn, { as: sn, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ A(
82
83
  gt.div,
83
84
  {
84
85
  "data-state": Bt(o.open),
@@ -101,7 +102,7 @@ var un = O.forwardRef(
101
102
  const e = q(rt, t.__scopeDialog), a = O.useRef(null), o = Lt(n, e.contentRef, a);
102
103
  return O.useEffect(() => {
103
104
  const r = a.current;
104
- if (r) return en(r);
105
+ if (r) return tn(r);
105
106
  }, []), /* @__PURE__ */ A(
106
107
  fe,
107
108
  {
@@ -147,9 +148,9 @@ var un = O.forwardRef(
147
148
  ), fe = O.forwardRef(
148
149
  (t, n) => {
149
150
  const { __scopeDialog: e, trapFocus: a, onOpenAutoFocus: o, onCloseAutoFocus: r, ...c } = t, s = q(rt, e), v = O.useRef(null), E = Lt(n, v);
150
- return nn(), /* @__PURE__ */ Zt(Qt, { children: [
151
+ return en(), /* @__PURE__ */ Zt(Qt, { children: [
151
152
  /* @__PURE__ */ A(
152
- rn,
153
+ nn,
153
154
  {
154
155
  asChild: !0,
155
156
  loop: !0,
@@ -209,7 +210,7 @@ we.displayName = he;
209
210
  function Bt(t) {
210
211
  return t ? "open" : "closed";
211
212
  }
212
- var ve = "DialogTitleWarning", [rr, ye] = Ke(ve, {
213
+ var ve = "DialogTitleWarning", [ar, ye] = Ke(ve, {
213
214
  contentName: rt,
214
215
  titleName: Ht,
215
216
  docsSlug: "dialog"
@@ -1250,7 +1251,7 @@ function Gn(t) {
1250
1251
  ...a
1251
1252
  });
1252
1253
  }
1253
- const ar = {
1254
+ const or = {
1254
1255
  Root: Yn,
1255
1256
  Content: Pe,
1256
1257
  Overlay: Ae,
@@ -1261,5 +1262,5 @@ const ar = {
1261
1262
  Description: bn
1262
1263
  };
1263
1264
  export {
1264
- ar as D
1265
+ or as D
1265
1266
  };
@@ -0,0 +1,200 @@
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
+ };
@@ -61,7 +61,7 @@ import "../Icons/WarningIcon.js";
61
61
  import "../Icons/ZoomAllIcon.js";
62
62
  import "../Icons/ZoomXIcon.js";
63
63
  import "../Icons/ZoomYIcon.js";
64
- import { R as c, P as d, C as u, V as f, G as x, I as g, a as h, b as v, L as b, S as y, c as w, d as S, T as z, e as N, f as I } from "../index-CevVJ05e.js";
64
+ import { R as c, P as d, C as u, V as f, G as x, I as g, a as h, b as v, L as b, S as y, c as w, d as S, T as z, e as N, f as I } from "../index-7IR9qVCR.js";
65
65
  import { cn as o } from "../utils/twUtils.js";
66
66
  import "react";
67
67
  function At({ ...t }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spear-ai/spectral",
3
- "version": "1.4.12",
3
+ "version": "1.4.13",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "repository": {
@@ -66,6 +66,7 @@
66
66
  "lucide-react": "^0.552.0",
67
67
  "motion": "^12.23.24",
68
68
  "react-day-picker": "^9.11.1",
69
+ "react-remove-scroll": "^2.7.2",
69
70
  "react-router": "^7.9.5",
70
71
  "react-use-measure": "^2.1.7",
71
72
  "sonner": "^2.0.7",