@ui-sdk/web 0.0.0-stage → 0.1.0-beta.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 (467) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +10 -2
  3. package/browser/web/accordion.js +1 -0
  4. package/browser/web/alert-dialog.js +1 -0
  5. package/browser/web/autocomplete.js +1 -0
  6. package/browser/web/avatar.js +1 -0
  7. package/browser/web/button.js +1 -0
  8. package/browser/web/calendar.js +1 -0
  9. package/browser/web/carousel.js +1 -0
  10. package/browser/web/checkbox.js +1 -0
  11. package/browser/web/chunks/0eRGibL6.js +1 -0
  12. package/browser/web/chunks/2bIEUO6_.js +1 -0
  13. package/browser/web/chunks/5A9w2ULz.js +1 -0
  14. package/browser/web/chunks/5RSyydjV.js +1 -0
  15. package/browser/web/chunks/9pWTy2wl.js +1 -0
  16. package/browser/web/chunks/B0f2j6zz.js +1 -0
  17. package/browser/web/chunks/B1rux6br.js +1 -0
  18. package/browser/web/chunks/B3-APaNf.js +1 -0
  19. package/browser/web/chunks/B7EgSgjQ.js +1 -0
  20. package/browser/web/chunks/B8QcOzJU.js +1 -0
  21. package/browser/web/chunks/BFueEkwm.js +3 -0
  22. package/browser/web/chunks/BJj3oS29.js +1 -0
  23. package/browser/web/chunks/BNSvTCpr.js +1 -0
  24. package/browser/web/chunks/BPD0kAZB.js +1 -0
  25. package/browser/web/chunks/BQeduZqT.js +1 -0
  26. package/browser/web/chunks/B_CVFyiz.js +1 -0
  27. package/browser/web/chunks/B_ns1YHO.js +1 -0
  28. package/browser/web/chunks/BcwkVTsR.js +1 -0
  29. package/browser/web/chunks/BeaQ6TYM.js +1 -0
  30. package/browser/web/chunks/BgBB013u.js +1 -0
  31. package/browser/web/chunks/BgsKhHDm.js +1 -0
  32. package/browser/web/chunks/BjMcbuhi.js +9 -0
  33. package/browser/web/chunks/Bjiy_F2N.js +1 -0
  34. package/browser/web/chunks/BqScCLwv.js +1 -0
  35. package/browser/web/chunks/BqX3Utqx.js +1 -0
  36. package/browser/web/chunks/BtVkQf3z.js +1 -0
  37. package/browser/web/chunks/By30h-7B.js +1 -0
  38. package/browser/web/chunks/C1zqYpy2.js +1 -0
  39. package/browser/web/chunks/C436juFf.js +1 -0
  40. package/browser/web/chunks/C4_bULs1.js +1 -0
  41. package/browser/web/chunks/C4omqJEz.js +1 -0
  42. package/browser/web/chunks/C7tt0T3n.js +1 -0
  43. package/browser/web/chunks/C8w7s5dg.js +1 -0
  44. package/browser/web/chunks/CElY4erO.js +1 -0
  45. package/browser/web/chunks/CFODo-m2.js +1 -0
  46. package/browser/web/chunks/CL4wjam9.js +1 -0
  47. package/browser/web/chunks/CMg-8UVf.js +1 -0
  48. package/browser/web/chunks/COWKfakj.js +1 -0
  49. package/browser/web/chunks/CQBU0qZ4.js +1 -0
  50. package/browser/web/chunks/CV6uABgc.js +1 -0
  51. package/browser/web/chunks/C_SWFpWQ.js +1 -0
  52. package/browser/web/chunks/C_Uanbrl.js +1 -0
  53. package/browser/web/chunks/Ce_CSanC.js +1 -0
  54. package/browser/web/chunks/Cg-ZmRhS.js +1 -0
  55. package/browser/web/chunks/Cgf2wPI_.js +1 -0
  56. package/browser/web/chunks/Cuep_3Vf.js +1 -0
  57. package/browser/web/chunks/D02PaHn6.js +1 -0
  58. package/browser/web/chunks/D5LiaI5R.js +1 -0
  59. package/browser/web/chunks/D9UgVYvF.js +1 -0
  60. package/browser/web/chunks/DC08tnkE.js +2 -0
  61. package/browser/web/chunks/DG8YGSvu.js +1 -0
  62. package/browser/web/chunks/DIQd0FYD.js +1 -0
  63. package/browser/web/chunks/DMLqacE8.js +1 -0
  64. package/browser/web/chunks/DSUI3yI-.js +1 -0
  65. package/browser/web/chunks/DT3Hb76X.js +1 -0
  66. package/browser/web/chunks/DY75g3-W.js +1 -0
  67. package/browser/web/chunks/DZpNQKZ9.js +1 -0
  68. package/browser/web/chunks/Db-W1wrC.js +1 -0
  69. package/browser/web/chunks/Dc1xK3Ii.js +1 -0
  70. package/browser/web/chunks/DdF6awFs.js +1 -0
  71. package/browser/web/chunks/DdaCLml8.js +1 -0
  72. package/browser/web/chunks/Dh8MLjQO.js +1 -0
  73. package/browser/web/chunks/DiuslJRy.js +1 -0
  74. package/browser/web/chunks/DjRcw3Y0.js +1 -0
  75. package/browser/web/chunks/Djdv-16J.js +1 -0
  76. package/browser/web/chunks/DnFXe_lF.js +1 -0
  77. package/browser/web/chunks/DneGv1oC.js +1 -0
  78. package/browser/web/chunks/DsVxP-p-.js +1 -0
  79. package/browser/web/chunks/DwDilCo2.js +1 -0
  80. package/browser/web/chunks/DwV48AXv.js +1 -0
  81. package/browser/web/chunks/F37aF4-L.js +1 -0
  82. package/browser/web/chunks/LyB6XIbN.js +1 -0
  83. package/browser/web/chunks/NKnbYGjC.js +1 -0
  84. package/browser/web/chunks/Vk-rVi16.js +1 -0
  85. package/browser/web/chunks/XsM0J1Ex.js +1 -0
  86. package/browser/web/chunks/asSN9iEp.js +1 -0
  87. package/browser/web/chunks/c-AjHfdF.js +1 -0
  88. package/browser/web/chunks/dR-12TPY.js +1 -0
  89. package/browser/web/chunks/hR4xM0EC.js +1 -0
  90. package/browser/web/chunks/hqOaBxAg.js +1 -0
  91. package/browser/web/chunks/kMKqqeG4.js +1 -0
  92. package/browser/web/chunks/kXboBcfi.js +1 -0
  93. package/browser/web/chunks/l4aQIg22.js +1 -0
  94. package/browser/web/chunks/tJC0JSU4.js +1 -0
  95. package/browser/web/chunks/wHdS_QYM.js +1 -0
  96. package/browser/web/chunks/yv8dTvNI.js +1 -0
  97. package/browser/web/chunks/yw9M3nfi.js +1 -0
  98. package/browser/web/collapsible.js +1 -0
  99. package/browser/web/color-picker.js +1 -0
  100. package/browser/web/combobox.js +2 -0
  101. package/browser/web/command.js +1 -0
  102. package/browser/web/core.js +5 -0
  103. package/browser/web/date-input.js +1 -0
  104. package/browser/web/date-picker.js +1 -0
  105. package/browser/web/dialog.js +1 -0
  106. package/browser/web/drawer.js +1 -0
  107. package/browser/web/field.js +1 -0
  108. package/browser/web/file-input.js +1 -0
  109. package/browser/web/hover-card.js +1 -0
  110. package/browser/web/image-cropper.js +1 -0
  111. package/browser/web/input.js +1 -0
  112. package/browser/web/label.js +1 -0
  113. package/browser/web/listbox.js +1 -0
  114. package/browser/web/menu.js +1 -0
  115. package/browser/web/menubar.js +1 -0
  116. package/browser/web/meter.js +1 -0
  117. package/browser/web/navigation-menu.js +1 -0
  118. package/browser/web/number-input.js +1 -0
  119. package/browser/web/otp-input.js +2 -0
  120. package/browser/web/overlays.js +1 -0
  121. package/browser/web/pagination.js +1 -0
  122. package/browser/web/password-input.js +1 -0
  123. package/browser/web/popover.js +1 -0
  124. package/browser/web/preferences.js +1 -0
  125. package/browser/web/progress.js +1 -0
  126. package/browser/web/radio.js +1 -0
  127. package/browser/web/rating.js +1 -0
  128. package/browser/web/resizable.js +1 -0
  129. package/browser/web/scroll-area.js +1 -0
  130. package/browser/web/segmented-control.js +1 -0
  131. package/browser/web/select.js +1 -0
  132. package/browser/web/separator.js +1 -0
  133. package/browser/web/slider.js +1 -0
  134. package/browser/web/switch.js +1 -0
  135. package/browser/web/tabs.js +1 -0
  136. package/browser/web/textarea.js +1 -0
  137. package/browser/web/time-input.js +1 -0
  138. package/browser/web/timeline.js +1 -0
  139. package/browser/web/toast.js +1 -0
  140. package/browser/web/toggle.js +1 -0
  141. package/browser/web/token-input.js +8 -0
  142. package/browser/web/toolbar.js +1 -0
  143. package/browser/web/tooltip.js +1 -0
  144. package/browser/web/tree.js +1 -0
  145. package/browser/web/trigger-menu.js +4 -0
  146. package/browser/web/waterfall.js +1 -0
  147. package/browser/web.css +3378 -0
  148. package/browser/web.js +3 -0
  149. package/custom-elements.json +32315 -0
  150. package/dist/accordion.d.ts +2 -0
  151. package/dist/accordion.js +57 -0
  152. package/dist/action.d.ts +16 -0
  153. package/dist/action.js +39 -0
  154. package/dist/agent.d.ts +2 -0
  155. package/dist/agent.js +7 -0
  156. package/dist/autocomplete.d.ts +2 -0
  157. package/dist/autocomplete.js +120 -0
  158. package/dist/autoload.d.ts +18 -0
  159. package/dist/autoload.js +63 -0
  160. package/dist/avatar.d.ts +2 -0
  161. package/dist/avatar.js +27 -0
  162. package/dist/browser-core.d.ts +2 -0
  163. package/dist/browser-core.js +8 -0
  164. package/dist/button.d.ts +2 -0
  165. package/dist/button.js +35 -0
  166. package/dist/calendar.d.ts +23 -0
  167. package/dist/calendar.js +429 -0
  168. package/dist/carousel.d.ts +2 -0
  169. package/dist/carousel.js +54 -0
  170. package/dist/checkbox.d.ts +4 -0
  171. package/dist/checkbox.js +75 -0
  172. package/dist/collapsible.d.ts +2 -0
  173. package/dist/collapsible.js +28 -0
  174. package/dist/color-picker.d.ts +2 -0
  175. package/dist/color-picker.js +64 -0
  176. package/dist/combobox.d.ts +2 -0
  177. package/dist/combobox.js +334 -0
  178. package/dist/command.d.ts +2 -0
  179. package/dist/command.js +122 -0
  180. package/dist/date-input.d.ts +3 -0
  181. package/dist/date-input.js +87 -0
  182. package/dist/date-picker.d.ts +2 -0
  183. package/dist/date-picker.js +174 -0
  184. package/dist/default-text.d.ts +3 -0
  185. package/dist/default-text.js +24 -0
  186. package/dist/define-element.d.ts +404 -0
  187. package/dist/define-element.js +1489 -0
  188. package/dist/dialog.d.ts +3 -0
  189. package/dist/dialog.js +94 -0
  190. package/dist/drawer.d.ts +2 -0
  191. package/dist/drawer.js +96 -0
  192. package/dist/entries/accordion.d.ts +3 -0
  193. package/dist/entries/accordion.js +7 -0
  194. package/dist/entries/alert-dialog.d.ts +3 -0
  195. package/dist/entries/alert-dialog.js +13 -0
  196. package/dist/entries/autocomplete.d.ts +3 -0
  197. package/dist/entries/autocomplete.js +7 -0
  198. package/dist/entries/avatar.d.ts +2 -0
  199. package/dist/entries/avatar.js +3 -0
  200. package/dist/entries/button.d.ts +2 -0
  201. package/dist/entries/button.js +3 -0
  202. package/dist/entries/calendar.d.ts +3 -0
  203. package/dist/entries/calendar.js +7 -0
  204. package/dist/entries/carousel.d.ts +3 -0
  205. package/dist/entries/carousel.js +7 -0
  206. package/dist/entries/checkbox.d.ts +3 -0
  207. package/dist/entries/checkbox.js +15 -0
  208. package/dist/entries/collapsible.d.ts +3 -0
  209. package/dist/entries/collapsible.js +7 -0
  210. package/dist/entries/color-picker.d.ts +3 -0
  211. package/dist/entries/color-picker.js +7 -0
  212. package/dist/entries/combobox.d.ts +3 -0
  213. package/dist/entries/combobox.js +7 -0
  214. package/dist/entries/command.d.ts +3 -0
  215. package/dist/entries/command.js +7 -0
  216. package/dist/entries/date-input.d.ts +3 -0
  217. package/dist/entries/date-input.js +7 -0
  218. package/dist/entries/date-picker.d.ts +3 -0
  219. package/dist/entries/date-picker.js +7 -0
  220. package/dist/entries/dialog.d.ts +3 -0
  221. package/dist/entries/dialog.js +7 -0
  222. package/dist/entries/drawer.d.ts +3 -0
  223. package/dist/entries/drawer.js +8 -0
  224. package/dist/entries/field.d.ts +2 -0
  225. package/dist/entries/field.js +3 -0
  226. package/dist/entries/file-input.d.ts +3 -0
  227. package/dist/entries/file-input.js +13 -0
  228. package/dist/entries/hover-card.d.ts +3 -0
  229. package/dist/entries/hover-card.js +7 -0
  230. package/dist/entries/image-cropper.d.ts +3 -0
  231. package/dist/entries/image-cropper.js +7 -0
  232. package/dist/entries/input.d.ts +3 -0
  233. package/dist/entries/input.js +8 -0
  234. package/dist/entries/label.d.ts +2 -0
  235. package/dist/entries/label.js +3 -0
  236. package/dist/entries/listbox.d.ts +3 -0
  237. package/dist/entries/listbox.js +7 -0
  238. package/dist/entries/menu.d.ts +3 -0
  239. package/dist/entries/menu.js +7 -0
  240. package/dist/entries/menubar.d.ts +3 -0
  241. package/dist/entries/menubar.js +7 -0
  242. package/dist/entries/meter.d.ts +2 -0
  243. package/dist/entries/meter.js +3 -0
  244. package/dist/entries/navigation-menu.d.ts +3 -0
  245. package/dist/entries/navigation-menu.js +7 -0
  246. package/dist/entries/number-input.d.ts +3 -0
  247. package/dist/entries/number-input.js +7 -0
  248. package/dist/entries/otp-input.d.ts +3 -0
  249. package/dist/entries/otp-input.js +7 -0
  250. package/dist/entries/overlays.d.ts +2 -0
  251. package/dist/entries/overlays.js +3 -0
  252. package/dist/entries/pagination.d.ts +3 -0
  253. package/dist/entries/pagination.js +11 -0
  254. package/dist/entries/password-input.d.ts +3 -0
  255. package/dist/entries/password-input.js +7 -0
  256. package/dist/entries/popover.d.ts +3 -0
  257. package/dist/entries/popover.js +7 -0
  258. package/dist/entries/preferences.d.ts +3 -0
  259. package/dist/entries/preferences.js +13 -0
  260. package/dist/entries/progress.d.ts +2 -0
  261. package/dist/entries/progress.js +3 -0
  262. package/dist/entries/radio.d.ts +3 -0
  263. package/dist/entries/radio.js +7 -0
  264. package/dist/entries/rating.d.ts +3 -0
  265. package/dist/entries/rating.js +8 -0
  266. package/dist/entries/resizable.d.ts +3 -0
  267. package/dist/entries/resizable.js +11 -0
  268. package/dist/entries/scroll-area.d.ts +3 -0
  269. package/dist/entries/scroll-area.js +7 -0
  270. package/dist/entries/segmented-control.d.ts +3 -0
  271. package/dist/entries/segmented-control.js +7 -0
  272. package/dist/entries/select.d.ts +3 -0
  273. package/dist/entries/select.js +7 -0
  274. package/dist/entries/separator.d.ts +2 -0
  275. package/dist/entries/separator.js +3 -0
  276. package/dist/entries/slider.d.ts +3 -0
  277. package/dist/entries/slider.js +7 -0
  278. package/dist/entries/switch.d.ts +3 -0
  279. package/dist/entries/switch.js +7 -0
  280. package/dist/entries/tabs.d.ts +3 -0
  281. package/dist/entries/tabs.js +7 -0
  282. package/dist/entries/textarea.d.ts +3 -0
  283. package/dist/entries/textarea.js +7 -0
  284. package/dist/entries/time-input.d.ts +3 -0
  285. package/dist/entries/time-input.js +7 -0
  286. package/dist/entries/timeline.d.ts +3 -0
  287. package/dist/entries/timeline.js +7 -0
  288. package/dist/entries/toast.d.ts +2 -0
  289. package/dist/entries/toast.js +3 -0
  290. package/dist/entries/toggle.d.ts +3 -0
  291. package/dist/entries/toggle.js +12 -0
  292. package/dist/entries/token-input.d.ts +3 -0
  293. package/dist/entries/token-input.js +17 -0
  294. package/dist/entries/toolbar.d.ts +3 -0
  295. package/dist/entries/toolbar.js +7 -0
  296. package/dist/entries/tooltip.d.ts +3 -0
  297. package/dist/entries/tooltip.js +7 -0
  298. package/dist/entries/tree.d.ts +3 -0
  299. package/dist/entries/tree.js +17 -0
  300. package/dist/entries/trigger-menu.d.ts +3 -0
  301. package/dist/entries/trigger-menu.js +11 -0
  302. package/dist/entries/waterfall.d.ts +3 -0
  303. package/dist/entries/waterfall.js +11 -0
  304. package/dist/events.d.ts +1658 -0
  305. package/dist/events.js +0 -0
  306. package/dist/field.d.ts +2 -0
  307. package/dist/field.js +101 -0
  308. package/dist/file-input.d.ts +2 -0
  309. package/dist/file-input.js +140 -0
  310. package/dist/forward-attributes.d.ts +2 -0
  311. package/dist/forward-attributes.js +22 -0
  312. package/dist/history.d.ts +2 -0
  313. package/dist/history.js +11 -0
  314. package/dist/hover-card.d.ts +2 -0
  315. package/dist/hover-card.js +31 -0
  316. package/dist/image-cropper.d.ts +2 -0
  317. package/dist/image-cropper.js +66 -0
  318. package/dist/index.d.ts +66 -0
  319. package/dist/index.js +269 -0
  320. package/dist/input.d.ts +3 -0
  321. package/dist/input.js +69 -0
  322. package/dist/label.d.ts +2 -0
  323. package/dist/label.js +11 -0
  324. package/dist/list.d.ts +40 -0
  325. package/dist/list.js +192 -0
  326. package/dist/listbox.d.ts +2 -0
  327. package/dist/listbox.js +84 -0
  328. package/dist/menu.d.ts +4 -0
  329. package/dist/menu.js +295 -0
  330. package/dist/menubar.d.ts +4 -0
  331. package/dist/menubar.js +30 -0
  332. package/dist/meter.d.ts +2 -0
  333. package/dist/meter.js +22 -0
  334. package/dist/navigation-menu.d.ts +2 -0
  335. package/dist/navigation-menu.js +114 -0
  336. package/dist/number-input.d.ts +2 -0
  337. package/dist/number-input.js +73 -0
  338. package/dist/observe.d.ts +2 -0
  339. package/dist/observe.js +7 -0
  340. package/dist/otp-input.d.ts +2 -0
  341. package/dist/otp-input.js +72 -0
  342. package/dist/overlays.d.ts +13 -0
  343. package/dist/overlays.js +156 -0
  344. package/dist/pagination.d.ts +2 -0
  345. package/dist/pagination.js +127 -0
  346. package/dist/password-input.d.ts +2 -0
  347. package/dist/password-input.js +57 -0
  348. package/dist/popover.d.ts +2 -0
  349. package/dist/popover.js +64 -0
  350. package/dist/popup.d.ts +40 -0
  351. package/dist/popup.js +112 -0
  352. package/dist/preferences.d.ts +2 -0
  353. package/dist/preferences.js +56 -0
  354. package/dist/progress.d.ts +2 -0
  355. package/dist/progress.js +22 -0
  356. package/dist/radio.d.ts +2 -0
  357. package/dist/radio.js +33 -0
  358. package/dist/rating.d.ts +2 -0
  359. package/dist/rating.js +64 -0
  360. package/dist/resizable.d.ts +2 -0
  361. package/dist/resizable.js +42 -0
  362. package/dist/scroll-area.d.ts +2 -0
  363. package/dist/scroll-area.js +45 -0
  364. package/dist/segmented-control.d.ts +2 -0
  365. package/dist/segmented-control.js +28 -0
  366. package/dist/select.d.ts +2 -0
  367. package/dist/select.js +239 -0
  368. package/dist/separator.d.ts +2 -0
  369. package/dist/separator.js +11 -0
  370. package/dist/slider.d.ts +2 -0
  371. package/dist/slider.js +77 -0
  372. package/dist/tabs.d.ts +2 -0
  373. package/dist/tabs.js +37 -0
  374. package/dist/timeline.d.ts +2 -0
  375. package/dist/timeline.js +27 -0
  376. package/dist/toast.d.ts +20 -0
  377. package/dist/toast.js +177 -0
  378. package/dist/toggle.d.ts +3 -0
  379. package/dist/toggle.js +64 -0
  380. package/dist/token-input.d.ts +2 -0
  381. package/dist/token-input.js +103 -0
  382. package/dist/toolbar.d.ts +2 -0
  383. package/dist/toolbar.js +36 -0
  384. package/dist/tooltip.d.ts +2 -0
  385. package/dist/tooltip.js +35 -0
  386. package/dist/tree.d.ts +2 -0
  387. package/dist/tree.js +147 -0
  388. package/dist/trigger-menu.d.ts +2 -0
  389. package/dist/trigger-menu.js +133 -0
  390. package/dist/waterfall.d.ts +2 -0
  391. package/dist/waterfall.js +140 -0
  392. package/docs/README.md +89 -0
  393. package/docs/agents.md +1523 -0
  394. package/docs/components/accordion.md +1401 -0
  395. package/docs/components/alert-dialog.md +788 -0
  396. package/docs/components/autocomplete.md +1692 -0
  397. package/docs/components/avatar.md +261 -0
  398. package/docs/components/button.md +441 -0
  399. package/docs/components/calendar.md +1536 -0
  400. package/docs/components/carousel.md +1055 -0
  401. package/docs/components/checkbox.md +1045 -0
  402. package/docs/components/collapsible.md +535 -0
  403. package/docs/components/color-picker.md +651 -0
  404. package/docs/components/combobox.md +3274 -0
  405. package/docs/components/command.md +1431 -0
  406. package/docs/components/date-input.md +563 -0
  407. package/docs/components/date-picker.md +1136 -0
  408. package/docs/components/dialog.md +1360 -0
  409. package/docs/components/drawer.md +1201 -0
  410. package/docs/components/field.md +519 -0
  411. package/docs/components/file-input.md +617 -0
  412. package/docs/components/hover-card.md +486 -0
  413. package/docs/components/image-cropper.md +489 -0
  414. package/docs/components/input.md +327 -0
  415. package/docs/components/label.md +208 -0
  416. package/docs/components/listbox.md +1015 -0
  417. package/docs/components/menu.md +1212 -0
  418. package/docs/components/menubar.md +460 -0
  419. package/docs/components/meter.md +298 -0
  420. package/docs/components/navigation-menu.md +1573 -0
  421. package/docs/components/number-input.md +1087 -0
  422. package/docs/components/otp-input.md +558 -0
  423. package/docs/components/pagination.md +639 -0
  424. package/docs/components/password-input.md +649 -0
  425. package/docs/components/popover.md +1433 -0
  426. package/docs/components/preferences.md +243 -0
  427. package/docs/components/progress.md +406 -0
  428. package/docs/components/radio.md +855 -0
  429. package/docs/components/rating.md +431 -0
  430. package/docs/components/resizable.md +866 -0
  431. package/docs/components/scroll-area.md +898 -0
  432. package/docs/components/segmented-control.md +421 -0
  433. package/docs/components/select.md +1957 -0
  434. package/docs/components/separator.md +238 -0
  435. package/docs/components/slider.md +1018 -0
  436. package/docs/components/switch.md +583 -0
  437. package/docs/components/tabs.md +948 -0
  438. package/docs/components/textarea.md +331 -0
  439. package/docs/components/time-input.md +235 -0
  440. package/docs/components/timeline.md +622 -0
  441. package/docs/components/toast.md +1223 -0
  442. package/docs/components/toggle.md +522 -0
  443. package/docs/components/token-input.md +854 -0
  444. package/docs/components/toolbar.md +815 -0
  445. package/docs/components/tooltip.md +860 -0
  446. package/docs/components/tree.md +1243 -0
  447. package/docs/components/trigger-menu.md +1110 -0
  448. package/docs/components/waterfall.md +709 -0
  449. package/docs/controllers.md +66 -0
  450. package/docs/core.md +8027 -0
  451. package/docs/custom-parts.md +91 -0
  452. package/docs/first-component.md +88 -0
  453. package/docs/forms.md +125 -0
  454. package/docs/installation.md +141 -0
  455. package/docs/introduction.md +32 -0
  456. package/docs/lists-and-menus.md +166 -0
  457. package/docs/llms.txt +1566 -0
  458. package/docs/parts-and-composition.md +57 -0
  459. package/docs/popups.md +92 -0
  460. package/docs/rendering.md +71 -0
  461. package/docs/server-rendering.md +118 -0
  462. package/docs/state-and-events.md +134 -0
  463. package/docs/styling-and-animation.md +104 -0
  464. package/docs/utilities/async-options.md +332 -0
  465. package/docs/utilities/shortcuts.md +184 -0
  466. package/html-custom-data.json +14792 -0
  467. package/package.json +302 -3
