@editora/ui-core 0.1.19 → 0.1.21
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 +30 -29
- package/dist/color-picker.cjs.js +10 -10
- package/dist/color-picker.esm.js +190 -253
- 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-collection.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.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-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.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 +7 -7
- package/dist/date-time-picker.esm.js +115 -147
- 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 +5 -5
- package/dist/multi-select.esm.js +125 -137
- 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 +3 -3
- package/dist/portal.esm.js +20 -28
- 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 +22 -28
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- 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/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- 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 +79 -65
- package/dist/sortable.esm.js +714 -734
- 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 +8 -8
- package/dist/tabs.esm.js +89 -109
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +10 -10
- package/dist/textarea.esm.js +49 -52
- 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 +31 -31
- package/dist/transfer-list.esm.js +114 -127
- 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/dropdown.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as _ } from "./ElementBase-
|
|
2
|
-
import { c as x } from "./menu-item-styles-
|
|
1
|
+
import { E as _ } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { c as x } from "./menu-item-styles-CZiPwPwl.mjs";
|
|
3
3
|
const l = [
|
|
4
4
|
'[role="menuitem"]',
|
|
5
5
|
'[role="menuitemcheckbox"]',
|
|
@@ -523,10 +523,9 @@ function h(i, e) {
|
|
|
523
523
|
return i.getAttribute(e) || "";
|
|
524
524
|
}
|
|
525
525
|
function f(i, e) {
|
|
526
|
-
if (i == null)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
return r !== "false" && r !== "0" && r !== "off";
|
|
526
|
+
if (i == null) return e;
|
|
527
|
+
const t = i.trim().toLowerCase();
|
|
528
|
+
return t !== "false" && t !== "0" && t !== "off";
|
|
530
529
|
}
|
|
531
530
|
function p() {
|
|
532
531
|
return typeof window < "u" && typeof document < "u";
|
|
@@ -546,12 +545,12 @@ function g(i) {
|
|
|
546
545
|
}
|
|
547
546
|
}
|
|
548
547
|
function E(i, e) {
|
|
549
|
-
const
|
|
550
|
-
if (
|
|
551
|
-
e.scrollTop =
|
|
548
|
+
const t = i.offsetTop, r = t + i.offsetHeight, o = e.scrollTop, a = o + e.clientHeight;
|
|
549
|
+
if (t < o) {
|
|
550
|
+
e.scrollTop = t;
|
|
552
551
|
return;
|
|
553
552
|
}
|
|
554
|
-
|
|
553
|
+
r > a && (e.scrollTop = Math.max(0, r - e.clientHeight));
|
|
555
554
|
}
|
|
556
555
|
function I(i) {
|
|
557
556
|
return w(i);
|
|
@@ -561,30 +560,26 @@ function w(i) {
|
|
|
561
560
|
return document.createTextNode(i.textContent || "");
|
|
562
561
|
if (!(i instanceof HTMLElement))
|
|
563
562
|
return i.cloneNode(!1);
|
|
564
|
-
const e = i.tagName === "UI-BOX",
|
|
565
|
-
return Array.from(i.attributes).forEach((
|
|
566
|
-
|
|
567
|
-
}), Array.from(i.childNodes).forEach((
|
|
568
|
-
|
|
569
|
-
}),
|
|
563
|
+
const e = i.tagName === "UI-BOX", t = document.createElement(e ? "div" : i.tagName.toLowerCase());
|
|
564
|
+
return Array.from(i.attributes).forEach((r) => {
|
|
565
|
+
r.name !== "slot" && t.setAttribute(r.name, r.value);
|
|
566
|
+
}), Array.from(i.childNodes).forEach((r) => {
|
|
567
|
+
t.appendChild(w(r));
|
|
568
|
+
}), t;
|
|
570
569
|
}
|
|
571
|
-
function T(i, e,
|
|
572
|
-
for (let
|
|
573
|
-
if (!b(i[
|
|
574
|
-
return t;
|
|
570
|
+
function T(i, e, t) {
|
|
571
|
+
for (let r = e + t; r >= 0 && r < i.length; r += t)
|
|
572
|
+
if (!b(i[r])) return r;
|
|
575
573
|
return -1;
|
|
576
574
|
}
|
|
577
|
-
function M(i, e,
|
|
578
|
-
if (!e)
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
const n = t[(o + a + t.length) % t.length];
|
|
586
|
-
if (C(n).toLowerCase().startsWith(e))
|
|
587
|
-
return n;
|
|
575
|
+
function M(i, e, t) {
|
|
576
|
+
if (!e) return null;
|
|
577
|
+
const r = i.filter((a) => !b(a));
|
|
578
|
+
if (!r.length) return null;
|
|
579
|
+
const o = t ? r.indexOf(t) : -1;
|
|
580
|
+
for (let a = 1; a <= r.length; a += 1) {
|
|
581
|
+
const n = r[(o + a + r.length) % r.length];
|
|
582
|
+
if (C(n).toLowerCase().startsWith(e)) return n;
|
|
588
583
|
}
|
|
589
584
|
return null;
|
|
590
585
|
}
|
|
@@ -640,8 +635,8 @@ class D extends _ {
|
|
|
640
635
|
disconnectedCallback() {
|
|
641
636
|
this.removeEventListener("click", this._onHostClick), this.removeEventListener("keydown", this._onHostKeyDown), this.root.removeEventListener("slotchange", this._onSlotChange), this._teardownOpenListeners(), this._openFrame && cancelAnimationFrame(this._openFrame), super.disconnectedCallback();
|
|
642
637
|
}
|
|
643
|
-
attributeChangedCallback(e,
|
|
644
|
-
if (
|
|
638
|
+
attributeChangedCallback(e, t, r) {
|
|
639
|
+
if (t !== r) {
|
|
645
640
|
if (e === "open") {
|
|
646
641
|
this._syncOpenState();
|
|
647
642
|
return;
|
|
@@ -709,43 +704,39 @@ class D extends _ {
|
|
|
709
704
|
return this._portalEl;
|
|
710
705
|
}
|
|
711
706
|
_isFocusable(e) {
|
|
712
|
-
if (!e || !e.isConnected || e.disabled || e.getAttribute("aria-hidden") === "true")
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
const r = window.getComputedStyle(e);
|
|
717
|
-
return r.display !== "none" && r.visibility !== "hidden";
|
|
707
|
+
if (!e || !e.isConnected || e.disabled || e.getAttribute("aria-hidden") === "true") return !1;
|
|
708
|
+
if (!p()) return !0;
|
|
709
|
+
const t = window.getComputedStyle(e);
|
|
710
|
+
return t.display !== "none" && t.visibility !== "hidden";
|
|
718
711
|
}
|
|
719
712
|
_currentFocusedItem() {
|
|
720
713
|
const e = this.root.activeElement || document.activeElement;
|
|
721
714
|
return e instanceof HTMLElement ? e.closest(l) : null;
|
|
722
715
|
}
|
|
723
716
|
_queryItems(e = !0) {
|
|
724
|
-
const
|
|
725
|
-
if (!
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
return e ? t : t.filter((o) => !b(o));
|
|
717
|
+
const t = this._getMenu();
|
|
718
|
+
if (!t) return [];
|
|
719
|
+
const r = Array.from(t.querySelectorAll(l));
|
|
720
|
+
return e ? r : r.filter((o) => !b(o));
|
|
729
721
|
}
|
|
730
722
|
_requestClose(e) {
|
|
731
|
-
if (!this._isOpen)
|
|
732
|
-
|
|
733
|
-
const r = new CustomEvent("request-close", {
|
|
723
|
+
if (!this._isOpen) return;
|
|
724
|
+
const t = new CustomEvent("request-close", {
|
|
734
725
|
detail: { reason: e },
|
|
735
726
|
bubbles: !0,
|
|
736
727
|
composed: !0,
|
|
737
728
|
cancelable: !0
|
|
738
729
|
});
|
|
739
|
-
this.dispatchEvent(
|
|
740
|
-
const
|
|
730
|
+
this.dispatchEvent(t);
|
|
731
|
+
const r = new CustomEvent("ui-request-close", {
|
|
741
732
|
detail: { reason: e },
|
|
742
733
|
bubbles: !0,
|
|
743
734
|
composed: !0,
|
|
744
735
|
cancelable: !0
|
|
745
736
|
});
|
|
746
|
-
this.dispatchEvent(
|
|
737
|
+
this.dispatchEvent(r), !(t.defaultPrevented || r.defaultPrevented) && this.close(e);
|
|
747
738
|
}
|
|
748
|
-
_close(e,
|
|
739
|
+
_close(e, t = {}) {
|
|
749
740
|
if (this._openFrame && cancelAnimationFrame(this._openFrame), this._openFrame = 0, this._isOpen = !1, this._teardownOpenListeners(), this.hasAttribute("open") && this.removeAttribute("open"), this._syncControlState(), this._syncTriggerA11y(), this._clearActiveItem(), this._clearMenuContent(), this._resetTypeahead(), this.dispatchEvent(
|
|
750
741
|
new CustomEvent("change", {
|
|
751
742
|
bubbles: !0,
|
|
@@ -758,9 +749,9 @@ class D extends _ {
|
|
|
758
749
|
composed: !0,
|
|
759
750
|
detail: { reason: e }
|
|
760
751
|
})
|
|
761
|
-
),
|
|
762
|
-
const
|
|
763
|
-
|
|
752
|
+
), t.restoreFocus !== !1) {
|
|
753
|
+
const r = this._getTrigger();
|
|
754
|
+
r && this._isFocusable(r) ? g(r) : this._restoreFocusEl && this._isFocusable(this._restoreFocusEl) && g(this._restoreFocusEl);
|
|
764
755
|
}
|
|
765
756
|
this._restoreFocusEl = null;
|
|
766
757
|
}
|
|
@@ -800,55 +791,50 @@ class D extends _ {
|
|
|
800
791
|
}
|
|
801
792
|
_renderMenuContent() {
|
|
802
793
|
const e = this._getMenu();
|
|
803
|
-
if (!e)
|
|
804
|
-
return;
|
|
794
|
+
if (!e) return;
|
|
805
795
|
e.replaceChildren();
|
|
806
|
-
const
|
|
807
|
-
if (
|
|
808
|
-
const
|
|
809
|
-
|
|
796
|
+
const t = this._getContentSource();
|
|
797
|
+
if (t && e.appendChild(I(t)), !e.querySelector(l)) {
|
|
798
|
+
const r = document.createElement("div");
|
|
799
|
+
r.className = "empty-state", r.textContent = "No items", e.appendChild(r);
|
|
810
800
|
}
|
|
811
801
|
this._syncMenuItemSemantics();
|
|
812
802
|
}
|
|
813
803
|
_syncMenuItemSemantics() {
|
|
814
|
-
this._queryItems(!0).forEach((e,
|
|
815
|
-
e.getAttribute("role") || e.setAttribute("role", "menuitem"), e.hasAttribute("tabindex") || e.setAttribute("tabindex", "-1"), e.dataset.sourceIndex = String(
|
|
816
|
-
const
|
|
817
|
-
(
|
|
804
|
+
this._queryItems(!0).forEach((e, t) => {
|
|
805
|
+
e.getAttribute("role") || e.setAttribute("role", "menuitem"), e.hasAttribute("tabindex") || e.setAttribute("tabindex", "-1"), e.dataset.sourceIndex = String(t), e.hasAttribute("disabled") && e.getAttribute("aria-disabled") !== "true" && e.setAttribute("aria-disabled", "true");
|
|
806
|
+
const r = e.getAttribute("role");
|
|
807
|
+
(r === "menuitemcheckbox" || r === "menuitemradio") && !e.hasAttribute("aria-checked") && e.setAttribute("aria-checked", "false"), this._applyStoredItemState(e, t);
|
|
818
808
|
});
|
|
819
809
|
}
|
|
820
810
|
_clearMenuContent() {
|
|
821
811
|
const e = this._getMenu();
|
|
822
812
|
e && e.replaceChildren();
|
|
823
813
|
}
|
|
824
|
-
_applyStoredItemState(e,
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
827
|
-
if (!this._checkboxState.has(
|
|
828
|
-
|
|
829
|
-
const n = this._checkboxState.get(r) === !0;
|
|
814
|
+
_applyStoredItemState(e, t) {
|
|
815
|
+
const r = e.getAttribute("role");
|
|
816
|
+
if (r === "menuitemcheckbox") {
|
|
817
|
+
if (!this._checkboxState.has(t)) return;
|
|
818
|
+
const n = this._checkboxState.get(t) === !0;
|
|
830
819
|
e.setAttribute("aria-checked", n ? "true" : "false"), e.setAttribute("data-state", n ? "checked" : "unchecked");
|
|
831
820
|
return;
|
|
832
821
|
}
|
|
833
|
-
if (
|
|
834
|
-
return;
|
|
822
|
+
if (r !== "menuitemradio") return;
|
|
835
823
|
const o = e.getAttribute("data-group") || e.getAttribute("name") || "__default__";
|
|
836
|
-
if (!this._radioState.has(o))
|
|
837
|
-
|
|
838
|
-
const a = this._radioState.get(o) === r;
|
|
824
|
+
if (!this._radioState.has(o)) return;
|
|
825
|
+
const a = this._radioState.get(o) === t;
|
|
839
826
|
e.setAttribute("aria-checked", a ? "true" : "false"), e.setAttribute("data-state", a ? "checked" : "unchecked");
|
|
840
827
|
}
|
|
841
828
|
_syncMenuPresentation() {
|
|
842
829
|
const e = this._getMenu();
|
|
843
|
-
if (!e)
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
const m = r.getPropertyValue(c).trim();
|
|
830
|
+
if (!e) return;
|
|
831
|
+
const t = p() ? window.getComputedStyle(this) : null;
|
|
832
|
+
t && F.forEach((c) => {
|
|
833
|
+
const m = t.getPropertyValue(c).trim();
|
|
848
834
|
m ? e.style.setProperty(c, m) : e.style.removeProperty(c);
|
|
849
835
|
});
|
|
850
|
-
const
|
|
851
|
-
if (
|
|
836
|
+
const r = h(this, "variant"), o = A(this.getAttribute("size") || this.getAttribute("density")), a = h(this, "density"), n = h(this, "shape"), u = h(this, "elevation"), s = h(this, "tone"), d = S(this.getAttribute("radius") || n || null);
|
|
837
|
+
if (r && r !== "default" ? e.setAttribute("data-variant", r) : e.removeAttribute("data-variant"), o !== "md" ? e.setAttribute("data-size", o) : e.removeAttribute("data-size"), a && a !== "default" ? e.setAttribute("data-density", a) : e.removeAttribute("data-density"), n && n !== "default" ? e.setAttribute("data-shape", n) : e.removeAttribute("data-shape"), u && u !== "default" ? e.setAttribute("data-elevation", u) : e.removeAttribute("data-elevation"), s && s !== "default" && s !== "brand" ? e.setAttribute("data-tone", s) : e.removeAttribute("data-tone"), d) {
|
|
852
838
|
e.style.setProperty("--ui-dropdown-radius", d), e.style.setProperty("--ui-dropdown-item-radius", d === "999px" ? "999px" : `max(0px, calc(${d} - 2px))`);
|
|
853
839
|
return;
|
|
854
840
|
}
|
|
@@ -856,14 +842,13 @@ class D extends _ {
|
|
|
856
842
|
}
|
|
857
843
|
_syncMenuA11y() {
|
|
858
844
|
const e = this._getMenu();
|
|
859
|
-
if (!e)
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
t ? e.setAttribute("aria-label", t) : e.removeAttribute("aria-label"), n ? e.setAttribute("aria-labelledby", n) : e.removeAttribute("aria-labelledby"), a ? e.setAttribute("aria-describedby", a) : e.removeAttribute("aria-describedby");
|
|
845
|
+
if (!e) return;
|
|
846
|
+
const t = this._getTrigger(), r = this.getAttribute("aria-label") || "", o = this.getAttribute("aria-labelledby") || "", a = this.getAttribute("aria-describedby") || "", n = o || (!r && t?.id ? t.id : "");
|
|
847
|
+
r ? e.setAttribute("aria-label", r) : e.removeAttribute("aria-label"), n ? e.setAttribute("aria-labelledby", n) : e.removeAttribute("aria-labelledby"), a ? e.setAttribute("aria-describedby", a) : e.removeAttribute("aria-describedby");
|
|
863
848
|
}
|
|
864
849
|
_syncControlState() {
|
|
865
|
-
const e = this._panelEl,
|
|
866
|
-
!e || !
|
|
850
|
+
const e = this._panelEl, t = this._getMenu();
|
|
851
|
+
!e || !t || (e.hidden = !this._isOpen, e.setAttribute("data-placement", this._placement));
|
|
867
852
|
}
|
|
868
853
|
_schedulePanelSync(e) {
|
|
869
854
|
this._openFrame && cancelAnimationFrame(this._openFrame), this._openFrame = requestAnimationFrame(() => {
|
|
@@ -875,33 +860,30 @@ class D extends _ {
|
|
|
875
860
|
!e || !this._isOpen || (this._placement = this._resolvePlacement(), e.setAttribute("data-placement", this._placement), this.style.setProperty("--ui-dropdown-available-width", `${Math.max(0, Math.floor(this._availableWidth(this._placement)))}px`), this.style.setProperty("--ui-dropdown-available-height", `${Math.max(0, Math.floor(this._availableHeight(this._placement)))}px`));
|
|
876
861
|
}
|
|
877
862
|
_availableWidth(e) {
|
|
878
|
-
const
|
|
879
|
-
if (!
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
return e === "left" ? t.left - 12 : e === "right" ? o - t.right - 12 : o - t.left - 12;
|
|
863
|
+
const t = this._getTrigger();
|
|
864
|
+
if (!t || !p()) return 380;
|
|
865
|
+
const r = t.getBoundingClientRect(), o = window.innerWidth || document.documentElement.clientWidth || 0;
|
|
866
|
+
return e === "left" ? r.left - 12 : e === "right" ? o - r.right - 12 : o - r.left - 12;
|
|
883
867
|
}
|
|
884
868
|
_availableHeight(e) {
|
|
885
|
-
const
|
|
886
|
-
if (!
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
return e === "top" ? t.top - 12 : o - t.bottom - 12;
|
|
869
|
+
const t = this._getTrigger();
|
|
870
|
+
if (!t || !p()) return 440;
|
|
871
|
+
const r = t.getBoundingClientRect(), o = window.innerHeight || document.documentElement.clientHeight || 0;
|
|
872
|
+
return e === "top" ? r.top - 12 : o - r.bottom - 12;
|
|
890
873
|
}
|
|
891
874
|
_resolvePlacement() {
|
|
892
|
-
const e = k(this.getAttribute("placement")),
|
|
893
|
-
if (!
|
|
894
|
-
|
|
895
|
-
const o = r.getBoundingClientRect(), a = window.innerWidth || document.documentElement.clientWidth || 0, n = window.innerHeight || document.documentElement.clientHeight || 0, u = Math.max(0, n - o.bottom - 12), s = Math.max(0, o.top - 12), d = Math.max(0, a - o.right - 12), c = Math.max(0, o.left - 12), m = Math.min(Math.max(t.scrollHeight, t.offsetHeight) + 4, 320), v = Math.min(Math.max(t.scrollWidth, t.offsetWidth) + 4, 360);
|
|
875
|
+
const e = k(this.getAttribute("placement")), t = this._getTrigger(), r = this._getMenu();
|
|
876
|
+
if (!t || !r || !p()) return e;
|
|
877
|
+
const o = t.getBoundingClientRect(), a = window.innerWidth || document.documentElement.clientWidth || 0, n = window.innerHeight || document.documentElement.clientHeight || 0, u = Math.max(0, n - o.bottom - 12), s = Math.max(0, o.top - 12), d = Math.max(0, a - o.right - 12), c = Math.max(0, o.left - 12), m = Math.min(Math.max(r.scrollHeight, r.offsetHeight) + 4, 320), v = Math.min(Math.max(r.scrollWidth, r.offsetWidth) + 4, 360);
|
|
896
878
|
return e === "top" ? s >= m || s > u ? "top" : "bottom" : e === "left" ? c >= v || c > d ? "left" : "right" : e === "right" ? d >= v || d >= c ? "right" : "left" : u >= m || u >= s ? "bottom" : "top";
|
|
897
879
|
}
|
|
898
880
|
_clearActiveItem() {
|
|
899
881
|
this._queryItems(!0).forEach((e) => e.removeAttribute("data-active"));
|
|
900
882
|
}
|
|
901
|
-
_setActiveItem(e,
|
|
902
|
-
if (this._clearActiveItem(), !!e && (e.setAttribute("data-active", "true"),
|
|
903
|
-
const
|
|
904
|
-
|
|
883
|
+
_setActiveItem(e, t = {}) {
|
|
884
|
+
if (this._clearActiveItem(), !!e && (e.setAttribute("data-active", "true"), t.focus && g(e), t.scroll)) {
|
|
885
|
+
const r = this._getMenu();
|
|
886
|
+
r && E(e, r);
|
|
905
887
|
}
|
|
906
888
|
}
|
|
907
889
|
_focusFirstItem() {
|
|
@@ -913,12 +895,11 @@ class D extends _ {
|
|
|
913
895
|
this._setActiveItem(e[e.length - 1] || null, { focus: !0, scroll: !0 });
|
|
914
896
|
}
|
|
915
897
|
_moveFocus(e) {
|
|
916
|
-
const
|
|
917
|
-
if (!
|
|
918
|
-
|
|
919
|
-
const t = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = t ? r.indexOf(t) : e > 0 ? -1 : r.length, a = T(r, o, e);
|
|
898
|
+
const t = this._queryItems(!0);
|
|
899
|
+
if (!t.length) return;
|
|
900
|
+
const r = this._currentFocusedItem() || this._queryItems(!0).find((n) => n.getAttribute("data-active") === "true") || null, o = r ? t.indexOf(r) : e > 0 ? -1 : t.length, a = T(t, o, e);
|
|
920
901
|
if (a >= 0) {
|
|
921
|
-
this._setActiveItem(
|
|
902
|
+
this._setActiveItem(t[a], { focus: !0, scroll: !0 });
|
|
922
903
|
return;
|
|
923
904
|
}
|
|
924
905
|
e > 0 ? this._focusFirstItem() : this._focusLastItem();
|
|
@@ -930,52 +911,46 @@ class D extends _ {
|
|
|
930
911
|
return e.ctrlKey || e.metaKey || e.altKey ? !1 : e.key.length === 1 && /\S/.test(e.key);
|
|
931
912
|
}
|
|
932
913
|
_handleTypeahead(e) {
|
|
933
|
-
if (!this.typeahead || !this._isTypeaheadKey(e))
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
return t ? (this._setActiveItem(t, { focus: !0, scroll: !0 }), e.preventDefault(), !0) : !1;
|
|
914
|
+
if (!this.typeahead || !this._isTypeaheadKey(e)) return !1;
|
|
915
|
+
const t = e.key.toLowerCase();
|
|
916
|
+
this._typeaheadBuffer = `${this._typeaheadBuffer}${t}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => this._resetTypeahead(), 460);
|
|
917
|
+
const r = M(this._queryItems(!0), this._typeaheadBuffer, this._currentFocusedItem());
|
|
918
|
+
return r ? (this._setActiveItem(r, { focus: !0, scroll: !0 }), e.preventDefault(), !0) : !1;
|
|
939
919
|
}
|
|
940
920
|
_querySourceItems() {
|
|
941
921
|
const e = this._getContentSource();
|
|
942
922
|
return e ? Array.from(e.querySelectorAll(l)) : [];
|
|
943
923
|
}
|
|
944
924
|
_applySelectionBehavior(e) {
|
|
945
|
-
const
|
|
946
|
-
if (
|
|
925
|
+
const t = e.getAttribute("role"), r = Number(e.dataset.sourceIndex || "-1");
|
|
926
|
+
if (t === "menuitemcheckbox") {
|
|
947
927
|
const n = e.getAttribute("aria-checked") !== "true";
|
|
948
|
-
e.setAttribute("aria-checked", n ? "true" : "false"), e.setAttribute("data-state", n ? "checked" : "unchecked"),
|
|
928
|
+
e.setAttribute("aria-checked", n ? "true" : "false"), e.setAttribute("data-state", n ? "checked" : "unchecked"), r >= 0 && this._checkboxState.set(r, n);
|
|
949
929
|
return;
|
|
950
930
|
}
|
|
951
|
-
if (
|
|
952
|
-
return;
|
|
931
|
+
if (t !== "menuitemradio") return;
|
|
953
932
|
const a = e.getAttribute("data-group") || e.getAttribute("name") || "" || "__default__";
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
if (a && (u || "__default__") !== a)
|
|
957
|
-
return;
|
|
933
|
+
r >= 0 && this._radioState.set(a, r), this._queryItems(!0).filter((n) => n.getAttribute("role") === "menuitemradio").forEach((n) => {
|
|
934
|
+
if ((n.getAttribute("data-group") || n.getAttribute("name") || "" || "__default__") !== a) return;
|
|
958
935
|
const s = n === e;
|
|
959
936
|
n.setAttribute("aria-checked", s ? "true" : "false"), n.setAttribute("data-state", s ? "checked" : "unchecked");
|
|
960
937
|
});
|
|
961
938
|
}
|
|
962
939
|
_findMenuItemFromEvent(e) {
|
|
963
|
-
const
|
|
964
|
-
for (const o of
|
|
965
|
-
if (o instanceof HTMLElement && o.matches(l))
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
return t instanceof HTMLElement ? t.closest(l) : null;
|
|
940
|
+
const t = typeof e.composedPath == "function" ? e.composedPath() : [];
|
|
941
|
+
for (const o of t)
|
|
942
|
+
if (o instanceof HTMLElement && o.matches(l)) return o;
|
|
943
|
+
const r = e.target;
|
|
944
|
+
return r instanceof HTMLElement ? r.closest(l) : null;
|
|
969
945
|
}
|
|
970
946
|
_isEventInsideTrigger(e) {
|
|
971
|
-
const
|
|
972
|
-
return
|
|
947
|
+
const t = this._getTrigger();
|
|
948
|
+
return t ? (typeof e.composedPath == "function" ? e.composedPath() : []).includes(t) : !1;
|
|
973
949
|
}
|
|
974
950
|
_emitSelect(e) {
|
|
975
|
-
|
|
976
|
-
const r = {
|
|
951
|
+
const t = {
|
|
977
952
|
value: e.getAttribute("data-value") || e.getAttribute("value") || void 0,
|
|
978
|
-
label: e.getAttribute("aria-label") ||
|
|
953
|
+
label: e.getAttribute("aria-label") || e.textContent?.trim() || void 0,
|
|
979
954
|
checked: e.getAttribute("aria-checked") === "true",
|
|
980
955
|
item: e
|
|
981
956
|
};
|
|
@@ -983,17 +958,15 @@ class D extends _ {
|
|
|
983
958
|
new CustomEvent("select", {
|
|
984
959
|
bubbles: !0,
|
|
985
960
|
composed: !0,
|
|
986
|
-
detail:
|
|
961
|
+
detail: t
|
|
987
962
|
})
|
|
988
963
|
);
|
|
989
964
|
}
|
|
990
965
|
_onHostClick(e) {
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
if (r && ((t = this._getMenu()) != null && t.contains(r)) && !b(r)) {
|
|
996
|
-
this._applySelectionBehavior(r), this._setActiveItem(r, { focus: !0, scroll: !0 }), this._emitSelect(r), this.closeOnSelect && this._requestClose("select");
|
|
966
|
+
if (this.hasAttribute("disabled")) return;
|
|
967
|
+
const t = this._isOpen ? this._findMenuItemFromEvent(e) : null;
|
|
968
|
+
if (t && this._getMenu()?.contains(t) && !b(t)) {
|
|
969
|
+
this._applySelectionBehavior(t), this._setActiveItem(t, { focus: !0, scroll: !0 }), this._emitSelect(t), this.closeOnSelect && this._requestClose("select");
|
|
997
970
|
return;
|
|
998
971
|
}
|
|
999
972
|
if (this._isEventInsideTrigger(e)) {
|
|
@@ -1005,10 +978,8 @@ class D extends _ {
|
|
|
1005
978
|
}
|
|
1006
979
|
}
|
|
1007
980
|
_onHostKeyDown(e) {
|
|
1008
|
-
var r;
|
|
1009
981
|
if (!this._isOpen) {
|
|
1010
|
-
if (!this._isEventInsideTrigger(e) || !["ArrowDown", "ArrowUp", "Enter", " "].includes(e.key))
|
|
1011
|
-
return;
|
|
982
|
+
if (!this._isEventInsideTrigger(e) || !["ArrowDown", "ArrowUp", "Enter", " "].includes(e.key)) return;
|
|
1012
983
|
e.preventDefault(), this.open(), this._schedulePanelSync(e.key === "ArrowUp" ? "last" : "first");
|
|
1013
984
|
return;
|
|
1014
985
|
}
|
|
@@ -1039,8 +1010,7 @@ class D extends _ {
|
|
|
1039
1010
|
}
|
|
1040
1011
|
if (e.key === "Enter" || e.key === " ") {
|
|
1041
1012
|
const t = this._currentFocusedItem();
|
|
1042
|
-
if (!t || !
|
|
1043
|
-
return;
|
|
1013
|
+
if (!t || !this._getMenu()?.contains(t) || b(t)) return;
|
|
1044
1014
|
e.preventDefault(), t.click();
|
|
1045
1015
|
}
|
|
1046
1016
|
}
|
package/dist/dropzone.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./file-upload.cjs.js");
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("./file-upload.cjs.js");class e extends t.UIFileUpload{connectedCallback(){this.hasAttribute("surface")||this.setAttribute("surface","dropzone"),super.connectedCallback()}}typeof customElements<"u"&&!customElements.get("ui-dropzone")&&customElements.define("ui-dropzone",e);exports.UIDropzone=e;
|
package/dist/dropzone.esm.js
CHANGED
package/dist/empty-state.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./ElementBase-EV6mVBUV.js"),c=`
|
|
2
2
|
:host {
|
|
3
3
|
display: block;
|
|
4
4
|
--ui-empty-bg: linear-gradient(180deg, var(--ui-color-surface, #ffffff), var(--ui-color-surface-alt, #f8fafc));
|
package/dist/empty-state.esm.js
CHANGED
package/dist/field-error.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const d=require("./ElementBase-EV6mVBUV.js"),u=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #dc2626));
|
|
4
4
|
--ui-field-error-size: 12px;
|
package/dist/field-error.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as d } from "./ElementBase-
|
|
1
|
+
import { E as d } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const l = `
|
|
3
3
|
:host {
|
|
4
4
|
--ui-field-error-color: var(--ui-color-danger, var(--ui-error, #dc2626));
|
|
@@ -104,8 +104,7 @@ class f extends d {
|
|
|
104
104
|
}
|
|
105
105
|
_resolveTarget() {
|
|
106
106
|
const r = this.getAttribute("for");
|
|
107
|
-
if (!r)
|
|
108
|
-
return null;
|
|
107
|
+
if (!r) return null;
|
|
109
108
|
const i = this.getRootNode();
|
|
110
109
|
return i instanceof Document || i instanceof ShadowRoot ? i.getElementById(r) : document.getElementById(r);
|
|
111
110
|
}
|
|
@@ -113,8 +112,7 @@ class f extends d {
|
|
|
113
112
|
this._target && this._errorId && (a(this._target, "aria-describedby", this._errorId, !1), this._target.getAttribute("aria-errormessage") === this._errorId && this._target.removeAttribute("aria-errormessage"), this._target.getAttribute("aria-invalid") === "true" && !this._target.hasAttribute("data-ui-invalid-persist") && this._target.removeAttribute("aria-invalid")), this._target = null;
|
|
114
113
|
}
|
|
115
114
|
_syncAssociation() {
|
|
116
|
-
if (this._clearAssociation(), !this.hasAttribute("active") || this.hasAttribute("hidden"))
|
|
117
|
-
return;
|
|
115
|
+
if (this._clearAssociation(), !this.hasAttribute("active") || this.hasAttribute("hidden")) return;
|
|
118
116
|
const r = this._resolveTarget();
|
|
119
117
|
r && (this._errorId = u(this, "msg"), this._target = r, a(r, "aria-describedby", this._errorId, !0), r.setAttribute("aria-errormessage", this._errorId), r.setAttribute("aria-invalid", "true"));
|
|
120
118
|
}
|
package/dist/field.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=require("./ElementBase-EV6mVBUV.js"),q=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-field-gap: 8px;
|
|
4
4
|
--ui-field-label-width: 192px;
|
|
@@ -370,19 +370,19 @@
|
|
|
370
370
|
box-shadow: none;
|
|
371
371
|
}
|
|
372
372
|
}
|
|
373
|
-
`;function b(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function p(o){if(!o)return!1;const e=o.assignedNodes({flatten:!0});return e.length?e.some(
|
|
373
|
+
`;function b(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function p(o){if(!o)return!1;const e=o.assignedNodes({flatten:!0});return e.length?e.some(r=>r.nodeType===Node.TEXT_NODE?!!r.textContent?.trim():r.nodeType===Node.ELEMENT_NODE):!1}function f(o){if(o.hasAttribute("disabled")||o.getAttribute("aria-disabled")==="true"||o.getAttribute("tabindex")==="-1")return!1;const e=window.getComputedStyle(o);return!(e.display==="none"||e.visibility==="hidden")}function k(o){return!!o.closest('button, a, input, select, textarea, summary, [contenteditable=""], [contenteditable="true"], [role="button"]')}function _(o){return Array.from(new Set(o.filter(Boolean)))}const S='ui-input, ui-textarea, ui-select, ui-combobox, input, textarea, select, button, [tabindex]:not([tabindex="-1"])';class A extends E.ElementBase{constructor(){super(),this._uid=Math.random().toString(36).slice(2,9),this._controlCache=null,this._stateSyncQueued=!1,this._onRootClick=this._onRootClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["label","description","error","for","required","invalid","orientation","headless","variant","tone","density","shape","shell","label-width"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this.root.addEventListener("slotchange",this._onSlotChange),this._scheduleDerivedStateSync()}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this.root.removeEventListener("slotchange",this._onSlotChange),super.disconnectedCallback()}attributeChangedCallback(e,r,l){if(r!==l){if(e==="for"&&this._invalidateControlCache(),e==="label-width"){const i=this.getAttribute("label-width");i?this.style.setProperty("--ui-field-label-width",i):this.style.removeProperty("--ui-field-label-width")}if(e==="label"||e==="description"||e==="error"||e==="required"||e==="for"){this.isConnected&&this.requestRender();return}e==="invalid"&&this._scheduleDerivedStateSync()}}_onSlotChange(){this._invalidateControlCache(),this._scheduleDerivedStateSync()}_onRootClick(e){const r=e.target;r&&r.closest(".label")&&(k(r)||this._focusControl())}_invalidateControlCache(){this._controlCache=null}_scheduleDerivedStateSync(){this._stateSyncQueued||(this._stateSyncQueued=!0,queueMicrotask(()=>{this._stateSyncQueued=!1,this.isConnected&&this._syncDerivedState()}))}_focusControl(){const e=this._resolveControlElement();if(e)try{e.focus({preventScroll:!0})}catch{e.focus()}}_resolveControlElement(){if(this._controlCache&&this._controlCache.isConnected&&f(this._controlCache))return this._controlCache;const e=this.getAttribute("for");if(e){const t=document.getElementById(e);if(t instanceof HTMLElement&&f(t))return this._controlCache=t,t}const l=this.root.querySelector("slot:not([name])")?.assignedElements({flatten:!0})||[];for(const t of l){if(!(t instanceof HTMLElement))continue;if(f(t))return this._controlCache=t,t;const s=t.querySelector(S);if(s&&f(s))return this._controlCache=s,s}const i=this.querySelector(S);return i&&f(i)?(this._controlCache=i,i):null}_syncDerivedState(){const e=this.root.querySelector('slot[name="label"]'),r=this.root.querySelector('slot[name="actions"]'),l=this.root.querySelector('slot[name="description"]'),i=this.root.querySelector('slot[name="error"]'),t=(this.getAttribute("label")||"").trim(),s=(this.getAttribute("description")||"").trim(),h=(this.getAttribute("error")||"").trim(),n=!!t||p(e),c=p(r),d=!!s||p(l),u=!!h||p(i),C=n||c||d,a=n||c,g=this.root.querySelector(".meta"),v=this.root.querySelector(".label-row"),m=this.root.querySelector(".label"),x=this.root.querySelector(".actions"),y=this.root.querySelector(".description"),w=this.root.querySelector(".error");g&&(C?g.removeAttribute("hidden"):g.setAttribute("hidden","")),v&&(a?v.removeAttribute("hidden"):v.setAttribute("hidden","")),m&&(n?m.removeAttribute("hidden"):m.setAttribute("hidden","")),x&&(c?x.removeAttribute("hidden"):x.setAttribute("hidden","")),y&&(d?y.removeAttribute("hidden"):y.setAttribute("hidden","")),w&&(u?w.removeAttribute("hidden"):w.setAttribute("hidden","")),this._syncControlA11y(n,d,u)}_syncControlA11y(e,r,l){const i=this._resolveControlElement();if(!i)return;const t=`${this._uid}-label`,s=`${this._uid}-description`,h=`${this._uid}-error`,n=(i.getAttribute("aria-labelledby")||"").split(/\s+/).filter(a=>a&&a!==t);!i.hasAttribute("aria-label")&&e&&n.push(t);const c=_(n);c.length?i.setAttribute("aria-labelledby",c.join(" ")):i.removeAttribute("aria-labelledby");const d=(i.getAttribute("aria-describedby")||"").split(/\s+/).filter(a=>a&&a!==s&&a!==h);r&&d.push(s),l&&d.push(h);const u=_(d);u.length?i.setAttribute("aria-describedby",u.join(" ")):i.removeAttribute("aria-describedby"),this.hasAttribute("invalid")||l?i.setAttribute("aria-invalid","true"):i.removeAttribute("aria-invalid"),this.hasAttribute("required")?i.setAttribute("aria-required","true"):i.removeAttribute("aria-required")}render(){const e=this.getAttribute("label")||"",r=this.getAttribute("description")||"",l=this.getAttribute("error")||"",i=this.hasAttribute("required"),t=this.getAttribute("for")||"";this.setContent(`
|
|
374
374
|
<style>${q}</style>
|
|
375
375
|
<div class="frame" part="field">
|
|
376
376
|
<div class="meta" part="meta">
|
|
377
377
|
<div class="label-row" part="top">
|
|
378
|
-
<label class="label" id="${this._uid}-label" ${
|
|
378
|
+
<label class="label" id="${this._uid}-label" ${t?`for="${b(t)}"`:""}>
|
|
379
379
|
<slot name="label">${b(e)}</slot>
|
|
380
380
|
${i?'<span class="required" aria-hidden="true">*</span>':""}
|
|
381
381
|
</label>
|
|
382
382
|
<div class="actions" part="actions"><slot name="actions"></slot></div>
|
|
383
383
|
</div>
|
|
384
384
|
<p class="description" id="${this._uid}-description" part="description">
|
|
385
|
-
<slot name="description">${b(
|
|
385
|
+
<slot name="description">${b(r)}</slot>
|
|
386
386
|
</p>
|
|
387
387
|
</div>
|
|
388
388
|
|
|
@@ -395,4 +395,4 @@
|
|
|
395
395
|
</p>
|
|
396
396
|
</div>
|
|
397
397
|
</div>
|
|
398
|
-
`),this._invalidateControlCache(),this._scheduleDerivedStateSync()}shouldRenderOnAttributeChange(e,
|
|
398
|
+
`),this._invalidateControlCache(),this._scheduleDerivedStateSync()}shouldRenderOnAttributeChange(e,r,l){return e==="label"||e==="description"||e==="error"||e==="required"||e==="for"}}typeof customElements<"u"&&!customElements.get("ui-field")&&customElements.define("ui-field",A);exports.UIField=A;
|