@voidable/ui 0.6.0 → 0.8.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/README.md +168 -9
- package/dist/angular/index.d.ts +20 -0
- package/dist/angular/index.js +78 -0
- package/dist/autoloader-core.d.ts +45 -0
- package/dist/autoloader-table.generated.d.ts +5 -0
- package/dist/autoloader.d.ts +13 -0
- package/dist/autoloader.js +229 -0
- package/dist/base.d.ts +173 -2
- package/dist/base.js +2 -9
- package/dist/chunks/base-CMruMbxC.js +824 -0
- package/dist/chunks/{decorate-DKuCkHK4.js → decorate-CaYbmmmm.js} +1 -1
- package/dist/chunks/disclosure-Bj_49GcC.js +23 -0
- package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
- package/dist/chunks/form-control-C0vH6gii.js +300 -0
- package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
- package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
- package/dist/chunks/modal-D_YVy2vg.js +71 -0
- package/dist/chunks/overlay-BywGMcDW.js +467 -0
- package/dist/chunks/parts-D30c8OoG.js +229 -0
- package/dist/chunks/{shape-DmgCwYvY.js → shape-C_LW7EjG.js} +12 -4
- package/dist/components/accordion.d.ts +38 -10
- package/dist/components/accordion.js +52 -54
- package/dist/components/action-input.d.ts +64 -6
- package/dist/components/action-input.js +85 -42
- package/dist/components/alert.d.ts +24 -10
- package/dist/components/alert.js +27 -28
- package/dist/components/avatar.d.ts +8 -2
- package/dist/components/avatar.js +4 -4
- package/dist/components/badge.d.ts +8 -3
- package/dist/components/badge.js +3 -3
- package/dist/components/banner.d.ts +21 -10
- package/dist/components/banner.js +28 -28
- package/dist/components/bar-chart.d.ts +30 -6
- package/dist/components/bar-chart.js +29 -39
- package/dist/components/breadcrumbs.d.ts +19 -6
- package/dist/components/breadcrumbs.js +17 -23
- package/dist/components/button.d.ts +64 -10
- package/dist/components/button.js +71 -27
- package/dist/components/calendar.d.ts +65 -10
- package/dist/components/calendar.js +158 -107
- package/dist/components/card.d.ts +14 -9
- package/dist/components/card.js +9 -23
- package/dist/components/carousel.d.ts +65 -14
- package/dist/components/carousel.js +85 -94
- package/dist/components/charts/scale.d.ts +0 -1
- package/dist/components/charts/shape.d.ts +0 -1
- package/dist/components/checkbox-group.d.ts +38 -5
- package/dist/components/checkbox-group.js +61 -20
- package/dist/components/checkbox.d.ts +53 -7
- package/dist/components/checkbox.js +66 -29
- package/dist/components/collapsible.d.ts +29 -9
- package/dist/components/collapsible.js +43 -45
- package/dist/components/color-picker.d.ts +20 -4
- package/dist/components/color-picker.js +36 -30
- package/dist/components/combobox.d.ts +84 -10
- package/dist/components/combobox.js +142 -45
- package/dist/components/compose-input.d.ts +8 -1
- package/dist/components/compose-input.js +10 -4
- package/dist/components/dialog.d.ts +24 -20
- package/dist/components/dialog.js +8 -57
- package/dist/components/divider.d.ts +8 -1
- package/dist/components/divider.js +4 -4
- package/dist/components/donut-chart.d.ts +28 -5
- package/dist/components/donut-chart.js +55 -54
- package/dist/components/drawer.d.ts +19 -18
- package/dist/components/drawer.js +9 -53
- package/dist/components/dropdown-menu.d.ts +62 -7
- package/dist/components/dropdown-menu.js +125 -34
- package/dist/components/editable.d.ts +37 -3
- package/dist/components/editable.js +45 -24
- package/dist/components/error-fallback.d.ts +36 -5
- package/dist/components/error-fallback.js +74 -24
- package/dist/components/field.d.ts +38 -4
- package/dist/components/field.js +63 -21
- package/dist/components/file-upload.d.ts +23 -2
- package/dist/components/file-upload.js +48 -25
- package/dist/components/gauge.d.ts +48 -9
- package/dist/components/gauge.js +57 -55
- package/dist/components/hamburger.d.ts +19 -4
- package/dist/components/hamburger.js +29 -20
- package/dist/components/hover-card.d.ts +40 -14
- package/dist/components/hover-card.js +77 -60
- package/dist/components/indicator.d.ts +18 -7
- package/dist/components/indicator.js +17 -19
- package/dist/components/input.d.ts +70 -5
- package/dist/components/input.js +84 -21
- package/dist/components/line-chart.d.ts +27 -5
- package/dist/components/line-chart.js +19 -21
- package/dist/components/list.d.ts +10 -1
- package/dist/components/list.js +4 -4
- package/dist/components/menu.d.ts +67 -21
- package/dist/components/menu.js +117 -116
- package/dist/components/multiselect.d.ts +108 -13
- package/dist/components/multiselect.js +207 -70
- package/dist/components/nav-bar.d.ts +12 -7
- package/dist/components/nav-bar.js +12 -22
- package/dist/components/nav-menu.d.ts +52 -12
- package/dist/components/nav-menu.js +69 -71
- package/dist/components/number-input.d.ts +76 -8
- package/dist/components/number-input.js +117 -51
- package/dist/components/pagination.d.ts +19 -1
- package/dist/components/pagination.js +69 -8
- package/dist/components/panel.d.ts +16 -8
- package/dist/components/panel.js +21 -21
- package/dist/components/pin-input.d.ts +41 -4
- package/dist/components/pin-input.js +45 -27
- package/dist/components/popover.d.ts +29 -11
- package/dist/components/popover.js +48 -36
- package/dist/components/progress.d.ts +7 -3
- package/dist/components/progress.js +4 -4
- package/dist/components/radio-group.d.ts +30 -5
- package/dist/components/radio-group.js +56 -19
- package/dist/components/radio.d.ts +47 -7
- package/dist/components/radio.js +68 -29
- package/dist/components/scroll-area.d.ts +8 -5
- package/dist/components/scroll-area.js +19 -20
- package/dist/components/segmented-control.d.ts +52 -8
- package/dist/components/segmented-control.js +67 -37
- package/dist/components/select.d.ts +59 -12
- package/dist/components/select.js +97 -47
- package/dist/components/sidebar.d.ts +22 -3
- package/dist/components/sidebar.js +21 -11
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +5 -5
- package/dist/components/slider.d.ts +27 -5
- package/dist/components/slider.js +30 -18
- package/dist/components/spinner.d.ts +6 -2
- package/dist/components/spinner.js +4 -4
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +8 -4
- package/dist/components/status-dot.d.ts +4 -1
- package/dist/components/status-dot.js +4 -4
- package/dist/components/stepper.d.ts +5 -1
- package/dist/components/stepper.js +3 -3
- package/dist/components/switch.d.ts +24 -5
- package/dist/components/switch.js +38 -20
- package/dist/components/table.d.ts +51 -2
- package/dist/components/table.js +158 -9
- package/dist/components/tabs.d.ts +49 -17
- package/dist/components/tabs.js +86 -55
- package/dist/components/tag.d.ts +17 -7
- package/dist/components/tag.js +19 -21
- package/dist/components/tags-input.d.ts +33 -4
- package/dist/components/tags-input.js +41 -31
- package/dist/components/textarea.d.ts +61 -5
- package/dist/components/textarea.js +59 -22
- package/dist/components/toast.d.ts +89 -15
- package/dist/components/toast.js +106 -31
- package/dist/components/toggle-group.d.ts +30 -3
- package/dist/components/toggle-group.js +44 -17
- package/dist/components/toggle.d.ts +25 -4
- package/dist/components/toggle.js +29 -19
- package/dist/components/tooltip.d.ts +31 -12
- package/dist/components/tooltip.js +63 -29
- package/dist/components.json +1518 -0
- package/dist/custom-elements.json +31817 -0
- package/dist/dev/index.d.ts +40 -0
- package/dist/dev/rules.d.ts +46 -0
- package/dist/dev/table.generated.d.ts +8 -0
- package/dist/dev/types.d.ts +113 -0
- package/dist/dev.js +3364 -0
- package/dist/disclosure.d.ts +30 -0
- package/dist/dismiss.d.ts +20 -0
- package/dist/form-control.d.ts +92 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +24 -24
- package/dist/keyboard-activation.d.ts +31 -0
- package/dist/keyboard.d.ts +32 -0
- package/dist/modal.d.ts +44 -0
- package/dist/overlay.d.ts +249 -0
- package/dist/parts.d.ts +171 -0
- package/dist/projection.d.ts +370 -0
- package/dist/types/elements.d.ts +648 -0
- package/dist/types/react.d.ts +163 -0
- package/dist/types/solid.d.ts +164 -0
- package/dist/types/solid2.d.ts +161 -0
- package/dist/types/svelte.d.ts +154 -0
- package/dist/types/vue.d.ts +156 -0
- package/dist/vscode.html-custom-data.json +6004 -0
- package/dist/web-types.json +8365 -0
- package/package.json +113 -25
- package/dist/base.d.ts.map +0 -1
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/action-input.d.ts.map +0 -1
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/bar-chart.d.ts.map +0 -1
- package/dist/components/breadcrumbs.d.ts.map +0 -1
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/charts/scale.d.ts.map +0 -1
- package/dist/components/charts/shape.d.ts.map +0 -1
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/color-picker.d.ts.map +0 -1
- package/dist/components/combobox.d.ts.map +0 -1
- package/dist/components/compose-input.d.ts.map +0 -1
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/divider.d.ts.map +0 -1
- package/dist/components/donut-chart.d.ts.map +0 -1
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/editable.d.ts.map +0 -1
- package/dist/components/error-fallback.d.ts.map +0 -1
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/file-upload.d.ts.map +0 -1
- package/dist/components/gauge.d.ts.map +0 -1
- package/dist/components/hamburger.d.ts.map +0 -1
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/indicator.d.ts.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/line-chart.d.ts.map +0 -1
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/menu.d.ts.map +0 -1
- package/dist/components/multiselect.d.ts.map +0 -1
- package/dist/components/nav-bar.d.ts.map +0 -1
- package/dist/components/nav-menu.d.ts.map +0 -1
- package/dist/components/number-input.d.ts.map +0 -1
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/panel.d.ts.map +0 -1
- package/dist/components/pin-input.d.ts.map +0 -1
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/segmented-control.d.ts.map +0 -1
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/stat.d.ts.map +0 -1
- package/dist/components/status-dot.d.ts.map +0 -1
- package/dist/components/stepper.d.ts.map +0 -1
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tag.d.ts.map +0 -1
- package/dist/components/tags-input.d.ts.map +0 -1
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/toast.d.ts.map +0 -1
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- /package/dist/chunks/{scale-BFZNL3Ss.js → scale-_ccSuoYg.js} +0 -0
|
@@ -1,30 +1,125 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
-
|
|
2
|
+
import { FormSubmission } from '../form-control.js';
|
|
3
|
+
import { OverlayController } from '../overlay.js';
|
|
4
|
+
import { PartsController } from '../parts.js';
|
|
5
|
+
import { ProjectionController } from '../projection.js';
|
|
6
|
+
/**
|
|
7
|
+
* One option of a `<void-combobox>` or `<void-multiselect>`, inside its `-content` part. The option itself is
|
|
8
|
+
* the `role="option"` in the list: the parent gives it an id and writes `aria-selected` (chosen), `active`
|
|
9
|
+
* (highlighted) and, in a combobox, `hidden` while the typed text filters it out.
|
|
10
|
+
*/
|
|
3
11
|
export declare class VoidOption extends VoidElement {
|
|
12
|
+
/**
|
|
13
|
+
* Value this option contributes when chosen: what the parent `void-combobox` or `void-multiselect`
|
|
14
|
+
* reports and submits. The option's text content is what the user sees.
|
|
15
|
+
*/
|
|
4
16
|
value: string;
|
|
17
|
+
/**
|
|
18
|
+
* Mark the option as chosen. In a `void-multiselect` it is the option's state (any number may be selected);
|
|
19
|
+
* in a `void-combobox` it is the initial choice when the combobox has no `value`.
|
|
20
|
+
*/
|
|
5
21
|
selected: boolean;
|
|
22
|
+
/** A disabled option is listed but cannot be highlighted or chosen. */
|
|
23
|
+
disabled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Text shown for the option once chosen (in the combobox field, on a multiselect chip) and used for
|
|
26
|
+
* filtering and type-ahead, when its content is more than plain text (an icon, a second line). Defaults to
|
|
27
|
+
* the option's text content.
|
|
28
|
+
*/
|
|
29
|
+
label: string;
|
|
30
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
6
31
|
}
|
|
7
|
-
|
|
8
|
-
|
|
32
|
+
export declare function optionLabel(opt: Element): string;
|
|
33
|
+
declare const VoidMultiselect_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
34
|
+
/**
|
|
35
|
+
* Multi-value picker for tag selection, permission assignment, and filter fields that allow several simultaneous choices.
|
|
36
|
+
*
|
|
37
|
+
* One part, `<void-multiselect-content>`, holding the `<void-option>`s: it is the list (`role="listbox"`,
|
|
38
|
+
* `aria-multiselectable`) shown in the top layer under the trigger. The component renders the trigger and its
|
|
39
|
+
* chips itself (after the content part) and never moves, copies or wraps the options.
|
|
40
|
+
*
|
|
41
|
+
* Follows the WAI-ARIA select-only combobox pattern with a multiselectable listbox popup: the trigger is the
|
|
42
|
+
* `role="combobox"` element and keeps DOM focus; the highlighted option is exposed with `aria-activedescendant`
|
|
43
|
+
* and drawn with the `active` attribute; chosen options have `aria-selected="true"`. The trigger is described by
|
|
44
|
+
* the number of chosen options ("2 selected"). The popup stays open while options are toggled.
|
|
45
|
+
*
|
|
46
|
+
* Keyboard (focus on the trigger): Enter, Space, ArrowDown and Alt+ArrowDown open the list on the first chosen
|
|
47
|
+
* option (else the first); ArrowUp opens it on the first option; Home and End open it on the first or last
|
|
48
|
+
* option; typing characters opens it on the next option starting with them. While open: ArrowDown and ArrowUp
|
|
49
|
+
* move the highlight (stopping at the ends), PageDown and PageUp by ten, Home and End to the first or last option,
|
|
50
|
+
* Enter or Space toggle the highlighted option, typing characters jumps to the next option starting with them,
|
|
51
|
+
* Escape and Alt+ArrowUp close the list (a second Escape reaches the surrounding dialog), Tab closes it and moves
|
|
52
|
+
* on. Disabled options are skipped.
|
|
53
|
+
*
|
|
54
|
+
* The list is shown in the top layer (never clipped by an `overflow` or `transform` ancestor) and placed under the
|
|
55
|
+
* trigger with CSS anchor positioning, flipping above it near the bottom of the viewport. A press outside closes
|
|
56
|
+
* it too.
|
|
57
|
+
*
|
|
58
|
+
* @fires {CustomEvent<{ value: string[] }>} void-change - An option was chosen or unchosen; `value` is every chosen value.
|
|
59
|
+
* @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' | 'api' }>} void-open - The option list opened.
|
|
60
|
+
* @fires {CustomEvent<{ reason: 'trigger' | 'escape' | 'outside' | 'blur' | 'parent' | 'api' }>} void-close - The option list is closing.
|
|
61
|
+
*/
|
|
62
|
+
export declare class VoidMultiselect extends VoidMultiselect_base {
|
|
63
|
+
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
64
|
+
static labelTarget: string;
|
|
65
|
+
/**
|
|
66
|
+
* Text shown in the trigger while nothing is selected. Defaults to `Select...`. It is also the
|
|
67
|
+
* trigger's accessible name when no `void-field` label names it.
|
|
68
|
+
*/
|
|
9
69
|
placeholder: string;
|
|
70
|
+
/** Stop the trigger opening and exclude the values from the form submission. */
|
|
10
71
|
disabled: boolean;
|
|
11
|
-
|
|
72
|
+
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
73
|
+
size: 'sm' | 'md' | 'lg';
|
|
74
|
+
/**
|
|
75
|
+
* Mark the control invalid: it gets the error styling and `aria-invalid`. The message itself is shown
|
|
76
|
+
* by the wrapping `void-field`.
|
|
77
|
+
*/
|
|
12
78
|
error: string;
|
|
13
79
|
name: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
80
|
+
/** Whether the option list is showing. Reflected, so it can be read (and set) from markup. */
|
|
81
|
+
open: boolean;
|
|
82
|
+
/** The option with visual focus (`aria-activedescendant`), or null. */
|
|
83
|
+
private _active;
|
|
84
|
+
private readonly _typeahead;
|
|
85
|
+
/** Inside updated(): the wiring it runs must not schedule another update. */
|
|
86
|
+
private _wiring;
|
|
87
|
+
/** The rendered trigger comes first, so reading order puts the field before its (top-layer) list. */
|
|
88
|
+
protected readonly _projection: ProjectionController;
|
|
89
|
+
protected readonly _parts: PartsController;
|
|
90
|
+
protected readonly _overlay: OverlayController;
|
|
91
|
+
private _content;
|
|
92
|
+
private _trigger;
|
|
93
|
+
private get _options();
|
|
17
94
|
get value(): string[];
|
|
95
|
+
/** Select exactly the options whose value is listed. Does not fire void-change. */
|
|
96
|
+
set value(values: string[]);
|
|
97
|
+
/** One entry per selected option. */
|
|
98
|
+
protected formSubmission(): FormSubmission;
|
|
18
99
|
connectedCallback(): void;
|
|
19
100
|
disconnectedCallback(): void;
|
|
20
|
-
protected
|
|
101
|
+
protected willUpdate(changed: Map<string, unknown>): void;
|
|
102
|
+
protected updated(changed: Map<string, unknown>): void;
|
|
103
|
+
/** The content part is the multiselectable listbox in the top layer; every option a `role="option"`. */
|
|
104
|
+
private _wire;
|
|
105
|
+
/** The id of the content part while the list is open (one is generated where the author wrote none). */
|
|
106
|
+
private _controls;
|
|
21
107
|
render(): import('lit').TemplateResult<1>;
|
|
22
|
-
|
|
108
|
+
/** Presses on the list and the chips keep focus on the trigger. */
|
|
109
|
+
private _onPointerDown;
|
|
110
|
+
private _onClick;
|
|
111
|
+
/** Opens the list; the highlight starts on the first selected option, the first or last option, or nowhere. */
|
|
112
|
+
private _openList;
|
|
113
|
+
/** Closes the list through the overlay stack (so `void-close` carries the reason). */
|
|
114
|
+
private _close;
|
|
115
|
+
private _moveActive;
|
|
116
|
+
/** The enabled option `n` steps from the current one, stopping at the ends. */
|
|
117
|
+
private _stepBy;
|
|
23
118
|
private _onTriggerKeydown;
|
|
24
|
-
private
|
|
25
|
-
|
|
119
|
+
private _typeaheadTo;
|
|
120
|
+
/** Focus left the widget (Tab, or a click elsewhere): close the list. */
|
|
121
|
+
private _onFocusOut;
|
|
26
122
|
private _toggleOption;
|
|
27
|
-
private _deselect;
|
|
28
123
|
}
|
|
29
124
|
declare global {
|
|
30
125
|
interface HTMLElementTagNameMap {
|
|
@@ -32,4 +127,4 @@ declare global {
|
|
|
32
127
|
'void-multiselect': VoidMultiselect;
|
|
33
128
|
}
|
|
34
129
|
}
|
|
35
|
-
|
|
130
|
+
export {};
|
|
@@ -1,118 +1,255 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../chunks/decorate-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { n as e, t } from "../chunks/base-CMruMbxC.js";
|
|
2
|
+
import { t as n } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as r } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as i } from "../chunks/parts-D30c8OoG.js";
|
|
5
|
+
import { i as a, n as o, r as s, t as c } from "../chunks/keyboard-MQpfTX5I.js";
|
|
6
|
+
import { t as l } from "../chunks/overlay-BywGMcDW.js";
|
|
7
|
+
import { html as u, nothing as d } from "lit";
|
|
8
|
+
import { property as f } from "lit/decorators.js";
|
|
5
9
|
//#region src/components/multiselect.ts
|
|
6
|
-
var
|
|
10
|
+
var p = class extends t {
|
|
7
11
|
constructor(...e) {
|
|
8
|
-
super(...e), this.value = "", this.selected = !1;
|
|
12
|
+
super(...e), this.value = "", this.selected = !1, this.disabled = !1, this.label = "";
|
|
13
|
+
}
|
|
14
|
+
updated(e) {
|
|
15
|
+
super.updated(e), [
|
|
16
|
+
"selected",
|
|
17
|
+
"disabled",
|
|
18
|
+
"label",
|
|
19
|
+
"value"
|
|
20
|
+
].some((t) => e.has(t) && e.get(t) !== void 0) && (this.closest("void-multiselect") ?? this.closest("void-combobox"))?.requestUpdate();
|
|
9
21
|
}
|
|
10
22
|
};
|
|
11
|
-
|
|
23
|
+
n([f({
|
|
12
24
|
type: String,
|
|
13
25
|
reflect: !0
|
|
14
|
-
})],
|
|
26
|
+
})], p.prototype, "value", void 0), n([f({
|
|
15
27
|
type: Boolean,
|
|
16
28
|
reflect: !0
|
|
17
|
-
})],
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
})], p.prototype, "selected", void 0), n([f({
|
|
30
|
+
type: Boolean,
|
|
31
|
+
reflect: !0
|
|
32
|
+
})], p.prototype, "disabled", void 0), n([f({ type: String })], p.prototype, "label", void 0), customElements.get("void-option") || customElements.define("void-option", p);
|
|
33
|
+
var m = (e) => e instanceof p ? e.value : e.getAttribute("value") ?? "", h = (e) => e instanceof p ? e.selected : e.hasAttribute("selected");
|
|
34
|
+
function g(e) {
|
|
35
|
+
return e.getAttribute("label") || e.textContent?.trim() || e.getAttribute("value") || "";
|
|
36
|
+
}
|
|
37
|
+
var _ = class extends r(t) {
|
|
38
|
+
constructor(...t) {
|
|
39
|
+
super(...t), this.placeholder = "Select...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._active = null, this._typeahead = new c(), this._wiring = !1, this._projection = new e(this, { placement: "start" }), this._parts = new i(this, {
|
|
40
|
+
tags: ["void-multiselect-content", "void-option"],
|
|
41
|
+
onChange: () => {
|
|
42
|
+
this._wire(), this._wiring || this.requestUpdate();
|
|
43
|
+
}
|
|
44
|
+
}), this._overlay = new l(this, {
|
|
45
|
+
kind: "listbox",
|
|
46
|
+
surface: () => this._content(),
|
|
47
|
+
isOpen: () => this.open && !this.formDisabled,
|
|
48
|
+
setOpen: (e) => {
|
|
49
|
+
this.open = e;
|
|
50
|
+
},
|
|
51
|
+
anchor: () => this._trigger(),
|
|
52
|
+
attr: (e, t, n) => this._parts.set(e, t, n),
|
|
53
|
+
style: (e, t, n) => this._parts.style(e, t, n),
|
|
54
|
+
initialFocus: () => !1
|
|
55
|
+
}), this._onPointerDown = (e) => {
|
|
56
|
+
let t = e.target;
|
|
57
|
+
(this._content()?.contains(t) || t.closest?.(".void-multiselect-pill-remove")) && e.preventDefault();
|
|
58
|
+
}, this._onClick = (e) => {
|
|
59
|
+
if (this.formDisabled) return;
|
|
60
|
+
let t = e.target, n = t.closest?.(".void-multiselect-pill-remove");
|
|
61
|
+
if (n && this._trigger()?.contains(n)) {
|
|
62
|
+
e.stopPropagation();
|
|
63
|
+
let t = this._options.find((e) => e.value === n.getAttribute("data-value"));
|
|
64
|
+
t && this._toggleOption(t, !1);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
if (this._content()?.contains(t)) {
|
|
68
|
+
let e = t.closest("void-option");
|
|
69
|
+
e && !e.disabled && this._options.includes(e) && this._toggleOption(e);
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this._trigger()?.contains(t) && (e.stopPropagation(), this.open ? this._close("trigger") : this._openList("none", "trigger"));
|
|
22
73
|
}, this._onTriggerKeydown = (e) => {
|
|
23
|
-
this.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
74
|
+
if (this.formDisabled || e.target !== e.currentTarget || e.isComposing) return;
|
|
75
|
+
let t = this._options.map((e) => e.disabled), n = e.key;
|
|
76
|
+
if (!this.open) {
|
|
77
|
+
n === "Home" || n === "End" ? (e.preventDefault(), this._openList(n === "Home" ? "first" : "last")) : n === "ArrowUp" ? (e.preventDefault(), this._openList("first")) : n === "Enter" || n === " " || n === "ArrowDown" ? (e.preventDefault(), this._openList("selected")) : s(e) && (e.preventDefault(), this._openList("selected"), this._typeaheadTo(e.key));
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
switch (n) {
|
|
81
|
+
case "ArrowDown":
|
|
82
|
+
e.preventDefault(), e.altKey || this._moveActive(this._stepBy(1));
|
|
83
|
+
break;
|
|
84
|
+
case "ArrowUp":
|
|
85
|
+
e.preventDefault(), e.altKey ? this._close("escape") : this._moveActive(this._stepBy(-1));
|
|
86
|
+
break;
|
|
87
|
+
case "PageDown":
|
|
88
|
+
e.preventDefault(), this._moveActive(this._stepBy(10));
|
|
89
|
+
break;
|
|
90
|
+
case "PageUp":
|
|
91
|
+
e.preventDefault(), this._moveActive(this._stepBy(-10));
|
|
92
|
+
break;
|
|
93
|
+
case "Home":
|
|
94
|
+
e.preventDefault(), this._moveActive(o(t, 1));
|
|
95
|
+
break;
|
|
96
|
+
case "End":
|
|
97
|
+
e.preventDefault(), this._moveActive(o(t, -1));
|
|
98
|
+
break;
|
|
99
|
+
case "Enter":
|
|
100
|
+
case " ":
|
|
101
|
+
e.preventDefault(), this._active && !this._active.disabled && this._toggleOption(this._active);
|
|
102
|
+
break;
|
|
103
|
+
case "Escape":
|
|
104
|
+
e.preventDefault(), e.stopPropagation(), this._close("escape");
|
|
105
|
+
break;
|
|
106
|
+
case "Tab":
|
|
107
|
+
this._close("blur");
|
|
108
|
+
break;
|
|
109
|
+
default: s(e) && (e.preventDefault(), this._typeaheadTo(e.key));
|
|
110
|
+
}
|
|
111
|
+
}, this._onFocusOut = (e) => {
|
|
112
|
+
this.open && !this.contains(e.relatedTarget) && this._close("blur");
|
|
28
113
|
};
|
|
29
114
|
}
|
|
115
|
+
static {
|
|
116
|
+
this.labelTarget = "[role=combobox]";
|
|
117
|
+
}
|
|
118
|
+
_content() {
|
|
119
|
+
return this._parts.one("void-multiselect-content");
|
|
120
|
+
}
|
|
121
|
+
_trigger() {
|
|
122
|
+
return this.querySelector(":scope > .void-multiselect-trigger");
|
|
123
|
+
}
|
|
124
|
+
get _options() {
|
|
125
|
+
let e = this._content();
|
|
126
|
+
return e ? this._parts.within(e, "void-option") : [];
|
|
127
|
+
}
|
|
30
128
|
get value() {
|
|
31
|
-
return this._options.filter(
|
|
129
|
+
return this._options.filter(h).map(m);
|
|
130
|
+
}
|
|
131
|
+
set value(e) {
|
|
132
|
+
let t = new Set(e ?? []);
|
|
133
|
+
for (let e of this._options) {
|
|
134
|
+
let n = t.has(m(e));
|
|
135
|
+
e instanceof p ? e.selected = n : e.toggleAttribute("selected", n);
|
|
136
|
+
}
|
|
137
|
+
this.requestUpdate();
|
|
138
|
+
}
|
|
139
|
+
formSubmission() {
|
|
140
|
+
return this.value;
|
|
32
141
|
}
|
|
33
142
|
connectedCallback() {
|
|
34
|
-
super.connectedCallback(), this.
|
|
143
|
+
super.connectedCallback(), this.addEventListener("focusout", this._onFocusOut), this.addEventListener("mousedown", this._onPointerDown), this.addEventListener("click", this._onClick);
|
|
35
144
|
}
|
|
36
145
|
disconnectedCallback() {
|
|
37
|
-
super.disconnectedCallback(),
|
|
146
|
+
super.disconnectedCallback(), this.removeEventListener("focusout", this._onFocusOut), this.removeEventListener("mousedown", this._onPointerDown), this.removeEventListener("click", this._onClick);
|
|
147
|
+
}
|
|
148
|
+
willUpdate(e) {
|
|
149
|
+
super.willUpdate(e), e.has("open") && !this.open && (this._active = null, this._typeahead.reset());
|
|
38
150
|
}
|
|
39
151
|
updated(e) {
|
|
40
|
-
super.updated(e), this.
|
|
152
|
+
super.updated(e), this._wiring = !0;
|
|
153
|
+
try {
|
|
154
|
+
this._parts.sync();
|
|
155
|
+
} finally {
|
|
156
|
+
this._wiring = !1;
|
|
157
|
+
}
|
|
158
|
+
this.open && this._active?.scrollIntoView?.({ block: "nearest" });
|
|
159
|
+
}
|
|
160
|
+
_wire() {
|
|
161
|
+
let e = this._content(), t = this._trigger(), n = this._options, r = this.open && !this.formDisabled;
|
|
162
|
+
this._active && (!n.includes(this._active) || this._active.disabled) && (this._active = null);
|
|
163
|
+
for (let e of n) this._parts.set(e, "role", "option"), this._parts.id(e, "void-option"), this._parts.set(e, "aria-selected", e.selected ? "true" : null), this._parts.set(e, "aria-disabled", e.disabled ? "true" : null), this._parts.set(e, "active", e === this._active);
|
|
164
|
+
if (!e) return;
|
|
165
|
+
this._parts.set(e, "popover", "manual"), this._parts.set(e, "role", "listbox"), this._parts.set(e, "aria-multiselectable", "true"), this._parts.id(e, "void-multiselect-content");
|
|
166
|
+
let i = r ? t?.getAttribute("aria-labelledby") ?? null : null;
|
|
167
|
+
this._parts.set(e, "aria-labelledby", i), this._parts.set(e, "aria-label", r && !i && (t?.getAttribute("aria-label") || this.placeholder) || null), t && this._parts.set(t, "aria-activedescendant", r && this._active ? this._parts.id(this._active, "void-option") : null);
|
|
168
|
+
}
|
|
169
|
+
_controls(e) {
|
|
170
|
+
let t = e ? this._content() : null;
|
|
171
|
+
return t ? this._parts.id(t, "void-multiselect-content") : d;
|
|
41
172
|
}
|
|
42
173
|
render() {
|
|
43
|
-
let e = this._options.filter((e) => e.selected);
|
|
44
|
-
return
|
|
174
|
+
let e = this._options.filter((e) => e.selected), t = this.open && !this.formDisabled, n = e.length;
|
|
175
|
+
return u`
|
|
45
176
|
<div
|
|
46
177
|
class="void-multiselect-trigger"
|
|
47
|
-
|
|
48
|
-
|
|
178
|
+
role="combobox"
|
|
179
|
+
tabindex=${this.formDisabled ? "-1" : "0"}
|
|
180
|
+
aria-label=${this.placeholder}
|
|
181
|
+
aria-haspopup="listbox"
|
|
182
|
+
aria-expanded=${String(t)}
|
|
183
|
+
aria-controls=${this._controls(t)}
|
|
184
|
+
aria-description=${n ? `${n} selected` : d}
|
|
185
|
+
aria-disabled=${this.formDisabled ? "true" : d}
|
|
186
|
+
aria-required=${this.required ? "true" : d}
|
|
187
|
+
aria-invalid=${this.error ? "true" : d}
|
|
49
188
|
@keydown=${this._onTriggerKeydown}
|
|
50
189
|
>
|
|
51
|
-
${
|
|
190
|
+
${n > 0 ? e.map((e) => u`
|
|
52
191
|
<span class="void-multiselect-pill">
|
|
53
|
-
<span class="void-multiselect-pill-label">${e
|
|
192
|
+
<span class="void-multiselect-pill-label">${g(e)}</span>
|
|
54
193
|
<button
|
|
55
194
|
type="button"
|
|
56
195
|
class="void-multiselect-pill-remove"
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}}
|
|
196
|
+
tabindex="-1"
|
|
197
|
+
aria-label="Remove ${g(e)}"
|
|
198
|
+
data-value=${e.value}
|
|
61
199
|
>×</button>
|
|
62
200
|
</span>
|
|
63
|
-
`) :
|
|
201
|
+
`) : u`<span class="void-multiselect-placeholder">${this.placeholder}</span>`}
|
|
64
202
|
</div>
|
|
65
|
-
${this.
|
|
66
|
-
<div class="void-multiselect-dropdown" role="listbox" aria-label=${this.placeholder} aria-multiselectable="true">
|
|
67
|
-
${this._options.map((e) => n`
|
|
68
|
-
<div
|
|
69
|
-
class="void-multiselect-option"
|
|
70
|
-
role="option"
|
|
71
|
-
tabindex="0"
|
|
72
|
-
aria-selected=${e.selected ? "true" : "false"}
|
|
73
|
-
@click=${() => this._toggleOption(e)}
|
|
74
|
-
@keydown=${(t) => {
|
|
75
|
-
(t.key === "Enter" || t.key === " ") && (t.preventDefault(), this._toggleOption(e));
|
|
76
|
-
}}
|
|
77
|
-
>
|
|
78
|
-
<span class="void-multiselect-checkbox">
|
|
79
|
-
${e.selected ? n`<svg viewBox="0 0 12 12" fill="none"><path d="M2.5 6l2.5 2.5 4.5-5" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/></svg>` : r}
|
|
80
|
-
</span>
|
|
81
|
-
<span class="void-multiselect-option-label">${e.textContent?.trim() || e.value}</span>
|
|
82
|
-
</div>
|
|
83
|
-
`)}
|
|
84
|
-
</div>
|
|
85
|
-
` : r}
|
|
86
|
-
${this.error ? n`<span class="void-multiselect-error">${this.error}</span>` : r}
|
|
203
|
+
${this.error ? u`<span class="void-multiselect-error">${this.error}</span>` : d}
|
|
87
204
|
`;
|
|
88
205
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
detail: { values: this.value }
|
|
94
|
-
}));
|
|
206
|
+
_openList(e, t = "keyboard") {
|
|
207
|
+
if (this._overlay.requestOpen(t), !this.open) return;
|
|
208
|
+
let n = this._options, r = n.map((e) => e.disabled), i = -1;
|
|
209
|
+
e === "first" ? i = o(r, 1) : e === "last" ? i = o(r, -1) : e === "selected" && (i = n.findIndex((e) => e.selected && !e.disabled), i < 0 && (i = o(r, 1))), this._active = i >= 0 ? n[i] : null, this.requestUpdate();
|
|
95
210
|
}
|
|
96
|
-
|
|
97
|
-
|
|
211
|
+
_close(e = "api") {
|
|
212
|
+
this.open && this._overlay.requestClose(e);
|
|
213
|
+
}
|
|
214
|
+
_moveActive(e) {
|
|
215
|
+
e < 0 || (this._active = this._options[e], this.requestUpdate());
|
|
216
|
+
}
|
|
217
|
+
_stepBy(e) {
|
|
218
|
+
let t = this._options, n = t.map((e) => e.disabled), r = this._active ? t.indexOf(this._active) : -1, i = e > 0 ? 1 : -1, s = r;
|
|
219
|
+
for (let t = r, o = Math.abs(e); o > 0;) {
|
|
220
|
+
let e = a(n, t, i, !1);
|
|
221
|
+
if (e < 0) break;
|
|
222
|
+
s = t = e, o--;
|
|
223
|
+
}
|
|
224
|
+
return s >= 0 ? s : o(n, i);
|
|
225
|
+
}
|
|
226
|
+
_typeaheadTo(e) {
|
|
227
|
+
let t = this._options, n = this._active ? t.indexOf(this._active) : -1, r = this._typeahead.match(e, t.map((e) => g(e)), t.map((e) => e.disabled), n);
|
|
228
|
+
this._moveActive(r);
|
|
229
|
+
}
|
|
230
|
+
_toggleOption(e, t = !e.selected) {
|
|
231
|
+
e.selected = t, this.requestUpdate(), this.dispatchEvent(new CustomEvent("void-change", {
|
|
98
232
|
bubbles: !0,
|
|
99
233
|
composed: !0,
|
|
100
|
-
detail: {
|
|
234
|
+
detail: { value: this.value }
|
|
101
235
|
}));
|
|
102
236
|
}
|
|
103
237
|
};
|
|
104
|
-
|
|
238
|
+
n([f({ type: String })], _.prototype, "placeholder", void 0), n([f({
|
|
105
239
|
type: Boolean,
|
|
106
240
|
reflect: !0
|
|
107
|
-
})],
|
|
241
|
+
})], _.prototype, "disabled", void 0), n([f({
|
|
108
242
|
type: String,
|
|
109
243
|
reflect: !0
|
|
110
|
-
})],
|
|
244
|
+
})], _.prototype, "size", void 0), n([f({
|
|
111
245
|
type: String,
|
|
112
246
|
reflect: !0
|
|
113
|
-
})],
|
|
247
|
+
})], _.prototype, "error", void 0), n([f({
|
|
114
248
|
type: String,
|
|
115
249
|
reflect: !0
|
|
116
|
-
})],
|
|
250
|
+
})], _.prototype, "name", void 0), n([f({
|
|
251
|
+
type: Boolean,
|
|
252
|
+
reflect: !0
|
|
253
|
+
})], _.prototype, "open", void 0), customElements.get("void-multiselect") || customElements.define("void-multiselect", _);
|
|
117
254
|
//#endregion
|
|
118
|
-
export {
|
|
255
|
+
export { _ as VoidMultiselect, p as VoidOption, g as optionLabel };
|
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Top application navigation bar for branding, primary links, and user account controls.
|
|
4
|
+
*
|
|
5
|
+
* The bar is a row: what you write inside it is laid out by the theme as it stands, with no part elements and
|
|
6
|
+
* nothing rendered. Use the patterns beside it for the usual contents: `<void-brand>` for the name or logo,
|
|
7
|
+
* `<void-nav-links>` for the links (mark the current page with `aria-current="page"`) and `<void-spacer>` to
|
|
8
|
+
* push what follows to the far end.
|
|
9
|
+
*/
|
|
3
10
|
export declare class VoidNavBar extends VoidElement {
|
|
11
|
+
/** Stay at the top of the viewport while the page scrolls. */
|
|
4
12
|
sticky: boolean;
|
|
5
|
-
|
|
13
|
+
/** Leave out the hairline under the bar (it is drawn by default). */
|
|
14
|
+
hideBorder: boolean;
|
|
15
|
+
/** `default` sits on the page; `elevated` uses the raised surface colour. */
|
|
6
16
|
variant: 'default' | 'elevated';
|
|
7
|
-
private _userContent;
|
|
8
|
-
private _didSetup;
|
|
9
17
|
connectedCallback(): void;
|
|
10
|
-
protected updated(_changed: Map<string, unknown>): void;
|
|
11
|
-
render(): import('lit').TemplateResult<1>;
|
|
12
18
|
}
|
|
13
19
|
declare global {
|
|
14
20
|
interface HTMLElementTagNameMap {
|
|
15
21
|
'void-nav-bar': VoidNavBar;
|
|
16
22
|
}
|
|
17
23
|
}
|
|
18
|
-
//# sourceMappingURL=nav-bar.d.ts.map
|
|
@@ -1,35 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t } from "../chunks/decorate-
|
|
3
|
-
import {
|
|
4
|
-
import { property as r } from "lit/decorators.js";
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { property as n } from "lit/decorators.js";
|
|
5
4
|
//#region src/components/nav-bar.ts
|
|
6
|
-
var
|
|
5
|
+
var r = class extends e {
|
|
7
6
|
constructor(...e) {
|
|
8
|
-
super(...e), this.sticky = !1, this.
|
|
7
|
+
super(...e), this.sticky = !1, this.hideBorder = !1, this.variant = "default";
|
|
9
8
|
}
|
|
10
9
|
connectedCallback() {
|
|
11
|
-
super.connectedCallback(), this.
|
|
12
|
-
}
|
|
13
|
-
updated(e) {
|
|
14
|
-
if (super.updated(e), !this._didSetup) {
|
|
15
|
-
this._didSetup = !0;
|
|
16
|
-
let e = this.querySelector(".void-nav-bar-content");
|
|
17
|
-
for (let t of this._userContent) e.appendChild(t);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
render() {
|
|
21
|
-
return n`<div class="void-nav-bar-content"></div>`;
|
|
10
|
+
super.connectedCallback(), this.setHostAttribute("role", "navigation");
|
|
22
11
|
}
|
|
23
12
|
};
|
|
24
|
-
t([
|
|
13
|
+
t([n({
|
|
25
14
|
type: Boolean,
|
|
26
15
|
reflect: !0
|
|
27
|
-
})],
|
|
16
|
+
})], r.prototype, "sticky", void 0), t([n({
|
|
28
17
|
type: Boolean,
|
|
18
|
+
attribute: "hide-border",
|
|
29
19
|
reflect: !0
|
|
30
|
-
})],
|
|
20
|
+
})], r.prototype, "hideBorder", void 0), t([n({
|
|
31
21
|
type: String,
|
|
32
22
|
reflect: !0
|
|
33
|
-
})],
|
|
23
|
+
})], r.prototype, "variant", void 0), customElements.get("void-nav-bar") || customElements.define("void-nav-bar", r);
|
|
34
24
|
//#endregion
|
|
35
|
-
export {
|
|
25
|
+
export { r as VoidNavBar };
|
|
@@ -1,37 +1,78 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
-
|
|
2
|
+
import { PartsController } from '../parts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Horizontal navigation bar with dropdown sub-menus for site headers, application nav bars, and mega-menu layouts.
|
|
5
|
+
*
|
|
6
|
+
* A row of `<void-nav-menu-item>`s. Arrow keys move between the items' triggers, Escape closes an open panel and
|
|
7
|
+
* returns focus to its trigger.
|
|
8
|
+
*/
|
|
3
9
|
export declare class VoidNavMenu extends VoidElement {
|
|
10
|
+
/**
|
|
11
|
+
* `horizontal` (default) lays the items out in a row with Left and Right arrow keys; `vertical` stacks
|
|
12
|
+
* them.
|
|
13
|
+
*/
|
|
4
14
|
orientation: 'horizontal' | 'vertical';
|
|
15
|
+
/** CSS width of the menu, such as `100%` or `40rem`. By default it is as wide as its items. */
|
|
5
16
|
width: string;
|
|
6
17
|
connectedCallback(): void;
|
|
7
18
|
disconnectedCallback(): void;
|
|
8
19
|
protected updated(changed: Map<string, unknown>): void;
|
|
9
20
|
private _handleItemOpen;
|
|
10
21
|
private _handleKeydown;
|
|
22
|
+
/** The items of this menu (not of a menu nested inside one of its panels). */
|
|
11
23
|
private _getItems;
|
|
12
24
|
}
|
|
13
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* One entry of a `<void-nav-menu>`: a `<void-nav-menu-trigger>` around one control (a `<button>` for an entry that
|
|
27
|
+
* opens a panel, an `<a href>` for one that navigates) and, for a panel, a `<void-nav-menu-content>` after it.
|
|
28
|
+
*
|
|
29
|
+
* Hovering the item opens its panel after a short delay; a click, Enter or Space on a button trigger opens it
|
|
30
|
+
* too (the browser turns Enter and Space on a button into one `click`, so each key activates exactly once). A
|
|
31
|
+
* link trigger always navigates. The panel closes when the pointer leaves, on Escape, on a press outside or when
|
|
32
|
+
* focus leaves the item.
|
|
33
|
+
*
|
|
34
|
+
* @fires {CustomEvent<{ reason: 'hover' | 'trigger' }>} void-open - The panel opened. Does not bubble.
|
|
35
|
+
* @fires {CustomEvent<{ reason: 'hover' | 'trigger' | 'escape' | 'outside' | 'blur' }>} void-close - The panel
|
|
36
|
+
* closed. Does not bubble.
|
|
37
|
+
*/
|
|
14
38
|
export declare class VoidNavMenuItem extends VoidElement {
|
|
39
|
+
/**
|
|
40
|
+
* Whether the item's panel is showing. A click or Enter on the trigger toggles it, firing `void-open` or
|
|
41
|
+
* `void-close`.
|
|
42
|
+
*/
|
|
15
43
|
open: boolean;
|
|
44
|
+
/** Dim the item and stop it opening or navigating. */
|
|
16
45
|
disabled: boolean;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
private _didSetup;
|
|
46
|
+
/**
|
|
47
|
+
* Mark the item as the current section: it is drawn with an underline, and a link trigger gets
|
|
48
|
+
* `aria-current="page"`. Set it on the item that matches the page.
|
|
49
|
+
*/
|
|
50
|
+
current: boolean;
|
|
23
51
|
private _openTimerId;
|
|
24
52
|
private _closeTimerId;
|
|
53
|
+
/** The panel was opened by hovering, so a click keeps it open instead of closing it. */
|
|
54
|
+
private _openedByHover;
|
|
55
|
+
protected readonly _parts: PartsController;
|
|
56
|
+
/** The control inside the trigger part. @internal */
|
|
57
|
+
_control(): HTMLElement | null;
|
|
58
|
+
private _content;
|
|
59
|
+
private get _hasContent();
|
|
60
|
+
/** A link navigates; it never toggles the panel. */
|
|
61
|
+
private _isLink;
|
|
62
|
+
/** Writes the menubar ARIA on the control and links it to the panel. Idempotent. */
|
|
63
|
+
private _wire;
|
|
25
64
|
connectedCallback(): void;
|
|
26
65
|
disconnectedCallback(): void;
|
|
27
66
|
protected updated(changed: Map<string, unknown>): void;
|
|
67
|
+
/** A click (or the click Enter and Space make on a button) on the trigger toggles the panel. */
|
|
68
|
+
private _onClick;
|
|
28
69
|
private _onMouseEnter;
|
|
29
70
|
private _onMouseLeave;
|
|
30
|
-
private
|
|
31
|
-
private _onContentLeave;
|
|
71
|
+
private _onFocusOut;
|
|
32
72
|
private _onOutsideClick;
|
|
33
73
|
private _openDropdown;
|
|
34
|
-
|
|
74
|
+
/** @internal Closes the panel for `reason` (the menu calls it for Escape and when another item opens). */
|
|
75
|
+
_closeDropdown(reason: 'hover' | 'trigger' | 'escape' | 'outside' | 'blur'): void;
|
|
35
76
|
}
|
|
36
77
|
declare global {
|
|
37
78
|
interface HTMLElementTagNameMap {
|
|
@@ -39,4 +80,3 @@ declare global {
|
|
|
39
80
|
'void-nav-menu-item': VoidNavMenuItem;
|
|
40
81
|
}
|
|
41
82
|
}
|
|
42
|
-
//# sourceMappingURL=nav-menu.d.ts.map
|