@fusion.dev/helix-headless 0.143.0 → 0.145.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 (314) hide show
  1. package/custom-elements.json +16990 -1383
  2. package/dist/accordion/item/accordion-item.d.ts +48 -12
  3. package/dist/accordion/item/accordion-item.js +26 -5
  4. package/dist/accordion/root/accordion-root.d.ts +6 -0
  5. package/dist/accordion/root/accordion-root.js +7 -1
  6. package/dist/announcement/root/announcement-root.d.ts +21 -1
  7. package/dist/announcement/root/announcement-root.js +36 -1
  8. package/dist/app-header/root/app-header-root.d.ts +7 -0
  9. package/dist/app-header/root/app-header-root.js +5 -1
  10. package/dist/app-header/sectioning.d.ts +7 -0
  11. package/dist/app-header/sectioning.js +26 -0
  12. package/dist/area-chart/root/area-chart-root.d.ts +12 -4
  13. package/dist/area-chart/root/area-chart-root.js +24 -7
  14. package/dist/avatar/root/avatar-root.d.ts +14 -0
  15. package/dist/avatar/root/avatar-root.js +23 -9
  16. package/dist/badge/root/badge-root.d.ts +11 -7
  17. package/dist/badge/root/badge-root.js +1 -1
  18. package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
  19. package/dist/bar-chart/root/bar-chart-root.js +17 -10
  20. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
  21. package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
  22. package/dist/button/root/button-root.d.ts +47 -1
  23. package/dist/button/root/button-root.js +38 -4
  24. package/dist/callout/root/callout-root.d.ts +18 -1
  25. package/dist/callout/root/callout-root.js +15 -4
  26. package/dist/canvas/root/canvas-root.d.ts +38 -3
  27. package/dist/canvas/root/canvas-root.js +121 -40
  28. package/dist/card/root/card-root.d.ts +30 -1
  29. package/dist/card/root/card-root.js +38 -5
  30. package/dist/carousel/root/carousel-root.d.ts +90 -0
  31. package/dist/carousel/root/carousel-root.js +134 -12
  32. package/dist/chat/composer/chat-composer.d.ts +38 -6
  33. package/dist/chat/composer/chat-composer.js +42 -9
  34. package/dist/chat/message/chat-message.d.ts +32 -1
  35. package/dist/chat/message/chat-message.js +25 -9
  36. package/dist/chat/naming.d.ts +22 -0
  37. package/dist/chat/naming.js +12 -0
  38. package/dist/chat/relative-clock.d.ts +39 -0
  39. package/dist/chat/relative-clock.js +31 -0
  40. package/dist/chat/root/chat-root.d.ts +36 -0
  41. package/dist/chat/root/chat-root.js +24 -1
  42. package/dist/checkbox/root/checkbox-root.js +2 -0
  43. package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
  44. package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
  45. package/dist/code-block/lines.d.ts +13 -0
  46. package/dist/code-block/lines.js +2 -0
  47. package/dist/code-block/root/code-block-root.d.ts +38 -1
  48. package/dist/code-block/root/code-block-root.js +28 -7
  49. package/dist/color-input/root/color-input-root.d.ts +34 -1
  50. package/dist/color-input/root/color-input-root.js +23 -4
  51. package/dist/color-picker/channels.d.ts +26 -0
  52. package/dist/color-picker/channels.js +84 -0
  53. package/dist/color-picker/root/color-picker-root.d.ts +81 -5
  54. package/dist/color-picker/root/color-picker-root.js +103 -10
  55. package/dist/combobox/root/combobox-root.d.ts +38 -3
  56. package/dist/combobox/root/combobox-root.js +64 -2
  57. package/dist/command/root/command-root.d.ts +30 -4
  58. package/dist/command/root/command-root.js +33 -3
  59. package/dist/copy-button/from.d.ts +22 -0
  60. package/dist/copy-button/from.js +28 -0
  61. package/dist/copy-button/root/copy-button-root.d.ts +47 -1
  62. package/dist/copy-button/root/copy-button-root.js +44 -8
  63. package/dist/data-table/root/data-table-root.d.ts +150 -2
  64. package/dist/data-table/root/data-table-root.js +303 -29
  65. package/dist/data-table/tree.d.ts +40 -0
  66. package/dist/data-table/tree.js +55 -0
  67. package/dist/date-input/root/date-input-root.d.ts +73 -4
  68. package/dist/date-input/root/date-input-root.js +93 -43
  69. package/dist/date-picker/root/date-picker-root.d.ts +145 -1
  70. package/dist/date-picker/root/date-picker-root.js +239 -48
  71. package/dist/description-list/item/description-list-item.d.ts +17 -2
  72. package/dist/description-list/item/description-list-item.js +15 -2
  73. package/dist/description-list/root/description-list-root.d.ts +27 -1
  74. package/dist/description-list/root/description-list-root.js +26 -1
  75. package/dist/dialog/description.d.ts +9 -0
  76. package/dist/dialog/description.js +14 -0
  77. package/dist/dialog/root/dialog-root.d.ts +64 -1
  78. package/dist/dialog/root/dialog-root.js +49 -23
  79. package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
  80. package/dist/donut-chart/root/donut-chart-root.js +21 -6
  81. package/dist/drawer/root/drawer-root.d.ts +63 -2
  82. package/dist/drawer/root/drawer-root.js +95 -19
  83. package/dist/drawer/swipe-start.d.ts +9 -0
  84. package/dist/drawer/swipe-start.js +12 -0
  85. package/dist/drilldown/item/drilldown-item.d.ts +11 -6
  86. package/dist/drilldown/item/drilldown-item.js +8 -5
  87. package/dist/drilldown/root/drilldown-root.d.ts +11 -0
  88. package/dist/drilldown/root/drilldown-root.js +8 -3
  89. package/dist/element-events.generated.js +61 -13
  90. package/dist/empty/root/empty-root.d.ts +1 -1
  91. package/dist/file-input/root/file-input-root.d.ts +47 -0
  92. package/dist/file-input/root/file-input-root.js +60 -22
  93. package/dist/file-input/screen.d.ts +35 -0
  94. package/dist/file-input/screen.js +49 -0
  95. package/dist/filter-input/menu/filter-menu.d.ts +3 -0
  96. package/dist/filter-input/menu/filter-menu.js +8 -4
  97. package/dist/filter-input/root/filter-input-root.d.ts +38 -4
  98. package/dist/filter-input/root/filter-input-root.js +67 -3
  99. package/dist/filter-input/suggest.d.ts +17 -0
  100. package/dist/filter-input/suggest.js +23 -0
  101. package/dist/format-date/options.d.ts +33 -0
  102. package/dist/format-date/options.js +42 -0
  103. package/dist/format-date/root/format-date-root.d.ts +51 -0
  104. package/dist/format-date/root/format-date-root.js +58 -38
  105. package/dist/heatmap/root/heatmap-root.d.ts +23 -6
  106. package/dist/heatmap/root/heatmap-root.js +24 -13
  107. package/dist/icon/index.d.ts +2 -0
  108. package/dist/icon/index.js +2 -0
  109. package/dist/icon/registry.d.ts +37 -0
  110. package/dist/icon/registry.js +83 -0
  111. package/dist/icon/root/icon-root.d.ts +30 -4
  112. package/dist/icon/root/icon-root.js +41 -6
  113. package/dist/icon/root/index.d.ts +2 -0
  114. package/dist/icon/root/index.js +2 -0
  115. package/dist/icon/set.d.ts +1 -0
  116. package/dist/icon/set.js +3 -0
  117. package/dist/image/root/image-root.d.ts +14 -0
  118. package/dist/image/root/image-root.js +23 -2
  119. package/dist/input/root/input-root.d.ts +11 -0
  120. package/dist/input/root/input-root.js +16 -1
  121. package/dist/kbd/root/kbd-root.d.ts +20 -13
  122. package/dist/kbd/root/kbd-root.js +35 -37
  123. package/dist/kbd/shortcut.d.ts +18 -0
  124. package/dist/kbd/shortcut.js +35 -0
  125. package/dist/legend/hidden-series.d.ts +8 -0
  126. package/dist/legend/hidden-series.js +13 -0
  127. package/dist/legend/root/legend-root.d.ts +56 -0
  128. package/dist/legend/root/legend-root.js +54 -5
  129. package/dist/lightbox/item/lightbox-item.d.ts +15 -0
  130. package/dist/lightbox/item/lightbox-item.js +10 -1
  131. package/dist/lightbox/root/lightbox-root.d.ts +61 -1
  132. package/dist/lightbox/root/lightbox-root.js +94 -4
  133. package/dist/line-chart/root/line-chart-root.d.ts +11 -3
  134. package/dist/line-chart/root/line-chart-root.js +19 -5
  135. package/dist/list/item/list-item.d.ts +68 -1
  136. package/dist/list/item/list-item.js +66 -4
  137. package/dist/list/numbering.d.ts +14 -0
  138. package/dist/list/numbering.js +8 -0
  139. package/dist/list/root/list-root.d.ts +106 -9
  140. package/dist/list/root/list-root.js +189 -4
  141. package/dist/list/selection.d.ts +19 -0
  142. package/dist/list/selection.js +21 -0
  143. package/dist/listbox/root/listbox-root.d.ts +74 -3
  144. package/dist/listbox/root/listbox-root.js +86 -9
  145. package/dist/loader/busy.d.ts +17 -0
  146. package/dist/loader/busy.js +24 -0
  147. package/dist/loader/root/loader-root.d.ts +37 -0
  148. package/dist/loader/root/loader-root.js +52 -3
  149. package/dist/map/root/map-root.d.ts +6 -2
  150. package/dist/map/root/map-root.js +5 -2
  151. package/dist/megamenu/root/megamenu-root.d.ts +21 -0
  152. package/dist/megamenu/root/megamenu-root.js +16 -2
  153. package/dist/menu/index.d.ts +1 -0
  154. package/dist/menu/index.js +1 -0
  155. package/dist/menu/item/menu-item.d.ts +38 -11
  156. package/dist/menu/item/menu-item.js +33 -1
  157. package/dist/menu/root/menu-root.d.ts +25 -1
  158. package/dist/menu/root/menu-root.js +63 -6
  159. package/dist/menu/section/menu-section.d.ts +55 -0
  160. package/dist/menu/section/menu-section.js +60 -0
  161. package/dist/meter/root/meter-root.d.ts +7 -0
  162. package/dist/meter/root/meter-root.js +6 -3
  163. package/dist/navigation/root/navigation-root.d.ts +16 -1
  164. package/dist/navigation/root/navigation-root.js +27 -1
  165. package/dist/notifications/feed-keys.d.ts +10 -0
  166. package/dist/notifications/feed-keys.js +14 -0
  167. package/dist/notifications/notification/notification.d.ts +17 -0
  168. package/dist/notifications/notification/notification.js +21 -2
  169. package/dist/notifications/root/notifications-root.d.ts +60 -0
  170. package/dist/notifications/root/notifications-root.js +76 -1
  171. package/dist/number-input/root/number-input-root.d.ts +47 -0
  172. package/dist/number-input/root/number-input-root.js +58 -22
  173. package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
  174. package/dist/object-inspector/root/object-inspector-root.js +180 -80
  175. package/dist/object-inspector/rows.d.ts +57 -0
  176. package/dist/object-inspector/rows.js +86 -0
  177. package/dist/option/root/option-root.d.ts +54 -5
  178. package/dist/option/root/option-root.js +34 -5
  179. package/dist/outline/levels.d.ts +31 -0
  180. package/dist/outline/levels.js +23 -0
  181. package/dist/outline/root/outline-root.d.ts +68 -3
  182. package/dist/outline/root/outline-root.js +73 -8
  183. package/dist/pagination/size/pagination-size.d.ts +11 -2
  184. package/dist/pagination/size/pagination-size.js +19 -4
  185. package/dist/pin-input/format.d.ts +7 -0
  186. package/dist/pin-input/format.js +16 -0
  187. package/dist/pin-input/root/pin-input-root.d.ts +21 -0
  188. package/dist/pin-input/root/pin-input-root.js +29 -2
  189. package/dist/popover/root/popover-root.d.ts +62 -4
  190. package/dist/popover/root/popover-root.js +53 -5
  191. package/dist/progress/root/progress-root.d.ts +7 -0
  192. package/dist/progress/root/progress-root.js +9 -3
  193. package/dist/qr-code/export.d.ts +31 -0
  194. package/dist/qr-code/export.js +10 -0
  195. package/dist/qr-code/root/qr-code-root.d.ts +26 -0
  196. package/dist/qr-code/root/qr-code-root.js +49 -2
  197. package/dist/radio/group/radio-group.d.ts +17 -0
  198. package/dist/radio/group/radio-group.js +14 -1
  199. package/dist/rating/root/rating-root.d.ts +25 -0
  200. package/dist/rating/root/rating-root.js +46 -4
  201. package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
  202. package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
  203. package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
  204. package/dist/scroll-area/root/scroll-area-root.js +218 -3
  205. package/dist/scroll-area/scrollbar.d.ts +65 -0
  206. package/dist/scroll-area/scrollbar.js +24 -0
  207. package/dist/select/root/select-root.d.ts +24 -0
  208. package/dist/select/root/select-root.js +21 -7
  209. package/dist/skeleton/root/skeleton-root.d.ts +25 -0
  210. package/dist/skeleton/root/skeleton-root.js +17 -2
  211. package/dist/slider/root/slider-root.d.ts +39 -0
  212. package/dist/slider/root/slider-root.js +45 -9
  213. package/dist/splitter/root/splitter-root.d.ts +13 -0
  214. package/dist/splitter/root/splitter-root.js +20 -2
  215. package/dist/splitter/snap.d.ts +9 -0
  216. package/dist/splitter/snap.js +12 -0
  217. package/dist/stat/root/stat-root.d.ts +2 -0
  218. package/dist/stat/root/stat-root.js +1 -1
  219. package/dist/steps/reach.d.ts +15 -0
  220. package/dist/steps/reach.js +12 -0
  221. package/dist/steps/root/steps-root.d.ts +30 -0
  222. package/dist/steps/root/steps-root.js +53 -0
  223. package/dist/steps/step/step.d.ts +39 -2
  224. package/dist/steps/step/step.js +29 -7
  225. package/dist/switch/root/switch-root.d.ts +12 -2
  226. package/dist/switch/root/switch-root.js +6 -1
  227. package/dist/table/column/table-column.d.ts +11 -0
  228. package/dist/table/column/table-column.js +6 -1
  229. package/dist/table/root/table-root.d.ts +101 -0
  230. package/dist/table/root/table-root.js +166 -5
  231. package/dist/table/row/table-row.d.ts +47 -1
  232. package/dist/table/row/table-row.js +39 -2
  233. package/dist/tabs/panel/tab-panel.d.ts +9 -5
  234. package/dist/tabs/panel/tab-panel.js +3 -4
  235. package/dist/tabs/root/tabs-root.d.ts +25 -1
  236. package/dist/tabs/root/tabs-root.js +21 -3
  237. package/dist/tabs/tab/tab.d.ts +36 -4
  238. package/dist/tabs/tab/tab.js +46 -3
  239. package/dist/tag/group/tag-group.d.ts +107 -0
  240. package/dist/tag/group/tag-group.js +157 -0
  241. package/dist/tag/index.d.ts +1 -0
  242. package/dist/tag/index.js +1 -0
  243. package/dist/tag/root/tag-root.d.ts +60 -0
  244. package/dist/tag/root/tag-root.js +74 -18
  245. package/dist/tag/selection.d.ts +10 -0
  246. package/dist/tag/selection.js +12 -0
  247. package/dist/textarea/grow.d.ts +22 -0
  248. package/dist/textarea/grow.js +20 -0
  249. package/dist/textarea/root/textarea-root.d.ts +9 -0
  250. package/dist/textarea/root/textarea-root.js +9 -1
  251. package/dist/time-input/root/time-input-root.d.ts +44 -5
  252. package/dist/time-input/root/time-input-root.js +69 -39
  253. package/dist/time-picker/root/time-picker-root.d.ts +54 -8
  254. package/dist/time-picker/root/time-picker-root.js +121 -91
  255. package/dist/timeline/group/timeline-group.d.ts +46 -0
  256. package/dist/timeline/group/timeline-group.js +37 -0
  257. package/dist/timeline/index.d.ts +1 -0
  258. package/dist/timeline/index.js +1 -0
  259. package/dist/timeline/root/timeline-root.d.ts +10 -3
  260. package/dist/toast/hotkey.d.ts +22 -0
  261. package/dist/toast/hotkey.js +23 -0
  262. package/dist/toast/item/toast-item.d.ts +26 -18
  263. package/dist/toast/item/toast-item.js +55 -48
  264. package/dist/toast/root/toast-root.d.ts +42 -8
  265. package/dist/toast/root/toast-root.js +64 -4
  266. package/dist/toggle/group/toggle-group.d.ts +57 -15
  267. package/dist/toggle/group/toggle-group.js +69 -9
  268. package/dist/toggle/root/toggle-root.d.ts +12 -1
  269. package/dist/toggle/root/toggle-root.js +11 -3
  270. package/dist/toolbar/root/toolbar-root.d.ts +13 -0
  271. package/dist/toolbar/root/toolbar-root.js +15 -5
  272. package/dist/tooltip/focus-target.d.ts +6 -0
  273. package/dist/tooltip/focus-target.js +9 -0
  274. package/dist/tooltip/root/tooltip-root.d.ts +42 -17
  275. package/dist/tooltip/root/tooltip-root.js +50 -9
  276. package/dist/tour/naming.d.ts +30 -0
  277. package/dist/tour/naming.js +10 -0
  278. package/dist/tour/root/tour-root.d.ts +35 -0
  279. package/dist/tour/root/tour-root.js +56 -5
  280. package/dist/tour/stop/tour-stop.d.ts +53 -8
  281. package/dist/tour/stop/tour-stop.js +45 -15
  282. package/dist/tour/wait.d.ts +11 -0
  283. package/dist/tour/wait.js +19 -0
  284. package/dist/tree/item/tree-item.d.ts +54 -1
  285. package/dist/tree/item/tree-item.js +89 -20
  286. package/dist/tree/root/tree-root.d.ts +37 -0
  287. package/dist/tree/root/tree-root.js +51 -6
  288. package/dist/tree/selection.d.ts +24 -0
  289. package/dist/tree/selection.js +26 -0
  290. package/dist/trend/root/trend-root.d.ts +13 -0
  291. package/dist/trend/root/trend-root.js +14 -9
  292. package/dist/video/media-events.d.ts +49 -0
  293. package/dist/video/media-events.js +39 -0
  294. package/dist/video/root/video-root.d.ts +99 -13
  295. package/dist/video/root/video-root.js +84 -47
  296. package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
  297. package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
  298. package/dist/video-playlist/order.d.ts +41 -0
  299. package/dist/video-playlist/order.js +34 -0
  300. package/dist/video-playlist/root/video-playlist-root.d.ts +70 -2
  301. package/dist/video-playlist/root/video-playlist-root.js +60 -16
  302. package/dist/virtual-list/controls.d.ts +4 -0
  303. package/dist/virtual-list/controls.js +30 -0
  304. package/dist/virtual-list/fill.d.ts +30 -0
  305. package/dist/virtual-list/fill.js +39 -0
  306. package/dist/virtual-list/keys.d.ts +15 -0
  307. package/dist/virtual-list/keys.js +24 -0
  308. package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
  309. package/dist/virtual-list/root/virtual-list-root.js +175 -34
  310. package/lint.json +1 -1
  311. package/package.json +5 -5
  312. package/types/jsx.d.ts +8871 -1286
  313. package/types/svelte.d.ts +3 -0
  314. package/types/vue.d.ts +1918 -269
