@spear-ai/spectral 1.4.2 → 1.4.3

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.
Files changed (127) hide show
  1. package/dist/Accordion.d.ts +7 -7
  2. package/dist/Accordion.js +53 -51
  3. package/dist/Alert/AlertBase.js +6 -6
  4. package/dist/Alert.js +1 -1
  5. package/dist/Avatar.d.ts +2 -2
  6. package/dist/Avatar.js +46 -46
  7. package/dist/Badge.js +3 -3
  8. package/dist/Button.js +19 -12
  9. package/dist/ButtonGroup/ButtonGroupButton.d.ts +1 -1
  10. package/dist/ButtonGroup/ButtonGroupButton.js +10 -10
  11. package/dist/ButtonGroup.d.ts +8 -5
  12. package/dist/ButtonGroup.js +22 -14
  13. package/dist/ButtonIcon.d.ts +1 -1
  14. package/dist/ButtonIcon.js +5 -5
  15. package/dist/Card.d.ts +1 -1
  16. package/dist/Card.js +10 -10
  17. package/dist/Checkbox/CheckboxBase.d.ts +6 -6
  18. package/dist/Checkbox/CheckboxBase.js +65 -63
  19. package/dist/Checkbox.js +16 -14
  20. package/dist/Dialog/DialogBase.d.ts +37 -25
  21. package/dist/Dialog/DialogBase.js +130 -104
  22. package/dist/Dialog.d.ts +8 -8
  23. package/dist/Dialog.js +46 -36
  24. package/dist/Drawer.js +17 -17
  25. package/dist/HoverCard.d.ts +4 -4
  26. package/dist/HoverCard.js +34 -33
  27. package/dist/Input.js +58 -58
  28. package/dist/InputOTP.d.ts +1 -1
  29. package/dist/InputOTP.js +113 -112
  30. package/dist/MultiSelect/MultiSelectBase.d.ts +16 -16
  31. package/dist/MultiSelect/MultiSelectBase.js +236 -177
  32. package/dist/MultiSelect/MutiSelect.d.ts +6 -4
  33. package/dist/MultiSelect/MutiSelect.js +13 -12
  34. package/dist/Popover.js +2 -1
  35. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +18 -17
  36. package/dist/RadioGroup.js +5 -3
  37. package/dist/Select.js +70 -51
  38. package/dist/Slider.js +8 -4
  39. package/dist/Switch/SwitchBase.d.ts +6 -6
  40. package/dist/Switch/SwitchBase.js +39 -38
  41. package/dist/Switch.js +17 -16
  42. package/dist/Tabs/TabsBase.js +40 -25
  43. package/dist/Tabs.js +18 -21
  44. package/dist/Textarea.d.ts +1 -0
  45. package/dist/Textarea.js +33 -33
  46. package/dist/Toggle.js +4 -4
  47. package/dist/ToggleGroup/ToggleGroupBase.d.ts +7 -7
  48. package/dist/ToggleGroup/ToggleGroupBase.js +64 -64
  49. package/dist/ToggleGroup.js +19 -17
  50. package/dist/Tooltip/TooltipBase.d.ts +8 -8
  51. package/dist/Tooltip/TooltipBase.js +76 -74
  52. package/dist/Tooltip.d.ts +1 -1
  53. package/dist/Tooltip.js +12 -11
  54. package/dist/Tray.d.ts +1 -1
  55. package/dist/Tray.js +4910 -117
  56. package/dist/primitives/input.js +4 -4
  57. package/dist/primitives/select.d.ts +11 -11
  58. package/dist/primitives/select.d.ts.map +1 -1
  59. package/dist/primitives/select.js +28 -21
  60. package/dist/styles/main.css +1 -1
  61. package/dist/utils/{refs.d.ts → createForwardRef.d.ts} +1 -1
  62. package/dist/utils/createForwardRef.d.ts.map +1 -0
  63. package/dist/utils/formFieldUtils.d.ts +22 -18
  64. package/dist/utils/formFieldUtils.d.ts.map +1 -1
  65. package/dist/utils/formFieldUtils.js +46 -46
  66. package/package.json +9 -3
  67. package/dist/analyzer/list.yml.webp +0 -0
  68. package/dist/analyzer/network.webp +0 -0
  69. package/dist/analyzer/sunburst.webp +0 -0
  70. package/dist/analyzer/visual.webp +0 -0
  71. package/dist/auth-background.json +0 -90
  72. package/dist/favicon-invert.svg +0 -5
  73. package/dist/favicon.svg +0 -5
  74. package/dist/features/AuthCard/AuthCard.d.ts +0 -3
  75. package/dist/features/AuthCard/AuthCard.d.ts.map +0 -1
  76. package/dist/features/AuthCard/AuthToggle.d.ts +0 -9
  77. package/dist/features/AuthCard/AuthToggle.d.ts.map +0 -1
  78. package/dist/features/AuthCard/AuthToggle.js +0 -20
  79. package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts +0 -11
  80. package/dist/features/AuthCard/ForgotPasswordEmailForm.d.ts.map +0 -1
  81. package/dist/features/AuthCard/ForgotPasswordEmailForm.js +0 -86
  82. package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts +0 -11
  83. package/dist/features/AuthCard/ForgotPasswordResetForm.d.ts.map +0 -1
  84. package/dist/features/AuthCard/ForgotPasswordResetForm.js +0 -21
  85. package/dist/features/AuthCard/OTPInput.d.ts +0 -12
  86. package/dist/features/AuthCard/OTPInput.d.ts.map +0 -1
  87. package/dist/features/AuthCard/OTPInput.js +0 -12
  88. package/dist/features/AuthCard/PasswordInput.d.ts +0 -13
  89. package/dist/features/AuthCard/PasswordInput.d.ts.map +0 -1
  90. package/dist/features/AuthCard/PasswordInput.js +0 -93
  91. package/dist/features/AuthCard/SignInForm.d.ts +0 -9
  92. package/dist/features/AuthCard/SignInForm.d.ts.map +0 -1
  93. package/dist/features/AuthCard/SignInForm.js +0 -86
  94. package/dist/features/AuthCard/SignUpForm.d.ts +0 -8
  95. package/dist/features/AuthCard/SignUpForm.d.ts.map +0 -1
  96. package/dist/features/AuthCard/SignUpForm.js +0 -100
  97. package/dist/features/AuthCard.js +0 -202
  98. package/dist/features/ClearDialog/ClearDialog.d.ts +0 -2
  99. package/dist/features/ClearDialog/ClearDialog.d.ts.map +0 -1
  100. package/dist/features/ClearDialog.js +0 -31
  101. package/dist/features/LabelingToolbar/LabelingToolbar.d.ts +0 -8
  102. package/dist/features/LabelingToolbar/LabelingToolbar.d.ts.map +0 -1
  103. package/dist/features/LabelingToolbar.js +0 -13
  104. package/dist/features/LabelingTools/LabelingTools.d.ts +0 -2
  105. package/dist/features/LabelingTools/LabelingTools.d.ts.map +0 -1
  106. package/dist/features/LabelingTools.js +0 -134
  107. package/dist/features/SensorMetadata/SensorMetadata.d.ts +0 -2
  108. package/dist/features/SensorMetadata/SensorMetadata.d.ts.map +0 -1
  109. package/dist/features/SensorMetadata.js +0 -117
  110. package/dist/features/SettingsPopover/SettingsPopover.d.ts +0 -2
  111. package/dist/features/SettingsPopover/SettingsPopover.d.ts.map +0 -1
  112. package/dist/features/SettingsPopover.js +0 -204
  113. package/dist/index-BIpuW_o8.js +0 -146
  114. package/dist/linear-cursor-small.png +0 -0
  115. package/dist/loader-circle-CdRVlFhN.js +0 -11
  116. package/dist/logo/wordmark-dark-side-by-side.svg +0 -6
  117. package/dist/logo/wordmark-light-side-by-side.svg +0 -6
  118. package/dist/message-alert-matte-glass-gradient.webp +0 -0
  119. package/dist/proxy-C9AqCss6.js +0 -4670
  120. package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
  121. package/dist/themes/grayscale-theme.webp +0 -0
  122. package/dist/themes/green-black-theme.webp +0 -0
  123. package/dist/themes/reverse-grayscale-theme.webp +0 -0
  124. package/dist/themes/viridis-theme.webp +0 -0
  125. package/dist/utils/refs.d.ts.map +0 -1
  126. package/dist/x-Dl66o_vF.js +0 -14
  127. /package/dist/utils/{refs.js → createForwardRef.js} +0 -0
