@editora/ui-core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-DxbvhLJs.js → ElementBase-CbUsP3D6.js} +1 -1
- package/dist/{ElementBase-BeZT54Hj.mjs → ElementBase-D5QsC5Vw.mjs} +10 -1
- package/dist/ElementBase.d.ts +7 -0
- package/dist/ElementBase.d.ts.map +1 -1
- package/dist/accordion.cjs.js +1 -1
- package/dist/accordion.esm.js +1 -1
- package/dist/add-icons-CVeHOsWl.js +1 -0
- package/dist/add-icons-DBUZJ0g7.mjs +14 -0
- package/dist/add-icons.cjs.js +1 -0
- package/dist/add-icons.d.ts +16 -0
- package/dist/add-icons.d.ts.map +1 -0
- package/dist/add-icons.esm.js +4 -0
- package/dist/alert-dialog.cjs.js +24 -24
- package/dist/alert-dialog.esm.js +112 -107
- package/dist/alert.cjs.js +8 -8
- package/dist/alert.esm.js +22 -22
- package/dist/animated-beam.cjs.js +1 -1
- package/dist/animated-beam.esm.js +1 -1
- package/dist/animated-list.cjs.js +1 -1
- package/dist/animated-list.esm.js +1 -1
- package/dist/animated-text.cjs.js +1 -1
- package/dist/animated-text.esm.js +1 -1
- package/dist/app-header.cjs.js +15 -3
- package/dist/app-header.esm.js +31 -4
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +1 -1
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +1 -1
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +1 -1
- package/dist/block-controls.cjs.js +1 -1
- package/dist/block-controls.esm.js +1 -1
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +1 -1
- package/dist/breadcrumb.cjs.js +4 -4
- package/dist/breadcrumb.esm.js +93 -84
- package/dist/button.cjs.js +520 -1
- package/dist/button.esm.js +682 -2
- package/dist/{calendar-CzpWDxLc.js → calendar-BsVqtpjM.js} +6 -6
- package/dist/{calendar-DkSDFg33.mjs → calendar-CFafqZVA.mjs} +6 -6
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -5
- package/dist/card.esm.js +52 -39
- package/dist/chart.cjs.js +2 -2
- package/dist/chart.esm.js +2 -2
- package/dist/checkbox.cjs.js +4 -4
- package/dist/checkbox.esm.js +36 -15
- package/dist/clone-source-BxK2pEVw.mjs +11 -0
- package/dist/clone-source-C7E_ri5f.js +1 -0
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +1 -1
- package/dist/color-picker.cjs.js +2 -2
- package/dist/color-picker.esm.js +3 -3
- package/dist/combobox.cjs.js +4 -4
- package/dist/combobox.esm.js +22 -19
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +1 -1
- package/dist/command.cjs.js +1 -1
- package/dist/command.esm.js +1 -1
- 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-app-header.d.ts +1 -0
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts +7 -0
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts +6 -0
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +1 -0
- package/dist/components/ui-dialog.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-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon.d.ts +1 -0
- package/dist/components/ui-icon.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts +16 -0
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-layout.d.ts +20 -0
- package/dist/components/ui-layout.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts +1 -0
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts +6 -0
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts +6 -0
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts +11 -0
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts +6 -0
- package/dist/components/ui-radio-group.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-select.d.ts +7 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts +1 -0
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts +6 -0
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +1 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts +6 -0
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts +2 -0
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts +6 -0
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-toast.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/container.cjs.js +1 -1
- package/dist/container.esm.js +1 -1
- package/dist/context-menu.cjs.js +2 -2
- package/dist/context-menu.esm.js +2 -2
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +1 -1
- package/dist/data-table.cjs.js +5 -5
- package/dist/data-table.esm.js +7 -7
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +3 -3
- package/dist/date-picker.cjs.js +2 -2
- package/dist/date-picker.esm.js +17 -17
- package/dist/date-range-picker.cjs.js +2 -2
- package/dist/date-range-picker.esm.js +4 -4
- package/dist/date-range-time-picker.cjs.js +3 -3
- package/dist/date-range-time-picker.esm.js +16 -16
- package/dist/date-time-picker.cjs.js +26 -23
- package/dist/date-time-picker.esm.js +49 -46
- package/dist/{date-time-utils-zAx4ghvC.mjs → date-time-utils-CJUksWj3.mjs} +1 -1
- package/dist/{date-time-utils-C-4eHTyy.js → date-time-utils-D3hQQ5Om.js} +1 -1
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +1 -1
- package/dist/dialog.cjs.js +7 -7
- package/dist/dialog.esm.js +51 -47
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dismissable-layer.cjs.js +1 -1
- package/dist/dismissable-layer.esm.js +1 -1
- package/dist/dock.cjs.js +1 -1
- package/dist/dock.esm.js +1 -1
- package/dist/drawer.cjs.js +5 -5
- package/dist/drawer.esm.js +18 -17
- package/dist/dropdown.cjs.js +7 -7
- package/dist/dropdown.esm.js +39 -38
- package/dist/empty-state.cjs.js +12 -2
- package/dist/empty-state.esm.js +17 -7
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +1 -1
- package/dist/field.cjs.js +2 -2
- package/dist/field.esm.js +2 -2
- package/dist/fieldset.cjs.js +1 -1
- package/dist/fieldset.esm.js +1 -1
- package/dist/file-upload.cjs.js +1 -1
- package/dist/file-upload.esm.js +1 -1
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +1 -1
- package/dist/floating-toolbar.cjs.js +2 -2
- package/dist/floating-toolbar.esm.js +2 -2
- package/dist/focus-scope-Dl0qk5GP.mjs +177 -0
- package/dist/focus-scope-Doz0bnE1.js +1 -0
- package/dist/focus-scope.cjs.js +1 -1
- package/dist/focus-scope.esm.js +2 -2
- package/dist/form-control-B90_3kYN.js +1 -0
- package/dist/form-control-D9wWUMBl.mjs +86 -0
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +2 -2
- package/dist/gantt.cjs.js +2 -2
- package/dist/gantt.esm.js +2 -2
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +5 -5
- package/dist/hover-card.esm.js +19 -18
- package/dist/icon-cloud.cjs.js +1 -1
- package/dist/icon-cloud.esm.js +1 -1
- package/dist/icon.cjs.js +207 -1
- package/dist/icon.esm.js +294 -2
- package/dist/icons-CpCpPXV5.js +1 -0
- package/dist/icons-DWYbbhb0.mjs +115 -0
- package/dist/icons.d.ts +11 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/implicit-submit-B6M5Uc56.js +1 -0
- package/dist/implicit-submit-Lr0-q2LR.mjs +44 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +309 -299
- package/dist/inline-edit.cjs.js +1 -1
- package/dist/inline-edit.esm.js +1 -1
- package/dist/input.cjs.js +62 -20
- package/dist/input.esm.js +164 -58
- package/dist/label.cjs.js +1 -1
- package/dist/label.esm.js +1 -1
- package/dist/layout.cjs.js +145 -4
- package/dist/layout.esm.js +278 -40
- package/dist/marquee.cjs.js +1 -1
- package/dist/marquee.esm.js +1 -1
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +1 -1
- package/dist/menu.cjs.js +8 -8
- package/dist/menu.esm.js +51 -47
- package/dist/menubar.cjs.js +9 -9
- package/dist/menubar.esm.js +41 -40
- package/dist/meter.cjs.js +1 -1
- package/dist/meter.esm.js +1 -1
- package/dist/multi-select.cjs.js +7 -7
- package/dist/multi-select.esm.js +55 -34
- package/dist/navigate-CXebafwF.mjs +18 -0
- package/dist/navigate-ChJVIIuS.js +1 -0
- package/dist/navigation-menu.cjs.js +1 -1
- package/dist/navigation-menu.esm.js +1 -1
- package/dist/number-attribute-BAF07JrU.mjs +8 -0
- package/dist/number-attribute-C4Rrl7d3.js +1 -0
- package/dist/number-field.cjs.js +8 -8
- package/dist/number-field.esm.js +90 -69
- package/dist/number-ticker.cjs.js +1 -1
- package/dist/number-ticker.esm.js +1 -1
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +1 -1
- package/dist/orbiter.cjs.js +1 -1
- package/dist/orbiter.esm.js +1 -1
- package/dist/pagination.cjs.js +24 -23
- package/dist/pagination.esm.js +61 -46
- package/dist/{panel-group-BVHJEdfx.js → panel-group-BIzzpQ5i.js} +1 -1
- package/dist/{panel-group-BxO_eNW6.mjs → panel-group-CFLjzRWI.mjs} +1 -1
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +1 -1
- package/dist/panel.cjs.js +1 -1
- package/dist/panel.esm.js +1 -1
- package/dist/password-field.cjs.js +36 -16
- package/dist/password-field.esm.js +113 -44
- package/dist/pin-input.cjs.js +1 -1
- package/dist/pin-input.esm.js +1 -1
- 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 +2 -2
- package/dist/popover.esm.js +28 -26
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +35 -38
- package/dist/preload.cjs.js +221 -0
- package/dist/preload.css +220 -0
- package/dist/preload.d.ts +17 -0
- package/dist/preload.d.ts.map +1 -0
- package/dist/preload.esm.js +224 -0
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/clone-source.d.ts +3 -0
- package/dist/primitives/clone-source.d.ts.map +1 -0
- package/dist/primitives/focus-scope.d.ts +6 -0
- package/dist/primitives/focus-scope.d.ts.map +1 -1
- package/dist/primitives/form-control.d.ts +68 -0
- package/dist/primitives/form-control.d.ts.map +1 -0
- package/dist/primitives/implicit-submit.d.ts +17 -0
- package/dist/primitives/implicit-submit.d.ts.map +1 -0
- package/dist/primitives/navigate.d.ts +27 -0
- package/dist/primitives/navigate.d.ts.map +1 -0
- package/dist/primitives/number-attribute.d.ts +7 -0
- package/dist/primitives/number-attribute.d.ts.map +1 -0
- package/dist/primitives/slotted-input.d.ts +19 -0
- package/dist/primitives/slotted-input.d.ts.map +1 -0
- package/dist/progress.cjs.js +3 -3
- package/dist/progress.esm.js +3 -3
- package/dist/quick-actions.cjs.js +5 -5
- package/dist/quick-actions.esm.js +3 -3
- package/dist/radio-group.cjs.js +9 -9
- package/dist/radio-group.esm.js +47 -24
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +1 -1
- package/dist/rating.cjs.js +6 -6
- package/dist/rating.esm.js +21 -10
- package/dist/{runtime-BRT7E4A8.mjs → runtime-CORXjP7e.mjs} +379 -357
- package/dist/runtime-uCly3ECd.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +1 -1
- package/dist/scroll-area.cjs.js +1 -1
- package/dist/scroll-area.esm.js +1 -1
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +21 -21
- package/dist/select.esm.js +111 -71
- package/dist/selection-popup.cjs.js +2 -2
- package/dist/selection-popup.esm.js +2 -2
- package/dist/semantic-tokens.d.ts.map +1 -1
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +15 -15
- package/dist/sidebar.esm.js +48 -42
- package/dist/skeleton.cjs.js +1 -1
- package/dist/skeleton.esm.js +1 -1
- package/dist/slider.cjs.js +11 -11
- package/dist/slider.esm.js +40 -23
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/slotted-input-BVq2QQg2.js +1 -0
- package/dist/slotted-input-atWznLfm.mjs +13 -0
- package/dist/sortable.cjs.js +25 -25
- package/dist/sortable.esm.js +29 -21
- package/dist/spinning-text.cjs.js +1 -1
- package/dist/spinning-text.esm.js +1 -1
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +1 -1
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/standalone/add-icons.d.ts +2 -0
- package/dist/standalone/add-icons.d.ts.map +1 -0
- package/dist/standalone/preload.d.ts +2 -0
- package/dist/standalone/preload.d.ts.map +1 -0
- package/dist/stepper.cjs.js +3 -3
- package/dist/stepper.esm.js +3 -3
- package/dist/switch.cjs.js +9 -9
- package/dist/switch.esm.js +56 -35
- package/dist/table.cjs.js +1 -1
- package/dist/table.esm.js +1 -1
- package/dist/tabs.cjs.js +14 -14
- package/dist/tabs.esm.js +129 -115
- package/dist/tags-input.cjs.js +1 -1
- package/dist/tags-input.esm.js +1 -1
- package/dist/textarea.cjs.js +33 -11
- package/dist/textarea.esm.js +74 -35
- package/dist/theme.d.ts +6 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +2 -2
- package/dist/time-picker.cjs.js +1 -1
- package/dist/time-picker.esm.js +3 -3
- package/dist/timeline.cjs.js +2 -2
- package/dist/timeline.esm.js +2 -2
- package/dist/toast.cjs.js +4 -4
- package/dist/toast.esm.js +17 -16
- package/dist/toggle-group.cjs.js +1 -1
- package/dist/toggle-group.esm.js +1 -1
- package/dist/toggle.cjs.js +3 -3
- package/dist/toggle.esm.js +9 -9
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +1 -1
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +12 -14
- package/dist/transfer-list.cjs.js +1 -1
- package/dist/transfer-list.esm.js +1 -1
- package/dist/{tree-33fVNnaf.mjs → tree-CD2k2lIC.mjs} +1 -1
- package/dist/{tree-Dc02MChE.js → tree-ChQfhxya.js} +1 -1
- package/dist/tree-item.cjs.js +1 -1
- package/dist/tree-item.esm.js +1 -1
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +4 -4
- package/dist/wizard.esm.js +4 -4
- package/package.json +3 -2
- package/dist/focus-scope-Bwug2gDv.js +0 -1
- package/dist/focus-scope-CmEsG5UZ.mjs +0 -138
- package/dist/runtime-CXw4SGV9.js +0 -5
- package/dist/ui-button-C3OmI7Sn.mjs +0 -684
- package/dist/ui-button-CnLwXBnx.js +0 -520
- package/dist/ui-icon-D3avtxX_.js +0 -207
- package/dist/ui-icon-DLhB08Fo.mjs +0 -361
package/dist/drawer.esm.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { E as
|
|
1
|
+
import { E as S } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
|
+
import { g as O, d as T, c as D } from "./focus-scope-Dl0qk5GP.mjs";
|
|
2
3
|
import { O as v } from "./overlayManager-BJjU1VA8.mjs";
|
|
3
4
|
function k(i) {
|
|
4
5
|
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(() => i()) : window.setTimeout(i, 16);
|
|
@@ -12,7 +13,7 @@ function F(i) {
|
|
|
12
13
|
window.clearTimeout(i);
|
|
13
14
|
}
|
|
14
15
|
}
|
|
15
|
-
const
|
|
16
|
+
const $ = 'button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])', B = /* @__PURE__ */ new Set([
|
|
16
17
|
"side",
|
|
17
18
|
"dismissible",
|
|
18
19
|
"headless",
|
|
@@ -33,7 +34,7 @@ const L = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
|
|
|
33
34
|
"aria-labelledby",
|
|
34
35
|
"aria-describedby",
|
|
35
36
|
"initial-focus"
|
|
36
|
-
]),
|
|
37
|
+
]), R = `
|
|
37
38
|
:host {
|
|
38
39
|
position: fixed;
|
|
39
40
|
inset: 0;
|
|
@@ -390,7 +391,7 @@ const L = 'button:not([disabled]), [href], input:not([disabled]), select:not([di
|
|
|
390
391
|
--ui-drawer-muted: #94a3b8;
|
|
391
392
|
--ui-drawer-border-color: #334155;
|
|
392
393
|
--ui-drawer-overlay: rgba(2, 6, 23, 0.78);
|
|
393
|
-
--ui-drawer-focus-ring: #93c5fd;
|
|
394
|
+
--ui-drawer-focus-ring: var(--ui-color-accent-on-dark, #93c5fd);
|
|
394
395
|
--ui-drawer-control-bg: #111827;
|
|
395
396
|
--ui-drawer-control-bg-hover: color-mix(in srgb, #ffffff 14%, transparent);
|
|
396
397
|
}
|
|
@@ -538,17 +539,17 @@ function _(i, e) {
|
|
|
538
539
|
function y(i) {
|
|
539
540
|
return i.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
540
541
|
}
|
|
541
|
-
function
|
|
542
|
+
function L(i, e) {
|
|
542
543
|
return i === "top" || i === "bottom" || i === "left" || i === "right" ? i : i === "start" ? e === "rtl" ? "right" : "left" : i === "end" ? e === "rtl" ? "left" : "right" : "left";
|
|
543
544
|
}
|
|
544
545
|
function C(i, e) {
|
|
545
546
|
const t = i.querySelector(`[slot="${e}"]`);
|
|
546
547
|
return t ? t.textContent?.trim().length !== 0 || t.children.length > 0 : !1;
|
|
547
548
|
}
|
|
548
|
-
function
|
|
549
|
+
function I() {
|
|
549
550
|
return typeof window < "u" && typeof document < "u";
|
|
550
551
|
}
|
|
551
|
-
class
|
|
552
|
+
class q extends S {
|
|
552
553
|
constructor() {
|
|
553
554
|
super(), this._uid = Math.random().toString(36).slice(2, 10), this._isOpen = !1, this._restoreFocusEl = null, this._globalListenersBound = !1, this._closeReason = "programmatic", this._focusInitialFrame = 0, this._focusTrapFrame = 0, this._restoreFocusFrame = 0, this._onRootClick = this._onRootClick.bind(this), this._onDocumentKeyDown = this._onDocumentKeyDown.bind(this), this._onDocumentFocusIn = this._onDocumentFocusIn.bind(this);
|
|
554
555
|
}
|
|
@@ -590,7 +591,7 @@ class $ extends O {
|
|
|
590
591
|
this._syncOpenState();
|
|
591
592
|
return;
|
|
592
593
|
}
|
|
593
|
-
if (
|
|
594
|
+
if (B.has(e)) {
|
|
594
595
|
this._syncLiveUi(), this._isOpen && (e === "initial-focus" || e === "dismissible" || e === "show-close") && this._scheduleEnsureFocusTrap();
|
|
595
596
|
return;
|
|
596
597
|
}
|
|
@@ -683,7 +684,7 @@ class $ extends O {
|
|
|
683
684
|
}
|
|
684
685
|
_resolvedSide() {
|
|
685
686
|
const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr";
|
|
686
|
-
return
|
|
687
|
+
return L(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr");
|
|
687
688
|
}
|
|
688
689
|
_isTopMost() {
|
|
689
690
|
const e = v.top();
|
|
@@ -699,7 +700,7 @@ class $ extends O {
|
|
|
699
700
|
}
|
|
700
701
|
_isFocusable(e) {
|
|
701
702
|
if (!e || !e.isConnected || e.disabled || e.matches('[inert], [aria-hidden="true"]') || e.closest('[inert], [aria-hidden="true"]')) return !1;
|
|
702
|
-
if (!
|
|
703
|
+
if (!I()) return !0;
|
|
703
704
|
const t = window.getComputedStyle(e);
|
|
704
705
|
return t.display !== "none" && t.visibility !== "hidden";
|
|
705
706
|
}
|
|
@@ -707,7 +708,7 @@ class $ extends O {
|
|
|
707
708
|
const e = this._getPanel(), t = [], r = (s) => {
|
|
708
709
|
this._isFocusable(s) && (t.includes(s) || t.push(s));
|
|
709
710
|
};
|
|
710
|
-
return
|
|
711
|
+
return e ? O(e).forEach(r) : this.querySelectorAll($).forEach(r), t;
|
|
711
712
|
}
|
|
712
713
|
_cancelScheduledFocusWork() {
|
|
713
714
|
this._focusInitialFrame && (F(this._focusInitialFrame), this._focusInitialFrame = 0), this._focusTrapFrame && (F(this._focusTrapFrame), this._focusTrapFrame = 0), this._restoreFocusFrame && (F(this._restoreFocusFrame), this._restoreFocusFrame = 0);
|
|
@@ -794,7 +795,7 @@ class $ extends O {
|
|
|
794
795
|
}
|
|
795
796
|
_canRestoreFocus(e) {
|
|
796
797
|
if (!e || !e.isConnected || e.disabled) return !1;
|
|
797
|
-
if (!
|
|
798
|
+
if (!I()) return !0;
|
|
798
799
|
const t = window.getComputedStyle(e);
|
|
799
800
|
return t.display !== "none" && t.visibility !== "hidden";
|
|
800
801
|
}
|
|
@@ -877,7 +878,7 @@ class $ extends O {
|
|
|
877
878
|
e.preventDefault(), t.focus();
|
|
878
879
|
return;
|
|
879
880
|
}
|
|
880
|
-
const s = r[0], a = r[r.length - 1], o =
|
|
881
|
+
const s = r[0], a = r[r.length - 1], o = T(), n = !!o && (this._isNodeInsideDrawer(o) || !!t && D(t, o));
|
|
881
882
|
if (e.shiftKey) {
|
|
882
883
|
if (!n || o === s) {
|
|
883
884
|
e.preventDefault();
|
|
@@ -914,11 +915,11 @@ class $ extends O {
|
|
|
914
915
|
t && this._isNodeInsideDrawer(t) || s.includes(this) || r && s.includes(r) || this._scheduleFocusInitial();
|
|
915
916
|
}
|
|
916
917
|
render() {
|
|
917
|
-
const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr", t =
|
|
918
|
+
const e = this.getAttribute("dir") || document.documentElement.getAttribute("dir") || "ltr", t = L(this.getAttribute("side"), e === "rtl" ? "rtl" : "ltr"), r = this.showClose, s = C(this, "header"), a = C(this, "footer"), o = (this.getAttribute("title") || "").trim(), n = (this.getAttribute("description") || "").trim(), A = r || s || !!o || !!n, u = `ui-drawer-title-${this._uid}`, g = `ui-drawer-description-${this._uid}`, c = `ui-drawer-body-${this._uid}`, h = this.getAttribute("aria-label") || "", x = this.getAttribute("aria-labelledby") || "", p = this.getAttribute("aria-describedby") || "", m = s ? (this.querySelector('[slot="header"]')?.textContent || "").replace(/\s+/g, " ").trim() : "", w = !h && !x && !!m, b = x || (!h && !w && (s || o) ? u : ""), l = [];
|
|
918
919
|
p ? l.push(p) : (n && l.push(g), l.push(c));
|
|
919
920
|
const f = h || (w ? m : b ? "" : "Drawer"), d = this.state === "loading";
|
|
920
921
|
this.setContent(`
|
|
921
|
-
<style>${
|
|
922
|
+
<style>${R}</style>
|
|
922
923
|
<div class="overlay" part="overlay" aria-hidden="true"></div>
|
|
923
924
|
<div
|
|
924
925
|
class="panel side-${t}"
|
|
@@ -963,7 +964,7 @@ class $ extends O {
|
|
|
963
964
|
this._globalListenersBound && (document.removeEventListener("keydown", this._onDocumentKeyDown, !0), document.removeEventListener("focusin", this._onDocumentFocusIn, !0), this._globalListenersBound = !1);
|
|
964
965
|
}
|
|
965
966
|
}
|
|
966
|
-
typeof customElements < "u" && !customElements.get("ui-drawer") && customElements.define("ui-drawer",
|
|
967
|
+
typeof customElements < "u" && !customElements.get("ui-drawer") && customElements.define("ui-drawer", q);
|
|
967
968
|
export {
|
|
968
|
-
|
|
969
|
+
q as UIDrawer
|
|
969
970
|
};
|
package/dist/dropdown.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./ElementBase-CbUsP3D6.js"),v=require("./clone-source-C7E_ri5f.js"),_=require("./overlay-motion-B56x1GoY.js"),A=require("./trigger-DkPsKxsP.js"),S=require("./menu-item-styles-DUdyjQ7i.js"),l=['[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]',".item","[data-menu-item]"].join(", "),C=`
|
|
2
|
+
${_.OVERLAY_MOTION_CSS}
|
|
3
3
|
|
|
4
4
|
:host {
|
|
5
5
|
--ui-dropdown-bg: var(
|
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
--ui-dropdown-color: #f8fafc;
|
|
233
233
|
--ui-dropdown-muted: #94a3b8;
|
|
234
234
|
--ui-dropdown-border-color: #334155;
|
|
235
|
-
--ui-dropdown-ring: #93c5fd;
|
|
235
|
+
--ui-dropdown-ring: var(--ui-color-accent-on-dark, #93c5fd);
|
|
236
236
|
--ui-dropdown-item-active-color: #f8fafc;
|
|
237
237
|
--ui-dropdown-item-secondary-active-color: color-mix(in srgb, #f8fafc 82%, transparent);
|
|
238
238
|
--ui-dropdown-item-hover-bg: color-mix(in srgb, #ffffff 12%, transparent);
|
|
@@ -269,7 +269,7 @@
|
|
|
269
269
|
--ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 17%, transparent);
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
${
|
|
272
|
+
${S.createSharedMenuItemCss({scopes:[".menu"],prefix:"--ui-dropdown",shortcutSelectors:[".shortcut",".meta"],activeStateSelectors:['.item[data-active="true"]','[role="menuitem"][data-active="true"]','[role="menuitemcheckbox"][data-active="true"]','[role="menuitemradio"][data-active="true"]','[data-menu-item][data-active="true"]']})}
|
|
273
273
|
|
|
274
274
|
.menu [role='menuitem'],
|
|
275
275
|
.menu [role='menuitemcheckbox'],
|
|
@@ -490,8 +490,8 @@
|
|
|
490
490
|
color: HighlightText;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
`;function C(i){return i==="top"||i==="left"||i==="right"?i:"bottom"}function E(i){const e=(i||"").trim().toLowerCase();return e==="sm"||e==="1"||e==="compact"?"sm":e==="lg"||e==="3"||e==="comfortable"?"lg":"md"}function I(i){const e=(i||"").trim().toLowerCase();return!e||e==="default"?null:e==="none"?"0px":e==="sm"?"8px":e==="md"?"12px":e==="lg"||e==="large"?"16px":e==="full"||e==="pill"?"999px":e==="square"?"6px":e==="soft"||e==="rounded"?"14px":/^\d+(\.\d+)?$/.test(e)?`${e}px`:/^\d+(\.\d+)?(px|rem|em|%)$/.test(e)?e:i}function p(i,e){return i.getAttribute(e)||""}function f(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function h(){return typeof window<"u"&&typeof document<"u"}function b(i){return i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"||i.disabled===!0}function T(i){return(i.getAttribute("aria-label")||i.textContent||"").trim()}function g(i){if(i)try{i.focus({preventScroll:!0})}catch{i.focus()}}function M(i,e){const t=i.offsetTop,r=t+i.offsetHeight,o=e.scrollTop,a=o+e.clientHeight;if(t<o){e.scrollTop=t;return}r>a&&(e.scrollTop=Math.max(0,r-e.clientHeight))}function O(i){return _(i)}function _(i){if(i.nodeType===Node.TEXT_NODE)return document.createTextNode(i.textContent||"");if(!(i instanceof HTMLElement))return i.cloneNode(!1);const e=i.tagName==="UI-BOX",t=document.createElement(e?"div":i.tagName.toLowerCase());return Array.from(i.attributes).forEach(r=>{r.name!=="slot"&&t.setAttribute(r.name,r.value)}),Array.from(i.childNodes).forEach(r=>{t.appendChild(_(r))}),t}function P(i,e,t){for(let r=e+t;r>=0&&r<i.length;r+=t)if(!b(i[r]))return r;return-1}function D(i,e,t){if(!e)return null;const r=i.filter(a=>!b(a));if(!r.length)return null;const o=t?r.indexOf(t):-1;for(let a=1;a<=r.length;a+=1){const n=r[(o+a+r.length)%r.length];if(T(n).toLowerCase().startsWith(e))return n}return null}const F=new Set(["variant","density","shape","elevation","tone","size","radius"]),L=new Set(["aria-label","aria-labelledby","aria-describedby"]),z=["--ui-dropdown-bg","--ui-dropdown-color","--ui-dropdown-muted","--ui-dropdown-border-color","--ui-dropdown-border","--ui-dropdown-shadow","--ui-dropdown-radius","--ui-dropdown-padding","--ui-dropdown-min-width","--ui-dropdown-gap","--ui-dropdown-ring","--ui-dropdown-backdrop","--ui-dropdown-item-radius","--ui-dropdown-item-font-weight","--ui-dropdown-item-hover-bg","--ui-dropdown-item-active-bg","--ui-dropdown-item-checked-bg","--ui-dropdown-item-active-color","--ui-dropdown-duration","--ui-dropdown-easing"];class x extends y.ElementBase{constructor(){super(),this._isOpen=!1,this._panelEl=null,this._portalEl=null,this._restoreFocusEl=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._placement="bottom",this._openListenersBound=!1,this._openFrame=0,this._checkboxState=new Map,this._radioState=new Map,this._menuId=`ui-dropdown-menu-${Math.random().toString(36).slice(2,10)}`,this._triggerId=`ui-dropdown-trigger-${Math.random().toString(36).slice(2,10)}`,this._onHostClick=this._onHostClick.bind(this),this._onHostKeyDown=this._onHostKeyDown.bind(this),this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["open","disabled","placement","variant","size","density","radius","shape","elevation","tone","close-on-select","close-on-scroll","typeahead","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onHostClick),this.addEventListener("keydown",this._onHostKeyDown),this.root.addEventListener("slotchange",this._onSlotChange),this._syncOpenState(),this._syncTriggerA11y()}disconnectedCallback(){this.removeEventListener("click",this._onHostClick),this.removeEventListener("keydown",this._onHostKeyDown),this.root.removeEventListener("slotchange",this._onSlotChange),this._teardownOpenListeners(),this._openFrame&&cancelAnimationFrame(this._openFrame),super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(!(e==="close-on-select"||e==="close-on-scroll"||e==="typeahead")){if(e==="disabled"){this.hasAttribute("disabled")&&this._isOpen&&this.close("disabled"),this._syncTriggerA11y();return}if(this._isOpen&&(e==="placement"||F.has(e))){this._syncMenuPresentation(),this._schedulePanelSync();return}this._isOpen&&L.has(e)&&this._syncMenuA11y()}}}open(){this.hasAttribute("disabled")||this.hasAttribute("open")||this.setAttribute("open","")}close(e="programmatic"){!this.hasAttribute("open")&&!this._isOpen||this._close(e)}closeDropdown(e="programmatic"){if(!(!this.hasAttribute("open")&&!this._isOpen)){if(e==="programmatic"){this.close(e);return}this._requestClose(e)}}toggle(){if(this._isOpen){this._requestClose("trigger");return}this.open()}get closeOnSelect(){return f(this.getAttribute("close-on-select"),!0)}set closeOnSelect(e){this.setAttribute("close-on-select",e?"true":"false")}get closeOnScroll(){return f(this.getAttribute("close-on-scroll"),!0)}set closeOnScroll(e){this.setAttribute("close-on-scroll",e?"true":"false")}get typeahead(){return f(this.getAttribute("typeahead"),!0)}set typeahead(e){this.setAttribute("typeahead",e?"true":"false")}_getTrigger(){return this.querySelector('[slot="trigger"]')}_getContentSource(){return this.querySelector('[slot="content"]')}_getMenu(){return this._portalEl}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;if(!h())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_currentFocusedItem(){const e=this.root.activeElement||document.activeElement;return e instanceof HTMLElement?e.closest(l):null}_queryItems(e=!0){const t=this._getMenu();if(!t)return[];const r=Array.from(t.querySelectorAll(l));return e?r:r.filter(o=>!b(o))}_requestClose(e){if(!this._isOpen)return;const t=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t);const r=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r),!(t.defaultPrevented||r.defaultPrevented)&&this.close(e)}_close(e,t={}){if(this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=0,this._isOpen=!1,this._teardownOpenListeners(),this.hasAttribute("open")&&this.removeAttribute("open"),this._syncControlState(),this._syncTriggerA11y(),this._clearActiveItem(),this._clearMenuContent(),this._resetTypeahead(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:e}})),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:e}})),t.restoreFocus!==!1){const r=this._getTrigger();r&&this._isFocusable(r)?g(r):this._restoreFocusEl&&this._isFocusable(this._restoreFocusEl)&&g(this._restoreFocusEl)}this._restoreFocusEl=null}_syncOpenState(){const e=this.hasAttribute("open")&&!this.hasAttribute("disabled");if(e===this._isOpen){this._syncControlState(),this._syncTriggerA11y(),e&&(this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync());return}if(e){this._isOpen=!0,this._restoreFocusEl=document.activeElement,this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncControlState(),this._syncTriggerA11y(),this._attachOpenListeners(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0}})),this._schedulePanelSync("first");return}this._close("programmatic",{restoreFocus:!1})}_attachOpenListeners(){this._openListenersBound||(document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!0)}_teardownOpenListeners(){this._openListenersBound&&(document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!1)}_syncTriggerA11y(){const e=this._getTrigger();if(!e)return;const t=k.resolveTriggerControl(e);if(t.id||(t.id=this._triggerId),t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded",this._isOpen?"true":"false"),this._isOpen?t.setAttribute("aria-controls",this._menuId):t.removeAttribute("aria-controls"),this.hasAttribute("disabled")){t.setAttribute("aria-disabled","true"),t.setAttribute("tabindex","-1");return}t.getAttribute("aria-disabled")==="true"&&t.removeAttribute("aria-disabled"),t.getAttribute("tabindex")==="-1"&&t.removeAttribute("tabindex")}_renderMenuContent(){const e=this._getMenu();if(!e)return;e.replaceChildren();const t=this._getContentSource();if(t&&e.appendChild(O(t)),!e.querySelector(l)){const r=document.createElement("div");r.className="empty-state",r.textContent="No items",e.appendChild(r)}this._syncMenuItemSemantics()}_syncMenuItemSemantics(){this._queryItems(!0).forEach((e,t)=>{e.getAttribute("role")||e.setAttribute("role","menuitem"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.dataset.sourceIndex=String(t),e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true"&&e.setAttribute("aria-disabled","true");const r=e.getAttribute("role");(r==="menuitemcheckbox"||r==="menuitemradio")&&!e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false"),this._applyStoredItemState(e,t)})}_clearMenuContent(){const e=this._getMenu();e&&e.replaceChildren()}_applyStoredItemState(e,t){const r=e.getAttribute("role");if(r==="menuitemcheckbox"){if(!this._checkboxState.has(t))return;const n=this._checkboxState.get(t)===!0;e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked");return}if(r!=="menuitemradio")return;const o=e.getAttribute("data-group")||e.getAttribute("name")||"__default__";if(!this._radioState.has(o))return;const a=this._radioState.get(o)===t;e.setAttribute("aria-checked",a?"true":"false"),e.setAttribute("data-state",a?"checked":"unchecked")}_syncMenuPresentation(){const e=this._getMenu();if(!e)return;const t=h()?window.getComputedStyle(this):null;t&&z.forEach(c=>{const m=t.getPropertyValue(c).trim();m?e.style.setProperty(c,m):e.style.removeProperty(c)});const r=p(this,"variant"),o=E(this.getAttribute("size")||this.getAttribute("density")),a=p(this,"density"),n=p(this,"shape"),u=p(this,"elevation"),s=p(this,"tone"),d=I(this.getAttribute("radius")||n||null);if(r&&r!=="default"?e.setAttribute("data-variant",r):e.removeAttribute("data-variant"),o!=="md"?e.setAttribute("data-size",o):e.removeAttribute("data-size"),a&&a!=="default"?e.setAttribute("data-density",a):e.removeAttribute("data-density"),n&&n!=="default"?e.setAttribute("data-shape",n):e.removeAttribute("data-shape"),u&&u!=="default"?e.setAttribute("data-elevation",u):e.removeAttribute("data-elevation"),s&&s!=="default"&&s!=="brand"?e.setAttribute("data-tone",s):e.removeAttribute("data-tone"),d){e.style.setProperty("--ui-dropdown-radius",d),e.style.setProperty("--ui-dropdown-item-radius",d==="999px"?"999px":`max(0px, calc(${d} - 2px))`);return}e.style.removeProperty("--ui-dropdown-radius"),e.style.removeProperty("--ui-dropdown-item-radius")}_syncMenuA11y(){const e=this._getMenu();if(!e)return;const t=this._getTrigger(),r=this.getAttribute("aria-label")||"",o=this.getAttribute("aria-labelledby")||"",a=this.getAttribute("aria-describedby")||"",n=o||(!r&&t?.id?t.id:"");r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label"),n?e.setAttribute("aria-labelledby",n):e.removeAttribute("aria-labelledby"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby")}_syncControlState(){const e=this._panelEl,t=this._getMenu();!e||!t||(e.setAttribute("data-placement",this._placement),w.setPanelOpen(e,this._isOpen,String(this._placement).split("-")[0]))}_schedulePanelSync(e){this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=requestAnimationFrame(()=>{this._openFrame=0,this._syncPanelState(),e==="first"&&this._focusFirstItem(),e==="last"&&this._focusLastItem()})}_syncPanelState(){const e=this._panelEl;!e||!this._isOpen||(this._placement=this._resolvePlacement(),e.setAttribute("data-placement",this._placement),this.style.setProperty("--ui-dropdown-available-width",`${Math.max(0,Math.floor(this._availableWidth(this._placement)))}px`),this.style.setProperty("--ui-dropdown-available-height",`${Math.max(0,Math.floor(this._availableHeight(this._placement)))}px`))}_availableWidth(e){const t=this._getTrigger();if(!t||!h())return 380;const r=t.getBoundingClientRect(),o=window.innerWidth||document.documentElement.clientWidth||0;return e==="left"?r.left-12:e==="right"?o-r.right-12:o-r.left-12}_availableHeight(e){const t=this._getTrigger();if(!t||!h())return 440;const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight||0;return e==="top"?r.top-12:o-r.bottom-12}_resolvePlacement(){const e=C(this.getAttribute("placement")),t=this._getTrigger(),r=this._getMenu();if(!t||!r||!h())return e;const o=t.getBoundingClientRect(),a=window.innerWidth||document.documentElement.clientWidth||0,n=window.innerHeight||document.documentElement.clientHeight||0,u=Math.max(0,n-o.bottom-12),s=Math.max(0,o.top-12),d=Math.max(0,a-o.right-12),c=Math.max(0,o.left-12),m=Math.min(Math.max(r.scrollHeight,r.offsetHeight)+4,320),v=Math.min(Math.max(r.scrollWidth,r.offsetWidth)+4,360);return e==="top"?s>=m||s>u?"top":"bottom":e==="left"?c>=v||c>d?"left":"right":e==="right"?d>=v||d>=c?"right":"left":u>=m||u>=s?"bottom":"top"}_clearActiveItem(){this._queryItems(!0).forEach(e=>e.removeAttribute("data-active"))}_setActiveItem(e,t={}){if(this._clearActiveItem(),!!e&&(e.setAttribute("data-active","true"),t.focus&&g(e),t.scroll)){const r=this._getMenu();r&&M(e,r)}}_focusFirstItem(){const e=this._queryItems(!1);this._setActiveItem(e[0]||null,{focus:!0,scroll:!0})}_focusLastItem(){const e=this._queryItems(!1);this._setActiveItem(e[e.length-1]||null,{focus:!0,scroll:!0})}_moveFocus(e){const t=this._queryItems(!0);if(!t.length)return;const r=this._currentFocusedItem()||this._queryItems(!0).find(n=>n.getAttribute("data-active")==="true")||null,o=r?t.indexOf(r):e>0?-1:t.length,a=P(t,o,e);if(a>=0){this._setActiveItem(t[a],{focus:!0,scroll:!0});return}e>0?this._focusFirstItem():this._focusLastItem()}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_isTypeaheadKey(e){return e.ctrlKey||e.metaKey||e.altKey?!1:e.key.length===1&&/\S/.test(e.key)}_handleTypeahead(e){if(!this.typeahead||!this._isTypeaheadKey(e))return!1;const t=e.key.toLowerCase();this._typeaheadBuffer=`${this._typeaheadBuffer}${t}`.slice(0,24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),460);const r=D(this._queryItems(!0),this._typeaheadBuffer,this._currentFocusedItem());return r?(this._setActiveItem(r,{focus:!0,scroll:!0}),e.preventDefault(),!0):!1}_querySourceItems(){const e=this._getContentSource();return e?Array.from(e.querySelectorAll(l)):[]}_applySelectionBehavior(e){const t=e.getAttribute("role"),r=Number(e.dataset.sourceIndex||"-1");if(t==="menuitemcheckbox"){const n=e.getAttribute("aria-checked")!=="true";e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked"),r>=0&&this._checkboxState.set(r,n);return}if(t!=="menuitemradio")return;const a=e.getAttribute("data-group")||e.getAttribute("name")||""||"__default__";r>=0&&this._radioState.set(a,r),this._queryItems(!0).filter(n=>n.getAttribute("role")==="menuitemradio").forEach(n=>{if((n.getAttribute("data-group")||n.getAttribute("name")||""||"__default__")!==a)return;const s=n===e;n.setAttribute("aria-checked",s?"true":"false"),n.setAttribute("data-state",s?"checked":"unchecked")})}_findMenuItemFromEvent(e){const t=typeof e.composedPath=="function"?e.composedPath():[];for(const o of t)if(o instanceof HTMLElement&&o.matches(l))return o;const r=e.target;return r instanceof HTMLElement?r.closest(l):null}_isEventInsideTrigger(e){const t=this._getTrigger();return t?(typeof e.composedPath=="function"?e.composedPath():[]).includes(t):!1}_emitSelect(e){const t={value:e.getAttribute("data-value")||e.getAttribute("value")||void 0,label:e.getAttribute("aria-label")||e.textContent?.trim()||void 0,checked:e.getAttribute("aria-checked")==="true",item:e};this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:t}))}_onHostClick(e){if(this.hasAttribute("disabled"))return;const t=this._isOpen?this._findMenuItemFromEvent(e):null;if(t&&this._getMenu()?.contains(t)&&!b(t)){this._applySelectionBehavior(t),this._setActiveItem(t,{focus:!0,scroll:!0}),this._emitSelect(t),this.closeOnSelect&&this._requestClose("select");return}if(this._isEventInsideTrigger(e)){if(e.preventDefault(),this._isOpen){this._requestClose("trigger");return}this.open()}}_onHostKeyDown(e){if(!this._isOpen){if(!this._isEventInsideTrigger(e)||!["ArrowDown","ArrowUp","Enter"," "].includes(e.key))return;e.preventDefault(),this.open(),this._schedulePanelSync(e.key==="ArrowUp"?"last":"first");return}if(!this._handleTypeahead(e)){if(e.key==="Escape"){e.preventDefault(),this._requestClose("escape");return}if(e.key==="ArrowDown"){e.preventDefault(),this._moveFocus(1);return}if(e.key==="ArrowUp"){e.preventDefault(),this._moveFocus(-1);return}if(e.key==="Home"){e.preventDefault(),this._focusFirstItem();return}if(e.key==="End"){e.preventDefault(),this._focusLastItem();return}if(e.key==="Tab"){this._requestClose("tab");return}if(e.key==="Enter"||e.key===" "){const t=this._currentFocusedItem();if(!t||!this._getMenu()?.contains(t)||b(t))return;e.preventDefault(),t.click()}}}_onDocumentPointerDown(e){!this._isOpen||(typeof e.composedPath=="function"?e.composedPath():[]).includes(this)||this._requestClose("outside")}_onSlotChange(){this._syncTriggerA11y(),this._isOpen&&(this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync())}render(){this.setContent(`
|
|
494
|
-
<style>${
|
|
493
|
+
`;function E(i){return i==="top"||i==="left"||i==="right"?i:"bottom"}function I(i){const e=(i||"").trim().toLowerCase();return e==="sm"||e==="1"||e==="compact"?"sm":e==="lg"||e==="3"||e==="comfortable"?"lg":"md"}function T(i){const e=(i||"").trim().toLowerCase();return!e||e==="default"?null:e==="none"?"0px":e==="sm"?"8px":e==="md"?"12px":e==="lg"||e==="large"?"16px":e==="full"||e==="pill"?"999px":e==="square"?"6px":e==="soft"||e==="rounded"?"14px":/^\d+(\.\d+)?$/.test(e)?`${e}px`:/^\d+(\.\d+)?(px|rem|em|%)$/.test(e)?e:i}function h(i,e){return i.getAttribute(e)||""}function f(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function p(){return typeof window<"u"&&typeof document<"u"}function b(i){return i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true"||i.disabled===!0}function M(i){return(i.getAttribute("aria-label")||i.textContent||"").trim()}function g(i){if(i)try{i.focus({preventScroll:!0})}catch{i.focus()}}function O(i,e){const t=i.offsetTop,r=t+i.offsetHeight,o=e.scrollTop,a=o+e.clientHeight;if(t<o){e.scrollTop=t;return}r>a&&(e.scrollTop=Math.max(0,r-e.clientHeight))}function P(i){return v.revealClone(x(i))}function x(i){if(i.nodeType===Node.TEXT_NODE)return document.createTextNode(i.textContent||"");if(!(i instanceof HTMLElement))return i.cloneNode(!1);const e=i.tagName==="UI-BOX",t=document.createElement(e?"div":i.tagName.toLowerCase());return Array.from(i.attributes).forEach(r=>{r.name!=="slot"&&t.setAttribute(r.name,r.value)}),Array.from(i.childNodes).forEach(r=>{t.appendChild(x(r))}),t}function D(i,e,t){for(let r=e+t;r>=0&&r<i.length;r+=t)if(!b(i[r]))return r;return-1}function F(i,e,t){if(!e)return null;const r=i.filter(a=>!b(a));if(!r.length)return null;const o=t?r.indexOf(t):-1;for(let a=1;a<=r.length;a+=1){const n=r[(o+a+r.length)%r.length];if(M(n).toLowerCase().startsWith(e))return n}return null}const L=new Set(["variant","density","shape","elevation","tone","size","radius"]),z=new Set(["aria-label","aria-labelledby","aria-describedby"]),q=["--ui-dropdown-bg","--ui-dropdown-color","--ui-dropdown-muted","--ui-dropdown-border-color","--ui-dropdown-border","--ui-dropdown-shadow","--ui-dropdown-radius","--ui-dropdown-padding","--ui-dropdown-min-width","--ui-dropdown-gap","--ui-dropdown-ring","--ui-dropdown-backdrop","--ui-dropdown-item-radius","--ui-dropdown-item-font-weight","--ui-dropdown-item-hover-bg","--ui-dropdown-item-active-bg","--ui-dropdown-item-checked-bg","--ui-dropdown-item-active-color","--ui-dropdown-duration","--ui-dropdown-easing"];class y extends k.ElementBase{constructor(){super(),this._isOpen=!1,this._panelEl=null,this._portalEl=null,this._restoreFocusEl=null,this._typeaheadBuffer="",this._typeaheadTimer=null,this._placement="bottom",this._openListenersBound=!1,this._openFrame=0,this._checkboxState=new Map,this._radioState=new Map,this._menuId=`ui-dropdown-menu-${Math.random().toString(36).slice(2,10)}`,this._triggerId=`ui-dropdown-trigger-${Math.random().toString(36).slice(2,10)}`,this._onHostClick=this._onHostClick.bind(this),this._onHostKeyDown=this._onHostKeyDown.bind(this),this._onDocumentPointerDown=this._onDocumentPointerDown.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["open","disabled","placement","variant","size","density","radius","shape","elevation","tone","close-on-select","close-on-scroll","typeahead","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._onHostClick),this.addEventListener("keydown",this._onHostKeyDown),this.root.addEventListener("slotchange",this._onSlotChange),this._syncOpenState(),this._syncTriggerA11y()}disconnectedCallback(){this.removeEventListener("click",this._onHostClick),this.removeEventListener("keydown",this._onHostKeyDown),this.root.removeEventListener("slotchange",this._onSlotChange),this._teardownOpenListeners(),this._openFrame&&cancelAnimationFrame(this._openFrame),super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(!(e==="close-on-select"||e==="close-on-scroll"||e==="typeahead")){if(e==="disabled"){this.hasAttribute("disabled")&&this._isOpen&&this.close("disabled"),this._syncTriggerA11y();return}if(this._isOpen&&(e==="placement"||L.has(e))){this._syncMenuPresentation(),this._schedulePanelSync();return}this._isOpen&&z.has(e)&&this._syncMenuA11y()}}}open(){this.hasAttribute("disabled")||this.hasAttribute("open")||this.setAttribute("open","")}close(e="programmatic"){!this.hasAttribute("open")&&!this._isOpen||this._close(e)}closeDropdown(e="programmatic"){if(!(!this.hasAttribute("open")&&!this._isOpen)){if(e==="programmatic"){this.close(e);return}this._requestClose(e)}}toggle(){if(this._isOpen){this._requestClose("trigger");return}this.open()}get closeOnSelect(){return f(this.getAttribute("close-on-select"),!0)}set closeOnSelect(e){this.setAttribute("close-on-select",e?"true":"false")}get closeOnScroll(){return f(this.getAttribute("close-on-scroll"),!0)}set closeOnScroll(e){this.setAttribute("close-on-scroll",e?"true":"false")}get typeahead(){return f(this.getAttribute("typeahead"),!0)}set typeahead(e){this.setAttribute("typeahead",e?"true":"false")}_getTrigger(){return this.querySelector('[slot="trigger"]')}_getContentSource(){return this.querySelector('[slot="content"]')}_getMenu(){return this._portalEl}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.getAttribute("aria-hidden")==="true")return!1;if(!p())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_currentFocusedItem(){const e=this.root.activeElement||document.activeElement;return e instanceof HTMLElement?e.closest(l):null}_queryItems(e=!0){const t=this._getMenu();if(!t)return[];const r=Array.from(t.querySelectorAll(l));return e?r:r.filter(o=>!b(o))}_requestClose(e){if(!this._isOpen)return;const t=new CustomEvent("request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(t);const r=new CustomEvent("ui-request-close",{detail:{reason:e},bubbles:!0,composed:!0,cancelable:!0});this.dispatchEvent(r),!(t.defaultPrevented||r.defaultPrevented)&&this.close(e)}_close(e,t={}){if(this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=0,this._isOpen=!1,this._teardownOpenListeners(),this.hasAttribute("open")&&this.removeAttribute("open"),this._syncControlState(),this._syncTriggerA11y(),this._clearActiveItem(),this._clearMenuContent(),this._resetTypeahead(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:e}})),this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:e}})),t.restoreFocus!==!1){const r=this._getTrigger();r&&this._isFocusable(r)?g(r):this._restoreFocusEl&&this._isFocusable(this._restoreFocusEl)&&g(this._restoreFocusEl)}this._restoreFocusEl=null}_syncOpenState(){const e=this.hasAttribute("open")&&!this.hasAttribute("disabled");if(e===this._isOpen){this._syncControlState(),this._syncTriggerA11y(),e&&(this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync());return}if(e){this._isOpen=!0,this._restoreFocusEl=document.activeElement,this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncControlState(),this._syncTriggerA11y(),this._attachOpenListeners(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0}})),this._schedulePanelSync("first");return}this._close("programmatic",{restoreFocus:!1})}_attachOpenListeners(){this._openListenersBound||(document.addEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!0)}_teardownOpenListeners(){this._openListenersBound&&(document.removeEventListener("pointerdown",this._onDocumentPointerDown,!0),this._openListenersBound=!1)}_syncTriggerA11y(){const e=this._getTrigger();if(!e)return;const t=A.resolveTriggerControl(e);if(t.id||(t.id=this._triggerId),t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded",this._isOpen?"true":"false"),this._isOpen?t.setAttribute("aria-controls",this._menuId):t.removeAttribute("aria-controls"),this.hasAttribute("disabled")){t.setAttribute("aria-disabled","true"),t.setAttribute("tabindex","-1");return}t.getAttribute("aria-disabled")==="true"&&t.removeAttribute("aria-disabled"),t.getAttribute("tabindex")==="-1"&&t.removeAttribute("tabindex")}_renderMenuContent(){const e=this._getMenu();if(!e)return;e.replaceChildren();const t=this._getContentSource();if(t&&e.appendChild(P(t)),!e.querySelector(l)){const r=document.createElement("div");r.className="empty-state",r.textContent="No items",e.appendChild(r)}this._syncMenuItemSemantics()}_syncMenuItemSemantics(){this._queryItems(!0).forEach((e,t)=>{e.getAttribute("role")||e.setAttribute("role","menuitem"),e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.dataset.sourceIndex=String(t),e.hasAttribute("disabled")&&e.getAttribute("aria-disabled")!=="true"&&e.setAttribute("aria-disabled","true");const r=e.getAttribute("role");(r==="menuitemcheckbox"||r==="menuitemradio")&&!e.hasAttribute("aria-checked")&&e.setAttribute("aria-checked","false"),this._applyStoredItemState(e,t)})}_clearMenuContent(){const e=this._getMenu();e&&e.replaceChildren()}_applyStoredItemState(e,t){const r=e.getAttribute("role");if(r==="menuitemcheckbox"){if(!this._checkboxState.has(t))return;const n=this._checkboxState.get(t)===!0;e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked");return}if(r!=="menuitemradio")return;const o=e.getAttribute("data-group")||e.getAttribute("name")||"__default__";if(!this._radioState.has(o))return;const a=this._radioState.get(o)===t;e.setAttribute("aria-checked",a?"true":"false"),e.setAttribute("data-state",a?"checked":"unchecked")}_syncMenuPresentation(){const e=this._getMenu();if(!e)return;const t=p()?window.getComputedStyle(this):null;t&&q.forEach(c=>{const m=t.getPropertyValue(c).trim();m?e.style.setProperty(c,m):e.style.removeProperty(c)});const r=h(this,"variant"),o=I(this.getAttribute("size")||this.getAttribute("density")),a=h(this,"density"),n=h(this,"shape"),u=h(this,"elevation"),s=h(this,"tone"),d=T(this.getAttribute("radius")||n||null);if(r&&r!=="default"?e.setAttribute("data-variant",r):e.removeAttribute("data-variant"),o!=="md"?e.setAttribute("data-size",o):e.removeAttribute("data-size"),a&&a!=="default"?e.setAttribute("data-density",a):e.removeAttribute("data-density"),n&&n!=="default"?e.setAttribute("data-shape",n):e.removeAttribute("data-shape"),u&&u!=="default"?e.setAttribute("data-elevation",u):e.removeAttribute("data-elevation"),s&&s!=="default"&&s!=="brand"?e.setAttribute("data-tone",s):e.removeAttribute("data-tone"),d){e.style.setProperty("--ui-dropdown-radius",d),e.style.setProperty("--ui-dropdown-item-radius",d==="999px"?"999px":`max(0px, calc(${d} - 2px))`);return}e.style.removeProperty("--ui-dropdown-radius"),e.style.removeProperty("--ui-dropdown-item-radius")}_syncMenuA11y(){const e=this._getMenu();if(!e)return;const t=this._getTrigger(),r=this.getAttribute("aria-label")||"",o=this.getAttribute("aria-labelledby")||"",a=this.getAttribute("aria-describedby")||"",n=o||(!r&&t?.id?t.id:"");r?e.setAttribute("aria-label",r):e.removeAttribute("aria-label"),n?e.setAttribute("aria-labelledby",n):e.removeAttribute("aria-labelledby"),a?e.setAttribute("aria-describedby",a):e.removeAttribute("aria-describedby")}_syncControlState(){const e=this._panelEl,t=this._getMenu();!e||!t||(e.setAttribute("data-placement",this._placement),_.setPanelOpen(e,this._isOpen,String(this._placement).split("-")[0]))}_schedulePanelSync(e){this._openFrame&&cancelAnimationFrame(this._openFrame),this._openFrame=requestAnimationFrame(()=>{this._openFrame=0,this._syncPanelState(),e==="first"&&this._focusFirstItem(),e==="last"&&this._focusLastItem()})}_syncPanelState(){const e=this._panelEl;!e||!this._isOpen||(this._placement=this._resolvePlacement(),e.setAttribute("data-placement",this._placement),this.style.setProperty("--ui-dropdown-available-width",`${Math.max(0,Math.floor(this._availableWidth(this._placement)))}px`),this.style.setProperty("--ui-dropdown-available-height",`${Math.max(0,Math.floor(this._availableHeight(this._placement)))}px`))}_availableWidth(e){const t=this._getTrigger();if(!t||!p())return 380;const r=t.getBoundingClientRect(),o=window.innerWidth||document.documentElement.clientWidth||0;return e==="left"?r.left-12:e==="right"?o-r.right-12:o-r.left-12}_availableHeight(e){const t=this._getTrigger();if(!t||!p())return 440;const r=t.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight||0;return e==="top"?r.top-12:o-r.bottom-12}_resolvePlacement(){const e=E(this.getAttribute("placement")),t=this._getTrigger(),r=this._getMenu();if(!t||!r||!p())return e;const o=t.getBoundingClientRect(),a=window.innerWidth||document.documentElement.clientWidth||0,n=window.innerHeight||document.documentElement.clientHeight||0,u=Math.max(0,n-o.bottom-12),s=Math.max(0,o.top-12),d=Math.max(0,a-o.right-12),c=Math.max(0,o.left-12),m=Math.min(Math.max(r.scrollHeight,r.offsetHeight)+4,320),w=Math.min(Math.max(r.scrollWidth,r.offsetWidth)+4,360);return e==="top"?s>=m||s>u?"top":"bottom":e==="left"?c>=w||c>d?"left":"right":e==="right"?d>=w||d>=c?"right":"left":u>=m||u>=s?"bottom":"top"}_clearActiveItem(){this._queryItems(!0).forEach(e=>e.removeAttribute("data-active"))}_setActiveItem(e,t={}){if(this._clearActiveItem(),!!e&&(e.setAttribute("data-active","true"),t.focus&&g(e),t.scroll)){const r=this._getMenu();r&&O(e,r)}}_focusFirstItem(){const e=this._queryItems(!1);this._setActiveItem(e[0]||null,{focus:!0,scroll:!0})}_focusLastItem(){const e=this._queryItems(!1);this._setActiveItem(e[e.length-1]||null,{focus:!0,scroll:!0})}_moveFocus(e){const t=this._queryItems(!0);if(!t.length)return;const r=this._currentFocusedItem()||this._queryItems(!0).find(n=>n.getAttribute("data-active")==="true")||null,o=r?t.indexOf(r):e>0?-1:t.length,a=D(t,o,e);if(a>=0){this._setActiveItem(t[a],{focus:!0,scroll:!0});return}e>0?this._focusFirstItem():this._focusLastItem()}_resetTypeahead(){this._typeaheadBuffer="",this._typeaheadTimer!=null&&(window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=null)}_isTypeaheadKey(e){return e.ctrlKey||e.metaKey||e.altKey?!1:e.key.length===1&&/\S/.test(e.key)}_handleTypeahead(e){if(!this.typeahead||!this._isTypeaheadKey(e))return!1;const t=e.key.toLowerCase();this._typeaheadBuffer=`${this._typeaheadBuffer}${t}`.slice(0,24),this._typeaheadTimer!=null&&window.clearTimeout(this._typeaheadTimer),this._typeaheadTimer=window.setTimeout(()=>this._resetTypeahead(),460);const r=F(this._queryItems(!0),this._typeaheadBuffer,this._currentFocusedItem());return r?(this._setActiveItem(r,{focus:!0,scroll:!0}),e.preventDefault(),!0):!1}_querySourceItems(){const e=this._getContentSource();return e?Array.from(e.querySelectorAll(l)):[]}_applySelectionBehavior(e){const t=e.getAttribute("role"),r=Number(e.dataset.sourceIndex||"-1");if(t==="menuitemcheckbox"){const n=e.getAttribute("aria-checked")!=="true";e.setAttribute("aria-checked",n?"true":"false"),e.setAttribute("data-state",n?"checked":"unchecked"),r>=0&&this._checkboxState.set(r,n);return}if(t!=="menuitemradio")return;const a=e.getAttribute("data-group")||e.getAttribute("name")||""||"__default__";r>=0&&this._radioState.set(a,r),this._queryItems(!0).filter(n=>n.getAttribute("role")==="menuitemradio").forEach(n=>{if((n.getAttribute("data-group")||n.getAttribute("name")||""||"__default__")!==a)return;const s=n===e;n.setAttribute("aria-checked",s?"true":"false"),n.setAttribute("data-state",s?"checked":"unchecked")})}_findMenuItemFromEvent(e){const t=typeof e.composedPath=="function"?e.composedPath():[];for(const o of t)if(o instanceof HTMLElement&&o.matches(l))return o;const r=e.target;return r instanceof HTMLElement?r.closest(l):null}_isEventInsideTrigger(e){const t=this._getTrigger();return t?(typeof e.composedPath=="function"?e.composedPath():[]).includes(t):!1}_emitSelect(e){const t={value:e.getAttribute("data-value")||e.getAttribute("value")||void 0,label:e.getAttribute("aria-label")||e.textContent?.trim()||void 0,checked:e.getAttribute("aria-checked")==="true",item:e};this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:t}))}_onHostClick(e){if(this.hasAttribute("disabled"))return;const t=this._isOpen?this._findMenuItemFromEvent(e):null;if(t&&this._getMenu()?.contains(t)&&!b(t)){this._applySelectionBehavior(t),this._setActiveItem(t,{focus:!0,scroll:!0}),this._emitSelect(t),this.closeOnSelect&&this._requestClose("select");return}if(this._isEventInsideTrigger(e)){if(e.preventDefault(),this._isOpen){this._requestClose("trigger");return}this.open()}}_onHostKeyDown(e){if(!this._isOpen){if(!this._isEventInsideTrigger(e)||!["ArrowDown","ArrowUp","Enter"," "].includes(e.key))return;e.preventDefault(),this.open(),this._schedulePanelSync(e.key==="ArrowUp"?"last":"first");return}if(!this._handleTypeahead(e)){if(e.key==="Escape"){e.preventDefault(),this._requestClose("escape");return}if(e.key==="ArrowDown"){e.preventDefault(),this._moveFocus(1);return}if(e.key==="ArrowUp"){e.preventDefault(),this._moveFocus(-1);return}if(e.key==="Home"){e.preventDefault(),this._focusFirstItem();return}if(e.key==="End"){e.preventDefault(),this._focusLastItem();return}if(e.key==="Tab"){this._requestClose("tab");return}if(e.key==="Enter"||e.key===" "){const t=this._currentFocusedItem();if(!t||!this._getMenu()?.contains(t)||b(t))return;e.preventDefault(),t.click()}}}_onDocumentPointerDown(e){!this._isOpen||(typeof e.composedPath=="function"?e.composedPath():[]).includes(this)||this._requestClose("outside")}_onSlotChange(){v.hideCloneSource(this._getContentSource()),this._syncTriggerA11y(),this._isOpen&&(this._renderMenuContent(),this._syncMenuPresentation(),this._syncMenuA11y(),this._schedulePanelSync())}render(){this.setContent(`
|
|
494
|
+
<style>${C}</style>
|
|
495
495
|
<div class="root" part="root">
|
|
496
496
|
<div class="trigger" part="trigger">
|
|
497
497
|
<slot name="trigger"></slot>
|
|
@@ -510,4 +510,4 @@
|
|
|
510
510
|
<slot name="content"></slot>
|
|
511
511
|
</div>
|
|
512
512
|
<slot></slot>
|
|
513
|
-
`),this._panelEl=this.root.querySelector(".panel"),this._portalEl=this.root.querySelector(".menu"),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncTriggerA11y(),this._syncControlState(),this._isOpen?(this._renderMenuContent(),this._schedulePanelSync()):this._clearMenuContent()}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-dropdown")&&customElements.define("ui-dropdown",
|
|
513
|
+
`),this._panelEl=this.root.querySelector(".panel"),this._portalEl=this.root.querySelector(".menu"),v.hideCloneSource(this._getContentSource()),this._syncMenuPresentation(),this._syncMenuA11y(),this._syncTriggerA11y(),this._syncControlState(),this._isOpen?(this._renderMenuContent(),this._schedulePanelSync()):this._clearMenuContent()}shouldRenderOnAttributeChange(){return!1}}typeof customElements<"u"&&!customElements.get("ui-dropdown")&&customElements.define("ui-dropdown",y);exports.UIDropdown=y;
|
package/dist/dropdown.esm.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { E as x } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
|
+
import { h as w, r as y } from "./clone-source-BxK2pEVw.mjs";
|
|
3
|
+
import { O as k, s as A } from "./overlay-motion-BX3dPLay.mjs";
|
|
4
|
+
import { r as S } from "./trigger-BjnxLCeQ.mjs";
|
|
5
|
+
import { c as C } from "./menu-item-styles-CdqxPUuw.mjs";
|
|
5
6
|
const l = [
|
|
6
7
|
'[role="menuitem"]',
|
|
7
8
|
'[role="menuitemcheckbox"]',
|
|
8
9
|
'[role="menuitemradio"]',
|
|
9
10
|
".item",
|
|
10
11
|
"[data-menu-item]"
|
|
11
|
-
].join(", "),
|
|
12
|
-
${
|
|
12
|
+
].join(", "), E = `
|
|
13
|
+
${k}
|
|
13
14
|
|
|
14
15
|
:host {
|
|
15
16
|
--ui-dropdown-bg: var(
|
|
@@ -242,7 +243,7 @@ const l = [
|
|
|
242
243
|
--ui-dropdown-color: #f8fafc;
|
|
243
244
|
--ui-dropdown-muted: #94a3b8;
|
|
244
245
|
--ui-dropdown-border-color: #334155;
|
|
245
|
-
--ui-dropdown-ring: #93c5fd;
|
|
246
|
+
--ui-dropdown-ring: var(--ui-color-accent-on-dark, #93c5fd);
|
|
246
247
|
--ui-dropdown-item-active-color: #f8fafc;
|
|
247
248
|
--ui-dropdown-item-secondary-active-color: color-mix(in srgb, #f8fafc 82%, transparent);
|
|
248
249
|
--ui-dropdown-item-hover-bg: color-mix(in srgb, #ffffff 12%, transparent);
|
|
@@ -279,7 +280,7 @@ const l = [
|
|
|
279
280
|
--ui-dropdown-item-checked-bg: color-mix(in srgb, var(--ui-color-warning, #b45309) 17%, transparent);
|
|
280
281
|
}
|
|
281
282
|
|
|
282
|
-
${
|
|
283
|
+
${C({
|
|
283
284
|
scopes: [".menu"],
|
|
284
285
|
prefix: "--ui-dropdown",
|
|
285
286
|
shortcutSelectors: [".shortcut", ".meta"],
|
|
@@ -512,14 +513,14 @@ const l = [
|
|
|
512
513
|
}
|
|
513
514
|
}
|
|
514
515
|
`;
|
|
515
|
-
function
|
|
516
|
+
function I(i) {
|
|
516
517
|
return i === "top" || i === "left" || i === "right" ? i : "bottom";
|
|
517
518
|
}
|
|
518
|
-
function
|
|
519
|
+
function T(i) {
|
|
519
520
|
const e = (i || "").trim().toLowerCase();
|
|
520
521
|
return e === "sm" || e === "1" || e === "compact" ? "sm" : e === "lg" || e === "3" || e === "comfortable" ? "lg" : "md";
|
|
521
522
|
}
|
|
522
|
-
function
|
|
523
|
+
function M(i) {
|
|
523
524
|
const e = (i || "").trim().toLowerCase();
|
|
524
525
|
return !e || e === "default" ? null : e === "none" ? "0px" : e === "sm" ? "8px" : e === "md" ? "12px" : e === "lg" || e === "large" ? "16px" : e === "full" || e === "pill" ? "999px" : e === "square" ? "6px" : e === "soft" || e === "rounded" ? "14px" : /^\d+(\.\d+)?$/.test(e) ? `${e}px` : /^\d+(\.\d+)?(px|rem|em|%)$/.test(e) ? e : i;
|
|
525
526
|
}
|
|
@@ -537,7 +538,7 @@ function h() {
|
|
|
537
538
|
function b(i) {
|
|
538
539
|
return i.hasAttribute("disabled") || i.getAttribute("aria-disabled") === "true" || i.disabled === !0;
|
|
539
540
|
}
|
|
540
|
-
function
|
|
541
|
+
function O(i) {
|
|
541
542
|
return (i.getAttribute("aria-label") || i.textContent || "").trim();
|
|
542
543
|
}
|
|
543
544
|
function g(i) {
|
|
@@ -548,7 +549,7 @@ function g(i) {
|
|
|
548
549
|
i.focus();
|
|
549
550
|
}
|
|
550
551
|
}
|
|
551
|
-
function
|
|
552
|
+
function P(i, e) {
|
|
552
553
|
const t = i.offsetTop, r = t + i.offsetHeight, o = e.scrollTop, a = o + e.clientHeight;
|
|
553
554
|
if (t < o) {
|
|
554
555
|
e.scrollTop = t;
|
|
@@ -556,10 +557,10 @@ function M(i, e) {
|
|
|
556
557
|
}
|
|
557
558
|
r > a && (e.scrollTop = Math.max(0, r - e.clientHeight));
|
|
558
559
|
}
|
|
559
|
-
function
|
|
560
|
-
return
|
|
560
|
+
function F(i) {
|
|
561
|
+
return y(_(i));
|
|
561
562
|
}
|
|
562
|
-
function
|
|
563
|
+
function _(i) {
|
|
563
564
|
if (i.nodeType === Node.TEXT_NODE)
|
|
564
565
|
return document.createTextNode(i.textContent || "");
|
|
565
566
|
if (!(i instanceof HTMLElement))
|
|
@@ -568,26 +569,26 @@ function w(i) {
|
|
|
568
569
|
return Array.from(i.attributes).forEach((r) => {
|
|
569
570
|
r.name !== "slot" && t.setAttribute(r.name, r.value);
|
|
570
571
|
}), Array.from(i.childNodes).forEach((r) => {
|
|
571
|
-
t.appendChild(
|
|
572
|
+
t.appendChild(_(r));
|
|
572
573
|
}), t;
|
|
573
574
|
}
|
|
574
|
-
function
|
|
575
|
+
function D(i, e, t) {
|
|
575
576
|
for (let r = e + t; r >= 0 && r < i.length; r += t)
|
|
576
577
|
if (!b(i[r])) return r;
|
|
577
578
|
return -1;
|
|
578
579
|
}
|
|
579
|
-
function
|
|
580
|
+
function L(i, e, t) {
|
|
580
581
|
if (!e) return null;
|
|
581
582
|
const r = i.filter((a) => !b(a));
|
|
582
583
|
if (!r.length) return null;
|
|
583
584
|
const o = t ? r.indexOf(t) : -1;
|
|
584
585
|
for (let a = 1; a <= r.length; a += 1) {
|
|
585
586
|
const n = r[(o + a + r.length) % r.length];
|
|
586
|
-
if (
|
|
587
|
+
if (O(n).toLowerCase().startsWith(e)) return n;
|
|
587
588
|
}
|
|
588
589
|
return null;
|
|
589
590
|
}
|
|
590
|
-
const
|
|
591
|
+
const z = /* @__PURE__ */ new Set(["variant", "density", "shape", "elevation", "tone", "size", "radius"]), H = /* @__PURE__ */ new Set(["aria-label", "aria-labelledby", "aria-describedby"]), q = [
|
|
591
592
|
"--ui-dropdown-bg",
|
|
592
593
|
"--ui-dropdown-color",
|
|
593
594
|
"--ui-dropdown-muted",
|
|
@@ -609,7 +610,7 @@ const D = /* @__PURE__ */ new Set(["variant", "density", "shape", "elevation", "
|
|
|
609
610
|
"--ui-dropdown-duration",
|
|
610
611
|
"--ui-dropdown-easing"
|
|
611
612
|
];
|
|
612
|
-
class
|
|
613
|
+
class B extends x {
|
|
613
614
|
constructor() {
|
|
614
615
|
super(), this._isOpen = !1, this._panelEl = null, this._portalEl = null, this._restoreFocusEl = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._placement = "bottom", this._openListenersBound = !1, this._openFrame = 0, this._checkboxState = /* @__PURE__ */ new Map(), this._radioState = /* @__PURE__ */ new Map(), this._menuId = `ui-dropdown-menu-${Math.random().toString(36).slice(2, 10)}`, this._triggerId = `ui-dropdown-trigger-${Math.random().toString(36).slice(2, 10)}`, this._onHostClick = this._onHostClick.bind(this), this._onHostKeyDown = this._onHostKeyDown.bind(this), this._onDocumentPointerDown = this._onDocumentPointerDown.bind(this), this._onSlotChange = this._onSlotChange.bind(this);
|
|
615
616
|
}
|
|
@@ -650,11 +651,11 @@ class H extends _ {
|
|
|
650
651
|
this.hasAttribute("disabled") && this._isOpen && this.close("disabled"), this._syncTriggerA11y();
|
|
651
652
|
return;
|
|
652
653
|
}
|
|
653
|
-
if (this._isOpen && (e === "placement" ||
|
|
654
|
+
if (this._isOpen && (e === "placement" || z.has(e))) {
|
|
654
655
|
this._syncMenuPresentation(), this._schedulePanelSync();
|
|
655
656
|
return;
|
|
656
657
|
}
|
|
657
|
-
this._isOpen &&
|
|
658
|
+
this._isOpen && H.has(e) && this._syncMenuA11y();
|
|
658
659
|
}
|
|
659
660
|
}
|
|
660
661
|
}
|
|
@@ -786,7 +787,7 @@ class H extends _ {
|
|
|
786
787
|
_syncTriggerA11y() {
|
|
787
788
|
const e = this._getTrigger();
|
|
788
789
|
if (!e) return;
|
|
789
|
-
const t =
|
|
790
|
+
const t = S(e);
|
|
790
791
|
if (t.id || (t.id = this._triggerId), t.setAttribute("aria-haspopup", "menu"), t.setAttribute("aria-expanded", this._isOpen ? "true" : "false"), this._isOpen ? t.setAttribute("aria-controls", this._menuId) : t.removeAttribute("aria-controls"), this.hasAttribute("disabled")) {
|
|
791
792
|
t.setAttribute("aria-disabled", "true"), t.setAttribute("tabindex", "-1");
|
|
792
793
|
return;
|
|
@@ -798,7 +799,7 @@ class H extends _ {
|
|
|
798
799
|
if (!e) return;
|
|
799
800
|
e.replaceChildren();
|
|
800
801
|
const t = this._getContentSource();
|
|
801
|
-
if (t && e.appendChild(
|
|
802
|
+
if (t && e.appendChild(F(t)), !e.querySelector(l)) {
|
|
802
803
|
const r = document.createElement("div");
|
|
803
804
|
r.className = "empty-state", r.textContent = "No items", e.appendChild(r);
|
|
804
805
|
}
|
|
@@ -833,11 +834,11 @@ class H extends _ {
|
|
|
833
834
|
const e = this._getMenu();
|
|
834
835
|
if (!e) return;
|
|
835
836
|
const t = h() ? window.getComputedStyle(this) : null;
|
|
836
|
-
t &&
|
|
837
|
+
t && q.forEach((c) => {
|
|
837
838
|
const m = t.getPropertyValue(c).trim();
|
|
838
839
|
m ? e.style.setProperty(c, m) : e.style.removeProperty(c);
|
|
839
840
|
});
|
|
840
|
-
const r = p(this, "variant"), o =
|
|
841
|
+
const r = p(this, "variant"), o = T(this.getAttribute("size") || this.getAttribute("density")), a = p(this, "density"), n = p(this, "shape"), u = p(this, "elevation"), s = p(this, "tone"), d = M(this.getAttribute("radius") || n || null);
|
|
841
842
|
if (r && r !== "default" ? e.setAttribute("data-variant", r) : e.removeAttribute("data-variant"), o !== "md" ? e.setAttribute("data-size", o) : e.removeAttribute("data-size"), a && a !== "default" ? e.setAttribute("data-density", a) : e.removeAttribute("data-density"), n && n !== "default" ? e.setAttribute("data-shape", n) : e.removeAttribute("data-shape"), u && u !== "default" ? e.setAttribute("data-elevation", u) : e.removeAttribute("data-elevation"), s && s !== "default" && s !== "brand" ? e.setAttribute("data-tone", s) : e.removeAttribute("data-tone"), d) {
|
|
842
843
|
e.style.setProperty("--ui-dropdown-radius", d), e.style.setProperty("--ui-dropdown-item-radius", d === "999px" ? "999px" : `max(0px, calc(${d} - 2px))`);
|
|
843
844
|
return;
|
|
@@ -852,7 +853,7 @@ class H extends _ {
|
|
|
852
853
|
}
|
|
853
854
|
_syncControlState() {
|
|
854
855
|
const e = this._panelEl, t = this._getMenu();
|
|
855
|
-
!e || !t || (e.setAttribute("data-placement", this._placement),
|
|
856
|
+
!e || !t || (e.setAttribute("data-placement", this._placement), A(e, this._isOpen, String(this._placement).split("-")[0]));
|
|
856
857
|
}
|
|
857
858
|
_schedulePanelSync(e) {
|
|
858
859
|
this._openFrame && cancelAnimationFrame(this._openFrame), this._openFrame = requestAnimationFrame(() => {
|
|
@@ -876,7 +877,7 @@ class H extends _ {
|
|
|
876
877
|
return e === "top" ? r.top - 12 : o - r.bottom - 12;
|
|
877
878
|
}
|
|
878
879
|
_resolvePlacement() {
|
|
879
|
-
const e =
|
|
880
|
+
const e = I(this.getAttribute("placement")), t = this._getTrigger(), r = this._getMenu();
|
|
880
881
|
if (!t || !r || !h()) return e;
|
|
881
882
|
const o = t.getBoundingClientRect(), a = window.innerWidth || document.documentElement.clientWidth || 0, n = window.innerHeight || document.documentElement.clientHeight || 0, u = Math.max(0, n - o.bottom - 12), s = Math.max(0, o.top - 12), d = Math.max(0, a - o.right - 12), c = Math.max(0, o.left - 12), m = Math.min(Math.max(r.scrollHeight, r.offsetHeight) + 4, 320), v = Math.min(Math.max(r.scrollWidth, r.offsetWidth) + 4, 360);
|
|
882
883
|
return e === "top" ? s >= m || s > u ? "top" : "bottom" : e === "left" ? c >= v || c > d ? "left" : "right" : e === "right" ? d >= v || d >= c ? "right" : "left" : u >= m || u >= s ? "bottom" : "top";
|
|
@@ -887,7 +888,7 @@ class H extends _ {
|
|
|
887
888
|
_setActiveItem(e, t = {}) {
|
|
888
889
|
if (this._clearActiveItem(), !!e && (e.setAttribute("data-active", "true"), t.focus && g(e), t.scroll)) {
|
|
889
890
|
const r = this._getMenu();
|
|
890
|
-
r &&
|
|
891
|
+
r && P(e, r);
|
|
891
892
|
}
|
|
892
893
|
}
|
|
893
894
|
_focusFirstItem() {
|
|
@@ -901,7 +902,7 @@ class H extends _ {
|
|
|
901
902
|
_moveFocus(e) {
|
|
902
903
|
const t = this._queryItems(!0);
|
|
903
904
|
if (!t.length) return;
|
|
904
|
-
const r = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = r ? t.indexOf(r) : e > 0 ? -1 : t.length, a =
|
|
905
|
+
const r = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = r ? t.indexOf(r) : e > 0 ? -1 : t.length, a = D(t, o, e);
|
|
905
906
|
if (a >= 0) {
|
|
906
907
|
this._setActiveItem(t[a], { focus: !0, scroll: !0 });
|
|
907
908
|
return;
|
|
@@ -918,7 +919,7 @@ class H extends _ {
|
|
|
918
919
|
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
919
920
|
const t = e.key.toLowerCase();
|
|
920
921
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${t}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 460);
|
|
921
|
-
const r =
|
|
922
|
+
const r = L(this._queryItems(!0), this._typeaheadBuffer, this._currentFocusedItem());
|
|
922
923
|
return r ? (this._setActiveItem(r, { focus: !0, scroll: !0 }), e.preventDefault(), !0) : !1;
|
|
923
924
|
}
|
|
924
925
|
_querySourceItems() {
|
|
@@ -1023,11 +1024,11 @@ class H extends _ {
|
|
|
1023
1024
|
!this._isOpen || (typeof e.composedPath == "function" ? e.composedPath() : []).includes(this) || this._requestClose("outside");
|
|
1024
1025
|
}
|
|
1025
1026
|
_onSlotChange() {
|
|
1026
|
-
this._syncTriggerA11y(), this._isOpen && (this._renderMenuContent(), this._syncMenuPresentation(), this._syncMenuA11y(), this._schedulePanelSync());
|
|
1027
|
+
w(this._getContentSource()), this._syncTriggerA11y(), this._isOpen && (this._renderMenuContent(), this._syncMenuPresentation(), this._syncMenuA11y(), this._schedulePanelSync());
|
|
1027
1028
|
}
|
|
1028
1029
|
render() {
|
|
1029
1030
|
this.setContent(`
|
|
1030
|
-
<style>${
|
|
1031
|
+
<style>${E}</style>
|
|
1031
1032
|
<div class="root" part="root">
|
|
1032
1033
|
<div class="trigger" part="trigger">
|
|
1033
1034
|
<slot name="trigger"></slot>
|
|
@@ -1046,13 +1047,13 @@ class H extends _ {
|
|
|
1046
1047
|
<slot name="content"></slot>
|
|
1047
1048
|
</div>
|
|
1048
1049
|
<slot></slot>
|
|
1049
|
-
`), this._panelEl = this.root.querySelector(".panel"), this._portalEl = this.root.querySelector(".menu"), this._syncMenuPresentation(), this._syncMenuA11y(), this._syncTriggerA11y(), this._syncControlState(), this._isOpen ? (this._renderMenuContent(), this._schedulePanelSync()) : this._clearMenuContent();
|
|
1050
|
+
`), this._panelEl = this.root.querySelector(".panel"), this._portalEl = this.root.querySelector(".menu"), w(this._getContentSource()), this._syncMenuPresentation(), this._syncMenuA11y(), this._syncTriggerA11y(), this._syncControlState(), this._isOpen ? (this._renderMenuContent(), this._schedulePanelSync()) : this._clearMenuContent();
|
|
1050
1051
|
}
|
|
1051
1052
|
shouldRenderOnAttributeChange() {
|
|
1052
1053
|
return !1;
|
|
1053
1054
|
}
|
|
1054
1055
|
}
|
|
1055
|
-
typeof customElements < "u" && !customElements.get("ui-dropdown") && customElements.define("ui-dropdown",
|
|
1056
|
+
typeof customElements < "u" && !customElements.get("ui-dropdown") && customElements.define("ui-dropdown", B);
|
|
1056
1057
|
export {
|
|
1057
|
-
|
|
1058
|
+
B as UIDropdown
|
|
1058
1059
|
};
|
package/dist/empty-state.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-CbUsP3D6.js"),c=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
--ui-empty-bg: linear-gradient(180deg, var(--ui-color-surface, #ffffff), var(--ui-color-surface-alt, #f8fafc));
|
|
@@ -89,6 +89,16 @@
|
|
|
89
89
|
outline-offset: 2px;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
+
/* variant="plain": no box of its own, for use inside a Card, a table or a panel that already
|
|
93
|
+
draws one. */
|
|
94
|
+
:host([variant="plain"]) .card {
|
|
95
|
+
background: transparent;
|
|
96
|
+
border: 0;
|
|
97
|
+
border-radius: 0;
|
|
98
|
+
box-shadow: none;
|
|
99
|
+
padding-inline: 0;
|
|
100
|
+
}
|
|
101
|
+
|
|
92
102
|
:host([compact]) .card {
|
|
93
103
|
padding: 18px;
|
|
94
104
|
gap: 10px;
|
|
@@ -151,7 +161,7 @@
|
|
|
151
161
|
border-color: Highlight;
|
|
152
162
|
}
|
|
153
163
|
}
|
|
154
|
-
`;function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class n extends a.ElementBase{constructor(){super(),this._actionBtn=null,this._onActionClick=this._onActionClick.bind(this)}static get observedAttributes(){return["title","description","action-label","tone","compact","headless"]}disconnectedCallback(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null),super.disconnectedCallback()}_onActionClick(){this.dispatchEvent(new CustomEvent("action",{bubbles:!0}))}render(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null);const o=this.getAttribute("title")||"No results found",r=this.getAttribute("description")||"Try adjusting your filters or creating a new record.",t=this.getAttribute("action-label")||"";this.setContent(`
|
|
164
|
+
`;function i(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}class n extends a.ElementBase{constructor(){super(),this._actionBtn=null,this._onActionClick=this._onActionClick.bind(this)}static get observedAttributes(){return["title","description","action-label","tone","compact","headless","variant"]}disconnectedCallback(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null),super.disconnectedCallback()}_onActionClick(){this.dispatchEvent(new CustomEvent("action",{bubbles:!0}))}render(){this._actionBtn&&(this._actionBtn.removeEventListener("click",this._onActionClick),this._actionBtn=null);const o=this.getAttribute("title")||"No results found",r=this.getAttribute("description")||"Try adjusting your filters or creating a new record.",t=this.getAttribute("action-label")||"";this.setContent(`
|
|
155
165
|
<style>${c}</style>
|
|
156
166
|
<section class="card" role="status" aria-live="polite">
|
|
157
167
|
<div class="icon" part="icon" aria-hidden="true">
|
package/dist/empty-state.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as n } from "./ElementBase-
|
|
1
|
+
import { E as n } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
2
|
const a = `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
@@ -90,6 +90,16 @@ const a = `
|
|
|
90
90
|
outline-offset: 2px;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/* variant="plain": no box of its own, for use inside a Card, a table or a panel that already
|
|
94
|
+
draws one. */
|
|
95
|
+
:host([variant="plain"]) .card {
|
|
96
|
+
background: transparent;
|
|
97
|
+
border: 0;
|
|
98
|
+
border-radius: 0;
|
|
99
|
+
box-shadow: none;
|
|
100
|
+
padding-inline: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
93
103
|
:host([compact]) .card {
|
|
94
104
|
padding: 18px;
|
|
95
105
|
gap: 10px;
|
|
@@ -153,15 +163,15 @@ const a = `
|
|
|
153
163
|
}
|
|
154
164
|
}
|
|
155
165
|
`;
|
|
156
|
-
function i(
|
|
157
|
-
return
|
|
166
|
+
function i(o) {
|
|
167
|
+
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
158
168
|
}
|
|
159
169
|
class c extends n {
|
|
160
170
|
constructor() {
|
|
161
171
|
super(), this._actionBtn = null, this._onActionClick = this._onActionClick.bind(this);
|
|
162
172
|
}
|
|
163
173
|
static get observedAttributes() {
|
|
164
|
-
return ["title", "description", "action-label", "tone", "compact", "headless"];
|
|
174
|
+
return ["title", "description", "action-label", "tone", "compact", "headless", "variant"];
|
|
165
175
|
}
|
|
166
176
|
disconnectedCallback() {
|
|
167
177
|
this._actionBtn && (this._actionBtn.removeEventListener("click", this._onActionClick), this._actionBtn = null), super.disconnectedCallback();
|
|
@@ -171,7 +181,7 @@ class c extends n {
|
|
|
171
181
|
}
|
|
172
182
|
render() {
|
|
173
183
|
this._actionBtn && (this._actionBtn.removeEventListener("click", this._onActionClick), this._actionBtn = null);
|
|
174
|
-
const
|
|
184
|
+
const e = this.getAttribute("title") || "No results found", r = this.getAttribute("description") || "Try adjusting your filters or creating a new record.", t = this.getAttribute("action-label") || "";
|
|
175
185
|
this.setContent(`
|
|
176
186
|
<style>${a}</style>
|
|
177
187
|
<section class="card" role="status" aria-live="polite">
|
|
@@ -179,7 +189,7 @@ class c extends n {
|
|
|
179
189
|
<slot name="icon">i</slot>
|
|
180
190
|
</div>
|
|
181
191
|
<h3 class="title" part="title">
|
|
182
|
-
<slot name="title">${i(
|
|
192
|
+
<slot name="title">${i(e)}</slot>
|
|
183
193
|
</h3>
|
|
184
194
|
<p class="description" part="description">
|
|
185
195
|
<slot name="description">${i(r)}</slot>
|
|
@@ -191,7 +201,7 @@ class c extends n {
|
|
|
191
201
|
</section>
|
|
192
202
|
`), this._actionBtn = this.root.querySelector(".default-action"), this._actionBtn && this._actionBtn.addEventListener("click", this._onActionClick);
|
|
193
203
|
}
|
|
194
|
-
shouldRenderOnAttributeChange(
|
|
204
|
+
shouldRenderOnAttributeChange(e, r, t) {
|
|
195
205
|
return !0;
|
|
196
206
|
}
|
|
197
207
|
}
|