@spear-ai/spectral 1.3.62 → 1.3.64

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 (281) hide show
  1. package/dist/.js +205 -152
  2. package/dist/Accordion.d.ts +37 -0
  3. package/dist/Accordion.js +474 -0
  4. package/dist/Alert/AlertBase.js +2 -2
  5. package/dist/Alert.js +21 -11
  6. package/dist/Avatar.js +1 -1
  7. package/dist/Badge.d.ts +12 -2
  8. package/dist/Badge.js +28 -4
  9. package/dist/Button.d.ts +3 -3
  10. package/dist/Button.js +35 -28
  11. package/dist/ButtonGroup/ButtonGroupButton.d.ts +13 -0
  12. package/dist/ButtonGroup/ButtonGroupButton.js +51 -0
  13. package/dist/ButtonGroup.d.ts +29 -0
  14. package/dist/ButtonGroup.js +89 -0
  15. package/dist/ButtonIcon.js +11 -1
  16. package/dist/Card.d.ts +16 -0
  17. package/dist/Card.js +32 -0
  18. package/dist/Checkbox/CheckboxBase.js +1 -1
  19. package/dist/Checkbox.js +22 -14
  20. package/dist/Dialog/DialogBase.d.ts +6 -3
  21. package/dist/Dialog/DialogBase.js +113 -98
  22. package/dist/Dialog.d.ts +1 -1
  23. package/dist/Dialog.js +42 -36
  24. package/dist/Drawer.js +24 -1283
  25. package/dist/HoverCard.d.ts +29 -0
  26. package/dist/HoverCard.js +207 -0
  27. package/dist/Icons/AnalyzeIcon.d.ts +3 -0
  28. package/dist/Icons/AnalyzeIcon.js +73 -0
  29. package/dist/Icons/AnnotationsIcon.js +4 -4
  30. package/dist/Icons/ApprovedIcon.d.ts +3 -0
  31. package/dist/Icons/ApprovedIcon.js +43 -0
  32. package/dist/Icons/CalendarIcon.js +7 -7
  33. package/dist/Icons/CheckCircleIcon.js +14 -14
  34. package/dist/Icons/CheckSquareIcon.js +14 -14
  35. package/dist/Icons/CheckmarkIcon.js +9 -9
  36. package/dist/Icons/ChevronDownIcon.js +6 -6
  37. package/dist/Icons/ChevronUpIcon.js +7 -7
  38. package/dist/Icons/ClockIcon.js +10 -10
  39. package/dist/Icons/CloseCircleIcon.js +10 -10
  40. package/dist/Icons/CloseIcon.js +5 -5
  41. package/dist/Icons/DashboardIcon.js +4 -4
  42. package/dist/Icons/DatabaseIcon.d.ts +3 -0
  43. package/dist/Icons/DatabaseIcon.js +53 -0
  44. package/dist/Icons/DeleteIcon.js +24 -6
  45. package/dist/Icons/DurationIcon.js +7 -7
  46. package/dist/Icons/EmailIcon.js +4 -4
  47. package/dist/Icons/EraserIcon.js +20 -11
  48. package/dist/Icons/ErrorIcon.js +3 -3
  49. package/dist/Icons/EyeClosedIcon.js +2 -2
  50. package/dist/Icons/EyeClosedIcon2.js +18 -18
  51. package/dist/Icons/EyeOpenIcon.js +8 -8
  52. package/dist/Icons/GoToFirstIcon.js +1 -1
  53. package/dist/Icons/GoToLastIcon.js +3 -3
  54. package/dist/Icons/HarmonicCursorsIcon.js +4 -4
  55. package/dist/Icons/IconBase.d.ts +1 -1
  56. package/dist/Icons/IconBase.js +15 -17
  57. package/dist/Icons/InfoIcon.js +4 -4
  58. package/dist/Icons/LabelIcon.js +6 -6
  59. package/dist/Icons/LassoIcon.js +6 -6
  60. package/dist/Icons/LineToolIcon.js +22 -93
  61. package/dist/Icons/LineToolIcon2.d.ts +3 -0
  62. package/dist/Icons/LineToolIcon2.js +73 -0
  63. package/dist/Icons/LiveViewIcon.js +5 -5
  64. package/dist/Icons/LoaderIcon.js +5 -5
  65. package/dist/Icons/LocationIcon.js +5 -5
  66. package/dist/Icons/LogoutIcon.js +11 -11
  67. package/dist/Icons/MessagesIcon.d.ts +3 -0
  68. package/dist/Icons/MessagesIcon.js +34 -0
  69. package/dist/Icons/MetadataIcon.js +5 -5
  70. package/dist/Icons/MinusIcon.js +9 -9
  71. package/dist/Icons/OntologyIcon.js +74 -21
  72. package/dist/Icons/PanelIconClose.js +11 -11
  73. package/dist/Icons/PanelIconOpen.js +11 -11
  74. package/dist/Icons/PlayIcon.js +5 -5
  75. package/dist/Icons/PlusIcon.js +9 -8
  76. package/dist/Icons/ResetIcon.js +6 -6
  77. package/dist/Icons/ReviewedIcon.d.ts +3 -0
  78. package/dist/Icons/ReviewedIcon.js +44 -0
  79. package/dist/Icons/ScissorsIcon.js +9 -9
  80. package/dist/Icons/SettingsIcon.js +20 -22
  81. package/dist/Icons/SortAscendingIcon.d.ts +3 -0
  82. package/dist/Icons/SortAscendingIcon.js +73 -0
  83. package/dist/Icons/SortDescendingIcon.d.ts +3 -0
  84. package/dist/Icons/SortDescendingIcon.js +73 -0
  85. package/dist/Icons/StackIcon.d.ts +3 -0
  86. package/dist/Icons/StackIcon.js +43 -0
  87. package/dist/Icons/StarIcon.d.ts +3 -0
  88. package/dist/Icons/StarIcon.js +31 -0
  89. package/dist/Icons/TrashIcon.js +10 -10
  90. package/dist/Icons/UndoIcon.js +1 -1
  91. package/dist/Icons/UserIcon.js +1 -1
  92. package/dist/Icons/WarningIcon.js +9 -9
  93. package/dist/Icons/ZoomAllIcon.js +97 -57
  94. package/dist/Icons/ZoomXIcon.js +6 -6
  95. package/dist/Icons/ZoomYIcon.js +17 -8
  96. package/dist/Icons/index.d.ts +10 -0
  97. package/dist/Icons.js +114 -94
  98. package/dist/Input.d.ts +2 -0
  99. package/dist/Input.js +100 -82
  100. package/dist/InputGroup.d.ts +16 -0
  101. package/dist/InputGroup.js +129 -0
  102. package/dist/InputOTP.d.ts +0 -2
  103. package/dist/InputOTP.js +148 -143
  104. package/dist/Label.d.ts +3 -7
  105. package/dist/Label.js +11 -11
  106. package/dist/MultiSelect/MultiSelectBase.js +28 -28
  107. package/dist/Popover.d.ts +6 -7
  108. package/dist/Popover.js +60 -71
  109. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +1 -1
  110. package/dist/RadioButtonGroup.js +1 -1
  111. package/dist/RadioGroup.d.ts +1 -1
  112. package/dist/RadioGroup.js +141 -134
  113. package/dist/Select.d.ts +12 -12
  114. package/dist/Select.js +106 -895
  115. package/dist/Separator.d.ts +12 -0
  116. package/dist/Separator.js +24 -0
  117. package/dist/Skeleton.js +3 -3
  118. package/dist/Slider.d.ts +15 -3
  119. package/dist/Slider.js +464 -40
  120. package/dist/Switch/SwitchBase.js +1 -1
  121. package/dist/Switch.js +2 -2
  122. package/dist/Tabs/TabsBase.js +1 -1
  123. package/dist/Tabs.js +16 -16
  124. package/dist/Textarea.js +58 -50
  125. package/dist/Toggle.js +2 -2
  126. package/dist/ToggleGroup.js +1 -1
  127. package/dist/Tooltip/TooltipBase.js +29 -29
  128. package/dist/Tooltip.js +15 -15
  129. package/dist/Tray/TrayStoriesData.d.ts +39 -0
  130. package/dist/Tray/TrayStoriesData.js +438 -0
  131. package/dist/Tray.d.ts +28 -0
  132. package/dist/Tray.js +236 -0
  133. package/dist/analyzer/network.webp +0 -0
  134. package/dist/analyzer/sunburst.webp +0 -0
  135. package/dist/analyzer/visual.webp +0 -0
  136. package/dist/clsx-OuTLNxxd.js +16 -0
  137. package/dist/components/Accordion/Accordion.d.ts +37 -0
  138. package/dist/components/Accordion/Accordion.d.ts.map +1 -0
  139. package/dist/components/Badge/Badge.d.ts +12 -2
  140. package/dist/components/Badge/Badge.d.ts.map +1 -1
  141. package/dist/components/Button/Button.d.ts +3 -3
  142. package/dist/components/Button/Button.d.ts.map +1 -1
  143. package/dist/components/ButtonGroup/ButtonGroup.d.ts +29 -0
  144. package/dist/components/ButtonGroup/ButtonGroup.d.ts.map +1 -0
  145. package/dist/components/ButtonGroup/ButtonGroupButton.d.ts +13 -0
  146. package/dist/components/ButtonGroup/ButtonGroupButton.d.ts.map +1 -0
  147. package/dist/components/Card/Card.d.ts +16 -0
  148. package/dist/components/Card/Card.d.ts.map +1 -0
  149. package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
  150. package/dist/components/Dialog/Dialog.d.ts +1 -1
  151. package/dist/components/Dialog/Dialog.d.ts.map +1 -1
  152. package/dist/components/Dialog/DialogBase.d.ts +6 -3
  153. package/dist/components/Dialog/DialogBase.d.ts.map +1 -1
  154. package/dist/components/HoverCard/HoverCard.d.ts +29 -0
  155. package/dist/components/HoverCard/HoverCard.d.ts.map +1 -0
  156. package/dist/components/Icons/AnalyzeIcon.d.ts +3 -0
  157. package/dist/components/Icons/AnalyzeIcon.d.ts.map +1 -0
  158. package/dist/components/Icons/ApprovedIcon.d.ts +3 -0
  159. package/dist/components/Icons/ApprovedIcon.d.ts.map +1 -0
  160. package/dist/components/Icons/DatabaseIcon.d.ts +3 -0
  161. package/dist/components/Icons/DatabaseIcon.d.ts.map +1 -0
  162. package/dist/components/Icons/DeleteIcon.d.ts.map +1 -1
  163. package/dist/components/Icons/EraserIcon.d.ts.map +1 -1
  164. package/dist/components/Icons/IconBase.d.ts +1 -1
  165. package/dist/components/Icons/IconBase.d.ts.map +1 -1
  166. package/dist/components/Icons/LineToolIcon.d.ts.map +1 -1
  167. package/dist/components/Icons/LineToolIcon2.d.ts +3 -0
  168. package/dist/components/Icons/LineToolIcon2.d.ts.map +1 -0
  169. package/dist/components/Icons/MessagesIcon.d.ts +3 -0
  170. package/dist/components/Icons/MessagesIcon.d.ts.map +1 -0
  171. package/dist/components/Icons/OntologyIcon.d.ts.map +1 -1
  172. package/dist/components/Icons/PlusIcon.d.ts.map +1 -1
  173. package/dist/components/Icons/ReviewedIcon.d.ts +3 -0
  174. package/dist/components/Icons/ReviewedIcon.d.ts.map +1 -0
  175. package/dist/components/Icons/SettingsIcon.d.ts.map +1 -1
  176. package/dist/components/Icons/SortAscendingIcon.d.ts +3 -0
  177. package/dist/components/Icons/SortAscendingIcon.d.ts.map +1 -0
  178. package/dist/components/Icons/SortDescendingIcon.d.ts +3 -0
  179. package/dist/components/Icons/SortDescendingIcon.d.ts.map +1 -0
  180. package/dist/components/Icons/StackIcon.d.ts +3 -0
  181. package/dist/components/Icons/StackIcon.d.ts.map +1 -0
  182. package/dist/components/Icons/StarIcon.d.ts +3 -0
  183. package/dist/components/Icons/StarIcon.d.ts.map +1 -0
  184. package/dist/components/Icons/ZoomAllIcon.d.ts.map +1 -1
  185. package/dist/components/Icons/ZoomYIcon.d.ts.map +1 -1
  186. package/dist/components/Icons/index.d.ts +10 -0
  187. package/dist/components/Icons/index.d.ts.map +1 -1
  188. package/dist/components/Input/Input.d.ts +2 -0
  189. package/dist/components/Input/Input.d.ts.map +1 -1
  190. package/dist/components/InputGroup/InputGroup.d.ts +16 -0
  191. package/dist/components/InputGroup/InputGroup.d.ts.map +1 -0
  192. package/dist/components/InputOTP/InputOTP.d.ts +0 -2
  193. package/dist/components/InputOTP/InputOTP.d.ts.map +1 -1
  194. package/dist/components/Label/Label.d.ts +3 -7
  195. package/dist/components/Label/Label.d.ts.map +1 -1
  196. package/dist/components/Popover/Popover.d.ts +6 -7
  197. package/dist/components/Popover/Popover.d.ts.map +1 -1
  198. package/dist/components/RadioGroup/RadioGroup.d.ts +1 -1
  199. package/dist/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  200. package/dist/components/Select/Select.d.ts +12 -12
  201. package/dist/components/Select/Select.d.ts.map +1 -1
  202. package/dist/components/Separator/Separator.d.ts +12 -0
  203. package/dist/components/Separator/Separator.d.ts.map +1 -0
  204. package/dist/components/Slider/Slider.d.ts +15 -3
  205. package/dist/components/Slider/Slider.d.ts.map +1 -1
  206. package/dist/components/Textarea/Textarea.d.ts.map +1 -1
  207. package/dist/components/Tray/Tray.d.ts +28 -0
  208. package/dist/components/Tray/Tray.d.ts.map +1 -0
  209. package/dist/components/Tray/TrayStoriesData.d.ts +39 -0
  210. package/dist/components/Tray/TrayStoriesData.d.ts.map +1 -0
  211. package/dist/{createLucideIcon-CI1yJrZf.js → createLucideIcon-B_8CJpcQ.js} +4 -4
  212. package/dist/features/AuthCard/ForgotPasswordEmailForm.js +13 -3
  213. package/dist/features/AuthCard/ForgotPasswordResetForm.js +9 -9
  214. package/dist/features/AuthCard/PasswordInput.js +87 -9
  215. package/dist/features/AuthCard/SignInForm.js +25 -15
  216. package/dist/features/AuthCard/SignUpForm.js +24 -14
  217. package/dist/features/AuthCard.js +2 -2
  218. package/dist/features/LabelingTools.js +16 -6
  219. package/dist/features/SensorMetadata.js +15 -5
  220. package/dist/features/SettingsPopover.js +22 -12
  221. package/dist/index-0ioNhtNM.js +10 -0
  222. package/dist/{index-CBwRmAsQ.js → index-6Abv_Flm.js} +1 -1
  223. package/dist/{index-DUK1rxhf.js → index-B-GQStVW.js} +6 -5
  224. package/dist/index-B2oBi8ng.js +142 -0
  225. package/dist/index-BIpuW_o8.js +146 -0
  226. package/dist/index-BZPx6jYI.js +8 -0
  227. package/dist/index-BhufZRa2.js +232 -0
  228. package/dist/index-CAKA12cC.js +1265 -0
  229. package/dist/{index-Cfyte2YO.js → index-CGALWSq_.js} +1 -1
  230. package/dist/index-CVSxKOPp.js +13 -0
  231. package/dist/index-CevVJ05e.js +822 -0
  232. package/dist/{index-CRBC94ik.js → index-D29mdTf5.js} +1 -1
  233. package/dist/{index-FeGk8zep.js → index-NzygPVvJ.js} +10 -9
  234. package/dist/index-UEFPWH8U.js +54 -0
  235. package/dist/index-rKs9bXHr.js +6 -0
  236. package/dist/{index-Cb7rjMhE.js → index-y6Br5T4h.js} +6 -6
  237. package/dist/index.d.ts +11 -1
  238. package/dist/index.d.ts.map +1 -1
  239. package/dist/linear-cursor-small.png +0 -0
  240. package/dist/{loader-circle-CvdzOiQ_.js → loader-circle-CdRVlFhN.js} +2 -2
  241. package/dist/main.js +15630 -13510
  242. package/dist/message-alert-matte-glass-gradient.webp +0 -0
  243. package/dist/primitives/button.d.ts +10 -0
  244. package/dist/primitives/button.d.ts.map +1 -0
  245. package/dist/primitives/button.js +42 -0
  246. package/dist/primitives/input.d.ts +3 -0
  247. package/dist/primitives/input.d.ts.map +1 -0
  248. package/dist/primitives/input.js +18 -0
  249. package/dist/primitives/select.d.ts +16 -0
  250. package/dist/primitives/select.d.ts.map +1 -0
  251. package/dist/primitives/select.js +205 -0
  252. package/dist/primitives/slot.d.ts.map +1 -1
  253. package/dist/primitives/slot.js +21 -20
  254. package/dist/primitives/textarea.d.ts +3 -0
  255. package/dist/primitives/textarea.d.ts.map +1 -0
  256. package/dist/primitives/textarea.js +16 -0
  257. package/dist/{proxy-DD79Ok6n.js → proxy-C9AqCss6.js} +1 -1
  258. package/dist/speech-bubble-fluid-glass-gradient.webp +0 -0
  259. package/dist/styles/main.css +1 -1
  260. package/dist/utils/formFieldUtils.js +1 -1
  261. package/dist/utils/twUtils.js +2728 -2
  262. package/dist/{x-BBpi7a_7.js → x-Dl66o_vF.js} +2 -2
  263. package/package.json +28 -23
  264. package/dist/Accordion/AccordionBase.d.ts +0 -42
  265. package/dist/Accordion/AccordionBase.js +0 -225
  266. package/dist/Badge/BadgeBase.d.ts +0 -13
  267. package/dist/Badge/BadgeBase.js +0 -35
  268. package/dist/PasswordInput-ClY_hxuN.js +0 -261
  269. package/dist/components/Accordion/AccordionBase.d.ts +0 -42
  270. package/dist/components/Accordion/AccordionBase.d.ts.map +0 -1
  271. package/dist/components/Badge/BadgeBase.d.ts +0 -13
  272. package/dist/components/Badge/BadgeBase.d.ts.map +0 -1
  273. package/dist/index-CA7haECj.js +0 -248
  274. package/dist/index-CbXx14YO.js +0 -59
  275. package/dist/index-VXXKXen4.js +0 -15
  276. package/dist/index-cCg4yNa8.js +0 -132
  277. package/dist/primitives/label.d.ts +0 -5
  278. package/dist/primitives/label.d.ts.map +0 -1
  279. package/dist/primitives/label.js +0 -27
  280. package/dist/twUtils-CRiPKpXj.js +0 -2743
  281. /package/dist/{list.yml.webp → analyzer/list.yml.webp} +0 -0
