@proyecto-viviana/solidaria-components 0.3.2 → 0.4.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 (398) hide show
  1. package/dist/ActionBar.js +184 -0
  2. package/dist/ActionBar.js.map +1 -0
  3. package/dist/ActionBar.jsx +128 -0
  4. package/dist/ActionBar.jsx.map +1 -0
  5. package/dist/ActionGroup.js +179 -0
  6. package/dist/ActionGroup.js.map +1 -0
  7. package/dist/ActionGroup.jsx +129 -0
  8. package/dist/ActionGroup.jsx.map +1 -0
  9. package/dist/Alert.js +111 -0
  10. package/dist/Alert.js.map +1 -0
  11. package/dist/Alert.jsx +82 -0
  12. package/dist/Alert.jsx.map +1 -0
  13. package/dist/Autocomplete.js +130 -0
  14. package/dist/Autocomplete.js.map +1 -0
  15. package/dist/Autocomplete.jsx +116 -0
  16. package/dist/Autocomplete.jsx.map +1 -0
  17. package/dist/Breadcrumbs.d.ts.map +1 -1
  18. package/dist/Breadcrumbs.js +334 -0
  19. package/dist/Breadcrumbs.js.map +1 -0
  20. package/dist/Breadcrumbs.jsx +266 -0
  21. package/dist/Breadcrumbs.jsx.map +1 -0
  22. package/dist/Button.d.ts.map +1 -1
  23. package/dist/Button.js +348 -0
  24. package/dist/Button.js.map +1 -0
  25. package/dist/Button.jsx +314 -0
  26. package/dist/Button.jsx.map +1 -0
  27. package/dist/Calendar.d.ts +4 -4
  28. package/dist/Calendar.d.ts.map +1 -1
  29. package/dist/Calendar.js +538 -0
  30. package/dist/Calendar.js.map +1 -0
  31. package/dist/Calendar.jsx +333 -0
  32. package/dist/Calendar.jsx.map +1 -0
  33. package/dist/CalendarPicker.d.ts +33 -0
  34. package/dist/CalendarPicker.d.ts.map +1 -0
  35. package/dist/CalendarPicker.js +44 -0
  36. package/dist/CalendarPicker.js.map +1 -0
  37. package/dist/CalendarPicker.jsx +44 -0
  38. package/dist/CalendarPicker.jsx.map +1 -0
  39. package/dist/Checkbox.d.ts +83 -4
  40. package/dist/Checkbox.d.ts.map +1 -1
  41. package/dist/Checkbox.js +923 -0
  42. package/dist/Checkbox.js.map +1 -0
  43. package/dist/Checkbox.jsx +707 -0
  44. package/dist/Checkbox.jsx.map +1 -0
  45. package/dist/Collection.d.ts.map +1 -1
  46. package/dist/Collection.js +202 -0
  47. package/dist/Collection.js.map +1 -0
  48. package/dist/Collection.jsx +152 -0
  49. package/dist/Collection.jsx.map +1 -0
  50. package/dist/Color.d.ts.map +1 -1
  51. package/dist/Color.js +1720 -0
  52. package/dist/Color.js.map +1 -0
  53. package/dist/Color.jsx +1344 -0
  54. package/dist/Color.jsx.map +1 -0
  55. package/dist/ColorEditor.js +208 -0
  56. package/dist/ColorEditor.js.map +1 -0
  57. package/dist/ColorEditor.jsx +120 -0
  58. package/dist/ColorEditor.jsx.map +1 -0
  59. package/dist/ComboBox.d.ts +4 -4
  60. package/dist/ComboBox.d.ts.map +1 -1
  61. package/dist/ComboBox.js +992 -0
  62. package/dist/ComboBox.js.map +1 -0
  63. package/dist/ComboBox.jsx +714 -0
  64. package/dist/ComboBox.jsx.map +1 -0
  65. package/dist/ContextualHelpTrigger.js +146 -0
  66. package/dist/ContextualHelpTrigger.js.map +1 -0
  67. package/dist/ContextualHelpTrigger.jsx +109 -0
  68. package/dist/ContextualHelpTrigger.jsx.map +1 -0
  69. package/dist/DateField.d.ts +3 -3
  70. package/dist/DateField.d.ts.map +1 -1
  71. package/dist/DateField.js +4 -0
  72. package/dist/DateField.jsx +4 -0
  73. package/dist/DateField2.js +499 -0
  74. package/dist/DateField2.js.map +1 -0
  75. package/dist/DateField2.jsx +317 -0
  76. package/dist/DateField2.jsx.map +1 -0
  77. package/dist/DatePicker.d.ts +4 -4
  78. package/dist/DatePicker.d.ts.map +1 -1
  79. package/dist/DatePicker.js +991 -0
  80. package/dist/DatePicker.js.map +1 -0
  81. package/dist/DatePicker.jsx +682 -0
  82. package/dist/DatePicker.jsx.map +1 -0
  83. package/dist/Dialog.d.ts.map +1 -1
  84. package/dist/Dialog.js +337 -0
  85. package/dist/Dialog.js.map +1 -0
  86. package/dist/Dialog.jsx +192 -0
  87. package/dist/Dialog.jsx.map +1 -0
  88. package/dist/Disclosure.d.ts.map +1 -1
  89. package/dist/Disclosure.js +328 -0
  90. package/dist/Disclosure.js.map +1 -0
  91. package/dist/Disclosure.jsx +230 -0
  92. package/dist/Disclosure.jsx.map +1 -0
  93. package/dist/DragAndDrop.d.ts.map +1 -1
  94. package/dist/DragAndDrop.js +176 -0
  95. package/dist/DragAndDrop.js.map +1 -0
  96. package/dist/DragAndDrop.jsx +160 -0
  97. package/dist/DragAndDrop.jsx.map +1 -0
  98. package/dist/DropZone.d.ts.map +1 -1
  99. package/dist/DropZone.js +189 -0
  100. package/dist/DropZone.js.map +1 -0
  101. package/dist/DropZone.jsx +144 -0
  102. package/dist/DropZone.jsx.map +1 -0
  103. package/dist/FieldError.js +66 -0
  104. package/dist/FieldError.js.map +1 -0
  105. package/dist/FieldError.jsx +47 -0
  106. package/dist/FieldError.jsx.map +1 -0
  107. package/dist/FileTrigger.js +79 -0
  108. package/dist/FileTrigger.js.map +1 -0
  109. package/dist/FileTrigger.jsx +49 -0
  110. package/dist/FileTrigger.jsx.map +1 -0
  111. package/dist/Focusable.js +70 -0
  112. package/dist/Focusable.js.map +1 -0
  113. package/dist/Focusable.jsx +69 -0
  114. package/dist/Focusable.jsx.map +1 -0
  115. package/dist/Form.js +99 -0
  116. package/dist/Form.js.map +1 -0
  117. package/dist/Form.jsx +73 -0
  118. package/dist/Form.jsx.map +1 -0
  119. package/dist/GridList.d.ts +34 -2
  120. package/dist/GridList.d.ts.map +1 -1
  121. package/dist/GridList.js +723 -0
  122. package/dist/GridList.js.map +1 -0
  123. package/dist/GridList.jsx +552 -0
  124. package/dist/GridList.jsx.map +1 -0
  125. package/dist/HiddenTimeInput.js +104 -0
  126. package/dist/HiddenTimeInput.js.map +1 -0
  127. package/dist/HiddenTimeInput.jsx +69 -0
  128. package/dist/HiddenTimeInput.jsx.map +1 -0
  129. package/dist/Icon.d.ts.map +1 -1
  130. package/dist/Icon.js +127 -0
  131. package/dist/Icon.js.map +1 -0
  132. package/dist/Icon.jsx +72 -0
  133. package/dist/Icon.jsx.map +1 -0
  134. package/dist/Keyboard.js +30 -0
  135. package/dist/Keyboard.js.map +1 -0
  136. package/dist/Keyboard.jsx +24 -0
  137. package/dist/Keyboard.jsx.map +1 -0
  138. package/dist/Landmark.js +134 -0
  139. package/dist/Landmark.js.map +1 -0
  140. package/dist/Landmark.jsx +118 -0
  141. package/dist/Landmark.jsx.map +1 -0
  142. package/dist/Link.d.ts.map +1 -1
  143. package/dist/Link.js +219 -0
  144. package/dist/Link.js.map +1 -0
  145. package/dist/Link.jsx +189 -0
  146. package/dist/Link.jsx.map +1 -0
  147. package/dist/ListBox.d.ts.map +1 -1
  148. package/dist/ListBox.js +670 -0
  149. package/dist/ListBox.js.map +1 -0
  150. package/dist/ListBox.jsx +508 -0
  151. package/dist/ListBox.jsx.map +1 -0
  152. package/dist/Menu.d.ts +27 -9
  153. package/dist/Menu.d.ts.map +1 -1
  154. package/dist/Menu.js +1254 -0
  155. package/dist/Menu.js.map +1 -0
  156. package/dist/Menu.jsx +1042 -0
  157. package/dist/Menu.jsx.map +1 -0
  158. package/dist/Meter.d.ts.map +1 -1
  159. package/dist/Meter.js +123 -0
  160. package/dist/Meter.js.map +1 -0
  161. package/dist/Meter.jsx +107 -0
  162. package/dist/Meter.jsx.map +1 -0
  163. package/dist/Modal.d.ts.map +1 -1
  164. package/dist/Modal.js +380 -0
  165. package/dist/Modal.js.map +1 -0
  166. package/dist/Modal.jsx +314 -0
  167. package/dist/Modal.jsx.map +1 -0
  168. package/dist/NumberField.d.ts +3 -3
  169. package/dist/NumberField.d.ts.map +1 -1
  170. package/dist/NumberField.js +573 -0
  171. package/dist/NumberField.js.map +1 -0
  172. package/dist/NumberField.jsx +443 -0
  173. package/dist/NumberField.jsx.map +1 -0
  174. package/dist/Popover.d.ts +10 -2
  175. package/dist/Popover.d.ts.map +1 -1
  176. package/dist/Popover.js +464 -0
  177. package/dist/Popover.js.map +1 -0
  178. package/dist/Popover.jsx +333 -0
  179. package/dist/Popover.jsx.map +1 -0
  180. package/dist/Pressable.js +69 -0
  181. package/dist/Pressable.js.map +1 -0
  182. package/dist/Pressable.jsx +68 -0
  183. package/dist/Pressable.jsx.map +1 -0
  184. package/dist/ProgressBar.d.ts.map +1 -1
  185. package/dist/ProgressBar.js +130 -0
  186. package/dist/ProgressBar.js.map +1 -0
  187. package/dist/ProgressBar.jsx +114 -0
  188. package/dist/ProgressBar.jsx.map +1 -0
  189. package/dist/RadioGroup.d.ts +82 -4
  190. package/dist/RadioGroup.d.ts.map +1 -1
  191. package/dist/RadioGroup.js +931 -0
  192. package/dist/RadioGroup.js.map +1 -0
  193. package/dist/RadioGroup.jsx +681 -0
  194. package/dist/RadioGroup.jsx.map +1 -0
  195. package/dist/RangeCalendar.d.ts.map +1 -1
  196. package/dist/RangeCalendar.js +410 -0
  197. package/dist/RangeCalendar.js.map +1 -0
  198. package/dist/RangeCalendar.jsx +253 -0
  199. package/dist/RangeCalendar.jsx.map +1 -0
  200. package/dist/RouterProvider.js +118 -0
  201. package/dist/RouterProvider.js.map +1 -0
  202. package/dist/RouterProvider.jsx +112 -0
  203. package/dist/RouterProvider.jsx.map +1 -0
  204. package/dist/SearchField.d.ts +2 -2
  205. package/dist/SearchField.d.ts.map +1 -1
  206. package/dist/SearchField.js +643 -0
  207. package/dist/SearchField.js.map +1 -0
  208. package/dist/SearchField.jsx +526 -0
  209. package/dist/SearchField.jsx.map +1 -0
  210. package/dist/Select.d.ts.map +1 -1
  211. package/dist/Select.js +1031 -0
  212. package/dist/Select.js.map +1 -0
  213. package/dist/Select.jsx +744 -0
  214. package/dist/Select.jsx.map +1 -0
  215. package/dist/SelectionIndicator.d.ts.map +1 -1
  216. package/dist/SelectionIndicator.js +86 -0
  217. package/dist/SelectionIndicator.js.map +1 -0
  218. package/dist/SelectionIndicator.jsx +50 -0
  219. package/dist/SelectionIndicator.jsx.map +1 -0
  220. package/dist/Separator.js +97 -0
  221. package/dist/Separator.js.map +1 -0
  222. package/dist/Separator.jsx +85 -0
  223. package/dist/Separator.jsx.map +1 -0
  224. package/dist/SharedElementTransition.d.ts.map +1 -1
  225. package/dist/SharedElementTransition.js +165 -0
  226. package/dist/SharedElementTransition.js.map +1 -0
  227. package/dist/SharedElementTransition.jsx +138 -0
  228. package/dist/SharedElementTransition.jsx.map +1 -0
  229. package/dist/Slider.d.ts +33 -1
  230. package/dist/Slider.d.ts.map +1 -1
  231. package/dist/Slider.js +515 -0
  232. package/dist/Slider.js.map +1 -0
  233. package/dist/Slider.jsx +403 -0
  234. package/dist/Slider.jsx.map +1 -0
  235. package/dist/StepList.js +198 -0
  236. package/dist/StepList.js.map +1 -0
  237. package/dist/StepList.jsx +141 -0
  238. package/dist/StepList.jsx.map +1 -0
  239. package/dist/Switch.d.ts +65 -2
  240. package/dist/Switch.d.ts.map +1 -1
  241. package/dist/Switch.js +534 -0
  242. package/dist/Switch.js.map +1 -0
  243. package/dist/Switch.jsx +393 -0
  244. package/dist/Switch.jsx.map +1 -0
  245. package/dist/Table.d.ts +48 -0
  246. package/dist/Table.d.ts.map +1 -1
  247. package/dist/Table.js +1759 -0
  248. package/dist/Table.js.map +1 -0
  249. package/dist/Table.jsx +1348 -0
  250. package/dist/Table.jsx.map +1 -0
  251. package/dist/Tabs.d.ts +0 -4
  252. package/dist/Tabs.d.ts.map +1 -1
  253. package/dist/Tabs.js +595 -0
  254. package/dist/Tabs.js.map +1 -0
  255. package/dist/Tabs.jsx +367 -0
  256. package/dist/Tabs.jsx.map +1 -0
  257. package/dist/TagGroup.d.ts.map +1 -1
  258. package/dist/TagGroup.js +378 -0
  259. package/dist/TagGroup.js.map +1 -0
  260. package/dist/TagGroup.jsx +270 -0
  261. package/dist/TagGroup.jsx.map +1 -0
  262. package/dist/Text.d.ts +18 -6
  263. package/dist/Text.d.ts.map +1 -1
  264. package/dist/Text.js +42 -0
  265. package/dist/Text.js.map +1 -0
  266. package/dist/Text.jsx +35 -0
  267. package/dist/Text.jsx.map +1 -0
  268. package/dist/TextField.d.ts +6 -6
  269. package/dist/TextField.d.ts.map +1 -1
  270. package/dist/TextField.js +436 -0
  271. package/dist/TextField.js.map +1 -0
  272. package/dist/TextField.jsx +403 -0
  273. package/dist/TextField.jsx.map +1 -0
  274. package/dist/TimeField.d.ts +3 -3
  275. package/dist/TimeField.d.ts.map +1 -1
  276. package/dist/TimeField.js +372 -0
  277. package/dist/TimeField.js.map +1 -0
  278. package/dist/TimeField.jsx +224 -0
  279. package/dist/TimeField.jsx.map +1 -0
  280. package/dist/Toast.d.ts +14 -0
  281. package/dist/Toast.d.ts.map +1 -1
  282. package/dist/Toast.js +551 -0
  283. package/dist/Toast.js.map +1 -0
  284. package/dist/Toast.jsx +361 -0
  285. package/dist/Toast.jsx.map +1 -0
  286. package/dist/ToggleButton.d.ts.map +1 -1
  287. package/dist/ToggleButton.js +123 -0
  288. package/dist/ToggleButton.js.map +1 -0
  289. package/dist/ToggleButton.jsx +88 -0
  290. package/dist/ToggleButton.jsx.map +1 -0
  291. package/dist/ToggleButtonGroup.d.ts.map +1 -1
  292. package/dist/ToggleButtonGroup.js +114 -0
  293. package/dist/ToggleButtonGroup.js.map +1 -0
  294. package/dist/ToggleButtonGroup.jsx +85 -0
  295. package/dist/ToggleButtonGroup.jsx.map +1 -0
  296. package/dist/Toolbar.js +112 -0
  297. package/dist/Toolbar.js.map +1 -0
  298. package/dist/Toolbar.jsx +92 -0
  299. package/dist/Toolbar.jsx.map +1 -0
  300. package/dist/Tooltip.d.ts.map +1 -1
  301. package/dist/Tooltip.js +539 -0
  302. package/dist/Tooltip.js.map +1 -0
  303. package/dist/Tooltip.jsx +465 -0
  304. package/dist/Tooltip.jsx.map +1 -0
  305. package/dist/Tree.d.ts +14 -2
  306. package/dist/Tree.d.ts.map +1 -1
  307. package/dist/Tree.js +1424 -0
  308. package/dist/Tree.js.map +1 -0
  309. package/dist/Tree.jsx +1172 -0
  310. package/dist/Tree.jsx.map +1 -0
  311. package/dist/Virtualizer.d.ts +16 -2
  312. package/dist/Virtualizer.d.ts.map +1 -1
  313. package/dist/Virtualizer.js +2 -0
  314. package/dist/Virtualizer.jsx +2 -0
  315. package/dist/Virtualizer2.js +751 -0
  316. package/dist/Virtualizer2.js.map +1 -0
  317. package/dist/Virtualizer2.jsx +730 -0
  318. package/dist/Virtualizer2.jsx.map +1 -0
  319. package/dist/VirtualizerLayouts.d.ts +18 -0
  320. package/dist/VirtualizerLayouts.d.ts.map +1 -1
  321. package/dist/VisuallyHidden.js +42 -0
  322. package/dist/VisuallyHidden.js.map +1 -0
  323. package/dist/VisuallyHidden.jsx +35 -0
  324. package/dist/VisuallyHidden.jsx.map +1 -0
  325. package/dist/contexts.js +33 -0
  326. package/dist/contexts.js.map +1 -0
  327. package/dist/contexts.jsx +33 -0
  328. package/dist/contexts.jsx.map +1 -0
  329. package/dist/index.d.ts +7 -6
  330. package/dist/index.d.ts.map +1 -1
  331. package/dist/index.js +70 -23932
  332. package/dist/index.jsx +70 -18337
  333. package/dist/useDragAndDrop.js +2 -0
  334. package/dist/useDragAndDrop.jsx +2 -0
  335. package/dist/useDragAndDrop2.js +395 -0
  336. package/dist/useDragAndDrop2.js.map +1 -0
  337. package/dist/useDragAndDrop2.jsx +395 -0
  338. package/dist/useDragAndDrop2.jsx.map +1 -0
  339. package/dist/utils.d.ts +83 -11
  340. package/dist/utils.d.ts.map +1 -1
  341. package/dist/utils.js +285 -0
  342. package/dist/utils.js.map +1 -0
  343. package/dist/utils.jsx +277 -0
  344. package/dist/utils.jsx.map +1 -0
  345. package/dist/virtualizer/Layout.js +144 -0
  346. package/dist/virtualizer/Layout.js.map +1 -0
  347. package/dist/virtualizer/Layout.jsx +144 -0
  348. package/dist/virtualizer/Layout.jsx.map +1 -0
  349. package/package.json +401 -4
  350. package/src/Breadcrumbs.tsx +3 -1
  351. package/src/Button.tsx +22 -2
  352. package/src/Calendar.tsx +27 -10
  353. package/src/CalendarPicker.tsx +73 -0
  354. package/src/Checkbox.tsx +539 -3
  355. package/src/Collection.tsx +9 -3
  356. package/src/Color.tsx +42 -14
  357. package/src/ComboBox.tsx +50 -6
  358. package/src/DateField.tsx +20 -2
  359. package/src/DatePicker.tsx +57 -5
  360. package/src/Dialog.tsx +13 -5
  361. package/src/Disclosure.tsx +3 -1
  362. package/src/DragAndDrop.tsx +3 -1
  363. package/src/DropZone.tsx +3 -1
  364. package/src/GridList.tsx +125 -24
  365. package/src/Icon.tsx +3 -1
  366. package/src/Link.tsx +3 -1
  367. package/src/ListBox.tsx +31 -4
  368. package/src/Menu.tsx +252 -128
  369. package/src/Meter.tsx +3 -1
  370. package/src/Modal.tsx +100 -52
  371. package/src/NumberField.tsx +51 -8
  372. package/src/Popover.tsx +40 -10
  373. package/src/ProgressBar.tsx +3 -1
  374. package/src/RadioGroup.tsx +468 -4
  375. package/src/RangeCalendar.tsx +3 -1
  376. package/src/SearchField.tsx +27 -3
  377. package/src/Select.tsx +22 -7
  378. package/src/SelectionIndicator.tsx +3 -1
  379. package/src/SharedElementTransition.tsx +3 -1
  380. package/src/Slider.tsx +159 -13
  381. package/src/Switch.tsx +395 -2
  382. package/src/Table.tsx +409 -95
  383. package/src/Tabs.tsx +16 -45
  384. package/src/TagGroup.tsx +3 -1
  385. package/src/Text.tsx +31 -10
  386. package/src/TextField.tsx +43 -5
  387. package/src/TimeField.tsx +20 -2
  388. package/src/Toast.tsx +79 -14
  389. package/src/ToggleButton.tsx +3 -1
  390. package/src/ToggleButtonGroup.tsx +3 -1
  391. package/src/Tooltip.tsx +3 -1
  392. package/src/Tree.tsx +77 -9
  393. package/src/Virtualizer.tsx +180 -31
  394. package/src/VirtualizerLayouts.ts +45 -10
  395. package/src/index.ts +50 -0
  396. package/src/utils.tsx +243 -27
  397. package/dist/index.js.map +0 -1
  398. package/dist/index.jsx.map +0 -1
