@spear-ai/spectral 1.9.0 → 1.10.0

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 (237) hide show
  1. package/README.md +6 -5
  2. package/dist/.js +112 -239
  3. package/dist/Accordion-CDXdSAST.js +363 -0
  4. package/dist/Accordion.js +3 -498
  5. package/dist/Alert/AlertBase.js +69 -152
  6. package/dist/Alert.js +58 -106
  7. package/dist/AnimatePresence-D-9jXfgI.js +178 -0
  8. package/dist/App.js +6 -6
  9. package/dist/Avatar.js +83 -65
  10. package/dist/Badge.d.ts +1 -3
  11. package/dist/Badge.js +21 -25
  12. package/dist/Button.js +102 -178
  13. package/dist/ButtonGroup/ButtonGroupButton.js +38 -40
  14. package/dist/ButtonGroup.js +55 -59
  15. package/dist/ButtonIcon.js +58 -134
  16. package/dist/Calendar-s4lyijkn.js +3109 -0
  17. package/dist/Checkbox/CheckboxBase.js +94 -126
  18. package/dist/Checkbox.d.ts +1 -1
  19. package/dist/Checkbox.js +40 -105
  20. package/dist/Combobox/ComboboxBase.js +2 -79
  21. package/dist/Combobox.js +106 -172
  22. package/dist/ComboboxBase-D8Nf4xC-.js +491 -0
  23. package/dist/ControlGroup/ControlGroupSelect.d.ts +1 -1
  24. package/dist/ControlGroup/ControlGroupSelect.js +85 -101
  25. package/dist/ControlGroup.js +45 -48
  26. package/dist/DataCard/Card.js +37 -12
  27. package/dist/DataCard.d.ts +1 -1
  28. package/dist/DataCard.js +36 -16
  29. package/dist/DateTimePicker/Calendar.js +2 -2967
  30. package/dist/DateTimePicker/DateTimeDisplayInput.d.ts +1 -1
  31. package/dist/DateTimePicker/DateTimeDisplayInput.js +379 -274
  32. package/dist/DateTimePicker/DateTimeInput.d.ts +5 -3
  33. package/dist/DateTimePicker/DateTimeInput.js +133 -88
  34. package/dist/DateTimePicker/DateTimeUtils.js +2 -2193
  35. package/dist/DateTimePicker/TimePeriodSelect.d.ts +1 -1
  36. package/dist/DateTimePicker/TimePeriodSelect.js +45 -20
  37. package/dist/DateTimePicker/TimePicker.d.ts +1 -1
  38. package/dist/DateTimePicker/TimePicker.js +76 -60
  39. package/dist/DateTimePicker.d.ts +2 -2
  40. package/dist/DateTimePicker.js +87 -205
  41. package/dist/DateTimeUtils-DVvG6H-p.js +2098 -0
  42. package/dist/Dialog.js +74 -74
  43. package/dist/Drawer.js +67 -37
  44. package/dist/HoverCard-CYDsIiVK.js +201 -0
  45. package/dist/HoverCard.d.ts +1 -1
  46. package/dist/HoverCard.js +2 -218
  47. package/dist/Icons/AnalyzeIcon.js +50 -57
  48. package/dist/Icons/AnnotationsIcon.js +20 -15
  49. package/dist/Icons/ApprovedIcon.js +26 -18
  50. package/dist/Icons/ArrowDownIcon.js +20 -6
  51. package/dist/Icons/ArrowUpIcon.js +20 -6
  52. package/dist/Icons/BoxToolIcon.js +17 -12
  53. package/dist/Icons/CalendarIcon.js +43 -20
  54. package/dist/Icons/CheckCircleIcon.js +26 -10
  55. package/dist/Icons/CheckSquareIcon.js +26 -10
  56. package/dist/Icons/CheckmarkIcon.js +22 -9
  57. package/dist/Icons/ChevronDownIcon.js +22 -9
  58. package/dist/Icons/ChevronUpIcon.js +22 -9
  59. package/dist/Icons/ClockIcon.js +26 -18
  60. package/dist/Icons/CloseCircleIcon.js +26 -10
  61. package/dist/Icons/CloseIcon.js +18 -9
  62. package/dist/Icons/DashboardIcon.js +36 -10
  63. package/dist/Icons/DatabaseIcon.js +36 -19
  64. package/dist/Icons/DeleteIcon.js +36 -19
  65. package/dist/Icons/DurationIcon.js +57 -22
  66. package/dist/Icons/EditIcon.js +26 -27
  67. package/dist/Icons/EmailIcon.js +26 -10
  68. package/dist/Icons/EraserIcon.js +41 -25
  69. package/dist/Icons/ErrorIcon.js +27 -11
  70. package/dist/Icons/EyeClosedIcon.js +29 -13
  71. package/dist/Icons/EyeClosedIcon2.js +27 -11
  72. package/dist/Icons/EyeOpenIcon.js +22 -9
  73. package/dist/Icons/FileDownloadIcon.js +43 -20
  74. package/dist/Icons/GoToFirstIcon.js +26 -9
  75. package/dist/Icons/GoToLastIcon.js +26 -9
  76. package/dist/Icons/HarmonicCursorsIcon.js +23 -9
  77. package/dist/Icons/IconBase.d.ts +3 -3
  78. package/dist/Icons/IconBase.js +49 -23
  79. package/dist/Icons/InfoIcon.js +36 -10
  80. package/dist/Icons/KeyboardIcon.js +26 -27
  81. package/dist/Icons/LabelIcon.js +19 -14
  82. package/dist/Icons/LassoIcon.js +36 -28
  83. package/dist/Icons/LineToolIcon.js +48 -39
  84. package/dist/Icons/LiveViewIcon.js +50 -12
  85. package/dist/Icons/LoaderIcon.js +67 -27
  86. package/dist/Icons/LocationIcon.js +26 -27
  87. package/dist/Icons/LogoutIcon.js +20 -15
  88. package/dist/Icons/MeasureIcon.js +78 -25
  89. package/dist/Icons/MessagesIcon.js +33 -18
  90. package/dist/Icons/MetadataIcon.js +20 -15
  91. package/dist/Icons/MinusIcon.d.ts +1 -1
  92. package/dist/Icons/MinusIcon.js +18 -6
  93. package/dist/Icons/OntologyIcon.js +87 -71
  94. package/dist/Icons/PanelIconClose.js +28 -10
  95. package/dist/Icons/PanelIconOpen.js +28 -10
  96. package/dist/Icons/PlayIcon.js +20 -6
  97. package/dist/Icons/PlusIcon.js +20 -14
  98. package/dist/Icons/PolygonIcon.js +50 -39
  99. package/dist/Icons/ProgressCheckIcon.d.ts +5 -0
  100. package/dist/Icons/ProgressCheckIcon.js +58 -0
  101. package/dist/Icons/ResetIcon.js +17 -12
  102. package/dist/Icons/ReviewedIcon.js +36 -19
  103. package/dist/Icons/ScissorsIcon.js +22 -17
  104. package/dist/Icons/SearchIcon.js +26 -9
  105. package/dist/Icons/SettingsIcon.js +26 -27
  106. package/dist/Icons/SortAscendingIcon.js +50 -12
  107. package/dist/Icons/SortAtoZIcon.js +50 -12
  108. package/dist/Icons/SortDescendingIcon.js +50 -12
  109. package/dist/Icons/SortZtoAIcon.js +50 -12
  110. package/dist/Icons/StackIcon.js +26 -9
  111. package/dist/Icons/StarIcon.js +20 -6
  112. package/dist/Icons/TrashIcon.js +17 -12
  113. package/dist/Icons/UndoIcon.js +20 -15
  114. package/dist/Icons/User2Icon.js +26 -10
  115. package/dist/Icons/UserIcon.js +19 -14
  116. package/dist/Icons/WarningIcon.js +19 -14
  117. package/dist/Icons/ZoomAllIcon.js +71 -15
  118. package/dist/Icons/ZoomXIcon.js +36 -10
  119. package/dist/Icons/ZoomYIcon.js +36 -10
  120. package/dist/Icons/index.d.ts +1 -0
  121. package/dist/Icons.js +68 -136
  122. package/dist/IconsAnimated/PanelLeftCloseIcon.js +66 -36
  123. package/dist/IconsAnimated/PanelLeftOpenIcon.js +66 -36
  124. package/dist/IconsAnimated.js +3 -6
  125. package/dist/Input/InputUtils.js +51 -52
  126. package/dist/Input.js +132 -185
  127. package/dist/InputOTP-XUWW9xcI.js +461 -0
  128. package/dist/InputOTP.js +2 -382
  129. package/dist/Kbd.d.ts +1 -1
  130. package/dist/Kbd.js +182 -86
  131. package/dist/Label.js +12 -14
  132. package/dist/MultiSelect/MultiSelectBase.js +331 -403
  133. package/dist/MultiSelect.d.ts +1 -1
  134. package/dist/MultiSelect.js +23 -23
  135. package/dist/Popover.js +28 -32
  136. package/dist/RadioButton.d.ts +17 -0
  137. package/dist/RadioButton.js +33 -0
  138. package/dist/RadioButtonGroup/RadioButtonGroupBase.d.ts +3 -1
  139. package/dist/RadioButtonGroup/RadioButtonGroupBase.js +49 -46
  140. package/dist/RadioButtonGroup.d.ts +1 -1
  141. package/dist/RadioButtonGroup.js +11 -8
  142. package/dist/RadioGroup-w_q6RGEK.js +447 -0
  143. package/dist/RadioGroup.js +2 -505
  144. package/dist/Select.js +163 -186
  145. package/dist/Separator.js +16 -19
  146. package/dist/Skeleton.js +10 -6
  147. package/dist/Slider-BzzZT3Zm.js +490 -0
  148. package/dist/Slider.js +2 -562
  149. package/dist/SpectralProvider.js +8 -5
  150. package/dist/Switch/SwitchBase.js +91 -95
  151. package/dist/Switch-CVzRJ-0n.js +126 -0
  152. package/dist/Switch.d.ts +1 -1
  153. package/dist/Switch.js +2 -134
  154. package/dist/Tabs/TabsBase.js +242 -250
  155. package/dist/Tabs/tabsUtils.js +65 -73
  156. package/dist/Tabs.d.ts +1 -1
  157. package/dist/Tabs.js +73 -103
  158. package/dist/Textarea/TextareaUtils.js +35 -46
  159. package/dist/Textarea.js +83 -160
  160. package/dist/Toast-9zqXxKKO.js +711 -0
  161. package/dist/Toast.js +2 -885
  162. package/dist/Toggle/ToggleBase.js +46 -56
  163. package/dist/Toggle.d.ts +1 -1
  164. package/dist/Toggle.js +52 -62
  165. package/dist/ToggleGroup/ToggleGroupBase.js +128 -104
  166. package/dist/ToggleGroup.d.ts +1 -1
  167. package/dist/ToggleGroup.js +52 -63
  168. package/dist/Tooltip-D1K8kY1y.js +389 -0
  169. package/dist/Tooltip.js +2 -365
  170. package/dist/Tray.js +174 -217
  171. package/dist/chunk-h9knIhTc.js +20 -0
  172. package/dist/clsx-jM1GlMvB.js +16 -0
  173. package/dist/dist-3Af8168y.js +913 -0
  174. package/dist/dist-7HRQ5IKN.js +249 -0
  175. package/dist/dist-B2k1iWFp.js +129 -0
  176. package/dist/dist-B4FgboI8.js +122 -0
  177. package/dist/dist-B4g6zpUF.js +33 -0
  178. package/dist/dist-B9tup-4O.js +216 -0
  179. package/dist/dist-BK1K0g9W.js +29 -0
  180. package/dist/dist-Bfjk-jx9.js +28 -0
  181. package/dist/dist-Bft31cJh.js +65 -0
  182. package/dist/dist-BtdmHAzK.js +190 -0
  183. package/dist/dist-C0Hifjgh.js +1287 -0
  184. package/dist/dist-CGzgmYB9.js +68 -0
  185. package/dist/dist-ClmepHp4.js +10 -0
  186. package/dist/dist-D8Wb_MX9.js +6 -0
  187. package/dist/dist-Dtvmk11N.js +12 -0
  188. package/dist/dist-fW81qjVl.js +677 -0
  189. package/dist/dist-s1uWaZYZ.js +11 -0
  190. package/dist/es2015-YHaMV-St.js +701 -0
  191. package/dist/hooks/useAccordionAutoScroll.js +66 -67
  192. package/dist/hooks/useControllableState.js +14 -13
  193. package/dist/hooks/useTheme.js +21 -17
  194. package/dist/index.d.ts +2 -1
  195. package/dist/index.d.ts.map +1 -1
  196. package/dist/main.js +18954 -27224
  197. package/dist/primitives/button.js +39 -41
  198. package/dist/primitives/input-group.js +57 -73
  199. package/dist/primitives/input.js +11 -20
  200. package/dist/primitives/popover.d.ts.map +1 -1
  201. package/dist/primitives/popover.js +34 -25
  202. package/dist/primitives/select.js +70 -138
  203. package/dist/primitives/slot.js +32 -31
  204. package/dist/primitives/textarea.js +10 -16
  205. package/dist/proxy-Dn10Pl_g.js +4920 -0
  206. package/dist/styles/main.css +2 -1
  207. package/dist/styles/spectral.css +1 -1
  208. package/dist/twUtils-VNWgstKL.js +1673 -0
  209. package/dist/use-animation-CBUDycyW.js +57 -0
  210. package/dist/utils/constants.js +4 -4
  211. package/dist/utils/formFieldUtils.js +136 -148
  212. package/dist/utils/sharedUtils.js +26 -7
  213. package/dist/utils/twUtils.js +2 -2919
  214. package/package.json +24 -28
  215. package/dist/ComboboxBase-CxNxYtdT.js +0 -408
  216. package/dist/clsx-OuTLNxxd.js +0 -16
  217. package/dist/index-0ioNhtNM.js +0 -10
  218. package/dist/index-6oYKCvIn.js +0 -677
  219. package/dist/index-BFOf48AQ.js +0 -69
  220. package/dist/index-BZPx6jYI.js +0 -8
  221. package/dist/index-BlHU_t18.js +0 -142
  222. package/dist/index-Bm1RbF6w.js +0 -1037
  223. package/dist/index-Bv2OIg5P.js +0 -225
  224. package/dist/index-CKEI0pDv.js +0 -56
  225. package/dist/index-CM_hWgfC.js +0 -32
  226. package/dist/index-C_YVr64u.js +0 -1538
  227. package/dist/index-Cl8VeY0o.js +0 -149
  228. package/dist/index-CwSyIPrv.js +0 -13
  229. package/dist/index-D29mdTf5.js +0 -34
  230. package/dist/index-DEYs15GP.js +0 -66
  231. package/dist/index-Dc0No4pV.js +0 -233
  232. package/dist/index-T6XEa11q.js +0 -822
  233. package/dist/index-pBCLb6Gr.js +0 -240
  234. package/dist/index-psiVrsnE.js +0 -27
  235. package/dist/index-rKs9bXHr.js +0 -6
  236. package/dist/proxy-CO_-Vget.js +0 -4975
  237. package/dist/use-animation-DhEPRwZ3.js +0 -62
