@fusion.dev/helix-headless 0.145.0 → 0.147.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/custom-elements.json +12286 -4281
  2. package/dist/accordion/item/accordion-item.d.ts +51 -18
  3. package/dist/accordion/item/accordion-item.js +45 -13
  4. package/dist/accordion/root/accordion-root.d.ts +16 -7
  5. package/dist/accordion/root/accordion-root.js +3 -3
  6. package/dist/announcement/root/announcement-root.d.ts +16 -6
  7. package/dist/announcement/root/announcement-root.js +37 -7
  8. package/dist/app-header/root/app-header-root.d.ts +7 -2
  9. package/dist/app-header/root/app-header-root.js +9 -1
  10. package/dist/app-header/sectioning.d.ts +3 -1
  11. package/dist/app-header/sectioning.js +3 -2
  12. package/dist/area-chart/root/area-chart-root.d.ts +18 -1
  13. package/dist/area-chart/root/area-chart-root.js +11 -3
  14. package/dist/avatar/group/avatar-group.d.ts +20 -14
  15. package/dist/avatar/group/avatar-group.js +17 -19
  16. package/dist/avatar/root/avatar-root.d.ts +31 -1
  17. package/dist/avatar/root/avatar-root.js +11 -1
  18. package/dist/badge/root/badge-root.d.ts +60 -7
  19. package/dist/badge/root/badge-root.js +89 -6
  20. package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
  21. package/dist/bar-chart/root/bar-chart-root.js +48 -20
  22. package/dist/bar-chart/stack.d.ts +25 -0
  23. package/dist/bar-chart/stack.js +27 -0
  24. package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
  25. package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
  26. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
  27. package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
  28. package/dist/button/root/button-root.d.ts +50 -38
  29. package/dist/button/root/button-root.js +42 -53
  30. package/dist/button/submitter.d.ts +27 -0
  31. package/dist/button/submitter.js +25 -0
  32. package/dist/button-group/root/button-group-root.d.ts +2 -1
  33. package/dist/button-group/root/button-group-root.js +5 -1
  34. package/dist/canvas/node/canvas-node.d.ts +4 -3
  35. package/dist/canvas/node/canvas-node.js +3 -2
  36. package/dist/canvas/root/canvas-root.js +2 -2
  37. package/dist/card/root/card-root.d.ts +36 -4
  38. package/dist/card/root/card-root.js +29 -10
  39. package/dist/carousel/root/carousel-root.d.ts +43 -4
  40. package/dist/carousel/root/carousel-root.js +40 -12
  41. package/dist/carousel/stops.d.ts +20 -0
  42. package/dist/carousel/stops.js +30 -0
  43. package/dist/chat/message/chat-message.js +5 -4
  44. package/dist/chat/naming.d.ts +5 -1
  45. package/dist/chat/naming.js +4 -2
  46. package/dist/chat/root/chat-root.d.ts +40 -4
  47. package/dist/chat/root/chat-root.js +32 -6
  48. package/dist/checkbox/root/checkbox-root.d.ts +20 -0
  49. package/dist/checkbox/root/checkbox-root.js +18 -7
  50. package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
  51. package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
  52. package/dist/checkbox-group/select-all.d.ts +21 -0
  53. package/dist/checkbox-group/select-all.js +7 -0
  54. package/dist/code-block/highlight.d.ts +15 -0
  55. package/dist/code-block/highlight.js +4 -0
  56. package/dist/code-block/root/code-block-root.d.ts +79 -10
  57. package/dist/code-block/root/code-block-root.js +74 -5
  58. package/dist/color-input/root/color-input-root.d.ts +14 -0
  59. package/dist/color-input/root/color-input-root.js +17 -7
  60. package/dist/color-picker/channels.js +1 -2
  61. package/dist/color-picker/root/color-picker-root.d.ts +53 -16
  62. package/dist/color-picker/root/color-picker-root.js +155 -46
  63. package/dist/color-picker/wheel.d.ts +17 -0
  64. package/dist/color-picker/wheel.js +6 -0
  65. package/dist/combobox/root/combobox-root.d.ts +56 -0
  66. package/dist/combobox/root/combobox-root.js +92 -15
  67. package/dist/command/root/command-root.d.ts +19 -2
  68. package/dist/command/root/command-root.js +24 -23
  69. package/dist/copy-button/root/copy-button-root.d.ts +21 -1
  70. package/dist/copy-button/root/copy-button-root.js +16 -4
  71. package/dist/data-table/index.d.ts +1 -1
  72. package/dist/data-table/index.js +1 -1
  73. package/dist/data-table/keys.d.ts +6 -0
  74. package/dist/data-table/keys.js +14 -0
  75. package/dist/data-table/root/data-table-root.d.ts +27 -18
  76. package/dist/data-table/root/data-table-root.js +31 -57
  77. package/dist/data-table/tree.d.ts +16 -1
  78. package/dist/data-table/tree.js +2 -3
  79. package/dist/date-input/root/date-input-root.d.ts +11 -2
  80. package/dist/date-input/root/date-input-root.js +26 -12
  81. package/dist/date-picker/root/date-picker-root.d.ts +14 -9
  82. package/dist/date-picker/root/date-picker-root.js +33 -22
  83. package/dist/description-list/item/description-list-item.d.ts +18 -4
  84. package/dist/description-list/item/description-list-item.js +8 -4
  85. package/dist/dialog/description.js +15 -1
  86. package/dist/dialog/root/dialog-root.d.ts +8 -2
  87. package/dist/dialog/root/dialog-root.js +16 -1
  88. package/dist/divider/root/divider-root.d.ts +3 -0
  89. package/dist/divider/root/divider-root.js +2 -1
  90. package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
  91. package/dist/donut-chart/root/donut-chart-root.js +55 -1
  92. package/dist/donut-chart/slice-label.d.ts +35 -0
  93. package/dist/donut-chart/slice-label.js +11 -0
  94. package/dist/drawer/reveal.d.ts +8 -0
  95. package/dist/drawer/reveal.js +1 -0
  96. package/dist/drawer/root/drawer-root.d.ts +63 -2
  97. package/dist/drawer/root/drawer-root.js +75 -4
  98. package/dist/drilldown/item/drilldown-item.d.ts +21 -1
  99. package/dist/drilldown/item/drilldown-item.js +40 -5
  100. package/dist/drilldown/root/drilldown-root.d.ts +21 -3
  101. package/dist/drilldown/root/drilldown-root.js +22 -3
  102. package/dist/element-events.generated.js +35 -6
  103. package/dist/empty/root/empty-root.d.ts +34 -2
  104. package/dist/empty/root/empty-root.js +26 -4
  105. package/dist/file-input/root/file-input-root.d.ts +99 -8
  106. package/dist/file-input/root/file-input-root.js +120 -22
  107. package/dist/file-input/screen.d.ts +2 -1
  108. package/dist/file-input/status.d.ts +24 -0
  109. package/dist/file-input/status.js +10 -0
  110. package/dist/filter-input/chip/filter-chip.d.ts +23 -0
  111. package/dist/filter-input/chip/filter-chip.js +11 -2
  112. package/dist/filter-input/menu/filter-menu.d.ts +2 -0
  113. package/dist/filter-input/menu/filter-menu.js +12 -4
  114. package/dist/filter-input/root/filter-input-root.d.ts +38 -6
  115. package/dist/filter-input/root/filter-input-root.js +18 -28
  116. package/dist/filter-input/suggest.d.ts +28 -3
  117. package/dist/filter-input/suggest.js +18 -8
  118. package/dist/format-date/options.d.ts +3 -4
  119. package/dist/format-date/options.js +2 -2
  120. package/dist/format-date/root/format-date-root.d.ts +27 -17
  121. package/dist/format-date/root/format-date-root.js +27 -48
  122. package/dist/heatmap/root/buckets.d.ts +21 -0
  123. package/dist/heatmap/root/buckets.js +34 -0
  124. package/dist/heatmap/root/heatmap-root.d.ts +83 -11
  125. package/dist/heatmap/root/heatmap-root.js +104 -12
  126. package/dist/icon/index.d.ts +1 -1
  127. package/dist/icon/index.js +1 -1
  128. package/dist/icon/registry.d.ts +26 -1
  129. package/dist/icon/registry.js +12 -1
  130. package/dist/icon/root/icon-root.d.ts +25 -1
  131. package/dist/icon/root/icon-root.js +44 -12
  132. package/dist/icon/root/index.d.ts +1 -1
  133. package/dist/icon/root/index.js +1 -1
  134. package/dist/icon/settle.d.ts +7 -0
  135. package/dist/icon/settle.js +10 -0
  136. package/dist/icon-button/root/icon-button-root.d.ts +2 -0
  137. package/dist/image/root/image-root.d.ts +14 -1
  138. package/dist/image/root/image-root.js +7 -2
  139. package/dist/input/root/input-root.d.ts +34 -3
  140. package/dist/input/root/input-root.js +17 -4
  141. package/dist/kbd/keys.d.ts +29 -0
  142. package/dist/kbd/keys.js +52 -0
  143. package/dist/kbd/root/kbd-root.d.ts +52 -1
  144. package/dist/kbd/root/kbd-root.js +40 -47
  145. package/dist/legend/hidden-series.d.ts +10 -2
  146. package/dist/legend/hidden-series.js +5 -2
  147. package/dist/legend/root/legend-root.d.ts +77 -12
  148. package/dist/legend/root/legend-root.js +71 -17
  149. package/dist/lightbox/root/lightbox-root.d.ts +98 -10
  150. package/dist/lightbox/root/lightbox-root.js +153 -18
  151. package/dist/lightbox/zoom-controller.d.ts +59 -0
  152. package/dist/lightbox/zoom-controller.js +128 -0
  153. package/dist/lightbox/zoom.d.ts +24 -0
  154. package/dist/lightbox/zoom.js +18 -0
  155. package/dist/line-chart/root/line-chart-root.d.ts +38 -1
  156. package/dist/line-chart/root/line-chart-root.js +31 -3
  157. package/dist/list/item/list-item.d.ts +2 -0
  158. package/dist/list/item/list-item.js +11 -2
  159. package/dist/list/root/list-root.d.ts +70 -13
  160. package/dist/list/root/list-root.js +91 -13
  161. package/dist/list/selection.d.ts +54 -7
  162. package/dist/list/selection.js +32 -7
  163. package/dist/listbox/root/listbox-root.d.ts +44 -4
  164. package/dist/listbox/root/listbox-root.js +72 -34
  165. package/dist/loader/busy.d.ts +10 -0
  166. package/dist/loader/busy.js +11 -0
  167. package/dist/loader/root/loader-root.d.ts +9 -2
  168. package/dist/loader/root/loader-root.js +23 -3
  169. package/dist/megamenu/hand-over.d.ts +75 -0
  170. package/dist/megamenu/hand-over.js +67 -0
  171. package/dist/megamenu/root/megamenu-root.d.ts +80 -15
  172. package/dist/megamenu/root/megamenu-root.js +76 -19
  173. package/dist/menu/item/menu-item.d.ts +51 -2
  174. package/dist/menu/item/menu-item.js +50 -26
  175. package/dist/menu/root/menu-root.d.ts +17 -0
  176. package/dist/menu/root/menu-root.js +2 -2
  177. package/dist/meter/root/meter-root.d.ts +62 -1
  178. package/dist/meter/root/meter-root.js +38 -16
  179. package/dist/navigation/root/navigation-root.d.ts +2 -1
  180. package/dist/navigation/root/navigation-root.js +2 -2
  181. package/dist/notifications/root/notifications-root.d.ts +20 -4
  182. package/dist/notifications/root/notifications-root.js +30 -8
  183. package/dist/number-input/grain.d.ts +28 -0
  184. package/dist/number-input/grain.js +14 -0
  185. package/dist/number-input/root/number-input-root.d.ts +34 -9
  186. package/dist/number-input/root/number-input-root.js +31 -25
  187. package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
  188. package/dist/object-inspector/root/object-inspector-root.js +134 -92
  189. package/dist/object-inspector/rows.d.ts +18 -0
  190. package/dist/object-inspector/rows.js +33 -0
  191. package/dist/option/index.d.ts +1 -0
  192. package/dist/option/index.js +1 -0
  193. package/dist/option/root/option-root.d.ts +5 -3
  194. package/dist/option/separator/option-separator.d.ts +30 -0
  195. package/dist/option/separator/option-separator.js +21 -0
  196. package/dist/outline/root/outline-root.d.ts +30 -0
  197. package/dist/outline/root/outline-root.js +17 -13
  198. package/dist/pagination/size/pagination-size.d.ts +6 -0
  199. package/dist/pagination/size/pagination-size.js +5 -3
  200. package/dist/pin-input/code.d.ts +37 -0
  201. package/dist/pin-input/code.js +25 -0
  202. package/dist/pin-input/root/pin-input-root.d.ts +116 -115
  203. package/dist/pin-input/root/pin-input-root.js +163 -155
  204. package/dist/popover/hide-outside.d.ts +14 -0
  205. package/dist/popover/hide-outside.js +34 -0
  206. package/dist/popover/root/popover-root.d.ts +64 -8
  207. package/dist/popover/root/popover-root.js +67 -4
  208. package/dist/progress/root/progress-root.d.ts +47 -0
  209. package/dist/progress/root/progress-root.js +34 -16
  210. package/dist/qr-code/export.d.ts +45 -1
  211. package/dist/qr-code/export.js +28 -0
  212. package/dist/qr-code/name.d.ts +11 -0
  213. package/dist/qr-code/name.js +7 -0
  214. package/dist/qr-code/root/qr-code-root.d.ts +36 -11
  215. package/dist/qr-code/root/qr-code-root.js +58 -11
  216. package/dist/quote/marks.d.ts +8 -0
  217. package/dist/quote/marks.js +5 -0
  218. package/dist/quote/root/quote-root.d.ts +14 -2
  219. package/dist/quote/root/quote-root.js +23 -1
  220. package/dist/radio/group/radio-group.d.ts +15 -0
  221. package/dist/radio/root/radio-root.d.ts +6 -2
  222. package/dist/radio/root/radio-root.js +7 -2
  223. package/dist/rating/root/rating-root.d.ts +30 -12
  224. package/dist/rating/root/rating-root.js +27 -27
  225. package/dist/scatter-chart/fit.d.ts +15 -0
  226. package/dist/scatter-chart/fit.js +35 -0
  227. package/dist/scatter-chart/root/scatter-chart-root.d.ts +51 -1
  228. package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
  229. package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
  230. package/dist/scroll-area/root/scroll-area-root.js +57 -173
  231. package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
  232. package/dist/scroll-area/scrollbar-controller.js +172 -0
  233. package/dist/scroll-area/scrollbar.d.ts +27 -8
  234. package/dist/scroll-area/scrollbar.js +10 -1
  235. package/dist/select/align.d.ts +47 -0
  236. package/dist/select/align.js +7 -0
  237. package/dist/select/root/select-root.d.ts +71 -0
  238. package/dist/select/root/select-root.js +78 -6
  239. package/dist/skeleton/root/skeleton-root.d.ts +3 -0
  240. package/dist/skeleton/root/skeleton-root.js +4 -2
  241. package/dist/skip-link/root/skip-link-root.js +2 -2
  242. package/dist/slider/root/slider-root.d.ts +59 -5
  243. package/dist/slider/root/slider-root.js +45 -3
  244. package/dist/sparkline/readings.d.ts +36 -0
  245. package/dist/sparkline/readings.js +36 -0
  246. package/dist/sparkline/root/sparkline-root.d.ts +121 -7
  247. package/dist/sparkline/root/sparkline-root.js +160 -26
  248. package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
  249. package/dist/speed-dial/item/speed-dial-item.js +2 -2
  250. package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
  251. package/dist/speed-dial/root/speed-dial-root.js +11 -3
  252. package/dist/splitter/root/splitter-root.d.ts +10 -12
  253. package/dist/splitter/root/splitter-root.js +211 -204
  254. package/dist/stat/root/stat-root.d.ts +14 -5
  255. package/dist/stat/root/stat-root.js +21 -5
  256. package/dist/steps/reach.d.ts +5 -0
  257. package/dist/steps/reach.js +3 -0
  258. package/dist/steps/root/steps-root.d.ts +56 -3
  259. package/dist/steps/root/steps-root.js +50 -6
  260. package/dist/steps/step/step.d.ts +8 -0
  261. package/dist/steps/step/step.js +8 -3
  262. package/dist/switch/root/switch-root.d.ts +10 -0
  263. package/dist/table/column/table-column.d.ts +6 -10
  264. package/dist/table/column/table-column.js +8 -20
  265. package/dist/table/root/table-root.d.ts +31 -10
  266. package/dist/table/root/table-root.js +14 -18
  267. package/dist/table/row/table-row.d.ts +24 -0
  268. package/dist/table/row/table-row.js +37 -1
  269. package/dist/tabs/panel/tab-panel.d.ts +16 -3
  270. package/dist/tabs/panel/tab-panel.js +34 -5
  271. package/dist/tabs/root/tabs-root.d.ts +17 -3
  272. package/dist/tabs/root/tabs-root.js +1 -1
  273. package/dist/tabs/tab/tab.d.ts +5 -0
  274. package/dist/tabs/tab/tab.js +5 -2
  275. package/dist/tag/group/tag-group.d.ts +44 -5
  276. package/dist/tag/group/tag-group.js +60 -9
  277. package/dist/tag/root/tag-root.js +9 -2
  278. package/dist/textarea/root/textarea-root.d.ts +41 -2
  279. package/dist/textarea/root/textarea-root.js +39 -1
  280. package/dist/time-input/root/time-input-root.d.ts +10 -2
  281. package/dist/time-input/root/time-input-root.js +24 -13
  282. package/dist/time-picker/root/time-picker-root.d.ts +28 -17
  283. package/dist/time-picker/root/time-picker-root.js +18 -29
  284. package/dist/time-picker/wheel-name.d.ts +9 -0
  285. package/dist/time-picker/wheel-name.js +15 -0
  286. package/dist/timeline/group/timeline-group.js +2 -2
  287. package/dist/toast/item/toast-item.d.ts +16 -3
  288. package/dist/toast/item/toast-item.js +22 -6
  289. package/dist/toast/root/toast-root.d.ts +34 -4
  290. package/dist/toast/root/toast-root.js +74 -13
  291. package/dist/toast/words.d.ts +12 -0
  292. package/dist/toast/words.js +25 -0
  293. package/dist/toggle/group/toggle-group.d.ts +52 -7
  294. package/dist/toggle/group/toggle-group.js +58 -44
  295. package/dist/toggle/root/toggle-root.js +2 -4
  296. package/dist/toolbar/root/toolbar-root.d.ts +21 -5
  297. package/dist/toolbar/root/toolbar-root.js +52 -8
  298. package/dist/tooltip/root/tooltip-root.d.ts +20 -3
  299. package/dist/tooltip/root/tooltip-root.js +18 -1
  300. package/dist/tour/back.d.ts +10 -0
  301. package/dist/tour/back.js +8 -0
  302. package/dist/tour/root/tour-root.d.ts +45 -2
  303. package/dist/tour/root/tour-root.js +53 -8
  304. package/dist/tour/stop/tour-stop.d.ts +3 -0
  305. package/dist/tour/stop/tour-stop.js +3 -3
  306. package/dist/tree/item/tree-item.d.ts +7 -3
  307. package/dist/tree/item/tree-item.js +3 -0
  308. package/dist/tree/root/tree-root.d.ts +24 -3
  309. package/dist/tree/root/tree-root.js +32 -13
  310. package/dist/tree/selection.js +2 -15
  311. package/dist/trend/figure.d.ts +16 -0
  312. package/dist/trend/figure.js +8 -0
  313. package/dist/trend/root/trend-root.d.ts +83 -19
  314. package/dist/trend/root/trend-root.js +59 -8
  315. package/dist/video/media-events.d.ts +13 -18
  316. package/dist/video/media-events.js +1 -5
  317. package/dist/video/root/extra-controls.d.ts +12 -0
  318. package/dist/video/root/extra-controls.js +6 -2
  319. package/dist/video/root/video-root.d.ts +23 -6
  320. package/dist/video/root/video-root.js +19 -10
  321. package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
  322. package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
  323. package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
  324. package/dist/video-playlist/root/video-playlist-root.js +3 -0
  325. package/dist/virtual-list/fill.d.ts +11 -8
  326. package/dist/virtual-list/fill.js +10 -17
  327. package/dist/virtual-list/keys.d.ts +16 -7
  328. package/dist/virtual-list/keys.js +17 -6
  329. package/dist/virtual-list/plan.d.ts +65 -0
  330. package/dist/virtual-list/plan.js +27 -0
  331. package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
  332. package/dist/virtual-list/root/virtual-list-root.js +218 -51
  333. package/lint.json +1 -1
  334. package/package.json +8 -8
  335. package/types/jsx.d.ts +7441 -1458
  336. package/types/svelte.d.ts +1 -0
  337. package/types/vue.d.ts +1501 -326
  338. package/dist/chat/relative-clock.d.ts +0 -39
  339. package/dist/chat/relative-clock.js +0 -31
  340. package/dist/data-table/root/order.d.ts +0 -141
  341. package/dist/data-table/root/order.js +0 -76
  342. package/dist/tag/selection.d.ts +0 -10
  343. package/dist/tag/selection.js +0 -12
