@spear-ai/spectral 1.4.3 → 1.4.5

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.
@@ -24,7 +24,7 @@ const E = M(null), C = (I = "Tabs") => {
24
24
  disabled: l,
25
25
  baseId: d
26
26
  };
27
- return /* @__PURE__ */ x(E.Provider, { value: r, children: /* @__PURE__ */ x("div", { ref: c, "data-testid": "spectral-tabs-root", "data-orientation": o, "data-disabled": l ? "" : void 0, dir: b, ...s, children: e }) });
27
+ return /* @__PURE__ */ x(E.Provider, { value: r, children: /* @__PURE__ */ x("div", { ref: c, "data-testid": "spectral-tabs", "data-orientation": o, "data-disabled": l ? "" : void 0, dir: b, ...s, children: e }) });
28
28
  }), H = z(function({ className: u, loop: e = !0, ...h }, b) {
29
29
  const { orientation: l, disabled: f } = C("TabsList"), [o, v] = D(() => ({
30
30
  left: 0,
@@ -117,22 +117,22 @@ const E = M(null), C = (I = "Tabs") => {
117
117
  return /* @__PURE__ */ x(
118
118
  "button",
119
119
  {
120
- ref: o,
121
- role: "tab",
122
- type: "button",
123
- "data-testid": "spectral-tabs-trigger",
124
- id: d,
125
120
  "aria-controls": a,
126
- "aria-selected": t,
127
121
  "aria-disabled": n,
128
- disabled: n,
129
- "data-state": t ? "active" : "inactive",
130
- "data-disabled": n ? "" : void 0,
131
- tabIndex: t ? 0 : -1,
122
+ "aria-selected": t,
132
123
  className: y("tabs-trigger z-10 focus:outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-600", u),
124
+ "data-disabled": n ? "" : void 0,
125
+ "data-state": t ? "active" : "inactive",
126
+ "data-testid": "spectral-tabs-trigger",
127
+ disabled: n,
128
+ id: d,
133
129
  onClick: r,
134
- onKeyDown: p,
135
130
  onFocus: A,
131
+ onKeyDown: p,
132
+ ref: o,
133
+ role: "tab",
134
+ tabIndex: t ? 0 : -1,
135
+ type: "button",
136
136
  ...f
137
137
  }
138
138
  );
@@ -141,15 +141,15 @@ const E = M(null), C = (I = "Tabs") => {
141
141
  return !h && !c ? null : /* @__PURE__ */ x(
142
142
  "div",
143
143
  {
144
- ref: l,
145
- role: "tabpanel",
146
- "data-testid": "spectral-tabs-content",
147
- id: v,
148
144
  "aria-labelledby": s,
149
- "data-state": c ? "active" : "inactive",
150
- tabIndex: 0,
151
145
  className: y("tabs-content focus:outline-none focus-visible:outline-none", u),
146
+ "data-state": c ? "active" : "inactive",
147
+ "data-testid": "spectral-tabs-content",
152
148
  hidden: !c,
149
+ id: v,
150
+ ref: l,
151
+ role: "tabpanel",
152
+ tabIndex: 0,
153
153
  ...b
154
154
  }
155
155
  );
@@ -1,5 +1,5 @@
1
1
  import "react";
2
- const u = (e) => {
2
+ const s = (e) => {
3
3
  const n = {
4
4
  left: 0,
5
5
  top: 0,
@@ -9,18 +9,18 @@ const u = (e) => {
9
9
  isEnclosed: !1
10
10
  };
11
11
  if (!e.current) return n;
12
- const t = e.current.querySelector("[data-state='active']"), o = e.current.closest("[data-orientation]")?.getAttribute("data-orientation") ?? "horizontal", r = e.current.closest(".enclosed") !== null;
13
- if (!t) return { ...n, orientation: o, isEnclosed: r };
14
- const i = t.getBoundingClientRect(), a = e.current.getBoundingClientRect();
12
+ const t = e.current.querySelector("[data-state='active']"), r = e.current.closest("[data-orientation]")?.getAttribute("data-orientation") ?? "horizontal", o = e.current.closest(".enclosed") !== null;
13
+ if (!t) return { ...n, orientation: r, isEnclosed: o };
14
+ const a = t.getBoundingClientRect(), i = e.current.getBoundingClientRect();
15
15
  return {
16
- left: i.left - a.left,
17
- top: i.top - a.top,
18
- width: i.width,
19
- height: i.height,
20
- orientation: o,
21
- isEnclosed: r
16
+ left: a.left - i.left,
17
+ top: a.top - i.top,
18
+ width: a.width,
19
+ height: a.height,
20
+ orientation: r,
21
+ isEnclosed: o
22
22
  };
23
- }, l = (e) => e.orientation === "horizontal" ? {
23
+ }, u = (e) => e.orientation === "horizontal" ? {
24
24
  left: `${e.left}px`,
25
25
  width: `${e.width}px`
26
26
  } : {
@@ -28,9 +28,9 @@ const u = (e) => {
28
28
  height: `${e.height}px`
29
29
  }, d = (e, n) => {
30
30
  let t = null;
31
- return (...o) => {
31
+ return (...r) => {
32
32
  t !== null && clearTimeout(t), t = setTimeout(() => {
33
- e(...o);
33
+ e(...r);
34
34
  }, n);
35
35
  };
36
36
  }, f = () => {
@@ -40,32 +40,33 @@ const u = (e) => {
40
40
  } catch {
41
41
  return !1;
42
42
  }
43
- }, p = (e = "tabs") => typeof crypto < "u" && crypto.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Math.random().toString(36).substring(2, 11)}-${Date.now().toString(36)}`, c = (e, n) => {
43
+ }, h = (e = "tabs") => typeof crypto < "u" && crypto.randomUUID ? `${e}-${crypto.randomUUID()}` : `${e}-${Math.random().toString(36).substring(2, 11)}-${Date.now().toString(36)}`, c = (e, n) => {
44
44
  if (typeof e != "object" || e === null)
45
- return process.env.NODE_ENV !== "production" && console.warn(`Tabs: Tab at index ${n} must be an object, received: ${typeof e}`), !1;
45
+ return console.warn(`Tabs: Tab at index ${n} must be an object, received: ${typeof e}`), !1;
46
46
  const t = e;
47
- return !("key" in t) || typeof t.key != "string" || t.key.length === 0 ? (process.env.NODE_ENV !== "production" && console.warn(`Tabs: Tab at index ${n} must have a non-empty string 'key' property`), !1) : "label" in t ? "children" in t ? !0 : (process.env.NODE_ENV !== "production" && console.warn(`Tabs: Tab at index ${n} must have a 'children' property`), !1) : (process.env.NODE_ENV !== "production" && console.warn(`Tabs: Tab at index ${n} must have a 'label' property`), !1);
48
- }, h = (e) => {
47
+ return !("key" in t) || typeof t.key != "string" || t.key.length === 0 ? (console.warn(`Tabs: Tab at index ${n} must have a non-empty string 'key' property`), !1) : "label" in t ? "children" in t ? !0 : (console.warn(`Tabs: Tab at index ${n} must have a 'children' property`), !1) : (console.warn(`Tabs: Tab at index ${n} must have a 'label' property`), !1);
48
+ }, p = (e) => {
49
49
  if (!Array.isArray(e) || e.length === 0)
50
- return process.env.NODE_ENV !== "production" && console.warn("Tabs: tabValues must be a non-empty array"), !1;
50
+ return console.warn("Tabs: tabValues must be a non-empty array"), !1;
51
51
  const n = /* @__PURE__ */ new Set();
52
- for (const [t, o] of e.entries()) {
53
- if (!c(o, t))
52
+ for (let t = 0; t < e.length; t++) {
53
+ const r = e[t];
54
+ if (!c(r, t))
54
55
  return !1;
55
- const r = o;
56
- if (n.has(r.key))
57
- return process.env.NODE_ENV !== "production" && console.warn(`Tabs: Duplicate key found: '${r.key}' at index ${t}`), !1;
58
- n.add(r.key);
56
+ const o = r;
57
+ if (n.has(o.key))
58
+ return console.warn(`Tabs: Duplicate key found: '${o.key}' at index ${t}`), !1;
59
+ n.add(o.key);
59
60
  }
60
61
  return !0;
61
- }, y = (e) => e.map((n) => n.key), b = (e, n) => e.find((t) => t.key === n);
62
+ }, y = (e) => e.map((n) => n.key), g = (e, n) => e.find((t) => t.key === n);
62
63
  export {
63
- u as calculateIndicatorStyle,
64
+ s as calculateIndicatorStyle,
64
65
  d as debounce,
65
- b as findTabByKey,
66
- p as generateId,
67
- l as getIndicatorPosition,
66
+ g as findTabByKey,
67
+ h as generateId,
68
+ u as getIndicatorPosition,
68
69
  y as getTabKeys,
69
70
  f as prefersReducedMotion,
70
- h as validateTabValues
71
+ p as validateTabValues
71
72
  };
package/dist/Textarea.js CHANGED
@@ -82,7 +82,7 @@ const K = "absolute right-4 top-4", Q = (t) => t || "off", U = (t, a) => {
82
82
  });
83
83
  return /* @__PURE__ */ n("div", { className: "w-full", children: [
84
84
  c && /* @__PURE__ */ e(D, { "data-testid": "spectral-textarea-label", htmlFor: p, className: g("block mb-2", f && "opacity-50 cursor-not-allowed", b), children: c }),
85
- /* @__PURE__ */ n("div", { className: "relative", "data-testid": "spectral-textarea-container", children: [
85
+ /* @__PURE__ */ n("div", { className: "relative", children: [
86
86
  /* @__PURE__ */ e(
87
87
  "textarea",
88
88
  {
@@ -109,7 +109,7 @@ const K = "absolute right-4 top-4", Q = (t) => t || "off", U = (t, a) => {
109
109
  }
110
110
  ),
111
111
  E && /* @__PURE__ */ e("div", { className: K, "data-testid": "spectral-textarea-loading-icon", children: /* @__PURE__ */ e(B, { size: 24 }) }),
112
- /* @__PURE__ */ n("div", { className: U(l, i), role: "status", "aria-live": "polite", "aria-label": `${l} of ${i} characters used`, children: [
112
+ /* @__PURE__ */ n("div", { "aria-label": `${l} of ${i} characters used`, "aria-live": "polite", className: U(l, i), "data-testid": "spectral-textarea-counter", role: "status", children: [
113
113
  l,
114
114
  "/",
115
115
  i
@@ -47,19 +47,19 @@
47
47
  --horizon-color-level-four: oklch(35.77% 0.0088 248.07);
48
48
  --horizon-color-level-five: oklch(38.75% 0.0073 242.06);
49
49
 
50
- --horizon-color-success-50: oklch(96.27% 0.04 158.08);
51
- --horizon-color-success-100: oklch(92.53% 0.08 156.69);
52
- --horizon-color-success-200: oklch(87.14% 0.14 154.83);
53
- --horizon-color-success-300: oklch(80.03% 0.18 151.71);
54
- --horizon-color-success-400: oklch(72.27% 0.19 149.58);
55
- --horizon-color-success-500: oklch(62.71% 0.17 149.21);
50
+ --horizon-color-success-50: oklch(99% 0.1049 144);
51
+ --horizon-color-success-100: oklch(94% 0.1649 144);
52
+ --horizon-color-success-200: oklch(92% 0.2424 144);
53
+ --horizon-color-success-300: oklch(82% 0.2424 144);
54
+ --horizon-color-success-400: oklch(72% 0.2424 144);
55
+ --horizon-color-success-500: oklch(62% 0.2424 144);
56
56
 
57
- --horizon-color-warning-50: oklch(95.15% 0.02 73.61);
58
- --horizon-color-warning-100: oklch(95.40% 0.04 76.20);
59
- --horizon-color-warning-200: oklch(90.9% 0.095 52.355);
60
- --horizon-color-warning-300: oklch(84.9% 0.144 52.438);
61
- --horizon-color-warning-400: oklch(74.58% 0.1802 56.73);
62
- --horizon-color-warning-500: oklch(69.96% 0.201959 44.4414);
57
+ --horizon-color-warning-50: oklch(94% 0.0442 56.91);
58
+ --horizon-color-warning-100: oklch(91% 0.095 52.355);
59
+ --horizon-color-warning-200: oklch(84.9% 0.144 52.438);
60
+ --horizon-color-warning-300: oklch(76.9% 0.178 52.325);
61
+ --horizon-color-warning-400: oklch(71.06% 0.19 46.76);
62
+ --horizon-color-warning-500: oklch(70.5% 0.213 47.604);
63
63
 
64
64
  --horizon-color-danger-50: oklch(88.5% 0.062 18.334);
65
65
  --horizon-color-danger-100: oklch(80.8% 0.114 19.571);