@fusion.dev/helix-headless 0.144.0 → 0.146.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 +15195 -4240
- package/dist/accordion/item/accordion-item.d.ts +62 -12
- package/dist/accordion/item/accordion-item.js +41 -10
- package/dist/accordion/root/accordion-root.d.ts +14 -5
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +24 -3
- package/dist/announcement/root/announcement-root.js +39 -2
- package/dist/app-header/root/app-header-root.d.ts +12 -0
- package/dist/app-header/root/app-header-root.js +13 -1
- package/dist/app-header/sectioning.d.ts +9 -0
- package/dist/app-header/sectioning.js +27 -0
- package/dist/avatar/group/avatar-group.d.ts +20 -14
- package/dist/avatar/group/avatar-group.js +17 -19
- package/dist/badge/root/badge-root.d.ts +3 -1
- package/dist/badge/root/badge-root.js +2 -2
- package/dist/bar-chart/root/bar-chart-root.d.ts +18 -1
- package/dist/bar-chart/root/bar-chart-root.js +52 -15
- package/dist/bar-chart/stack.d.ts +15 -0
- package/dist/bar-chart/stack.js +19 -0
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +57 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +73 -3
- package/dist/button/root/button-root.d.ts +26 -0
- package/dist/button/root/button-root.js +38 -18
- 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.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +123 -42
- package/dist/card/root/card-root.d.ts +24 -3
- package/dist/card/root/card-root.js +20 -8
- package/dist/carousel/root/carousel-root.d.ts +133 -4
- package/dist/carousel/root/carousel-root.js +174 -24
- package/dist/carousel/stops.d.ts +20 -0
- package/dist/carousel/stops.js +30 -0
- package/dist/chat/composer/chat-composer.d.ts +38 -6
- package/dist/chat/composer/chat-composer.js +42 -9
- package/dist/chat/message/chat-message.d.ts +32 -1
- package/dist/chat/message/chat-message.js +27 -10
- package/dist/chat/naming.d.ts +26 -0
- package/dist/chat/naming.js +14 -0
- package/dist/chat/root/chat-root.d.ts +58 -0
- package/dist/chat/root/chat-root.js +43 -3
- package/dist/checkbox/root/checkbox-root.d.ts +20 -0
- package/dist/checkbox/root/checkbox-root.js +14 -1
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +8 -2
- package/dist/checkbox-group/root/checkbox-group-root.js +12 -10
- package/dist/checkbox-group/select-all.d.ts +27 -0
- package/dist/checkbox-group/select-all.js +12 -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 +57 -2
- package/dist/code-block/root/code-block-root.js +63 -8
- package/dist/color-input/root/color-input-root.d.ts +3 -0
- package/dist/color-input/root/color-input-root.js +6 -3
- package/dist/color-picker/root/color-picker-root.d.ts +33 -4
- package/dist/color-picker/root/color-picker-root.js +80 -21
- package/dist/color-picker/swatches.d.ts +12 -0
- package/dist/color-picker/swatches.js +26 -0
- package/dist/combobox/root/combobox-root.d.ts +43 -0
- package/dist/combobox/root/combobox-root.js +79 -15
- package/dist/command/root/command-root.d.ts +16 -1
- package/dist/command/root/command-root.js +22 -4
- package/dist/copy-button/root/copy-button-root.d.ts +26 -1
- package/dist/copy-button/root/copy-button-root.js +12 -5
- package/dist/data-table/index.d.ts +1 -1
- package/dist/data-table/index.js +1 -1
- package/dist/data-table/keys.d.ts +24 -0
- package/dist/data-table/keys.js +24 -0
- package/dist/data-table/root/data-table-root.d.ts +170 -13
- package/dist/data-table/root/data-table-root.js +294 -52
- package/dist/data-table/tree.d.ts +55 -0
- package/dist/data-table/tree.js +54 -0
- package/dist/date-input/root/date-input-root.d.ts +3 -1
- package/dist/date-input/root/date-input-root.js +18 -7
- package/dist/date-picker/root/date-picker-root.js +12 -6
- package/dist/description-list/item/description-list-item.d.ts +17 -2
- package/dist/description-list/item/description-list-item.js +15 -2
- package/dist/description-list/root/description-list-root.d.ts +27 -1
- package/dist/description-list/root/description-list-root.js +26 -1
- 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 +48 -1
- package/dist/drawer/reveal.d.ts +8 -0
- package/dist/drawer/reveal.js +1 -0
- package/dist/drawer/root/drawer-root.d.ts +59 -0
- package/dist/drawer/root/drawer-root.js +63 -4
- package/dist/drilldown/item/drilldown-item.d.ts +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +29 -0
- package/dist/drilldown/root/drilldown-root.js +28 -5
- package/dist/element-events.generated.js +83 -12
- package/dist/empty/root/empty-root.d.ts +3 -1
- package/dist/empty/root/empty-root.js +3 -2
- package/dist/file-input/root/file-input-root.d.ts +69 -6
- package/dist/file-input/root/file-input-root.js +82 -19
- package/dist/file-input/screen.d.ts +2 -1
- package/dist/filter-input/menu/filter-menu.d.ts +5 -0
- package/dist/filter-input/menu/filter-menu.js +16 -4
- package/dist/filter-input/root/filter-input-root.d.ts +30 -6
- package/dist/filter-input/root/filter-input-root.js +1 -1
- package/dist/filter-input/suggest.d.ts +28 -3
- package/dist/filter-input/suggest.js +18 -8
- package/dist/format-date/root/format-date-root.d.ts +9 -16
- package/dist/format-date/root/format-date-root.js +10 -27
- package/dist/heatmap/root/heatmap-root.d.ts +24 -13
- package/dist/heatmap/root/heatmap-root.js +34 -12
- package/dist/icon/root/icon-root.d.ts +12 -1
- package/dist/icon/root/icon-root.js +21 -10
- 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 +5 -1
- package/dist/image/root/image-root.js +10 -2
- package/dist/input/root/input-root.d.ts +13 -3
- package/dist/input/root/input-root.js +12 -3
- package/dist/kbd/root/kbd-root.d.ts +35 -1
- package/dist/kbd/root/kbd-root.js +23 -4
- package/dist/legend/root/legend-root.d.ts +55 -8
- package/dist/legend/root/legend-root.js +55 -13
- package/dist/lightbox/root/lightbox-root.d.ts +49 -6
- package/dist/lightbox/root/lightbox-root.js +86 -19
- package/dist/lightbox/zoom-controller.d.ts +59 -0
- package/dist/lightbox/zoom-controller.js +128 -0
- package/dist/lightbox/zoom.d.ts +22 -0
- package/dist/lightbox/zoom.js +16 -0
- package/dist/line-chart/root/line-chart-root.d.ts +22 -1
- package/dist/line-chart/root/line-chart-root.js +21 -1
- package/dist/list/item/list-item.d.ts +70 -1
- package/dist/list/item/list-item.js +77 -6
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +155 -9
- package/dist/list/root/list-root.js +246 -4
- package/dist/list/selection.d.ts +49 -0
- package/dist/list/selection.js +30 -0
- package/dist/listbox/root/listbox-root.d.ts +37 -1
- package/dist/listbox/root/listbox-root.js +49 -4
- 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/map/root/map-root.d.ts +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +62 -0
- package/dist/megamenu/root/megamenu-root.js +90 -5
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +87 -11
- package/dist/menu/item/menu-item.js +78 -22
- package/dist/menu/root/menu-root.d.ts +39 -1
- package/dist/menu/root/menu-root.js +65 -8
- package/dist/menu/section/menu-section.d.ts +55 -0
- package/dist/menu/section/menu-section.js +60 -0
- package/dist/meter/root/meter-root.d.ts +20 -1
- package/dist/meter/root/meter-root.js +11 -15
- package/dist/navigation/root/navigation-root.d.ts +18 -2
- package/dist/navigation/root/navigation-root.js +29 -3
- package/dist/notifications/root/notifications-root.d.ts +25 -0
- package/dist/notifications/root/notifications-root.js +33 -5
- package/dist/number-input/root/number-input-root.d.ts +17 -8
- package/dist/number-input/root/number-input-root.js +2 -7
- package/dist/object-inspector/root/object-inspector-root.d.ts +161 -32
- package/dist/object-inspector/root/object-inspector-root.js +264 -123
- package/dist/object-inspector/rows.d.ts +75 -0
- package/dist/object-inspector/rows.js +119 -0
- package/dist/option/root/option-root.d.ts +5 -3
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +86 -3
- package/dist/outline/root/outline-root.js +95 -12
- package/dist/pagination/size/pagination-size.d.ts +12 -2
- package/dist/pagination/size/pagination-size.js +20 -5
- package/dist/pin-input/code.d.ts +10 -0
- package/dist/pin-input/code.js +13 -0
- package/dist/pin-input/root/pin-input-root.d.ts +25 -1
- package/dist/pin-input/root/pin-input-root.js +10 -11
- package/dist/popover/hide-outside.d.ts +14 -0
- package/dist/popover/hide-outside.js +41 -0
- package/dist/popover/root/popover-root.d.ts +57 -7
- package/dist/popover/root/popover-root.js +58 -3
- package/dist/progress/root/progress-root.d.ts +20 -0
- package/dist/progress/root/progress-root.js +15 -15
- package/dist/qr-code/export.d.ts +26 -1
- package/dist/qr-code/export.js +14 -0
- package/dist/qr-code/root/qr-code-root.d.ts +19 -5
- package/dist/qr-code/root/qr-code-root.js +58 -9
- 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 +4 -10
- package/dist/radio/group/radio-group.js +5 -10
- package/dist/radio/root/radio-root.d.ts +6 -2
- package/dist/radio/root/radio-root.js +6 -1
- package/dist/rating/root/rating-root.d.ts +10 -5
- package/dist/rating/root/rating-root.js +32 -8
- package/dist/rating/steps.d.ts +7 -0
- package/dist/rating/steps.js +9 -0
- 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 +21 -1
- package/dist/scatter-chart/root/scatter-chart-root.js +30 -17
- package/dist/scroll-area/root/scroll-area-root.d.ts +84 -0
- package/dist/scroll-area/root/scroll-area-root.js +106 -7
- 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 +92 -0
- package/dist/scroll-area/scrollbar.js +33 -0
- package/dist/select/root/select-root.d.ts +15 -0
- package/dist/select/root/select-root.js +18 -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 +41 -4
- package/dist/slider/root/slider-root.js +23 -3
- package/dist/sparkline/readings.d.ts +18 -0
- package/dist/sparkline/readings.js +19 -0
- package/dist/sparkline/root/sparkline-root.d.ts +78 -7
- package/dist/sparkline/root/sparkline-root.js +118 -23
- package/dist/speed-dial/root/speed-dial-root.js +2 -2
- package/dist/splitter/root/splitter-root.d.ts +20 -12
- package/dist/splitter/root/splitter-root.js +226 -203
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- 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 +20 -0
- package/dist/steps/reach.js +15 -0
- package/dist/steps/root/steps-root.d.ts +76 -0
- package/dist/steps/root/steps-root.js +93 -1
- package/dist/steps/step/step.d.ts +45 -2
- package/dist/steps/step/step.js +33 -6
- package/dist/switch/root/switch-root.d.ts +10 -0
- package/dist/table/column/table-column.d.ts +11 -10
- package/dist/table/column/table-column.js +8 -19
- package/dist/table/root/table-root.d.ts +126 -4
- package/dist/table/root/table-root.js +156 -6
- package/dist/table/row/table-row.d.ts +47 -1
- package/dist/table/row/table-row.js +39 -2
- package/dist/tabs/panel/tab-panel.d.ts +22 -5
- package/dist/tabs/panel/tab-panel.js +34 -6
- package/dist/tabs/root/tabs-root.d.ts +37 -1
- package/dist/tabs/root/tabs-root.js +22 -4
- package/dist/tabs/tab/tab.d.ts +41 -4
- package/dist/tabs/tab/tab.js +49 -3
- package/dist/tag/group/tag-group.d.ts +31 -4
- package/dist/tag/group/tag-group.js +46 -7
- package/dist/tag/root/tag-root.js +9 -2
- package/dist/textarea/root/textarea-root.d.ts +28 -1
- package/dist/textarea/root/textarea-root.js +40 -1
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +16 -8
- package/dist/time-picker/root/time-picker-root.d.ts +18 -4
- package/dist/time-picker/root/time-picker-root.js +7 -10
- 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.d.ts +46 -0
- package/dist/timeline/group/timeline-group.js +37 -0
- package/dist/timeline/index.d.ts +1 -0
- package/dist/timeline/index.js +1 -0
- package/dist/timeline/root/timeline-root.d.ts +10 -3
- package/dist/toast/item/toast-item.d.ts +24 -18
- package/dist/toast/item/toast-item.js +36 -40
- package/dist/toast/root/toast-root.d.ts +6 -0
- package/dist/toast/root/toast-root.js +16 -1
- package/dist/toggle/group/toggle-group.d.ts +24 -3
- package/dist/toggle/group/toggle-group.js +34 -5
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- package/dist/tooltip/root/tooltip-root.d.ts +13 -2
- package/dist/tooltip/root/tooltip-root.js +9 -1
- package/dist/tour/back.d.ts +10 -0
- package/dist/tour/back.js +8 -0
- package/dist/tour/root/tour-root.d.ts +30 -2
- package/dist/tour/root/tour-root.js +34 -8
- package/dist/tree/item/tree-item.d.ts +61 -4
- package/dist/tree/item/tree-item.js +92 -20
- package/dist/tree/root/tree-root.d.ts +58 -0
- package/dist/tree/root/tree-root.js +80 -16
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +13 -0
- package/dist/trend/root/trend-root.d.ts +43 -18
- package/dist/trend/root/trend-root.js +31 -6
- package/dist/video/media-events.d.ts +44 -0
- package/dist/video/media-events.js +35 -0
- package/dist/video/root/video-root.d.ts +117 -18
- package/dist/video/root/video-root.js +93 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +5 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +3 -1
- package/dist/video-playlist/order.d.ts +41 -0
- package/dist/video-playlist/order.js +34 -0
- package/dist/video-playlist/root/video-playlist-root.d.ts +77 -3
- package/dist/video-playlist/root/video-playlist-root.js +60 -16
- package/dist/virtual-list/controls.d.ts +4 -0
- package/dist/virtual-list/controls.js +30 -0
- package/dist/virtual-list/fill.d.ts +22 -0
- package/dist/virtual-list/fill.js +23 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/plan.d.ts +49 -0
- package/dist/virtual-list/plan.js +16 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +259 -26
- package/dist/virtual-list/root/virtual-list-root.js +333 -49
- package/lint.json +1 -1
- package/package.json +8 -8
- package/types/jsx.d.ts +8113 -1394
- package/types/svelte.d.ts +2 -0
- package/types/vue.d.ts +1678 -353
- package/dist/data-table/root/order.d.ts +0 -141
- package/dist/data-table/root/order.js +0 -76
- package/dist/listbox/range.d.ts +0 -17
- package/dist/listbox/range.js +0 -5
- package/dist/tag/selection.d.ts +0 -10
- package/dist/tag/selection.js +0 -12
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
|
+
import type { HelixHeadlessStep } from '../step/step.js';
|
|
3
4
|
declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerActiveInterface) & typeof HelixElement;
|
|
4
5
|
/**
|
|
5
6
|
* @summary A sequence of stages that shows which stage the user is on.
|
|
@@ -13,6 +14,29 @@ declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.
|
|
|
13
14
|
* sequence is correct in the server's markup, where the root cannot count its
|
|
14
15
|
* slotted children.
|
|
15
16
|
*
|
|
17
|
+
* `linear` keeps a reader from passing a stage they have not finished, as Ark
|
|
18
|
+
* UI's linear steps do: a stage ahead is out of reach, and its button disabled,
|
|
19
|
+
* until every stage before it is `complete` or `optional`. Going back is always
|
|
20
|
+
* allowed. `next()` and `previous()` move one stage either way, under the
|
|
21
|
+
* same rules, for your own buttons.
|
|
22
|
+
*
|
|
23
|
+
* To check a stage before a reader moves on from it, set `validate` to a
|
|
24
|
+
* function that answers whether the stage is valid, as Ark UI's `isStepValid`
|
|
25
|
+
* does. Moving forward asks it about the stage the reader is on, and where it
|
|
26
|
+
* answers `false` the reader stays and the stage is `:state(invalid)` until it
|
|
27
|
+
* answers `true`. An `optional` stage is not asked. `helix-before-activate`
|
|
28
|
+
* is still sent for every move, for a check of your own.
|
|
29
|
+
*
|
|
30
|
+
* `progress` is how far through the sequence is, from 0 to 100: the share of
|
|
31
|
+
* its stages that are `complete`. The `progress` part carries it as a
|
|
32
|
+
* `progressbar` and as `--steps-progress`, and is hidden until a stylesheet
|
|
33
|
+
* gives it a `display`, so a bar of your own costs nothing until you draw it.
|
|
34
|
+
* The sequence is `:state(complete)` once every stage is.
|
|
35
|
+
*
|
|
36
|
+
* The sequence is a list named by `label`, and each step a list item. The
|
|
37
|
+
* current stage's button says `aria-current="step"`, and a finished stage's
|
|
38
|
+
* button is described by its `complete-label`.
|
|
39
|
+
*
|
|
16
40
|
* @since 0.1.0
|
|
17
41
|
* @status stable
|
|
18
42
|
* @category navigation
|
|
@@ -24,6 +48,12 @@ declare const HelixHeadlessSteps_base: (new (...args: any[]) => import("@fusion.
|
|
|
24
48
|
* @event {HelixActivateEvent} helix-activate - Fired after the current step changes, when the element already holds the new step.
|
|
25
49
|
* @event {HelixBeforeActivateEvent} helix-before-activate - Fired before the active step changes. Cancelable: cancel it to keep the current step.
|
|
26
50
|
* @event {HelixSelectEvent} helix-select - Fired when a step is pressed. The step dispatches it, and you can listen for it on the sequence. Cancelable: cancel it to keep the current step.
|
|
51
|
+
*
|
|
52
|
+
* @csspart progress - How far through the sequence is, as a `progressbar` carrying `--steps-progress`. Hidden until a stylesheet gives it a `display`.
|
|
53
|
+
*
|
|
54
|
+
* @cssproperty --steps-progress - How far through the sequence is, as a percentage, written on the `progress` part.
|
|
55
|
+
*
|
|
56
|
+
* @cssstate complete - Every stage is complete.
|
|
27
57
|
*/
|
|
28
58
|
export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
|
|
29
59
|
/**
|
|
@@ -33,6 +63,11 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
|
|
|
33
63
|
* needs a name of its own rather than borrowing the heading above it.
|
|
34
64
|
*/
|
|
35
65
|
label: string;
|
|
66
|
+
/**
|
|
67
|
+
* Whether a reader has to finish each stage, or pass an `optional` one,
|
|
68
|
+
* before going on to the next.
|
|
69
|
+
*/
|
|
70
|
+
linear: boolean;
|
|
36
71
|
/**
|
|
37
72
|
* Which way the steps run.
|
|
38
73
|
*
|
|
@@ -47,6 +82,17 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
|
|
|
47
82
|
* catches people out.
|
|
48
83
|
*/
|
|
49
84
|
orientation?: 'vertical';
|
|
85
|
+
/**
|
|
86
|
+
* A function that answers whether a stage is valid, asked about the stage a
|
|
87
|
+
* reader is on before they move forward from it. Return `false` to keep them
|
|
88
|
+
* there. Not asked of an `optional` stage, nor for a move back.
|
|
89
|
+
*/
|
|
90
|
+
validate?: (step: HelixHeadlessStep) => boolean;
|
|
91
|
+
/**
|
|
92
|
+
* How far through the sequence is, from 0 to 100: the share of its stages
|
|
93
|
+
* that are `complete`, rounded to a whole number.
|
|
94
|
+
*/
|
|
95
|
+
get progress(): number;
|
|
50
96
|
/**
|
|
51
97
|
* What each step is marked with.
|
|
52
98
|
*
|
|
@@ -62,6 +108,30 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
|
|
|
62
108
|
variant?: 'numeric';
|
|
63
109
|
/** The steps, in the order the consumer wrote them. */
|
|
64
110
|
private get steps();
|
|
111
|
+
/** The index of the stage the reader is on, or `-1`. */
|
|
112
|
+
private get at();
|
|
113
|
+
/**
|
|
114
|
+
* Moves to the next stage that can be gone to, as Ark UI's `goToNextStep`
|
|
115
|
+
* does. Returns whether it moved: not past the last stage, not into a stage
|
|
116
|
+
* `linear` holds out of reach, and not where a listener refused.
|
|
117
|
+
*/
|
|
118
|
+
next(): boolean;
|
|
119
|
+
/** Moves to the stage before, as Ark UI's `goToPrevStep` does. Returns whether it moved. */
|
|
120
|
+
previous(): boolean;
|
|
121
|
+
/** Moves `delta` stages, skipping disabled ones. */
|
|
122
|
+
private step;
|
|
123
|
+
/**
|
|
124
|
+
* Whether the stage the reader is on lets them go to the stage at `index`,
|
|
125
|
+
* by `validate`. Only a move forward is asked, and an `optional` stage is
|
|
126
|
+
* never asked. The stage is marked invalid while the answer is no.
|
|
127
|
+
*/
|
|
128
|
+
private valid;
|
|
129
|
+
/** Whether the stage at `index` can be gone to from where the reader is. */
|
|
130
|
+
private reachable;
|
|
131
|
+
/** Marks the stages a linear sequence holds out of reach. Client only. */
|
|
132
|
+
private lock;
|
|
133
|
+
/** Watches what decides a stage's reach: which is current, which are done. */
|
|
134
|
+
private watcher;
|
|
65
135
|
/**
|
|
66
136
|
* Puts `active` on whichever step owns it.
|
|
67
137
|
*
|
|
@@ -78,7 +148,13 @@ export declare class HelixHeadlessSteps extends HelixHeadlessSteps_base {
|
|
|
78
148
|
private readonly handleSlotChange;
|
|
79
149
|
connectedCallback(): void;
|
|
80
150
|
disconnectedCallback(): void;
|
|
151
|
+
/**
|
|
152
|
+
* The steps where they can be known, and none on a server or while
|
|
153
|
+
* hydrating, so the progress drawn first is the server's.
|
|
154
|
+
*/
|
|
155
|
+
private get known();
|
|
81
156
|
protected willUpdate(changed: PropertyValues): void;
|
|
157
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
82
158
|
protected updated(changed: PropertyValues): void;
|
|
83
159
|
protected render(): TemplateResult;
|
|
84
160
|
}
|
|
@@ -7,23 +7,75 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { customElement, HelixElement, hostAria, MixinControllerActive, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { canReach, progressOf } from '../reach.js';
|
|
10
11
|
let HelixHeadlessSteps = class HelixHeadlessSteps extends MixinControllerActive(HelixElement) {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
13
14
|
this.label = 'Steps';
|
|
15
|
+
this.linear = false;
|
|
14
16
|
this.handleSelection = (event) => {
|
|
15
17
|
if (event.defaultPrevented || !this.steps.includes(event.target)) {
|
|
16
18
|
return;
|
|
17
19
|
}
|
|
20
|
+
const index = this.steps.indexOf(event.target);
|
|
21
|
+
if (!this.reachable(index) || !this.valid(index)) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
18
24
|
this.requestActive(event.detail.value);
|
|
19
25
|
};
|
|
20
26
|
this.handleSlotChange = () => {
|
|
21
27
|
this.sync();
|
|
28
|
+
this.lock();
|
|
22
29
|
};
|
|
23
30
|
}
|
|
31
|
+
get progress() {
|
|
32
|
+
return progressOf(this.steps);
|
|
33
|
+
}
|
|
24
34
|
get steps() {
|
|
25
35
|
return [...this.querySelectorAll(':scope > *')].filter((one) => 'current' in one);
|
|
26
36
|
}
|
|
37
|
+
get at() {
|
|
38
|
+
return this.steps.findIndex((step) => step.current);
|
|
39
|
+
}
|
|
40
|
+
next() {
|
|
41
|
+
return this.step(1);
|
|
42
|
+
}
|
|
43
|
+
previous() {
|
|
44
|
+
return this.step(-1);
|
|
45
|
+
}
|
|
46
|
+
step(delta) {
|
|
47
|
+
const steps = this.steps;
|
|
48
|
+
let index = this.at + delta;
|
|
49
|
+
while (steps[index]?.disabled) {
|
|
50
|
+
index += delta;
|
|
51
|
+
}
|
|
52
|
+
const target = steps[index];
|
|
53
|
+
if (!target || !this.reachable(index) || !this.valid(index)) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
return this.requestActive(target.value);
|
|
57
|
+
}
|
|
58
|
+
valid(index) {
|
|
59
|
+
const from = this.steps[this.at];
|
|
60
|
+
if (!from || index <= this.at || !this.validate || from.optional) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
const valid = this.validate(from);
|
|
64
|
+
from.invalid = !valid;
|
|
65
|
+
return valid;
|
|
66
|
+
}
|
|
67
|
+
reachable(index) {
|
|
68
|
+
return !this.linear || canReach(this.steps, this.at, index);
|
|
69
|
+
}
|
|
70
|
+
lock() {
|
|
71
|
+
const steps = this.steps;
|
|
72
|
+
steps.forEach((step, index) => {
|
|
73
|
+
const locked = !this.reachable(index);
|
|
74
|
+
whenHydrated(step, () => {
|
|
75
|
+
step.locked = locked;
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
27
79
|
sync() {
|
|
28
80
|
if (this.active === '') {
|
|
29
81
|
return;
|
|
@@ -40,31 +92,71 @@ let HelixHeadlessSteps = class HelixHeadlessSteps extends MixinControllerActive(
|
|
|
40
92
|
connectedCallback() {
|
|
41
93
|
super.connectedCallback();
|
|
42
94
|
this.addEventListener('helix-select', this.handleSelection);
|
|
95
|
+
this.watcher = new MutationObserver(() => {
|
|
96
|
+
this.lock();
|
|
97
|
+
this.requestUpdate();
|
|
98
|
+
});
|
|
99
|
+
this.watcher.observe(this, {
|
|
100
|
+
attributeFilter: ['complete', 'current', 'optional'],
|
|
101
|
+
attributes: true,
|
|
102
|
+
subtree: true,
|
|
103
|
+
});
|
|
43
104
|
}
|
|
44
105
|
disconnectedCallback() {
|
|
45
106
|
super.disconnectedCallback();
|
|
46
107
|
this.removeEventListener('helix-select', this.handleSelection);
|
|
108
|
+
this.watcher?.disconnect();
|
|
109
|
+
this.watcher = undefined;
|
|
110
|
+
}
|
|
111
|
+
get known() {
|
|
112
|
+
return this.knownChildren.filter((one) => 'current' in one);
|
|
47
113
|
}
|
|
48
114
|
willUpdate(changed) {
|
|
49
115
|
super.willUpdate(changed);
|
|
50
116
|
hostAria(this.internals, { label: this.label, role: 'list' });
|
|
117
|
+
const known = this.known;
|
|
118
|
+
this.toggleState('complete', known.length > 0 && known.every((step) => step.complete));
|
|
119
|
+
}
|
|
120
|
+
firstUpdated(changed) {
|
|
121
|
+
super.firstUpdated(changed);
|
|
122
|
+
this.finishHydration();
|
|
51
123
|
}
|
|
52
124
|
updated(changed) {
|
|
53
125
|
super.updated(changed);
|
|
54
126
|
if (changed.has('active')) {
|
|
55
127
|
this.sync();
|
|
56
128
|
}
|
|
129
|
+
if (changed.has('linear') || changed.has('active')) {
|
|
130
|
+
this.lock();
|
|
131
|
+
}
|
|
57
132
|
}
|
|
58
133
|
render() {
|
|
59
|
-
|
|
134
|
+
const progress = progressOf(this.known);
|
|
135
|
+
return html `<slot @slotchange=${this.handleSlotChange}></slot>
|
|
136
|
+
<div
|
|
137
|
+
part="progress"
|
|
138
|
+
role="progressbar"
|
|
139
|
+
aria-label=${this.label}
|
|
140
|
+
aria-valuemin="0"
|
|
141
|
+
aria-valuemax="100"
|
|
142
|
+
aria-valuenow=${progress}
|
|
143
|
+
style="--steps-progress: ${progress}%"
|
|
144
|
+
hidden
|
|
145
|
+
></div>`;
|
|
60
146
|
}
|
|
61
147
|
};
|
|
62
148
|
__decorate([
|
|
63
149
|
property()
|
|
64
150
|
], HelixHeadlessSteps.prototype, "label", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ reflect: true, type: Boolean })
|
|
153
|
+
], HelixHeadlessSteps.prototype, "linear", void 0);
|
|
65
154
|
__decorate([
|
|
66
155
|
property({ reflect: true })
|
|
67
156
|
], HelixHeadlessSteps.prototype, "orientation", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ attribute: false })
|
|
159
|
+
], HelixHeadlessSteps.prototype, "validate", void 0);
|
|
68
160
|
__decorate([
|
|
69
161
|
property({ reflect: true })
|
|
70
162
|
], HelixHeadlessSteps.prototype, "variant", void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import type
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../button/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* @summary One stage in a sequence.
|
|
@@ -21,6 +21,12 @@ import '../../button/index.js';
|
|
|
21
21
|
* and `::after` from properties the list sets, so the step renders no extra
|
|
22
22
|
* element for them.
|
|
23
23
|
*
|
|
24
|
+
* A finished stage says so in words: the name's button is described by
|
|
25
|
+
* `complete-label`, "Complete" unless you translate it, and a stage that
|
|
26
|
+
* becomes complete while the page is open says it once in a polite live
|
|
27
|
+
* region. The current stage's button carries `aria-current="step"`, and only
|
|
28
|
+
* the button, so the state is said once, on the control.
|
|
29
|
+
*
|
|
24
30
|
* @since 0.1.0
|
|
25
31
|
* @status stable
|
|
26
32
|
* @aliases Stage
|
|
@@ -40,14 +46,23 @@ import '../../button/index.js';
|
|
|
40
46
|
* @csspart label-button - The button inside the label.
|
|
41
47
|
* @csspart label-live - The live region inside that button, rendered only from the first time the button is pending.
|
|
42
48
|
* @csspart label-text - The words on that button, trimmed to their capitals and baseline.
|
|
49
|
+
* @csspart live - The live region that says a stage was completed, rendered from the first time one is.
|
|
43
50
|
* @csspart mark - The glyph inside the marker: a tick, a dot, or an empty ring.
|
|
44
51
|
* @csspart marker - The shape carrying the number or the check.
|
|
52
|
+
* @csspart state - The words that describe a finished stage's button. Hidden.
|
|
53
|
+
*
|
|
54
|
+
* @cssstate invalid - The sequence's `validate` last answered that this stage is not valid.
|
|
45
55
|
*/
|
|
46
56
|
export declare class HelixHeadlessStep extends HelixElement {
|
|
47
57
|
/**
|
|
48
58
|
* Whether this stage is finished.
|
|
49
59
|
*/
|
|
50
60
|
complete: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* The words that tell a screen reader the stage is finished. Translate it
|
|
63
|
+
* with the page.
|
|
64
|
+
*/
|
|
65
|
+
completeLabel: string;
|
|
51
66
|
/**
|
|
52
67
|
* Whether this is the current stage.
|
|
53
68
|
*/
|
|
@@ -56,11 +71,32 @@ export declare class HelixHeadlessStep extends HelixElement {
|
|
|
56
71
|
* Whether the stage is disabled, so the user cannot go to it.
|
|
57
72
|
*/
|
|
58
73
|
disabled: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* @internal Set by the sequence: whether its `validate` last answered that
|
|
76
|
+
* this stage is not valid. Recorded as `:state(invalid)`.
|
|
77
|
+
*/
|
|
78
|
+
invalid: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @internal Set by a linear sequence: whether the stage is out of reach
|
|
81
|
+
* until the ones before it are finished. A property, because the sequence
|
|
82
|
+
* writes it after the step upgrades.
|
|
83
|
+
*/
|
|
84
|
+
locked: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Whether a reader may pass the stage without finishing it, in a sequence
|
|
87
|
+
* with `linear`. Ark UI's skippable step.
|
|
88
|
+
*/
|
|
89
|
+
optional: boolean;
|
|
59
90
|
/**
|
|
60
91
|
* The value the step sends in `helix-select`.
|
|
61
92
|
*/
|
|
62
93
|
value: string;
|
|
63
|
-
/**
|
|
94
|
+
/** Says a stage was finished, from the first time one is. */
|
|
95
|
+
private readonly status;
|
|
96
|
+
/**
|
|
97
|
+
* Fires `helix-select` for the step, unless the step is `disabled` or a
|
|
98
|
+
* linear sequence has it out of reach.
|
|
99
|
+
*/
|
|
64
100
|
select(): void;
|
|
65
101
|
/**
|
|
66
102
|
* The mark this stage's state calls for.
|
|
@@ -85,6 +121,13 @@ export declare class HelixHeadlessStep extends HelixElement {
|
|
|
85
121
|
*/
|
|
86
122
|
protected renderMarker(): TemplateResult;
|
|
87
123
|
protected willUpdate(changed: PropertyValues): void;
|
|
124
|
+
/**
|
|
125
|
+
* Says a stage that was finished while the page is open, with its name.
|
|
126
|
+
*
|
|
127
|
+
* Only a change after the first update, so a sequence served with its done
|
|
128
|
+
* stages says nothing when it arrives.
|
|
129
|
+
*/
|
|
130
|
+
protected updated(changed: PropertyValues): void;
|
|
88
131
|
/**
|
|
89
132
|
* The step's own label, which is a control because a step can be gone to, behind a seam the styled tier can move.
|
|
90
133
|
*
|
package/dist/steps/step/step.js
CHANGED
|
@@ -4,8 +4,9 @@ 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, HelixSelectEvent, hostAria } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, drawStatus, HelixElement, HelixSelectEvent, hostAria, StatusController, slottedWords, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { check, circle, record } from '@fusion.dev/helix-icons';
|
|
9
|
+
import { nothing } from 'lit';
|
|
9
10
|
import { property } from 'lit/decorators.js';
|
|
10
11
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
11
12
|
import { html } from 'lit/static-html.js';
|
|
@@ -14,12 +15,17 @@ let HelixHeadlessStep = class HelixHeadlessStep extends HelixElement {
|
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
16
17
|
this.complete = false;
|
|
18
|
+
this.completeLabel = 'Complete';
|
|
17
19
|
this.current = false;
|
|
18
20
|
this.disabled = false;
|
|
21
|
+
this.invalid = false;
|
|
22
|
+
this.locked = false;
|
|
23
|
+
this.optional = false;
|
|
19
24
|
this.value = '';
|
|
25
|
+
this.status = new StatusController(this);
|
|
20
26
|
}
|
|
21
27
|
select() {
|
|
22
|
-
if (this.disabled) {
|
|
28
|
+
if (this.disabled || this.locked) {
|
|
23
29
|
return;
|
|
24
30
|
}
|
|
25
31
|
this.dispatchEvent(new HelixSelectEvent({ value: this.value }));
|
|
@@ -35,18 +41,27 @@ let HelixHeadlessStep = class HelixHeadlessStep extends HelixElement {
|
|
|
35
41
|
willUpdate(changed) {
|
|
36
42
|
super.willUpdate(changed);
|
|
37
43
|
hostAria(this.internals, { role: 'listitem' });
|
|
38
|
-
this.
|
|
44
|
+
this.toggleState('invalid', this.invalid);
|
|
45
|
+
}
|
|
46
|
+
updated(changed) {
|
|
47
|
+
super.updated(changed);
|
|
48
|
+
if (changed.get('complete') === false && this.complete) {
|
|
49
|
+
const name = slottedWords(this, ['']);
|
|
50
|
+
this.status.say(name === '' ? this.completeLabel : `${name}, ${this.completeLabel}`);
|
|
51
|
+
}
|
|
39
52
|
}
|
|
40
53
|
renderLabel() {
|
|
41
54
|
return html `<${this.tag('button')}
|
|
42
55
|
part="label"
|
|
43
56
|
exportparts="button: label-button, live: label-live, text: label-text"
|
|
44
57
|
emphasis="ghost"
|
|
45
|
-
|
|
58
|
+
aria-current=${this.current ? 'step' : nothing}
|
|
59
|
+
aria-describedby=${this.complete ? 'state' : nothing}
|
|
60
|
+
?disabled=${this.disabled || this.locked}
|
|
46
61
|
@click=${this.select}
|
|
47
62
|
>
|
|
48
63
|
<slot></slot>
|
|
49
|
-
</${this.tag('button')}>`;
|
|
64
|
+
</${this.tag('button')}><span id="state" part="state" hidden>${this.complete ? this.completeLabel : ''}</span>`;
|
|
50
65
|
}
|
|
51
66
|
render() {
|
|
52
67
|
return html `<span part="marker" aria-hidden="true">
|
|
@@ -56,18 +71,30 @@ let HelixHeadlessStep = class HelixHeadlessStep extends HelixElement {
|
|
|
56
71
|
${this.renderLabel()}
|
|
57
72
|
<span part="description"><slot name="description"></slot></span>
|
|
58
73
|
</span>
|
|
59
|
-
<div part="content"><slot name="content"></slot></div
|
|
74
|
+
<div part="content"><slot name="content"></slot></div>${drawStatus(this.status)}`;
|
|
60
75
|
}
|
|
61
76
|
};
|
|
62
77
|
__decorate([
|
|
63
78
|
property({ reflect: true, type: Boolean })
|
|
64
79
|
], HelixHeadlessStep.prototype, "complete", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
property({ attribute: 'complete-label' })
|
|
82
|
+
], HelixHeadlessStep.prototype, "completeLabel", void 0);
|
|
65
83
|
__decorate([
|
|
66
84
|
property({ reflect: true, type: Boolean })
|
|
67
85
|
], HelixHeadlessStep.prototype, "current", void 0);
|
|
68
86
|
__decorate([
|
|
69
87
|
property({ reflect: true, type: Boolean })
|
|
70
88
|
], HelixHeadlessStep.prototype, "disabled", void 0);
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ attribute: false })
|
|
91
|
+
], HelixHeadlessStep.prototype, "invalid", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property({ attribute: false })
|
|
94
|
+
], HelixHeadlessStep.prototype, "locked", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ reflect: true, type: Boolean })
|
|
97
|
+
], HelixHeadlessStep.prototype, "optional", void 0);
|
|
71
98
|
__decorate([
|
|
72
99
|
property()
|
|
73
100
|
], HelixHeadlessStep.prototype, "value", void 0);
|
|
@@ -18,6 +18,16 @@ declare const HelixHeadlessSwitch_base: (new (...args: any[]) => import("@fusion
|
|
|
18
18
|
* press, the same as a checkbox. The hint and the message go below the row,
|
|
19
19
|
* because the switch and its label share one line.
|
|
20
20
|
*
|
|
21
|
+
* **Keyboard.** The switch is one tab stop.
|
|
22
|
+
*
|
|
23
|
+
* | Key | What it does |
|
|
24
|
+
* |---|---|
|
|
25
|
+
* | Space | Turns the switch on or off, as a native checkbox does. |
|
|
26
|
+
*
|
|
27
|
+
* The input carries `role="switch"`, so a screen reader says "on" or "off".
|
|
28
|
+
* `aria-readonly` is set under `readonly`, and `aria-invalid` and
|
|
29
|
+
* `aria-describedby` point at the message while one shows.
|
|
30
|
+
*
|
|
21
31
|
* @since 0.1.0
|
|
22
32
|
* @status stable
|
|
23
33
|
* @category forms
|
|
@@ -10,16 +10,6 @@ import { type PropertyValues, type TemplateResult } from 'lit';
|
|
|
10
10
|
* `undefined` falls back to the field.
|
|
11
11
|
*/
|
|
12
12
|
export type CellReader = (row: Readonly<Record<string, unknown>>) => unknown;
|
|
13
|
-
/**
|
|
14
|
-
* A dot path resolved against a row.
|
|
15
|
-
*
|
|
16
|
-
* Written here rather than taken from a library, because the whole of what is
|
|
17
|
-
* needed is "walk the keys and stop at the first thing that is not an object".
|
|
18
|
-
* Returns `undefined` for a path that does not resolve, which the table renders
|
|
19
|
-
* as an empty cell: a missing key is a hole in the data and drawing `undefined`
|
|
20
|
-
* into a table tells a reader the software is broken rather than the row is.
|
|
21
|
-
*/
|
|
22
|
-
export declare const at: (row: Readonly<Record<string, unknown>>, path: string) => unknown;
|
|
23
13
|
/**
|
|
24
14
|
* The edge a column names, where it names one of the three.
|
|
25
15
|
*
|
|
@@ -84,6 +74,7 @@ export declare const edgeOf: (align: string | undefined) => string | undefined;
|
|
|
84
74
|
* @slot - The heading.
|
|
85
75
|
*
|
|
86
76
|
* @event {HelixBeforeResizeEvent} helix-before-resize - The column is about to be resized, with the requested width. Cancelable: cancel it to keep the current width.
|
|
77
|
+
* @event {HelixResizedEvent} helix-resized - Fired after the column is resized, with the new width.
|
|
87
78
|
*
|
|
88
79
|
* @csspart column - The heading cell.
|
|
89
80
|
* @csspart grip - The handle for moving the column, when the table allows it.
|
|
@@ -154,6 +145,16 @@ export declare class HelixHeadlessTableColumn extends HelixElement {
|
|
|
154
145
|
* replaced with the heading text.
|
|
155
146
|
*/
|
|
156
147
|
resizeLabel: string;
|
|
148
|
+
/**
|
|
149
|
+
* Makes this column's cells the headers of their rows, in `DataTable`.
|
|
150
|
+
*
|
|
151
|
+
* A screen reader moving along a row or down a column names the row by its
|
|
152
|
+
* row header, so the cell that identifies a row, a file's name say, is the
|
|
153
|
+
* one to mark. Where no column sets it, `DataTable` makes the first column
|
|
154
|
+
* with a `field` the row header. A `Table`'s cells are your markup, so there
|
|
155
|
+
* a cell is a row header through its own `header` attribute.
|
|
156
|
+
*/
|
|
157
|
+
rowHeader: boolean;
|
|
157
158
|
/**
|
|
158
159
|
* Whether the table can be sorted by this column.
|
|
159
160
|
*
|
|
@@ -5,27 +5,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
7
|
var HelixHeadlessTableColumn_1;
|
|
8
|
-
import { customElement, fillTemplate, HelixBeforeResizeEvent, HelixElement, hostAria, inlineStep, isRtl, requestChange, } from '@fusion.dev/helix-core';
|
|
8
|
+
import { customElement, fillTemplate, HelixBeforeResizeEvent, HelixElement, HelixResizedEvent, hostAria, inlineStep, isRtl, requestChange, valueAt, } from '@fusion.dev/helix-core';
|
|
9
9
|
import { dotsThreeVertical } from '@fusion.dev/helix-icons';
|
|
10
10
|
import { html, nothing } from 'lit';
|
|
11
11
|
import { property, state } from 'lit/decorators.js';
|
|
12
12
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
13
|
-
export const at = (row, path) => {
|
|
14
|
-
if (path === '') {
|
|
15
|
-
return undefined;
|
|
16
|
-
}
|
|
17
|
-
if (!path.includes('.')) {
|
|
18
|
-
return row[path];
|
|
19
|
-
}
|
|
20
|
-
let cursor = row;
|
|
21
|
-
for (const key of path.split('.')) {
|
|
22
|
-
if (cursor === null || typeof cursor !== 'object') {
|
|
23
|
-
return undefined;
|
|
24
|
-
}
|
|
25
|
-
cursor = cursor[key];
|
|
26
|
-
}
|
|
27
|
-
return cursor;
|
|
28
|
-
};
|
|
29
13
|
const EDGES = new Set(['center', 'end', 'start']);
|
|
30
14
|
export const edgeOf = (align) => align && EDGES.has(align) ? align : undefined;
|
|
31
15
|
let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixElement {
|
|
@@ -37,6 +21,7 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
|
|
|
37
21
|
this.moveLabel = 'Move {name}';
|
|
38
22
|
this.resizable = false;
|
|
39
23
|
this.resizeLabel = 'Resize {name}';
|
|
24
|
+
this.rowHeader = false;
|
|
40
25
|
this.sortable = false;
|
|
41
26
|
this.width = '';
|
|
42
27
|
this.widthLabel = '{width} pixels';
|
|
@@ -95,11 +80,11 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
|
|
|
95
80
|
}
|
|
96
81
|
read(row) {
|
|
97
82
|
const rendered = this.cell?.(row);
|
|
98
|
-
return rendered === undefined ?
|
|
83
|
+
return rendered === undefined ? valueAt(row, this.field) : rendered;
|
|
99
84
|
}
|
|
100
85
|
order(row) {
|
|
101
86
|
const compared = this.compare?.(row);
|
|
102
|
-
return compared === undefined ?
|
|
87
|
+
return compared === undefined ? valueAt(row, this.field) : compared;
|
|
103
88
|
}
|
|
104
89
|
willUpdate(changed) {
|
|
105
90
|
super.willUpdate(changed);
|
|
@@ -172,6 +157,7 @@ let HelixHeadlessTableColumn = class HelixHeadlessTableColumn extends HelixEleme
|
|
|
172
157
|
requestChange({
|
|
173
158
|
apply: (value) => {
|
|
174
159
|
this.width = value;
|
|
160
|
+
this.dispatchEvent(new HelixResizedEvent({ value }));
|
|
175
161
|
},
|
|
176
162
|
event: (value) => new HelixBeforeResizeEvent({ value }),
|
|
177
163
|
host: this,
|
|
@@ -237,6 +223,9 @@ __decorate([
|
|
|
237
223
|
__decorate([
|
|
238
224
|
property({ attribute: 'resize-label' })
|
|
239
225
|
], HelixHeadlessTableColumn.prototype, "resizeLabel", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
property({ attribute: 'row-header', type: Boolean })
|
|
228
|
+
], HelixHeadlessTableColumn.prototype, "rowHeader", void 0);
|
|
240
229
|
__decorate([
|
|
241
230
|
property({ reflect: true, type: Boolean })
|
|
242
231
|
], HelixHeadlessTableColumn.prototype, "sortable", void 0);
|