@fusion.dev/helix-headless 0.142.1 → 0.144.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 (285) hide show
  1. package/custom-elements.json +25381 -1202
  2. package/dist/accordion/item/accordion-item.d.ts +38 -2
  3. package/dist/accordion/item/accordion-item.js +38 -6
  4. package/dist/accordion/root/accordion-root.d.ts +23 -1
  5. package/dist/accordion/root/accordion-root.js +39 -3
  6. package/dist/announcement/root/announcement-root.d.ts +11 -7
  7. package/dist/announcement/root/announcement-root.js +1 -1
  8. package/dist/app-header/root/app-header-root.d.ts +21 -0
  9. package/dist/app-header/root/app-header-root.js +31 -5
  10. package/dist/area-chart/root/area-chart-root.d.ts +12 -4
  11. package/dist/area-chart/root/area-chart-root.js +39 -11
  12. package/dist/avatar/group/avatar-group.d.ts +24 -3
  13. package/dist/avatar/group/avatar-group.js +34 -2
  14. package/dist/avatar/root/avatar-root.d.ts +17 -1
  15. package/dist/avatar/root/avatar-root.js +31 -10
  16. package/dist/badge/root/badge-root.d.ts +12 -0
  17. package/dist/badge/root/badge-root.js +1 -1
  18. package/dist/bar-chart/root/bar-chart-root.d.ts +30 -5
  19. package/dist/bar-chart/root/bar-chart-root.js +58 -21
  20. package/dist/blockquote/root/blockquote-root.d.ts +12 -7
  21. package/dist/blockquote/root/blockquote-root.js +6 -4
  22. package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -3
  23. package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -1
  24. package/dist/button/root/button-root.d.ts +84 -1
  25. package/dist/button/root/button-root.js +81 -3
  26. package/dist/callout/root/callout-root.d.ts +32 -6
  27. package/dist/callout/root/callout-root.js +26 -7
  28. package/dist/canvas/root/canvas-root.d.ts +1 -0
  29. package/dist/canvas/root/canvas-root.js +10 -1
  30. package/dist/card/root/card-root.d.ts +30 -1
  31. package/dist/card/root/card-root.js +38 -5
  32. package/dist/carousel/root/carousel-root.d.ts +47 -5
  33. package/dist/carousel/root/carousel-root.js +53 -21
  34. package/dist/chat/composer/chat-composer.d.ts +13 -11
  35. package/dist/chat/composer/chat-composer.js +6 -12
  36. package/dist/chat/message/chat-message.js +8 -1
  37. package/dist/chat/root/chat-root.d.ts +1 -0
  38. package/dist/chat/root/chat-root.js +2 -1
  39. package/dist/checkbox/root/checkbox-root.d.ts +7 -0
  40. package/dist/checkbox/root/checkbox-root.js +9 -3
  41. package/dist/checkbox-group/root/checkbox-group-root.d.ts +116 -33
  42. package/dist/checkbox-group/root/checkbox-group-root.js +141 -44
  43. package/dist/code/root/code-root.d.ts +1 -1
  44. package/dist/code-block/lines.d.ts +13 -0
  45. package/dist/code-block/lines.js +2 -0
  46. package/dist/code-block/root/code-block-root.d.ts +49 -0
  47. package/dist/code-block/root/code-block-root.js +44 -3
  48. package/dist/color-input/root/color-input-root.d.ts +60 -2
  49. package/dist/color-input/root/color-input-root.js +55 -7
  50. package/dist/color-picker/channels.d.ts +26 -0
  51. package/dist/color-picker/channels.js +84 -0
  52. package/dist/color-picker/root/color-picker-root.d.ts +118 -12
  53. package/dist/color-picker/root/color-picker-root.js +183 -13
  54. package/dist/combobox/root/combobox-root.d.ts +126 -3
  55. package/dist/combobox/root/combobox-root.js +224 -21
  56. package/dist/command/root/command-root.d.ts +47 -10
  57. package/dist/command/root/command-root.js +45 -4
  58. package/dist/copy-button/from.d.ts +22 -0
  59. package/dist/copy-button/from.js +28 -0
  60. package/dist/copy-button/root/copy-button-root.d.ts +48 -7
  61. package/dist/copy-button/root/copy-button-root.js +54 -8
  62. package/dist/data-table/root/data-table-root.d.ts +164 -10
  63. package/dist/data-table/root/data-table-root.js +488 -57
  64. package/dist/date-input/root/date-input-root.d.ts +123 -9
  65. package/dist/date-input/root/date-input-root.js +147 -45
  66. package/dist/date-picker/root/date-picker-root.d.ts +229 -18
  67. package/dist/date-picker/root/date-picker-root.js +342 -46
  68. package/dist/dialog/description.d.ts +9 -0
  69. package/dist/dialog/description.js +14 -0
  70. package/dist/dialog/root/dialog-root.d.ts +101 -10
  71. package/dist/dialog/root/dialog-root.js +83 -4
  72. package/dist/donut-chart/root/donut-chart-root.d.ts +61 -16
  73. package/dist/donut-chart/root/donut-chart-root.js +48 -13
  74. package/dist/drawer/root/drawer-root.d.ts +93 -7
  75. package/dist/drawer/root/drawer-root.js +126 -5
  76. package/dist/drawer/swipe-start.d.ts +9 -0
  77. package/dist/drawer/swipe-start.js +12 -0
  78. package/dist/drilldown/item/drilldown-item.d.ts +16 -13
  79. package/dist/drilldown/item/drilldown-item.js +6 -2
  80. package/dist/drilldown/root/drilldown-root.d.ts +21 -5
  81. package/dist/drilldown/root/drilldown-root.js +26 -10
  82. package/dist/element-events.generated.js +42 -13
  83. package/dist/empty/root/empty-root.d.ts +1 -1
  84. package/dist/file-input/root/file-input-root.d.ts +65 -1
  85. package/dist/file-input/root/file-input-root.js +76 -12
  86. package/dist/file-input/screen.d.ts +35 -0
  87. package/dist/file-input/screen.js +49 -0
  88. package/dist/filter-input/menu/filter-menu.d.ts +9 -0
  89. package/dist/filter-input/menu/filter-menu.js +8 -0
  90. package/dist/filter-input/root/filter-input-root.d.ts +43 -6
  91. package/dist/filter-input/root/filter-input-root.js +89 -10
  92. package/dist/filter-input/suggest.d.ts +17 -0
  93. package/dist/filter-input/suggest.js +23 -0
  94. package/dist/format-date/options.d.ts +33 -0
  95. package/dist/format-date/options.js +42 -0
  96. package/dist/format-date/root/format-date-root.d.ts +62 -3
  97. package/dist/format-date/root/format-date-root.js +78 -37
  98. package/dist/graph/root/graph-root.d.ts +24 -3
  99. package/dist/graph/root/graph-root.js +66 -12
  100. package/dist/heatmap/root/buckets.d.ts +2 -1
  101. package/dist/heatmap/root/buckets.js +5 -1
  102. package/dist/heatmap/root/heatmap-root.d.ts +47 -9
  103. package/dist/heatmap/root/heatmap-root.js +46 -18
  104. package/dist/icon/index.d.ts +2 -0
  105. package/dist/icon/index.js +2 -0
  106. package/dist/icon/registry.d.ts +37 -0
  107. package/dist/icon/registry.js +83 -0
  108. package/dist/icon/root/icon-root.d.ts +53 -6
  109. package/dist/icon/root/icon-root.js +72 -4
  110. package/dist/icon/root/index.d.ts +2 -0
  111. package/dist/icon/root/index.js +2 -0
  112. package/dist/icon/set.d.ts +1 -0
  113. package/dist/icon/set.js +3 -0
  114. package/dist/icon-button/root/icon-button-root.d.ts +1 -1
  115. package/dist/image/root/image-root.d.ts +23 -2
  116. package/dist/image/root/image-root.js +23 -4
  117. package/dist/input/root/input-root.d.ts +62 -9
  118. package/dist/input/root/input-root.js +61 -5
  119. package/dist/kbd/root/kbd-root.d.ts +26 -11
  120. package/dist/kbd/root/kbd-root.js +35 -38
  121. package/dist/kbd/shortcut.d.ts +18 -0
  122. package/dist/kbd/shortcut.js +35 -0
  123. package/dist/legend/hidden-series.d.ts +8 -0
  124. package/dist/legend/hidden-series.js +13 -0
  125. package/dist/legend/root/legend-root.d.ts +63 -0
  126. package/dist/legend/root/legend-root.js +61 -7
  127. package/dist/lightbox/item/lightbox-item.d.ts +17 -1
  128. package/dist/lightbox/item/lightbox-item.js +10 -1
  129. package/dist/lightbox/root/lightbox-root.d.ts +77 -6
  130. package/dist/lightbox/root/lightbox-root.js +116 -5
  131. package/dist/line-chart/root/line-chart-root.d.ts +29 -4
  132. package/dist/line-chart/root/line-chart-root.js +58 -17
  133. package/dist/list/item/list-item.d.ts +11 -5
  134. package/dist/list/item/list-item.js +5 -6
  135. package/dist/listbox/range.d.ts +17 -0
  136. package/dist/listbox/range.js +5 -0
  137. package/dist/listbox/root/listbox-root.d.ts +184 -4
  138. package/dist/listbox/root/listbox-root.js +229 -23
  139. package/dist/loader/busy.d.ts +17 -0
  140. package/dist/loader/busy.js +24 -0
  141. package/dist/loader/root/loader-root.d.ts +37 -0
  142. package/dist/loader/root/loader-root.js +52 -3
  143. package/dist/map/root/map-root.d.ts +19 -4
  144. package/dist/map/root/map-root.js +36 -7
  145. package/dist/megamenu/root/megamenu-root.d.ts +10 -1
  146. package/dist/megamenu/root/megamenu-root.js +10 -1
  147. package/dist/menu/item/menu-item.d.ts +41 -12
  148. package/dist/menu/item/menu-item.js +46 -3
  149. package/dist/menu/root/menu-root.d.ts +32 -2
  150. package/dist/menu/root/menu-root.js +48 -8
  151. package/dist/meter/root/meter-root.d.ts +13 -0
  152. package/dist/meter/root/meter-root.js +24 -5
  153. package/dist/navigation/root/navigation-root.d.ts +10 -2
  154. package/dist/navigation/root/navigation-root.js +13 -2
  155. package/dist/notifications/feed-keys.d.ts +10 -0
  156. package/dist/notifications/feed-keys.js +14 -0
  157. package/dist/notifications/group/notification-group.d.ts +1 -0
  158. package/dist/notifications/notification/notification.d.ts +29 -0
  159. package/dist/notifications/notification/notification.js +51 -3
  160. package/dist/notifications/root/notifications-root.d.ts +49 -0
  161. package/dist/notifications/root/notifications-root.js +76 -2
  162. package/dist/number-input/root/number-input-root.d.ts +109 -7
  163. package/dist/number-input/root/number-input-root.js +109 -21
  164. package/dist/object-inspector/root/object-inspector-root.d.ts +49 -5
  165. package/dist/object-inspector/root/object-inspector-root.js +92 -12
  166. package/dist/option/root/option-root.d.ts +58 -6
  167. package/dist/option/root/option-root.js +35 -5
  168. package/dist/outline/root/outline-root.d.ts +13 -2
  169. package/dist/outline/root/outline-root.js +4 -2
  170. package/dist/pagination/root/pagination-root.d.ts +19 -1
  171. package/dist/pagination/root/pagination-root.js +49 -9
  172. package/dist/pagination/size/pagination-size.d.ts +13 -3
  173. package/dist/pagination/size/pagination-size.js +7 -0
  174. package/dist/pin-input/format.d.ts +7 -0
  175. package/dist/pin-input/format.js +16 -0
  176. package/dist/pin-input/root/pin-input-root.d.ts +37 -0
  177. package/dist/pin-input/root/pin-input-root.js +48 -7
  178. package/dist/popover/root/popover-root.d.ts +78 -3
  179. package/dist/popover/root/popover-root.js +74 -5
  180. package/dist/progress/root/progress-root.d.ts +23 -1
  181. package/dist/progress/root/progress-root.js +40 -10
  182. package/dist/qr-code/export.d.ts +31 -0
  183. package/dist/qr-code/export.js +10 -0
  184. package/dist/qr-code/root/qr-code-root.d.ts +45 -0
  185. package/dist/qr-code/root/qr-code-root.js +78 -3
  186. package/dist/radio/group/radio-group.d.ts +64 -0
  187. package/dist/radio/group/radio-group.js +66 -12
  188. package/dist/radio/root/radio-root.d.ts +8 -5
  189. package/dist/radio/root/radio-root.js +1 -2
  190. package/dist/rating/root/rating-root.d.ts +49 -1
  191. package/dist/rating/root/rating-root.js +69 -10
  192. package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
  193. package/dist/scatter-chart/root/scatter-chart-root.js +40 -14
  194. package/dist/select/root/select-root.d.ts +93 -3
  195. package/dist/select/root/select-root.js +111 -13
  196. package/dist/skeleton/root/skeleton-root.d.ts +39 -3
  197. package/dist/skeleton/root/skeleton-root.js +33 -4
  198. package/dist/skip-link/root/skip-link-root.d.ts +10 -0
  199. package/dist/skip-link/root/skip-link-root.js +15 -1
  200. package/dist/slider/root/slider-root.d.ts +59 -2
  201. package/dist/slider/root/slider-root.js +82 -8
  202. package/dist/sparkline/root/sparkline-root.d.ts +9 -10
  203. package/dist/speed-dial/item/speed-dial-item.d.ts +11 -5
  204. package/dist/speed-dial/item/speed-dial-item.js +7 -2
  205. package/dist/speed-dial/root/speed-dial-root.d.ts +15 -4
  206. package/dist/speed-dial/root/speed-dial-root.js +19 -5
  207. package/dist/splitter/root/splitter-root.d.ts +28 -6
  208. package/dist/splitter/root/splitter-root.js +35 -1
  209. package/dist/stat/root/stat-root.d.ts +9 -1
  210. package/dist/stat/root/stat-root.js +15 -2
  211. package/dist/steps/root/steps-root.js +1 -1
  212. package/dist/steps/step/step.d.ts +1 -0
  213. package/dist/steps/step/step.js +1 -1
  214. package/dist/switch/root/switch-root.d.ts +14 -2
  215. package/dist/switch/root/switch-root.js +7 -1
  216. package/dist/table/cell/table-cell.d.ts +24 -4
  217. package/dist/table/cell/table-cell.js +21 -1
  218. package/dist/table/column/table-column.d.ts +32 -6
  219. package/dist/table/column/table-column.js +36 -6
  220. package/dist/table/root/table-root.d.ts +94 -3
  221. package/dist/table/root/table-root.js +128 -5
  222. package/dist/table/row/table-row.d.ts +7 -0
  223. package/dist/table/row/table-row.js +9 -1
  224. package/dist/tabs/root/tabs-root.d.ts +6 -1
  225. package/dist/tabs/root/tabs-root.js +6 -2
  226. package/dist/tag/group/tag-group.d.ts +107 -0
  227. package/dist/tag/group/tag-group.js +157 -0
  228. package/dist/tag/index.d.ts +1 -0
  229. package/dist/tag/index.js +1 -0
  230. package/dist/tag/root/tag-root.d.ts +83 -1
  231. package/dist/tag/root/tag-root.js +87 -17
  232. package/dist/tag/selection.d.ts +10 -0
  233. package/dist/tag/selection.js +12 -0
  234. package/dist/textarea/grow.d.ts +22 -0
  235. package/dist/textarea/grow.js +20 -0
  236. package/dist/textarea/root/textarea-root.d.ts +13 -0
  237. package/dist/textarea/root/textarea-root.js +10 -2
  238. package/dist/time-input/root/time-input-root.d.ts +71 -6
  239. package/dist/time-input/root/time-input-root.js +110 -44
  240. package/dist/time-picker/root/time-picker-root.d.ts +155 -26
  241. package/dist/time-picker/root/time-picker-root.js +192 -63
  242. package/dist/toast/hotkey.d.ts +22 -0
  243. package/dist/toast/hotkey.js +23 -0
  244. package/dist/toast/item/toast-item.d.ts +16 -1
  245. package/dist/toast/item/toast-item.js +41 -13
  246. package/dist/toast/root/toast-root.d.ts +105 -8
  247. package/dist/toast/root/toast-root.js +209 -4
  248. package/dist/toggle/group/toggle-group.d.ts +95 -16
  249. package/dist/toggle/group/toggle-group.js +99 -13
  250. package/dist/toggle/root/toggle-root.d.ts +26 -11
  251. package/dist/toggle/root/toggle-root.js +14 -6
  252. package/dist/toolbar/root/toolbar-root.d.ts +55 -15
  253. package/dist/toolbar/root/toolbar-root.js +99 -16
  254. package/dist/tooltip/focus-target.d.ts +6 -0
  255. package/dist/tooltip/focus-target.js +9 -0
  256. package/dist/tooltip/root/tooltip-root.d.ts +73 -15
  257. package/dist/tooltip/root/tooltip-root.js +96 -7
  258. package/dist/tour/naming.d.ts +30 -0
  259. package/dist/tour/naming.js +10 -0
  260. package/dist/tour/root/tour-root.d.ts +67 -3
  261. package/dist/tour/root/tour-root.js +105 -17
  262. package/dist/tour/stop/tour-stop.d.ts +65 -3
  263. package/dist/tour/stop/tour-stop.js +61 -11
  264. package/dist/tour/wait.d.ts +11 -0
  265. package/dist/tour/wait.js +19 -0
  266. package/dist/tree/item/tree-item.d.ts +21 -5
  267. package/dist/tree/item/tree-item.js +14 -4
  268. package/dist/tree/root/tree-root.d.ts +29 -5
  269. package/dist/tree/root/tree-root.js +64 -8
  270. package/dist/trend/root/trend-root.d.ts +36 -1
  271. package/dist/trend/root/trend-root.js +41 -15
  272. package/dist/video/root/keys.d.ts +5 -0
  273. package/dist/video/root/keys.js +13 -1
  274. package/dist/video/root/video-root.d.ts +19 -0
  275. package/dist/video/root/video-root.js +48 -4
  276. package/dist/video-playlist/menu/video-playlist-menu.d.ts +20 -2
  277. package/dist/video-playlist/menu/video-playlist-menu.js +27 -5
  278. package/dist/video-playlist/root/video-playlist-root.js +6 -3
  279. package/dist/virtual-list/root/virtual-list-root.d.ts +52 -4
  280. package/dist/virtual-list/root/virtual-list-root.js +103 -21
  281. package/lint.json +1 -1
  282. package/package.json +5 -5
  283. package/types/jsx.d.ts +9140 -1149
  284. package/types/svelte.d.ts +1 -0
  285. package/types/vue.d.ts +2089 -267
