@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
@@ -0,0 +1,28 @@
1
+ import { elementById } from '@fusion.dev/helix-core';
2
+ export const parseFrom = (reference) => {
3
+ const written = reference.trim();
4
+ const bracket = /^([^[\].\s]+)\[([^\]\s]+)\]$/u.exec(written);
5
+ if (bracket) {
6
+ return { attribute: bracket[2], id: bracket[1] };
7
+ }
8
+ const dot = /^([^[\].\s]+)\.([^[\].\s]+)$/u.exec(written);
9
+ if (dot) {
10
+ return { id: dot[1], property: dot[2] };
11
+ }
12
+ return /^[^[\].\s]+$/u.test(written) ? { id: written } : null;
13
+ };
14
+ export const readFrom = (reference, scope) => {
15
+ const parsed = parseFrom(reference);
16
+ const element = parsed ? elementById(scope, parsed.id) : null;
17
+ if (!(parsed && element)) {
18
+ return null;
19
+ }
20
+ if (parsed.attribute !== undefined) {
21
+ return element.getAttribute(parsed.attribute);
22
+ }
23
+ if (parsed.property !== undefined) {
24
+ const read = element[parsed.property];
25
+ return read === undefined || read === null ? null : String(read);
26
+ }
27
+ return element.textContent;
28
+ };
@@ -12,7 +12,19 @@ import '../../tooltip/index.js';
12
12
  * The confirmation and the event wait for the write to finish. The browser can
13
13
  * refuse a clipboard write, for example on an insecure origin, in a document
14
14
  * that is not focused, or after a gesture that does not qualify. A refused
15
- * write leaves the button unchanged.
15
+ * write, or nothing to copy, names the button with `error-label` for the same
16
+ * moment a copy shows `copied-label`, draws a cross, and sends
17
+ * `helix-copy-error`.
18
+ *
19
+ * `from` copies from another element on the page: its text, an attribute
20
+ * written `id[attribute]`, or a property written `id.property`, read at the
21
+ * press. It takes the place of `value`.
22
+ *
23
+ * It replaces Button's render and its press, so it never submits a form or
24
+ * sends a command: `type`, `command`, `commandfor` and the `form*` overrides
25
+ * have no effect, and the `start` and `end` slots and the `text` part are not
26
+ * rendered. An `aria-label` on the element names it before a copy, in place of
27
+ * `label`.
16
28
  *
17
29
  * @since 0.1.0
18
30
  * @status stable
@@ -22,10 +34,13 @@ import '../../tooltip/index.js';
22
34
  *
23
35
  * @slot - The icon shown before a copy. Defaults to a clipboard.
24
36
  * @slot copied - The icon shown after a successful copy. Defaults to a check mark.
37
+ * @slot failed - The icon shown after a copy that put nothing on the clipboard. Defaults to a cross.
25
38
  *
26
39
  * @event {HelixCopyEvent} helix-copy - Fired after the clipboard write succeeds.
40
+ * @event {Event} helix-copy-error - Fired when a press put nothing on the clipboard: the browser refused the write, or there was nothing to copy.
27
41
  *
28
42
  * @csspart button - The inner button.
43
+ * @csspart live - The live region that says `pending-label` when the button becomes pending under focus. It is rendered from the first time the button is pending.
29
44
  * @csspart mark - The clipboard icon, and the confirmation icon that replaces it.
30
45
  * @csspart tooltip - The tooltip bubble, forwarded from the tooltip inside the button.
31
46
  * @csspart tooltip-arrow - The tooltip's arrow, which points at the button.
@@ -46,6 +61,18 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
46
61
  * dash-casing it, and `copiedlabel` is not what anyone would type.
47
62
  */
48
63
  copiedLabel: string;
64
+ /**
65
+ * The button's name and tooltip text after a press that put nothing on the
66
+ * clipboard.
67
+ */
68
+ errorLabel: string;
69
+ /**
70
+ * The element to copy from, by its id: `key` for its text, `key[value]` for
71
+ * an attribute, and `key.value` for a property. Read at the press, and used
72
+ * in place of `value`. An element that is not there copies nothing, which is
73
+ * a failed copy.
74
+ */
75
+ from: string;
49
76
  /**
50
77
  * The button's name and tooltip text before a copy.
51
78
  *
@@ -57,12 +84,8 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
57
84
  /**
58
85
  * The text copied to the clipboard.
59
86
  *
60
- * **Narrows `Button.value`, which is the submit value, and the two agree.**
61
- * A copy button is `type="button"` and never submits, so the inherited
62
- * meaning has nothing to act on; where a consumer changes the type, what it
63
- * submits is what it copies, which is the reading anybody would expect of one
64
- * property called `value`. Declared here rather than inherited because the
65
- * clipboard is what this component is about and its own page should say so.
87
+ * It replaces `Button.value`, the submit value: a copy button never submits,
88
+ * whatever its `type`. Declared here so its own page says what it holds.
66
89
  */
