@editora/ui-core 0.1.19 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +4 -7
- package/dist/color-picker.cjs.js +9 -9
- package/dist/color-picker.esm.js +189 -252
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +4 -4
- package/dist/date-time-picker.esm.js +112 -144
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +4 -4
- package/dist/multi-select.esm.js +120 -140
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +2 -2
- package/dist/portal.esm.js +10 -19
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +11 -18
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +45 -45
- package/dist/sortable.esm.js +421 -524
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +3 -3
- package/dist/tabs.esm.js +35 -55
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +6 -6
- package/dist/textarea.esm.js +32 -41
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +19 -19
- package/dist/transfer-list.esm.js +98 -111
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/split-button.esm.js
CHANGED
|
@@ -1,11 +1,32 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import {
|
|
3
|
-
import { c as
|
|
4
|
-
import {
|
|
5
|
-
import "./listbox-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { E as c } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { b } from "./portal-bR42gHvG.mjs";
|
|
3
|
+
import { c as f } from "./dismissable-layer-BmPIoK80.mjs";
|
|
4
|
+
import { e as g } from "./positioner-D0VGxtYU.mjs";
|
|
5
|
+
import "./listbox-DJamVeFj.mjs";
|
|
6
|
+
const l = 160, h = [
|
|
7
|
+
"--ui-split-button-menu-bg",
|
|
8
|
+
"--ui-split-button-menu-color",
|
|
9
|
+
"--ui-split-button-menu-border",
|
|
10
|
+
"--ui-split-button-menu-radius",
|
|
11
|
+
"--ui-split-button-menu-shadow",
|
|
12
|
+
"--ui-split-button-menu-accent",
|
|
13
|
+
"--ui-split-button-menu-accent-strong",
|
|
14
|
+
"--ui-split-button-menu-shortcut",
|
|
15
|
+
"--ui-split-button-menu-separator",
|
|
16
|
+
"--ui-split-button-menu-muted",
|
|
17
|
+
"--ui-split-button-menu-danger",
|
|
18
|
+
"--ui-split-button-menu-option-border",
|
|
19
|
+
"--ui-split-button-menu-option-border-strong",
|
|
20
|
+
"--ui-split-button-menu-option-shadow",
|
|
21
|
+
"--ui-split-button-menu-affordance-bg",
|
|
22
|
+
"--ui-split-button-menu-affordance-border",
|
|
23
|
+
"--ui-split-button-menu-affordance-size",
|
|
24
|
+
"--ui-split-button-menu-list-gap",
|
|
25
|
+
"--ui-split-button-menu-list-padding-top",
|
|
26
|
+
"--ui-split-button-menu-item-min-height",
|
|
27
|
+
"--ui-split-button-menu-item-radius",
|
|
28
|
+
"--ui-split-button-menu-item-padding"
|
|
29
|
+
], x = `
|
|
9
30
|
:host {
|
|
10
31
|
--ui-split-button-radius: 12px;
|
|
11
32
|
--ui-split-button-border: 1px solid color-mix(in srgb, var(--ui-color-border, #cbd5e1) 70%, transparent);
|
|
@@ -190,7 +211,7 @@ const m = 160, x = `
|
|
|
190
211
|
opacity: 0;
|
|
191
212
|
transform: translateY(-6px) scale(0.985);
|
|
192
213
|
transform-origin: top left;
|
|
193
|
-
transition: opacity ${
|
|
214
|
+
transition: opacity ${l}ms cubic-bezier(0.22, 1, 0.36, 1), transform ${l}ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
194
215
|
will-change: opacity, transform;
|
|
195
216
|
}
|
|
196
217
|
|
|
@@ -481,15 +502,15 @@ const m = 160, x = `
|
|
|
481
502
|
}
|
|
482
503
|
}
|
|
483
504
|
`;
|
|
484
|
-
function _(
|
|
485
|
-
const t =
|
|
505
|
+
function _(m, e) {
|
|
506
|
+
const t = m.cloneNode(!0);
|
|
486
507
|
if (t.setAttribute("slot", "menuitem"), t.setAttribute("data-menu-item", "true"), t.setAttribute("data-index", String(e)), t.setAttribute("role", "menuitem"), t.setAttribute("tabindex", "-1"), t.classList.add("menu-option"), t.setAttribute("data-has-description", t.querySelector("[data-menu-description]") ? "true" : "false"), t.setAttribute("data-has-shortcut", t.querySelector("[data-menu-shortcut]") ? "true" : "false"), t.hasAttribute("disabled") && t.setAttribute("aria-disabled", "true"), !t.querySelector("[data-menu-affordance]")) {
|
|
487
508
|
const n = document.createElement("span");
|
|
488
509
|
n.setAttribute("data-menu-affordance", "true"), n.setAttribute("aria-hidden", "true"), t.prepend(n);
|
|
489
510
|
}
|
|
490
511
|
return t.id || (t.id = `ui-split-button-item-${Math.random().toString(36).slice(2, 9)}`), t;
|
|
491
512
|
}
|
|
492
|
-
class y extends
|
|
513
|
+
class y extends c {
|
|
493
514
|
constructor() {
|
|
494
515
|
super(), this._portalEl = null, this._portalRoot = null, this._layer = null, this._positioner = null, this._listbox = null, this._triggerButton = null, this._toggleButton = null, this._menuItems = [], this._lastFocused = null, this._closeTimer = null, this._onPrimaryClick = this._onPrimaryClick.bind(this), this._onToggleClick = this._onToggleClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onMenuPointerDown = this._onMenuPointerDown.bind(this), this._onMenuPointerMove = this._onMenuPointerMove.bind(this);
|
|
495
516
|
}
|
|
@@ -497,10 +518,8 @@ class y extends b {
|
|
|
497
518
|
return ["label", "menu-label", "menu-heading", "menu-description", "variant", "density", "menu-density", "menu-shape", "disabled", "open"];
|
|
498
519
|
}
|
|
499
520
|
openMenu() {
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
if (!this._portalEl)
|
|
503
|
-
this._mountMenu();
|
|
521
|
+
this.hasAttribute("disabled") || this.hasAttribute("open") && this._portalEl?.getAttribute("data-state") !== "closing" || !this._portalEl && this._collectMenuItems().length === 0 || (this._lastFocused = document.activeElement || this._toggleButton, this._clearCloseTimer(), this._portalEl && (this._setMenuState("opening"), this._portalEl.style.pointerEvents = "auto", this._positioner?.update(), requestAnimationFrame(() => this._setMenuState("open"))), this.setAttribute("open", ""), queueMicrotask(() => {
|
|
522
|
+
if (!this._portalEl) this._mountMenu();
|
|
504
523
|
else
|
|
505
524
|
try {
|
|
506
525
|
this._portalEl.focus({ preventScroll: !0 });
|
|
@@ -531,7 +550,6 @@ class y extends b {
|
|
|
531
550
|
}
|
|
532
551
|
}
|
|
533
552
|
render() {
|
|
534
|
-
var n, i, o;
|
|
535
553
|
const e = this.getAttribute("label") || "Run action", t = this.getAttribute("menu-label") || "Open action menu";
|
|
536
554
|
this.setContent(`
|
|
537
555
|
<style>${x}</style>
|
|
@@ -542,7 +560,7 @@ class y extends b {
|
|
|
542
560
|
</button>
|
|
543
561
|
</div>
|
|
544
562
|
<div class="slot-source"><slot name="menuitem"></slot></div>
|
|
545
|
-
`), this._triggerButton = this.root.querySelector(".button"), this._toggleButton = this.root.querySelector(".toggle"), this._syncToggleState(),
|
|
563
|
+
`), this._triggerButton = this.root.querySelector(".button"), this._toggleButton = this.root.querySelector(".toggle"), this._syncToggleState(), this._triggerButton?.addEventListener("click", this._onPrimaryClick), this._toggleButton?.addEventListener("click", this._onToggleClick), this._toggleButton?.addEventListener("keydown", this._onKeyDown);
|
|
546
564
|
}
|
|
547
565
|
_onPrimaryClick(e) {
|
|
548
566
|
this.hasAttribute("disabled") || this.dispatchEvent(new CustomEvent("primary-action", { detail: { originalEvent: e }, bubbles: !0, composed: !0 }));
|
|
@@ -553,50 +571,54 @@ class y extends b {
|
|
|
553
571
|
_onKeyDown(e) {
|
|
554
572
|
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), this.openMenu());
|
|
555
573
|
}
|
|
574
|
+
_applyPortalTokens(e) {
|
|
575
|
+
const t = window.getComputedStyle(this);
|
|
576
|
+
h.forEach((n) => {
|
|
577
|
+
const i = t.getPropertyValue(n).trim();
|
|
578
|
+
i ? e.style.setProperty(n, i) : e.style.removeProperty(n);
|
|
579
|
+
});
|
|
580
|
+
}
|
|
556
581
|
_mountMenu() {
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
const e = f();
|
|
561
|
-
if (!e)
|
|
562
|
-
return;
|
|
582
|
+
if (this._portalEl) return;
|
|
583
|
+
const e = b();
|
|
584
|
+
if (!e) return;
|
|
563
585
|
this._portalRoot = e, this._portalRoot.classList.add("ui-split-button-portal");
|
|
564
586
|
const t = document.createElement("div");
|
|
565
587
|
t.className = "menu", t.setAttribute("role", "menu"), t.setAttribute("data-state", "opening"), t.tabIndex = -1, t.style.pointerEvents = "auto";
|
|
566
588
|
const n = document.createElement("style");
|
|
567
589
|
n.textContent = v;
|
|
568
|
-
const i = this.getAttribute("menu-heading") || "",
|
|
569
|
-
const
|
|
570
|
-
if (
|
|
571
|
-
const
|
|
572
|
-
|
|
590
|
+
const i = this.getAttribute("menu-heading") || "", r = this.getAttribute("menu-description") || "", p = i || r ? (() => {
|
|
591
|
+
const s = document.createElement("div");
|
|
592
|
+
if (s.className = "menu-header", i) {
|
|
593
|
+
const a = document.createElement("p");
|
|
594
|
+
a.className = "menu-heading", a.textContent = i, s.appendChild(a);
|
|
573
595
|
}
|
|
574
|
-
if (
|
|
575
|
-
const
|
|
576
|
-
|
|
596
|
+
if (r) {
|
|
597
|
+
const a = document.createElement("p");
|
|
598
|
+
a.className = "menu-description", a.textContent = r, s.appendChild(a);
|
|
577
599
|
}
|
|
578
|
-
return
|
|
579
|
-
})() : null,
|
|
580
|
-
if (
|
|
600
|
+
return s;
|
|
601
|
+
})() : null, o = document.createElement("ui-listbox");
|
|
602
|
+
if (o.setAttribute("item-selector", '[slot="menuitem"]'), o.setAttribute("item-role", "menuitem"), o.setAttribute("active-attribute", "data-active"), this._menuItems = this._collectMenuItems(), this._menuItems.length === 0) {
|
|
581
603
|
this.removeAttribute("open");
|
|
582
604
|
return;
|
|
583
605
|
}
|
|
584
|
-
const
|
|
585
|
-
|
|
606
|
+
const u = this.root.querySelector(".group")?.getBoundingClientRect();
|
|
607
|
+
u && Number.isFinite(u.width) && u.width > 0 && (t.style.minWidth = `${Math.max(260, Math.round(u.width))}px`), this._menuItems.forEach((s) => o.appendChild(s)), o.refresh(), t.append(n), p && t.appendChild(p), t.appendChild(o), this._applyPortalTokens(t), this._portalRoot.appendChild(t), this._portalEl = t, this._listbox = o, this._positioner = g({
|
|
586
608
|
floating: t,
|
|
587
609
|
anchor: this.root.querySelector(".group") || this._toggleButton || this,
|
|
588
610
|
placement: "bottom-start",
|
|
589
611
|
offset: 6,
|
|
590
612
|
fitViewport: !0
|
|
591
|
-
}), this._layer =
|
|
613
|
+
}), this._layer = f({
|
|
592
614
|
node: t,
|
|
593
615
|
trigger: this._toggleButton,
|
|
594
616
|
closeOnEscape: !0,
|
|
595
617
|
closeOnPointerOutside: !0,
|
|
596
618
|
onDismiss: () => this.closeMenu()
|
|
597
|
-
}),
|
|
598
|
-
const
|
|
599
|
-
|
|
619
|
+
}), o.addEventListener("click", (s) => this._onMenuClick(s)), o.addEventListener("pointerdown", this._onMenuPointerDown), o.addEventListener("pointermove", this._onMenuPointerMove, { passive: !0 }), o.addEventListener("keydown", (s) => this._onMenuKeyDown(s));
|
|
620
|
+
const d = this._listbox.focusBoundary("first", { focus: !1, scroll: !1 });
|
|
621
|
+
d && this._listbox.setActiveItem(d, { focus: !1, scroll: !1 }), this._syncToggleState(), requestAnimationFrame(() => this._setMenuState("open")), queueMicrotask(() => {
|
|
600
622
|
try {
|
|
601
623
|
t.focus({ preventScroll: !0 });
|
|
602
624
|
} catch {
|
|
@@ -609,24 +631,20 @@ class y extends b {
|
|
|
609
631
|
return (e ? e.assignedElements({ flatten: !0 }) : []).filter((n) => n.getAttribute("slot") === "menuitem").map((n, i) => _(n, i));
|
|
610
632
|
}
|
|
611
633
|
_onMenuClick(e) {
|
|
612
|
-
|
|
613
|
-
const t = e.composedPath(), n = this._menuItems.find((r) => t.includes(r));
|
|
634
|
+
const t = e.composedPath(), n = this._menuItems.find((i) => t.includes(i));
|
|
614
635
|
if (!n) {
|
|
615
|
-
const
|
|
616
|
-
|
|
636
|
+
const i = e.target?.closest?.("[data-menu-item]");
|
|
637
|
+
i && this._selectMenuItem(i);
|
|
617
638
|
return;
|
|
618
639
|
}
|
|
619
640
|
this._selectMenuItem(n);
|
|
620
641
|
}
|
|
621
642
|
_onMenuPointerDown(e) {
|
|
622
|
-
|
|
623
|
-
(i = (n = e.target) == null ? void 0 : n.closest) != null && i.call(n, "[data-menu-item]") && e.preventDefault();
|
|
643
|
+
e.target?.closest?.("[data-menu-item]") && e.preventDefault();
|
|
624
644
|
}
|
|
625
645
|
_onMenuPointerMove(e) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
return;
|
|
629
|
-
const t = (i = (n = e.target) == null ? void 0 : n.closest) == null ? void 0 : i.call(n, "[data-menu-item]");
|
|
646
|
+
if (!this._listbox) return;
|
|
647
|
+
const t = e.target?.closest?.("[data-menu-item]");
|
|
630
648
|
!t || t.hasAttribute("disabled") || t.getAttribute("aria-disabled") === "true" || this._listbox.getActiveItem() !== t && this._listbox.setActiveItem(t, { focus: !1, scroll: !1 });
|
|
631
649
|
}
|
|
632
650
|
_onMenuKeyDown(e) {
|
|
@@ -659,8 +677,7 @@ class y extends b {
|
|
|
659
677
|
}
|
|
660
678
|
}
|
|
661
679
|
_syncToggleState() {
|
|
662
|
-
|
|
663
|
-
(e = this._toggleButton) == null || e.setAttribute("aria-expanded", this.hasAttribute("open") ? "true" : "false");
|
|
680
|
+
this._toggleButton?.setAttribute("aria-expanded", this.hasAttribute("open") ? "true" : "false");
|
|
664
681
|
}
|
|
665
682
|
_selectMenuItem(e) {
|
|
666
683
|
const t = Number(e.getAttribute("data-index") || -1);
|
|
@@ -679,24 +696,22 @@ class y extends b {
|
|
|
679
696
|
_beginCloseMenu() {
|
|
680
697
|
this._portalEl && (this._clearCloseTimer(), this._setMenuState("closing"), this._portalEl.style.pointerEvents = "none", this._closeTimer = window.setTimeout(() => {
|
|
681
698
|
this._closeTimer = null, this._teardownMenu(!0);
|
|
682
|
-
},
|
|
699
|
+
}, l));
|
|
683
700
|
}
|
|
684
701
|
_setMenuState(e) {
|
|
685
|
-
|
|
686
|
-
(t = this._portalEl) == null || t.setAttribute("data-state", e);
|
|
702
|
+
this._portalEl?.setAttribute("data-state", e);
|
|
687
703
|
}
|
|
688
704
|
_clearCloseTimer() {
|
|
689
705
|
this._closeTimer != null && (window.clearTimeout(this._closeTimer), this._closeTimer = null);
|
|
690
706
|
}
|
|
691
707
|
_teardownMenu(e = !1) {
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
o && o.isConnected && queueMicrotask(() => {
|
|
708
|
+
if (this._clearCloseTimer(), this._layer?.destroy(), this._layer = null, this._positioner?.destroy(), this._positioner = null, this._listbox = null, this._portalEl?.parentElement && this._portalEl.parentElement.removeChild(this._portalEl), this._portalEl = null, this._portalRoot = null, this._syncToggleState(), e) {
|
|
709
|
+
const t = this._toggleButton || this._lastFocused;
|
|
710
|
+
t && t.isConnected && queueMicrotask(() => {
|
|
696
711
|
try {
|
|
697
|
-
|
|
712
|
+
t.focus({ preventScroll: !0 });
|
|
698
713
|
} catch {
|
|
699
|
-
|
|
714
|
+
t.focus();
|
|
700
715
|
}
|
|
701
716
|
});
|
|
702
717
|
}
|
package/dist/splitter.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("./ElementBase-EV6mVBUV.js"),l=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-splitter-size: 10px;
|
|
4
4
|
--ui-splitter-hit-area: 10px;
|
package/dist/splitter.esm.js
CHANGED
package/dist/stepper.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const b=require("./ElementBase-EV6mVBUV.js"),g=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-stepper-gap: 8px;
|
|
4
4
|
--ui-stepper-radius: 12px;
|
|
@@ -279,28 +279,28 @@
|
|
|
279
279
|
border-color: CanvasText;
|
|
280
280
|
}
|
|
281
281
|
}
|
|
282
|
-
`;function u(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
283
|
-
<li class="item" part="item" data-state="${i.state!=="default"?i.state:a<
|
|
282
|
+
`;function u(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(o){if(!o)return[];try{const t=JSON.parse(o);return Array.isArray(t)?t.filter(e=>e&&typeof e=="object"):[]}catch{return[]}}function p(o){if(o==null)return!1;const t=String(o).toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}class d extends b.ElementBase{constructor(){super(),this._observer=null,this._isSyncingValueAttribute=!1,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this)}static get observedAttributes(){return["steps","value","orientation","variant","size","clickable","linear","headless","aria-label"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this._observer=new MutationObserver(()=>{this.hasAttribute("steps")||this.requestRender()}),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["slot","data-value","data-label","data-description","data-optional","data-disabled","data-state","disabled"]})}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this._observer&&(this._observer.disconnect(),this._observer=null),super.disconnectedCallback()}attributeChangedCallback(t,e,r){if(e!==r){if(t==="value"){this._isSyncingValueAttribute||this._syncValueUi();return}if(t==="aria-label"){const s=this.root.querySelector(".frame");if(s){s.setAttribute("aria-label",r||"Stepper");return}}this.isConnected&&this.requestRender()}}_fromSlots(){return Array.from(this.querySelectorAll('[slot="step"], [data-step]')).map((e,r)=>{const s=e.getAttribute("data-value")||String(r+1),i=e.getAttribute("data-label")||e.getAttribute("title")||e.textContent?.trim()||`Step ${r+1}`,a=e.getAttribute("data-description")||"",l=p(e.getAttribute("data-optional")),n=e.hasAttribute("disabled")||p(e.getAttribute("data-disabled")),c=e.getAttribute("data-state");return{index:r,value:s,label:i,description:a,optional:l,disabled:n,state:c==="complete"||c==="error"||c==="warning"?c:"default"}})}_fromAttr(){return f(this.getAttribute("steps")).map((t,e)=>{const r=t.state==="complete"||t.state==="error"||t.state==="warning"?t.state:"default";return{index:e,value:t.value!=null?String(t.value):String(e+1),label:t.label!=null?String(t.label):`Step ${e+1}`,description:t.description!=null?String(t.description):"",optional:!!t.optional,disabled:!!t.disabled,state:r}})}_steps(){const t=this._fromAttr();return t.length?t:this._fromSlots()}_activeIndex(t){if(!t.length)return-1;const e=this.getAttribute("value")||"";if(e){const s=t.findIndex(i=>i.value===e);if(s>=0)return s}const r=t.find(s=>!s.disabled)||t[0];return r&&this.getAttribute("value")!==r.value&&this.setAttribute("value",r.value),t.findIndex(s=>s.value===r.value)}get value(){return this.getAttribute("value")||""}set value(t){const e=String(t||"");e?this.setAttribute("value",e):this.removeAttribute("value")}goTo(t){const e=this._steps();if(!e.length)return!1;const r=this._activeIndex(e),s=typeof t=="number"?t:e.findIndex(i=>i.value===String(t));return!Number.isInteger(s)||s<0||s>=e.length?!1:this._selectIndex(e,r,s,"api")}next(){const t=this._steps(),e=this._activeIndex(t);if(e<0)return!1;const r=Math.min(t.length-1,e+1);return this._selectIndex(t,e,r,"next")}prev(){const t=this._steps(),e=this._activeIndex(t);if(e<0)return!1;const r=Math.max(0,e-1);return this._selectIndex(t,e,r,"prev")}_selectIndex(t,e,r,s){if(r===e)return!0;const i=t[r];if(!i||i.disabled||this.hasAttribute("linear")&&r>e+1)return!1;const a=t[e],l=new CustomEvent("before-change",{detail:{currentIndex:e,nextIndex:r,currentValue:a?.value||"",nextValue:i.value,trigger:s},bubbles:!0,composed:!0,cancelable:!0});if(!this.dispatchEvent(l))return!1;this.value=i.value;const n={index:r,value:i.value,label:i.label,trigger:s};return this.dispatchEvent(new CustomEvent("input",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("select",{detail:n,bubbles:!0,composed:!0})),!0}_onClick(t){const r=t.target?.closest(".trigger");if(!r||!this.hasAttribute("clickable")&&!this.hasAttribute("linear"))return;const s=Number(r.getAttribute("data-index"));if(!Number.isInteger(s))return;const i=this._steps(),a=this._activeIndex(i);this._selectIndex(i,a,s,"click")}_moveFocus(t,e){const r=Array.from(this.root.querySelectorAll(".trigger:not([disabled])"));if(!r.length)return;const s=r.indexOf(t);if(s<0)return;const i=(s+e+r.length)%r.length;r[i].focus()}_onKeyDown(t){const r=t.target?.closest(".trigger");if(!r)return;const s=this.getAttribute("orientation")==="vertical",i=!s&&getComputedStyle(this).direction==="rtl",a=s?"ArrowDown":i?"ArrowLeft":"ArrowRight",l=s?"ArrowUp":i?"ArrowRight":"ArrowLeft";if(t.key===a){t.preventDefault(),this._moveFocus(r,1);return}if(t.key===l){t.preventDefault(),this._moveFocus(r,-1);return}if(t.key==="Home"||t.key==="End"){const n=Array.from(this.root.querySelectorAll(".trigger:not([disabled])"));if(!n.length)return;t.preventDefault(),(t.key==="Home"?n[0]:n[n.length-1]).focus();return}(t.key===" "||t.key==="Enter")&&(t.preventDefault(),r.click())}_syncValueUi(){if(!this.isConnected)return;if(!this.root.querySelector(".list")){this.requestRender();return}const t=this._steps();if(!t.length)return;this._isSyncingValueAttribute=!0;let e=-1;try{e=this._activeIndex(t)}finally{this._isSyncingValueAttribute=!1}Array.from(this.root.querySelectorAll(".item")).forEach((s,i)=>{const a=t[i];if(!a)return;const l=a.state!=="default"?a.state:i<e?"complete":i===e?"current":"upcoming";s.setAttribute("data-state",l),s.setAttribute("data-active",i===e?"true":"false");const n=s.querySelector(".trigger");n&&n.setAttribute("aria-current",i===e?"step":"false");const c=s.querySelector(".index");c&&(c.textContent=i<e?"✓":String(i+1))})}render(){const t=this._steps(),e=this._activeIndex(t),r=this.getAttribute("aria-label")||"Stepper",s=t.map((i,a)=>`
|
|
283
|
+
<li class="item" part="item" data-state="${i.state!=="default"?i.state:a<e?"complete":a===e?"current":"upcoming"}" data-active="${a===e?"true":"false"}">
|
|
284
284
|
<button
|
|
285
285
|
type="button"
|
|
286
286
|
class="trigger"
|
|
287
287
|
part="trigger"
|
|
288
288
|
data-index="${a}"
|
|
289
|
-
aria-current="${a===
|
|
289
|
+
aria-current="${a===e?"step":"false"}"
|
|
290
290
|
aria-disabled="${i.disabled?"true":"false"}"
|
|
291
291
|
${i.disabled?"disabled":""}
|
|
292
292
|
>
|
|
293
|
-
<span class="index" part="index">${a<
|
|
293
|
+
<span class="index" part="index">${a<e?"✓":a+1}</span>
|
|
294
294
|
<span class="meta" part="meta">
|
|
295
295
|
<span class="label">${u(i.label)}${i.optional?" (optional)":""}</span>
|
|
296
296
|
${i.description?`<span class="description">${u(i.description)}</span>`:""}
|
|
297
297
|
</span>
|
|
298
298
|
</button>
|
|
299
|
-
${a<
|
|
299
|
+
${a<t.length-1?'<span class="connector" part="connector"></span>':""}
|
|
300
300
|
</li>
|
|
301
301
|
`).join("");this.setContent(`
|
|
302
|
-
<style>${
|
|
302
|
+
<style>${g}</style>
|
|
303
303
|
<section class="frame" part="frame" role="group" aria-label="${u(r)}">
|
|
304
304
|
<ol class="list" part="list">${s}</ol>
|
|
305
305
|
</section>
|
|
306
|
-
`)}}typeof customElements<"u"&&!customElements.get("ui-stepper")&&customElements.define("ui-stepper",
|
|
306
|
+
`)}}typeof customElements<"u"&&!customElements.get("ui-stepper")&&customElements.define("ui-stepper",d);exports.UIStepper=d;
|
package/dist/stepper.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
const
|
|
1
|
+
import { E as d } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
const b = `
|
|
3
3
|
:host {
|
|
4
4
|
--ui-stepper-gap: 8px;
|
|
5
5
|
--ui-stepper-radius: 12px;
|
|
@@ -284,9 +284,8 @@ const g = `
|
|
|
284
284
|
function u(o) {
|
|
285
285
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
if (!o)
|
|
289
|
-
return [];
|
|
287
|
+
function g(o) {
|
|
288
|
+
if (!o) return [];
|
|
290
289
|
try {
|
|
291
290
|
const t = JSON.parse(o);
|
|
292
291
|
return Array.isArray(t) ? t.filter((e) => e && typeof e == "object") : [];
|
|
@@ -294,13 +293,12 @@ function f(o) {
|
|
|
294
293
|
return [];
|
|
295
294
|
}
|
|
296
295
|
}
|
|
297
|
-
function
|
|
298
|
-
if (o == null)
|
|
299
|
-
return !1;
|
|
296
|
+
function p(o) {
|
|
297
|
+
if (o == null) return !1;
|
|
300
298
|
const t = String(o).toLowerCase();
|
|
301
299
|
return t !== "false" && t !== "0" && t !== "off";
|
|
302
300
|
}
|
|
303
|
-
class
|
|
301
|
+
class f extends d {
|
|
304
302
|
constructor() {
|
|
305
303
|
super(), this._observer = null, this._isSyncingValueAttribute = !1, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this);
|
|
306
304
|
}
|
|
@@ -349,13 +347,12 @@ class h extends b {
|
|
|
349
347
|
}
|
|
350
348
|
_fromSlots() {
|
|
351
349
|
return Array.from(this.querySelectorAll('[slot="step"], [data-step]')).map((e, r) => {
|
|
352
|
-
|
|
353
|
-
const s = e.getAttribute("data-value") || String(r + 1), i = e.getAttribute("data-label") || e.getAttribute("title") || ((p = e.textContent) == null ? void 0 : p.trim()) || `Step ${r + 1}`, a = e.getAttribute("data-description") || "", l = d(e.getAttribute("data-optional")), n = e.hasAttribute("disabled") || d(e.getAttribute("data-disabled")), c = e.getAttribute("data-state");
|
|
350
|
+
const s = e.getAttribute("data-value") || String(r + 1), i = e.getAttribute("data-label") || e.getAttribute("title") || e.textContent?.trim() || `Step ${r + 1}`, a = e.getAttribute("data-description") || "", l = p(e.getAttribute("data-optional")), n = e.hasAttribute("disabled") || p(e.getAttribute("data-disabled")), c = e.getAttribute("data-state");
|
|
354
351
|
return { index: r, value: s, label: i, description: a, optional: l, disabled: n, state: c === "complete" || c === "error" || c === "warning" ? c : "default" };
|
|
355
352
|
});
|
|
356
353
|
}
|
|
357
354
|
_fromAttr() {
|
|
358
|
-
return
|
|
355
|
+
return g(this.getAttribute("steps")).map((t, e) => {
|
|
359
356
|
const r = t.state === "complete" || t.state === "error" || t.state === "warning" ? t.state : "default";
|
|
360
357
|
return {
|
|
361
358
|
index: e,
|
|
@@ -373,13 +370,11 @@ class h extends b {
|
|
|
373
370
|
return t.length ? t : this._fromSlots();
|
|
374
371
|
}
|
|
375
372
|
_activeIndex(t) {
|
|
376
|
-
if (!t.length)
|
|
377
|
-
return -1;
|
|
373
|
+
if (!t.length) return -1;
|
|
378
374
|
const e = this.getAttribute("value") || "";
|
|
379
375
|
if (e) {
|
|
380
376
|
const s = t.findIndex((i) => i.value === e);
|
|
381
|
-
if (s >= 0)
|
|
382
|
-
return s;
|
|
377
|
+
if (s >= 0) return s;
|
|
383
378
|
}
|
|
384
379
|
const r = t.find((s) => !s.disabled) || t[0];
|
|
385
380
|
return r && this.getAttribute("value") !== r.value && this.setAttribute("value", r.value), t.findIndex((s) => s.value === r.value);
|
|
@@ -393,36 +388,31 @@ class h extends b {
|
|
|
393
388
|
}
|
|
394
389
|
goTo(t) {
|
|
395
390
|
const e = this._steps();
|
|
396
|
-
if (!e.length)
|
|
397
|
-
return !1;
|
|
391
|
+
if (!e.length) return !1;
|
|
398
392
|
const r = this._activeIndex(e), s = typeof t == "number" ? t : e.findIndex((i) => i.value === String(t));
|
|
399
393
|
return !Number.isInteger(s) || s < 0 || s >= e.length ? !1 : this._selectIndex(e, r, s, "api");
|
|
400
394
|
}
|
|
401
395
|
next() {
|
|
402
396
|
const t = this._steps(), e = this._activeIndex(t);
|
|
403
|
-
if (e < 0)
|
|
404
|
-
return !1;
|
|
397
|
+
if (e < 0) return !1;
|
|
405
398
|
const r = Math.min(t.length - 1, e + 1);
|
|
406
399
|
return this._selectIndex(t, e, r, "next");
|
|
407
400
|
}
|
|
408
401
|
prev() {
|
|
409
402
|
const t = this._steps(), e = this._activeIndex(t);
|
|
410
|
-
if (e < 0)
|
|
411
|
-
return !1;
|
|
403
|
+
if (e < 0) return !1;
|
|
412
404
|
const r = Math.max(0, e - 1);
|
|
413
405
|
return this._selectIndex(t, e, r, "prev");
|
|
414
406
|
}
|
|
415
407
|
_selectIndex(t, e, r, s) {
|
|
416
|
-
if (r === e)
|
|
417
|
-
return !0;
|
|
408
|
+
if (r === e) return !0;
|
|
418
409
|
const i = t[r];
|
|
419
|
-
if (!i || i.disabled || this.hasAttribute("linear") && r > e + 1)
|
|
420
|
-
return !1;
|
|
410
|
+
if (!i || i.disabled || this.hasAttribute("linear") && r > e + 1) return !1;
|
|
421
411
|
const a = t[e], l = new CustomEvent("before-change", {
|
|
422
412
|
detail: {
|
|
423
413
|
currentIndex: e,
|
|
424
414
|
nextIndex: r,
|
|
425
|
-
currentValue:
|
|
415
|
+
currentValue: a?.value || "",
|
|
426
416
|
nextValue: i.value,
|
|
427
417
|
trigger: s
|
|
428
418
|
},
|
|
@@ -430,8 +420,7 @@ class h extends b {
|
|
|
430
420
|
composed: !0,
|
|
431
421
|
cancelable: !0
|
|
432
422
|
});
|
|
433
|
-
if (!this.dispatchEvent(l))
|
|
434
|
-
return !1;
|
|
423
|
+
if (!this.dispatchEvent(l)) return !1;
|
|
435
424
|
this.value = i.value;
|
|
436
425
|
const n = {
|
|
437
426
|
index: r,
|
|
@@ -442,29 +431,24 @@ class h extends b {
|
|
|
442
431
|
return this.dispatchEvent(new CustomEvent("input", { detail: n, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: n, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("select", { detail: n, bubbles: !0, composed: !0 })), !0;
|
|
443
432
|
}
|
|
444
433
|
_onClick(t) {
|
|
445
|
-
const
|
|
446
|
-
if (!r || !this.hasAttribute("clickable") && !this.hasAttribute("linear"))
|
|
447
|
-
return;
|
|
434
|
+
const r = t.target?.closest(".trigger");
|
|
435
|
+
if (!r || !this.hasAttribute("clickable") && !this.hasAttribute("linear")) return;
|
|
448
436
|
const s = Number(r.getAttribute("data-index"));
|
|
449
|
-
if (!Number.isInteger(s))
|
|
450
|
-
return;
|
|
437
|
+
if (!Number.isInteger(s)) return;
|
|
451
438
|
const i = this._steps(), a = this._activeIndex(i);
|
|
452
439
|
this._selectIndex(i, a, s, "click");
|
|
453
440
|
}
|
|
454
441
|
_moveFocus(t, e) {
|
|
455
442
|
const r = Array.from(this.root.querySelectorAll(".trigger:not([disabled])"));
|
|
456
|
-
if (!r.length)
|
|
457
|
-
return;
|
|
443
|
+
if (!r.length) return;
|
|
458
444
|
const s = r.indexOf(t);
|
|
459
|
-
if (s < 0)
|
|
460
|
-
return;
|
|
445
|
+
if (s < 0) return;
|
|
461
446
|
const i = (s + e + r.length) % r.length;
|
|
462
447
|
r[i].focus();
|
|
463
448
|
}
|
|
464
449
|
_onKeyDown(t) {
|
|
465
|
-
const
|
|
466
|
-
if (!r)
|
|
467
|
-
return;
|
|
450
|
+
const r = t.target?.closest(".trigger");
|
|
451
|
+
if (!r) return;
|
|
468
452
|
const s = this.getAttribute("orientation") === "vertical", i = !s && getComputedStyle(this).direction === "rtl", a = s ? "ArrowDown" : i ? "ArrowLeft" : "ArrowRight", l = s ? "ArrowUp" : i ? "ArrowRight" : "ArrowLeft";
|
|
469
453
|
if (t.key === a) {
|
|
470
454
|
t.preventDefault(), this._moveFocus(r, 1);
|
|
@@ -476,23 +460,20 @@ class h extends b {
|
|
|
476
460
|
}
|
|
477
461
|
if (t.key === "Home" || t.key === "End") {
|
|
478
462
|
const n = Array.from(this.root.querySelectorAll(".trigger:not([disabled])"));
|
|
479
|
-
if (!n.length)
|
|
480
|
-
return;
|
|
463
|
+
if (!n.length) return;
|
|
481
464
|
t.preventDefault(), (t.key === "Home" ? n[0] : n[n.length - 1]).focus();
|
|
482
465
|
return;
|
|
483
466
|
}
|
|
484
467
|
(t.key === " " || t.key === "Enter") && (t.preventDefault(), r.click());
|
|
485
468
|
}
|
|
486
469
|
_syncValueUi() {
|
|
487
|
-
if (!this.isConnected)
|
|
488
|
-
return;
|
|
470
|
+
if (!this.isConnected) return;
|
|
489
471
|
if (!this.root.querySelector(".list")) {
|
|
490
472
|
this.requestRender();
|
|
491
473
|
return;
|
|
492
474
|
}
|
|
493
475
|
const t = this._steps();
|
|
494
|
-
if (!t.length)
|
|
495
|
-
return;
|
|
476
|
+
if (!t.length) return;
|
|
496
477
|
this._isSyncingValueAttribute = !0;
|
|
497
478
|
let e = -1;
|
|
498
479
|
try {
|
|
@@ -502,8 +483,7 @@ class h extends b {
|
|
|
502
483
|
}
|
|
503
484
|
Array.from(this.root.querySelectorAll(".item")).forEach((s, i) => {
|
|
504
485
|
const a = t[i];
|
|
505
|
-
if (!a)
|
|
506
|
-
return;
|
|
486
|
+
if (!a) return;
|
|
507
487
|
const l = a.state !== "default" ? a.state : i < e ? "complete" : i === e ? "current" : "upcoming";
|
|
508
488
|
s.setAttribute("data-state", l), s.setAttribute("data-active", i === e ? "true" : "false");
|
|
509
489
|
const n = s.querySelector(".trigger");
|
|
@@ -534,14 +514,14 @@ class h extends b {
|
|
|
534
514
|
</li>
|
|
535
515
|
`).join("");
|
|
536
516
|
this.setContent(`
|
|
537
|
-
<style>${
|
|
517
|
+
<style>${b}</style>
|
|
538
518
|
<section class="frame" part="frame" role="group" aria-label="${u(r)}">
|
|
539
519
|
<ol class="list" part="list">${s}</ol>
|
|
540
520
|
</section>
|
|
541
521
|
`);
|
|
542
522
|
}
|
|
543
523
|
}
|
|
544
|
-
typeof customElements < "u" && !customElements.get("ui-stepper") && customElements.define("ui-stepper",
|
|
524
|
+
typeof customElements < "u" && !customElements.get("ui-stepper") && customElements.define("ui-stepper", f);
|
|
545
525
|
export {
|
|
546
|
-
|
|
526
|
+
f as UIStepper
|
|
547
527
|
};
|
package/dist/switch.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=require("./ElementBase-EV6mVBUV.js"),g=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-switch-width: 44px;
|
|
4
4
|
--ui-switch-height: 24px;
|
|
@@ -372,8 +372,8 @@
|
|
|
372
372
|
background: HighlightText;
|
|
373
373
|
}
|
|
374
374
|
}
|
|
375
|
-
`,
|
|
376
|
-
<style>${
|
|
375
|
+
`,l=new Set(["label","description"]);function u(s){if(s==null)return!1;const t=String(s).toLowerCase();return t!=="false"&&t!=="0"&&t!=="off"}function d(s){return String(s).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(s){for(const t of s)if(t instanceof HTMLElement&&t.matches('a,button,input,select,textarea,[contenteditable="true"],[data-ui-switch-no-toggle]'))return!0;return!1}class b extends w.ElementBase{constructor(){super(),this._control=null,this._onClick=this._onClick.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["checked","disabled","headless","loading","size","variant","tone","shape","elevation","label","description","name","value","required","tabindex","aria-label"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onClick),this.root.addEventListener("keydown",this._onKeyDown),this.root.addEventListener("slotchange",this._onSlotChange),this._syncAria()}disconnectedCallback(){this.root.removeEventListener("click",this._onClick),this.root.removeEventListener("keydown",this._onKeyDown),this.root.removeEventListener("slotchange",this._onSlotChange),super.disconnectedCallback()}attributeChangedCallback(t,i,e){if(i!==e){if(l.has(t)){super.attributeChangedCallback(t,i,e);return}this._syncAria()}}get checked(){return this.hasAttribute("checked")}set checked(t){t?this.setAttribute("checked",""):this.removeAttribute("checked")}get disabled(){return this.hasAttribute("disabled")||this.hasAttribute("loading")}set disabled(t){t?this.setAttribute("disabled",""):this.removeAttribute("disabled")}toggle(t){if(this.disabled)return;const i=typeof t=="boolean"?t:!this.checked;if(i===this.checked){this._syncAria();return}this.checked=i,this._syncAria();const e={checked:i,value:this.getAttribute("value")||"on",name:this.getAttribute("name")||"",required:u(this.getAttribute("required"))};this.dispatchEvent(new CustomEvent("input",{detail:e,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:e,bubbles:!0,composed:!0}))}_syncAria(){const t=this.checked,i=this.disabled,e=this.hasAttribute("loading"),r=u(this.getAttribute("required"));this.setAttribute("role","switch"),this.setAttribute("aria-checked",t?"true":"false"),this.setAttribute("aria-disabled",i?"true":"false"),this.setAttribute("aria-busy",e?"true":"false"),r?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required");const o=this.getAttribute("data-ui-switch-tabindex");i?(o==null&&this.setAttribute("data-ui-switch-tabindex",this.getAttribute("tabindex")||""),this.getAttribute("tabindex")!=="-1"&&this.setAttribute("tabindex","-1")):o!=null?(o?this.setAttribute("tabindex",o):this.removeAttribute("tabindex"),this.removeAttribute("data-ui-switch-tabindex")):this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this._control&&(this._control.disabled=i)}_onClick(t){if(this.disabled)return;const i=t.composedPath();if(!i.some(a=>a instanceof HTMLElement&&a.classList.contains("control"))&&f(i))return;const r=t.target;r instanceof HTMLElement&&r.closest(".shell")&&(this.toggle(),this.focus({preventScroll:!0}))}_onKeyDown(t){if(this.disabled||t.defaultPrevented)return;const i=t.target;if(i instanceof HTMLElement&&i!==this&&!i.closest(".control"))return;const e=getComputedStyle(this).direction==="rtl";if(t.key===" "||t.key==="Enter"){t.preventDefault(),this.toggle();return}if(t.key==="ArrowLeft"){t.preventDefault(),this.toggle(e);return}if(t.key==="ArrowRight"){t.preventDefault(),this.toggle(!e);return}if(t.key==="Home"){t.preventDefault(),this.toggle(!1);return}t.key==="End"&&(t.preventDefault(),this.toggle(!0))}_onSlotChange(){this.requestRender()}render(){const t=this.checked,i=this.disabled,e=(this.getAttribute("label")||"").trim(),r=(this.getAttribute("description")||"").trim(),o=Array.from(this.childNodes).some(n=>n.nodeType===Node.TEXT_NODE?!!n.textContent?.trim():n.nodeType!==Node.ELEMENT_NODE?!1:!n.getAttribute("slot")),a=!!this.querySelector('[slot="description"]'),c=!!e||o,h=!!r||a,p=c||h;this.setContent(`
|
|
376
|
+
<style>${g}</style>
|
|
377
377
|
<span class="shell" part="shell">
|
|
378
378
|
<button
|
|
379
379
|
type="button"
|
|
@@ -389,9 +389,9 @@
|
|
|
389
389
|
<span class="thumb-icon icon-off" aria-hidden="true">•</span>
|
|
390
390
|
</span>
|
|
391
391
|
</button>
|
|
392
|
-
<span class="label-wrap" part="label-wrap" ${
|
|
393
|
-
<span class="label" part="label" ${c?"":"hidden"}><slot>${
|
|
394
|
-
<span class="description" part="description" ${h?"":"hidden"}><slot name="description">${
|
|
392
|
+
<span class="label-wrap" part="label-wrap" ${p?"":"hidden"}>
|
|
393
|
+
<span class="label" part="label" ${c?"":"hidden"}><slot>${d(e)}</slot></span>
|
|
394
|
+
<span class="description" part="description" ${h?"":"hidden"}><slot name="description">${d(r)}</slot></span>
|
|
395
395
|
</span>
|
|
396
396
|
</span>
|
|
397
|
-
`),this._control=this.root.querySelector(".control"),this._syncAria(),this.setAttribute("aria-checked",t?"true":"false")}shouldRenderOnAttributeChange(t,i,e){return
|
|
397
|
+
`),this._control=this.root.querySelector(".control"),this._syncAria(),this.setAttribute("aria-checked",t?"true":"false")}shouldRenderOnAttributeChange(t,i,e){return l.has(t)}}typeof customElements<"u"&&!customElements.get("ui-switch")&&customElements.define("ui-switch",b);exports.UISwitch=b;
|