@editora/ui-core 0.1.18 → 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 -669
- 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-button.d.ts +1 -0
- package/dist/components/ui-button.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 +1 -0
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts +1 -0
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- 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 +30 -9
- package/dist/date-picker.esm.js +90 -97
- package/dist/date-range-picker.cjs.js +22 -3
- package/dist/date-range-picker.esm.js +103 -108
- package/dist/date-range-time-picker.cjs.js +28 -12
- package/dist/date-range-time-picker.esm.js +137 -150
- package/dist/date-time-picker.cjs.js +25 -9
- package/dist/date-time-picker.esm.js +139 -155
- 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 +29 -21
- package/dist/time-picker.esm.js +96 -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 +3 -3
- 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/toast.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as l } from "./ElementBase-
|
|
1
|
+
import { E as l } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const u = 3200, c = 170, d = `
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
@@ -213,19 +213,19 @@ const u = 3200, c = 170, d = `
|
|
|
213
213
|
}
|
|
214
214
|
`;
|
|
215
215
|
let h = 0;
|
|
216
|
-
function p(
|
|
217
|
-
return String(
|
|
216
|
+
function p(i) {
|
|
217
|
+
return String(i).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
218
218
|
}
|
|
219
|
-
function m(
|
|
220
|
-
const t = String(
|
|
219
|
+
function m(i) {
|
|
220
|
+
const t = String(i || "").toLowerCase();
|
|
221
221
|
return t === "success" || t === "warning" || t === "error" || t === "loading" || t === "neutral" ? t : "info";
|
|
222
222
|
}
|
|
223
|
-
function g(
|
|
224
|
-
const t = Number(
|
|
223
|
+
function g(i) {
|
|
224
|
+
const t = Number(i);
|
|
225
225
|
return Number.isFinite(t) ? Math.max(0, Math.trunc(t)) : u;
|
|
226
226
|
}
|
|
227
|
-
function f(
|
|
228
|
-
const t = String(
|
|
227
|
+
function f(i) {
|
|
228
|
+
const t = String(i || "polite").toLowerCase();
|
|
229
229
|
return t === "off" || t === "assertive" ? t : "polite";
|
|
230
230
|
}
|
|
231
231
|
class b extends l {
|
|
@@ -248,28 +248,27 @@ class b extends l {
|
|
|
248
248
|
t ? this.setAttribute("headless", "") : this.removeAttribute("headless");
|
|
249
249
|
}
|
|
250
250
|
show(t, e = {}) {
|
|
251
|
-
const o = ++h, s = m(e.type),
|
|
251
|
+
const o = ++h, s = m(e.type), a = g(e.duration), r = f(e.ariaLive), n = {
|
|
252
252
|
id: o,
|
|
253
253
|
message: String(t ?? ""),
|
|
254
|
-
duration:
|
|
254
|
+
duration: a,
|
|
255
255
|
tone: s,
|
|
256
256
|
ariaLive: r,
|
|
257
257
|
createdAt: Date.now(),
|
|
258
258
|
closing: !1
|
|
259
259
|
};
|
|
260
|
-
return this._toasts.push(n), this._trimVisibleToasts(), this.requestRender(), this.dispatchEvent(new CustomEvent("show", { detail: { id: o, message: n.message, type: s }, bubbles: !0 })), this._scheduleAutoHide(o,
|
|
260
|
+
return this._toasts.push(n), this._trimVisibleToasts(), this.requestRender(), this.dispatchEvent(new CustomEvent("show", { detail: { id: o, message: n.message, type: s }, bubbles: !0 })), this._scheduleAutoHide(o, a), o;
|
|
261
261
|
}
|
|
262
262
|
hide(t) {
|
|
263
|
-
const e = this._toasts.find((
|
|
264
|
-
if (!e || e.closing)
|
|
265
|
-
return;
|
|
263
|
+
const e = this._toasts.find((a) => a.id === t);
|
|
264
|
+
if (!e || e.closing) return;
|
|
266
265
|
e.closing = !0, this._clearToastTimer(t), this.requestRender();
|
|
267
266
|
const o = this._exitMap.get(t);
|
|
268
267
|
o && clearTimeout(o);
|
|
269
268
|
const s = setTimeout(() => {
|
|
270
269
|
this._exitMap.delete(t);
|
|
271
|
-
const
|
|
272
|
-
this._toasts = this._toasts.filter((r) => r.id !== t), this._toasts.length !==
|
|
270
|
+
const a = this._toasts.length;
|
|
271
|
+
this._toasts = this._toasts.filter((r) => r.id !== t), this._toasts.length !== a && (this.requestRender(), this.dispatchEvent(new CustomEvent("hide", { detail: { id: t }, bubbles: !0 })));
|
|
273
272
|
}, c);
|
|
274
273
|
this._exitMap.set(t, s);
|
|
275
274
|
}
|
|
@@ -279,13 +278,11 @@ class b extends l {
|
|
|
279
278
|
}
|
|
280
279
|
_trimVisibleToasts() {
|
|
281
280
|
const t = this._toasts.filter((s) => !s.closing), e = this._maxVisible();
|
|
282
|
-
if (t.length <= e)
|
|
283
|
-
|
|
284
|
-
[...t].sort((s, i) => s.createdAt - i.createdAt).slice(0, t.length - e).forEach((s) => this.hide(s.id));
|
|
281
|
+
if (t.length <= e) return;
|
|
282
|
+
[...t].sort((s, a) => s.createdAt - a.createdAt).slice(0, t.length - e).forEach((s) => this.hide(s.id));
|
|
285
283
|
}
|
|
286
284
|
_scheduleAutoHide(t, e) {
|
|
287
|
-
if (this._clearToastTimer(t), e <= 0)
|
|
288
|
-
return;
|
|
285
|
+
if (this._clearToastTimer(t), e <= 0) return;
|
|
289
286
|
const o = Date.now(), s = setTimeout(() => {
|
|
290
287
|
this._timerMap.delete(t), this.hide(t);
|
|
291
288
|
}, e);
|
|
@@ -293,16 +290,14 @@ class b extends l {
|
|
|
293
290
|
}
|
|
294
291
|
_pauseToast(t) {
|
|
295
292
|
const e = this._timerMap.get(t);
|
|
296
|
-
if (!e || e.paused)
|
|
297
|
-
return;
|
|
293
|
+
if (!e || e.paused) return;
|
|
298
294
|
clearTimeout(e.timeout);
|
|
299
295
|
const o = Date.now() - e.startedAt;
|
|
300
296
|
e.remaining = Math.max(0, e.remaining - o), e.paused = !0, this._timerMap.set(t, e);
|
|
301
297
|
}
|
|
302
298
|
_resumeToast(t) {
|
|
303
299
|
const e = this._timerMap.get(t);
|
|
304
|
-
if (!e || !e.paused)
|
|
305
|
-
return;
|
|
300
|
+
if (!e || !e.paused) return;
|
|
306
301
|
const o = Math.max(0, e.remaining);
|
|
307
302
|
this._scheduleAutoHide(t, o);
|
|
308
303
|
}
|
|
@@ -313,27 +308,22 @@ class b extends l {
|
|
|
313
308
|
o && (clearTimeout(o), this._exitMap.delete(t));
|
|
314
309
|
}
|
|
315
310
|
_clearAllTimers() {
|
|
316
|
-
for (const t of this._timerMap.values())
|
|
317
|
-
clearTimeout(t.timeout);
|
|
311
|
+
for (const t of this._timerMap.values()) clearTimeout(t.timeout);
|
|
318
312
|
this._timerMap.clear();
|
|
319
|
-
for (const t of this._exitMap.values())
|
|
320
|
-
clearTimeout(t);
|
|
313
|
+
for (const t of this._exitMap.values()) clearTimeout(t);
|
|
321
314
|
this._exitMap.clear();
|
|
322
315
|
}
|
|
323
316
|
_closestToastId(t) {
|
|
324
|
-
const
|
|
325
|
-
if (!o)
|
|
326
|
-
return null;
|
|
317
|
+
const o = (t instanceof HTMLElement ? t : null)?.closest(".toast[data-toast-id]");
|
|
318
|
+
if (!o) return null;
|
|
327
319
|
const s = Number(o.getAttribute("data-toast-id"));
|
|
328
320
|
return Number.isFinite(s) ? s : null;
|
|
329
321
|
}
|
|
330
322
|
_handleRootClick(t) {
|
|
331
323
|
const e = t.target;
|
|
332
|
-
if (!e)
|
|
333
|
-
return;
|
|
324
|
+
if (!e) return;
|
|
334
325
|
const o = e.closest("button.close[data-toast-id]");
|
|
335
|
-
if (!o)
|
|
336
|
-
return;
|
|
326
|
+
if (!o) return;
|
|
337
327
|
t.preventDefault();
|
|
338
328
|
const s = Number(o.getAttribute("data-toast-id"));
|
|
339
329
|
Number.isNaN(s) || this.hide(s);
|
|
@@ -343,24 +333,20 @@ class b extends l {
|
|
|
343
333
|
e != null && this._pauseToast(e);
|
|
344
334
|
}
|
|
345
335
|
_handleRootMouseLeave(t) {
|
|
346
|
-
var i;
|
|
347
336
|
const e = this._closestToastId(t.target);
|
|
348
|
-
if (e == null)
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
s && (o != null && o.contains(s)) || this._resumeToast(e);
|
|
337
|
+
if (e == null) return;
|
|
338
|
+
const o = t.target?.closest(".toast[data-toast-id]"), s = t.relatedTarget;
|
|
339
|
+
s && o?.contains(s) || this._resumeToast(e);
|
|
352
340
|
}
|
|
353
341
|
_handleRootFocusIn(t) {
|
|
354
342
|
const e = this._closestToastId(t.target);
|
|
355
343
|
e != null && this._pauseToast(e);
|
|
356
344
|
}
|
|
357
345
|
_handleRootFocusOut(t) {
|
|
358
|
-
var i;
|
|
359
346
|
const e = this._closestToastId(t.target);
|
|
360
|
-
if (e == null)
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
o && (s != null && s.contains(o)) || this._resumeToast(e);
|
|
347
|
+
if (e == null) return;
|
|
348
|
+
const o = t.relatedTarget, s = t.target?.closest(".toast[data-toast-id]");
|
|
349
|
+
o && s?.contains(o) || this._resumeToast(e);
|
|
364
350
|
}
|
|
365
351
|
render() {
|
|
366
352
|
this.setContent(`
|
package/dist/toggle-group.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 A=require("./ElementBase-EV6mVBUV.js"),g=require("./roving-focus-group-BdJ_4Njm.js"),y=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-toggle-group-gap: 8px;
|
|
4
4
|
--ui-toggle-group-padding: 6px;
|
|
@@ -115,17 +115,17 @@
|
|
|
115
115
|
--ui-toggle-group-shadow: none;
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
`,
|
|
119
|
-
<style>${
|
|
118
|
+
`,_=new Set(["multiple","orientation","aria-label","required","disabled"]);function x(n){return String(n).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function S(n){try{return JSON.parse(n)}catch{return}}function w(n,t){if(!t)return n||"";if(!n)return[];const e=S(n);return Array.isArray(e)?Array.from(new Set(e.map(i=>String(i)).filter(Boolean))):n.includes(",")?Array.from(new Set(n.split(",").map(i=>i.trim()).filter(Boolean))):[n]}function f(n,t){return t?JSON.stringify(Array.isArray(n)?n:[String(n)]):String(n||"")}class v extends A.ElementBase{constructor(){super(),this._observer=null,this._isSyncing=!1,this._focusIndex=-1,this._onToggleEvent=this._onToggleEvent.bind(this),this._onKeyDown=this._onKeyDown.bind(this)}static get observedAttributes(){return["value","multiple","disabled","headless","orientation","variant","size","density","shape","elevation","allow-empty","required","activation","aria-label"]}connectedCallback(){super.connectedCallback(),this.addEventListener("change",this._onToggleEvent),this.addEventListener("keydown",this._onKeyDown),this._observer=new MutationObserver(t=>{this._isSyncing||(t.forEach(e=>{e.type!=="childList"||e.removedNodes.length===0||e.removedNodes.forEach(i=>this._clearGroupFlagsFromNode(i))}),this._syncChildren())}),this._observer.observe(this,{childList:!0,subtree:!0,attributes:!0,characterData:!0,attributeFilter:["value","data-value","disabled","pressed","data-disabled"]}),this._syncChildren()}attributeChangedCallback(t,e,i){if(e!==i){if(_.has(t)){if(!this.root.querySelector(".group")){this.requestRender();return}this._syncGroupA11y()}this._syncChildren()}}disconnectedCallback(){this.removeEventListener("change",this._onToggleEvent),this.removeEventListener("keydown",this._onKeyDown),this._toggles().forEach(t=>this._clearGroupFlags(t)),this._observer&&(this._observer.disconnect(),this._observer=null),super.disconnectedCallback()}get multiple(){return this.hasAttribute("multiple")}set multiple(t){t?this.setAttribute("multiple",""):this.removeAttribute("multiple")}get value(){return w(this.getAttribute("value"),this.multiple)}set value(t){const e=f(t,this.multiple);if(!this.multiple&&!e){this.hasAttribute("value")&&this.removeAttribute("value"),this._syncChildren();return}this.getAttribute("value")!==e&&this.setAttribute("value",e),this._syncChildren()}_toggles(){return Array.from(this.querySelectorAll("ui-toggle"))}_toggleValue(t,e){return t.getAttribute("value")||t.getAttribute("data-value")||t.textContent?.trim()||String(e)}_clearGroupFlags(t){t.hasAttribute("data-group-item")&&t.removeAttribute("data-group-item"),t.hasAttribute("data-group-disabled")&&t.removeAttribute("data-group-disabled"),t.hasAttribute("role")&&t.removeAttribute("role"),t.hasAttribute("aria-checked")&&t.removeAttribute("aria-checked"),t._syncAria?.()}_clearGroupFlagsFromNode(t){if(!(t instanceof HTMLElement))return;t.matches("ui-toggle")&&this._clearGroupFlags(t),Array.from(t.querySelectorAll("ui-toggle")).forEach(i=>this._clearGroupFlags(i))}_selectedSet(){const t=this.value;return Array.isArray(t)?new Set(t.map(e=>String(e))):t?new Set([String(t)]):new Set}_setGroupValue(t,e=!0){const i=f(t,this.multiple),a=this.getAttribute("value")||"";if(!this.multiple&&!i&&!a||a===i){this._syncChildren();return}if(!this.multiple&&!i?this.removeAttribute("value"):this.setAttribute("value",i),this._syncChildren(),!e)return;const r={value:this.multiple?Array.isArray(t)?t:[String(t)]:String(t||""),values:this.multiple?Array.isArray(t)?t:[String(t)]:t?[String(t)]:[],multiple:this.multiple};this.dispatchEvent(new CustomEvent("input",{detail:r,bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("change",{detail:r,bubbles:!0,composed:!0}))}_syncChildren(){const t=this._toggles(),e=this.hasAttribute("disabled"),i=this._selectedSet(),a=this.multiple,r=(c,s,o)=>{const u=c.hasAttribute(s);o&&!u&&c.setAttribute(s,""),!o&&u&&c.removeAttribute(s)},d=(c,s,o)=>{c.getAttribute(s)!==o&&c.setAttribute(s,o)};let h=-1,l=-1;this._isSyncing=!0;try{t.forEach((s,o)=>{const u=this._toggleValue(s,o),p=s.hasAttribute("data-disabled")||s.getAttribute("aria-disabled")==="true",m=e||p;r(s,"data-group-item",!0),m?(r(s,"disabled",!0),r(s,"data-group-disabled",e&&!p)):s.hasAttribute("data-group-disabled")&&(r(s,"disabled",!1),r(s,"data-group-disabled",!1));const b=i.has(u);r(s,"pressed",b),d(s,"role",a?"checkbox":"radio"),d(s,"aria-checked",b?"true":"false"),b&&l<0&&(l=o),!s.hasAttribute("disabled")&&h<0&&(h=o)});const c=g.resolveRovingFocusIndex(t,{activeIndex:this._focusIndex,selectedIndex:l>=0?l:h,getDisabled:s=>s.hasAttribute("disabled")});this._focusIndex=c,g.syncRovingTabStops(t,t[c]||null,{activeAttribute:null})}finally{this._isSyncing=!1}}_onToggleEvent(t){const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-toggle"||this.hasAttribute("disabled"))return;const a=this._toggles().indexOf(e);if(a<0)return;const r=this._toggleValue(e,a),d=t.detail?.pressed??e.hasAttribute("pressed");if(this._focusIndex=a,this.multiple){const l=this._selectedSet();d?l.add(r):l.delete(r),this._setGroupValue(Array.from(l),!0);return}const h=this.hasAttribute("allow-empty")&&!this.hasAttribute("required");if(d){this._setGroupValue(r,!0);return}if(h)this._setGroupValue("",!0);else{const l=String(this.value||"");this._setGroupValue(l||r,!1)}}_onKeyDown(t){const e=t.target;if(!e||e.tagName.toLowerCase()!=="ui-toggle")return;const i=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",a=this.getAttribute("activation")==="manual"?"manual":"auto",r=this._toggles().filter(o=>!o.hasAttribute("disabled"));if(r.length<2)return;const d=r.indexOf(e);if(d<0)return;const h=this._isHorizontalRtl(),l=o=>{const u=g.moveRovingFocusIndex(r,d,o,{wrap:!0,fallbackIndex:g.resolveRovingFocusIndex(r,{activeIndex:d,getDisabled:()=>!1}),getDisabled:()=>!1});if(u<0)return;const p=r[u];this._focusIndex=this._toggles().indexOf(p),g.syncRovingTabStops(r,p,{activeAttribute:null}),g.focusRovingItem(p),a==="auto"&&p.toggle?.(!0)},c=i==="horizontal"&&(t.key==="ArrowRight"&&!h||t.key==="ArrowLeft"&&h)||i==="vertical"&&t.key==="ArrowDown",s=i==="horizontal"&&(t.key==="ArrowLeft"&&!h||t.key==="ArrowRight"&&h)||i==="vertical"&&t.key==="ArrowUp";if(c){t.preventDefault(),l(1);return}if(s){t.preventDefault(),l(-1);return}if(t.key==="Home"){t.preventDefault();const o=g.getRovingFocusBoundaryIndex(r,"first",()=>!1);if(o<0)return;const u=r[o];this._focusIndex=this._toggles().indexOf(u),g.syncRovingTabStops(r,u,{activeAttribute:null}),g.focusRovingItem(u),a==="auto"&&u.toggle?.(!0);return}if(t.key==="End"){t.preventDefault();const o=g.getRovingFocusBoundaryIndex(r,"last",()=>!1);if(o<0)return;const u=r[o];this._focusIndex=this._toggles().indexOf(u),g.syncRovingTabStops(r,u,{activeAttribute:null}),g.focusRovingItem(u),a==="auto"&&u.toggle?.(!0)}}render(){const t=this.multiple?"group":"radiogroup",e=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",i=this.getAttribute("aria-label")||"Toggle group",a=this.hasAttribute("required"),r=this.hasAttribute("disabled");this.setContent(`
|
|
119
|
+
<style>${y}</style>
|
|
120
120
|
<div
|
|
121
121
|
class="group"
|
|
122
122
|
part="group"
|
|
123
123
|
role="${t}"
|
|
124
|
-
aria-label="${
|
|
124
|
+
aria-label="${x(i)}"
|
|
125
125
|
aria-orientation="${e}"
|
|
126
|
-
aria-disabled="${
|
|
126
|
+
aria-disabled="${r?"true":"false"}"
|
|
127
127
|
aria-required="${a?"true":"false"}"
|
|
128
128
|
>
|
|
129
129
|
<slot></slot>
|
|
130
130
|
</div>
|
|
131
|
-
`),this._syncChildren()}_syncGroupA11y(){const t=this.root.querySelector(".group");if(!t)return;const e=this.multiple?"group":"radiogroup",
|
|
131
|
+
`),this._syncChildren()}_syncGroupA11y(){const t=this.root.querySelector(".group");if(!t)return;const e=this.multiple?"group":"radiogroup",i=this.getAttribute("orientation")==="vertical"?"vertical":"horizontal",a=this.getAttribute("aria-label")||"Toggle group",r=this.hasAttribute("required"),d=this.hasAttribute("disabled");t.getAttribute("role")!==e&&t.setAttribute("role",e),t.getAttribute("aria-label")!==a&&t.setAttribute("aria-label",a),t.getAttribute("aria-orientation")!==i&&t.setAttribute("aria-orientation",i),t.setAttribute("aria-disabled",d?"true":"false"),t.setAttribute("aria-required",r?"true":"false")}_isHorizontalRtl(){if(this.getAttribute("orientation")==="vertical")return!1;const t=this.getAttribute("dir");return t?t.toLowerCase()==="rtl":typeof window>"u"?!1:window.getComputedStyle(this).direction==="rtl"}shouldRenderOnAttributeChange(t,e,i){return!1}}typeof customElements<"u"&&!customElements.get("ui-toggle-group")&&customElements.define("ui-toggle-group",v);exports.UIToggleGroup=v;
|
package/dist/toggle-group.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import { r as
|
|
3
|
-
const
|
|
1
|
+
import { E as _ } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import { r as m, s as p, g as v, f, m as x } from "./roving-focus-group-Dbm1Jko_.mjs";
|
|
3
|
+
const w = `
|
|
4
4
|
:host {
|
|
5
5
|
--ui-toggle-group-gap: 8px;
|
|
6
6
|
--ui-toggle-group-padding: 6px;
|
|
@@ -117,29 +117,27 @@ const S = `
|
|
|
117
117
|
--ui-toggle-group-shadow: none;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
|
-
`,
|
|
121
|
-
function
|
|
120
|
+
`, S = /* @__PURE__ */ new Set(["multiple", "orientation", "aria-label", "required", "disabled"]);
|
|
121
|
+
function E(n) {
|
|
122
122
|
return String(n).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function C(n) {
|
|
125
125
|
try {
|
|
126
126
|
return JSON.parse(n);
|
|
127
127
|
} catch {
|
|
128
128
|
return;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
if (!t)
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
const e = I(n);
|
|
137
|
-
return Array.isArray(e) ? Array.from(new Set(e.map((r) => String(r)).filter(Boolean))) : n.includes(",") ? Array.from(new Set(n.split(",").map((r) => r.trim()).filter(Boolean))) : [n];
|
|
131
|
+
function I(n, t) {
|
|
132
|
+
if (!t) return n || "";
|
|
133
|
+
if (!n) return [];
|
|
134
|
+
const e = C(n);
|
|
135
|
+
return Array.isArray(e) ? Array.from(new Set(e.map((i) => String(i)).filter(Boolean))) : n.includes(",") ? Array.from(new Set(n.split(",").map((i) => i.trim()).filter(Boolean))) : [n];
|
|
138
136
|
}
|
|
139
|
-
function
|
|
137
|
+
function A(n, t) {
|
|
140
138
|
return t ? JSON.stringify(Array.isArray(n) ? n : [String(n)]) : String(n || "");
|
|
141
139
|
}
|
|
142
|
-
class
|
|
140
|
+
class k extends _ {
|
|
143
141
|
constructor() {
|
|
144
142
|
super(), this._observer = null, this._isSyncing = !1, this._focusIndex = -1, this._onToggleEvent = this._onToggleEvent.bind(this), this._onKeyDown = this._onKeyDown.bind(this);
|
|
145
143
|
}
|
|
@@ -164,7 +162,7 @@ class z extends x {
|
|
|
164
162
|
connectedCallback() {
|
|
165
163
|
super.connectedCallback(), this.addEventListener("change", this._onToggleEvent), this.addEventListener("keydown", this._onKeyDown), this._observer = new MutationObserver((t) => {
|
|
166
164
|
this._isSyncing || (t.forEach((e) => {
|
|
167
|
-
e.type !== "childList" || e.removedNodes.length === 0 || e.removedNodes.forEach((
|
|
165
|
+
e.type !== "childList" || e.removedNodes.length === 0 || e.removedNodes.forEach((i) => this._clearGroupFlagsFromNode(i));
|
|
168
166
|
}), this._syncChildren());
|
|
169
167
|
}), this._observer.observe(this, {
|
|
170
168
|
childList: !0,
|
|
@@ -174,9 +172,9 @@ class z extends x {
|
|
|
174
172
|
attributeFilter: ["value", "data-value", "disabled", "pressed", "data-disabled"]
|
|
175
173
|
}), this._syncChildren();
|
|
176
174
|
}
|
|
177
|
-
attributeChangedCallback(t, e,
|
|
178
|
-
if (e !==
|
|
179
|
-
if (
|
|
175
|
+
attributeChangedCallback(t, e, i) {
|
|
176
|
+
if (e !== i) {
|
|
177
|
+
if (S.has(t)) {
|
|
180
178
|
if (!this.root.querySelector(".group")) {
|
|
181
179
|
this.requestRender();
|
|
182
180
|
return;
|
|
@@ -196,10 +194,10 @@ class z extends x {
|
|
|
196
194
|
t ? this.setAttribute("multiple", "") : this.removeAttribute("multiple");
|
|
197
195
|
}
|
|
198
196
|
get value() {
|
|
199
|
-
return
|
|
197
|
+
return I(this.getAttribute("value"), this.multiple);
|
|
200
198
|
}
|
|
201
199
|
set value(t) {
|
|
202
|
-
const e =
|
|
200
|
+
const e = A(t, this.multiple);
|
|
203
201
|
if (!this.multiple && !e) {
|
|
204
202
|
this.hasAttribute("value") && this.removeAttribute("value"), this._syncChildren();
|
|
205
203
|
return;
|
|
@@ -210,149 +208,133 @@ class z extends x {
|
|
|
210
208
|
return Array.from(this.querySelectorAll("ui-toggle"));
|
|
211
209
|
}
|
|
212
210
|
_toggleValue(t, e) {
|
|
213
|
-
|
|
214
|
-
return t.getAttribute("value") || t.getAttribute("data-value") || ((r = t.textContent) == null ? void 0 : r.trim()) || String(e);
|
|
211
|
+
return t.getAttribute("value") || t.getAttribute("data-value") || t.textContent?.trim() || String(e);
|
|
215
212
|
}
|
|
216
213
|
_clearGroupFlags(t) {
|
|
217
|
-
|
|
218
|
-
t.hasAttribute("data-group-item") && t.removeAttribute("data-group-item"), t.hasAttribute("data-group-disabled") && t.removeAttribute("data-group-disabled"), t.hasAttribute("role") && t.removeAttribute("role"), t.hasAttribute("aria-checked") && t.removeAttribute("aria-checked"), (e = t._syncAria) == null || e.call(t);
|
|
214
|
+
t.hasAttribute("data-group-item") && t.removeAttribute("data-group-item"), t.hasAttribute("data-group-disabled") && t.removeAttribute("data-group-disabled"), t.hasAttribute("role") && t.removeAttribute("role"), t.hasAttribute("aria-checked") && t.removeAttribute("aria-checked"), t._syncAria?.();
|
|
219
215
|
}
|
|
220
216
|
_clearGroupFlagsFromNode(t) {
|
|
221
|
-
if (!(t instanceof HTMLElement))
|
|
222
|
-
|
|
223
|
-
t.matches("ui-toggle") && this._clearGroupFlags(t), Array.from(t.querySelectorAll("ui-toggle")).forEach((r) => this._clearGroupFlags(r));
|
|
217
|
+
if (!(t instanceof HTMLElement)) return;
|
|
218
|
+
t.matches("ui-toggle") && this._clearGroupFlags(t), Array.from(t.querySelectorAll("ui-toggle")).forEach((i) => this._clearGroupFlags(i));
|
|
224
219
|
}
|
|
225
220
|
_selectedSet() {
|
|
226
221
|
const t = this.value;
|
|
227
222
|
return Array.isArray(t) ? new Set(t.map((e) => String(e))) : t ? /* @__PURE__ */ new Set([String(t)]) : /* @__PURE__ */ new Set();
|
|
228
223
|
}
|
|
229
224
|
_setGroupValue(t, e = !0) {
|
|
230
|
-
const
|
|
231
|
-
if (!this.multiple && !
|
|
225
|
+
const i = A(t, this.multiple), a = this.getAttribute("value") || "";
|
|
226
|
+
if (!this.multiple && !i && !a || a === i) {
|
|
232
227
|
this._syncChildren();
|
|
233
228
|
return;
|
|
234
229
|
}
|
|
235
|
-
if (!this.multiple && !
|
|
236
|
-
|
|
237
|
-
const i = {
|
|
230
|
+
if (!this.multiple && !i ? this.removeAttribute("value") : this.setAttribute("value", i), this._syncChildren(), !e) return;
|
|
231
|
+
const r = {
|
|
238
232
|
value: this.multiple ? Array.isArray(t) ? t : [String(t)] : String(t || ""),
|
|
239
233
|
values: this.multiple ? Array.isArray(t) ? t : [String(t)] : t ? [String(t)] : [],
|
|
240
234
|
multiple: this.multiple
|
|
241
235
|
};
|
|
242
|
-
this.dispatchEvent(new CustomEvent("input", { detail:
|
|
236
|
+
this.dispatchEvent(new CustomEvent("input", { detail: r, bubbles: !0, composed: !0 })), this.dispatchEvent(new CustomEvent("change", { detail: r, bubbles: !0, composed: !0 }));
|
|
243
237
|
}
|
|
244
238
|
_syncChildren() {
|
|
245
|
-
const t = this._toggles(), e = this.hasAttribute("disabled"),
|
|
246
|
-
const
|
|
247
|
-
|
|
248
|
-
}, g = (
|
|
249
|
-
|
|
239
|
+
const t = this._toggles(), e = this.hasAttribute("disabled"), i = this._selectedSet(), a = this.multiple, r = (d, s, o) => {
|
|
240
|
+
const u = d.hasAttribute(s);
|
|
241
|
+
o && !u && d.setAttribute(s, ""), !o && u && d.removeAttribute(s);
|
|
242
|
+
}, g = (d, s, o) => {
|
|
243
|
+
d.getAttribute(s) !== o && d.setAttribute(s, o);
|
|
250
244
|
};
|
|
251
|
-
let c = -1,
|
|
245
|
+
let c = -1, l = -1;
|
|
252
246
|
this._isSyncing = !0;
|
|
253
247
|
try {
|
|
254
|
-
t.forEach((s,
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
const
|
|
258
|
-
|
|
248
|
+
t.forEach((s, o) => {
|
|
249
|
+
const u = this._toggleValue(s, o), h = s.hasAttribute("data-disabled") || s.getAttribute("aria-disabled") === "true", y = e || h;
|
|
250
|
+
r(s, "data-group-item", !0), y ? (r(s, "disabled", !0), r(s, "data-group-disabled", e && !h)) : s.hasAttribute("data-group-disabled") && (r(s, "disabled", !1), r(s, "data-group-disabled", !1));
|
|
251
|
+
const b = i.has(u);
|
|
252
|
+
r(s, "pressed", b), g(s, "role", a ? "checkbox" : "radio"), g(s, "aria-checked", b ? "true" : "false"), b && l < 0 && (l = o), !s.hasAttribute("disabled") && c < 0 && (c = o);
|
|
259
253
|
});
|
|
260
|
-
const
|
|
254
|
+
const d = m(t, {
|
|
261
255
|
activeIndex: this._focusIndex,
|
|
262
|
-
selectedIndex:
|
|
256
|
+
selectedIndex: l >= 0 ? l : c,
|
|
263
257
|
getDisabled: (s) => s.hasAttribute("disabled")
|
|
264
258
|
});
|
|
265
|
-
this._focusIndex =
|
|
259
|
+
this._focusIndex = d, p(t, t[d] || null, { activeAttribute: null });
|
|
266
260
|
} finally {
|
|
267
261
|
this._isSyncing = !1;
|
|
268
262
|
}
|
|
269
263
|
}
|
|
270
264
|
_onToggleEvent(t) {
|
|
271
|
-
var h;
|
|
272
265
|
const e = t.target;
|
|
273
|
-
if (!e || e.tagName.toLowerCase() !== "ui-toggle" || this.hasAttribute("disabled"))
|
|
274
|
-
return;
|
|
266
|
+
if (!e || e.tagName.toLowerCase() !== "ui-toggle" || this.hasAttribute("disabled")) return;
|
|
275
267
|
const a = this._toggles().indexOf(e);
|
|
276
|
-
if (a < 0)
|
|
277
|
-
|
|
278
|
-
const i = this._toggleValue(e, a), g = ((h = t.detail) == null ? void 0 : h.pressed) ?? e.hasAttribute("pressed");
|
|
268
|
+
if (a < 0) return;
|
|
269
|
+
const r = this._toggleValue(e, a), g = t.detail?.pressed ?? e.hasAttribute("pressed");
|
|
279
270
|
if (this._focusIndex = a, this.multiple) {
|
|
280
|
-
const
|
|
281
|
-
g ?
|
|
271
|
+
const l = this._selectedSet();
|
|
272
|
+
g ? l.add(r) : l.delete(r), this._setGroupValue(Array.from(l), !0);
|
|
282
273
|
return;
|
|
283
274
|
}
|
|
284
275
|
const c = this.hasAttribute("allow-empty") && !this.hasAttribute("required");
|
|
285
276
|
if (g) {
|
|
286
|
-
this._setGroupValue(
|
|
277
|
+
this._setGroupValue(r, !0);
|
|
287
278
|
return;
|
|
288
279
|
}
|
|
289
|
-
if (c)
|
|
290
|
-
this._setGroupValue("", !0);
|
|
280
|
+
if (c) this._setGroupValue("", !0);
|
|
291
281
|
else {
|
|
292
|
-
const
|
|
293
|
-
this._setGroupValue(
|
|
282
|
+
const l = String(this.value || "");
|
|
283
|
+
this._setGroupValue(l || r, !1);
|
|
294
284
|
}
|
|
295
285
|
}
|
|
296
286
|
_onKeyDown(t) {
|
|
297
|
-
var l, b;
|
|
298
287
|
const e = t.target;
|
|
299
|
-
if (!e || e.tagName.toLowerCase() !== "ui-toggle")
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
return;
|
|
307
|
-
const c = this._isHorizontalRtl(), h = (d) => {
|
|
308
|
-
var v;
|
|
309
|
-
const o = w(i, g, d, {
|
|
288
|
+
if (!e || e.tagName.toLowerCase() !== "ui-toggle") return;
|
|
289
|
+
const i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", a = this.getAttribute("activation") === "manual" ? "manual" : "auto", r = this._toggles().filter((o) => !o.hasAttribute("disabled"));
|
|
290
|
+
if (r.length < 2) return;
|
|
291
|
+
const g = r.indexOf(e);
|
|
292
|
+
if (g < 0) return;
|
|
293
|
+
const c = this._isHorizontalRtl(), l = (o) => {
|
|
294
|
+
const u = x(r, g, o, {
|
|
310
295
|
wrap: !0,
|
|
311
|
-
fallbackIndex:
|
|
296
|
+
fallbackIndex: m(r, { activeIndex: g, getDisabled: () => !1 }),
|
|
312
297
|
getDisabled: () => !1
|
|
313
298
|
});
|
|
314
|
-
if (
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
t.preventDefault(), h(1);
|
|
299
|
+
if (u < 0) return;
|
|
300
|
+
const h = r[u];
|
|
301
|
+
this._focusIndex = this._toggles().indexOf(h), p(r, h, { activeAttribute: null }), f(h), a === "auto" && h.toggle?.(!0);
|
|
302
|
+
}, d = i === "horizontal" && (t.key === "ArrowRight" && !c || t.key === "ArrowLeft" && c) || i === "vertical" && t.key === "ArrowDown", s = i === "horizontal" && (t.key === "ArrowLeft" && !c || t.key === "ArrowRight" && c) || i === "vertical" && t.key === "ArrowUp";
|
|
303
|
+
if (d) {
|
|
304
|
+
t.preventDefault(), l(1);
|
|
321
305
|
return;
|
|
322
306
|
}
|
|
323
307
|
if (s) {
|
|
324
|
-
t.preventDefault(),
|
|
308
|
+
t.preventDefault(), l(-1);
|
|
325
309
|
return;
|
|
326
310
|
}
|
|
327
311
|
if (t.key === "Home") {
|
|
328
312
|
t.preventDefault();
|
|
329
|
-
const
|
|
330
|
-
if (
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
this._focusIndex = this._toggles().indexOf(o), f(i, o, { activeAttribute: null }), m(o), a === "auto" && ((l = o.toggle) == null || l.call(o, !0));
|
|
313
|
+
const o = v(r, "first", () => !1);
|
|
314
|
+
if (o < 0) return;
|
|
315
|
+
const u = r[o];
|
|
316
|
+
this._focusIndex = this._toggles().indexOf(u), p(r, u, { activeAttribute: null }), f(u), a === "auto" && u.toggle?.(!0);
|
|
334
317
|
return;
|
|
335
318
|
}
|
|
336
319
|
if (t.key === "End") {
|
|
337
320
|
t.preventDefault();
|
|
338
|
-
const
|
|
339
|
-
if (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
this._focusIndex = this._toggles().indexOf(o), f(i, o, { activeAttribute: null }), m(o), a === "auto" && ((b = o.toggle) == null || b.call(o, !0));
|
|
321
|
+
const o = v(r, "last", () => !1);
|
|
322
|
+
if (o < 0) return;
|
|
323
|
+
const u = r[o];
|
|
324
|
+
this._focusIndex = this._toggles().indexOf(u), p(r, u, { activeAttribute: null }), f(u), a === "auto" && u.toggle?.(!0);
|
|
343
325
|
}
|
|
344
326
|
}
|
|
345
327
|
render() {
|
|
346
|
-
const t = this.multiple ? "group" : "radiogroup", e = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal",
|
|
328
|
+
const t = this.multiple ? "group" : "radiogroup", e = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", i = this.getAttribute("aria-label") || "Toggle group", a = this.hasAttribute("required"), r = this.hasAttribute("disabled");
|
|
347
329
|
this.setContent(`
|
|
348
|
-
<style>${
|
|
330
|
+
<style>${w}</style>
|
|
349
331
|
<div
|
|
350
332
|
class="group"
|
|
351
333
|
part="group"
|
|
352
334
|
role="${t}"
|
|
353
|
-
aria-label="${
|
|
335
|
+
aria-label="${E(i)}"
|
|
354
336
|
aria-orientation="${e}"
|
|
355
|
-
aria-disabled="${
|
|
337
|
+
aria-disabled="${r ? "true" : "false"}"
|
|
356
338
|
aria-required="${a ? "true" : "false"}"
|
|
357
339
|
>
|
|
358
340
|
<slot></slot>
|
|
@@ -361,22 +343,20 @@ class z extends x {
|
|
|
361
343
|
}
|
|
362
344
|
_syncGroupA11y() {
|
|
363
345
|
const t = this.root.querySelector(".group");
|
|
364
|
-
if (!t)
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
t.getAttribute("role") !== e && t.setAttribute("role", e), t.getAttribute("aria-label") !== a && t.setAttribute("aria-label", a), t.getAttribute("aria-orientation") !== r && t.setAttribute("aria-orientation", r), t.setAttribute("aria-disabled", g ? "true" : "false"), t.setAttribute("aria-required", i ? "true" : "false");
|
|
346
|
+
if (!t) return;
|
|
347
|
+
const e = this.multiple ? "group" : "radiogroup", i = this.getAttribute("orientation") === "vertical" ? "vertical" : "horizontal", a = this.getAttribute("aria-label") || "Toggle group", r = this.hasAttribute("required"), g = this.hasAttribute("disabled");
|
|
348
|
+
t.getAttribute("role") !== e && t.setAttribute("role", e), t.getAttribute("aria-label") !== a && t.setAttribute("aria-label", a), t.getAttribute("aria-orientation") !== i && t.setAttribute("aria-orientation", i), t.setAttribute("aria-disabled", g ? "true" : "false"), t.setAttribute("aria-required", r ? "true" : "false");
|
|
368
349
|
}
|
|
369
350
|
_isHorizontalRtl() {
|
|
370
|
-
if (this.getAttribute("orientation") === "vertical")
|
|
371
|
-
return !1;
|
|
351
|
+
if (this.getAttribute("orientation") === "vertical") return !1;
|
|
372
352
|
const t = this.getAttribute("dir");
|
|
373
353
|
return t ? t.toLowerCase() === "rtl" : typeof window > "u" ? !1 : window.getComputedStyle(this).direction === "rtl";
|
|
374
354
|
}
|
|
375
|
-
shouldRenderOnAttributeChange(t, e,
|
|
355
|
+
shouldRenderOnAttributeChange(t, e, i) {
|
|
376
356
|
return !1;
|
|
377
357
|
}
|
|
378
358
|
}
|
|
379
|
-
typeof customElements < "u" && !customElements.get("ui-toggle-group") && customElements.define("ui-toggle-group",
|
|
359
|
+
typeof customElements < "u" && !customElements.get("ui-toggle-group") && customElements.define("ui-toggle-group", k);
|
|
380
360
|
export {
|
|
381
|
-
|
|
361
|
+
k as UIToggleGroup
|
|
382
362
|
};
|
package/dist/toggle.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-EV6mVBUV.js"),c=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-toggle-radius: 10px;
|
|
4
4
|
--ui-toggle-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 74%, transparent);
|
package/dist/toggle.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { E as g } from "./ElementBase-
|
|
1
|
+
import { E as g } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
const u = `
|
|
3
3
|
:host {
|
|
4
4
|
--ui-toggle-radius: 10px;
|
|
@@ -221,8 +221,7 @@ const u = `
|
|
|
221
221
|
}
|
|
222
222
|
`, l = /* @__PURE__ */ new Set(["icon-on", "icon-off", "aria-label"]);
|
|
223
223
|
function c(o) {
|
|
224
|
-
if (o == null)
|
|
225
|
-
return !1;
|
|
224
|
+
if (o == null) return !1;
|
|
226
225
|
const e = String(o).toLowerCase();
|
|
227
226
|
return e !== "false" && e !== "0" && e !== "off";
|
|
228
227
|
}
|
|
@@ -281,8 +280,7 @@ class d extends g {
|
|
|
281
280
|
e ? this.setAttribute("disabled", "") : this.removeAttribute("disabled");
|
|
282
281
|
}
|
|
283
282
|
toggle(e) {
|
|
284
|
-
if (this.disabled)
|
|
285
|
-
return;
|
|
283
|
+
if (this.disabled) return;
|
|
286
284
|
const t = typeof e == "boolean" ? e : !this.pressed;
|
|
287
285
|
if (t === this.pressed) {
|
|
288
286
|
this._syncAria();
|
package/dist/toolbar.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const u=require("./ElementBase-EV6mVBUV.js"),i=require("./roving-focus-group-BdJ_4Njm.js"),b=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-toolbar-gap: 8px;
|
|
4
4
|
--ui-toolbar-padding: 8px;
|