@@ -0,0 +1,55 @@
1
+ import { at } from '../table/column/table-column.js';
2
+ import { filter, parse, sort } from './root/order.js';
3
+ export const childrenOf = (row, field) => {
4
+ const value = at(row, field);
5
+ return Array.isArray(value) ? value : [];
6
+ };
7
+ export const grow = (rows, axes, { field, isOpen, query, spec, }) => {
8
+ const searching = query.trim() !== '';
9
+ const order = parse(spec);
10
+ const every = [];
11
+ const kept = new Set();
12
+ const seen = new Set();
13
+ const keep = (row) => {
14
+ if (seen.has(row)) {
15
+ return kept.has(row);
16
+ }
17
+ seen.add(row);
18
+ every.push(row);
19
+ let below = false;
20
+ for (const child of childrenOf(row, field)) {
21
+ below = keep(child) || below;
22
+ }
23
+ const stays = below || !searching || filter([row], query, axes).length > 0;
24
+ if (stays) {
25
+ kept.add(row);
26
+ }
27
+ return stays;
28
+ };
29
+ for (const row of rows) {
30
+ keep(row);
31
+ }
32
+ const placed = new Map();
33
+ const shown = [];
34
+ const lay = (level, depth, parent) => {
35
+ const siblings = sort(level.filter((row) => kept.has(row) && !placed.has(row)), order, axes);
36
+ for (const [index, row] of siblings.entries()) {
37
+ const children = childrenOf(row, field).filter((child) => kept.has(child));
38
+ const open = children.length > 0 && (searching || isOpen(row));
39
+ placed.set(row, {
40
+ branch: children.length > 0,
41
+ level: depth,
42
+ open,
43
+ parent,
44
+ position: index + 1,
45
+ siblings: siblings.length,
46
+ });
47
+ shown.push(row);
48
+ if (open) {
49
+ lay(children, depth + 1, row);
50
+ }
51
+ }
52
+ };
53
+ lay(rows, 1, undefined);
54
+ return { every, placed, rows: shown, total: every.length };
55
+ };
@@ -2,7 +2,7 @@ import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core'
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
3
  import '../../date-picker/index.js';