@@ -0,0 +1,57 @@
1
+ import { c as e, d as t, l as n, m as r, p as i } from "./proxy-Dn10Pl_g.js";
2
+ //#region node_modules/.pnpm/framer-motion@12.38.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/framer-motion/dist/es/animation/hooks/animation-controls.mjs
3
+ function a(e) {
4
+ e.values.forEach((e) => e.stop());
5
+ }
6
+ function o(e, t) {
7
+ [...t].reverse().forEach((r) => {
8
+ let i = e.getVariant(r);
9
+ i && n(e, i), e.variantChildren && e.variantChildren.forEach((e) => {
10
+ o(e, t);
11
+ });
12
+ });
13
+ }
14
+ function s(e, t) {
15
+ if (Array.isArray(t)) return o(e, t);
16
+ if (typeof t == "string") return o(e, [t]);
17
+ n(e, t);
18
+ }
19
+ function c() {
20
+ let n = !1, r = /* @__PURE__ */ new Set(), i = {
21
+ subscribe(e) {
22
+ return r.add(e), () => void r.delete(e);
23
+ },
24
+ start(i, a) {
25
+ t(n, "controls.start() should only be called after a component has mounted. Consider calling within a useEffect hook.");
26
+ let o = [];
27
+ return r.forEach((t) => {
28
+ o.push(e(t, i, { transitionOverride: a }));
29
+ }), Promise.all(o);
30
+ },
31
+ set(e) {
32
+ return t(n, "controls.set() should only be called after a component has mounted. Consider calling within a useEffect hook."), r.forEach((t) => {
33
+ s(t, e);
34
+ });
35
+ },
36
+ stop() {
37
+ r.forEach((e) => {
38
+ a(e);
39
+ });
40
+ },
41
+ mount() {
42
+ return n = !0, () => {
43
+ n = !1, i.stop();
44
+ };
45
+ }
46
+ };
47
+ return i;
48
+ }
49
+ //#endregion
50
+ //#region node_modules/.pnpm/framer-motion@12.38.0_react-dom@19.2.3_react@19.2.3__react@19.2.3/node_modules/framer-motion/dist/es/animation/hooks/use-animation.mjs
51
+ function l() {
52
+ let e = r(c);
53
+ return i(e.mount, []), e;
54
+ }
55
+ var u = l;
56
+ //#endregion
57
+ export { u as t };
@@ -1,4 +1,4 @@
1
- const o = "oklch(92.53% 0.1976 123.38)";
2
- export {
3
- o as ACCENT_COLOR_DEFAULT
4
- };
1
+ //#region src/utils/constants.ts
2
+ var e = "oklch(92.53% 0.1976 123.38)";
3
+ //#endregion
4
+ export { e as ACCENT_COLOR_DEFAULT };
@@ -1,150 +1,138 @@
1
1
  "use client";