@@ -1,98 +1,99 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as s, jsxs as E } from "react/jsx-runtime";
3
+ import { jsx as r, jsxs as I } from "react/jsx-runtime";
4
+ import { CloseIcon as V } from "../Icons/CloseIcon.js";
4
5
  import { cn as f } from "../utils/twUtils.js";
5
- import { c as P } from "../index-D29mdTf5.js";
6
- import { createContext as V, useContext as L, useState as N, useMemo as I, useCallback as y, cloneElement as O, useEffect as w, useRef as k, isValidElement as B } from "react";
7
- import { createPortal as j } from "react-dom";
8
- import { X as A } from "../x-Dl66o_vF.js";
9
- const z = V(null);
6
+ import { c as L } from "../index-D29mdTf5.js";
7
+ import { createContext as j, useContext as A, useState as z, useMemo as B, useCallback as k, cloneElement as R, useEffect as y, useRef as D, isValidElement as N } from "react";
8
+ import { createPortal as $ } from "react-dom";
9
+ const T = j(null);
10
10
  function m() {
11
- const e = L(z);
12
- if (!e)
11
+ const t = A(T);
12
+ if (!t)
13
13
  throw new Error("Dialog components must be used within <Dialog>");
14
- return e;
14
+ return t;
15
15
  }