67
90
  value: string;
68
91
  /**
@@ -76,6 +99,19 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
76
99
  * makes the announcement happen at all.
77
100
  */
78
101
  private get says();
102
+ /**
103
+ * @internal The host's `aria-label`, observed so a new one renders, as
104
+ * `MixinField` observes it. Not reflected: the attribute is the consumer's.
105
+ */
106
+ protected namedBy: string | null;
107
+ /**
108
+ * @internal The name is written here, from `aria-label` too, so it can
109
+ * change to `copiedLabel`: carried down as well, a host `aria-label` would
110
+ * cover the confirmation.
111
+ */
112
+ protected get forwardsLabel(): boolean;
113
+ /** @internal A copy button never submits, so it is no form's default button. */
114
+ protected get submitsForm(): boolean;
79
115
  /**
80
116
  * The write, the confirmation, the timer and the event, all of them shared.
81
117
  *
@@ -92,6 +128,9 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
92
128
  */
93
129
  private readonly clipboard;
94
130
  private get copied();
131
+ private get failed();
132
+ /** What a press copies: the text `from` names, or `value`. */
133
+ private get text();
95
134
  private readonly handleCopy;
96
135
  /**
97
136
  * Both faces, drawn rather than demanded.
@@ -124,6 +163,8 @@ export declare class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
124
163
  * the focused element mid-press.
125
164
  */
126
165
  protected renderCopiedIcon(): TemplateResult;
