@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/dist/context-menu.esm.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { E
|
|
2
|
-
import { c as
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
1
|
+
import { E } from "./ElementBase-909688f3.mjs";
|
|
2
|
+
import { c as A } from "./portal-fe73e5cc.mjs";
|
|
3
|
+
import { c as S } from "./dismissable-layer-9c7e6b58.mjs";
|
|
4
|
+
import { l as P } from "./positioner-e9770c66.mjs";
|
|
5
|
+
import { c as w } from "./menu-item-styles-27fdbac4.mjs";
|
|
5
6
|
import "./listbox-308789a0.mjs";
|
|
6
7
|
import "./collection-a1aac0c6.mjs";
|
|
7
8
|
import "./collection.esm.js";
|
|
8
|
-
const
|
|
9
|
+
const c = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menuitemradio"], [data-menu-item]', b = [
|
|
9
10
|
":scope > .menuitem",
|
|
10
11
|
':scope > [role="menuitem"]',
|
|
11
12
|
':scope > [role="menuitemcheckbox"]',
|
|
12
13
|
':scope > [role="menuitemradio"]',
|
|
13
14
|
":scope > [data-menu-item]"
|
|
14
|
-
].join(", "),
|
|
15
|
+
].join(", "), O = ":scope > .submenu", l = 8, L = 6, R = 420, C = 110, I = [
|
|
15
16
|
"--ui-color-primary",
|
|
16
17
|
"--ui-color-primary-hover",
|
|
17
18
|
"--ui-color-foreground-on-primary",
|
|
@@ -46,7 +47,7 @@ const p = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
46
47
|
"--accent-surface",
|
|
47
48
|
"--accent-indicator",
|
|
48
49
|
"--accent-track"
|
|
49
|
-
],
|
|
50
|
+
], k = [
|
|
50
51
|
{ prefix: "--accent-", from: 1, to: 12 },
|
|
51
52
|
{ prefix: "--accent-a", from: 1, to: 12 },
|
|
52
53
|
{ prefix: "--gray-", from: 1, to: 12 },
|
|
@@ -70,7 +71,7 @@ const p = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
70
71
|
"--base-context-menu-item-line-height",
|
|
71
72
|
"--base-context-menu-submenu-radius",
|
|
72
73
|
"--base-context-menu-submenu-padding"
|
|
73
|
-
],
|
|
74
|
+
], g = `
|
|
74
75
|
:host {
|
|
75
76
|
position: fixed;
|
|
76
77
|
inset: 0;
|
|
@@ -352,14 +353,14 @@ const p = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
352
353
|
--ui-context-menu-status-border: color-mix(in srgb, #16a34a 46%, var(--ui-context-menu-border-color));
|
|
353
354
|
--ui-context-menu-status-text: #15803d;
|
|
354
355
|
}
|
|
355
|
-
`,
|
|
356
|
+
`, v = `
|
|
356
357
|
ui-context-menu [slot="menu"],
|
|
357
358
|
ui-context-menu [slot="content"] {
|
|
358
359
|
display: flex;
|
|
359
360
|
flex-direction: column;
|
|
360
361
|
gap: 0;
|
|
361
362
|
}
|
|
362
|
-
${
|
|
363
|
+
${w({
|
|
363
364
|
scopes: ['ui-context-menu [slot="menu"]', 'ui-context-menu [slot="content"]'],
|
|
364
365
|
prefix: "--ui-context-menu",
|
|
365
366
|
itemSelectors: [".menuitem", '[role="menuitem"]', '[role="menuitemcheckbox"]', '[role="menuitemradio"]', "[data-menu-item]"],
|
|
@@ -417,104 +418,83 @@ const p = '.menuitem, [role="menuitem"], [role="menuitemcheckbox"], [role="menui
|
|
|
417
418
|
function z() {
|
|
418
419
|
if (typeof document > "u")
|
|
419
420
|
return;
|
|
420
|
-
const
|
|
421
|
-
if (document.getElementById(
|
|
421
|
+
const o = "ui-context-menu-light-dom-style";
|
|
422
|
+
if (document.getElementById(o))
|
|
422
423
|
return;
|
|
423
424
|
const t = document.createElement("style");
|
|
424
|
-
t.id =
|
|
425
|
+
t.id = o, t.textContent = v, document.head.appendChild(t);
|
|
425
426
|
}
|
|
426
|
-
function B(
|
|
427
|
-
return
|
|
428
|
-
const
|
|
427
|
+
function B(o, t) {
|
|
428
|
+
return o.replace(/(^|})\s*([^@}{][^{}]*)\{/g, (e, i, n) => {
|
|
429
|
+
const s = n.split(",").map((r) => r.trim()).filter(Boolean).map((r) => r.startsWith(t) ? r : `${t} ${r}`).join(", ");
|
|
429
430
|
return `${i}
|
|
430
|
-
${
|
|
431
|
+
${s} {`;
|
|
431
432
|
});
|
|
432
433
|
}
|
|
433
|
-
function F(
|
|
434
|
-
const t =
|
|
434
|
+
function F(o) {
|
|
435
|
+
const t = o.replace(/:host\(\[([a-z-]+)(?:="([^"]+)")?\]\)/g, (e, i, n) => n != null ? `.ui-context-menu-portal[data-${i}="${n}"]` : `.ui-context-menu-portal[data-${i}="true"]`).replace(/:host/g, ".ui-context-menu-portal");
|
|
435
436
|
return B(t, ".ui-context-menu-portal");
|
|
436
437
|
}
|
|
437
|
-
function H(
|
|
438
|
-
return
|
|
438
|
+
function H(o) {
|
|
439
|
+
return o.replace(/(^|,)\s*ui-context-menu\b/gm, (t, e) => `${e} .ui-context-menu-portal`);
|
|
439
440
|
}
|
|
440
|
-
const D = `${F(
|
|
441
|
-
${H(
|
|
442
|
-
function
|
|
443
|
-
return
|
|
441
|
+
const D = `${F(g)}
|
|
442
|
+
${H(v)}`;
|
|
443
|
+
function M(o) {
|
|
444
|
+
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
444
445
|
}
|
|
445
|
-
function
|
|
446
|
-
return
|
|
446
|
+
function q(o, t) {
|
|
447
|
+
return typeof o == "number" ? { x: o, y: typeof t == "number" ? t : 0 } : o;
|
|
447
448
|
}
|
|
448
|
-
function
|
|
449
|
-
return
|
|
449
|
+
function $(o) {
|
|
450
|
+
return o === "top" || o === "left" || o === "right" ? o : "bottom";
|
|
450
451
|
}
|
|
451
|
-
function
|
|
452
|
-
return
|
|
452
|
+
function V(o) {
|
|
453
|
+
return `${o}-start`;
|
|
453
454
|
}
|
|
454
|
-
function _(
|
|
455
|
-
if (!
|
|
455
|
+
function _(o) {
|
|
456
|
+
if (!o)
|
|
456
457
|
return "";
|
|
457
|
-
const t =
|
|
458
|
+
const t = o.trim().toLowerCase();
|
|
458
459
|
return t === "1" ? "sm" : t === "2" ? "md" : t === "3" ? "lg" : t === "sm" || t === "md" || t === "lg" ? t : t === "compact" ? "sm" : t === "comfortable" ? "lg" : "";
|
|
459
460
|
}
|
|
460
|
-
function
|
|
461
|
-
if (!
|
|
461
|
+
function y(o) {
|
|
462
|
+
if (!o)
|
|
462
463
|
return "";
|
|
463
|
-
const t =
|
|
464
|
-
return t ? t === "none" ? "0px" : t === "sm" ? "8px" : t === "md" ? "12px" : t === "lg" ? "16px" : t === "full" ? "999px" : t === "square" ? "6px" : t === "soft" ? "16px" : /^\d+(\.\d+)?$/.test(t) ? `${t}px` :
|
|
464
|
+
const t = o.trim().toLowerCase();
|
|
465
|
+
return t ? t === "none" ? "0px" : t === "sm" ? "8px" : t === "md" ? "12px" : t === "lg" ? "16px" : t === "full" ? "999px" : t === "square" ? "6px" : t === "soft" ? "16px" : /^\d+(\.\d+)?$/.test(t) ? `${t}px` : o : "";
|
|
465
466
|
}
|
|
466
|
-
function
|
|
467
|
-
if (!
|
|
467
|
+
function N(o) {
|
|
468
|
+
if (!o.isConnected || o.hidden)
|
|
468
469
|
return !1;
|
|
469
|
-
const t = window.getComputedStyle(
|
|
470
|
+
const t = window.getComputedStyle(o);
|
|
470
471
|
return !(t.display === "none" || t.visibility === "hidden");
|
|
471
472
|
}
|
|
472
|
-
function
|
|
473
|
-
if (!
|
|
473
|
+
function W(o) {
|
|
474
|
+
if (!o.isConnected)
|
|
474
475
|
return !1;
|
|
475
|
-
const t = window.getComputedStyle(
|
|
476
|
+
const t = window.getComputedStyle(o);
|
|
476
477
|
if (t.display === "none" || t.visibility === "hidden")
|
|
477
478
|
return !1;
|
|
478
|
-
const e =
|
|
479
|
+
const e = o.getBoundingClientRect();
|
|
479
480
|
if (e.width > 0 || e.height > 0)
|
|
480
481
|
return !0;
|
|
481
482
|
const i = Number.parseFloat(t.width || "0"), n = Number.parseFloat(t.height || "0");
|
|
482
483
|
return i > 0 || n > 0;
|
|
483
484
|
}
|
|
484
|
-
function x(
|
|
485
|
-
const t =
|
|
486
|
-
return
|
|
485
|
+
function x(o) {
|
|
486
|
+
const t = o.getAttribute("aria-disabled");
|
|
487
|
+
return o.hasAttribute("disabled") || t === "true" || o.disabled === !0;
|
|
487
488
|
}
|
|
488
|
-
function G(
|
|
489
|
-
for (const t of
|
|
490
|
-
if (t instanceof HTMLElement && t.matches(
|
|
489
|
+
function G(o) {
|
|
490
|
+
for (const t of o)
|
|
491
|
+
if (t instanceof HTMLElement && t.matches(c))
|
|
491
492
|
return t;
|
|
492
493
|
return null;
|
|
493
494
|
}
|
|
494
|
-
|
|
495
|
-
return {
|
|
496
|
-
top: s.y,
|
|
497
|
-
left: s.x,
|
|
498
|
-
right: s.x,
|
|
499
|
-
bottom: s.y,
|
|
500
|
-
width: 0,
|
|
501
|
-
height: 0
|
|
502
|
-
};
|
|
503
|
-
}
|
|
504
|
-
function U(s, t, e, i, n) {
|
|
505
|
-
const o = window.innerWidth || document.documentElement.clientWidth || 0, r = window.innerHeight || document.documentElement.clientHeight || 0, a = Math.max(u, o - t - u), c = Math.max(u, r - e - u);
|
|
506
|
-
let l = i, h = i === "left" ? s.left - t - n : i === "right" ? s.right + n : s.left, m = i === "top" ? s.top - e - n : i === "bottom" ? s.bottom + n : s.top;
|
|
507
|
-
return i === "top" || i === "bottom" ? l === "bottom" && m + e > r - u && s.top - e - n >= u ? (l = "top", m = s.top - e - n) : l === "top" && m < u && s.bottom + n + e <= r - u && (l = "bottom", m = s.bottom + n) : (i === "left" || i === "right") && (l === "right" && h + t > o - u && s.left - t - n >= u ? (l = "left", h = s.left - t - n) : l === "left" && h < u && s.right + n + t <= o - u && (l = "right", h = s.right + n)), h = y(h, u, a), m = y(m, u, c), {
|
|
508
|
-
x: Math.round(h),
|
|
509
|
-
y: Math.round(m),
|
|
510
|
-
placement: l,
|
|
511
|
-
maxWidth: Math.max(160, o - u * 2),
|
|
512
|
-
maxHeight: Math.max(120, r - u * 2)
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
class Y extends A {
|
|
495
|
+
class U extends E {
|
|
516
496
|
constructor() {
|
|
517
|
-
super(), this._isOpen = !1, this._anchorEl = null, this._point = { x: 0, y: 0 }, this._restoreFocusEl = null, this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._dismissableLayer = null, this._contentAnchor = null, this._contentSourceEl = null, this._contentOriginalParent = null, this._positionRaf = null, this._submenuRaf = null, this._anchorTrackRaf = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._submenuIntentTimer = null, this._submenuIntentItem = null, this._hoveredItem = null, this._lastAnchorRect = null, this._resizeListenerBound = !1, this._scrollListenerBound = !1, this._nextOpenSource = "attribute", this._onRootClick = this._onRootClick.bind(this), this._onRootKeyDown = this._onRootKeyDown.bind(this), this._onRootPointerOver = this._onRootPointerOver.bind(this), this._onRootPointerLeave = this._onRootPointerLeave.bind(this), this._onRootFocusIn = this._onRootFocusIn.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onViewportChange = this._onViewportChange.bind(this), this._trackAnchorLayout = this._trackAnchorLayout.bind(this);
|
|
497
|
+
super(), this._isOpen = !1, this._anchorEl = null, this._point = { x: 0, y: 0 }, this._restoreFocusEl = null, this._portalEl = null, this._portalSurfaceEl = null, this._portalContentHostEl = null, this._dismissableLayer = null, this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._contentAnchor = null, this._contentSourceEl = null, this._contentOriginalParent = null, this._positionRaf = null, this._submenuRaf = null, this._anchorTrackRaf = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._submenuIntentTimer = null, this._submenuIntentItem = null, this._hoveredItem = null, this._lastAnchorRect = null, this._resizeListenerBound = !1, this._scrollListenerBound = !1, this._nextOpenSource = "attribute", this._onRootClick = this._onRootClick.bind(this), this._onRootKeyDown = this._onRootKeyDown.bind(this), this._onRootPointerOver = this._onRootPointerOver.bind(this), this._onRootPointerLeave = this._onRootPointerLeave.bind(this), this._onRootFocusIn = this._onRootFocusIn.bind(this), this._onContextMenu = this._onContextMenu.bind(this), this._onViewportChange = this._onViewportChange.bind(this), this._trackAnchorLayout = this._trackAnchorLayout.bind(this);
|
|
518
498
|
}
|
|
519
499
|
static get observedAttributes() {
|
|
520
500
|
return [
|
|
@@ -703,12 +683,12 @@ class Y extends A {
|
|
|
703
683
|
_syncVisualState() {
|
|
704
684
|
const t = _(this.getAttribute("size") || this.getAttribute("density"));
|
|
705
685
|
t && t !== "md" ? this.setAttribute("data-ui-context-menu-size", t) : this.removeAttribute("data-ui-context-menu-size"), t === "sm" ? (this.style.setProperty("--ui-context-menu-padding", "4px"), this.style.setProperty("--ui-context-menu-item-gap", "8px"), this.style.setProperty("--ui-context-menu-item-min-height", "32px"), this.style.setProperty("--ui-context-menu-item-pad-y", "6px"), this.style.setProperty("--ui-context-menu-item-pad-x", "8px"), this.style.setProperty("--ui-context-menu-item-font-size", "13px"), this.style.setProperty("--ui-context-menu-item-line-height", "18px"), this.style.setProperty("--ui-context-menu-separator-margin", "4px 8px")) : t === "lg" ? (this.style.setProperty("--ui-context-menu-padding", "8px"), this.style.setProperty("--ui-context-menu-item-gap", "12px"), this.style.setProperty("--ui-context-menu-item-min-height", "40px"), this.style.setProperty("--ui-context-menu-item-pad-y", "9px"), this.style.setProperty("--ui-context-menu-item-pad-x", "12px"), this.style.setProperty("--ui-context-menu-item-font-size", "15px"), this.style.setProperty("--ui-context-menu-item-line-height", "22px"), this.style.setProperty("--ui-context-menu-separator-margin", "8px 12px")) : (this.style.removeProperty("--ui-context-menu-padding"), this.style.removeProperty("--ui-context-menu-item-gap"), this.style.removeProperty("--ui-context-menu-item-min-height"), this.style.removeProperty("--ui-context-menu-item-pad-y"), this.style.removeProperty("--ui-context-menu-item-pad-x"), this.style.removeProperty("--ui-context-menu-item-font-size"), this.style.removeProperty("--ui-context-menu-item-line-height"), this.style.removeProperty("--ui-context-menu-separator-margin"));
|
|
706
|
-
const e =
|
|
686
|
+
const e = y(this.getAttribute("radius") || this.getAttribute("shape"));
|
|
707
687
|
e ? (this.style.setProperty("--ui-context-menu-radius", e), this.style.setProperty("--ui-context-menu-item-radius", e), this.style.setProperty("--ui-context-menu-submenu-radius", e)) : (this.style.removeProperty("--ui-context-menu-radius"), this.style.removeProperty("--ui-context-menu-item-radius"), this.style.removeProperty("--ui-context-menu-submenu-radius"));
|
|
708
688
|
}
|
|
709
689
|
_syncGlobalListeners(t) {
|
|
710
690
|
const e = t, i = t && !!this._anchorEl;
|
|
711
|
-
e && !this._resizeListenerBound ? (window.addEventListener("resize", this._onViewportChange), this._resizeListenerBound = !0) : !e && this._resizeListenerBound && (window.removeEventListener("resize", this._onViewportChange), this._resizeListenerBound = !1), i && !this._scrollListenerBound ? (window.addEventListener("scroll", this._onViewportChange, !0), this._scrollListenerBound = !0) : !i && this._scrollListenerBound && (window.removeEventListener("scroll", this._onViewportChange, !0), this._scrollListenerBound = !1), t && this._anchorEl ? this._startAnchorTracking() : this._stopAnchorTracking();
|
|
691
|
+
e && !this._resizeListenerBound ? (window.addEventListener("resize", this._onViewportChange), this._resizeListenerBound = !0) : !e && this._resizeListenerBound && (window.removeEventListener("resize", this._onViewportChange), this._resizeListenerBound = !1), i && !this._scrollListenerBound ? (window.addEventListener("scroll", this._onViewportChange, { passive: !0, capture: !0 }), this._scrollListenerBound = !0) : !i && this._scrollListenerBound && (window.removeEventListener("scroll", this._onViewportChange, !0), this._scrollListenerBound = !1), t && this._anchorEl ? this._startAnchorTracking() : this._stopAnchorTracking();
|
|
712
692
|
}
|
|
713
693
|
_unbindGlobalListeners() {
|
|
714
694
|
this._syncGlobalListeners(!1);
|
|
@@ -729,20 +709,20 @@ class Y extends A {
|
|
|
729
709
|
const n = t.getPropertyValue(i).trim();
|
|
730
710
|
n ? this._portalEl.style.setProperty(i, n) : this._portalEl.style.removeProperty(i);
|
|
731
711
|
};
|
|
732
|
-
|
|
733
|
-
for (let r = n; r <=
|
|
712
|
+
I.forEach(e), T.forEach(e), k.forEach(({ prefix: i, from: n, to: s }) => {
|
|
713
|
+
for (let r = n; r <= s; r += 1)
|
|
734
714
|
e(`${i}${r}`);
|
|
735
715
|
});
|
|
736
716
|
}
|
|
737
717
|
_syncPortalVisualState() {
|
|
738
718
|
if (!this._portalEl)
|
|
739
719
|
return;
|
|
740
|
-
const t = _(this.getAttribute("size") || this.getAttribute("density")), e =
|
|
720
|
+
const t = _(this.getAttribute("size") || this.getAttribute("density")), e = y(this.getAttribute("radius") || this.getAttribute("shape"));
|
|
741
721
|
this._syncPortalThemeVariables(), this._setPortalFlag("open", this._isOpen), this._setPortalFlag("headless", this.headless), this._setPortalFlag("disabled", this.isDisabled);
|
|
742
|
-
const i = this.getAttribute("variant"), n = _(this.getAttribute("size") || this.getAttribute("density")),
|
|
743
|
-
i ? this._portalEl.setAttribute("data-variant", i) : this._portalEl.removeAttribute("data-variant"), n && n !== "md" ? this._portalEl.setAttribute("data-size", n) : this._portalEl.removeAttribute("data-size"),
|
|
744
|
-
const
|
|
745
|
-
|
|
722
|
+
const i = this.getAttribute("variant"), n = _(this.getAttribute("size") || this.getAttribute("density")), s = this.getAttribute("density"), r = this.getAttribute("radius"), u = this.getAttribute("shape"), a = this.getAttribute("elevation"), h = this.getAttribute("tone"), m = this.getAttribute("placement");
|
|
723
|
+
i ? this._portalEl.setAttribute("data-variant", i) : this._portalEl.removeAttribute("data-variant"), n && n !== "md" ? this._portalEl.setAttribute("data-size", n) : this._portalEl.removeAttribute("data-size"), s ? this._portalEl.setAttribute("data-density", s) : this._portalEl.removeAttribute("data-density"), r ? this._portalEl.setAttribute("data-radius", r) : this._portalEl.removeAttribute("data-radius"), u ? this._portalEl.setAttribute("data-shape", u) : this._portalEl.removeAttribute("data-shape"), a ? this._portalEl.setAttribute("data-elevation", a) : this._portalEl.removeAttribute("data-elevation"), h ? this._portalEl.setAttribute("data-tone", h) : this._portalEl.removeAttribute("data-tone"), m ? this._portalEl.setAttribute("data-placement-request", m) : this._portalEl.removeAttribute("data-placement-request"), t === "sm" ? (this._portalEl.style.setProperty("--ui-context-menu-padding", "4px"), this._portalEl.style.setProperty("--ui-context-menu-item-gap", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-min-height", "32px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-y", "6px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-x", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-font-size", "13px"), this._portalEl.style.setProperty("--ui-context-menu-item-line-height", "18px"), this._portalEl.style.setProperty("--ui-context-menu-separator-margin", "4px 8px")) : t === "lg" ? (this._portalEl.style.setProperty("--ui-context-menu-padding", "8px"), this._portalEl.style.setProperty("--ui-context-menu-item-gap", "12px"), this._portalEl.style.setProperty("--ui-context-menu-item-min-height", "40px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-y", "9px"), this._portalEl.style.setProperty("--ui-context-menu-item-pad-x", "12px"), this._portalEl.style.setProperty("--ui-context-menu-item-font-size", "15px"), this._portalEl.style.setProperty("--ui-context-menu-item-line-height", "22px"), this._portalEl.style.setProperty("--ui-context-menu-separator-margin", "8px 12px")) : (this._portalEl.style.removeProperty("--ui-context-menu-padding"), this._portalEl.style.removeProperty("--ui-context-menu-item-gap"), this._portalEl.style.removeProperty("--ui-context-menu-item-min-height"), this._portalEl.style.removeProperty("--ui-context-menu-item-pad-y"), this._portalEl.style.removeProperty("--ui-context-menu-item-pad-x"), this._portalEl.style.removeProperty("--ui-context-menu-item-font-size"), this._portalEl.style.removeProperty("--ui-context-menu-item-line-height"), this._portalEl.style.removeProperty("--ui-context-menu-separator-margin")), e ? (this._portalEl.style.setProperty("--ui-context-menu-radius", e), this._portalEl.style.setProperty("--ui-context-menu-item-radius", e), this._portalEl.style.setProperty("--ui-context-menu-submenu-radius", e)) : (this._portalEl.style.removeProperty("--ui-context-menu-radius"), this._portalEl.style.removeProperty("--ui-context-menu-item-radius"), this._portalEl.style.removeProperty("--ui-context-menu-submenu-radius")), this.state !== "idle" ? this._portalEl.setAttribute("data-state", this.state) : this._portalEl.removeAttribute("data-state");
|
|
724
|
+
const p = this._portalEl.querySelector(".state-row");
|
|
725
|
+
p && (p.textContent = this._stateText());
|
|
746
726
|
}
|
|
747
727
|
_moveContentIntoPortal() {
|
|
748
728
|
if (this._contentSourceEl)
|
|
@@ -761,7 +741,7 @@ class Y extends A {
|
|
|
761
741
|
var i, n;
|
|
762
742
|
if ((i = this._portalEl) != null && i.isConnected)
|
|
763
743
|
return;
|
|
764
|
-
const t =
|
|
744
|
+
const t = A();
|
|
765
745
|
if (!t)
|
|
766
746
|
return;
|
|
767
747
|
const e = document.createElement("div");
|
|
@@ -769,13 +749,13 @@ class Y extends A {
|
|
|
769
749
|
<style>${D}</style>
|
|
770
750
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
771
751
|
<div class="state-row" part="state"></div>
|
|
772
|
-
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${
|
|
752
|
+
<ui-listbox class="content-host" slot="menu" role="menu" item-selector="${c.replace(/"/g, """)}" direct-item-selector="${b.replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active"></ui-listbox>
|
|
773
753
|
</div>
|
|
774
754
|
`, t.appendChild(e), this._portalEl = e, this._portalSurfaceEl = e.querySelector(".surface"), this._portalContentHostEl = e.querySelector("ui-listbox.content-host"), this._moveContentIntoPortal(), (n = this._portalContentHostEl) == null || n.refresh(), this._syncPortalVisualState(), this._syncSurfaceState(), this._bindPortalInteractionListeners(), this._syncDismissableLayer();
|
|
775
755
|
}
|
|
776
756
|
_teardownPortal() {
|
|
777
|
-
var t, e;
|
|
778
|
-
if ((t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, this._unbindPortalInteractionListeners(), this._restoreContentFromPortal(), this._portalContentHostEl = null, this._portalSurfaceEl = null, (
|
|
757
|
+
var t, e, i;
|
|
758
|
+
if ((t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, (e = this._positioner) == null || e.destroy(), this._positioner = null, this._positionerPlacement = null, this._positionerOffset = 0, this._positionerAnchorEl = null, this._unbindPortalInteractionListeners(), this._restoreContentFromPortal(), this._portalContentHostEl = null, this._portalSurfaceEl = null, (i = this._portalEl) != null && i.parentElement)
|
|
779
759
|
try {
|
|
780
760
|
this._portalEl.parentElement.removeChild(this._portalEl);
|
|
781
761
|
} catch {
|
|
@@ -789,15 +769,15 @@ class Y extends A {
|
|
|
789
769
|
(e = this._dismissableLayer) == null || e.destroy(), this._dismissableLayer = null;
|
|
790
770
|
return;
|
|
791
771
|
}
|
|
792
|
-
(i = this._dismissableLayer) == null || i.destroy(), this._dismissableLayer =
|
|
772
|
+
(i = this._dismissableLayer) == null || i.destroy(), this._dismissableLayer = S({
|
|
793
773
|
node: t,
|
|
794
774
|
trigger: this._anchorEl || this,
|
|
795
775
|
closeOnEscape: this.closeOnEscape,
|
|
796
776
|
closeOnPointerOutside: !0,
|
|
797
777
|
closeOnFocusOutside: !0,
|
|
798
778
|
onDismiss: (n) => {
|
|
799
|
-
const
|
|
800
|
-
this._setOpen(!1,
|
|
779
|
+
const s = n === "escape-key" ? "escape" : "outside";
|
|
780
|
+
this._setOpen(!1, s);
|
|
801
781
|
}
|
|
802
782
|
});
|
|
803
783
|
}
|
|
@@ -817,6 +797,48 @@ class Y extends A {
|
|
|
817
797
|
height: t.height
|
|
818
798
|
};
|
|
819
799
|
}
|
|
800
|
+
_pointVirtualAnchor() {
|
|
801
|
+
return {
|
|
802
|
+
getBoundingClientRect: () => {
|
|
803
|
+
const { x: t, y: e } = this._point;
|
|
804
|
+
return {
|
|
805
|
+
x: t,
|
|
806
|
+
y: e,
|
|
807
|
+
top: e,
|
|
808
|
+
left: t,
|
|
809
|
+
right: t,
|
|
810
|
+
bottom: e,
|
|
811
|
+
width: 0,
|
|
812
|
+
height: 0,
|
|
813
|
+
toJSON: () => ({})
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
_rebuildPositioner(t, e, i) {
|
|
819
|
+
var n;
|
|
820
|
+
(n = this._positioner) == null || n.destroy(), this._positioner = P({
|
|
821
|
+
anchor: this._anchorEl || this._pointVirtualAnchor(),
|
|
822
|
+
floating: t,
|
|
823
|
+
placement: e,
|
|
824
|
+
strategy: "fixed",
|
|
825
|
+
offset: i,
|
|
826
|
+
flip: !0,
|
|
827
|
+
shift: !0,
|
|
828
|
+
boundaryPadding: l,
|
|
829
|
+
observeWindowResize: !1,
|
|
830
|
+
observeScroll: !1,
|
|
831
|
+
observeAncestorScroll: !1,
|
|
832
|
+
observeAncestorResize: !1,
|
|
833
|
+
observeLayoutShift: !1,
|
|
834
|
+
observeAnchorResize: !1,
|
|
835
|
+
observeFloatingResize: !1,
|
|
836
|
+
onUpdate: (s) => {
|
|
837
|
+
const r = window.innerWidth || document.documentElement.clientWidth || 0, u = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
838
|
+
t.style.maxWidth = `${Math.max(160, r - l * 2)}px`, t.style.maxHeight = `${Math.max(120, u - l * 2)}px`, t.setAttribute("data-placement", s.placement.split("-")[0]);
|
|
839
|
+
}
|
|
840
|
+
}), this._positionerPlacement = e, this._positionerOffset = i, this._positionerAnchorEl = this._anchorEl;
|
|
841
|
+
}
|
|
820
842
|
_startAnchorTracking() {
|
|
821
843
|
!this._isOpen || !this._anchorEl || this._anchorTrackRaf != null || (this._lastAnchorRect = this._captureAnchorRect(), this._anchorTrackRaf = requestAnimationFrame(this._trackAnchorLayout));
|
|
822
844
|
}
|
|
@@ -844,10 +866,10 @@ class Y extends A {
|
|
|
844
866
|
_queryMenuItems(t) {
|
|
845
867
|
var i;
|
|
846
868
|
const e = t || this._menuHost();
|
|
847
|
-
return e ? (((i = this._listbox()) == null ? void 0 : i.queryItems({ container: e })) || []).filter((n) =>
|
|
869
|
+
return e ? (((i = this._listbox()) == null ? void 0 : i.queryItems({ container: e })) || []).filter((n) => N(n)) : [];
|
|
848
870
|
}
|
|
849
871
|
_submenuFor(t) {
|
|
850
|
-
return t.querySelector(
|
|
872
|
+
return t.querySelector(O);
|
|
851
873
|
}
|
|
852
874
|
_clearHighlights() {
|
|
853
875
|
this._hoveredItem = null;
|
|
@@ -904,38 +926,38 @@ class Y extends A {
|
|
|
904
926
|
}
|
|
905
927
|
const e = document.activeElement;
|
|
906
928
|
if (e instanceof HTMLElement) {
|
|
907
|
-
const n = e.closest(
|
|
929
|
+
const n = e.closest(c);
|
|
908
930
|
if (n instanceof HTMLElement)
|
|
909
931
|
return n;
|
|
910
932
|
}
|
|
911
933
|
return (i = this._hoveredItem) != null && i.isConnected ? this._hoveredItem : null;
|
|
912
934
|
}
|
|
913
935
|
_moveFocus(t, e) {
|
|
914
|
-
var
|
|
936
|
+
var s, r, u;
|
|
915
937
|
const i = t.closest(".submenu") || this._menuHost();
|
|
916
938
|
if (!i)
|
|
917
939
|
return;
|
|
918
940
|
if (e === "first") {
|
|
919
|
-
const
|
|
941
|
+
const a = (s = this._listbox()) == null ? void 0 : s.focusBoundary("first", {
|
|
920
942
|
container: i,
|
|
921
943
|
focus: !0,
|
|
922
944
|
owner: this._surface(),
|
|
923
945
|
scroll: !0
|
|
924
946
|
});
|
|
925
|
-
|
|
947
|
+
a && this._setOpenBranch(a, !1);
|
|
926
948
|
return;
|
|
927
949
|
}
|
|
928
950
|
if (e === "last") {
|
|
929
|
-
const
|
|
951
|
+
const a = (r = this._listbox()) == null ? void 0 : r.focusBoundary("last", {
|
|
930
952
|
container: i,
|
|
931
953
|
focus: !0,
|
|
932
954
|
owner: this._surface(),
|
|
933
955
|
scroll: !0
|
|
934
956
|
});
|
|
935
|
-
|
|
957
|
+
a && this._setOpenBranch(a, !1);
|
|
936
958
|
return;
|
|
937
959
|
}
|
|
938
|
-
const n = (
|
|
960
|
+
const n = (u = this._listbox()) == null ? void 0 : u.move(e === "next" ? 1 : -1, {
|
|
939
961
|
container: i,
|
|
940
962
|
current: t,
|
|
941
963
|
focus: !0,
|
|
@@ -949,27 +971,27 @@ class Y extends A {
|
|
|
949
971
|
if (!i || (i.querySelectorAll('[data-submenu-open="true"]').forEach((r) => r.removeAttribute("data-submenu-open")), !t))
|
|
950
972
|
return;
|
|
951
973
|
const n = [];
|
|
952
|
-
let
|
|
953
|
-
for (;
|
|
954
|
-
const r =
|
|
974
|
+
let s = t;
|
|
975
|
+
for (; s; ) {
|
|
976
|
+
const r = s.closest(".submenu");
|
|
955
977
|
if (!r)
|
|
956
978
|
break;
|
|
957
|
-
const
|
|
958
|
-
if (!(
|
|
979
|
+
const u = r.parentElement;
|
|
980
|
+
if (!(u instanceof HTMLElement) || !u.matches(c))
|
|
959
981
|
break;
|
|
960
|
-
n.unshift(
|
|
982
|
+
n.unshift(u), s = u;
|
|
961
983
|
}
|
|
962
984
|
n.forEach((r) => r.setAttribute("data-submenu-open", "true")), e && this._submenuFor(t) && t.setAttribute("data-submenu-open", "true");
|
|
963
985
|
}
|
|
964
986
|
_openSubmenu(t, e) {
|
|
965
|
-
var
|
|
987
|
+
var s;
|
|
966
988
|
this._cancelSubmenuIntent();
|
|
967
989
|
const i = this._submenuFor(t);
|
|
968
990
|
if (!i || x(t))
|
|
969
991
|
return !1;
|
|
970
992
|
if (this._setOpenBranch(t, !0), this._scheduleSubmenuLayout(), !e)
|
|
971
993
|
return !0;
|
|
972
|
-
const n = (
|
|
994
|
+
const n = (s = this._listbox()) == null ? void 0 : s.focusBoundary("first", {
|
|
973
995
|
container: i,
|
|
974
996
|
focus: !0,
|
|
975
997
|
owner: this._surface(),
|
|
@@ -982,7 +1004,7 @@ class Y extends A {
|
|
|
982
1004
|
if (!e)
|
|
983
1005
|
return !1;
|
|
984
1006
|
const i = e.parentElement;
|
|
985
|
-
return !(i instanceof HTMLElement) || !i.matches(
|
|
1007
|
+
return !(i instanceof HTMLElement) || !i.matches(c) ? !1 : (this._focusItem(i), this._setOpenBranch(i, !1), i.removeAttribute("data-submenu-open"), !0);
|
|
986
1008
|
}
|
|
987
1009
|
_clearSubmenuState() {
|
|
988
1010
|
var e;
|
|
@@ -991,14 +1013,14 @@ class Y extends A {
|
|
|
991
1013
|
t && (t.querySelectorAll('[data-submenu-open="true"]').forEach((i) => i.removeAttribute("data-submenu-open")), (e = this._listbox()) == null || e.clearActive({ container: t }));
|
|
992
1014
|
}
|
|
993
1015
|
_handleTypeahead(t, e) {
|
|
994
|
-
var
|
|
1016
|
+
var s;
|
|
995
1017
|
if (!this.typeahead || t.ctrlKey || t.altKey || t.metaKey || t.key.length !== 1 || !/\S/.test(t.key))
|
|
996
1018
|
return !1;
|
|
997
1019
|
const i = (e == null ? void 0 : e.closest(".submenu")) || this._menuHost();
|
|
998
1020
|
if (!i)
|
|
999
1021
|
return !1;
|
|
1000
|
-
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key}`.slice(-24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(),
|
|
1001
|
-
const n = (
|
|
1022
|
+
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key}`.slice(-24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), R);
|
|
1023
|
+
const n = (s = this._listbox()) == null ? void 0 : s.typeahead(this._typeaheadBuffer, {
|
|
1002
1024
|
container: i,
|
|
1003
1025
|
current: e,
|
|
1004
1026
|
focus: !0,
|
|
@@ -1010,8 +1032,8 @@ class Y extends A {
|
|
|
1010
1032
|
_applySelectionBehavior(t) {
|
|
1011
1033
|
const e = t.getAttribute("role");
|
|
1012
1034
|
if (e === "menuitemcheckbox") {
|
|
1013
|
-
const
|
|
1014
|
-
t.setAttribute("aria-checked",
|
|
1035
|
+
const s = t.getAttribute("aria-checked") !== "true";
|
|
1036
|
+
t.setAttribute("aria-checked", s ? "true" : "false"), t.setAttribute("data-state", s ? "checked" : "unchecked");
|
|
1015
1037
|
return;
|
|
1016
1038
|
}
|
|
1017
1039
|
if (e !== "menuitemradio")
|
|
@@ -1020,21 +1042,21 @@ class Y extends A {
|
|
|
1020
1042
|
if (!i)
|
|
1021
1043
|
return;
|
|
1022
1044
|
const n = t.getAttribute("data-group") || t.getAttribute("name") || "";
|
|
1023
|
-
i.querySelectorAll('[role="menuitemradio"]').forEach((
|
|
1024
|
-
const r =
|
|
1025
|
-
n && r !== n || (
|
|
1045
|
+
i.querySelectorAll('[role="menuitemradio"]').forEach((s) => {
|
|
1046
|
+
const r = s.getAttribute("data-group") || s.getAttribute("name") || "";
|
|
1047
|
+
n && r !== n || (s.setAttribute("aria-checked", "false"), s.setAttribute("data-state", "unchecked"));
|
|
1026
1048
|
}), t.setAttribute("aria-checked", "true"), t.setAttribute("data-state", "checked");
|
|
1027
1049
|
}
|
|
1028
1050
|
_emitSelect(t) {
|
|
1029
|
-
var
|
|
1030
|
-
const e = this._menuHost(), n = (e ? Array.from(e.querySelectorAll(
|
|
1051
|
+
var s;
|
|
1052
|
+
const e = this._menuHost(), n = (e ? Array.from(e.querySelectorAll(c)) : []).indexOf(t);
|
|
1031
1053
|
this.dispatchEvent(new CustomEvent("select", {
|
|
1032
1054
|
bubbles: !0,
|
|
1033
1055
|
composed: !0,
|
|
1034
1056
|
detail: {
|
|
1035
1057
|
index: n,
|
|
1036
1058
|
value: t.getAttribute("data-value") || t.getAttribute("value") || void 0,
|
|
1037
|
-
label: t.getAttribute("aria-label") || ((
|
|
1059
|
+
label: t.getAttribute("aria-label") || ((s = t.textContent) == null ? void 0 : s.trim()) || void 0,
|
|
1038
1060
|
checked: t.getAttribute("aria-checked") === "true",
|
|
1039
1061
|
item: t
|
|
1040
1062
|
}
|
|
@@ -1046,15 +1068,20 @@ class Y extends A {
|
|
|
1046
1068
|
}));
|
|
1047
1069
|
}
|
|
1048
1070
|
_positionMenu() {
|
|
1071
|
+
var r;
|
|
1049
1072
|
const t = this._surface();
|
|
1050
1073
|
if (!t)
|
|
1051
1074
|
return;
|
|
1052
|
-
if (this._anchorEl && !
|
|
1075
|
+
if (this._anchorEl && !W(this._anchorEl)) {
|
|
1053
1076
|
this.close();
|
|
1054
1077
|
return;
|
|
1055
1078
|
}
|
|
1056
|
-
const e =
|
|
1057
|
-
|
|
1079
|
+
const e = $(this.getAttribute("placement")), i = V(e), n = this._anchorEl ? L : 0;
|
|
1080
|
+
if (!this._positioner || this._positionerPlacement !== i || this._positionerOffset !== n || this._positionerAnchorEl !== this._anchorEl) {
|
|
1081
|
+
this._rebuildPositioner(t, i, n);
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
(r = this._positioner) == null || r.update();
|
|
1058
1085
|
}
|
|
1059
1086
|
_scheduleSubmenuLayout() {
|
|
1060
1087
|
this._isOpen && (this._submenuRaf != null && cancelAnimationFrame(this._submenuRaf), this._submenuRaf = requestAnimationFrame(() => {
|
|
@@ -1066,15 +1093,15 @@ class Y extends A {
|
|
|
1066
1093
|
if (!t)
|
|
1067
1094
|
return;
|
|
1068
1095
|
const e = window.innerWidth || document.documentElement.clientWidth || 0, i = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
1069
|
-
Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach((
|
|
1070
|
-
const r =
|
|
1096
|
+
Array.from(t.querySelectorAll('.menuitem > .submenu, [role="menuitem"] > .submenu')).forEach((s) => {
|
|
1097
|
+
const r = s.parentElement;
|
|
1071
1098
|
if (!(r instanceof HTMLElement))
|
|
1072
1099
|
return;
|
|
1073
1100
|
r.removeAttribute("data-submenu-side"), r.removeAttribute("data-submenu-align");
|
|
1074
|
-
const
|
|
1075
|
-
|
|
1076
|
-
const d = r.getBoundingClientRect(), f =
|
|
1077
|
-
d.right +
|
|
1101
|
+
const u = s.style.display, a = s.style.visibility, h = s.style.pointerEvents, m = s.style.opacity, p = s.style.transform;
|
|
1102
|
+
s.style.display = "grid", s.style.visibility = "hidden", s.style.pointerEvents = "none", s.style.opacity = "0", s.style.transform = "none";
|
|
1103
|
+
const d = r.getBoundingClientRect(), f = s.getBoundingClientRect();
|
|
1104
|
+
d.right + l + f.width > e && d.left - l - f.width >= l && r.setAttribute("data-submenu-side", "left"), d.top + f.height > i - l && d.bottom - f.height >= l && r.setAttribute("data-submenu-align", "up"), s.style.display = u, s.style.visibility = a, s.style.pointerEvents = h, s.style.opacity = m, s.style.transform = p;
|
|
1078
1105
|
});
|
|
1079
1106
|
}
|
|
1080
1107
|
_onRootClick(t) {
|
|
@@ -1128,7 +1155,7 @@ class Y extends A {
|
|
|
1128
1155
|
this._submenuIntentTimer = null;
|
|
1129
1156
|
const e = this._submenuIntentItem;
|
|
1130
1157
|
this._submenuIntentItem = null, !(!e || !e.isConnected || !this._isOpen) && (this._setOpenBranch(e, !0), this._scheduleSubmenuLayout());
|
|
1131
|
-
},
|
|
1158
|
+
}, C));
|
|
1132
1159
|
}
|
|
1133
1160
|
_onRootKeyDown(t) {
|
|
1134
1161
|
if (!this._isOpen)
|
|
@@ -1183,10 +1210,10 @@ class Y extends A {
|
|
|
1183
1210
|
render() {
|
|
1184
1211
|
const t = M(this._stateText());
|
|
1185
1212
|
this.setContent(`
|
|
1186
|
-
<style>${
|
|
1213
|
+
<style>${g}</style>
|
|
1187
1214
|
<div class="surface" part="menu" role="menu" aria-hidden="true" aria-busy="false" tabindex="-1">
|
|
1188
1215
|
<div class="state-row" part="state" data-state="${this.state}">${t}</div>
|
|
1189
|
-
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${
|
|
1216
|
+
<ui-listbox class="content-host" part="content" slot="menu" role="menu" item-selector="${c.replace(/"/g, """)}" direct-item-selector="${b.replace(/"/g, """)}" item-role="menuitem" active-attribute="data-active">
|
|
1190
1217
|
<slot name="menu"></slot>
|
|
1191
1218
|
<slot name="content"></slot>
|
|
1192
1219
|
</ui-listbox>
|
|
@@ -1198,7 +1225,7 @@ class Y extends A {
|
|
|
1198
1225
|
return !1;
|
|
1199
1226
|
}
|
|
1200
1227
|
}
|
|
1201
|
-
typeof customElements < "u" && !customElements.get("ui-context-menu") && customElements.define("ui-context-menu",
|
|
1228
|
+
typeof customElements < "u" && !customElements.get("ui-context-menu") && customElements.define("ui-context-menu", U);
|
|
1202
1229
|
export {
|
|
1203
|
-
|
|
1230
|
+
U as UIContextMenu
|
|
1204
1231
|
};
|
package/dist/date-field.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./ElementBase-1b301e7f.js"),U=require("./calendar-a8735e40.js"),d=require("./date-time-utils-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("./ElementBase-1b301e7f.js"),U=require("./calendar-a8735e40.js"),d=require("./date-time-utils-66480de4.js");require("./scroll-lock-d7b0df21.js");require("./positioner-33529bb8.js");let F=0;const I=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-date-field-border-color: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 78%, transparent);
|
|
4
4
|
--ui-date-field-border: 1px solid var(--ui-date-field-border-color);
|
package/dist/date-field.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { E as F } from "./ElementBase-909688f3.mjs";
|
|
2
2
|
import { p as U } from "./calendar-2c11b824.mjs";
|
|
3
|
-
import { n as h, a as I, b as E } from "./date-time-utils-
|
|
4
|
-
import "./scroll-lock-
|
|
3
|
+
import { n as h, a as I, b as E } from "./date-time-utils-a2c7af25.mjs";
|
|
4
|
+
import "./scroll-lock-31da444f.mjs";
|
|
5
|
+
import "./positioner-e9770c66.mjs";
|
|
5
6
|
let T = 0;
|
|
6
7
|
const w = `
|
|
7
8
|
:host {
|