@fusion.dev/helix-headless 0.143.0 → 0.145.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 +16990 -1383
- package/dist/accordion/item/accordion-item.d.ts +48 -12
- package/dist/accordion/item/accordion-item.js +26 -5
- package/dist/accordion/root/accordion-root.d.ts +6 -0
- package/dist/accordion/root/accordion-root.js +7 -1
- package/dist/announcement/root/announcement-root.d.ts +21 -1
- package/dist/announcement/root/announcement-root.js +36 -1
- package/dist/app-header/root/app-header-root.d.ts +7 -0
- package/dist/app-header/root/app-header-root.js +5 -1
- package/dist/app-header/sectioning.d.ts +7 -0
- package/dist/app-header/sectioning.js +26 -0
- package/dist/area-chart/root/area-chart-root.d.ts +12 -4
- package/dist/area-chart/root/area-chart-root.js +24 -7
- package/dist/avatar/root/avatar-root.d.ts +14 -0
- package/dist/avatar/root/avatar-root.js +23 -9
- package/dist/badge/root/badge-root.d.ts +11 -7
- package/dist/badge/root/badge-root.js +1 -1
- package/dist/bar-chart/root/bar-chart-root.d.ts +12 -3
- package/dist/bar-chart/root/bar-chart-root.js +17 -10
- package/dist/breadcrumbs/root/breadcrumbs-root.d.ts +32 -1
- package/dist/breadcrumbs/root/breadcrumbs-root.js +25 -2
- package/dist/button/root/button-root.d.ts +47 -1
- package/dist/button/root/button-root.js +38 -4
- package/dist/callout/root/callout-root.d.ts +18 -1
- package/dist/callout/root/callout-root.js +15 -4
- package/dist/canvas/root/canvas-root.d.ts +38 -3
- package/dist/canvas/root/canvas-root.js +121 -40
- 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 +90 -0
- package/dist/carousel/root/carousel-root.js +134 -12
- 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 +25 -9
- package/dist/chat/naming.d.ts +22 -0
- package/dist/chat/naming.js +12 -0
- package/dist/chat/relative-clock.d.ts +39 -0
- package/dist/chat/relative-clock.js +31 -0
- package/dist/chat/root/chat-root.d.ts +36 -0
- package/dist/chat/root/chat-root.js +24 -1
- package/dist/checkbox/root/checkbox-root.js +2 -0
- package/dist/checkbox-group/root/checkbox-group-root.d.ts +53 -3
- package/dist/checkbox-group/root/checkbox-group-root.js +71 -22
- 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 +38 -1
- package/dist/code-block/root/code-block-root.js +28 -7
- package/dist/color-input/root/color-input-root.d.ts +34 -1
- package/dist/color-input/root/color-input-root.js +23 -4
- 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 +81 -5
- package/dist/color-picker/root/color-picker-root.js +103 -10
- package/dist/combobox/root/combobox-root.d.ts +38 -3
- package/dist/combobox/root/combobox-root.js +64 -2
- package/dist/command/root/command-root.d.ts +30 -4
- package/dist/command/root/command-root.js +33 -3
- 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 +47 -1
- package/dist/copy-button/root/copy-button-root.js +44 -8
- package/dist/data-table/root/data-table-root.d.ts +150 -2
- package/dist/data-table/root/data-table-root.js +303 -29
- package/dist/data-table/tree.d.ts +40 -0
- package/dist/data-table/tree.js +55 -0
- package/dist/date-input/root/date-input-root.d.ts +73 -4
- package/dist/date-input/root/date-input-root.js +93 -43
- package/dist/date-picker/root/date-picker-root.d.ts +145 -1
- package/dist/date-picker/root/date-picker-root.js +239 -48
- 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.d.ts +9 -0
- package/dist/dialog/description.js +14 -0
- package/dist/dialog/root/dialog-root.d.ts +64 -1
- package/dist/dialog/root/dialog-root.js +49 -23
- package/dist/donut-chart/root/donut-chart-root.d.ts +25 -4
- package/dist/donut-chart/root/donut-chart-root.js +21 -6
- package/dist/drawer/root/drawer-root.d.ts +63 -2
- package/dist/drawer/root/drawer-root.js +95 -19
- 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 +11 -6
- package/dist/drilldown/item/drilldown-item.js +8 -5
- package/dist/drilldown/root/drilldown-root.d.ts +11 -0
- package/dist/drilldown/root/drilldown-root.js +8 -3
- package/dist/element-events.generated.js +61 -13
- package/dist/empty/root/empty-root.d.ts +1 -1
- package/dist/file-input/root/file-input-root.d.ts +47 -0
- package/dist/file-input/root/file-input-root.js +60 -22
- 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 +3 -0
- package/dist/filter-input/menu/filter-menu.js +8 -4
- package/dist/filter-input/root/filter-input-root.d.ts +38 -4
- package/dist/filter-input/root/filter-input-root.js +67 -3
- 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 +51 -0
- package/dist/format-date/root/format-date-root.js +58 -38
- package/dist/heatmap/root/heatmap-root.d.ts +23 -6
- package/dist/heatmap/root/heatmap-root.js +24 -13
- 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 +30 -4
- package/dist/icon/root/icon-root.js +41 -6
- 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/image/root/image-root.d.ts +14 -0
- package/dist/image/root/image-root.js +23 -2
- package/dist/input/root/input-root.d.ts +11 -0
- package/dist/input/root/input-root.js +16 -1
- package/dist/kbd/root/kbd-root.d.ts +20 -13
- package/dist/kbd/root/kbd-root.js +35 -37
- 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 +56 -0
- package/dist/legend/root/legend-root.js +54 -5
- package/dist/lightbox/item/lightbox-item.d.ts +15 -0
- package/dist/lightbox/item/lightbox-item.js +10 -1
- package/dist/lightbox/root/lightbox-root.d.ts +61 -1
- package/dist/lightbox/root/lightbox-root.js +94 -4
- package/dist/line-chart/root/line-chart-root.d.ts +11 -3
- package/dist/line-chart/root/line-chart-root.js +19 -5
- package/dist/list/item/list-item.d.ts +68 -1
- package/dist/list/item/list-item.js +66 -4
- package/dist/list/numbering.d.ts +14 -0
- package/dist/list/numbering.js +8 -0
- package/dist/list/root/list-root.d.ts +106 -9
- package/dist/list/root/list-root.js +189 -4
- package/dist/list/selection.d.ts +19 -0
- package/dist/list/selection.js +21 -0
- package/dist/listbox/root/listbox-root.d.ts +74 -3
- package/dist/listbox/root/listbox-root.js +86 -9
- 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 +6 -2
- package/dist/map/root/map-root.js +5 -2
- package/dist/megamenu/root/megamenu-root.d.ts +21 -0
- package/dist/megamenu/root/megamenu-root.js +16 -2
- package/dist/menu/index.d.ts +1 -0
- package/dist/menu/index.js +1 -0
- package/dist/menu/item/menu-item.d.ts +38 -11
- package/dist/menu/item/menu-item.js +33 -1
- package/dist/menu/root/menu-root.d.ts +25 -1
- package/dist/menu/root/menu-root.js +63 -6
- 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 +7 -0
- package/dist/meter/root/meter-root.js +6 -3
- package/dist/navigation/root/navigation-root.d.ts +16 -1
- package/dist/navigation/root/navigation-root.js +27 -1
- package/dist/notifications/feed-keys.d.ts +10 -0
- package/dist/notifications/feed-keys.js +14 -0
- package/dist/notifications/notification/notification.d.ts +17 -0
- package/dist/notifications/notification/notification.js +21 -2
- package/dist/notifications/root/notifications-root.d.ts +60 -0
- package/dist/notifications/root/notifications-root.js +76 -1
- package/dist/number-input/root/number-input-root.d.ts +47 -0
- package/dist/number-input/root/number-input-root.js +58 -22
- package/dist/object-inspector/root/object-inspector-root.d.ts +98 -16
- package/dist/object-inspector/root/object-inspector-root.js +180 -80
- package/dist/object-inspector/rows.d.ts +57 -0
- package/dist/object-inspector/rows.js +86 -0
- package/dist/option/root/option-root.d.ts +54 -5
- package/dist/option/root/option-root.js +34 -5
- package/dist/outline/levels.d.ts +31 -0
- package/dist/outline/levels.js +23 -0
- package/dist/outline/root/outline-root.d.ts +68 -3
- package/dist/outline/root/outline-root.js +73 -8
- package/dist/pagination/size/pagination-size.d.ts +11 -2
- package/dist/pagination/size/pagination-size.js +19 -4
- 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 +21 -0
- package/dist/pin-input/root/pin-input-root.js +29 -2
- package/dist/popover/root/popover-root.d.ts +62 -4
- package/dist/popover/root/popover-root.js +53 -5
- package/dist/progress/root/progress-root.d.ts +7 -0
- package/dist/progress/root/progress-root.js +9 -3
- 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 +26 -0
- package/dist/qr-code/root/qr-code-root.js +49 -2
- package/dist/radio/group/radio-group.d.ts +17 -0
- package/dist/radio/group/radio-group.js +14 -1
- package/dist/rating/root/rating-root.d.ts +25 -0
- package/dist/rating/root/rating-root.js +46 -4
- package/dist/scatter-chart/root/scatter-chart-root.d.ts +17 -3
- package/dist/scatter-chart/root/scatter-chart-root.js +25 -7
- package/dist/scroll-area/root/scroll-area-root.d.ts +113 -0
- package/dist/scroll-area/root/scroll-area-root.js +218 -3
- package/dist/scroll-area/scrollbar.d.ts +65 -0
- package/dist/scroll-area/scrollbar.js +24 -0
- package/dist/select/root/select-root.d.ts +24 -0
- package/dist/select/root/select-root.js +21 -7
- package/dist/skeleton/root/skeleton-root.d.ts +25 -0
- package/dist/skeleton/root/skeleton-root.js +17 -2
- package/dist/slider/root/slider-root.d.ts +39 -0
- package/dist/slider/root/slider-root.js +45 -9
- package/dist/splitter/root/splitter-root.d.ts +13 -0
- package/dist/splitter/root/splitter-root.js +20 -2
- package/dist/splitter/snap.d.ts +9 -0
- package/dist/splitter/snap.js +12 -0
- package/dist/stat/root/stat-root.d.ts +2 -0
- package/dist/stat/root/stat-root.js +1 -1
- package/dist/steps/reach.d.ts +15 -0
- package/dist/steps/reach.js +12 -0
- package/dist/steps/root/steps-root.d.ts +30 -0
- package/dist/steps/root/steps-root.js +53 -0
- package/dist/steps/step/step.d.ts +39 -2
- package/dist/steps/step/step.js +29 -7
- package/dist/switch/root/switch-root.d.ts +12 -2
- package/dist/switch/root/switch-root.js +6 -1
- package/dist/table/column/table-column.d.ts +11 -0
- package/dist/table/column/table-column.js +6 -1
- package/dist/table/root/table-root.d.ts +101 -0
- package/dist/table/root/table-root.js +166 -5
- 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 +9 -5
- package/dist/tabs/panel/tab-panel.js +3 -4
- package/dist/tabs/root/tabs-root.d.ts +25 -1
- package/dist/tabs/root/tabs-root.js +21 -3
- package/dist/tabs/tab/tab.d.ts +36 -4
- package/dist/tabs/tab/tab.js +46 -3
- 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 +60 -0
- package/dist/tag/root/tag-root.js +74 -18
- 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 +9 -0
- package/dist/textarea/root/textarea-root.js +9 -1
- package/dist/time-input/root/time-input-root.d.ts +44 -5
- package/dist/time-input/root/time-input-root.js +69 -39
- package/dist/time-picker/root/time-picker-root.d.ts +54 -8
- package/dist/time-picker/root/time-picker-root.js +121 -91
- 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/hotkey.d.ts +22 -0
- package/dist/toast/hotkey.js +23 -0
- package/dist/toast/item/toast-item.d.ts +26 -18
- package/dist/toast/item/toast-item.js +55 -48
- package/dist/toast/root/toast-root.d.ts +42 -8
- package/dist/toast/root/toast-root.js +64 -4
- package/dist/toggle/group/toggle-group.d.ts +57 -15
- package/dist/toggle/group/toggle-group.js +69 -9
- package/dist/toggle/root/toggle-root.d.ts +12 -1
- package/dist/toggle/root/toggle-root.js +11 -3
- package/dist/toolbar/root/toolbar-root.d.ts +13 -0
- package/dist/toolbar/root/toolbar-root.js +15 -5
- 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 +42 -17
- package/dist/tooltip/root/tooltip-root.js +50 -9
- package/dist/tour/naming.d.ts +30 -0
- package/dist/tour/naming.js +10 -0
- package/dist/tour/root/tour-root.d.ts +35 -0
- package/dist/tour/root/tour-root.js +56 -5
- package/dist/tour/stop/tour-stop.d.ts +53 -8
- package/dist/tour/stop/tour-stop.js +45 -15
- package/dist/tour/wait.d.ts +11 -0
- package/dist/tour/wait.js +19 -0
- package/dist/tree/item/tree-item.d.ts +54 -1
- package/dist/tree/item/tree-item.js +89 -20
- package/dist/tree/root/tree-root.d.ts +37 -0
- package/dist/tree/root/tree-root.js +51 -6
- package/dist/tree/selection.d.ts +24 -0
- package/dist/tree/selection.js +26 -0
- package/dist/trend/root/trend-root.d.ts +13 -0
- package/dist/trend/root/trend-root.js +14 -9
- package/dist/video/media-events.d.ts +49 -0
- package/dist/video/media-events.js +39 -0
- package/dist/video/root/video-root.d.ts +99 -13
- package/dist/video/root/video-root.js +84 -47
- package/dist/video-playlist/menu/video-playlist-menu.d.ts +3 -0
- package/dist/video-playlist/menu/video-playlist-menu.js +2 -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 +70 -2
- 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 +30 -0
- package/dist/virtual-list/fill.js +39 -0
- package/dist/virtual-list/keys.d.ts +15 -0
- package/dist/virtual-list/keys.js +24 -0
- package/dist/virtual-list/root/virtual-list-root.d.ts +155 -23
- package/dist/virtual-list/root/virtual-list-root.js +175 -34
- package/lint.json +1 -1
- package/package.json +5 -5
- package/types/jsx.d.ts +8871 -1286
- package/types/svelte.d.ts +3 -0
- package/types/vue.d.ts +1918 -269
|
@@ -4,9 +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 { AriaForwardController, CommandController, customElement, HelixElement, lockScroll, MixinControllerOpen, onUnlessFalse, unlockScroll, } from '@fusion.dev/helix-core';
|
|
7
|
+
import { AriaForwardController, CommandController, customElement, edgeOffset, HelixElement, headingsIn, isRtl, lockScroll, MixinControllerOpen, OpenPhaseController, onUnlessFalse, parseSnapPoints, reflectElements, SwipeController, settleSwipe, snapTravel, swipeAxis, swipeEdge, towardEdge, unlockScroll, } from '@fusion.dev/helix-core';
|
|
8
8
|
import { html, nothing } from 'lit';
|
|
9
9
|
import { property } from 'lit/decorators.js';
|
|
10
|
+
import { startsSwipe } from '../swipe-start.js';
|
|
10
11
|
let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(HelixElement) {
|
|
11
12
|
constructor() {
|
|
12
13
|
super(...arguments);
|
|
@@ -20,7 +21,36 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
20
21
|
this.label = '';
|
|
21
22
|
this.aria = new AriaForwardController(this, { target: () => this.panel });
|
|
22
23
|
this.modal = true;
|
|
24
|
+
this.snapPoints = '';
|
|
25
|
+
this.swipe = true;
|
|
23
26
|
this.returned = '';
|
|
27
|
+
this.phases = new OpenPhaseController(this, {
|
|
28
|
+
mark: {
|
|
29
|
+
entering: (on) => this.toggleState('entering', on),
|
|
30
|
+
exiting: (on) => this.toggleState('exiting', on),
|
|
31
|
+
},
|
|
32
|
+
open: () => this.open,
|
|
33
|
+
surface: () => this.panel,
|
|
34
|
+
});
|
|
35
|
+
this.rest = 0;
|
|
36
|
+
this.swipes = new SwipeController(this, {
|
|
37
|
+
axis: () => (this.open && this.swipe ? swipeAxis(this.edge) : undefined),
|
|
38
|
+
end: (dx, dy, vx, vy) => this.settle(dx, dy, vx, vy),
|
|
39
|
+
move: (dx, dy) => this.place(Math.max(0, this.rest + towardEdge(this.edge, dx, dy))),
|
|
40
|
+
start: (target, event) => startsSwipe(target, event.pointerType, swipeAxis(this.edge), this.partNamed('content')),
|
|
41
|
+
surface: () => this.panel,
|
|
42
|
+
});
|
|
43
|
+
this.handleKeydown = (event) => {
|
|
44
|
+
if (event.key !== 'Escape' ||
|
|
45
|
+
event.defaultPrevented ||
|
|
46
|
+
this.modal ||
|
|
47
|
+
!this.open ||
|
|
48
|
+
closedByKnown()) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
this.requestOpen(false);
|
|
53
|
+
};
|
|
24
54
|
this.handleCancel = (event) => {
|
|
25
55
|
event.preventDefault();
|
|
26
56
|
this.requestOpen(false);
|
|
@@ -57,25 +87,62 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
57
87
|
panel.returnValue = value;
|
|
58
88
|
}
|
|
59
89
|
}
|
|
60
|
-
get
|
|
61
|
-
return this.
|
|
90
|
+
get edge() {
|
|
91
|
+
return swipeEdge(this.placement ?? 'end', isRtl(this));
|
|
62
92
|
}
|
|
63
|
-
|
|
93
|
+
get extent() {
|
|
94
|
+
const box = this.panel?.getBoundingClientRect();
|
|
95
|
+
return (swipeAxis(this.edge) === 'x' ? box?.width : box?.height) ?? 0;
|
|
96
|
+
}
|
|
97
|
+
place(travel) {
|
|
64
98
|
const panel = this.panel;
|
|
65
|
-
if (!panel
|
|
99
|
+
if (!panel) {
|
|
66
100
|
return;
|
|
67
101
|
}
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
102
|
+
const { x, y } = edgeOffset(this.edge, travel);
|
|
103
|
+
const px = (value) => (value === 0 ? '' : `${Math.round(value)}px`);
|
|
104
|
+
panel.style.setProperty('--drawer-swipe-x', px(x));
|
|
105
|
+
panel.style.setProperty('--drawer-swipe-y', px(y));
|
|
106
|
+
}
|
|
107
|
+
settle(dx, dy, vx, vy) {
|
|
108
|
+
const edge = this.edge;
|
|
109
|
+
const size = this.extent;
|
|
110
|
+
const shown = settleSwipe({
|
|
111
|
+
points: parseSnapPoints(this.snapPoints),
|
|
112
|
+
size,
|
|
113
|
+
travel: Math.max(0, this.rest + towardEdge(edge, dx, dy)),
|
|
114
|
+
velocity: towardEdge(edge, vx, vy),
|
|
115
|
+
});
|
|
116
|
+
if (shown === 0 && this.requestOpen(false)) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (shown !== 0) {
|
|
120
|
+
this.rest = snapTravel(size, shown);
|
|
121
|
+
}
|
|
122
|
+
this.place(this.rest);
|
|
123
|
+
}
|
|
124
|
+
show() {
|
|
125
|
+
this.requestOpen(true);
|
|
126
|
+
}
|
|
127
|
+
close(returnValue) {
|
|
128
|
+
const previous = this.returnValue;
|
|
129
|
+
if (returnValue !== undefined) {
|
|
130
|
+
this.returnValue = returnValue;
|
|
73
131
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.namedByHeader = false;
|
|
132
|
+
if (!this.requestOpen(false) && returnValue !== undefined) {
|
|
133
|
+
this.returnValue = previous;
|
|
77
134
|
}
|
|
78
135
|
}
|
|
136
|
+
get panel() {
|
|
137
|
+
return this.partNamed('panel');
|
|
138
|
+
}
|
|
139
|
+
nameByHeader() {
|
|
140
|
+
const slot = this.renderRoot.querySelector('slot[name="header"]');
|
|
141
|
+
const heading = this.label || this.hasAttribute('aria-labelledby')
|
|
142
|
+
? []
|
|
143
|
+
: headingsIn(slot?.assignedElements({ flatten: true }) ?? []);
|
|
144
|
+
this.namedByHeader = reflectElements(this.panel, 'ariaLabelledByElements', heading, this.namedByHeader);
|
|
145
|
+
}
|
|
79
146
|
disconnectedCallback() {
|
|
80
147
|
super.disconnectedCallback();
|
|
81
148
|
unlockScroll(this);
|
|
@@ -83,6 +150,10 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
83
150
|
updated(changed) {
|
|
84
151
|
super.updated(changed);
|
|
85
152
|
this.nameByHeader();
|
|
153
|
+
if (changed.has('open') && !this.open) {
|
|
154
|
+
this.rest = 0;
|
|
155
|
+
this.place(0);
|
|
156
|
+
}
|
|
86
157
|
if (this.open && this.modal) {
|
|
87
158
|
lockScroll(this);
|
|
88
159
|
}
|
|
@@ -100,6 +171,8 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
100
171
|
else {
|
|
101
172
|
panel.show();
|
|
102
173
|
}
|
|
174
|
+
this.rest = snapTravel(this.extent, parseSnapPoints(this.snapPoints)[0] ?? 1);
|
|
175
|
+
this.place(this.rest);
|
|
103
176
|
}
|
|
104
177
|
else if (!this.open && panel.open) {
|
|
105
178
|
panel.close();
|
|
@@ -114,9 +187,11 @@ let HelixHeadlessDrawer = class HelixHeadlessDrawer extends MixinControllerOpen(
|
|
|
114
187
|
@cancel=${this.handleCancel}
|
|
115
188
|
@click=${this.handleBackdrop}
|
|
116
189
|
@close=${this.handleClose}
|
|
190
|
+
@keydown=${this.handleKeydown}
|
|
117
191
|
>
|
|
118
192
|
<div part="header"><slot name="header" @slotchange=${this.nameByHeader}></slot></div>
|
|
119
193
|
<div part="content"><slot></slot></div>
|
|
194
|
+
<div part="footer"><slot name="footer"></slot></div>
|
|
120
195
|
</dialog>`;
|
|
121
196
|
}
|
|
122
197
|
};
|
|
@@ -132,13 +207,14 @@ __decorate([
|
|
|
132
207
|
__decorate([
|
|
133
208
|
property({ reflect: true })
|
|
134
209
|
], HelixHeadlessDrawer.prototype, "placement", void 0);
|
|
210
|
+
__decorate([
|
|
211
|
+
property({ attribute: 'snap-points' })
|
|
212
|
+
], HelixHeadlessDrawer.prototype, "snapPoints", void 0);
|
|
213
|
+
__decorate([
|
|
214
|
+
property({ converter: onUnlessFalse })
|
|
215
|
+
], HelixHeadlessDrawer.prototype, "swipe", void 0);
|
|
135
216
|
HelixHeadlessDrawer = __decorate([
|
|
136
217
|
customElement('helix-headless-drawer')
|
|
137
218
|
], HelixHeadlessDrawer);
|
|
138
219
|
export { HelixHeadlessDrawer };
|
|
139
|
-
const
|
|
140
|
-
const assigned = slot?.assignedElements({ flatten: true }) ?? [];
|
|
141
|
-
const heading = 'h1, h2, h3, h4, h5, h6, [role="heading"]';
|
|
142
|
-
const found = assigned.flatMap((one) => one.matches(heading) ? [one] : [...one.querySelectorAll(heading)].slice(0, 1));
|
|
143
|
-
return found.length > 0 ? found.slice(0, 1) : assigned;
|
|
144
|
-
};
|
|
220
|
+
const closedByKnown = () => typeof HTMLDialogElement !== 'undefined' && 'closedBy' in HTMLDialogElement.prototype;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a press may start swiping a drawer away.
|
|
3
|
+
*
|
|
4
|
+
* Not a mouse, which drags to select text. Not a press on a field or on
|
|
5
|
+
* editable text, which drags to move its caret. And not a press inside a
|
|
6
|
+
* scroller that can scroll along the swipe, which drags to scroll, so a bottom
|
|
7
|
+
* sheet holding a long list scrolls the list.
|
|
8
|
+
*/
|
|
9
|
+
export declare const startsSwipe: (target: Element, pointerType: string, axis: 'x' | 'y', scroller: Element | null | undefined) => boolean;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const EDITABLE = 'input, select, textarea, [contenteditable]:not([contenteditable="false"])';
|
|
2
|
+
export const startsSwipe = (target, pointerType, axis, scroller) => {
|
|
3
|
+
if (pointerType === 'mouse' || target.closest(EDITABLE)) {
|
|
4
|
+
return false;
|
|
5
|
+
}
|
|
6
|
+
if (!scroller || !(scroller === target || scroller.contains(target))) {
|
|
7
|
+
return true;
|
|
8
|
+
}
|
|
9
|
+
return axis === 'x'
|
|
10
|
+
? scroller.scrollWidth <= scroller.clientWidth
|
|
11
|
+
: scroller.scrollHeight <= scroller.clientHeight;
|
|
12
|
+
};
|
|
@@ -29,6 +29,7 @@ import { nothing, type PropertyValues, type TemplateResult } from 'lit';
|
|
|
29
29
|
* @documentation https://fusion.dev/helix/components/drilldown
|
|
30
30
|
*
|
|
31
31
|
* @slot - The row's label.
|
|
32
|
+
* @slot chevron - Replaces the caret of a row that opens a page, such as with your own icon.
|
|
32
33
|
* @slot end - Content after the label, usually an icon or a count.
|
|
33
34
|
* @slot page - The rows of the page this row opens.
|
|
34
35
|
* @slot start - Content before the label, usually an icon.
|
|
@@ -65,15 +66,14 @@ export declare class HelixHeadlessDrilldownItem extends HelixElement {
|
|
|
65
66
|
*/
|
|
66
67
|
readonly isDrilldownItem = true;
|
|
67
68
|
/**
|
|
68
|
-
* Whether the page showing is the one this row is on.
|
|
69
|
-
*
|
|
70
|
-
*
|
|
69
|
+
* @internal Whether the page showing is the one this row is on. Written by
|
|
70
|
+
* the stack, and not a consumer's to set: a framework reading `onPage` as an
|
|
71
|
+
* event handler is why it is kept off the typings.
|
|
71
72
|
*/
|
|
72
73
|
onPage: boolean;
|
|
73
74
|
/**
|
|
74
|
-
* Whether this row's own page is the one showing.
|
|
75
|
-
*
|
|
76
|
-
* Written by the stack.
|
|
75
|
+
* @internal Whether this row's own page is the one showing. Written by the
|
|
76
|
+
* stack.
|
|
77
77
|
*/
|
|
78
78
|
showingPage: boolean;
|
|
79
79
|
/**
|
|
@@ -134,6 +134,11 @@ export declare class HelixHeadlessDrilldownItem extends HelixElement {
|
|
|
134
134
|
get selected(): boolean;
|
|
135
135
|
/** Fires `helix-select` for this row. */
|
|
136
136
|
select(): void;
|
|
137
|
+
/**
|
|
138
|
+
* The caret of a row that opens a page, as the `chevron` slot's fallback, so
|
|
139
|
+
* an icon of your own replaces it by being slotted.
|
|
140
|
+
*/
|
|
141
|
+
protected renderMark(): TemplateResult;
|
|
137
142
|
protected render(): TemplateResult | typeof nothing;
|
|
138
143
|
}
|
|
139
144
|
declare global {
|
|
@@ -50,6 +50,13 @@ let HelixHeadlessDrilldownItem = class HelixHeadlessDrilldownItem extends HelixE
|
|
|
50
50
|
}
|
|
51
51
|
this.dispatchEvent(new HelixSelectEvent({ value: this.value }));
|
|
52
52
|
}
|
|
53
|
+
renderMark() {
|
|
54
|
+
return html `<slot name="chevron"
|
|
55
|
+
><svg part="mark" data-mirror fill="currentColor" viewBox=${caretRight.viewBox} aria-hidden="true">
|
|
56
|
+
${unsafeSVG(caretRight.content)}
|
|
57
|
+
</svg></slot
|
|
58
|
+
>`;
|
|
59
|
+
}
|
|
53
60
|
render() {
|
|
54
61
|
if (this.showingPage) {
|
|
55
62
|
return html `<slot name="page" @slotchange=${this.readPage}></slot>`;
|
|
@@ -69,11 +76,7 @@ let HelixHeadlessDrilldownItem = class HelixHeadlessDrilldownItem extends HelixE
|
|
|
69
76
|
<slot name="start"></slot>
|
|
70
77
|
<span part="label"><slot></slot></span>
|
|
71
78
|
<slot name="end"></slot>
|
|
72
|
-
${this.page
|
|
73
|
-
? html `<svg part="mark" data-mirror fill="currentColor" viewBox=${caretRight.viewBox} aria-hidden="true">
|
|
74
|
-
${unsafeSVG(caretRight.content)}
|
|
75
|
-
</svg>`
|
|
76
|
-
: nothing}
|
|
79
|
+
${this.page ? this.renderMark() : nothing}
|
|
77
80
|
</button>
|
|
78
81
|
<div hidden><slot name="page" @slotchange=${this.readPage}></slot></div>`;
|
|
79
82
|
}
|
|
@@ -20,6 +20,11 @@ declare const HelixHeadlessDrilldown_base: (new (...args: any[]) => import("@fus
|
|
|
20
20
|
* and reads the rest from the DOM. The behavior lives in `DrilldownController`,
|
|
21
21
|
* which `Menu` shares.
|
|
22
22
|
*
|
|
23
|
+
* After each move the host carries `data-direction`, `forward` into a page or
|
|
24
|
+
* `back` out of one, so a stylesheet can slide the new page in from the side
|
|
25
|
+
* the reader is going. The styled tier does, and holds still under reduced
|
|
26
|
+
* motion.
|
|
27
|
+
*
|
|
23
28
|
* The rows of the page showing are a `menu`, named by `label` on the top page
|
|
24
29
|
* and by the page's title below it. The back button and the title sit above
|
|
25
30
|
* the menu. Disabled rows stay reachable with the arrow keys, and typing a
|
|
@@ -32,6 +37,7 @@ declare const HelixHeadlessDrilldown_base: (new (...args: any[]) => import("@fus
|
|
|
32
37
|
* @documentation https://fusion.dev/helix/components/drilldown
|
|
33
38
|
*
|
|
34
39
|
* @slot - The rows of the top page.
|
|
40
|
+
* @slot back-icon - Replaces the icon on the back button.
|
|
35
41
|
*
|
|
36
42
|
* @event {HelixSelectEvent} helix-select - Fired when a row with no page is chosen. Cancelable: canceling it stops the change and leaves the decision to you.
|
|
37
43
|
*
|
|
@@ -135,6 +141,11 @@ export declare class HelixHeadlessDrilldown extends HelixHeadlessDrilldown_base
|
|
|
135
141
|
protected updated(changed: PropertyValues): void;
|
|
136
142
|
/** Walks the tree marking which rows are on the page showing. */
|
|
137
143
|
private mark;
|
|
144
|
+
/**
|
|
145
|
+
* The back button's icon, as the `back-icon` slot's fallback, so an icon of
|
|
146
|
+
* your own replaces it by being slotted.
|
|
147
|
+
*/
|
|
148
|
+
protected renderBackIcon(): TemplateResult;
|
|
138
149
|
protected render(): TemplateResult;
|
|
139
150
|
}
|
|
140
151
|
declare global {
|
|
@@ -150,14 +150,19 @@ let HelixHeadlessDrilldown = class HelixHeadlessDrilldown extends MixinCollectio
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
+
renderBackIcon() {
|
|
154
|
+
return html `<slot name="back-icon"
|
|
155
|
+
><svg part="back-mark" data-mirror fill="currentColor" viewBox=${caretLeft.viewBox} aria-hidden="true">
|
|
156
|
+
${unsafeSVG(caretLeft.content)}
|
|
157
|
+
</svg></slot
|
|
158
|
+
>`;
|
|
159
|
+
}
|
|
153
160
|
render() {
|
|
154
161
|
return html `${this.drilldown.atRoot
|
|
155
162
|
? ''
|
|
156
163
|
: html `<div part="header">
|
|
157
164
|
<button part="back" type="button" aria-label=${this.backLabel} @click=${() => this.back()}>
|
|
158
|
-
|
|
159
|
-
${unsafeSVG(caretLeft.content)}
|
|
160
|
-
</svg>
|
|
165
|
+
${this.renderBackIcon()}
|
|
161
166
|
</button>
|
|
162
167
|
<span id="title" part="title">${this.drilldown.label}</span>
|
|
163
168
|
</div>`}
|
|
@@ -4,6 +4,7 @@ registerElementEvents({
|
|
|
4
4
|
'helix-headless-announcement': ['helix-dismiss'],
|
|
5
5
|
'helix-headless-app-header': ['helix-scrolled'],
|
|
6
6
|
'helix-headless-avatar': ['error', 'load'],
|
|
7
|
+
'helix-headless-callout': ['helix-dismiss'],
|
|
7
8
|
'helix-headless-canvas': [
|
|
8
9
|
'helix-before-move',
|
|
9
10
|
'helix-before-reconnect',
|
|
@@ -21,7 +22,7 @@ registerElementEvents({
|
|
|
21
22
|
],
|
|
22
23
|
'helix-headless-carousel': ['helix-activate', 'helix-select'],
|
|
23
24
|
'helix-headless-chat': ['helix-before-pin', 'helix-history', 'helix-pin', 'helix-send'],
|
|
24
|
-
'helix-headless-chat-composer': ['helix-send', 'input'],
|
|
25
|
+
'helix-headless-chat-composer': ['helix-send', 'helix-typing', 'input'],
|
|
25
26
|
'helix-headless-chat-message': ['helix-send'],
|
|
26
27
|
'helix-headless-checkbox': ['change', 'helix-before-toggle', 'input'],
|
|
27
28
|
'helix-headless-checkbox-group': ['change', 'helix-before-change', 'input'],
|
|
@@ -58,11 +59,13 @@ registerElementEvents({
|
|
|
58
59
|
'helix-select',
|
|
59
60
|
'toggle',
|
|
60
61
|
],
|
|
61
|
-
'helix-headless-copy-button': ['helix-copy'],
|
|
62
|
+
'helix-headless-copy-button': ['helix-copy', 'helix-copy-error'],
|
|
62
63
|
'helix-headless-data-table': [
|
|
63
64
|
'helix-activate',
|
|
65
|
+
'helix-expand',
|
|
64
66
|
'helix-filter',
|
|
65
67
|
'helix-filtered',
|
|
68
|
+
'helix-load-more',
|
|
66
69
|
'helix-navigate',
|
|
67
70
|
'helix-reorder',
|
|
68
71
|
'helix-reordered',
|
|
@@ -84,7 +87,7 @@ registerElementEvents({
|
|
|
84
87
|
'helix-headless-drawer': ['close', 'helix-before-close', 'helix-before-open', 'toggle'],
|
|
85
88
|
'helix-headless-drilldown': ['helix-select'],
|
|
86
89
|
'helix-headless-drilldown-item': ['helix-select'],
|
|
87
|
-
'helix-headless-file-input': ['change', 'helix-before-change', 'input'],
|
|
90
|
+
'helix-headless-file-input': ['change', 'helix-before-change', 'helix-reject', 'input'],
|
|
88
91
|
'helix-headless-filter-chip': ['helix-dismiss'],
|
|
89
92
|
'helix-headless-filter-input': [
|
|
90
93
|
'change',
|
|
@@ -110,10 +113,11 @@ registerElementEvents({
|
|
|
110
113
|
'helix-graph-zoom',
|
|
111
114
|
],
|
|
112
115
|
'helix-headless-heatmap': ['helix-resize'],
|
|
113
|
-
'helix-headless-icon': ['error'],
|
|
116
|
+
'helix-headless-icon': ['error', 'load'],
|
|
114
117
|
'helix-headless-image': ['error', 'load'],
|
|
115
|
-
'helix-headless-input': ['change', 'helix-before-change', 'input'],
|
|
118
|
+
'helix-headless-input': ['change', 'helix-before-change', 'helix-clear', 'input'],
|
|
116
119
|
'helix-headless-kbd': ['helix-shortcut'],
|
|
120
|
+
'helix-headless-legend': ['change', 'helix-before-change'],
|
|
117
121
|
'helix-headless-lightbox': [
|
|
118
122
|
'close',
|
|
119
123
|
'helix-activate',
|
|
@@ -122,6 +126,8 @@ registerElementEvents({
|
|
|
122
126
|
'helix-before-open',
|
|
123
127
|
'toggle',
|
|
124
128
|
],
|
|
129
|
+
'helix-headless-list': ['change', 'helix-action', 'helix-before-change'],
|
|
130
|
+
'helix-headless-list-item': ['helix-action'],
|
|
125
131
|
'helix-headless-listbox': ['change', 'helix-before-change', 'helix-filter', 'input'],
|
|
126
132
|
'helix-headless-map': [
|
|
127
133
|
'change',
|
|
@@ -135,6 +141,7 @@ registerElementEvents({
|
|
|
135
141
|
'helix-map-rotate',
|
|
136
142
|
'helix-map-tilt',
|
|
137
143
|
'helix-map-zoom',
|
|
144
|
+
'helix-toggle',
|
|
138
145
|
],
|
|
139
146
|
'helix-headless-map-area': ['helix-map-part-change'],
|
|
140
147
|
'helix-headless-map-buildings': ['helix-map-part-change'],
|
|
@@ -151,9 +158,15 @@ registerElementEvents({
|
|
|
151
158
|
'helix-headless-menu-item': ['helix-before-toggle', 'helix-select'],
|
|
152
159
|
'helix-headless-notification': ['helix-dismiss', 'helix-read'],
|
|
153
160
|
'helix-headless-notification-group': ['helix-before-close', 'helix-before-open', 'toggle'],
|
|
154
|
-
'helix-headless-notifications': ['helix-dismiss', 'helix-read'],
|
|
161
|
+
'helix-headless-notifications': ['helix-dismiss', 'helix-load-more', 'helix-read'],
|
|
155
162
|
'helix-headless-number-input': ['change', 'helix-before-change', 'input'],
|
|
156
|
-
'helix-headless-object-inspector': [
|
|
163
|
+
'helix-headless-object-inspector': [
|
|
164
|
+
'helix-activate',
|
|
165
|
+
'helix-before-activate',
|
|
166
|
+
'helix-copy',
|
|
167
|
+
'helix-filter',
|
|
168
|
+
'helix-filtered',
|
|
169
|
+
],
|
|
157
170
|
'helix-headless-option': ['helix-select'],
|
|
158
171
|
'helix-headless-outline': ['helix-activate'],
|
|
159
172
|
'helix-headless-pagination': ['helix-activate', 'helix-navigate'],
|
|
@@ -163,7 +176,8 @@ registerElementEvents({
|
|
|
163
176
|
'helix-headless-qr-code': ['error'],
|
|
164
177
|
'helix-headless-radio': ['helix-select'],
|
|
165
178
|
'helix-headless-radio-group': ['change', 'helix-before-change', 'helix-select', 'input'],
|
|
166
|
-
'helix-headless-rating': ['change', 'helix-before-change', 'input'],
|
|
179
|
+
'helix-headless-rating': ['change', 'helix-before-change', 'helix-clear', 'input'],
|
|
180
|
+
'helix-headless-scroll-area': ['scroll', 'scrollend'],
|
|
167
181
|
'helix-headless-select': [
|
|
168
182
|
'change',
|
|
169
183
|
'helix-before-change',
|
|
@@ -191,10 +205,11 @@ registerElementEvents({
|
|
|
191
205
|
'helix-headless-steps': ['helix-activate', 'helix-before-activate', 'helix-select'],
|
|
192
206
|
'helix-headless-switch': ['change', 'helix-before-toggle', 'input'],
|
|
193
207
|
'helix-headless-tab': ['helix-select'],
|
|
194
|
-
'helix-headless-table': ['helix-sort'],
|
|
195
|
-
'helix-headless-table-column': ['helix-before-resize'],
|
|
208
|
+
'helix-headless-table': ['helix-select', 'helix-selected', 'helix-sort', 'helix-sorted'],
|
|
209
|
+
'helix-headless-table-column': ['helix-before-resize', 'helix-resized'],
|
|
196
210
|
'helix-headless-tabs': ['helix-activate', 'helix-before-activate', 'helix-select'],
|
|
197
211
|
'helix-headless-tag': ['helix-dismiss'],
|
|
212
|
+
'helix-headless-tag-group': ['change', 'helix-before-change', 'helix-dismiss'],
|
|
198
213
|
'helix-headless-textarea': ['change', 'helix-before-change', 'input'],
|
|
199
214
|
'helix-headless-time-input': [
|
|
200
215
|
'change',
|
|
@@ -221,9 +236,42 @@ registerElementEvents({
|
|
|
221
236
|
],
|
|
222
237
|
'helix-headless-tour-stop': ['helix-tour-ask'],
|
|
223
238
|
'helix-headless-tree': ['helix-activate', 'helix-before-activate', 'helix-select'],
|
|
224
|
-
'helix-headless-tree-item': [
|
|
225
|
-
|
|
226
|
-
|
|
239
|
+
'helix-headless-tree-item': [
|
|
240
|
+
'helix-before-close',
|
|
241
|
+
'helix-before-open',
|
|
242
|
+
'helix-load',
|
|
243
|
+
'helix-select',
|
|
244
|
+
'toggle',
|
|
245
|
+
],
|
|
246
|
+
'helix-headless-video': [
|
|
247
|
+
'abort',
|
|
248
|
+
'canplay',
|
|
249
|
+
'canplaythrough',
|
|
250
|
+
'durationchange',
|
|
251
|
+
'emptied',
|
|
252
|
+
'ended',
|
|
253
|
+
'error',
|
|
254
|
+
'helix-next',
|
|
255
|
+
'helix-previous',
|
|
256
|
+
'loadeddata',
|
|
257
|
+
'loadedmetadata',
|
|
258
|
+
'loadstart',
|
|
259
|
+
'pause',
|
|
260
|
+
'play',
|
|
261
|
+
'playing',
|
|
262
|
+
'progress',
|
|
263
|
+
'ratechange',
|
|
264
|
+
'resize',
|
|
265
|
+
'seeked',
|
|
266
|
+
'seeking',
|
|
267
|
+
'stalled',
|
|
268
|
+
'suspend',
|
|
269
|
+
'timeupdate',
|
|
270
|
+
'volumechange',
|
|
271
|
+
'waiting',
|
|
272
|
+
],
|
|
273
|
+
'helix-headless-video-playlist': ['helix-activate', 'helix-before-activate', 'helix-end'],
|
|
227
274
|
'helix-headless-video-playlist-item': ['helix-select'],
|
|
228
275
|
'helix-headless-video-playlist-menu': ['helix-select'],
|
|
276
|
+
'helix-headless-virtual-list': ['helix-load-more', 'helix-range-change'],
|
|
229
277
|
});
|
|
@@ -25,7 +25,7 @@ import { type TemplateResult } from 'lit';
|
|
|
25
25
|
*
|
|
26
26
|
* @slot - The message: why the region is empty, and what to do about it.
|
|
27
27
|
* @slot actions - The action that would put something in the region.
|
|
28
|
-
* @slot heading - The heading, which names what is missing.
|
|
28
|
+
* @slot heading - The heading, which names what is missing. Slot a heading element, such as an `<h3>`, so a reader can find it in the page's outline.
|
|
29
29
|
* @slot icon - An icon above the heading.
|
|
30
30
|
*
|
|
31
31
|
* @csspart live - A copy of the heading and the message, in a live region that screen readers announce when the view appears. Visually hidden in the styled tier.
|
|
@@ -16,6 +16,12 @@ declare const HelixHeadlessFileInput_base: (new (...args: any[]) => import("@fus
|
|
|
16
16
|
* visible trigger is a `<label for>`. The label is not focusable. The input is,
|
|
17
17
|
* and Enter and Space on it open the picker.
|
|
18
18
|
*
|
|
19
|
+
* Files arrive from the picker, a drop, or a paste onto the field, and each one
|
|
20
|
+
* is screened: `accept`, `max-file-size`, `max-files` and your own `validate`
|
|
21
|
+
* can refuse it. A refused file is left out, `helix-reject` lists each one with
|
|
22
|
+
* its reason, and a reader hears `rejected-text` with the names filled in.
|
|
23
|
+
* `directory` asks the picker for a folder.
|
|
24
|
+
*
|
|
19
25
|
* @since 0.1.0
|
|
20
26
|
* @status stable
|
|
21
27
|
* @category forms
|
|
@@ -29,6 +35,7 @@ declare const HelixHeadlessFileInput_base: (new (...args: any[]) => import("@fus
|
|
|
29
35
|
*
|
|
30
36
|
* @event {Event} change - Fired after the value changes.
|
|
31
37
|
* @event {HelixBeforeChangeEvent} helix-before-change - Fired before the chosen files change, with their names, and cancelable. Canceling it keeps the files the field had, even when the browser has already written a new pick.
|
|
38
|
+
* @event {HelixRejectEvent} helix-reject - Fired when files arrive and some are left out. `detail.files` lists each with its `reason`: `type`, `size`, `count` or `invalid`, and your `validate` message.
|
|
32
39
|
* @event {Event} input - Fired after the value changes.
|
|
33
40
|
*
|
|
34
41
|
* @csspart control - The file input itself, which carries the label and validity.
|
|
@@ -38,19 +45,24 @@ declare const HelixHeadlessFileInput_base: (new (...args: any[]) => import("@fus
|
|
|
38
45
|
* @csspart file - One chosen file.
|
|
39
46
|
* @csspart hint - Help under the field, while nothing is wrong.
|
|
40
47
|
* @csspart kind - A file's type.
|
|
48
|
+
* @csspart kind-cell - The grid cell around the tag, rendered only when the tag sits in a `Tag.Group`.
|
|
41
49
|
* @csspart kind-dismiss - The remove button, when `dismissible`.
|
|
42
50
|
* @csspart kind-dismiss-mark - The glyph on the dismiss control, where none is slotted.
|
|
43
51
|
* @csspart kind-label - The label, trimmed to its capitals and baseline.
|
|
52
|
+
* @csspart kind-link - The link around the label, when the tag has an `href`.
|
|
44
53
|
* @csspart kind-start - The category before the label.
|
|
45
54
|
* @csspart label - The label above the field.
|
|
46
55
|
* @csspart list - The chosen files.
|
|
56
|
+
* @csspart live - The live region that says `rejected-text` when files are refused. It is rendered from the first refusal.
|
|
47
57
|
* @csspart meta - The row that holds a file's size and type.
|
|
48
58
|
* @csspart name - A file's name.
|
|
49
59
|
* @csspart remove - The control that removes a file.
|
|
50
60
|
* @csspart size - A file's size.
|
|
61
|
+
* @csspart size-cell - The grid cell around the tag, rendered only when the tag sits in a `Tag.Group`.
|
|
51
62
|
* @csspart size-dismiss - The remove button, when `dismissible`.
|
|
52
63
|
* @csspart size-dismiss-mark - The glyph on the dismiss control, where none is slotted.
|
|
53
64
|
* @csspart size-label - The label, trimmed to its capitals and baseline.
|
|
65
|
+
* @csspart size-link - The link around the label, when the tag has an `href`.
|
|
54
66
|
* @csspart size-start - The category before the label.
|
|
55
67
|
* @csspart trigger - The label that opens the picker.
|
|
56
68
|
*
|
|
@@ -69,16 +81,35 @@ export declare class HelixHeadlessFileInput extends HelixHeadlessFileInput_base
|
|
|
69
81
|
* Which camera or microphone a mobile picker should offer, if any.
|
|
70
82
|
*/
|
|
71
83
|
capture?: 'environment' | 'user';
|
|
84
|
+
/**
|
|
85
|
+
* Whether the picker chooses a folder, and the field takes every file in
|
|
86
|
+
* it. The platform's `webkitdirectory`.
|
|
87
|
+
*/
|
|
88
|
+
directory: boolean;
|
|
72
89
|
/**
|
|
73
90
|
* Language tag the sizes are written in.
|
|
74
91
|
*
|
|
75
92
|
* Absent uses the runtime's own.
|
|
76
93
|
*/
|
|
77
94
|
locale: string;
|
|
95
|
+
/**
|
|
96
|
+
* The most files the field holds, under `multiple`. Files past it are
|
|
97
|
+
* refused.
|
|
98
|
+
*/
|
|
99
|
+
maxFiles?: number;
|
|
100
|
+
/**
|
|
101
|
+
* The most bytes one file may have. A larger one is refused.
|
|
102
|
+
*/
|
|
103
|
+
maxFileSize?: number;
|
|
78
104
|
/**
|
|
79
105
|
* Whether more than one file can be chosen.
|
|
80
106
|
*/
|
|
81
107
|
multiple: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* What a reader hears when files are refused, with `{count}` and `{names}`
|
|
110
|
+
* filled in.
|
|
111
|
+
*/
|
|
112
|
+
rejectedText: string;
|
|
82
113
|
/**
|
|
83
114
|
* The accessible name of the control that removes a file. `{name}` is
|
|
84
115
|
* replaced with the file's name.
|
|
@@ -92,6 +123,22 @@ export declare class HelixHeadlessFileInput extends HelixHeadlessFileInput_base
|
|
|
92
123
|
* The trigger's text when nothing is slotted into it.
|
|
93
124
|
*/
|
|
94
125
|
triggerLabel: string;
|
|
126
|
+
/**
|
|
127
|
+
* Your own check on each arriving file, which returns why it is refused, or
|
|
128
|
+
* nothing to take it. A property, since a function cannot be an attribute.
|
|
129
|
+
*/
|
|
130
|
+
validate?: (file: File) => string | null | undefined;
|
|
131
|
+
/** The live region, rendered from the first refusal. */
|
|
132
|
+
private readonly status;
|
|
133
|
+
/**
|
|
134
|
+
* Screens arriving files and commits what is taken, after the files the
|
|
135
|
+
* field keeps. Refused files are announced and said.
|
|
136
|
+
*/
|
|
137
|
+
private take;
|
|
138
|
+
/** Sends `helix-reject` and says which files were left out. */
|
|
139
|
+
private refuse;
|
|
140
|
+
/** Takes files pasted onto the field, as a drop takes them. */
|
|
141
|
+
private readonly handlePaste;
|
|
95
142
|
/**
|
|
96
143
|
* Whether something is being dragged over the field.
|
|
97
144
|
*
|