166
+ /** The mark for a press that put nothing on the clipboard, behind a seam of its own. */
167
+ protected renderFailedIcon(): TemplateResult;
127
168
  /**
128
169
  * The bubble the control sits inside, behind a seam.
129
170
  *
@@ -6,60 +6,97 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  var HelixHeadlessCopyButton_1;
8
8
  import { CopyController, customElement } from '@fusion.dev/helix-core';
9
- import { check, copy } from '@fusion.dev/helix-icons';
9
+ import { check, copy, x } from '@fusion.dev/helix-icons';
10
10
  import { nothing } from 'lit';
11
11
  import { property } from 'lit/decorators.js';
12
12
  import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
13
13
  import { html } from 'lit/static-html.js';
14
14
  import { HelixHeadlessIconButton } from '../../icon-button/root/icon-button-root.js';
15
+ import { readFrom } from '../from.js';
15
16
  import '../../tooltip/index.js';
16
17
  const CONFIRM = 1600;
17
18
  let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCopyButton extends HelixHeadlessIconButton {
18
19
  constructor() {
19
20
  super(...arguments);
20
21
  this.copiedLabel = 'Copied';
22
+ this.errorLabel = 'Could not copy';
23
+ this.from = '';
21
24
  this.label = 'Copy';
22
25
  this.value = '';
26
+ this.namedBy = null;
23
27
  this.clipboard = new CopyController(this, { after: CONFIRM });
24
- this.handleCopy = async () => {
28
+ this.handleCopy = async (event) => {
29
+ if (this.pending) {
30
+ event.preventDefault();
31
+ event.stopImmediatePropagation();
32
+ return;
33
+ }
25
34
  if (this.isDisabled) {
26
35
  return;
27
36
  }
28
- await this.clipboard.copy(this.value);
37
+ const wrote = await this.clipboard.copy(this.text);
38
+ if (!wrote && this.isConnected) {
39
+ this.dispatchEvent(new Event('helix-copy-error', { bubbles: true, composed: true }));
40
+ }
29
41
  };
30
42
  }
31
43
  get says() {
32
- return this.copied ? this.copiedLabel : this.label;
44
+ if (this.failed) {
45
+ return this.errorLabel;
46
+ }
47
+ return this.copied ? this.copiedLabel : this.namedBy || this.label;
48
+ }
49
+ get forwardsLabel() {
50
+ return false;
51
+ }
52
+ get submitsForm() {
53
+ return false;
33
54
  }
34
55
  get copied() {
35
56
  return this.clipboard.copied;
36
57
  }
58
+ get failed() {
59
+ return this.clipboard.failed;
60
+ }
61
+ get text() {
62
+ return this.from === '' ? this.value : (readFrom(this.from, this) ?? '');
63
+ }
37
64
  static icon(glyph) {
38
65
  return html `<svg part="mark" fill="currentColor" viewBox=${glyph.viewBox} aria-hidden="true">
39
66
  ${unsafeSVG(glyph.content)}
40
67
  </svg>`;
41
68
  }
42
69
  render() {
43
- return this.renderTooltip(html `<button
70
+ return html `${this.renderTooltip(html `<button
44
71
  part="button"
45
72
  type="button"
73
+ aria-busy=${this.pending ? 'true' : nothing}
74
+ aria-disabled=${this.pending ? 'true' : nothing}
46
75
  aria-label=${this.says}
47
76
  data-copied=${this.copied ? '' : nothing}
77
+ data-failed=${this.failed ? '' : nothing}
48
78
  tabindex=${this.focusable ? nothing : '-1'}
49
79
  ?disabled=${this.isDisabled}
50
80
  @click=${this.handleCopy}
51
81
  >
52
- ${this.renderCopiedIcon()} ${this.renderCopyIcon()}
53
- </button>`);
82
+ ${this.renderCopiedIcon()} ${this.renderFailedIcon()} ${this.renderCopyIcon()}
83
+ </button>`)}${this.renderLive()}`;
54
84
  }
55
85
  renderCopyIcon() {
56
- return html `<slot ?hidden=${this.copied}>${HelixHeadlessCopyButton_1.icon(copy)}</slot>`;
86
+ return html `<slot ?hidden=${this.copied || this.failed}
87
+ >${HelixHeadlessCopyButton_1.icon(copy)}</slot
88
+ >`;
57
89
  }
58
90
  renderCopiedIcon() {
59
91
  return html `<slot name="copied" ?hidden=${!this.copied}
60
92
  >${HelixHeadlessCopyButton_1.icon(check)}</slot
61
93
  >`;
62
94
  }
95
+ renderFailedIcon() {
96
+ return html `<slot name="failed" ?hidden=${!this.failed}
97
+ >${HelixHeadlessCopyButton_1.icon(x)}</slot
98
+ >`;
99
+ }
63
100
  renderTooltip(control) {
64
101
  return html `<${this.tag('tooltip')} content=${this.says} persist
65
102
  exportparts="arrow: tooltip-arrow, arrow-bottom: tooltip-arrow-bottom,
@@ -73,12 +110,21 @@ let HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = class HelixHeadlessCop
73
110
  __decorate([
74
111
  property({ attribute: 'copied-label' })
75
112
  ], HelixHeadlessCopyButton.prototype, "copiedLabel", void 0);
113
+ __decorate([
114
+ property({ attribute: 'error-label' })
115
+ ], HelixHeadlessCopyButton.prototype, "errorLabel", void 0);
116
+ __decorate([
117
+ property()
118
+ ], HelixHeadlessCopyButton.prototype, "from", void 0);
76
119
  __decorate([
77
120
  property()
78
121
  ], HelixHeadlessCopyButton.prototype, "label", void 0);
79
122
  __decorate([
80
123
  property()
81
124
  ], HelixHeadlessCopyButton.prototype, "value", void 0);
125
+ __decorate([
126
+ property({ attribute: 'aria-label' })
127
+ ], HelixHeadlessCopyButton.prototype, "namedBy", void 0);
82
128
  HelixHeadlessCopyButton = HelixHeadlessCopyButton_1 = __decorate([
83
129
  customElement('helix-headless-copy-button')
84
130
  ], HelixHeadlessCopyButton);
@@ -42,6 +42,21 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
42
42
  *
43
43
  * To act on a single row, such as opening it, put a link or a button in a cell.
44
44
  *
45
+ * The grid is one tab stop, and the arrow keys move between its cells, the
46
+ * headings included:
47
+ *
48
+ * - The arrow keys move one cell, and Home and End to the ends of the row.
49
+ * - Control with Home or End moves to the first or the last cell of the grid.
50
+ * - Page Up and Page Down move by the rows that fit in view.
51
+ * - Enter or F2 moves into the cell's controls, and Escape moves back to the
52
+ * cell. Tab moves between the controls of one cell.
53
+ * - Enter or Space on a sortable heading sorts by it, and Space on a row of a
54
+ * `selectable` table selects it.
55
+ *
56
+ * The controls inside the cells leave the tab order, so Tab moves past the
57
+ * whole grid. A windowed table keeps the row holding focus drawn while the
58
+ * rest scroll away.
59
+ *
45
60
  * People can resize and reorder the columns. `resizable` on a column puts a
46
61
  * separator on its edge. `reorderable` on the table puts a grip on each heading
47
62
  * that has a `field`, moved by dragging or with the arrow keys. The new order
@@ -67,11 +82,16 @@ declare const HelixHeadlessDataTable_base: (new (...args: any[]) => import("@fus
67
82
  * @slot footer - Content below the grid. It replaces the built-in pagination.
68
83
  * @slot toolbar - Content above the grid, such as a search field or actions.
69
84
  *
85
+ * @event {HelixActivateEvent} helix-activate - Fired after the page changes, with the new page as a string in `detail.value`.
70
86
  * @event {HelixFilterEvent} helix-filter - The search query is about to change. Cancelable: cancel it to keep the current query.
87
+ * @event {HelixFilteredEvent} helix-filtered - Fired after the search query changes, with the new query.
71
88
  * @event {HelixNavigateEvent} helix-navigate - Another page was requested. Cancelable: cancel it to stay on the current page.
72
- * @event {HelixReorderEvent} helix-reorder - The columns were moved. The event carries every field in the new order. Cancelable: cancel it to keep the current order.
73
- * @event {HelixSelectEvent} helix-select - The selection changed. The event carries every selected key, separated by commas. Cancelable: cancel it to keep the current selection.
89
+ * @event {HelixReorderEvent} helix-reorder - The columns are about to move. The event carries every field in the new order. Cancelable: cancel it to keep the current order.
90
+ * @event {HelixReorderedEvent} helix-reordered - Fired after the columns move, with every field in the new order.
91
+ * @event {HelixSelectEvent} helix-select - The selection is about to change. The event carries every selected key, separated by commas. Cancelable: cancel it to keep the current selection.
92
+ * @event {HelixSelectedEvent} helix-selected - Fired after the selection changes, with every selected key, separated by commas.
74
93
  * @event {HelixSortEvent} helix-sort - A different sort order was requested. Cancelable: cancel it to keep the current order.
94
+ * @event {HelixSortedEvent} helix-sorted - Fired after the sort order changes, with the new order.
75
95
  *
76
96
  * @csspart after - The space that stands in for the rows below the window. Only while `windowed`.
77
97
  * @csspart before - The space that stands in for the rows above the window. Only while `windowed`.
@@ -176,6 +196,11 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
176
196
  */
