@editora/ui-core 0.1.12 → 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -5
- package/dist/alert-dialog.cjs.js +18 -18
- package/dist/alert-dialog.esm.js +130 -117
- package/dist/app-header.cjs.js +22 -2
- package/dist/app-header.esm.js +22 -2
- package/dist/badge.cjs.js +5 -5
- package/dist/badge.esm.js +9 -8
- package/dist/color-picker.cjs.js +4 -4
- package/dist/color-picker.esm.js +40 -31
- package/dist/combobox.cjs.js +21 -21
- package/dist/combobox.esm.js +79 -40
- package/dist/command-palette.cjs.js +1 -1
- package/dist/command-palette.esm.js +2 -2
- package/dist/components/date-time-utils.d.ts +2 -1
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts +4 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts +6 -0
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts +3 -0
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts +3 -0
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts +3 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +3 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +3 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts +14 -0
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts +3 -0
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts +30 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts +3 -0
- package/dist/components/ui-hover-card.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 +1 -0
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-quick-actions.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts +47 -0
- package/dist/components/ui-radio.d.ts.map +1 -0
- package/dist/components/ui-select.d.ts +8 -0
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts +3 -0
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +12 -12
- package/dist/context-menu.esm.js +160 -133
- package/dist/date-field.cjs.js +1 -1
- package/dist/date-field.esm.js +3 -2
- package/dist/date-picker.cjs.js +13 -13
- package/dist/date-picker.esm.js +101 -67
- package/dist/date-range-picker.cjs.js +14 -14
- package/dist/date-range-picker.esm.js +99 -65
- package/dist/date-range-time-picker.cjs.js +13 -13
- package/dist/date-range-time-picker.esm.js +77 -45
- package/dist/date-time-picker.cjs.js +13 -13
- package/dist/date-time-picker.esm.js +133 -101
- package/dist/date-time-utils-66480de4.js +1 -0
- package/dist/date-time-utils-a2c7af25.mjs +307 -0
- package/dist/dialog.cjs.js +29 -20
- package/dist/dialog.esm.js +90 -70
- package/dist/drawer.cjs.js +16 -16
- package/dist/drawer.esm.js +216 -98
- package/dist/floating-toolbar.cjs.js +6 -16
- package/dist/floating-toolbar.esm.js +57 -40
- package/dist/gantt.cjs.js +656 -74
- package/dist/gantt.esm.js +1050 -100
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +62 -39
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +300 -286
- package/dist/menu.cjs.js +2 -2
- package/dist/menu.esm.js +118 -110
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +83 -78
- package/dist/{overlayManager-ece06517.js → overlayManager-0eda4e08.js} +1 -1
- package/dist/{overlayManager-86454af7.mjs → overlayManager-5bbd4dc3.mjs} +1 -1
- package/dist/popover.cjs.js +1 -1
- package/dist/popover.esm.js +2 -2
- package/dist/portal-c69756c0.js +1 -0
- package/dist/portal-fe73e5cc.mjs +123 -0
- package/dist/portal.d.ts +29 -3
- package/dist/portal.d.ts.map +1 -1
- package/dist/positioner-33529bb8.js +1 -0
- package/dist/positioner-e9770c66.mjs +582 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +36 -26
- package/dist/primitives/positioner.d.ts +199 -1
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/quick-actions.cjs.js +10 -4
- package/dist/quick-actions.esm.js +27 -21
- package/dist/radio.cjs.js +259 -0
- package/dist/radio.esm.js +455 -0
- package/dist/{runtime-4ac0107b.mjs → runtime-161f68a2.mjs} +24 -23
- package/dist/runtime-3f13807b.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +39 -24
- package/dist/scroll-lock-31da444f.mjs +56 -0
- package/dist/scroll-lock-d7b0df21.js +1 -0
- package/dist/scroll-lock.d.ts.map +1 -1
- package/dist/select.cjs.js +14 -15
- package/dist/select.esm.js +117 -97
- package/dist/selection-popup.cjs.js +4 -7
- package/dist/selection-popup.esm.js +8 -11
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +2 -2
- package/dist/standalone/radio.d.ts +2 -0
- package/dist/standalone/radio.d.ts.map +1 -0
- package/dist/stepper.cjs.js +19 -50
- package/dist/stepper.esm.js +17 -48
- package/dist/time-field.cjs.js +1 -1
- package/dist/time-field.esm.js +3 -2
- package/dist/time-picker.cjs.js +15 -15
- package/dist/time-picker.esm.js +100 -68
- package/dist/tooltip.cjs.js +1 -1
- package/dist/tooltip.esm.js +2 -1
- package/package.json +1 -1
- package/dist/date-time-utils-5cf58cd0.js +0 -1
- package/dist/date-time-utils-bdceb7af.mjs +0 -273
- package/dist/portal-1cf392ca.mjs +0 -114
- package/dist/portal-d8d7fbca.js +0 -1
- package/dist/positioner-accc6e5f.js +0 -1
- package/dist/positioner-fbd61bf1.mjs +0 -132
- package/dist/runtime-5f282bc8.js +0 -1
- package/dist/scroll-lock-48793569.js +0 -1
- package/dist/scroll-lock-9de6d328.mjs +0 -53
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
# @editora/ui-core
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
> **Live Website:** https://editora-ecosystem.netlify.app/
|
|
5
|
-
> **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
3
|
+

