@editora/ui-core 0.1.25 → 0.2.1
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 +132 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +92 -53
- package/dist/alert-dialog.esm.js +211 -159
- package/dist/alert.cjs.js +42 -33
- package/dist/alert.esm.js +80 -71
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +9 -9
- package/dist/animated-text.esm.js +9 -9
- package/dist/app-header.cjs.js +17 -12
- package/dist/app-header.esm.js +18 -13
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +16 -20
- package/dist/avatar.esm.js +16 -20
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-D-mXMgqc.js → calendar-CzpWDxLc.js} +56 -46
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DkSDFg33.mjs} +127 -117
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +58 -52
- package/dist/chart.esm.js +101 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +9 -13
- package/dist/collapsible.esm.js +9 -13
- package/dist/color-picker.cjs.js +38 -19
- package/dist/color-picker.esm.js +134 -115
- package/dist/combobox.cjs.js +60 -57
- package/dist/combobox.esm.js +96 -92
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-chart.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.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.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +21 -18
- package/dist/data-table.esm.js +210 -190
- package/dist/date-field.cjs.js +9 -9
- package/dist/date-field.esm.js +19 -19
- package/dist/date-picker.cjs.js +29 -20
- package/dist/date-picker.esm.js +59 -50
- package/dist/date-range-picker.cjs.js +24 -19
- package/dist/date-range-picker.esm.js +86 -81
- package/dist/date-range-time-picker.cjs.js +27 -20
- package/dist/date-range-time-picker.esm.js +24 -17
- package/dist/date-time-picker.cjs.js +24 -17
- package/dist/date-time-picker.esm.js +89 -82
- package/dist/date-time-utils-C-4eHTyy.js +1 -0
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-zAx4ghvC.mjs} +75 -68
- package/dist/description.cjs.js +4 -4
- package/dist/description.esm.js +4 -4
- package/dist/dialog.cjs.js +59 -43
- package/dist/dialog.esm.js +86 -53
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +7 -7
- package/dist/field.cjs.js +23 -14
- package/dist/field.esm.js +30 -21
- package/dist/fieldset.cjs.js +16 -9
- package/dist/fieldset.esm.js +19 -12
- package/dist/file-upload.cjs.js +79 -37
- package/dist/file-upload.esm.js +154 -112
- package/dist/flex.cjs.js +2 -2
- package/dist/flex.esm.js +8 -8
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +24 -27
- package/dist/form.esm.js +24 -27
- package/dist/gantt.cjs.js +13 -11
- package/dist/gantt.esm.js +13 -11
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +8 -8
- package/dist/hover-card.esm.js +18 -15
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +50 -22
- package/dist/inline-edit.esm.js +77 -49
- package/dist/input.cjs.js +45 -38
- package/dist/input.esm.js +60 -53
- package/dist/label.cjs.js +6 -6
- package/dist/label.esm.js +6 -6
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/masonry-grid.cjs.js +2 -2
- package/dist/masonry-grid.esm.js +11 -11
- package/dist/{menu-item-styles-IGSFLAHu.mjs → menu-item-styles-CdqxPUuw.mjs} +15 -15
- package/dist/{menu-item-styles-B4onAr4C.js → menu-item-styles-DUdyjQ7i.js} +10 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +53 -40
- package/dist/multi-select.esm.js +87 -73
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +28 -17
- package/dist/number-field.esm.js +37 -26
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +10 -10
- package/dist/odometer.cjs.js +9 -9
- package/dist/odometer.esm.js +17 -17
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +39 -34
- package/dist/password-field.esm.js +63 -58
- package/dist/pin-input.cjs.js +18 -14
- package/dist/pin-input.esm.js +24 -20
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +14 -14
- package/dist/quick-actions.esm.js +12 -12
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +16 -13
- package/dist/radio.esm.js +16 -13
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-BRT7E4A8.mjs} +563 -531
- package/dist/runtime-CXw4SGV9.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +42 -75
- package/dist/select.esm.js +57 -89
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/separator.cjs.js +6 -6
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +29 -28
- package/dist/sidebar.esm.js +32 -31
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/sortable.cjs.js +10 -11
- package/dist/sortable.esm.js +10 -11
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +7 -7
- package/dist/split-button.esm.js +17 -16
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +101 -26
- package/dist/tabs.esm.js +187 -112
- package/dist/tags-input.cjs.js +43 -17
- package/dist/tags-input.esm.js +75 -49
- package/dist/textarea.cjs.js +34 -35
- package/dist/textarea.esm.js +50 -51
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +8 -8
- package/dist/time-field.esm.js +29 -29
- package/dist/time-picker.cjs.js +17 -14
- package/dist/time-picker.esm.js +28 -25
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +2 -2
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +37 -38
- package/dist/transfer-list.esm.js +32 -33
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +51 -39
- package/dist/wizard.esm.js +51 -39
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/menubar.esm.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { E } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
-
import { b as k } from "./portal-
|
|
2
|
+
import { b as k } from "./portal-DeaM1tYY.mjs";
|
|
3
3
|
import { d as L } from "./collection-C7URGjEI.mjs";
|
|
4
4
|
import { c as I } from "./dismissable-layer-BmPIoK80.mjs";
|
|
5
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-
|
|
6
|
+
import { e as T } from "./positioner-BE8Nbho2.mjs";
|
|
7
|
+
import { O as D, o as z, r as O, a as B } from "./overlay-motion-BX3dPLay.mjs";
|
|
7
8
|
import "./listbox-hMVOhKHC.mjs";
|
|
8
|
-
import { c as
|
|
9
|
-
const
|
|
9
|
+
import { c as F } from "./menu-item-styles-CdqxPUuw.mjs";
|
|
10
|
+
const R = ":scope > .submenu", M = [
|
|
10
11
|
"--ui-color-primary",
|
|
11
12
|
"--ui-color-primary-hover",
|
|
12
13
|
"--ui-color-foreground-on-primary",
|
|
@@ -41,7 +42,7 @@ const z = ":scope > .submenu", B = [
|
|
|
41
42
|
"--accent-surface",
|
|
42
43
|
"--accent-indicator",
|
|
43
44
|
"--accent-track"
|
|
44
|
-
],
|
|
45
|
+
], $ = [
|
|
45
46
|
{ prefix: "--accent-", from: 1, to: 12 },
|
|
46
47
|
{ prefix: "--accent-a", from: 1, to: 12 },
|
|
47
48
|
{ prefix: "--gray-", from: 1, to: 12 },
|
|
@@ -51,17 +52,17 @@ const z = ":scope > .submenu", B = [
|
|
|
51
52
|
{ prefix: "--shadow-", from: 1, to: 6 },
|
|
52
53
|
{ prefix: "--radius-", from: 1, to: 6 }
|
|
53
54
|
];
|
|
54
|
-
function
|
|
55
|
+
function H(n) {
|
|
55
56
|
return n === "sm" || n === "1" || n === "compact" ? "sm" : n === "lg" || n === "3" || n === "comfortable" ? "lg" : "md";
|
|
56
57
|
}
|
|
57
58
|
function S(n) {
|
|
58
59
|
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;
|
|
59
60
|
}
|
|
60
|
-
const
|
|
61
|
+
const q = `
|
|
61
62
|
:host {
|
|
62
63
|
--ui-menubar-gap: var(--base-menubar-gap, 6px);
|
|
63
64
|
--ui-menubar-padding: var(--base-menubar-padding, 6px);
|
|
64
|
-
--ui-menubar-radius: var(--base-menubar-radius, var(--ui-radius,
|
|
65
|
+
--ui-menubar-radius: var(--base-menubar-radius, var(--ui-radius, 6px));
|
|
65
66
|
--ui-menubar-bg: var(--base-menubar-bg, var(--color-panel-solid, var(--ui-color-surface, #ffffff)));
|
|
66
67
|
--ui-menubar-border: var(--base-menubar-border, 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 86%, transparent));
|
|
67
68
|
--ui-menubar-shadow: var(--base-menubar-shadow, var(--shadow-2, none));
|
|
@@ -263,7 +264,9 @@ const R = `
|
|
|
263
264
|
border-color: Highlight;
|
|
264
265
|
}
|
|
265
266
|
}
|
|
266
|
-
`,
|
|
267
|
+
`, N = `
|
|
268
|
+
${D}
|
|
269
|
+
|
|
267
270
|
.ui-menubar-portal {
|
|
268
271
|
position: absolute;
|
|
269
272
|
pointer-events: auto;
|
|
@@ -286,12 +289,7 @@ const R = `
|
|
|
286
289
|
background: var(--ui-menubar-panel-bg, #fff);
|
|
287
290
|
color: var(--ui-menubar-panel-color, #0f172a);
|
|
288
291
|
box-shadow: var(--ui-menubar-panel-shadow);
|
|
289
|
-
opacity: 0;
|
|
290
|
-
transform: translateY(5px) scale(0.984);
|
|
291
|
-
transform-origin: top left;
|
|
292
|
-
animation: ui-menubar-panel-enter 160ms cubic-bezier(0.2, 0.9, 0.24, 1) forwards;
|
|
293
292
|
outline: none;
|
|
294
|
-
will-change: transform, opacity;
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
.ui-menubar-portal .surface[data-placement="top"] {
|
|
@@ -368,7 +366,7 @@ const R = `
|
|
|
368
366
|
0 6px 18px rgba(2, 6, 23, 0.14);
|
|
369
367
|
}
|
|
370
368
|
|
|
371
|
-
${
|
|
369
|
+
${F({
|
|
372
370
|
scopes: [".ui-menubar-portal .content-host"],
|
|
373
371
|
prefix: "--ui-menubar-panel",
|
|
374
372
|
shortcutSelectors: [".shortcut", ".meta"],
|
|
@@ -487,25 +485,6 @@ const R = `
|
|
|
487
485
|
opacity: 0.72;
|
|
488
486
|
}
|
|
489
487
|
|
|
490
|
-
@keyframes ui-menubar-panel-enter {
|
|
491
|
-
from {
|
|
492
|
-
opacity: 0;
|
|
493
|
-
transform: translateY(5px) scale(0.984);
|
|
494
|
-
}
|
|
495
|
-
to {
|
|
496
|
-
opacity: 1;
|
|
497
|
-
transform: translateY(0) scale(1);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
@media (prefers-reduced-motion: reduce) {
|
|
502
|
-
.ui-menubar-portal .surface {
|
|
503
|
-
animation: none;
|
|
504
|
-
opacity: 1;
|
|
505
|
-
transform: none;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
|
|
509
488
|
@media (prefers-contrast: more) {
|
|
510
489
|
.ui-menubar-portal .surface {
|
|
511
490
|
border-width: 2px;
|
|
@@ -513,11 +492,11 @@ const R = `
|
|
|
513
492
|
}
|
|
514
493
|
}
|
|
515
494
|
`;
|
|
516
|
-
function
|
|
495
|
+
function V(n) {
|
|
517
496
|
return n === "top" || n === "left" || n === "right" ? n : "bottom";
|
|
518
497
|
}
|
|
519
|
-
function
|
|
520
|
-
const e =
|
|
498
|
+
function K(n) {
|
|
499
|
+
const e = V(n);
|
|
521
500
|
return e === "top" ? "top" : e === "left" ? "left" : e === "right" ? "right" : "bottom";
|
|
522
501
|
}
|
|
523
502
|
function f(n, e) {
|
|
@@ -542,9 +521,9 @@ function _(n) {
|
|
|
542
521
|
}
|
|
543
522
|
function w(n) {
|
|
544
523
|
const e = typeof n.composedPath == "function" ? n.composedPath() : [];
|
|
545
|
-
for (const
|
|
546
|
-
if (
|
|
547
|
-
return
|
|
524
|
+
for (const r of e)
|
|
525
|
+
if (r instanceof HTMLElement && r.matches(l()))
|
|
526
|
+
return r;
|
|
548
527
|
const t = n.target;
|
|
549
528
|
return t instanceof HTMLElement ? t.closest(l()) : null;
|
|
550
529
|
}
|
|
@@ -554,7 +533,7 @@ function m(n) {
|
|
|
554
533
|
function b(n, e) {
|
|
555
534
|
return n.getAttribute(e) || "";
|
|
556
535
|
}
|
|
557
|
-
class
|
|
536
|
+
class G extends E {
|
|
558
537
|
constructor() {
|
|
559
538
|
super(), this._items = [], this._contents = [], this._itemSlot = null, this._contentSlot = null, this._uid = Math.random().toString(36).slice(2, 8), this._ignoreSelected = !1, this._open = !1, this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._positioner = null, this._dismissableLayer = null, this._panelForIndex = -1, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._submenuRaf = null, this._globalListenersBound = !1, this._focusIndex = -1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onDocKeyDown = this._onDocKeyDown.bind(this), this._onDocScroll = this._onDocScroll.bind(this), this._onSlotChange = this._onSlotChange.bind(this), this._onMouseMove = this._onMouseMove.bind(this), this._onPanelPointerOver = this._onPanelPointerOver.bind(this), this._onPanelPointerLeave = this._onPanelPointerLeave.bind(this), this._onPanelFocusIn = this._onPanelFocusIn.bind(this);
|
|
560
539
|
}
|
|
@@ -587,8 +566,8 @@ class q extends E {
|
|
|
587
566
|
disconnectedCallback() {
|
|
588
567
|
this.root.removeEventListener("click", this._onClick), this.root.removeEventListener("keydown", this._onKeyDown), this.root.removeEventListener("mousemove", this._onMouseMove), this._unbindGlobalListeners(), this._detachSlotListeners(), this._teardownPanel(), super.disconnectedCallback();
|
|
589
568
|
}
|
|
590
|
-
attributeChangedCallback(e, t,
|
|
591
|
-
if (t !==
|
|
569
|
+
attributeChangedCallback(e, t, r) {
|
|
570
|
+
if (t !== r && !(e === "selected" && this._ignoreSelected)) {
|
|
592
571
|
if ((e === "radius" || e === "shape") && this._syncHostVisualState(), this._syncBarA11y(), this._open && e === "placement") {
|
|
593
572
|
this._rebuildPanel();
|
|
594
573
|
return;
|
|
@@ -603,7 +582,7 @@ class q extends E {
|
|
|
603
582
|
render() {
|
|
604
583
|
const e = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal";
|
|
605
584
|
this.setContent(`
|
|
606
|
-
<style>${
|
|
585
|
+
<style>${q}</style>
|
|
607
586
|
<div class="bar" part="bar" role="menubar" aria-orientation="${e}">
|
|
608
587
|
<slot name="item"></slot>
|
|
609
588
|
</div>
|
|
@@ -677,9 +656,9 @@ class q extends E {
|
|
|
677
656
|
}
|
|
678
657
|
_moveIndex(e, t) {
|
|
679
658
|
if (this._items.length === 0) return -1;
|
|
680
|
-
const
|
|
681
|
-
let
|
|
682
|
-
return
|
|
659
|
+
const r = this._loopEnabled();
|
|
660
|
+
let a = e + t;
|
|
661
|
+
return a < 0 && (a = r ? this._items.length - 1 : 0), a >= this._items.length && (a = r ? 0 : this._items.length - 1), a;
|
|
683
662
|
}
|
|
684
663
|
_syncState() {
|
|
685
664
|
this._syncStructure();
|
|
@@ -695,11 +674,11 @@ class q extends E {
|
|
|
695
674
|
else {
|
|
696
675
|
this._unbindGlobalListeners();
|
|
697
676
|
const t = this._panelForIndex >= 0 ? this._panelForIndex : this._selectedIndex();
|
|
698
|
-
this._teardownPanel(), this.dispatchEvent(new CustomEvent("close", { detail: { previous: t }, bubbles: !0 }));
|
|
677
|
+
this._teardownPanel(!0), this.dispatchEvent(new CustomEvent("close", { detail: { previous: t }, bubbles: !0 }));
|
|
699
678
|
}
|
|
700
679
|
return;
|
|
701
680
|
}
|
|
702
|
-
this._open ? (this._bindGlobalListeners(), (this._selectedIndex() !== this._panelForIndex || !this._portalEl) && this._rebuildPanel()) : (this._unbindGlobalListeners(), this._teardownPanel());
|
|
681
|
+
this._open ? (this._bindGlobalListeners(), (this._selectedIndex() !== this._panelForIndex || !this._portalEl) && this._rebuildPanel()) : (this._unbindGlobalListeners(), this._teardownPanel(!0));
|
|
703
682
|
}
|
|
704
683
|
_bindGlobalListeners() {
|
|
705
684
|
this._globalListenersBound || (document.addEventListener("keydown", this._onDocKeyDown), document.addEventListener("scroll", this._onDocScroll, { passive: !0, capture: !0 }), this._globalListenersBound = !0);
|
|
@@ -715,57 +694,57 @@ class q extends E {
|
|
|
715
694
|
getDisabled: m
|
|
716
695
|
});
|
|
717
696
|
this._focusIndex = t;
|
|
718
|
-
const
|
|
719
|
-
this._items.forEach((
|
|
720
|
-
const s = e === i, o =
|
|
721
|
-
|
|
722
|
-
}), v(this._items, this._items[t] || null, { activeAttribute: null }), this._contents.forEach((
|
|
723
|
-
const s =
|
|
724
|
-
|
|
697
|
+
const r = this._isOpenAttribute();
|
|
698
|
+
this._items.forEach((a, i) => {
|
|
699
|
+
const s = e === i, o = a.id || `ui-menubar-item-${this._uid}-${i}`, u = this._contents[i]?.id || `ui-menubar-content-${this._uid}-${i}`;
|
|
700
|
+
a.id = o, a.setAttribute("role", "menuitem"), a.setAttribute("tabindex", i === t && !m(a) ? "0" : "-1"), a.setAttribute("aria-haspopup", "menu"), a.setAttribute("aria-expanded", s && r ? "true" : "false"), a.setAttribute("aria-controls", u), a.setAttribute("data-active", s ? "true" : "false");
|
|
701
|
+
}), v(this._items, this._items[t] || null, { activeAttribute: null }), this._contents.forEach((a, i) => {
|
|
702
|
+
const s = a.id || `ui-menubar-content-${this._uid}-${i}`;
|
|
703
|
+
a.id = s, a.setAttribute("role", "menu"), a.setAttribute("tabindex", "-1"), a.setAttribute("aria-hidden", e === i && r ? "false" : "true"), this._items[i] ? a.setAttribute("aria-labelledby", this._items[i].id) : a.removeAttribute("aria-labelledby");
|
|
725
704
|
});
|
|
726
705
|
}
|
|
727
706
|
_hydratePanelItems(e) {
|
|
728
|
-
Array.from(e.querySelectorAll(l())).forEach((
|
|
729
|
-
|
|
707
|
+
Array.from(e.querySelectorAll(l())).forEach((r, a) => {
|
|
708
|
+
r.getAttribute("role") || r.setAttribute("role", "menuitem"), r.hasAttribute("tabindex") || r.setAttribute("tabindex", "-1"), r.hasAttribute("data-index") || r.setAttribute("data-index", String(a)), r.classList.contains("item") || r.classList.add("item");
|
|
730
709
|
});
|
|
731
710
|
}
|
|
732
711
|
_queryPanelItemsIn(e) {
|
|
733
712
|
return this._panelListbox()?.queryEnabledItems({ container: e || this._panelListbox() }) || [];
|
|
734
713
|
}
|
|
735
714
|
_submenuFor(e) {
|
|
736
|
-
return e.querySelector(
|
|
715
|
+
return e.querySelector(R);
|
|
737
716
|
}
|
|
738
717
|
_setOpenPanelBranch(e, t) {
|
|
739
|
-
const
|
|
740
|
-
if (!
|
|
741
|
-
const
|
|
718
|
+
const r = this._panelListbox();
|
|
719
|
+
if (!r || (r.querySelectorAll('[data-submenu-open="true"]').forEach((s) => s.removeAttribute("data-submenu-open")), !e)) return;
|
|
720
|
+
const a = [];
|
|
742
721
|
let i = e;
|
|
743
722
|
for (; i; ) {
|
|
744
723
|
const s = i.closest(".submenu");
|
|
745
724
|
if (!s) break;
|
|
746
725
|
const o = s.parentElement;
|
|
747
726
|
if (!(o instanceof HTMLElement) || !o.matches(l())) break;
|
|
748
|
-
|
|
727
|
+
a.unshift(o), i = o;
|
|
749
728
|
}
|
|
750
|
-
|
|
729
|
+
a.forEach((s) => s.setAttribute("data-submenu-open", "true")), t && this._submenuFor(e) && e.setAttribute("data-submenu-open", "true");
|
|
751
730
|
}
|
|
752
731
|
_openPanelSubmenu(e, t) {
|
|
753
|
-
const
|
|
754
|
-
if (!
|
|
732
|
+
const r = this._submenuFor(e);
|
|
733
|
+
if (!r || _(e)) return !1;
|
|
755
734
|
if (this._setOpenPanelBranch(e, !0), this._schedulePanelSubmenuLayout(), !t) return !0;
|
|
756
|
-
const
|
|
757
|
-
container:
|
|
735
|
+
const a = this._panelListbox()?.focusBoundary("first", {
|
|
736
|
+
container: r,
|
|
758
737
|
focus: !0,
|
|
759
738
|
owner: this._panelSurface(),
|
|
760
739
|
scroll: !0
|
|
761
740
|
});
|
|
762
|
-
return
|
|
741
|
+
return a && this._setOpenPanelBranch(a, !1), !0;
|
|
763
742
|
}
|
|
764
743
|
_closeParentPanelSubmenu(e) {
|
|
765
744
|
const t = e.closest(".submenu");
|
|
766
745
|
if (!t) return !1;
|
|
767
|
-
const
|
|
768
|
-
return !(
|
|
746
|
+
const r = t.parentElement;
|
|
747
|
+
return !(r instanceof HTMLElement) || !r.matches(l()) ? !1 : (this._focusPanelItem(r), this._setOpenPanelBranch(r, !1), r.removeAttribute("data-submenu-open"), !0);
|
|
769
748
|
}
|
|
770
749
|
_clearPanelSubmenuState() {
|
|
771
750
|
const e = this._panelListbox();
|
|
@@ -779,7 +758,7 @@ class q extends E {
|
|
|
779
758
|
_layoutPanelSubmenus() {
|
|
780
759
|
const e = this._panelListbox();
|
|
781
760
|
if (!e) return;
|
|
782
|
-
const t = window.innerWidth,
|
|
761
|
+
const t = window.innerWidth, r = window.innerHeight;
|
|
783
762
|
Array.from(e.querySelectorAll('.item > .submenu, [role="menuitem"] > .submenu, [role="menuitemcheckbox"] > .submenu, [role="menuitemradio"] > .submenu, [data-menu-item] > .submenu')).forEach((i) => {
|
|
784
763
|
const s = i.parentElement;
|
|
785
764
|
if (!(s instanceof HTMLElement)) return;
|
|
@@ -787,7 +766,7 @@ class q extends E {
|
|
|
787
766
|
const o = i.style.display, u = i.style.visibility, c = i.style.pointerEvents, d = i.style.opacity, P = i.style.transform;
|
|
788
767
|
i.style.display = "grid", i.style.visibility = "hidden", i.style.pointerEvents = "none", i.style.opacity = "0", i.style.transform = "none";
|
|
789
768
|
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 >
|
|
769
|
+
p.right + 4 + h.width > t - 8 && p.left - 4 - h.width >= 8 && s.setAttribute("data-submenu-side", "left"), p.top + h.height > r - 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;
|
|
791
770
|
});
|
|
792
771
|
}
|
|
793
772
|
_panelListbox() {
|
|
@@ -797,25 +776,25 @@ class q extends E {
|
|
|
797
776
|
return this._portalSurfaceEl;
|
|
798
777
|
}
|
|
799
778
|
_buildPanelContent(e) {
|
|
800
|
-
const t = this._contents[e],
|
|
801
|
-
|
|
802
|
-
<style>${
|
|
779
|
+
const t = this._contents[e], r = document.createElement("div");
|
|
780
|
+
r.className = "ui-menubar-portal", r.style.position = "absolute", r.style.pointerEvents = "auto", r.innerHTML = `
|
|
781
|
+
<style>${N}</style>
|
|
803
782
|
<div class="surface menu-panel" part="menu" role="menu" aria-hidden="false" aria-busy="false" tabindex="-1">
|
|
804
783
|
<div class="state-row" part="state"></div>
|
|
805
784
|
<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>
|
|
806
785
|
</div>
|
|
807
786
|
`;
|
|
808
|
-
const
|
|
809
|
-
if (!
|
|
810
|
-
if (i.id = t?.id || `ui-menubar-panel-${this._uid}-${e}`, i.setAttribute("aria-labelledby", this._items[e]?.id || ""), this._applyPanelVariantData(
|
|
787
|
+
const a = r.querySelector("ui-listbox.content-host"), i = r.querySelector(".surface");
|
|
788
|
+
if (!a || !i) return r;
|
|
789
|
+
if (i.id = t?.id || `ui-menubar-panel-${this._uid}-${e}`, i.setAttribute("aria-labelledby", this._items[e]?.id || ""), this._applyPanelVariantData(r), this._applyPanelTokens(r), t) {
|
|
811
790
|
const s = t.cloneNode(!0);
|
|
812
|
-
s.setAttribute("slot", "menu"),
|
|
791
|
+
s.setAttribute("slot", "menu"), a.appendChild(s);
|
|
813
792
|
}
|
|
814
|
-
if (this._hydratePanelItems(
|
|
793
|
+
if (this._hydratePanelItems(a), a.refresh(), !a.querySelector(l())) {
|
|
815
794
|
const s = document.createElement("div");
|
|
816
|
-
s.className = "empty-state", s.textContent = "No items",
|
|
795
|
+
s.className = "empty-state", s.textContent = "No items", a.appendChild(s);
|
|
817
796
|
}
|
|
818
|
-
return
|
|
797
|
+
return r.addEventListener("click", (s) => {
|
|
819
798
|
const o = w(s);
|
|
820
799
|
if (!o || _(o)) return;
|
|
821
800
|
if (this._submenuFor(o)) {
|
|
@@ -837,11 +816,11 @@ class q extends E {
|
|
|
837
816
|
bubbles: !0
|
|
838
817
|
})
|
|
839
818
|
), this.closeOnSelect ? this.close() : this._focusPanelItem(o);
|
|
840
|
-
}),
|
|
819
|
+
}), r.addEventListener("pointerover", this._onPanelPointerOver), r.addEventListener("pointerleave", this._onPanelPointerLeave), r.addEventListener("focusin", this._onPanelFocusIn), r;
|
|
841
820
|
}
|
|
842
821
|
_applyPanelVariantData(e) {
|
|
843
|
-
const t = b(this, "variant"),
|
|
844
|
-
c ? e.setAttribute("data-variant", c) : e.removeAttribute("data-variant"),
|
|
822
|
+
const t = b(this, "variant"), r = H(this.getAttribute("size") || this.getAttribute("density")), a = 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;
|
|
823
|
+
c ? e.setAttribute("data-variant", c) : e.removeAttribute("data-variant"), r !== "md" ? e.setAttribute("data-size", r) : e.removeAttribute("data-size"), a && a !== "default" ? e.setAttribute("data-density", a) : 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
824
|
const d = S(i || s || null);
|
|
846
825
|
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"));
|
|
847
826
|
}
|
|
@@ -902,15 +881,15 @@ class q extends E {
|
|
|
902
881
|
"--ui-menubar-panel-separator-margin",
|
|
903
882
|
"--ui-menubar-panel-item-hover-bg",
|
|
904
883
|
"--ui-menubar-panel-item-active-color"
|
|
905
|
-
].forEach((
|
|
906
|
-
const i = t.getPropertyValue(
|
|
907
|
-
i ? e.style.setProperty(
|
|
908
|
-
}),
|
|
909
|
-
const i = t.getPropertyValue(
|
|
910
|
-
i ? e.style.setProperty(
|
|
911
|
-
}),
|
|
884
|
+
].forEach((a) => {
|
|
885
|
+
const i = t.getPropertyValue(a).trim();
|
|
886
|
+
i ? e.style.setProperty(a, i) : e.style.removeProperty(a);
|
|
887
|
+
}), M.forEach((a) => {
|
|
888
|
+
const i = t.getPropertyValue(a).trim();
|
|
889
|
+
i ? e.style.setProperty(a, i) : e.style.removeProperty(a);
|
|
890
|
+
}), $.forEach(({ prefix: a, from: i, to: s }) => {
|
|
912
891
|
for (let o = i; o <= s; o += 1) {
|
|
913
|
-
const u = `${
|
|
892
|
+
const u = `${a}${o}`, c = t.getPropertyValue(u).trim();
|
|
914
893
|
c ? e.style.setProperty(u, c) : e.style.removeProperty(u);
|
|
915
894
|
}
|
|
916
895
|
});
|
|
@@ -921,8 +900,8 @@ class q extends E {
|
|
|
921
900
|
this._setPanelFlag("open", this._open), this._applyPanelVariantData(e), this._applyPanelTokens(e);
|
|
922
901
|
const t = this._panelSurface();
|
|
923
902
|
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");
|
|
924
|
-
const
|
|
925
|
-
|
|
903
|
+
const r = e.querySelector(".state-row");
|
|
904
|
+
r && (r.textContent = ""), this._schedulePanelSubmenuLayout();
|
|
926
905
|
}
|
|
927
906
|
_rebuildPanel() {
|
|
928
907
|
if (!this._open) return;
|
|
@@ -932,43 +911,38 @@ class q extends E {
|
|
|
932
911
|
return;
|
|
933
912
|
}
|
|
934
913
|
this._teardownPanel();
|
|
935
|
-
const
|
|
936
|
-
this._portalEl =
|
|
937
|
-
const
|
|
938
|
-
if (!
|
|
914
|
+
const r = this._buildPanelContent(e);
|
|
915
|
+
this._portalEl = r, this._portalSurfaceEl = r.querySelector(".surface"), this._portalContentHostEl = r.querySelector("ui-listbox.content-host"), this._panelForIndex = e;
|
|
916
|
+
const a = k();
|
|
917
|
+
if (!a) {
|
|
939
918
|
this._portalEl = null, this._panelForIndex = -1;
|
|
940
919
|
return;
|
|
941
920
|
}
|
|
942
|
-
|
|
921
|
+
a.appendChild(r), this._positioner = T({
|
|
943
922
|
anchor: t,
|
|
944
|
-
floating: this._panelSurface() ||
|
|
945
|
-
placement:
|
|
923
|
+
floating: this._panelSurface() || r,
|
|
924
|
+
placement: K(this.getAttribute("placement")),
|
|
946
925
|
offset: 6,
|
|
947
926
|
flip: !0,
|
|
948
927
|
shift: !0,
|
|
949
928
|
fitViewport: !0,
|
|
950
929
|
observeScroll: !1
|
|
951
930
|
}), this._dismissableLayer = I({
|
|
952
|
-
node: this._panelSurface() ||
|
|
931
|
+
node: this._panelSurface() || r,
|
|
953
932
|
trigger: t,
|
|
954
933
|
closeOnEscape: !0,
|
|
955
934
|
closeOnPointerOutside: !0,
|
|
956
935
|
onDismiss: () => this.close()
|
|
957
|
-
});
|
|
936
|
+
}), z(this._panelSurface() || r);
|
|
958
937
|
}
|
|
959
|
-
_teardownPanel() {
|
|
960
|
-
|
|
961
|
-
try {
|
|
962
|
-
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
963
|
-
} catch {
|
|
964
|
-
}
|
|
965
|
-
this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._panelForIndex = -1, this._submenuRaf != null && (cancelAnimationFrame(this._submenuRaf), this._submenuRaf = null), this._resetTypeahead();
|
|
938
|
+
_teardownPanel(e = !1) {
|
|
939
|
+
this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._positioner?.destroy(), this._positioner = null, e ? O(this._portalEl) : B(this._portalEl), this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._panelForIndex = -1, this._submenuRaf != null && (cancelAnimationFrame(this._submenuRaf), this._submenuRaf = null), this._resetTypeahead();
|
|
966
940
|
}
|
|
967
941
|
_selectIndex(e, t) {
|
|
968
|
-
const
|
|
969
|
-
|
|
942
|
+
const r = this._selectedIndex(), a = A(e, this._items.length);
|
|
943
|
+
a < 0 || (this._setSelectedAttribute(a), this.setAttribute("open", ""), this._syncState(), this.dispatchEvent(
|
|
970
944
|
new CustomEvent("change", {
|
|
971
|
-
detail: { selected:
|
|
945
|
+
detail: { selected: a, previous: r, open: !0, reason: t },
|
|
972
946
|
bubbles: !0
|
|
973
947
|
})
|
|
974
948
|
));
|
|
@@ -990,9 +964,9 @@ class q extends E {
|
|
|
990
964
|
this._panelListbox()?.focusBoundary("last", { focus: !0, owner: this._panelSurface(), scroll: !0 });
|
|
991
965
|
}
|
|
992
966
|
_movePanelFocus(e) {
|
|
993
|
-
const t = document.activeElement,
|
|
967
|
+
const t = document.activeElement, a = (t && this._portalEl?.contains(t) ? t.closest(l()) : null)?.closest(".submenu") || this._panelListbox();
|
|
994
968
|
this._panelListbox()?.move(e, {
|
|
995
|
-
container:
|
|
969
|
+
container: a,
|
|
996
970
|
current: t && this._portalEl?.contains(t) ? t : null,
|
|
997
971
|
focus: !0,
|
|
998
972
|
owner: this._panelSurface(),
|
|
@@ -1008,19 +982,19 @@ class q extends E {
|
|
|
1008
982
|
_typeaheadOnBar(e) {
|
|
1009
983
|
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
1010
984
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${e.key.toLowerCase()}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 420);
|
|
1011
|
-
const t = this._items.findIndex((
|
|
985
|
+
const t = this._items.findIndex((a) => a === e.target || a.contains(e.target)), r = L(this._items, this._typeaheadBuffer, {
|
|
1012
986
|
startIndex: t,
|
|
1013
|
-
getLabel: (
|
|
987
|
+
getLabel: (a) => a.getAttribute("aria-label") || a.textContent || "",
|
|
1014
988
|
getDisabled: m
|
|
1015
989
|
});
|
|
1016
|
-
return
|
|
990
|
+
return r < 0 ? !1 : (e.preventDefault(), this._focusItem(r), this._open && this._selectIndex(r, "keyboard"), !0);
|
|
1017
991
|
}
|
|
1018
992
|
_typeaheadOnPanel(e) {
|
|
1019
993
|
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
1020
994
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${e.key.toLowerCase()}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 420);
|
|
1021
|
-
const t = document.activeElement,
|
|
995
|
+
const t = document.activeElement, a = (t && this._portalEl?.contains(t) ? t.closest(l()) : null)?.closest(".submenu") || this._panelListbox();
|
|
1022
996
|
return this._panelListbox()?.typeahead(this._typeaheadBuffer, {
|
|
1023
|
-
container:
|
|
997
|
+
container: a,
|
|
1024
998
|
current: t && this._portalEl?.contains(t) ? t : null,
|
|
1025
999
|
focus: !0,
|
|
1026
1000
|
owner: this._panelSurface(),
|
|
@@ -1035,32 +1009,32 @@ class q extends E {
|
|
|
1035
1009
|
return;
|
|
1036
1010
|
}
|
|
1037
1011
|
if (t !== "menuitemradio") return;
|
|
1038
|
-
const
|
|
1039
|
-
if (!
|
|
1040
|
-
const
|
|
1041
|
-
Array.from(
|
|
1042
|
-
|
|
1012
|
+
const r = e.closest(".submenu") || this._panelListbox();
|
|
1013
|
+
if (!r) return;
|
|
1014
|
+
const a = e.getAttribute("data-group") || e.getAttribute("name") || "";
|
|
1015
|
+
Array.from(r.querySelectorAll('[role="menuitemradio"]')).forEach((s) => {
|
|
1016
|
+
a && (s.getAttribute("data-group") || s.getAttribute("name") || "") !== a || (s.setAttribute("aria-checked", "false"), s.setAttribute("data-state", "unchecked"));
|
|
1043
1017
|
}), e.setAttribute("aria-checked", "true"), e.setAttribute("data-state", "checked");
|
|
1044
1018
|
}
|
|
1045
1019
|
_onClick(e) {
|
|
1046
|
-
const t = e.composedPath(),
|
|
1047
|
-
if (
|
|
1048
|
-
if (this._focusItem(
|
|
1020
|
+
const t = e.composedPath(), r = this._items.findIndex((i) => t.includes(i));
|
|
1021
|
+
if (r < 0) return;
|
|
1022
|
+
if (this._focusItem(r), this._selectedIndex() === r && this._open) {
|
|
1049
1023
|
this.close(), this._syncState();
|
|
1050
1024
|
return;
|
|
1051
1025
|
}
|
|
1052
|
-
this._selectIndex(
|
|
1026
|
+
this._selectIndex(r, "click");
|
|
1053
1027
|
}
|
|
1054
1028
|
_onMouseMove(e) {
|
|
1055
1029
|
if (!this._open) return;
|
|
1056
|
-
const t = e.composedPath(),
|
|
1057
|
-
|
|
1030
|
+
const t = e.composedPath(), r = this._items.findIndex((a) => t.includes(a));
|
|
1031
|
+
r < 0 || r !== this._selectedIndex() && this._selectIndex(r, "programmatic");
|
|
1058
1032
|
}
|
|
1059
1033
|
_isInternalScrollEvent(e) {
|
|
1060
1034
|
const t = typeof e.composedPath == "function" ? e.composedPath() : [];
|
|
1061
|
-
if (this._portalEl && t.includes(this._portalEl) || this._items.some((
|
|
1062
|
-
const
|
|
1063
|
-
return !!(
|
|
1035
|
+
if (this._portalEl && t.includes(this._portalEl) || this._items.some((a) => t.includes(a))) return !0;
|
|
1036
|
+
const r = e.target;
|
|
1037
|
+
return !!(r instanceof Node && (this._portalEl?.contains(r) || this._items.some((a) => a.contains(r))));
|
|
1064
1038
|
}
|
|
1065
1039
|
_onDocScroll(e) {
|
|
1066
1040
|
!this._open || !this.closeOnScroll || this._isInternalScrollEvent(e) || this.close();
|
|
@@ -1069,9 +1043,9 @@ class q extends E {
|
|
|
1069
1043
|
if (!this._open) return;
|
|
1070
1044
|
const t = w(e);
|
|
1071
1045
|
if (!t || _(t)) return;
|
|
1072
|
-
const
|
|
1046
|
+
const r = t.closest(".submenu") || this._panelListbox();
|
|
1073
1047
|
this._panelListbox()?.setActiveItem(t, {
|
|
1074
|
-
container:
|
|
1048
|
+
container: r,
|
|
1075
1049
|
focus: !1,
|
|
1076
1050
|
owner: this._panelSurface(),
|
|
1077
1051
|
scroll: !1
|
|
@@ -1085,28 +1059,28 @@ class q extends E {
|
|
|
1085
1059
|
_onPanelFocusIn(e) {
|
|
1086
1060
|
const t = e.target;
|
|
1087
1061
|
if (!(t instanceof HTMLElement)) return;
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1062
|
+
const r = t.closest(l());
|
|
1063
|
+
r && (this._submenuFor(r) ? this._setOpenPanelBranch(r, !0) : this._setOpenPanelBranch(r, !1));
|
|
1090
1064
|
}
|
|
1091
1065
|
_onKeyDown(e) {
|
|
1092
1066
|
const t = this._items.findIndex((o) => o === e.target || o.contains(e.target));
|
|
1093
1067
|
if (t < 0) return;
|
|
1094
|
-
const
|
|
1095
|
-
let
|
|
1068
|
+
const r = getComputedStyle(this).direction === "rtl" ? "rtl" : "ltr";
|
|
1069
|
+
let a = !1, i = t;
|
|
1096
1070
|
const s = g(this._items, {
|
|
1097
1071
|
activeIndex: t,
|
|
1098
1072
|
selectedIndex: this._selectedIndex(),
|
|
1099
1073
|
getDisabled: m
|
|
1100
1074
|
});
|
|
1101
|
-
e.key === "ArrowRight" ? (i = y(this._items, t,
|
|
1075
|
+
e.key === "ArrowRight" ? (i = y(this._items, t, r === "rtl" ? -1 : 1, {
|
|
1102
1076
|
wrap: this._loopEnabled(),
|
|
1103
1077
|
fallbackIndex: s,
|
|
1104
1078
|
getDisabled: m
|
|
1105
|
-
}),
|
|
1079
|
+
}), a = !0) : e.key === "ArrowLeft" ? (i = y(this._items, t, r === "rtl" ? 1 : -1, {
|
|
1106
1080
|
wrap: this._loopEnabled(),
|
|
1107
1081
|
fallbackIndex: s,
|
|
1108
1082
|
getDisabled: m
|
|
1109
|
-
}),
|
|
1083
|
+
}), a = !0) : e.key === "Home" ? (i = x(this._items, "first", m), a = !0) : e.key === "End" ? (i = x(this._items, "last", m), a = !0) : e.key === "Enter" || e.key === " " ? (this._selectIndex(t, "keyboard"), a = !0) : e.key === "ArrowDown" ? (this._selectIndex(t, "keyboard"), setTimeout(() => this._focusPanelFirst(), 0), a = !0) : e.key === "ArrowUp" && (this._selectIndex(t, "keyboard"), setTimeout(() => this._focusPanelLast(), 0), a = !0), !(!a && this._typeaheadOnBar(e)) && a && (e.preventDefault(), i >= 0 && i !== t && (this._focusItem(i), this._open && this._selectIndex(i, "keyboard")));
|
|
1110
1084
|
}
|
|
1111
1085
|
_onDocKeyDown(e) {
|
|
1112
1086
|
if (!this._open || !(!!this._portalEl && e.composedPath().includes(this._portalEl)) || this._typeaheadOnPanel(e)) return;
|
|
@@ -1126,12 +1100,12 @@ class q extends E {
|
|
|
1126
1100
|
e.preventDefault(), this._focusPanelLast();
|
|
1127
1101
|
return;
|
|
1128
1102
|
}
|
|
1129
|
-
const
|
|
1130
|
-
if (e.key === "ArrowRight" &&
|
|
1103
|
+
const r = document.activeElement, a = r?.closest(l());
|
|
1104
|
+
if (e.key === "ArrowRight" && a && this._openPanelSubmenu(a, !0)) {
|
|
1131
1105
|
e.preventDefault();
|
|
1132
1106
|
return;
|
|
1133
1107
|
}
|
|
1134
|
-
if (e.key === "ArrowLeft" &&
|
|
1108
|
+
if (e.key === "ArrowLeft" && a && this._closeParentPanelSubmenu(a)) {
|
|
1135
1109
|
e.preventDefault();
|
|
1136
1110
|
return;
|
|
1137
1111
|
}
|
|
@@ -1140,15 +1114,15 @@ class q extends E {
|
|
|
1140
1114
|
return;
|
|
1141
1115
|
}
|
|
1142
1116
|
if (e.key === "Enter" || e.key === " ") {
|
|
1143
|
-
if (!
|
|
1144
|
-
|
|
1117
|
+
if (!r || !this._portalEl?.contains(r) || !a || _(a) || (e.preventDefault(), this._openPanelSubmenu(a, !0))) return;
|
|
1118
|
+
a.click();
|
|
1145
1119
|
}
|
|
1146
1120
|
}
|
|
1147
|
-
shouldRenderOnAttributeChange(e, t,
|
|
1121
|
+
shouldRenderOnAttributeChange(e, t, r) {
|
|
1148
1122
|
return !1;
|
|
1149
1123
|
}
|
|
1150
1124
|
}
|
|
1151
|
-
typeof customElements < "u" && !customElements.get("ui-menubar") && customElements.define("ui-menubar",
|
|
1125
|
+
typeof customElements < "u" && !customElements.get("ui-menubar") && customElements.define("ui-menubar", G);
|
|
1152
1126
|
export {
|
|
1153
|
-
|
|
1127
|
+
G as UIMenubar
|
|
1154
1128
|
};
|