@@ -0,0 +1,651 @@
1
+ # Color Picker
2
+
3
+ Choose a color by dragging across an area and along sliders, typing any CSS color, or picking a preset.
4
+
5
+ Use a color picker to choose a color, like a brand or theme color. The value is a CSS color string, and every part edits it: an area for two channels at once, a slider per channel, a text input that reads any CSS color, and presets.
6
+
7
+ <ComponentExample
8
+ name="color-picker/basic"
9
+ inspect
10
+ caption="Drag across the area or along the sliders, or choose a preset. Choose HSL to write the color another way, or type one like rebeccapurple and press Enter."
11
+ />
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install @ui-sdk/web @ui-sdk/core
17
+ ```
18
+
19
+ Import the component to register its elements. The import is safe on the server.
20
+
21
+ ```ts
22
+ import "@ui-sdk/web/color-picker"
23
+ ```
24
+
25
+ ## Composition
26
+
27
+ Use the following composition to build a `ui-color-picker`:
28
+
29
+ ```text
30
+ ui-color-picker
31
+ ├── ui-color-picker-area
32
+ │ ├── ui-color-picker-area-canvas
33
+ │ └── ui-color-picker-area-thumb
34
+ ├── ui-color-picker-slider
35
+ │ └── ui-color-picker-slider-thumb
36
+ ├── ui-color-picker-slider
37
+ │ └── ui-color-picker-slider-thumb
38
+ ├── ui-color-picker-swatch
39
+ ├── ui-color-picker-input
40
+ ├── ui-color-picker-channel-input
41
+ ├── ui-color-picker-eye-dropper
42
+ └── ui-color-picker-swatches
43
+ ├── ui-color-picker-swatch-item
44
+ └── ui-color-picker-swatch-item
45
+ ```
46
+
47
+ Every part is optional, so use the ones your picker needs.
48
+
49
+ - **ui-color-picker** holds the value and is a group around the parts.
50
+ - **ui-color-picker-area** edits two channels, like saturation across and brightness up. A press moves the thumb there and starts a drag. Its background is `--color-area-background`, so give it a size and that background.
51
+ - **ui-color-picker-area-canvas** paints the area pixel by pixel, for channels no gradient can draw, like OKLCH's chroma and lightness.
52
+ - **ui-color-picker-area-thumb** shows where the color sits in the area. It's a slider that screen readers hear as both channels.
53
+ - **ui-color-picker-slider** edits one `channel`, like `hue` or `alpha`, drawn by `--color-slider-background`.
54
+ - **ui-color-picker-slider-thumb** shows where the channel sits along its slider.
55
+ - **ui-color-picker-swatch** shows the color, named for screen readers, like "vivid blue".
56
+ - **ui-color-picker-input** wraps an `<input>`, which reads any CSS color when you press Enter or leave it. Text that isn't a color goes back to the value.
57
+ - **ui-color-picker-channel-input** edits one `channel` as a number, in the units people read it in, like 0 to 255 for red.
58
+ - **ui-color-picker-eye-dropper** picks a color from anywhere on the screen, where the browser can.
59
+ - **ui-color-picker-swatches** and **ui-color-picker-swatch-item** are a list of preset colors.
60
+
61
+ Each part writes the color as `--color-picker-color`, so a thumb or a swatch fills itself with `background: var(--color-picker-color)`. The picker is form-associated, so it submits its value like a native input. The inputs, the canvas, the eye dropper and preset items use the `<input>`, `<canvas>` or `<button>` you put inside them, or make one.
62
+
63
+ ## Usage
64
+
65
+ Import the parts and put them together:
66
+
67
+ ```html
68
+ <script type="module">
69
+ import "@ui-sdk/web/color-picker"
70
+ </script>
71
+
72
+ <ui-color-picker aria-label="Brand color" default-value="#0ea5e9">
73
+ <ui-color-picker-area>
74
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
75
+ </ui-color-picker-area>
76
+ <ui-color-picker-slider channel="hue">
77
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
78
+ </ui-color-picker-slider>
79
+ <ui-color-picker-input>
80
+ <input aria-label="Hex" />
81
+ </ui-color-picker-input>
82
+ </ui-color-picker>
83
+ ```
84
+
85
+ Name the picker with `aria-label`, or put it in a [Field](./field.md) whose label names it. Without `default-value`, it starts at black.
86
+
87
+ ## Spaces and Channels
88
+
89
+ `space` decides which channels the parts edit, and what the value is written in:
90
+
91
+ | `space` | Area, across and up | Slider | Value written as |
92
+ | ------- | ---------------------- | ------ | ----------------------------- |
93
+ | `hsv` | saturation, brightness | hue | hex, like `#0ea5e9` |
94
+ | `hsl` | saturation, lightness | hue | `hsl(198.63 88.66% 48.43%)` |
95
+ | `srgb` | red, green | blue | `rgb(14 165 233)` |
96
+ | `oklch` | chroma, lightness | hue | `oklch(0.6847 0.1479 237.32)` |
97
+
98
+ Set `format` to write the value another way, like `format="hex"` in any space. Every space has an `alpha` channel too. Set `x` and `y` on the area, or `channel` on a slider, to edit other channels:
99
+
100
+ ```html
101
+ <ui-color-picker
102
+ aria-label="Background"
103
+ space="hsl"
104
+ default-value="hsl(220 60% 50%)"
105
+ >
106
+ <ui-color-picker-area x="hue" y="lightness">
107
+ <ui-color-picker-area-canvas></ui-color-picker-area-canvas>
108
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
109
+ </ui-color-picker-area>
110
+ <ui-color-picker-slider channel="saturation" orientation="vertical">
111
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
112
+ </ui-color-picker-slider>
113
+ </ui-color-picker>
114
+ ```
115
+
116
+ The parts keep a hue while the color turns gray or black, so dragging back out of a corner returns to the same hue.
117
+
118
+ ## OKLCH
119
+
120
+ OKLCH spaces its colors evenly for the eye, so two colors with the same lightness look equally bright. Its edge with the colors a screen can show is a curve, which no gradient can draw. Add `ui-color-picker-area-canvas` to the area, and it paints the colors inside that edge and leaves the rest clear.
121
+
122
+ ```ts title="oklch.ts"
123
+ import "@ui-sdk/web/color-picker"
124
+
125
+ function mount(root: HTMLElement) {
126
+ root.innerHTML = `
127
+ <ui-color-picker aria-label="Accent" space="oklch" default-value="oklch(0.62 0.19 259)">
128
+ <ui-color-picker-area>
129
+ <ui-color-picker-area-canvas></ui-color-picker-area-canvas>
130
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
131
+ </ui-color-picker-area>
132
+ <ui-color-picker-slider channel="hue">
133
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
134
+ </ui-color-picker-slider>
135
+ <ui-color-picker-slider channel="alpha">
136
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
137
+ </ui-color-picker-slider>
138
+ <div data-slot="row">
139
+ <ui-color-picker-swatch></ui-color-picker-swatch>
140
+ <ui-color-picker-input>
141
+ <input aria-label="OKLCH" />
142
+ </ui-color-picker-input>
143
+ </div>
144
+ </ui-color-picker>
145
+ `
146
+ }
147
+
148
+ export { mount }
149
+ ```
150
+
151
+ Drag the thumb right, past the painted edge, and let go. The thumb moves back to the closest color inside.
152
+
153
+ While a drag holds a color past the edge, the value is already the closest color inside it, and every part has `data-out-of-gamut`. Once the drag ends, the thumb moves to that color. Colors stay inside sRGB by default. Set `gamut="p3"` for wide-gamut screens, or `gamut="false"` to allow any color:
154
+
155
+ ```html
156
+ <ui-color-picker
157
+ aria-label="Accent"
158
+ space="oklch"
159
+ gamut="p3"
160
+ default-value="oklch(0.7 0.25 150)"
161
+ >
162
+ <!-- … -->
163
+ </ui-color-picker>
164
+ ```
165
+
166
+ ## Presets and Channel Inputs
167
+
168
+ Put `ui-color-picker-swatch-item`s inside `ui-color-picker-swatches` for preset colors. Each one is selected while the value is its color, however either is written, so `#0000ff` selects `rgb(0 0 255)`. The list is one tab stop, and the arrow keys move between the presets.
169
+
170
+ `ui-color-picker-channel-input` edits one channel as a number and sets it on Enter, when you leave it, or with its arrows. `ui-color-picker-eye-dropper` picks from the screen in browsers that can. Elsewhere it's disabled, with `data-unsupported`, so you can hide it.
171
+
172
+ ```ts title="swatches.ts"
173
+ import "@ui-sdk/web/color-picker"
174
+ import { createElement, Pipette } from "lucide"
175
+
176
+ const presets = [
177
+ "#ef4444",
178
+ "#f97316",
179
+ "#eab308",
180
+ "#22c55e",
181
+ "#0ea5e9",
182
+ "#6366f1",
183
+ "#a855f7",
184
+ "#ec4899",
185
+ ]
186
+
187
+ function mount(root: HTMLElement) {
188
+ root.innerHTML = `
189
+ <ui-color-picker aria-label="Label color" space="srgb" format="hex" default-value="#0ea5e9">
190
+ <ui-color-picker-swatches aria-label="Presets">
191
+ ${presets.map((preset) => `<ui-color-picker-swatch-item value="${preset}"></ui-color-picker-swatch-item>`).join("")}
192
+ </ui-color-picker-swatches>
193
+ <div data-slot="row">
194
+ <ui-color-picker-channel-input channel="red"></ui-color-picker-channel-input>
195
+ <ui-color-picker-channel-input channel="green"></ui-color-picker-channel-input>
196
+ <ui-color-picker-channel-input channel="blue"></ui-color-picker-channel-input>
197
+ <ui-color-picker-eye-dropper>
198
+ <button aria-label="Pick from screen">${createElement(Pipette, { "aria-hidden": "true" }).outerHTML}</button>
199
+ </ui-color-picker-eye-dropper>
200
+ </div>
201
+ </ui-color-picker>
202
+ `
203
+ }
204
+
205
+ export { mount }
206
+ ```
207
+
208
+ Choose a preset, or use the arrow keys between them. Type 255 into the first number to set red.
209
+
210
+ ## Popover
211
+
212
+ Put a `ui-popover` inside the picker to open it from a swatch. The parts inside the popup edit the same color, and the swatch in the trigger shows it.
213
+
214
+ ```ts title="popover.ts"
215
+ import "@ui-sdk/web/color-picker"
216
+ import "@ui-sdk/web/popover"
217
+
218
+ function mount(root: HTMLElement) {
219
+ root.innerHTML = `
220
+ <ui-color-picker aria-label="Background" default-value="#22c55e">
221
+ <ui-popover>
222
+ <ui-popover-trigger>
223
+ <button aria-label="Background">
224
+ <ui-color-picker-swatch></ui-color-picker-swatch>
225
+ </button>
226
+ </ui-popover-trigger>
227
+ <ui-popover-content>
228
+ <ui-color-picker-area>
229
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
230
+ </ui-color-picker-area>
231
+ <ui-color-picker-slider channel="hue">
232
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
233
+ </ui-color-picker-slider>
234
+ <ui-color-picker-input>
235
+ <input aria-label="Hex" />
236
+ </ui-color-picker-input>
237
+ </ui-popover-content>
238
+ </ui-popover>
239
+ </ui-color-picker>
240
+ `
241
+ }
242
+
243
+ export { mount }
244
+ ```
245
+
246
+ Press the Background swatch to open the picker, then drag to change the color.
247
+
248
+ ## Disabled
249
+
250
+ Set `disabled`. A disabled picker can't be focused or changed, and isn't submitted. A disabled `<fieldset>` around it disables it too.
251
+
252
+ ```ts title="disabled.ts"
253
+ import "@ui-sdk/web/color-picker"
254
+
255
+ function mount(root: HTMLElement) {
256
+ root.innerHTML = `
257
+ <ui-color-picker aria-label="Brand color" default-value="#0ea5e9" disabled>
258
+ <ui-color-picker-area>
259
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
260
+ </ui-color-picker-area>
261
+ <ui-color-picker-slider channel="hue">
262
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
263
+ </ui-color-picker-slider>
264
+ <ui-color-picker-input>
265
+ <input aria-label="Hex" />
266
+ </ui-color-picker-input>
267
+ </ui-color-picker>
268
+ `
269
+ }
270
+
271
+ export { mount }
272
+ ```
273
+
274
+ The thumbs can't be focused or dragged.
275
+
276
+ Set `read-only` to keep the parts focusable and the value submitted, while drags, keys and typing leave the color alone:
277
+
278
+ ```html
279
+ <ui-color-picker aria-label="Theme color" default-value="#0ea5e9" read-only>
280
+ <ui-color-picker-swatch></ui-color-picker-swatch>
281
+ <ui-color-picker-input>
282
+ <input aria-label="Hex" />
283
+ </ui-color-picker-input>
284
+ </ui-color-picker>
285
+ ```
286
+
287
+ ## Controlled
288
+
289
+ Listen to `valuechange` for each change. Each change carries a [reason](#reasons), like `drag`, `step-key` or `input-commit`, and `event.detail.color`, the color the parts hold, which keeps a hue while the value turns gray. Call `event.preventDefault()` to keep the current value.
290
+
291
+ `valuechange` fires on every step of a drag. `valuecommit` fires once, when the drag, key press or typed color ends, so listen to it to save. The element's `api` property sets the color from anywhere with `setValue()`, like the Use Purple button below.
292
+
293
+ ```ts title="controlled.ts"
294
+ import "@ui-sdk/web/color-picker"
295
+ import { log } from "./log"
296
+
297
+ function mount(root: HTMLElement) {
298
+ root.innerHTML = `
299
+ <div>
300
+ <div data-slot="controls">
301
+ <button type="button">Use Purple</button>
302
+ </div>
303
+ <ui-color-picker aria-label="Theme color" default-value="#0ea5e9">
304
+ <ui-color-picker-area>
305
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
306
+ </ui-color-picker-area>
307
+ <ui-color-picker-slider channel="hue">
308
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
309
+ </ui-color-picker-slider>
310
+ <ui-color-picker-input>
311
+ <input aria-label="Hex" />
312
+ </ui-color-picker-input>
313
+ </ui-color-picker>
314
+ </div>
315
+ `
316
+ const picker = root.querySelector("ui-color-picker")!
317
+ picker.addEventListener("valuecommit", (event) => {
318
+ const { value, reason } = event.detail
319
+ log(root, `committed: ${value} (${reason})`)
320
+ })
321
+ root
322
+ .querySelector('[data-slot="controls"] button')!
323
+ .addEventListener("click", () => picker.api.setValue("#663399"))
324
+ }
325
+
326
+ export { mount }
327
+ ```
328
+
329
+ Drag across the area and let go, or press Use Purple. The console logs each committed color and its reason.
330
+
331
+ See [State and Events](../state-and-events.md) for controlled state, cancellation and debugging.
332
+
333
+ ## Form
334
+
335
+ The picker submits the value under `name`, like `#f97316`, and a disabled picker submits nothing. A form reset returns it to `default-value`. Set `form` to join a form by its id.
336
+
337
+ ```ts title="form.ts"
338
+ import "@ui-sdk/web/color-picker"
339
+ import "@ui-sdk/web/field"
340
+ import { log } from "./log"
341
+
342
+ function mount(root: HTMLElement) {
343
+ root.innerHTML = `
344
+ <form data-slot="stack">
345
+ <ui-field>
346
+ <ui-field-label>Brand color</ui-field-label>
347
+ <ui-color-picker name="brand" default-value="#f97316">
348
+ <ui-color-picker-area>
349
+ <ui-color-picker-area-thumb></ui-color-picker-area-thumb>
350
+ </ui-color-picker-area>
351
+ <div data-slot="row">
352
+ <ui-color-picker-swatch></ui-color-picker-swatch>
353
+ <ui-color-picker-slider channel="hue">
354
+ <ui-color-picker-slider-thumb></ui-color-picker-slider-thumb>
355
+ </ui-color-picker-slider>
356
+ </div>
357
+ </ui-color-picker>
358
+ </ui-field>
359
+ <div data-slot="row">
360
+ <button type="submit" data-variant="solid">Save</button>
361
+ <button type="reset">Reset</button>
362
+ </div>
363
+ </form>
364
+ `
365
+ const form = root.querySelector("form")!
366
+ form.addEventListener("submit", (event) => {
367
+ event.preventDefault()
368
+ log(root, `Submitted brand=${new FormData(form).get("brand")}`)
369
+ })
370
+ }
371
+
372
+ export { mount }
373
+ ```
374
+
375
+ Change the color and press Save to log the submitted value. Reset restores the orange.
376
+
377
+ A color picker always has a value, so `required` only adds `data-required`.
378
+
379
+ ## Styling
380
+
381
+ Parts are unstyled, apart from the positions they need: thumbs get `position: absolute` and their place in percent, as inline styles. Give the area and sliders a size and their background variable, and center each thumb on its point with `translate: -50% -50%`.
382
+
383
+ Each part has a `data-slot`, such as `color-picker-area`, and its state attributes are listed under [Data Attributes](#data-attributes).
384
+
385
+ ### ui-color-picker
386
+ - `--color-picker-color`: The color as CSS, inside the gamut. On a swatch item, its own color. Use it to fill a thumb or a swatch.
387
+
388
+ ### ui-color-picker-area
389
+ - `--color-area-background`: Gradients that draw the area, when its channels are saturation and brightness or lightness. Unset for others, which a canvas paints.
390
+
391
+ ### ui-color-picker-area-thumb
392
+ - `--area-x`: Where the thumb is across the area, from 0 to 1.
393
+ - `--area-y`: Where the thumb is up the area, from 0 at the bottom to 1 at the top.
394
+
395
+ ### ui-color-picker-slider
396
+ - `--color-slider-background`: A gradient through the slider's channel, with the other channels as they are.
397
+
398
+ ### ui-color-picker-slider-thumb
399
+ - `--color-slider-thumb-position`: Where the thumb is along the slider, as a percentage.
400
+
401
+ ### ui-color-picker-swatch
402
+ - `--color-picker-color`: The color as CSS, inside the gamut. On a swatch item, its own color. Use it to fill a thumb or a swatch.
403
+
404
+ ### ui-color-picker-swatch-item
405
+ - `--color-picker-color`: The color as CSS, inside the gamut. On a swatch item, its own color. Use it to fill a thumb or a swatch.
406
+
407
+ ## Data Attributes
408
+
409
+ ### ui-color-picker
410
+ `[data-slot="color-picker"]`
411
+
412
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
413
+ - `data-readonly`: Present when the picker shows its color but can't change it.
414
+ - `data-required`: Present when the picker is required.
415
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
416
+
417
+ ### ui-color-picker-area
418
+ `[data-slot="color-picker-area"]`
419
+
420
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
421
+ - `data-readonly`: Present when the picker shows its color but can't change it.
422
+ - `data-required`: Present when the picker is required.
423
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
424
+
425
+ ### ui-color-picker-area-thumb
426
+ `[data-slot="color-picker-area-thumb"]`
427
+
428
+ - `data-area-thumb`: Present on the area's thumb, which a press on the area moves and focuses.
429
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
430
+ - `data-readonly`: Present when the picker shows its color but can't change it.
431
+ - `data-required`: Present when the picker is required.
432
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
433
+
434
+ ### ui-color-picker-slider
435
+ `[data-slot="color-picker-slider"]`
436
+
437
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
438
+ - `data-readonly`: Present when the picker shows its color but can't change it.
439
+ - `data-required`: Present when the picker is required.
440
+ - `data-orientation` (`horizontal`, `vertical`): The slider's axis.
441
+ - `data-channel` (`hue`, `saturation`, `brightness`, `lightness`, `chroma`, `red`, `green`, `blue`, `alpha`): The channel the part edits.
442
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
443
+
444
+ ### ui-color-picker-slider-thumb
445
+ `[data-slot="color-picker-slider-thumb"]`
446
+
447
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
448
+ - `data-readonly`: Present when the picker shows its color but can't change it.
449
+ - `data-required`: Present when the picker is required.
450
+ - `data-orientation` (`horizontal`, `vertical`): The slider's axis.
451
+ - `data-channel` (`hue`, `saturation`, `brightness`, `lightness`, `chroma`, `red`, `green`, `blue`, `alpha`): The channel the part edits.
452
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
453
+
454
+ ### ui-color-picker-input
455
+ `[data-slot="color-picker-input"]`
456
+
457
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
458
+ - `data-readonly`: Present when the picker shows its color but can't change it.
459
+ - `data-required`: Present when the picker is required.
460
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
461
+
462
+ ### ui-color-picker-channel-input
463
+ `[data-slot="color-picker-channel-input"]`
464
+
465
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
466
+ - `data-readonly`: Present when the picker shows its color but can't change it.
467
+ - `data-required`: Present when the picker is required.
468
+ - `data-channel` (`hue`, `saturation`, `brightness`, `lightness`, `chroma`, `red`, `green`, `blue`, `alpha`): The channel the part edits.
469
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
470
+
471
+ ### ui-color-picker-swatch
472
+ `[data-slot="color-picker-swatch"]`
473
+
474
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
475
+ - `data-readonly`: Present when the picker shows its color but can't change it.
476
+ - `data-required`: Present when the picker is required.
477
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
478
+
479
+ ### ui-color-picker-eye-dropper
480
+ `[data-slot="color-picker-eye-dropper"]`
481
+
482
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
483
+ - `data-readonly`: Present when the picker shows its color but can't change it.
484
+ - `data-required`: Present when the picker is required.
485
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
486
+ - `data-unsupported`: Present when the browser can't pick a color from the screen.
487
+
488
+ ### ui-color-picker-swatches
489
+ `[data-slot="color-picker-swatches"]`
490
+
491
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
492
+ - `data-readonly`: Present when the picker shows its color but can't change it.
493
+ - `data-required`: Present when the picker is required.
494
+ - `data-out-of-gamut`: Present while a drag or a key holds a color outside the gamut. The value is the closest color inside, and the parts move there once the change commits.
495
+
496
+ ### ui-color-picker-swatch-item
497
+ `[data-slot="color-picker-swatch-item"]`
498
+
499
+ - `data-selected`: Present on the swatch item whose color is the value.
500
+ - `data-disabled`: Present when the picker is disabled, by its own prop or a `<fieldset>`.
501
+ - `data-readonly`: Present when the picker shows its color but can't change it.
502
+
503
+ ## API Reference
504
+
505
+ Props are attributes in kebab case, like `default-value` and `read-only`. `controller` is a property. `value` is a live property and attribute. Callbacks are DOM events.
506
+
507
+ ### ui-color-picker
508
+
509
+ - `value?` (`string`): The value, as a CSS color, like `"#0ea5e9"` or `"oklch(0.62 0.19 259)"`. Pass it to control the picker.
510
+ - `defaultValue?` (`string`): The value at first, when uncontrolled. A form reset returns to it.
511
+ - `valuechange event`: Runs while the value changes: on every step of a drag or a key. `details.color` is the color, and `details.cancel()` stops it.
512
+ - `valuecommit event`: Runs once an interaction that changed the value ends: the pointer lifts, a key is pressed, a swatch is picked. For saving.
513
+ - `space?` (`ColorPickerSpace`): The space the parts edit in, which decides their channels: `"hsv"` has hue, saturation and brightness, `"hsl"` hue, saturation and lightness, `"srgb"` red, green and blue, `"oklch"` lightness, chroma and hue.
514
+ - `format?` (`ColorFormat`): How the value is written: `"hex"`, or a space in its CSS syntax, like `"oklch"`.
515
+ - `gamut?` (`false | ColorGamut`): The colors the value can hold. A drag can go past the edge, and the value is the closest color inside it; once the drag ends, the picker moves there too. `"p3"` allows wide-gamut screens' colors, and `false` any color.
516
+ - `disabled?` (`boolean`): Disables every part: they can't be focused or changed, and the value isn't submitted.
517
+ - `readOnly?` (`boolean`): Keeps the parts focusable and the value submitted, but stops changes.
518
+ - `required?` (`boolean`): Marks it required, with `data-required`. A color picker always has a value, so it never blocks a form.
519
+ - `name?` (`string`): The name the value submits under. Without one, the picker submits nothing.
520
+ - `form?` (`string`): The id of a form to belong to, when it isn't inside that form.
521
+ - `controller?` (`{ getValue: () => string; setValue: (value: string, options?: ColorPickerChangeOptions) => boolean; focus: () => void; }`): Sets the value from anywhere. Create one with `createColorPickerController()`.
522
+ - `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.
523
+
524
+ ### ui-color-picker-area
525
+
526
+ - `x?` (`ColorChannel`): The channel across, left to right.
527
+ - `y?` (`ColorChannel`): The channel up, bottom to top.
528
+
529
+ ### ui-color-picker-slider
530
+
531
+ - `channel?` (`ColorChannel`): The channel the slider edits, like `"hue"` or `"alpha"`.
532
+ - `orientation?` (`"horizontal" | "vertical"`): The slider's axis. Vertical sliders grow upward.
533
+
534
+ ### ui-color-picker-channel-input
535
+
536
+ - `channel?` (`ColorChannel`): The channel the input edits, like `"hue"` or `"alpha"`.
537
+
538
+ ### ui-color-picker-swatch-item
539
+
540
+ - `value` (`string`): The color it picks, as any CSS color.
541
+
542
+ ### State
543
+
544
+ The same state shows as data attributes on each element.
545
+
546
+ - `value` (`string`): The value, as a CSS color.
547
+ - `color` (`Color`): The color the parts show, in the picker's space. During a drag it can be outside the gamut.
548
+ - `space` (`ColorPickerSpace`): The space the parts edit in.
549
+ - `disabled` (`boolean`): Whether it's disabled, by itself or by a `<fieldset>`.
550
+ - `readOnly` (`boolean`): Whether it's read-only: the parts stay focusable, but nothing changes the value.
551
+ - `required` (`boolean`): Whether it's marked required.
552
+ - `outOfGamut` (`boolean`): Whether the color the parts show is outside the gamut, so the value is the closest one inside.
553
+
554
+ - `value` (`string`): The value, as a CSS color.
555
+ - `color` (`Color`): The color the parts show, in the picker's space. During a drag it can be outside the gamut.
556
+ - `space` (`ColorPickerSpace`): The space the parts edit in.
557
+ - `disabled` (`boolean`): Whether it's disabled, by itself or by a `<fieldset>`.
558
+ - `readOnly` (`boolean`): Whether it's read-only: the parts stay focusable, but nothing changes the value.
559
+ - `required` (`boolean`): Whether it's marked required.
560
+ - `outOfGamut` (`boolean`): Whether the color the parts show is outside the gamut, so the value is the closest one inside.
561
+ - `channel` (`ColorChannel`): The channel the slider edits.
562
+ - `channelValue` (`number`): The channel's value, in the units people read it in: degrees, percentages, 0 to 255 for red.
563
+ - `orientation` (`"horizontal" | "vertical"`): The slider's axis.
564
+
565
+ - `selected` (`boolean`): Whether the picker's color looks the same as this swatch's, whatever each is written in.
566
+ - `disabled` (`boolean`): Whether pressing it changes nothing, since the picker is disabled or read-only.
567
+
568
+ ### Reasons
569
+
570
+ `event.detail.reason` says why the value changed.
571
+
572
+ - `track-press` (`PointerEvent`): A press on a slider's track or an area's surface moved the nearest thumb there.
573
+ - `drag` (`PointerEvent`): A slider thumb or a resize handle was dragged, or an item was dragged to a new place in a list.
574
+ - `step-key` (`KeyboardEvent`): Arrow, Page Up, Page Down, Home or End stepped a slider or a number input.
575
+ - `input-commit` (`KeyboardEvent | FocusEvent`): Enter, or leaving a number input, committed what was typed: a number input parses, clamps and snaps it to the step, and an autocomplete closes its suggestions on it.
576
+ - `item-press` (`MouseEvent | KeyboardEvent`): A member of a collection was chosen: a menu item, a tab, a radio or a checkbox item.
577
+ - `eye-dropper-pick`
578
+ - `reset` (`none`): A form reset.
579
+ - `restore` (`none`): The browser restored state, like after going back, or a saved value was read back from storage.
580
+ - `imperative` (`none`): A controller or `api` call, or a property set on a web component.
581
+
582
+ ### Controller
583
+
584
+ The element's `api` property has the same methods. The `value` property reads and sets the color.
585
+
586
+ `setValue()` takes any CSS color and an optional `{ reason, event }`, fires the change event like a drag, and returns `false` when the color can't be read or the change is canceled.
587
+
588
+ - `getValue()` (`() => string`): The value, as a CSS color.
589
+ - `setValue(value, options?)` (`(value: string, options?: ColorPickerChangeOptions | undefined) => boolean`): Sets the value from any CSS color, as a user would. Returns false for text that isn't one.
590
+ - `focus()` (`() => void`): Moves focus to the area's thumb, or the first slider's.
591
+
592
+ ### Events
593
+
594
+ Events fire on their own element and don't bubble, with the new value in `event.detail.value` and the `reason`, `event` and `color` beside it. Calling `preventDefault()` on `valuechange` cancels the change.
595
+
596
+ | Member | On | Description |
597
+ | --------------------------- | ----------------- | -------------------------------------------------------------------- |
598
+ | `value` property, attribute | `ui-color-picker` | The value. The attribute sets where it starts, and is live |
599
+ | `api` property | `ui-color-picker` | The [controller](#controller) |
600
+ | `valuechange` event | `ui-color-picker` | `detail: { value, reason, event, color }` |
601
+ | `valuecommit` event | `ui-color-picker` | `detail: { value, reason, event, color }`, once the interaction ends |
602
+
603
+ ## Accessibility
604
+
605
+ No WAI-ARIA pattern covers a color picker, so it's built from ones that do. The picker is a group. The area's thumb and each slider's thumb follow the [WAI-ARIA slider pattern](https://www.w3.org/WAI/ARIA/apg/patterns/slider/), and the area's thumb names both of its channels, like "Saturation 76%, Brightness 96%". The presets follow the [listbox pattern](https://www.w3.org/WAI/ARIA/apg/patterns/listbox/), and each one is named by its color, like "vivid red", as is `ui-color-picker-swatch`.
606
+
607
+ The thumbs, inputs and presets are named in English by default. Pass `aria-label` to name them in another language.
608
+
609
+ ### Keyboard
610
+
611
+ | Key | Does |
612
+ | -------------------- | --------------------------------------------------------------------------------------------- |
613
+ | Arrow keys | Move a thumb one step. On the area, Left and Right move across, Up and Down move up and down. |
614
+ | Shift with an arrow | Moves ten steps |
615
+ | Page Up or Page Down | Moves a tenth of the range, up the area or along a slider |
616
+ | Home or End | Moves to the start or end, across the area or along a slider |
617
+ | Enter | Reads the text in the input, or picks the focused preset |
618
+ | Escape | Puts the input's text back to the value |
619
+
620
+ Each key press commits, like the end of a drag.
621
+
622
+ ### Tested Behavior
623
+
624
+ Every line below is an automated test.
625
+
626
+ **Value**
627
+
628
+ - The parts show the default value.
629
+ - A press on the area moves the color there, and commits when it lifts.
630
+ - A drag along a slider follows the pointer and commits once.
631
+ - The text input reads any CSS color on Enter, and text that isn't one goes back.
632
+ - A channel input sets its channel in its own units.
633
+ - A controller sets the value, and a canceled change keeps it.
634
+
635
+ **Keyboard**
636
+
637
+ - Arrows step a slider, Shift ten steps, and each press commits.
638
+ - Arrows move the area's thumb on both axes.
639
+ - Swatches are one tab stop, arrows move between them, and a press picks one.
640
+
641
+ **Forms**
642
+
643
+ - The value submits under its name, and a reset returns to the default.
644
+ - A disabled picker can't be focused or changed, and submits nothing.
645
+
646
+ **Gamut**
647
+
648
+ - In OKLCH, a color past the sRGB edge writes the closest one inside, and the thumb moves there once it lifts.
649
+ - The canvas paints the area, with the colors outside the gamut left clear.
650
+
651
+ Runs in React, Vue and web components.