|
|
6
4
|
|
|
5
|
+
## Demos
|
|
6
|
+
|
|
7
|
+
- **CodeSandbox:** https://qjr47y-5173.csb.app/button
|
|
8
|
+
- **UI Component Catalog:** https://editora-ecosystem.netlify.app/
|
|
9
|
+
- **Web Demo:** https://editora-free.netlify.app/
|
|
10
|
+
- **Storybook:** https://editora-ecosystem-storybook.netlify.app/
|
|
7
11
|
|
|
8
12
|
Production-oriented Web Components for Editora UI.
|
|
9
13
|
|
|
@@ -78,6 +82,7 @@ More guidance lives in [`docs/FRAMEWORK_DIRECT_USAGE.md`](https://github.com/aja
|
|
|
78
82
|
- `ElementBase`
|
|
79
83
|
- `applyTheme`, `defaultTokens`
|
|
80
84
|
- `showPortalFor`, `autoUpdatePosition`, portal helpers
|
|
85
|
+
- `createPositioner`, `computePositionState`, `autoUpdatePositioner`, middleware helpers, virtual anchors
|
|
81
86
|
- focus/overlay managers
|
|
82
87
|
- `showToast`
|
|
83
88
|
|
|
@@ -169,7 +174,56 @@ More guidance lives in [`docs/FRAMEWORK_DIRECT_USAGE.md`](https://github.com/aja
|
|
|
169
174
|
<ui-pagination id="usersPager"></ui-pagination>
|
|
170
175
|
```
|
|
171
176
|
|
|
172
|
-
### 4.
|
|
177
|
+
### 4. Gantt planning timeline
|
|
178
|
+
|
|
179
|
+
`ui-gantt` is a framework-agnostic planning workspace for schedules, release plans, and project roadmaps. It includes task, summary, and milestone rows; dependency links; drag/resize editing; baselines; critical tasks; split segments; keyboard navigation; and automatic row virtualization for large schedules.
|
|
180
|
+
|
|
181
|
+
```html
|
|
182
|
+
<ui-gantt id="releasePlan" zoom="week" sort="start" bar-variant="soft"></ui-gantt>
|
|
183
|
+
|
|
184
|
+
<script type="module">
|
|
185
|
+
import '@editora/ui-core';
|
|
186
|
+
|
|
187
|
+
const gantt = document.getElementById('releasePlan');
|
|
188
|
+
|
|
189
|
+
gantt.setAttribute('tasks', JSON.stringify([
|
|
190
|
+
{
|
|
191
|
+
id: 'api',
|
|
192
|
+
label: 'API contracts',
|
|
193
|
+
start: '2026-02-10',
|
|
194
|
+
end: '2026-02-24',
|
|
195
|
+
progress: 62,
|
|
196
|
+
baselineStart: '2026-02-07',
|
|
197
|
+
baselineEnd: '2026-02-21',
|
|
198
|
+
critical: true
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
id: 'qa',
|
|
202
|
+
label: 'QA sign-off',
|
|
203
|
+
start: '2026-02-27',
|
|
204
|
+
type: 'milestone',
|
|
205
|
+
tone: 'success'
|
|
206
|
+
}
|
|
207
|
+
]));
|
|
208
|
+
|
|
209
|
+
gantt.setAttribute('links', JSON.stringify([
|
|
210
|
+
{ id: 'api-qa', source: 'api', target: 'qa', type: 'e2s' }
|
|
211
|
+
]));
|
|
212
|
+
|
|
213
|
+
gantt.addEventListener('taskchange', (event) => console.log('task changed', event.detail));
|
|
214
|
+
gantt.addEventListener('taskdelete', (event) => console.log('delete task', event.detail.id));
|
|
215
|
+
gantt.addEventListener('linkselect', (event) => console.log('dependency selected', event.detail));
|
|
216
|
+
</script>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Useful attributes:
|
|
220
|
+
|
|
221
|
+
- `zoom`: `day`, `week`, `month`, `quarter`, or `year`
|
|
222
|
+
- `sort`: `none`, `start`, `end`, `label`, or `progress`
|
|
223
|
+
- `bar-variant`: `solid`, `soft`, `striped`, `outline`, or `glass`
|
|
224
|
+
- `readonly`, `show-toolbar`, `show-today`, `filter`, `virtualized="false"`
|
|
225
|
+
|
|
226
|
+
### 5. Promise dialog manager
|
|
173
227
|
|
|
174
228
|
```ts
|
|
175
229
|
import '@editora/ui-core';
|
|
@@ -190,7 +244,7 @@ if (result.action === 'submit') {
|
|
|
190
244
|
}
|
|
191
245
|
```
|
|
192
246
|
|
|
193
|
-
###
|
|
247
|
+
### 6. Promise alert dialog manager
|
|
194
248
|
|
|
195
249
|
```ts
|
|
196
250
|
import '@editora/ui-core';
|
|
@@ -229,10 +283,46 @@ applyTheme({
|
|
|
229
283
|
});
|
|
230
284
|
```
|
|
231
285
|
|
|
286
|
+
## Floating Positioning
|
|
287
|
+
|
|
288
|
+
`@editora/ui-core` includes the shared floating engine used by menus, context menus, hover cards, floating toolbars, and picker overlays.
|
|
289
|
+
|
|
290
|
+
Use `@editora/ui-core/runtime` for framework-agnostic floating behavior:
|
|
291
|
+
|
|
292
|
+
```ts
|
|
293
|
+
import { createPositioner } from '@editora/ui-core/runtime';
|
|
294
|
+
|
|
295
|
+
const handle = createPositioner({
|
|
296
|
+
anchor: trigger,
|
|
297
|
+
floating: panel,
|
|
298
|
+
placement: 'bottom-start',
|
|
299
|
+
strategy: 'fixed',
|
|
300
|
+
offset: 8,
|
|
301
|
+
flip: true,
|
|
302
|
+
shift: true,
|
|
303
|
+
fitViewport: true
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
// later
|
|
307
|
+
handle.destroy();
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
You can also use:
|
|
311
|
+
|
|
312
|
+
- `computePositionState()` for one-shot coordinate calculation
|
|
313
|
+
- `autoUpdatePositioner()` for observer-driven updates
|
|
314
|
+
- `createVirtualPoint()`, `createVirtualRect()`, `createVirtualRange()` for virtual anchors
|
|
315
|
+
- `detectPositionerOverflow()` for diagnostics and custom middleware
|
|
316
|
+
|
|
317
|
+
Full guide:
|
|
318
|
+
|
|
319
|
+
- `docs/FLOATING_USAGE.md`
|
|
320
|
+
|
|
232
321
|
## Docs
|
|
233
322
|
|
|
234
323
|
- `docs/FRAMEWORK_DIRECT_USAGE.md` for Vue, Svelte, and Angular direct-use guidance
|
|
235
324
|
- `docs/ATTRIBUTE_RENDER_MATRIX.md` for component render strategy coverage
|
|
325
|
+
- `docs/FLOATING_USAGE.md` for first-party floating primitives and Floating UI-style usage
|
|
236
326
|
- `docs/PRIMITIVE_GAP_MATRIX.md` for the missing primitive roadmap
|
|
237
327
|
- `docs/PRIMITIVE_IMPLEMENTATION_PLAN.md` for proposed APIs and rollout order
|
|
238
328
|
|
package/dist/alert-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 J=require("./ElementBase-1b301e7f.js"),p=require("./scroll-lock-d7b0df21.js"),Q=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
color-scheme: light dark;
|
|
@@ -497,71 +497,71 @@
|
|
|
497
497
|
border: 1px solid CanvasText;
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
`,J='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function p(i,t){if(i==null)return t;const e=i.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="off"}function a(i){return String(i).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Q(i){return i==="info"||i==="success"||i==="warning"||i==="danger"?i:"neutral"}function X(i){return i==="sm"||i==="1"?"sm":i==="lg"||i==="3"?"lg":"md"}function tt(i){return i==="soft"||i==="outline"||i==="solid"?i:"surface"}function et(i){return i==="none"||i==="high"?i:"low"}function it(i){return i==="none"?"none":"line"}function rt(i,t="var(--base-alert-dialog-radius, var(--ui-radius, 4px))"){if(i==null)return t;const e=i.trim().toLowerCase();return e?e==="full"||e==="pill"?"999px":/^-?\d+(\.\d+)?$/.test(e)?`${e}px`:i:t}const st=new Set(["tone","size","variant","elevation","indicator","radius"]);function at(i){return i==="success"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M5 10.2 8.3 13.4 15 6.8"></path></svg>':i==="warning"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.6 17 16.4H3L10 3.6Z"></path><path d="M10 8v3.4"></path><circle cx="10" cy="14.1" r="0.9" fill="currentColor" stroke="none"></circle></svg>':i==="danger"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="m7.5 7.5 5 5M12.5 7.5l-5 5"></path></svg>':i==="info"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="M10 13v-3.8"></path><circle cx="10" cy="6.5" r="0.9" fill="currentColor" stroke="none"></circle></svg>':'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 10h8"></path><circle cx="10" cy="10" r="7.1"></circle></svg>'}function l(){return typeof window<"u"&&typeof document<"u"}function S(){if(!l())return null;const i=document.activeElement;return i instanceof HTMLElement?i:null}const I=class c extends Z.ElementBase{constructor(){super(),this._lastActive=null,this._active=!1,this._terminalEmitted=!1,this._closeMeta=null,this._uid=Math.random().toString(36).slice(2,10),this._dialogId="",this._config={},this._inputValue="",this._checked=!1,this._runtimeError="",this._activeHeadless=!1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onInput=this._onInput.bind(this),this._dialogId=this._uid}static get observedAttributes(){return["open","headless","dismissible","close-on-esc","close-on-backdrop","lock-while-loading","role","tone","size","variant","elevation","indicator","radius","state","aria-label","aria-labelledby","aria-describedby","initial-focus","title","description","confirm-text","cancel-text","loading-text","error-message"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("input",this._onInput),this._syncFromAttributes(),this._syncVisualTokens(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("input",this._onInput),this._active&&!this._terminalEmitted&&this.close("dismiss","unmount"),this._deactivate(),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(st.has(t)){this._syncVisualTokens();return}if(t==="headless"){this._syncActiveEnvironment(),this.requestRender();return}if(t==="open"){this._syncOpenState();return}t==="state"&&r!=="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 headless(){return this.hasAttribute("headless")}set headless(t){t?this.setAttribute("headless",""):this.removeAttribute("headless")}get dismissible(){return p(this.getAttribute("dismissible"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t))}get closeOnEsc(){return p(this.getAttribute("close-on-esc"),this.dismissible)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get closeOnBackdrop(){return p(this.getAttribute("close-on-backdrop"),this.dismissible)}set closeOnBackdrop(t){this.setAttribute("close-on-backdrop",String(t))}get lockWhileLoading(){return p(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get roleType(){return this.getAttribute("role")==="dialog"?"dialog":"alertdialog"}set roleType(t){this.setAttribute("role",t)}get tone(){return Q(this.getAttribute("tone"))}set tone(t){if(t==="neutral"){this.removeAttribute("tone");return}this.setAttribute("tone",t)}get size(){return X(this.getAttribute("size"))}set size(t){if(t==="md"){this.removeAttribute("size");return}this.setAttribute("size",t)}get variant(){return tt(this.getAttribute("variant"))}set variant(t){if(t==="surface"){this.removeAttribute("variant");return}this.setAttribute("variant",t)}get elevation(){return et(this.getAttribute("elevation"))}set elevation(t){if(t==="low"){this.removeAttribute("elevation");return}this.setAttribute("elevation",t)}get indicator(){return it(this.getAttribute("indicator"))}set indicator(t){if(t==="line"){this.removeAttribute("indicator");return}this.setAttribute("indicator",t)}get radius(){return this.getAttribute("radius")||""}set radius(t){if(!t){this.removeAttribute("radius");return}this.setAttribute("radius",t)}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get initialFocus(){return this.getAttribute("initial-focus")||this._config.initialFocus||""}set initialFocus(t){if(!t){this.removeAttribute("initial-focus");return}this.setAttribute("initial-focus",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){var e,r;this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.closeOnBackdrop!=null&&(this.closeOnBackdrop=!!this._config.closeOnBackdrop),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.role&&(this.roleType=this._config.role),this._config.tone&&(this.tone=this._config.tone),this._config.size&&(this.size=this._config.size),this._config.variant&&(this.variant=this._config.variant),this._config.elevation&&(this.elevation=this._config.elevation),this._config.indicator&&(this.indicator=this._config.indicator),this._config.radius!=null&&(this.radius=String(this._config.radius)),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.initialFocus&&(this.initialFocus=this._config.initialFocus),this._config.headless!=null&&(this.headless=!!this._config.headless),this._inputValue=((e=this._config.input)==null?void 0:e.value)??this._inputValue,this._checked=((r=this._config.checkbox)==null?void 0:r.checked)??this._checked,this._runtimeError=this._config.errorMessage||"",this._syncVisualTokens(),this.requestRender()}getInputValue(){const t=this.root.querySelector(".input");return(t==null?void 0:t.value)??this._inputValue}setInputValue(t){this._inputValue=t;const e=this.root.querySelector(".input");e&&(e.value=t)}getChecked(){const t=this.root.querySelector(".checkbox-input");return(t==null?void 0:t.checked)??this._checked}setChecked(t){this._checked=t;const e=this.root.querySelector(".checkbox-input");e&&(e.checked=t)}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}close(t="dismiss",e,r){this._terminalEmitted||(this._closeMeta={action:t,source:e,reason:r},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}_syncFromAttributes(){this.hasAttribute("role")||this.setAttribute("role","alertdialog")}_syncVisualTokens(){this.style.setProperty("--ui-alert-radius",rt(this.getAttribute("radius")))}_syncOpenState(){const t=this.hasAttribute("open");if(t&&!this._active){this._activate();return}!t&&this._active&&this._deactivate()}_activate(){this._active=!0,this._activeHeadless=this.headless,this._terminalEmitted=!1,this._closeMeta=null,c._openStack.includes(this)||c._openStack.push(this),this._lastActive=this.headless?null:S(),this.headless||h.acquireBodyScrollLock(),l()&&!this.headless&&document.addEventListener("focusin",this._onFocusIn,!0);const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.headless||setTimeout(()=>{this._focusInitial()},0),this.requestRender()}_deactivate(){if(!this._active)return;this._active=!1;const t=c._openStack.lastIndexOf(this);if(t>=0&&c._openStack.splice(t,1),l()&&!this._activeHeadless&&document.removeEventListener("focusin",this._onFocusIn,!0),this._activeHeadless||h.releaseBodyScrollLock(),!this._terminalEmitted){const r=this._closeMeta||{action:"dismiss",source:"abort"},s=this.dialogId||this._uid;r.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:s}):r.action==="dismiss"&&this._dispatchWithLegacy("ui-dismiss","dismiss",{id:s,source:r.source||"abort",reason:r.reason}),this._dispatchWithLegacy("ui-close","close",{id:s,action:r.action,source:r.source,reason:r.reason}),this._terminalEmitted=!0,this._closeMeta=null}const e=this._lastActive;this._lastActive=null,e&&!this._activeHeadless&&setTimeout(()=>{try{e.focus()}catch{}},0),this._activeHeadless=!1,this.requestRender()}_syncActiveEnvironment(){if(this._active&&this.headless!==this._activeHeadless){if(this.headless){l()&&document.removeEventListener("focusin",this._onFocusIn,!0),h.releaseBodyScrollLock(),this._lastActive=null,this._activeHeadless=!0;return}this._lastActive=S(),h.acquireBodyScrollLock(),l()&&document.addEventListener("focusin",this._onFocusIn,!0),this._activeHeadless=!1,setTimeout(()=>{this._focusInitial()},0)}}_dispatchWithLegacy(t,e,r,s=!1){const o=new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:s});this.dispatchEvent(o);const n=new CustomEvent(e,{detail:r,bubbles:!0,composed:!0,cancelable:s});return this.dispatchEvent(n),o}_isTopMost(){if(!this._active)return!1;const t=c._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".dialog")}_collectFocusable(t){return Array.from(t.querySelectorAll(J)).filter(e=>{if(e.disabled||e.getAttribute("aria-hidden")==="true")return!1;const s=l()?window.getComputedStyle(e):null;return!(s&&(s.display==="none"||s.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const e=this.initialFocus;if(e){const n=t.querySelector(e);if(n&&typeof n.focus=="function"){n.focus();return}}const r=this._collectFocusable(t),o=r.find(n=>n.hasAttribute("autofocus"))||r[0]||t;!o.hasAttribute("tabindex")&&o===t&&o.setAttribute("tabindex","-1");try{o.focus()}catch{}}_handleTab(t){if(t.key!=="Tab")return;const e=this._queryPanel();if(!e)return;const r=this._collectFocusable(e);if(!r.length){t.preventDefault(),e.focus();return}const s=this.root.activeElement||document.activeElement,o=r[0],n=r[r.length-1];if(t.shiftKey){(s===o||!s||!e.contains(s))&&(t.preventDefault(),n.focus());return}s===n&&(t.preventDefault(),o.focus())}_onFocusIn(t){if(!this.open||!this._isTopMost())return;const e=this._queryPanel();if(!e)return;const r=t.target;(typeof t.composedPath=="function"?t.composedPath():[]).includes(e)||r&&e.contains(r)||this._focusInitial()}_onInput(t){const e=t.target;e&&(e.classList.contains("input")&&(this._inputValue=e.value),e.classList.contains("checkbox-input")&&(this._checked=e.checked),this._dispatchWithLegacy("ui-change","change",{id:this.dialogId||this._uid,inputValue:this._inputValue,checked:this._checked}))}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,e){this._isInteractionLocked()||this.close("dismiss",t,e)}_handleConfirm(){const t={id:this.dialogId||this._uid,inputValue:this.getInputValue(),checked:this.getChecked()};this._dispatchWithLegacy("ui-confirm","confirm",t,!0).defaultPrevented||this.close("confirm")}_handleCancel(){this._isInteractionLocked()||this.close("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const e=t.target;if(e){if(e.classList.contains("backdrop")&&this.closeOnBackdrop){this._requestDismiss("backdrop");return}if(e.closest(".close")){this._requestDismiss("close-icon");return}if(e.closest(".btn-confirm")){this._handleConfirm();return}e.closest(".btn-cancel")&&this._handleCancel()}}_onKeyDown(t){if(!(!this.open||!this._isTopMost())){if(t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}this._handleTab(t)}}render(){var w,A,z,E,C,L;if(!this.open){this.setContent("");return}const t=this._config.title??this.getAttribute("title")??"",e=this._config.description??this.getAttribute("description")??"",r=this._config.confirmText??this.getAttribute("confirm-text")??"Confirm",s=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",o=this._config.loadingText??this.getAttribute("loading-text")??"Working...",n=!!((w=this._config.input)!=null&&w.enabled),$=((A=this._config.input)==null?void 0:A.label)||"Value",T=((z=this._config.input)==null?void 0:z.placeholder)||"",q=!!((E=this._config.input)!=null&&E.required),F=!!((C=this._config.checkbox)!=null&&C.enabled),D=((L=this._config.checkbox)==null?void 0:L.label)||"Remember this choice",M=this.state,g=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",m=`ui-alert-title-${this._uid}`,x=`ui-alert-description-${this._uid}`,_=`ui-alert-error-${this._uid}`,O=!!this.querySelector('[slot="title"]'),V=!!this.querySelector('[slot="description"]'),H=!!this.querySelector('[slot="icon"]'),W=!!this.querySelector('[slot="footer"]'),P=!!this.querySelector('[slot="content"]'),b=O||!!t,f=V||!!e,R=H||b||f,j=this._config.showCancel??this.dismissible,K=this._config.showClose??this.dismissible,U=this.tone,Y=this.getAttribute("aria-label")||"",N=this.getAttribute("aria-labelledby")||"",k=this.getAttribute("aria-describedby")||"",v=N||(b?m:""),y=Y||(v?"":t||e||"Dialog"),u=[];k?u.push(k):(f&&u.push(x),g&&u.push(_));const d=M==="loading";this.setContent(`
|
|
501
|
-
<style>${
|
|
500
|
+
`,X='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';function g(i,t){if(i==null)return t;const e=i.trim().toLowerCase();return e!=="false"&&e!=="0"&&e!=="off"}function a(i){return String(i).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function tt(i){return i==="info"||i==="success"||i==="warning"||i==="danger"?i:"neutral"}function et(i){return i==="sm"||i==="1"?"sm":i==="lg"||i==="3"?"lg":"md"}function it(i){return i==="soft"||i==="outline"||i==="solid"?i:"surface"}function rt(i){return i==="none"||i==="high"?i:"low"}function st(i){return i==="none"?"none":"line"}function at(i,t="var(--base-alert-dialog-radius, var(--ui-radius, 4px))"){if(i==null)return t;const e=i.trim().toLowerCase();return e?e==="full"||e==="pill"?"999px":/^-?\d+(\.\d+)?$/.test(e)?`${e}px`:i:t}const ot=new Set(["tone","size","variant","elevation","indicator","radius"]);function nt(i){return i==="success"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M5 10.2 8.3 13.4 15 6.8"></path></svg>':i==="warning"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M10 3.6 17 16.4H3L10 3.6Z"></path><path d="M10 8v3.4"></path><circle cx="10" cy="14.1" r="0.9" fill="currentColor" stroke="none"></circle></svg>':i==="danger"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="m7.5 7.5 5 5M12.5 7.5l-5 5"></path></svg>':i==="info"?'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><circle cx="10" cy="10" r="7.1"></circle><path d="M10 13v-3.8"></path><circle cx="10" cy="6.5" r="0.9" fill="currentColor" stroke="none"></circle></svg>':'<svg width="16" height="16" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M6 10h8"></path><circle cx="10" cy="10" r="7.1"></circle></svg>'}function l(){return typeof window<"u"&&typeof document<"u"}function S(){if(!l())return null;const i=document.activeElement;return i instanceof HTMLElement?i:null}function x(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function h(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const B=class c extends J.ElementBase{constructor(){super(),this._lastActive=null,this._active=!1,this._terminalEmitted=!1,this._closeMeta=null,this._uid=Math.random().toString(36).slice(2,10),this._dialogId="",this._config={},this._inputValue="",this._checked=!1,this._runtimeError="",this._activeHeadless=!1,this._focusInitialFrame=0,this._restoreFocusFrame=0,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onFocusIn=this._onFocusIn.bind(this),this._onInput=this._onInput.bind(this),this._dialogId=this._uid}static get observedAttributes(){return["open","headless","dismissible","close-on-esc","close-on-backdrop","lock-while-loading","role","tone","size","variant","elevation","indicator","radius","state","aria-label","aria-labelledby","aria-describedby","initial-focus","title","description","confirm-text","cancel-text","loading-text","error-message"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("input",this._onInput),this._syncFromAttributes(),this._syncVisualTokens(),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("input",this._onInput),this._focusInitialFrame&&(h(this._focusInitialFrame),this._focusInitialFrame=0),this._restoreFocusFrame&&(h(this._restoreFocusFrame),this._restoreFocusFrame=0),this._active&&!this._terminalEmitted&&this.close("dismiss","unmount"),this._deactivate(),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(ot.has(t)){this._syncVisualTokens();return}if(t==="headless"){this._syncActiveEnvironment(),this.requestRender();return}if(t==="open"){this._syncOpenState();return}t==="state"&&r!=="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 headless(){return this.hasAttribute("headless")}set headless(t){t?this.setAttribute("headless",""):this.removeAttribute("headless")}get dismissible(){return g(this.getAttribute("dismissible"),!0)}set dismissible(t){this.setAttribute("dismissible",String(t))}get closeOnEsc(){return g(this.getAttribute("close-on-esc"),this.dismissible)}set closeOnEsc(t){this.setAttribute("close-on-esc",String(t))}get closeOnBackdrop(){return g(this.getAttribute("close-on-backdrop"),this.dismissible)}set closeOnBackdrop(t){this.setAttribute("close-on-backdrop",String(t))}get lockWhileLoading(){return g(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(t){this.setAttribute("lock-while-loading",String(t))}get roleType(){return this.getAttribute("role")==="dialog"?"dialog":"alertdialog"}set roleType(t){this.setAttribute("role",t)}get tone(){return tt(this.getAttribute("tone"))}set tone(t){if(t==="neutral"){this.removeAttribute("tone");return}this.setAttribute("tone",t)}get size(){return et(this.getAttribute("size"))}set size(t){if(t==="md"){this.removeAttribute("size");return}this.setAttribute("size",t)}get variant(){return it(this.getAttribute("variant"))}set variant(t){if(t==="surface"){this.removeAttribute("variant");return}this.setAttribute("variant",t)}get elevation(){return rt(this.getAttribute("elevation"))}set elevation(t){if(t==="low"){this.removeAttribute("elevation");return}this.setAttribute("elevation",t)}get indicator(){return st(this.getAttribute("indicator"))}set indicator(t){if(t==="line"){this.removeAttribute("indicator");return}this.setAttribute("indicator",t)}get radius(){return this.getAttribute("radius")||""}set radius(t){if(!t){this.removeAttribute("radius");return}this.setAttribute("radius",t)}get state(){const t=this.getAttribute("state");return t==="loading"||t==="error"?t:"idle"}set state(t){if(t==="idle"){this.removeAttribute("state");return}this.setAttribute("state",t)}get initialFocus(){return this.getAttribute("initial-focus")||this._config.initialFocus||""}set initialFocus(t){if(!t){this.removeAttribute("initial-focus");return}this.setAttribute("initial-focus",t)}get dialogId(){return this._dialogId}set dialogId(t){this._dialogId=t||this._uid,this.requestRender()}get config(){return this._config}set config(t){var e,r;this._config=t||{},this._config.id&&(this._dialogId=this._config.id),this._config.dismissible!=null&&(this.dismissible=!!this._config.dismissible),this._config.closeOnEsc!=null&&(this.closeOnEsc=!!this._config.closeOnEsc),this._config.closeOnBackdrop!=null&&(this.closeOnBackdrop=!!this._config.closeOnBackdrop),this._config.lockWhileLoading!=null&&(this.lockWhileLoading=!!this._config.lockWhileLoading),this._config.role&&(this.roleType=this._config.role),this._config.tone&&(this.tone=this._config.tone),this._config.size&&(this.size=this._config.size),this._config.variant&&(this.variant=this._config.variant),this._config.elevation&&(this.elevation=this._config.elevation),this._config.indicator&&(this.indicator=this._config.indicator),this._config.radius!=null&&(this.radius=String(this._config.radius)),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.initialFocus&&(this.initialFocus=this._config.initialFocus),this._config.headless!=null&&(this.headless=!!this._config.headless),this._inputValue=((e=this._config.input)==null?void 0:e.value)??this._inputValue,this._checked=((r=this._config.checkbox)==null?void 0:r.checked)??this._checked,this._runtimeError=this._config.errorMessage||"",this._syncVisualTokens(),this.requestRender()}getInputValue(){const t=this.root.querySelector(".input");return(t==null?void 0:t.value)??this._inputValue}setInputValue(t){this._inputValue=t;const e=this.root.querySelector(".input");e&&(e.value=t)}getChecked(){const t=this.root.querySelector(".checkbox-input");return(t==null?void 0:t.checked)??this._checked}setChecked(t){this._checked=t;const e=this.root.querySelector(".checkbox-input");e&&(e.checked=t)}setError(t){this._runtimeError=t,this.state=t?"error":"idle",this.requestRender()}clearError(){this._runtimeError="",this.state==="error"&&(this.state="idle"),this.requestRender()}close(t="dismiss",e,r){this._terminalEmitted||(this._closeMeta={action:t,source:e,reason:r},this.hasAttribute("open")&&this.removeAttribute("open"),this._syncOpenState())}_syncFromAttributes(){this.hasAttribute("role")||this.setAttribute("role","alertdialog")}_syncVisualTokens(){this.style.setProperty("--ui-alert-radius",at(this.getAttribute("radius")))}_syncOpenState(){const t=this.hasAttribute("open");if(t&&!this._active){this._activate();return}!t&&this._active&&this._deactivate()}_activate(){this._active=!0,this._activeHeadless=this.headless,this._terminalEmitted=!1,this._closeMeta=null,c._openStack.includes(this)||c._openStack.push(this),this._lastActive=this.headless?null:S(),this.headless||p.acquireBodyScrollLock(),l()&&!this.headless&&document.addEventListener("focusin",this._onFocusIn,!0);const t=this.dialogId||this._uid;this._dispatchWithLegacy("ui-open","open",{id:t}),this.headless||(this._focusInitialFrame&&h(this._focusInitialFrame),this._focusInitialFrame=x(()=>{this._focusInitialFrame=0,this._focusInitial()})),this.requestRender()}_deactivate(){if(!this._active)return;this._active=!1;const t=c._openStack.lastIndexOf(this);if(t>=0&&c._openStack.splice(t,1),l()&&!this._activeHeadless&&document.removeEventListener("focusin",this._onFocusIn,!0),this._activeHeadless||p.releaseBodyScrollLock(),!this._terminalEmitted){const r=this._closeMeta||{action:"dismiss",source:"abort"},s=this.dialogId||this._uid;r.action==="cancel"?this._dispatchWithLegacy("ui-cancel","cancel",{id:s}):r.action==="dismiss"&&this._dispatchWithLegacy("ui-dismiss","dismiss",{id:s,source:r.source||"abort",reason:r.reason}),this._dispatchWithLegacy("ui-close","close",{id:s,action:r.action,source:r.source,reason:r.reason}),this._terminalEmitted=!0,this._closeMeta=null}const e=this._lastActive;this._lastActive=null,e&&!this._activeHeadless&&(this._restoreFocusFrame&&h(this._restoreFocusFrame),this._restoreFocusFrame=x(()=>{this._restoreFocusFrame=0;try{e.focus()}catch{}})),this._activeHeadless=!1,this.requestRender()}_syncActiveEnvironment(){if(this._active&&this.headless!==this._activeHeadless){if(this.headless){l()&&document.removeEventListener("focusin",this._onFocusIn,!0),p.releaseBodyScrollLock(),this._lastActive=null,this._activeHeadless=!0;return}this._lastActive=S(),p.acquireBodyScrollLock(),l()&&document.addEventListener("focusin",this._onFocusIn,!0),this._activeHeadless=!1,this._focusInitialFrame&&h(this._focusInitialFrame),this._focusInitialFrame=x(()=>{this._focusInitialFrame=0,this._focusInitial()})}}_dispatchWithLegacy(t,e,r,s=!1){const o=new CustomEvent(t,{detail:r,bubbles:!0,composed:!0,cancelable:s});this.dispatchEvent(o);const n=new CustomEvent(e,{detail:r,bubbles:!0,composed:!0,cancelable:s});return this.dispatchEvent(n),o}_isTopMost(){if(!this._active)return!1;const t=c._openStack;return t.length>0&&t[t.length-1]===this}_queryPanel(){return this.root.querySelector(".dialog")}_collectFocusable(t){return Array.from(t.querySelectorAll(X)).filter(e=>{if(e.disabled||e.getAttribute("aria-hidden")==="true")return!1;const s=l()?window.getComputedStyle(e):null;return!(s&&(s.display==="none"||s.visibility==="hidden"))})}_focusInitial(){if(!this.open)return;const t=this._queryPanel();if(!t)return;const e=this.initialFocus;if(e){const n=t.querySelector(e);if(n&&typeof n.focus=="function"){n.focus();return}}const r=this._collectFocusable(t),o=r.find(n=>n.hasAttribute("autofocus"))||r[0]||t;!o.hasAttribute("tabindex")&&o===t&&o.setAttribute("tabindex","-1");try{o.focus()}catch{}}_handleTab(t){if(t.key!=="Tab")return;const e=this._queryPanel();if(!e)return;const r=this._collectFocusable(e);if(!r.length){t.preventDefault(),e.focus();return}const s=this.root.activeElement||document.activeElement,o=r[0],n=r[r.length-1];if(t.shiftKey){(s===o||!s||!e.contains(s))&&(t.preventDefault(),n.focus());return}s===n&&(t.preventDefault(),o.focus())}_onFocusIn(t){if(!this.open||!this._isTopMost())return;const e=this._queryPanel();if(!e)return;const r=t.target;(typeof t.composedPath=="function"?t.composedPath():[]).includes(e)||r&&e.contains(r)||this._focusInitial()}_onInput(t){const e=t.target;e&&(e.classList.contains("input")&&(this._inputValue=e.value),e.classList.contains("checkbox-input")&&(this._checked=e.checked),this._dispatchWithLegacy("ui-change","change",{id:this.dialogId||this._uid,inputValue:this._inputValue,checked:this._checked}))}_isInteractionLocked(){return this.state==="loading"&&this.lockWhileLoading}_requestDismiss(t,e){this._isInteractionLocked()||this.close("dismiss",t,e)}_handleConfirm(){const t={id:this.dialogId||this._uid,inputValue:this.getInputValue(),checked:this.getChecked()};this._dispatchWithLegacy("ui-confirm","confirm",t,!0).defaultPrevented||this.close("confirm")}_handleCancel(){this._isInteractionLocked()||this.close("cancel")}_onClick(t){if(!this.open||!this._isTopMost())return;const e=t.target;if(e){if(e.classList.contains("backdrop")&&this.closeOnBackdrop){this._requestDismiss("backdrop");return}if(e.closest(".close")){this._requestDismiss("close-icon");return}if(e.closest(".btn-confirm")){this._handleConfirm();return}e.closest(".btn-cancel")&&this._handleCancel()}}_onKeyDown(t){if(!(!this.open||!this._isTopMost())){if(t.key==="Escape"){if(!this.closeOnEsc)return;t.preventDefault(),t.stopPropagation(),this._requestDismiss("esc");return}this._handleTab(t)}}render(){var F,z,I,E,C,L;if(!this.open){this.setContent("");return}const t=this._config.title??this.getAttribute("title")??"",e=this._config.description??this.getAttribute("description")??"",r=this._config.confirmText??this.getAttribute("confirm-text")??"Confirm",s=this._config.cancelText??this.getAttribute("cancel-text")??"Cancel",o=this._config.loadingText??this.getAttribute("loading-text")??"Working...",n=!!((F=this._config.input)!=null&&F.enabled),T=((z=this._config.input)==null?void 0:z.label)||"Value",q=((I=this._config.input)==null?void 0:I.placeholder)||"",D=!!((E=this._config.input)!=null&&E.required),M=!!((C=this._config.checkbox)!=null&&C.enabled),O=((L=this._config.checkbox)==null?void 0:L.label)||"Remember this choice",V=this.state,f=this._runtimeError||this._config.errorMessage||this.getAttribute("error-message")||"",_=`ui-alert-title-${this._uid}`,k=`ui-alert-description-${this._uid}`,y=`ui-alert-error-${this._uid}`,H=!!this.querySelector('[slot="title"]'),W=!!this.querySelector('[slot="description"]'),P=!!this.querySelector('[slot="icon"]'),R=!!this.querySelector('[slot="footer"]'),j=!!this.querySelector('[slot="content"]'),b=H||!!t,m=W||!!e,K=P||b||m,U=this._config.showCancel??this.dismissible,Y=this._config.showClose??this.dismissible,N=this.tone,Z=this.getAttribute("aria-label")||"",G=this.getAttribute("aria-labelledby")||"",w=this.getAttribute("aria-describedby")||"",v=G||(b?_:""),A=Z||(v?"":t||e||"Dialog"),u=[];w?u.push(w):(m&&u.push(k),f&&u.push(y));const d=V==="loading";this.setContent(`
|
|
501
|
+
<style>${Q}</style>
|
|
502
502
|
<div class="backdrop" part="backdrop" role="presentation" data-open="${String(this.open)}">
|
|
503
503
|
<section
|
|
504
504
|
class="dialog"
|
|
505
505
|
part="dialog"
|
|
506
506
|
role="${a(this.roleType)}"
|
|
507
507
|
aria-modal="true"
|
|
508
|
-
${
|
|
508
|
+
${A?`aria-label="${a(A)}"`:""}
|
|
509
509
|
${v?`aria-labelledby="${a(v)}"`:""}
|
|
510
510
|
${u.length?`aria-describedby="${a(u.join(" "))}"`:""}
|
|
511
511
|
tabindex="-1"
|
|
512
512
|
>
|
|
513
|
-
${
|
|
513
|
+
${Y?`<button class="close" part="close" aria-label="Close dialog">
|
|
514
514
|
<svg width="14" height="14" viewBox="0 0 20 20" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round">
|
|
515
515
|
<path d="m6 6 8 8M14 6l-8 8"></path>
|
|
516
516
|
</svg>
|
|
517
517
|
</button>`:""}
|
|
518
518
|
|
|
519
|
-
${
|
|
519
|
+
${K?`<header class="header">
|
|
520
520
|
<div class="header-main">
|
|
521
521
|
<span class="icon-wrap" part="icon-wrap" aria-hidden="true">
|
|
522
522
|
<span class="icon" part="icon">
|
|
523
|
-
<slot name="icon">${
|
|
523
|
+
<slot name="icon">${nt(N)}</slot>
|
|
524
524
|
</span>
|
|
525
525
|
</span>
|
|
526
526
|
<div class="heading">
|
|
527
|
-
${b?`<h2 id="${
|
|
528
|
-
${
|
|
527
|
+
${b?`<h2 id="${_}" class="title" part="title"><slot name="title">${a(t)}</slot></h2>`:""}
|
|
528
|
+
${m?`<p id="${k}" class="description" part="description"><slot name="description">${a(e)}</slot></p>`:""}
|
|
529
529
|
</div>
|
|
530
530
|
</div>
|
|
531
531
|
</header>`:""}
|
|
532
532
|
|
|
533
533
|
<div class="content" part="content">
|
|
534
|
-
${
|
|
534
|
+
${j?'<slot name="content"></slot>':"<slot></slot>"}
|
|
535
535
|
|
|
536
536
|
${n?`<label class="input-wrap">
|
|
537
|
-
<span class="label">${a(
|
|
537
|
+
<span class="label">${a(T)}</span>
|
|
538
538
|
<input
|
|
539
539
|
class="input"
|
|
540
540
|
part="input"
|
|
541
541
|
type="text"
|
|
542
542
|
value="${a(this.getInputValue())}"
|
|
543
|
-
placeholder="${a(
|
|
544
|
-
${
|
|
543
|
+
placeholder="${a(q)}"
|
|
544
|
+
${D?"required":""}
|
|
545
545
|
${d?"disabled":""}
|
|
546
546
|
/>
|
|
547
547
|
</label>`:""}
|
|
548
548
|
|
|
549
|
-
${
|
|
549
|
+
${M?`<label class="checkbox" part="checkbox">
|
|
550
550
|
<span class="checkbox-line">
|
|
551
551
|
<input class="checkbox-input" type="checkbox" ${this.getChecked()?"checked":""} ${d?"disabled":""} />
|
|
552
|
-
<span>${a(
|
|
552
|
+
<span>${a(O)}</span>
|
|
553
553
|
</span>
|
|
554
554
|
</label>`:""}
|
|
555
555
|
</div>
|
|
556
556
|
|
|
557
|
-
<div class="error" id="${
|
|
557
|
+
<div class="error" id="${y}" part="error" aria-live="polite" data-empty="${String(!f)}">${a(f)}</div>
|
|
558
558
|
|
|
559
559
|
<footer class="footer" part="footer">
|
|
560
560
|
${d?`<span class="loading"><span class="spinner" aria-hidden="true"></span><span>${a(o)}</span></span>`:'<span aria-hidden="true"></span>'}
|
|
561
561
|
|
|
562
|
-
${
|
|
562
|
+
${R?'<slot name="footer"></slot>':`${U?`<button class="btn btn-cancel" part="cancel" type="button" ${d?"disabled":""}>${a(s)}</button>`:""}
|
|
563
563
|
<button class="btn btn-confirm" part="confirm" type="button" ${d?"disabled":""}>${a(r)}</button>`}
|
|
564
564
|
</footer>
|
|
565
565
|
</section>
|
|
566
566
|
</div>
|
|
567
|
-
`)}};
|
|
567
|
+
`)}};B._openStack=[];let $=B;typeof customElements<"u"&&!customElements.get("ui-alert-dialog")&&customElements.define("ui-alert-dialog",$);exports.UIAlertDialog=$;
|