@editora/ui-core 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +4 -4
- package/dist/date-time-picker.esm.js +112 -144
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/dock.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as M } from "./ElementBase-
|
|
1
|
+
import { E as M } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const T = 1.92, F = 148, C = 1, R = 20, _ = 0.18, g = "12px", y = "12px 14px", x = "56px", D = 56, k = {
|
|
3
3
|
xs: {
|
|
4
4
|
gap: "8px",
|
|
@@ -418,59 +418,54 @@ const T = 1.92, F = 148, C = 1, R = 20, _ = 0.18, g = "12px", y = "12px 14px", x
|
|
|
418
418
|
}
|
|
419
419
|
}
|
|
420
420
|
`;
|
|
421
|
-
function p(
|
|
422
|
-
return Math.min(t, Math.max(e,
|
|
421
|
+
function p(s, e, t) {
|
|
422
|
+
return Math.min(t, Math.max(e, s));
|
|
423
423
|
}
|
|
424
|
-
function
|
|
425
|
-
if (
|
|
426
|
-
|
|
427
|
-
const t = Number(a);
|
|
424
|
+
function S(s, e) {
|
|
425
|
+
if (s == null || s.trim() === "") return e;
|
|
426
|
+
const t = Number(s);
|
|
428
427
|
return Number.isFinite(t) ? t : e;
|
|
429
428
|
}
|
|
430
|
-
function m(
|
|
431
|
-
return Math.max(0,
|
|
429
|
+
function m(s, e) {
|
|
430
|
+
return Math.max(0, S(s, e));
|
|
432
431
|
}
|
|
433
|
-
function q(
|
|
434
|
-
return p(
|
|
432
|
+
function q(s, e) {
|
|
433
|
+
return p(S(s, e), 0.01, 1);
|
|
435
434
|
}
|
|
436
|
-
function h(
|
|
437
|
-
if (
|
|
438
|
-
|
|
439
|
-
const e = a.trim().split(/\s+/).filter(Boolean);
|
|
435
|
+
function h(s) {
|
|
436
|
+
if (s == null || s.trim() === "") return null;
|
|
437
|
+
const e = s.trim().split(/\s+/).filter(Boolean);
|
|
440
438
|
return e.length ? e.map((t) => /^-?\d+(\.\d+)?$/.test(t) ? `${t}px` : t).join(" ") : null;
|
|
441
439
|
}
|
|
442
|
-
function U(
|
|
443
|
-
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(
|
|
440
|
+
function U(s) {
|
|
441
|
+
return typeof requestAnimationFrame == "function" ? requestAnimationFrame(s) : window.setTimeout(() => s(Date.now()), 16);
|
|
444
442
|
}
|
|
445
|
-
function E(
|
|
446
|
-
if (
|
|
443
|
+
function E(s) {
|
|
444
|
+
if (s != null) {
|
|
447
445
|
if (typeof cancelAnimationFrame == "function") {
|
|
448
|
-
cancelAnimationFrame(
|
|
446
|
+
cancelAnimationFrame(s);
|
|
449
447
|
return;
|
|
450
448
|
}
|
|
451
|
-
window.clearTimeout(
|
|
449
|
+
window.clearTimeout(s);
|
|
452
450
|
}
|
|
453
451
|
}
|
|
454
|
-
function $(
|
|
455
|
-
return
|
|
452
|
+
function $(s) {
|
|
453
|
+
return s instanceof HTMLElement;
|
|
456
454
|
}
|
|
457
|
-
function B(
|
|
458
|
-
return
|
|
455
|
+
function B(s) {
|
|
456
|
+
return s.hasAttribute("disabled") || s.getAttribute("aria-disabled") === "true";
|
|
459
457
|
}
|
|
460
|
-
function H(
|
|
461
|
-
return
|
|
458
|
+
function H(s) {
|
|
459
|
+
return s.hasAttribute("data-active") || s.getAttribute("aria-current") === "page" || s.getAttribute("aria-current") === "true";
|
|
462
460
|
}
|
|
463
|
-
function
|
|
464
|
-
return
|
|
461
|
+
function I(s, e) {
|
|
462
|
+
return s === "top" || s === "bottom" || s === "start" || s === "end" ? s : e === "horizontal" ? "top" : "end";
|
|
465
463
|
}
|
|
466
|
-
function
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
for (let r = 0; r < a.length; r += 1)
|
|
472
|
-
if (n = (n + t + a.length) % a.length, !((l = a[n]) != null && l.disabled))
|
|
473
|
-
return n;
|
|
464
|
+
function A(s, e, t) {
|
|
465
|
+
if (!s.length) return -1;
|
|
466
|
+
let a = e;
|
|
467
|
+
for (let n = 0; n < s.length; n += 1)
|
|
468
|
+
if (a = (a + t + s.length) % s.length, !s[a]?.disabled) return a;
|
|
474
469
|
return -1;
|
|
475
470
|
}
|
|
476
471
|
class G extends M {
|
|
@@ -502,8 +497,7 @@ class G extends M {
|
|
|
502
497
|
super.connectedCallback(), this.hasAttribute("role") || this.setAttribute("role", "toolbar"), this._observeLightDom(), this._bindReducedMotion(), this._syncHostStyles(), queueMicrotask(() => this.refresh());
|
|
503
498
|
}
|
|
504
499
|
disconnectedCallback() {
|
|
505
|
-
|
|
506
|
-
if (this._slotEl && (this._slotEl.removeEventListener("slotchange", this._handleSlotChange), this._slotEl = null), this._frameEl && (this._frameEl.removeEventListener("pointermove", this._handlePointerMove), this._frameEl.removeEventListener("pointerleave", this._handlePointerLeave), this._frameEl = null), this.removeEventListener("focusin", this._handleFocusIn), this.removeEventListener("focusout", this._handleFocusOut), this.removeEventListener("keydown", this._handleKeyDown), (e = this._resizeObserver) == null || e.disconnect(), this._resizeObserver = null, (t = this._mutationObserver) == null || t.disconnect(), this._mutationObserver = null, this._mediaQuery) {
|
|
500
|
+
if (this._slotEl && (this._slotEl.removeEventListener("slotchange", this._handleSlotChange), this._slotEl = null), this._frameEl && (this._frameEl.removeEventListener("pointermove", this._handlePointerMove), this._frameEl.removeEventListener("pointerleave", this._handlePointerLeave), this._frameEl = null), this.removeEventListener("focusin", this._handleFocusIn), this.removeEventListener("focusout", this._handleFocusOut), this.removeEventListener("keydown", this._handleKeyDown), this._resizeObserver?.disconnect(), this._resizeObserver = null, this._mutationObserver?.disconnect(), this._mutationObserver = null, this._mediaQuery) {
|
|
507
501
|
try {
|
|
508
502
|
this._mediaQuery.removeEventListener("change", this._handleReducedMotionChange);
|
|
509
503
|
} catch {
|
|
@@ -517,15 +511,14 @@ class G extends M {
|
|
|
517
511
|
this._collectItems(), this._syncHostStyles(), this._measureItems(), this._syncTabIndices(), this._updateTargets(), this._queueAnimation();
|
|
518
512
|
}
|
|
519
513
|
focusItem(e) {
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
t < 0 || t >= this._items.length || (n = this._items[t]) != null && n.disabled || (this._focusedIndex = t, this._rovingIndex = t, this._syncTabIndices(), (l = this._items[t]) == null || l.el.focus(), this._pointerActive = !1, this._pointerCoord = Number.NaN, this._updateTargets(), this._queueAnimation());
|
|
514
|
+
const t = typeof e == "number" ? e : this._items.findIndex((a) => a.el.getAttribute("data-value") === String(e));
|
|
515
|
+
t < 0 || t >= this._items.length || this._items[t]?.disabled || (this._focusedIndex = t, this._rovingIndex = t, this._syncTabIndices(), this._items[t]?.el.focus(), this._pointerActive = !1, this._pointerCoord = Number.NaN, this._updateTargets(), this._queueAnimation());
|
|
523
516
|
}
|
|
524
517
|
clearActive() {
|
|
525
518
|
this._pointerActive = !1, this._pointerCoord = Number.NaN, this._focusedIndex = -1, this._updateTargets(), this._queueAnimation();
|
|
526
519
|
}
|
|
527
|
-
attributeChangedCallback(e, t,
|
|
528
|
-
!e || t ===
|
|
520
|
+
attributeChangedCallback(e, t, a) {
|
|
521
|
+
!e || t === a || !this.isConnected || (z.has(e) && this._syncHostStyles(), P.has(e) && this._syncItemChrome(), (O.has(e) || P.has(e) || z.has(e)) && this.refresh());
|
|
529
522
|
}
|
|
530
523
|
shouldRenderOnAttributeChange() {
|
|
531
524
|
return !1;
|
|
@@ -559,8 +552,7 @@ class G extends M {
|
|
|
559
552
|
this._resizeObserver || typeof ResizeObserver > "u" || (this._resizeObserver = new ResizeObserver(this._handleResize), this._resizeObserver.observe(this));
|
|
560
553
|
}
|
|
561
554
|
_bindReducedMotion() {
|
|
562
|
-
if (typeof window > "u" || typeof window.matchMedia != "function")
|
|
563
|
-
return;
|
|
555
|
+
if (typeof window > "u" || typeof window.matchMedia != "function") return;
|
|
564
556
|
const e = window.matchMedia("(prefers-reduced-motion: reduce)");
|
|
565
557
|
this._reducedMotion = e.matches, this._mediaQuery = e;
|
|
566
558
|
try {
|
|
@@ -582,54 +574,49 @@ class G extends M {
|
|
|
582
574
|
this._measureItems(), this._updateTargets(), this._queueAnimation();
|
|
583
575
|
}
|
|
584
576
|
_handlePointerMove(e) {
|
|
585
|
-
if ("pointerType" in e && e.pointerType === "touch" || !this._frameEl)
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
this._pointerActive = !0, this._pointerCoord = l, this._measureItems(), this._updateTargets(), this._queueAnimation();
|
|
577
|
+
if ("pointerType" in e && e.pointerType === "touch" || !this._frameEl) return;
|
|
578
|
+
const t = this._frameEl.getBoundingClientRect(), n = this._orientation() === "horizontal" ? e.clientX - t.left : e.clientY - t.top;
|
|
579
|
+
this._pointerActive = !0, this._pointerCoord = n, this._measureItems(), this._updateTargets(), this._queueAnimation();
|
|
589
580
|
}
|
|
590
581
|
_handlePointerLeave() {
|
|
591
582
|
this._pointerActive = !1, this._pointerCoord = Number.NaN, this._updateTargets(), this._queueAnimation();
|
|
592
583
|
}
|
|
593
584
|
_handleFocusIn(e) {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
const n = this._items.findIndex((s) => s.el === t);
|
|
599
|
-
n < 0 || (this._focusedIndex = n, this._rovingIndex = n, this._syncTabIndices(), this._pointerActive = !1, this._pointerCoord = Number.NaN, this._updateTargets(), this._queueAnimation());
|
|
585
|
+
const t = e.target?.closest?.("[data-ui-dock-item]");
|
|
586
|
+
if (!t) return;
|
|
587
|
+
const a = this._items.findIndex((n) => n.el === t);
|
|
588
|
+
a < 0 || (this._focusedIndex = a, this._rovingIndex = a, this._syncTabIndices(), this._pointerActive = !1, this._pointerCoord = Number.NaN, this._updateTargets(), this._queueAnimation());
|
|
600
589
|
}
|
|
601
590
|
_handleFocusOut(e) {
|
|
602
591
|
const t = e.relatedTarget;
|
|
603
592
|
t && this.contains(t) || (this._focusedIndex = -1, this._pointerActive || (this._updateTargets(), this._queueAnimation()));
|
|
604
593
|
}
|
|
605
594
|
_handleKeyDown(e) {
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
const t = this._orientation(), n = t === "horizontal" ? ["ArrowLeft"] : ["ArrowUp"], l = t === "horizontal" ? ["ArrowRight"] : ["ArrowDown"];
|
|
610
|
-
if (n.includes(e.key)) {
|
|
595
|
+
if (e.defaultPrevented || !this._items.length) return;
|
|
596
|
+
const t = this._orientation(), a = t === "horizontal" ? ["ArrowLeft"] : ["ArrowUp"], n = t === "horizontal" ? ["ArrowRight"] : ["ArrowDown"];
|
|
597
|
+
if (a.includes(e.key)) {
|
|
611
598
|
e.preventDefault();
|
|
612
|
-
const
|
|
613
|
-
|
|
599
|
+
const i = A(this._items, this._rovingIndex, -1);
|
|
600
|
+
i >= 0 && this.focusItem(i);
|
|
614
601
|
return;
|
|
615
602
|
}
|
|
616
|
-
if (
|
|
603
|
+
if (n.includes(e.key)) {
|
|
617
604
|
e.preventDefault();
|
|
618
|
-
const
|
|
619
|
-
|
|
605
|
+
const i = A(this._items, this._rovingIndex, 1);
|
|
606
|
+
i >= 0 && this.focusItem(i);
|
|
620
607
|
return;
|
|
621
608
|
}
|
|
622
609
|
if (e.key === "Home") {
|
|
623
610
|
e.preventDefault();
|
|
624
|
-
const
|
|
625
|
-
|
|
611
|
+
const i = this._items.findIndex((c) => !c.disabled);
|
|
612
|
+
i >= 0 && this.focusItem(i);
|
|
626
613
|
return;
|
|
627
614
|
}
|
|
628
615
|
if (e.key === "End") {
|
|
629
616
|
e.preventDefault();
|
|
630
|
-
for (let
|
|
631
|
-
if (!
|
|
632
|
-
this.focusItem(
|
|
617
|
+
for (let i = this._items.length - 1; i >= 0; i -= 1)
|
|
618
|
+
if (!this._items[i]?.disabled) {
|
|
619
|
+
this.focusItem(i);
|
|
633
620
|
break;
|
|
634
621
|
}
|
|
635
622
|
return;
|
|
@@ -637,96 +624,92 @@ class G extends M {
|
|
|
637
624
|
e.key === "Escape" && this.clearActive();
|
|
638
625
|
}
|
|
639
626
|
_collectItems() {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const i = e.get(s), c = s.querySelector("[data-ui-dock-icon]"), u = s.querySelector("[data-ui-dock-label]"), o = s.querySelector("[data-ui-dock-badge]");
|
|
627
|
+
const e = new Map(this._items.map((n) => [n.el, n])), t = Array.from(this.children).filter($).map((n) => {
|
|
628
|
+
const i = e.get(n), c = n.querySelector("[data-ui-dock-icon]"), o = n.querySelector("[data-ui-dock-label]"), l = n.querySelector("[data-ui-dock-badge]");
|
|
643
629
|
return {
|
|
644
|
-
el:
|
|
630
|
+
el: n,
|
|
645
631
|
iconEl: c,
|
|
646
|
-
labelEl:
|
|
647
|
-
badgeEl:
|
|
648
|
-
center:
|
|
649
|
-
currentScale:
|
|
650
|
-
targetScale:
|
|
651
|
-
currentLift:
|
|
652
|
-
targetLift:
|
|
653
|
-
labelVisible:
|
|
654
|
-
disabled: B(
|
|
655
|
-
sticky: H(
|
|
656
|
-
scaleVelocity:
|
|
657
|
-
liftVelocity:
|
|
632
|
+
labelEl: o,
|
|
633
|
+
badgeEl: l,
|
|
634
|
+
center: i?.center ?? 0,
|
|
635
|
+
currentScale: i?.currentScale ?? this._idleScale(),
|
|
636
|
+
targetScale: i?.targetScale ?? this._idleScale(),
|
|
637
|
+
currentLift: i?.currentLift ?? 0,
|
|
638
|
+
targetLift: i?.targetLift ?? 0,
|
|
639
|
+
labelVisible: i?.labelVisible ?? !1,
|
|
640
|
+
disabled: B(n),
|
|
641
|
+
sticky: H(n),
|
|
642
|
+
scaleVelocity: i?.scaleVelocity ?? 0,
|
|
643
|
+
liftVelocity: i?.liftVelocity ?? 0
|
|
658
644
|
};
|
|
659
645
|
});
|
|
660
646
|
this._items = t;
|
|
661
|
-
const
|
|
662
|
-
|
|
647
|
+
const a = this._items.findIndex((n) => n.sticky && !n.disabled);
|
|
648
|
+
a >= 0 ? this._rovingIndex = a : (!this._items[this._rovingIndex] || this._items[this._rovingIndex]?.disabled) && (this._rovingIndex = this._items.findIndex((n) => !n.disabled)), this._rovingIndex < 0 && (this._rovingIndex = 0), (this._focusedIndex >= this._items.length || this._items[this._focusedIndex]?.disabled) && (this._focusedIndex = -1), this._syncItemChrome();
|
|
663
649
|
}
|
|
664
650
|
_syncItemChrome() {
|
|
665
|
-
const e =
|
|
666
|
-
this._items.forEach((
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
d && r.setAttribute("aria-label", d);
|
|
651
|
+
const e = I(this.getAttribute("label-placement"), this._orientation()), t = this._labelMode(), a = this._orientation();
|
|
652
|
+
this._items.forEach((n) => {
|
|
653
|
+
const { el: i, iconEl: c, labelEl: o, badgeEl: l, sticky: d } = n;
|
|
654
|
+
if (i.setAttribute("data-ui-dock-item", ""), i.style.setProperty("position", "relative"), i.style.setProperty("display", "inline-flex"), i.style.setProperty("align-items", "center"), i.style.setProperty("justify-content", "center"), i.style.setProperty("inline-size", "var(--ui-dock-item-size)"), i.style.setProperty("block-size", "var(--ui-dock-item-size)"), i.style.setProperty("min-inline-size", "var(--ui-dock-item-size)"), i.style.setProperty("min-block-size", "var(--ui-dock-item-size)"), i.style.setProperty("flex", "0 0 var(--ui-dock-item-size)"), i.style.setProperty("box-sizing", "border-box"), i.style.setProperty("background", "transparent"), i.style.setProperty("border", "none"), i.style.setProperty("padding", "0"), i.style.setProperty("margin", "0"), i.style.setProperty("color", "inherit"), i.style.setProperty("text-decoration", "none"), i.style.setProperty("outline", "none"), i.style.setProperty("cursor", n.disabled ? "not-allowed" : "pointer"), i.style.setProperty("transform-origin", a === "horizontal" ? "center bottom" : "center center"), i.style.setProperty("touch-action", "manipulation"), i.hasAttribute("tabindex") || (i.tabIndex = -1), !i.hasAttribute("aria-label")) {
|
|
655
|
+
const r = o?.textContent?.trim() || i.getAttribute("data-label") || i.getAttribute("title") || void 0;
|
|
656
|
+
r && i.setAttribute("aria-label", r);
|
|
672
657
|
}
|
|
673
|
-
|
|
658
|
+
d ? i.setAttribute("data-dock-current", "true") : i.removeAttribute("data-dock-current"), c && (c.style.setProperty("display", "inline-flex"), c.style.setProperty("align-items", "center"), c.style.setProperty("justify-content", "center"), c.style.setProperty("inline-size", "100%"), c.style.setProperty("block-size", "100%"), c.style.setProperty("border-radius", "var(--ui-dock-item-radius)"), c.style.setProperty("background", "var(--ui-dock-item-bg)"), c.style.setProperty("border", "1px solid var(--ui-dock-item-border)"), c.style.setProperty("box-shadow", "var(--ui-dock-item-shadow)"), c.style.setProperty("backdrop-filter", "var(--ui-dock-item-backdrop)"), c.style.setProperty("font-size", "var(--ui-dock-icon-size)"), c.style.setProperty("color", "inherit"), c.style.setProperty("overflow", "hidden"), c.style.setProperty("box-sizing", "border-box")), o && (o.setAttribute("aria-hidden", "true"), o.style.setProperty("position", "absolute"), o.style.setProperty("pointer-events", "none"), o.style.setProperty("white-space", "nowrap"), o.style.setProperty("padding", "var(--ui-dock-label-padding)"), o.style.setProperty("border-radius", "var(--ui-dock-label-radius)"), o.style.setProperty("background", "var(--ui-dock-label-bg)"), o.style.setProperty("color", "var(--ui-dock-label-color)"), o.style.setProperty("border", "1px solid var(--ui-dock-label-border)"), o.style.setProperty("box-shadow", "var(--ui-dock-label-shadow)"), o.style.setProperty("backdrop-filter", "var(--ui-dock-label-backdrop)"), o.style.setProperty("font-size", "var(--ui-dock-label-font-size)"), o.style.setProperty("font-weight", "var(--ui-dock-label-font-weight)"), o.style.setProperty("line-height", "1.2"), o.style.setProperty("letter-spacing", "0.01em"), o.style.setProperty("min-inline-size", "max-content"), o.style.setProperty("z-index", "3"), o.style.setProperty("display", t === "none" ? "none" : "inline-flex"), o.style.removeProperty("top"), o.style.removeProperty("bottom"), o.style.removeProperty("left"), o.style.removeProperty("right"), e === "top" ? (o.style.setProperty("left", "50%"), o.style.setProperty("bottom", "calc(100% + var(--ui-dock-label-offset))")) : e === "bottom" ? (o.style.setProperty("left", "50%"), o.style.setProperty("top", "calc(100% + var(--ui-dock-label-offset))")) : e === "start" ? (o.style.setProperty("right", "calc(100% + var(--ui-dock-label-offset))"), o.style.setProperty("top", "50%")) : (o.style.setProperty("left", "calc(100% + var(--ui-dock-label-offset))"), o.style.setProperty("top", "50%"))), l && (l.setAttribute("aria-hidden", "true"), l.style.setProperty("position", "absolute"), l.style.setProperty("inset-inline-end", "-2px"), l.style.setProperty("inset-block-start", "-2px"), l.style.setProperty("display", "inline-flex"), l.style.setProperty("align-items", "center"), l.style.setProperty("justify-content", "center"), l.style.setProperty("min-inline-size", "18px"), l.style.setProperty("min-block-size", "18px"), l.style.setProperty("padding", "0 6px"), l.style.setProperty("border-radius", "999px"), l.style.setProperty("background", "var(--ui-dock-accent)"), l.style.setProperty("color", "#ffffff"), l.style.setProperty("font-size", "11px"), l.style.setProperty("font-weight", "700"), l.style.setProperty("box-shadow", "0 8px 18px color-mix(in srgb, var(--ui-dock-accent) 32%, rgba(15, 23, 42, 0.18))"), l.style.setProperty("z-index", "4"));
|
|
674
659
|
});
|
|
675
660
|
}
|
|
676
661
|
_syncTabIndices() {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
n.el.tabIndex = -1;
|
|
662
|
+
const e = this._items.findIndex((t) => !t.disabled);
|
|
663
|
+
e >= 0 && (this._rovingIndex < 0 || this._items[this._rovingIndex]?.disabled) && (this._rovingIndex = e), this._items.forEach((t, a) => {
|
|
664
|
+
if (t.disabled) {
|
|
665
|
+
t.el.tabIndex = -1;
|
|
682
666
|
return;
|
|
683
667
|
}
|
|
684
|
-
|
|
668
|
+
t.el.tabIndex = a === this._rovingIndex ? 0 : -1;
|
|
685
669
|
});
|
|
686
670
|
}
|
|
687
671
|
_measureItems() {
|
|
688
|
-
if (!this._frameEl)
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
l.center = (t === "horizontal" ? r.left + r.width / 2 : r.top + r.height / 2) - n;
|
|
672
|
+
if (!this._frameEl) return;
|
|
673
|
+
const e = this._frameEl.getBoundingClientRect(), t = this._orientation(), a = t === "horizontal" ? e.left : e.top;
|
|
674
|
+
this._items.forEach((n) => {
|
|
675
|
+
const i = n.el.getBoundingClientRect();
|
|
676
|
+
n.center = (t === "horizontal" ? i.left + i.width / 2 : i.top + i.height / 2) - a;
|
|
694
677
|
});
|
|
695
678
|
}
|
|
696
679
|
_updateTargets() {
|
|
697
|
-
const e = this._idleScale(), t = Math.max(e, this._magnification()),
|
|
698
|
-
this._items.forEach((
|
|
699
|
-
let
|
|
700
|
-
if (
|
|
701
|
-
const
|
|
702
|
-
|
|
680
|
+
const e = this._idleScale(), t = Math.max(e, this._magnification()), a = Math.max(1, this._distance()), n = this._lift() * this._motion().lift, i = this._labelMode();
|
|
681
|
+
this._items.forEach((c, o) => {
|
|
682
|
+
let l = e;
|
|
683
|
+
if (c.sticky && (l = Math.max(l, e + (t - e) * 0.08)), this._pointerActive && Number.isFinite(this._pointerCoord)) {
|
|
684
|
+
const r = Math.abs(this._pointerCoord - c.center), u = p(1 - r / a, 0, 1);
|
|
685
|
+
l = Math.max(l, e + (t - e) * u * u);
|
|
703
686
|
}
|
|
704
|
-
|
|
705
|
-
const
|
|
706
|
-
|
|
687
|
+
o === this._focusedIndex && (l = Math.max(l, t)), c.disabled && (l = e);
|
|
688
|
+
const d = t === e ? 0 : (l - e) / (t - e);
|
|
689
|
+
c.targetScale = p(l, e, t), c.targetLift = d * n, c.labelVisible = i === "always" || i !== "none" && (o === this._focusedIndex || d > 0.18);
|
|
707
690
|
}), this._updateRuntimeState();
|
|
708
691
|
}
|
|
709
692
|
_applyFrame(e = !1) {
|
|
710
|
-
const t = this._smoothing(),
|
|
711
|
-
let
|
|
712
|
-
this._items.forEach((
|
|
713
|
-
e ? (
|
|
714
|
-
const b =
|
|
715
|
-
if (
|
|
716
|
-
const f =
|
|
717
|
-
|
|
693
|
+
const t = this._smoothing(), a = this._motion(), n = p(a.response + t * 0.12, 0.05, 0.42), i = p(a.damping + (t - _) * 0.14, 0.52, 0.9), c = this._orientation(), o = I(this.getAttribute("label-placement"), c), l = this._mainAxisOffsets(a.spread);
|
|
694
|
+
let d = !1;
|
|
695
|
+
this._items.forEach((r, u) => {
|
|
696
|
+
e ? (r.currentScale = r.targetScale, r.currentLift = r.targetLift, r.scaleVelocity = 0, r.liftVelocity = 0) : (r.scaleVelocity = r.scaleVelocity * i + (r.targetScale - r.currentScale) * n, r.liftVelocity = r.liftVelocity * i + (r.targetLift - r.currentLift) * n, r.currentScale += r.scaleVelocity, r.currentLift += r.liftVelocity, Math.abs(r.targetScale - r.currentScale) < 2e-3 && Math.abs(r.scaleVelocity) < 2e-3 && (r.currentScale = r.targetScale, r.scaleVelocity = 0), Math.abs(r.targetLift - r.currentLift) < 2e-3 && Math.abs(r.liftVelocity) < 2e-3 && (r.currentLift = r.targetLift, r.liftVelocity = 0)), (Math.abs(r.targetScale - r.currentScale) >= 2e-3 || Math.abs(r.targetLift - r.currentLift) >= 2e-3 || Math.abs(r.scaleVelocity) >= 2e-3 || Math.abs(r.liftVelocity) >= 2e-3) && (d = !0);
|
|
697
|
+
const b = l[u] ?? 0, L = c === "horizontal" ? b : o === "start" ? -r.currentLift * 0.28 : r.currentLift * 0.28, w = c === "horizontal" ? -r.currentLift : b;
|
|
698
|
+
if (r.el.style.setProperty("transform", `translate3d(${L}px, ${w}px, 0) scale(${r.currentScale})`), r.el.style.setProperty("z-index", String(100 + Math.round(r.currentScale * 100) + u)), r.iconEl) {
|
|
699
|
+
const f = u === this._focusedIndex ? "0 0 0 3px color-mix(in srgb, var(--ui-dock-focus-ring) 26%, transparent), " : r.sticky ? "0 0 0 2px color-mix(in srgb, var(--ui-dock-accent) 22%, transparent), " : "";
|
|
700
|
+
r.iconEl.style.setProperty("box-shadow", `${f}var(--ui-dock-item-shadow)`), r.iconEl.style.setProperty(
|
|
718
701
|
"border-color",
|
|
719
|
-
|
|
702
|
+
r.sticky || u === this._focusedIndex ? "color-mix(in srgb, var(--ui-dock-accent) 30%, var(--ui-dock-item-border))" : "var(--ui-dock-item-border)"
|
|
720
703
|
);
|
|
721
704
|
}
|
|
722
|
-
if (
|
|
723
|
-
const f =
|
|
724
|
-
|
|
705
|
+
if (r.labelEl) {
|
|
706
|
+
const f = r.labelVisible;
|
|
707
|
+
r.labelEl.style.setProperty("opacity", f ? "1" : "0"), r.labelEl.style.setProperty(
|
|
725
708
|
"transform",
|
|
726
|
-
this._labelTransform(
|
|
727
|
-
),
|
|
709
|
+
this._labelTransform(o, f)
|
|
710
|
+
), r.labelEl.style.setProperty("filter", f ? "blur(0px)" : "blur(6px)");
|
|
728
711
|
}
|
|
729
|
-
}),
|
|
712
|
+
}), d && this._queueAnimation();
|
|
730
713
|
}
|
|
731
714
|
_queueAnimation() {
|
|
732
715
|
if (this._reducedMotion) {
|
|
@@ -738,15 +721,14 @@ class G extends M {
|
|
|
738
721
|
}));
|
|
739
722
|
}
|
|
740
723
|
_mainAxisOffsets(e) {
|
|
741
|
-
if (this._items.length < 2)
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
r[i] = r[i - 1] + b * e;
|
|
724
|
+
if (this._items.length < 2) return this._items.map(() => 0);
|
|
725
|
+
const t = this._resolvedItemSizePx(), a = this._resolvedGapPx(), n = t + a, i = [0];
|
|
726
|
+
for (let o = 1; o < this._items.length; o += 1) {
|
|
727
|
+
const l = this._items[o - 1], d = this._items[o], r = t * l.currentScale / 2, u = t * d.currentScale / 2, b = Math.max(0, r + u - n);
|
|
728
|
+
i[o] = i[o - 1] + b * e;
|
|
747
729
|
}
|
|
748
|
-
const
|
|
749
|
-
return
|
|
730
|
+
const c = i[i.length - 1] / 2;
|
|
731
|
+
return i.map((o) => o - c);
|
|
750
732
|
}
|
|
751
733
|
_labelTransform(e, t) {
|
|
752
734
|
return e === "top" ? t ? "translate3d(-50%, 0, 0)" : "translate3d(-50%, 6px, 0)" : e === "bottom" ? t ? "translate3d(-50%, 0, 0)" : "translate3d(-50%, -6px, 0)" : e === "start" ? t ? "translate3d(0, -50%, 0)" : "translate3d(6px, -50%, 0)" : t ? "translate3d(0, -50%, 0)" : "translate3d(-6px, -50%, 0)";
|
|
@@ -756,12 +738,12 @@ class G extends M {
|
|
|
756
738
|
e ? this.style.setProperty("--ui-dock-gap", e) : this.style.removeProperty("--ui-dock-gap");
|
|
757
739
|
const t = h(this.getAttribute("padding"));
|
|
758
740
|
t ? this.style.setProperty("--ui-dock-padding", t) : this.style.removeProperty("--ui-dock-padding");
|
|
759
|
-
const
|
|
760
|
-
|
|
761
|
-
const
|
|
762
|
-
if (
|
|
763
|
-
const
|
|
764
|
-
this.style.setProperty("--ui-dock-radius",
|
|
741
|
+
const a = h(this.getAttribute("item-size"));
|
|
742
|
+
a ? (this.style.setProperty("--ui-dock-item-size", a), this.style.setProperty("--ui-dock-icon-size", `calc(${a} * 0.44)`)) : (this.style.removeProperty("--ui-dock-item-size"), this.style.removeProperty("--ui-dock-icon-size"));
|
|
743
|
+
const n = this.getAttribute("radius");
|
|
744
|
+
if (n && !N.has(n)) {
|
|
745
|
+
const i = h(n) || n;
|
|
746
|
+
this.style.setProperty("--ui-dock-radius", i), this.style.setProperty("--ui-dock-item-radius", `calc(${i} * 0.82)`);
|
|
765
747
|
} else
|
|
766
748
|
this.style.removeProperty("--ui-dock-radius"), this.style.removeProperty("--ui-dock-item-radius");
|
|
767
749
|
}
|
|
@@ -796,21 +778,18 @@ class G extends M {
|
|
|
796
778
|
return e === "xs" || e === "0" ? "xs" : e === "sm" || e === "1" ? "sm" : e === "lg" || e === "3" ? "lg" : e === "xl" || e === "4" ? "xl" : "md";
|
|
797
779
|
}
|
|
798
780
|
_resolvedItemSizePx() {
|
|
799
|
-
var t;
|
|
800
781
|
const e = h(this.getAttribute("item-size"));
|
|
801
782
|
if (e) {
|
|
802
|
-
const
|
|
803
|
-
if (Number.isFinite(
|
|
804
|
-
return n;
|
|
783
|
+
const t = Number.parseFloat(e);
|
|
784
|
+
if (Number.isFinite(t)) return t;
|
|
805
785
|
}
|
|
806
|
-
return
|
|
786
|
+
return k[this._sizeToken()]?.itemSize ?? D;
|
|
807
787
|
}
|
|
808
788
|
_resolvedGapPx() {
|
|
809
789
|
const e = h(this.getAttribute("gap"));
|
|
810
790
|
if (e) {
|
|
811
|
-
const
|
|
812
|
-
if (Number.isFinite(
|
|
813
|
-
return n;
|
|
791
|
+
const a = Number.parseFloat(e);
|
|
792
|
+
if (Number.isFinite(a)) return a;
|
|
814
793
|
}
|
|
815
794
|
const t = k[this._sizeToken()];
|
|
816
795
|
return t ? Number.parseFloat(t.gap) : Number.parseFloat(g);
|
package/dist/drawer.cjs.js
CHANGED
|
@@ -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-EV6mVBUV.js"),m=require("./overlayManager-CSy3fJmJ.js");function F(i){return typeof requestAnimationFrame=="function"?requestAnimationFrame(()=>i()):window.setTimeout(i,16)}function _(i){if(i){if(typeof cancelAnimationFrame=="function"){cancelAnimationFrame(i);return}window.clearTimeout(i)}}const E='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',S=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"]),T=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -498,7 +498,7 @@
|
|
|
498
498
|
display: none;
|
|
499
499
|
}
|
|
500
500
|
}
|
|
501
|
-
`;function w(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function v(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C(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 A(i,e){var r;const t=i.querySelector(`[slot="${e}"]`);return t?((r=t.textContent)==null?void 0:r.trim().length)!==0||t.children.length>0:!1}function L(){return typeof window<"u"&&typeof document<"u"}class I extends O.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(S.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:w(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return w(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return w(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return w(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?w(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 C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=m.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(!L())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(E).forEach(r),e&&e.querySelectorAll(E).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(_(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(_(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(_(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=F(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=F(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&_(this._restoreFocusFrame),this._restoreFocusFrame=F(()=>{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 y=this.getAttribute("role")||"dialog";r.setAttribute("role",y);const u=(this.getAttribute("title")||"").trim(),h=(this.getAttribute("description")||"").trim(),b=A(this,"header"),p=this.showClose,x=p||b||!!u||!!h;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!p,a.disabled=n&&this.lockWhileLoading);const f=this.getAttribute("aria-label")||"",g=this.getAttribute("aria-labelledby")||"",l=this.getAttribute("aria-describedby")||"",c=g||(!f&&(b||u)?this._titleId():""),d=[];l?d.push(l):(h&&d.push(this._descriptionId()),d.push(this._bodyId()));const k=f||(c?"":"Drawer");k?r.setAttribute("aria-label",k):r.removeAttribute("aria-label"),c?r.setAttribute("aria-labelledby",c):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{m.OverlayManager.unregister(this),m.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!L())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{m.OverlayManager.register(this),m.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=C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=A(this,"header"),a=A(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),y=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,h=`ui-drawer-description-${this._uid}`,b=`ui-drawer-body-${this._uid}`,p=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",f=this.getAttribute("aria-describedby")||"",g=x||(!p&&(s||o)?u:""),l=[];f?l.push(f):(n&&l.push(h),l.push(b));const c=p||(g?"":"Drawer"),d=this.state==="loading";this.setContent(`
|
|
501
|
+
`;function w(i,e){if(i==null)return e;const t=i.trim().toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function v(i){return i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function C(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 A(i,e){const t=i.querySelector(`[slot="${e}"]`);return t?t.textContent?.trim().length!==0||t.children.length>0:!1}function L(){return typeof window<"u"&&typeof document<"u"}class I extends O.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(S.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:w(e,!0)}set dismissible(e){e?this.setAttribute("dismissible",""):this.removeAttribute("dismissible")}get closeOnOverlay(){return w(this.getAttribute("close-on-overlay"),!0)}set closeOnOverlay(e){this.setAttribute("close-on-overlay",String(e))}get closeOnEsc(){return w(this.getAttribute("close-on-esc"),!0)}set closeOnEsc(e){this.setAttribute("close-on-esc",String(e))}get lockWhileLoading(){return w(this.getAttribute("lock-while-loading"),!0)}set lockWhileLoading(e){this.setAttribute("lock-while-loading",String(e))}get showClose(){return this.hasAttribute("show-close")?w(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 C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr")}_isTopMost(){const e=m.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(!L())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(E).forEach(r),e&&e.querySelectorAll(E).forEach(r),t}_cancelScheduledFocusWork(){this._focusInitialFrame&&(_(this._focusInitialFrame),this._focusInitialFrame=0),this._focusTrapFrame&&(_(this._focusTrapFrame),this._focusTrapFrame=0),this._restoreFocusFrame&&(_(this._restoreFocusFrame),this._restoreFocusFrame=0)}_scheduleFocusInitial(){this._isOpen&&(this._focusInitialFrame||(this._focusInitialFrame=F(()=>{this._focusInitialFrame=0,this._focusInitial()})))}_scheduleEnsureFocusTrap(){this._isOpen&&(this._focusTrapFrame||(this._focusTrapFrame=F(()=>{this._focusTrapFrame=0,this._ensureFocusTrap()})))}_scheduleRestoreFocus(e){!e||!this._canRestoreFocus(e)||(this._restoreFocusFrame&&_(this._restoreFocusFrame),this._restoreFocusFrame=F(()=>{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 y=this.getAttribute("role")||"dialog";r.setAttribute("role",y);const u=(this.getAttribute("title")||"").trim(),h=(this.getAttribute("description")||"").trim(),b=A(this,"header"),p=this.showClose,x=p||b||!!u||!!h;s&&s.classList.toggle("empty",!x),a&&(a.hidden=!p,a.disabled=n&&this.lockWhileLoading);const f=this.getAttribute("aria-label")||"",g=this.getAttribute("aria-labelledby")||"",l=this.getAttribute("aria-describedby")||"",c=g||(!f&&(b||u)?this._titleId():""),d=[];l?d.push(l):(h&&d.push(this._descriptionId()),d.push(this._bodyId()));const k=f||(c?"":"Drawer");k?r.setAttribute("aria-label",k):r.removeAttribute("aria-label"),c?r.setAttribute("aria-labelledby",c):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{m.OverlayManager.unregister(this),m.OverlayManager.releaseLock()}catch{}}_canRestoreFocus(e){if(!e||!e.isConnected||e.disabled)return!1;if(!L())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{m.OverlayManager.register(this),m.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=C(this.getAttribute("side"),e==="rtl"?"rtl":"ltr"),r=this.showClose,s=A(this,"header"),a=A(this,"footer"),o=(this.getAttribute("title")||"").trim(),n=(this.getAttribute("description")||"").trim(),y=r||s||!!o||!!n,u=`ui-drawer-title-${this._uid}`,h=`ui-drawer-description-${this._uid}`,b=`ui-drawer-body-${this._uid}`,p=this.getAttribute("aria-label")||"",x=this.getAttribute("aria-labelledby")||"",f=this.getAttribute("aria-describedby")||"",g=x||(!p&&(s||o)?u:""),l=[];f?l.push(f):(n&&l.push(h),l.push(b));const c=p||(g?"":"Drawer"),d=this.state==="loading";this.setContent(`
|
|
502
502
|
<style>${T}</style>
|
|
503
503
|
<div class="overlay" part="overlay" aria-hidden="true"></div>
|
|
504
504
|
<aside
|