177
197
  get filter(): string;
178
198
  set filter(next: string);
199
+ /**
200
+ * The built-in pagination's name for a gap in its run of pages. `{page}` is
201
+ * replaced with the page it jumps to.
202
+ */
203
+ gapLabel: string;
179
204
  /**
180
205
  * The grid's name, read by screen readers.
181
206
  */
@@ -192,6 +217,8 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
192
217
  * inverts the data flow.
193
218
  */
194
219
  mode: 'client' | 'server';
220
+ /** The built-in pagination's name for the button that moves forward a page. */
221
+ nextLabel: string;
195
222
  /**
196
223
  * The column order, as field names separated by spaces.
197
224
  *
@@ -212,6 +239,11 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
212
239
  */
213
240
  get page(): number;
214
241
  set page(next: number);
242
+ /**
243
+ * The built-in pagination's name for one page. `{page}` and `{pages}` are
244
+ * replaced with the page number and the page count.
245
+ */
246
+ pageLabel: string;
215
247
  /**
216
248
  * The number of rows on a page. `0` shows every row, with no paging.
217
249
  *
@@ -233,6 +265,10 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
233
265
  */
234
266
  get paginated(): boolean;
235
267
  set paginated(next: boolean);
268
+ /** The name of the built-in pagination's navigation landmark. */
269
+ paginationLabel: string;
270
+ /** The built-in pagination's name for the button that moves back a page. */
271
+ previousLabel: string;
236
272
  /**
237
273
  * Lets users reorder the columns.
238
274
  *
@@ -240,6 +276,13 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
240
276
  * place at a time with the arrow keys once it has focus.
241
277
  */
242
278
  reorderable: boolean;
279
+ /** What screen readers hear when a search leaves one row. `{count}` is the count. */
280
+ resultLabel: string;
281
+ /**
282
+ * What screen readers hear when a search leaves any other number of rows.
283
+ * `{count}` is the count.
284
+ */
285
+ resultsLabel: string;
243
286
  /**
244
287
  * The field that identifies each row.
245
288
  *
@@ -274,6 +317,8 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
274
317
  * are known by their place in the result, which a sort changes.
275
318
  */
