@fusion.dev/helix-headless 0.145.0 → 0.147.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +12286 -4281
- package/dist/accordion/item/accordion-item.d.ts +51 -18
- package/dist/accordion/item/accordion-item.js +45 -13
- package/dist/accordion/root/accordion-root.d.ts +16 -7
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +16 -6
- package/dist/announcement/root/announcement-root.js +37 -7
- package/dist/app-header/root/app-header-root.d.ts +7 -2
- package/dist/app-header/root/app-header-root.js +9 -1
- package/dist/app-header/sectioning.d.ts +3 -1
- package/dist/app-header/sectioning.js +3 -2
- package/dist/area-chart/root/area-chart-root.d.ts +18 -1
- package/dist/area-chart/root/area-chart-root.js +11 -3
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/avatar/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +60 -7
- package/dist/badge/root/badge-root.js +89 -6
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +48 -20
- package/dist/bar-chart/stack.d.ts +25 -0
- package/dist/bar-chart/stack.js +27 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +25 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.js +51 -4
- package/dist/button/root/button-root.d.ts +50 -38
- package/dist/button/root/button-root.js +42 -53
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- package/dist/button-group/root/button-group-root.d.ts +2 -1
- package/dist/button-group/root/button-group-root.js +5 -1
- package/dist/canvas/node/canvas-node.d.ts +4 -3
- package/dist/canvas/node/canvas-node.js +3 -2
- package/dist/canvas/root/canvas-root.js +2 -2
- package/dist/card/root/card-root.d.ts +36 -4
- package/dist/card/root/card-root.js +29 -10
- package/dist/carousel/root/carousel-root.d.ts +43 -4
- package/dist/carousel/root/carousel-root.js +40 -12
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/message/chat-message.js +5 -4
- package/dist/chat/naming.d.ts +5 -1
- package/dist/chat/naming.js +4 -2
- package/dist/chat/root/chat-root.d.ts +40 -4
- package/dist/chat/root/chat-root.js +32 -6
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +18 -7
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +14 -11
- package/dist/checkbox-group/select-all.d.ts +21 -0
- package/dist/checkbox-group/select-all.js +7 -0
- package/dist/code-block/highlight.d.ts +15 -0
- package/dist/code-block/highlight.js +4 -0
- package/dist/code-block/root/code-block-root.d.ts +79 -10
- package/dist/code-block/root/code-block-root.js +74 -5
- package/dist/color-input/root/color-input-root.d.ts +14 -0
- package/dist/color-input/root/color-input-root.js +17 -7
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +53 -16
- package/dist/color-picker/root/color-picker-root.js +155 -46
- package/dist/color-picker/wheel.d.ts +17 -0
- package/dist/color-picker/wheel.js +6 -0
- package/dist/combobox/root/combobox-root.d.ts +56 -0
- package/dist/combobox/root/combobox-root.js +92 -15
- package/dist/command/root/command-root.d.ts +19 -2
- package/dist/command/root/command-root.js +24 -23
- package/dist/copy-button/root/copy-button-root.d.ts +21 -1
- package/dist/copy-button/root/copy-button-root.js +16 -4
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +6 -0
- package/dist/data-table/keys.js +14 -0
- package/dist/data-table/root/data-table-root.d.ts +27 -18
- package/dist/data-table/root/data-table-root.js +31 -57
- package/dist/data-table/tree.d.ts +16 -1
- package/dist/data-table/tree.js +2 -3
- package/dist/date-input/root/date-input-root.d.ts +11 -2
- package/dist/date-input/root/date-input-root.js +26 -12
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +33 -22
- package/dist/description-list/item/description-list-item.d.ts +18 -4
- package/dist/description-list/item/description-list-item.js +8 -4
- package/dist/dialog/description.js +15 -1
- package/dist/dialog/root/dialog-root.d.ts +8 -2
- package/dist/dialog/root/dialog-root.js +16 -1
- package/dist/divider/root/divider-root.d.ts +3 -0
- package/dist/divider/root/divider-root.js +2 -1
- package/dist/donut-chart/root/donut-chart-root.d.ts +31 -0
- package/dist/donut-chart/root/donut-chart-root.js +55 -1
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +75 -4
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +40 -5
- package/dist/drilldown/root/drilldown-root.d.ts +21 -3
- package/dist/drilldown/root/drilldown-root.js +22 -3
- package/dist/element-events.generated.js +35 -6
- package/dist/empty/root/empty-root.d.ts +34 -2
- package/dist/empty/root/empty-root.js +26 -4
- package/dist/file-input/root/file-input-root.d.ts +99 -8
- package/dist/file-input/root/file-input-root.js +120 -22
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/file-input/status.d.ts +24 -0
- package/dist/file-input/status.js +10 -0
- package/dist/filter-input/chip/filter-chip.d.ts +23 -0
- package/dist/filter-input/chip/filter-chip.js +11 -2
- package/dist/filter-input/menu/filter-menu.d.ts +2 -0
- package/dist/filter-input/menu/filter-menu.js +12 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -6
- package/dist/filter-input/root/filter-input-root.js +18 -28
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/options.d.ts +3 -4
- package/dist/format-date/options.js +2 -2
- package/dist/format-date/root/format-date-root.d.ts +27 -17
- package/dist/format-date/root/format-date-root.js +27 -48
- package/dist/heatmap/root/buckets.d.ts +21 -0
- package/dist/heatmap/root/buckets.js +34 -0
- package/dist/heatmap/root/heatmap-root.d.ts +83 -11
- package/dist/heatmap/root/heatmap-root.js +104 -12
- package/dist/icon/index.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/registry.d.ts +26 -1
- package/dist/icon/registry.js +12 -1
- package/dist/icon/root/icon-root.d.ts +25 -1
- package/dist/icon/root/icon-root.js +44 -12
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- package/dist/icon/settle.d.ts +7 -0
- package/dist/icon/settle.js +10 -0
- package/dist/icon-button/root/icon-button-root.d.ts +2 -0
- package/dist/image/root/image-root.d.ts +14 -1
- package/dist/image/root/image-root.js +7 -2
- package/dist/input/root/input-root.d.ts +34 -3
- package/dist/input/root/input-root.js +17 -4
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +52 -1
- package/dist/kbd/root/kbd-root.js +40 -47
- package/dist/legend/hidden-series.d.ts +10 -2
- package/dist/legend/hidden-series.js +5 -2
- package/dist/legend/root/legend-root.d.ts +77 -12
- package/dist/legend/root/legend-root.js +71 -17
- package/dist/lightbox/root/lightbox-root.d.ts +98 -10
- package/dist/lightbox/root/lightbox-root.js +153 -18
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +24 -0
- package/dist/lightbox/zoom.js +18 -0
- package/dist/line-chart/root/line-chart-root.d.ts +38 -1
- package/dist/line-chart/root/line-chart-root.js +31 -3
- package/dist/list/item/list-item.d.ts +2 -0
- package/dist/list/item/list-item.js +11 -2
- package/dist/list/root/list-root.d.ts +70 -13
- package/dist/list/root/list-root.js +91 -13
- package/dist/list/selection.d.ts +54 -7
- package/dist/list/selection.js +32 -7
- package/dist/listbox/root/listbox-root.d.ts +44 -4
- package/dist/listbox/root/listbox-root.js +72 -34
- package/dist/loader/busy.d.ts +10 -0
- package/dist/loader/busy.js +11 -0
- package/dist/loader/root/loader-root.d.ts +9 -2
- package/dist/loader/root/loader-root.js +23 -3
- package/dist/megamenu/hand-over.d.ts +75 -0
- package/dist/megamenu/hand-over.js +67 -0
- package/dist/megamenu/root/megamenu-root.d.ts +80 -15
- package/dist/megamenu/root/megamenu-root.js +76 -19
- package/dist/menu/item/menu-item.d.ts +51 -2
- package/dist/menu/item/menu-item.js +50 -26
- package/dist/menu/root/menu-root.d.ts +17 -0
- package/dist/menu/root/menu-root.js +2 -2
- package/dist/meter/root/meter-root.d.ts +62 -1
- package/dist/meter/root/meter-root.js +38 -16
- package/dist/navigation/root/navigation-root.d.ts +2 -1
- package/dist/navigation/root/navigation-root.js +2 -2
- package/dist/notifications/root/notifications-root.d.ts +20 -4
- package/dist/notifications/root/notifications-root.js +30 -8
- package/dist/number-input/grain.d.ts +28 -0
- package/dist/number-input/grain.js +14 -0
- package/dist/number-input/root/number-input-root.d.ts +34 -9
- package/dist/number-input/root/number-input-root.js +31 -25
- package/dist/object-inspector/root/object-inspector-root.d.ts +88 -33
- package/dist/object-inspector/root/object-inspector-root.js +134 -92
- package/dist/object-inspector/rows.d.ts +18 -0
- package/dist/object-inspector/rows.js +33 -0
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/option/separator/option-separator.d.ts +30 -0
- package/dist/option/separator/option-separator.js +21 -0
- package/dist/outline/root/outline-root.d.ts +30 -0
- package/dist/outline/root/outline-root.js +17 -13
- package/dist/pagination/size/pagination-size.d.ts +6 -0
- package/dist/pagination/size/pagination-size.js +5 -3
- package/dist/pin-input/code.d.ts +37 -0
- package/dist/pin-input/code.js +25 -0
- package/dist/pin-input/root/pin-input-root.d.ts +116 -115
- package/dist/pin-input/root/pin-input-root.js +163 -155
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +34 -0
- package/dist/popover/root/popover-root.d.ts +64 -8
- package/dist/popover/root/popover-root.js +67 -4
- package/dist/progress/root/progress-root.d.ts +47 -0
- package/dist/progress/root/progress-root.js +34 -16
- package/dist/qr-code/export.d.ts +45 -1
- package/dist/qr-code/export.js +28 -0
- package/dist/qr-code/name.d.ts +11 -0
- package/dist/qr-code/name.js +7 -0
- package/dist/qr-code/root/qr-code-root.d.ts +36 -11
- package/dist/qr-code/root/qr-code-root.js +58 -11
- package/dist/quote/marks.d.ts +8 -0
- package/dist/quote/marks.js +5 -0
- package/dist/quote/root/quote-root.d.ts +14 -2
- package/dist/quote/root/quote-root.js +23 -1
- package/dist/radio/group/radio-group.d.ts +15 -0
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +7 -2
- package/dist/rating/root/rating-root.d.ts +30 -12
- package/dist/rating/root/rating-root.js +27 -27
- package/dist/scatter-chart/fit.d.ts +15 -0
- package/dist/scatter-chart/fit.js +35 -0
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +51 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +64 -24
- package/dist/scroll-area/root/scroll-area-root.d.ts +22 -51
- package/dist/scroll-area/root/scroll-area-root.js +57 -173
- package/dist/scroll-area/scrollbar-controller.d.ts +111 -0
- package/dist/scroll-area/scrollbar-controller.js +172 -0
- package/dist/scroll-area/scrollbar.d.ts +27 -8
- package/dist/scroll-area/scrollbar.js +10 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +71 -0
- package/dist/select/root/select-root.js +78 -6
- package/dist/skeleton/root/skeleton-root.d.ts +3 -0
- package/dist/skeleton/root/skeleton-root.js +4 -2
- package/dist/skip-link/root/skip-link-root.js +2 -2
- package/dist/slider/root/slider-root.d.ts +59 -5
- package/dist/slider/root/slider-root.js +45 -3
- package/dist/sparkline/readings.d.ts +36 -0
- package/dist/sparkline/readings.js +36 -0
- package/dist/sparkline/root/sparkline-root.d.ts +121 -7
- package/dist/sparkline/root/sparkline-root.js +160 -26
- package/dist/speed-dial/item/speed-dial-item.d.ts +1 -1
- package/dist/speed-dial/item/speed-dial-item.js +2 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +6 -0
- package/dist/speed-dial/root/speed-dial-root.js +11 -3
- package/dist/splitter/root/splitter-root.d.ts +10 -12
- package/dist/splitter/root/splitter-root.js +211 -204
- package/dist/stat/root/stat-root.d.ts +14 -5
- package/dist/stat/root/stat-root.js +21 -5
- package/dist/steps/reach.d.ts +5 -0
- package/dist/steps/reach.js +3 -0
- package/dist/steps/root/steps-root.d.ts +56 -3
- package/dist/steps/root/steps-root.js +50 -6
- package/dist/steps/step/step.d.ts +8 -0
- package/dist/steps/step/step.js +8 -3
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +6 -10
- package/dist/table/column/table-column.js +8 -20
- package/dist/table/root/table-root.d.ts +31 -10
- package/dist/table/root/table-root.js +14 -18
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/panel/tab-panel.d.ts +16 -3
- package/dist/tabs/panel/tab-panel.js +34 -5
- package/dist/tabs/root/tabs-root.d.ts +17 -3
- package/dist/tabs/root/tabs-root.js +1 -1
- package/dist/tabs/tab/tab.d.ts +5 -0
- package/dist/tabs/tab/tab.js +5 -2
- package/dist/tag/group/tag-group.d.ts +44 -5
- package/dist/tag/group/tag-group.js +60 -9
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +41 -2
- package/dist/textarea/root/textarea-root.js +39 -1
- package/dist/time-input/root/time-input-root.d.ts +10 -2
- package/dist/time-input/root/time-input-root.js +24 -13
- package/dist/time-picker/root/time-picker-root.d.ts +28 -17
- package/dist/time-picker/root/time-picker-root.js +18 -29
- package/dist/time-picker/wheel-name.d.ts +9 -0
- package/dist/time-picker/wheel-name.js +15 -0
- package/dist/timeline/group/timeline-group.js +2 -2
- package/dist/toast/item/toast-item.d.ts +16 -3
- package/dist/toast/item/toast-item.js +22 -6
- package/dist/toast/root/toast-root.d.ts +34 -4
- package/dist/toast/root/toast-root.js +74 -13
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +52 -7
- package/dist/toggle/group/toggle-group.js +58 -44
- package/dist/toggle/root/toggle-root.js +2 -4
- package/dist/toolbar/root/toolbar-root.d.ts +21 -5
- package/dist/toolbar/root/toolbar-root.js +52 -8
- package/dist/tooltip/root/tooltip-root.d.ts +20 -3
- package/dist/tooltip/root/tooltip-root.js +18 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +45 -2
- package/dist/tour/root/tour-root.js +53 -8
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/item/tree-item.d.ts +7 -3
- package/dist/tree/item/tree-item.js +3 -0
- package/dist/tree/root/tree-root.d.ts +24 -3
- package/dist/tree/root/tree-root.js +32 -13
- package/dist/tree/selection.js +2 -15
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +83 -19
- package/dist/trend/root/trend-root.js +59 -8
- package/dist/video/media-events.d.ts +13 -18
- package/dist/video/media-events.js +1 -5
- package/dist/video/root/extra-controls.d.ts +12 -0
- package/dist/video/root/extra-controls.js +6 -2
- package/dist/video/root/video-root.d.ts +23 -6
- package/dist/video/root/video-root.js +19 -10
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +2 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +17 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -8
- package/dist/virtual-list/fill.js +10 -17
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +65 -0
- package/dist/virtual-list/plan.js +27 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +136 -13
- package/dist/virtual-list/root/virtual-list-root.js +218 -51
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +7441 -1458
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +1501 -326
- package/dist/chat/relative-clock.d.ts +0 -39
- package/dist/chat/relative-clock.js +0 -31
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -16,6 +16,15 @@ export type MeterBand = 'fair' | 'good' | 'poor';
|
|
|
16
16
|
* band. `optimum` sets the preferred band. The band next to it is fair, and the
|
|
17
17
|
* band two away is poor.
|
|
18
18
|
*
|
|
19
|
+
* The band is a custom state on the meter, `good`, `fair` or `poor`, beside
|
|
20
|
+
* `over` and `under` for a value past an end, so a page styles the meter
|
|
21
|
+
* around the fill as well as the fill.
|
|
22
|
+
*
|
|
23
|
+
* **`live` says the reading when it moves into another band**, such as "92%,
|
|
24
|
+
* Poor", in a polite region, for a meter whose value changes while a reader is
|
|
25
|
+
* on the page: a disk filling or a battery draining. The band's word comes from
|
|
26
|
+
* `band-labels`.
|
|
27
|
+
*
|
|
19
28
|
* @since 0.1.0
|
|
20
29
|
* @status stable
|
|
21
30
|
* @category feedback
|
|
@@ -24,6 +33,8 @@ export type MeterBand = 'fair' | 'good' | 'poor';
|
|
|
24
33
|
*
|
|
25
34
|
* @slot label - A visible label. Its words name the meter in place of `label`.
|
|
26
35
|
*
|
|
36
|
+
* @event {HelixBandEvent} helix-band - Fired when the reading moves into another band, with the band it is in now, or `''` where it is in none. Not sent on the first render, since a meter that arrives in a band has not moved.
|
|
37
|
+
*
|
|
27
38
|
* @csspart groove - The unfilled circle, in `ring` and `arc`.
|
|
28
39
|
* @csspart indicator - The part of the track the value fills.
|
|
29
40
|
* @csspart indicator-fair - The fill while the reading is in a band next to the good band. Set alongside `indicator`.
|
|
@@ -31,6 +42,7 @@ export type MeterBand = 'fair' | 'good' | 'poor';
|
|
|
31
42
|
* @csspart indicator-over - The fill while the value is above `max`. Set alongside `indicator`.
|
|
32
43
|
* @csspart indicator-poor - The fill while the reading is two bands from the good band. Set alongside `indicator`.
|
|
33
44
|
* @csspart indicator-under - The fill while the value is below `min`. Set alongside `indicator`.
|
|
45
|
+
* @csspart live - A polite region that says the reading as it moves into another band, under `live`, rendered from the first time it does. Hide it visually.
|
|
34
46
|
* @csspart tick - A mark at `low` or at `high`.
|
|
35
47
|
* @csspart track - The whole range, or the drawing in `ring` and `arc`.
|
|
36
48
|
* @csspart value - The reading as text, shown when `show-value` is set.
|
|
@@ -39,6 +51,12 @@ export type MeterBand = 'fair' | 'good' | 'poor';
|
|
|
39
51
|
* @cssproperty --meter-at - Where a bound sits on a linear track, as a percentage.
|
|
40
52
|
* @cssproperty --meter-fraction - The value as a fraction of the range, 0 to 1.
|
|
41
53
|
* @cssproperty --meter-sweep - How much of the circle the arc covers, as a path length.
|
|
54
|
+
*
|
|
55
|
+
* @cssstate fair - The reading is in a band next to the good band.
|
|
56
|
+
* @cssstate good - The reading is in the good band.
|
|
57
|
+
* @cssstate over - The value is above `max`.
|
|
58
|
+
* @cssstate poor - The reading is two bands from the good band.
|
|
59
|
+
* @cssstate under - The value is below `min`.
|
|
42
60
|
*/
|
|
43
61
|
export declare class HelixHeadlessMeter extends HelixElement {
|
|
44
62
|
/**
|
|
@@ -71,6 +89,28 @@ export declare class HelixHeadlessMeter extends HelixElement {
|
|
|
71
89
|
* no reader.
|
|
72
90
|
*/
|
|
73
91
|
band?: MeterBand;
|
|
92
|
+
/**
|
|
93
|
+
* The words each band is said with under `live`, by its name, written as
|
|
94
|
+
* JSON in the attribute: `band-labels='{"poor":"Almost full"}'`.
|
|
95
|
+
*
|
|
96
|
+
* A band left out keeps its default: "Good", "Fair" or "Poor".
|
|
97
|
+
*/
|
|
98
|
+
bandLabels: Partial<Record<MeterBand, string>>;
|
|
99
|
+
/**
|
|
100
|
+
* `Intl.NumberFormat` options the reading is written with, as React Aria's
|
|
101
|
+
* Meter and ProgressBar take them: a unit, a currency, or a number of
|
|
102
|
+
* decimals. Written as JSON in the attribute.
|
|
103
|
+
*
|
|
104
|
+
* ```html
|
|
105
|
+
* <helix-meter value="18" max="32" format-options='{"style":"unit","unit":"gigabyte"}'></helix-meter>
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* A `percent` style writes the share of the range, and any other the value
|
|
109
|
+
* itself, so the example says "18 GB", and a value past an end as it is.
|
|
110
|
+
* Absent is a whole percentage. The words are announced as well as shown.
|
|
111
|
+
* `value-text` still wins.
|
|
112
|
+
*/
|
|
113
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
74
114
|
/**
|
|
75
115
|
* Bottom of the high band.
|
|
76
116
|
*
|
|
@@ -84,6 +124,15 @@ export declare class HelixHeadlessMeter extends HelixElement {
|
|
|
84
124
|
* shows, so the name and the label cannot disagree.
|
|
85
125
|
*/
|
|
86
126
|
label: string;
|
|
127
|
+
/**
|
|
128
|
+
* Says the reading in a polite `live` region each time it moves into
|
|
129
|
+
* another band, with the band's word, such as "92%, Poor".
|
|
130
|
+
*
|
|
131
|
+
* For a meter whose value changes while it is on screen. Off by default,
|
|
132
|
+
* because a meter that reads a fixed level has nothing new to say. A meter
|
|
133
|
+
* with no bands says nothing.
|
|
134
|
+
*/
|
|
135
|
+
live: boolean;
|
|
87
136
|
/**
|
|
88
137
|
* The locale the percentage is written in, such as `fr` for `72 %`.
|
|
89
138
|
*
|
|
@@ -156,6 +205,13 @@ export declare class HelixHeadlessMeter extends HelixElement {
|
|
|
156
205
|
* fair summary of a task and a poor one of a quantity.
|
|
157
206
|
*/
|
|
158
207
|
valueText: string;
|
|
208
|
+
/** The region `live` speaks in, rendered from the first time it does. */
|
|
209
|
+
private readonly status;
|
|
210
|
+
/**
|
|
211
|
+
* The band at the last update, so a move into another one is heard once:
|
|
212
|
+
* an empty string for none, and undefined before the first update.
|
|
213
|
+
*/
|
|
214
|
+
private lastBand;
|
|
159
215
|
/** The range, clamped so `max` is never at or below `min`. */
|
|
160
216
|
private get span();
|
|
161
217
|
/** The reading, pulled into the range. */
|
|
@@ -199,9 +255,14 @@ export declare class HelixHeadlessMeter extends HelixElement {
|
|
|
199
255
|
* keeps an unbanded meter from being painted as good news.
|
|
200
256
|
*/
|
|
201
257
|
private get computedBand();
|
|
202
|
-
/**
|
|
258
|
+
/**
|
|
259
|
+
* What the reading says: the consumer's words, or the reading in
|
|
260
|
+
* `format-options`, a share of the range for a percent and the value for
|
|
261
|
+
* anything else.
|
|
262
|
+
*/
|
|
203
263
|
private get text();
|
|
204
264
|
protected willUpdate(changed: PropertyValues): void;
|
|
265
|
+
protected updated(changed: PropertyValues): void;
|
|
205
266
|
/**
|
|
206
267
|
* The same reading, drawn round.
|
|
207
268
|
*
|
|
@@ -4,31 +4,23 @@ 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, hostAria, slottedWords } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, drawStatus, HelixBandEvent, HelixElement, hostAria, readingText, StatusController, slottedWords, wordsConverter, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
-
const
|
|
11
|
-
const percent = (share, locale) => {
|
|
12
|
-
let format = percents.get(locale);
|
|
13
|
-
if (!format) {
|
|
14
|
-
format = new Intl.NumberFormat(locale || undefined, {
|
|
15
|
-
maximumFractionDigits: 0,
|
|
16
|
-
style: 'percent',
|
|
17
|
-
});
|
|
18
|
-
percents.set(locale, format);
|
|
19
|
-
}
|
|
20
|
-
return format.format(share);
|
|
21
|
-
};
|
|
10
|
+
const BAND_WORDS = { fair: 'Fair', good: 'Good', poor: 'Poor' };
|
|
22
11
|
let HelixHeadlessMeter = class HelixHeadlessMeter extends HelixElement {
|
|
23
12
|
constructor() {
|
|
24
13
|
super(...arguments);
|
|
14
|
+
this.bandLabels = {};
|
|
25
15
|
this.label = 'Meter';
|
|
16
|
+
this.live = false;
|
|
26
17
|
this.locale = '';
|
|
27
18
|
this.max = 100;
|
|
28
19
|
this.min = 0;
|
|
29
20
|
this.showValue = false;
|
|
30
21
|
this.value = 0;
|
|
31
22
|
this.valueText = '';
|
|
23
|
+
this.status = new StatusController(this);
|
|
32
24
|
this.renamed = () => {
|
|
33
25
|
this.requestUpdate();
|
|
34
26
|
};
|
|
@@ -80,7 +72,8 @@ let HelixHeadlessMeter = class HelixHeadlessMeter extends HelixElement {
|
|
|
80
72
|
return distance === 0 ? 'good' : distance === 1 ? 'fair' : 'poor';
|
|
81
73
|
}
|
|
82
74
|
get text() {
|
|
83
|
-
return this.valueText ||
|
|
75
|
+
return (this.valueText ||
|
|
76
|
+
readingText(Number.isFinite(this.value) ? this.value : this.span.min, this.ratio, this.locale, this.formatOptions));
|
|
84
77
|
}
|
|
85
78
|
willUpdate(changed) {
|
|
86
79
|
super.willUpdate(changed);
|
|
@@ -90,7 +83,27 @@ let HelixHeadlessMeter = class HelixHeadlessMeter extends HelixElement {
|
|
|
90
83
|
this.internals.ariaValueMax = String(max);
|
|
91
84
|
this.internals.ariaValueNow = String(this.reading);
|
|
92
85
|
this.internals.ariaValueText =
|
|
93
|
-
this.valueText ||
|
|
86
|
+
this.valueText || this.formatOptions !== undefined || this.beyond ? this.text : null;
|
|
87
|
+
const band = this.computedBand;
|
|
88
|
+
const beyond = this.beyond;
|
|
89
|
+
this.toggleState('fair', band === 'fair');
|
|
90
|
+
this.toggleState('good', band === 'good');
|
|
91
|
+
this.toggleState('poor', band === 'poor');
|
|
92
|
+
this.toggleState('over', beyond === 'over');
|
|
93
|
+
this.toggleState('under', beyond === 'under');
|
|
94
|
+
}
|
|
95
|
+
updated(changed) {
|
|
96
|
+
super.updated(changed);
|
|
97
|
+
const band = this.computedBand;
|
|
98
|
+
const moved = this.lastBand !== undefined && (band ?? '') !== this.lastBand;
|
|
99
|
+
this.lastBand = band ?? '';
|
|
100
|
+
if (!moved) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
this.dispatchEvent(new HelixBandEvent({ band: band ?? '' }));
|
|
104
|
+
if (band && this.live) {
|
|
105
|
+
this.status.say(`${this.text}, ${this.bandLabels[band] ?? BAND_WORDS[band]}`);
|
|
106
|
+
}
|
|
94
107
|
}
|
|
95
108
|
renderRound() {
|
|
96
109
|
const bounds = this.thresholds;
|
|
@@ -138,18 +151,27 @@ let HelixHeadlessMeter = class HelixHeadlessMeter extends HelixElement {
|
|
|
138
151
|
style="--meter-fraction: ${this.fraction}"
|
|
139
152
|
></div>
|
|
140
153
|
</div>`}
|
|
141
|
-
${this.showValue ? html `<span part="value">${this.text}</span>` : nothing}`;
|
|
154
|
+
${this.showValue ? html `<span part="value">${this.text}</span>` : nothing}${drawStatus(this.status)}`;
|
|
142
155
|
}
|
|
143
156
|
};
|
|
144
157
|
__decorate([
|
|
145
158
|
property()
|
|
146
159
|
], HelixHeadlessMeter.prototype, "band", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ attribute: 'band-labels', converter: wordsConverter })
|
|
162
|
+
], HelixHeadlessMeter.prototype, "bandLabels", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ attribute: 'format-options', type: Object })
|
|
165
|
+
], HelixHeadlessMeter.prototype, "formatOptions", void 0);
|
|
147
166
|
__decorate([
|
|
148
167
|
property({ type: Number })
|
|
149
168
|
], HelixHeadlessMeter.prototype, "high", void 0);
|
|
150
169
|
__decorate([
|
|
151
170
|
property()
|
|
152
171
|
], HelixHeadlessMeter.prototype, "label", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
property({ type: Boolean })
|
|
174
|
+
], HelixHeadlessMeter.prototype, "live", void 0);
|
|
153
175
|
__decorate([
|
|
154
176
|
property()
|
|
155
177
|
], HelixHeadlessMeter.prototype, "locale", void 0);
|
|
@@ -36,8 +36,9 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
36
36
|
* @documentation https://fusion.dev/helix/components/navigation
|
|
37
37
|
*
|
|
38
38
|
* @slot - The destinations, as your own links.
|
|
39
|
+
* @slot indicator - A marker of your own, drawn inside the `indicator` part, where the current destination's place and size reach it.
|
|
39
40
|
*
|
|
40
|
-
* @csspart indicator - The marker that moves to the current destination.
|
|
41
|
+
* @csspart indicator - The marker that moves to the current destination. It carries the destination's place and size as `--indicator-x`, `--indicator-y`, `--indicator-inline-size` and `--indicator-block-size`, and `data-placed` once it has been placed.
|
|
41
42
|
* @csspart nav - The navigation landmark.
|
|
42
43
|
*/
|
|
43
44
|
export declare class HelixHeadlessNavigation extends HelixElement {
|
|
@@ -53,7 +53,7 @@ let HelixHeadlessNavigation = class HelixHeadlessNavigation extends HelixElement
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
get items() {
|
|
56
|
-
const slot = this.renderRoot.querySelector('slot');
|
|
56
|
+
const slot = this.renderRoot.querySelector('slot:not([name])');
|
|
57
57
|
return (slot?.assignedElements() ?? []);
|
|
58
58
|
}
|
|
59
59
|
watch() {
|
|
@@ -80,7 +80,7 @@ let HelixHeadlessNavigation = class HelixHeadlessNavigation extends HelixElement
|
|
|
80
80
|
}
|
|
81
81
|
render() {
|
|
82
82
|
return html `<nav part="nav" aria-label=${this.label}>
|
|
83
|
-
<div part="indicator" aria-hidden="true"></div>
|
|
83
|
+
<div part="indicator" aria-hidden="true"><slot name="indicator"></slot></div>
|
|
84
84
|
<slot @slotchange=${() => this.watch()}></slot>
|
|
85
85
|
</nav>`;
|
|
86
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
2
|
+
import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import type { HelixHeadlessNotificationGroup } from '../group/notification-group.js';
|
|
4
4
|
import type { HelixHeadlessNotification } from '../notification/notification.js';
|
|
5
5
|
declare const HelixHeadlessNotifications_base: (new (...args: any[]) => import("@fusion.dev/helix-core").CollectionElement) & typeof HelixElement;
|
|
@@ -32,7 +32,8 @@ declare const HelixHeadlessNotifications_base: (new (...args: any[]) => import("
|
|
|
32
32
|
* **`load-more` adds a button after the list** that sends `helix-load-more`,
|
|
33
33
|
* for a feed that holds one page of a longer list. Append the next page, set
|
|
34
34
|
* `loading` while it is on its way, and take `load-more` off once there is
|
|
35
|
-
* nothing more.
|
|
35
|
+
* nothing more. While the feed is loading the button stays, so focus stays on
|
|
36
|
+
* it, and it is `aria-disabled` and sends nothing.
|
|
36
37
|
*
|
|
37
38
|
* @since 0.1.0
|
|
38
39
|
* @status stable
|
|
@@ -41,8 +42,10 @@ declare const HelixHeadlessNotifications_base: (new (...args: any[]) => import("
|
|
|
41
42
|
* @documentation https://fusion.dev/helix/components/notifications
|
|
42
43
|
*
|
|
43
44
|
* @slot - The notifications.
|
|
45
|
+
* @slot empty - Replaces the words of `empty-text` in the `empty` part, such as a picture and a line of your own. The live region still says `empty-text`.
|
|
44
46
|
* @slot footer - Below the list, for a link to everything.
|
|
45
47
|
* @slot header - Above the list, for a title and the mark-all control.
|
|
48
|
+
* @slot loading - Replaces the words of `loading-text` in the `loading` part, such as a loader. The live region still says `loading-text`.
|
|
46
49
|
*
|
|
47
50
|
* @event {HelixDismissEvent} helix-dismiss - Fired when the user dismisses a row. The row dispatches it, and you can listen for it on the feed. Cancelable: cancel it to keep the row.
|
|
48
51
|
* @event {HelixLoadMoreEvent} helix-load-more - Fired when a reader presses the `load-more` button, asking for the next page of the feed.
|
|
@@ -55,8 +58,10 @@ declare const HelixHeadlessNotifications_base: (new (...args: any[]) => import("
|
|
|
55
58
|
* @csspart live - A copy of the empty and loading messages, in a live region that screen readers announce when they change. Visually hidden in the styled tier.
|
|
56
59
|
* @csspart loading - Shown while the feed is loading.
|
|
57
60
|
* @csspart mark-all - The control that marks everything read.
|
|
58
|
-
* @csspart more - The button after the list that asks for more, while `load-more` is set
|
|
61
|
+
* @csspart more - The button after the list that asks for more, while `load-more` is set. It is `aria-disabled` while the feed is loading.
|
|
59
62
|
*
|
|
63
|
+
* @cssstate empty - While the feed holds no notification and is not loading. Never on the server, which cannot count the rows.
|
|
64
|
+
* @cssstate loading - While `loading` is set.
|
|
60
65
|
* @cssstate media - While a notification in the list holds something in its media slot, so every row keeps that column.
|
|
61
66
|
*/
|
|
62
67
|
export declare class HelixHeadlessNotifications extends HelixHeadlessNotifications_base {
|
|
@@ -219,6 +224,11 @@ export declare class HelixHeadlessNotifications extends HelixHeadlessNotificatio
|
|
|
219
224
|
connectedCallback(): void;
|
|
220
225
|
disconnectedCallback(): void;
|
|
221
226
|
protected willUpdate(changed: PropertyValues): void;
|
|
227
|
+
/**
|
|
228
|
+
* The empty or the loading line, each around a slot of the same name whose
|
|
229
|
+
* fallback is the words, so a page can put its own in.
|
|
230
|
+
*/
|
|
231
|
+
protected renderStatus(hasContent: boolean): TemplateResult | typeof nothing;
|
|
222
232
|
/**
|
|
223
233
|
* Says whether anything in the feed has media, so every item can hold the
|
|
224
234
|
* column open whether or not it has one of its own.
|
|
@@ -260,7 +270,13 @@ export declare class HelixHeadlessNotifications extends HelixHeadlessNotificatio
|
|
|
260
270
|
private markEmpty;
|
|
261
271
|
protected updated(changed: PropertyValues): void;
|
|
262
272
|
protected render(): TemplateResult;
|
|
263
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* Asks for the next page, for the `load-more` button, unless a page is
|
|
275
|
+
* already on its way.
|
|
276
|
+
*
|
|
277
|
+
* The button stays while the feed is loading, marked `aria-disabled`, so
|
|
278
|
+
* focus stays on it: removed, it took focus with it to the body.
|
|
279
|
+
*/
|
|
264
280
|
private readonly askForMore;
|
|
265
281
|
/**
|
|
266
282
|
* Marks everything read, and keeps focus in the feed.
|
|
@@ -54,7 +54,9 @@ let HelixHeadlessNotifications = class HelixHeadlessNotifications extends MixinC
|
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
this.askForMore = () => {
|
|
57
|
-
this.
|
|
57
|
+
if (!this.loading) {
|
|
58
|
+
this.dispatchEvent(new HelixLoadMoreEvent());
|
|
59
|
+
}
|
|
58
60
|
};
|
|
59
61
|
this.handleMarkAll = (event) => {
|
|
60
62
|
const button = event.currentTarget;
|
|
@@ -137,7 +139,7 @@ let HelixHeadlessNotifications = class HelixHeadlessNotifications extends MixinC
|
|
|
137
139
|
return;
|
|
138
140
|
}
|
|
139
141
|
list.assign(...this.rows);
|
|
140
|
-
for (const name of ['header', 'footer']) {
|
|
142
|
+
for (const name of ['header', 'footer', 'empty', 'loading']) {
|
|
141
143
|
const slot = root?.querySelector?.(`slot[name="${name}"]`);
|
|
142
144
|
slot?.assign?.(...[...this.children].filter((child) => child.getAttribute('slot') === name));
|
|
143
145
|
}
|
|
@@ -151,9 +153,9 @@ let HelixHeadlessNotifications = class HelixHeadlessNotifications extends MixinC
|
|
|
151
153
|
rove() {
|
|
152
154
|
const rows = this.reachable;
|
|
153
155
|
const stop = rovingStop(rows, this.stopRow);
|
|
154
|
-
const
|
|
155
|
-
for (const row of
|
|
156
|
-
const position =
|
|
156
|
+
const items = this.items;
|
|
157
|
+
for (const row of items) {
|
|
158
|
+
const position = items.indexOf(row) + 1;
|
|
157
159
|
whenHydrated(row, () => {
|
|
158
160
|
row.stop = row === stop;
|
|
159
161
|
row.position = this.total === undefined ? 0 : position;
|
|
@@ -176,6 +178,16 @@ let HelixHeadlessNotifications = class HelixHeadlessNotifications extends MixinC
|
|
|
176
178
|
willUpdate(changed) {
|
|
177
179
|
super.willUpdate(changed);
|
|
178
180
|
hostAria(this.internals, { label: this.label || 'Notifications', role: 'region' });
|
|
181
|
+
this.toggleState('loading', this.loading);
|
|
182
|
+
this.toggleState('empty', !this.loading && this.childrenKnown && this.items.length === 0);
|
|
183
|
+
}
|
|
184
|
+
renderStatus(hasContent) {
|
|
185
|
+
if (!this.loading && hasContent) {
|
|
186
|
+
return nothing;
|
|
187
|
+
}
|
|
188
|
+
return this.loading
|
|
189
|
+
? html `<p part="loading"><slot name="loading">${this.loadingText}</slot></p>`
|
|
190
|
+
: html `<p part="empty"><slot name="empty">${this.emptyText}</slot></p>`;
|
|
179
191
|
}
|
|
180
192
|
markMedia() {
|
|
181
193
|
this.toggleState('media', this.items.some((item) => item.querySelector(':scope > [slot="media"]') !== null));
|
|
@@ -210,13 +222,23 @@ let HelixHeadlessNotifications = class HelixHeadlessNotifications extends MixinC
|
|
|
210
222
|
</button>`
|
|
211
223
|
: nothing}
|
|
212
224
|
</div>
|
|
213
|
-
<div
|
|
225
|
+
<div
|
|
226
|
+
part="list"
|
|
227
|
+
role="list"
|
|
228
|
+
aria-busy=${this.loading ? 'true' : nothing}
|
|
229
|
+
aria-label=${this.label || nothing}
|
|
230
|
+
>
|
|
214
231
|
<slot name="items" @slotchange=${this.handleSlotChange}></slot>
|
|
215
232
|
${this.renderStatus(hasItems)}
|
|
216
233
|
</div>
|
|
217
234
|
${this.renderLive(hasItems)}
|
|
218
|
-
${this.loadMore
|
|
219
|
-
? html `<button
|
|
235
|
+
${this.loadMore
|
|
236
|
+
? html `<button
|
|
237
|
+
part="more"
|
|
238
|
+
type="button"
|
|
239
|
+
aria-disabled=${this.loading ? 'true' : nothing}
|
|
240
|
+
@click=${this.askForMore}
|
|
241
|
+
>
|
|
220
242
|
${this.loadMoreLabel}
|
|
221
243
|
</button>`
|
|
222
244
|
: nothing}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The steps a number field takes when `step` is not set, read off its format.
|
|
3
|
+
*
|
|
4
|
+
* React Aria's NumberField does not round a typed number to whole steps when
|
|
5
|
+
* no step is given: it keeps the fraction the format shows. A field showing
|
|
6
|
+
* dollars keeps cents, and one showing a percent steps by one percent.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The smallest amount a format shows, which is the grid a typed number is
|
|
10
|
+
* rounded to when no `step` is set: `0.01` for a currency in dollars, `0.001`
|
|
11
|
+
* for a plain decimal, and `0.01` for a whole percent, since a percent shows
|
|
12
|
+
* the number a hundred times over.
|
|
13
|
+
*/
|
|
14
|
+
export declare const formatGrain: (locale: string, options: Intl.NumberFormatOptions) => number;
|
|
15
|
+
/**
|
|
16
|
+
* How far one press moves when no `step` is set: one percent for a percent,
|
|
17
|
+
* as React Aria does, and one otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export declare const strideOf: (options: Intl.NumberFormatOptions | undefined) => number;
|
|
20
|
+
/**
|
|
21
|
+
* How many decimal places a number is written with.
|
|
22
|
+
*
|
|
23
|
+
* Read off the string rather than computed, because the question is about how
|
|
24
|
+
* the consumer wrote the step and not about what the binary can represent.
|
|
25
|
+
* `1e-7` is handled separately: its string form has no dot at all, so counting
|
|
26
|
+
* after one would say zero and round every result to a whole number.
|
|
27
|
+
*/
|
|
28
|
+
export declare const decimals: (value: number) => number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const formatGrain = (locale, options) => {
|
|
2
|
+
const { maximumFractionDigits = 0 } = new Intl.NumberFormat(locale || undefined, options).resolvedOptions();
|
|
3
|
+
const places = maximumFractionDigits + (options.style === 'percent' ? 2 : 0);
|
|
4
|
+
return Number(`1e-${places}`);
|
|
5
|
+
};
|
|
6
|
+
export const strideOf = (options) => options?.style === 'percent' ? 0.01 : 1;
|
|
7
|
+
export const decimals = (value) => {
|
|
8
|
+
const text = String(value);
|
|
9
|
+
const exponent = /e-(\d+)$/.exec(text);
|
|
10
|
+
if (exponent) {
|
|
11
|
+
return Number(exponent[1]);
|
|
12
|
+
}
|
|
13
|
+
return (text.split('.')[1] ?? '').length;
|
|
14
|
+
};
|
|
@@ -25,9 +25,10 @@ declare const HelixHeadlessNumberInput_base: (new (...args: any[]) => import("@f
|
|
|
25
25
|
* The locale's group separators are read in every field, so `1,234` is a
|
|
26
26
|
* number in `en-US`.
|
|
27
27
|
*
|
|
28
|
-
* On iOS and iPadOS the field is a text field
|
|
29
|
-
*
|
|
30
|
-
*
|
|
28
|
+
* On iOS and iPadOS the field is a plain text field, with no
|
|
29
|
+
* `role="spinbutton"`, which VoiceOver reads as a slider you cannot type in,
|
|
30
|
+
* and no role description, so VoiceOver says the field is required. React
|
|
31
|
+
* Aria's NumberField does the same.
|
|
31
32
|
*
|
|
32
33
|
* Validity follows the platform's rules: `min`, `max`, and `step` are checked
|
|
33
34
|
* and reported through the host's own `setValidity`, under the platform's flag
|
|
@@ -36,6 +37,19 @@ declare const HelixHeadlessNumberInput_base: (new (...args: any[]) => import("@f
|
|
|
36
37
|
* Stepping is separate from typing, so a number is not corrected while you type
|
|
37
38
|
* it.
|
|
38
39
|
*
|
|
40
|
+
* **Keyboard.** The field is one tab stop, and the stepper buttons are not in
|
|
41
|
+
* the tab order.
|
|
42
|
+
*
|
|
43
|
+
* | Key | What it does |
|
|
44
|
+
* |---|---|
|
|
45
|
+
* | Up, Down | Steps the value up or down by `step`. |
|
|
46
|
+
* | Page Up, Page Down | Steps by `large-step` steps, ten by default. |
|
|
47
|
+
* | Home, End | Goes to `min` or `max`, where there is one. Without one, moves the caret. |
|
|
48
|
+
* | Enter | Commits the typed number and submits the form, as a native field does. |
|
|
49
|
+
*
|
|
50
|
+
* The field has `role="spinbutton"` with `aria-valuenow`, `aria-valuemin`,
|
|
51
|
+
* `aria-valuemax`, and the formatted text in `aria-valuetext`.
|
|
52
|
+
*
|
|
39
53
|
* @since 0.1.0
|
|
40
54
|
* @status stable
|
|
41
55
|
* @category forms
|
|
@@ -63,6 +77,7 @@ declare const HelixHeadlessNumberInput_base: (new (...args: any[]) => import("@f
|
|
|
63
77
|
* @csspart label - The label above the field. It is also the grip you drag when `scrub` is set.
|
|
64
78
|
*
|
|
65
79
|
* @cssstate invalid - The control has an error to show, from the browser's validation or from your `feedback`.
|
|
80
|
+
* @cssstate scrubbing - The label is being dragged to change the value, under `scrub`, as Zag's scrubber says while it is held.
|
|
66
81
|
*/
|
|
67
82
|
export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_base {
|
|
68
83
|
protected readonly aria: AriaForwardController;
|
|
@@ -154,11 +169,6 @@ export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_b
|
|
|
154
169
|
* Prevents editing. The value is still submitted with the form.
|
|
155
170
|
*/
|
|
156
171
|
readOnly: boolean;
|
|
157
|
-
/**
|
|
158
|
-
* What the field is described as on iOS and iPadOS, where it carries no
|
|
159
|
-
* spinbutton role. See the class description.
|
|
160
|
-
*/
|
|
161
|
-
roleDescription: string;
|
|
162
172
|
/**
|
|
163
173
|
* Makes the label a grip that changes the value when it is dragged.
|
|
164
174
|
*
|
|
@@ -173,8 +183,14 @@ export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_b
|
|
|
173
183
|
/**
|
|
174
184
|
* How far one step moves. A value off the step grid, counted from `min`, is
|
|
175
185
|
* invalid, as it is in a native number field.
|
|
186
|
+
*
|
|
187
|
+
* Unset, a step moves by one, or by one percent under a percent format, and
|
|
188
|
+
* a typed number is rounded to the smallest amount `format-options` shows
|
|
189
|
+
* rather than to whole steps, as React Aria's NumberField does: a field
|
|
190
|
+
* showing dollars keeps the cents typed into it. Without `format-options`
|
|
191
|
+
* the grid is whole numbers, as in a native number field.
|
|
176
192
|
*/
|
|
177
|
-
step
|
|
193
|
+
step?: number;
|
|
178
194
|
/**
|
|
179
195
|
* The message the browser shows when the number is off the step grid, with
|
|
180
196
|
* `{below}` and `{above}` filled in with the nearest valid values.
|
|
@@ -213,6 +229,15 @@ export declare class HelixHeadlessNumberInput extends HelixHeadlessNumberInput_b
|
|
|
213
229
|
private get control();
|
|
214
230
|
/** The value as a number, or `null` where the field holds nothing usable. */
|
|
215
231
|
private get numeric();
|
|
232
|
+
/** The grain last read off the format, with the locale and options it was read for. */
|
|
233
|
+
private grainOf?;
|
|
234
|
+
/** How far one press moves: `step`, or the stride the format implies. */
|
|
235
|
+
private get stride();
|
|
236
|
+
/**
|
|
237
|
+
* The grid a typed number is rounded to: `step` where it is set, and
|
|
238
|
+
* otherwise the smallest amount the format shows, or whole numbers.
|
|
239
|
+
*/
|
|
240
|
+
private get grid();
|
|
216
241
|
/** Whether `value` is on the step grid, counted from `min`. */
|
|
217
242
|
private onStep;
|
|
218
243
|
/**
|