package/dist/Color.js ADDED
@@ -0,0 +1,1720 @@
1
+ import { filterDOMProps, useRenderProps } from "./utils.js";
2
+ import { className, createComponent, effect, getNextElement, getNextMarker, insert, memo, mergeProps, runHydrationEvents, setAttribute, setProperty, spread, style, template, use } from "solid-js/web";
3
+ import { Show, createContext, createEffect, createMemo, createSignal, onCleanup, splitProps, untrack, useContext } from "solid-js";
4
+ import { createColorArea, createColorField, createColorSlider, createColorSwatch, createColorWheel, createFocusRing, createHover, createListBox, createOption, mergeProps as mergeProps$2 } from "@proyecto-viviana/solidaria";
5
+ import { createColorAreaState, createColorFieldState, createColorSliderState, createColorWheelState, createListState, normalizeColor } from "@proyecto-viviana/solid-stately";
6
+ //#region src/Color.tsx
7
+ /**
8
+ * Color components for solidaria-components
9
+ *
10
+ * Pre-wired headless color picker components that combine state + aria hooks.
11
+ * Port of react-aria-components color components.
12
+ */
13
+ var _tmpl$ = /*#__PURE__*/ template(`<div>`), _tmpl$2 = /*#__PURE__*/ template(`<label>`), _tmpl$3 = /*#__PURE__*/ template(`<output>`), _tmpl$4 = /*#__PURE__*/ template(`<div><input><!$><!/>`), _tmpl$5 = /*#__PURE__*/ template(`<div><input><input><!$><!/>`), _tmpl$6 = /*#__PURE__*/ template(`<div><!$><!/><!$><!/>`), _tmpl$7 = /*#__PURE__*/ template(`<input type=hidden>`), _tmpl$8 = /*#__PURE__*/ template(`<input>`);
14
+ const ColorPickerContextInternal = createContext(null);
15
+ const ColorPickerStateContextInternal = createContext(null);
16
+ const ColorSwatchContextInternal = createContext(null);
17
+ const ColorSwatchPickerContextInternal = createContext(null);
18
+ const ColorSliderContext = createContext(null);
19
+ /**
20
+ * A color slider allows users to adjust a single color channel.
21
+ */
22
+ function ColorSlider(props) {
23
+ const pickerContext = useContext(ColorPickerContextInternal);
24
+ const [local, stateProps, ariaProps, rest] = splitProps(props, [
25
+ "children",
26
+ "class",
27
+ "style",
28
+ "slot",
29
+ "label"
30
+ ], [
31
+ "value",
32
+ "defaultValue",
33
+ "onChange",
34
+ "onChangeEnd",
35
+ "channel",
36
+ "colorSpace"
37
+ ], [
38
+ "id",
39
+ "aria-label",
40
+ "aria-labelledby",
41
+ "aria-describedby",
42
+ "aria-details",
43
+ "isDisabled",
44
+ "name",
45
+ "form",
46
+ "orientation",
47
+ "channelName"
48
+ ]);
49
+ const state = createColorSliderState(() => ({
50
+ value: stateProps.value ?? pickerContext?.value,
51
+ defaultValue: stateProps.defaultValue,
52
+ onChange: stateProps.onChange ?? pickerContext?.onChange,
53
+ onChangeEnd: stateProps.onChangeEnd,
54
+ channel: stateProps.channel,
55
+ colorSpace: stateProps.colorSpace,
56
+ orientation: ariaProps.orientation,
57
+ isDisabled: ariaProps.isDisabled
58
+ }));
59
+ let trackRef;
60
+ const setTrackRef = (el) => {
61
+ trackRef = el;
62
+ };
63
+ let inputRef;
64
+ const setInputRef = (el) => {
65
+ inputRef = el;
66
+ };
67
+ const colorSliderAria = createColorSlider(() => ({
68
+ id: ariaProps.id,
69
+ channel: stateProps.channel,
70
+ label: local.label,
71
+ "aria-label": ariaProps["aria-label"],
72
+ "aria-labelledby": ariaProps["aria-labelledby"],
73
+ "aria-describedby": ariaProps["aria-describedby"],
74
+ "aria-details": ariaProps["aria-details"],
75
+ isDisabled: ariaProps.isDisabled,
76
+ name: ariaProps.name,
77
+ form: ariaProps.form,
78
+ orientation: ariaProps.orientation,
79
+ channelName: ariaProps.channelName
80
+ }), () => state, () => trackRef ?? null, () => inputRef ?? null);
81
+ const renderValues = createMemo(() => ({
82
+ isDisabled: state.isDisabled,
83
+ isDragging: state.isDragging,
84
+ channel: state.channel,
85
+ orientation: state.orientation,
86
+ value: state.getThumbValue(),
87
+ valueLabel: state.getThumbValueLabel(),
88
+ color: state.value,
89
+ defaultStyle: colorSliderAria.trackProps.style ?? {}
90
+ }));
91
+ const renderProps = useRenderProps({
92
+ get children() {
93
+ return props.children;
94
+ },
95
+ class: local.class,
96
+ style: local.style,
97
+ defaultClassName: "solidaria-ColorSlider"
98
+ }, renderValues);
99
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
100
+ return createComponent(ColorSliderContext.Provider, {
101
+ value: {
102
+ state,
103
+ get trackProps() {
104
+ return colorSliderAria.trackProps;
105
+ },
106
+ get thumbProps() {
107
+ return colorSliderAria.thumbProps;
108
+ },
109
+ get inputProps() {
110
+ return colorSliderAria.inputProps;
111
+ },
112
+ get outputProps() {
113
+ return colorSliderAria.outputProps;
114
+ },
115
+ get labelProps() {
116
+ return colorSliderAria.labelProps;
117
+ },
118
+ get trackRef() {
119
+ return trackRef;
120
+ },
121
+ setTrackRef,
122
+ setInputRef
123
+ },
124
+ get children() {
125
+ var _el$ = getNextElement(_tmpl$);
126
+ spread(_el$, mergeProps(domProps, {
127
+ get ["class"]() {
128
+ return renderProps.class();
129
+ },
130
+ get style() {
131
+ return renderProps.style();
132
+ },
133
+ get ["data-disabled"]() {
134
+ return state.isDisabled || void 0;
135
+ },
136
+ get ["data-dragging"]() {
137
+ return state.isDragging || void 0;
138
+ },
139
+ get ["data-orientation"]() {
140
+ return state.orientation;
141
+ },
142
+ get slot() {
143
+ return local.slot || void 0;
144
+ }
145
+ }), false, true);
146
+ insert(_el$, () => renderProps.renderChildren());
147
+ runHydrationEvents();
148
+ return _el$;
149
+ }
150
+ });
151
+ }
152
+ /**
153
+ * The label element of a color slider.
154
+ */
155
+ function ColorSliderLabel(props) {
156
+ const [local, domProps] = splitProps(props, [
157
+ "class",
158
+ "slot",
159
+ "children"
160
+ ]);
161
+ const context = useContext(ColorSliderContext);
162
+ if (!context) throw new Error("ColorSliderLabel must be used within a ColorSlider");
163
+ const labelProps = () => {
164
+ const { ref: _ref, ...rest } = context.labelProps;
165
+ return rest;
166
+ };
167
+ return (() => {
168
+ var _el$2 = getNextElement(_tmpl$2);
169
+ spread(_el$2, mergeProps(domProps, labelProps, { get ["class"]() {
170
+ return local.class;
171
+ } }), false, true);
172
+ insert(_el$2, () => local.children);
173
+ runHydrationEvents();
174
+ return _el$2;
175
+ })();
176
+ }
177
+ /**
178
+ * The output element of a color slider.
179
+ */
180
+ function ColorSliderOutput(props) {
181
+ const [local, domProps] = splitProps(props, [
182
+ "class",
183
+ "slot",
184
+ "children"
185
+ ]);
186
+ const context = useContext(ColorSliderContext);
187
+ if (!context) throw new Error("ColorSliderOutput must be used within a ColorSlider");
188
+ const state = context.state;
189
+ const renderValues = createMemo(() => ({
190
+ isDisabled: state.isDisabled,
191
+ isDragging: state.isDragging,
192
+ channel: state.channel,
193
+ orientation: state.orientation,
194
+ value: state.getThumbValue(),
195
+ valueLabel: state.getThumbValueLabel(),
196
+ color: state.value,
197
+ defaultStyle: context.trackProps.style ?? {}
198
+ }));
199
+ const children = () => typeof local.children === "function" ? local.children(renderValues()) : local.children ?? renderValues().valueLabel;
200
+ return (() => {
201
+ var _el$3 = getNextElement(_tmpl$3);
202
+ spread(_el$3, mergeProps(domProps, () => context.outputProps, { get ["class"]() {
203
+ return local.class;
204
+ } }), false, true);
205
+ insert(_el$3, children);
206
+ runHydrationEvents();
207
+ return _el$3;
208
+ })();
209
+ }
210
+ /**
211
+ * The track element of a color slider.
212
+ */
213
+ function ColorSliderTrack(props) {
214
+ const [local, domProps] = splitProps(props, [
215
+ "class",
216
+ "style",
217
+ "slot",
218
+ "children"
219
+ ]);
220
+ const context = useContext(ColorSliderContext);
221
+ if (!context) throw new Error("ColorSliderTrack must be used within a ColorSlider");
222
+ const state = context.state;
223
+ const renderValues = createMemo(() => ({
224
+ isDisabled: state.isDisabled,
225
+ isDragging: state.isDragging,
226
+ orientation: state.orientation,
227
+ defaultStyle: context.trackProps.style ?? {}
228
+ }));
229
+ const renderProps = useRenderProps({
230
+ get children() {
231
+ return props.children;
232
+ },
233
+ class: local.class,
234
+ style: local.style,
235
+ defaultClassName: "solidaria-ColorSlider-track"
236
+ }, renderValues);
237
+ const cleanTrackProps = () => {
238
+ const { ref: _ref, style: _trackStyle, ...rest } = context.trackProps;
239
+ return rest;
240
+ };
241
+ const mergedStyle = () => {
242
+ const trackStyle = context.trackProps.style || {};
243
+ const renderStyle = renderProps.style() || {};
244
+ return {
245
+ ...trackStyle,
246
+ ...renderStyle
247
+ };
248
+ };
249
+ return (() => {
250
+ var _el$4 = getNextElement(_tmpl$);
251
+ var _ref$ = context.setTrackRef;
252
+ typeof _ref$ === "function" ? use(_ref$, _el$4) : context.setTrackRef = _el$4;
253
+ spread(_el$4, mergeProps(domProps, cleanTrackProps, {
254
+ get ["class"]() {
255
+ return renderProps.class();
256
+ },
257
+ get style() {
258
+ return mergedStyle();
259
+ },
260
+ get ["data-disabled"]() {
261
+ return state.isDisabled || void 0;
262
+ },
263
+ get ["data-dragging"]() {
264
+ return state.isDragging || void 0;
265
+ },
266
+ get ["data-orientation"]() {
267
+ return state.orientation;
268
+ }
269
+ }), false, true);
270
+ insert(_el$4, () => renderProps.renderChildren());
271
+ runHydrationEvents();
272
+ return _el$4;
273
+ })();
274
+ }
275
+ /**
276
+ * The thumb element of a color slider.
277
+ */
278
+ function ColorSliderThumb(props) {
279
+ const [local, domProps] = splitProps(props, [
280
+ "class",
281
+ "style",
282
+ "slot",
283
+ "children",
284
+ "ref"
285
+ ]);
286
+ const context = useContext(ColorSliderContext);
287
+ if (!context) throw new Error("ColorSliderThumb must be used within a ColorSlider");
288
+ const state = context.state;
289
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
290
+ const { isHovered, hoverProps } = createHover({ get isDisabled() {
291
+ return state.isDisabled;
292
+ } });
293
+ const renderValues = createMemo(() => ({
294
+ isDisabled: state.isDisabled,
295
+ isDragging: state.isDragging,
296
+ isFocused: isFocused(),
297
+ isFocusVisible: isFocusVisible(),
298
+ isHovered: isHovered(),
299
+ color: state.getDisplayColor(),
300
+ defaultStyle: context.thumbProps.style ?? {}
301
+ }));
302
+ const renderProps = useRenderProps({
303
+ get children() {
304
+ return props.children;
305
+ },
306
+ class: local.class,
307
+ style: local.style,
308
+ defaultClassName: "solidaria-ColorSlider-thumb"
309
+ }, renderValues);
310
+ const cleanThumbProps = () => {
311
+ const { ref: _ref, style: _thumbStyle, ...rest } = context.thumbProps;
312
+ return rest;
313
+ };
314
+ const cleanFocusProps = () => {
315
+ const { ref: _ref, ...rest } = focusProps;
316
+ return rest;
317
+ };
318
+ const cleanHoverProps = () => {
319
+ const { ref: _ref, ...rest } = hoverProps;
320
+ return rest;
321
+ };
322
+ const mergedInputProps = () => {
323
+ return mergeProps$2(context.inputProps, cleanFocusProps());
324
+ };
325
+ const mergedStyle = () => {
326
+ const thumbStyle = context.thumbProps.style || {};
327
+ const renderStyle = renderProps.style() || {};
328
+ return {
329
+ ...thumbStyle,
330
+ ...renderStyle
331
+ };
332
+ };
333
+ return (() => {
334
+ var _el$5 = getNextElement(_tmpl$4), _el$6 = _el$5.firstChild, _el$7 = _el$6.nextSibling, [_el$8, _co$] = getNextMarker(_el$7.nextSibling);
335
+ var _ref$2 = local.ref;
336
+ typeof _ref$2 === "function" ? use(_ref$2, _el$5) : local.ref = _el$5;
337
+ spread(_el$5, mergeProps(domProps, cleanThumbProps, cleanHoverProps, {
338
+ get ["class"]() {
339
+ return renderProps.class();
340
+ },
341
+ get style() {
342
+ return mergedStyle();
343
+ },
344
+ get ["data-disabled"]() {
345
+ return state.isDisabled || void 0;
346
+ },
347
+ get ["data-dragging"]() {
348
+ return state.isDragging || void 0;
349
+ },
350
+ get ["data-focused"]() {
351
+ return isFocused() || void 0;
352
+ },
353
+ get ["data-focus-visible"]() {
354
+ return isFocusVisible() || void 0;
355
+ },
356
+ get ["data-hovered"]() {
357
+ return isHovered() || void 0;
358
+ }
359
+ }), false, true);
360
+ var _ref$3 = context.setInputRef;
361
+ typeof _ref$3 === "function" ? use(_ref$3, _el$6) : context.setInputRef = _el$6;
362
+ spread(_el$6, mergeProps(mergedInputProps), false, false);
363
+ insert(_el$5, () => renderProps.renderChildren(), _el$8, _co$);
364
+ runHydrationEvents();
365
+ return _el$5;
366
+ })();
367
+ }
368
+ ColorSlider.Track = ColorSliderTrack;
369
+ ColorSlider.Thumb = ColorSliderThumb;
370
+ ColorSlider.Label = ColorSliderLabel;
371
+ ColorSlider.Output = ColorSliderOutput;
372
+ const ColorAreaContext = createContext(null);
373
+ /**
374
+ * A color area allows users to select a color using a 2D gradient.
375
+ */
376
+ function ColorArea(props) {
377
+ const pickerContext = useContext(ColorPickerContextInternal);
378
+ const [local, stateProps, ariaProps, rest] = splitProps(props, [
379
+ "children",
380
+ "class",
381
+ "style",
382
+ "slot"
383
+ ], [
384
+ "value",
385
+ "defaultValue",
386
+ "onChange",
387
+ "onChangeEnd",
388
+ "xChannel",
389
+ "yChannel",
390
+ "colorSpace"
391
+ ], [
392
+ "id",
393
+ "aria-label",
394
+ "aria-labelledby",
395
+ "aria-describedby",
396
+ "aria-details",
397
+ "isDisabled",
398
+ "xName",
399
+ "yName",
400
+ "form"
401
+ ]);
402
+ const state = createColorAreaState(() => ({
403
+ value: stateProps.value ?? pickerContext?.value,
404
+ defaultValue: stateProps.defaultValue,
405
+ onChange: stateProps.onChange ?? pickerContext?.onChange,
406
+ onChangeEnd: stateProps.onChangeEnd,
407
+ xChannel: stateProps.xChannel,
408
+ yChannel: stateProps.yChannel,
409
+ colorSpace: stateProps.colorSpace,
410
+ isDisabled: ariaProps.isDisabled
411
+ }));
412
+ let areaRef;
413
+ const setAreaRef = (el) => {
414
+ areaRef = el;
415
+ };
416
+ const colorAreaAria = createColorArea(() => ({
417
+ id: ariaProps.id,
418
+ "aria-label": ariaProps["aria-label"],
419
+ "aria-labelledby": ariaProps["aria-labelledby"],
420
+ "aria-describedby": ariaProps["aria-describedby"],
421
+ "aria-details": ariaProps["aria-details"],
422
+ isDisabled: ariaProps.isDisabled,
423
+ xName: ariaProps.xName,
424
+ yName: ariaProps.yName,
425
+ form: ariaProps.form
426
+ }), () => state, () => areaRef ?? null);
427
+ const renderValues = createMemo(() => ({
428
+ isDisabled: state.isDisabled,
429
+ isDragging: state.isDragging,
430
+ xChannel: state.xChannel,
431
+ yChannel: state.yChannel,
432
+ color: state.value,
433
+ defaultStyle: colorAreaAria.colorAreaProps.style ?? {}
434
+ }));
435
+ const childRenderValues = {
436
+ get isDisabled() {
437
+ return state.isDisabled;
438
+ },
439
+ get isDragging() {
440
+ return state.isDragging;
441
+ },
442
+ get xChannel() {
443
+ return state.xChannel;
444
+ },
445
+ get yChannel() {
446
+ return state.yChannel;
447
+ },
448
+ get color() {
449
+ return state.value;
450
+ },
451
+ get defaultStyle() {
452
+ return colorAreaAria.colorAreaProps.style ?? {};
453
+ }
454
+ };
455
+ const colorAreaChildren = () => {
456
+ const children = props.children;
457
+ return typeof children === "function" ? children(childRenderValues) : children;
458
+ };
459
+ const renderProps = useRenderProps({
460
+ get children() {
461
+ return props.children;
462
+ },
463
+ class: local.class,
464
+ style: local.style,
465
+ defaultClassName: "solidaria-ColorArea"
466
+ }, renderValues);
467
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
468
+ const cleanColorAreaProps = () => {
469
+ const { ref: _ref, style: _areaStyle, ...rest } = colorAreaAria.colorAreaProps;
470
+ return rest;
471
+ };
472
+ const mergedStyle = () => {
473
+ const areaStyle = colorAreaAria.colorAreaProps.style || {};
474
+ const renderStyle = renderProps.style() || {};
475
+ return {
476
+ ...areaStyle,
477
+ ...renderStyle
478
+ };
479
+ };
480
+ return createComponent(ColorAreaContext.Provider, {
481
+ value: {
482
+ state,
483
+ get colorAreaProps() {
484
+ return colorAreaAria.colorAreaProps;
485
+ },
486
+ get gradientProps() {
487
+ return colorAreaAria.gradientProps;
488
+ },
489
+ get thumbProps() {
490
+ return colorAreaAria.thumbProps;
491
+ },
492
+ get xInputProps() {
493
+ return colorAreaAria.xInputProps;
494
+ },
495
+ get yInputProps() {
496
+ return colorAreaAria.yInputProps;
497
+ },
498
+ areaRef,
499
+ setAreaRef
500
+ },
501
+ get children() {
502
+ var _el$9 = getNextElement(_tmpl$);
503
+ use(setAreaRef, _el$9);
504
+ spread(_el$9, mergeProps(domProps, cleanColorAreaProps, {
505
+ get ["class"]() {
506
+ return renderProps.class();
507
+ },
508
+ get style() {
509
+ return mergedStyle();
510
+ },
511
+ get slot() {
512
+ return local.slot ?? void 0;
513
+ },
514
+ get ["data-disabled"]() {
515
+ return state.isDisabled || void 0;
516
+ },
517
+ get ["data-dragging"]() {
518
+ return state.isDragging || void 0;
519
+ }
520
+ }), false, true);
521
+ insert(_el$9, colorAreaChildren);
522
+ runHydrationEvents();
523
+ return _el$9;
524
+ }
525
+ });
526
+ }
527
+ /**
528
+ * The gradient background of a color area.
529
+ */
530
+ function ColorAreaGradient(props) {
531
+ const [local, domProps] = splitProps(props, [
532
+ "class",
533
+ "style",
534
+ "slot",
535
+ "children"
536
+ ]);
537
+ const context = useContext(ColorAreaContext);
538
+ if (!context) throw new Error("ColorAreaGradient must be used within a ColorArea");
539
+ const { state } = context;
540
+ const renderValues = createMemo(() => ({ isDisabled: state.isDisabled }));
541
+ const renderProps = useRenderProps({
542
+ get children() {
543
+ return props.children;
544
+ },
545
+ class: local.class,
546
+ style: local.style,
547
+ defaultClassName: "solidaria-ColorArea-gradient"
548
+ }, renderValues);
549
+ const cleanGradientProps = () => {
550
+ const { ref: _ref, style: _gradStyle, ...rest } = context.gradientProps;
551
+ return rest;
552
+ };
553
+ const mergedStyle = () => {
554
+ const gradStyle = context.gradientProps.style || {};
555
+ const renderStyle = renderProps.style() || {};
556
+ return {
557
+ ...gradStyle,
558
+ ...renderStyle
559
+ };
560
+ };
561
+ return (() => {
562
+ var _el$0 = getNextElement(_tmpl$);
563
+ spread(_el$0, mergeProps(domProps, cleanGradientProps, {
564
+ get ["class"]() {
565
+ return renderProps.class();
566
+ },
567
+ get style() {
568
+ return mergedStyle();
569
+ },
570
+ get ["data-disabled"]() {
571
+ return state.isDisabled || void 0;
572
+ }
573
+ }), false, true);
574
+ insert(_el$0, () => renderProps.renderChildren());
575
+ runHydrationEvents();
576
+ return _el$0;
577
+ })();
578
+ }
579
+ /**
580
+ * The thumb element of a color area.
581
+ */
582
+ function ColorAreaThumb(props) {
583
+ const [local, domProps] = splitProps(props, [
584
+ "class",
585
+ "style",
586
+ "slot",
587
+ "children",
588
+ "ref"
589
+ ]);
590
+ const context = useContext(ColorAreaContext);
591
+ if (!context) throw new Error("ColorAreaThumb must be used within a ColorArea");
592
+ const { state } = context;
593
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
594
+ let xInputRef;
595
+ let yInputRef;
596
+ const { isHovered, hoverProps } = createHover({ get isDisabled() {
597
+ return state.isDisabled;
598
+ } });
599
+ const renderValues = createMemo(() => ({
600
+ isDisabled: state.isDisabled,
601
+ isDragging: state.isDragging,
602
+ color: state.getDisplayColor(),
603
+ isFocused: isFocused(),
604
+ isFocusVisible: isFocusVisible(),
605
+ isHovered: isHovered()
606
+ }));
607
+ const renderProps = useRenderProps({
608
+ get children() {
609
+ return props.children;
610
+ },
611
+ class: local.class,
612
+ style: local.style,
613
+ defaultClassName: "solidaria-ColorArea-thumb"
614
+ }, renderValues);
615
+ const cleanThumbProps = () => {
616
+ const { ref: _ref, style: _thumbStyle, ...rest } = context.thumbProps;
617
+ return rest;
618
+ };
619
+ const cleanFocusProps = () => {
620
+ const { ref: _ref, ...rest } = focusProps;
621
+ return rest;
622
+ };
623
+ const cleanHoverProps = () => {
624
+ const { ref: _ref, ...rest } = hoverProps;
625
+ return rest;
626
+ };
627
+ const mergedXInputProps = () => {
628
+ const { value: _value, ...inputProps } = context.xInputProps;
629
+ return mergeProps$2(inputProps, cleanFocusProps());
630
+ };
631
+ const mergedYInputProps = () => {
632
+ const { value: _value, ...inputProps } = context.yInputProps;
633
+ return mergeProps$2(inputProps, cleanFocusProps());
634
+ };
635
+ const mergedStyle = () => {
636
+ const thumbStyle = context.thumbProps.style || {};
637
+ const renderStyle = renderProps.style() || {};
638
+ return {
639
+ ...thumbStyle,
640
+ ...renderStyle
641
+ };
642
+ };
643
+ const syncInputValue = (input, value) => {
644
+ const nextValue = String(value);
645
+ const update = () => {
646
+ if (input && input.value !== nextValue) input.value = nextValue;
647
+ };
648
+ update();
649
+ queueMicrotask(update);
650
+ };
651
+ createEffect(() => {
652
+ syncInputValue(xInputRef, state.getXValue());
653
+ });
654
+ createEffect(() => {
655
+ syncInputValue(yInputRef, state.getYValue());
656
+ });
657
+ return (() => {
658
+ var _el$1 = getNextElement(_tmpl$5), _el$10 = _el$1.firstChild, _el$11 = _el$10.nextSibling, _el$12 = _el$11.nextSibling, [_el$13, _co$2] = getNextMarker(_el$12.nextSibling);
659
+ var _ref$4 = local.ref;
660
+ typeof _ref$4 === "function" ? use(_ref$4, _el$1) : local.ref = _el$1;
661
+ spread(_el$1, mergeProps(domProps, cleanThumbProps, cleanHoverProps, {
662
+ get ["class"]() {
663
+ return renderProps.class();
664
+ },
665
+ get style() {
666
+ return mergedStyle();
667
+ },
668
+ get ["data-disabled"]() {
669
+ return state.isDisabled || void 0;
670
+ },
671
+ get ["data-dragging"]() {
672
+ return state.isDragging || void 0;
673
+ },
674
+ get ["data-focused"]() {
675
+ return isFocused() || void 0;
676
+ },
677
+ get ["data-focus-visible"]() {
678
+ return isFocusVisible() || void 0;
679
+ },
680
+ get ["data-hovered"]() {
681
+ return isHovered() || void 0;
682
+ }
683
+ }), false, true);
684
+ use((el) => {
685
+ xInputRef = el;
686
+ syncInputValue(el, state.getXValue());
687
+ }, _el$10);
688
+ spread(_el$10, mergeProps(mergedXInputProps), false, false);
689
+ use((el) => {
690
+ yInputRef = el;
691
+ syncInputValue(el, state.getYValue());
692
+ }, _el$11);
693
+ spread(_el$11, mergeProps(mergedYInputProps), false, false);
694
+ insert(_el$1, () => renderProps.renderChildren(), _el$13, _co$2);
695
+ runHydrationEvents();
696
+ return _el$1;
697
+ })();
698
+ }
699
+ ColorArea.Gradient = ColorAreaGradient;
700
+ ColorArea.Thumb = ColorAreaThumb;
701
+ const ColorWheelContext = createContext(null);
702
+ /**
703
+ * A color wheel allows users to select a hue using a circular control.
704
+ */
705
+ function ColorWheel(props) {
706
+ const pickerContext = useContext(ColorPickerContextInternal);
707
+ const [local, stateProps, ariaProps, rest] = splitProps(props, [
708
+ "children",
709
+ "class",
710
+ "style",
711
+ "slot"
712
+ ], [
713
+ "value",
714
+ "defaultValue",
715
+ "onChange",
716
+ "onChangeEnd"
717
+ ], [
718
+ "id",
719
+ "aria-label",
720
+ "aria-labelledby",
721
+ "aria-describedby",
722
+ "aria-details",
723
+ "aria-errormessage",
724
+ "isDisabled",
725
+ "name",
726
+ "form",
727
+ "outerRadius",
728
+ "innerRadius"
729
+ ]);
730
+ const state = createColorWheelState(() => ({
731
+ value: stateProps.value ?? pickerContext?.value,
732
+ defaultValue: stateProps.defaultValue,
733
+ onChange: stateProps.onChange ?? pickerContext?.onChange,
734
+ onChangeEnd: stateProps.onChangeEnd,
735
+ isDisabled: ariaProps.isDisabled
736
+ }));
737
+ let wheelRef;
738
+ const setWheelRef = (el) => {
739
+ wheelRef = el;
740
+ };
741
+ const colorWheelAria = createColorWheel(() => ({
742
+ id: ariaProps.id,
743
+ "aria-label": ariaProps["aria-label"],
744
+ "aria-labelledby": ariaProps["aria-labelledby"],
745
+ "aria-describedby": ariaProps["aria-describedby"],
746
+ "aria-details": ariaProps["aria-details"],
747
+ "aria-errormessage": ariaProps["aria-errormessage"],
748
+ isDisabled: ariaProps.isDisabled,
749
+ name: ariaProps.name,
750
+ form: ariaProps.form,
751
+ outerRadius: ariaProps.outerRadius,
752
+ innerRadius: ariaProps.innerRadius
753
+ }), () => state, () => wheelRef ?? null);
754
+ const renderValues = createMemo(() => ({
755
+ isDisabled: state.isDisabled,
756
+ isDragging: state.isDragging,
757
+ hue: state.getHue(),
758
+ color: state.value,
759
+ defaultStyle: { position: "relative" }
760
+ }));
761
+ const renderProps = useRenderProps({
762
+ get children() {
763
+ return props.children;
764
+ },
765
+ class: local.class,
766
+ style: local.style,
767
+ defaultClassName: "solidaria-ColorWheel"
768
+ }, renderValues);
769
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
770
+ return createComponent(ColorWheelContext.Provider, {
771
+ value: {
772
+ state,
773
+ get trackProps() {
774
+ return colorWheelAria.trackProps;
775
+ },
776
+ get thumbProps() {
777
+ return colorWheelAria.thumbProps;
778
+ },
779
+ get inputProps() {
780
+ return colorWheelAria.inputProps;
781
+ },
782
+ get wheelRef() {
783
+ return wheelRef;
784
+ },
785
+ setWheelRef
786
+ },
787
+ get children() {
788
+ var _el$14 = getNextElement(_tmpl$);
789
+ use(setWheelRef, _el$14);
790
+ spread(_el$14, mergeProps(domProps, {
791
+ get ["class"]() {
792
+ return renderProps.class();
793
+ },
794
+ get style() {
795
+ return renderProps.style();
796
+ },
797
+ get slot() {
798
+ return local.slot || void 0;
799
+ },
800
+ get ["data-disabled"]() {
801
+ return state.isDisabled || void 0;
802
+ },
803
+ get ["data-dragging"]() {
804
+ return state.isDragging || void 0;
805
+ }
806
+ }), false, true);
807
+ insert(_el$14, () => renderProps.renderChildren());
808
+ runHydrationEvents();
809
+ return _el$14;
810
+ }
811
+ });
812
+ }
813
+ /**
814
+ * The track element of a color wheel.
815
+ */
816
+ function ColorWheelTrack(props) {
817
+ const [local, domProps] = splitProps(props, [
818
+ "class",
819
+ "style",
820
+ "slot",
821
+ "children"
822
+ ]);
823
+ const context = useContext(ColorWheelContext);
824
+ if (!context) throw new Error("ColorWheelTrack must be used within a ColorWheel");
825
+ const state = context.state;
826
+ const renderValues = createMemo(() => ({
827
+ isDisabled: state.isDisabled,
828
+ isDragging: state.isDragging,
829
+ defaultStyle: context.trackProps.style ?? {}
830
+ }));
831
+ const renderProps = useRenderProps({
832
+ get children() {
833
+ return props.children;
834
+ },
835
+ class: local.class,
836
+ style: local.style,
837
+ defaultClassName: "solidaria-ColorWheel-track"
838
+ }, renderValues);
839
+ const cleanTrackProps = () => {
840
+ const { ref: _ref, style: _trackStyle, ...rest } = context.trackProps;
841
+ return rest;
842
+ };
843
+ const mergedStyle = () => {
844
+ const trackStyle = context.trackProps.style || {};
845
+ const renderStyle = renderProps.style() || {};
846
+ return {
847
+ ...trackStyle,
848
+ ...renderStyle
849
+ };
850
+ };
851
+ return (() => {
852
+ var _el$15 = getNextElement(_tmpl$);
853
+ spread(_el$15, mergeProps(domProps, cleanTrackProps, {
854
+ get ["class"]() {
855
+ return renderProps.class();
856
+ },
857
+ get style() {
858
+ return mergedStyle();
859
+ },
860
+ get ["data-disabled"]() {
861
+ return state.isDisabled || void 0;
862
+ },
863
+ get ["data-dragging"]() {
864
+ return state.isDragging || void 0;
865
+ }
866
+ }), false, true);
867
+ insert(_el$15, () => renderProps.renderChildren());
868
+ runHydrationEvents();
869
+ return _el$15;
870
+ })();
871
+ }
872
+ /**
873
+ * The thumb element of a color wheel.
874
+ */
875
+ function ColorWheelThumb(props) {
876
+ const [local, domProps] = splitProps(props, [
877
+ "class",
878
+ "style",
879
+ "slot",
880
+ "children",
881
+ "ref"
882
+ ]);
883
+ const context = useContext(ColorWheelContext);
884
+ if (!context) throw new Error("ColorWheelThumb must be used within a ColorWheel");
885
+ const state = context.state;
886
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
887
+ const { isHovered, hoverProps } = createHover({ get isDisabled() {
888
+ return state.isDisabled;
889
+ } });
890
+ const renderValues = createMemo(() => ({
891
+ isDisabled: state.isDisabled,
892
+ isDragging: state.isDragging,
893
+ color: state.getDisplayColor(),
894
+ isFocused: isFocused(),
895
+ isFocusVisible: isFocusVisible(),
896
+ isHovered: isHovered(),
897
+ defaultStyle: context.thumbProps.style ?? {}
898
+ }));
899
+ const renderProps = useRenderProps({
900
+ get children() {
901
+ return props.children;
902
+ },
903
+ class: local.class,
904
+ style: local.style,
905
+ defaultClassName: "solidaria-ColorWheel-thumb"
906
+ }, renderValues);
907
+ const cleanThumbProps = () => {
908
+ const { ref: _ref, style: _thumbStyle, ...rest } = context.thumbProps;
909
+ return rest;
910
+ };
911
+ const cleanFocusProps = () => {
912
+ const { ref: _ref, ...rest } = focusProps;
913
+ return rest;
914
+ };
915
+ const cleanHoverProps = () => {
916
+ const { ref: _ref, ...rest } = hoverProps;
917
+ return rest;
918
+ };
919
+ const mergedInputProps = () => {
920
+ return mergeProps$2(context.inputProps, cleanFocusProps());
921
+ };
922
+ const mergedStyle = () => {
923
+ const thumbStyle = context.thumbProps.style || {};
924
+ const renderStyle = renderProps.style() || {};
925
+ return {
926
+ ...thumbStyle,
927
+ ...renderStyle
928
+ };
929
+ };
930
+ return (() => {
931
+ var _el$16 = getNextElement(_tmpl$4), _el$17 = _el$16.firstChild, _el$18 = _el$17.nextSibling, [_el$19, _co$3] = getNextMarker(_el$18.nextSibling);
932
+ var _ref$5 = local.ref;
933
+ typeof _ref$5 === "function" ? use(_ref$5, _el$16) : local.ref = _el$16;
934
+ spread(_el$16, mergeProps(domProps, cleanThumbProps, cleanHoverProps, {
935
+ get ["class"]() {
936
+ return renderProps.class();
937
+ },
938
+ get style() {
939
+ return mergedStyle();
940
+ },
941
+ get ["data-disabled"]() {
942
+ return state.isDisabled || void 0;
943
+ },
944
+ get ["data-dragging"]() {
945
+ return state.isDragging || void 0;
946
+ },
947
+ get ["data-focused"]() {
948
+ return isFocused() || void 0;
949
+ },
950
+ get ["data-focus-visible"]() {
951
+ return isFocusVisible() || void 0;
952
+ },
953
+ get ["data-hovered"]() {
954
+ return isHovered() || void 0;
955
+ }
956
+ }), false, true);
957
+ spread(_el$17, mergeProps(mergedInputProps), false, false);
958
+ insert(_el$16, () => renderProps.renderChildren(), _el$19, _co$3);
959
+ runHydrationEvents();
960
+ return _el$16;
961
+ })();
962
+ }
963
+ ColorWheel.Track = ColorWheelTrack;
964
+ ColorWheel.Thumb = ColorWheelThumb;
965
+ const ColorFieldContext = createContext(null);
966
+ /**
967
+ * A color field allows users to enter a color value as text.
968
+ */
969
+ function ColorField(props) {
970
+ const pickerContext = useContext(ColorPickerContextInternal);
971
+ const [local, stateProps, ariaProps, rest] = splitProps(props, [
972
+ "children",
973
+ "class",
974
+ "style",
975
+ "slot",
976
+ "label",
977
+ "description",
978
+ "errorMessage"
979
+ ], [
980
+ "value",
981
+ "defaultValue",
982
+ "onChange",
983
+ "channel",
984
+ "colorSpace",
985
+ "colorFormat"
986
+ ], [
987
+ "id",
988
+ "aria-label",
989
+ "aria-labelledby",
990
+ "aria-describedby",
991
+ "aria-details",
992
+ "aria-errormessage",
993
+ "name",
994
+ "form",
995
+ "isWheelDisabled",
996
+ "isDisabled",
997
+ "isReadOnly",
998
+ "isRequired",
999
+ "isInvalid",
1000
+ "validationBehavior",
1001
+ "autoFocus",
1002
+ "excludeFromTabOrder",
1003
+ "placeholder"
1004
+ ]);
1005
+ const [hasRegisteredLabelElement, setHasRegisteredLabelElement] = createSignal(false);
1006
+ const state = createColorFieldState(() => ({
1007
+ value: stateProps.value ?? pickerContext?.value,
1008
+ defaultValue: stateProps.defaultValue,
1009
+ onChange: stateProps.onChange ?? ((color) => {
1010
+ if (color) pickerContext?.onChange?.(color);
1011
+ }),
1012
+ channel: stateProps.channel,
1013
+ colorSpace: stateProps.colorSpace,
1014
+ colorFormat: stateProps.colorFormat,
1015
+ isDisabled: ariaProps.isDisabled,
1016
+ isReadOnly: ariaProps.isReadOnly,
1017
+ isInvalid: ariaProps.isInvalid,
1018
+ isRequired: ariaProps.isRequired
1019
+ }));
1020
+ let inputRef;
1021
+ const setInputRef = (el) => {
1022
+ inputRef = el;
1023
+ };
1024
+ const colorFieldAria = createColorField(() => ({
1025
+ id: ariaProps.id,
1026
+ "aria-label": ariaProps["aria-label"],
1027
+ "aria-labelledby": ariaProps["aria-labelledby"],
1028
+ "aria-describedby": ariaProps["aria-describedby"],
1029
+ "aria-details": ariaProps["aria-details"],
1030
+ "aria-errormessage": ariaProps["aria-errormessage"],
1031
+ name: ariaProps.name,
1032
+ form: ariaProps.form,
1033
+ isWheelDisabled: ariaProps.isWheelDisabled,
1034
+ isDisabled: ariaProps.isDisabled,
1035
+ isReadOnly: ariaProps.isReadOnly,
1036
+ isRequired: ariaProps.isRequired,
1037
+ isInvalid: ariaProps.isInvalid,
1038
+ validationBehavior: ariaProps.validationBehavior,
1039
+ autoFocus: ariaProps.autoFocus,
1040
+ excludeFromTabOrder: ariaProps.excludeFromTabOrder,
1041
+ placeholder: ariaProps.placeholder,
1042
+ channel: stateProps.channel,
1043
+ colorSpace: stateProps.colorSpace
1044
+ }), () => state, () => inputRef ?? null);
1045
+ const describedBy = () => {
1046
+ const invalid = ariaProps.isInvalid || state.isInvalid;
1047
+ return [
1048
+ ariaProps["aria-describedby"],
1049
+ local.description && !invalid ? colorFieldAria.descriptionProps.id : void 0,
1050
+ invalid && local.errorMessage ? colorFieldAria.errorMessageProps.id : void 0
1051
+ ].filter(Boolean).join(" ") || void 0;
1052
+ };
1053
+ const fieldInputProps = () => {
1054
+ const labelledBy = ariaProps["aria-labelledby"] ?? (!ariaProps["aria-label"] && (local.label || hasRegisteredLabelElement()) ? colorFieldAria.labelProps.id : void 0);
1055
+ return {
1056
+ ...colorFieldAria.inputProps,
1057
+ "aria-label": labelledBy ? void 0 : colorFieldAria.inputProps["aria-label"],
1058
+ "aria-labelledby": labelledBy,
1059
+ "aria-describedby": describedBy(),
1060
+ "aria-errormessage": (ariaProps.isInvalid || state.isInvalid) && local.errorMessage ? colorFieldAria.errorMessageProps.id : colorFieldAria.inputProps["aria-errormessage"]
1061
+ };
1062
+ };
1063
+ const hiddenInputValue = createMemo(() => Number.isNaN(state.numberValue) ? "" : String(state.numberValue));
1064
+ const renderValues = createMemo(() => ({
1065
+ isDisabled: state.isDisabled,
1066
+ isReadOnly: state.isReadOnly,
1067
+ isRequired: state.isRequired,
1068
+ isInvalid: state.isInvalid,
1069
+ color: state.value,
1070
+ channel: state.channel ?? "hex"
1071
+ }));
1072
+ const renderProps = useRenderProps({
1073
+ get children() {
1074
+ return props.children;
1075
+ },
1076
+ class: local.class,
1077
+ style: local.style,
1078
+ defaultClassName: "solidaria-ColorField"
1079
+ }, renderValues);
1080
+ const childRenderValues = {
1081
+ get isDisabled() {
1082
+ return state.isDisabled;
1083
+ },
1084
+ get isReadOnly() {
1085
+ return state.isReadOnly;
1086
+ },
1087
+ get isRequired() {
1088
+ return state.isRequired;
1089
+ },
1090
+ get isInvalid() {
1091
+ return state.isInvalid;
1092
+ },
1093
+ get color() {
1094
+ return state.value;
1095
+ },
1096
+ get channel() {
1097
+ return state.channel ?? "hex";
1098
+ }
1099
+ };
1100
+ let hasRenderedChildren = false;
1101
+ let renderedChildren;
1102
+ const renderChildren = () => {
1103
+ if (!hasRenderedChildren) {
1104
+ const children = local.children;
1105
+ renderedChildren = typeof children === "function" ? untrack(() => children(childRenderValues)) : children;
1106
+ hasRenderedChildren = true;
1107
+ }
1108
+ return renderedChildren;
1109
+ };
1110
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
1111
+ return createComponent(ColorFieldContext.Provider, {
1112
+ value: {
1113
+ state,
1114
+ get inputProps() {
1115
+ return fieldInputProps();
1116
+ },
1117
+ get labelProps() {
1118
+ return colorFieldAria.labelProps;
1119
+ },
1120
+ get descriptionProps() {
1121
+ return colorFieldAria.descriptionProps;
1122
+ },
1123
+ get errorMessageProps() {
1124
+ return colorFieldAria.errorMessageProps;
1125
+ },
1126
+ setInputRef,
1127
+ setLabelElement: setHasRegisteredLabelElement
1128
+ },
1129
+ get children() {
1130
+ return [(() => {
1131
+ var _el$20 = getNextElement(_tmpl$6), _el$22 = _el$20.firstChild, [_el$23, _co$4] = getNextMarker(_el$22.nextSibling), _el$24 = _el$23.nextSibling, [_el$25, _co$5] = getNextMarker(_el$24.nextSibling);
1132
+ spread(_el$20, mergeProps(domProps, {
1133
+ get ["class"]() {
1134
+ return renderProps.class();
1135
+ },
1136
+ get style() {
1137
+ return renderProps.style();
1138
+ },
1139
+ get slot() {
1140
+ return local.slot ?? void 0;
1141
+ },
1142
+ get ["data-disabled"]() {
1143
+ return state.isDisabled || void 0;
1144
+ },
1145
+ get ["data-readonly"]() {
1146
+ return state.isReadOnly || void 0;
1147
+ },
1148
+ get ["data-invalid"]() {
1149
+ return state.isInvalid || void 0;
1150
+ },
1151
+ get ["data-required"]() {
1152
+ return state.isRequired || void 0;
1153
+ },
1154
+ get ["data-channel"]() {
1155
+ return state.channel ?? "hex";
1156
+ }
1157
+ }), false, true);
1158
+ insert(_el$20, createComponent(Show, {
1159
+ get when() {
1160
+ return local.label;
1161
+ },
1162
+ get children() {
1163
+ var _el$21 = getNextElement(_tmpl$2);
1164
+ spread(_el$21, mergeProps(() => colorFieldAria.labelProps), false, true);
1165
+ insert(_el$21, () => local.label);
1166
+ runHydrationEvents();
1167
+ return _el$21;
1168
+ }
1169
+ }), _el$23, _co$4);
1170
+ insert(_el$20, renderChildren, _el$25, _co$5);
1171
+ runHydrationEvents();
1172
+ return _el$20;
1173
+ })(), createComponent(Show, {
1174
+ get when() {
1175
+ return memo(() => !!state.channel)() && ariaProps.name;
1176
+ },
1177
+ get children() {
1178
+ var _el$26 = getNextElement(_tmpl$7);
1179
+ effect((_p$) => {
1180
+ var _v$ = ariaProps.name, _v$2 = ariaProps.form;
1181
+ _v$ !== _p$.e && setAttribute(_el$26, "name", _p$.e = _v$);
1182
+ _v$2 !== _p$.t && setAttribute(_el$26, "form", _p$.t = _v$2);
1183
+ return _p$;
1184
+ }, {
1185
+ e: void 0,
1186
+ t: void 0
1187
+ });
1188
+ effect(() => setProperty(_el$26, "value", hiddenInputValue()));
1189
+ return _el$26;
1190
+ }
1191
+ })];
1192
+ }
1193
+ });
1194
+ }
1195
+ /**
1196
+ * The input element of a color field.
1197
+ */
1198
+ function ColorFieldInput(props) {
1199
+ const [local, domProps] = splitProps(props, [
1200
+ "class",
1201
+ "style",
1202
+ "slot",
1203
+ "children",
1204
+ "ref"
1205
+ ]);
1206
+ const context = useContext(ColorFieldContext);
1207
+ if (!context) throw new Error("ColorFieldInput must be used within a ColorField");
1208
+ const state = context.state;
1209
+ const inputValue = createMemo(() => state.inputValue);
1210
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing();
1211
+ const { isHovered, hoverProps } = createHover({ get isDisabled() {
1212
+ return state.isDisabled;
1213
+ } });
1214
+ const renderValues = createMemo(() => ({
1215
+ isDisabled: state.isDisabled,
1216
+ isReadOnly: state.isReadOnly,
1217
+ isInvalid: state.isInvalid,
1218
+ isFocused: isFocused(),
1219
+ isFocusVisible: isFocusVisible(),
1220
+ isHovered: isHovered()
1221
+ }));
1222
+ const renderProps = useRenderProps({
1223
+ get children() {
1224
+ return props.children;
1225
+ },
1226
+ class: local.class,
1227
+ style: local.style,
1228
+ defaultClassName: "solidaria-ColorField-input"
1229
+ }, renderValues);
1230
+ const cleanInputProps = () => {
1231
+ const { ref: _ref, style: _inputStyle, value: _value, ...rest } = context.inputProps;
1232
+ return rest;
1233
+ };
1234
+ const cleanFocusProps = () => {
1235
+ const { ref: _ref, ...rest } = focusProps;
1236
+ return rest;
1237
+ };
1238
+ const cleanHoverProps = () => {
1239
+ const { ref: _ref, ...rest } = hoverProps;
1240
+ return rest;
1241
+ };
1242
+ return (() => {
1243
+ var _el$27 = getNextElement(_tmpl$8);
1244
+ use((el) => {
1245
+ context.setInputRef(el);
1246
+ local.ref?.(el);
1247
+ }, _el$27);
1248
+ spread(_el$27, mergeProps(domProps, cleanInputProps, cleanFocusProps, cleanHoverProps, {
1249
+ get ["class"]() {
1250
+ return renderProps.class();
1251
+ },
1252
+ get style() {
1253
+ return renderProps.style();
1254
+ },
1255
+ get value() {
1256
+ return inputValue();
1257
+ },
1258
+ get ["data-disabled"]() {
1259
+ return state.isDisabled || void 0;
1260
+ },
1261
+ get ["data-readonly"]() {
1262
+ return state.isReadOnly || void 0;
1263
+ },
1264
+ get ["data-invalid"]() {
1265
+ return state.isInvalid || void 0;
1266
+ },
1267
+ get ["data-focused"]() {
1268
+ return isFocused() || void 0;
1269
+ },
1270
+ get ["data-focus-visible"]() {
1271
+ return isFocusVisible() || void 0;
1272
+ },
1273
+ get ["data-hovered"]() {
1274
+ return isHovered() || void 0;
1275
+ }
1276
+ }), false, false);
1277
+ runHydrationEvents();
1278
+ return _el$27;
1279
+ })();
1280
+ }
1281
+ ColorField.Input = ColorFieldInput;
1282
+ /**
1283
+ * A color swatch displays a preview of a color.
1284
+ */
1285
+ function ColorSwatch(props) {
1286
+ const swatchContext = useContext(ColorSwatchContextInternal);
1287
+ const pickerContext = useContext(ColorPickerContextInternal);
1288
+ const [local, ariaProps, rest] = splitProps(props, [
1289
+ "children",
1290
+ "class",
1291
+ "style",
1292
+ "slot",
1293
+ "color",
1294
+ "colorName"
1295
+ ], [
1296
+ "aria-label",
1297
+ "aria-labelledby",
1298
+ "aria-describedby",
1299
+ "aria-details"
1300
+ ]);
1301
+ const resolvedColor = createMemo(() => {
1302
+ return local.color ?? swatchContext?.color ?? pickerContext?.value ?? "#fff0";
1303
+ });
1304
+ const swatchAria = createColorSwatch(() => ({
1305
+ id: rest.id,
1306
+ slot: local.slot,
1307
+ color: resolvedColor(),
1308
+ colorName: local.colorName,
1309
+ "aria-label": ariaProps["aria-label"],
1310
+ "aria-labelledby": ariaProps["aria-labelledby"],
1311
+ "aria-describedby": ariaProps["aria-describedby"],
1312
+ "aria-details": ariaProps["aria-details"]
1313
+ }));
1314
+ const renderValues = createMemo(() => ({
1315
+ color: swatchAria.color,
1316
+ colorValue: swatchAria.color.toString("css")
1317
+ }));
1318
+ const renderProps = useRenderProps({
1319
+ get children() {
1320
+ return props.children;
1321
+ },
1322
+ class: local.class,
1323
+ style: local.style,
1324
+ defaultClassName: "solidaria-ColorSwatch"
1325
+ }, renderValues);
1326
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
1327
+ const cleanSwatchProps = () => {
1328
+ const { ref: _ref, style: _swatchStyle, ...rest } = swatchAria.swatchProps;
1329
+ return rest;
1330
+ };
1331
+ const mergedStyle = () => {
1332
+ const swatchStyle = swatchAria.swatchProps.style || {};
1333
+ const renderStyle = renderProps.style() || {};
1334
+ return {
1335
+ ...swatchStyle,
1336
+ ...renderStyle
1337
+ };
1338
+ };
1339
+ return (() => {
1340
+ var _el$28 = getNextElement(_tmpl$);
1341
+ spread(_el$28, mergeProps(domProps, cleanSwatchProps, {
1342
+ get ["class"]() {
1343
+ return renderProps.class();
1344
+ },
1345
+ get style() {
1346
+ return mergedStyle();
1347
+ }
1348
+ }), false, true);
1349
+ insert(_el$28, () => renderProps.renderChildren());
1350
+ runHydrationEvents();
1351
+ return _el$28;
1352
+ })();
1353
+ }
1354
+ const ColorSliderStateContext = ColorSliderContext;
1355
+ const ColorAreaStateContext = ColorAreaContext;
1356
+ const ColorWheelStateContext = ColorWheelContext;
1357
+ const ColorWheelTrackContext = ColorWheelContext;
1358
+ const ColorFieldStateContext = ColorFieldContext;
1359
+ const ColorSwatchContext = ColorSwatchContextInternal;
1360
+ const ColorPickerContext = ColorPickerContextInternal;
1361
+ const ColorPickerStateContext = ColorPickerStateContextInternal;
1362
+ const ColorSwatchPickerContext = ColorSwatchPickerContextInternal;
1363
+ const ColorThumb = ColorSliderThumb;
1364
+ function ColorPicker(props) {
1365
+ const [local] = splitProps(props, [
1366
+ "value",
1367
+ "defaultValue",
1368
+ "onChange",
1369
+ "children",
1370
+ "class",
1371
+ "style",
1372
+ "slot"
1373
+ ]);
1374
+ const [internalColor, setInternalColor] = createSignal(normalizeColor(local.defaultValue ?? "#ff0000"));
1375
+ const color = createMemo(() => {
1376
+ if (local.value !== void 0) return normalizeColor(local.value);
1377
+ return internalColor();
1378
+ });
1379
+ const setColor = (nextColor) => {
1380
+ if (local.value === void 0) setInternalColor(nextColor);
1381
+ local.onChange?.(nextColor);
1382
+ };
1383
+ const renderValues = createMemo(() => ({ color: color() }));
1384
+ const renderProps = useRenderProps({
1385
+ get children() {
1386
+ return local.children;
1387
+ },
1388
+ class: local.class,
1389
+ style: local.style,
1390
+ defaultClassName: "solidaria-ColorPicker"
1391
+ }, renderValues);
1392
+ return createComponent(ColorPickerStateContextInternal.Provider, {
1393
+ value: {
1394
+ color: () => color(),
1395
+ setColor
1396
+ },
1397
+ get children() {
1398
+ return createComponent(ColorPickerContextInternal.Provider, {
1399
+ value: {
1400
+ get value() {
1401
+ return color();
1402
+ },
1403
+ onChange: setColor
1404
+ },
1405
+ get children() {
1406
+ var _el$29 = getNextElement(_tmpl$);
1407
+ insert(_el$29, () => renderProps.renderChildren());
1408
+ effect((_p$) => {
1409
+ var _v$3 = renderProps.class(), _v$4 = renderProps.style();
1410
+ _v$3 !== _p$.e && className(_el$29, _p$.e = _v$3);
1411
+ _p$.t = style(_el$29, _v$4, _p$.t);
1412
+ return _p$;
1413
+ }, {
1414
+ e: void 0,
1415
+ t: void 0
1416
+ });
1417
+ return _el$29;
1418
+ }
1419
+ });
1420
+ }
1421
+ });
1422
+ }
1423
+ function ColorSwatchPicker(props) {
1424
+ const pickerContext = useContext(ColorPickerContextInternal);
1425
+ const [local, rest] = splitProps(props, [
1426
+ "value",
1427
+ "defaultValue",
1428
+ "onChange",
1429
+ "id",
1430
+ "aria-label",
1431
+ "aria-labelledby",
1432
+ "aria-describedby",
1433
+ "aria-details",
1434
+ "layout",
1435
+ "children",
1436
+ "class",
1437
+ "style",
1438
+ "slot"
1439
+ ]);
1440
+ const [itemMap, setItemMap] = createSignal(/* @__PURE__ */ new Map());
1441
+ const [itemOrder, setItemOrder] = createSignal([]);
1442
+ const [internalColor, setInternalColor] = createSignal(normalizeColor(local.defaultValue ?? pickerContext?.value ?? "#ff0000"));
1443
+ const selectedColor = createMemo(() => {
1444
+ if (local.value !== void 0) return normalizeColor(local.value);
1445
+ if (pickerContext?.value !== void 0) return normalizeColor(pickerContext.value);
1446
+ return internalColor();
1447
+ });
1448
+ const selectedKey = createMemo(() => selectedColor().toString("hexa"));
1449
+ const isControlled = createMemo(() => local.value !== void 0 || pickerContext?.value !== void 0);
1450
+ const registerItem = (item) => {
1451
+ setItemMap((prev) => {
1452
+ const next = new Map(prev);
1453
+ next.set(item.key, item);
1454
+ return next;
1455
+ });
1456
+ setItemOrder((prev) => prev.includes(item.key) ? prev : [...prev, item.key]);
1457
+ };
1458
+ const unregisterItem = (key) => {
1459
+ setItemMap((prev) => {
1460
+ if (!prev.has(key)) return prev;
1461
+ const next = new Map(prev);
1462
+ next.delete(key);
1463
+ return next;
1464
+ });
1465
+ setItemOrder((prev) => prev.filter((itemKey) => itemKey !== key));
1466
+ };
1467
+ const items = createMemo(() => {
1468
+ const map = itemMap();
1469
+ return itemOrder().map((key) => map.get(key)).filter((item) => item != null);
1470
+ });
1471
+ const state = createListState({
1472
+ get items() {
1473
+ return items();
1474
+ },
1475
+ get getKey() {
1476
+ return (item) => item.key;
1477
+ },
1478
+ get getTextValue() {
1479
+ return (item) => item.textValue;
1480
+ },
1481
+ get getDisabled() {
1482
+ return (item) => !!item.isDisabled;
1483
+ },
1484
+ selectionMode: "single",
1485
+ disallowEmptySelection: true,
1486
+ get selectedKeys() {
1487
+ return [selectedKey()];
1488
+ },
1489
+ onSelectionChange(keys) {
1490
+ if (keys === "all") return;
1491
+ const key = keys.values().next().value;
1492
+ if (!key) return;
1493
+ const item = itemMap().get(key);
1494
+ if (!item) return;
1495
+ if (!isControlled()) setInternalColor(item.color);
1496
+ (local.onChange ?? pickerContext?.onChange)?.(item.color);
1497
+ }
1498
+ });
1499
+ const listBoxAria = createListBox(() => ({
1500
+ id: local.id,
1501
+ "aria-label": local["aria-label"] ?? (!local["aria-labelledby"] ? "Color swatch picker" : void 0),
1502
+ "aria-labelledby": local["aria-labelledby"],
1503
+ "aria-describedby": local["aria-describedby"],
1504
+ "aria-details": local["aria-details"],
1505
+ shouldFocusWrap: true
1506
+ }), state);
1507
+ const resolveDirection = () => {
1508
+ if (typeof document === "undefined") return "ltr";
1509
+ return document.dir === "rtl" ? "rtl" : "ltr";
1510
+ };
1511
+ const findNextEnabledKey = (from, direction) => {
1512
+ const collection = state.collection();
1513
+ const getAdjacent = direction === "next" ? (key) => collection.getKeyAfter(key) : (key) => collection.getKeyBefore(key);
1514
+ let key = from != null ? getAdjacent(from) : (direction === "next" ? () => collection.getFirstKey() : () => collection.getLastKey())();
1515
+ while (key != null && state.isDisabled(key)) key = getAdjacent(key);
1516
+ return key;
1517
+ };
1518
+ const getBoundaryEnabledKey = (direction) => {
1519
+ const collection = state.collection();
1520
+ const getAdjacent = direction === "next" ? (key) => collection.getKeyAfter(key) : (key) => collection.getKeyBefore(key);
1521
+ let key = (direction === "next" ? () => collection.getFirstKey() : () => collection.getLastKey())();
1522
+ while (key != null && state.isDisabled(key)) key = getAdjacent(key);
1523
+ return key;
1524
+ };
1525
+ const getOptionElementForKey = (listbox, key) => {
1526
+ if (!listbox || key == null) return null;
1527
+ const keyString = String(key);
1528
+ for (const optionElement of listbox.querySelectorAll("[role=\"option\"]")) if (optionElement.id === keyString) return optionElement;
1529
+ return null;
1530
+ };
1531
+ const findGridKey = (listbox, key, nextKey, shouldSkip) => {
1532
+ let candidate = key;
1533
+ const previousRect = getOptionElementForKey(listbox, candidate)?.getBoundingClientRect();
1534
+ if (!previousRect) return null;
1535
+ while (candidate != null) {
1536
+ candidate = nextKey(candidate);
1537
+ if (candidate == null) return null;
1538
+ const itemRect = getOptionElementForKey(listbox, candidate)?.getBoundingClientRect();
1539
+ if (!itemRect) return null;
1540
+ if (!shouldSkip(previousRect, itemRect)) return candidate;
1541
+ }
1542
+ return null;
1543
+ };
1544
+ const isSameRow = (prevRect, itemRect) => prevRect.y === itemRect.y || prevRect.x !== itemRect.x;
1545
+ const getGridKeyBelow = (listbox, key) => findGridKey(listbox, key, (current) => findNextEnabledKey(current, "next"), isSameRow);
1546
+ const getGridKeyAbove = (listbox, key) => findGridKey(listbox, key, (current) => findNextEnabledKey(current, "prev"), isSameRow);
1547
+ const getGridKeyRightOf = (key) => resolveDirection() === "rtl" ? findNextEnabledKey(key, "prev") : findNextEnabledKey(key, "next");
1548
+ const getGridKeyLeftOf = (key) => resolveDirection() === "rtl" ? findNextEnabledKey(key, "next") : findNextEnabledKey(key, "prev");
1549
+ const handleGridKeyDown = (e) => {
1550
+ if ((local.layout ?? "grid") !== "grid") return false;
1551
+ if (e.key !== "ArrowRight" && e.key !== "ArrowLeft" && e.key !== "ArrowDown" && e.key !== "ArrowUp") return false;
1552
+ const listbox = e.currentTarget;
1553
+ const initialKey = state.focusedKey() ?? (e.key === "ArrowUp" || e.key === "ArrowLeft" ? getBoundaryEnabledKey("prev") : getBoundaryEnabledKey("next"));
1554
+ if (initialKey == null) return false;
1555
+ let nextKey = null;
1556
+ switch (e.key) {
1557
+ case "ArrowDown":
1558
+ nextKey = getGridKeyBelow(listbox, initialKey) ?? getBoundaryEnabledKey("next");
1559
+ break;
1560
+ case "ArrowUp":
1561
+ nextKey = getGridKeyAbove(listbox, initialKey) ?? getBoundaryEnabledKey("prev");
1562
+ break;
1563
+ case "ArrowRight":
1564
+ nextKey = getGridKeyRightOf(initialKey) ?? (resolveDirection() === "rtl" ? getBoundaryEnabledKey("prev") : getBoundaryEnabledKey("next"));
1565
+ break;
1566
+ case "ArrowLeft":
1567
+ nextKey = getGridKeyLeftOf(initialKey) ?? (resolveDirection() === "rtl" ? getBoundaryEnabledKey("next") : getBoundaryEnabledKey("prev"));
1568
+ break;
1569
+ }
1570
+ if (nextKey == null) return false;
1571
+ state.setFocusedKey(nextKey);
1572
+ if (state.selectionMode() === "single") state.replaceSelection(nextKey);
1573
+ e.preventDefault();
1574
+ e.stopPropagation();
1575
+ return true;
1576
+ };
1577
+ const getListBoxKeyDown = () => {
1578
+ return listBoxAria.listBoxProps.onKeyDown;
1579
+ };
1580
+ const onColorSwatchPickerKeyDown = (e) => {
1581
+ if (handleGridKeyDown(e)) return;
1582
+ getListBoxKeyDown()?.(e);
1583
+ };
1584
+ createEffect(() => {
1585
+ const key = selectedKey();
1586
+ if (key) state.setFocusedKey(key);
1587
+ });
1588
+ const { isFocused, isFocusVisible, focusProps } = createFocusRing({ within: true });
1589
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
1590
+ const renderValues = createMemo(() => ({
1591
+ isFocused: state.isFocused() || isFocused(),
1592
+ isFocusVisible: isFocusVisible(),
1593
+ selectedColor: selectedColor(),
1594
+ layout: local.layout ?? "grid"
1595
+ }));
1596
+ const renderProps = useRenderProps({
1597
+ class: local.class,
1598
+ style: local.style,
1599
+ defaultClassName: "solidaria-ColorSwatchPicker"
1600
+ }, renderValues);
1601
+ const cleanListBoxProps = () => {
1602
+ const { ref: _ref, onKeyDown: _onKeyDown, ...restListBoxProps } = listBoxAria.listBoxProps;
1603
+ return restListBoxProps;
1604
+ };
1605
+ const cleanFocusProps = () => {
1606
+ const { ref: _ref, ...restFocusProps } = focusProps;
1607
+ return restFocusProps;
1608
+ };
1609
+ return createComponent(ColorSwatchPickerContextInternal.Provider, {
1610
+ value: {
1611
+ state,
1612
+ registerItem,
1613
+ unregisterItem
1614
+ },
1615
+ get children() {
1616
+ var _el$30 = getNextElement(_tmpl$);
1617
+ spread(_el$30, mergeProps(() => mergeProps$2(domProps(), cleanListBoxProps(), cleanFocusProps(), { onKeyDown: onColorSwatchPickerKeyDown }), {
1618
+ get ["class"]() {
1619
+ return renderProps.class();
1620
+ },
1621
+ get style() {
1622
+ return renderProps.style();
1623
+ },
1624
+ get slot() {
1625
+ return local.slot ?? void 0;
1626
+ },
1627
+ get ["data-focused"]() {
1628
+ return state.isFocused() || void 0;
1629
+ },
1630
+ get ["data-focus-visible"]() {
1631
+ return isFocusVisible() || void 0;
1632
+ },
1633
+ get ["data-layout"]() {
1634
+ return local.layout ?? "grid";
1635
+ }
1636
+ }), false, true);
1637
+ insert(_el$30, () => local.children);
1638
+ runHydrationEvents();
1639
+ return _el$30;
1640
+ }
1641
+ });
1642
+ }
1643
+ function ColorSwatchPickerItem(props) {
1644
+ const context = useContext(ColorSwatchPickerContextInternal);
1645
+ if (!context) throw new Error("ColorSwatchPickerItem must be used within a ColorSwatchPicker");
1646
+ const [local, ariaProps, rest] = splitProps(props, [
1647
+ "children",
1648
+ "class",
1649
+ "style",
1650
+ "slot",
1651
+ "color"
1652
+ ], ["isDisabled", "aria-label"]);
1653
+ const color = createMemo(() => normalizeColor(local.color));
1654
+ const key = createMemo(() => color().toString("hexa"));
1655
+ const textValue = createMemo(() => {
1656
+ const locale = globalThis.navigator?.language ?? "en-US";
1657
+ return color().getColorName(locale);
1658
+ });
1659
+ createEffect(() => {
1660
+ const itemKey = key();
1661
+ context.registerItem({
1662
+ key: itemKey,
1663
+ color: color(),
1664
+ textValue: textValue(),
1665
+ isDisabled: ariaProps.isDisabled
1666
+ });
1667
+ onCleanup(() => context.unregisterItem(itemKey));
1668
+ });
1669
+ const optionAria = createOption(() => ({
1670
+ key: key(),
1671
+ isDisabled: ariaProps.isDisabled,
1672
+ "aria-label": ariaProps["aria-label"] ?? textValue()
1673
+ }), context.state);
1674
+ const renderValues = createMemo(() => ({
1675
+ isSelected: optionAria.isSelected(),
1676
+ isFocused: optionAria.isFocused(),
1677
+ isFocusVisible: optionAria.isFocusVisible(),
1678
+ isPressed: optionAria.isPressed(),
1679
+ isDisabled: optionAria.isDisabled(),
1680
+ color: color()
1681
+ }));
1682
+ const renderProps = useRenderProps({
1683
+ get children() {
1684
+ return local.children;
1685
+ },
1686
+ class: local.class,
1687
+ style: local.style,
1688
+ defaultClassName: "solidaria-ColorSwatchPickerItem"
1689
+ }, renderValues);
1690
+ const domProps = createMemo(() => filterDOMProps(rest, { global: true }));
1691
+ const cleanOptionProps = () => {
1692
+ const { ref: _ref, ...restOptionProps } = optionAria.optionProps;
1693
+ return restOptionProps;
1694
+ };
1695
+ return (() => {
1696
+ var _el$31 = getNextElement(_tmpl$);
1697
+ spread(_el$31, mergeProps(() => mergeProps$2(domProps(), cleanOptionProps()), {
1698
+ get ["class"]() {
1699
+ return renderProps.class();
1700
+ },
1701
+ get style() {
1702
+ return renderProps.style();
1703
+ }
1704
+ }), false, true);
1705
+ insert(_el$31, createComponent(ColorSwatchContextInternal.Provider, {
1706
+ get value() {
1707
+ return { color: color() };
1708
+ },
1709
+ get children() {
1710
+ return memo(() => !!renderProps.children)() ? renderProps.renderChildren() : createComponent(ColorSwatch, {});
1711
+ }
1712
+ }));
1713
+ runHydrationEvents();
1714
+ return _el$31;
1715
+ })();
1716
+ }
1717
+ //#endregion
1718
+ export { ColorArea, ColorAreaContext, ColorAreaGradient, ColorAreaStateContext, ColorAreaThumb, ColorField, ColorFieldContext, ColorFieldInput, ColorFieldStateContext, ColorPicker, ColorPickerContext, ColorPickerStateContext, ColorSlider, ColorSliderContext, ColorSliderLabel, ColorSliderOutput, ColorSliderStateContext, ColorSliderThumb, ColorSliderTrack, ColorSwatch, ColorSwatchContext, ColorSwatchPicker, ColorSwatchPickerContext, ColorSwatchPickerItem, ColorThumb, ColorWheel, ColorWheelContext, ColorWheelStateContext, ColorWheelThumb, ColorWheelTrack, ColorWheelTrackContext };
1719
+
1720
+ //# sourceMappingURL=Color.js.map