@forte-ui/react 1.0.0-alpha.1

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 (304) hide show
  1. package/README.md +240 -0
  2. package/dist/Accordion-9JunkjgY.js +111 -0
  3. package/dist/Alert-Cn_WUF3L.js +183 -0
  4. package/dist/AspectRatio-gSjpTVk-.js +39 -0
  5. package/dist/Avatar-BuitDluH.js +87 -0
  6. package/dist/Badge-sArNWMre.js +33 -0
  7. package/dist/Breadcrumb-Cq7tFtMX.js +170 -0
  8. package/dist/Button-AiyKnx5I.js +42 -0
  9. package/dist/ButtonGroup-C-CrwPXP.js +54 -0
  10. package/dist/Calendar-D7Q-QJ_e.js +503 -0
  11. package/dist/Checkbox-DfNbmOed.js +56 -0
  12. package/dist/Collapsible-D8UKiGip.js +86 -0
  13. package/dist/ColorPicker-B-eCI31W.js +612 -0
  14. package/dist/Combobox-D-BN-Tvp.js +302 -0
  15. package/dist/ContextMenu-D81uDaMG.js +44 -0
  16. package/dist/DatePicker-CfkMsaI-.js +192 -0
  17. package/dist/Dialog-_n8FpFs5.js +432 -0
  18. package/dist/Drawer-DKQF3OO7.js +158 -0
  19. package/dist/Field-FLFEO70D.js +58 -0
  20. package/dist/Fieldset-CYhh71Qt.js +28 -0
  21. package/dist/Form-DVPmW9XV.js +17 -0
  22. package/dist/Input-BgGWhO2q.js +18 -0
  23. package/dist/InputGroup-DsZyDXNn.js +89 -0
  24. package/dist/Menu-CKu9xE2h.js +261 -0
  25. package/dist/Menubar-Dax027Db.js +19 -0
  26. package/dist/NavList-DGvcIoJm.js +176 -0
  27. package/dist/NavigationMenu-BayQkUUb.js +209 -0
  28. package/dist/NumberField-P55SA8T7.js +191 -0
  29. package/dist/OTPField-CjHvBNSN.js +55 -0
  30. package/dist/Popover-BXhn2Wwt.js +142 -0
  31. package/dist/PreviewCard-Dnitrky0.js +99 -0
  32. package/dist/Progress-BlomDp-X.js +81 -0
  33. package/dist/ProgressCircle-j6XBl0fk.js +112 -0
  34. package/dist/Radio-BIcX4INJ.js +37 -0
  35. package/dist/Resizable-7nJJM97e.js +609 -0
  36. package/dist/ScrollArea-CBMGJ6hh.js +83 -0
  37. package/dist/Select-BP-zvdXm.js +237 -0
  38. package/dist/Separator-DewJBzaJ.js +21 -0
  39. package/dist/Skeleton-zr6ObCCq.js +79 -0
  40. package/dist/Slider-Bh8_cti1.js +104 -0
  41. package/dist/Spinner-BF0uD4hR.js +53 -0
  42. package/dist/Switch-OBewMMvM.js +39 -0
  43. package/dist/Tabs-LgkSbPSF.js +132 -0
  44. package/dist/Textarea-CqZJL41e.js +51 -0
  45. package/dist/Toast-BWayxAcd.js +304 -0
  46. package/dist/Toggle-BrhMnkF5.js +45 -0
  47. package/dist/Toolbar-OmOVCk3i.js +88 -0
  48. package/dist/Tooltip-CI4chsRw.js +101 -0
  49. package/dist/clsx-By2n9mTe.js +16 -0
  50. package/dist/cn.d.ts +8 -0
  51. package/dist/cn.js +11 -0
  52. package/dist/components/accordion/Accordion.d.ts +117 -0
  53. package/dist/components/accordion/Accordion.js +3 -0
  54. package/dist/components/accordion/index.d.ts +2 -0
  55. package/dist/components/accordion/index.js +2 -0
  56. package/dist/components/alert/Alert.d.ts +167 -0
  57. package/dist/components/alert/Alert.js +3 -0
  58. package/dist/components/alert/index.d.ts +2 -0
  59. package/dist/components/alert/index.js +2 -0
  60. package/dist/components/aspect-ratio/AspectRatio.d.ts +128 -0
  61. package/dist/components/aspect-ratio/AspectRatio.js +3 -0
  62. package/dist/components/aspect-ratio/index.d.ts +2 -0
  63. package/dist/components/aspect-ratio/index.js +2 -0
  64. package/dist/components/avatar/Avatar.d.ts +176 -0
  65. package/dist/components/avatar/Avatar.js +3 -0
  66. package/dist/components/avatar/index.d.ts +2 -0
  67. package/dist/components/avatar/index.js +2 -0
  68. package/dist/components/badge/Badge.d.ts +117 -0
  69. package/dist/components/badge/Badge.js +3 -0
  70. package/dist/components/badge/index.d.ts +2 -0
  71. package/dist/components/badge/index.js +2 -0
  72. package/dist/components/breadcrumb/Breadcrumb.d.ts +244 -0
  73. package/dist/components/breadcrumb/Breadcrumb.js +3 -0
  74. package/dist/components/breadcrumb/index.d.ts +2 -0
  75. package/dist/components/breadcrumb/index.js +2 -0
  76. package/dist/components/button/Button.d.ts +73 -0
  77. package/dist/components/button/Button.js +3 -0
  78. package/dist/components/button/index.d.ts +2 -0
  79. package/dist/components/button/index.js +2 -0
  80. package/dist/components/button-group/ButtonGroup.d.ts +113 -0
  81. package/dist/components/button-group/ButtonGroup.js +3 -0
  82. package/dist/components/button-group/index.d.ts +2 -0
  83. package/dist/components/button-group/index.js +2 -0
  84. package/dist/components/calendar/Calendar.d.ts +201 -0
  85. package/dist/components/calendar/Calendar.js +3 -0
  86. package/dist/components/calendar/index.d.ts +2 -0
  87. package/dist/components/calendar/index.js +2 -0
  88. package/dist/components/checkbox/Checkbox.d.ts +130 -0
  89. package/dist/components/checkbox/Checkbox.js +3 -0
  90. package/dist/components/checkbox/index.d.ts +2 -0
  91. package/dist/components/checkbox/index.js +2 -0
  92. package/dist/components/collapsible/Collapsible.d.ts +91 -0
  93. package/dist/components/collapsible/Collapsible.js +3 -0
  94. package/dist/components/collapsible/index.d.ts +2 -0
  95. package/dist/components/collapsible/index.js +2 -0
  96. package/dist/components/color-picker/ColorPicker.d.ts +553 -0
  97. package/dist/components/color-picker/ColorPicker.js +4 -0
  98. package/dist/components/color-picker/color.d.ts +102 -0
  99. package/dist/components/color-picker/color.js +249 -0
  100. package/dist/components/color-picker/index.d.ts +2 -0
  101. package/dist/components/color-picker/index.js +3 -0
  102. package/dist/components/combobox/Combobox.d.ts +553 -0
  103. package/dist/components/combobox/Combobox.js +3 -0
  104. package/dist/components/combobox/index.d.ts +2 -0
  105. package/dist/components/combobox/index.js +2 -0
  106. package/dist/components/context-menu/ContextMenu.d.ts +103 -0
  107. package/dist/components/context-menu/ContextMenu.js +3 -0
  108. package/dist/components/context-menu/index.d.ts +3 -0
  109. package/dist/components/context-menu/index.js +2 -0
  110. package/dist/components/date-picker/DatePicker.d.ts +268 -0
  111. package/dist/components/date-picker/DatePicker.js +3 -0
  112. package/dist/components/date-picker/index.d.ts +2 -0
  113. package/dist/components/date-picker/index.js +2 -0
  114. package/dist/components/dialog/Dialog.d.ts +567 -0
  115. package/dist/components/dialog/Dialog.js +3 -0
  116. package/dist/components/dialog/index.d.ts +2 -0
  117. package/dist/components/dialog/index.js +2 -0
  118. package/dist/components/drawer/Drawer.d.ts +351 -0
  119. package/dist/components/drawer/Drawer.js +3 -0
  120. package/dist/components/drawer/index.d.ts +2 -0
  121. package/dist/components/drawer/index.js +2 -0
  122. package/dist/components/field/Field.d.ts +170 -0
  123. package/dist/components/field/Field.js +3 -0
  124. package/dist/components/field/index.d.ts +2 -0
  125. package/dist/components/field/index.js +2 -0
  126. package/dist/components/fieldset/Fieldset.d.ts +60 -0
  127. package/dist/components/fieldset/Fieldset.js +3 -0
  128. package/dist/components/fieldset/index.d.ts +2 -0
  129. package/dist/components/fieldset/index.js +2 -0
  130. package/dist/components/form/Form.d.ts +76 -0
  131. package/dist/components/form/Form.js +3 -0
  132. package/dist/components/form/index.d.ts +2 -0
  133. package/dist/components/form/index.js +2 -0
  134. package/dist/components/input/Input.d.ts +67 -0
  135. package/dist/components/input/Input.js +3 -0
  136. package/dist/components/input/index.d.ts +2 -0
  137. package/dist/components/input/index.js +2 -0
  138. package/dist/components/input-group/InputGroup.d.ts +214 -0
  139. package/dist/components/input-group/InputGroup.js +3 -0
  140. package/dist/components/input-group/index.d.ts +2 -0
  141. package/dist/components/input-group/index.js +2 -0
  142. package/dist/components/menu/Menu.d.ts +587 -0
  143. package/dist/components/menu/Menu.js +3 -0
  144. package/dist/components/menu/index.d.ts +2 -0
  145. package/dist/components/menu/index.js +2 -0
  146. package/dist/components/menubar/Menubar.d.ts +104 -0
  147. package/dist/components/menubar/Menubar.js +3 -0
  148. package/dist/components/menubar/index.d.ts +2 -0
  149. package/dist/components/menubar/index.js +2 -0
  150. package/dist/components/nav-list/NavList.d.ts +290 -0
  151. package/dist/components/nav-list/NavList.js +3 -0
  152. package/dist/components/nav-list/index.d.ts +2 -0
  153. package/dist/components/nav-list/index.js +2 -0
  154. package/dist/components/navigation-menu/NavigationMenu.d.ts +483 -0
  155. package/dist/components/navigation-menu/NavigationMenu.js +3 -0
  156. package/dist/components/navigation-menu/index.d.ts +2 -0
  157. package/dist/components/navigation-menu/index.js +2 -0
  158. package/dist/components/number-field/NumberField.d.ts +303 -0
  159. package/dist/components/number-field/NumberField.js +3 -0
  160. package/dist/components/number-field/index.d.ts +2 -0
  161. package/dist/components/number-field/index.js +2 -0
  162. package/dist/components/otp-field/OTPField.d.ts +206 -0
  163. package/dist/components/otp-field/OTPField.js +3 -0
  164. package/dist/components/otp-field/index.d.ts +2 -0
  165. package/dist/components/otp-field/index.js +2 -0
  166. package/dist/components/popover/Popover.d.ts +394 -0
  167. package/dist/components/popover/Popover.js +3 -0
  168. package/dist/components/popover/index.d.ts +2 -0
  169. package/dist/components/popover/index.js +2 -0
  170. package/dist/components/preview-card/PreviewCard.d.ts +307 -0
  171. package/dist/components/preview-card/PreviewCard.js +3 -0
  172. package/dist/components/preview-card/index.d.ts +2 -0
  173. package/dist/components/preview-card/index.js +2 -0
  174. package/dist/components/progress/Progress.d.ts +156 -0
  175. package/dist/components/progress/Progress.js +3 -0
  176. package/dist/components/progress/ProgressCircle.d.ts +166 -0
  177. package/dist/components/progress/ProgressCircle.js +3 -0
  178. package/dist/components/progress/index.d.ts +4 -0
  179. package/dist/components/progress/index.js +3 -0
  180. package/dist/components/radio/Radio.d.ts +144 -0
  181. package/dist/components/radio/Radio.js +3 -0
  182. package/dist/components/radio/index.d.ts +2 -0
  183. package/dist/components/radio/index.js +2 -0
  184. package/dist/components/resizable/Resizable.d.ts +211 -0
  185. package/dist/components/resizable/Resizable.js +3 -0
  186. package/dist/components/resizable/index.d.ts +2 -0
  187. package/dist/components/resizable/index.js +2 -0
  188. package/dist/components/scroll-area/ScrollArea.d.ts +113 -0
  189. package/dist/components/scroll-area/ScrollArea.js +3 -0
  190. package/dist/components/scroll-area/index.d.ts +2 -0
  191. package/dist/components/scroll-area/index.js +2 -0
  192. package/dist/components/select/Select.d.ts +345 -0
  193. package/dist/components/select/Select.js +3 -0
  194. package/dist/components/select/index.d.ts +2 -0
  195. package/dist/components/select/index.js +2 -0
  196. package/dist/components/separator/Separator.d.ts +75 -0
  197. package/dist/components/separator/Separator.js +3 -0
  198. package/dist/components/separator/index.d.ts +2 -0
  199. package/dist/components/separator/index.js +2 -0
  200. package/dist/components/skeleton/Skeleton.d.ts +169 -0
  201. package/dist/components/skeleton/Skeleton.js +3 -0
  202. package/dist/components/skeleton/index.d.ts +2 -0
  203. package/dist/components/skeleton/index.js +2 -0
  204. package/dist/components/slider/Slider.d.ts +208 -0
  205. package/dist/components/slider/Slider.js +3 -0
  206. package/dist/components/slider/index.d.ts +2 -0
  207. package/dist/components/slider/index.js +2 -0
  208. package/dist/components/spinner/Spinner.d.ts +92 -0
  209. package/dist/components/spinner/Spinner.js +3 -0
  210. package/dist/components/spinner/index.d.ts +2 -0
  211. package/dist/components/spinner/index.js +2 -0
  212. package/dist/components/switch/Switch.d.ts +80 -0
  213. package/dist/components/switch/Switch.js +3 -0
  214. package/dist/components/switch/index.d.ts +2 -0
  215. package/dist/components/switch/index.js +2 -0
  216. package/dist/components/tabs/Tabs.d.ts +125 -0
  217. package/dist/components/tabs/Tabs.js +3 -0
  218. package/dist/components/tabs/index.d.ts +2 -0
  219. package/dist/components/tabs/index.js +2 -0
  220. package/dist/components/textarea/Textarea.d.ts +119 -0
  221. package/dist/components/textarea/Textarea.js +3 -0
  222. package/dist/components/textarea/index.d.ts +2 -0
  223. package/dist/components/textarea/index.js +2 -0
  224. package/dist/components/toast/Toast.d.ts +517 -0
  225. package/dist/components/toast/Toast.js +3 -0
  226. package/dist/components/toast/index.d.ts +2 -0
  227. package/dist/components/toast/index.js +2 -0
  228. package/dist/components/toggle/Toggle.d.ts +171 -0
  229. package/dist/components/toggle/Toggle.js +3 -0
  230. package/dist/components/toggle/index.d.ts +2 -0
  231. package/dist/components/toggle/index.js +2 -0
  232. package/dist/components/toolbar/Toolbar.d.ts +318 -0
  233. package/dist/components/toolbar/Toolbar.js +3 -0
  234. package/dist/components/toolbar/index.d.ts +2 -0
  235. package/dist/components/toolbar/index.js +2 -0
  236. package/dist/components/tooltip/Tooltip.d.ts +361 -0
  237. package/dist/components/tooltip/Tooltip.js +3 -0
  238. package/dist/components/tooltip/index.d.ts +2 -0
  239. package/dist/components/tooltip/index.js +2 -0
  240. package/dist/index.d.ts +92 -0
  241. package/dist/index.js +86 -0
  242. package/dist/styles/Accordion.css +1 -0
  243. package/dist/styles/Alert.css +1 -0
  244. package/dist/styles/AspectRatio.css +1 -0
  245. package/dist/styles/Avatar.css +1 -0
  246. package/dist/styles/Badge.css +1 -0
  247. package/dist/styles/Breadcrumb.css +1 -0
  248. package/dist/styles/Button.css +1 -0
  249. package/dist/styles/ButtonGroup.css +1 -0
  250. package/dist/styles/Calendar.css +1 -0
  251. package/dist/styles/Checkbox.css +1 -0
  252. package/dist/styles/Collapsible.css +1 -0
  253. package/dist/styles/ColorPicker.css +1 -0
  254. package/dist/styles/Combobox.css +1 -0
  255. package/dist/styles/ContextMenu.css +1 -0
  256. package/dist/styles/DatePicker.css +1 -0
  257. package/dist/styles/Dialog.css +1 -0
  258. package/dist/styles/Drawer.css +1 -0
  259. package/dist/styles/Field.css +1 -0
  260. package/dist/styles/Fieldset.css +1 -0
  261. package/dist/styles/Form.css +1 -0
  262. package/dist/styles/Input.css +1 -0
  263. package/dist/styles/InputGroup.css +1 -0
  264. package/dist/styles/Menu.css +1 -0
  265. package/dist/styles/Menubar.css +1 -0
  266. package/dist/styles/NavList.css +1 -0
  267. package/dist/styles/NavigationMenu.css +1 -0
  268. package/dist/styles/NumberField.css +1 -0
  269. package/dist/styles/OTPField.css +1 -0
  270. package/dist/styles/Popover.css +1 -0
  271. package/dist/styles/PreviewCard.css +1 -0
  272. package/dist/styles/Progress.css +1 -0
  273. package/dist/styles/ProgressCircle.css +1 -0
  274. package/dist/styles/Radio.css +1 -0
  275. package/dist/styles/Resizable.css +1 -0
  276. package/dist/styles/ScrollArea.css +1 -0
  277. package/dist/styles/Select.css +1 -0
  278. package/dist/styles/Separator.css +1 -0
  279. package/dist/styles/Skeleton.css +1 -0
  280. package/dist/styles/Slider.css +1 -0
  281. package/dist/styles/Spinner.css +1 -0
  282. package/dist/styles/Switch.css +1 -0
  283. package/dist/styles/Tabs.css +1 -0
  284. package/dist/styles/Textarea.css +1 -0
  285. package/dist/styles/Toast.css +1 -0
  286. package/dist/styles/Toggle.css +1 -0
  287. package/dist/styles/Toolbar.css +1 -0
  288. package/dist/styles/Tooltip.css +1 -0
  289. package/dist/styles/a11y.css +119 -0
  290. package/dist/styles/layers.css +39 -0
  291. package/dist/styles/motion.css +194 -0
  292. package/dist/styles/patterns.css +236 -0
  293. package/dist/styles/properties.css +62 -0
  294. package/dist/styles/reset.css +11 -0
  295. package/dist/styles/tailwind.css +281 -0
  296. package/dist/styles/theme.css +57 -0
  297. package/dist/styles/tokens.color.css +223 -0
  298. package/dist/styles/tokens.css +460 -0
  299. package/dist/tailwind-merge.d.ts +52 -0
  300. package/dist/tailwind-merge.js +52 -0
  301. package/docs-data/props.json +8047 -0
  302. package/docs-data/theming.json +9600 -0
  303. package/docs-data/tokens.json +4070 -0
  304. package/package.json +78 -0