276
319
  selectable: boolean;
320
+ /** The name of the checkbox in the heading that selects every row. */
321
+ selectAllLabel: string;
277
322
  /**
278
323
  * The keys of the selected rows, separated by commas.
279
324
  *
@@ -290,12 +335,18 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
290
335
  * rows are chosen.
291
336
  */
292
337
  selectedLabel: string;
338
+ /**
339
+ * The name of a row's checkbox. `{row}` is replaced with the row's value in
340
+ * the first column that has a field, or with its key.
341
+ */
342
+ selectRowLabel: string;
293
343
  /**
294
344
  * The sort order, as `field:direction`.
295
345
  *
296
- * Set it and this element defers: a reader's click fires `helix-sort` and
297
- * changes nothing until a new value arrives. `default-sort` seeds an order this
298
- * element then owns.
346
+ * A reader's click on a sortable heading fires `helix-sort` first, and
347
+ * refusing it leaves the order as it was. To own the order yourself, refuse
348
+ * the event and set this to the order you chose. `default-sort` seeds an
349
+ * order this element then owns.
299
350
  */
300
351
  get sort(): string;
301
352
  set sort(next: string);
@@ -343,6 +394,25 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
343
394
  private paginatedState;
344
395
  private orderState;
345
396
  private selectedState;
397
+ /**
398
+ * The row holding the grid's tab stop: `-1` for the headings, otherwise a
399
+ * row of the page counted from 0. Unset until a reader moves, when the stop
400
+ * rests on the first row, or on the headings where there is none.
401
+ */
402
+ private activeRow;
403
+ /** The column holding the grid's tab stop, the checkbox column counted. */
404
+ private activeColumn;
405
+ /**
406
+ * The key of the row holding the tab stop, so a sort or a filter keeps the
407
+ * stop on the row a reader was on. Only kept while `row-key` is set.
408
+ */
409
+ private activeKey;
410
+ /** Whether the next render should move focus to the active cell. */
411
+ private focusWanted;
412
+ /** The page as last drawn, for the keys to count rows against between renders. */
413
+ private drawnPage;
414
+ /** The grid's size as the last render counted it, for the internals. */
415
+ private counts;
346
416
  /** The order while a grip is being dragged, before anybody has been asked. */
347
417
  private dragOrder;
348
418
  /** The column a grip is dragging, and the pointer doing it. */
@@ -387,8 +457,30 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
387
457
  */
388
458
  private held;
389
459
  private arrange;
390
- /** The part of a page the reader can see, which is every row when not windowed. */
460
+ /**
461
+ * The part of a page the reader can see, which is every row when not
462
+ * windowed, each with its place in the page.
463
+ *
464
+ * **The row holding the tab stop is drawn wherever the window is.** A row
465
+ * that scrolled out took the focus inside it to the body, and a grid whose
466
+ * one tab stop is not drawn has no tab stop at all. It is drawn beside the
467
+ * window, on the side it belongs, and the spacer on that side gives up its
468
+ * room, so every other row stays where it was.
469
+ */
391
470
  private windowOf;
471
+ /** The row drawn outside the window to keep the tab stop, if there is one. */
472
+ private keptRow;
473
+ /** What a row is known by between renders: its `row-key`, or its place in the page. */
474
+ private rowKeyOf;
475
+ /**
476
+ * The row holding the tab stop in this page: the row with the key it was
477
+ * on, where `row-key` says, and otherwise the same place, held to the page.
478
+ */
479
+ private currentRow;
480
+ /** How many cells a row has: the checkbox and every drawn column. */
481
+ private get width();
482
+ /** The column holding the tab stop, held to the row's width. */
483
+ private get currentColumn();
392
484
  /** The columns declared as children, in the order they are written. */
393
485
  get tableColumns(): HelixHeadlessTableColumn[];
394
486
  /**
@@ -545,8 +637,12 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
545
637
  private get everyKey();
546
638
  /** Ticks or clears one row, which the checkbox asked for and was refused. */
547
639
  private readonly toggleRow;
640
+ /** Asks for one row to be chosen or let go. */
641
+ private chooseRow;
548
642
  /** Selects every row, or clears them all where every one already was. */
549
643
  private readonly toggleAll;
644
+ /** Asks for every row, or for none where every one already was. */
645
+ private chooseAll;
550
646
  /**
551
647
  * Moves a column by some places among the ones that move and are drawn.
552
648
  *
@@ -603,6 +699,8 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
603
699
  private heardSort;
604
700
  /** The selection last heard, for the same reason. */
