@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/dialog.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const I=require("./ElementBase-CbUsP3D6.js"),C=require("./scroll-lock-BX6e3Ced.js"),R=require("./dismissable-layer-DNfrKA20.js"),S=require("./focus-scope-Doz0bnE1.js"),E=require("./overlay-motion-B56x1GoY.js"),P=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
box-shadow: none;
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
`,W='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function p(n,t){if(n==null)return t;const i=n.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function a(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function E(){return typeof window<"u"&&typeof document<"u"}function L(n){return window.setTimeout(n,16)}function g(n){n&&window.clearTimeout(n)}const l=class l extends M.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._presented=!1,this._finishClose=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(g(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&g(this._disconnectCleanupFrame),this._restoreFocusFrame&&(g(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=L(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return p(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return p(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return p(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return p(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true"),this.hasAttribute("role")||this.setAttribute("role","dialog")}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,C.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),C.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},s=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:s}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:s,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:s,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&g(this._restoreFocusFrame),this._restoreFocusFrame=L(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,s=!1){const o=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:s});this.dispatchEvent(o);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:s});return this.dispatchEvent(r),o}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!E())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return Array.from(t.querySelectorAll(W)).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const s=E()?window.getComputedStyle(i):null;return!(s&&(s.display==="none"||s.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),o=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!o.hasAttribute("tabindex")&&o===t&&o.setAttribute("tabindex","-1");try{o.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._focusScope?.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;if(!(!t||!i)){if(t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"),t.setAttribute("data-open",String(e)),e){this._finishClose?.(),this._finishClose=null,t.hidden=!1,t.setAttribute("data-state","open"),this._presented||t.removeAttribute("data-instant"),this._presented=!0,this.hasAttribute("headless")||S.liftToTopLayer(t,{resetBox:!1});return}if(this._presented&&!t.hidden){this._presented=!1,t.removeAttribute("data-instant"),this._finishClose=S.closeOverlay(t,()=>{this._finishClose=null,t.hidden=!0;try{t.matches(":popover-open")&&t.hidePopover()}catch{}});return}this._finishClose||(this._presented=!1,t.setAttribute("data-state","closed"),t.hidden=!0)}}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=I.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=R.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||i?.querySelector("form")||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const s=new FormData(e),o={};for(const[r,h]of s.entries()){const c=String(h);if(o[r]==null){o[r]=c;continue}const d=o[r];Array.isArray(d)?d.push(c):o[r]=[d,c]}return Object.keys(o).length?o:void 0}_resolveSubmitForm(t){if(t){const s=t.closest("form");if(s instanceof HTMLFormElement&&this.contains(s))return s}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=this._queryPanel()?.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",s=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",o=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),m=!!(r||c),v=!!(h||d),O=!!this.querySelector('[slot="content"]'),q=!!this.querySelector('[slot="footer"]'),$=this._config.showCancel??!0,T=this._config.showClose??this.dismissible,_=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",x=`ui-dialog-title-${this._uid}`,k=`ui-dialog-description-${this._uid}`,A=`ui-dialog-error-${this._uid}`,D=this.getAttribute("aria-label")||"",z=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",y=z||(m?x:""),F=D||(y?"":"Dialog"),u=[];w?u.push(w):(v&&u.push(k),_&&u.push(A));const B=m||v?`
|
|
391
|
+
`;function p(n,t){if(n==null)return t;const i=n.trim().toLowerCase();return i!=="false"&&i!=="0"&&i!=="off"}function a(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function L(){return typeof window<"u"&&typeof document<"u"}function O(n){return window.setTimeout(n,16)}function g(n){n&&window.clearTimeout(n)}const l=class l extends I.ElementBase{constructor(){super(),this._isActive=!1,this._uid=Math.random().toString(36).slice(2,10),this._dialogId=this._uid,this._lastFocused=null,this._terminalEmitted=!1,this._closeMeta=null,this._runtimeError="",this._config={},this._dismissableLayer=null,this._focusScope=null,this._disconnectCleanupFrame=0,this._restoreFocusFrame=0,this._presented=!1,this._finishClose=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onSubmit=this._onSubmit.bind(this)}static get observedAttributes(){return["open","headless","title","description","closable","dismissible","close-on-overlay","close-on-backdrop","close-on-esc","lock-while-loading","size","state","role","dialog-role","initial-focus","submit-text","cancel-text","loading-text","error-message","aria-label","aria-labelledby","aria-describedby"]}connectedCallback(){this._disconnectCleanupFrame&&(g(this._disconnectCleanupFrame),this._disconnectCleanupFrame=0),super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.addEventListener("submit",this._onSubmit),this._syncFromAttributes(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.removeEventListener("submit",this._onSubmit),this._disconnectCleanupFrame&&g(this._disconnectCleanupFrame),this._restoreFocusFrame&&(g(this._restoreFocusFrame),this._restoreFocusFrame=0),this._disconnectCleanupFrame=O(()=>{this._disconnectCleanupFrame=0,!this.isConnected&&(this._isActive&&!this._terminalEmitted?this.close("dismiss","unmount"):(this._destroyRuntimeControllers(),this._deactivate()),super.disconnectedCallback())})}attributeChangedCallback(t,i,e){if(i!==e){if(t==="open"){this._syncOpenState();return}t==="state"&&e!=="error"&&(this._runtimeError=""),this._syncFromAttributes(),this.isConnected&&this.requestRender()}}get open(){return this.hasAttribute("open")}set open(t){t?this.setAttribute("open",""):this.close("dismiss","programmatic")}get dismissible(){return p(this.getAttribute("dismissible")??this.getAttribute("closable"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t)),this.setAttribute("closable",String(t))}get closeOnOverlay(){return p(this.getAttribute("close-on-overlay")??this.getAttribute("close-on-backdrop"),!0)}set closeOnOverlay(t){this.setAttribute("close-on-overlay",String(t)),this.setAttribute("close-on-backdrop",String(t))}get closeOnEsc(){return p(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get lockWhileLoading(){return p(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"||t==="success"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnOverlay!=null&&(this.closeOnOverlay=!!this._config.closeOnOverlay),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.size&&this.setAttribute("size",this._config.size),this._config.role&&this.setAttribute("dialog-role",this._config.role),this._config.initialFocus&&this.setAttribute("initial-focus",this._config.initialFocus),this._config.ariaLabel&&this.setAttribute("aria-label",this._config.ariaLabel),this._config.ariaLabelledby&&this.setAttribute("aria-labelledby",this._config.ariaLabelledby),this._config.ariaDescribedby&&this.setAttribute("aria-describedby",this._config.ariaDescribedby),this._config.errorMessage&&(this._runtimeError=this._config.errorMessage),this.requestRender()}openDialog(){this.setAttribute("open","")}closeDialog(t="programmatic"){if(!this.hasAttribute("open"))return;const i=new CustomEvent("request-close",{detail:{reason:t},bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(i);const e=new CustomEvent("ui-request-close",{detail:{id:this.dialogId||this._uid,reason:t},bubbles:!0,cancelable:!0,composed:!0});if(this.dispatchEvent(e),!(i.defaultPrevented||e.defaultPrevented)){if(t==="submit"){this.close("submit");return}if(t==="cancel"){this.close("cancel");return}if(t==="overlay"){this.close("dismiss","overlay");return}if(t==="escape"){this.close("dismiss","esc");return}if(t==="button"){this.close("dismiss","close-icon");return}this.close("dismiss","programmatic")}}close(t="dismiss",i,e){this._terminalEmitted||(this._closeMeta={action:t,source:i,reason:e},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}_syncFromAttributes(){!this.hasAttribute("dismissible")&&this.hasAttribute("closable")&&this.setAttribute("dismissible",this.getAttribute("closable")||"true"),!this.hasAttribute("closable")&&this.hasAttribute("dismissible")&&this.setAttribute("closable",this.getAttribute("dismissible")||"true"),!this.hasAttribute("close-on-overlay")&&this.hasAttribute("close-on-backdrop")&&this.setAttribute("close-on-overlay",this.getAttribute("close-on-backdrop")||"true"),!this.hasAttribute("close-on-backdrop")&&this.hasAttribute("close-on-overlay")&&this.setAttribute("close-on-backdrop",this.getAttribute("close-on-overlay")||"true")}_panelRole(){return(this.getAttribute("dialog-role")||this.getAttribute("role")||"").trim()==="alertdialog"?"alertdialog":"dialog"}_syncOpenState(){const t=this.hasAttribute("open");t&&!this._isActive?this._activate():!t&&this._isActive&&this._deactivate(),this._syncOpenUi()}_activate(){this._isActive=!0,this._terminalEmitted=!1,this._closeMeta=null,l._openStack.includes(this)||l._openStack.push(this),this._lastFocused=document.activeElement||null,C.acquireBodyScrollLock();const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this._syncOpenUi(),this._syncRuntimeControllers()}_deactivate(){if(!this._isActive)return;this._isActive=!1,this._destroyRuntimeControllers();const t=l._openStack.lastIndexOf(this);if(t>=0&&l._openStack.splice(t,1),C.releaseBodyScrollLock(),!this._terminalEmitted){const e=this._closeMeta||{action:"dismiss",source:"abort"},o=this.dialogId||this._uid;e.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:o}):this._dispatchWithLegacy("ui-dismiss","dismiss",{id:o,source:e.source||"abort",reason:e.reason}),this._dispatchWithLegacy("ui-close","close",{id:o,action:e.action,source:e.source,reason:e.reason}),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0})),this._terminalEmitted=!0,this._closeMeta=null}const i=this._lastFocused;this._lastFocused=null,i&&this._canRestoreFocus(i)&&(this._restoreFocusFrame&&g(this._restoreFocusFrame),this._restoreFocusFrame=O(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(i)&&i.focus()}catch{}})),this._syncOpenUi()}_dispatchWithLegacy(t,i,e,o=!1){const s=new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:o});this.dispatchEvent(s);const r=new CustomEvent(i,{detail:e,bubbles:!0,composed:!0,cancelable:o});return this.dispatchEvent(r),s}_isTopMost(){if(!this._isActive)return!1;const t=l._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".panel")}_canRestoreFocus(t){if(!t||!t.isConnected||t.disabled||t.getAttribute("aria-hidden")==="true")return!1;if(!L())return!0;const i=window.getComputedStyle(t);return i.display!=="none"&&i.visibility!=="hidden"}_collectFocusable(t){return S.getFocusable(t).filter(i=>{if(i.disabled||i.getAttribute("aria-hidden")==="true")return!1;const o=L()?window.getComputedStyle(i):null;return!(o&&(o.display==="none"||o.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";if(i){const r=t.querySelector(i);if(r&&typeof r.focus=="function"){r.focus();return}}const e=this._collectFocusable(t),s=e.find(r=>r.hasAttribute("autofocus"))||e[0]||t;!s.hasAttribute("tabindex")&&s===t&&s.setAttribute("tabindex","-1");try{s.focus()}catch{}}_onFocusIn(t){!this.open||this._isTopMost()}_handleTab(t){t.key}_destroyRuntimeControllers(){this._dismissableLayer?.destroy(),this._dismissableLayer=null,this._focusScope?.destroy(),this._focusScope=null}_syncOpenUi(){const t=this.root.querySelector(".overlay"),i=this._queryPanel(),e=this.open;if(!(!t||!i)){if(t.setAttribute("aria-hidden",e?"false":"true"),i.setAttribute("aria-hidden",e?"false":"true"),t.setAttribute("data-open",String(e)),e){this._finishClose?.(),this._finishClose=null,t.hidden=!1,t.setAttribute("data-state","open"),this._presented||t.removeAttribute("data-instant"),this._presented=!0,this.hasAttribute("headless")||E.liftToTopLayer(t,{resetBox:!1});return}if(this._presented&&!t.hidden){this._presented=!1,t.removeAttribute("data-instant"),this._finishClose=E.closeOverlay(t,()=>{this._finishClose=null,t.hidden=!0;try{t.matches(":popover-open")&&t.hidePopover()}catch{}});return}this._finishClose||(this._presented=!1,t.setAttribute("data-state","closed"),t.hidden=!0)}}_syncRuntimeControllers(){if(this._destroyRuntimeControllers(),!this.open||!this._isTopMost())return;const t=this._queryPanel();t&&(this._dismissableLayer=R.createDismissableLayer({node:t,closeOnEscape:this.closeOnEsc,closeOnPointerOutside:this.closeOnOverlay,closeOnFocusOutside:!1,onBeforeDismiss:(i,e)=>this._isInteractionLocked()?!1:i==="escape-key"?(this.closeDialog("escape"),!1):(i==="outside-pointer"&&this.closeDialog("overlay"),!1)}),this._focusScope=S.createFocusScope({node:t,trapped:!0,loop:!0,restoreFocus:!1,autoFocus:"first",initialFocus:()=>{const i=this.getAttribute("initial-focus")||this._config.initialFocus||"";return i?t.querySelector(i):null}}))}_collectFormData(t){const i=this._queryPanel(),e=t||this.querySelector("form")||i?.querySelector("form")||null;if(!(e instanceof HTMLFormElement)||typeof FormData>"u")return;const o=new FormData(e),s={};for(const[r,h]of o.entries()){const c=String(h);if(s[r]==null){s[r]=c;continue}const d=s[r];Array.isArray(d)?d.push(c):s[r]=[d,c]}return Object.keys(s).length?s:void 0}_resolveSubmitForm(t){if(t){const o=t.closest("form");if(o instanceof HTMLFormElement&&this.contains(o))return o}const i=this.querySelector("form");if(i instanceof HTMLFormElement)return i;const e=this._queryPanel()?.querySelector("form");return e instanceof HTMLFormElement?e:null}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,i){if(!this._isInteractionLocked()){if(t==="overlay"){this.closeDialog("overlay");return}if(t==="esc"){this.closeDialog("escape");return}if(t==="close-icon"){this.closeDialog("button");return}this.close("dismiss",t,i)}}_handleSubmit(t){if(this._isInteractionLocked())return;const i=t??this._resolveSubmitForm();if(i&&typeof i.reportValidity=="function"&&!i.reportValidity())return;const e={id:this.dialogId||this._uid,formData:this._collectFormData(i)};this._dispatchWithLegacy("ui-submit","submit",e,!0).defaultPrevented||this.closeDialog("submit")}_handleCancel(){this._isInteractionLocked()||this.closeDialog("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const i=t.target;if(i){if(!i.closest(".panel")&&i.closest(".overlay")&&this.closeOnOverlay){this._requestDismiss("overlay");return}if(i.closest(".close")){this._requestDismiss("close-icon");return}if(i.closest(".btn-submit")){this._handleSubmit();return}i.closest(".btn-cancel")&&this._handleCancel()}}_onSubmit(t){if(!this.open||!this._isTopMost())return;const i=t.target;i&&i!==this&&this.contains(i)&&(t.preventDefault(),t.stopPropagation(),this._handleSubmit(i))}_onKeyDown(t){if(!(!this.open||!this._isTopMost())&&t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}}render(){const t=this._config.title??this.getAttribute("title")??"",i=this._config.description??this.getAttribute("description")??"",e=this._config.submitText??this.getAttribute("submit-text")??"Submit",o=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",s=this._config.loadingText??this.getAttribute("loading-text")??"Working...",r=t.trim(),h=i.trim(),c=!!this.querySelector('[slot="title"]'),d=!!this.querySelector('[slot="description"]'),m=!!(r||c),v=!!(h||d),$=!!this.querySelector('[slot="content"]'),q=!!this.querySelector('[slot="footer"]'),D=this._config.showCancel??!0,T=this._config.showClose??this.dismissible,_=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",b=this.state==="loading",x=`ui-dialog-title-${this._uid}`,k=`ui-dialog-description-${this._uid}`,A=`ui-dialog-error-${this._uid}`,z=this.getAttribute("aria-label")||"",B=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",y=B||(m?x:""),F=z||(y?"":"Dialog"),u=[];w?u.push(w):(v&&u.push(k),_&&u.push(A));const M=m||v?`
|
|
392
392
|
<header class="header" part="header">
|
|
393
393
|
${m?`<h2 id="${x}" class="title" part="title"><slot name="title">${a(r)}</slot></h2>`:""}
|
|
394
394
|
${v?`<p id="${k}" class="description" part="description"><slot name="description">${a(h)}</slot></p>`:""}
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
<section
|
|
400
400
|
class="panel"
|
|
401
401
|
part="panel"
|
|
402
|
-
role="${a(this.
|
|
402
|
+
role="${a(this._panelRole())}"
|
|
403
403
|
aria-modal="true"
|
|
404
404
|
${F?`aria-label="${a(F)}"`:""}
|
|
405
405
|
${y?`aria-labelledby="${a(y)}"`:""}
|
|
@@ -413,17 +413,17 @@
|
|
|
413
413
|
<path d="M12.5 3.5L3.5 12.5"></path>
|
|
414
414
|
</svg>
|
|
415
415
|
</button>`:""}
|
|
416
|
-
${
|
|
416
|
+
${M}
|
|
417
417
|
<div class="body" part="body">
|
|
418
|
-
${
|
|
418
|
+
${$?'<slot name="content"></slot>':"<slot></slot>"}
|
|
419
419
|
</div>
|
|
420
420
|
|
|
421
421
|
<div class="error" id="${A}" part="error" aria-live="polite" data-empty="${String(!_)}">${a(_)}</div>
|
|
422
422
|
|
|
423
423
|
<footer class="footer" part="footer">
|
|
424
|
-
${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(
|
|
424
|
+
${b?`<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(s)}</span></span>`:'<span aria-hidden="true"></span>'}
|
|
425
425
|
|
|
426
|
-
${q?'<slot name="footer"></slot>':`${
|
|
426
|
+
${q?'<slot name="footer"></slot>':`${D?`<button class="btn btn-cancel" part="cancel" type="button" ${b?"disabled":""}>${a(o)}</button>`:""}
|
|
427
427
|
<button class="btn btn-submit" part="submit" type="button" ${b?"disabled":""}>${a(e)}</button>`}
|
|
428
428
|
</footer>
|
|
429
429
|
</section>
|
package/dist/dialog.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { E as z } from "./ElementBase-
|
|
1
|
+
import { E as z } from "./ElementBase-D5QsC5Vw.mjs";
|
|
2
2
|
import { a as B, r as I } from "./scroll-lock-LfqXXqsu.mjs";
|
|
3
3
|
import { c as M } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { l as
|
|
6
|
-
const
|
|
4
|
+
import { g as R, a as P } from "./focus-scope-Dl0qk5GP.mjs";
|
|
5
|
+
import { l as W, c as H } from "./overlay-motion-BX3dPLay.mjs";
|
|
6
|
+
const K = `
|
|
7
7
|
:host {
|
|
8
8
|
position: fixed;
|
|
9
9
|
inset: 0;
|
|
@@ -393,8 +393,8 @@ const H = `
|
|
|
393
393
|
box-shadow: none;
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
|
-
|
|
397
|
-
function
|
|
396
|
+
`;
|
|
397
|
+
function b(n, t) {
|
|
398
398
|
if (n == null) return t;
|
|
399
399
|
const i = n.trim().toLowerCase();
|
|
400
400
|
return i !== "false" && i !== "0" && i !== "off";
|
|
@@ -430,6 +430,7 @@ const l = class l extends z {
|
|
|
430
430
|
"size",
|
|
431
431
|
"state",
|
|
432
432
|
"role",
|
|
433
|
+
"dialog-role",
|
|
433
434
|
"initial-focus",
|
|
434
435
|
"submit-text",
|
|
435
436
|
"cancel-text",
|
|
@@ -464,25 +465,25 @@ const l = class l extends z {
|
|
|
464
465
|
t ? this.setAttribute("open", "") : this.close("dismiss", "programmatic");
|
|
465
466
|
}
|
|
466
467
|
get dismissible() {
|
|
467
|
-
return
|
|
468
|
+
return b(this.getAttribute("dismissible") ?? this.getAttribute("closable"), !0);
|
|
468
469
|
}
|
|
469
470
|
set dismissible(t) {
|
|
470
471
|
this.setAttribute("dismissible", String(t)), this.setAttribute("closable", String(t));
|
|
471
472
|
}
|
|
472
473
|
get closeOnOverlay() {
|
|
473
|
-
return
|
|
474
|
+
return b(this.getAttribute("close-on-overlay") ?? this.getAttribute("close-on-backdrop"), !0);
|
|
474
475
|
}
|
|
475
476
|
set closeOnOverlay(t) {
|
|
476
477
|
this.setAttribute("close-on-overlay", String(t)), this.setAttribute("close-on-backdrop", String(t));
|
|
477
478
|
}
|
|
478
479
|
get closeOnEsc() {
|
|
479
|
-
return
|
|
480
|
+
return b(this.getAttribute("close-on-esc"), !0);
|
|
480
481
|
}
|
|
481
482
|
set closeOnEsc(t) {
|
|
482
483
|
this.setAttribute("close-on-esc", String(t));
|
|
483
484
|
}
|
|
484
485
|
get lockWhileLoading() {
|
|
485
|
-
return
|
|
486
|
+
return b(this.getAttribute("lock-while-loading"), !0);
|
|
486
487
|
}
|
|
487
488
|
set lockWhileLoading(t) {
|
|
488
489
|
this.setAttribute("lock-while-loading", String(t));
|
|
@@ -508,7 +509,7 @@ const l = class l extends z {
|
|
|
508
509
|
return this._config;
|
|
509
510
|
}
|
|
510
511
|
set config(t) {
|
|
511
|
-
this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnOverlay != null && (this.closeOnOverlay = !!this._config.closeOnOverlay), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.size && this.setAttribute("size", this._config.size), this._config.role && this.setAttribute("role", this._config.role), this._config.initialFocus && this.setAttribute("initial-focus", this._config.initialFocus), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.errorMessage && (this._runtimeError = this._config.errorMessage), this.requestRender();
|
|
512
|
+
this._config = t || {}, this._config.id && (this._dialogId = this._config.id), this._config.dismissible != null && (this.dismissible = !!this._config.dismissible), this._config.closeOnOverlay != null && (this.closeOnOverlay = !!this._config.closeOnOverlay), this._config.closeOnEsc != null && (this.closeOnEsc = !!this._config.closeOnEsc), this._config.lockWhileLoading != null && (this.lockWhileLoading = !!this._config.lockWhileLoading), this._config.size && this.setAttribute("size", this._config.size), this._config.role && this.setAttribute("dialog-role", this._config.role), this._config.initialFocus && this.setAttribute("initial-focus", this._config.initialFocus), this._config.ariaLabel && this.setAttribute("aria-label", this._config.ariaLabel), this._config.ariaLabelledby && this.setAttribute("aria-labelledby", this._config.ariaLabelledby), this._config.ariaDescribedby && this.setAttribute("aria-describedby", this._config.ariaDescribedby), this._config.errorMessage && (this._runtimeError = this._config.errorMessage), this.requestRender();
|
|
512
513
|
}
|
|
513
514
|
openDialog() {
|
|
514
515
|
this.setAttribute("open", "");
|
|
@@ -562,7 +563,10 @@ const l = class l extends z {
|
|
|
562
563
|
this._runtimeError = "", this.state === "error" && (this.state = "idle"), this.requestRender();
|
|
563
564
|
}
|
|
564
565
|
_syncFromAttributes() {
|
|
565
|
-
!this.hasAttribute("dismissible") && this.hasAttribute("closable") && this.setAttribute("dismissible", this.getAttribute("closable") || "true"), !this.hasAttribute("closable") && this.hasAttribute("dismissible") && this.setAttribute("closable", this.getAttribute("dismissible") || "true"), !this.hasAttribute("close-on-overlay") && this.hasAttribute("close-on-backdrop") && this.setAttribute("close-on-overlay", this.getAttribute("close-on-backdrop") || "true"), !this.hasAttribute("close-on-backdrop") && this.hasAttribute("close-on-overlay") && this.setAttribute("close-on-backdrop", this.getAttribute("close-on-overlay") || "true")
|
|
566
|
+
!this.hasAttribute("dismissible") && this.hasAttribute("closable") && this.setAttribute("dismissible", this.getAttribute("closable") || "true"), !this.hasAttribute("closable") && this.hasAttribute("dismissible") && this.setAttribute("closable", this.getAttribute("dismissible") || "true"), !this.hasAttribute("close-on-overlay") && this.hasAttribute("close-on-backdrop") && this.setAttribute("close-on-overlay", this.getAttribute("close-on-backdrop") || "true"), !this.hasAttribute("close-on-backdrop") && this.hasAttribute("close-on-overlay") && this.setAttribute("close-on-backdrop", this.getAttribute("close-on-overlay") || "true");
|
|
567
|
+
}
|
|
568
|
+
_panelRole() {
|
|
569
|
+
return (this.getAttribute("dialog-role") || this.getAttribute("role") || "").trim() === "alertdialog" ? "alertdialog" : "dialog";
|
|
566
570
|
}
|
|
567
571
|
_syncOpenState() {
|
|
568
572
|
const t = this.hasAttribute("open");
|
|
@@ -578,13 +582,13 @@ const l = class l extends z {
|
|
|
578
582
|
this._isActive = !1, this._destroyRuntimeControllers();
|
|
579
583
|
const t = l._openStack.lastIndexOf(this);
|
|
580
584
|
if (t >= 0 && l._openStack.splice(t, 1), I(), !this._terminalEmitted) {
|
|
581
|
-
const e = this._closeMeta || { action: "dismiss", source: "abort" },
|
|
582
|
-
e.action === "cancel" ? this._dispatchWithLegacy("ui-cancel", "cancel", { id:
|
|
583
|
-
id:
|
|
585
|
+
const e = this._closeMeta || { action: "dismiss", source: "abort" }, o = this.dialogId || this._uid;
|
|
586
|
+
e.action === "cancel" ? this._dispatchWithLegacy("ui-cancel", "cancel", { id: o }) : this._dispatchWithLegacy("ui-dismiss", "dismiss", {
|
|
587
|
+
id: o,
|
|
584
588
|
source: e.source || "abort",
|
|
585
589
|
reason: e.reason
|
|
586
590
|
}), this._dispatchWithLegacy("ui-close", "close", {
|
|
587
|
-
id:
|
|
591
|
+
id: o,
|
|
588
592
|
action: e.action,
|
|
589
593
|
source: e.source,
|
|
590
594
|
reason: e.reason
|
|
@@ -599,21 +603,21 @@ const l = class l extends z {
|
|
|
599
603
|
}
|
|
600
604
|
})), this._syncOpenUi();
|
|
601
605
|
}
|
|
602
|
-
_dispatchWithLegacy(t, i, e,
|
|
603
|
-
const
|
|
606
|
+
_dispatchWithLegacy(t, i, e, o = !1) {
|
|
607
|
+
const s = new CustomEvent(t, {
|
|
604
608
|
detail: e,
|
|
605
609
|
bubbles: !0,
|
|
606
610
|
composed: !0,
|
|
607
|
-
cancelable:
|
|
611
|
+
cancelable: o
|
|
608
612
|
});
|
|
609
|
-
this.dispatchEvent(
|
|
613
|
+
this.dispatchEvent(s);
|
|
610
614
|
const r = new CustomEvent(i, {
|
|
611
615
|
detail: e,
|
|
612
616
|
bubbles: !0,
|
|
613
617
|
composed: !0,
|
|
614
|
-
cancelable:
|
|
618
|
+
cancelable: o
|
|
615
619
|
});
|
|
616
|
-
return this.dispatchEvent(r),
|
|
620
|
+
return this.dispatchEvent(r), s;
|
|
617
621
|
}
|
|
618
622
|
_isTopMost() {
|
|
619
623
|
if (!this._isActive) return !1;
|
|
@@ -630,10 +634,10 @@ const l = class l extends z {
|
|
|
630
634
|
return i.display !== "none" && i.visibility !== "hidden";
|
|
631
635
|
}
|
|
632
636
|
_collectFocusable(t) {
|
|
633
|
-
return
|
|
637
|
+
return R(t).filter((i) => {
|
|
634
638
|
if (i.disabled || i.getAttribute("aria-hidden") === "true") return !1;
|
|
635
|
-
const
|
|
636
|
-
return !(
|
|
639
|
+
const o = C() ? window.getComputedStyle(i) : null;
|
|
640
|
+
return !(o && (o.display === "none" || o.visibility === "hidden"));
|
|
637
641
|
});
|
|
638
642
|
}
|
|
639
643
|
_focusInitial() {
|
|
@@ -648,10 +652,10 @@ const l = class l extends z {
|
|
|
648
652
|
return;
|
|
649
653
|
}
|
|
650
654
|
}
|
|
651
|
-
const e = this._collectFocusable(t),
|
|
652
|
-
!
|
|
655
|
+
const e = this._collectFocusable(t), s = e.find((r) => r.hasAttribute("autofocus")) || e[0] || t;
|
|
656
|
+
!s.hasAttribute("tabindex") && s === t && s.setAttribute("tabindex", "-1");
|
|
653
657
|
try {
|
|
654
|
-
|
|
658
|
+
s.focus();
|
|
655
659
|
} catch {
|
|
656
660
|
}
|
|
657
661
|
}
|
|
@@ -668,11 +672,11 @@ const l = class l extends z {
|
|
|
668
672
|
const t = this.root.querySelector(".overlay"), i = this._queryPanel(), e = this.open;
|
|
669
673
|
if (!(!t || !i)) {
|
|
670
674
|
if (t.setAttribute("aria-hidden", e ? "false" : "true"), i.setAttribute("aria-hidden", e ? "false" : "true"), t.setAttribute("data-open", String(e)), e) {
|
|
671
|
-
this._finishClose?.(), this._finishClose = null, t.hidden = !1, t.setAttribute("data-state", "open"), this._presented || t.removeAttribute("data-instant"), this._presented = !0, this.hasAttribute("headless") ||
|
|
675
|
+
this._finishClose?.(), this._finishClose = null, t.hidden = !1, t.setAttribute("data-state", "open"), this._presented || t.removeAttribute("data-instant"), this._presented = !0, this.hasAttribute("headless") || W(t, { resetBox: !1 });
|
|
672
676
|
return;
|
|
673
677
|
}
|
|
674
678
|
if (this._presented && !t.hidden) {
|
|
675
|
-
this._presented = !1, t.removeAttribute("data-instant"), this._finishClose =
|
|
679
|
+
this._presented = !1, t.removeAttribute("data-instant"), this._finishClose = H(t, () => {
|
|
676
680
|
this._finishClose = null, t.hidden = !0;
|
|
677
681
|
try {
|
|
678
682
|
t.matches(":popover-open") && t.hidePopover();
|
|
@@ -693,7 +697,7 @@ const l = class l extends z {
|
|
|
693
697
|
closeOnPointerOutside: this.closeOnOverlay,
|
|
694
698
|
closeOnFocusOutside: !1,
|
|
695
699
|
onBeforeDismiss: (i, e) => this._isInteractionLocked() ? !1 : i === "escape-key" ? (this.closeDialog("escape"), !1) : (i === "outside-pointer" && this.closeDialog("overlay"), !1)
|
|
696
|
-
}), this._focusScope =
|
|
700
|
+
}), this._focusScope = P({
|
|
697
701
|
node: t,
|
|
698
702
|
trapped: !0,
|
|
699
703
|
loop: !0,
|
|
@@ -708,22 +712,22 @@ const l = class l extends z {
|
|
|
708
712
|
_collectFormData(t) {
|
|
709
713
|
const i = this._queryPanel(), e = t || this.querySelector("form") || i?.querySelector("form") || null;
|
|
710
714
|
if (!(e instanceof HTMLFormElement) || typeof FormData > "u") return;
|
|
711
|
-
const
|
|
712
|
-
for (const [r, h] of
|
|
715
|
+
const o = new FormData(e), s = {};
|
|
716
|
+
for (const [r, h] of o.entries()) {
|
|
713
717
|
const c = String(h);
|
|
714
|
-
if (
|
|
715
|
-
|
|
718
|
+
if (s[r] == null) {
|
|
719
|
+
s[r] = c;
|
|
716
720
|
continue;
|
|
717
721
|
}
|
|
718
|
-
const d =
|
|
719
|
-
Array.isArray(d) ? d.push(c) :
|
|
722
|
+
const d = s[r];
|
|
723
|
+
Array.isArray(d) ? d.push(c) : s[r] = [d, c];
|
|
720
724
|
}
|
|
721
|
-
return Object.keys(
|
|
725
|
+
return Object.keys(s).length ? s : void 0;
|
|
722
726
|
}
|
|
723
727
|
_resolveSubmitForm(t) {
|
|
724
728
|
if (t) {
|
|
725
|
-
const
|
|
726
|
-
if (
|
|
729
|
+
const o = t.closest("form");
|
|
730
|
+
if (o instanceof HTMLFormElement && this.contains(o)) return o;
|
|
727
731
|
}
|
|
728
732
|
const i = this.querySelector("form");
|
|
729
733
|
if (i instanceof HTMLFormElement) return i;
|
|
@@ -796,7 +800,7 @@ const l = class l extends z {
|
|
|
796
800
|
}
|
|
797
801
|
}
|
|
798
802
|
render() {
|
|
799
|
-
const t = this._config.title ?? this.getAttribute("title") ?? "", i = this._config.description ?? this.getAttribute("description") ?? "", e = this._config.submitText ?? this.getAttribute("submit-text") ?? "Submit",
|
|
803
|
+
const t = this._config.title ?? this.getAttribute("title") ?? "", i = this._config.description ?? this.getAttribute("description") ?? "", e = this._config.submitText ?? this.getAttribute("submit-text") ?? "Submit", o = this._config.cancelText ?? this.getAttribute("cancel-text") ?? "Cancel", s = this._config.loadingText ?? this.getAttribute("loading-text") ?? "Working...", r = t.trim(), h = i.trim(), c = !!this.querySelector('[slot="title"]'), d = !!this.querySelector('[slot="description"]'), f = !!(r || c), m = !!(h || d), E = !!this.querySelector('[slot="content"]'), L = !!this.querySelector('[slot="footer"]'), O = this._config.showCancel ?? !0, $ = this._config.showClose ?? this.dismissible, v = this._runtimeError || this._config.errorMessage || this.getAttribute("error-message") || "", p = this.state === "loading", x = `ui-dialog-title-${this._uid}`, k = `ui-dialog-description-${this._uid}`, A = `ui-dialog-error-${this._uid}`, D = this.getAttribute("aria-label") || "", T = this.getAttribute("aria-labelledby") || "", w = this.getAttribute("aria-describedby") || "", _ = T || (f ? x : ""), F = D || (_ ? "" : "Dialog"), u = [];
|
|
800
804
|
w ? u.push(w) : (m && u.push(k), v && u.push(A));
|
|
801
805
|
const q = f || m ? `
|
|
802
806
|
<header class="header" part="header">
|
|
@@ -805,12 +809,12 @@ const l = class l extends z {
|
|
|
805
809
|
</header>
|
|
806
810
|
` : "";
|
|
807
811
|
this._destroyRuntimeControllers(), this.setContent(`
|
|
808
|
-
${this.hasAttribute("headless") ? "" : `<style>${
|
|
812
|
+
${this.hasAttribute("headless") ? "" : `<style>${K}</style>`}
|
|
809
813
|
<div class="overlay" part="overlay" data-open="${String(this.open)}" data-state="${this.open ? "open" : "closed"}" ${this.open ? "data-instant" : "hidden"} aria-hidden="${this.open ? "false" : "true"}">
|
|
810
814
|
<section
|
|
811
815
|
class="panel"
|
|
812
816
|
part="panel"
|
|
813
|
-
role="${a(this.
|
|
817
|
+
role="${a(this._panelRole())}"
|
|
814
818
|
aria-modal="true"
|
|
815
819
|
${F ? `aria-label="${a(F)}"` : ""}
|
|
816
820
|
${_ ? `aria-labelledby="${a(_)}"` : ""}
|
|
@@ -818,7 +822,7 @@ const l = class l extends z {
|
|
|
818
822
|
aria-hidden="${this.open ? "false" : "true"}"
|
|
819
823
|
tabindex="-1"
|
|
820
824
|
>
|
|
821
|
-
${$ ? `<button class="close" part="close" aria-label="Close dialog" type="button" ${
|
|
825
|
+
${$ ? `<button class="close" part="close" aria-label="Close dialog" type="button" ${p ? "disabled" : ""}>
|
|
822
826
|
<svg class="close-icon" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" aria-hidden="true">
|
|
823
827
|
<path d="M3.5 3.5L12.5 12.5"></path>
|
|
824
828
|
<path d="M12.5 3.5L3.5 12.5"></path>
|
|
@@ -832,10 +836,10 @@ const l = class l extends z {
|
|
|
832
836
|
<div class="error" id="${A}" part="error" aria-live="polite" data-empty="${String(!v)}">${a(v)}</div>
|
|
833
837
|
|
|
834
838
|
<footer class="footer" part="footer">
|
|
835
|
-
${
|
|
839
|
+
${p ? `<span class="loading" part="loading"><span class="spinner" aria-hidden="true"></span><span>${a(s)}</span></span>` : '<span aria-hidden="true"></span>'}
|
|
836
840
|
|
|
837
|
-
${L ? '<slot name="footer"></slot>' : `${O ? `<button class="btn btn-cancel" part="cancel" type="button" ${
|
|
838
|
-
<button class="btn btn-submit" part="submit" type="button" ${
|
|
841
|
+
${L ? '<slot name="footer"></slot>' : `${O ? `<button class="btn btn-cancel" part="cancel" type="button" ${p ? "disabled" : ""}>${a(o)}</button>` : ""}
|
|
842
|
+
<button class="btn btn-submit" part="submit" type="button" ${p ? "disabled" : ""}>${a(e)}</button>`}
|
|
839
843
|
</footer>
|
|
840
844
|
</section>
|
|
841
845
|
</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("./ElementBase-CbUsP3D6.js"),n=`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
color-scheme: light dark;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("./ElementBase-CbUsP3D6.js"),a=require("./dismissable-layer-DNfrKA20.js"),u=`
|
|
2
2
|
:host {
|
|
3
3
|
display: contents;
|
|
4
4
|
color-scheme: light dark;
|
package/dist/dock.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-CbUsP3D6.js"),F=1.92,C=148,R=1,D=20,x=.18,_="12px",k="12px 14px",v="56px",O=56,z={xs:{gap:"8px",padding:"8px 10px",itemSize:40,iconSize:18,itemRadius:14},sm:{gap:"10px",padding:"10px 12px",itemSize:48,iconSize:20,itemRadius:16},md:{gap:_,padding:k,itemSize:56,iconSize:24,itemRadius:18},lg:{gap:"14px",padding:"14px 16px",itemSize:64,iconSize:28,itemRadius:20},xl:{gap:"18px",padding:"16px 20px",itemSize:74,iconSize:32,itemRadius:24}},P={calm:{response:.11,damping:.82,spread:.62,lift:.82},smooth:{response:.16,damping:.78,spread:.82,lift:1},snappy:{response:.22,damping:.74,spread:.92,lift:1.06},bouncy:{response:.24,damping:.66,spread:1,lift:1.12}},E=new Set(["gap","padding","radius","item-size","variant","tone","size","elevation"]),N=new Set(["orientation","magnification","distance","idle-scale","lift","smoothing","animation","gap","padding","item-size"]),I=new Set(["label-mode","label-placement"]),V=new Set(["none","sm","md","lg","full"]),q=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-dock-gap: ${_};
|
|
4
4
|
--ui-dock-padding: ${k};
|
package/dist/dock.esm.js
CHANGED
package/dist/drawer.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const T=require("./ElementBase-CbUsP3D6.js"),k=require("./focus-scope-Doz0bnE1.js"),w=require("./overlayManager-CSy3fJmJ.js");function C(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function F(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const D='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',$=new Set(["side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","role","aria-label","aria-labelledby","aria-describedby","initial-focus"]),B=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
--ui-drawer-muted: #94a3b8;
|
|
356
356
|
--ui-drawer-border-color: #334155;
|
|
357
357
|
--ui-drawer-overlay: rgba(2, 6, 23, 0.78);
|
|
358
|
-
--ui-drawer-focus-ring: #93c5fd;
|
|
358
|
+
--ui-drawer-focus-ring: var(--ui-color-accent-on-dark, #93c5fd);
|
|
359
359
|
--ui-drawer-control-bg: #111827;
|
|
360
360
|
--ui-drawer-control-bg-hover: color-mix(in srgb, #ffffff 14%, transparent);
|
|
361
361
|
}
|
|
@@ -494,8 +494,8 @@
|
|
|
494
494
|
display: none;
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
|
-
`;function _(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function y(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function C(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function I(){return typeof window<"u"&&typeof document<"u"}class O extends T.ElementBase{constructor(){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)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if(D.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:_(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return _(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return _(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return _(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?_(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=w.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return this.querySelectorAll(L).forEach(r),e&&e.querySelectorAll(L).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(F(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(F(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(F(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=k(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=k(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&F(this._restoreFocusFrame),this._restoreFocusFrame=k(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const A=this.getAttribute("role")||"dialog";r.setAttribute("role",A);const u=(this.getAttribute("title")||"").trim(),g=(this.getAttribute("description")||"").trim(),c=C(this,"header"),h=this.showClose,x=h||c||!!u||!!g;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!h,a.disabled=n&&this.lockWhileLoading);const b=this.getAttribute("aria-label")||"",m=this.getAttribute("aria-labelledby")||"",v=this.getAttribute("aria-describedby")||"",p=c?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",l=!b&&!m&&!!p,f=m||(!b&&!l&&(c||u)?this._titleId():""),d=[];v?d.push(v):(g&&d.push(this._descriptionId()),d.push(this._bodyId()));const E=b||(l?p:f?"":"Drawer");E?r.setAttribute("aria-label",E):r.removeAttribute("aria-label"),f?r.setAttribute("aria-labelledby",f):r.removeAttribute("aria-labelledby"),d.length?r.setAttribute("aria-describedby",d.join(" ")):r.removeAttribute("aria-describedby")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{w.OverlayManager.unregister(this),w.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{w.OverlayManager.register(this),w.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())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)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=document.activeElement,n=!!o&&this._isNodeInsideDrawer(o);if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=S(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")||"",b=this.getAttribute("aria-describedby")||"",m=s?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",v=!h&&!x&&!!m,p=x||(!h&&!v&&(s||o)?u:""),l=[];b?l.push(b):(n&&l.push(g),l.push(c));const f=h||(v?m:p?"":"Drawer"),d=this.state==="loading";this.setContent(`
|
|
498
|
-
<style>${
|
|
497
|
+
`;function _(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function y(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(i,e){return i==="top"||i==="bottom"||i==="left"||i==="right"?i:i==="start"?e==="rtl"?"right":"left":i==="end"?e==="rtl"?"left":"right":"left"}function E(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function I(){return typeof window<"u"&&typeof document<"u"}class O extends T.ElementBase{constructor(){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)}static get observedAttributes(){return["open","side","dismissible","headless","variant","density","shape","elevation","tone","size","inset","close-on-overlay","close-on-esc","lock-while-loading","show-close","state","title","description","aria-label","aria-labelledby","aria-describedby","initial-focus"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources(),this._restoreFocusEl=null,this._isOpen=!1,super.disconnectedCallback()}attributeChangedCallback(e,t,r){if(t!==r){if(e==="open"){this._syncOpenState();return}if($.has(e)){this._syncLiveUi(),this._isOpen&&(e==="initial-focus"||e==="dismissible"||e==="show-close")&&this._scheduleEnsureFocusTrap();return}this.isConnected&&this.requestRender()}}open(){this.setAttribute("open","")}close(e="programmatic"){this._closeReason=e,this.removeAttribute("open")}closeDrawer(e="programmatic"){if(this.hasAttribute("open")){if(e==="programmatic"){this.close("programmatic");return}this._requestClose(e)}}toggle(){this.hasAttribute("open")?this.close("programmatic"):this.open()}get dismissible(){const e=this.getAttribute("dismissible");return e==null?!1:_(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return _(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return _(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return _(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?_(this.getAttribute("show-close"),!0):this.dismissible}set showClose(e){this.setAttribute("show-close",String(e))}get state(){const e=this.getAttribute("state");return e==="loading"||e==="error"||e==="success"?e:"idle"}set state(e){if(e==="idle"){this.removeAttribute("state");return}this.setAttribute("state",e)}get inset(){return this.hasAttribute("inset")}set inset(e){e?this.setAttribute("inset",""):this.removeAttribute("inset")}_getPanel(){return this.root.querySelector(".panel")}_getOverlay(){return this.root.querySelector(".overlay")}_getHeader(){return this.root.querySelector(".header")}_titleId(){return`ui-drawer-title-${this._uid}`}_descriptionId(){return`ui-drawer-description-${this._uid}`}_bodyId(){return`ui-drawer-body-${this._uid}`}_resolvedSide(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr";return S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=w.OverlayManager.top();return e?e===this:!0}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_isNodeInsideDrawer(e){if(!e)return!1;const t=this._getPanel();return t&&t.contains(e)?!0:this.contains(e)}_isFocusable(e){if(!e||!e.isConnected||e.disabled||e.matches('[inert], [aria-hidden="true"]')||e.closest('[inert], [aria-hidden="true"]'))return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_collectFocusable(){const e=this._getPanel(),t=[],r=s=>{this._isFocusable(s)&&(t.includes(s)||t.push(s))};return e?k.getFocusable(e).forEach(r):this.querySelectorAll(D).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(F(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(F(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(F(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=C(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=C(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&F(this._restoreFocusFrame),this._restoreFocusFrame=C(()=>{this._restoreFocusFrame=0;try{this._canRestoreFocus(e)&&e.focus({preventScroll:!0})}catch{try{this._canRestoreFocus(e)&&e.focus()}catch{}}}))}_syncLiveUi(){const e=this.hasAttribute("open"),t=this._getOverlay(),r=this._getPanel(),s=this._getHeader(),a=this.root.querySelector(".close-btn");if(t&&t.setAttribute("aria-hidden",e?"false":"true"),!r)return;const o=this._resolvedSide();r.classList.remove("side-left","side-right","side-top","side-bottom"),r.classList.add(`side-${o}`);const n=this.state==="loading";n?r.setAttribute("aria-busy","true"):r.removeAttribute("aria-busy");const A=this.getAttribute("role")||"dialog";r.setAttribute("role",A);const u=(this.getAttribute("title")||"").trim(),g=(this.getAttribute("description")||"").trim(),c=E(this,"header"),h=this.showClose,x=h||c||!!u||!!g;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!h,a.disabled=n&&this.lockWhileLoading);const p=this.getAttribute("aria-label")||"",m=this.getAttribute("aria-labelledby")||"",v=this.getAttribute("aria-describedby")||"",b=c?(this.querySelector('[slot="header"]')?.textContent||"").replace(/\s+/g," ").trim():"",l=!p&&!m&&!!b,f=m||(!p&&!l&&(c||u)?this._titleId():""),d=[];v?d.push(v):(g&&d.push(this._descriptionId()),d.push(this._bodyId()));const L=p||(l?b:f?"":"Drawer");L?r.setAttribute("aria-label",L):r.removeAttribute("aria-label"),f?r.setAttribute("aria-labelledby",f):r.removeAttribute("aria-labelledby"),d.length?r.setAttribute("aria-describedby",d.join(" ")):r.removeAttribute("aria-describedby")}_focusInitial(){if(!this._isOpen)return;const e=this._getPanel();if(!e)return;const t=this.getAttribute("initial-focus")||"";if(t){const o=this.querySelector(t)||e.querySelector(t);if(o&&this._isFocusable(o))try{o.focus({preventScroll:!0});return}catch{try{o.focus();return}catch{}}}const r=this._collectFocusable(),a=r.find(o=>o.hasAttribute("autofocus"))||r[0]||e;a===e&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","-1");try{a.focus({preventScroll:!0})}catch{try{a.focus()}catch{}}}_ensureFocusTrap(){if(!this._isOpen||!this._isTopMost())return;const e=document.activeElement;this._isNodeInsideDrawer(e)||this._focusInitial()}_releaseOpenResources(){try{w.OverlayManager.unregister(this),w.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!I())return!0;const t=window.getComputedStyle(e);return t.display!=="none"&&t.visibility!=="hidden"}_syncOpenState(){const e=this.hasAttribute("open");if(this._syncLiveUi(),e===this._isOpen){e?(this._bindGlobalListeners(),this._scheduleEnsureFocusTrap()):(this._unbindGlobalListeners(),this._cancelScheduledFocusWork());return}if(this._isOpen=e,e){this._cancelScheduledFocusWork(),this._bindGlobalListeners(),this._restoreFocusEl=document.activeElement||null,this._closeReason="programmatic";try{w.OverlayManager.register(this),w.OverlayManager.acquireLock()}catch{}this._scheduleFocusInitial(),this._scheduleEnsureFocusTrap(),this.dispatchEvent(new CustomEvent("open",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("show",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!0,reason:"programmatic"}}));return}this._unbindGlobalListeners(),this._cancelScheduledFocusWork(),this._releaseOpenResources();const t=this._closeReason;this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("hide",{bubbles:!0,composed:!0,detail:{reason:t}})),this.dispatchEvent(new CustomEvent("change",{bubbles:!0,composed:!0,detail:{open:!1,reason:t}}));const r=this._restoreFocusEl;this._restoreFocusEl=null,this._closeReason="programmatic",this._scheduleRestoreFocus(r)}_requestClose(e){if(!this._isOpen||this._isInteractionLocked())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)}_onRootClick(e){const t=e.target;if(!t||!this._isOpen)return;if(t.closest(".close-btn")){this._requestClose("button");return}t.closest(".overlay")&&(!this.dismissible||!this.closeOnOverlay||this._isTopMost()&&this._requestClose("overlay"))}_handleTab(e){const t=this._getPanel();if(!t)return;const r=this._collectFocusable();if(!r.length){e.preventDefault(),t.focus();return}const s=r[0],a=r[r.length-1],o=k.deepActiveElement(),n=!!o&&(this._isNodeInsideDrawer(o)||!!t&&k.composedContains(t,o));if(e.shiftKey){if(!n||o===s){e.preventDefault();try{a.focus({preventScroll:!0})}catch{a.focus()}}return}if(!n||o===a){e.preventDefault();try{s.focus({preventScroll:!0})}catch{s.focus()}}}_onDocumentKeyDown(e){if(!(!this._isOpen||!this._isTopMost())){if(e.key==="Escape"){if(!this.dismissible||!this.closeOnEsc||this._isInteractionLocked())return;e.preventDefault(),e.stopPropagation(),this._requestClose("escape");return}e.key==="Tab"&&this._handleTab(e)}}_onDocumentFocusIn(e){if(!this._isOpen||!this._isTopMost())return;const t=e.target,r=this._getPanel(),s=typeof e.composedPath=="function"?e.composedPath():[];t&&this._isNodeInsideDrawer(t)||s.includes(this)||r&&s.includes(r)||this._scheduleFocusInitial()}render(){const e=this.getAttribute("dir")||document.documentElement.getAttribute("dir")||"ltr",t=S(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=E(this,"header"),a=E(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():"",v=!h&&!x&&!!m,b=x||(!h&&!v&&(s||o)?u:""),l=[];p?l.push(p):(n&&l.push(g),l.push(c));const f=h||(v?m:b?"":"Drawer"),d=this.state==="loading";this.setContent(`
|
|
498
|
+
<style>${B}</style>
|
|
499
499
|
<div class="overlay" part="overlay" aria-hidden="true"></div>
|
|
500
500
|
<div
|
|
501
501
|
class="panel side-${t}"
|
|
@@ -503,7 +503,7 @@
|
|
|
503
503
|
role="dialog"
|
|
504
504
|
aria-modal="true"
|
|
505
505
|
${f?`aria-label="${y(f)}"`:""}
|
|
506
|
-
${
|
|
506
|
+
${b?`aria-labelledby="${y(b)}"`:""}
|
|
507
507
|
${l.length?`aria-describedby="${y(l.join(" "))}"`:""}
|
|
508
508
|
${d?'aria-busy="true"':""}
|
|
509
509
|
tabindex="-1"
|