2
- import { jsx as p } from "react/jsx-runtime";
3
- import { cn as u } from "./twUtils.js";
4
- import { useId as m, useRef as y, useEffect as x, useState as w, useCallback as v } from "react";
5
- const g = (e) => ({
6
- success: "border-success-400 hover:border-success-500 focus-visible:border-success-400 focus-visible:outline-success-400",
7
- error: "border-danger-400 hover:border-danger-500 focus-visible:border-danger-400 focus-visible:outline-danger-400",
8
- loading: "cursor-wait border-input-border--disabled pointer-events-none",
9
- disabled: "cursor-not-allowed opacity-50 border-input-border--disabled text-input-text--disabled",
10
- default: ""
11
- })[e], k = (e = !1, r, o) => u(
12
- "flex h-12 w-full items-center justify-between rounded-lg border-2 border-input-border bg-input-bg px-4 text-base",
13
- "transition duration-200 text-input-text hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
14
- "focus-visible:outline focus-visible:outline-2 focus-visible:outline-input-border--focus focus-visible:outline-offset-2",
15
- "disabled:cursor-not-allowed disabled:opacity-50 disabled:border-input-border--disabled disabled:bg-input-bg--disabled",
16
- e && "border-input-border--focus outline outline-2 outline-input-border--focus outline-offset-2",
17
- g(r),
18
- o
19
- ), N = (e, r = "bottom") => u("absolute left-0 right-0 z-50 rounded-lg border border-input-border bg-input-bg shadow-md", "transition-[opacity,transform] duration-150 motion-reduce:transition-none motion-reduce:transform-none", "will-change-[opacity,transform]", r === "bottom" ? "top-full mt-1 origin-top" : "bottom-full mb-1 origin-bottom", r === "bottom" ? e ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none" : e ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 translate-y-1 pointer-events-none"), A = (e, r) => u(
20
- "peer flex h-12 w-full rounded-md border-2 border-input-border bg-input-bg ps-3 pe-12 text-base transition duration-200",
21
- "placeholder:text-input-text-placeholder hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
22
- "focus-visible:outline focus-visible:outline-2 focus-visible:outline-input-border--focus focus-visible:outline-offset-2",
23
- "disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled",
24
- g(e),
25
- r
26
- ), F = (e, r) => u(
27
- "peer flex h-24 w-full resize-none rounded-md border-2 border-input-border bg-input-bg p-3 text-base transition duration-200",
28
- "placeholder:text-input-text-placeholder hover:border-input-border--hover focus:border-input-border--focus focus:outline-none",
29
- "focus-visible:outline focus-visible:outline-2 focus-visible:outline-input-border--focus focus-visible:outline-offset-2",
30
- "disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled",
31
- g(e),
32
- r
33
- ), j = (e, r) => {
34
- const o = m();
35
- if (e) return e;
36
- const t = r?.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9\-_.:]/g, "");
37
- return t ? `${t}-${o}` : o;
38
- }, L = (e) => `${e}-error`, M = (e, r, o, t) => ({
39
- "aria-invalid": e === "error",
40
- "aria-required": o,
41
- "aria-describedby": u(e === "error" && t, r)
42
- }), z = (e = {}) => ({
43
- "--field-border-radius": "0.5rem",
44
- "--field-height": "3rem",
45
- "--field-padding": "1rem",
46
- ...e
47
- }), H = (e, r = "default") => ({
48
- isDisabled: e || r === "disabled",
49
- isLoading: r === "loading",
50
- isInvalid: r === "error"
51
- // isSuccess: state === 'success', // For future use
52
- }), O = (e) => {
53
- const r = y(null);
54
- return x(() => {
55
- const o = (t) => {
56
- r.current && !r.current.contains(t.target) && e();
57
- };
58
- return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
59
- }, [e]), r;
60
- }, S = (e, r = !1, o, t, s, b) => {
61
- const [d, a] = w(-1);
62
- x(() => {
63
- if (e)
64
- if (r)
65
- a(0);
66
- else {
67
- const n = s.findIndex((l) => l.value === b);
68
- a(n >= 0 ? n : 0);
69
- }
70
- else
71
- a(-1);
72
- }, [e, b, s, r]);
73
- const c = v(
74
- (n, l) => {
75
- let i = n + (l === "down" ? 1 : -1);
76
- return l === "down" ? i = Math.min(i, s.length - 1) : i = Math.max(i, 0), s[i]?.disabled && i !== n ? c(i, l) : i;
77
- },
78
- [s]
79
- ), h = v(
80
- (n) => {
81
- if (!e)
82
- return ["ArrowDown", "ArrowUp", " ", "Enter"].includes(n.key) ? (n.preventDefault(), "open") : void 0;
83
- const f = {
84
- ArrowDown: () => {
85
- n.preventDefault(), a((i) => c(i, "down"));
86
- },
87
- ArrowUp: () => {
88
- n.preventDefault(), a((i) => c(i, "up"));
89
- },
90
- Enter: () => {
91
- n.preventDefault(), d >= 0 && s[d] && !s[d].disabled && (t(s[d].value), r || o());
92
- },
93
- " ": () => {
94
- n.preventDefault(), d >= 0 && s[d] && !s[d].disabled && (t(s[d].value), r || o());
95
- },
96
- Escape: () => {
97
- n.preventDefault(), o();
98
- },
99
- Home: () => {
100
- n.preventDefault(), a(0);
101
- },
102
- End: () => {
103
- n.preventDefault(), a(s.length - 1);
104
- }
105
- }[n.key];
106
- f && f();
107
- },
108
- [s, d, t, o, e, r, c]
109
- );
110
- return { focusedIndex: d, setFocusedIndex: a, handleKeyDown: h, isOpen: e };
111
- }, $ = (e) => {
112
- const r = {}, o = [];
113
- return e.forEach((t) => {
114
- t.group ? (r[t.group] || (r[t.group] = []), r[t.group].push(t)) : o.push(t);
115
- }), {
116
- groups: r,
117
- ungrouped: o,
118
- hasGroups: Object.keys(r).length > 0
119
- };
120
- }, K = ({ className: e, message: r = "Loading…" }) => /* @__PURE__ */ p("div", { "aria-live": "polite", className: u("text-input-text-secondary flex items-center justify-center gap-2 py-6 text-base", e), role: "status", children: r }), P = ({ className: e, message: r = "No options found" }) => /* @__PURE__ */ p("div", { className: u("text-text-secondary py-6 text-center text-base", e), role: "status", children: r }), T = ({ className: e, id: r, dataTestId: o, message: t }) => {
121
- const b = t ? typeof t == "string" ? t : Array.isArray(t) ? t.join(", ") : typeof t == "object" ? t.message ? t.message : t.error ? t.error : t.details ? t.details : JSON.stringify(t) : String(t) : null;
122
- return b ? /* @__PURE__ */ p("p", { "aria-atomic": "true", "aria-live": "assertive", className: u("text-danger-400! m-0! mt-1.5! text-base", e), "data-testid": o || "spectral-form-field-error-message", id: r, role: "alert", children: b }) : null;
123
- }, U = (e = !1, r, o) => u(
124
- "relative flex w-full cursor-pointer select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-base outline-none hover:bg-input-bg--hover",
125
- r && "bg-input-bg--hover",
126
- o && "bg-input-bg--selected text-input-text",
127
- e && "pointer-events-none text-input-text--disabled"
128
- ), q = (e) => {
129
- e && e.scrollIntoView({ block: "nearest", behavior: "smooth" });
130
- };
131
- export {
132
- P as EmptyState,
133
- T as ErrorMessage,
134
- K as LoadingState,
135
- M as getAriaProps,
136
- N as getDropdownClasses,
137
- L as getErrorMessageId,
138
- z as getFormFieldCSSProperties,
139
- A as getInputClasses,
140
- U as getOptionClasses,
141
- g as getStateClasses,
142
- F as getTextareaClasses,
143
- k as getTriggerClasses,
144
- $ as groupOptions,
145
- q as scrollIntoView,
146
- O as useClickOutside,
147
- j as useFormFieldId,
148
- H as useFormFieldState,
149
- S as useKeyboardNavigation
2
+ import { t as e } from "../twUtils-VNWgstKL.js";
3
+ import { useCallback as t, useEffect as n, useId as r, useRef as i, useState as a } from "react";
4
+ import { jsx as o } from "react/jsx-runtime";
5
+ //#region src/utils/formFieldUtils.tsx
6
+ var s = (e) => ({
7
+ success: "border-success-400 hover:border-success-500 focus-visible:border-success-400 focus-visible:outline-success-400",
8
+ error: "border-danger-400 hover:border-danger-500 focus-visible:border-danger-400 focus-visible:outline-danger-400",
9
+ loading: "cursor-wait border-input-border--disabled pointer-events-none",
10
+ disabled: "cursor-not-allowed opacity-50 border-input-border--disabled text-input-text--disabled",
11
+ default: ""
12
+ })[e], c = (t = !1, n, r) => e("h-12 rounded-lg px-4 text-base flex w-full items-center justify-between border-2 border-input-border bg-input-bg", "text-input-text transition duration-200 hover:border-input-border--hover focus:border-input-border--focus focus:outline-none", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus", "disabled:cursor-not-allowed disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:opacity-50", t && "border-input-border--focus outline outline-2 outline-offset-2 outline-input-border--focus", s(n), r), l = (t, n = "bottom") => e("left-0 right-0 rounded-lg shadow-md absolute z-50 border border-input-border bg-input-bg", "transition-[opacity,transform] duration-150 motion-reduce:transform-none motion-reduce:transition-none", "will-change-[opacity,transform]", n === "bottom" ? "top-full mt-1 origin-top" : "bottom-full mb-1 origin-bottom", n === "bottom" ? t ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 -translate-y-1 pointer-events-none" : t ? "scale-100 opacity-100 translate-y-0" : "scale-95 opacity-0 translate-y-1 pointer-events-none"), u = (t, n) => e("peer h-12 rounded-md ps-3 pe-12 text-base flex w-full border-2 border-input-border bg-input-bg transition duration-200", "placeholder:text-input-text-placeholder hover:border-input-border--hover focus:border-input-border--focus focus:outline-none", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus", "disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled", s(t), n), d = (t, n) => e("peer h-24 rounded-md p-3 text-base flex w-full resize-none border-2 border-input-border bg-input-bg transition duration-200", "placeholder:text-input-text-placeholder hover:border-input-border--hover focus:border-input-border--focus focus:outline-none", "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-input-border--focus", "disabled:pointer-events-none disabled:border-input-border--disabled disabled:bg-input-bg--disabled disabled:text-input-text--disabled", s(t), n), f = (e, t) => {
13
+ let n = r();
14
+ if (e) return e;
15
+ let i = t?.trim().toLowerCase().replace(/\s+/g, "-").replace(/[^a-z0-9\-_.:]/g, "");
16
+ return i ? `${i}-${n}` : n;
17
+ }, p = (e) => `${e}-error`, m = (t, n, r, i) => ({
18
+ "aria-invalid": t === "error",
19
+ "aria-required": r,
20
+ "aria-describedby": e(t === "error" && i, n)
21
+ }), h = (e = {}) => ({
22
+ "--field-border-radius": "0.5rem",
23
+ "--field-height": "3rem",
24
+ "--field-padding": "1rem",
25
+ ...e
26
+ }), g = (e, t = "default") => ({
27
+ isDisabled: e || t === "disabled",
28
+ isLoading: t === "loading",
29
+ isInvalid: t === "error"
30
+ }), _ = (e) => {
31
+ let t = i(null);
32
+ return n(() => {
33
+ let n = (n) => {
34
+ t.current && !t.current.contains(n.target) && e();
35
+ };
36
+ return document.addEventListener("mousedown", n), () => document.removeEventListener("mousedown", n);
37
+ }, [e]), t;
38
+ }, v = (e, r = !1, i, o, s, c) => {
39
+ let [l, u] = a(-1);
40
+ n(() => {
41
+ if (e) if (r) u(0);
42
+ else {
43
+ let e = s.findIndex((e) => e.value === c);
44
+ u(e >= 0 ? e : 0);
45
+ }
46
+ else u(-1);
47
+ }, [
48
+ e,
49
+ c,
50
+ s,
51
+ r
52
+ ]);
53
+ let d = t((e, t) => {
54
+ let n = e + (t === "down" ? 1 : -1);
55
+ return n = t === "down" ? Math.min(n, s.length - 1) : Math.max(n, 0), s[n]?.disabled && n !== e ? d(n, t) : n;
56
+ }, [s]);
57
+ return {
58
+ focusedIndex: l,
59
+ setFocusedIndex: u,
60
+ handleKeyDown: t((t) => {
61
+ if (!e) return [
62
+ "ArrowDown",
63
+ "ArrowUp",
64
+ " ",
65
+ "Enter"
66
+ ].includes(t.key) ? (t.preventDefault(), "open") : void 0;
67
+ let n = {
68
+ ArrowDown: () => {
69
+ t.preventDefault(), u((e) => d(e, "down"));
70
+ },
71
+ ArrowUp: () => {
72
+ t.preventDefault(), u((e) => d(e, "up"));
73
+ },
74
+ Enter: () => {
75
+ t.preventDefault(), l >= 0 && s[l] && !s[l].disabled && (o(s[l].value), r || i());
76
+ },
77
+ " ": () => {
78
+ t.preventDefault(), l >= 0 && s[l] && !s[l].disabled && (o(s[l].value), r || i());
79
+ },
80
+ Escape: () => {
81
+ t.preventDefault(), i();
82
+ },
83
+ Home: () => {
84
+ t.preventDefault(), u(0);
85
+ },
86
+ End: () => {
87
+ t.preventDefault(), u(s.length - 1);
88
+ }
89
+ }[t.key];
90
+ n && n();
91
+ }, [
92
+ s,
93
+ l,
94
+ o,
95
+ i,
96
+ e,
97
+ r,
98
+ d
99
+ ]),
100
+ isOpen: e
101
+ };
102
+ }, y = (e) => {
103
+ let t = {}, n = [];
104
+ return e.forEach((e) => {
105
+ e.group ? (t[e.group] || (t[e.group] = []), t[e.group].push(e)) : n.push(e);
106
+ }), {
107
+ groups: t,
108
+ ungrouped: n,
109
+ hasGroups: Object.keys(t).length > 0
110
+ };
111
+ }, b = ({ className: t, message: n = "Loading…" }) => /* @__PURE__ */ o("div", {
112
+ "aria-live": "polite",
113
+ className: e("gap-2 py-6 text-base text-input-text-secondary flex items-center justify-center", t),
114
+ role: "status",
115
+ children: n
116
+ }), x = ({ className: t, message: n = "No options found" }) => /* @__PURE__ */ o("div", {
117
+ className: e("py-6 text-base text-center text-text-secondary", t),
118
+ role: "status",
119
+ children: n
120
+ }), S = ({ className: t, id: n, dataTestId: r, message: i }) => {
121
+ let a = i ? typeof i == "string" ? i : Array.isArray(i) ? i.join(", ") : typeof i == "object" ? i.message ? i.message : i.error ? i.error : i.details ? i.details : JSON.stringify(i) : String(i) : null;
122
+ return a ? /* @__PURE__ */ o("p", {
123
+ "aria-atomic": "true",
124
+ "aria-live": "assertive",
125
+ className: e("m-0! mt-1.5! text-base text-danger-400!", t),
126
+ "data-testid": r || "spectral-form-field-error-message",
127
+ id: n,
128
+ role: "alert",
129
+ children: a
130
+ }) : null;
131
+ }, C = (t = !1, n, r) => e("rounded-sm py-1.5 pl-2 pr-8 text-base relative flex w-full cursor-pointer items-center outline-none select-none hover:bg-input-bg--hover", n && "bg-input-bg--hover", r && "bg-input-bg--selected text-input-text", t && "pointer-events-none text-input-text--disabled"), w = (e) => {
132
+ e && e.scrollIntoView({
133
+ block: "nearest",
134
+ behavior: "smooth"
135
+ });
150
136
  };
137
+ //#endregion
138
+ export { x as EmptyState, S as ErrorMessage, b as LoadingState, m as getAriaProps, l as getDropdownClasses, p as getErrorMessageId, h as getFormFieldCSSProperties, u as getInputClasses, C as getOptionClasses, s as getStateClasses, d as getTextareaClasses, c as getTriggerClasses, y as groupOptions, w as scrollIntoView, _ as useClickOutside, f as useFormFieldId, g as useFormFieldState, v as useKeyboardNavigation };
@@ -1,8 +1,27 @@
1
- const r = (t, e, l) => Math.min(l, Math.max(e, t)), c = (t) => {
2
- let e = 0;
3
- return t.length >= 8 && (e += 1), t.length >= 12 && (e += 1), /[a-z]/u.test(t) && /[A-Z]/u.test(t) && (e += 1), /\d/u.test(t) && (e += 1), /[^\da-z]/i.test(t) && (e += 1), e <= 1 ? { score: 1, label: "Weak", color: "#ef4444" } : e === 2 ? { score: 2, label: "Fair", color: "#f97316" } : e === 3 ? { score: 3, label: "Good", color: "#eab308" } : e === 4 ? { score: 4, label: "Strong", color: "#22c55e" } : { score: 5, label: "Excellent", color: "#CDFB50" };
4
- };
5
- export {
6
- c as calculatePasswordStrength,
7
- r as clamp
1
+ //#region src/utils/sharedUtils.ts
2
+ var e = (e, t, n) => Math.min(n, Math.max(t, e)), t = (e) => {
3
+ let t = 0;
4
+ return e.length >= 8 && (t += 1), e.length >= 12 && (t += 1), /[a-z]/u.test(e) && /[A-Z]/u.test(e) && (t += 1), /\d/u.test(e) && (t += 1), /[^\da-z]/i.test(e) && (t += 1), t <= 1 ? {
5
+ score: 1,
6
+ label: "Weak",
7
+ color: "#ef4444"
8
+ } : t === 2 ? {
9
+ score: 2,
10
+ label: "Fair",
11
+ color: "#f97316"
12
+ } : t === 3 ? {
13
+ score: 3,
14
+ label: "Good",
15
+ color: "#eab308"
16
+ } : t === 4 ? {
17
+ score: 4,
18
+ label: "Strong",
19
+ color: "#22c55e"
20
+ } : {
21
+ score: 5,
22
+ label: "Excellent",
23
+ color: "#CDFB50"
24
+ };
8
25
  };
26
+ //#endregion
27
+ export { t as calculatePasswordStrength, e as clamp };