@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,558 @@
1
+ # OTP Input
2
+
3
+ Enter a one-time code with support for pasting, autofill, and native form validation.
4
+
5
+ Use an OTP Input for a short code sent by text or email, like a sign-in or verification code. Each character gets its own slot, and a pasted or autofilled code fills them all at once.
6
+
7
+ ```ts title="basic.ts"
8
+ import "@ui-sdk/web/otp-input"
9
+ import "@ui-sdk/web/field"
10
+ import { createElement, Minus } from "lucide"
11
+
12
+ function mount(root: HTMLElement) {
13
+ root.innerHTML = `
14
+ <ui-field>
15
+ <ui-field-label>Verification code</ui-field-label>
16
+ <ui-otp-input max-length="6">
17
+ <ui-otp-input-group>
18
+ <ui-otp-input-slot></ui-otp-input-slot>
19
+ <ui-otp-input-slot></ui-otp-input-slot>
20
+ <ui-otp-input-slot></ui-otp-input-slot>
21
+ </ui-otp-input-group>
22
+ <ui-otp-input-separator>${createElement(Minus, { "aria-hidden": "true" }).outerHTML}</ui-otp-input-separator>
23
+ <ui-otp-input-group>
24
+ <ui-otp-input-slot></ui-otp-input-slot>
25
+ <ui-otp-input-slot></ui-otp-input-slot>
26
+ <ui-otp-input-slot></ui-otp-input-slot>
27
+ </ui-otp-input-group>
28
+ </ui-otp-input>
29
+ </ui-field>
30
+ `
31
+ }
32
+
33
+ export { mount }
34
+ ```
35
+
36
+ Type a six-digit code or paste 123-456. Click a slot to edit it, use the arrow keys to move, and use your usual undo shortcut to undo a change.
37
+
38
+ ## Installation
39
+
40
+ ```bash
41
+ npm install @ui-sdk/web @ui-sdk/core
42
+ ```
43
+
44
+ Importing the component defines its elements. Import the field too if you use it. On the server the import does nothing.
45
+
46
+ ```ts
47
+ import "@ui-sdk/web/otp-input"
48
+ import "@ui-sdk/web/field"
49
+ ```
50
+
51
+ ## Composition
52
+
53
+ Use the following composition to build a `ui-otp-input`:
54
+
55
+ ```text
56
+ ui-otp-input
57
+ └── ui-otp-input-group
58
+ ├── ui-otp-input-slot
59
+ └── ui-otp-input-slot
60
+ ```
61
+
62
+ `ui-otp-input` creates the native input and holds the code. `ui-otp-input-group` lays out a run of slots. Each `ui-otp-input-slot` displays the character at its place among the input's slots, or at its zero-based `index` if you set one. Add `ui-otp-input-separator` between groups when the code is easier to read in sections, like the dash in the example above.
63
+
64
+ Groups and separators change the presentation of one value. They do not create additional fields or tab stops: the slots display the value of a single native input, which handles selection, paste, undo, form submission, and autofill. It uses `autocomplete="one-time-code"` so supported browsers and password managers can offer a saved or received code.
65
+
66
+ ## Usage
67
+
68
+ Import the parts and put them together:
69
+
70
+ ```html
71
+ <script type="module">
72
+ import "@ui-sdk/web/otp-input"
73
+ </script>
74
+
75
+ <ui-otp-input max-length="4" aria-label="Verification code">
76
+ <ui-otp-input-group>
77
+ <ui-otp-input-slot></ui-otp-input-slot>
78
+ <ui-otp-input-slot></ui-otp-input-slot>
79
+ <ui-otp-input-slot></ui-otp-input-slot>
80
+ <ui-otp-input-slot></ui-otp-input-slot>
81
+ </ui-otp-input-group>
82
+ </ui-otp-input>
83
+ ```
84
+
85
+ ## Four Digits
86
+
87
+ Set `max-length` to the code's length and render that many slots. The default length is six.
88
+
89
+ ```ts title="four-digits.ts"
90
+ import "@ui-sdk/web/otp-input"
91
+ import "@ui-sdk/web/field"
92
+
93
+ function mount(root: HTMLElement) {
94
+ root.innerHTML = `
95
+ <ui-field>
96
+ <ui-field-label>PIN</ui-field-label>
97
+ <ui-otp-input max-length="4" text-align="center">
98
+ <ui-otp-input-group>
99
+ <ui-otp-input-slot></ui-otp-input-slot>
100
+ <ui-otp-input-slot></ui-otp-input-slot>
101
+ <ui-otp-input-slot></ui-otp-input-slot>
102
+ <ui-otp-input-slot></ui-otp-input-slot>
103
+ </ui-otp-input-group>
104
+ </ui-otp-input>
105
+ </ui-field>
106
+ `
107
+ }
108
+
109
+ export { mount }
110
+ ```
111
+
112
+ Enter four digits in PIN. Once it is full, typing another digit replaces the selected slot. Click another slot to edit it.
113
+
114
+ ## Alphanumeric
115
+
116
+ Set `pattern` to `digits`, `letters`, or `alphanumeric`. The default is `digits`. The pattern filters characters and selects a suitable keyboard on touch devices.
117
+
118
+ ```ts title="alphanumeric.ts"
119
+ import "@ui-sdk/web/otp-input"
120
+ import "@ui-sdk/web/field"
121
+ import { createElement, Minus } from "lucide"
122
+
123
+ function mount(root: HTMLElement) {
124
+ root.innerHTML = `
125
+ <ui-field>
126
+ <ui-field-label>Recovery code</ui-field-label>
127
+ <ui-otp-input max-length="8" pattern="alphanumeric">
128
+ <ui-otp-input-group>
129
+ <ui-otp-input-slot></ui-otp-input-slot>
130
+ <ui-otp-input-slot></ui-otp-input-slot>
131
+ <ui-otp-input-slot></ui-otp-input-slot>
132
+ <ui-otp-input-slot></ui-otp-input-slot>
133
+ </ui-otp-input-group>
134
+ <ui-otp-input-separator>${createElement(Minus, { "aria-hidden": "true" }).outerHTML}</ui-otp-input-separator>
135
+ <ui-otp-input-group>
136
+ <ui-otp-input-slot></ui-otp-input-slot>
137
+ <ui-otp-input-slot></ui-otp-input-slot>
138
+ <ui-otp-input-slot></ui-otp-input-slot>
139
+ <ui-otp-input-slot></ui-otp-input-slot>
140
+ </ui-otp-input-group>
141
+ </ui-otp-input>
142
+ </ui-field>
143
+ `
144
+ }
145
+
146
+ export { mount }
147
+ ```
148
+
149
+ Type letters and digits into Recovery code, or paste ab12-cd34. The hyphen is removed and the eight characters fill the slots.
150
+
151
+ ## Custom Pattern
152
+
153
+ Pass the source of a regular expression, such as `pattern="[0-9A-Fa-f]"` to accept hexadecimal characters. Use `input-mode` to choose the keyboard separately. The example displays letters in uppercase without changing their stored case.
154
+
155
+ ```ts title="pattern.ts"
156
+ import "@ui-sdk/web/otp-input"
157
+ import "@ui-sdk/web/field"
158
+
159
+ function mount(root: HTMLElement) {
160
+ root.innerHTML = `
161
+ <ui-field>
162
+ <ui-field-label>Device code</ui-field-label>
163
+ <ui-otp-input max-length="6" pattern="[0-9A-Fa-f]" input-mode="text">
164
+ <ui-otp-input-group>
165
+ <ui-otp-input-slot></ui-otp-input-slot>
166
+ <ui-otp-input-slot></ui-otp-input-slot>
167
+ <ui-otp-input-slot></ui-otp-input-slot>
168
+ <ui-otp-input-slot></ui-otp-input-slot>
169
+ <ui-otp-input-slot></ui-otp-input-slot>
170
+ <ui-otp-input-slot></ui-otp-input-slot>
171
+ </ui-otp-input-group>
172
+ </ui-otp-input>
173
+ </ui-field>
174
+ `
175
+ }
176
+
177
+ export { mount }
178
+ ```
179
+
180
+ Try typing 12zzab into Device code. The z characters are rejected; the accepted value is 12ab, displayed as 12AB.
181
+
182
+ ## Validation
183
+
184
+ Inside a [Field](./field.md), set `invalid` on `ui-field` when your code rejects the value, such as a code the server didn't accept. The field marks the input with `aria-invalid` and connects its `ui-field-error`. Outside a field, pass `aria-invalid` and `aria-describedby` yourself.
185
+
186
+ ```ts title="invalid.ts"
187
+ import "@ui-sdk/web/otp-input"
188
+ import "@ui-sdk/web/field"
189
+
190
+ function mount(root: HTMLElement) {
191
+ root.innerHTML = `
192
+ <ui-field invalid>
193
+ <ui-field-label>Verification code</ui-field-label>
194
+ <ui-otp-input default-value="482913">
195
+ <ui-otp-input-group>
196
+ <ui-otp-input-slot></ui-otp-input-slot>
197
+ <ui-otp-input-slot></ui-otp-input-slot>
198
+ <ui-otp-input-slot></ui-otp-input-slot>
199
+ <ui-otp-input-slot></ui-otp-input-slot>
200
+ <ui-otp-input-slot></ui-otp-input-slot>
201
+ <ui-otp-input-slot></ui-otp-input-slot>
202
+ </ui-otp-input-group>
203
+ </ui-otp-input>
204
+ <ui-field-error>That code has expired. Request a new one.</ui-field-error>
205
+ </ui-field>
206
+ `
207
+ const field = root.querySelector("ui-field")!
208
+ root.querySelector("ui-otp-input")!.addEventListener("valuechange", () => {
209
+ field.invalid = false
210
+ })
211
+ }
212
+
213
+ export { mount }
214
+ ```
215
+
216
+ Verification code is marked invalid, and the error below explains why. Edit any digit to clear the error.
217
+
218
+ ## Controlled
219
+
220
+ Listen for `valuechange` to read changes, and set the element's `value` property to update it. Call `event.preventDefault()` in the listener to reject a change. Incoming values are filtered by the pattern and limited to `max-length`, just like typed values.
221
+
222
+ ```ts title="controlled.ts"
223
+ import "@ui-sdk/web/otp-input"
224
+ import "@ui-sdk/web/field"
225
+ import { log } from "./log"
226
+
227
+ function mount(root: HTMLElement) {
228
+ root.innerHTML = `
229
+ <ui-field>
230
+ <ui-field-label>One-time password</ui-field-label>
231
+ <ui-otp-input>
232
+ <ui-otp-input-group>
233
+ <ui-otp-input-slot></ui-otp-input-slot>
234
+ <ui-otp-input-slot></ui-otp-input-slot>
235
+ <ui-otp-input-slot></ui-otp-input-slot>
236
+ <ui-otp-input-slot></ui-otp-input-slot>
237
+ <ui-otp-input-slot></ui-otp-input-slot>
238
+ <ui-otp-input-slot></ui-otp-input-slot>
239
+ </ui-otp-input-group>
240
+ </ui-otp-input>
241
+ </ui-field>
242
+ `
243
+ root
244
+ .querySelector("ui-otp-input")!
245
+ .addEventListener("valuechange", (event) => {
246
+ const { value, reason } = event.detail
247
+ log(root, `${value || "Empty"} (${reason})`)
248
+ })
249
+ }
250
+
251
+ export { mount }
252
+ ```
253
+
254
+ Enter, paste, or delete digits in One-time password. The console logs each new code and its reason.
255
+
256
+ See [State and Events](../state-and-events.md) for the shared state conventions. The [reason](#reasons) distinguishes typing, pasting, undo, and controller actions.
257
+
258
+ ## On Complete
259
+
260
+ `valuecommit` fires when a change fills every slot, including typing, paste, autofill, and controller writes. Changing an already-full code fires it again. Form resets and page restoration do not.
261
+
262
+ ```ts title="complete.ts"
263
+ import "@ui-sdk/web/otp-input"
264
+ import "@ui-sdk/web/field"
265
+ import { log } from "./log"
266
+
267
+ function mount(root: HTMLElement) {
268
+ root.innerHTML = `
269
+ <ui-field>
270
+ <ui-field-label>Verification code</ui-field-label>
271
+ <ui-otp-input>
272
+ <ui-otp-input-group>
273
+ <ui-otp-input-slot></ui-otp-input-slot>
274
+ <ui-otp-input-slot></ui-otp-input-slot>
275
+ <ui-otp-input-slot></ui-otp-input-slot>
276
+ <ui-otp-input-slot></ui-otp-input-slot>
277
+ <ui-otp-input-slot></ui-otp-input-slot>
278
+ <ui-otp-input-slot></ui-otp-input-slot>
279
+ </ui-otp-input-group>
280
+ </ui-otp-input>
281
+ </ui-field>
282
+ `
283
+ root
284
+ .querySelector("ui-otp-input")!
285
+ .addEventListener("valuecommit", (event) => {
286
+ const { value, reason } = event.detail
287
+ log(root, `Checking ${value} (${reason})`)
288
+ })
289
+ }
290
+
291
+ export { mount }
292
+ ```
293
+
294
+ Fill all six slots. The console logs the complete code and the change reason. Replace a digit to log it again; deleting one logs nothing.
295
+
296
+ ## Forms
297
+
298
+ Set `name` to include the code in `FormData`. `required` blocks an empty code, and a partial code fails length validation. Reset restores the default value. Use `form` to associate a control outside the form with its ID.
299
+
300
+ ```ts title="form.ts"
301
+ import "@ui-sdk/web/otp-input"
302
+ import "@ui-sdk/web/field"
303
+ import { log } from "./log"
304
+
305
+ function mount(root: HTMLElement) {
306
+ root.innerHTML = `
307
+ <div data-slot="stack">
308
+ <form id="verify-sign-in">
309
+ <ui-field>
310
+ <ui-field-label>Verification code</ui-field-label>
311
+ <ui-otp-input name="code" required>
312
+ <ui-otp-input-group>
313
+ <ui-otp-input-slot></ui-otp-input-slot>
314
+ <ui-otp-input-slot></ui-otp-input-slot>
315
+ <ui-otp-input-slot></ui-otp-input-slot>
316
+ <ui-otp-input-slot></ui-otp-input-slot>
317
+ <ui-otp-input-slot></ui-otp-input-slot>
318
+ <ui-otp-input-slot></ui-otp-input-slot>
319
+ </ui-otp-input-group>
320
+ </ui-otp-input>
321
+ <ui-field-description>Enter the six-digit code we sent to hollis@example.com.</ui-field-description>
322
+ <ui-field-error></ui-field-error>
323
+ </ui-field>
324
+ </form>
325
+ <ui-field>
326
+ <ui-field-label>Recovery code (optional)</ui-field-label>
327
+ <ui-otp-input name="recovery" form="verify-sign-in" max-length="8" pattern="alphanumeric">
328
+ <ui-otp-input-group>
329
+ <ui-otp-input-slot></ui-otp-input-slot>
330
+ <ui-otp-input-slot></ui-otp-input-slot>
331
+ <ui-otp-input-slot></ui-otp-input-slot>
332
+ <ui-otp-input-slot></ui-otp-input-slot>
333
+ <ui-otp-input-slot></ui-otp-input-slot>
334
+ <ui-otp-input-slot></ui-otp-input-slot>
335
+ <ui-otp-input-slot></ui-otp-input-slot>
336
+ <ui-otp-input-slot></ui-otp-input-slot>
337
+ </ui-otp-input-group>
338
+ </ui-otp-input>
339
+ <ui-field-error></ui-field-error>
340
+ </ui-field>
341
+ <div data-slot="row">
342
+ <button type="reset" form="verify-sign-in">Reset</button>
343
+ <button type="submit" form="verify-sign-in" data-variant="solid">Verify</button>
344
+ </div>
345
+ </div>
346
+ `
347
+ const form = root.querySelector("form")!
348
+ form.addEventListener("submit", (event) => {
349
+ event.preventDefault()
350
+ const data = [...new FormData(form)].map(
351
+ ([name, value]) => `${name}=${value}`
352
+ )
353
+ log(root, `Submitted ${data.join(", ")}`)
354
+ })
355
+ }
356
+
357
+ export { mount }
358
+ ```
359
+
360
+ Choose Verify with an empty or partial code to see validation. Enter all six digits and choose Verify to log the form values. Recovery code sits outside the form but submits with it. Reset clears both fields.
361
+
362
+ A typed partial code reports `tooShort`. Partial default values and controller writes are checked through the native input's pattern, because browsers do not apply minlength validation to those values.
363
+
364
+ ## Disabled and Read-Only
365
+
366
+ A disabled input cannot be focused, changed, or submitted. `read-only` prevents changes while keeping the input focusable and included in form data.
367
+
368
+ ```html
369
+ <ui-otp-input disabled default-value="123456" aria-label="Disabled code">
370
+ ...
371
+ </ui-otp-input>
372
+ <ui-otp-input read-only default-value="654321" aria-label="Read-only code">
373
+ ...
374
+ </ui-otp-input>
375
+ ```
376
+
377
+ ## Controller
378
+
379
+ Use the element's `api` to read, fill, clear, or focus the input from another control. Writes use the `imperative` reason and pass through the same filtering and `valuechange` events as typing.
380
+
381
+ ```html
382
+ <button type="button" data-action="fill">Fill</button>
383
+ <button type="button" data-action="clear">Clear</button>
384
+ <button type="button" data-action="read">Read</button>
385
+ <button type="button" data-action="focus">Focus</button>
386
+ <ui-otp-input aria-label="Verification code"> ... </ui-otp-input>
387
+ ```
388
+
389
+ ```ts
390
+ const code = document.querySelector("ui-otp-input")!.api
391
+ document
392
+ .querySelector('[data-action="fill"]')!
393
+ .addEventListener("click", () => code.setValue("123456"))
394
+ document
395
+ .querySelector('[data-action="clear"]')!
396
+ .addEventListener("click", () => code.clear())
397
+ document
398
+ .querySelector('[data-action="read"]')!
399
+ .addEventListener("click", () => console.log(code.getValue()))
400
+ document
401
+ .querySelector('[data-action="focus"]')!
402
+ .addEventListener("click", () => code.focus())
403
+ ```
404
+
405
+ [Controllers](../controllers.md) covers an element's `api`.
406
+
407
+ ## Custom Rendering
408
+
409
+ Elements have no render functions. Each slot shows its character, and marks `active` and `hasFakeCaret` with `data-active` and `data-fake-caret`. Read the whole code from the `value` property or the `valuechange` event. See [Parts and Composition](../parts-and-composition.md) for choosing the elements parts bind.
410
+
411
+ ## Styling
412
+
413
+ Draw the active slot and caret with `data-active` and `data-fake-caret`. The examples include the caret animation and disable it for reduced motion. Keep `position: relative` on each slot so its caret stays inside it.
414
+
415
+ Each part has a `data-slot`, such as `otp-input-slot`, and its state attributes are listed under [Data Attributes](#data-attributes).
416
+
417
+ ## Data Attributes
418
+
419
+ ### `<ui-otp-input>`
420
+ `[data-slot="otp-input"]`
421
+
422
+ - `data-complete`: Present while every slot is filled.
423
+ - `data-filled`: Present while the code holds any character.
424
+ - `data-disabled`: Present when disabled, by its own prop or a `<fieldset>`.
425
+ - `data-focused`: Present while the input has focus.
426
+
427
+ ### `<ui-otp-input-group>`
428
+ `[data-slot="otp-input-group"]`
429
+
430
+ - `data-complete`: Present while every slot is filled.
431
+ - `data-filled`: Present while the code holds any character.
432
+ - `data-disabled`: Present when disabled, by its own prop or a `<fieldset>`.
433
+ - `data-focused`: Present while the input has focus.
434
+
435
+ ### `<ui-otp-input-slot>`
436
+ `[data-slot="otp-input-slot"]`
437
+
438
+ - `data-filled`: Present while the slot holds a character.
439
+ - `data-disabled`: Present when disabled, by its own prop or a `<fieldset>`.
440
+ - `data-active`: Present on the slot typing goes to: the selected character, or the empty slot after the last one. Only while focused.
441
+ - `data-fake-caret`: Present on the active slot while it's empty. Draw a blinking caret in it; the input's own caret is hidden.
442
+
443
+ ### `<ui-otp-input-separator>`
444
+ `[data-slot="otp-input-separator"]`
445
+
446
+ - `data-disabled`: Present when disabled, by its own prop or a `<fieldset>`.
447
+
448
+ ## API Reference
449
+
450
+ Props are attributes in kebab case, like `max-length`, `default-value` and `read-only`. `pattern` is a
451
+ preset name or the source of a regular expression. `controller` is a property. Callbacks are DOM events.
452
+
453
+ ### OTPInput
454
+
455
+ - `debug?` (`boolean`): Logs every state change with its reason to the console, in development builds.
456
+ - `value?` (`string`): The code, for a controlled input.
457
+ - `defaultValue?` (`string`): The code it starts with, when uncontrolled. A form reset returns here.
458
+ - `valuechange event`: Runs when the code changes: typing or deleting (`"input-change"`), a paste (`"paste"`), the browser's undo and redo, a form reset, or a controller. Autofill and codes from the keyboard's suggestions are `"input-change"`. `details.cancel()` keeps the code as it was.
459
+ - `valuecommit event`: Runs when a change fills every slot, with the whole code, like to verify it. A controller filling it counts, so does a code that changes while full.
460
+ - `maxLength?` (`number`): How many characters the code has, one slot each.
461
+ - `pattern?` (`OTPInputPattern`): Which characters it accepts: `"digits"`, `"letters"`, `"alphanumeric"`, or a regular expression each character must match, like `/[A-F0-9]/i`. Anything else typed, pasted or dropped is ignored.
462
+ - `inputMode?` (`"decimal" | "none" | "numeric" | "tel" | "text"`): The keyboard touch screens show.
463
+ - `textAlign?` (`"center" | "end" | "start"`): Where the invisible input keeps its text and caret. It decides where the browser puts its own popups, like the paste menu on phones. `"start"` and `"end"` follow the reading direction.
464
+ - `autoComplete?` (`string`): The input's `autocomplete`. `"one-time-code"` lets phones offer a code from a message, and password managers fill it.
465
+ - `disabled?` (`boolean`): Disables it like a native input: it can't be focused, and isn't submitted.
466
+ - `readOnly?` (`boolean`): Makes it read-only: focusable and submitted, but the code can't change.
467
+ - `required?` (`boolean`): Requires a code before the form submits. A partial code is too short either way.
468
+ - `name?` (`string`): The name it submits the code under.
469
+ - `form?` (`string`): The id of a form to belong to, when it isn't inside that form.
470
+ - `controller?` (`{ getValue: () => string; setValue: (value: string, options?: OTPInputChangeOptions) => boolean; clear: (options?: OTPInputChangeOptions) => boolean; focus: () => void; }`): Reads and writes the code from anywhere. Create one with `createOTPInputController()`.
471
+
472
+ ### OTPInputSlot
473
+
474
+ - `index` (`number`): Which character of the code the slot shows, from 0.
475
+
476
+ ### State
477
+
478
+ The same state shows as data attributes on each element. The root, groups and separators get the
479
+ input's state.
480
+
481
+ - `value` (`string`): The code.
482
+ - `slots` (`OTPInputSlotData[]`): One entry per slot: its character, whether it's active, and whether it draws a caret.
483
+ - `focused` (`boolean`): Whether the input has focus.
484
+ - `complete` (`boolean`): Whether every slot is filled.
485
+ - `disabled` (`boolean`): Whether it's disabled, by itself or by a `<fieldset>`.
486
+
487
+ Slots get their own:
488
+
489
+ - `char` (`string | null`): The character in the slot, or null when it's empty.
490
+ - `active` (`boolean`): Whether the slot is where typing goes: the selected character, or the empty slot after the last one.
491
+ - `hasFakeCaret` (`boolean`): Whether the slot should draw a caret: it's active and empty. The real caret is hidden.
492
+ - `index` (`number`): Which character of the code the slot shows.
493
+ - `focused` (`boolean`): Whether the input has focus.
494
+ - `disabled` (`boolean`): Whether it's disabled, by itself or by a `<fieldset>`.
495
+
496
+ ### Reasons
497
+
498
+ `event.detail.reason` says why the code changed. Autofill and a code from the keyboard's suggestions are `input-change`.
499
+
500
+ - `input-change` (`Event`): Typing, pasting or dropping changed a text field's value; in a combobox it can also open or close it, or Enter keeps the typed text as the value.
501
+ - `paste` (`ClipboardEvent`): Files were pasted, like a screenshot, or text and tokens into a token input.
502
+ - `undo` (`KeyboardEvent | InputEvent`): Undo, from the keyboard, the Edit menu or a controller.
503
+ - `redo` (`KeyboardEvent | InputEvent`): Redo, from the keyboard, the Edit menu or a controller.
504
+ - `reset` (`none`): A form reset.
505
+ - `restore` (`none`): The browser restored state, like after going back, or a saved value was read back from storage.
506
+ - `imperative` (`none`): A controller or `api` call, or a property set on a web component.
507
+
508
+ ### Controller
509
+
510
+ The element's `api` property has the same methods. The `value` property reads and sets the code.
511
+
512
+ `setValue()` and `clear()` take an optional `{ reason, event }`, and fire `valuechange` like typing.
513
+
514
+ - `getValue()` (`() => string`): The code.
515
+ - `setValue(value, options?)` (`(value: string, options?: OTPInputChangeOptions | undefined) => boolean`): Sets the code, as typing it would. Characters that don't fit the pattern are dropped. Returns false when the change was canceled or nothing changed.
516
+ - `clear(options?)` (`(options?: OTPInputChangeOptions | undefined) => boolean`): Empties the code. Returns false when the change was canceled or nothing changed.
517
+ - `focus()` (`() => void`): Moves focus to the input.
518
+
519
+ ### Events
520
+
521
+ Events fire on their own element and don't bubble, with the code in `event.detail.value` and the `reason` and `event` beside it. Calling `preventDefault()` on `valuechange` cancels the change.
522
+
523
+ | Member | On | Description |
524
+ | --------------------------- | -------------- | ---------------------------------------------------------- |
525
+ | `value` property, attribute | `ui-otp-input` | The code |
526
+ | `api` property | `ui-otp-input` | The [controller](#controller) |
527
+ | `valuechange` event | `ui-otp-input` | `detail: { value, reason, event }`, on every change |
528
+ | `valuecommit` event | `ui-otp-input` | `detail: { value, reason, event }`, when a change fills it |
529
+
530
+ ## Accessibility
531
+
532
+ Name the input with `ui-field-label`, a native label, `aria-label`, or `aria-labelledby`. Screen readers encounter one input with the whole code; the visual slots, groups, and separators are hidden from them.
533
+
534
+ ### Keyboard
535
+
536
+ The input keeps its native keys. Arrow keys, Home, and End move the selection between slots, Backspace deletes, and your usual shortcuts undo and redo. Pasting a code such as `123-456` removes the separators.
537
+
538
+ ### Tested Behavior
539
+
540
+ Every line below is an automated test.
541
+
542
+ - Typing fills the slots in order.
543
+ - Characters the pattern doesn't accept are ignored.
544
+ - Filling every slot completes the code.
545
+ - Backspace deletes the last character.
546
+ - ArrowLeft goes back a slot, and typing replaces its character.
547
+ - Pressing a filled slot lets you retype it.
548
+ - Pasting a code with a dash fills every slot.
549
+ - The form submits the code under its name.
550
+ - A partial default code is too short to submit.
551
+ - A typed partial code is too short, not the wrong format.
552
+ - A canceled change keeps the code.
553
+ - A disabled code can't be typed into.
554
+ - A code of letters and digits takes both.
555
+ - The input asks for a one-time code and a numeric keyboard.
556
+ - Typing a whole code with no waits fills it.
557
+
558
+ Runs in React, Vue and web components.