@@ -0,0 +1,612 @@
1
+ "use client";
2
+ import { t as e } from "./clsx-By2n9mTe.js";
3
+ import { t } from "./Select-BP-zvdXm.js";
4
+ import { t as n } from "./Popover-BXhn2Wwt.js";
5
+ import { DEFAULT_SWATCHES as r, formatColor as i, hsvaToRgba as a, onColor as o, parseColor as s, sameColor as c, toCssColor as l } from "./components/color-picker/color.js";
6
+ import * as u from "react";
7
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
8
+ import { Slider as p } from "@base-ui/react/slider";
9
+ import './styles/ColorPicker.css';var m = {
10
+ popup: "_popup_eoqpp_55",
11
+ panel: "_panel_eoqpp_68",
12
+ standalonePanel: "_standalonePanel_eoqpp_165",
13
+ row: "_row_eoqpp_182",
14
+ area: "_area_eoqpp_207",
15
+ areaThumb: "_areaThumb_eoqpp_245",
16
+ srOnly: "_srOnly_eoqpp_295",
17
+ rail: "_rail_eoqpp_314",
18
+ railControl: "_railControl_eoqpp_319",
19
+ hueTrack: "_hueTrack_eoqpp_339",
20
+ alphaTrack: "_alphaTrack_eoqpp_340",
21
+ railThumb: "_railThumb_eoqpp_400",
22
+ swatches: "_swatches_eoqpp_458",
23
+ swatch: "_swatch_eoqpp_458",
24
+ swatchTick: "_swatchTick_eoqpp_509",
25
+ preview: "_preview_eoqpp_521",
26
+ value: "_value_eoqpp_545",
27
+ format: "_format_eoqpp_563",
28
+ input: "_input_eoqpp_576",
29
+ eyeDropper: "_eyeDropper_eoqpp_613",
30
+ eyeDropperIcon: "_eyeDropperIcon_eoqpp_644",
31
+ trigger: "_trigger_eoqpp_657",
32
+ triggerSwatch: "_triggerSwatch_eoqpp_725"
33
+ }, h = (e, t, n) => e < t ? t : e > n ? n : e, g = [
34
+ "hex",
35
+ "rgb",
36
+ "hsl",
37
+ "oklch"
38
+ ], _ = {
39
+ hex: "HEX",
40
+ rgb: "RGB",
41
+ hsl: "HSL",
42
+ oklch: "OKLCH"
43
+ }, v = u.createContext(null);
44
+ function y(e) {
45
+ let t = u.useContext(v);
46
+ if (!t) throw Error(`<ColorPicker.${e}> must be rendered inside <ColorPicker.Root>.`);
47
+ return t;
48
+ }
49
+ function b(e) {
50
+ let { css: t, solid: n, hsva: r, rgba: i } = e;
51
+ return u.useMemo(() => ({
52
+ "--forte-color-picker-color": t,
53
+ "--forte-color-picker-solid": n,
54
+ "--forte-color-picker-hue": String(Math.round(r.h * 100) / 100),
55
+ "--forte-color-picker-on-color": o(i)
56
+ }), [
57
+ t,
58
+ n,
59
+ r.h,
60
+ i
61
+ ]);
62
+ }
63
+ function x({ value: e, defaultValue: t = "#000000", onValueChange: r, onValueCommitted: o, format: c, defaultFormat: f = "hex", onFormatChange: p, formats: m = g, disabled: h = !1, defaultOpen: _, open: y, onOpenChange: b, modal: x, children: S }) {
64
+ let [C, w] = u.useState(() => s(e ?? t) ?? {
65
+ h: 0,
66
+ s: 0,
67
+ v: 0,
68
+ a: 1
69
+ }), [T, E] = u.useState(f), D = c ?? T, O = u.useRef(null), [k, A] = u.useState(e);
70
+ if (e !== k && (A(e), e !== void 0 && e !== O.current)) {
71
+ let t = s(e);
72
+ t && w((e) => ({
73
+ ...t,
74
+ h: t.s === 0 || t.v === 0 ? e.h : t.h,
75
+ s: t.v === 0 ? e.s : t.s
76
+ }));
77
+ }
78
+ let j = u.useMemo(() => a(C), [C]), M = u.useMemo(() => i(C, D), [C, D]), N = u.useMemo(() => l(C), [C]), P = u.useMemo(() => l({
79
+ ...C,
80
+ a: 1
81
+ }), [C]), F = u.useRef({
82
+ hsva: C,
83
+ format: D
84
+ });
85
+ F.current = {
86
+ hsva: C,
87
+ format: D
88
+ };
89
+ let I = u.useCallback((e, t, n, r) => {
90
+ let o = i(e, t);
91
+ return O.current = o, r?.(o, {
92
+ hsva: e,
93
+ rgba: a(e),
94
+ format: t,
95
+ reason: n
96
+ }), o;
97
+ }, []), L = u.useCallback((e, t) => {
98
+ let n = {
99
+ ...F.current.hsva,
100
+ ...e
101
+ };
102
+ F.current = {
103
+ ...F.current,
104
+ hsva: n
105
+ }, w(n), I(n, F.current.format, t, r);
106
+ }, [I, r]), R = u.useCallback((e) => {
107
+ let { hsva: t, format: n } = F.current;
108
+ I(t, n, e, o);
109
+ }, [I, o]), z = u.useCallback((e) => {
110
+ if (e === F.current.format) return;
111
+ F.current = {
112
+ ...F.current,
113
+ format: e
114
+ }, c === void 0 && E(e), p?.(e);
115
+ let t = I(F.current.hsva, e, "format-change", r);
116
+ o?.(t, {
117
+ hsva: F.current.hsva,
118
+ rgba: a(F.current.hsva),
119
+ format: e,
120
+ reason: "format-change"
121
+ });
122
+ }, [
123
+ I,
124
+ c,
125
+ p,
126
+ r,
127
+ o
128
+ ]), B = u.useMemo(() => ({
129
+ hsva: C,
130
+ rgba: j,
131
+ css: N,
132
+ solid: P,
133
+ text: M,
134
+ format: D,
135
+ formats: m,
136
+ setFormat: z,
137
+ update: L,
138
+ commit: R,
139
+ disabled: h
140
+ }), [
141
+ C,
142
+ j,
143
+ N,
144
+ P,
145
+ M,
146
+ D,
147
+ m,
148
+ z,
149
+ L,
150
+ R,
151
+ h
152
+ ]);
153
+ return /* @__PURE__ */ d(v.Provider, {
154
+ value: B,
155
+ children: /* @__PURE__ */ d(n.Root, {
156
+ open: y,
157
+ defaultOpen: _,
158
+ onOpenChange: b,
159
+ modal: x,
160
+ children: S
161
+ })
162
+ });
163
+ }
164
+ var S = u.forwardRef(function({ hideSwatch: t = !1, disabled: r, className: i, style: a, children: o, ...s }, c) {
165
+ let l = y("Trigger"), u = b(l);
166
+ return /* @__PURE__ */ f(n.Trigger, {
167
+ ref: c,
168
+ render: /* @__PURE__ */ d("button", { type: "button" }),
169
+ className: e(m.trigger, i),
170
+ disabled: l.disabled || r,
171
+ style: {
172
+ ...u,
173
+ ...a
174
+ },
175
+ "data-forte": "color-picker-trigger",
176
+ ...s,
177
+ children: [
178
+ t ? null : /* @__PURE__ */ d("span", {
179
+ className: m.triggerSwatch,
180
+ "data-forte": "color-picker-trigger-swatch"
181
+ }),
182
+ o,
183
+ /* @__PURE__ */ d("span", {
184
+ className: "forte-visually-hidden",
185
+ children: l.text
186
+ })
187
+ ]
188
+ });
189
+ }), C = u.forwardRef(function({ arrow: t = !0, className: r, panelClassName: i, children: a, ...o }, s) {
190
+ let { disabled: c } = y("Popup");
191
+ return /* @__PURE__ */ f(n.Popup, {
192
+ ref: s,
193
+ className: e(m.popup, r),
194
+ ...o,
195
+ children: [t ? /* @__PURE__ */ d(n.Arrow, {}) : null, /* @__PURE__ */ d("div", {
196
+ className: e(m.panel, i),
197
+ "data-forte": "color-picker-panel",
198
+ "data-disabled": c || void 0,
199
+ children: a
200
+ })]
201
+ });
202
+ }), w = n.Arrow, T = u.forwardRef(function({ className: t, ...n }, r) {
203
+ let { disabled: i } = y("Panel");
204
+ return /* @__PURE__ */ d("div", {
205
+ ref: r,
206
+ className: e(m.panel, m.standalonePanel, t),
207
+ "data-forte": "color-picker-panel",
208
+ "data-disabled": i || void 0,
209
+ ...n
210
+ });
211
+ }), E = u.forwardRef(function({ className: t, ...n }, r) {
212
+ return /* @__PURE__ */ d("div", {
213
+ ref: r,
214
+ className: e(m.row, t),
215
+ "data-forte": "color-picker-row",
216
+ ...n
217
+ });
218
+ }), D = u.forwardRef(function({ saturationLabel: t = "Saturation", brightnessLabel: n = "Brightness", step: r = .01, className: i, style: a, onPointerDown: o, onPointerMove: s, onPointerUp: c, onPointerCancel: l, ...p }, g) {
219
+ let _ = y("Area"), { hsva: v, disabled: x, update: S, commit: C } = _, w = b(_), T = u.useRef(null), E = u.useRef(null), D = u.useRef(null), O = u.useRef(!1), [k, A] = u.useState(!1);
220
+ u.useImperativeHandle(g, () => T.current, []);
221
+ let j = (e) => {
222
+ let t = T.current;
223
+ if (!t) return null;
224
+ let n = t.getBoundingClientRect();
225
+ return n.width === 0 || n.height === 0 ? null : {
226
+ s: h((e.clientX - n.left) / n.width, 0, 1),
227
+ v: 1 - h((e.clientY - n.top) / n.height, 0, 1)
228
+ };
229
+ }, M = (e) => {
230
+ if (x || e.button !== 0) {
231
+ o?.(e);
232
+ return;
233
+ }
234
+ e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), O.current = !0, A(!0), E.current?.focus();
235
+ let t = j(e);
236
+ t && S(t, "area"), o?.(e);
237
+ }, N = (e) => {
238
+ if (s?.(e), !O.current) return;
239
+ let t = j(e);
240
+ t && S(t, "area");
241
+ }, P = (e) => {
242
+ (e.type === "pointerup" ? c : l)?.(e), O.current && (O.current = !1, A(!1), e.currentTarget.hasPointerCapture(e.pointerId) && e.currentTarget.releasePointerCapture(e.pointerId), C("area"));
243
+ }, F = {
244
+ ArrowRight: {
245
+ axis: "s",
246
+ direction: 1
247
+ },
248
+ ArrowLeft: {
249
+ axis: "s",
250
+ direction: -1
251
+ },
252
+ ArrowUp: {
253
+ axis: "v",
254
+ direction: 1
255
+ },
256
+ ArrowDown: {
257
+ axis: "v",
258
+ direction: -1
259
+ }
260
+ }, I = (e) => {
261
+ let t = F[e.key];
262
+ if (!t) return;
263
+ e.preventDefault();
264
+ let n = r * (e.shiftKey ? 10 : 1) * t.direction;
265
+ S({ [t.axis]: h(v[t.axis] + n, 0, 1) }, "area"), C("area"), (t.axis === "s" ? E : D).current?.focus();
266
+ }, L = (e) => Math.round(e * 100), R = (e) => Math.round(e * 1e4) / 100;
267
+ return /* @__PURE__ */ d("div", {
268
+ ref: T,
269
+ className: e(m.area, i),
270
+ "data-forte": "color-picker-area",
271
+ "data-disabled": x || void 0,
272
+ "data-dragging": k || void 0,
273
+ style: {
274
+ ...w,
275
+ ...a
276
+ },
277
+ onPointerDown: M,
278
+ onPointerMove: N,
279
+ onPointerUp: P,
280
+ onPointerCancel: P,
281
+ ...p,
282
+ children: /* @__PURE__ */ f("div", {
283
+ className: e(m.areaThumb, "forte-focus-ring-within"),
284
+ "data-forte": "color-picker-area-thumb",
285
+ style: {
286
+ left: `${R(v.s)}%`,
287
+ top: `${R(1 - v.v)}%`
288
+ },
289
+ children: [/* @__PURE__ */ d("input", {
290
+ ref: E,
291
+ className: m.srOnly,
292
+ type: "range",
293
+ min: 0,
294
+ max: 100,
295
+ step: r * 100,
296
+ value: R(v.s),
297
+ disabled: x,
298
+ "aria-label": t,
299
+ "aria-valuetext": `${L(v.s)}%`,
300
+ onChange: (e) => {
301
+ S({ s: Number(e.target.value) / 100 }, "area"), C("area");
302
+ },
303
+ onKeyDown: I
304
+ }), /* @__PURE__ */ d("input", {
305
+ ref: D,
306
+ className: m.srOnly,
307
+ type: "range",
308
+ min: 0,
309
+ max: 100,
310
+ step: r * 100,
311
+ value: R(v.v),
312
+ disabled: x,
313
+ "aria-label": n,
314
+ "aria-orientation": "vertical",
315
+ "aria-valuetext": `${L(v.v)}%`,
316
+ onChange: (e) => {
317
+ S({ v: Number(e.target.value) / 100 }, "area"), C("area");
318
+ },
319
+ onKeyDown: I
320
+ })]
321
+ })
322
+ });
323
+ });
324
+ function O({ channel: t, label: n, className: r, style: i, rest: a }) {
325
+ let o = y(t === "hue" ? "HueSlider" : "AlphaSlider"), { hsva: s, disabled: c, update: l, commit: u } = o, f = b(o), h = t === "hue", g = h ? s.h : s.a * 100;
326
+ return /* @__PURE__ */ d(p.Root, {
327
+ value: g,
328
+ min: 0,
329
+ max: h ? 360 : 100,
330
+ step: 1,
331
+ largeStep: 10,
332
+ disabled: c,
333
+ thumbAlignment: "edge",
334
+ onValueChange: (e) => l(h ? { h: e } : { a: e / 100 }, h ? "hue" : "alpha"),
335
+ onValueCommitted: () => u(h ? "hue" : "alpha"),
336
+ className: e(m.rail, r),
337
+ "data-forte": `color-picker-${t}-slider`,
338
+ style: {
339
+ ...f,
340
+ ...i
341
+ },
342
+ ...a,
343
+ children: /* @__PURE__ */ d(p.Control, {
344
+ className: m.railControl,
345
+ children: /* @__PURE__ */ d(p.Track, {
346
+ className: h ? m.hueTrack : m.alphaTrack,
347
+ "data-forte": `color-picker-${t}-track`,
348
+ children: /* @__PURE__ */ d(p.Thumb, {
349
+ className: e(m.railThumb, "forte-focus-ring-within"),
350
+ "data-forte": `color-picker-${t}-thumb`,
351
+ "aria-label": n,
352
+ getAriaValueText: (e, t) => h ? `${Math.round(t)}°` : `${Math.round(t)}%`
353
+ })
354
+ })
355
+ })
356
+ });
357
+ }
358
+ function k({ label: e = "Hue", className: t, style: n, ...r }) {
359
+ return /* @__PURE__ */ d(O, {
360
+ channel: "hue",
361
+ label: e,
362
+ className: t,
363
+ style: n,
364
+ rest: r
365
+ });
366
+ }
367
+ function A({ label: e = "Opacity", className: t, style: n, ...r }) {
368
+ return /* @__PURE__ */ d(O, {
369
+ channel: "alpha",
370
+ label: e,
371
+ className: t,
372
+ style: n,
373
+ rest: r
374
+ });
375
+ }
376
+ var j = u.createContext(null), M = u.forwardRef(function({ colors: t = r, columns: n = 8, label: i = "Colour swatches", className: o, style: l, onKeyDown: f, ...p }, g) {
377
+ let { rgba: _, disabled: v } = y("Swatches"), b = u.useMemo(() => t.find((e) => {
378
+ let t = s(e);
379
+ return t ? c(a(t), _) : !1;
380
+ }) ?? t[0] ?? null, [t, _]), x = u.useMemo(() => ({ roving: b }), [b]), S = (e) => {
381
+ f?.(e);
382
+ let t = Array.from(e.currentTarget.querySelectorAll("[data-forte=\"color-picker-swatch\"]:not(:disabled)")), r = t.indexOf(document.activeElement);
383
+ if (r === -1) return;
384
+ let i = getComputedStyle(e.currentTarget).direction === "rtl" ? -1 : 1, a = r;
385
+ switch (e.key) {
386
+ case "ArrowRight":
387
+ a = r + i;
388
+ break;
389
+ case "ArrowLeft":
390
+ a = r - i;
391
+ break;
392
+ case "ArrowDown":
393
+ a = r + n;
394
+ break;
395
+ case "ArrowUp":
396
+ a = r - n;
397
+ break;
398
+ case "Home":
399
+ a = 0;
400
+ break;
401
+ case "End":
402
+ a = t.length - 1;
403
+ break;
404
+ default: return;
405
+ }
406
+ e.preventDefault();
407
+ let o = t[h(a, 0, t.length - 1)];
408
+ o?.focus(), o?.click();
409
+ };
410
+ return /* @__PURE__ */ d(j.Provider, {
411
+ value: x,
412
+ children: /* @__PURE__ */ d("div", {
413
+ ref: g,
414
+ role: "radiogroup",
415
+ "aria-label": i,
416
+ "aria-disabled": v || void 0,
417
+ className: e(m.swatches, o),
418
+ "data-forte": "color-picker-swatches",
419
+ "data-disabled": v || void 0,
420
+ style: {
421
+ "--forte-color-picker-swatch-columns": n,
422
+ ...l
423
+ },
424
+ onKeyDown: S,
425
+ ...p,
426
+ children: t.map((e, t) => /* @__PURE__ */ d(N, { value: e }, `${e}-${t}`))
427
+ })
428
+ });
429
+ }), N = u.forwardRef(function({ value: t, label: n, disabled: r, className: i, style: l, onClick: f, ...p }, h) {
430
+ let { rgba: g, disabled: _, update: v, commit: b } = y("Swatch"), x = u.useContext(j), S = u.useMemo(() => s(t), [t]), C = S ? c(a(S), g) : !1, w = () => {
431
+ S && (v(S, "swatch"), b("swatch"));
432
+ };
433
+ return /* @__PURE__ */ d("button", {
434
+ ref: h,
435
+ type: "button",
436
+ role: x ? "radio" : void 0,
437
+ "aria-checked": x ? C : void 0,
438
+ "aria-pressed": x ? void 0 : C,
439
+ "aria-label": n ?? t,
440
+ disabled: _ || r,
441
+ tabIndex: x ? x.roving === t ? 0 : -1 : void 0,
442
+ className: e(m.swatch, "forte-focus-ring", i),
443
+ "data-forte": "color-picker-swatch",
444
+ "data-selected": C || void 0,
445
+ style: {
446
+ "--forte-color-picker-swatch": t,
447
+ "--forte-color-picker-swatch-on": S ? o(a(S)) : "currentColor",
448
+ ...l
449
+ },
450
+ onClick: (e) => {
451
+ w(), f?.(e);
452
+ },
453
+ ...p,
454
+ children: C ? /* @__PURE__ */ d("svg", {
455
+ className: m.swatchTick,
456
+ viewBox: "0 0 16 16",
457
+ fill: "none",
458
+ stroke: "currentColor",
459
+ strokeWidth: "2.5",
460
+ strokeLinecap: "round",
461
+ strokeLinejoin: "round",
462
+ "aria-hidden": "true",
463
+ focusable: "false",
464
+ children: /* @__PURE__ */ d("path", { d: "m3.5 8.5 3 3 6-7" })
465
+ }) : null
466
+ });
467
+ }), P = u.forwardRef(function({ className: t, style: n, ...r }, i) {
468
+ let a = b(y("Preview"));
469
+ return /* @__PURE__ */ d("div", {
470
+ ref: i,
471
+ "aria-hidden": "true",
472
+ className: e(m.preview, t),
473
+ "data-forte": "color-picker-preview",
474
+ style: {
475
+ ...a,
476
+ ...n
477
+ },
478
+ ...r
479
+ });
480
+ }), F = u.forwardRef(function({ className: t, ...n }, r) {
481
+ let { text: i } = y("Value");
482
+ return /* @__PURE__ */ d("span", {
483
+ ref: r,
484
+ className: e(m.value, t),
485
+ "data-forte": "color-picker-value",
486
+ ...n,
487
+ children: i
488
+ });
489
+ });
490
+ function I({ label: n = "Colour format", className: r }) {
491
+ let { format: i, formats: a, setFormat: o, disabled: s } = y("Format"), c = u.useMemo(() => Object.fromEntries(a.map((e) => [e, _[e]])), [a]);
492
+ return /* @__PURE__ */ f(t.Root, {
493
+ items: c,
494
+ value: i,
495
+ onValueChange: (e) => o(e),
496
+ disabled: s,
497
+ children: [/* @__PURE__ */ f(t.Trigger, {
498
+ size: "sm",
499
+ variant: "ghost",
500
+ "aria-label": n,
501
+ className: e(m.format, r),
502
+ "data-forte": "color-picker-format",
503
+ children: [/* @__PURE__ */ d(t.Value, {}), /* @__PURE__ */ d(t.Icon, {})]
504
+ }), /* @__PURE__ */ d(t.Popup, { children: a.map((e) => /* @__PURE__ */ d(t.Item, {
505
+ value: e,
506
+ children: _[e]
507
+ }, e)) })]
508
+ });
509
+ }
510
+ var L = u.forwardRef(function({ label: t = "Colour value", className: n, onKeyDown: r, onBlur: i, ...a }, o) {
511
+ let { text: c, disabled: l, update: f, commit: p } = y("Input"), [h, g] = u.useState(null), _ = h !== null && s(h) === null;
512
+ return /* @__PURE__ */ d("input", {
513
+ ref: o,
514
+ type: "text",
515
+ spellCheck: !1,
516
+ autoComplete: "off",
517
+ autoCapitalize: "off",
518
+ autoCorrect: "off",
519
+ inputMode: "text",
520
+ disabled: l,
521
+ "aria-label": t,
522
+ "aria-invalid": _ || void 0,
523
+ value: h ?? c,
524
+ className: e(m.input, "forte-focus-ring", n),
525
+ "data-forte": "color-picker-input",
526
+ "data-invalid": _ || void 0,
527
+ onChange: (e) => {
528
+ let t = e.target.value;
529
+ g(t);
530
+ let n = s(t);
531
+ n && f(n, "input");
532
+ },
533
+ onKeyDown: (e) => {
534
+ if (e.key === "Enter") {
535
+ let e = h === null ? null : s(h);
536
+ e && (f(e, "input"), p("input")), g(null);
537
+ } else e.key === "Escape" && g(null);
538
+ r?.(e);
539
+ },
540
+ onBlur: (e) => {
541
+ h !== null && s(h) && p("input"), g(null), i?.(e);
542
+ },
543
+ ...a
544
+ });
545
+ }), R = u.forwardRef(function({ label: t = "Pick a colour from the screen", disabled: n, className: r, onClick: i, ...a }, o) {
546
+ let { disabled: c, update: l, commit: p } = y("EyeDropper"), [h, g] = u.useState(!1);
547
+ if (u.useEffect(() => {
548
+ g(typeof window < "u" && "EyeDropper" in window);
549
+ }, []), !h) return null;
550
+ let _ = async () => {
551
+ let e = window.EyeDropper;
552
+ if (e) try {
553
+ let { sRGBHex: t } = await new e().open(), n = s(t);
554
+ n && (l({
555
+ h: n.h,
556
+ s: n.s,
557
+ v: n.v
558
+ }, "eye-dropper"), p("eye-dropper"));
559
+ } catch {}
560
+ };
561
+ return /* @__PURE__ */ d("button", {
562
+ ref: o,
563
+ type: "button",
564
+ disabled: c || n,
565
+ "aria-label": t,
566
+ className: e(m.eyeDropper, "forte-focus-ring", r),
567
+ "data-forte": "color-picker-eye-dropper",
568
+ onClick: (e) => {
569
+ _(), i?.(e);
570
+ },
571
+ ...a,
572
+ children: /* @__PURE__ */ f("svg", {
573
+ viewBox: "0 0 16 16",
574
+ fill: "currentColor",
575
+ "aria-hidden": "true",
576
+ focusable: "false",
577
+ className: m.eyeDropperIcon,
578
+ children: [/* @__PURE__ */ d("path", { d: "M13.7 2.3a1.9 1.9 0 0 0-2.7 0L9.6 3.7l2.7 2.7 1.4-1.4a1.9 1.9 0 0 0 0-2.7Z" }), /* @__PURE__ */ d("path", { d: "M8.9 4.4 3.4 9.9c-.3.3-.45.55-.5.9L2.5 13a.5.5 0 0 0 .6.6l2.2-.4c.35-.05.6-.2.9-.5l5.5-5.5-2.8-2.8Z" })]
579
+ })
580
+ });
581
+ }), z = u.forwardRef(function({ name: e, ...t }, n) {
582
+ let { text: r } = y("HiddenInput");
583
+ return /* @__PURE__ */ d("input", {
584
+ ref: n,
585
+ type: "hidden",
586
+ name: e,
587
+ value: r,
588
+ readOnly: !0,
589
+ "data-forte": "color-picker-hidden-input",
590
+ ...t
591
+ });
592
+ }), B = {
593
+ Root: x,
594
+ Trigger: S,
595
+ Popup: C,
596
+ Arrow: w,
597
+ Panel: T,
598
+ Row: E,
599
+ Area: D,
600
+ HueSlider: k,
601
+ AlphaSlider: A,
602
+ Swatches: M,
603
+ Swatch: N,
604
+ Preview: P,
605
+ Value: F,
606
+ Format: I,
607
+ Input: L,
608
+ EyeDropper: R,
609
+ HiddenInput: z
610
+ };
611
+ //#endregion
612
+ export { S as _, R as a, k as c, C as d, P as f, M as g, N as h, w as i, L as l, E as m, A as n, I as o, x as p, D as r, z as s, B as t, T as u, F as v };