@editora/ui-core 0.1.25 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +132 -0
- package/dist/accordion.cjs.js +13 -12
- package/dist/accordion.esm.js +13 -12
- package/dist/alert-dialog.cjs.js +92 -53
- package/dist/alert-dialog.esm.js +211 -159
- package/dist/alert.cjs.js +42 -33
- package/dist/alert.esm.js +80 -71
- package/dist/animated-beam.cjs.js +42 -50
- package/dist/animated-beam.esm.js +47 -55
- package/dist/animated-list.cjs.js +11 -27
- package/dist/animated-list.esm.js +12 -28
- package/dist/animated-text.cjs.js +9 -9
- package/dist/animated-text.esm.js +9 -9
- package/dist/app-header.cjs.js +17 -12
- package/dist/app-header.esm.js +18 -13
- package/dist/aspect-ratio.cjs.js +10 -12
- package/dist/aspect-ratio.esm.js +11 -13
- package/dist/avatar.cjs.js +16 -20
- package/dist/avatar.esm.js +16 -20
- package/dist/badge.cjs.js +27 -22
- package/dist/badge.esm.js +32 -27
- package/dist/block-controls.cjs.js +11 -12
- package/dist/block-controls.esm.js +8 -9
- package/dist/box.cjs.js +2 -3
- package/dist/box.esm.js +2 -3
- package/dist/breadcrumb.cjs.js +12 -18
- package/dist/breadcrumb.esm.js +11 -17
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-D-mXMgqc.js → calendar-CzpWDxLc.js} +56 -46
- package/dist/{calendar-B3PUKHQm.mjs → calendar-DkSDFg33.mjs} +127 -117
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +6 -7
- package/dist/card.esm.js +5 -6
- package/dist/chart.cjs.js +58 -52
- package/dist/chart.esm.js +101 -95
- package/dist/checkbox.cjs.js +19 -15
- package/dist/checkbox.esm.js +19 -15
- package/dist/collapsible.cjs.js +9 -13
- package/dist/collapsible.esm.js +9 -13
- package/dist/color-picker.cjs.js +38 -19
- package/dist/color-picker.esm.js +134 -115
- package/dist/combobox.cjs.js +60 -57
- package/dist/combobox.esm.js +96 -92
- package/dist/command-palette.cjs.js +1 -0
- package/dist/command-palette.esm.js +1 -0
- package/dist/command.cjs.js +32 -14
- package/dist/command.esm.js +46 -28
- package/dist/components/date-time-utils.d.ts.map +1 -1
- package/dist/components/ui-accordion.d.ts.map +1 -1
- package/dist/components/ui-alert-dialog.d.ts +2 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-alert.d.ts.map +1 -1
- package/dist/components/ui-animated-beam.d.ts.map +1 -1
- package/dist/components/ui-animated-list.d.ts.map +1 -1
- package/dist/components/ui-app-header.d.ts.map +1 -1
- package/dist/components/ui-aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-badge.d.ts.map +1 -1
- package/dist/components/ui-block-controls.d.ts.map +1 -1
- package/dist/components/ui-box.d.ts.map +1 -1
- package/dist/components/ui-breadcrumb.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-chart.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collapsible.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-command-palette.d.ts.map +1 -1
- package/dist/components/ui-command.d.ts.map +1 -1
- package/dist/components/ui-container.d.ts.map +1 -1
- package/dist/components/ui-context-menu.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts +7 -0
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dialog.d.ts +2 -0
- package/dist/components/ui-dialog.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-empty-state.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-fieldset.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-floating-toolbar.d.ts.map +1 -1
- package/dist/components/ui-form.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-hover-card.d.ts.map +1 -1
- package/dist/components/ui-icon-cloud.d.ts.map +1 -1
- package/dist/components/ui-inline-edit.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-marquee.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-menubar.d.ts.map +1 -1
- package/dist/components/ui-meter.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-pagination.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-popover.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio-group.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-scroll-area.d.ts.map +1 -1
- package/dist/components/ui-section.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-selection-popup.d.ts.map +1 -1
- package/dist/components/ui-sidebar.d.ts.map +1 -1
- package/dist/components/ui-slider.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-spinning-text.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-splitter.d.ts.map +1 -1
- package/dist/components/ui-stepper.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.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/components/ui-toggle-group.d.ts +2 -0
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-toolbar.d.ts +2 -0
- package/dist/components/ui-toolbar.d.ts.map +1 -1
- package/dist/components/ui-tooltip.d.ts.map +1 -1
- package/dist/components/ui-transfer-list.d.ts.map +1 -1
- package/dist/components/ui-tree-item.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/container.cjs.js +6 -12
- package/dist/container.esm.js +8 -14
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +42 -41
- package/dist/data-table.cjs.js +21 -18
- package/dist/data-table.esm.js +210 -190
- package/dist/date-field.cjs.js +9 -9
- package/dist/date-field.esm.js +19 -19
- package/dist/date-picker.cjs.js +29 -20
- package/dist/date-picker.esm.js +59 -50
- package/dist/date-range-picker.cjs.js +24 -19
- package/dist/date-range-picker.esm.js +86 -81
- package/dist/date-range-time-picker.cjs.js +27 -20
- package/dist/date-range-time-picker.esm.js +24 -17
- package/dist/date-time-picker.cjs.js +24 -17
- package/dist/date-time-picker.esm.js +89 -82
- package/dist/date-time-utils-C-4eHTyy.js +1 -0
- package/dist/{date-time-utils-BTlxnz5j.mjs → date-time-utils-zAx4ghvC.mjs} +75 -68
- package/dist/description.cjs.js +4 -4
- package/dist/description.esm.js +4 -4
- package/dist/dialog.cjs.js +59 -43
- package/dist/dialog.esm.js +86 -53
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +1 -1
- package/dist/dock.cjs.js +16 -30
- package/dist/dock.esm.js +26 -40
- package/dist/drawer.cjs.js +8 -12
- package/dist/drawer.esm.js +6 -10
- package/dist/dropdown.cjs.js +8 -6
- package/dist/dropdown.esm.js +33 -30
- package/dist/empty-state.cjs.js +17 -15
- package/dist/empty-state.esm.js +13 -11
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +7 -7
- package/dist/field.cjs.js +23 -14
- package/dist/field.esm.js +30 -21
- package/dist/fieldset.cjs.js +16 -9
- package/dist/fieldset.esm.js +19 -12
- package/dist/file-upload.cjs.js +79 -37
- package/dist/file-upload.esm.js +154 -112
- package/dist/flex.cjs.js +2 -2
- package/dist/flex.esm.js +8 -8
- package/dist/floating-toolbar.cjs.js +6 -7
- package/dist/floating-toolbar.esm.js +8 -9
- package/dist/form.cjs.js +24 -27
- package/dist/form.esm.js +24 -27
- package/dist/gantt.cjs.js +13 -11
- package/dist/gantt.esm.js +13 -11
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +1 -1
- package/dist/hover-card.cjs.js +8 -8
- package/dist/hover-card.esm.js +18 -15
- package/dist/icon-cloud.cjs.js +19 -36
- package/dist/icon-cloud.esm.js +41 -58
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +108 -104
- package/dist/inline-edit.cjs.js +50 -22
- package/dist/inline-edit.esm.js +77 -49
- package/dist/input.cjs.js +45 -38
- package/dist/input.esm.js +60 -53
- package/dist/label.cjs.js +6 -6
- package/dist/label.esm.js +6 -6
- package/dist/layout.cjs.js +3 -3
- package/dist/layout.esm.js +3 -3
- package/dist/marquee.cjs.js +7 -10
- package/dist/marquee.esm.js +7 -10
- package/dist/masonry-grid.cjs.js +2 -2
- package/dist/masonry-grid.esm.js +11 -11
- package/dist/{menu-item-styles-IGSFLAHu.mjs → menu-item-styles-CdqxPUuw.mjs} +15 -15
- package/dist/{menu-item-styles-B4onAr4C.js → menu-item-styles-DUdyjQ7i.js} +10 -10
- package/dist/menu.cjs.js +8 -24
- package/dist/menu.esm.js +52 -72
- package/dist/menubar.cjs.js +9 -31
- package/dist/menubar.esm.js +127 -153
- package/dist/meter.cjs.js +4 -9
- package/dist/meter.esm.js +6 -11
- package/dist/multi-select.cjs.js +53 -40
- package/dist/multi-select.esm.js +87 -73
- package/dist/navigation-menu.cjs.js +10 -10
- package/dist/navigation-menu.esm.js +33 -33
- package/dist/number-field.cjs.js +28 -17
- package/dist/number-field.esm.js +37 -26
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +10 -10
- package/dist/odometer.cjs.js +9 -9
- package/dist/odometer.esm.js +17 -17
- package/dist/orbiter.cjs.js +11 -28
- package/dist/orbiter.esm.js +28 -45
- package/dist/overlay-motion-B56x1GoY.js +49 -0
- package/dist/overlay-motion-BX3dPLay.mjs +120 -0
- package/dist/pagination.cjs.js +28 -25
- package/dist/pagination.esm.js +54 -51
- package/dist/password-field.cjs.js +39 -34
- package/dist/password-field.esm.js +63 -58
- package/dist/pin-input.cjs.js +18 -14
- package/dist/pin-input.esm.js +24 -20
- package/dist/placement-grid.cjs.js +1 -1
- package/dist/placement-grid.esm.js +1 -1
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +16 -28
- package/dist/popover.esm.js +29 -45
- package/dist/portal-DeaM1tYY.mjs +121 -0
- package/dist/portal-XbYR3m_q.js +1 -0
- package/dist/portal.cjs.js +1 -1
- package/dist/portal.d.ts +3 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.esm.js +1 -1
- package/dist/{positioner-D0VGxtYU.mjs → positioner-BE8Nbho2.mjs} +5 -3
- package/dist/{positioner-D_fqyx_j.js → positioner-DZ1FW6A9.js} +1 -1
- package/dist/positioner.cjs.js +1 -1
- package/dist/positioner.esm.js +1 -1
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +1 -1
- package/dist/primitives/overlay-motion.d.ts +47 -0
- package/dist/primitives/overlay-motion.d.ts.map +1 -0
- package/dist/primitives/positioner.d.ts.map +1 -1
- package/dist/progress.cjs.js +11 -16
- package/dist/progress.esm.js +37 -42
- package/dist/quick-actions.cjs.js +14 -14
- package/dist/quick-actions.esm.js +12 -12
- package/dist/radio-group.cjs.js +50 -26
- package/dist/radio-group.esm.js +53 -29
- package/dist/radio.cjs.js +16 -13
- package/dist/radio.esm.js +16 -13
- package/dist/rating.cjs.js +11 -15
- package/dist/rating.esm.js +48 -50
- package/dist/{runtime-CFnK53iC.mjs → runtime-BRT7E4A8.mjs} +563 -531
- package/dist/runtime-CXw4SGV9.js +5 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +3 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +36 -32
- package/dist/scroll-area.cjs.js +3 -4
- package/dist/scroll-area.esm.js +3 -4
- package/dist/section.cjs.js +2 -4
- package/dist/section.esm.js +2 -4
- package/dist/select.cjs.js +42 -75
- package/dist/select.esm.js +57 -89
- package/dist/selection-popup.cjs.js +3 -4
- package/dist/selection-popup.esm.js +3 -4
- package/dist/semantic-tokens.d.ts +17 -0
- package/dist/semantic-tokens.d.ts.map +1 -0
- package/dist/separator.cjs.js +6 -6
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +29 -28
- package/dist/sidebar.esm.js +32 -31
- package/dist/skeleton.cjs.js +2 -2
- package/dist/skeleton.esm.js +2 -2
- package/dist/slider.cjs.js +22 -26
- package/dist/slider.esm.js +25 -29
- package/dist/slot.cjs.js +1 -1
- package/dist/slot.esm.js +1 -1
- package/dist/sortable.cjs.js +10 -11
- package/dist/sortable.esm.js +10 -11
- package/dist/spinning-text.cjs.js +4 -13
- package/dist/spinning-text.esm.js +4 -13
- package/dist/split-button.cjs.js +7 -7
- package/dist/split-button.esm.js +17 -16
- package/dist/splitter.cjs.js +52 -10
- package/dist/splitter.esm.js +55 -13
- package/dist/stepper.cjs.js +31 -65
- package/dist/stepper.esm.js +32 -66
- package/dist/switch.cjs.js +20 -22
- package/dist/switch.esm.js +20 -22
- package/dist/table.cjs.js +5 -5
- package/dist/table.esm.js +20 -20
- package/dist/tabs.cjs.js +101 -26
- package/dist/tabs.esm.js +187 -112
- package/dist/tags-input.cjs.js +43 -17
- package/dist/tags-input.esm.js +75 -49
- package/dist/textarea.cjs.js +34 -35
- package/dist/textarea.esm.js +50 -51
- package/dist/theme.d.ts +25 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +8 -8
- package/dist/time-field.esm.js +29 -29
- package/dist/time-picker.cjs.js +17 -14
- package/dist/time-picker.esm.js +28 -25
- package/dist/timeline.cjs.js +10 -10
- package/dist/timeline.esm.js +7 -7
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +2 -2
- package/dist/toggle-group.cjs.js +13 -13
- package/dist/toggle-group.esm.js +66 -61
- package/dist/toggle.cjs.js +52 -34
- package/dist/toggle.esm.js +80 -62
- package/dist/toolbar.cjs.js +14 -14
- package/dist/toolbar.esm.js +41 -33
- package/dist/tooltip.cjs.js +3 -3
- package/dist/tooltip.esm.js +39 -33
- package/dist/transfer-list.cjs.js +37 -38
- package/dist/transfer-list.esm.js +32 -33
- package/dist/{tree-B_oQput6.mjs → tree-33fVNnaf.mjs} +6 -5
- package/dist/{tree-SivHxcAy.js → tree-Dc02MChE.js} +6 -5
- package/dist/tree-item.cjs.js +9 -8
- package/dist/tree-item.esm.js +13 -12
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/{ui-button-Co8Sid6t.mjs → ui-button-C3OmI7Sn.mjs} +152 -154
- package/dist/{ui-button-BPrzJScZ.js → ui-button-CnLwXBnx.js} +107 -109
- package/dist/wizard.cjs.js +51 -39
- package/dist/wizard.esm.js +51 -39
- package/package.json +1 -1
- package/dist/date-time-utils-y3AvNvGe.js +0 -1
- package/dist/portal-DgpQ3Jo1.js +0 -1
- package/dist/portal-bR42gHvG.mjs +0 -118
- package/dist/runtime-DwE-tizc.js +0 -1
package/dist/combobox.esm.js
CHANGED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import {
|
|
1
|
+
import { E as L } from "./ElementBase-BeZT54Hj.mjs";
|
|
2
|
+
import { s as k, O as F } from "./overlay-motion-BX3dPLay.mjs";
|
|
3
|
+
import { e as $ } from "./control-name-Bpj7F34X.mjs";
|
|
3
4
|
import { n as h } from "./collection-C7URGjEI.mjs";
|
|
4
|
-
import { c as
|
|
5
|
-
import { r as
|
|
6
|
-
const
|
|
5
|
+
import { c as E } from "./dismissable-layer-BmPIoK80.mjs";
|
|
6
|
+
import { r as D } from "./listbox-hMVOhKHC.mjs";
|
|
7
|
+
const I = `
|
|
7
8
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
8
9
|
<path d="m6 6 8 8M14 6l-8 8" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/>
|
|
9
10
|
</svg>
|
|
10
|
-
`,
|
|
11
|
+
`, B = `
|
|
11
12
|
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false">
|
|
12
13
|
<path d="m5.6 7.6 4.4 4.6 4.4-4.6" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/>
|
|
13
14
|
</svg>
|
|
14
|
-
`,
|
|
15
|
+
`, S = `
|
|
16
|
+
${F}
|
|
17
|
+
|
|
15
18
|
:host {
|
|
16
19
|
--ui-combobox-width: var(--ui-width, 100%);
|
|
17
20
|
--ui-combobox-min-width: 248px;
|
|
18
|
-
--ui-combobox-
|
|
19
|
-
--ui-combobox-
|
|
20
|
-
--ui-combobox-
|
|
21
|
+
--ui-combobox-action-size: 24px;
|
|
22
|
+
--ui-combobox-height: var(--ui-control-height-2, 32px);
|
|
23
|
+
--ui-combobox-padding-x: var(--ui-control-padding-inline-2, 12px);
|
|
24
|
+
--ui-combobox-font-size: var(--ui-control-font-size-2, 14px);
|
|
25
|
+
--ui-combobox-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
21
26
|
--ui-combobox-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
22
27
|
--ui-combobox-text: var(--ui-color-text, #0f172a);
|
|
23
28
|
--ui-combobox-muted: var(--ui-color-muted, #526175);
|
|
24
|
-
--ui-combobox-border-color: color-
|
|
29
|
+
--ui-combobox-border-color: var(--ui-color-line, var(--ui-color-border, #cbd5e1));
|
|
25
30
|
--ui-combobox-border: 1px solid var(--ui-combobox-border-color);
|
|
26
31
|
--ui-combobox-shadow: none;
|
|
27
32
|
--ui-combobox-shadow-hover: none;
|
|
28
33
|
--ui-combobox-shadow-focus: none;
|
|
29
34
|
--ui-combobox-focus: var(--ui-color-primary, #2563eb);
|
|
30
|
-
--ui-combobox-panel-bg: color-
|
|
31
|
-
--ui-combobox-panel-border: 1px solid color-mix(in srgb, var(--ui-combobox-border-color) 80%, transparent);
|
|
32
|
-
--ui-combobox-panel-shadow:
|
|
35
|
+
--ui-combobox-panel-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
36
|
+
--ui-combobox-panel-border: 1px solid var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-combobox-border-color) 80%, transparent));
|
|
37
|
+
--ui-combobox-panel-shadow: var(--shadow-5, 0 14px 34px rgba(15, 23, 42, 0.16));
|
|
33
38
|
--ui-combobox-panel-z: 1600;
|
|
34
39
|
--ui-combobox-option-hover: color-mix(in srgb, var(--ui-color-primary, #2563eb) 11%, transparent);
|
|
35
40
|
--ui-combobox-option-active: color-mix(in srgb, var(--ui-color-primary, #2563eb) 18%, transparent);
|
|
36
|
-
--ui-combobox-error: var(--ui-color-danger, #dc2626);
|
|
37
|
-
--ui-combobox-success: var(--ui-color-success, #15803d);
|
|
38
|
-
--ui-combobox-warning: var(--ui-color-warning, #b45309);
|
|
41
|
+
--ui-combobox-error: var(--ui-color-danger-text, var(--ui-color-danger, #dc2626));
|
|
42
|
+
--ui-combobox-success: var(--ui-color-success-text, var(--ui-color-success, #15803d));
|
|
43
|
+
--ui-combobox-warning: var(--ui-color-warning-text, var(--ui-color-warning, #b45309));
|
|
39
44
|
--ui-combobox-duration: 150ms;
|
|
40
45
|
--ui-combobox-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
|
|
41
46
|
|
|
@@ -76,6 +81,7 @@ const E = `
|
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
.control {
|
|
84
|
+
box-sizing: border-box;
|
|
79
85
|
position: relative;
|
|
80
86
|
display: grid;
|
|
81
87
|
grid-template-columns: minmax(0, 1fr) auto auto;
|
|
@@ -100,8 +106,8 @@ const E = `
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
.control:hover {
|
|
103
|
-
border-color:
|
|
104
|
-
box-shadow:
|
|
109
|
+
border-color: var(--ui-color-line-strong, var(--ui-combobox-border-color));
|
|
110
|
+
box-shadow: none;
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
input {
|
|
@@ -112,23 +118,22 @@ const E = `
|
|
|
112
118
|
outline: none;
|
|
113
119
|
background: transparent;
|
|
114
120
|
color: var(--ui-combobox-text);
|
|
115
|
-
padding:
|
|
116
|
-
font-size:
|
|
121
|
+
padding: 0 var(--ui-combobox-padding-x);
|
|
122
|
+
font-size: var(--ui-combobox-font-size);
|
|
117
123
|
line-height: 1.4;
|
|
118
124
|
font-family: inherit;
|
|
119
|
-
min-height: var(--ui-combobox-height);
|
|
125
|
+
min-height: calc(var(--ui-combobox-height) - 2px);
|
|
120
126
|
}
|
|
121
127
|
|
|
122
128
|
input::placeholder {
|
|
123
|
-
color: var(--ui-combobox-muted);
|
|
129
|
+
color: var(--ui-color-placeholder, var(--ui-combobox-muted));
|
|
124
130
|
}
|
|
125
131
|
|
|
126
132
|
.control[data-focused="true"] {
|
|
127
|
-
border-color:
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
transform: translateY(-1px);
|
|
133
|
+
border-color: var(--ui-ring-color, var(--ui-combobox-focus));
|
|
134
|
+
outline: var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--ui-combobox-focus));
|
|
135
|
+
outline-offset: -1px;
|
|
136
|
+
box-shadow: none;
|
|
132
137
|
}
|
|
133
138
|
|
|
134
139
|
.icon-btn {
|
|
@@ -136,8 +141,9 @@ const E = `
|
|
|
136
141
|
border: none;
|
|
137
142
|
background: transparent;
|
|
138
143
|
color: var(--ui-combobox-muted);
|
|
139
|
-
inline-size:
|
|
140
|
-
block-size:
|
|
144
|
+
inline-size: var(--ui-combobox-action-size);
|
|
145
|
+
block-size: var(--ui-combobox-action-size);
|
|
146
|
+
margin-block: var(--ui-combobox-action-bleed, 0px);
|
|
141
147
|
border-radius: 8px;
|
|
142
148
|
display: inline-flex;
|
|
143
149
|
align-items: center;
|
|
@@ -185,26 +191,17 @@ const E = `
|
|
|
185
191
|
left: 0;
|
|
186
192
|
right: 0;
|
|
187
193
|
border: var(--ui-combobox-panel-border);
|
|
188
|
-
border-radius: calc(var(--ui-
|
|
194
|
+
border-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
189
195
|
background: var(--ui-combobox-panel-bg);
|
|
190
196
|
box-shadow: var(--ui-combobox-panel-shadow);
|
|
191
197
|
max-height: min(360px, 52vh);
|
|
192
198
|
overflow: auto;
|
|
193
199
|
padding: 6px 6px 8px;
|
|
194
200
|
z-index: var(--ui-combobox-panel-z, 1600);
|
|
195
|
-
display: none;
|
|
196
|
-
opacity: 0;
|
|
197
|
-
transform: translateY(-4px) scale(0.985);
|
|
198
|
-
transition:
|
|
199
|
-
opacity var(--ui-combobox-duration) var(--ui-combobox-ease),
|
|
200
|
-
transform var(--ui-combobox-duration) var(--ui-combobox-ease);
|
|
201
|
-
backdrop-filter: saturate(1.08) blur(8px);
|
|
202
201
|
}
|
|
203
202
|
|
|
204
|
-
.panel[
|
|
205
|
-
display:
|
|
206
|
-
opacity: 1;
|
|
207
|
-
transform: translateY(0) scale(1);
|
|
203
|
+
.panel[hidden] {
|
|
204
|
+
display: none;
|
|
208
205
|
}
|
|
209
206
|
|
|
210
207
|
.status-row {
|
|
@@ -342,12 +339,12 @@ const E = `
|
|
|
342
339
|
|
|
343
340
|
:host([state="error"]) .control {
|
|
344
341
|
border-color: var(--ui-combobox-error);
|
|
345
|
-
box-shadow: 0 0 0
|
|
342
|
+
box-shadow: 0 0 0 1px var(--ui-combobox-error), var(--ui-combobox-shadow);
|
|
346
343
|
}
|
|
347
344
|
|
|
348
345
|
:host([state="success"]) .control {
|
|
349
346
|
border-color: color-mix(in srgb, var(--ui-combobox-success) 72%, var(--ui-combobox-border-color));
|
|
350
|
-
box-shadow: 0 0 0
|
|
347
|
+
box-shadow: 0 0 0 1px var(--ui-combobox-success), var(--ui-combobox-shadow);
|
|
351
348
|
}
|
|
352
349
|
|
|
353
350
|
:host([disabled]) .control {
|
|
@@ -366,14 +363,21 @@ const E = `
|
|
|
366
363
|
|
|
367
364
|
:host([size="sm"]),
|
|
368
365
|
:host([size="1"]) {
|
|
369
|
-
--ui-combobox-
|
|
370
|
-
--ui-combobox-
|
|
366
|
+
--ui-combobox-action-size: 24px;
|
|
367
|
+
--ui-combobox-action-bleed: -1px;
|
|
368
|
+
--ui-combobox-height: var(--ui-control-height-1, 24px);
|
|
369
|
+
--ui-combobox-padding-x: var(--ui-control-padding-inline-1, 8px);
|
|
370
|
+
--ui-combobox-font-size: var(--ui-control-font-size-1, 12px);
|
|
371
|
+
--ui-combobox-radius: var(--ui-control-radius-1, var(--ui-radius, 6px));
|
|
371
372
|
}
|
|
372
373
|
|
|
373
374
|
:host([size="lg"]),
|
|
374
375
|
:host([size="3"]) {
|
|
375
|
-
--ui-combobox-
|
|
376
|
-
--ui-combobox-
|
|
376
|
+
--ui-combobox-action-size: 28px;
|
|
377
|
+
--ui-combobox-height: var(--ui-control-height-3, 40px);
|
|
378
|
+
--ui-combobox-padding-x: var(--ui-control-padding-inline-3, 16px);
|
|
379
|
+
--ui-combobox-font-size: var(--ui-control-font-size-3, 16px);
|
|
380
|
+
--ui-combobox-radius: var(--ui-control-radius-3, var(--ui-radius, 6px));
|
|
377
381
|
}
|
|
378
382
|
|
|
379
383
|
:host([variant="surface"]) .control {
|
|
@@ -403,7 +407,7 @@ const E = `
|
|
|
403
407
|
|
|
404
408
|
:host([validation="error"]) .control {
|
|
405
409
|
border-color: var(--ui-combobox-error);
|
|
406
|
-
box-shadow: 0 0 0
|
|
410
|
+
box-shadow: 0 0 0 1px var(--ui-combobox-error), var(--ui-combobox-shadow);
|
|
407
411
|
}
|
|
408
412
|
|
|
409
413
|
:host([validation="success"]) .control {
|
|
@@ -482,7 +486,7 @@ function _(d) {
|
|
|
482
486
|
const t = String(d).toLowerCase();
|
|
483
487
|
return t !== "false" && t !== "0";
|
|
484
488
|
}
|
|
485
|
-
class
|
|
489
|
+
class z extends L {
|
|
486
490
|
constructor() {
|
|
487
491
|
super(), this._input = null, this._control = null, this._panel = null, this._clearBtn = null, this._toggleBtn = null, this._options = [], this._filtered = [], this._highlightedIndex = -1, this._query = "", this._debounceTimer = null, this._observer = null, this._uid = Math.random().toString(36).slice(2, 8), this._formUnregister = null, this._isFocused = !1, this._suppressValueSync = !1, this._globalListenersBound = !1, this._dismissableLayer = null, this._nextOpenSource = "attribute", this._optionsRefreshFrame = 0, this._autofocusFrame = 0, this._listStructureFingerprint = "", this._panelPointerDown = !1, this._onInput = this._onInput.bind(this), this._onNativeChange = this._onNativeChange.bind(this), this._onFocusIn = this._onFocusIn.bind(this), this._onFocusOut = this._onFocusOut.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onClearClick = this._onClearClick.bind(this), this._onToggleClick = this._onToggleClick.bind(this), this._onPanelPointerDown = this._onPanelPointerDown.bind(this), this._onPanelClick = this._onPanelClick.bind(this);
|
|
488
492
|
}
|
|
@@ -588,16 +592,16 @@ class B extends k {
|
|
|
588
592
|
return e === "loading" ? "Syncing results" : e === "error" ? "Unable to load results" : e === "success" ? "Results up to date" : "";
|
|
589
593
|
}
|
|
590
594
|
_emitOpenState(t, e, i) {
|
|
591
|
-
const
|
|
595
|
+
const s = { open: t, previousOpen: e, source: i };
|
|
592
596
|
this.dispatchEvent(
|
|
593
597
|
new CustomEvent(t ? "open" : "close", {
|
|
594
|
-
detail:
|
|
598
|
+
detail: s,
|
|
595
599
|
bubbles: !0,
|
|
596
600
|
composed: !0
|
|
597
601
|
})
|
|
598
602
|
), this.dispatchEvent(
|
|
599
603
|
new CustomEvent(t ? "ui-open" : "ui-close", {
|
|
600
|
-
detail:
|
|
604
|
+
detail: s,
|
|
601
605
|
bubbles: !0,
|
|
602
606
|
composed: !0
|
|
603
607
|
})
|
|
@@ -605,9 +609,9 @@ class B extends k {
|
|
|
605
609
|
}
|
|
606
610
|
_attachFormRegistration() {
|
|
607
611
|
try {
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
name:
|
|
612
|
+
const s = this.getRootNode().host?.closest?.("ui-form") || null || this.closest("ui-form"), r = this.getAttribute("name");
|
|
613
|
+
s && typeof s.registerField == "function" && r && (this._formUnregister = s.registerField(r, {
|
|
614
|
+
name: r,
|
|
611
615
|
getValue: () => this.value,
|
|
612
616
|
setValue: (o) => {
|
|
613
617
|
this.value = o;
|
|
@@ -634,8 +638,8 @@ class B extends k {
|
|
|
634
638
|
const t = Array.from(
|
|
635
639
|
this.querySelectorAll("option,[data-combobox-option]")
|
|
636
640
|
), e = /* @__PURE__ */ new Set();
|
|
637
|
-
return t.map((i,
|
|
638
|
-
const
|
|
641
|
+
return t.map((i, s) => {
|
|
642
|
+
const r = i.tagName.toLowerCase() === "option", o = i, a = r ? o.value || o.textContent || "" : i.getAttribute("value") || i.getAttribute("data-value") || i.textContent || "", l = r ? (o.label || o.textContent || o.value || "").trim() : (i.getAttribute("label") || i.textContent || a).trim(), b = (i.getAttribute("description") || i.getAttribute("data-description") || "").trim(), u = r ? o.disabled : _(i.getAttribute("disabled")), c = a.trim();
|
|
639
643
|
if (!c && !l) return null;
|
|
640
644
|
const p = `${c}::${l}`;
|
|
641
645
|
return e.has(p) ? null : (e.add(p), {
|
|
@@ -643,7 +647,7 @@ class B extends k {
|
|
|
643
647
|
label: l,
|
|
644
648
|
description: b,
|
|
645
649
|
disabled: u,
|
|
646
|
-
sourceIndex:
|
|
650
|
+
sourceIndex: s
|
|
647
651
|
});
|
|
648
652
|
}).filter((i) => !!i);
|
|
649
653
|
}
|
|
@@ -657,23 +661,23 @@ class B extends k {
|
|
|
657
661
|
) || null;
|
|
658
662
|
}
|
|
659
663
|
_rebuildFiltered(t) {
|
|
660
|
-
const e = h(this._query), i = this.hasAttribute("no-filter"),
|
|
661
|
-
if (this._filtered = this._options.filter((o) => i || !e ? !0 : h(o.label).includes(e) || h(o.value).includes(e)), t?.preserveHighlight &&
|
|
662
|
-
const o = this._filtered.findIndex((a) => a.sourceIndex ===
|
|
664
|
+
const e = h(this._query), i = this.hasAttribute("no-filter"), s = this._filtered[this._highlightedIndex];
|
|
665
|
+
if (this._filtered = this._options.filter((o) => i || !e ? !0 : h(o.label).includes(e) || h(o.value).includes(e)), t?.preserveHighlight && s) {
|
|
666
|
+
const o = this._filtered.findIndex((a) => a.sourceIndex === s.sourceIndex);
|
|
663
667
|
if (o >= 0 && !this._filtered[o].disabled) {
|
|
664
668
|
this._highlightedIndex = o;
|
|
665
669
|
return;
|
|
666
670
|
}
|
|
667
671
|
}
|
|
668
|
-
const
|
|
669
|
-
if (
|
|
670
|
-
const o = this._filtered.findIndex((a) => a.sourceIndex ===
|
|
672
|
+
const r = this._findOptionByValue(this.value);
|
|
673
|
+
if (r) {
|
|
674
|
+
const o = this._filtered.findIndex((a) => a.sourceIndex === r.sourceIndex);
|
|
671
675
|
if (o >= 0 && !this._filtered[o].disabled) {
|
|
672
676
|
this._highlightedIndex = o;
|
|
673
677
|
return;
|
|
674
678
|
}
|
|
675
679
|
}
|
|
676
|
-
this._highlightedIndex =
|
|
680
|
+
this._highlightedIndex = D(this._filtered, {
|
|
677
681
|
getDisabled: (o) => o.disabled
|
|
678
682
|
});
|
|
679
683
|
}
|
|
@@ -699,8 +703,8 @@ class B extends k {
|
|
|
699
703
|
this._panel.innerHTML = `${t}<div class="empty" part="empty">${n(e)}</div>`, this._listStructureFingerprint = i, this._panel.refresh(), this._panel.clearActive(), this._syncActiveDescendant();
|
|
700
704
|
return;
|
|
701
705
|
}
|
|
702
|
-
const
|
|
703
|
-
const l = o.value ===
|
|
706
|
+
const s = this.value, r = this._filtered.map((o, a) => {
|
|
707
|
+
const l = o.value === s, b = a === this._highlightedIndex, u = o.disabled;
|
|
704
708
|
return `
|
|
705
709
|
<button
|
|
706
710
|
type="button"
|
|
@@ -721,7 +725,7 @@ class B extends k {
|
|
|
721
725
|
</button>
|
|
722
726
|
`;
|
|
723
727
|
}).join("");
|
|
724
|
-
this._panel.innerHTML = `${t}${
|
|
728
|
+
this._panel.innerHTML = `${t}${r}`, this._listStructureFingerprint = i, this._panel.refresh(), this._syncActiveDescendant(), this._scrollHighlightedIntoView();
|
|
725
729
|
}
|
|
726
730
|
_syncRenderedListState() {
|
|
727
731
|
if (!this._panel) return !1;
|
|
@@ -730,11 +734,11 @@ class B extends k {
|
|
|
730
734
|
const t = Array.from(this._panel.querySelectorAll(".option[data-option-index]"));
|
|
731
735
|
if (t.length !== this._filtered.length) return !1;
|
|
732
736
|
const e = this.value;
|
|
733
|
-
return t.forEach((i,
|
|
734
|
-
const
|
|
735
|
-
if (!
|
|
736
|
-
const o =
|
|
737
|
-
i.setAttribute("aria-selected", o ? "true" : "false"), i.setAttribute("aria-disabled",
|
|
737
|
+
return t.forEach((i, s) => {
|
|
738
|
+
const r = this._filtered[s];
|
|
739
|
+
if (!r) return;
|
|
740
|
+
const o = r.value === e, a = s === this._highlightedIndex;
|
|
741
|
+
i.setAttribute("aria-selected", o ? "true" : "false"), i.setAttribute("aria-disabled", r.disabled ? "true" : "false"), i.setAttribute("data-highlighted", a ? "true" : "false"), i.setAttribute("data-selected", o ? "true" : "false"), i.disabled = r.disabled;
|
|
738
742
|
}), this._syncActiveDescendant(), this._scrollHighlightedIntoView(), !0;
|
|
739
743
|
}
|
|
740
744
|
_renderStateRow() {
|
|
@@ -775,7 +779,7 @@ class B extends k {
|
|
|
775
779
|
_applyOpenState() {
|
|
776
780
|
if (!this._panel || !this._input || !this._toggleBtn) return;
|
|
777
781
|
const t = this.open, e = this._isLoading();
|
|
778
|
-
t ? (this._bindGlobalListeners(), this._panel.setAttribute("data-open", "true"), this._panel
|
|
782
|
+
t ? (this._bindGlobalListeners(), this._panel.setAttribute("data-open", "true"), k(this._panel, !0, "bottom"), 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, k(this._panel, !1, "bottom"), 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");
|
|
779
783
|
}
|
|
780
784
|
_bindGlobalListeners() {
|
|
781
785
|
this._globalListenersBound || (this._globalListenersBound = !0);
|
|
@@ -784,7 +788,7 @@ class B extends k {
|
|
|
784
788
|
this._globalListenersBound && (this._globalListenersBound = !1);
|
|
785
789
|
}
|
|
786
790
|
_syncDismissableLayer() {
|
|
787
|
-
!this.open || !this._panel || (this._dismissableLayer?.destroy(), this._dismissableLayer =
|
|
791
|
+
!this.open || !this._panel || (this._dismissableLayer?.destroy(), this._dismissableLayer = E({
|
|
788
792
|
node: this._panel,
|
|
789
793
|
trigger: this._control,
|
|
790
794
|
closeOnEscape: !1,
|
|
@@ -840,18 +844,18 @@ class B extends k {
|
|
|
840
844
|
scroll: !0
|
|
841
845
|
}) || null;
|
|
842
846
|
if (!i) return;
|
|
843
|
-
const
|
|
844
|
-
|
|
847
|
+
const s = Number(i.getAttribute("data-option-index") || "-1");
|
|
848
|
+
s < 0 || (this._highlightedIndex = s, this._renderList());
|
|
845
849
|
}
|
|
846
850
|
render() {
|
|
847
|
-
const t = this.hasAttribute("headless"), e = this.getAttribute("disabled"), i = _(e),
|
|
851
|
+
const t = this.hasAttribute("headless"), e = this.getAttribute("disabled"), i = _(e), s = this._isReadonly(), r = this._state(), o = r === "loading", a = 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") || "" || (r === "error" ? this._stateText() || "Unable to load options." : ""), m = this.getAttribute("validation") === "error" || r === "error" || !!x, f = !!(u || this.querySelector('[slot="label"]')), v = (this.getAttribute("aria-label") || "").trim(), g = !!(c || this.querySelector('[slot="description"]')), y = `${this._uid}-error`, w = $(this, this._uid), A = [g ? `${this._uid}-description` : "", m ? y : "", w.id].filter(Boolean).join(" ");
|
|
848
852
|
if (this._options = this._readOptions(), !this._query) {
|
|
849
853
|
const C = this._findOptionByValue(this.value);
|
|
850
854
|
this._query = C ? C.label : this.value;
|
|
851
855
|
}
|
|
852
856
|
this._rebuildFiltered({ preserveHighlight: !1 }), this.setContent(`
|
|
853
|
-
${t ? "" : `<style>${
|
|
854
|
-
${f ||
|
|
857
|
+
${t ? "" : `<style>${S}</style>`}
|
|
858
|
+
${f || g ? `
|
|
855
859
|
<div class="label-row">
|
|
856
860
|
<label class="label" part="label" id="${this._uid}-label"><slot name="label">${n(u)}</slot></label>
|
|
857
861
|
<div class="description" part="description" id="${this._uid}-description"><slot name="description">${n(c)}</slot></div>
|
|
@@ -859,7 +863,7 @@ class B extends k {
|
|
|
859
863
|
` : ""}
|
|
860
864
|
|
|
861
865
|
<div class="root" part="root">
|
|
862
|
-
<div class="control" part="control" data-focused="${this._isFocused ? "true" : "false"}" data-state="${n(
|
|
866
|
+
<div class="control" part="control" data-focused="${this._isFocused ? "true" : "false"}" data-state="${n(r)}">
|
|
863
867
|
<input
|
|
864
868
|
id="${this._uid}-input"
|
|
865
869
|
part="input"
|
|
@@ -868,21 +872,21 @@ class B extends k {
|
|
|
868
872
|
aria-autocomplete="list"
|
|
869
873
|
aria-expanded="${this.open ? "true" : "false"}"
|
|
870
874
|
aria-controls="${this._uid}-listbox"
|
|
871
|
-
${f ? `aria-labelledby="${this._uid}-label"` :
|
|
875
|
+
${f ? `aria-labelledby="${this._uid}-label"` : v ? `aria-label="${n(v)}"` : ""}
|
|
872
876
|
${A ? `aria-describedby="${A}"` : ""}
|
|
873
877
|
${m ? 'aria-invalid="true"' : ""}
|
|
874
878
|
aria-busy="${o ? "true" : "false"}"
|
|
875
879
|
value="${n(this._query)}"
|
|
876
880
|
placeholder="${n(a)}"
|
|
877
881
|
${i ? "disabled" : ""}
|
|
878
|
-
${
|
|
882
|
+
${s ? "readonly" : ""}
|
|
879
883
|
${b ? "required" : ""}
|
|
880
884
|
${l ? `maxlength="${n(l)}"` : ""}
|
|
881
885
|
/>
|
|
882
|
-
<button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${
|
|
883
|
-
<button type="button" part="toggle" class="icon-btn toggle-btn" data-open="${this.open ? "true" : "false"}" aria-label="Toggle options">${
|
|
886
|
+
<button type="button" part="clear" class="icon-btn clear-btn" aria-label="Clear value" hidden ${s ? "disabled" : ""}>${I}</button>
|
|
887
|
+
<button type="button" part="toggle" class="icon-btn toggle-btn" data-open="${this.open ? "true" : "false"}" aria-label="Toggle options">${B}</button>
|
|
884
888
|
</div>
|
|
885
|
-
<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="${n(
|
|
889
|
+
<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="${n(r)}" ${this.open ? 'data-open="true" aria-hidden="false"' : 'hidden aria-hidden="true"'}></ui-listbox>
|
|
886
890
|
</div>
|
|
887
891
|
<slot hidden></slot>
|
|
888
892
|
<div class="error" part="error" id="${y}" ${m ? "" : "hidden"}>${n(x)}</div>
|
|
@@ -1023,13 +1027,13 @@ class B extends k {
|
|
|
1023
1027
|
if (this._isReadonly()) return;
|
|
1024
1028
|
const i = t.target.closest("[data-option-index]");
|
|
1025
1029
|
if (!i) return;
|
|
1026
|
-
const
|
|
1027
|
-
if (!Number.isFinite(
|
|
1028
|
-
const o = this._filtered[
|
|
1030
|
+
const s = i.getAttribute("data-option-index"), r = s == null ? -1 : Number(s);
|
|
1031
|
+
if (!Number.isFinite(r) || r < 0) return;
|
|
1032
|
+
const o = this._filtered[r];
|
|
1029
1033
|
!o || o.disabled || this._commitSelection(o);
|
|
1030
1034
|
}
|
|
1031
1035
|
}
|
|
1032
|
-
typeof customElements < "u" && !customElements.get("ui-combobox") && customElements.define("ui-combobox",
|
|
1036
|
+
typeof customElements < "u" && !customElements.get("ui-combobox") && customElements.define("ui-combobox", z);
|
|
1033
1037
|
export {
|
|
1034
|
-
|
|
1038
|
+
z as UICombobox
|
|
1035
1039
|
};
|
package/dist/command.cjs.js
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
min-inline-size: 0;
|
|
6
6
|
min-block-size: 0;
|
|
7
7
|
color-scheme: light dark;
|
|
8
|
-
--ui-command-bg: color-
|
|
8
|
+
--ui-command-bg: var(--color-panel-solid, var(--ui-color-surface, #ffffff));
|
|
9
9
|
--ui-command-text: var(--ui-color-text, #0f172a);
|
|
10
10
|
--ui-command-muted: var(--ui-color-muted, #526175);
|
|
11
|
-
--ui-command-border: 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent);
|
|
11
|
+
--ui-command-border: 1px solid var(--ui-color-line-subtle, color-mix(in srgb, var(--ui-color-border, #cbd5e1) 68%, transparent));
|
|
12
12
|
--ui-command-accent: var(--ui-color-primary, #2563eb);
|
|
13
13
|
--ui-command-focus: var(--ui-color-focus-ring, #2563eb);
|
|
14
|
-
--ui-command-radius:
|
|
14
|
+
--ui-command-radius: calc(var(--ui-radius, 6px) + 2px);
|
|
15
15
|
--ui-command-shadow: none;
|
|
16
16
|
border: var(--ui-command-border);
|
|
17
17
|
border-radius: var(--ui-command-radius);
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
background: transparent;
|
|
28
28
|
width: 100%;
|
|
29
29
|
box-sizing: border-box;
|
|
30
|
-
padding:
|
|
31
|
-
font-size:
|
|
32
|
-
border-bottom: 1px solid rgba(15, 23, 42, 0.1);
|
|
30
|
+
padding: 12px 16px;
|
|
31
|
+
font-size: var(--ui-control-font-size-2, 14px);
|
|
32
|
+
border-bottom: 1px solid var(--ui-color-line-subtle, rgba(15, 23, 42, 0.1));
|
|
33
33
|
color: inherit;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.search:focus-visible {
|
|
37
|
-
outline:
|
|
38
|
-
|
|
37
|
+
outline: none;
|
|
38
|
+
box-shadow: inset 0 -2px 0 var(--ui-ring-color, var(--ui-command-focus));
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.list {
|
|
@@ -48,9 +48,16 @@
|
|
|
48
48
|
|
|
49
49
|
::slotted([slot="command"]) {
|
|
50
50
|
display: block;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
box-sizing: border-box;
|
|
52
|
+
inline-size: 100%;
|
|
53
|
+
margin: 0;
|
|
54
|
+
border: 0;
|
|
55
|
+
background: transparent;
|
|
56
|
+
font-family: inherit;
|
|
57
|
+
text-align: start;
|
|
58
|
+
border-radius: var(--ui-control-radius-2, var(--ui-radius, 6px));
|
|
59
|
+
padding: 6px 10px;
|
|
60
|
+
font-size: var(--ui-control-font-size-2, 14px);
|
|
54
61
|
color: var(--ui-command-text);
|
|
55
62
|
line-height: 1.35;
|
|
56
63
|
cursor: pointer;
|
|
@@ -62,7 +69,18 @@
|
|
|
62
69
|
::slotted([slot="command"]:hover),
|
|
63
70
|
::slotted([slot="command"]:focus-visible),
|
|
64
71
|
::slotted([slot="command"][data-active="true"]) {
|
|
65
|
-
background: color-mix(in srgb, var(--ui-command-accent) 14%, transparent);
|
|
72
|
+
background: var(--ui-color-fill, color-mix(in srgb, var(--ui-command-accent) 14%, transparent));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
::slotted([slot="command"][disabled]),
|
|
76
|
+
::slotted([slot="command"][aria-disabled="true"]) {
|
|
77
|
+
opacity: 0.5;
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
::slotted([slot="command"][disabled]:hover),
|
|
82
|
+
::slotted([slot="command"][aria-disabled="true"]:hover) {
|
|
83
|
+
background: transparent;
|
|
66
84
|
}
|
|
67
85
|
|
|
68
86
|
::slotted([slot="command"][hidden]) {
|
|
@@ -120,11 +138,11 @@
|
|
|
120
138
|
border-color: Highlight;
|
|
121
139
|
}
|
|
122
140
|
}
|
|
123
|
-
`;function n(
|
|
141
|
+
`;function n(o){return o.trim().toLowerCase()}function d(o){return n(o.getAttribute("aria-label")||o.getAttribute("data-label")||[o.getAttribute("data-value")||"",o.getAttribute("data-keywords")||"",o.textContent||""].join(" "))}function r(o){if(!o)return[];const t=o.assignedElements({flatten:!0}),e=[];for(const i of t){if(i instanceof HTMLSlotElement){e.push(...r(i));continue}i instanceof HTMLElement&&i.getAttribute("slot")==="command"&&e.push(i)}return e}class a extends l.ElementBase{constructor(){super(),this._commands=[],this._visible=[],this._active=-1,this._input=null,this._listbox=null,this._slot=null,this._query="",this._onSlotChange=this._onSlotChange.bind(this),this._onInput=this._onInput.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this)}static get observedAttributes(){return["placeholder","empty-text"]}get query(){return this._query}set query(t){const e=t||"";if(e===this._query)return;const i=this._query;this._query=e,this._input&&(this._input.value=e),this._applyFilter(),this.dispatchEvent(new CustomEvent("query-change",{detail:{value:e,previousValue:i},bubbles:!0,composed:!0}))}focusSearch(){this._input?.focus()}clearQuery(){this.query=""}refreshCommands(){this._collectCommands(),this._applyFilter()}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this._syncSlotListener(),this.refreshCommands()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this._input?.removeEventListener("input",this._onInput),this._input?.removeEventListener("keydown",this._onKeyDown),this._slot&&this._slot.removeEventListener("slotchange",this._onSlotChange),this._slot=null,this._input=null,super.disconnectedCallback()}attributeChangedCallback(t,e,i){if(e!==i){if(t==="placeholder"){this._input&&(this._input.placeholder=i||"Search commands...");return}if(t==="empty-text"){const s=this.root.querySelector(".empty");s&&(s.textContent=i||"No commands found.")}}}render(){this._input&&(this._input.removeEventListener("input",this._onInput),this._input.removeEventListener("keydown",this._onKeyDown));const t=this.getAttribute("placeholder")||"Search commands...",e=this.getAttribute("empty-text")||"No commands found.";this.setContent(`
|
|
124
142
|
<style>${c}</style>
|
|
125
143
|
<input class="search" part="search" type="text" placeholder="${t}" />
|
|
126
144
|
<ui-listbox class="list" part="list" role="listbox" aria-label="Command options" item-selector="[slot="command"]" item-role="option" active-attribute="data-active">
|
|
127
145
|
<slot name="command"></slot>
|
|
128
146
|
<div class="empty" part="empty" hidden>${e}</div>
|
|
129
147
|
</ui-listbox>
|
|
130
|
-
`),this._input=this.root.querySelector(".search"),this._listbox=this.root.querySelector("ui-listbox"),this._listbox&&(this._listbox.container=this),this._input&&(this._input.value=this._query,this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onKeyDown)),this._syncSlotListener(),this.refreshCommands()}_syncSlotListener(){const t=this.root.querySelector('slot[name="command"]');this._slot&&this._slot!==t&&this._slot.removeEventListener("slotchange",this._onSlotChange),t&&this._slot!==t&&t.addEventListener("slotchange",this._onSlotChange),this._slot=t}_onSlotChange(){this.refreshCommands()}_collectCommands(){this._commands=r(this._slot),this._commands.forEach((t,e)=>{t.setAttribute("data-index",String(e))}),this._listbox&&(this._listbox.items=this._commands),this._listbox?.refresh()}_applyFilter(){const t=n(this._query);this._visible=this._commands.filter(i=>!t||
|
|
148
|
+
`),this._input=this.root.querySelector(".search"),this._listbox=this.root.querySelector("ui-listbox"),this._listbox&&(this._listbox.container=this),this._input&&(this._input.value=this._query,this._input.addEventListener("input",this._onInput),this._input.addEventListener("keydown",this._onKeyDown)),this._syncSlotListener(),this.refreshCommands()}_syncSlotListener(){const t=this.root.querySelector('slot[name="command"]');this._slot&&this._slot!==t&&this._slot.removeEventListener("slotchange",this._onSlotChange),t&&this._slot!==t&&t.addEventListener("slotchange",this._onSlotChange),this._slot=t}_onSlotChange(){this.refreshCommands()}_collectCommands(){this._commands=r(this._slot),this._commands.forEach((t,e)=>{t.setAttribute("data-index",String(e))}),this._listbox&&(this._listbox.items=this._commands),this._listbox?.refresh()}_applyFilter(){const t=n(this._query);this._visible=this._commands.filter(i=>!t||d(i).includes(t)),this._commands.forEach(i=>{this._visible.includes(i)?i.removeAttribute("hidden"):i.setAttribute("hidden","")}),this._visible.length>0?(this._active=Math.max(0,Math.min(this._active,this._visible.length-1)),this._listbox?.setActiveItem(this._visible[this._active],{focus:!1,owner:this._input,scroll:!0})):(this._active=-1,this._listbox?.clearActive(),this._input&&this._input.removeAttribute("aria-activedescendant"));const e=this.root.querySelector(".empty");e&&(this._visible.length===0?e.removeAttribute("hidden"):e.setAttribute("hidden",""))}_selectCommand(t){if(!t)return;const e=t.getAttribute("data-index"),i=e==null?-1:Number(e);this.dispatchEvent(new CustomEvent("select",{detail:{index:i,item:t,label:t.getAttribute("data-label")||(t.textContent||"").trim(),value:t.getAttribute("data-value")||void 0},bubbles:!0,composed:!0}))}_move(t){if(this._visible.length===0)return;const e=this._active>=0?this._visible[this._active]:null,i=this._listbox?.move(t,{current:e,focus:!1,owner:this._input,scroll:!0})||null;i&&(this._active=this._visible.indexOf(i))}_onInput(t){this.query=t.target.value||""}_onKeyDown(t){if(t.key==="ArrowDown"){t.preventDefault(),this._move(1);return}if(t.key==="ArrowUp"){t.preventDefault(),this._move(-1);return}if(t.key==="Home"){t.preventDefault();const e=this._listbox?.focusBoundary("first",{focus:!1,owner:this._input,scroll:!0})||null;e&&(this._active=this._visible.indexOf(e));return}if(t.key==="End"){t.preventDefault();const e=this._listbox?.focusBoundary("last",{focus:!1,owner:this._input,scroll:!0})||null;e&&(this._active=this._visible.indexOf(e));return}t.key==="Enter"&&(t.preventDefault(),this._selectCommand(this._active>=0?this._visible[this._active]:null))}_onClick(t){const e=t.composedPath(),i=this._commands.find(s=>e.includes(s));!i||i.hasAttribute("hidden")||this._selectCommand(i)}}typeof customElements<"u"&&!customElements.get("ui-command")&&customElements.define("ui-command",a);exports.UICommand=a;
|