@@ -4,32 +4,102 @@ 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, HelixElement, MixinDismissible } from '@fusion.dev/helix-core';
8
- import { x } from '@fusion.dev/helix-icons';
7
+ import { customElement, drawDismiss, drawDismissGlyph, HelixElement, hostAria, MixinDismissible, slottedWords, } from '@fusion.dev/helix-core';
9
8
  import { html, nothing } from 'lit';
10
- import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
9
+ import { property } from 'lit/decorators.js';
11
10
  let HelixHeadlessTag = class HelixHeadlessTag extends MixinDismissible(HelixElement) {
12
11
  constructor() {
13
12
  super(...arguments);
14
13
  this.dismissLabel = 'Remove';
14
+ this.disabled = false;
15
+ this.href = '';
16
+ this.value = '';
17
+ }
18
+ get words() {
19
+ return this.childrenKnown ? slottedWords(this, ['start', '']) : '';
20
+ }
21
+ get grouped() {
22
+ return this.focusable !== undefined;
23
+ }
24
+ focusItem() {
25
+ this.renderRoot
26
+ .querySelector(this.grouped ? '[part~="cell"]' : '[part~="link"], [part~="dismiss"]')
27
+ ?.focus();
28
+ }
29
+ get returnFocusTo() {
30
+ if (this.disabled) {
31
+ return null;
32
+ }
33
+ return this.grouped
34
+ ? this.renderRoot.querySelector('[part~="cell"]')
35
+ : super.returnFocusTo;
36
+ }
37
+ willUpdate(changed) {
38
+ super.willUpdate(changed);
39
+ hostAria(this.internals, { role: this.grouped ? 'row' : '' });
40
+ this.internals.ariaSelected = this.selected === undefined ? null : String(this.selected);
41
+ this.internals.ariaDisabled = this.disabled ? 'true' : null;
42
+ this.toggleState('selected', this.selected === true);
43
+ }
44
+ get removeName() {
45
+ const words = this.words;
46
+ if (this.dismissLabel.includes('{label}')) {
47
+ return this.dismissLabel.replace('{label}', words).trim();
48
+ }
49
+ return words === '' || this.dismissLabel.includes(words)
50
+ ? this.dismissLabel
51
+ : `${this.dismissLabel} ${words}`;
52
+ }
53
+ firstUpdated(changed) {
54
+ super.firstUpdated(changed);
55
+ this.renderRoot.addEventListener('slotchange', () => this.requestUpdate());
56
+ this.finishHydration();
15
57
  }
16
58
  render() {
17
- return html `<slot name="start" part="start"></slot>
18
- <slot part="label"></slot>
19
- ${this.dismissible
20
- ? html `<button
21
- part="dismiss"
22
- type="button"
23
- aria-label=${this.dismissLabel}
24
- @click=${() => this.dismiss()}
25
- >
26
- <svg part="dismiss-mark" fill="currentColor" viewBox=${x.viewBox} aria-hidden="true">
27
- ${unsafeSVG(x.content)}
28
- </svg>
29
- </button>`
30
- : nothing}`;
59
+ const content = html `<slot name="start" part="start"></slot>${this.renderLabel()}${this.dismissible ? this.renderDismiss() : nothing}`;
60
+ return this.grouped
61
+ ? html `<span part="cell" role="gridcell" tabindex=${this.focusable ? '0' : '-1'}
62
+ >${content}</span
63
+ >`
64
+ : content;
65
+ }
66
+ renderLabel() {
67
+ if (this.href === '') {
68
+ return html `<slot part="label"></slot>`;
69
+ }
70
+ return html `<a
71
+ aria-disabled=${this.disabled ? 'true' : nothing}
72
+ href=${this.disabled ? nothing : this.href}
73
+ part="link"
74
+ tabindex=${this.grouped ? '-1' : nothing}
75
+ ><slot part="label"></slot
76
+ ></a>`;
77
+ }
78
+ renderDismiss() {
79
+ return drawDismiss({
80
+ disabled: this.disabled,
81
+ label: this.removeName,
82
+ mark: html `<slot name="dismiss-icon">${drawDismissGlyph()}</slot>`,
83
+ onDismiss: () => this.dismiss(),
84
+ tabindex: this.grouped ? '-1' : undefined,
85
+ });
31
86
  }
32
87
  };
