@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.
- package/custom-elements.json +25381 -1202
- package/dist/accordion/item/accordion-item.d.ts +38 -2
- package/dist/accordion/item/accordion-item.js +38 -6
- package/dist/accordion/root/accordion-root.d.ts +23 -1
- package/dist/accordion/root/accordion-root.js +39 -3
- package/dist/announcement/root/announcement-root.d.ts +11 -7
- package/dist/announcement/root/announcement-root.js +1 -1
- package/dist/app-header/root/app-header-root.d.ts +21 -0
- package/dist/app-header/root/app-header-root.js +31 -5
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +39 -11
- package/dist/avatar/group/avatar-group.d.ts +24 -3
- package/dist/avatar/group/avatar-group.js +34 -2
- package/dist/avatar/root/avatar-root.d.ts +17 -1
- package/dist/avatar/root/avatar-root.js +31 -10
- package/dist/badge/root/badge-root.d.ts +12 -0
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +30 -5
- package/dist/bar-chart/root/bar-chart-root.js +58 -21
- package/dist/blockquote/root/blockquote-root.d.ts +12 -7
- package/dist/blockquote/root/blockquote-root.js +6 -4
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +9 -3
- package/dist/breadcrumbs/root/breadcrumbs-root.js +9 -1
- package/dist/button/root/button-root.d.ts +84 -1
- package/dist/button/root/button-root.js +81 -3
- package/dist/callout/root/callout-root.d.ts +32 -6
- package/dist/callout/root/callout-root.js +26 -7
- package/dist/canvas/root/canvas-root.d.ts +1 -0
- package/dist/canvas/root/canvas-root.js +10 -1
- package/dist/card/root/card-root.d.ts +30 -1
- package/dist/card/root/card-root.js +38 -5
- package/dist/carousel/root/carousel-root.d.ts +47 -5
- package/dist/carousel/root/carousel-root.js +53 -21
- package/dist/chat/composer/chat-composer.d.ts +13 -11
- package/dist/chat/composer/chat-composer.js +6 -12
- package/dist/chat/message/chat-message.js +8 -1
- package/dist/chat/root/chat-root.d.ts +1 -0
- package/dist/chat/root/chat-root.js +2 -1
- package/dist/checkbox/root/checkbox-root.d.ts +7 -0
- package/dist/checkbox/root/checkbox-root.js +9 -3
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +116 -33
- package/dist/checkbox-group/root/checkbox-group-root.js +141 -44
- package/dist/code/root/code-root.d.ts +1 -1
- package/dist/code-block/lines.d.ts +13 -0
- package/dist/code-block/lines.js +2 -0
- package/dist/code-block/root/code-block-root.d.ts +49 -0
- package/dist/code-block/root/code-block-root.js +44 -3
- package/dist/color-input/root/color-input-root.d.ts +60 -2
- package/dist/color-input/root/color-input-root.js +55 -7
- package/dist/color-picker/channels.d.ts +26 -0
- package/dist/color-picker/channels.js +84 -0
- package/dist/color-picker/root/color-picker-root.d.ts +118 -12
- package/dist/color-picker/root/color-picker-root.js +183 -13
- package/dist/combobox/root/combobox-root.d.ts +126 -3
- package/dist/combobox/root/combobox-root.js +224 -21
- package/dist/command/root/command-root.d.ts +47 -10
- package/dist/command/root/command-root.js +45 -4
- package/dist/copy-button/from.d.ts +22 -0
- package/dist/copy-button/from.js +28 -0
- package/dist/copy-button/root/copy-button-root.d.ts +48 -7
- package/dist/copy-button/root/copy-button-root.js +54 -8
- package/dist/data-table/root/data-table-root.d.ts +164 -10
- package/dist/data-table/root/data-table-root.js +488 -57
- package/dist/date-input/root/date-input-root.d.ts +123 -9
- package/dist/date-input/root/date-input-root.js +147 -45
- package/dist/date-picker/root/date-picker-root.d.ts +229 -18
- package/dist/date-picker/root/date-picker-root.js +342 -46
- package/dist/dialog/description.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +101 -10
- package/dist/dialog/root/dialog-root.js +83 -4
- package/dist/donut-chart/root/donut-chart-root.d.ts +61 -16
- package/dist/donut-chart/root/donut-chart-root.js +48 -13
- package/dist/drawer/root/drawer-root.d.ts +93 -7
- package/dist/drawer/root/drawer-root.js +126 -5
- package/dist/drawer/swipe-start.d.ts +9 -0
- package/dist/drawer/swipe-start.js +12 -0
- package/dist/drilldown/item/drilldown-item.d.ts +16 -13
- package/dist/drilldown/item/drilldown-item.js +6 -2
- package/dist/drilldown/root/drilldown-root.d.ts +21 -5
- package/dist/drilldown/root/drilldown-root.js +26 -10
- package/dist/element-events.generated.js +42 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +65 -1
- package/dist/file-input/root/file-input-root.js +76 -12
- package/dist/file-input/screen.d.ts +35 -0
- package/dist/file-input/screen.js +49 -0
- package/dist/filter-input/menu/filter-menu.d.ts +9 -0
- package/dist/filter-input/menu/filter-menu.js +8 -0
- package/dist/filter-input/root/filter-input-root.d.ts +43 -6
- package/dist/filter-input/root/filter-input-root.js +89 -10
- package/dist/filter-input/suggest.d.ts +17 -0
- package/dist/filter-input/suggest.js +23 -0
- package/dist/format-date/options.d.ts +33 -0
- package/dist/format-date/options.js +42 -0
- package/dist/format-date/root/format-date-root.d.ts +62 -3
- package/dist/format-date/root/format-date-root.js +78 -37
- package/dist/graph/root/graph-root.d.ts +24 -3
- package/dist/graph/root/graph-root.js +66 -12
- package/dist/heatmap/root/buckets.d.ts +2 -1
- package/dist/heatmap/root/buckets.js +5 -1
- package/dist/heatmap/root/heatmap-root.d.ts +47 -9
- package/dist/heatmap/root/heatmap-root.js +46 -18
- package/dist/icon/index.d.ts +2 -0
- package/dist/icon/index.js +2 -0
- package/dist/icon/registry.d.ts +37 -0
- package/dist/icon/registry.js +83 -0
- package/dist/icon/root/icon-root.d.ts +53 -6
- package/dist/icon/root/icon-root.js +72 -4
- package/dist/icon/root/index.d.ts +2 -0
- package/dist/icon/root/index.js +2 -0
- package/dist/icon/set.d.ts +1 -0
- package/dist/icon/set.js +3 -0
- package/dist/icon-button/root/icon-button-root.d.ts +1 -1
- package/dist/image/root/image-root.d.ts +23 -2
- package/dist/image/root/image-root.js +23 -4
- package/dist/input/root/input-root.d.ts +62 -9
- package/dist/input/root/input-root.js +61 -5
- package/dist/kbd/root/kbd-root.d.ts +26 -11
- package/dist/kbd/root/kbd-root.js +35 -38
- package/dist/kbd/shortcut.d.ts +18 -0
- package/dist/kbd/shortcut.js +35 -0
- package/dist/legend/hidden-series.d.ts +8 -0
- package/dist/legend/hidden-series.js +13 -0
- package/dist/legend/root/legend-root.d.ts +63 -0
- package/dist/legend/root/legend-root.js +61 -7
- package/dist/lightbox/item/lightbox-item.d.ts +17 -1
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +77 -6
- package/dist/lightbox/root/lightbox-root.js +116 -5
- package/dist/line-chart/root/line-chart-root.d.ts +29 -4
- package/dist/line-chart/root/line-chart-root.js +58 -17
- package/dist/list/item/list-item.d.ts +11 -5
- package/dist/list/item/list-item.js +5 -6
- package/dist/listbox/range.d.ts +17 -0
- package/dist/listbox/range.js +5 -0
- package/dist/listbox/root/listbox-root.d.ts +184 -4
- package/dist/listbox/root/listbox-root.js +229 -23
- package/dist/loader/busy.d.ts +17 -0
- package/dist/loader/busy.js +24 -0
- package/dist/loader/root/loader-root.d.ts +37 -0
- package/dist/loader/root/loader-root.js +52 -3
- package/dist/map/root/map-root.d.ts +19 -4
- package/dist/map/root/map-root.js +36 -7
- package/dist/megamenu/root/megamenu-root.d.ts +10 -1
- package/dist/megamenu/root/megamenu-root.js +10 -1
- package/dist/menu/item/menu-item.d.ts +41 -12
- package/dist/menu/item/menu-item.js +46 -3
- package/dist/menu/root/menu-root.d.ts +32 -2
- package/dist/menu/root/menu-root.js +48 -8
- package/dist/meter/root/meter-root.d.ts +13 -0
- package/dist/meter/root/meter-root.js +24 -5
- package/dist/navigation/root/navigation-root.d.ts +10 -2
- package/dist/navigation/root/navigation-root.js +13 -2
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/group/notification-group.d.ts +1 -0
- package/dist/notifications/notification/notification.d.ts +29 -0
- package/dist/notifications/notification/notification.js +51 -3
- package/dist/notifications/root/notifications-root.d.ts +49 -0
- package/dist/notifications/root/notifications-root.js +76 -2
- package/dist/number-input/root/number-input-root.d.ts +109 -7
- package/dist/number-input/root/number-input-root.js +109 -21
- package/dist/object-inspector/root/object-inspector-root.d.ts +49 -5
- package/dist/object-inspector/root/object-inspector-root.js +92 -12
- package/dist/option/root/option-root.d.ts +58 -6
- package/dist/option/root/option-root.js +35 -5
- package/dist/outline/root/outline-root.d.ts +13 -2
- package/dist/outline/root/outline-root.js +4 -2
- package/dist/pagination/root/pagination-root.d.ts +19 -1
- package/dist/pagination/root/pagination-root.js +49 -9
- package/dist/pagination/size/pagination-size.d.ts +13 -3
- package/dist/pagination/size/pagination-size.js +7 -0
- package/dist/pin-input/format.d.ts +7 -0
- package/dist/pin-input/format.js +16 -0
- package/dist/pin-input/root/pin-input-root.d.ts +37 -0
- package/dist/pin-input/root/pin-input-root.js +48 -7
- package/dist/popover/root/popover-root.d.ts +78 -3
- package/dist/popover/root/popover-root.js +74 -5
- package/dist/progress/root/progress-root.d.ts +23 -1
- package/dist/progress/root/progress-root.js +40 -10
- package/dist/qr-code/export.d.ts +31 -0
- package/dist/qr-code/export.js +10 -0
- package/dist/qr-code/root/qr-code-root.d.ts +45 -0
- package/dist/qr-code/root/qr-code-root.js +78 -3
- package/dist/radio/group/radio-group.d.ts +64 -0
- package/dist/radio/group/radio-group.js +66 -12
- package/dist/radio/root/radio-root.d.ts +8 -5
- package/dist/radio/root/radio-root.js +1 -2
- package/dist/rating/root/rating-root.d.ts +49 -1
- package/dist/rating/root/rating-root.js +69 -10
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +40 -14
- package/dist/select/root/select-root.d.ts +93 -3
- package/dist/select/root/select-root.js +111 -13
- package/dist/skeleton/root/skeleton-root.d.ts +39 -3
- package/dist/skeleton/root/skeleton-root.js +33 -4
- package/dist/skip-link/root/skip-link-root.d.ts +10 -0
- package/dist/skip-link/root/skip-link-root.js +15 -1
- package/dist/slider/root/slider-root.d.ts +59 -2
- package/dist/slider/root/slider-root.js +82 -8
- package/dist/sparkline/root/sparkline-root.d.ts +9 -10
- package/dist/speed-dial/item/speed-dial-item.d.ts +11 -5
- package/dist/speed-dial/item/speed-dial-item.js +7 -2
- package/dist/speed-dial/root/speed-dial-root.d.ts +15 -4
- package/dist/speed-dial/root/speed-dial-root.js +19 -5
- package/dist/splitter/root/splitter-root.d.ts +28 -6
- package/dist/splitter/root/splitter-root.js +35 -1
- package/dist/stat/root/stat-root.d.ts +9 -1
- package/dist/stat/root/stat-root.js +15 -2
- package/dist/steps/root/steps-root.js +1 -1
- package/dist/steps/step/step.d.ts +1 -0
- package/dist/steps/step/step.js +1 -1
- package/dist/switch/root/switch-root.d.ts +14 -2
- package/dist/switch/root/switch-root.js +7 -1
- package/dist/table/cell/table-cell.d.ts +24 -4
- package/dist/table/cell/table-cell.js +21 -1
- package/dist/table/column/table-column.d.ts +32 -6
- package/dist/table/column/table-column.js +36 -6
- package/dist/table/root/table-root.d.ts +94 -3
- package/dist/table/root/table-root.js +128 -5
- package/dist/table/row/table-row.d.ts +7 -0
- package/dist/table/row/table-row.js +9 -1
- package/dist/tabs/root/tabs-root.d.ts +6 -1
- package/dist/tabs/root/tabs-root.js +6 -2
- package/dist/tag/group/tag-group.d.ts +107 -0
- package/dist/tag/group/tag-group.js +157 -0
- package/dist/tag/index.d.ts +1 -0
- package/dist/tag/index.js +1 -0
- package/dist/tag/root/tag-root.d.ts +83 -1
- package/dist/tag/root/tag-root.js +87 -17
- package/dist/tag/selection.d.ts +10 -0
- package/dist/tag/selection.js +12 -0
- package/dist/textarea/grow.d.ts +22 -0
- package/dist/textarea/grow.js +20 -0
- package/dist/textarea/root/textarea-root.d.ts +13 -0
- package/dist/textarea/root/textarea-root.js +10 -2
- package/dist/time-input/root/time-input-root.d.ts +71 -6
- package/dist/time-input/root/time-input-root.js +110 -44
- package/dist/time-picker/root/time-picker-root.d.ts +155 -26
- package/dist/time-picker/root/time-picker-root.js +192 -63
- package/dist/toast/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +16 -1
- package/dist/toast/item/toast-item.js +41 -13
- package/dist/toast/root/toast-root.d.ts +105 -8
- package/dist/toast/root/toast-root.js +209 -4
- package/dist/toggle/group/toggle-group.d.ts +95 -16
- package/dist/toggle/group/toggle-group.js +99 -13
- package/dist/toggle/root/toggle-root.d.ts +26 -11
- package/dist/toggle/root/toggle-root.js +14 -6
- package/dist/toolbar/root/toolbar-root.d.ts +55 -15
- package/dist/toolbar/root/toolbar-root.js +99 -16
- package/dist/tooltip/focus-target.d.ts +6 -0
- package/dist/tooltip/focus-target.js +9 -0
- package/dist/tooltip/root/tooltip-root.d.ts +73 -15
- package/dist/tooltip/root/tooltip-root.js +96 -7
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +67 -3
- package/dist/tour/root/tour-root.js +105 -17
- package/dist/tour/stop/tour-stop.d.ts +65 -3
- package/dist/tour/stop/tour-stop.js +61 -11
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +21 -5
- package/dist/tree/item/tree-item.js +14 -4
- package/dist/tree/root/tree-root.d.ts +29 -5
- package/dist/tree/root/tree-root.js +64 -8
- package/dist/trend/root/trend-root.d.ts +36 -1
- package/dist/trend/root/trend-root.js +41 -15
- package/dist/video/root/keys.d.ts +5 -0
- package/dist/video/root/keys.js +13 -1
- package/dist/video/root/video-root.d.ts +19 -0
- package/dist/video/root/video-root.js +48 -4
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +20 -2
- package/dist/video-playlist/menu/video-playlist-menu.js +27 -5
- package/dist/video-playlist/root/video-playlist-root.js +6 -3
- package/dist/virtual-list/root/virtual-list-root.d.ts +52 -4
- package/dist/virtual-list/root/virtual-list-root.js +103 -21
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +9140 -1149
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +2089 -267
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CommandController, HelixElement } from '@fusion.dev/helix-core';
|
|
1
|
+
import { AriaForwardController, CommandController, HelixElement, OpenPhaseController } from '@fusion.dev/helix-core';
|
|
2
2
|
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion.dev/helix-core").MixinControllerOpenInterface) & typeof HelixElement;
|
|
4
4
|
/**
|
|
@@ -19,6 +19,20 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
|
|
|
19
19
|
* keeps your state in step, so the dialog never closes while your state still
|
|
20
20
|
* says it is open, which would leave it impossible to reopen.
|
|
21
21
|
*
|
|
22
|
+
* The dialog's name is `label` when you set it. Otherwise it is the heading in
|
|
23
|
+
* the `header` slot, or the elements an `aria-labelledby` on the host names.
|
|
24
|
+
* While it is open, the page behind it does not scroll.
|
|
25
|
+
*
|
|
26
|
+
* The dialog is described by the words at the start of its body: the elements
|
|
27
|
+
* in the default slot before the first one that is or holds a control. A
|
|
28
|
+
* question above a form describes the dialog, and the form does not. An
|
|
29
|
+
* `aria-describedby` on the host replaces it.
|
|
30
|
+
*
|
|
31
|
+
* Set `alert` for a dialog that interrupts to ask for an answer, such as a
|
|
32
|
+
* confirmation before a deletion. It is an `alertdialog`, which a screen reader
|
|
33
|
+
* announces with its description as it opens. Set `dismissible` to draw a
|
|
34
|
+
* close control, labeled by `dismiss-label`.
|
|
35
|
+
*
|
|
22
36
|
* @since 0.1.0
|
|
23
37
|
* @status stable
|
|
24
38
|
* @category overlays
|
|
@@ -26,6 +40,7 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
|
|
|
26
40
|
* @documentation https://fusion.dev/helix/components/dialog
|
|
27
41
|
*
|
|
28
42
|
* @slot - The dialog's content.
|
|
43
|
+
* @slot dismiss-icon - Replaces the glyph inside the close control.
|
|
29
44
|
* @slot footer - The dialog's actions.
|
|
30
45
|
* @slot header - The title, and anything beside it.
|
|
31
46
|
* @slot icon - An icon above the title, for a warning dialog.
|
|
@@ -33,13 +48,32 @@ declare const HelixHeadlessDialog_base: (new (...args: any[]) => import("@fusion
|
|
|
33
48
|
* @event {Event} close - Sent from the host after the dialog closes, because the native `close` event does not leave the shadow root.
|
|
34
49
|
* @event {HelixBeforeCloseEvent} helix-before-close - Fired before it closes, and cancelable.
|
|
35
50
|
* @event {HelixBeforeOpenEvent} helix-before-open - Fired before it opens, and cancelable.
|
|
36
|
-
* @event {
|
|
51
|
+
* @event {ToggleEvent} toggle - Sent when the dialog opens or closes, with `newState` and `oldState`.
|
|
37
52
|
*
|
|
53
|
+
* @csspart body - The slot the content is in. It draws no box until you give it one.
|
|
38
54
|
* @csspart dialog - The native dialog element.
|
|
55
|
+
* @csspart dismiss - The close control, drawn when the dialog is `dismissible`.
|
|
56
|
+
* @csspart dismiss-mark - The glyph on the close control, where none is slotted.
|
|
57
|
+
* @csspart footer - The slot the actions are in. It draws no box until you give it one.
|
|
58
|
+
* @csspart header - The slot the title is in. It draws no box until you give it one.
|
|
39
59
|
*
|
|
60
|
+
* @cssstate entering - From the moment the dialog opens until its entrance has finished.
|
|
61
|
+
* @cssstate exiting - From the moment the dialog closes until its exit has finished.
|
|
40
62
|
* @cssstate open - While the dialog is open.
|
|
41
63
|
*/
|
|
42
64
|
export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
65
|
+
/**
|
|
66
|
+
* Makes the dialog an alert dialog, for a message that interrupts to ask for
|
|
67
|
+
* an answer, such as a confirmation before something is deleted.
|
|
68
|
+
*
|
|
69
|
+
* The `<dialog>` takes `role="alertdialog"`, so a screen reader announces the
|
|
70
|
+
* dialog and its description as it opens. Everything else stays the same:
|
|
71
|
+
* the dialog is modal, Escape asks to close it, and `persistent` still
|
|
72
|
+
* refuses that.
|
|
73
|
+
*
|
|
74
|
+
* Not reflected, because no stylesheet selects on it.
|
|
75
|
+
*/
|
|
76
|
+
alert: boolean;
|
|
43
77
|
/**
|
|
44
78
|
* Which close requests the browser handles on its own.
|
|
45
79
|
*
|
|
@@ -54,9 +88,24 @@ export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
|
54
88
|
*/
|
|
55
89
|
closedBy?: 'any' | 'closerequest' | 'none';
|
|
56
90
|
/**
|
|
57
|
-
*
|
|
91
|
+
* Draws a control that closes the dialog, in the corner where the title is.
|
|
92
|
+
*
|
|
93
|
+
* Pressing it is `close()`, so it sends `helix-before-close` like every other
|
|
94
|
+
* way out, and `persistent` does not disable it.
|
|
95
|
+
*/
|
|
96
|
+
dismissible: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* The close control's accessible name. Translate it with the rest of your
|
|
99
|
+
* interface.
|
|
100
|
+
*/
|
|
101
|
+
dismissLabel: string;
|
|
102
|
+
/**
|
|
103
|
+
* Accessible name for the dialog. When it is empty, the heading in the
|
|
104
|
+
* `header` slot names the dialog.
|
|
58
105
|
*/
|
|
59
106
|
label: string;
|
|
107
|
+
protected readonly phases: OpenPhaseController;
|
|
108
|
+
protected readonly aria: AriaForwardController;
|
|
60
109
|
protected readonly commands: CommandController;
|
|
61
110
|
/**
|
|
62
111
|
* Stops Escape and a press on the backdrop from closing the dialog.
|
|
@@ -120,20 +169,55 @@ export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
|
120
169
|
* saying otherwise would be a lie the next `showModal()` would trip over.
|
|
121
170
|
*/
|
|
122
171
|
private readonly handleClose;
|
|
172
|
+
/**
|
|
173
|
+
* A `<form method="dialog">` slotted into the dialog, closed the way the
|
|
174
|
+
* platform closes its own.
|
|
175
|
+
*
|
|
176
|
+
* **The platform cannot find this dialog from the form.** A submit with the
|
|
177
|
+
* `dialog` method closes the nearest `<dialog>` ancestor, and a slotted form's
|
|
178
|
+
* ancestors are the light DOM, where there is none. So the submit is read
|
|
179
|
+
* here, and the submitter's `value` is the `returnValue`, as it would be.
|
|
180
|
+
*/
|
|
181
|
+
private readonly handleSubmit;
|
|
182
|
+
/** Whether the `header` slot's heading is what currently names the dialog. */
|
|
183
|
+
private namedByHeader;
|
|
184
|
+
/**
|
|
185
|
+
* Names the dialog by its heading, where nothing else names it.
|
|
186
|
+
*
|
|
187
|
+
* An element reference, because the heading is in the light DOM and the
|
|
188
|
+
* `<dialog>` is in this shadow root, which an IDREF cannot cross. `label` and
|
|
189
|
+
* an `aria-labelledby` on the host come first, so this steps aside for
|
|
190
|
+
* either. A browser without element reflection keeps the fallback name.
|
|
191
|
+
*/
|
|
192
|
+
private nameByHeader;
|
|
193
|
+
/** Whether the body's words are what currently describe the dialog. */
|
|
194
|
+
private describedByBody;
|
|
195
|
+
/**
|
|
196
|
+
* Describes the dialog by the words at the start of its body, where nothing
|
|
197
|
+
* else describes it.
|
|
198
|
+
*
|
|
199
|
+
* An element reference, for the reason `nameByHeader` gives. Only the leading
|
|
200
|
+
* run of elements that hold no control, so a dialog asking a question above a
|
|
201
|
+
* form is described by the question: a description that read out every field
|
|
202
|
+
* label would repeat what a reader hears again as they reach each field. An
|
|
203
|
+
* `aria-describedby` on the host comes first.
|
|
204
|
+
*/
|
|
205
|
+
private describeByBody;
|
|
123
206
|
protected willUpdate(changed: PropertyValues): void;
|
|
207
|
+
connectedCallback(): void;
|
|
208
|
+
disconnectedCallback(): void;
|
|
124
209
|
protected updated(changed: PropertyValues): void;
|
|
125
210
|
/** Opens once anything slotted has had its first render. See `updated`. */
|
|
126
211
|
private openWhenSlotted;
|
|
127
212
|
/**
|
|
128
213
|
* A press on the backdrop, which lands on the dialog element itself.
|
|
129
214
|
*
|
|
130
|
-
* **The target alone is not enough
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
* fills it. So the point is compared against the panel's box.
|
|
215
|
+
* **The target alone is not enough.** A modal `<dialog>` attributes backdrop
|
|
216
|
+
* clicks to itself, which is the usual trick, and this panel also carries
|
|
217
|
+
* `--dialog-padding` of padding: a press in that padding has the same target
|
|
218
|
+
* as a press on the backdrop, so the trick alone closes a dialog when a reader
|
|
219
|
+
* clicks just inside its own edge. So the point is compared against the
|
|
220
|
+
* panel's box. `Drawer` does the same.
|
|
137
221
|
*/
|
|
138
222
|
private readonly handleBackdrop;
|
|
139
223
|
/**
|
|
@@ -175,6 +259,13 @@ export declare class HelixHeadlessDialog extends HelixHeadlessDialog_base {
|
|
|
175
259
|
private refuse;
|
|
176
260
|
/** Bounds the refusal listener to one, whether or not it ever fires. */
|
|
177
261
|
private refusal;
|
|
262
|
+
/**
|
|
263
|
+
* The glyph on the close control, behind a seam.
|
|
264
|
+
*
|
|
265
|
+
* Slot fallback, so a consumer replaces it by slotting, and a method, so a
|
|
266
|
+
* tier above replaces it by overriding. The same pair `Toast.Item` draws.
|
|
267
|
+
*/
|
|
268
|
+
protected renderDismissIcon(): TemplateResult;
|
|
178
269
|
protected render(): TemplateResult;
|
|
179
270
|
}
|
|
180
271
|
declare global {
|
|
@@ -4,13 +4,26 @@ 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 { CommandController, customElement, HelixElement, hostAria, MixinControllerOpen, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, CommandController, customElement, drawDismiss, drawDismissGlyph, HelixElement, headingsIn, hostAria, lockScroll, MixinControllerOpen, OpenPhaseController, reflectElements, unlockScroll, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { wordsIn } from '../description.js';
|
|
10
11
|
let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(HelixElement) {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
14
|
+
this.alert = false;
|
|
15
|
+
this.dismissible = false;
|
|
16
|
+
this.dismissLabel = 'Close';
|
|
13
17
|
this.label = '';
|
|
18
|
+
this.phases = new OpenPhaseController(this, {
|
|
19
|
+
mark: {
|
|
20
|
+
entering: (on) => this.toggleState('entering', on),
|
|
21
|
+
exiting: (on) => this.toggleState('exiting', on),
|
|
22
|
+
},
|
|
23
|
+
open: () => this.open,
|
|
24
|
+
surface: () => this.dialog,
|
|
25
|
+
});
|
|
26
|
+
this.aria = new AriaForwardController(this, { target: () => this.dialog });
|
|
14
27
|
this.commands = new CommandController(this, {
|
|
15
28
|
commands: {
|
|
16
29
|
'--close': () => this.close(),
|
|
@@ -33,6 +46,21 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
33
46
|
}
|
|
34
47
|
this.relayNativeEvent(event);
|
|
35
48
|
};
|
|
49
|
+
this.handleSubmit = (event) => {
|
|
50
|
+
const form = event.target;
|
|
51
|
+
if (!(form instanceof HTMLFormElement) || form.closest('dialog')) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const submitter = event.submitter;
|
|
55
|
+
const method = submitter?.hasAttribute('formmethod') ? submitter.formMethod : form.method;
|
|
56
|
+
if (method !== 'dialog') {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
this.close(submitter?.hasAttribute('value') ? submitter.value : undefined);
|
|
61
|
+
};
|
|
62
|
+
this.namedByHeader = false;
|
|
63
|
+
this.describedByBody = false;
|
|
36
64
|
this.handleBackdrop = (event) => {
|
|
37
65
|
const panel = this.dialog;
|
|
38
66
|
if (!panel || event.target !== panel) {
|
|
@@ -77,12 +105,41 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
77
105
|
this.returnValue = previous;
|
|
78
106
|
}
|
|
79
107
|
}
|
|
108
|
+
nameByHeader() {
|
|
109
|
+
const slot = this.renderRoot.querySelector('slot[name="header"]');
|
|
110
|
+
const heading = this.label || this.hasAttribute('aria-labelledby')
|
|
111
|
+
? []
|
|
112
|
+
: headingsIn(slot?.assignedElements({ flatten: true }) ?? []);
|
|
113
|
+
this.namedByHeader = reflectElements(this.dialog, 'ariaLabelledByElements', heading, this.namedByHeader);
|
|
114
|
+
}
|
|
115
|
+
describeByBody() {
|
|
116
|
+
const slot = this.renderRoot.querySelector('slot:not([name])');
|
|
117
|
+
const words = this.hasAttribute('aria-describedby') ? [] : wordsIn(slot);
|
|
118
|
+
this.describedByBody = reflectElements(this.dialog, 'ariaDescribedByElements', words, this.describedByBody);
|
|
119
|
+
}
|
|
80
120
|
willUpdate(changed) {
|
|
81
121
|
super.willUpdate(changed);
|
|
82
122
|
hostAria(this.internals, { label: this.label });
|
|
83
123
|
}
|
|
124
|
+
connectedCallback() {
|
|
125
|
+
super.connectedCallback();
|
|
126
|
+
this.addEventListener('submit', this.handleSubmit);
|
|
127
|
+
}
|
|
128
|
+
disconnectedCallback() {
|
|
129
|
+
super.disconnectedCallback();
|
|
130
|
+
this.removeEventListener('submit', this.handleSubmit);
|
|
131
|
+
unlockScroll(this);
|
|
132
|
+
}
|
|
84
133
|
updated(changed) {
|
|
85
134
|
super.updated(changed);
|
|
135
|
+
this.nameByHeader();
|
|
136
|
+
this.describeByBody();
|
|
137
|
+
if (this.open) {
|
|
138
|
+
lockScroll(this);
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
unlockScroll(this);
|
|
142
|
+
}
|
|
86
143
|
const dialog = this.dialog;
|
|
87
144
|
if (!dialog) {
|
|
88
145
|
return;
|
|
@@ -122,9 +179,15 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
122
179
|
signal: this.refusal.signal,
|
|
123
180
|
});
|
|
124
181
|
}
|
|
182
|
+
renderDismissIcon() {
|
|
183
|
+
return html `<slot name="dismiss-icon">
|
|
184
|
+
${drawDismissGlyph()}
|
|
185
|
+
</slot>`;
|
|
186
|
+
}
|
|
125
187
|
render() {
|
|
126
188
|
return html `<dialog
|
|
127
189
|
part="dialog"
|
|
190
|
+
role=${this.alert ? 'alertdialog' : nothing}
|
|
128
191
|
closedby=${this.closedBy ?? nothing}
|
|
129
192
|
aria-label=${this.label || 'Dialog'}
|
|
130
193
|
@cancel=${this.handleCancel}
|
|
@@ -132,15 +195,31 @@ let HelixHeadlessDialog = class HelixHeadlessDialog extends MixinControllerOpen(
|
|
|
132
195
|
@close=${this.handleClose}
|
|
133
196
|
>
|
|
134
197
|
<slot name="icon"></slot>
|
|
135
|
-
<slot name="header"></slot>
|
|
136
|
-
<slot></slot>
|
|
137
|
-
<slot name="footer"></slot>
|
|
198
|
+
<slot name="header" part="header" @slotchange=${this.nameByHeader}></slot>
|
|
199
|
+
<slot part="body" @slotchange=${this.describeByBody}></slot>
|
|
200
|
+
<slot name="footer" part="footer"></slot>
|
|
201
|
+
${this.dismissible
|
|
202
|
+
? drawDismiss({
|
|
203
|
+
label: this.dismissLabel,
|
|
204
|
+
mark: this.renderDismissIcon(),
|
|
205
|
+
onDismiss: () => this.close(),
|
|
206
|
+
})
|
|
207
|
+
: nothing}
|
|
138
208
|
</dialog>`;
|
|
139
209
|
}
|
|
140
210
|
};
|
|
211
|
+
__decorate([
|
|
212
|
+
property({ type: Boolean })
|
|
213
|
+
], HelixHeadlessDialog.prototype, "alert", void 0);
|
|
141
214
|
__decorate([
|
|
142
215
|
property({ attribute: 'closedby', reflect: true })
|
|
143
216
|
], HelixHeadlessDialog.prototype, "closedBy", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
property({ reflect: true, type: Boolean })
|
|
219
|
+
], HelixHeadlessDialog.prototype, "dismissible", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
property({ attribute: 'dismiss-label' })
|
|
222
|
+
], HelixHeadlessDialog.prototype, "dismissLabel", void 0);
|
|
144
223
|
__decorate([
|
|
145
224
|
property()
|
|
146
225
|
], HelixHeadlessDialog.prototype, "label", void 0);
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
2
|
import { nothing, type TemplateResult } from 'lit';
|
|
3
3
|
import '../../tooltip/index.js';
|
|
4
|
+
/** One slice: its share of the whole, where it starts, and the row it was read from. */
|
|
5
|
+
export interface DonutShare {
|
|
6
|
+
/** The slice's share of the whole, from 0 to 1. */
|
|
7
|
+
fraction: number;
|
|
8
|
+
/** The table row the slice was read from, counting from zero. */
|
|
9
|
+
row: number;
|
|
10
|
+
/** Where the slice starts, as a share of the whole. */
|
|
11
|
+
start: number;
|
|
12
|
+
}
|
|
4
13
|
declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args: any[]) => import("@fusion.dev/helix-core").MixinChartSourceInterface);
|
|
5
14
|
/**
|
|
6
15
|
* @summary A chart that shows parts of a whole as a ring, read from a table.
|
|
@@ -15,20 +24,32 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
|
|
|
15
24
|
* **Negative values are skipped.** An arc cannot show a negative number, so
|
|
16
25
|
* those rows are left out and the total is the sum of the remaining rows.
|
|
17
26
|
*
|
|
27
|
+
* The ring is hidden from screen readers. The `summary` part names the chart,
|
|
28
|
+
* from `label` or the table's caption, and gives each slice's share, and the
|
|
29
|
+
* table beside the chart has every amount.
|
|
30
|
+
*
|
|
31
|
+
* **The ring is read by key.** The plot takes focus, named by `label` or the
|
|
32
|
+
* caption. Every arrow moves from slice to slice, the right and down arrows to
|
|
33
|
+
* the next, and Home and End go to the first and the last. The tooltip
|
|
34
|
+
* follows, the `live` part says the slice in words, and Escape puts the
|
|
35
|
+
* tooltip away.
|
|
36
|
+
*
|
|
18
37
|
* @since 0.1.0
|
|
19
38
|
* @status stable
|
|
20
39
|
* @category charts
|
|
21
40
|
* @aliases Pie Chart, Ring Chart, Share Chart
|
|
22
41
|
* @documentation https://fusion.dev/helix/components/donut-chart
|
|
23
42
|
*
|
|
24
|
-
* @slot - Content in the middle of the ring, usually a total.
|
|
43
|
+
* @slot - Content in the middle of the ring, usually a total. It is read by screen readers, while the ring itself is hidden from them.
|
|
25
44
|
*
|
|
26
45
|
* @csspart center - The middle of the ring, holding whatever is slotted.
|
|
46
|
+
* @csspart live - The readout: a polite live region that says the slice the keys moved to. Hide it visually.
|
|
27
47
|
* @csspart mark - The invisible point the tooltip is anchored to.
|
|
28
|
-
* @csspart plot - The drawing.
|
|
48
|
+
* @csspart plot - The drawing, which takes focus to be read by key.
|
|
29
49
|
* @csspart segment - One slice.
|
|
30
50
|
* @csspart segment-active - The slice under the pointer. Set alongside `segment`.
|
|
31
51
|
* @csspart segment-edge - One slice as a closed shape, used to draw its outline.
|
|
52
|
+
* @csspart summary - The chart's name and each slice's share, written as a sentence for screen readers. Hide it visually.
|
|
32
53
|
* @csspart tooltip - The bubble, forwarded from `Tooltip`.
|
|
33
54
|
* @csspart tooltip-anchor - The `Tooltip` element itself.
|
|
34
55
|
* @csspart tooltip-arrow - The bubble's point, forwarded from `Tooltip`.
|
|
@@ -38,6 +59,7 @@ declare const HelixHeadlessDonutChart_base: typeof HelixElement & (new (...args:
|
|
|
38
59
|
* @csspart tooltip-arrow-top - The point while the bubble is above the reading, on its bottom edge. Set alongside `tooltip-arrow`.
|
|
39
60
|
* @csspart tooltip-bottom - The bubble while it is below the reading. Set alongside `tooltip`.
|
|
40
61
|
* @csspart tooltip-cell - One column's name and value inside the tooltip.
|
|
62
|
+
* @csspart tooltip-cell-current - The cell the series keys rest on, in the charts whose readings hold several series. A ring draws one, so it is never set here.
|
|
41
63
|
* @csspart tooltip-label - The slice's own name inside the tooltip.
|
|
42
64
|
* @csspart tooltip-left - The bubble while it is left of the reading. Set alongside `tooltip`.
|
|
43
65
|
* @csspart tooltip-name - A column's name inside the tooltip.
|
|
@@ -131,18 +153,47 @@ export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_bas
|
|
|
131
153
|
private get thickness();
|
|
132
154
|
/** The ring's radius, which follows its thickness so the outer edge holds. */
|
|
133
155
|
private get radius();
|
|
156
|
+
/**
|
|
157
|
+
* Each slice's share of the circle, where it starts, and the row it was read
|
|
158
|
+
* from.
|
|
159
|
+
*
|
|
160
|
+
* The row because a slice is not its row once a row is left out: a value
|
|
161
|
+
* that does not parse has no slice, and the tooltip counting slices against
|
|
162
|
+
* the table's rows named the row before the one under the pointer.
|
|
163
|
+
*/
|
|
134
164
|
private get shares();
|
|
165
|
+
/**
|
|
166
|
+
* The palette slot for a cell, which a ring gives its first plotted column
|
|
167
|
+
* alone: it draws that column and no other, so a second numeric column is
|
|
168
|
+
* no series the keys could move to.
|
|
169
|
+
*/
|
|
170
|
+
seriesOf(cell: number): number | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* The number of slices, which the keys walk.
|
|
173
|
+
*
|
|
174
|
+
* The mixin counts the table's rows, and a row with no amount draws no
|
|
175
|
+
* slice, so a key stepping by rows would land on a slice that is not there.
|
|
176
|
+
*/
|
|
177
|
+
get readings(): number;
|
|
135
178
|
protected render(): TemplateResult;
|
|
179
|
+
/**
|
|
180
|
+
* What a reader who cannot see the ring is told: the chart's name and each
|
|
181
|
+
* slice's share of the whole.
|
|
182
|
+
*
|
|
183
|
+
* The shares, because they are what the ring shows and the table does not:
|
|
184
|
+
* the table holds the amounts, and the percentages are this chart's
|
|
185
|
+
* arithmetic. In the ring's order, which is the table's and the legend's.
|
|
186
|
+
*/
|
|
187
|
+
protected renderSummary(shares: DonutShare[]): TemplateResult;
|
|
136
188
|
/**
|
|
137
189
|
* The ring itself, behind a seam the styled tier can move.
|
|
138
190
|
*
|
|
139
|
-
* `aria-hidden`, because the table it was read from is the
|
|
140
|
-
* and a screen reader hearing both hears the same numbers
|
|
191
|
+
* The drawing is `aria-hidden`, because the table it was read from is the
|
|
192
|
+
* readable version and a screen reader hearing both hears the same numbers
|
|
193
|
+
* twice. The middle is not: a total slotted there is usually a number the
|
|
194
|
+
* table does not hold.
|
|
141
195
|
*/
|
|
142
|
-
protected renderPlot(shares:
|
|
143
|
-
fraction: number;
|
|
144
|
-
start: number;
|
|
145
|
-
}[]): TemplateResult;
|
|
196
|
+
protected renderPlot(shares: DonutShare[]): TemplateResult;
|
|
146
197
|
/**
|
|
147
198
|
* The view box, cropped to what is actually drawn.
|
|
148
199
|
*
|
|
@@ -155,10 +206,7 @@ export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_bas
|
|
|
155
206
|
*/
|
|
156
207
|
private get frame();
|
|
157
208
|
/** One slice, as a dash the length of its share. */
|
|
158
|
-
protected renderSegment(share:
|
|
159
|
-
fraction: number;
|
|
160
|
-
start: number;
|
|
161
|
-
}, index: number): TemplateResult;
|
|
209
|
+
protected renderSegment(share: DonutShare, index: number): TemplateResult;
|
|
162
210
|
/**
|
|
163
211
|
* The same slice again, as a shape with an inside.
|
|
164
212
|
*
|
|
@@ -189,10 +237,7 @@ export declare class HelixHeadlessDonutChart extends HelixHeadlessDonutChart_bas
|
|
|
189
237
|
* `transform-box: fill-box`, so it spins each element about its own bounding
|
|
190
238
|
* box, which is the ring's center for a circle and is not for a sector.
|
|
191
239
|
*/
|
|
192
|
-
protected renderEdge(share:
|
|
193
|
-
fraction: number;
|
|
194
|
-
start: number;
|
|
195
|
-
}, index: number): TemplateResult;
|
|
240
|
+
protected renderEdge(share: DonutShare, index: number): TemplateResult;
|
|
196
241
|
/**
|
|
197
242
|
* What a pointer resting on a slice shows.
|
|
198
243
|
*
|
|
@@ -8,6 +8,18 @@ import { CHART_PLOT, customElement, drawTooltip, HelixElement, MixinChartSource,
|
|
|
8
8
|
import { html, nothing, svg } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import '../../tooltip/index.js';
|
|
11
|
+
const PERCENTS = new Map();
|
|
12
|
+
const percentIn = (locale) => {
|
|
13
|
+
let found = PERCENTS.get(locale);
|
|
14
|
+
if (!found) {
|
|
15
|
+
found = new Intl.NumberFormat(locale || undefined, {
|
|
16
|
+
maximumFractionDigits: 0,
|
|
17
|
+
style: 'percent',
|
|
18
|
+
});
|
|
19
|
+
PERCENTS.set(locale, found);
|
|
20
|
+
}
|
|
21
|
+
return found;
|
|
22
|
+
};
|
|
11
23
|
const CENTER = PLOT_WIDTH / 2;
|
|
12
24
|
const EDGE = 40;
|
|
13
25
|
const GAP = 9999;
|
|
@@ -36,34 +48,53 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
36
48
|
}
|
|
37
49
|
get shares() {
|
|
38
50
|
const series = this.series;
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
51
|
+
const points = series[0]?.points ?? [];
|
|
52
|
+
const values = points.map((point) => Number.isFinite(point.value) && point.value > 0 && this.showsSeries(point.label)
|
|
53
|
+
? point.value
|
|
54
|
+
: 0);
|
|
42
55
|
const total = values.reduce((sum, one) => sum + one, 0);
|
|
43
56
|
if (total === 0) {
|
|
44
57
|
return [];
|
|
45
58
|
}
|
|
46
59
|
let start = 0;
|
|
47
|
-
return values.map((value) => {
|
|
60
|
+
return values.map((value, index) => {
|
|
48
61
|
const fraction = value / total;
|
|
49
62
|
const at = start;
|
|
50
63
|
start += fraction;
|
|
51
|
-
return { fraction, start: at };
|
|
64
|
+
return { fraction, row: points[index]?.at ?? index, start: at };
|
|
52
65
|
});
|
|
53
66
|
}
|
|
67
|
+
seriesOf(cell) {
|
|
68
|
+
return cell === this.plottedColumns[0] ? seriesIndex(0) : undefined;
|
|
69
|
+
}
|
|
70
|
+
get readings() {
|
|
71
|
+
return this.shares.length;
|
|
72
|
+
}
|
|
54
73
|
render() {
|
|
55
74
|
const shares = this.shares;
|
|
56
|
-
return html `${this.renderPlot(shares)}
|
|
57
|
-
|
|
75
|
+
return html `${this.renderPlot(shares)}${shares.length === 0 ? nothing : this.renderSummary(shares)}`;
|
|
76
|
+
}
|
|
77
|
+
renderSummary(shares) {
|
|
78
|
+
const rows = this.sourceRows;
|
|
79
|
+
const parts = shares
|
|
80
|
+
.filter((share) => this.showsSeries(rows[share.row]?.label ?? ''))
|
|
81
|
+
.map((share) => `${rows[share.row]?.label ?? ''} ${percentIn(this.locale).format(share.fraction)}`);
|
|
82
|
+
const named = this.named ? `${this.named}: ` : '';
|
|
83
|
+
return html `<p id="helix-chart-summary" part="summary">${named}${parts.join(', ')}.</p>`;
|
|
58
84
|
}
|
|
59
85
|
renderPlot(shares) {
|
|
60
86
|
return html `<div
|
|
61
|
-
aria-
|
|
87
|
+
aria-describedby=${this.named ? `helix-chart-summary${this.hole === 'none' ? '' : ' helix-chart-center'}` : nothing}
|
|
88
|
+
aria-label=${this.named || nothing}
|
|
89
|
+
aria-labelledby=${this.named ? nothing : 'helix-chart-summary'}
|
|
62
90
|
id=${CHART_PLOT}
|
|
63
91
|
part="plot"
|
|
92
|
+
role="application"
|
|
64
93
|
style="--donut-chart-stroke: ${this.thickness}"
|
|
94
|
+
tabindex="0"
|
|
65
95
|
>
|
|
66
96
|
<svg
|
|
97
|
+
aria-hidden="true"
|
|
67
98
|
data-mirror=${this.sweep === 'half' ? '' : nothing}
|
|
68
99
|
viewBox=${this.frame}
|
|
69
100
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -79,7 +110,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
79
110
|
/>
|
|
80
111
|
${shares.map((share, index) => this.renderSegment(share, index))}
|
|
81
112
|
</svg>
|
|
82
|
-
${this.hole === 'none' ? nothing : html `<div part="center"><slot></slot></div>`}
|
|
113
|
+
${this.hole === 'none' ? nothing : html `<div id="helix-chart-center" part="center"><slot></slot></div>`}
|
|
83
114
|
${this.renderTooltip()}
|
|
84
115
|
</div>`;
|
|
85
116
|
}
|
|
@@ -100,7 +131,11 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
100
131
|
data-series=${seriesIndex(index)}
|
|
101
132
|
fill="none"
|
|
102
133
|
style="--chart-series: var(--chart-series-${seriesIndex(index)})"
|
|
103
|
-
@pointerenter=${() =>
|
|
134
|
+
@pointerenter=${(event) => {
|
|
135
|
+
if (this.pointer.accepts(event)) {
|
|
136
|
+
this.pointer.set(index);
|
|
137
|
+
}
|
|
138
|
+
}}
|
|
104
139
|
part="segment${active ? ' segment-active' : ''}"
|
|
105
140
|
r=${this.radius}
|
|
106
141
|
stroke-dasharray="${length} ${GAP}"
|
|
@@ -143,7 +178,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
143
178
|
const at = this.pointer.at;
|
|
144
179
|
const share = this.shares[at];
|
|
145
180
|
if (!share) {
|
|
146
|
-
return drawTooltip(this.sourceRows,
|
|
181
|
+
return drawTooltip(this.sourceRows, -1, this.tag('tooltip'), undefined, undefined, this.pointer);
|
|
147
182
|
}
|
|
148
183
|
const angle = (share.start + share.fraction / 2) * 2 * Math.PI * this.span + this.origin;
|
|
149
184
|
const edge = EDGE;
|
|
@@ -153,7 +188,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
153
188
|
const y = ((CENTER + Math.sin(angle) * edge - top) / tall) * 100;
|
|
154
189
|
const turned = this.sweep === 'half' && this.pointer.mirrored;
|
|
155
190
|
const across = Math.cos(angle) > 0 !== turned;
|
|
156
|
-
return drawTooltip(this.sourceRows,
|
|
191
|
+
return drawTooltip(this.sourceRows, share.row, this.tag('tooltip'), {
|
|
157
192
|
fixed: this.sweep !== 'half',
|
|
158
193
|
placement: Math.abs(Math.cos(angle)) > Math.abs(Math.sin(angle))
|
|
159
194
|
? across
|
|
@@ -164,7 +199,7 @@ let HelixHeadlessDonutChart = class HelixHeadlessDonutChart extends MixinChartSo
|
|
|
164
199
|
: 'top',
|
|
165
200
|
x: `${x}%`,
|
|
166
201
|
y: `${y}%`,
|
|
167
|
-
}, () => seriesIndex(at));
|
|
202
|
+
}, () => seriesIndex(at), this.pointer);
|
|
168
203
|
}
|
|
169
204
|
};
|
|
170
205
|
__decorate([
|