@@ -1,62 +1,69 @@
1
1
  "use client";
2
2
  import "../styles/main.css";
3
- import { jsx as s, jsxs as v } from "react/jsx-runtime";
4
- import { c as d } from "../twUtils-CRiPKpXj.js";
5
- import { c as B } from "../index-CRBC94ik.js";
6
- import { createContext as N, useContext as z, useState as y, useMemo as k, useCallback as b, cloneElement as D, useEffect as x, useRef as P, isValidElement as w } from "react";
7
- import { createPortal as T } from "react-dom";
8
- import { X as V } from "../x-BBpi7a_7.js";
9
- const h = N(null);
10
- function f() {
11
- const e = z(h);
3
+ import { jsx as s, jsxs as E } from "react/jsx-runtime";
4
+ 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);
10
+ function m() {
11
+ const e = L(z);
12
12
  if (!e)
13
13
  throw new Error("Dialog components must be used within <Dialog>");
14
14
  return e;
15
15
  }
16
- function I(e) {
17
- return w(e) && typeof e.type != "string" ? !0 : w(e);
16
+ function R(e) {
17
+ return B(e) && typeof e.type != "string" ? !0 : B(e);
18
18
  }
19
- let C = 0;
20
- function S({ isOpen: e, defaultOpen: t = !1, onOpenChange: n, children: o }) {
21
- const [r, a] = y(t), c = e !== void 0, m = c ? e : r, p = k(
19
+ let D = 0;
20
+ function J({
21
+ isOpen: e,
22
+ defaultOpen: t = !1,
23
+ onOpenChange: n,
24
+ children: o,
25
+ modal: r = !0
26
+ }) {
27
+ const [u, i] = N(t), d = e !== void 0, g = d ? e : u, x = I(
22
28
  () => ({
23
- contentId: `dialog-content-${++C}`,
24
- titleId: `dialog-title-${C}`,
25
- descriptionId: `dialog-description-${C}`
29
+ contentId: `dialog-content-${++D}`,
30
+ titleId: `dialog-title-${D}`,
31
+ descriptionId: `dialog-description-${D}`
26
32
  }),
27
33
  []
28
- ), g = b(
34
+ ), b = y(
29
35
  (l) => {
30
- c || a(l), n?.(l);
36
+ d || i(l), n?.(l);
31
37
  },
32
- [c, n]
33
- ), u = k(
38
+ [d, n]
39
+ ), C = I(
34
40
  () => ({
35
- isOpen: m,
36
- setIsOpen: g,
37
- ...p
41
+ isOpen: g,
42
+ setIsOpen: b,
43
+ modal: r,
44
+ ...x
38
45
  }),
39
- [m, g, p]
46
+ [g, b, r, x]
40
47
  );
41
- return /* @__PURE__ */ s(h.Provider, { value: u, children: o });
48
+ return /* @__PURE__ */ s(z.Provider, { value: C, children: o });
42
49
  }
43
- function U({ children: e, asChild: t = !0 }) {
44
- const { setIsOpen: n } = f(), o = b(() => {
50
+ function K({ children: e, asChild: t = !0 }) {
51
+ const { setIsOpen: n } = m(), o = y(() => {
45
52
  n(!0);
46
53
  }, [n]);
47
54
  if (!t)
48
55
  return /* @__PURE__ */ s("button", { onClick: o, children: e });
49
- if (!I(e))
56
+ if (!R(e))
50
57
  throw new Error("DialogTrigger expects a single React element as child");
51
58
  const r = e.props.onClick;
52
- return D(e, {
53
- onClick: (...a) => {
54
- r?.(...a), o();
59
+ return O(e, {
60
+ onClick: (...u) => {
61
+ r?.(...u), o();
55
62
  }
56
63
  });
57
64
  }
58
- function L({ children: e, asChild: t = !0 }) {
59
- const { setIsOpen: n } = f(), o = b(() => {
65
+ function $({ children: e, asChild: t = !0 }) {
66
+ const { setIsOpen: n } = m(), o = y(() => {
60
67
  n(!1);
61
68
  }, [n]);
62
69
  if (!t)
@@ -69,30 +76,30 @@ function L({ children: e, asChild: t = !0 }) {
69
76
  children: e
70
77
  }
71
78
  );
72
- if (!I(e))
79
+ if (!R(e))
73
80
  throw new Error("DialogClose expects a single React element as child");
74
81
  const r = e.props.onClick;
75
- return D(e, {
76
- onClick: (...a) => {
77
- r?.(...a), o();
82
+ return O(e, {
83
+ onClick: (...u) => {
84
+ r?.(...u), o();
78
85
  }
79
86
  });
80
87
  }
81
- function E({ children: e, container: t }) {
82
- const [n, o] = y(!1);
83
- return x(() => (o(!0), () => o(!1)), []), n ? T(e, t ?? document.body) : null;
88
+ function T({ children: e, container: t }) {
89
+ const [n, o] = N(!1);
90
+ return w(() => (o(!0), () => o(!1)), []), n ? j(e, t ?? document.body) : null;
84
91
  }
85
- function X({ className: e }) {
86
- const { isOpen: t, setIsOpen: n } = f(), o = b(
92
+ function Q({ className: e }) {
93
+ const { isOpen: t, setIsOpen: n } = m(), o = y(
87
94
  (r) => {
88
95
  r.target === r.currentTarget && n(!1);
89
96
  },
90
97
  [n]
91
98
  );
92
- return t ? /* @__PURE__ */ s(E, { children: /* @__PURE__ */ s(
99
+ return t ? /* @__PURE__ */ s(T, { children: /* @__PURE__ */ s(
93
100
  "div",
94
101
  {
95
- className: d(
102
+ className: f(
96
103
  "data-[state=open]:animate-in data-[state=open]:fade-in-0 fixed inset-0 z-40 bg-black/50 backdrop-blur-sm",
97
104
  "data-[state=closed]:animate-out data-[state=closed]:fade-out-0",
98
105
  e
@@ -103,7 +110,7 @@ function X({ className: e }) {
103
110
  }
104
111
  ) }) : null;
105
112
  }
106
- const R = B(
113
+ const M = P(
107
114
  [
108
115
  "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",
109
116
  "data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95"
@@ -123,58 +130,66 @@ const R = B(
123
130
  }
124
131
  }
125
132
  );
126
- function q({
133
+ function W({
127
134
  children: e,
128
135
  className: t,
129
136
  size: n,
130
137
  onPointerDownOutside: o,
131
- onEscapeKeyDown: r
138
+ onInteractOutside: r,
139
+ onEscapeKeyDown: u
132
140
  }) {
133
- const { isOpen: a, setIsOpen: c, contentId: m, titleId: p, descriptionId: g } = f(), u = P(null);
134
- return x(() => {
135
- if (!a || !u.current) return;
136
- const l = u.current, i = document.activeElement;
137
- return l.focus(), () => {
138
- i && typeof i.focus == "function" && i.focus();
139
- };
140
- }, [a]), x(() => {
141
- if (!a) return;
142
- const l = (i) => {
143
- i.key === "Escape" && (r?.(i), i.defaultPrevented || (i.preventDefault(), c(!1)));
141
+ const { isOpen: i, setIsOpen: d, contentId: g, titleId: x, descriptionId: b, modal: C } = m(), l = k(null), p = k(null), v = k(!1);
142
+ return w(() => {
143
+ if (!i) {
144
+ v.current && p.current && typeof p.current.focus == "function" && p.current.focus(), p.current = null, v.current = !1;
145
+ return;
146
+ }
147
+ if (!l.current || v.current) return;
148
+ v.current = !0;
149
+ const c = l.current;
150
+ p.current = document.activeElement, setTimeout(() => {
151
+ if (!c || !l.current) return;
152
+ const a = document.activeElement;
153
+ (!c.contains(a) || a === document.body) && c.focus();
154
+ }, 0);
155
+ }, [i]), w(() => {
156
+ if (!i) return;
157
+ const c = (a) => {
158
+ a.key === "Escape" && (u?.(a), r?.(a), a.defaultPrevented || (a.preventDefault(), d(!1)));
144
159
  };
145
- return document.addEventListener("keydown", l, { capture: !0 }), () => {
146
- document.removeEventListener("keydown", l, { capture: !0 });
160
+ return document.addEventListener("keydown", c, { capture: !0 }), () => {
161
+ document.removeEventListener("keydown", c, { capture: !0 });
147
162
  };
148
- }, [a, r, c]), x(() => {
149
- if (!a) return;
150
- const l = (i) => {
151
- const O = i.target;
152
- u.current && !u.current.contains(O) && (o?.(i), i.defaultPrevented || c(!1));
163
+ }, [i, u, r, d]), w(() => {
164
+ if (!i) return;
165
+ const c = (a) => {
166
+ const h = a.target;
167
+ l.current && !l.current.contains(h) && (h.closest('[role="dialog"]') !== null || (o?.(a), r?.(a), !C && !a.defaultPrevented && d(!1)));
153
168
  };
154
- return document.addEventListener("pointerdown", l, { capture: !0 }), () => document.removeEventListener("pointerdown", l, { capture: !0 });
155
- }, [a, o, c]), a ? /* @__PURE__ */ s(E, { children: /* @__PURE__ */ v(
169
+ return document.addEventListener("pointerdown", c), () => document.removeEventListener("pointerdown", c);
170
+ }, [i, o, r, d, C]), i ? /* @__PURE__ */ s(T, { children: /* @__PURE__ */ E(
156
171
  "div",
157
172
  {
158
- ref: u,
159
- id: m,
173
+ ref: l,
174
+ id: g,
160
175
  role: "dialog",
161
176
  "aria-modal": "true",
162
- "aria-labelledby": p,
163
- "aria-describedby": g,
164
- "data-state": a ? "open" : "closed",
177
+ "aria-labelledby": x,
178
+ "aria-describedby": b,
179
+ "data-state": i ? "open" : "closed",
165
180
  tabIndex: -1,
166
- className: d(R({ size: n }), t),
181
+ className: f(M({ size: n }), t),
167
182
  children: [
168
- /* @__PURE__ */ s(L, { asChild: !0, children: /* @__PURE__ */ v(
183
+ /* @__PURE__ */ s($, { asChild: !0, children: /* @__PURE__ */ E(
169
184
  "button",
170
185
  {
171
- className: d(
186
+ className: f(
172
187
  "ring-offset-background absolute top-4 right-4 rounded-sm opacity-70 transition-opacity hover:opacity-100",
173
188
  "focus:ring-ring focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none"
174
189
  ),
175
190
  "aria-label": "Close dialog",
176
191
  children: [
177
- /* @__PURE__ */ s(V, { className: "h-4 w-4" }),
192
+ /* @__PURE__ */ s(A, { className: "h-4 w-4" }),
178
193
  /* @__PURE__ */ s("span", { className: "sr-only", children: "Close" })
179
194
  ]
180
195
  }
@@ -184,30 +199,30 @@ function q({
184
199
  }
185
200
  ) }) : null;
186
201
  }
187
- function G({ children: e, className: t }) {
188
- const { titleId: n } = f();
189
- return /* @__PURE__ */ s("h2", { id: n, className: d("text-base leading-none font-semibold tracking-tight", t), children: e });
202
+ function Y({ children: e, className: t }) {
203
+ const { titleId: n } = m();
204
+ return /* @__PURE__ */ s("h2", { id: n, className: f("text-base leading-none font-semibold tracking-tight", t), children: e });
190
205
  }
191
- function J({ children: e, className: t }) {
192
- const { descriptionId: n } = f();
193
- return /* @__PURE__ */ s("p", { id: n, className: d("text-text-secondary text-sm", t), children: e });
206
+ function Z({ children: e, className: t }) {
207
+ const { descriptionId: n } = m();
208
+ return /* @__PURE__ */ s("p", { id: n, className: f("text-text-secondary text-sm", t), children: e });
194
209
  }
195
- function K({ children: e, className: t }) {
196
- return /* @__PURE__ */ s("div", { className: d("flex flex-col space-y-1.5 text-center text-left", t), children: e });
210
+ function _({ children: e, className: t }) {
211
+ return /* @__PURE__ */ s("div", { className: f("flex flex-col space-y-1.5 text-center text-left", t), children: e });
197
212
  }
198
- function Q({ children: e, className: t }) {
199
- return /* @__PURE__ */ s("div", { className: d("flex flex-col-reverse flex-row justify-end space-x-2", t), children: e });
213
+ function ee({ children: e, className: t }) {
214
+ return /* @__PURE__ */ s("div", { className: f("flex flex-col-reverse flex-row justify-end space-x-2", t), children: e });
200
215
  }
201
216
  export {
202
- S as DialogBase,
203
- L as DialogCloseBase,
204
- q as DialogContentBase,
205
- J as DialogDescriptionBase,
206
- Q as DialogFooterBase,
207
- K as DialogHeaderBase,
208
- X as DialogOverlayBase,
209
- E as DialogPortalBase,
210
- G as DialogTitleBase,
211
- U as DialogTriggerBase,
212
- f as useDialogContext
217
+ J as DialogBase,
218
+ $ as DialogCloseBase,
219
+ W as DialogContentBase,
220
+ Z as DialogDescriptionBase,
221
+ ee as DialogFooterBase,
222
+ _ as DialogHeaderBase,
223
+ Q as DialogOverlayBase,
224
+ T as DialogPortalBase,
225
+ Y as DialogTitleBase,
226
+ K as DialogTriggerBase,
227
+ m as useDialogContext
213
228
  };
package/dist/Dialog.d.ts CHANGED
@@ -5,7 +5,7 @@ declare function DialogTrigger({ ...props }: ComponentProps<typeof DialogTrigger
5
5
  declare function DialogPortal({ ...props }: ComponentProps<typeof DialogPortalBase>): import("react/jsx-runtime").JSX.Element;
6
6
  declare function DialogClose({ ...props }: ComponentProps<typeof DialogCloseBase>): import("react/jsx-runtime").JSX.Element;
7
7
  declare function DialogOverlay({ className, ...props }: ComponentProps<typeof DialogOverlayBase>): import("react/jsx-runtime").JSX.Element;
8
- declare function DialogContent({ className, children, ...props }: ComponentProps<typeof DialogContentBase> & {
8
+ declare function DialogContent({ className, children, onInteractOutside, onPointerDownOutside, onEscapeKeyDown, ...props }: ComponentProps<typeof DialogContentBase> & {
9
9
  showCloseButton?: boolean;
10
10
  }): import("react/jsx-runtime").JSX.Element;
11
11
  declare function DialogHeader({ className, ...props }: ComponentProps<typeof DialogHeaderBase>): import("react/jsx-runtime").JSX.Element;
package/dist/Dialog.js CHANGED
@@ -1,23 +1,23 @@
1
1
  import "./styles/main.css";
2
- import { jsx as e, Fragment as i } from "react/jsx-runtime";
3
- import { DialogBase as n, DialogCloseBase as s, DialogContentBase as r, DialogDescriptionBase as d, DialogFooterBase as g, DialogHeaderBase as c, DialogOverlayBase as u, DialogPortalBase as f, DialogTitleBase as m, DialogTriggerBase as D } from "./Dialog/DialogBase.js";
4
- import { c as o } from "./twUtils-CRiPKpXj.js";
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";
5
5
  import "react";
6
- function N({ ...a }) {
7
- return /* @__PURE__ */ e(n, { "data-slot": "dialog", ...a });
6
+ function C({ ...a }) {
7
+ return /* @__PURE__ */ e(d, { "data-slot": "dialog", ...a });
8
8
  }
9
- function b({ ...a }) {
10
- return /* @__PURE__ */ e(D, { asChild: !0, "data-slot": "dialog-trigger", ...a });
9
+ function h({ ...a }) {
10
+ return /* @__PURE__ */ e(B, { asChild: !0, "data-slot": "dialog-trigger", ...a });
11
11
  }
12
- function w({ ...a }) {
13
- return /* @__PURE__ */ e(f, { "data-slot": "dialog-portal", ...a });
12
+ function v({ ...a }) {
13
+ return /* @__PURE__ */ e(p, { "data-slot": "dialog-portal", ...a });
14
14
  }
15
- function C({ ...a }) {
16
- return /* @__PURE__ */ e(s, { "data-slot": "dialog-close", ...a });
15
+ function z({ ...a }) {
16
+ return /* @__PURE__ */ e(g, { "data-slot": "dialog-close", ...a });
17
17
  }
18
- function h({ className: a, ...t }) {
18
+ function T({ className: a, ...t }) {
19
19
  return /* @__PURE__ */ e(
20
- u,
20
+ D,
21
21
  {
22
22
  "data-slot": "dialog-overlay",
23
23
  className: o(
@@ -28,27 +28,33 @@ function h({ className: a, ...t }) {
28
28
  }
29
29
  );
30
30
  }
31
- function v({
31
+ function F({
32
32
  className: a,
33
33
  children: t,
34
- ...l
34
+ onInteractOutside: l,
35
+ onPointerDownOutside: i,
36
+ onEscapeKeyDown: n,
37
+ ...r
35
38
  }) {
36
- return /* @__PURE__ */ e(i, { children: /* @__PURE__ */ e(
37
- r,
39
+ return /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
40
+ c,
38
41
  {
39
42
  "data-slot": "dialog-content",
40
43
  className: o(
41
44
  "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)] max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg p-6 shadow-lg duration-200",
42
45
  a
43
46
  ),
44
- ...l,
47
+ onInteractOutside: l,
48
+ onPointerDownOutside: i,
49
+ onEscapeKeyDown: n,
50
+ ...r,
45
51
  children: t
46
52
  }
47
53
  ) });
48
54
  }
49
- function z({ className: a, ...t }) {
55
+ function j({ className: a, ...t }) {
50
56
  return /* @__PURE__ */ e(
51
- c,
57
+ m,
52
58
  {
53
59
  "data-slot": "dialog-header",
54
60
  className: o("flex flex-col gap-2 text-center sm:text-left", a),
@@ -56,9 +62,9 @@ function z({ className: a, ...t }) {
56
62
  }
57
63
  );
58
64
  }
59
- function T({ className: a, ...t }) {
65
+ function H({ className: a, ...t }) {
60
66
  return /* @__PURE__ */ e(
61
- g,
67
+ f,
62
68
  {
63
69
  "data-slot": "dialog-footer",
64
70
  className: o("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", a),
@@ -66,9 +72,9 @@ function T({ className: a, ...t }) {
66
72
  }
67
73
  );
68
74
  }
69
- function F({ className: a, ...t }) {
75
+ function O({ className: a, ...t }) {
70
76
  return /* @__PURE__ */ e(
71
- m,
77
+ x,
72
78
  {
73
79
  "data-slot": "dialog-title",
74
80
  className: o("text-lg leading-none font-semibold", a),
@@ -76,9 +82,9 @@ function F({ className: a, ...t }) {
76
82
  }
77
83
  );
78
84
  }
79
- function j({ className: a, ...t }) {
85
+ function P({ className: a, ...t }) {
80
86
  return /* @__PURE__ */ e(
81
- d,
87
+ u,
82
88
  {
83
89
  "data-slot": "dialog-description",
84
90
  className: o("text-muted-foreground text-sm", a),
@@ -87,14 +93,14 @@ function j({ className: a, ...t }) {
87
93
  );
88
94
  }
89
95
  export {
90
- N as Dialog,
91
- C as DialogClose,
92
- v as DialogContent,
93
- j as DialogDescription,
94
- T as DialogFooter,
95
- z as DialogHeader,
96
- h as DialogOverlay,
97
- w as DialogPortal,
98
- F as DialogTitle,
99
- b as DialogTrigger
96
+ C as Dialog,
97
+ z as DialogClose,
98
+ F as DialogContent,
99
+ P as DialogDescription,
100
+ H as DialogFooter,
101
+ j as DialogHeader,
102
+ T as DialogOverlay,
103
+ v as DialogPortal,
104
+ O as DialogTitle,
105
+ h as DialogTrigger
100
106
  };