4
4
  import '../../tag/index.js';
5
- declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerValueInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinFieldInterface) & typeof HelixFormElement;
5
+ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinSegmentedFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerEditingInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinPickerFieldInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinTokensInterface) & (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 date, typed or picked from a calendar.
8
8
  *
@@ -17,9 +17,15 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
17
17
  * when you leave the field, as a text field does. A date picked from the
18
18
  * calendar sends both.
19
19
  *
20
- * The trigger opens the calendar with focus on the selected day, and Escape
21
- * closes it and returns focus to the field. Focusing the field opens the
22
- * calendar too, and Tab out of the field closes it again.
20
+ * The trigger and ArrowDown open the calendar with focus on the selected day,
21
+ * Tab moves between the calendar's controls without leaving it, and Escape
22
+ * closes it and returns focus to the field. A press into the field opens the
23
+ * calendar too. Tab into the field opens nothing, and Tab out of the field
24
+ * closes the calendar.
25
+ *
26
+ * With `segmented`, the field is a row of segments in place of the text: a
27
+ * month, a day and a year in the order the locale writes them, each set with
28
+ * digits or the arrow keys. Alt+Down opens the calendar from a segment.
23
29
  *
24
30
  * @since 0.1.0
25
31
  * @status stable
@@ -42,14 +48,17 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
42
48
  *
43
49
  * @csspart control - The text input.
44
50
  * @csspart date - One held date, as a tag, in `multiple`.
51
+ * @csspart date-cell - The tag's grid cell, which a tag draws only inside a tag group.
45
52
  * @csspart date-dismiss - The remove button, when `dismissible`.
46
53
  * @csspart date-dismiss-mark - The icon on the remove button, shown when no icon is slotted.
47
54
  * @csspart date-label - The label, trimmed to its capitals and baseline.
55
+ * @csspart date-link - The tag's link around its label, which a tag draws only with `href`.
48
56
  * @csspart date-start - The category before the label.
49
57
  * @csspart feedback - The error message under the field.
50
58
  * @csspart field - The box that holds the text and the trigger.
51
59
  * @csspart hint - The help text under the field, shown while there is no error.
52
60
  * @csspart label - The label above the field.
61
+ * @csspart literal - The text the locale writes between two segments, such as a slash, in `segmented`.
53
62
  * @csspart picker - The date picker inside the panel.
54
63
  * @csspart picker-cell - One cell in a row of days. A range colors these cells.
55
64
  * @csspart picker-cell-range-end - The cell of a range's last day. Applied with `picker-cell`.
@@ -63,15 +72,25 @@ declare const HelixHeadlessDateInput_base: (new (...args: any[]) => import("@fus
63
72
  * @csspart picker-grid - The grid of days.
64
73
  * @csspart picker-header - The month name and its controls.
65
74
  * @csspart picker-heading - The month and year being shown.
75
+ * @csspart picker-heading-button - The calendar's heading as a button that shows the months or the years, where `max-view` is set.
66
76
  * @csspart picker-month - One month, with its header and its grid.
67
77
  * @csspart picker-months - The row of months.
68
78
  * @csspart picker-next - The control that moves to the next month.
69
79
  * @csspart picker-next-mark - The icon on the next month control.
80
+ * @csspart picker-period - One month or one year, in the calendar's months and years views.
81
+ * @csspart picker-period-current - This month or this year, beside `picker-period`.
82
+ * @csspart picker-period-disabled - A month or a year wholly outside `min` and `max`, beside `picker-period`.
83
+ * @csspart picker-period-row - One row of three months or years.
84
+ * @csspart picker-period-selected - The month or the year on show, beside `picker-period`.
85
+ * @csspart picker-periods - The grid of months or years.
70
86
  * @csspart picker-previous - The control that moves to the previous month.
71
87
  * @csspart picker-previous-mark - The icon on the previous month control.
72
88
  * @csspart picker-week - One row of days.
73
89
  * @csspart picker-weekday - A column header naming a day of the week.
74
90
  * @csspart rest - The count of dates beyond the ones shown. It is a `<button>` with `expandable` and a `<span>` without it.
91
+ * @csspart segment - One part of the date, a year, a month or a day, in `segmented`.
92
+ * @csspart segment-placeholder - A segment with nothing in it yet. Applied with `segment`.
93
+ * @csspart segments - The row of segments that holds the date, in `segmented`.
75
94
  * @csspart surface - The floating panel.
76
95
  * @csspart tags - The row the dates sit in.
77
96
  * @csspart trigger - The control that opens the calendar.
@@ -121,6 +140,12 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
121
140
  * submits and what `min` and `max` compare against.
122
141
  */
123
142
  dateStyle: 'full' | 'iso' | 'long' | 'medium' | 'short';
143
+ /**
144
+ * What each day in the calendar shows, in place of its number: a function
145
+ * given the date as `YYYY-MM-DD`. Handed to the calendar; see Date Picker's
146
+ * `dayContent`.
147
+ */
148
+ dayContent?: ((date: string) => unknown) | undefined;
124
149
  /**
125
150
  * Dates that cannot be chosen, as `YYYY-MM-DD`, separated by commas or
126
151
  * spaces.
@@ -139,6 +164,12 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
139
164
  * and is Sunday otherwise.
140
165
  */
141
166
  firstDayOfWeek?: number;
167
+ /**
168
+ * A rule for which dates cannot be chosen: a function given the date as
169
+ * `YYYY-MM-DD` that returns `true` to bar it. The calendar offers such a date
170
+ * as unavailable, and a typed one is invalid, as with `disable-dates`.
171
+ */
172
+ isDateUnavailable?: ((date: string) => boolean) | undefined;
142
173
  /**
143
174
  * The language tag for the names of months and days in the calendar.
144
175
  */
@@ -147,6 +178,11 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
147
178
  * The latest date that can be chosen, as `YYYY-MM-DD`.
148
179
  */
149
180
  max: string;
181
+ /**
182
+ * How far the calendar's heading steps back from the days: `month` or
183
+ * `year`. Handed to the calendar; see Date Picker's `max-view`.
184
+ */
185
+ maxView?: 'month' | 'year';
150
186
  /**
151
187
  * The earliest date that can be chosen, as `YYYY-MM-DD`.
152
188
  */
@@ -200,10 +236,23 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
200
236
  */
201
237
  protected placed(room: number | undefined): void;
202
238
  protected willUpdate(changed: PropertyValues): void;
239
+ /**
240
+ * The name of the calendar's heading where it shows the months, with
241
+ * `{heading}` filled in.
242
+ */
243
+ monthViewLabel: string;
203
244
  /**
204
245
  * The name of the calendar's control that moves to the next month.
205
246
  */
206
247
  nextLabel: string;
248
+ /**
249
+ * The name of the calendar's control that moves forward a year.
250
+ */
251
+ nextYearLabel: string;
252
+ /**
253
+ * The name of the calendar's control that moves forward a page of years.
254
+ */
255
+ nextYearsLabel: string;
207
256
  /**
208
257
  * The text the field shows before a date is entered.
209
258
  */
@@ -212,6 +261,14 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
212
261
  * The name of the calendar's control that moves to the previous month.
213
262
  */
214
263
  previousLabel: string;
264
+ /**
265
+ * The name of the calendar's control that moves back a year.
266
+ */
267
+ previousYearLabel: string;
268
+ /**
269
+ * The name of the calendar's control that moves back a page of years.
270
+ */
271
+ previousYearsLabel: string;
215
272
  /**
216
273
  * The message shown when a range holds more than two dates.
217
274
  *
@@ -264,6 +321,13 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
264
321
  * complete.
265
322
  */
266
323
  private get picked();
324
+ /**
325
+ * Segments hold one date, so `range` and `multiple` keep the line of text,
326
+ * whose separators and tags are how those modes write several.
327
+ */
328
+ protected get segmentable(): boolean;
329
+ protected get segmentedKind(): 'date';
330
+ protected get segmentLocale(): string;
267
331
  /** One date, written the way `dateStyle` asks for. */
268
332
  private written;
269
333
  protected get display(): string;
@@ -296,6 +360,11 @@ export declare class HelixHeadlessDateInput extends HelixHeadlessDateInput_base
296
360
  * The message shown when `disable-dates` or `disable-days` bars a date.
297
361
  */
298
362
  unavailableMessage?: string;
363
+ /**
364
+ * The name of the calendar's heading where it shows a page of years, with
365
+ * `{heading}` filled in.
366
+ */
367
+ yearViewLabel: string;
299
368
  /**
300
369
  * The calendar the field opens, behind a seam the styled tier can move.
301
370
  *
@@ -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 { AriaForwardController, valueAsDate as asDate, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinTokens, writtenList, } from '@fusion.dev/helix-core';
7
+ import { AriaForwardController, valueAsDate as asDate, barredBy, customElement, fillTemplate, dateAsValue as fromDate, HelixFormElement, isDateValue, MixinControllerOpen, MixinControllerValue, MixinField, MixinPickerEditing, MixinPickerField, MixinSegmentedField, MixinTokens, } from '@fusion.dev/helix-core';
8
8
  import { calendarBlank } from '@fusion.dev/helix-icons';
9
9
  import { nothing } from 'lit';
10
10
  import { property, state } from 'lit/decorators.js';
@@ -17,11 +17,11 @@ const dates = (value) => value
17
17
  .split(',')
18
18
  .map((one) => one.trim())
19
19
  .filter(Boolean);
20
- let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement)))))) {
20
+ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinSegmentedField(MixinPickerEditing(MixinPickerField(MixinControllerOpen(MixinTokens(MixinControllerValue(MixinField(HelixFormElement))))))) {
21
21
  constructor() {
22
22
  super(...arguments);
23
23
  this.aria = new AriaForwardController(this, {
24
- target: () => this.partNamed('control'),
24
+ target: () => this.partNamed('control') ?? this.segmentGroup,
25
25
  });
26
26
  this.autocomplete = '';
27
27
  this.calendarLabel = 'Date Picker';
@@ -35,9 +35,14 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
35
35
  this.months = 1;
36
36
  this.fitted = undefined;
37
37
  this.wide = undefined;
38
+ this.monthViewLabel = '{heading}. Choose a month';
38
39
  this.nextLabel = 'Next month';
40
+ this.nextYearLabel = 'Next year';
41
+ this.nextYearsLabel = 'Later years';
39
42
  this.placeholder = 'YYYY-MM-DD';
40
43
  this.previousLabel = 'Previous month';
44
+ this.previousYearLabel = 'Previous year';
45
+ this.previousYearsLabel = 'Earlier years';
41
46
  this.removeLabel = 'Remove {name}';
42
47
  this.step = 1;
43
48
  this.triggerLabel = 'Choose a date';
@@ -90,6 +95,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
90
95
  this.updateComplete.then(() => this.returnFocus());
91
96
  }
92
97
  };
98
+ this.yearViewLabel = '{heading}. Choose a year';
93
99
  this.handleIconChange = () => {
94
100
  this.requestUpdate();
95
101
  };
@@ -119,6 +125,15 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
119
125
  const held = dates(this.value);
120
126
  return held.length > 0 && held.every(isDateValue) ? held.join(',') : '';
121
127
  }
128
+ get segmentable() {
129
+ return this.mode === undefined;
130
+ }
131
+ get segmentedKind() {
132
+ return 'date';
133
+ }
134
+ get segmentLocale() {
135
+ return this.locale;
136
+ }
122
137
  written(date) {
123
138
  if (this.dateStyle === 'iso' || !isDateValue(date)) {
124
139
  return date;
@@ -170,21 +185,15 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
170
185
  max: this.written(this.max),
171
186
  });
172
187
  }
173
- const days = writtenList(this.disableDays);
174
- const listed = writtenList(this.disableDates);
175
- if (held.some((one) => listed.includes(one) || days.includes(String(asDate(one)?.getUTCDay() ?? '')))) {
188
+ const why = held.map((one) => {
189
+ const date = asDate(one);
190
+ return date ? barredBy(date, this) : null;
191
+ });
192
+ if (why.includes('listed')) {
176
193
  return this.unavailableMessage || 'Choose a date that is available.';
177
194
  }
178
- const step = Math.max(1, Math.floor(this.step) || 1);
179
- if (step > 1) {
180
- const base = asDate(this.min)?.getTime() ?? 0;
181
- const off = held.some((one) => {
182
- const at = asDate(one)?.getTime();
183
- return at !== undefined && Math.round((at - base) / 86_400_000) % step !== 0;
184
- });
185
- if (off) {
186
- return this.stepMismatchMessage || 'Choose one of the dates the calendar offers.';
187
- }
195
+ if (why.includes('step')) {
196
+ return this.stepMismatchMessage || 'Choose one of the dates the calendar offers.';
188
197
  }
189
198
  if (this.mode === 'range' && held.length > 2) {
190
199
  return this.rangeLengthMessage || 'A range is two dates.';
@@ -198,9 +207,12 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
198
207
  cell-range-middle: picker-cell-range-middle, cell-range-start: picker-cell-range-start,
199
208
  day: picker-day, day-disabled: picker-day-disabled, day-outside: picker-day-outside,
200
209
  day-selected: picker-day-selected, day-today: picker-day-today, grid: picker-grid,
201
- header: picker-header, heading: picker-heading, month: picker-month, months: picker-months,
202
- next: picker-next,
203
- next-mark: picker-next-mark, previous: picker-previous, previous-mark: picker-previous-mark,
210
+ header: picker-header, heading: picker-heading, heading-button: picker-heading-button,
211
+ month: picker-month, months: picker-months, next: picker-next,
212
+ next-mark: picker-next-mark, period: picker-period, period-current: picker-period-current,
213
+ period-disabled: picker-period-disabled, period-row: picker-period-row,
214
+ period-selected: picker-period-selected, periods: picker-periods,
215
+ previous: picker-previous, previous-mark: picker-previous-mark,
204
216
  week: picker-week, weekday: picker-weekday"
205
217
  ?invalid=${this.resolvedFeedback !== ''}
206
218
  mode=${this.mode ?? nothing}
@@ -212,10 +224,19 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
212
224
  label=${this.calendarLabel}
213
225
  locale=${this.locale || nothing}
214
226
  max=${this.max || nothing}
227
+ max-view=${this.maxView ?? nothing}
215
228
  min=${this.min || nothing}
229
+ month-view-label=${this.monthViewLabel}
216
230
  next-label=${this.nextLabel}
231
+ next-year-label=${this.nextYearLabel}
232
+ next-years-label=${this.nextYearsLabel}
217
233
  previous-label=${this.previousLabel}
234
+ previous-year-label=${this.previousYearLabel}
235
+ previous-years-label=${this.previousYearsLabel}
218
236
  step=${this.step}
237
+ year-view-label=${this.yearViewLabel}
238
+ .dayContent=${this.dayContent}
239
+ .isDateUnavailable=${this.isDateUnavailable}
219
240
  @helix-before-change=${this.handleCalendarChange}
220
241
  @change=${this.stopInner}
221
242
  @input=${this.stopInner}
@@ -235,7 +256,7 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
235
256
  renderTag(date) {
236
257
  return html `<${this.tag('tag')}
237
258
  part="date"
238
- exportparts="dismiss: date-dismiss, dismiss-mark: date-dismiss-mark, label: date-label, start: date-start"
259
+ exportparts="cell: date-cell, dismiss: date-dismiss, dismiss-mark: date-dismiss-mark, label: date-label, link: date-link, start: date-start"
239
260
  dismissible
240
261
  dismiss-label=${fillTemplate(this.removeLabel, { name: this.written(date) })}
241
262
  ?disabled=${this.isDisabled}
@@ -257,29 +278,31 @@ let HelixHeadlessDateInput = class HelixHeadlessDateInput extends MixinPickerEdi
257
278
  ${this.mode === 'multiple'
258
279
  ? this.renderTokenRow(this.shownDates.map((date) => this.renderTag(date)), this.restCount)
259
280
  : nothing}
260
- <input
261
- part="control"
262
- id=${this.controlId}
263
- type="text"
264
- .value=${this.display}
265
- name=${this.name || nothing}
266
- placeholder=${this.mode === 'multiple' && dates(this.value).length > 0
267
- ? nothing
268
- : this.placeholder || nothing}
269
- autocomplete=${this.autocomplete || nothing}
270
- inputmode="numeric"
271
- aria-describedby=${this.describedBy ?? nothing}
272
- aria-invalid=${this.invalidity ?? nothing}
273
- ?disabled=${this.isDisabled}
274
- ?readonly=${this.readOnly}
275
- ?required=${this.required}
276
- @blur=${this.handleBlur}
277
- @change=${this.handleCommit}
278
- @focus=${this.handleFocus}
279
- @input=${this.handleInput}
280
- @keydown=${this.handleDraftKey}
281
- @keypress=${this.handleKeypress}
282
- />
281
+ ${this.segmentsShown
282
+ ? this.renderSegments()
283
+ : html `<input
284
+ part="control"
285
+ id=${this.controlId}
286
+ type="text"
287
+ .value=${this.display}
288
+ name=${this.name || nothing}
289
+ placeholder=${this.mode === 'multiple' && dates(this.value).length > 0
290
+ ? nothing
291
+ : this.placeholder || nothing}
292
+ autocomplete=${this.autocomplete || nothing}
293
+ inputmode="numeric"
294
+ aria-describedby=${this.describedBy ?? nothing}
295
+ aria-invalid=${this.invalidity ?? nothing}
296
+ ?disabled=${this.isDisabled}
297
+ ?readonly=${this.readOnly}
298
+ ?required=${this.required}
299
+ @blur=${this.handleBlur}
300
+ @change=${this.handleCommit}
301
+ @focus=${this.handleFocus}
302
+ @input=${this.handleInput}
303
+ @keydown=${this.handleDraftKey}
304
+ @keypress=${this.handleKeypress}
305
+ />`}
283
306
  <button
284
307
  part="trigger"
285
308
  type="button"
@@ -330,6 +353,9 @@ __decorate([
330
353
  __decorate([
331
354
  property({ attribute: 'date-style' })
332
355
  ], HelixHeadlessDateInput.prototype, "dateStyle", void 0);
356
+ __decorate([
357
+ property({ attribute: false })
358
+ ], HelixHeadlessDateInput.prototype, "dayContent", void 0);
333
359
  __decorate([
334
360
  property({ attribute: 'disable-dates' })
335
361
  ], HelixHeadlessDateInput.prototype, "disableDates", void 0);
@@ -339,12 +365,18 @@ __decorate([
339
365
  __decorate([
340
366
  property({ attribute: 'first-day-of-week', type: Number })
341
367
  ], HelixHeadlessDateInput.prototype, "firstDayOfWeek", void 0);
368
+ __decorate([
369
+ property({ attribute: false })
370
+ ], HelixHeadlessDateInput.prototype, "isDateUnavailable", void 0);
342
371
  __decorate([
343
372
  property()
344
373
  ], HelixHeadlessDateInput.prototype, "locale", void 0);
345
374
  __decorate([
346
375
  property()
347
376
  ], HelixHeadlessDateInput.prototype, "max", void 0);
377
+ __decorate([
378
+ property({ attribute: 'max-view' })
379
+ ], HelixHeadlessDateInput.prototype, "maxView", void 0);
348
380
  __decorate([
349
381
  property()
350
382
  ], HelixHeadlessDateInput.prototype, "min", void 0);
@@ -357,15 +389,30 @@ __decorate([
357
389
  __decorate([
358
390
  state()
359
391
  ], HelixHeadlessDateInput.prototype, "fitted", void 0);
392
+ __decorate([
393
+ property({ attribute: 'month-view-label' })
394
+ ], HelixHeadlessDateInput.prototype, "monthViewLabel", void 0);
360
395
  __decorate([
361
396
  property({ attribute: 'next-label' })
362
397
  ], HelixHeadlessDateInput.prototype, "nextLabel", void 0);
398
+ __decorate([
399
+ property({ attribute: 'next-year-label' })
400
+ ], HelixHeadlessDateInput.prototype, "nextYearLabel", void 0);
401
+ __decorate([
402
+ property({ attribute: 'next-years-label' })
403
+ ], HelixHeadlessDateInput.prototype, "nextYearsLabel", void 0);
363
404
  __decorate([
364
405
  property()
365
406
  ], HelixHeadlessDateInput.prototype, "placeholder", void 0);
366
407
  __decorate([
367
408
  property({ attribute: 'previous-label' })
368
409
  ], HelixHeadlessDateInput.prototype, "previousLabel", void 0);
410
+ __decorate([
411
+ property({ attribute: 'previous-year-label' })
412
+ ], HelixHeadlessDateInput.prototype, "previousYearLabel", void 0);
413
+ __decorate([
414
+ property({ attribute: 'previous-years-label' })
415
+ ], HelixHeadlessDateInput.prototype, "previousYearsLabel", void 0);
369
416
  __decorate([
370
417
  property({ attribute: 'range-length-message' })
371
418
  ], HelixHeadlessDateInput.prototype, "rangeLengthMessage", void 0);
@@ -393,6 +440,9 @@ __decorate([
393
440
  __decorate([
394
441
  property({ attribute: 'unavailable-message' })
395
442
  ], HelixHeadlessDateInput.prototype, "unavailableMessage", void 0);
443
+ __decorate([
444
+ property({ attribute: 'year-view-label' })
445
+ ], HelixHeadlessDateInput.prototype, "yearViewLabel", void 0);
396
446
  HelixHeadlessDateInput = __decorate([
397
447
  customElement('helix-headless-date-input')
398
448
  ], HelixHeadlessDateInput);