@editora/ui-core 0.1.18 → 0.1.20
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/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -669
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +1 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +1 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +30 -9
- package/dist/date-picker.esm.js +90 -97
- package/dist/date-range-picker.cjs.js +22 -3
- package/dist/date-range-picker.esm.js +103 -108
- package/dist/date-range-time-picker.cjs.js +28 -12
- package/dist/date-range-time-picker.esm.js +137 -150
- package/dist/date-time-picker.cjs.js +25 -9
- package/dist/date-time-picker.esm.js +139 -155
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +29 -21
- package/dist/time-picker.esm.js +96 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +3 -3
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/menubar.esm.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { E } from "./ElementBase-
|
|
2
|
-
import {
|
|
3
|
-
import { d as L } from "./collection-
|
|
4
|
-
import { c as I } from "./dismissable-layer-
|
|
5
|
-
import { r as
|
|
6
|
-
import {
|
|
7
|
-
import "./listbox-
|
|
8
|
-
import { c as D } from "./menu-item-styles-
|
|
9
|
-
import "./collection.esm.js";
|
|
1
|
+
import { E } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { b as k } from "./portal-bR42gHvG.mjs";
|
|
3
|
+
import { d as L } from "./collection-C7URGjEI.mjs";
|
|
4
|
+
import { c as I } from "./dismissable-layer-BmPIoK80.mjs";
|
|
5
|
+
import { r as g, s as v, f as C, m as y, g as x } from "./roving-focus-group-Dbm1Jko_.mjs";
|
|
6
|
+
import { e as T } from "./positioner-D0VGxtYU.mjs";
|
|
7
|
+
import "./listbox-DJamVeFj.mjs";
|
|
8
|
+
import { c as D } from "./menu-item-styles-CZiPwPwl.mjs";
|
|
10
9
|
const z = ":scope > .submenu", B = [
|
|
11
10
|
"--ui-color-primary",
|
|
12
11
|
"--ui-color-primary-hover",
|
|
@@ -55,7 +54,7 @@ const z = ":scope > .submenu", B = [
|
|
|
55
54
|
function O(n) {
|
|
56
55
|
return n === "sm" || n === "1" || n === "compact" ? "sm" : n === "lg" || n === "3" || n === "comfortable" ? "lg" : "md";
|
|
57
56
|
}
|
|
58
|
-
function
|
|
57
|
+
function S(n) {
|
|
59
58
|
return !n || n === "default" ? null : n === "none" || n === "square" ? "0px" : n === "sm" ? "8px" : n === "md" || n === "soft" ? "12px" : n === "lg" ? "16px" : n === "full" ? "999px" : /^\d+(\.\d+)?$/.test(n) ? `${n}px` : /^\d+(\.\d+)?(px|rem|em|%)$/.test(n) ? n : null;
|
|
60
59
|
}
|
|
61
60
|
const R = `
|
|
@@ -521,16 +520,15 @@ function H(n) {
|
|
|
521
520
|
const e = $(n);
|
|
522
521
|
return e === "top" ? "top" : e === "left" ? "left" : e === "right" ? "right" : "bottom";
|
|
523
522
|
}
|
|
524
|
-
function
|
|
525
|
-
if (n == null)
|
|
526
|
-
return e;
|
|
523
|
+
function f(n, e) {
|
|
524
|
+
if (n == null) return e;
|
|
527
525
|
const t = String(n).toLowerCase();
|
|
528
526
|
return t !== "false" && t !== "0";
|
|
529
527
|
}
|
|
530
|
-
function
|
|
528
|
+
function A(n, e) {
|
|
531
529
|
return e <= 0 ? -1 : Number.isNaN(n) || n < 0 ? 0 : n >= e ? e - 1 : n;
|
|
532
530
|
}
|
|
533
|
-
function
|
|
531
|
+
function l() {
|
|
534
532
|
return [
|
|
535
533
|
'[role="menuitem"]',
|
|
536
534
|
'[role="menuitemcheckbox"]',
|
|
@@ -539,18 +537,18 @@ function c() {
|
|
|
539
537
|
"[data-menu-item]"
|
|
540
538
|
].join(", ");
|
|
541
539
|
}
|
|
542
|
-
function
|
|
540
|
+
function _(n) {
|
|
543
541
|
return n.hasAttribute("disabled") || n.getAttribute("aria-disabled") === "true" || !!n.disabled;
|
|
544
542
|
}
|
|
545
|
-
function
|
|
543
|
+
function w(n) {
|
|
546
544
|
const e = typeof n.composedPath == "function" ? n.composedPath() : [];
|
|
547
545
|
for (const a of e)
|
|
548
|
-
if (a instanceof HTMLElement && a.matches(
|
|
546
|
+
if (a instanceof HTMLElement && a.matches(l()))
|
|
549
547
|
return a;
|
|
550
548
|
const t = n.target;
|
|
551
|
-
return t instanceof HTMLElement ? t.closest(
|
|
549
|
+
return t instanceof HTMLElement ? t.closest(l()) : null;
|
|
552
550
|
}
|
|
553
|
-
function
|
|
551
|
+
function m(n) {
|
|
554
552
|
return n.hasAttribute("disabled") || n.disabled;
|
|
555
553
|
}
|
|
556
554
|
function b(n, e) {
|
|
@@ -603,7 +601,6 @@ class q extends E {
|
|
|
603
601
|
}
|
|
604
602
|
}
|
|
605
603
|
render() {
|
|
606
|
-
var t;
|
|
607
604
|
const e = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
608
605
|
this.setContent(`
|
|
609
606
|
<style>${R}</style>
|
|
@@ -614,7 +611,7 @@ class q extends E {
|
|
|
614
611
|
<slot name="content"></slot>
|
|
615
612
|
</div>
|
|
616
613
|
<slot></slot>
|
|
617
|
-
`), this._attachSlotListeners(), this._syncStructure(), this._syncHostVisualState(), this._syncBarA11y(), this._open && !this._portalEl ? this._rebuildPanel() : this._open &&
|
|
614
|
+
`), this._attachSlotListeners(), this._syncStructure(), this._syncHostVisualState(), this._syncBarA11y(), this._open && !this._portalEl ? this._rebuildPanel() : this._open && this._positioner?.update();
|
|
618
615
|
}
|
|
619
616
|
open() {
|
|
620
617
|
this.hasAttribute("headless") || this.setAttribute("open", "");
|
|
@@ -626,19 +623,19 @@ class q extends E {
|
|
|
626
623
|
this.hasAttribute("open") ? this.close() : this.open();
|
|
627
624
|
}
|
|
628
625
|
get closeOnSelect() {
|
|
629
|
-
return
|
|
626
|
+
return f(this.getAttribute("close-on-select"), !0);
|
|
630
627
|
}
|
|
631
628
|
set closeOnSelect(e) {
|
|
632
629
|
this.setAttribute("close-on-select", e ? "true" : "false");
|
|
633
630
|
}
|
|
634
631
|
get closeOnScroll() {
|
|
635
|
-
return
|
|
632
|
+
return f(this.getAttribute("close-on-scroll"), !0);
|
|
636
633
|
}
|
|
637
634
|
set closeOnScroll(e) {
|
|
638
635
|
this.setAttribute("close-on-scroll", e ? "true" : "false");
|
|
639
636
|
}
|
|
640
637
|
get typeahead() {
|
|
641
|
-
return
|
|
638
|
+
return f(this.getAttribute("typeahead"), !0);
|
|
642
639
|
}
|
|
643
640
|
set typeahead(e) {
|
|
644
641
|
this.setAttribute("typeahead", e ? "true" : "false");
|
|
@@ -652,37 +649,34 @@ class q extends E {
|
|
|
652
649
|
}
|
|
653
650
|
_syncBarA11y() {
|
|
654
651
|
const e = this.root.querySelector(".bar");
|
|
655
|
-
if (!e)
|
|
656
|
-
return;
|
|
652
|
+
if (!e) return;
|
|
657
653
|
const t = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
658
654
|
e.setAttribute("aria-orientation", t);
|
|
659
655
|
}
|
|
660
656
|
_syncHostVisualState() {
|
|
661
|
-
const e =
|
|
657
|
+
const e = S(this.getAttribute("radius") || this.getAttribute("shape"));
|
|
662
658
|
e ? (this.style.setProperty("--ui-menubar-radius", e), this.style.setProperty("--ui-menubar-item-radius", e === "999px" ? "999px" : `calc(${e} - 2px)`), this.style.setProperty("--ui-menubar-panel-radius", e), this.style.setProperty("--ui-menubar-panel-item-radius", e === "999px" ? "999px" : `calc(${e} - 2px)`)) : (this.style.removeProperty("--ui-menubar-radius"), this.style.removeProperty("--ui-menubar-item-radius"), this.style.removeProperty("--ui-menubar-panel-radius"), this.style.removeProperty("--ui-menubar-panel-item-radius"));
|
|
663
659
|
}
|
|
664
660
|
_onSlotChange() {
|
|
665
661
|
this._syncState();
|
|
666
662
|
}
|
|
667
663
|
_loopEnabled() {
|
|
668
|
-
return
|
|
664
|
+
return f(this.getAttribute("loop"), !0);
|
|
669
665
|
}
|
|
670
666
|
_isOpenAttribute() {
|
|
671
667
|
return this.hasAttribute("open") && !this.hasAttribute("headless");
|
|
672
668
|
}
|
|
673
669
|
_selectedIndex() {
|
|
674
670
|
const e = this.getAttribute("selected");
|
|
675
|
-
if (e == null || e === "")
|
|
676
|
-
return this._items.length > 0 ? 0 : -1;
|
|
671
|
+
if (e == null || e === "") return this._items.length > 0 ? 0 : -1;
|
|
677
672
|
const t = Number(e);
|
|
678
|
-
return Number.isNaN(t) ? this._items.length > 0 ? 0 : -1 : t < 0 ? -1 :
|
|
673
|
+
return Number.isNaN(t) ? this._items.length > 0 ? 0 : -1 : t < 0 ? -1 : A(t, this._items.length);
|
|
679
674
|
}
|
|
680
675
|
_setSelectedAttribute(e) {
|
|
681
676
|
this._ignoreSelected = !0, this.setAttribute("selected", String(e)), this._ignoreSelected = !1;
|
|
682
677
|
}
|
|
683
678
|
_moveIndex(e, t) {
|
|
684
|
-
if (this._items.length === 0)
|
|
685
|
-
return -1;
|
|
679
|
+
if (this._items.length === 0) return -1;
|
|
686
680
|
const a = this._loopEnabled();
|
|
687
681
|
let r = e + t;
|
|
688
682
|
return r < 0 && (r = a ? this._items.length - 1 : 0), r >= this._items.length && (r = a ? 0 : this._items.length - 1), r;
|
|
@@ -715,59 +709,51 @@ class q extends E {
|
|
|
715
709
|
}
|
|
716
710
|
_syncStructure() {
|
|
717
711
|
this._items = this._itemSlot ? this._itemSlot.assignedElements({ flatten: !0 }) : [], this._contents = this._contentSlot ? this._contentSlot.assignedElements({ flatten: !0 }) : [];
|
|
718
|
-
const e = this._selectedIndex(), t =
|
|
712
|
+
const e = this._selectedIndex(), t = g(this._items, {
|
|
719
713
|
activeIndex: this._focusIndex,
|
|
720
714
|
selectedIndex: e,
|
|
721
|
-
getDisabled:
|
|
715
|
+
getDisabled: m
|
|
722
716
|
});
|
|
723
717
|
this._focusIndex = t;
|
|
724
718
|
const a = this._isOpenAttribute();
|
|
725
719
|
this._items.forEach((r, i) => {
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
}), y(this._items, this._items[t] || null, { activeAttribute: null }), this._contents.forEach((r, i) => {
|
|
720
|
+
const s = e === i, o = r.id || `ui-menubar-item-${this._uid}-${i}`, u = this._contents[i]?.id || `ui-menubar-content-${this._uid}-${i}`;
|
|
721
|
+
r.id = o, r.setAttribute("role", "menuitem"), r.setAttribute("tabindex", i === t && !m(r) ? "0" : "-1"), r.setAttribute("aria-haspopup", "menu"), r.setAttribute("aria-expanded", s && a ? "true" : "false"), r.setAttribute("aria-controls", u), r.setAttribute("data-active", s ? "true" : "false");
|
|
722
|
+
}), v(this._items, this._items[t] || null, { activeAttribute: null }), this._contents.forEach((r, i) => {
|
|
730
723
|
const s = r.id || `ui-menubar-content-${this._uid}-${i}`;
|
|
731
724
|
r.id = s, r.setAttribute("role", "menu"), r.setAttribute("tabindex", "-1"), r.setAttribute("aria-hidden", e === i && a ? "false" : "true"), this._items[i] ? r.setAttribute("aria-labelledby", this._items[i].id) : r.removeAttribute("aria-labelledby");
|
|
732
725
|
});
|
|
733
726
|
}
|
|
734
727
|
_hydratePanelItems(e) {
|
|
735
|
-
Array.from(e.querySelectorAll(
|
|
728
|
+
Array.from(e.querySelectorAll(l())).forEach((a, r) => {
|
|
736
729
|
a.getAttribute("role") || a.setAttribute("role", "menuitem"), a.hasAttribute("tabindex") || a.setAttribute("tabindex", "-1"), a.hasAttribute("data-index") || a.setAttribute("data-index", String(r)), a.classList.contains("item") || a.classList.add("item");
|
|
737
730
|
});
|
|
738
731
|
}
|
|
739
732
|
_queryPanelItemsIn(e) {
|
|
740
|
-
|
|
741
|
-
return ((t = this._panelListbox()) == null ? void 0 : t.queryEnabledItems({ container: e || this._panelListbox() })) || [];
|
|
733
|
+
return this._panelListbox()?.queryEnabledItems({ container: e || this._panelListbox() }) || [];
|
|
742
734
|
}
|
|
743
735
|
_submenuFor(e) {
|
|
744
736
|
return e.querySelector(z);
|
|
745
737
|
}
|
|
746
738
|
_setOpenPanelBranch(e, t) {
|
|
747
739
|
const a = this._panelListbox();
|
|
748
|
-
if (!a || (a.querySelectorAll('[data-submenu-open="true"]').forEach((s) => s.removeAttribute("data-submenu-open")), !e))
|
|
749
|
-
return;
|
|
740
|
+
if (!a || (a.querySelectorAll('[data-submenu-open="true"]').forEach((s) => s.removeAttribute("data-submenu-open")), !e)) return;
|
|
750
741
|
const r = [];
|
|
751
742
|
let i = e;
|
|
752
743
|
for (; i; ) {
|
|
753
744
|
const s = i.closest(".submenu");
|
|
754
|
-
if (!s)
|
|
755
|
-
break;
|
|
745
|
+
if (!s) break;
|
|
756
746
|
const o = s.parentElement;
|
|
757
|
-
if (!(o instanceof HTMLElement) || !o.matches(
|
|
758
|
-
break;
|
|
747
|
+
if (!(o instanceof HTMLElement) || !o.matches(l())) break;
|
|
759
748
|
r.unshift(o), i = o;
|
|
760
749
|
}
|
|
761
750
|
r.forEach((s) => s.setAttribute("data-submenu-open", "true")), t && this._submenuFor(e) && e.setAttribute("data-submenu-open", "true");
|
|
762
751
|
}
|
|
763
752
|
_openPanelSubmenu(e, t) {
|
|
764
|
-
var i;
|
|
765
753
|
const a = this._submenuFor(e);
|
|
766
|
-
if (!a ||
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
return !0;
|
|
770
|
-
const r = (i = this._panelListbox()) == null ? void 0 : i.focusBoundary("first", {
|
|
754
|
+
if (!a || _(e)) return !1;
|
|
755
|
+
if (this._setOpenPanelBranch(e, !0), this._schedulePanelSubmenuLayout(), !t) return !0;
|
|
756
|
+
const r = this._panelListbox()?.focusBoundary("first", {
|
|
771
757
|
container: a,
|
|
772
758
|
focus: !0,
|
|
773
759
|
owner: this._panelSurface(),
|
|
@@ -777,10 +763,9 @@ class q extends E {
|
|
|
777
763
|
}
|
|
778
764
|
_closeParentPanelSubmenu(e) {
|
|
779
765
|
const t = e.closest(".submenu");
|
|
780
|
-
if (!t)
|
|
781
|
-
return !1;
|
|
766
|
+
if (!t) return !1;
|
|
782
767
|
const a = t.parentElement;
|
|
783
|
-
return !(a instanceof HTMLElement) || !a.matches(
|
|
768
|
+
return !(a instanceof HTMLElement) || !a.matches(l()) ? !1 : (this._focusPanelItem(a), this._setOpenPanelBranch(a, !1), a.removeAttribute("data-submenu-open"), !0);
|
|
784
769
|
}
|
|
785
770
|
_clearPanelSubmenuState() {
|
|
786
771
|
const e = this._panelListbox();
|
|
@@ -793,18 +778,16 @@ class q extends E {
|
|
|
793
778
|
}
|
|
794
779
|
_layoutPanelSubmenus() {
|
|
795
780
|
const e = this._panelListbox();
|
|
796
|
-
if (!e)
|
|
797
|
-
return;
|
|
781
|
+
if (!e) return;
|
|
798
782
|
const t = window.innerWidth, a = window.innerHeight;
|
|
799
783
|
Array.from(e.querySelectorAll('.item > .submenu, [role="menuitem"] > .submenu, [role="menuitemcheckbox"] > .submenu, [role="menuitemradio"] > .submenu, [data-menu-item] > .submenu')).forEach((i) => {
|
|
800
784
|
const s = i.parentElement;
|
|
801
|
-
if (!(s instanceof HTMLElement))
|
|
802
|
-
return;
|
|
785
|
+
if (!(s instanceof HTMLElement)) return;
|
|
803
786
|
s.removeAttribute("data-submenu-side"), s.removeAttribute("data-submenu-align");
|
|
804
|
-
const o = i.style.display, u = i.style.visibility,
|
|
787
|
+
const o = i.style.display, u = i.style.visibility, c = i.style.pointerEvents, d = i.style.opacity, P = i.style.transform;
|
|
805
788
|
i.style.display = "grid", i.style.visibility = "hidden", i.style.pointerEvents = "none", i.style.opacity = "0", i.style.transform = "none";
|
|
806
|
-
const
|
|
807
|
-
|
|
789
|
+
const p = s.getBoundingClientRect(), h = i.getBoundingClientRect();
|
|
790
|
+
p.right + 4 + h.width > t - 8 && p.left - 4 - h.width >= 8 && s.setAttribute("data-submenu-side", "left"), p.top + h.height > a - 8 && p.bottom - h.height >= 8 && s.setAttribute("data-submenu-align", "up"), i.style.display = o, i.style.visibility = u, i.style.pointerEvents = c, i.style.opacity = d, i.style.transform = P;
|
|
808
791
|
});
|
|
809
792
|
}
|
|
810
793
|
_panelListbox() {
|
|
@@ -814,57 +797,53 @@ class q extends E {
|
|
|
814
797
|
return this._portalSurfaceEl;
|
|
815
798
|
}
|
|
816
799
|
_buildPanelContent(e) {
|
|
817
|
-
var s;
|
|
818
800
|
const t = this._contents[e], a = document.createElement("div");
|
|
819
801
|
a.className = "ui-menubar-portal", a.style.position = "absolute", a.style.pointerEvents = "auto", a.innerHTML = `
|
|
820
802
|
<style>${M}</style>
|
|
821
803
|
<div class="surface menu-panel" part="menu" role="menu" aria-hidden="false" aria-busy="false" tabindex="-1">
|
|
822
804
|
<div class="state-row" part="state"></div>
|
|
823
|
-
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${
|
|
805
|
+
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${l().replace(/"/g, """)}" direct-item-selector=":scope > [slot="menu"] > ${l().replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active"></ui-listbox>
|
|
824
806
|
</div>
|
|
825
807
|
`;
|
|
826
808
|
const r = a.querySelector("ui-listbox.content-host"), i = a.querySelector(".surface");
|
|
827
|
-
if (!r || !i)
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
o.setAttribute("slot", "menu"), r.appendChild(o);
|
|
809
|
+
if (!r || !i) return a;
|
|
810
|
+
if (i.id = t?.id || `ui-menubar-panel-${this._uid}-${e}`, i.setAttribute("aria-labelledby", this._items[e]?.id || ""), this._applyPanelVariantData(a), this._applyPanelTokens(a), t) {
|
|
811
|
+
const s = t.cloneNode(!0);
|
|
812
|
+
s.setAttribute("slot", "menu"), r.appendChild(s);
|
|
832
813
|
}
|
|
833
|
-
if (this._hydratePanelItems(r), r.refresh(), !r.querySelector(
|
|
834
|
-
const
|
|
835
|
-
|
|
814
|
+
if (this._hydratePanelItems(r), r.refresh(), !r.querySelector(l())) {
|
|
815
|
+
const s = document.createElement("div");
|
|
816
|
+
s.className = "empty-state", s.textContent = "No items", r.appendChild(s);
|
|
836
817
|
}
|
|
837
|
-
return a.addEventListener("click", (
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
if (
|
|
841
|
-
|
|
842
|
-
if (this._submenuFor(u)) {
|
|
843
|
-
o.preventDefault(), this._openPanelSubmenu(u, !0);
|
|
818
|
+
return a.addEventListener("click", (s) => {
|
|
819
|
+
const o = w(s);
|
|
820
|
+
if (!o || _(o)) return;
|
|
821
|
+
if (this._submenuFor(o)) {
|
|
822
|
+
s.preventDefault(), this._openPanelSubmenu(o, !0);
|
|
844
823
|
return;
|
|
845
824
|
}
|
|
846
|
-
this._applyPanelSelectionBehavior(
|
|
847
|
-
const
|
|
825
|
+
this._applyPanelSelectionBehavior(o);
|
|
826
|
+
const u = o.getAttribute("data-index"), c = u != null && !Number.isNaN(Number(u)) ? Number(u) : void 0;
|
|
848
827
|
this.dispatchEvent(
|
|
849
828
|
new CustomEvent("select", {
|
|
850
829
|
detail: {
|
|
851
830
|
selected: e,
|
|
852
|
-
index:
|
|
853
|
-
value:
|
|
854
|
-
label:
|
|
855
|
-
checked:
|
|
856
|
-
item:
|
|
831
|
+
index: c,
|
|
832
|
+
value: o.getAttribute("data-value") || o.getAttribute("value") || void 0,
|
|
833
|
+
label: o.getAttribute("aria-label") || o.textContent?.trim() || void 0,
|
|
834
|
+
checked: o.getAttribute("aria-checked") === "true",
|
|
835
|
+
item: o
|
|
857
836
|
},
|
|
858
837
|
bubbles: !0
|
|
859
838
|
})
|
|
860
|
-
), this.closeOnSelect ? this.close() : this._focusPanelItem(
|
|
839
|
+
), this.closeOnSelect ? this.close() : this._focusPanelItem(o);
|
|
861
840
|
}), a.addEventListener("pointerover", this._onPanelPointerOver), a.addEventListener("pointerleave", this._onPanelPointerLeave), a.addEventListener("focusin", this._onPanelFocusIn), a;
|
|
862
841
|
}
|
|
863
842
|
_applyPanelVariantData(e) {
|
|
864
|
-
const t = b(this, "variant"), a = O(this.getAttribute("size") || this.getAttribute("density")), r = b(this, "density"), i = this.getAttribute("radius"), s = b(this, "shape"), o = b(this, "elevation"), u = b(this, "tone"),
|
|
865
|
-
|
|
866
|
-
const
|
|
867
|
-
|
|
843
|
+
const t = b(this, "variant"), a = O(this.getAttribute("size") || this.getAttribute("density")), r = b(this, "density"), i = this.getAttribute("radius"), s = b(this, "shape"), o = b(this, "elevation"), u = b(this, "tone"), c = t === "default" || t === "" ? "" : t === "glass" ? "soft" : t === "line" ? "outline" : t;
|
|
844
|
+
c ? e.setAttribute("data-variant", c) : e.removeAttribute("data-variant"), a !== "md" ? e.setAttribute("data-size", a) : e.removeAttribute("data-size"), r && r !== "default" ? e.setAttribute("data-density", r) : e.removeAttribute("data-density"), i ? e.setAttribute("data-radius", i) : e.removeAttribute("data-radius"), s && s !== "default" ? e.setAttribute("data-shape", s) : e.removeAttribute("data-shape"), o && o !== "default" ? e.setAttribute("data-elevation", o) : e.removeAttribute("data-elevation"), u && u !== "default" && u !== "brand" ? e.setAttribute("data-tone", u) : e.removeAttribute("data-tone"), this._open ? e.setAttribute("data-open", "true") : e.removeAttribute("data-open");
|
|
845
|
+
const d = S(i || s || null);
|
|
846
|
+
d ? (e.style.setProperty("--ui-menubar-panel-radius", d), e.style.setProperty("--ui-menubar-panel-item-radius", d === "999px" ? "999px" : `calc(${d} - 2px)`)) : (e.style.removeProperty("--ui-menubar-panel-radius"), e.style.removeProperty("--ui-menubar-panel-item-radius"));
|
|
868
847
|
}
|
|
869
848
|
_applyPanelTokens(e) {
|
|
870
849
|
const t = window.getComputedStyle(this);
|
|
@@ -931,15 +910,14 @@ class q extends E {
|
|
|
931
910
|
i ? e.style.setProperty(r, i) : e.style.removeProperty(r);
|
|
932
911
|
}), F.forEach(({ prefix: r, from: i, to: s }) => {
|
|
933
912
|
for (let o = i; o <= s; o += 1) {
|
|
934
|
-
const u = `${r}${o}`,
|
|
935
|
-
|
|
913
|
+
const u = `${r}${o}`, c = t.getPropertyValue(u).trim();
|
|
914
|
+
c ? e.style.setProperty(u, c) : e.style.removeProperty(u);
|
|
936
915
|
}
|
|
937
916
|
});
|
|
938
917
|
}
|
|
939
918
|
_syncPanelVisualState() {
|
|
940
919
|
const e = this._portalEl;
|
|
941
|
-
if (!e)
|
|
942
|
-
return;
|
|
920
|
+
if (!e) return;
|
|
943
921
|
this._setPanelFlag("open", this._open), this._applyPanelVariantData(e), this._applyPanelTokens(e);
|
|
944
922
|
const t = this._panelSurface();
|
|
945
923
|
t && (t.setAttribute("aria-hidden", "false"), t.setAttribute("aria-busy", "false"), t.removeAttribute("hidden"), t.style.display = "block", t.style.visibility = "visible", t.style.opacity = "1", t.style.transform = "translateY(0px) scale(1)", t.style.pointerEvents = "auto");
|
|
@@ -947,8 +925,7 @@ class q extends E {
|
|
|
947
925
|
a && (a.textContent = ""), this._schedulePanelSubmenuLayout();
|
|
948
926
|
}
|
|
949
927
|
_rebuildPanel() {
|
|
950
|
-
if (!this._open)
|
|
951
|
-
return;
|
|
928
|
+
if (!this._open) return;
|
|
952
929
|
const e = this._selectedIndex(), t = this._items[e];
|
|
953
930
|
if (e < 0 || !t) {
|
|
954
931
|
this._teardownPanel();
|
|
@@ -980,8 +957,7 @@ class q extends E {
|
|
|
980
957
|
});
|
|
981
958
|
}
|
|
982
959
|
_teardownPanel() {
|
|
983
|
-
|
|
984
|
-
if ((e = this._dismissableLayer) == null || e.destroy(), this._dismissableLayer = null, (t = this._positioner) == null || t.destroy(), this._positioner = null, (a = this._portalEl) != null && a.parentElement)
|
|
960
|
+
if (this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._positioner?.destroy(), this._positioner = null, this._portalEl?.parentElement)
|
|
985
961
|
try {
|
|
986
962
|
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
987
963
|
} catch {
|
|
@@ -989,7 +965,7 @@ class q extends E {
|
|
|
989
965
|
this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._panelForIndex = -1, this._submenuRaf != null && (cancelAnimationFrame(this._submenuRaf), this._submenuRaf = null), this._resetTypeahead();
|
|
990
966
|
}
|
|
991
967
|
_selectIndex(e, t) {
|
|
992
|
-
const a = this._selectedIndex(), r =
|
|
968
|
+
const a = this._selectedIndex(), r = A(e, this._items.length);
|
|
993
969
|
r < 0 || (this._setSelectedAttribute(r), this.setAttribute("open", ""), this._syncState(), this.dispatchEvent(
|
|
994
970
|
new CustomEvent("change", {
|
|
995
971
|
detail: { selected: r, previous: a, open: !0, reason: t },
|
|
@@ -999,33 +975,29 @@ class q extends E {
|
|
|
999
975
|
}
|
|
1000
976
|
_focusItem(e) {
|
|
1001
977
|
const t = this._items[e];
|
|
1002
|
-
t && (this._focusIndex = e,
|
|
978
|
+
t && (this._focusIndex = e, v(this._items, t, { activeAttribute: null }), C(t));
|
|
1003
979
|
}
|
|
1004
980
|
_queryPanelItems() {
|
|
1005
981
|
return this._queryPanelItemsIn(this._panelListbox());
|
|
1006
982
|
}
|
|
1007
983
|
_focusPanelItem(e) {
|
|
1008
|
-
|
|
1009
|
-
e && ((t = this._panelListbox()) == null || t.setActiveItem(e, { focus: !0, owner: this._panelSurface(), scroll: !0 }));
|
|
984
|
+
e && this._panelListbox()?.setActiveItem(e, { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
1010
985
|
}
|
|
1011
986
|
_focusPanelFirst() {
|
|
1012
|
-
|
|
1013
|
-
(e = this._panelListbox()) == null || e.focusBoundary("first", { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
987
|
+
this._panelListbox()?.focusBoundary("first", { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
1014
988
|
}
|
|
1015
989
|
_focusPanelLast() {
|
|
1016
|
-
|
|
1017
|
-
(e = this._panelListbox()) == null || e.focusBoundary("last", { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
990
|
+
this._panelListbox()?.focusBoundary("last", { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
1018
991
|
}
|
|
1019
992
|
_movePanelFocus(e) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
((u = this._panelListbox()) == null ? void 0 : u.move(e, {
|
|
993
|
+
const t = document.activeElement, r = (t && this._portalEl?.contains(t) ? t.closest(l()) : null)?.closest(".submenu") || this._panelListbox();
|
|
994
|
+
this._panelListbox()?.move(e, {
|
|
1023
995
|
container: r,
|
|
1024
|
-
current: t &&
|
|
996
|
+
current: t && this._portalEl?.contains(t) ? t : null,
|
|
1025
997
|
focus: !0,
|
|
1026
998
|
owner: this._panelSurface(),
|
|
1027
999
|
scroll: !0
|
|
1028
|
-
})
|
|
1000
|
+
}) || this._focusPanelFirst();
|
|
1029
1001
|
}
|
|
1030
1002
|
_resetTypeahead() {
|
|
1031
1003
|
this._typeaheadBuffer = "", this._typeaheadTimer != null && (window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = null);
|
|
@@ -1034,29 +1006,26 @@ class q extends E {
|
|
|
1034
1006
|
return e.ctrlKey || e.metaKey || e.altKey ? !1 : e.key.length === 1 && /\S/.test(e.key);
|
|
1035
1007
|
}
|
|
1036
1008
|
_typeaheadOnBar(e) {
|
|
1037
|
-
if (!this.typeahead || !this._isTypeaheadKey(e))
|
|
1038
|
-
return !1;
|
|
1009
|
+
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
1039
1010
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${e.key.toLowerCase()}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 420);
|
|
1040
1011
|
const t = this._items.findIndex((r) => r === e.target || r.contains(e.target)), a = L(this._items, this._typeaheadBuffer, {
|
|
1041
1012
|
startIndex: t,
|
|
1042
1013
|
getLabel: (r) => r.getAttribute("aria-label") || r.textContent || "",
|
|
1043
|
-
getDisabled:
|
|
1014
|
+
getDisabled: m
|
|
1044
1015
|
});
|
|
1045
1016
|
return a < 0 ? !1 : (e.preventDefault(), this._focusItem(a), this._open && this._selectIndex(a, "keyboard"), !0);
|
|
1046
1017
|
}
|
|
1047
1018
|
_typeaheadOnPanel(e) {
|
|
1048
|
-
|
|
1049
|
-
if (!this.typeahead || !this._isTypeaheadKey(e))
|
|
1050
|
-
return !1;
|
|
1019
|
+
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
1051
1020
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${e.key.toLowerCase()}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 420);
|
|
1052
|
-
const t = document.activeElement,
|
|
1053
|
-
return
|
|
1021
|
+
const t = document.activeElement, r = (t && this._portalEl?.contains(t) ? t.closest(l()) : null)?.closest(".submenu") || this._panelListbox();
|
|
1022
|
+
return this._panelListbox()?.typeahead(this._typeaheadBuffer, {
|
|
1054
1023
|
container: r,
|
|
1055
|
-
current: t &&
|
|
1024
|
+
current: t && this._portalEl?.contains(t) ? t : null,
|
|
1056
1025
|
focus: !0,
|
|
1057
1026
|
owner: this._panelSurface(),
|
|
1058
1027
|
scroll: !0
|
|
1059
|
-
})
|
|
1028
|
+
}) || null ? (e.preventDefault(), !0) : !1;
|
|
1060
1029
|
}
|
|
1061
1030
|
_applyPanelSelectionBehavior(e) {
|
|
1062
1031
|
const t = e.getAttribute("role");
|
|
@@ -1065,11 +1034,9 @@ class q extends E {
|
|
|
1065
1034
|
e.setAttribute("aria-checked", s ? "true" : "false"), e.setAttribute("data-state", s ? "checked" : "unchecked");
|
|
1066
1035
|
return;
|
|
1067
1036
|
}
|
|
1068
|
-
if (t !== "menuitemradio")
|
|
1069
|
-
return;
|
|
1037
|
+
if (t !== "menuitemradio") return;
|
|
1070
1038
|
const a = e.closest(".submenu") || this._panelListbox();
|
|
1071
|
-
if (!a)
|
|
1072
|
-
return;
|
|
1039
|
+
if (!a) return;
|
|
1073
1040
|
const r = e.getAttribute("data-group") || e.getAttribute("name") || "";
|
|
1074
1041
|
Array.from(a.querySelectorAll('[role="menuitemradio"]')).forEach((s) => {
|
|
1075
1042
|
r && (s.getAttribute("data-group") || s.getAttribute("name") || "") !== r || (s.setAttribute("aria-checked", "false"), s.setAttribute("data-state", "unchecked"));
|
|
@@ -1077,8 +1044,7 @@ class q extends E {
|
|
|
1077
1044
|
}
|
|
1078
1045
|
_onClick(e) {
|
|
1079
1046
|
const t = e.composedPath(), a = this._items.findIndex((i) => t.includes(i));
|
|
1080
|
-
if (a < 0)
|
|
1081
|
-
return;
|
|
1047
|
+
if (a < 0) return;
|
|
1082
1048
|
if (this._focusItem(a), this._selectedIndex() === a && this._open) {
|
|
1083
1049
|
this.close(), this._syncState();
|
|
1084
1050
|
return;
|
|
@@ -1086,31 +1052,25 @@ class q extends E {
|
|
|
1086
1052
|
this._selectIndex(a, "click");
|
|
1087
1053
|
}
|
|
1088
1054
|
_onMouseMove(e) {
|
|
1089
|
-
if (!this._open)
|
|
1090
|
-
return;
|
|
1055
|
+
if (!this._open) return;
|
|
1091
1056
|
const t = e.composedPath(), a = this._items.findIndex((r) => t.includes(r));
|
|
1092
1057
|
a < 0 || a !== this._selectedIndex() && this._selectIndex(a, "programmatic");
|
|
1093
1058
|
}
|
|
1094
1059
|
_isInternalScrollEvent(e) {
|
|
1095
|
-
var r;
|
|
1096
1060
|
const t = typeof e.composedPath == "function" ? e.composedPath() : [];
|
|
1097
|
-
if (this._portalEl && t.includes(this._portalEl) || this._items.some((
|
|
1098
|
-
return !0;
|
|
1061
|
+
if (this._portalEl && t.includes(this._portalEl) || this._items.some((r) => t.includes(r))) return !0;
|
|
1099
1062
|
const a = e.target;
|
|
1100
|
-
return !!(a instanceof Node && (
|
|
1063
|
+
return !!(a instanceof Node && (this._portalEl?.contains(a) || this._items.some((r) => r.contains(a))));
|
|
1101
1064
|
}
|
|
1102
1065
|
_onDocScroll(e) {
|
|
1103
1066
|
!this._open || !this.closeOnScroll || this._isInternalScrollEvent(e) || this.close();
|
|
1104
1067
|
}
|
|
1105
1068
|
_onPanelPointerOver(e) {
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
const t = P(e);
|
|
1110
|
-
if (!t || g(t))
|
|
1111
|
-
return;
|
|
1069
|
+
if (!this._open) return;
|
|
1070
|
+
const t = w(e);
|
|
1071
|
+
if (!t || _(t)) return;
|
|
1112
1072
|
const a = t.closest(".submenu") || this._panelListbox();
|
|
1113
|
-
|
|
1073
|
+
this._panelListbox()?.setActiveItem(t, {
|
|
1114
1074
|
container: a,
|
|
1115
1075
|
focus: !1,
|
|
1116
1076
|
owner: this._panelSurface(),
|
|
@@ -1118,43 +1078,38 @@ class q extends E {
|
|
|
1118
1078
|
}), this._submenuFor(t) ? this._openPanelSubmenu(t, !1) : this._setOpenPanelBranch(t, !1);
|
|
1119
1079
|
}
|
|
1120
1080
|
_onPanelPointerLeave(e) {
|
|
1121
|
-
if (!(e.currentTarget instanceof HTMLElement))
|
|
1122
|
-
return;
|
|
1081
|
+
if (!(e.currentTarget instanceof HTMLElement)) return;
|
|
1123
1082
|
const t = e.relatedTarget;
|
|
1124
1083
|
t instanceof Node && e.currentTarget.contains(t) || this._clearPanelSubmenuState();
|
|
1125
1084
|
}
|
|
1126
1085
|
_onPanelFocusIn(e) {
|
|
1127
1086
|
const t = e.target;
|
|
1128
|
-
if (!(t instanceof HTMLElement))
|
|
1129
|
-
|
|
1130
|
-
const a = t.closest(c());
|
|
1087
|
+
if (!(t instanceof HTMLElement)) return;
|
|
1088
|
+
const a = t.closest(l());
|
|
1131
1089
|
a && (this._submenuFor(a) ? this._setOpenPanelBranch(a, !0) : this._setOpenPanelBranch(a, !1));
|
|
1132
1090
|
}
|
|
1133
1091
|
_onKeyDown(e) {
|
|
1134
1092
|
const t = this._items.findIndex((o) => o === e.target || o.contains(e.target));
|
|
1135
|
-
if (t < 0)
|
|
1136
|
-
return;
|
|
1093
|
+
if (t < 0) return;
|
|
1137
1094
|
const a = getComputedStyle(this).direction === "rtl" ? "rtl" : "ltr";
|
|
1138
1095
|
let r = !1, i = t;
|
|
1139
|
-
const s =
|
|
1096
|
+
const s = g(this._items, {
|
|
1140
1097
|
activeIndex: t,
|
|
1141
1098
|
selectedIndex: this._selectedIndex(),
|
|
1142
|
-
getDisabled:
|
|
1099
|
+
getDisabled: m
|
|
1143
1100
|
});
|
|
1144
|
-
e.key === "ArrowRight" ? (i =
|
|
1101
|
+
e.key === "ArrowRight" ? (i = y(this._items, t, a === "rtl" ? -1 : 1, {
|
|
1145
1102
|
wrap: this._loopEnabled(),
|
|
1146
1103
|
fallbackIndex: s,
|
|
1147
|
-
getDisabled:
|
|
1148
|
-
}), r = !0) : e.key === "ArrowLeft" ? (i =
|
|
1104
|
+
getDisabled: m
|
|
1105
|
+
}), r = !0) : e.key === "ArrowLeft" ? (i = y(this._items, t, a === "rtl" ? 1 : -1, {
|
|
1149
1106
|
wrap: this._loopEnabled(),
|
|
1150
1107
|
fallbackIndex: s,
|
|
1151
|
-
getDisabled:
|
|
1152
|
-
}), r = !0) : e.key === "Home" ? (i =
|
|
1108
|
+
getDisabled: m
|
|
1109
|
+
}), r = !0) : e.key === "Home" ? (i = x(this._items, "first", m), r = !0) : e.key === "End" ? (i = x(this._items, "last", m), r = !0) : e.key === "Enter" || e.key === " " ? (this._selectIndex(t, "keyboard"), r = !0) : e.key === "ArrowDown" ? (this._selectIndex(t, "keyboard"), setTimeout(() => this._focusPanelFirst(), 0), r = !0) : e.key === "ArrowUp" && (this._selectIndex(t, "keyboard"), setTimeout(() => this._focusPanelLast(), 0), r = !0), !(!r && this._typeaheadOnBar(e)) && r && (e.preventDefault(), i >= 0 && i !== t && (this._focusItem(i), this._open && this._selectIndex(i, "keyboard")));
|
|
1153
1110
|
}
|
|
1154
1111
|
_onDocKeyDown(e) {
|
|
1155
|
-
|
|
1156
|
-
if (!this._open || !(!!this._portalEl && e.composedPath().includes(this._portalEl)) || this._typeaheadOnPanel(e))
|
|
1157
|
-
return;
|
|
1112
|
+
if (!this._open || !(!!this._portalEl && e.composedPath().includes(this._portalEl)) || this._typeaheadOnPanel(e)) return;
|
|
1158
1113
|
if (e.key === "ArrowDown") {
|
|
1159
1114
|
e.preventDefault(), this._movePanelFocus(1);
|
|
1160
1115
|
return;
|
|
@@ -1171,7 +1126,7 @@ class q extends E {
|
|
|
1171
1126
|
e.preventDefault(), this._focusPanelLast();
|
|
1172
1127
|
return;
|
|
1173
1128
|
}
|
|
1174
|
-
const a = document.activeElement, r = a
|
|
1129
|
+
const a = document.activeElement, r = a?.closest(l());
|
|
1175
1130
|
if (e.key === "ArrowRight" && r && this._openPanelSubmenu(r, !0)) {
|
|
1176
1131
|
e.preventDefault();
|
|
1177
1132
|
return;
|
|
@@ -1185,8 +1140,7 @@ class q extends E {
|
|
|
1185
1140
|
return;
|
|
1186
1141
|
}
|
|
1187
1142
|
if (e.key === "Enter" || e.key === " ") {
|
|
1188
|
-
if (!a || !
|
|
1189
|
-
return;
|
|
1143
|
+
if (!a || !this._portalEl?.contains(a) || !r || _(r) || (e.preventDefault(), this._openPanelSubmenu(r, !0))) return;
|
|
1190
1144
|
r.click();
|
|
1191
1145
|
}
|
|
1192
1146
|
}
|