@@ -4,7 +4,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { customElement, formatNumbers, HelixBeforeChangeEvent, HelixFormElement, requestChange, } from '@fusion.dev/helix-core';
7
+ import { customElement, formatNumbers, HelixBeforeChangeEvent, HelixFormElement, hostWords, requestChange, } from '@fusion.dev/helix-core';
8
8
  import { nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
10
  import { html } from 'lit/static-html.js';
@@ -89,17 +89,19 @@ let HelixHeadlessPaginationSize = class HelixHeadlessPaginationSize extends Heli
89
89
  renderSelect() {
90
90
  const select = this.tag('select');
91
91
  const option = this.tag('option');
92
+ const named = this.isConnected ? hostWords(this) : '';
92
93
  return html `<${select}
93
94
  part="control"
94
95
  exportparts="feedback: control-feedback, hint: control-hint, indicator: control-indicator,
95
96
  label: control-label, listbox: control-listbox, listbox-empty: control-listbox-empty,
96
- listbox-feedback: control-listbox-feedback, listbox-filter-icon: control-listbox-filter-icon,
97
+ listbox-error: control-listbox-error, listbox-feedback: control-listbox-feedback, listbox-filter-icon: control-listbox-filter-icon,
97
98
  listbox-filter-mark: control-listbox-filter-mark, listbox-hint: control-listbox-hint,
98
99
  listbox-items: control-listbox-items, listbox-label: control-listbox-label,
99
100
  listbox-live: control-listbox-live, listbox-loading: control-listbox-loading, listbox-search: control-listbox-search,
100
101
  listbox-search-field: control-listbox-search-field, surface: control-surface,
101
102
  trigger: control-trigger, value: control-value"
102
- label=${this.label}
103
+ label=${named ? '' : this.label}
104
+ aria-label=${named || nothing}
103
105
  ?disabled=${this.isDisabled}
104
106
  .value=${String(this.current)}
105
107
  @helix-before-change=${this.handleChange}
@@ -0,0 +1,37 @@
1
+ /** What a box accepts, which decides the keyboard a phone offers. */
2
+ export type PinType = 'alphanumeric' | 'numeric' | 'text';
3
+ /** How typed letters are cased: as typed, or turned upper or lower case. */
4
+ export type PinCase = 'lower' | 'preserve' | 'upper';
5
+ /**
6
+ * Typed or pasted text as the code's characters: trimmed, with what `type`
7
+ * refuses dropped, and its letters cased as `letterCase` asks. Web Awesome's
8
+ * OTP input takes the same `case`.
9
+ *
10
+ * `numeric` keeps digits, `alphanumeric` keeps ASCII letters and digits, and
11
+ * `text` keeps everything.
12
+ */
13
+ export declare const cleanCode: (text: string, type: PinType, letterCase?: PinCase) => string;
14
+ /** A code after an edit, and the box the caret is in after it. */
15
+ export interface CodeEdit {
16
+ /** The box the caret is in, from 0, never past the last box. */
17
+ caret: number;
18
+ /** The code's characters, as many as there are boxes at most. */
19
+ code: string;
20
+ }
21
+ /**
22
+ * What the one field holds after the platform edited it, as a code: `raw` is
23
+ * the field's text with the caret at `caret`, cleaned and cut at `count`, and
24
+ * the caret is moved past only the characters the code kept before it.
25
+ */
26
+ export declare const readTyped: (raw: string, caret: number, type: PinType, letterCase: PinCase, count: number) => CodeEdit;
27
+ /**
28
+ * A run of characters written over `code` from box `at` onward, which is what a
29
+ * paste does: the boxes it reaches take its characters and the rest keep
30
+ * theirs, and anything past the last box is dropped.
31
+ *
32
+ * **A code has no holes in it**, so the run starts no later than the end of
33
+ * the code: a whole code pasted into an empty field fills from the first box
34
+ * wherever the caret was, and two characters pasted into box three of a field
35
+ * holding two fill from box three.
36
+ */
37
+ export declare const overwriteCode: (code: string, at: number, text: string, count: number) => CodeEdit;
@@ -0,0 +1,25 @@
1
+ export const cleanCode = (text, type, letterCase = 'preserve') => {
2
+ const trimmed = text.trim();
3
+ const kept = type === 'numeric'
4
+ ? trimmed.replace(/\D/g, '')
5
+ : type === 'alphanumeric'
6
+ ? trimmed.replace(/[^0-9A-Za-z]/g, '')
7
+ : trimmed;
8
+ return letterCase === 'upper'
9
+ ? kept.toUpperCase()
10
+ : letterCase === 'lower'
11
+ ? kept.toLowerCase()
12
+ : kept;
13
+ };
14
+ export const readTyped = (raw, caret, type, letterCase, count) => ({
15
+ caret: Math.min(cleanCode(raw.slice(0, caret), type, letterCase).length, count - 1),
16
+ code: cleanCode(raw, type, letterCase).slice(0, count),
17
+ });
18
+ export const overwriteCode = (code, at, text, count) => {
19
+ const start = Math.min(at, code.length);
20
+ const characters = [...code.slice(0, count)];
21
+ for (let offset = 0; offset < text.length && start + offset < count; offset += 1) {
22
+ characters[start + offset] = text[offset];
23
+ }
24
+ return { caret: Math.min(count - 1, start + text.length), code: characters.join('') };
25
+ };
@@ -1,38 +1,58 @@
1
1
  import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
- /** What a cell accepts, which decides the keyboard a phone offers. */
4
- export type PinType = 'alphanumeric' | 'numeric' | 'text';
3
+ import { type PinCase, type PinType } from '../code.js';
4
+ export type { PinCase, PinType } from '../code.js';
5
5
  declare const HelixHeadlessPinInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
6
6
  /**
7
7
  * @summary A field for a short code, with one box for each character.
8
8
  *
9
9
  * @description
10
- * Each cell is its own `<input>`, so every box has a real focus ring, caret,
11
- * and tab stop.
10
+ * One real `<input>` holds the code, and the boxes are drawn from it, as Web
11
+ * Awesome's OTP input does. A screen reader meets one field, named by the
12
+ * label, and the code never sits in a row of separate fields. The boxes are
13
+ * hidden from it.
12
14
  *
13
- * Input longer than one character is treated as a paste, in any cell. This
14
- * covers pasting, a browser autofilling an SMS code, and a password manager,
15
- * which all put the whole code into the focused box. A six-character code that
16
- * arrives in cell three fills from cell three.
15
+ * The caret is drawn in the box it is in, and the box is marked with
16
+ * `cell-active` while the field has focus. A filled box selects its character,
17
+ * so typing replaces it and moves on.
17
18
  *
18
- * The code is one value to a form. The cells are in a shadow root and submit
19
- * nothing. The host is form-associated and submits the joined string, which
20
- * also carries validity and responds to a form reset.
19
+ * Input longer than one character is treated as a paste. This covers pasting,
20
+ * a browser autofilling an SMS code, and a password manager. A six-character
21
+ * code pasted into an empty field fills from the first box.
21
22
  *
22
- * Only the first cell has `autocomplete="one-time-code"`, because the hint
23
- * applies to the whole field.
23
+ * The code is one value to a form. The field is in a shadow root and submits
24
+ * nothing. The host is form-associated and submits the code, which also
25
+ * carries validity and responds to a form reset. The field carries
26
+ * `autocomplete="one-time-code"`, which lets a phone offer the code from a
27
+ * message.
24
28
  *
25
29
  * `autosubmit` submits the form once the last box is filled, through the form's
26
30
  * default button where there is one. `format` draws separators between the
27
- * boxes, such as the dash in `###-###`, as text a screen reader skips. Delete
28
- * removes the character in the focused box and pulls the rest of the code
29
- * back, as Backspace removes the one before it.
31
+ * boxes, such as the dash in `###-###`, as text a screen reader skips. `mask`
32
+ * makes the field a password field and draws `mask-character` in each filled
33
+ * box, so the code is never drawn as text.
30
34
  *
31
- * The row of cells always runs left to right, with `dir="ltr"`, including in
35
+ * The row of boxes always runs left to right, with `dir="ltr"`, including in
32
36
  * Arabic and Hebrew. The first box is the leftmost, a paste fills to the right,
33
37
  * and the right arrow moves to the next box. The label, hint, and feedback
34
38
  * follow the page's direction.
35
39
  *
40
+ * **Keyboard.** The field is one tab stop.
41
+ *
42
+ * | Key | What it does |
43
+ * |---|---|
44
+ * | A character | Fills the box and moves to the next one. A longer run is read as a paste. |
45
+ * | Left, Right | Moves to the box before or after. |
46
+ * | Home, End | Moves to the first box, or to the box after the last character. |
47
+ * | Backspace | Removes the character in the box, or in an empty box the one before it, and moves there. |
48
+ * | Delete | Removes the character in the box and pulls the rest of the code back. |
49
+ * | Enter | Submits the form. |
50
+ *
51
+ * The field is a text field, or a password field under `mask`, named by the
52
+ * label and described by the hint and the message, with `aria-invalid` while
53
+ * a message shows and `aria-required` under `required`. `helix-complete` is a
54
+ * `HelixCompleteEvent` sent once the last box is filled.
55
+ *
36
56
  * @since 0.1.0
37
57
  * @status stable
38
58
  * @category forms
@@ -48,28 +68,29 @@ declare const HelixHeadlessPinInput_base: (new (...args: any[]) => import("@fusi
48
68
  * @event {HelixCompleteEvent} helix-complete - The last box was filled.
49
69
  * @event {Event} input - The code changed.
50
70
  *
71
+ * @csspart caret - The caret, drawn in the empty box it is in while the field has focus.
51
72
  * @csspart cell - One box.
73
+ * @csspart cell-active - The box the caret is in, while the field has focus. Set together with `cell`.
74
+ * @csspart cell-filled - A box that holds a character. Set together with `cell`.
75
+ * @csspart control - The one field that holds the code, out of sight: the boxes are drawn from it.
52
76
  * @csspart feedback - The message that says what is wrong with the code.
53
77
  * @csspart field - The row of boxes, ordered left to right in every language.
54
78
  * @csspart hint - The help under the boxes, shown while there is no feedback.
55
79
  * @csspart label - The label above the boxes.
80
+ * @csspart placeholder - The `placeholder` text in an empty box.
56
81
  * @csspart separator - The text `format` draws between two boxes.
57
82
  *
83
+ * @cssstate complete - Every box holds a character.
58
84
  * @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
59
85
  */
60
86
  export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
61
87
  protected readonly aria: AriaForwardController;
62
- /** @internal The element a missing name is checked on: the row of cells, so the name of one cell does not count as the name of the field. */
63
- protected get namedControl(): HTMLElement | null;
64
- /** Typed or dragged, so every edit is announced. See `announcesInput`. */
88
+ /** Typed or pasted, so every edit is announced. See `announcesInput`. */
65
89
  protected readonly announcesInput = true;
66
90
  /**
67
- * The autofill hint for the browser, set on the first box only.
68
- *
69
- * `one-time-code` is why this defaults to anything at all: it is the token
70
- * that lets a phone offer the code out of a message. Later cells stay `off`
71
- * for the reason in the class comment above, that six cells each offering
72
- * the same code is one offer made six times.
91
+ * The autofill hint for the browser. `one-time-code` is why this defaults to
92
+ * anything at all: it is the token that lets a phone offer the code out of a
93
+ * message.
73
94
  */
74
95
  autocomplete: string;
75
96
  /**
@@ -79,7 +100,17 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
79
100
  */
80
101
  autosubmit: boolean;
81
102
  /**
82
- * Accessible name for one box, with `{index}` and `{length}` filled in.
103
+ * How typed and pasted letters are cased: `upper`, `lower`, or `preserve`
104
+ * to keep them as typed. Web Awesome's OTP input takes the same `case`, for
105
+ * a code a service reads in one case.
106
+ */
107
+ case: PinCase;
108
+ /**
109
+ * The name each box once had, with `{index}` and `{length}` filled in.
110
+ *
111
+ * @deprecated No longer read. The boxes are drawn from one field, which is
112
+ * named by `label`, and a screen reader does not meet the boxes. Removed in
113
+ * the next breaking release.
83
114
  */
84
115
  cellLabel: string;
85
116
  /**
@@ -93,23 +124,23 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
93
124
  */
94
125
  length: number;
95
126
  /**
96
- * Whether the characters are hidden, the way a password is.
127
+ * Whether the characters are hidden, the way a password is. The field is a
128
+ * password field, and each filled box draws `mask-character`.
97
129
  */
98
130
  mask: boolean;
99
131
  /**
100
- * What an empty box shows, usually a single dot.
101
- *
102
- * The platform's own placeholder, on each cell, rather than a character
103
- * drawn behind the field: it clears the moment anything is typed, it is
104
- * already excluded from the accessible value, and it works the same under
105
- * `mask`, where the cell is a password input and a hand-drawn glyph would
106
- * have to know that.
107
- *
108
- * Empty by default, because a row of boxes already reads as a row of boxes.
132
+ * What a filled box draws under `mask`, in place of its character, as Web
133
+ * Awesome's `--mask-char`.
134
+ */
135
+ maskCharacter: string;
136
+ /**
137
+ * What an empty box shows, usually a single dot. It is not shown in the box
138
+ * the caret is in. Empty by default, because a row of boxes already reads as
139
+ * a row of boxes.
109
140
  */
110
141
  placeholder: string;
111
142
  /**
112
- * Whether the boxes block input. A read-only code still submits its value.
143
+ * Whether the field blocks input. A read-only code still submits its value.
113
144
  */
114
145
  readOnly: boolean;
115
146
  /**
@@ -135,51 +166,60 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
135
166
  *
136
167
  * **Not reflected**: nothing selects on it, so reflecting only writes
137
168
  * `type="numeric"` onto every `<helix-headless-pin-input>` ever rendered, an
138
- * attribute no consumer's markup had. The area rules carry the sentence
139
- * "reflect only what CSS selects on". The real inputs take it as a binding,
169
+ * attribute no consumer's markup had. The field takes it as `inputmode`,
140
170
  * which is what makes the keyboard follow.
141
171
  */
142
172
  type: PinType;
143
173
  /** Focus is delegated, so the host is never the focus target. */
144
174
  static shadowRootOptions: ShadowRootInit;
175
+ /**
176
+ * The box the caret is in while the field has focus, and -1 while it does
177
+ * not or while the field is read-only, where there is nothing to type into.
178
+ */
179
+ private active;
180
+ /** The box a press asked for, taken when the focus it starts arrives. */
181
+ private pressedAt;
145
182
  /** How many boxes there are, clamped once so every reader agrees. */
146
183
  private get count();
147
- private get cells();
148
- /** The code as characters, padded to the row so every box has one to show. */
149
- private get characters();
150
- /** Everything this box would accept, with the rest dropped. */
151
- private clean;
184
+ private get control();
185
+ /** The furthest box the caret can be in: after the code, and the last box at most. */
186
+ private get end();
187
+ /** The box the caret is drawn in, kept within the code a script may have shortened. */
188
+ private get caretBox();
152
189
  /**
153
- * Writes a run of characters from one box onward.
190
+ * Takes a code the field was edited to, and moves the caret to `caret`.
154
191
  *
155
192
  * The single path for typing, pasting and autofill alike, because they are
156
- * the same act at different lengths and splitting them is how the three
157
- * disagree about trimming, about the cursor, and about what happens at the
158
- * end.
193
+ * the same act at different lengths. Through `requestValue`, so a consumer
194
+ * who owns the code can refuse it, and a refused edit puts the field back.
159
195
  */
160
- private write;
196
+ private take;
161
197
  /**
162
- * Puts the value back into the boxes.
198
+ * Puts the field's selection on the box the caret is in: the character
199
+ * there, so typing replaces it, or the empty place after the code.
163
200
  *
164
- * The cells are uncontrolled between renders, because Lit will not rewrite an
165
- * input's `.value` when the bound string has not changed, and a refused
166
- * keystroke leaves the box holding a character the element rejected. This is
167
- * the same put-back `Input` does with `restoreValue`, once per box.
201
+ * Left alone while the reader holds a wider selection of their own, such as
202
+ * everything after Control+A, unless `force` says the caret moved.
168
203
  */
169
- private paint;
204
+ private placeCaret;
170
205
  private readonly handleInput;
206
+ /**
207
+ * A paste writes over the boxes from the caret on, rather than into the
208
+ * field's text, so a code pasted into box three of a full code replaces the
209
+ * characters there instead of pushing them along.
210
+ */
171
211
  private readonly handlePaste;
172
212
  /**
173
- * The keys that move between boxes, and the one that clears backwards.
174
- *
175
- * Backspace in an empty box goes back and clears the one it lands in, which
176
- * is what makes a code correctable without the reader hunting for the box
177
- * they meant. In a full box it does what it always does and is left alone.
213
+ * The keys that move between boxes. Backspace and Delete are the field's
214
+ * own: the selection on a filled box makes them remove its character, and
215
+ * the empty place after the code makes Backspace remove the one before.
178
216
  *
179
217
  * Home goes to the first box and End to the end of the code, the box after
180
218
  * its last character, which is where the caret goes in a single text field.
181
219
  */
182
220
  private readonly handleKeydown;
221
+ /** A press on a box puts the caret there, or after the code where the box is past it. */
222
+ private readonly handlePress;
183
223
  /**
184
224
  * The code as it stood when focus arrived, so a visit that changed nothing
185
225
  * says nothing.
@@ -196,72 +236,37 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
196
236
  * | types a character and deletes it | silent | silent | silent |
197
237
  *
198
238
  * One row differed and it is the one that matters: a consumer who assigns
199
- * `value` and then has a reader tab through the row was told the reader had
239
+ * `value` and then has a reader tab through the field was told the reader had
200
240
  * entered a code. `change` on a field means "the reader had a go at this",
201
241
  * `MixinField` treats it as exactly that, and announcing a value the consumer
202
242
  * set themselves is a false positive rather than the safe half of a trade.
203
243
  *
204
- * **The narrower divergence that is left** is a script assigning while the row
205
- * is focused, where the platform stays silent because no user edit happened
206
- * and this commits on the way out. Closing it needs a dirty flag set from real
207
- * cell input rather than a baseline, which is more machinery than the case has
208
- * earned: a consumer writing to a field the reader is inside is already in a
209
- * fight with them.
210
- *
211
244
  * Seeded in `firstUpdated`, a code in the markup being committed by whoever
212
- * wrote it, and re-taken on every arrival from outside the row.
245
+ * wrote it, and re-taken on every arrival.
213
246
  */
214
247
  private committed;
215
- /** Selecting on focus, so typing replaces rather than appending. */
248
+ /** Takes the baseline, and puts the caret in the box pressed or after the code. */
216
249
  private readonly handleFocus;
217
250
  /**
218
- * Whether focus is currently somewhere inside the row.
219
- *
220
- * **The arrival is a transition, not a `relatedTarget` reading**, which is
221
- * what the exit still does. `relatedTarget` does not work on the way in for
222
- * two reasons and the second decides it. Every character moves focus to the
223
- * next box, so an unguarded `focusin` re-baselines on each keystroke and the
224
- * row can never report anything: measured, the three commit specs went silent
225
- * at once. And `focusin` carries `relatedTarget` in a browser and not in
226
- * happy-dom, so a guard written on it holds in production and not in the
227
- * specs, which is the worse half. This flag needs neither: entering is
228
- * `focusin` while it is `false`, and nothing else is.
229
- */
230
- private within;
231
- /**
232
- * Takes the baseline when focus arrives from outside the row.
233
- *
234
- * The value at arrival is what the platform compares against, and the table
235
- * on `committed` is why.
236
- */
237
- private readonly handleFocusIn;
238
- /**
239
- * Commits when focus leaves the row.
251
+ * Commits when focus leaves the field.
240
252
  *
241
253
  * `change` is one of the two events `MixinField` reads as "the reader has had
242
254
  * a go at this", so without this a code that was never completed is never
243
255
  * `touched` and its own `tooShort` message cannot show: two boxes of four
244
- * filled and tabbed away from is answered with nothing at all. `Input` gets
245
- * this for free by relaying its control's own `change`; here the cells each
246
- * fire one, none of them means the code is entered, and neither does any
247
- * single one of them mean the reader has left.
248
- *
249
- * **Focus leaving the row, and not a cell.** Every character moves focus to
250
- * the next box, so a per-cell blur would commit on every keystroke, which is
251
- * the fault this exists to fix pointed the other way.
256
+ * filled and tabbed away from is answered with nothing at all.
252
257
  */
253
- private readonly handleFocusOut;
258
+ private readonly handleBlur;
254
259
  /**
255
260
  * Announces the code as entered, from whichever moment reached it first.
256
261
  *
257
262
  * **One writer, because the fact has two moments and only one meaning.** A
258
- * filled code and a row being left are both "the reader is done with this".
263
+ * filled code and a field being left are both "the reader is done with this".
259
264
  * Dispatching from either site directly is how a moment gets added that fires
260
265
  * without baselining.
261
266
  *
262
267
  * Silent when nothing moved since the baseline, which is what makes it safe
263
268
  * to call from both: completing a code that is already the committed one, or
264
- * leaving a row nobody edited, says nothing.
269
+ * leaving a field nobody edited, says nothing.
265
270
  *
266
271
  * `composed: false`, like the native event this stands in for. It is
267
272
  * dispatched on the host, so a consumer hears it.
@@ -283,20 +288,15 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
283
288
  * | typed `1234` | valid | valid |
284
289
  *
285
290
  * So `required` decides whether *nothing* is acceptable, and the length rule
286
- * applies to anything that is not nothing. That is the right split for a code
287
- * as well: two of four characters is not an optional code omitted, it is a
288
- * code got wrong, and submitting it would send a fragment. The gate on the
289
- * message is `touched` rather than `required`, which is what stops a reader
290
- * being told off before they have had a go.
291
- *
292
- * `execCommand('insertText')` is not enough to measure this: `tooShort`
293
- * applies only to a value the user edited, and the first run of the probe
294
- * reported every case valid because nothing had set that flag.
291
+ * applies to anything that is not nothing. Two of four characters is not an
292
+ * optional code omitted, it is a code got wrong, and submitting it would send
293
+ * a fragment. The gate on the message is `touched` rather than `required`,
294
+ * which is what stops a reader being told off before they have had a go.
295
295
  */
296
296
  private sync;
297
297
  /** Puts the caret in the first empty box. */
298
298
  focus(options?: FocusOptions): void;
299
- /** Empties every box and moves focus to the first. */
299
+ /** Empties every box and puts the caret in the first. */
300
300
  clear(): void;
301
301
  protected firstUpdated(changed: PropertyValues): void;
302
302
  protected updated(changed: PropertyValues): void;
@@ -309,6 +309,8 @@ export declare class HelixHeadlessPinInput extends HelixHeadlessPinInput_base {
309
309
  private readonly handleKeypress;
310
310
  /** @internal A single line of text counts against implicit submission. */
311
311
  protected get blocksImplicitSubmission(): boolean;
312
+ /** What one box draws: its character, the mask, the caret, or the placeholder. */
313
+ private renderBox;
312
314
  protected render(): TemplateResult;
313
315
  }
314
316
  declare global {
@@ -316,4 +318,3 @@ declare global {
316
318
  'helix-headless-pin-input': HelixHeadlessPinInput;
317
319
  }
318
320
  }
319
- export {};