16
- function R(e) {
17
- return B(e) && typeof e.type != "string" ? !0 : B(e);
16
+ function O(t) {
17
+ return N(t) && typeof t.type != "string" ? !0 : N(t);
18
18
  }
19
- let D = 0;
20
- function J({ isOpen: e, defaultOpen: t = !1, onOpenChange: n, children: o, modal: r = !0 }) {
21
- const [u, i] = N(t), d = e !== void 0, g = d ? e : u, x = I(
19
+ let h = 0;
20
+ function Q({ open: t, defaultOpen: o = !1, onOpenChange: e, children: n, modal: a = !0 }) {
21
+ const [l, d] = z(o), s = t !== void 0, u = s ? t : l, b = B(
22
22
  () => ({
23
- contentId: `dialog-content-${++D}`,
24
- titleId: `dialog-title-${D}`,
25
- descriptionId: `dialog-description-${D}`
23
+ contentId: `dialog-content-${++h}`,
24
+ descriptionId: `dialog-description-${h}`,
25
+ titleId: `dialog-title-${h}`
26
26
  }),
27
27
  []
28
- ), b = y(
29
- (l) => {
30
- d || i(l), n?.(l);
28
+ ), C = k(
29
+ (p) => {
30
+ s || d(p), e?.(p);
31
31
  },
32
- [d, n]
33
- ), C = I(
32
+ [s, e]
33
+ ), w = B(
34
34
  () => ({
35
- isOpen: g,
36
- setIsOpen: b,
37
- modal: r,
38
- ...x
35
+ modal: a,
36
+ open: u,
37
+ setOpen: C,
38
+ ...b
39
39
  }),
40
- [g, b, r, x]
40
+ [u, C, a, b]
41
41
  );
42
- return /* @__PURE__ */ s(z.Provider, { value: C, children: o });
42
+ return /* @__PURE__ */ r(T.Provider, { value: w, children: n });
43
43
  }
44
- function K({ children: e, asChild: t = !0 }) {
45
- const { setIsOpen: n } = m(), o = y(() => {
44
+ function W({ children: t, asChild: o = !0, dataTestId: e }) {
45
+ const { setOpen: n } = m(), a = k(() => {
46
46
  n(!0);
47
47
  }, [n]);
48
- if (!t)
49
- return /* @__PURE__ */ s("button", { onClick: o, children: e });
50
- if (!R(e))
48
+ if (!o)
49
+ return /* @__PURE__ */ r("button", { "data-slot": "dialog-trigger", "data-testid": e, onClick: a, tabIndex: 0, children: t });
50
+ if (!O(t))
51
51
  throw new Error("DialogTrigger expects a single React element as child");
52
- const r = e.props.onClick;
53
- return O(e, {
54
- onClick: (...u) => {
55
- r?.(...u), o();
52
+ const l = t.props.onClick;
53
+ return R(t, {
54
+ onClick: (...d) => {
55
+ l?.(...d), a();
56
56
  }
57
57
  });
58
58
  }
59
- function $({ children: e, asChild: t = !0 }) {
60
- const { setIsOpen: n } = m(), o = y(() => {
59
+ function M({ children: t, asChild: o = !0, dataTestId: e }) {
60
+ const { setOpen: n } = m(), a = k(() => {
61
61
  n(!1);
62
62
  }, [n]);
63
- if (!t)
64
- return /* @__PURE__ */ s("button", { onClick: o, className: "cursor-pointer focus-visible:outline-none outline-transparent focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1", tabIndex: 0, children: e });
65
- if (!R(e))
63
+ if (!o)
64
+ return /* @__PURE__ */ r("button", { className: "cursor-pointer focus-visible:outline-none outline-transparent focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1", "data-slot": "dialog-close", "data-testid": e, onClick: a, tabIndex: 0, children: t });
65
+ if (!O(t))
66
66
  throw new Error("DialogClose expects a single React element as child");
67
- const r = e.props.onClick;
68
- return O(e, {
69
- onClick: (...u) => {
70
- r?.(...u), o();
67
+ const l = t.props.onClick;
68
+ return R(t, {
69
+ onClick: (...d) => {
70
+ l?.(...d), a();
71
71
  }
72
72
  });
73
73
  }
74
- function T({ children: e, container: t }) {
75
- const [n, o] = N(!1);
76
- return w(() => (o(!0), () => o(!1)), []), n ? j(e, t ?? document.body) : null;
74
+ function P({ children: t, container: o }) {
75
+ const [e, n] = z(!1);
76
+ return y(() => (n(!0), () => n(!1)), []), e ? $(t, o ?? document.body) : null;
77
77
  }
78
- function Q({ className: e }) {
79
- const { isOpen: t, setIsOpen: n } = m(), o = y(
80
- (r) => {
81
- r.target === r.currentTarget && n(!1);
78
+ function X({ className: t, dataTestId: o }) {
79
+ const { open: e, setOpen: n } = m(), a = k(
80
+ (l) => {
81
+ l.target === l.currentTarget && n(!1);
82
82
  },
83
83
  [n]
84
84
  );
85
- return t ? /* @__PURE__ */ s(T, { children: /* @__PURE__ */ s(
85
+ return e ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ r(
86
86
  "div",
87
87
  {
88
- className: f("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0", e),
89
- "data-state": t ? "open" : "closed",
90
- onClick: o,
91
- "aria-hidden": "true"
88
+ "aria-hidden": "true",
89
+ className: f("fixed inset-0 z-40 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=open]:fade-in-0", "data-[state=closed]:animate-out data-[state=closed]:fade-out-0", t),
90
+ "data-state": e ? "open" : "closed",
91
+ "data-testid": o,
92
+ onClick: a
92
93
  }
93
94
  ) }) : null;
94
95
  }
95
- const M = P(
96
+ const F = L(
96
97
  [
97
98
  "fixed left-1/2 top-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 rounded-lg p-6 shadow-lg outline-none data-[state=open]:animate-in data-[state=open]:fade-in-0",
98
99
  "data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
@@ -112,68 +113,93 @@ const M = P(
112
113
  }
113
114
  }
114
115
  );
115
- function W({ children: e, className: t, size: n, onPointerDownOutside: o, onInteractOutside: r, onEscapeKeyDown: u }) {
116
- const { isOpen: i, setIsOpen: d, contentId: g, titleId: x, descriptionId: b, modal: C } = m(), l = k(null), p = k(null), v = k(!1);
117
- return w(() => {
118
- if (!i) {
119
- v.current && p.current && typeof p.current.focus == "function" && p.current.focus(), p.current = null, v.current = !1;
116
+ function Y({ children: t, className: o, dataTestId: e, onEscapeKeyDown: n, onInteractOutside: a, onPointerDownOutside: l, size: d }) {
117
+ const { open: s, setOpen: u, contentId: b, titleId: C, descriptionId: w, modal: p } = m(), g = D(null), x = D(null), v = D(!1);
118
+ return y(() => {
119
+ if (!s) {
120
+ v.current && x.current && typeof x.current.focus == "function" && x.current.focus(), x.current = null, v.current = !1;
120
121
  return;
121
122
  }
122
- if (!l.current || v.current) return;
123
+ if (!g.current || v.current) return;
123
124
  v.current = !0;
124
- const c = l.current;
125
- p.current = document.activeElement, setTimeout(() => {
126
- if (!c || !l.current) return;
127
- const a = document.activeElement;
128
- (!c.contains(a) || a === document.body) && c.focus();
125
+ const c = g.current;
126
+ x.current = document.activeElement, setTimeout(() => {
127
+ if (!c || !g.current) return;
128
+ const i = document.activeElement;
129
+ (!c.contains(i) || i === document.body) && c.focus();
129
130
  }, 0);
130
- }, [i]), w(() => {
131
- if (!i) return;
132
- const c = (a) => {
133
- a.key === "Escape" && (u?.(a), r?.(a), a.defaultPrevented || (a.preventDefault(), d(!1)));
131
+ }, [s]), y(() => {
132
+ if (!s) return;
133
+ const c = (i) => {
134
+ i.key === "Escape" && (n?.(i), a?.(i), i.defaultPrevented || (i.preventDefault(), u(!1)));
134
135
  };
135
136
  return document.addEventListener("keydown", c, { capture: !0 }), () => {
136
137
  document.removeEventListener("keydown", c, { capture: !0 });
137
138
  };
138
- }, [i, u, r, d]), w(() => {
139
- if (!i) return;
140
- const c = (a) => {
141
- const h = a.target;
142
- l.current && !l.current.contains(h) && (h.closest('[role="dialog"]') !== null || (o?.(a), r?.(a), !C && !a.defaultPrevented && d(!1)));
139
+ }, [s, n, a, u]), y(() => {
140
+ if (!s) return;
141
+ const c = (i) => {
142
+ const E = i.target;
143
+ g.current && !g.current.contains(E) && (E.closest("[role='dialog']") !== null || (l?.(i), a?.(i), !p && !i.defaultPrevented && u(!1)));
143
144
  };
144
145
  return document.addEventListener("pointerdown", c), () => document.removeEventListener("pointerdown", c);
145
- }, [i, o, r, d, C]), i ? /* @__PURE__ */ s(T, { children: /* @__PURE__ */ E("div", { ref: l, id: g, role: "dialog", "aria-modal": "true", "aria-labelledby": x, "aria-describedby": b, "data-state": i ? "open" : "closed", tabIndex: -1, className: f(M({ size: n }), t), children: [
146
- /* @__PURE__ */ s($, { asChild: !0, children: /* @__PURE__ */ E("button", { className: f("absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100", "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none"), "aria-label": "Close dialog", children: [
147
- /* @__PURE__ */ s(A, { className: "h-4 w-4" }),
148
- /* @__PURE__ */ s("span", { className: "sr-only", children: "Close" })
149
- ] }) }),
150
- e
151
- ] }) }) : null;
146
+ }, [s, l, a, u, p]), s ? /* @__PURE__ */ r(P, { children: /* @__PURE__ */ I(
147
+ "div",
148
+ {
149
+ "aria-describedby": w,
150
+ "aria-labelledby": C,
151
+ "aria-modal": "true",
152
+ className: f(F({ size: d }), o),
153
+ "data-slot": "dialog-content",
154
+ "data-state": s ? "open" : "closed",
155
+ "data-testid": e,
156
+ id: b,
157
+ ref: g,
158
+ role: "dialog",
159
+ tabIndex: -1,
160
+ children: [
161
+ /* @__PURE__ */ r(M, { asChild: !0, children: /* @__PURE__ */ I(
162
+ "button",
163
+ {
164
+ "aria-label": "Close dialog",
165
+ className: f("absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100", "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none cursor-pointer"),
166
+ "data-slot": "dialog-close",
167
+ "data-testid": "spectral-dialog-close-icon",
168
+ children: [
169
+ /* @__PURE__ */ r(V, { size: 16 }),
170
+ /* @__PURE__ */ r("span", { className: "sr-only", children: "Close" })
171
+ ]
172
+ }
173
+ ) }),
174
+ t
175
+ ]
176
+ }
177
+ ) }) : null;
152
178
  }
153
- function Y({ children: e, className: t }) {
179
+ function Z({ children: t, className: o, dataTestId: e }) {
154
180
  const { titleId: n } = m();
155
- return /* @__PURE__ */ s("h2", { id: n, className: f("text-base font-semibold leading-none tracking-tight", t), children: e });
181
+ return /* @__PURE__ */ r("h2", { className: f("text-base font-semibold leading-none tracking-tight", o), "data-slot": "dialog-title", "data-testid": e, id: n, children: t });
156
182
  }
157
- function Z({ children: e, className: t }) {
183
+ function _({ children: t, className: o, dataTestId: e }) {
158
184
  const { descriptionId: n } = m();
159
- return /* @__PURE__ */ s("p", { id: n, className: f("text-sm text-text-secondary", t), children: e });
185
+ return /* @__PURE__ */ r("p", { className: f("text-sm text-text-secondary", o), "data-slot": "dialog-description", "data-testid": e, id: n, children: t });
160
186
  }
161
- function _({ children: e, className: t }) {
162
- return /* @__PURE__ */ s("div", { className: f("flex flex-col space-y-1.5 text-center text-left", t), children: e });
187
+ function tt({ children: t, className: o, dataTestId: e }) {
188
+ return /* @__PURE__ */ r("div", { className: f("flex flex-col space-y-1.5 text-center text-left", o), "data-slot": "dialog-header", "data-testid": e, children: t });
163
189
  }
164
- function ee({ children: e, className: t }) {
165
- return /* @__PURE__ */ s("div", { className: f("flex flex-col-reverse flex-row justify-end space-x-2", t), children: e });
190
+ function et({ children: t, className: o, dataTestId: e }) {
191
+ return /* @__PURE__ */ r("div", { className: f("flex flex-col-reverse flex-row justify-end space-x-2", o), "data-slot": "dialog-footer", "data-testid": e, children: t });
166
192
  }
167
193
  export {
168
- J as DialogBase,
169
- $ as DialogCloseBase,
170
- W as DialogContentBase,
171
- Z as DialogDescriptionBase,
172
- ee as DialogFooterBase,
173
- _ as DialogHeaderBase,
174
- Q as DialogOverlayBase,
175
- T as DialogPortalBase,
176
- Y as DialogTitleBase,
177
- K as DialogTriggerBase,
194
+ Q as DialogBase,
195
+ M as DialogCloseBase,
196
+ Y as DialogContentBase,
197
+ _ as DialogDescriptionBase,
198
+ et as DialogFooterBase,
199
+ tt as DialogHeaderBase,
200
+ X as DialogOverlayBase,
201
+ P as DialogPortalBase,
202
+ Z as DialogTitleBase,
203
+ W as DialogTriggerBase,
178
204
  m as useDialogContext
179
205
  };
package/dist/Dialog.d.ts CHANGED
@@ -1,16 +1,16 @@
1
1
  import { DialogCloseBase, DialogContentBase, DialogDescriptionBase, DialogFooterBase, DialogHeaderBase, DialogOverlayBase, DialogPortalBase, DialogTitleBase, DialogTriggerBase, DialogBaseProps } from './DialogBase';
2
2
  import { ComponentProps } from 'react';
3
3
  declare function Dialog({ ...props }: DialogBaseProps): import("react/jsx-runtime").JSX.Element;
4
- declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogTriggerBase>): import("react/jsx-runtime").JSX.Element;
4
+ declare function DialogTrigger({ dataTestId, ...props }: ComponentProps<typeof DialogTriggerBase>): import("react/jsx-runtime").JSX.Element;
5
5
  declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPortalBase>): import("react/jsx-runtime").JSX.Element;
6
- declare function DialogClose({ ...props }: ComponentProps<typeof DialogCloseBase>): import("react/jsx-runtime").JSX.Element;
7
- declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogOverlayBase>): import("react/jsx-runtime").JSX.Element;
8
- declare function DialogContent({ className, children, onInteractOutside, onPointerDownOutside, onEscapeKeyDown, ...props }: ComponentProps<typeof DialogContentBase> & {
6
+ declare function DialogClose({ dataTestId, ...props }: ComponentProps<typeof DialogCloseBase>): import("react/jsx-runtime").JSX.Element;
7
+ declare function DialogOverlay({ className, dataTestId, ...props }: ComponentProps<typeof DialogOverlayBase>): import("react/jsx-runtime").JSX.Element;
8
+ declare function DialogContent({ className, children, dataTestId, onInteractOutside, onPointerDownOutside, onEscapeKeyDown, ...props }: ComponentProps<typeof DialogContentBase> & {
9
9
  showCloseButton?: boolean;
10
10
  }): import("react/jsx-runtime").JSX.Element;
11
- declare function DialogHeader({ className, ...props }: ComponentProps<typeof DialogHeaderBase>): import("react/jsx-runtime").JSX.Element;
12
- declare function DialogFooter({ className, ...props }: ComponentProps<typeof DialogFooterBase>): import("react/jsx-runtime").JSX.Element;
13
- declare function DialogTitle({ className, ...props }: ComponentProps<typeof DialogTitleBase>): import("react/jsx-runtime").JSX.Element;
14
- declare function DialogDescription({ className, ...props }: ComponentProps<typeof DialogDescriptionBase>): import("react/jsx-runtime").JSX.Element;
11
+ declare function DialogHeader({ className, dataTestId, ...props }: ComponentProps<typeof DialogHeaderBase>): import("react/jsx-runtime").JSX.Element;
12
+ declare function DialogFooter({ className, dataTestId, ...props }: ComponentProps<typeof DialogFooterBase>): import("react/jsx-runtime").JSX.Element;
13
+ declare function DialogTitle({ className, dataTestId, ...props }: ComponentProps<typeof DialogTitleBase>): import("react/jsx-runtime").JSX.Element;
14
+ declare function DialogDescription({ className, dataTestId, ...props }: ComponentProps<typeof DialogDescriptionBase>): import("react/jsx-runtime").JSX.Element;
15
15
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
16
16
  //# sourceMappingURL=Dialog.d.ts.map
package/dist/Dialog.js CHANGED
@@ -1,68 +1,78 @@
1
1
  import "./styles/main.css";
2
- import { jsx as e, Fragment as s } from "react/jsx-runtime";
3
- import { DialogBase as d, DialogCloseBase as g, DialogContentBase as c, DialogDescriptionBase as u, DialogFooterBase as f, DialogHeaderBase as m, DialogOverlayBase as D, DialogPortalBase as p, DialogTitleBase as x, DialogTriggerBase as B } from "./Dialog/DialogBase.js";
4
- import { cn as o } from "./utils/twUtils.js";
2
+ import { jsx as o, Fragment as n } from "react/jsx-runtime";
3
+ import { DialogBase as g, DialogCloseBase as c, DialogContentBase as f, DialogDescriptionBase as u, DialogFooterBase as m, DialogHeaderBase as p, DialogOverlayBase as D, DialogPortalBase as x, DialogTitleBase as T, DialogTriggerBase as B } from "./Dialog/DialogBase.js";
4
+ import { cn as l } from "./utils/twUtils.js";
5
5
  import "react";
6
- function C({ ...a }) {
7
- return /* @__PURE__ */ e(d, { "data-slot": "dialog", ...a });
8
- }
9
6
  function h({ ...a }) {
10
- return /* @__PURE__ */ e(B, { asChild: !0, "data-slot": "dialog-trigger", ...a });
7
+ return /* @__PURE__ */ o(g, { "data-slot": "dialog", "data-testid": "spectral-dialog", ...a });
8
+ }
9
+ function v({ dataTestId: a, ...t }) {
10
+ return /* @__PURE__ */ o(B, { asChild: !0, "data-slot": "dialog-trigger", dataTestId: a || "dialog-trigger", ...t });
11
11
  }
12
- function v({ ...a }) {
13
- return /* @__PURE__ */ e(p, { "data-slot": "dialog-portal", ...a });
12
+ function w({ ...a }) {
13
+ return /* @__PURE__ */ o(x, { "data-slot": "dialog-portal", "data-testid": "dialog-portal", ...a });
14
14
  }
15
- function z({ ...a }) {
16
- return /* @__PURE__ */ e(g, { "data-slot": "dialog-close", ...a });
15
+ function C({ dataTestId: a, ...t }) {
16
+ return /* @__PURE__ */ o(c, { "data-slot": "dialog-close", dataTestId: a || "dialog-close", ...t });
17
17
  }
18
- function T({ className: a, ...t }) {
19
- return /* @__PURE__ */ e(D, { "data-slot": "dialog-overlay", className: o("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-bg-primary/50", a), ...t });
18
+ function z({ className: a, dataTestId: t, ...e }) {
19
+ return /* @__PURE__ */ o(
20
+ D,
21
+ {
22
+ className: l("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-bg-primary/50", a),
23
+ "data-slot": "dialog-overlay",
24
+ dataTestId: t || "dialog-overlay",
25
+ ...e
26
+ }
27
+ );
20
28
  }
21
29
  function F({
22
30
  className: a,
23
31
  children: t,
24
- onInteractOutside: l,
25
- onPointerDownOutside: i,
26
- onEscapeKeyDown: n,
32
+ dataTestId: e,
33
+ onInteractOutside: i,
34
+ onPointerDownOutside: d,
35
+ onEscapeKeyDown: s,
27
36
  ...r
28
37
  }) {
29
- return /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
30
- c,
38
+ return /* @__PURE__ */ o(n, { children: /* @__PURE__ */ o(
39
+ f,
31
40
  {
32
- "data-slot": "dialog-content",
33
- className: o(
41
+ className: l(
34
42
  "bg-dialog-bg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg p-6 shadow-lg duration-200 max-w-lg",
35
43
  a
36
44
  ),
37
- onInteractOutside: l,
38
- onPointerDownOutside: i,
39
- onEscapeKeyDown: n,
45
+ "data-slot": "dialog-content",
46
+ dataTestId: e || "dialog-content",
47
+ onEscapeKeyDown: s,
48
+ onInteractOutside: i,
49
+ onPointerDownOutside: d,
40
50
  ...r,
41
51
  children: t
42
52
  }
43
53
  ) });
44
54
  }
45
- function j({ className: a, ...t }) {
46
- return /* @__PURE__ */ e(m, { "data-slot": "dialog-header", className: o("flex flex-col gap-2 text-center sm:text-left", a), ...t });
55
+ function j({ className: a, dataTestId: t, ...e }) {
56
+ return /* @__PURE__ */ o(p, { className: l("flex flex-col gap-2 text-center sm:text-left", a), "data-slot": "dialog-header", dataTestId: t || "dialog-header", ...e });
47
57
  }
48
- function H({ className: a, ...t }) {
49
- return /* @__PURE__ */ e(f, { "data-slot": "dialog-footer", className: o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", a), ...t });
58
+ function H({ className: a, dataTestId: t, ...e }) {
59
+ return /* @__PURE__ */ o(m, { className: l("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", a), "data-slot": "dialog-footer", dataTestId: t || "dialog-footer", ...e });
50
60
  }
51
- function O({ className: a, ...t }) {
52
- return /* @__PURE__ */ e(x, { "data-slot": "dialog-title", className: o("text-lg leading-none font-semibold", a), ...t });
61
+ function O({ className: a, dataTestId: t, ...e }) {
62
+ return /* @__PURE__ */ o(T, { className: l("text-lg leading-none font-semibold", a), "data-slot": "dialog-title", dataTestId: t || "dialog-title", ...e });
53
63
  }
54
- function P({ className: a, ...t }) {
55
- return /* @__PURE__ */ e(u, { "data-slot": "dialog-description", className: o("text-muted-foreground text-sm", a), ...t });
64
+ function P({ className: a, dataTestId: t, ...e }) {
65
+ return /* @__PURE__ */ o(u, { className: l("text-muted-foreground text-sm", a), "data-slot": "dialog-description", dataTestId: t || "dialog-description", ...e });
56
66
  }
57
67
  export {
58
- C as Dialog,
59
- z as DialogClose,
68
+ h as Dialog,
69
+ C as DialogClose,
60
70
  F as DialogContent,
61
71
  P as DialogDescription,
62
72
  H as DialogFooter,
63
73
  j as DialogHeader,
64
- T as DialogOverlay,
65
- v as DialogPortal,
74
+ z as DialogOverlay,
75
+ w as DialogPortal,
66
76
  O as DialogTitle,
67
- h as DialogTrigger
77
+ v as DialogTrigger
68
78
  };
package/dist/Drawer.js CHANGED
@@ -1,39 +1,39 @@
1
1
  import "./styles/main.css";
2
- import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
+ import { jsx as t, jsxs as s } from "react/jsx-runtime";
3
3
  import { SpectralProvider as x } from "./SpectralProvider.js";
4
4
  import { D as e } from "./index-CAKA12cC.js";
5
- const f = ({ trigger: l, title: i, description: n, children: p, direction: o = "right", size: r = "380px" }) => {
6
- const s = "!font-sans fixed", c = {
5
+ const b = ({ trigger: d, title: o, description: i, children: c, direction: l = "right", size: r = "380px" }) => {
6
+ const a = "!font-sans fixed", p = {
7
7
  left: {
8
- className: `${s} top-0 bottom-0 left-0 shadow-[20px_0_20px_rgba(0,0,0,0.4)]`,
8
+ className: `${a} top-0 bottom-0 left-0 shadow-[20px_0_20px_rgba(0,0,0,0.4)]`,
9
9
  style: { width: r }
10
10
  },
11
11
  right: {
12
- className: `${s} top-0 bottom-0 right-0 shadow-[-20px_0_20px_rgba(0,0,0,0.4)]`,
12
+ className: `${a} top-0 bottom-0 right-0 shadow-[-20px_0_20px_rgba(0,0,0,0.4)]`,
13
13
  style: { width: r }
14
14
  },
15
15
  top: {
16
- className: `${s} top-0 left-0 right-0 shadow-[0_20px_20px_rgba(0,0,0,0.4)]`,
16
+ className: `${a} top-0 left-0 right-0 shadow-[0_20px_20px_rgba(0,0,0,0.4)]`,
17
17
  style: { height: r }
18
18
  },
19
19
  bottom: {
20
- className: `${s} bottom-0 left-0 right-0 shadow-[0_-20px_20px_rgba(0,0,0,0.4)]`,
20
+ className: `${a} bottom-0 left-0 right-0 shadow-[0_-20px_20px_rgba(0,0,0,0.4)]`,
21
21
  style: { height: r }
22
22
  }
23
- }, { className: d, style: m } = c[o];
24
- return /* @__PURE__ */ t(x, { children: /* @__PURE__ */ a(e.Root, { direction: o, children: [
25
- /* @__PURE__ */ t(e.Trigger, { asChild: !0, children: l }),
26
- /* @__PURE__ */ a(e.Portal, { children: [
27
- /* @__PURE__ */ t(e.Overlay, { className: "fixed inset-0 bg-transparent" }),
28
- /* @__PURE__ */ t(e.Content, { asChild: !0, className: `bg-drawer-bg z-10 flex flex-col outline-none [&_*]:box-border ${d}`, style: m, children: /* @__PURE__ */ a("div", { children: [
23
+ }, { className: n, style: m } = p[l];
24
+ return /* @__PURE__ */ t(x, { children: /* @__PURE__ */ s(e.Root, { direction: l, "data-testid": "spectral-drawer", children: [
25
+ /* @__PURE__ */ t(e.Trigger, { asChild: !0, "data-testid": "spectral-drawer-trigger", children: d }),
26
+ /* @__PURE__ */ s(e.Portal, { children: [
27
+ /* @__PURE__ */ t(e.Overlay, { className: "fixed inset-0 bg-transparent", "data-testid": "spectral-drawer-overlay" }),
28
+ /* @__PURE__ */ t(e.Content, { asChild: !0, className: `bg-drawer-bg z-10 flex flex-col outline-none [&_*]:box-border ${n}`, style: m, "data-testid": "spectral-drawer-content", children: /* @__PURE__ */ s("div", { children: [
29
29
  /* @__PURE__ */ t(e.Close, {}),
30
- /* @__PURE__ */ t(e.Title, { className: "text-text-primary px-3 pt-4 text-lg font-medium", children: i }),
31
- /* @__PURE__ */ t(e.Description, { className: "!text-text-secondary mb-2 px-3 !text-xs uppercase", children: n }),
32
- /* @__PURE__ */ t("div", { className: "py-2 px-3 min-w-0 w-auto overflow-hidden [&>*]:min-w-0 [&_*]:min-w-0", children: p })
30
+ /* @__PURE__ */ t(e.Title, { className: "text-text-primary px-3 pt-4 text-lg font-medium", "data-testid": "spectral-drawer-title", children: o }),
31
+ /* @__PURE__ */ t(e.Description, { className: "!text-text-secondary mb-2 px-3 !text-xs uppercase", "data-testid": "spectral-drawer-description", children: i }),
32
+ /* @__PURE__ */ t("div", { className: "py-2 px-3 min-w-0 w-auto overflow-hidden [&>*]:min-w-0 [&_*]:min-w-0", "data-testid": "spectral-drawer-body", children: c })
33
33
  ] }) })
34
34
  ] })
35
35
  ] }) });
36
36
  };
37
37
  export {
38
- f as Drawer
38
+ b as Drawer
39
39
  };
@@ -3,17 +3,17 @@ import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
3
3
  type Side = 'top' | 'right' | 'bottom' | 'left';
4
4
  type Align = 'start' | 'center' | 'end';
5
5
  type HoverCardContentProps = {
6
- side?: Side;
7
- sideOffset?: number;
8
6
  align?: Align;
9
7
  alignOffset?: number;
10
8
  collisionBoundary?: Element | null | Array<Element | null>;
11
9
  collisionPadding?: number | Partial<Record<Side, number>>;
10
+ side?: Side;
11
+ sideOffset?: number;
12
12
  width?: number | 'w-fit' | 'trigger-width';
13
13
  };
14
14
  export type HoverCardProps = ComponentProps<typeof HoverCardPrimitive.Root> & HoverCardContentProps;
15
15
  export declare const HoverCard: {
16
- ({ side, sideOffset, align, alignOffset, collisionBoundary, collisionPadding, width, ...props }: HoverCardProps): import("react/jsx-runtime").JSX.Element;
16
+ ({ align, alignOffset, collisionBoundary, collisionPadding, side, sideOffset, width, ...props }: HoverCardProps): import("react/jsx-runtime").JSX.Element;
17
17
  displayName: string;
18
18
  };
19
19
  export declare const HoverCardTrigger: {
@@ -21,7 +21,7 @@ export declare const HoverCardTrigger: {
21
21
  displayName: string;
22
22
  };
23
23
  export declare const HoverCardContent: {
24
- ({ className, align: alignProp, sideOffset: sideOffsetProp, side: sideProp, width: widthProp, alignOffset: alignOffsetProp, collisionBoundary: collisionBoundaryProp, collisionPadding: collisionPaddingProp, ...props }: ComponentProps<typeof HoverCardPrimitive.Content> & {
24
+ ({ align: alignProp, alignOffset: alignOffsetProp, className, collisionBoundary: collisionBoundaryProp, collisionPadding: collisionPaddingProp, side: sideProp, sideOffset: sideOffsetProp, width: widthProp, ...props }: ComponentProps<typeof HoverCardPrimitive.Content> & {
25
25
  width?: number | "w-fit" | "trigger-width";
26
26
  }): import("react/jsx-runtime").JSX.Element;
27
27
  displayName: string;