@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/combobox.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { E as A } from "./ElementBase-
|
|
2
|
-
import { n as h } from "./collection-
|
|
3
|
-
import { c as C } from "./dismissable-layer-
|
|
4
|
-
import { r as k } from "./listbox-
|
|
5
|
-
import "./collection.esm.js";
|
|
1
|
+
import { E as A } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { n as h } from "./collection-C7URGjEI.mjs";
|
|
3
|
+
import { c as C } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
+
import { r as k } from "./listbox-DJamVeFj.mjs";
|
|
6
5
|
const F = `
|
|
7
6
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
8
7
|
<path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
@@ -476,9 +475,8 @@ const F = `
|
|
|
476
475
|
function a(d) {
|
|
477
476
|
return d.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
478
477
|
}
|
|
479
|
-
function
|
|
480
|
-
if (d == null)
|
|
481
|
-
return !1;
|
|
478
|
+
function _(d) {
|
|
479
|
+
if (d == null) return !1;
|
|
482
480
|
const t = String(d).toLowerCase();
|
|
483
481
|
return t !== "false" && t !== "0";
|
|
484
482
|
}
|
|
@@ -525,8 +523,7 @@ class E extends A {
|
|
|
525
523
|
}), this._attachFormRegistration();
|
|
526
524
|
}
|
|
527
525
|
disconnectedCallback() {
|
|
528
|
-
|
|
529
|
-
this._unbindGlobalListeners(), this._detachDomListeners(), (t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = null, this._observer && (this._observer.disconnect(), this._observer = null), this._debounceTimer && (clearTimeout(this._debounceTimer), this._debounceTimer = null), this._optionsRefreshFrame && (cancelAnimationFrame(this._optionsRefreshFrame), this._optionsRefreshFrame = 0), this._autofocusFrame && (cancelAnimationFrame(this._autofocusFrame), this._autofocusFrame = 0), this._formUnregister && (this._formUnregister(), this._formUnregister = null), super.disconnectedCallback();
|
|
526
|
+
this._unbindGlobalListeners(), this._detachDomListeners(), this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._observer && (this._observer.disconnect(), this._observer = null), this._debounceTimer && (clearTimeout(this._debounceTimer), this._debounceTimer = null), this._optionsRefreshFrame && (cancelAnimationFrame(this._optionsRefreshFrame), this._optionsRefreshFrame = 0), this._autofocusFrame && (cancelAnimationFrame(this._autofocusFrame), this._autofocusFrame = 0), this._formUnregister && (this._formUnregister(), this._formUnregister = null), super.disconnectedCallback();
|
|
530
527
|
}
|
|
531
528
|
attributeChangedCallback(t, e, i) {
|
|
532
529
|
if (e !== i) {
|
|
@@ -567,7 +564,7 @@ class E extends A {
|
|
|
567
564
|
this._setOpen(t, "api");
|
|
568
565
|
}
|
|
569
566
|
_isDisabled() {
|
|
570
|
-
return
|
|
567
|
+
return _(this.getAttribute("disabled"));
|
|
571
568
|
}
|
|
572
569
|
_isReadonly() {
|
|
573
570
|
return this.hasAttribute("readonly");
|
|
@@ -581,46 +578,44 @@ class E extends A {
|
|
|
581
578
|
}
|
|
582
579
|
_stateText() {
|
|
583
580
|
const t = this.getAttribute("state-text");
|
|
584
|
-
if (t)
|
|
585
|
-
return t;
|
|
581
|
+
if (t) return t;
|
|
586
582
|
const e = this._state();
|
|
587
583
|
return e === "loading" ? "Syncing results" : e === "error" ? "Unable to load results" : e === "success" ? "Results up to date" : "";
|
|
588
584
|
}
|
|
589
585
|
_emitOpenState(t, e, i) {
|
|
590
|
-
const
|
|
586
|
+
const r = { open: t, previousOpen: e, source: i };
|
|
591
587
|
this.dispatchEvent(
|
|
592
588
|
new CustomEvent(t ? "open" : "close", {
|
|
593
|
-
detail:
|
|
589
|
+
detail: r,
|
|
594
590
|
bubbles: !0,
|
|
595
591
|
composed: !0
|
|
596
592
|
})
|
|
597
593
|
), this.dispatchEvent(
|
|
598
594
|
new CustomEvent(t ? "ui-open" : "ui-close", {
|
|
599
|
-
detail:
|
|
595
|
+
detail: r,
|
|
600
596
|
bubbles: !0,
|
|
601
597
|
composed: !0
|
|
602
598
|
})
|
|
603
599
|
);
|
|
604
600
|
}
|
|
605
601
|
_attachFormRegistration() {
|
|
606
|
-
var t;
|
|
607
602
|
try {
|
|
608
|
-
const
|
|
609
|
-
r && typeof r.registerField == "function" &&
|
|
610
|
-
name:
|
|
603
|
+
const r = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), s = this.getAttribute("name");
|
|
604
|
+
r && typeof r.registerField == "function" && s && (this._formUnregister = r.registerField(s, {
|
|
605
|
+
name: s,
|
|
611
606
|
getValue: () => this.value,
|
|
612
|
-
setValue: (
|
|
613
|
-
this.value =
|
|
607
|
+
setValue: (o) => {
|
|
608
|
+
this.value = o;
|
|
614
609
|
},
|
|
615
610
|
validate: async () => {
|
|
616
|
-
const
|
|
611
|
+
const o = this._isCurrentValueValid();
|
|
617
612
|
return {
|
|
618
|
-
valid:
|
|
619
|
-
message:
|
|
613
|
+
valid: o,
|
|
614
|
+
message: o ? void 0 : "Please select a value from the list."
|
|
620
615
|
};
|
|
621
616
|
},
|
|
622
|
-
setError: (
|
|
623
|
-
|
|
617
|
+
setError: (o) => {
|
|
618
|
+
o ? (this.setAttribute("validation", "error"), this.setAttribute("data-error", o)) : (this.removeAttribute("validation"), this.removeAttribute("data-error"));
|
|
624
619
|
}
|
|
625
620
|
}));
|
|
626
621
|
} catch {
|
|
@@ -634,17 +629,16 @@ class E extends A {
|
|
|
634
629
|
const t = Array.from(
|
|
635
630
|
this.querySelectorAll("option,[data-combobox-option]")
|
|
636
631
|
), e = /* @__PURE__ */ new Set();
|
|
637
|
-
return t.map((i,
|
|
638
|
-
const
|
|
639
|
-
if (!c && !l)
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
return e.has(m) ? null : (e.add(m), {
|
|
632
|
+
return t.map((i, r) => {
|
|
633
|
+
const s = i.tagName.toLowerCase() === "option", o = i, n = s ? o.value || o.textContent || "" : i.getAttribute("value") || i.getAttribute("data-value") || i.textContent || "", l = s ? (o.label || o.textContent || o.value || "").trim() : (i.getAttribute("label") || i.textContent || n).trim(), b = (i.getAttribute("description") || i.getAttribute("data-description") || "").trim(), u = s ? o.disabled : _(i.getAttribute("disabled")), c = n.trim();
|
|
634
|
+
if (!c && !l) return null;
|
|
635
|
+
const p = `${c}::${l}`;
|
|
636
|
+
return e.has(p) ? null : (e.add(p), {
|
|
643
637
|
value: c,
|
|
644
638
|
label: l,
|
|
645
639
|
description: b,
|
|
646
640
|
disabled: u,
|
|
647
|
-
sourceIndex:
|
|
641
|
+
sourceIndex: r
|
|
648
642
|
});
|
|
649
643
|
}).filter((i) => !!i);
|
|
650
644
|
}
|
|
@@ -658,17 +652,17 @@ class E extends A {
|
|
|
658
652
|
) || null;
|
|
659
653
|
}
|
|
660
654
|
_rebuildFiltered(t) {
|
|
661
|
-
const e = h(this._query), i = this.hasAttribute("no-filter"),
|
|
662
|
-
if (this._filtered = this._options.filter((o) => i || !e ? !0 : h(o.label).includes(e) || h(o.value).includes(e)), t
|
|
663
|
-
const o = this._filtered.findIndex((n) => n.sourceIndex ===
|
|
655
|
+
const e = h(this._query), i = this.hasAttribute("no-filter"), r = this._filtered[this._highlightedIndex];
|
|
656
|
+
if (this._filtered = this._options.filter((o) => i || !e ? !0 : h(o.label).includes(e) || h(o.value).includes(e)), t?.preserveHighlight && r) {
|
|
657
|
+
const o = this._filtered.findIndex((n) => n.sourceIndex === r.sourceIndex);
|
|
664
658
|
if (o >= 0 && !this._filtered[o].disabled) {
|
|
665
659
|
this._highlightedIndex = o;
|
|
666
660
|
return;
|
|
667
661
|
}
|
|
668
662
|
}
|
|
669
|
-
const
|
|
670
|
-
if (
|
|
671
|
-
const o = this._filtered.findIndex((n) => n.sourceIndex ===
|
|
663
|
+
const s = this._findOptionByValue(this.value);
|
|
664
|
+
if (s) {
|
|
665
|
+
const o = this._filtered.findIndex((n) => n.sourceIndex === s.sourceIndex);
|
|
672
666
|
if (o >= 0 && !this._filtered[o].disabled) {
|
|
673
667
|
this._highlightedIndex = o;
|
|
674
668
|
return;
|
|
@@ -679,8 +673,7 @@ class E extends A {
|
|
|
679
673
|
});
|
|
680
674
|
}
|
|
681
675
|
_renderList() {
|
|
682
|
-
if (!this._panel)
|
|
683
|
-
return;
|
|
676
|
+
if (!this._panel) return;
|
|
684
677
|
const t = this._renderStateRow(), e = this.getAttribute("empty-text") || "No matches found", i = [
|
|
685
678
|
t,
|
|
686
679
|
e,
|
|
@@ -701,8 +694,8 @@ class E extends A {
|
|
|
701
694
|
this._panel.innerHTML = `${t}<div class="empty" part="empty">${a(e)}</div>`, this._listStructureFingerprint = i, this._panel.refresh(), this._panel.clearActive(), this._syncActiveDescendant();
|
|
702
695
|
return;
|
|
703
696
|
}
|
|
704
|
-
const
|
|
705
|
-
const l = o.value ===
|
|
697
|
+
const r = this.value, s = this._filtered.map((o, n) => {
|
|
698
|
+
const l = o.value === r, b = n === this._highlightedIndex, u = o.disabled;
|
|
706
699
|
return `
|
|
707
700
|
<button
|
|
708
701
|
type="button"
|
|
@@ -723,23 +716,20 @@ class E extends A {
|
|
|
723
716
|
</button>
|
|
724
717
|
`;
|
|
725
718
|
}).join("");
|
|
726
|
-
this._panel.innerHTML = `${t}${
|
|
719
|
+
this._panel.innerHTML = `${t}${s}`, this._listStructureFingerprint = i, this._panel.refresh(), this._syncActiveDescendant(), this._scrollHighlightedIntoView();
|
|
727
720
|
}
|
|
728
721
|
_syncRenderedListState() {
|
|
729
|
-
if (!this._panel)
|
|
730
|
-
return !1;
|
|
722
|
+
if (!this._panel) return !1;
|
|
731
723
|
if (this._filtered.length === 0)
|
|
732
724
|
return this._panel.querySelector(".empty") ? (this._panel.clearActive(), this._syncActiveDescendant(), !0) : !1;
|
|
733
725
|
const t = Array.from(this._panel.querySelectorAll(".option[data-option-index]"));
|
|
734
|
-
if (t.length !== this._filtered.length)
|
|
735
|
-
return !1;
|
|
726
|
+
if (t.length !== this._filtered.length) return !1;
|
|
736
727
|
const e = this.value;
|
|
737
|
-
return t.forEach((i,
|
|
738
|
-
const
|
|
739
|
-
if (!
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
i.setAttribute("aria-selected", o ? "true" : "false"), i.setAttribute("aria-disabled", r.disabled ? "true" : "false"), i.setAttribute("data-highlighted", n ? "true" : "false"), i.setAttribute("data-selected", o ? "true" : "false"), i.disabled = r.disabled;
|
|
728
|
+
return t.forEach((i, r) => {
|
|
729
|
+
const s = this._filtered[r];
|
|
730
|
+
if (!s) return;
|
|
731
|
+
const o = s.value === e, n = r === this._highlightedIndex;
|
|
732
|
+
i.setAttribute("aria-selected", o ? "true" : "false"), i.setAttribute("aria-disabled", s.disabled ? "true" : "false"), i.setAttribute("data-highlighted", n ? "true" : "false"), i.setAttribute("data-selected", o ? "true" : "false"), i.disabled = s.disabled;
|
|
743
733
|
}), this._syncActiveDescendant(), this._scrollHighlightedIntoView(), !0;
|
|
744
734
|
}
|
|
745
735
|
_renderStateRow() {
|
|
@@ -747,16 +737,13 @@ class E extends A {
|
|
|
747
737
|
return e ? `<div class="status-row" part="status" data-state="${a(t)}" aria-live="polite">${a(e)}</div>` : "";
|
|
748
738
|
}
|
|
749
739
|
_syncInputFromValue() {
|
|
750
|
-
if (!this._input || this._isFocused && this.open)
|
|
751
|
-
return;
|
|
740
|
+
if (!this._input || this._isFocused && this.open) return;
|
|
752
741
|
const t = this._findOptionByValue(this.value);
|
|
753
742
|
t ? (this._query = t.label, this._input.value = t.label) : (this._query = this.value, this._input.value = this.value), this._rebuildFiltered({ preserveHighlight: !1 }), this._renderList();
|
|
754
743
|
}
|
|
755
744
|
_syncActiveDescendant() {
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
return;
|
|
759
|
-
const t = (e = this._panel) == null ? void 0 : e.querySelector(`[data-option-index="${this._highlightedIndex}"]`);
|
|
745
|
+
if (!this._input) return;
|
|
746
|
+
const t = this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`);
|
|
760
747
|
if (t && this._panel) {
|
|
761
748
|
this._panel.setActiveItem(t, {
|
|
762
749
|
focus: !1,
|
|
@@ -765,11 +752,10 @@ class E extends A {
|
|
|
765
752
|
});
|
|
766
753
|
return;
|
|
767
754
|
}
|
|
768
|
-
|
|
755
|
+
this._panel?.clearActive(), this._input.removeAttribute("aria-activedescendant");
|
|
769
756
|
}
|
|
770
757
|
_scrollHighlightedIntoView() {
|
|
771
|
-
if (!this._panel || this._highlightedIndex < 0)
|
|
772
|
-
return;
|
|
758
|
+
if (!this._panel || this._highlightedIndex < 0) return;
|
|
773
759
|
const t = this._panel.querySelector(`[data-option-index="${this._highlightedIndex}"]`);
|
|
774
760
|
this._panel.setActiveItem(t, {
|
|
775
761
|
focus: !1,
|
|
@@ -778,16 +764,13 @@ class E extends A {
|
|
|
778
764
|
});
|
|
779
765
|
}
|
|
780
766
|
_updateClearButton() {
|
|
781
|
-
if (!this._clearBtn)
|
|
782
|
-
return;
|
|
767
|
+
if (!this._clearBtn) return;
|
|
783
768
|
this.hasAttribute("clearable") && !this._isDisabled() && !this._isReadonly() && !this._isLoading() && (this._query.length > 0 || this.value.length > 0) ? this._clearBtn.removeAttribute("hidden") : this._clearBtn.setAttribute("hidden", "");
|
|
784
769
|
}
|
|
785
770
|
_applyOpenState() {
|
|
786
|
-
|
|
787
|
-
if (!this._panel || !this._input || !this._toggleBtn)
|
|
788
|
-
return;
|
|
771
|
+
if (!this._panel || !this._input || !this._toggleBtn) return;
|
|
789
772
|
const t = this.open, e = this._isLoading();
|
|
790
|
-
t ? (this._bindGlobalListeners(), this._panel.setAttribute("data-open", "true"), this._panel.removeAttribute("hidden"), this._panel.setAttribute("aria-hidden", "false"), this._input.setAttribute("aria-expanded", "true"), this._toggleBtn.setAttribute("data-open", "true"), this._rebuildFiltered({ preserveHighlight: !0 }), this._renderList(), this._syncDismissableLayer()) : (this._unbindGlobalListeners(),
|
|
773
|
+
t ? (this._bindGlobalListeners(), this._panel.setAttribute("data-open", "true"), this._panel.removeAttribute("hidden"), this._panel.setAttribute("aria-hidden", "false"), this._input.setAttribute("aria-expanded", "true"), this._toggleBtn.setAttribute("data-open", "true"), this._rebuildFiltered({ preserveHighlight: !0 }), this._renderList(), this._syncDismissableLayer()) : (this._unbindGlobalListeners(), this._dismissableLayer?.destroy(), this._dismissableLayer = null, this._panel.setAttribute("hidden", ""), this._panel.removeAttribute("data-open"), this._panel.setAttribute("aria-hidden", "true"), this._input.setAttribute("aria-expanded", "false"), this._toggleBtn.setAttribute("data-open", "false")), this._toggleBtn.disabled = this._isDisabled(), this._clearBtn && (this._clearBtn.disabled = this._isDisabled() || this._isReadonly()), this._input.setAttribute("aria-busy", e ? "true" : "false"), this._panel.setAttribute("aria-busy", e ? "true" : "false");
|
|
791
774
|
}
|
|
792
775
|
_bindGlobalListeners() {
|
|
793
776
|
this._globalListenersBound || (this._globalListenersBound = !0);
|
|
@@ -796,14 +779,13 @@ class E extends A {
|
|
|
796
779
|
this._globalListenersBound && (this._globalListenersBound = !1);
|
|
797
780
|
}
|
|
798
781
|
_syncDismissableLayer() {
|
|
799
|
-
|
|
800
|
-
!this.open || !this._panel || ((t = this._dismissableLayer) == null || t.destroy(), this._dismissableLayer = C({
|
|
782
|
+
!this.open || !this._panel || (this._dismissableLayer?.destroy(), this._dismissableLayer = C({
|
|
801
783
|
node: this._panel,
|
|
802
784
|
trigger: this._control,
|
|
803
785
|
closeOnEscape: !1,
|
|
804
786
|
closeOnPointerOutside: !0,
|
|
805
|
-
onDismiss: (
|
|
806
|
-
|
|
787
|
+
onDismiss: (t) => {
|
|
788
|
+
t === "outside-pointer" && (this.hasAttribute("allow-custom") ? this._commitCustomValue() : this._syncInputFromValue(), this._closePanel("outside"));
|
|
807
789
|
}
|
|
808
790
|
}));
|
|
809
791
|
}
|
|
@@ -817,8 +799,7 @@ class E extends A {
|
|
|
817
799
|
this._setOpen(!1, t);
|
|
818
800
|
}
|
|
819
801
|
_commitSelection(t) {
|
|
820
|
-
if (this._isDisabled() || this._isReadonly() || t.disabled)
|
|
821
|
-
return;
|
|
802
|
+
if (this._isDisabled() || this._isReadonly() || t.disabled) return;
|
|
822
803
|
const e = this.value;
|
|
823
804
|
this._suppressValueSync = !0, this.value = t.value, this._suppressValueSync = !1, this._input && (this._input.value = t.label), this._query = t.label, this._rebuildFiltered({ preserveHighlight: !1 }), this._renderList(), this._updateClearButton(), this._closePanel("selection"), e !== t.value && this.dispatchEvent(
|
|
824
805
|
new CustomEvent("change", {
|
|
@@ -835,8 +816,7 @@ class E extends A {
|
|
|
835
816
|
);
|
|
836
817
|
}
|
|
837
818
|
_commitCustomValue() {
|
|
838
|
-
if (this._isDisabled() || this._isReadonly() || !this.hasAttribute("allow-custom"))
|
|
839
|
-
return;
|
|
819
|
+
if (this._isDisabled() || this._isReadonly() || !this.hasAttribute("allow-custom")) return;
|
|
840
820
|
const t = this._query.trim(), e = this.value;
|
|
841
821
|
this._suppressValueSync = !0, this.value = t, this._suppressValueSync = !1, this._updateClearButton(), e !== t && this.dispatchEvent(
|
|
842
822
|
new CustomEvent("change", {
|
|
@@ -847,29 +827,26 @@ class E extends A {
|
|
|
847
827
|
);
|
|
848
828
|
}
|
|
849
829
|
_moveHighlight(t) {
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return;
|
|
853
|
-
const e = (r = this._panel) == null ? void 0 : r.querySelector(`[data-option-index="${this._highlightedIndex}"]`), i = ((o = this._panel) == null ? void 0 : o.move(t > 0 ? 1 : -1, {
|
|
830
|
+
if (this._filtered.length === 0) return;
|
|
831
|
+
const e = this._panel?.querySelector(`[data-option-index="${this._highlightedIndex}"]`), i = this._panel?.move(t > 0 ? 1 : -1, {
|
|
854
832
|
current: e,
|
|
855
833
|
focus: !1,
|
|
856
834
|
owner: this._input,
|
|
857
835
|
scroll: !0
|
|
858
|
-
})
|
|
859
|
-
if (!i)
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
s < 0 || (this._highlightedIndex = s, this._renderList());
|
|
836
|
+
}) || null;
|
|
837
|
+
if (!i) return;
|
|
838
|
+
const r = Number(i.getAttribute("data-option-index") || "-1");
|
|
839
|
+
r < 0 || (this._highlightedIndex = r, this._renderList());
|
|
863
840
|
}
|
|
864
841
|
render() {
|
|
865
|
-
const t = this.hasAttribute("headless"), e = this.getAttribute("disabled"), i =
|
|
842
|
+
const t = this.hasAttribute("headless"), e = this.getAttribute("disabled"), i = _(e), r = this._isReadonly(), s = this._state(), o = s === "loading", n = this.getAttribute("placeholder") || "Search...", l = this.getAttribute("maxlength"), b = this.hasAttribute("required"), u = this.getAttribute("label") || "", c = this.getAttribute("description") || "", x = this.getAttribute("data-error") || "" || (s === "error" ? this._stateText() || "Unable to load options." : ""), m = this.getAttribute("validation") === "error" || s === "error" || !!x, f = !!(u || this.querySelector('[slot="label"]')), g = !!(c || this.querySelector('[slot="description"]')), v = `${this._uid}-error`, y = [g ? `${this._uid}-description` : "", m ? v : ""].filter(Boolean).join(" ");
|
|
866
843
|
if (this._options = this._readOptions(), !this._query) {
|
|
867
|
-
const
|
|
868
|
-
this._query =
|
|
844
|
+
const w = this._findOptionByValue(this.value);
|
|
845
|
+
this._query = w ? w.label : this.value;
|
|
869
846
|
}
|
|
870
847
|
this._rebuildFiltered({ preserveHighlight: !1 }), this.setContent(`
|
|
871
848
|
${t ? "" : `<style>${$}</style>`}
|
|
872
|
-
${
|
|
849
|
+
${f || g ? `
|
|
873
850
|
<div class="label-row">
|
|
874
851
|
<label class="label" part="label" id="${this._uid}-label"><slot name="label">${a(u)}</slot></label>
|
|
875
852
|
<div class="description" part="description" id="${this._uid}-description"><slot name="description">${a(c)}</slot></div>
|
|
@@ -877,7 +854,7 @@ class E extends A {
|
|
|
877
854
|
` : ""}
|
|
878
855
|
|
|
879
856
|
<div class="root" part="root">
|
|
880
|
-
<div class="control" part="control" data-focused="${this._isFocused ? "true" : "false"}" data-state="${a(
|
|
857
|
+
<div class="control" part="control" data-focused="${this._isFocused ? "true" : "false"}" data-state="${a(s)}">
|
|
881
858
|
<input
|
|
882
859
|
id="${this._uid}-input"
|
|
883
860
|
part="input"
|
|
@@ -886,29 +863,28 @@ class E extends A {
|
|
|
886
863
|
aria-autocomplete="list"
|
|
887
864
|
aria-expanded="${this.open ? "true" : "false"}"
|
|
888
865
|
aria-controls="${this._uid}-listbox"
|
|
889
|
-
${
|
|
890
|
-
${
|
|
891
|
-
${
|
|
866
|
+
${f ? `aria-labelledby="${this._uid}-label"` : ""}
|
|
867
|
+
${y ? `aria-describedby="${y}"` : ""}
|
|
868
|
+
${m ? 'aria-invalid="true"' : ""}
|
|
892
869
|
aria-busy="${o ? "true" : "false"}"
|
|
893
870
|
value="${a(this._query)}"
|
|
894
871
|
placeholder="${a(n)}"
|
|
895
872
|
${i ? "disabled" : ""}
|
|
896
|
-
${
|
|
873
|
+
${r ? "readonly" : ""}
|
|
897
874
|
${b ? "required" : ""}
|
|
898
875
|
${l ? `maxlength="${a(l)}"` : ""}
|
|
899
876
|
/>
|
|
900
|
-
<button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${
|
|
877
|
+
<button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${r ? "disabled" : ""}>${F}</button>
|
|
901
878
|
<button type="button" part="toggle" class="icon-btn toggle-btn" data-open="${this.open ? "true" : "false"}" aria-label="Toggle options">${L}</button>
|
|
902
879
|
</div>
|
|
903
|
-
<ui-listbox class="panel" id="${this._uid}-listbox" part="panel" role="listbox" item-selector=".option[data-option-index]" item-role="option" active-attribute="data-highlighted" aria-busy="${o ? "true" : "false"}" data-state="${a(
|
|
880
|
+
<ui-listbox class="panel" id="${this._uid}-listbox" part="panel" role="listbox" item-selector=".option[data-option-index]" item-role="option" active-attribute="data-highlighted" aria-busy="${o ? "true" : "false"}" data-state="${a(s)}" ${this.open ? 'data-open="true" aria-hidden="false"' : 'hidden aria-hidden="true"'}></ui-listbox>
|
|
904
881
|
</div>
|
|
905
882
|
<slot hidden></slot>
|
|
906
|
-
<div class="error" part="error" id="${
|
|
883
|
+
<div class="error" part="error" id="${v}" ${m ? "" : "hidden"}>${a(x)}</div>
|
|
907
884
|
`), this._detachDomListeners(), this._input = this.root.querySelector("input"), this._control = this.root.querySelector(".control"), this._panel = this.root.querySelector("ui-listbox.panel"), this._clearBtn = this.root.querySelector(".clear-btn"), this._toggleBtn = this.root.querySelector(".toggle-btn"), this._listStructureFingerprint = "", this._renderList(), this._updateClearButton(), this._applyOpenState(), this._input && (this._input.addEventListener("input", this._onInput), this._input.addEventListener("change", this._onNativeChange), this._input.addEventListener("focus", this._onFocusIn), this._input.addEventListener("blur", this._onFocusOut), this._input.addEventListener("keydown", this._onKeyDown), this.hasAttribute("autofocus") && (this._autofocusFrame && cancelAnimationFrame(this._autofocusFrame), this._autofocusFrame = requestAnimationFrame(() => {
|
|
908
|
-
var p;
|
|
909
885
|
this._autofocusFrame = 0;
|
|
910
886
|
try {
|
|
911
|
-
|
|
887
|
+
this._input?.focus();
|
|
912
888
|
} catch {
|
|
913
889
|
}
|
|
914
890
|
}))), this._clearBtn && this._clearBtn.addEventListener("click", this._onClearClick), this._toggleBtn && this._toggleBtn.addEventListener("click", this._onToggleClick), this._panel && (this._panel.addEventListener("pointerdown", this._onPanelPointerDown), this._panel.addEventListener("click", this._onPanelClick));
|
|
@@ -917,8 +893,7 @@ class E extends A {
|
|
|
917
893
|
this._input && (this._input.removeEventListener("input", this._onInput), this._input.removeEventListener("change", this._onNativeChange), this._input.removeEventListener("focus", this._onFocusIn), this._input.removeEventListener("blur", this._onFocusOut), this._input.removeEventListener("keydown", this._onKeyDown)), this._clearBtn && this._clearBtn.removeEventListener("click", this._onClearClick), this._toggleBtn && this._toggleBtn.removeEventListener("click", this._onToggleClick), this._panel && (this._panel.removeEventListener("pointerdown", this._onPanelPointerDown), this._panel.removeEventListener("click", this._onPanelClick));
|
|
918
894
|
}
|
|
919
895
|
_onInput(t) {
|
|
920
|
-
if (!this._input || this._isDisabled() || this._isReadonly())
|
|
921
|
-
return;
|
|
896
|
+
if (!this._input || this._isDisabled() || this._isReadonly()) return;
|
|
922
897
|
const e = t.target.value;
|
|
923
898
|
this._query = e, this._openPanel("keyboard"), this._rebuildFiltered({ preserveHighlight: !1 }), this._renderList(), this._updateClearButton(), this.dispatchEvent(
|
|
924
899
|
new CustomEvent("input", {
|
|
@@ -974,18 +949,17 @@ class E extends A {
|
|
|
974
949
|
}));
|
|
975
950
|
}
|
|
976
951
|
_onKeyDown(t) {
|
|
977
|
-
var e, i;
|
|
978
952
|
if (!this._isDisabled() && this._input) {
|
|
979
953
|
if (t.key === "Home" && this.open) {
|
|
980
954
|
t.preventDefault();
|
|
981
|
-
const
|
|
982
|
-
this._highlightedIndex = Number(
|
|
955
|
+
const e = this._panel?.focusBoundary("first", { focus: !1, owner: this._input, scroll: !0 }) || null;
|
|
956
|
+
this._highlightedIndex = Number(e?.getAttribute("data-option-index") || "-1"), this._renderList();
|
|
983
957
|
return;
|
|
984
958
|
}
|
|
985
959
|
if (t.key === "End" && this.open) {
|
|
986
960
|
t.preventDefault();
|
|
987
|
-
const
|
|
988
|
-
this._highlightedIndex = Number(
|
|
961
|
+
const e = this._panel?.focusBoundary("last", { focus: !1, owner: this._input, scroll: !0 }) || null;
|
|
962
|
+
this._highlightedIndex = Number(e?.getAttribute("data-option-index") || "-1"), this._renderList();
|
|
989
963
|
return;
|
|
990
964
|
}
|
|
991
965
|
if (t.key === "ArrowDown") {
|
|
@@ -999,15 +973,15 @@ class E extends A {
|
|
|
999
973
|
if (t.key === "Enter") {
|
|
1000
974
|
if (this.open && this._highlightedIndex >= 0) {
|
|
1001
975
|
t.preventDefault();
|
|
1002
|
-
const
|
|
1003
|
-
|
|
976
|
+
const e = this._filtered[this._highlightedIndex];
|
|
977
|
+
e && this._commitSelection(e);
|
|
1004
978
|
} else if (this.hasAttribute("allow-custom"))
|
|
1005
979
|
t.preventDefault(), this._commitCustomValue(), this._closePanel("keyboard");
|
|
1006
980
|
else if (this.open)
|
|
1007
981
|
t.preventDefault(), this._syncInputFromValue(), this._closePanel("keyboard");
|
|
1008
982
|
else {
|
|
1009
|
-
const
|
|
1010
|
-
|
|
983
|
+
const e = this._findExactOptionByQuery(this._query);
|
|
984
|
+
e && (t.preventDefault(), this._commitSelection(e));
|
|
1011
985
|
}
|
|
1012
986
|
return;
|
|
1013
987
|
}
|
|
@@ -1034,25 +1008,18 @@ class E extends A {
|
|
|
1034
1008
|
)));
|
|
1035
1009
|
}
|
|
1036
1010
|
_onToggleClick(t) {
|
|
1037
|
-
|
|
1038
|
-
t.preventDefault(), !this._isDisabled() && (this.open ? this._closePanel("toggle") : this._openPanel("toggle"), (e = this._input) == null || e.focus());
|
|
1011
|
+
t.preventDefault(), !this._isDisabled() && (this.open ? this._closePanel("toggle") : this._openPanel("toggle"), this._input?.focus());
|
|
1039
1012
|
}
|
|
1040
1013
|
_onPanelPointerDown(t) {
|
|
1041
|
-
|
|
1042
|
-
return;
|
|
1043
|
-
const e = t.target;
|
|
1044
|
-
e != null && e.closest("[data-option-index]") && (this._panelPointerDown = !0, t.preventDefault());
|
|
1014
|
+
this._isReadonly() || !t.target?.closest("[data-option-index]") || (this._panelPointerDown = !0, t.preventDefault());
|
|
1045
1015
|
}
|
|
1046
1016
|
_onPanelClick(t) {
|
|
1047
|
-
if (this._isReadonly())
|
|
1048
|
-
return;
|
|
1017
|
+
if (this._isReadonly()) return;
|
|
1049
1018
|
const i = t.target.closest("[data-option-index]");
|
|
1050
|
-
if (!i)
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
return;
|
|
1055
|
-
const o = this._filtered[r];
|
|
1019
|
+
if (!i) return;
|
|
1020
|
+
const r = i.getAttribute("data-option-index"), s = r == null ? -1 : Number(r);
|
|
1021
|
+
if (!Number.isFinite(s) || s < 0) return;
|
|
1022
|
+
const o = this._filtered[s];
|
|
1056
1023
|
!o || o.disabled || this._commitSelection(o);
|
|
1057
1024
|
}
|
|
1058
1025
|
}
|
|
@@ -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"),n=require("./overlayManager-CSy3fJmJ.js");require("./command.cjs.js");const r=`
|
|
2
2
|
:host {
|
|
3
3
|
position: fixed;
|
|
4
4
|
inset: 0;
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
--ui-command-backdrop: rgba(0, 0, 0, 0.72);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
`;class o extends a.ElementBase{constructor(){super(),this._command=null,this._globalListenersBound=!1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSelect=this._onSelect.bind(this)}static get observedAttributes(){return["open","headless","placeholder","empty-text","query"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this._syncOpenState()}disconnectedCallback(){
|
|
59
|
+
`;class o extends a.ElementBase{constructor(){super(),this._command=null,this._globalListenersBound=!1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSelect=this._onSelect.bind(this)}static get observedAttributes(){return["open","headless","placeholder","empty-text","query"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this._syncOpenState()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this._command?.removeEventListener("select",this._onSelect),this._unbindGlobalListeners();try{n.OverlayManager.unregister(this),n.OverlayManager.releaseLock()}catch{}super.disconnectedCallback()}attributeChangedCallback(e,t,s){if(t!==s){if(e==="open"){this._syncOpenState(),this.dispatchEvent(new CustomEvent(s!=null?"open":"close",{bubbles:!0}));return}if(e==="placeholder"||e==="empty-text"){this.isConnected&&this.requestRender();return}if(e==="query"){const i=s||"";this._command&&this._command.query!==i&&(this._command.query=i);return}e==="headless"&&this.isConnected&&this.requestRender()}}openPalette(){this.setAttribute("open","")}closePalette(){this.removeAttribute("open")}get query(){const e=this.getAttribute("query");return typeof e=="string"?e:this._command?.query??""}set query(e){const t=e||"";t?this.setAttribute("query",t):this.removeAttribute("query"),this._command&&this._command.query!==t&&(this._command.query=t)}focusSearch(){this._command?.focusSearch()}clearQuery(){this.query=""}_syncOpenState(){if(this.hasAttribute("open")){this._bindGlobalListeners();try{n.OverlayManager.register(this),n.OverlayManager.acquireLock()}catch{}setTimeout(()=>{this._command?.focusSearch()},0)}else{this._unbindGlobalListeners(),this._command?.clearQuery();try{n.OverlayManager.unregister(this),n.OverlayManager.releaseLock()}catch{}}}render(){const e=this.getAttribute("placeholder")||"Search commands...",t=this.getAttribute("empty-text")||"No commands found.";this.setContent(`
|
|
60
60
|
<style>${r}</style>
|
|
61
61
|
<div class="overlay" part="overlay"></div>
|
|
62
62
|
<section class="panel" part="panel" role="dialog" aria-modal="true" aria-label="Command palette">
|
|
@@ -64,4 +64,4 @@
|
|
|
64
64
|
<slot slot="command" name="command"></slot>
|
|
65
65
|
</ui-command>
|
|
66
66
|
</section>
|
|
67
|
-
`);const s=this.root.querySelector("ui-command");this._command&&this._command!==s&&this._command.removeEventListener("select",this._onSelect),this._command=s,
|
|
67
|
+
`);const s=this.root.querySelector("ui-command");this._command&&this._command!==s&&this._command.removeEventListener("select",this._onSelect),this._command=s,this._command?.addEventListener("select",this._onSelect),this._command&&this._command.query!==this.query&&(this._command.query=this.query)}_bindGlobalListeners(){this._globalListenersBound||(document.addEventListener("keydown",this._onKeyDown),this._globalListenersBound=!0)}_unbindGlobalListeners(){this._globalListenersBound&&(document.removeEventListener("keydown",this._onKeyDown),this._globalListenersBound=!1)}_onClick(e){e.target?.classList.contains("overlay")&&this.closePalette()}_onSelect(e){this.closePalette()}_onKeyDown(e){this.hasAttribute("open")&&e.key==="Escape"&&(e.preventDefault(),this.closePalette())}}typeof customElements<"u"&&!customElements.get("ui-command-palette")&&customElements.define("ui-command-palette",o);exports.UICommandPalette=o;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { E as o } from "./ElementBase-
|
|
2
|
-
import { O as
|
|
1
|
+
import { E as o } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { O as n } from "./overlayManager-BJjU1VA8.mjs";
|
|
3
3
|
import "./command.esm.js";
|
|
4
|
-
|
|
5
|
-
import "./listbox-308789a0.mjs";
|
|
6
|
-
import "./collection-a1aac0c6.mjs";
|
|
7
|
-
import "./collection.esm.js";
|
|
8
|
-
const r = `
|
|
4
|
+
const a = `
|
|
9
5
|
:host {
|
|
10
6
|
position: fixed;
|
|
11
7
|
inset: 0;
|
|
@@ -64,7 +60,7 @@ const r = `
|
|
|
64
60
|
}
|
|
65
61
|
}
|
|
66
62
|
`;
|
|
67
|
-
class
|
|
63
|
+
class r extends o {
|
|
68
64
|
constructor() {
|
|
69
65
|
super(), this._command = null, this._globalListenersBound = !1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onSelect = this._onSelect.bind(this);
|
|
70
66
|
}
|
|
@@ -75,10 +71,9 @@ class a extends o {
|
|
|
75
71
|
super.connectedCallback(), this.root.addEventListener("click", this._onClick), this._syncOpenState();
|
|
76
72
|
}
|
|
77
73
|
disconnectedCallback() {
|
|
78
|
-
|
|
79
|
-
this.root.removeEventListener("click", this._onClick), (e = this._command) == null || e.removeEventListener("select", this._onSelect), this._unbindGlobalListeners();
|
|
74
|
+
this.root.removeEventListener("click", this._onClick), this._command?.removeEventListener("select", this._onSelect), this._unbindGlobalListeners();
|
|
80
75
|
try {
|
|
81
|
-
|
|
76
|
+
n.unregister(this), n.releaseLock();
|
|
82
77
|
} catch {
|
|
83
78
|
}
|
|
84
79
|
super.disconnectedCallback();
|
|
@@ -94,8 +89,8 @@ class a extends o {
|
|
|
94
89
|
return;
|
|
95
90
|
}
|
|
96
91
|
if (e === "query") {
|
|
97
|
-
const
|
|
98
|
-
this._command && this._command.query !==
|
|
92
|
+
const i = s || "";
|
|
93
|
+
this._command && this._command.query !== i && (this._command.query = i);
|
|
99
94
|
return;
|
|
100
95
|
}
|
|
101
96
|
e === "headless" && this.isConnected && this.requestRender();
|
|
@@ -108,46 +103,41 @@ class a extends o {
|
|
|
108
103
|
this.removeAttribute("open");
|
|
109
104
|
}
|
|
110
105
|
get query() {
|
|
111
|
-
var t;
|
|
112
106
|
const e = this.getAttribute("query");
|
|
113
|
-
return typeof e == "string" ? e :
|
|
107
|
+
return typeof e == "string" ? e : this._command?.query ?? "";
|
|
114
108
|
}
|
|
115
109
|
set query(e) {
|
|
116
110
|
const t = e || "";
|
|
117
111
|
t ? this.setAttribute("query", t) : this.removeAttribute("query"), this._command && this._command.query !== t && (this._command.query = t);
|
|
118
112
|
}
|
|
119
113
|
focusSearch() {
|
|
120
|
-
|
|
121
|
-
(e = this._command) == null || e.focusSearch();
|
|
114
|
+
this._command?.focusSearch();
|
|
122
115
|
}
|
|
123
116
|
clearQuery() {
|
|
124
117
|
this.query = "";
|
|
125
118
|
}
|
|
126
119
|
_syncOpenState() {
|
|
127
|
-
var e;
|
|
128
120
|
if (this.hasAttribute("open")) {
|
|
129
121
|
this._bindGlobalListeners();
|
|
130
122
|
try {
|
|
131
|
-
|
|
123
|
+
n.register(this), n.acquireLock();
|
|
132
124
|
} catch {
|
|
133
125
|
}
|
|
134
126
|
setTimeout(() => {
|
|
135
|
-
|
|
136
|
-
(t = this._command) == null || t.focusSearch();
|
|
127
|
+
this._command?.focusSearch();
|
|
137
128
|
}, 0);
|
|
138
129
|
} else {
|
|
139
|
-
this._unbindGlobalListeners(),
|
|
130
|
+
this._unbindGlobalListeners(), this._command?.clearQuery();
|
|
140
131
|
try {
|
|
141
|
-
|
|
132
|
+
n.unregister(this), n.releaseLock();
|
|
142
133
|
} catch {
|
|
143
134
|
}
|
|
144
135
|
}
|
|
145
136
|
}
|
|
146
137
|
render() {
|
|
147
|
-
var n;
|
|
148
138
|
const e = this.getAttribute("placeholder") || "Search commands...", t = this.getAttribute("empty-text") || "No commands found.";
|
|
149
139
|
this.setContent(`
|
|
150
|
-
<style>${
|
|
140
|
+
<style>${a}</style>
|
|
151
141
|
<div class="overlay" part="overlay"></div>
|
|
152
142
|
<section class="panel" part="panel" role="dialog" aria-modal="true" aria-label="Command palette">
|
|
153
143
|
<ui-command class="command" part="command" placeholder="${e}" empty-text="${t}">
|
|
@@ -156,7 +146,7 @@ class a extends o {
|
|
|
156
146
|
</section>
|
|
157
147
|
`);
|
|
158
148
|
const s = this.root.querySelector("ui-command");
|
|
159
|
-
this._command && this._command !== s && this._command.removeEventListener("select", this._onSelect), this._command = s,
|
|
149
|
+
this._command && this._command !== s && this._command.removeEventListener("select", this._onSelect), this._command = s, this._command?.addEventListener("select", this._onSelect), this._command && this._command.query !== this.query && (this._command.query = this.query);
|
|
160
150
|
}
|
|
161
151
|
_bindGlobalListeners() {
|
|
162
152
|
this._globalListenersBound || (document.addEventListener("keydown", this._onKeyDown), this._globalListenersBound = !0);
|
|
@@ -165,8 +155,7 @@ class a extends o {
|
|
|
165
155
|
this._globalListenersBound && (document.removeEventListener("keydown", this._onKeyDown), this._globalListenersBound = !1);
|
|
166
156
|
}
|
|
167
157
|
_onClick(e) {
|
|
168
|
-
|
|
169
|
-
t != null && t.classList.contains("overlay") && this.closePalette();
|
|
158
|
+
e.target?.classList.contains("overlay") && this.closePalette();
|
|
170
159
|
}
|
|
171
160
|
_onSelect(e) {
|
|
172
161
|
this.closePalette();
|
|
@@ -175,7 +164,7 @@ class a extends o {
|
|
|
175
164
|
this.hasAttribute("open") && e.key === "Escape" && (e.preventDefault(), this.closePalette());
|
|
176
165
|
}
|
|
177
166
|
}
|
|
178
|
-
typeof customElements < "u" && !customElements.get("ui-command-palette") && customElements.define("ui-command-palette",
|
|
167
|
+
typeof customElements < "u" && !customElements.get("ui-command-palette") && customElements.define("ui-command-palette", r);
|
|
179
168
|
export {
|
|
180
|
-
|
|
169
|
+
r as UICommandPalette
|
|
181
170
|
};
|