88
+ __decorate([
89
+ property({ reflect: true, type: Boolean })
90
+ ], HelixHeadlessTag.prototype, "disabled", void 0);
91
+ __decorate([
92
+ property({ attribute: false })
93
+ ], HelixHeadlessTag.prototype, "focusable", void 0);
94
+ __decorate([
95
+ property()
96
+ ], HelixHeadlessTag.prototype, "href", void 0);
97
+ __decorate([
98
+ property({ attribute: false })
99
+ ], HelixHeadlessTag.prototype, "selected", void 0);
100
+ __decorate([
101
+ property()
102
+ ], HelixHeadlessTag.prototype, "value", void 0);
33
103
  HelixHeadlessTag = __decorate([
34
104
  customElement('helix-headless-tag')
35
105
  ], HelixHeadlessTag);
@@ -0,0 +1,10 @@
1
+ /** How many tags a group lets a reader select. */
2
+ export type TagSelectionMode = 'multiple' | 'none' | 'single';
3
+ /**
4
+ * The `value` a press on the tag carrying `pressed` leaves.
5
+ *
6
+ * `single` selects that tag alone, or none where it was the one selected.
7
+ * `multiple` adds it, or takes it out. `none` selects nothing and leaves the
8
+ * value as it was.
9
+ */
10
+ export declare const pressedValue: (mode: TagSelectionMode, value: string, pressed: string) => string;
@@ -0,0 +1,12 @@
1
+ import { commaList, toggleValue } from '@fusion.dev/helix-core';
2
+ export const pressedValue = (mode, value, pressed) => {
3
+ const now = commaList(value);
4
+ const held = now.includes(pressed);
5
+ if (mode === 'single') {
6
+ return held ? '' : pressed;
7
+ }
8
+ if (mode === 'multiple') {
9
+ return toggleValue(now, pressed).join(', ');
10
+ }
11
+ return value;
12
+ };
@@ -0,0 +1,22 @@
1
+ /** What a box adds around its lines, and how tall one line is, in pixels. */
2
+ export interface LineMetrics {
3
+ /** Padding and border above and below the lines. */
4
+ readonly around: number;
5
+ /** The height of one line. */
6
+ readonly line: number;
7
+ }
8
+ /**
9
+ * The height a growing field takes: what its text needs, held to `maxRows`
10
+ * lines where that is a positive number. The second answer says whether the
11
+ * text is taller than the cap, so the field scrolls.
12
+ */
13
+ export declare const grownHeight: (needed: number, maxRows: number | undefined, metrics: LineMetrics) => {
14
+ height: number;
15
+ scrolls: boolean;
16
+ };
17
+ /**
18
+ * Reads a box's line height and what it adds around its lines from its
19
+ * computed style. A `normal` line height counts as 1.2 times the font size,
20
+ * which is what browsers draw it as for most fonts.
21
+ */
22
+ export declare const lineMetrics: (style: CSSStyleDeclaration) => LineMetrics;
@@ -0,0 +1,20 @@
1
+ export const grownHeight = (needed, maxRows, metrics) => {
2
+ if (maxRows === undefined || !(maxRows > 0) || metrics.line <= 0) {
3
+ return { height: needed, scrolls: false };
4
+ }
5
+ const cap = Math.ceil(maxRows * metrics.line + metrics.around);
6
+ return needed > cap ? { height: cap, scrolls: true } : { height: needed, scrolls: false };
7
+ };
8
+ export const lineMetrics = (style) => {
9
+ const px = (value) => Number.parseFloat(value) || 0;
10
+ const line = style.lineHeight === 'normal' || style.lineHeight === ''
11
+ ? px(style.fontSize) * 1.2
12
+ : px(style.lineHeight);
13
+ const around = style.boxSizing === 'border-box'
14
+ ? px(style.paddingBlockStart) +
15
+ px(style.paddingBlockEnd) +
16
+ px(style.borderBlockStartWidth) +
17
+ px(style.borderBlockEndWidth)
18
+ : 0;
19
+ return { around, line };
20
+ };
@@ -14,6 +14,8 @@ declare const HelixHeadlessTextarea_base: (new (...args: any[]) => import("@fusi
14
14
  *
15
15
  * `rows` sets the starting height, and `auto-grow` makes the field grow with
16
16
  * its content. You can use both: `rows` sets where an empty field begins.
17
+ * `max-rows` stops the growth at that many lines, and the field scrolls past
18
+ * them.
17
19
  *
18
20
  * @since 0.1.0
19
21
  * @status stable
@@ -21,6 +23,12 @@ declare const HelixHeadlessTextarea_base: (new (...args: any[]) => import("@fusi
21
23
  * @aliases Multiline, TextArea
22
24
  * @documentation https://fusion.dev/helix/components/textarea
23
25
  *
26
+ * @slot end - After the text, for an icon or an action beside it.
27
+ * @slot feedback - The message that says what is wrong, for content richer than a string. It shows while there is a message.
28
+ * @slot hint - Help under the control, for content richer than the `hint` text.
29
+ * @slot label - The label, for content richer than the `label` text.
30
+ * @slot start - Before the text, for an icon.
31
+ *
24
32
  * @event {Event} change - Sent from the textarea when the user finishes an edit.
25
33
  * @event {HelixBeforeChangeEvent} helix-before-change - Fired as the text changes, and cancelable.
26
34
  * @event {Event} input - Fired after the value changes.
@@ -75,6 +83,11 @@ export declare class HelixHeadlessTextarea extends HelixHeadlessTextarea_base {
75
83
  * The most characters the value can have.
76
84
  */
77
85
  maxLength?: number;
86
+ /**
87
+ * How many lines an `auto-grow` field grows to before it scrolls. Absent,
88
+ * it grows with all of its text.
89
+ */
90
+ maxRows?: number;
78
91
  /**
79
92
  * The fewest characters the value can have.
80
93
  *
@@ -7,6 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  import { AriaForwardController, customElement, HelixFormElement, holdCaret, isRtl, MixinControllerValue, MixinField, restoreValue, } from '@fusion.dev/helix-core';
8
8
  import { html, nothing } from 'lit';
9
9
  import { property } from 'lit/decorators.js';
10
+ import { grownHeight, lineMetrics } from '../grow.js';
10
11
  let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerValue(MixinField(HelixFormElement)) {
11
12
  constructor() {
12
13
  super(...arguments);
@@ -51,7 +52,9 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
51
52
  if (next === 0) {
52
53
  return;
53
54
  }
54
- control.style.blockSize = `${next}px`;
55
+ const grown = grownHeight(next, this.maxRows, lineMetrics(getComputedStyle(control)));
56
+ control.style.blockSize = `${grown.height}px`;
57
+ control.style.overflowY = grown.scrolls ? 'auto' : '';
55
58
  }
56
59
  formValue() {
57
60
  const control = this.control;
@@ -103,7 +106,7 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
103
106
  this.control?.focus(options);
104
107
  }
105
108
  sync() {
106
- this.internals.setFormValue(this.formValue());
109
+ this.internals.setFormValue(this.formValue(), this.value);
107
110
  const control = this.control;
108
111
  if (!control) {
109
112
  return;
@@ -155,6 +158,7 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
155
158
  render() {
156
159
  return html `${this.renderLabel()}
157
160
  <div part="field">
161
+ <slot name="start"></slot>
158
162
  <textarea
159
163
  part="control"
160
164
  id=${this.controlId}
@@ -175,6 +179,7 @@ let HelixHeadlessTextarea = class HelixHeadlessTextarea extends MixinControllerV
175
179
  @input=${this.handleInput}
176
180
  @change=${this.handleChange}
177
181
  ></textarea>
182
+ <slot name="end"></slot>
178
183
  </div>
179
184
  ${this.renderHint()}${this.renderFeedback()}`;
180
185
  }
@@ -194,6 +199,9 @@ __decorate([
194
199
  __decorate([
195
200
  property({ attribute: 'maxlength', type: Number })
196
201
  ], HelixHeadlessTextarea.prototype, "maxLength", void 0);
202
+ __decorate([
203
+ property({ attribute: 'max-rows', type: Number })
204
+ ], HelixHeadlessTextarea.prototype, "maxRows", void 0);
197
205
  __decorate([
198
206
  property({ attribute: 'minlength', type: Number })
199
207
  ], HelixHeadlessTextarea.prototype, "minLength", void 0);
@@ -1,9 +1,8 @@
1
- import { AriaForwardController, HelixFormElement } from '@fusion.dev/helix-core';
1
+ import { AriaForwardController, HelixFormElement, type HourCycle } from '@fusion.dev/helix-core';
2
2
  import { type PropertyValues, type TemplateResult } from 'lit';
3
- import '../../icon/index.js';
4
3
  import '../../tag/index.js';
5
4
  import '../../time-picker/index.js';
6
- declare const HelixHeadlessTimeInput_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 HelixHeadlessTimeInput_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;
7
6
  /**
8
7
  * @summary A field for a time, typed or picked from a list.
9
8
  *
@@ -16,13 +15,25 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
16
15
  * You can type a time or pick one. The list offers times at a step, and the
17
16
  * field lets you enter any time, such as `09:07`.
18
17
  *
19
- * The value is always `HH:mm` on a 24-hour clock, because that is what the form
18
+ * The value is always `HH:mm` on a 24-hour clock, or `HH:mm:ss` with
19
+ * `seconds`, because that is what the form
20
20
  * submits, what `min` and `max` compare against, and what sorts correctly as a
21
21
  * string. While idle, the field shows the time in the user's locale format.
22
22
  * Once the caret is in the field, it shows the value itself, because a
23
23
  * formatted time such as `2:30 PM` cannot be typed back and `Intl` has no
24
24
  * parser for it.
25
25
  *
26
+ * Typing sends `input` on each keystroke and `change` when you leave the
27
+ * field. The trigger and ArrowDown open the list, and so does a press into the
28
+ * field; Tab into the field opens nothing. In the list, the arrow keys, typed digits and PageUp and PageDown
29
+ * move through the times, and Enter, Space or a click chooses one and closes
30
+ * the panel. With `variant="wheels"` each wheel moves the time as you turn it,
31
+ * the panel stays open, and Enter or Escape closes it.
32
+ *
33
+ * With `segmented`, the field is a row of segments in place of the text: an
34
+ * hour, a minute, and AM or PM where the clock has them, each set with digits
35
+ * or the arrow keys. Alt+Down opens the list from a segment.
36
+ *
26
37
  * @since 0.1.0
27
38
  * @status stable
28
39
  * @category forms
@@ -38,13 +49,14 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
38
49
  * @event {HelixBeforeCloseEvent} helix-before-close - Fired before the list closes. Cancelable: canceling it keeps the list open and leaves the decision to you.
39
50
  * @event {HelixBeforeOpenEvent} helix-before-open - Fired before the list opens. Cancelable: canceling it keeps the list closed and leaves the decision to you.
40
51
  * @event {Event} input - Fired after the value changes.
41
- * @event {Event} toggle - Fired after the list opens or closes, with `newState` and `oldState`.
52
+ * @event {ToggleEvent} toggle - Fired after the list opens or closes, with `newState` and `oldState`.
42
53
  *
43
54
  * @csspart control - The text input.
44
55
  * @csspart feedback - The message that says what is wrong with the value.
45
56
  * @csspart field - The box that holds the text and the trigger.
46
57
  * @csspart hint - Help under the field, while nothing is wrong.
47
58
  * @csspart label - The label above the field.
59
+ * @csspart literal - The text the locale writes between two segments, such as a colon, in `segmented`.
48
60
  * @csspart picker - The time picker inside the panel.
49
61
  * @csspart picker-column - One column of the picker.
50
62
  * @csspart picker-column-empty - The text shown when the filter hides every option.
@@ -80,12 +92,17 @@ declare const HelixHeadlessTimeInput_base: (new (...args: any[]) => import("@fus
80
92
  * @csspart picker-option-label - The option's label.
81
93
  * @csspart picker-option-text - The label and the caption, as one column.
82
94
  * @csspart rest - The count of times held beyond the ones shown. A `<button>` with `expandable`, and a `<span>` without it.
95
+ * @csspart segment - One part of the time, an hour, a minute, a second or AM and PM, in `segmented`.
96
+ * @csspart segment-placeholder - A segment with nothing in it yet. Applied with `segment`.
97
+ * @csspart segments - The row of segments that holds the time, in `segmented`.
83
98
  * @csspart surface - The floating panel.
84
99
  * @csspart tags - The row the times sit in.
85
100
  * @csspart time - One held time, as a tag, in `multiple`.
101
+ * @csspart time-cell - The tag's grid cell, which a tag draws only inside a tag group.
86
102
  * @csspart time-dismiss - The remove button, when `dismissible`.
87
103
  * @csspart time-dismiss-mark - The default icon on the remove button, shown when none is slotted.
88
104
  * @csspart time-label - The label, trimmed to its capitals and baseline.
105
+ * @csspart time-link - The tag's link around its label, which a tag draws only with `href`.
89
106
  * @csspart time-start - The category before the label.
90
107
  * @csspart trigger - The control that opens the list.
91
108
  * @csspart trigger-icon - The icon on the button that opens the clock.
@@ -102,6 +119,22 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
102
119
  * lets autofill work at all.
103
120
  */
104
121
  autocomplete: string;
122
+ /** Typed, so a keystroke is announced as `input` alone. See `announcesInput`. */
123
+ protected readonly announcesInput = true;
124
+ /**
125
+ * Times that cannot be chosen, as `HH:mm`, separated by commas or spaces.
126
+ *
127
+ * Handed to the list, which offers them as unavailable, and checked against
128
+ * a typed time, which is then invalid.
129
+ */
130
+ disableTimes: string;
131
+ /**
132
+ * The clock the times are written on: `h12` for twelve hours with a
133
+ * meridiem, `h23` for twenty-four. Absent is the locale's own.
134
+ *
135
+ * Handed to the list. The value is `HH:mm` on twenty-four hours either way.
136
+ */
137
+ hourCycle?: HourCycle;
105
138
  /**
106
139
  * Language tag the times are written in.
107
140
  *
@@ -155,7 +188,14 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
155
188
  */
156
189
  removeLabel: string;
157
190
  /**
158
- * How far apart the offered times are, in minutes.
191
+ * Whether times carry their seconds: the value is `HH:mm:ss`, a typed time
192
+ * may give them, the field writes them, and the list's `step` counts seconds.
193
+ * See Time Picker's `seconds`.
194
+ */
195
+ seconds: boolean;
196
+ /**
197
+ * How far apart the offered times are, in minutes, or in seconds with
198
+ * `seconds`.
159
199
  */
160
200
  step: number;
161
201
  /**
@@ -172,8 +212,25 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
172
212
  * The name of the button that opens the list, read by screen readers.
173
213
  */
174
214
  triggerLabel: string;
215
+ /**
216
+ * The message shown when `disable-times` bars a time.
217
+ */
218
+ unavailableMessage?: string;
175
219
  /** Every time in the value, which may hold more than one. */
176
220
  private get held();
221
+ /**
222
+ * Segments hold one time, so `range` and `multiple` keep the line of text,
223
+ * whose separators and tags are how those modes write several.
224
+ */
225
+ protected get segmentable(): boolean;
226
+ protected get segmentedKind(): 'time';
227
+ protected get segmentLocale(): string;
228
+ protected get segmentOptions(): {
229
+ hourCycle?: HourCycle | undefined;
230
+ seconds: boolean;
231
+ };
232
+ /** Whether a typed time is one this field holds, to the second where it holds seconds. */
233
+ private isTime;
177
234
  /** One time, written the way `time-style` asks for. */
178
235
  private written;
179
236
  /** What the field shows: the value while it is being edited, a reading when not. */
@@ -204,6 +261,14 @@ export declare class HelixHeadlessTimeInput extends HelixHeadlessTimeInput_base
204
261
  private get picked();
205
262
  private readonly handleInput;
206
263
  private readonly handlePicked;
264
+ /**
265
+ * Enter on the wheels closes the panel, the time on them being the answer.
266
+ *
267
+ * The list closes on the choice Enter makes. A wheel turned by the arrows
268
+ * already holds its time, so Enter there chooses nothing new, and this is
269
+ * what says the reader is done.
270
+ */
271
+ private readonly handleWheelEnter;
207
272
  /** Each time, where `mode` holds several, sent one entry each. */
208
273
  protected get answers(): readonly string[] | undefined;
209
274
  /** What is wrong with the times, which the text input cannot say. */