@fusion.dev/helix-headless 0.146.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 +5266 -785
- package/dist/accordion/item/accordion-item.d.ts +38 -19
- package/dist/accordion/item/accordion-item.js +31 -9
- package/dist/accordion/root/accordion-root.d.ts +8 -2
- package/dist/accordion/root/accordion-root.js +3 -3
- package/dist/announcement/root/announcement-root.d.ts +13 -4
- package/dist/announcement/root/announcement-root.js +34 -6
- 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/root/avatar-root.d.ts +31 -1
- package/dist/avatar/root/avatar-root.js +11 -1
- package/dist/badge/root/badge-root.d.ts +57 -6
- package/dist/badge/root/badge-root.js +88 -5
- package/dist/bar-chart/root/bar-chart-root.js +11 -20
- package/dist/bar-chart/stack.d.ts +10 -0
- package/dist/bar-chart/stack.js +8 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.d.ts +14 -0
- package/dist/breadcrumbs/breadcrumb/breadcrumb.js +12 -2
- package/dist/breadcrumbs/root/breadcrumbs-root.js +2 -2
- package/dist/button/root/button-root.d.ts +24 -38
- package/dist/button/root/button-root.js +6 -37
- package/dist/button/submitter.d.ts +27 -0
- package/dist/button/submitter.js +25 -0
- package/dist/card/root/card-root.d.ts +12 -1
- package/dist/card/root/card-root.js +11 -4
- package/dist/chat/root/chat-root.d.ts +15 -1
- package/dist/chat/root/chat-root.js +11 -2
- package/dist/checkbox/root/checkbox-root.js +5 -7
- package/dist/checkbox-group/root/checkbox-group-root.js +4 -3
- package/dist/checkbox-group/select-all.d.ts +0 -6
- package/dist/checkbox-group/select-all.js +0 -5
- package/dist/code-block/root/code-block-root.d.ts +35 -14
- package/dist/code-block/root/code-block-root.js +17 -3
- package/dist/color-input/root/color-input-root.d.ts +11 -0
- package/dist/color-input/root/color-input-root.js +12 -5
- package/dist/color-picker/channels.js +1 -2
- package/dist/color-picker/root/color-picker-root.d.ts +32 -24
- package/dist/color-picker/root/color-picker-root.js +101 -51
- 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 +13 -0
- package/dist/combobox/root/combobox-root.js +14 -1
- package/dist/command/root/command-root.d.ts +3 -1
- package/dist/command/root/command-root.js +2 -19
- package/dist/copy-button/root/copy-button-root.d.ts +16 -1
- package/dist/copy-button/root/copy-button-root.js +7 -2
- package/dist/data-table/keys.d.ts +0 -18
- package/dist/data-table/keys.js +1 -11
- package/dist/data-table/root/data-table-root.js +13 -7
- package/dist/date-input/root/date-input-root.d.ts +8 -1
- package/dist/date-input/root/date-input-root.js +8 -5
- package/dist/date-picker/root/date-picker-root.d.ts +14 -9
- package/dist/date-picker/root/date-picker-root.js +21 -16
- 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/donut-chart/root/donut-chart-root.js +13 -6
- package/dist/donut-chart/slice-label.d.ts +35 -0
- package/dist/donut-chart/slice-label.js +11 -0
- package/dist/drawer/root/drawer-root.d.ts +4 -2
- package/dist/drawer/root/drawer-root.js +15 -3
- package/dist/drilldown/item/drilldown-item.d.ts +21 -1
- package/dist/drilldown/item/drilldown-item.js +39 -4
- package/dist/drilldown/root/drilldown-root.js +3 -2
- package/dist/element-events.generated.js +4 -1
- package/dist/empty/root/empty-root.d.ts +31 -1
- package/dist/empty/root/empty-root.js +26 -5
- package/dist/file-input/root/file-input-root.d.ts +34 -6
- package/dist/file-input/root/file-input-root.js +54 -19
- 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/root/filter-input-root.d.ts +8 -0
- package/dist/filter-input/root/filter-input-root.js +17 -27
- 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 +18 -1
- package/dist/format-date/root/format-date-root.js +19 -23
- 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 +64 -3
- package/dist/heatmap/root/heatmap-root.js +89 -19
- 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 +13 -0
- package/dist/icon/root/icon-root.js +23 -2
- package/dist/icon/root/index.d.ts +1 -1
- package/dist/icon/root/index.js +1 -1
- package/dist/image/root/image-root.d.ts +9 -0
- package/dist/image/root/image-root.js +6 -1
- package/dist/input/root/input-root.d.ts +23 -2
- package/dist/input/root/input-root.js +12 -8
- package/dist/kbd/keys.d.ts +29 -0
- package/dist/kbd/keys.js +52 -0
- package/dist/kbd/root/kbd-root.d.ts +20 -3
- package/dist/kbd/root/kbd-root.js +24 -50
- 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 +25 -7
- package/dist/legend/root/legend-root.js +22 -10
- package/dist/lightbox/root/lightbox-root.d.ts +50 -5
- package/dist/lightbox/root/lightbox-root.js +76 -8
- package/dist/lightbox/zoom.d.ts +2 -0
- package/dist/lightbox/zoom.js +5 -3
- package/dist/line-chart/root/line-chart-root.d.ts +16 -0
- package/dist/line-chart/root/line-chart-root.js +10 -2
- package/dist/list/root/list-root.d.ts +10 -2
- package/dist/list/root/list-root.js +26 -5
- package/dist/list/selection.d.ts +17 -0
- package/dist/list/selection.js +16 -0
- package/dist/listbox/root/listbox-root.d.ts +9 -5
- package/dist/listbox/root/listbox-root.js +29 -37
- 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 +38 -14
- package/dist/megamenu/root/megamenu-root.js +36 -50
- package/dist/menu/item/menu-item.js +4 -4
- package/dist/menu/root/menu-root.d.ts +3 -0
- package/dist/meter/root/meter-root.d.ts +42 -0
- package/dist/meter/root/meter-root.js +33 -7
- package/dist/notifications/root/notifications-root.d.ts +10 -1
- package/dist/notifications/root/notifications-root.js +11 -1
- 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 +17 -1
- package/dist/number-input/root/number-input-root.js +29 -18
- package/dist/object-inspector/root/object-inspector-root.d.ts +13 -6
- package/dist/object-inspector/root/object-inspector-root.js +18 -17
- package/dist/option/index.d.ts +1 -0
- package/dist/option/index.js +1 -0
- 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 +12 -0
- package/dist/outline/root/outline-root.js +5 -19
- package/dist/pagination/size/pagination-size.d.ts +5 -0
- package/dist/pagination/size/pagination-size.js +4 -2
- package/dist/pin-input/code.d.ts +28 -1
- package/dist/pin-input/code.js +12 -0
- package/dist/pin-input/root/pin-input-root.d.ts +98 -121
- package/dist/pin-input/root/pin-input-root.js +157 -148
- package/dist/popover/hide-outside.js +2 -9
- package/dist/popover/root/popover-root.d.ts +7 -1
- package/dist/popover/root/popover-root.js +9 -1
- package/dist/progress/root/progress-root.d.ts +27 -0
- package/dist/progress/root/progress-root.js +25 -7
- package/dist/qr-code/export.d.ts +19 -0
- package/dist/qr-code/export.js +14 -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 +17 -6
- package/dist/qr-code/root/qr-code-root.js +10 -12
- package/dist/radio/group/radio-group.d.ts +15 -0
- package/dist/radio/root/radio-root.js +2 -2
- package/dist/rating/root/rating-root.d.ts +22 -9
- package/dist/rating/root/rating-root.js +15 -39
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +30 -0
- package/dist/scatter-chart/root/scatter-chart-root.js +34 -7
- package/dist/scroll-area/scrollbar.d.ts +0 -8
- package/dist/scroll-area/scrollbar.js +1 -1
- package/dist/select/align.d.ts +47 -0
- package/dist/select/align.js +7 -0
- package/dist/select/root/select-root.d.ts +59 -3
- package/dist/select/root/select-root.js +72 -12
- package/dist/slider/root/slider-root.d.ts +18 -1
- package/dist/slider/root/slider-root.js +22 -0
- package/dist/sparkline/readings.d.ts +30 -12
- package/dist/sparkline/readings.js +32 -15
- package/dist/sparkline/root/sparkline-root.d.ts +46 -3
- package/dist/sparkline/root/sparkline-root.js +60 -21
- 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 +9 -1
- package/dist/splitter/root/splitter-root.d.ts +3 -0
- package/dist/splitter/root/splitter-root.js +2 -0
- package/dist/steps/root/steps-root.d.ts +8 -1
- package/dist/steps/root/steps-root.js +6 -1
- package/dist/steps/step/step.d.ts +1 -0
- package/dist/steps/step/step.js +1 -1
- package/dist/table/column/table-column.d.ts +6 -0
- package/dist/table/column/table-column.js +5 -1
- package/dist/table/root/table-root.js +13 -6
- package/dist/table/row/table-row.d.ts +24 -0
- package/dist/table/row/table-row.js +37 -1
- package/dist/tabs/root/tabs-root.d.ts +5 -3
- package/dist/tag/group/tag-group.d.ts +16 -4
- package/dist/tag/group/tag-group.js +19 -7
- package/dist/textarea/root/textarea-root.d.ts +14 -2
- package/dist/textarea/root/textarea-root.js +6 -7
- package/dist/time-input/root/time-input-root.d.ts +5 -1
- package/dist/time-input/root/time-input-root.js +10 -7
- package/dist/time-picker/root/time-picker-root.d.ts +11 -14
- package/dist/time-picker/root/time-picker-root.js +15 -23
- package/dist/toast/item/toast-item.d.ts +3 -3
- package/dist/toast/item/toast-item.js +0 -1
- package/dist/toast/root/toast-root.d.ts +28 -4
- package/dist/toast/root/toast-root.js +58 -12
- package/dist/toast/words.d.ts +12 -0
- package/dist/toast/words.js +25 -0
- package/dist/toggle/group/toggle-group.d.ts +29 -5
- package/dist/toggle/group/toggle-group.js +26 -41
- 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 +7 -1
- package/dist/tooltip/root/tooltip-root.js +10 -1
- package/dist/tour/root/tour-root.d.ts +15 -0
- package/dist/tour/root/tour-root.js +20 -1
- package/dist/tour/stop/tour-stop.d.ts +3 -0
- package/dist/tour/stop/tour-stop.js +3 -3
- package/dist/tree/root/tree-root.js +2 -2
- package/dist/trend/figure.d.ts +16 -0
- package/dist/trend/figure.js +8 -0
- package/dist/trend/root/trend-root.d.ts +41 -2
- package/dist/trend/root/trend-root.js +29 -3
- 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 +5 -1
- package/dist/video-playlist/root/video-playlist-root.d.ts +11 -1
- package/dist/video-playlist/root/video-playlist-root.js +3 -0
- package/dist/virtual-list/fill.d.ts +11 -0
- package/dist/virtual-list/fill.js +9 -0
- package/dist/virtual-list/keys.d.ts +16 -7
- package/dist/virtual-list/keys.js +17 -6
- package/dist/virtual-list/plan.d.ts +17 -1
- package/dist/virtual-list/plan.js +13 -2
- package/dist/virtual-list/root/virtual-list-root.d.ts +25 -3
- package/dist/virtual-list/root/virtual-list-root.js +48 -24
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +2979 -738
- package/types/svelte.d.ts +1 -0
- package/types/vue.d.ts +619 -202
- package/dist/color-picker/swatches.d.ts +0 -12
- package/dist/color-picker/swatches.js +0 -26
- package/dist/rating/steps.d.ts +0 -7
- package/dist/rating/steps.js +0 -9
|
@@ -13,20 +13,22 @@ declare const HelixHeadlessAccordionItem_base: (new (...args: any[]) => import("
|
|
|
13
13
|
* accordion's, then 3.
|
|
14
14
|
*
|
|
15
15
|
* Content stays mounted when the item is closed, so it can animate and its text
|
|
16
|
-
* is present in server-rendered HTML.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* `
|
|
16
|
+
* is present in server-rendered HTML.
|
|
17
|
+
*
|
|
18
|
+
* The browser's find in page searches a closed section, and a match opens it,
|
|
19
|
+
* with `helix-before-open` first, as React Aria's disclosure does. Closed
|
|
20
|
+
* content is `hidden="until-found"`, which hides it with no stylesheet loaded
|
|
21
|
+
* and keeps it out of the tab order and the accessibility tree. A section
|
|
22
|
+
* that closes keeps its content drawn until the content part's animations and
|
|
23
|
+
* transitions end, so a sheet that animates the section closed shows the
|
|
24
|
+
* content shrinking rather than an empty box. Set `hidden-until-found="false"`
|
|
25
|
+
* and a closed section is `hidden` and `inert` instead, and find in page skips
|
|
26
|
+
* it.
|
|
20
27
|
*
|
|
21
28
|
* While it is open, the content part carries the content's height as
|
|
22
29
|
* `--accordion-content-height`, as Radix's accordion does, for a stylesheet
|
|
23
30
|
* that animates the section open with keyframes of its own.
|
|
24
31
|
*
|
|
25
|
-
* Set `hidden-until-found` and the browser's find in page searches a closed
|
|
26
|
-
* section too: a match opens it, with `helix-before-open` first, as React
|
|
27
|
-
* Aria's disclosure does. The content is then `hidden="until-found"` while
|
|
28
|
-
* closed, and not `inert`, since an inert region is never searched.
|
|
29
|
-
*
|
|
30
32
|
* @since 0.1.0
|
|
31
33
|
* @status stable
|
|
32
34
|
* @aliases Collapsible, Expander, Disclosure
|
|
@@ -97,12 +99,11 @@ export declare class HelixHeadlessAccordionItem extends HelixHeadlessAccordionIt
|
|
|
97
99
|
* Whether find in page searches the section while it is closed, and opens it
|
|
98
100
|
* on a match.
|
|
99
101
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* accordion's own `hidden-until-found` turns it on for every section.
|
|
102
|
+
* Unset takes the accordion's `hidden-until-found`, which is on. Write
|
|
103
|
+
* `hidden-until-found="false"` to keep find in page out of this section: a
|
|
104
|
+
* closed section is then `hidden` and `inert`.
|
|
104
105
|
*/
|
|
105
|
-
hiddenUntilFound
|
|
106
|
+
hiddenUntilFound?: boolean;
|
|
106
107
|
/**
|
|
107
108
|
* A group name. Opening an item closes the other items with the same name,
|
|
108
109
|
* as `<details name>` does.
|
|
@@ -126,6 +127,24 @@ export declare class HelixHeadlessAccordionItem extends HelixHeadlessAccordionIt
|
|
|
126
127
|
name?: string;
|
|
127
128
|
/** Whether find in page searches this section while it is closed. */
|
|
128
129
|
private get findable();
|
|
130
|
+
/**
|
|
131
|
+
* Whether the section has closed and its content is still drawn, until the
|
|
132
|
+
* content part's animations end.
|
|
133
|
+
*
|
|
134
|
+
* `hidden="until-found"` hides through `content-visibility`, which an
|
|
135
|
+
* author's `display` does not override, so writing it the moment the section
|
|
136
|
+
* closes empties the box a sheet is still shrinking. `inert` holds the
|
|
137
|
+
* content meanwhile.
|
|
138
|
+
*/
|
|
139
|
+
private closing;
|
|
140
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
141
|
+
/**
|
|
142
|
+
* Hides the content of a section that closed, once whatever animates the
|
|
143
|
+
* content part has finished. Nothing running, as under reduced motion or
|
|
144
|
+
* with no stylesheet, hides it at once. `getAnimations` brings the styles up
|
|
145
|
+
* to date first, so a transition the close starts is among them.
|
|
146
|
+
*/
|
|
147
|
+
private finishClosing;
|
|
129
148
|
/**
|
|
130
149
|
* Opens the section find in page has matched in, before the match is shown.
|
|
131
150
|
*
|
|
@@ -204,13 +223,13 @@ export declare class HelixHeadlessAccordionItem extends HelixHeadlessAccordionIt
|
|
|
204
223
|
* part outranks it and the transition runs exactly as before. Measured on
|
|
205
224
|
* both tiers.
|
|
206
225
|
*
|
|
207
|
-
* **`hidden="until-found"`
|
|
226
|
+
* **`hidden="until-found"` unless it is turned off.** It hides through
|
|
208
227
|
* `content-visibility` rather than `display`, which an author `display` does
|
|
209
|
-
* not override, so
|
|
210
|
-
*
|
|
211
|
-
* under a trigger that still reports collapsed.
|
|
228
|
+
* not override, so it is written only once the section's closing motion has
|
|
229
|
+
* ended (`closing`). `beforematch` sets `open`, so find in page never reveals
|
|
230
|
+
* text under a trigger that still reports collapsed.
|
|
212
231
|
*
|
|
213
|
-
* `inert`
|
|
232
|
+
* `inert` only where `until-found` is not. `hidden` answers the reader who
|
|
214
233
|
* can see and `inert` answers the one tabbing through, and wherever a sheet
|
|
215
234
|
* overrides `display`, `inert` is the only one of the two still in force.
|
|
216
235
|
* `content-visibility: hidden` keeps skipped content out of the tab order and
|
|
@@ -4,10 +4,10 @@ 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 { closestInstance, customElement, HelixElement, headingLevel, MixinControllerOpen, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { closestInstance, customElement, HelixElement, headingLevel, MixinControllerOpen, onUnlessFalse, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { caretDown } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
|
-
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { property, state } from 'lit/decorators.js';
|
|
11
11
|
import { unsafeSVG } from 'lit/directives/unsafe-svg.js';
|
|
12
12
|
import { HelixHeadlessAccordion } from '../root/accordion-root.js';
|
|
13
13
|
const CONTENT_ID = 'content';
|
|
@@ -17,8 +17,8 @@ let HelixHeadlessAccordionItem = class HelixHeadlessAccordionItem extends MixinC
|
|
|
17
17
|
super(...arguments);
|
|
18
18
|
this.disabled = false;
|
|
19
19
|
this.groupHeadingLevel = undefined;
|
|
20
|
-
this.groupHiddenUntilFound =
|
|
21
|
-
this.
|
|
20
|
+
this.groupHiddenUntilFound = true;
|
|
21
|
+
this.closing = false;
|
|
22
22
|
this.handleBeforeMatch = (event) => {
|
|
23
23
|
if (this.open || this.requestOpen(true)) {
|
|
24
24
|
return;
|
|
@@ -63,7 +63,22 @@ let HelixHeadlessAccordionItem = class HelixHeadlessAccordionItem extends MixinC
|
|
|
63
63
|
>`;
|
|
64
64
|
}
|
|
65
65
|
get findable() {
|
|
66
|
-
return this.hiddenUntilFound
|
|
66
|
+
return this.hiddenUntilFound ?? this.groupHiddenUntilFound;
|
|
67
|
+
}
|
|
68
|
+
willUpdate(changed) {
|
|
69
|
+
super.willUpdate(changed);
|
|
70
|
+
if (changed.has('open')) {
|
|
71
|
+
this.closing = !this.open && changed.get('open') === true && this.findable;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
finishClosing() {
|
|
75
|
+
const running = this.partNamed('content')?.getAnimations?.({ subtree: true }) ?? [];
|
|
76
|
+
const done = () => {
|
|
77
|
+
if (!this.open) {
|
|
78
|
+
this.closing = false;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
Promise.all(running.map((animation) => animation.finished)).then(done, done);
|
|
67
82
|
}
|
|
68
83
|
get accordion() {
|
|
69
84
|
return closestInstance(this, HelixHeadlessAccordion);
|
|
@@ -96,6 +111,9 @@ let HelixHeadlessAccordionItem = class HelixHeadlessAccordionItem extends MixinC
|
|
|
96
111
|
if (this.wasOpen === false && this.open) {
|
|
97
112
|
this.closePeers();
|
|
98
113
|
}
|
|
114
|
+
if (changed.has('closing') && this.closing) {
|
|
115
|
+
this.finishClosing();
|
|
116
|
+
}
|
|
99
117
|
this.wasOpen = this.open;
|
|
100
118
|
this.measure();
|
|
101
119
|
}
|
|
@@ -104,7 +122,8 @@ let HelixHeadlessAccordionItem = class HelixHeadlessAccordionItem extends MixinC
|
|
|
104
122
|
}
|
|
105
123
|
render() {
|
|
106
124
|
const open = this.open;
|
|
107
|
-
const
|
|
125
|
+
const shown = open || this.closing;
|
|
126
|
+
const landmark = shown || !this.findable;
|
|
108
127
|
const level = headingLevel(this.headingLevel ?? this.groupHeadingLevel);
|
|
109
128
|
return html `
|
|
110
129
|
<div part="container">
|
|
@@ -127,8 +146,8 @@ let HelixHeadlessAccordionItem = class HelixHeadlessAccordionItem extends MixinC
|
|
|
127
146
|
id=${CONTENT_ID}
|
|
128
147
|
aria-labelledby=${landmark ? TRIGGER_ID : nothing}
|
|
129
148
|
part="content"
|
|
130
|
-
hidden=${
|
|
131
|
-
?inert=${!open && !this.findable}
|
|
149
|
+
hidden=${shown ? nothing : this.findable ? 'until-found' : ''}
|
|
150
|
+
?inert=${!open && (this.closing || !this.findable)}
|
|
132
151
|
role=${landmark ? 'region' : nothing}
|
|
133
152
|
@beforematch=${this.handleBeforeMatch}
|
|
134
153
|
>
|
|
@@ -156,11 +175,14 @@ __decorate([
|
|
|
156
175
|
property({ attribute: 'heading-level', type: Number })
|
|
157
176
|
], HelixHeadlessAccordionItem.prototype, "headingLevel", void 0);
|
|
158
177
|
__decorate([
|
|
159
|
-
property({ attribute: 'hidden-until-found',
|
|
178
|
+
property({ attribute: 'hidden-until-found', converter: onUnlessFalse })
|
|
160
179
|
], HelixHeadlessAccordionItem.prototype, "hiddenUntilFound", void 0);
|
|
161
180
|
__decorate([
|
|
162
181
|
property({ reflect: true })
|
|
163
182
|
], HelixHeadlessAccordionItem.prototype, "name", void 0);
|
|
183
|
+
__decorate([
|
|
184
|
+
state()
|
|
185
|
+
], HelixHeadlessAccordionItem.prototype, "closing", void 0);
|
|
164
186
|
HelixHeadlessAccordionItem = __decorate([
|
|
165
187
|
customElement('helix-headless-accordion-item')
|
|
166
188
|
], HelixHeadlessAccordionItem);
|
|
@@ -27,6 +27,9 @@ import { HelixHeadlessAccordionItem } from '../item/accordion-item.js';
|
|
|
27
27
|
* in a screen reader's list of headings. An open section is a region named by
|
|
28
28
|
* its trigger. Set the level that fits the page's outline.
|
|
29
29
|
*
|
|
30
|
+
* Find in page searches the closed sections too, and opens the one it matches
|
|
31
|
+
* in. `hidden-until-found="false"` turns that off.
|
|
32
|
+
*
|
|
30
33
|
* @since 0.1.0
|
|
31
34
|
* @status stable
|
|
32
35
|
* @category layout
|
|
@@ -44,8 +47,11 @@ export declare class HelixHeadlessAccordion extends HelixElement {
|
|
|
44
47
|
headingLevel?: number;
|
|
45
48
|
/**
|
|
46
49
|
* Whether find in page searches every closed section, and opens the one it
|
|
47
|
-
* matches in.
|
|
48
|
-
*
|
|
50
|
+
* matches in.
|
|
51
|
+
*
|
|
52
|
+
* On by default, as in React Aria's disclosure. Write
|
|
53
|
+
* `hidden-until-found="false"` to turn it off for every section; an item's
|
|
54
|
+
* own `hidden-until-found` wins for that item.
|
|
49
55
|
*/
|
|
50
56
|
hiddenUntilFound: boolean;
|
|
51
57
|
/**
|
|
@@ -4,7 +4,7 @@ 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, KeyboardNavigationController, whenHydrated, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { customElement, HelixElement, KeyboardNavigationController, onUnlessFalse, whenHydrated, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { HelixHeadlessAccordionItem } from '../item/accordion-item.js';
|
|
@@ -18,7 +18,7 @@ const navigable = (item) => ({
|
|
|
18
18
|
let HelixHeadlessAccordion = class HelixHeadlessAccordion extends HelixElement {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(...arguments);
|
|
21
|
-
this.hiddenUntilFound =
|
|
21
|
+
this.hiddenUntilFound = true;
|
|
22
22
|
this.keys = new KeyboardNavigationController(this, {
|
|
23
23
|
items: () => this.items.map(navigable),
|
|
24
24
|
origin: 'focus',
|
|
@@ -71,7 +71,7 @@ __decorate([
|
|
|
71
71
|
property({ attribute: 'heading-level', type: Number })
|
|
72
72
|
], HelixHeadlessAccordion.prototype, "headingLevel", void 0);
|
|
73
73
|
__decorate([
|
|
74
|
-
property({ attribute: 'hidden-until-found',
|
|
74
|
+
property({ attribute: 'hidden-until-found', converter: onUnlessFalse })
|
|
75
75
|
], HelixHeadlessAccordion.prototype, "hiddenUntilFound", void 0);
|
|
76
76
|
__decorate([
|
|
77
77
|
property({ reflect: true })
|
|
@@ -31,8 +31,11 @@ declare const HelixHeadlessAnnouncement_base: (new (...args: any[]) => import("@
|
|
|
31
31
|
*
|
|
32
32
|
* Set `duration` to dismiss it after a time. The clock stops while the pointer
|
|
33
33
|
* or focus is on the announcement, and continues from what was left, so a
|
|
34
|
-
* reader partway through is not cut off.
|
|
35
|
-
*
|
|
34
|
+
* reader partway through is not cut off. It stops while the page is hidden too,
|
|
35
|
+
* in another tab or a minimized window, so the message is not spent where
|
|
36
|
+
* nobody can see it. While the clock is stopped the announcement carries
|
|
37
|
+
* `:state(paused)`. When the time runs out it sends `helix-dismiss`, as the
|
|
38
|
+
* button does.
|
|
36
39
|
*
|
|
37
40
|
* @since 0.1.0
|
|
38
41
|
* @status stable
|
|
@@ -42,15 +45,18 @@ declare const HelixHeadlessAnnouncement_base: (new (...args: any[]) => import("@
|
|
|
42
45
|
*
|
|
43
46
|
* @slot - The message.
|
|
44
47
|
* @slot actions - Actions for the message, usually a link or a button.
|
|
45
|
-
* @slot icon - Replaces the
|
|
48
|
+
* @slot dismiss-icon - Replaces the cross inside the dismiss button, as `Callout`'s slot of the same name does.
|
|
49
|
+
* @slot icon - Replaces the cross inside the dismiss button. Deprecated: use `dismiss-icon`, which is read first.
|
|
46
50
|
*
|
|
47
51
|
* @event {HelixDismissEvent} helix-dismiss - The dismiss button was pressed, or `duration` ran out. The announcement does not remove itself, so remove it in response. Cancelable.
|
|
48
52
|
*
|
|
49
53
|
* @csspart actions - The region after the message that holds the actions.
|
|
50
54
|
* @csspart content - The region that holds the message.
|
|
51
55
|
* @csspart dismiss - The button that dismisses the announcement.
|
|
52
|
-
* @csspart dismiss-mark - The
|
|
56
|
+
* @csspart dismiss-mark - The cross on the dismiss button, shown when the `dismiss-icon` and `icon` slots are empty.
|
|
53
57
|
* @csspart live - A copy of the message in a live region, read by screen readers when the announcement appears after the page has loaded, and emptied seven seconds later. Visually hidden in the styled tier.
|
|
58
|
+
*
|
|
59
|
+
* @cssstate paused - The clock `duration` started is stopped, while the pointer or focus is on the announcement or the page is hidden.
|
|
54
60
|
*/
|
|
55
61
|
export declare class HelixHeadlessAnnouncement extends HelixHeadlessAnnouncement_base {
|
|
56
62
|
/**
|
|
@@ -87,6 +93,9 @@ export declare class HelixHeadlessAnnouncement extends HelixHeadlessAnnouncement
|
|
|
87
93
|
protected readonly arrival: ArrivalController;
|
|
88
94
|
/** The time `duration` gives it, held while a reader is on it. */
|
|
89
95
|
private readonly countdown;
|
|
96
|
+
/** Whether the page being hidden is one of the reasons the clock is held. */
|
|
97
|
+
private heldHidden;
|
|
98
|
+
private readonly handleVisibility;
|
|
90
99
|
private readonly handleHold;
|
|
91
100
|
private readonly handleRelease;
|
|
92
101
|
connectedCallback(): void;
|
|
@@ -4,7 +4,7 @@ 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 { ArrivalController, CountdownController, customElement, HelixElement, MixinDismissible, markRegion, slottedWords, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { ArrivalController, CountdownController, customElement, HelixElement, MixinDismissible, markRegion, reportRuntime, slottedWords, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { x } from '@fusion.dev/helix-icons';
|
|
9
9
|
import { html, nothing } from 'lit';
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
@@ -20,7 +20,21 @@ let HelixHeadlessAnnouncement = class HelixHeadlessAnnouncement extends MixinDis
|
|
|
20
20
|
done: () => {
|
|
21
21
|
this.dismiss();
|
|
22
22
|
},
|
|
23
|
+
paused: (paused) => {
|
|
24
|
+
this.toggleState('paused', paused);
|
|
25
|
+
},
|
|
23
26
|
});
|
|
27
|
+
this.heldHidden = false;
|
|
28
|
+
this.handleVisibility = () => {
|
|
29
|
+
if (document.hidden && !this.heldHidden) {
|
|
30
|
+
this.heldHidden = true;
|
|
31
|
+
this.countdown.hold();
|
|
32
|
+
}
|
|
33
|
+
else if (!document.hidden && this.heldHidden) {
|
|
34
|
+
this.heldHidden = false;
|
|
35
|
+
this.countdown.release();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
24
38
|
this.handleHold = () => {
|
|
25
39
|
this.countdown.hold();
|
|
26
40
|
};
|
|
@@ -34,8 +48,10 @@ let HelixHeadlessAnnouncement = class HelixHeadlessAnnouncement extends MixinDis
|
|
|
34
48
|
this.addEventListener('mouseleave', this.handleRelease);
|
|
35
49
|
this.addEventListener('focusin', this.handleHold);
|
|
36
50
|
this.addEventListener('focusout', this.handleRelease);
|
|
51
|
+
document.addEventListener('visibilitychange', this.handleVisibility);
|
|
37
52
|
if (this.hasUpdated) {
|
|
38
53
|
this.countdown.resume();
|
|
54
|
+
this.handleVisibility();
|
|
39
55
|
}
|
|
40
56
|
}
|
|
41
57
|
disconnectedCallback() {
|
|
@@ -44,10 +60,20 @@ let HelixHeadlessAnnouncement = class HelixHeadlessAnnouncement extends MixinDis
|
|
|
44
60
|
this.removeEventListener('mouseleave', this.handleRelease);
|
|
45
61
|
this.removeEventListener('focusin', this.handleHold);
|
|
46
62
|
this.removeEventListener('focusout', this.handleRelease);
|
|
63
|
+
document.removeEventListener('visibilitychange', this.handleVisibility);
|
|
64
|
+
this.heldHidden = false;
|
|
47
65
|
}
|
|
48
66
|
firstUpdated(changed) {
|
|
49
67
|
super.firstUpdated(changed);
|
|
50
68
|
this.countdown.start(this.duration);
|
|
69
|
+
this.handleVisibility();
|
|
70
|
+
if (this.querySelector(':scope > [slot="icon"]')) {
|
|
71
|
+
reportRuntime({
|
|
72
|
+
kind: 'deprecated',
|
|
73
|
+
message: `<${this.localName}>'s \`icon\` slot is deprecated: slot the glyph as \`dismiss-icon\`, the name Callout uses.`,
|
|
74
|
+
tag: this.localName,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
51
77
|
}
|
|
52
78
|
updated(changed) {
|
|
53
79
|
super.updated(changed);
|
|
@@ -57,11 +83,13 @@ let HelixHeadlessAnnouncement = class HelixHeadlessAnnouncement extends MixinDis
|
|
|
57
83
|
markRegion(this.renderRoot, 'actions', ['actions']);
|
|
58
84
|
}
|
|
59
85
|
renderDismissIcon() {
|
|
60
|
-
return html `<slot name="icon"
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
86
|
+
return html `<slot name="dismiss-icon"
|
|
87
|
+
><slot name="icon">
|
|
88
|
+
<svg part="dismiss-mark" viewBox=${x.viewBox} fill="currentColor" aria-hidden="true">
|
|
89
|
+
${unsafeSVG(x.content)}
|
|
90
|
+
</svg>
|
|
91
|
+
</slot></slot
|
|
92
|
+
>`;
|
|
65
93
|
}
|
|
66
94
|
render() {
|
|
67
95
|
return html `<div aria-hidden=${this.arrival.said === '' ? nothing : 'true'} part="content"
|
|
@@ -5,7 +5,10 @@ import '../../tooltip/index.js';
|
|
|
5
5
|
export interface AreaStack {
|
|
6
6
|
/** The table's columns that hold numbers, by their place among its cells. */
|
|
7
7
|
columns: number[];
|
|
8
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Each column's top edge at each reading: its running sum, or its own
|
|
10
|
+
* reading under `overlap`.
|
|
11
|
+
*/
|
|
9
12
|
layers: number[][];
|
|
10
13
|
/** Each column's heading. */
|
|
11
14
|
names: string[];
|
|
@@ -44,6 +47,11 @@ declare const HelixHeadlessAreaChart_base: typeof HelixElement & (new (...args:
|
|
|
44
47
|
* bands show each part's share. Use it to see which part grew. The default
|
|
45
48
|
* shows whether the total grew.
|
|
46
49
|
*
|
|
50
|
+
* `overlap` draws every band from zero, one in front of another, so each
|
|
51
|
+
* part's own amount is its height: the first column is in front. Use it to
|
|
52
|
+
* compare the parts with each other; the scale then fits the largest part
|
|
53
|
+
* rather than the total.
|
|
54
|
+
*
|
|
47
55
|
* The drawing is hidden from screen readers. The text summary gives the latest
|
|
48
56
|
* reading's total and each part's share of it, and the table beside the chart
|
|
49
57
|
* has every number.
|
|
@@ -121,6 +129,15 @@ export declare class HelixHeadlessAreaChart extends HelixHeadlessAreaChart_base
|
|
|
121
129
|
* a rule nobody sees.
|
|
122
130
|
*/
|
|
123
131
|
gridlines?: 'both' | 'category' | 'value';
|
|
132
|
+
/**
|
|
133
|
+
* Draws every band from zero, in front of the next, so a band's height is
|
|
134
|
+
* its own part's amount and not its place in a stack.
|
|
135
|
+
*
|
|
136
|
+
* Absent stacks the parts, so the top edge is the total. Set, the first
|
|
137
|
+
* column is in front and the scale fits the largest part. Reflected, because
|
|
138
|
+
* the styled tier lets the bands behind show through the ones in front.
|
|
139
|
+
*/
|
|
140
|
+
overlap: boolean;
|
|
124
141
|
/**
|
|
125
142
|
* Draws each reading as a hundred percent, so each band shows its share of
|
|
126
143
|
* the total.
|
|
@@ -23,6 +23,7 @@ const percentIn = (locale) => {
|
|
|
23
23
|
let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSource(HelixElement) {
|
|
24
24
|
constructor() {
|
|
25
25
|
super(...arguments);
|
|
26
|
+
this.overlap = false;
|
|
26
27
|
this.share = false;
|
|
27
28
|
this.totalLabel = 'Total';
|
|
28
29
|
this.warnedAboutNegatives = false;
|
|
@@ -57,7 +58,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
|
|
|
57
58
|
const layers = [];
|
|
58
59
|
let running = rows.map(() => 0);
|
|
59
60
|
for (const column of drawn) {
|
|
60
|
-
running = running.map((sum, index) => sum + (column[index] ?? 0));
|
|
61
|
+
running = this.overlap ? column : running.map((sum, index) => sum + (column[index] ?? 0));
|
|
61
62
|
layers.push(running);
|
|
62
63
|
}
|
|
63
64
|
return {
|
|
@@ -88,7 +89,11 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
|
|
|
88
89
|
if (rows.length === 0 || stack.columns.length === 0) {
|
|
89
90
|
return html `<div id=${CHART_PLOT} part="plot"></div>`;
|
|
90
91
|
}
|
|
91
|
-
const top = this.
|
|
92
|
+
const top = this.overlap
|
|
93
|
+
? Math.max(0, ...stack.layers.flat())
|
|
94
|
+
: this.share
|
|
95
|
+
? 1
|
|
96
|
+
: Math.max(0, ...stack.totals);
|
|
92
97
|
const domain = [0, top > 0 ? top : 1];
|
|
93
98
|
const y = linear(domain, [PLOT_HEIGHT, 0]);
|
|
94
99
|
const slot = PLOT_WIDTH / rows.length;
|
|
@@ -213,7 +218,7 @@ let HelixHeadlessAreaChart = class HelixHeadlessAreaChart extends MixinChartSour
|
|
|
213
218
|
return drawTooltip(rows, at, this.tag('tooltip'), {
|
|
214
219
|
placement: 'top',
|
|
215
220
|
x: `${at * slot + slot / 2}%`,
|
|
216
|
-
y: `${y(stack.layers.
|
|
221
|
+
y: `${y(Math.max(0, ...stack.layers.map((layer) => layer[at] ?? 0)))}%`,
|
|
217
222
|
}, (cell) => this.seriesOf(cell), this.pointer);
|
|
218
223
|
}
|
|
219
224
|
};
|
|
@@ -223,6 +228,9 @@ __decorate([
|
|
|
223
228
|
__decorate([
|
|
224
229
|
property()
|
|
225
230
|
], HelixHeadlessAreaChart.prototype, "gridlines", void 0);
|
|
231
|
+
__decorate([
|
|
232
|
+
property({ reflect: true, type: Boolean })
|
|
233
|
+
], HelixHeadlessAreaChart.prototype, "overlap", void 0);
|
|
226
234
|
__decorate([
|
|
227
235
|
property({ reflect: true, type: Boolean })
|
|
228
236
|
], HelixHeadlessAreaChart.prototype, "share", void 0);
|
|
@@ -15,7 +15,16 @@ export declare const initialsOf: (name: string) => string;
|
|
|
15
15
|
* a person's name does not describe what the avatar stands for.
|
|
16
16
|
*
|
|
17
17
|
* `load` and `error` are re-dispatched from the host, because they are not
|
|
18
|
-
* composed and would otherwise stop at the shadow boundary.
|
|
18
|
+
* composed and would otherwise stop at the shadow boundary. `status` says
|
|
19
|
+
* which of the two happened, for a listener that arrives after it, and the
|
|
20
|
+
* `loading`, `loaded` and `error` custom states say the same to a stylesheet.
|
|
21
|
+
*
|
|
22
|
+
* **On a server the avatar sends the picture's place**, an `<img>` that the
|
|
23
|
+
* browser fetches while it reads the page. The initials stand in only on the
|
|
24
|
+
* client: at once where the picture failed before the page hydrated, and after
|
|
25
|
+
* `fallback-delay` where it is still on its way. `load` or `error` for a
|
|
26
|
+
* picture that settled before hydration is sent a task after the avatar
|
|
27
|
+
* hydrates, so a page's own scripts are listening by then.
|
|
19
28
|
*
|
|
20
29
|
* @since 0.1.0
|
|
21
30
|
* @status stable
|
|
@@ -30,6 +39,10 @@ export declare const initialsOf: (name: string) => string;
|
|
|
30
39
|
*
|
|
31
40
|
* @csspart image - The image, when one is loading or loaded.
|
|
32
41
|
* @csspart initials - The initials shown when there is no usable image.
|
|
42
|
+
*
|
|
43
|
+
* @cssstate error - The picture failed, or there is none, and the initials show.
|
|
44
|
+
* @cssstate loaded - The picture arrived.
|
|
45
|
+
* @cssstate loading - The picture is on its way.
|
|
33
46
|
*/
|
|
34
47
|
export declare class HelixHeadlessAvatar extends HelixElement {
|
|
35
48
|
/**
|
|
@@ -43,6 +56,23 @@ export declare class HelixHeadlessAvatar extends HelixElement {
|
|
|
43
56
|
* same idea.
|
|
44
57
|
*/
|
|
45
58
|
fallbackDelay?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The letters shown where no picture loaded, such as `GH`, in place of the
|
|
61
|
+
* ones taken from `name`.
|
|
62
|
+
*
|
|
63
|
+
* For a name whose initials are not its first and last letters, or an
|
|
64
|
+
* entity with a short mark of its own. Absent, the first letters of the
|
|
65
|
+
* first and last words of `name` are shown.
|
|
66
|
+
*/
|
|
67
|
+
initials?: string;
|
|
68
|
+
/**
|
|
69
|
+
* When the browser fetches the picture: `lazy` waits until it is near the
|
|
70
|
+
* screen, as an `<img loading="lazy">` does, and `eager` fetches it at once.
|
|
71
|
+
*
|
|
72
|
+
* Absent is the browser's own default, which is `eager`. `lazy` suits a long
|
|
73
|
+
* list of people, most of them off screen.
|
|
74
|
+
*/
|
|
75
|
+
loading?: 'eager' | 'lazy';
|
|
46
76
|
/**
|
|
47
77
|
* Name of the person or entity.
|
|
48
78
|
*
|
|
@@ -45,6 +45,9 @@ let HelixHeadlessAvatar = class HelixHeadlessAvatar extends HelixElement {
|
|
|
45
45
|
label: this.name,
|
|
46
46
|
role: this.name === '' ? '' : 'img',
|
|
47
47
|
});
|
|
48
|
+
this.toggleState('error', this.status === 'error');
|
|
49
|
+
this.toggleState('loaded', this.status === 'loaded');
|
|
50
|
+
this.toggleState('loading', this.status === 'loading');
|
|
48
51
|
}
|
|
49
52
|
firstUpdated(changed) {
|
|
50
53
|
super.firstUpdated(changed);
|
|
@@ -91,6 +94,7 @@ let HelixHeadlessAvatar = class HelixHeadlessAvatar extends HelixElement {
|
|
|
91
94
|
part="image"
|
|
92
95
|
src=${this.src}
|
|
93
96
|
alt=""
|
|
97
|
+
loading=${this.loading ?? nothing}
|
|
94
98
|
?hidden=${standIn}
|
|
95
99
|
@error=${this.handleError}
|
|
96
100
|
@load=${this.handleLoad}
|
|
@@ -100,13 +104,19 @@ let HelixHeadlessAvatar = class HelixHeadlessAvatar extends HelixElement {
|
|
|
100
104
|
}
|
|
101
105
|
renderInitials() {
|
|
102
106
|
return html `<slot>
|
|
103
|
-
<span part="initials" aria-hidden="true">${initialsOf(this.name)}</span>
|
|
107
|
+
<span part="initials" aria-hidden="true">${this.initials ?? initialsOf(this.name)}</span>
|
|
104
108
|
</slot>`;
|
|
105
109
|
}
|
|
106
110
|
};
|
|
107
111
|
__decorate([
|
|
108
112
|
property({ attribute: 'fallback-delay', type: Number })
|
|
109
113
|
], HelixHeadlessAvatar.prototype, "fallbackDelay", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
property()
|
|
116
|
+
], HelixHeadlessAvatar.prototype, "initials", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
property()
|
|
119
|
+
], HelixHeadlessAvatar.prototype, "loading", void 0);
|
|
110
120
|
__decorate([
|
|
111
121
|
property()
|
|
112
122
|
], HelixHeadlessAvatar.prototype, "name", void 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HelixElement } from '@fusion.dev/helix-core';
|
|
2
|
-
import { type TemplateResult } from 'lit';
|
|
2
|
+
import { type PropertyValues, type TemplateResult } from 'lit';
|
|
3
3
|
/**
|
|
4
4
|
* @summary A count or a dot pinned to the corner of another element.
|
|
5
5
|
*
|
|
@@ -14,15 +14,20 @@ import { type TemplateResult } from 'lit';
|
|
|
14
14
|
* - Any other value shows the value. Above `max`, the indicator shows `{max}+`,
|
|
15
15
|
* so its width stays the same as the count grows.
|
|
16
16
|
*
|
|
17
|
+
* `format-options` writes a count with `Intl.NumberFormat`, in `locale`:
|
|
18
|
+
* `format-options='{"notation":"compact"}'` shows 1,200 as `1.2K`. Absent, the
|
|
19
|
+
* count is shown as it was given.
|
|
20
|
+
*
|
|
17
21
|
* A count is announced from its own text, and `label` replaces that with a
|
|
18
22
|
* fuller name, such as `4 unread`. A dot needs a `label`. Without one, the dot
|
|
19
23
|
* is a colored circle that screen readers do not announce.
|
|
20
24
|
*
|
|
21
|
-
* **A badge wrapped around a control
|
|
22
|
-
*
|
|
23
|
-
* so focusing
|
|
24
|
-
*
|
|
25
|
-
*
|
|
25
|
+
* **A badge wrapped around a control describes it.** The control is the first
|
|
26
|
+
* element in the badge that takes focus, and its description is the badge's
|
|
27
|
+
* words, so focusing `<helix-badge value="8" label="{count} unread"><button>Inbox
|
|
28
|
+
* </button></helix-badge>` announces "Inbox, button, 8 unread", current as the
|
|
29
|
+
* count changes. A control that already has a description keeps its own. The
|
|
30
|
+
* count is also a status of its own, read when it changes.
|
|
26
31
|
*
|
|
27
32
|
* **Put the badge inside the control to have its count read with the
|
|
28
33
|
* control's name**, as Web Awesome and Shoelace do: `<button>Inbox
|
|
@@ -39,8 +44,20 @@ import { type TemplateResult } from 'lit';
|
|
|
39
44
|
* @slot - The element being decorated.
|
|
40
45
|
*
|
|
41
46
|
* @csspart indicator - The count, or the dot when there is no value.
|
|
47
|
+
*
|
|
48
|
+
* @cssstate blank - The value is zero, so there is no mark.
|
|
49
|
+
* @cssstate capped - The count is past `max`, so the mark shows `{max}+`.
|
|
50
|
+
* @cssstate dot - There is no value, so the mark is a dot.
|
|
42
51
|
*/
|
|
43
52
|
export declare class HelixHeadlessBadge extends HelixElement {
|
|
53
|
+
/**
|
|
54
|
+
* `Intl.NumberFormat` options a count is written with, such as
|
|
55
|
+
* `{"notation":"compact"}` for `1.2K`, written as JSON in the attribute.
|
|
56
|
+
*
|
|
57
|
+
* Absent, a count is shown as it was given. Text that is not a number is
|
|
58
|
+
* shown as it is either way.
|
|
59
|
+
*/
|
|
60
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
44
61
|
/**
|
|
45
62
|
* The badge's name, read by screen readers.
|
|
46
63
|
*
|
|
@@ -49,6 +66,12 @@ export declare class HelixHeadlessBadge extends HelixElement {
|
|
|
49
66
|
* stays current as `value` changes, with no label of yours to keep in step.
|
|
50
67
|
*/
|
|
51
68
|
label: string;
|
|
69
|
+
/**
|
|
70
|
+
* The locale a count is written in under `format-options`, such as `de`.
|
|
71
|
+
*
|
|
72
|
+
* Absent uses the runtime's own.
|
|
73
|
+
*/
|
|
74
|
+
locale: string;
|
|
52
75
|
/**
|
|
53
76
|
* The largest number the badge shows.
|
|
54
77
|
*
|
|
@@ -75,8 +98,36 @@ export declare class HelixHeadlessBadge extends HelixElement {
|
|
|
75
98
|
private get given();
|
|
76
99
|
/** Whether the value counts nothing, in which case there is no mark. */
|
|
77
100
|
private get blank();
|
|
101
|
+
/** Whether the count is past `max`, which the mark shows as `{max}+`. */
|
|
102
|
+
private get capped();
|
|
78
103
|
/** What the indicator reads, once the cap has been applied. */
|
|
79
104
|
private get text();
|
|
105
|
+
/** What a reader hears for the mark, or nothing for a blank or unnamed one. */
|
|
106
|
+
private get words();
|
|
107
|
+
/** The control the badge describes, while it describes one. */
|
|
108
|
+
private described;
|
|
109
|
+
/**
|
|
110
|
+
* The first element the badge wraps that takes focus: one with a tab stop,
|
|
111
|
+
* or a component that hands its focus on.
|
|
112
|
+
*/
|
|
113
|
+
private wrapped;
|
|
114
|
+
protected firstUpdated(changed: PropertyValues): void;
|
|
115
|
+
/**
|
|
116
|
+
* Points the wrapped control's description at the badge, which carries its
|
|
117
|
+
* words as its own label, or takes the pointer back.
|
|
118
|
+
*
|
|
119
|
+
* **The badge itself and not the count**, because a reference from the
|
|
120
|
+
* control into the badge's shadow root is one the platform drops, and the
|
|
121
|
+
* badge is in the control's own tree. A control the page described is left
|
|
122
|
+
* alone.
|
|
123
|
+
*/
|
|
124
|
+
private describe;
|
|
125
|
+
private undescribe;
|
|
126
|
+
private readonly handleSlotchange;
|
|
127
|
+
disconnectedCallback(): void;
|
|
128
|
+
connectedCallback(): void;
|
|
129
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
130
|
+
protected updated(changed: PropertyValues): void;
|
|
80
131
|
protected render(): TemplateResult;
|
|
81
132
|
}
|
|
82
133
|
declare global {
|