605
701
  private heardSelected;
702
+ /** The search last heard, for the same reason. */
703
+ private heardFilter;
606
704
  /**
607
705
  * What the table says after a sort or a change to the chosen rows.
608
706
  *
@@ -676,8 +774,7 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
676
774
  * reader on page three should hear row 41, and a grid whose indices restart at
677
775
  * every page tells a reader the result is twenty rows long however many it has.
678
776
  *
679
- * A window is the second offset and stacks on the page: with both on, row one
680
- * of the window is the page's start plus how far down the page it begins.
777
+ * `within` is the row's place in the page, which already counts the window.
681
778
  */
682
779
  private rowIndex;
683
780
  /**
@@ -690,8 +787,6 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
690
787
  private get placement();
691
788
  /** The signature the recorded heights were measured against. */
692
789
  private measuredAgainst;
693
- /** Where the window begins in the page, which is the top when there is none. */
694
- private get windowStart();
695
790
  /**
696
791
  * The room the rows outside the window would have taken.
697
792
  *
@@ -731,6 +826,59 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
731
826
  * makes of them, so a keyboard needs nothing of its own.
732
827
  */
733
828
  private readonly handleHeadClick;
829
+ /**
830
+ * The cell at a place in the grid. The headings are row `-1`, the rows of
831
+ * the page count from 0, and the checkbox column, where there is one, is
832
+ * column 0.
833
+ */
834
+ private cellAt;
835
+ /** The cell an event came from or through, and its place in the grid. */
836
+ private placeOf;
837
+ /**
838
+ * The controls inside a cell, in order: what Enter and F2 move into, and
839
+ * what Tab moves between while focus is in the cell.
840
+ */
841
+ private controlsIn;
842
+ /**
843
+ * Takes the controls a consumer's `cell` drew out of the tab order, so the
844
+ * grid stays one tab stop. They are reached with Enter or F2.
845
+ */
846
+ private quietControls;
847
+ /** Moves the tab stop to a cell, and focus with it on the next render. */
848
+ private moveTo;
849
+ /** How many rows Page Up and Page Down move: those that fit in view, less one. */
850
+ private pageStep;
851
+ /** How tall the headings are, which stick over the rows in a windowed table. */
852
+ private headHeight;
853
+ /** Whether focus is on a cell of the grid, or inside one. */
854
+ private gridHasFocus;
855
+ /** Whether focus was in the grid before this render, for `placeFocus` to keep it there. */
856
+ private hadFocus;
857
+ /**
858
+ * Focuses the cell holding the tab stop, where a key asked to move there or
859
+ * a render took focus away from the grid.
860
+ *
861
+ * **A render can take focus away**: a sort moves the row elements, and a
862
+ * moved element loses focus to the body. Put back on the cell the stop is on,
863
+ * which follows the row by its key.
864
+ */
865
+ private placeFocus;
866
+ /** A cell, or a control inside one, took focus: the tab stop moves there. */
867
+ private readonly handleFocusIn;
868
+ /**
869
+ * The grid's keys, on a cell and inside one.
870
+ *
871
+ * On a cell, the arrows, Home, End, Page Up and Page Down move between
872
+ * cells, and Enter, Space and F2 act on it. Inside a cell the control has the
873
+ * keys, apart from Escape and F2, which go back to the cell, and Tab, which
874
+ * moves between the cell's controls. A key a control already handled is left
875
+ * alone.
876
+ */
877
+ private readonly handleGridKey;
878
+ /** Enter, Space and F2 on a cell. */
879
+ private activate;
880
+ /** The keys the grid takes while focus is on a control inside a cell. */
881
+ private handleControlKey;
734
882
  /** Whether the event passed through a part of that name on its way here. */
735
883
  private partIn;
736
884
  /** The arrow keys on a grip move its column a place, along the writing direction. */
@@ -753,6 +901,12 @@ export declare class HelixHeadlessDataTable extends HelixHeadlessDataTable_base
753
901
  */
754
902
  private readonly handleResize;
755
903
  private columnFrom;
904
+ /**
905
+ * The composed pagination's notification, stopped for the reason its
906
+ * request is: this element sends its own `helix-activate` once its own page
907
+ * has moved, and one move is one event.
908
+ */
909
+ private readonly stopPageNotification;
756
910
  /**
757
911
  * The composed pagination's request, relayed as this element's own.
758
912
  *