@editora/ui-core 0.1.20 → 0.1.22
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/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +3 -3
- package/dist/alert-dialog.cjs.js +32 -32
- package/dist/alert-dialog.esm.js +95 -75
- package/dist/alert.cjs.js +6 -6
- package/dist/alert.esm.js +6 -6
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +4 -4
- package/dist/animated-text.cjs.js +4 -4
- package/dist/animated-text.esm.js +4 -4
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +3 -3
- package/dist/aspect-ratio.cjs.js +3 -3
- package/dist/aspect-ratio.esm.js +3 -3
- package/dist/avatar.cjs.js +14 -14
- package/dist/avatar.esm.js +31 -29
- package/dist/badge.cjs.js +4 -4
- package/dist/badge.esm.js +4 -4
- package/dist/block-controls.cjs.js +4 -4
- package/dist/block-controls.esm.js +4 -4
- package/dist/box.cjs.js +2 -2
- package/dist/box.esm.js +2 -2
- package/dist/breadcrumb.cjs.js +5 -5
- package/dist/breadcrumb.esm.js +5 -5
- package/dist/button.cjs.js +1 -1
- package/dist/button.esm.js +1 -1
- package/dist/{calendar-DLY4acgn.mjs → calendar-DbxYRdlv.mjs} +227 -183
- package/dist/{calendar-Dkof-FTK.js → calendar-Qa-cFOp3.js} +74 -35
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +1 -1
- package/dist/card.cjs.js +8 -8
- package/dist/card.esm.js +63 -20
- package/dist/chart.cjs.js +4 -4
- package/dist/chart.esm.js +6 -6
- package/dist/checkbox.cjs.js +2 -2
- package/dist/checkbox.esm.js +2 -2
- package/dist/collapsible.cjs.js +7 -7
- package/dist/collapsible.esm.js +7 -7
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +27 -23
- package/dist/color-picker.cjs.js +34 -14
- package/dist/color-picker.esm.js +89 -67
- package/dist/combobox.cjs.js +29 -27
- package/dist/combobox.esm.js +51 -45
- package/dist/command.cjs.js +2 -2
- package/dist/command.esm.js +2 -2
- package/dist/components/ui-alert-dialog.d.ts +1 -0
- package/dist/components/ui-alert-dialog.d.ts.map +1 -1
- package/dist/components/ui-avatar.d.ts +1 -0
- package/dist/components/ui-avatar.d.ts.map +1 -1
- package/dist/components/ui-button.d.ts +1 -0
- package/dist/components/ui-button.d.ts.map +1 -1
- package/dist/components/ui-calendar.d.ts.map +1 -1
- package/dist/components/ui-card.d.ts +3 -0
- package/dist/components/ui-card.d.ts.map +1 -1
- package/dist/components/ui-checkbox.d.ts.map +1 -1
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-color-picker.d.ts.map +1 -1
- package/dist/components/ui-combobox.d.ts.map +1 -1
- package/dist/components/ui-data-table.d.ts.map +1 -1
- package/dist/components/ui-date-field.d.ts.map +1 -1
- package/dist/components/ui-date-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-picker.d.ts.map +1 -1
- package/dist/components/ui-date-range-time-picker.d.ts.map +1 -1
- package/dist/components/ui-date-time-picker.d.ts.map +1 -1
- package/dist/components/ui-dock.d.ts +1 -0
- package/dist/components/ui-dock.d.ts.map +1 -1
- package/dist/components/ui-drawer.d.ts.map +1 -1
- package/dist/components/ui-dropdown.d.ts.map +1 -1
- package/dist/components/ui-field.d.ts.map +1 -1
- package/dist/components/ui-file-upload.d.ts.map +1 -1
- package/dist/components/ui-gantt.d.ts.map +1 -1
- package/dist/components/ui-input.d.ts.map +1 -1
- package/dist/components/ui-menu.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-number-field.d.ts.map +1 -1
- package/dist/components/ui-password-field.d.ts.map +1 -1
- package/dist/components/ui-pin-input.d.ts +1 -0
- package/dist/components/ui-pin-input.d.ts.map +1 -1
- package/dist/components/ui-placement-grid.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-progress.d.ts.map +1 -1
- package/dist/components/ui-radio.d.ts.map +1 -1
- package/dist/components/ui-rating.d.ts +1 -0
- package/dist/components/ui-rating.d.ts.map +1 -1
- package/dist/components/ui-select.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-switch.d.ts.map +1 -1
- package/dist/components/ui-table.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts +1 -0
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-tags-input.d.ts +1 -0
- package/dist/components/ui-tags-input.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-field.d.ts.map +1 -1
- package/dist/components/ui-toggle-group.d.ts.map +1 -1
- package/dist/components/ui-toggle.d.ts.map +1 -1
- package/dist/components/ui-tree.d.ts.map +1 -1
- package/dist/components/ui-wizard.d.ts.map +1 -1
- package/dist/context-menu.cjs.js +3 -3
- package/dist/context-menu.esm.js +4 -4
- package/dist/control-name-BmoI1m3a.js +1 -0
- package/dist/control-name-Bpj7F34X.mjs +48 -0
- package/dist/data-table.cjs.js +5 -2
- package/dist/data-table.esm.js +145 -142
- package/dist/date-field.cjs.js +5 -5
- package/dist/date-field.esm.js +34 -31
- package/dist/date-picker.cjs.js +16 -16
- package/dist/date-picker.esm.js +48 -44
- package/dist/date-range-picker.cjs.js +5 -5
- package/dist/date-range-picker.esm.js +120 -118
- package/dist/date-range-time-picker.cjs.js +22 -22
- package/dist/date-range-time-picker.esm.js +88 -84
- package/dist/date-time-picker.cjs.js +26 -26
- package/dist/date-time-picker.esm.js +105 -101
- package/dist/{date-time-utils-Dmost5Ee.js → date-time-utils-BzfTpeU-.js} +1 -1
- package/dist/{date-time-utils-y1N2gvG2.mjs → date-time-utils-Cps2aSu2.mjs} +1 -1
- package/dist/description.cjs.js +3 -3
- package/dist/description.esm.js +3 -3
- package/dist/dialog.cjs.js +2 -2
- package/dist/dialog.esm.js +2 -2
- package/dist/dock.cjs.js +12 -12
- package/dist/dock.esm.js +72 -74
- package/dist/drawer.cjs.js +19 -19
- package/dist/drawer.esm.js +58 -58
- package/dist/dropdown.cjs.js +13 -13
- package/dist/dropdown.esm.js +49 -48
- package/dist/empty-state.cjs.js +3 -3
- package/dist/empty-state.esm.js +3 -3
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +1 -1
- package/dist/field.cjs.js +12 -12
- package/dist/field.esm.js +84 -75
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +4 -4
- package/dist/file-upload.cjs.js +3 -3
- package/dist/file-upload.esm.js +5 -3
- package/dist/floating-toolbar.cjs.js +8 -8
- package/dist/floating-toolbar.esm.js +9 -9
- package/dist/form.cjs.js +11 -11
- package/dist/form.esm.js +11 -11
- package/dist/gantt.cjs.js +43 -32
- package/dist/gantt.esm.js +99 -88
- package/dist/icon-cloud.cjs.js +3 -3
- package/dist/icon-cloud.esm.js +3 -3
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +121 -118
- package/dist/inline-edit.cjs.js +1 -1
- package/dist/inline-edit.esm.js +1 -1
- package/dist/input.cjs.js +14 -14
- package/dist/input.esm.js +39 -32
- package/dist/label.cjs.js +3 -3
- package/dist/label.esm.js +3 -3
- package/dist/{listbox-B6QgECax.js → listbox-CTpRpuF7.js} +1 -1
- package/dist/{listbox-DJamVeFj.mjs → listbox-hMVOhKHC.mjs} +1 -1
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +1 -1
- package/dist/marquee.cjs.js +3 -3
- package/dist/marquee.esm.js +3 -3
- package/dist/{menu-item-styles-CbNUEwP2.js → menu-item-styles-B4onAr4C.js} +3 -3
- package/dist/{menu-item-styles-CZiPwPwl.mjs → menu-item-styles-IGSFLAHu.mjs} +3 -3
- package/dist/menu.cjs.js +7 -7
- package/dist/menu.esm.js +29 -28
- package/dist/menubar.cjs.js +1 -1
- package/dist/menubar.esm.js +2 -2
- package/dist/meter.cjs.js +1 -1
- package/dist/meter.esm.js +1 -1
- package/dist/multi-select.cjs.js +18 -18
- package/dist/multi-select.esm.js +82 -66
- package/dist/navigation-menu.cjs.js +1 -1
- package/dist/navigation-menu.esm.js +1 -1
- package/dist/number-field.cjs.js +11 -13
- package/dist/number-field.esm.js +29 -27
- package/dist/number-ticker.cjs.js +4 -4
- package/dist/number-ticker.esm.js +4 -4
- package/dist/odometer.cjs.js +2 -2
- package/dist/odometer.esm.js +2 -2
- package/dist/orbiter.cjs.js +3 -3
- package/dist/orbiter.esm.js +3 -3
- package/dist/pagination.cjs.js +1 -1
- package/dist/pagination.esm.js +1 -1
- package/dist/password-field.cjs.js +23 -23
- package/dist/password-field.esm.js +48 -47
- package/dist/pin-input.cjs.js +8 -6
- package/dist/pin-input.esm.js +21 -15
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +58 -58
- package/dist/plugin-panel.cjs.js +1 -1
- package/dist/plugin-panel.esm.js +1 -1
- package/dist/popover.cjs.js +5 -5
- package/dist/popover.esm.js +4 -4
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +11 -10
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +15 -14
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/control-name.d.ts +30 -0
- package/dist/primitives/control-name.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/primitives/trigger.d.ts +2 -0
- package/dist/primitives/trigger.d.ts.map +1 -0
- package/dist/progress.cjs.js +4 -4
- package/dist/progress.esm.js +20 -18
- package/dist/quick-actions.cjs.js +3 -3
- package/dist/quick-actions.esm.js +3 -3
- package/dist/radio-group.cjs.js +1 -1
- package/dist/radio-group.esm.js +1 -1
- package/dist/radio.cjs.js +2 -2
- package/dist/radio.esm.js +2 -2
- package/dist/rating.cjs.js +17 -16
- package/dist/rating.esm.js +91 -92
- package/dist/{runtime-D1gFh1fS.mjs → runtime-CFnK53iC.mjs} +133 -94
- package/dist/runtime-DwE-tizc.js +1 -0
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.d.ts +1 -1
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.esm.js +29 -26
- package/dist/select.cjs.js +20 -19
- package/dist/select.esm.js +36 -32
- package/dist/selection-popup.cjs.js +2 -2
- package/dist/selection-popup.esm.js +2 -2
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +7 -7
- package/dist/separator.esm.js +7 -7
- package/dist/sidebar.cjs.js +7 -7
- package/dist/sidebar.esm.js +7 -7
- package/dist/skeleton.cjs.js +7 -7
- package/dist/skeleton.esm.js +7 -7
- package/dist/slider.cjs.js +3 -3
- package/dist/slider.esm.js +3 -3
- package/dist/slot.cjs.js +3 -3
- package/dist/slot.esm.js +3 -3
- package/dist/sortable.cjs.js +61 -48
- package/dist/sortable.esm.js +636 -554
- package/dist/spinning-text.cjs.js +3 -3
- package/dist/spinning-text.esm.js +3 -3
- package/dist/split-button.cjs.js +1 -1
- package/dist/split-button.esm.js +1 -1
- package/dist/stepper.cjs.js +1 -1
- package/dist/stepper.esm.js +1 -1
- package/dist/switch.cjs.js +10 -12
- package/dist/switch.esm.js +10 -12
- package/dist/table.cjs.js +9 -6
- package/dist/table.esm.js +46 -43
- package/dist/tabs.cjs.js +22 -23
- package/dist/tabs.esm.js +116 -112
- package/dist/tags-input.cjs.js +9 -9
- package/dist/tags-input.esm.js +32 -25
- package/dist/textarea.cjs.js +13 -13
- package/dist/textarea.esm.js +46 -31
- package/dist/theme.d.ts +18 -0
- package/dist/theme.d.ts.map +1 -1
- package/dist/time-field.cjs.js +5 -5
- package/dist/time-field.esm.js +21 -18
- package/dist/time-picker.cjs.js +4 -4
- package/dist/time-picker.esm.js +5 -5
- package/dist/timeline.cjs.js +2 -2
- package/dist/timeline.esm.js +4 -4
- package/dist/toast.cjs.js +6 -6
- package/dist/toast.esm.js +13 -13
- package/dist/toggle-group.cjs.js +5 -6
- package/dist/toggle-group.esm.js +63 -60
- package/dist/toggle.cjs.js +18 -18
- package/dist/toggle.esm.js +32 -31
- package/dist/tooltip.cjs.js +4 -4
- package/dist/tooltip.esm.js +4 -4
- package/dist/transfer-list.cjs.js +32 -32
- package/dist/transfer-list.esm.js +57 -57
- package/dist/tree-7qbVnpGp.js +39 -0
- package/dist/{tree-B3kE8ESs.mjs → tree-Deoft-kO.mjs} +34 -33
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +1 -1
- package/dist/trigger-BjnxLCeQ.mjs +9 -0
- package/dist/trigger-DkPsKxsP.js +1 -0
- package/dist/{ui-button-rXQOS9QJ.js → ui-button-BInsgSbr.js} +27 -26
- package/dist/{ui-button-Q0GNNWKC.mjs → ui-button-rfiuUnUD.mjs} +65 -48
- package/dist/{ui-icon-YI6lyuqU.mjs → ui-icon-BSi_GtqO.mjs} +2 -2
- package/dist/{ui-icon-BzVNC_lr.js → ui-icon-Bvt9oIIR.js} +5 -5
- package/dist/wizard.cjs.js +12 -13
- package/dist/wizard.esm.js +17 -15
- package/package.json +1 -1
- package/dist/runtime-CTaOSmBj.js +0 -1
- package/dist/tree-Dx_kv_ih.js +0 -39
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
import { E as g } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
import { n as b } from "./collection-C7URGjEI.mjs";
|
|
3
3
|
import { UITreeItem as f } from "./tree-item.esm.js";
|
|
4
|
-
function C(
|
|
4
|
+
function C(a, t) {
|
|
5
5
|
const e = [], i = t.getExpanded || (() => !1), r = t.getDisabled || (() => !1), s = (d, n, o) => {
|
|
6
|
-
d.forEach((
|
|
7
|
-
const u = t.getChildren(
|
|
8
|
-
item:
|
|
9
|
-
id: t.getId(
|
|
10
|
-
label: t.getLabel(
|
|
6
|
+
d.forEach((l) => {
|
|
7
|
+
const u = t.getChildren(l) || [], c = {
|
|
8
|
+
item: l,
|
|
9
|
+
id: t.getId(l),
|
|
10
|
+
label: t.getLabel(l),
|
|
11
11
|
level: n,
|
|
12
12
|
parentId: o,
|
|
13
|
-
disabled: r(
|
|
14
|
-
expanded: i(
|
|
13
|
+
disabled: r(l),
|
|
14
|
+
expanded: i(l),
|
|
15
15
|
hasChildren: u.length > 0
|
|
16
16
|
};
|
|
17
17
|
e.push(c), s(u, n + 1, c.id);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
|
-
return s(
|
|
20
|
+
return s(a, 1, null), e;
|
|
21
21
|
}
|
|
22
|
-
function _(
|
|
22
|
+
function _(a, t) {
|
|
23
23
|
const e = [], i = t.getExpanded || (() => !1), r = t.getDisabled || (() => !1), s = (d, n, o) => {
|
|
24
|
-
d.forEach((
|
|
25
|
-
const u = t.getChildren(
|
|
26
|
-
item:
|
|
27
|
-
id: t.getId(
|
|
28
|
-
label: t.getLabel(
|
|
24
|
+
d.forEach((l) => {
|
|
25
|
+
const u = t.getChildren(l) || [], c = i(l), h = {
|
|
26
|
+
item: l,
|
|
27
|
+
id: t.getId(l),
|
|
28
|
+
label: t.getLabel(l),
|
|
29
29
|
level: n,
|
|
30
30
|
parentId: o,
|
|
31
|
-
disabled: r(
|
|
31
|
+
disabled: r(l),
|
|
32
32
|
expanded: c,
|
|
33
33
|
hasChildren: u.length > 0
|
|
34
34
|
};
|
|
35
35
|
e.push(h), h.hasChildren && c && s(u, n + 1, h.id);
|
|
36
36
|
});
|
|
37
37
|
};
|
|
38
|
-
return s(
|
|
38
|
+
return s(a, 1, null), e;
|
|
39
39
|
}
|
|
40
|
-
function p(
|
|
41
|
-
return
|
|
40
|
+
function p(a, t) {
|
|
41
|
+
return a.findIndex((e) => e.id === t);
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
const e =
|
|
45
|
-
return e?.parentId ?
|
|
43
|
+
function y(a, t) {
|
|
44
|
+
const e = a[t];
|
|
45
|
+
return e?.parentId ? a.findIndex((i) => i.id === e.parentId) : -1;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function m(a, t, e = -1) {
|
|
48
48
|
const i = b(t);
|
|
49
49
|
if (!i) return -1;
|
|
50
|
-
for (let r = 1; r <=
|
|
51
|
-
const s = (e + r +
|
|
50
|
+
for (let r = 1; r <= a.length; r += 1) {
|
|
51
|
+
const s = (e + r + a.length) % a.length, d = a[s];
|
|
52
52
|
if (!d.disabled && b(d.label).startsWith(i))
|
|
53
53
|
return s;
|
|
54
54
|
}
|
|
@@ -61,7 +61,7 @@ const v = `
|
|
|
61
61
|
--ui-tree-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 98%, transparent);
|
|
62
62
|
--ui-tree-border: color-mix(in srgb, var(--ui-color-border, #cbd5e1) 72%, transparent);
|
|
63
63
|
--ui-tree-text: var(--ui-color-text, #0f172a);
|
|
64
|
-
--ui-tree-muted: var(--ui-color-muted, #
|
|
64
|
+
--ui-tree-muted: var(--ui-color-muted, #526175);
|
|
65
65
|
display: block;
|
|
66
66
|
min-inline-size: 0;
|
|
67
67
|
color-scheme: light dark;
|
|
@@ -93,7 +93,7 @@ class x extends g {
|
|
|
93
93
|
super(), this._observer = null, this._focusedValue = null, this._typeaheadBuffer = "", this._typeaheadTimer = null, this._onClick = this._onClick.bind(this), this._onKeyDown = this._onKeyDown.bind(this), this._onMutation = this._onMutation.bind(this);
|
|
94
94
|
}
|
|
95
95
|
static get observedAttributes() {
|
|
96
|
-
return ["value", "indent-size"];
|
|
96
|
+
return ["value", "indent-size", "aria-label", "aria-labelledby"];
|
|
97
97
|
}
|
|
98
98
|
connectedCallback() {
|
|
99
99
|
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeyDown), this._observer = new MutationObserver(this._onMutation), this._observer.observe(this, { childList: !0, subtree: !0, attributes: !0, attributeFilter: ["expanded", "selected", "disabled", "label", "value"] }), queueMicrotask(() => this._syncTree());
|
|
@@ -247,7 +247,7 @@ class x extends g {
|
|
|
247
247
|
this.collapse(r.id);
|
|
248
248
|
return;
|
|
249
249
|
}
|
|
250
|
-
const s =
|
|
250
|
+
const s = y(e, i);
|
|
251
251
|
s >= 0 && this.focusValue(e[s].id);
|
|
252
252
|
return;
|
|
253
253
|
}
|
|
@@ -259,18 +259,19 @@ class x extends g {
|
|
|
259
259
|
this._typeaheadBuffer = `${this._typeaheadBuffer}${t.key.toLowerCase()}`.slice(0, 24), this._typeaheadTimer != null && window.clearTimeout(this._typeaheadTimer), this._typeaheadTimer = window.setTimeout(() => {
|
|
260
260
|
this._typeaheadBuffer = "", this._typeaheadTimer = null;
|
|
261
261
|
}, 420);
|
|
262
|
-
const s =
|
|
262
|
+
const s = m(e, this._typeaheadBuffer, i);
|
|
263
263
|
s >= 0 && (t.preventDefault(), this.focusValue(e[s].id));
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
shouldRenderOnAttributeChange(t) {
|
|
268
|
-
return t === "indent-size";
|
|
268
|
+
return t === "indent-size" || t === "aria-label" || t === "aria-labelledby";
|
|
269
269
|
}
|
|
270
270
|
render() {
|
|
271
|
+
const t = (this.getAttribute("aria-label") || "").trim(), e = (this.getAttribute("aria-labelledby") || "").trim(), i = (s) => s.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<"), r = (t ? ` aria-label="${i(t)}"` : "") + (e ? ` aria-labelledby="${i(e)}"` : "");
|
|
271
272
|
this.setContent(`
|
|
272
273
|
<style>${v}</style>
|
|
273
|
-
<div class="tree" part="tree" role="tree">
|
|
274
|
+
<div class="tree" part="tree" role="tree"${r}>
|
|
274
275
|
<slot></slot>
|
|
275
276
|
</div>
|
|
276
277
|
`), queueMicrotask(() => this._syncTree());
|
|
@@ -280,8 +281,8 @@ typeof customElements < "u" && !customElements.get("ui-tree") && customElements.
|
|
|
280
281
|
export {
|
|
281
282
|
x as U,
|
|
282
283
|
p as a,
|
|
283
|
-
|
|
284
|
+
m as b,
|
|
284
285
|
C as c,
|
|
285
286
|
_ as d,
|
|
286
|
-
|
|
287
|
+
y as f
|
|
287
288
|
};
|
package/dist/tree.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tree-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("./tree-7qbVnpGp.js");exports.UITree=e.UITree;
|
package/dist/tree.esm.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const n = 'button, a[href], input, select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"]), ui-button';
|
|
2
|
+
function o(t) {
|
|
3
|
+
if (t.matches(n)) return t;
|
|
4
|
+
const e = t.querySelector(n);
|
|
5
|
+
return e || (t.hasAttribute("role") || t.setAttribute("role", "button"), t.hasAttribute("tabindex") || t.setAttribute("tabindex", "0"), t);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
o as r
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n='button, a[href], input, select, textarea, summary, [role="button"], [tabindex]:not([tabindex="-1"]), ui-button';function o(t){if(t.matches(n))return t;const e=t.querySelector(n);return e||(t.hasAttribute("role")||t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t)}exports.resolveTriggerControl=o;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const P=require("./ElementBase-EV6mVBUV.js");require("./ui-icon-Bvt9oIIR.js");const I=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-btn-radius: var(--ui-control-radius, var(--ui-radius, 4px));
|
|
4
4
|
--ui-btn-min-height: var(--ui-control-min-height, var(--base-button-height-md, 40px));
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
--ui-btn-surface: var(--ui-color-surface, #ffffff);
|
|
18
18
|
--ui-btn-surface-alt: var(--ui-color-surface-alt, #f8fafc);
|
|
19
19
|
--ui-btn-text: var(--ui-color-text, #0f172a);
|
|
20
|
-
--ui-btn-muted: var(--ui-color-muted, #
|
|
20
|
+
--ui-btn-muted: var(--ui-color-muted, #526175);
|
|
21
21
|
--ui-btn-ring: var(--ui-color-focus-ring, #2563eb);
|
|
22
22
|
|
|
23
23
|
display: inline-flex;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
:host([tone="neutral"]) {
|
|
36
|
-
--ui-btn-accent: color-mix(in srgb, var(--ui-color-muted, #
|
|
36
|
+
--ui-btn-accent: color-mix(in srgb, var(--ui-color-muted, #526175) 74%, var(--ui-color-text, #0f172a) 26%);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
:host([tone="info"]) {
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
:host([tone="success"]) {
|
|
44
|
-
--ui-btn-accent: var(--ui-color-success, #
|
|
44
|
+
--ui-btn-accent: var(--ui-color-success, #15803d);
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
:host([tone="warning"]) {
|
|
48
|
-
--ui-btn-accent: var(--ui-color-warning, #
|
|
48
|
+
--ui-btn-accent: var(--ui-color-warning, #b45309);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
:host([tone="danger"]) {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
:host([state="success"]) {
|
|
60
|
-
--ui-btn-accent: var(--ui-color-success, #
|
|
60
|
+
--ui-btn-accent: var(--ui-color-success, #15803d);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
:host([theme="dark"]) {
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
:host([recipe="soft"]) {
|
|
88
|
-
--ui-btn-surface: color-mix(in srgb, var(--ui-btn-accent) 10%,
|
|
89
|
-
--ui-btn-surface-alt: color-mix(in srgb, var(--ui-btn-accent) 14%,
|
|
88
|
+
--ui-btn-surface: color-mix(in srgb, var(--ui-btn-accent) 10%, var(--ui-color-surface, #ffffff));
|
|
89
|
+
--ui-btn-surface-alt: color-mix(in srgb, var(--ui-btn-accent) 14%, var(--ui-color-surface, #ffffff));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
:host([recipe="soft"]) .btn--secondary {
|
|
@@ -229,7 +229,8 @@
|
|
|
229
229
|
|
|
230
230
|
.btn--primary {
|
|
231
231
|
background: var(--ui-btn-accent);
|
|
232
|
-
|
|
232
|
+
/* The theme's text colour for a primary fill: the default theme's amber needs dark text. */
|
|
233
|
+
color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
233
234
|
border-color: color-mix(in srgb, var(--ui-btn-accent) 74%, #0f172a 26%);
|
|
234
235
|
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-btn-accent) 22%, transparent);
|
|
235
236
|
}
|
|
@@ -240,7 +241,7 @@
|
|
|
240
241
|
|
|
241
242
|
.btn--secondary {
|
|
242
243
|
background: var(--ui-btn-surface);
|
|
243
|
-
color: color-mix(in srgb, var(--ui-btn-accent)
|
|
244
|
+
color: color-mix(in srgb, var(--ui-btn-accent) 50%, var(--ui-btn-text) 50%);
|
|
244
245
|
border-color: color-mix(in srgb, var(--ui-btn-accent) 22%, var(--ui-btn-muted));
|
|
245
246
|
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.06);
|
|
246
247
|
}
|
|
@@ -251,7 +252,7 @@
|
|
|
251
252
|
|
|
252
253
|
.btn--ghost {
|
|
253
254
|
background: transparent;
|
|
254
|
-
color: color-mix(in srgb, var(--ui-btn-accent)
|
|
255
|
+
color: color-mix(in srgb, var(--ui-btn-accent) 50%, var(--ui-btn-text) 50%);
|
|
255
256
|
border-color: transparent;
|
|
256
257
|
box-shadow: none;
|
|
257
258
|
}
|
|
@@ -272,25 +273,25 @@
|
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
.btn--success {
|
|
275
|
-
background: var(--ui-color-success, #
|
|
276
|
+
background: var(--ui-color-success, #15803d);
|
|
276
277
|
color: #ffffff;
|
|
277
|
-
border-color: color-mix(in srgb, var(--ui-color-success, #
|
|
278
|
-
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-success, #
|
|
278
|
+
border-color: color-mix(in srgb, var(--ui-color-success, #15803d) 70%, #0f172a 30%);
|
|
279
|
+
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-success, #15803d) 20%, transparent);
|
|
279
280
|
}
|
|
280
281
|
|
|
281
282
|
.btn--success:hover:not([disabled]) {
|
|
282
|
-
background: color-mix(in srgb, var(--ui-color-success, #
|
|
283
|
+
background: color-mix(in srgb, var(--ui-color-success, #15803d) 86%, #0f172a 14%);
|
|
283
284
|
}
|
|
284
285
|
|
|
285
286
|
.btn--warning {
|
|
286
|
-
background: var(--ui-color-warning, #
|
|
287
|
+
background: var(--ui-color-warning, #b45309);
|
|
287
288
|
color: #ffffff;
|
|
288
|
-
border-color: color-mix(in srgb, var(--ui-color-warning, #
|
|
289
|
-
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-warning, #
|
|
289
|
+
border-color: color-mix(in srgb, var(--ui-color-warning, #b45309) 70%, #0f172a 30%);
|
|
290
|
+
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-warning, #b45309) 18%, transparent);
|
|
290
291
|
}
|
|
291
292
|
|
|
292
293
|
.btn--warning:hover:not([disabled]) {
|
|
293
|
-
background: color-mix(in srgb, var(--ui-color-warning, #
|
|
294
|
+
background: color-mix(in srgb, var(--ui-color-warning, #b45309) 86%, #0f172a 14%);
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
:host([size="sm"]) {
|
|
@@ -318,7 +319,7 @@
|
|
|
318
319
|
}
|
|
319
320
|
|
|
320
321
|
:host([state="success"]) .btn:not([disabled]) {
|
|
321
|
-
box-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-success, #
|
|
322
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-success, #15803d) 30%, transparent), 0 8px 18px rgba(22, 163, 74, 0.14);
|
|
322
323
|
}
|
|
323
324
|
|
|
324
325
|
:host([data-animation]) .btn:not([disabled]):hover {
|
|
@@ -501,21 +502,21 @@
|
|
|
501
502
|
color: HighlightText;
|
|
502
503
|
}
|
|
503
504
|
}
|
|
504
|
-
`;function
|
|
505
|
-
<style>${
|
|
505
|
+
`;function S(t){return t!==null&&t.toLowerCase()!=="false"&&t!=="0"}function U(t){return t==="secondary"||t==="ghost"||t==="danger"||t==="success"||t==="warning"?t:"primary"}function N(t){return t==="sm"||t==="lg"?t:"md"}function C(t){return t==="scale"||t==="pulse"||t==="none"?t:null}function W(t){return t==="neutral"||t==="info"||t==="success"||t==="warning"||t==="danger"?t:null}function G(t){return t==="loading"||t==="error"||t==="success"?t:"idle"}function $(t){return t==="submit"||t==="reset"?t:"button"}function J(t){return t==="classic"||t==="solid"||t==="soft"||t==="surface"||t==="outline"||t==="ghost"?t:null}function K(t){return t==="none"||t==="sm"||t==="md"||t==="lg"||t==="full"?t:null}function Q(t){return t==="1"||t==="2"||t==="3"||t==="4"?t:null}function V(t){if(!t)return null;const n=t.trim();return n?n==="full"?"999px":/^-?\d+(\.\d+)?$/.test(n)?`${n}px`:n:null}function r(t,n){const e=t.getAttribute(n);if(e!=null)return e;const i=t[n];return typeof i=="string"&&i.length>0?i:null}function c(t,n){const e=t.getAttribute(n);if(e!=null)return S(e);const i=t[n];return typeof i=="boolean"?i:typeof i=="string"?S(i):!1}function u(t){return t.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function E(t,n){return!!t.querySelector(`[slot="${n}"]`)}function X(t,n){if(n==="button")return;const e=t.closest("form");if(!e)return;if(n==="reset"){e.reset();return}if(typeof e.requestSubmit=="function"){e.requestSubmit();return}const i=new Event("submit",{bubbles:!0,cancelable:!0});e.dispatchEvent(i)}const T=["aria-expanded","aria-haspopup","aria-pressed"];class L extends P.ElementBase{constructor(){super(),this._slots=[],this._contentObserver=null,this._onRootClick=this._onRootClick.bind(this),this._onSlotChange=this._onSlotChange.bind(this),this._onContentMutations=this._onContentMutations.bind(this)}static get observedAttributes(){return["disabled","variant","size","headless","loading","icon","block","animation","theme","tone","state","type","recipe","shape","radius","scale","loading-label","aria-label","aria-expanded","aria-haspopup","aria-pressed"]}connectedCallback(){super.connectedCallback(),this.root.addEventListener("click",this._onRootClick),this._contentObserver=new MutationObserver(this._onContentMutations),this._contentObserver.observe(this,{childList:!0,subtree:!1,characterData:!0})}disconnectedCallback(){this.root.removeEventListener("click",this._onRootClick),this._contentObserver?.disconnect(),this._contentObserver=null,this._detachSlotListeners(),super.disconnectedCallback()}attributeChangedCallback(n,e,i){if(e!==i){if(n==="animation"){const o=C(i);o?this.setAttribute("data-animation",o):this.removeAttribute("data-animation")}if(T.includes(n)){this._syncForwardedState();return}this.isConnected&&this.requestRender()}}_syncForwardedState(){const n=this.root.querySelector('button[data-ui-button="true"]');if(n)for(const e of T){const i=this.getAttribute(e);i==null||i===""?n.removeAttribute(e):n.getAttribute(e)!==i&&n.setAttribute(e,i)}}_onRootClick(n){const i=n.target?.closest('button[data-ui-button="true"]');if(!i||i.disabled)return;const o=$(i.getAttribute("data-request-type"));queueMicrotask(()=>{n.defaultPrevented||X(this,o)})}_attachSlotListeners(){this._detachSlotListeners(),this._slots=Array.from(this.root.querySelectorAll("slot")),this._slots.forEach(n=>n.addEventListener("slotchange",this._onSlotChange))}_detachSlotListeners(){this._slots.forEach(n=>n.removeEventListener("slotchange",this._onSlotChange)),this._slots=[]}_onSlotChange(){this.requestRender()}_onContentMutations(){this.requestRender()}render(){const n=c(this,"disabled"),e=c(this,"loading"),i=r(this,"state"),o=G(i),s=e||o==="loading",l=r(this,"icon"),q=U(r(this,"variant")),b=r(this,"size"),d=N(b),h=C(r(this,"animation")),a=r(this,"theme"),p=a==="dark"||a==="brand"?a:null,f=r(this,"tone"),g=W(f),R=c(this,"block"),M=c(this,"headless"),B=$(r(this,"type")),m=J(r(this,"recipe")),x=r(this,"shape"),v=K(x),O=r(this,"radius"),y=V(O),w=Q(r(this,"scale")),k=r(this,"aria-label"),j=r(this,"loading-label")||"Loading";h?this.setAttribute("data-animation",h):this.removeAttribute("data-animation"),R?this.setAttribute("block",""):this.removeAttribute("block"),M?this.setAttribute("headless",""):this.removeAttribute("headless"),f!=null&&(g?this.setAttribute("tone",g):this.removeAttribute("tone")),b!=null&&(d==="md"?this.removeAttribute("size"):this.setAttribute("size",d)),a!=null&&(p?this.setAttribute("theme",p):this.removeAttribute("theme")),i!=null&&(o==="idle"?this.removeAttribute("state"):this.setAttribute("state",o)),m?this.setAttribute("recipe",m):this.removeAttribute("recipe"),x!=null&&(v?this.setAttribute("shape",v):this.removeAttribute("shape")),y?this.style.setProperty("--ui-btn-radius",y):this.style.removeProperty("--ui-btn-radius"),w?this.setAttribute("scale",w):this.removeAttribute("scale");const A=n||s;A?this.setAttribute("aria-disabled","true"):this.removeAttribute("aria-disabled"),s?this.setAttribute("aria-busy","true"):this.removeAttribute("aria-busy");const F=E(this,"prefix"),H=E(this,"suffix"),z=!s&&l?`<ui-icon class="icon" name="${u(l)}" aria-hidden="true"></ui-icon>`:"",_=s?'<span class="spinner" aria-hidden="true" part="spinner"></span>':"",Y=_||z||F?`<span class="slot slot--prefix" part="prefix">${_}${z}${s?"":'<slot name="prefix"></slot>'}</span>`:"",D=H?'<span class="slot slot--suffix" part="suffix"><slot name="suffix"></slot></span>':"";this.setContent(`
|
|
506
|
+
<style>${I}</style>
|
|
506
507
|
<button
|
|
507
508
|
class="btn btn--${q}"
|
|
508
509
|
part="button"
|
|
509
510
|
type="button"
|
|
510
511
|
data-ui-button="true"
|
|
511
|
-
data-request-type="${
|
|
512
|
+
data-request-type="${B}"
|
|
512
513
|
aria-busy="${s?"true":"false"}"
|
|
513
514
|
${k?`aria-label="${u(k)}"`:""}
|
|
514
|
-
${
|
|
515
|
+
${A?"disabled":""}
|
|
515
516
|
>
|
|
516
517
|
${Y}
|
|
517
518
|
<span class="slot slot--label" part="label"><slot></slot></span>
|
|
518
|
-
${
|
|
519
|
+
${D}
|
|
519
520
|
${s?`<span class="sr-only">${u(j)}</span>`:""}
|
|
520
521
|
</button>
|
|
521
|
-
`),this._attachSlotListeners()}}typeof customElements<"u"&&!customElements.get("ui-button")&&customElements.define("ui-button",
|
|
522
|
+
`),this._syncForwardedState(),this._attachSlotListeners()}}typeof customElements<"u"&&!customElements.get("ui-button")&&customElements.define("ui-button",L);exports.UIButton=L;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { E as
|
|
2
|
-
import "./ui-icon-
|
|
3
|
-
const
|
|
1
|
+
import { E as D } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
|
+
import "./ui-icon-BSi_GtqO.mjs";
|
|
3
|
+
const P = `
|
|
4
4
|
:host {
|
|
5
5
|
--ui-btn-radius: var(--ui-control-radius, var(--ui-radius, 4px));
|
|
6
6
|
--ui-btn-min-height: var(--ui-control-min-height, var(--base-button-height-md, 40px));
|
|
@@ -19,7 +19,7 @@ const D = `
|
|
|
19
19
|
--ui-btn-surface: var(--ui-color-surface, #ffffff);
|
|
20
20
|
--ui-btn-surface-alt: var(--ui-color-surface-alt, #f8fafc);
|
|
21
21
|
--ui-btn-text: var(--ui-color-text, #0f172a);
|
|
22
|
-
--ui-btn-muted: var(--ui-color-muted, #
|
|
22
|
+
--ui-btn-muted: var(--ui-color-muted, #526175);
|
|
23
23
|
--ui-btn-ring: var(--ui-color-focus-ring, #2563eb);
|
|
24
24
|
|
|
25
25
|
display: inline-flex;
|
|
@@ -35,7 +35,7 @@ const D = `
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
:host([tone="neutral"]) {
|
|
38
|
-
--ui-btn-accent: color-mix(in srgb, var(--ui-color-muted, #
|
|
38
|
+
--ui-btn-accent: color-mix(in srgb, var(--ui-color-muted, #526175) 74%, var(--ui-color-text, #0f172a) 26%);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
:host([tone="info"]) {
|
|
@@ -43,11 +43,11 @@ const D = `
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
:host([tone="success"]) {
|
|
46
|
-
--ui-btn-accent: var(--ui-color-success, #
|
|
46
|
+
--ui-btn-accent: var(--ui-color-success, #15803d);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
:host([tone="warning"]) {
|
|
50
|
-
--ui-btn-accent: var(--ui-color-warning, #
|
|
50
|
+
--ui-btn-accent: var(--ui-color-warning, #b45309);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
:host([tone="danger"]) {
|
|
@@ -59,7 +59,7 @@ const D = `
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
:host([state="success"]) {
|
|
62
|
-
--ui-btn-accent: var(--ui-color-success, #
|
|
62
|
+
--ui-btn-accent: var(--ui-color-success, #15803d);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
:host([theme="dark"]) {
|
|
@@ -87,8 +87,8 @@ const D = `
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
:host([recipe="soft"]) {
|
|
90
|
-
--ui-btn-surface: color-mix(in srgb, var(--ui-btn-accent) 10%,
|
|
91
|
-
--ui-btn-surface-alt: color-mix(in srgb, var(--ui-btn-accent) 14%,
|
|
90
|
+
--ui-btn-surface: color-mix(in srgb, var(--ui-btn-accent) 10%, var(--ui-color-surface, #ffffff));
|
|
91
|
+
--ui-btn-surface-alt: color-mix(in srgb, var(--ui-btn-accent) 14%, var(--ui-color-surface, #ffffff));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
:host([recipe="soft"]) .btn--secondary {
|
|
@@ -231,7 +231,8 @@ const D = `
|
|
|
231
231
|
|
|
232
232
|
.btn--primary {
|
|
233
233
|
background: var(--ui-btn-accent);
|
|
234
|
-
|
|
234
|
+
/* The theme's text colour for a primary fill: the default theme's amber needs dark text. */
|
|
235
|
+
color: var(--ui-color-foreground-on-primary, #ffffff);
|
|
235
236
|
border-color: color-mix(in srgb, var(--ui-btn-accent) 74%, #0f172a 26%);
|
|
236
237
|
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-btn-accent) 22%, transparent);
|
|
237
238
|
}
|
|
@@ -242,7 +243,7 @@ const D = `
|
|
|
242
243
|
|
|
243
244
|
.btn--secondary {
|
|
244
245
|
background: var(--ui-btn-surface);
|
|
245
|
-
color: color-mix(in srgb, var(--ui-btn-accent)
|
|
246
|
+
color: color-mix(in srgb, var(--ui-btn-accent) 50%, var(--ui-btn-text) 50%);
|
|
246
247
|
border-color: color-mix(in srgb, var(--ui-btn-accent) 22%, var(--ui-btn-muted));
|
|
247
248
|
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.06);
|
|
248
249
|
}
|
|
@@ -253,7 +254,7 @@ const D = `
|
|
|
253
254
|
|
|
254
255
|
.btn--ghost {
|
|
255
256
|
background: transparent;
|
|
256
|
-
color: color-mix(in srgb, var(--ui-btn-accent)
|
|
257
|
+
color: color-mix(in srgb, var(--ui-btn-accent) 50%, var(--ui-btn-text) 50%);
|
|
257
258
|
border-color: transparent;
|
|
258
259
|
box-shadow: none;
|
|
259
260
|
}
|
|
@@ -274,25 +275,25 @@ const D = `
|
|
|
274
275
|
}
|
|
275
276
|
|
|
276
277
|
.btn--success {
|
|
277
|
-
background: var(--ui-color-success, #
|
|
278
|
+
background: var(--ui-color-success, #15803d);
|
|
278
279
|
color: #ffffff;
|
|
279
|
-
border-color: color-mix(in srgb, var(--ui-color-success, #
|
|
280
|
-
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-success, #
|
|
280
|
+
border-color: color-mix(in srgb, var(--ui-color-success, #15803d) 70%, #0f172a 30%);
|
|
281
|
+
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-success, #15803d) 20%, transparent);
|
|
281
282
|
}
|
|
282
283
|
|
|
283
284
|
.btn--success:hover:not([disabled]) {
|
|
284
|
-
background: color-mix(in srgb, var(--ui-color-success, #
|
|
285
|
+
background: color-mix(in srgb, var(--ui-color-success, #15803d) 86%, #0f172a 14%);
|
|
285
286
|
}
|
|
286
287
|
|
|
287
288
|
.btn--warning {
|
|
288
|
-
background: var(--ui-color-warning, #
|
|
289
|
+
background: var(--ui-color-warning, #b45309);
|
|
289
290
|
color: #ffffff;
|
|
290
|
-
border-color: color-mix(in srgb, var(--ui-color-warning, #
|
|
291
|
-
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-warning, #
|
|
291
|
+
border-color: color-mix(in srgb, var(--ui-color-warning, #b45309) 70%, #0f172a 30%);
|
|
292
|
+
box-shadow: 0 1px 2px rgba(2, 6, 23, 0.12), 0 8px 18px color-mix(in srgb, var(--ui-color-warning, #b45309) 18%, transparent);
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
.btn--warning:hover:not([disabled]) {
|
|
295
|
-
background: color-mix(in srgb, var(--ui-color-warning, #
|
|
296
|
+
background: color-mix(in srgb, var(--ui-color-warning, #b45309) 86%, #0f172a 14%);
|
|
296
297
|
}
|
|
297
298
|
|
|
298
299
|
:host([size="sm"]) {
|
|
@@ -320,7 +321,7 @@ const D = `
|
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
:host([state="success"]) .btn:not([disabled]) {
|
|
323
|
-
box-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-success, #
|
|
324
|
+
box-shadow: 0 0 0 1px color-mix(in srgb, var(--ui-color-success, #15803d) 30%, transparent), 0 8px 18px rgba(22, 163, 74, 0.14);
|
|
324
325
|
}
|
|
325
326
|
|
|
326
327
|
:host([data-animation]) .btn:not([disabled]):hover {
|
|
@@ -504,22 +505,22 @@ const D = `
|
|
|
504
505
|
}
|
|
505
506
|
}
|
|
506
507
|
`;
|
|
507
|
-
function
|
|
508
|
+
function S(t) {
|
|
508
509
|
return t !== null && t.toLowerCase() !== "false" && t !== "0";
|
|
509
510
|
}
|
|
510
|
-
function
|
|
511
|
+
function U(t) {
|
|
511
512
|
return t === "secondary" || t === "ghost" || t === "danger" || t === "success" || t === "warning" ? t : "primary";
|
|
512
513
|
}
|
|
513
|
-
function
|
|
514
|
+
function I(t) {
|
|
514
515
|
return t === "sm" || t === "lg" ? t : "md";
|
|
515
516
|
}
|
|
516
|
-
function
|
|
517
|
+
function C(t) {
|
|
517
518
|
return t === "scale" || t === "pulse" || t === "none" ? t : null;
|
|
518
519
|
}
|
|
519
|
-
function
|
|
520
|
+
function N(t) {
|
|
520
521
|
return t === "neutral" || t === "info" || t === "success" || t === "warning" || t === "danger" ? t : null;
|
|
521
522
|
}
|
|
522
|
-
function
|
|
523
|
+
function W(t) {
|
|
523
524
|
return t === "loading" || t === "error" || t === "success" ? t : "idle";
|
|
524
525
|
}
|
|
525
526
|
function $(t) {
|
|
@@ -547,14 +548,14 @@ function r(t, n) {
|
|
|
547
548
|
}
|
|
548
549
|
function c(t, n) {
|
|
549
550
|
const e = t.getAttribute(n);
|
|
550
|
-
if (e != null) return
|
|
551
|
+
if (e != null) return S(e);
|
|
551
552
|
const i = t[n];
|
|
552
|
-
return typeof i == "boolean" ? i : typeof i == "string" ?
|
|
553
|
+
return typeof i == "boolean" ? i : typeof i == "string" ? S(i) : !1;
|
|
553
554
|
}
|
|
554
555
|
function u(t) {
|
|
555
556
|
return t.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
556
557
|
}
|
|
557
|
-
function
|
|
558
|
+
function E(t, n) {
|
|
558
559
|
return !!t.querySelector(`[slot="${n}"]`);
|
|
559
560
|
}
|
|
560
561
|
function V(t, n) {
|
|
@@ -572,7 +573,8 @@ function V(t, n) {
|
|
|
572
573
|
const i = new Event("submit", { bubbles: !0, cancelable: !0 });
|
|
573
574
|
e.dispatchEvent(i);
|
|
574
575
|
}
|
|
575
|
-
|
|
576
|
+
const T = ["aria-expanded", "aria-haspopup", "aria-pressed"];
|
|
577
|
+
class X extends D {
|
|
576
578
|
constructor() {
|
|
577
579
|
super(), this._slots = [], this._contentObserver = null, this._onRootClick = this._onRootClick.bind(this), this._onSlotChange = this._onSlotChange.bind(this), this._onContentMutations = this._onContentMutations.bind(this);
|
|
578
580
|
}
|
|
@@ -595,7 +597,10 @@ class W extends P {
|
|
|
595
597
|
"radius",
|
|
596
598
|
"scale",
|
|
597
599
|
"loading-label",
|
|
598
|
-
"aria-label"
|
|
600
|
+
"aria-label",
|
|
601
|
+
"aria-expanded",
|
|
602
|
+
"aria-haspopup",
|
|
603
|
+
"aria-pressed"
|
|
599
604
|
];
|
|
600
605
|
}
|
|
601
606
|
connectedCallback() {
|
|
@@ -607,12 +612,24 @@ class W extends P {
|
|
|
607
612
|
attributeChangedCallback(n, e, i) {
|
|
608
613
|
if (e !== i) {
|
|
609
614
|
if (n === "animation") {
|
|
610
|
-
const o =
|
|
615
|
+
const o = C(i);
|
|
611
616
|
o ? this.setAttribute("data-animation", o) : this.removeAttribute("data-animation");
|
|
612
617
|
}
|
|
618
|
+
if (T.includes(n)) {
|
|
619
|
+
this._syncForwardedState();
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
613
622
|
this.isConnected && this.requestRender();
|
|
614
623
|
}
|
|
615
624
|
}
|
|
625
|
+
_syncForwardedState() {
|
|
626
|
+
const n = this.root.querySelector('button[data-ui-button="true"]');
|
|
627
|
+
if (n)
|
|
628
|
+
for (const e of T) {
|
|
629
|
+
const i = this.getAttribute(e);
|
|
630
|
+
i == null || i === "" ? n.removeAttribute(e) : n.getAttribute(e) !== i && n.setAttribute(e, i);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
616
633
|
_onRootClick(n) {
|
|
617
634
|
const i = n.target?.closest('button[data-ui-button="true"]');
|
|
618
635
|
if (!i || i.disabled) return;
|
|
@@ -634,32 +651,32 @@ class W extends P {
|
|
|
634
651
|
this.requestRender();
|
|
635
652
|
}
|
|
636
653
|
render() {
|
|
637
|
-
const n = c(this, "disabled"), e = c(this, "loading"), i = r(this, "state"), o =
|
|
638
|
-
h ? this.setAttribute("data-animation", h) : this.removeAttribute("data-animation"),
|
|
639
|
-
const
|
|
640
|
-
|
|
641
|
-
const j =
|
|
654
|
+
const n = c(this, "disabled"), e = c(this, "loading"), i = r(this, "state"), o = W(i), s = e || o === "loading", l = r(this, "icon"), L = U(r(this, "variant")), b = r(this, "size"), d = I(b), h = C(r(this, "animation")), a = r(this, "theme"), p = a === "dark" || a === "brand" ? a : null, f = r(this, "tone"), g = N(f), R = c(this, "block"), q = c(this, "headless"), M = $(r(this, "type")), m = G(r(this, "recipe")), x = r(this, "shape"), v = J(x), B = r(this, "radius"), y = Q(B), w = K(r(this, "scale")), k = r(this, "aria-label"), O = r(this, "loading-label") || "Loading";
|
|
655
|
+
h ? this.setAttribute("data-animation", h) : this.removeAttribute("data-animation"), R ? this.setAttribute("block", "") : this.removeAttribute("block"), q ? this.setAttribute("headless", "") : this.removeAttribute("headless"), f != null && (g ? this.setAttribute("tone", g) : this.removeAttribute("tone")), b != null && (d === "md" ? this.removeAttribute("size") : this.setAttribute("size", d)), a != null && (p ? this.setAttribute("theme", p) : this.removeAttribute("theme")), i != null && (o === "idle" ? this.removeAttribute("state") : this.setAttribute("state", o)), m ? this.setAttribute("recipe", m) : this.removeAttribute("recipe"), x != null && (v ? this.setAttribute("shape", v) : this.removeAttribute("shape")), y ? this.style.setProperty("--ui-btn-radius", y) : this.style.removeProperty("--ui-btn-radius"), w ? this.setAttribute("scale", w) : this.removeAttribute("scale");
|
|
656
|
+
const A = n || s;
|
|
657
|
+
A ? this.setAttribute("aria-disabled", "true") : this.removeAttribute("aria-disabled"), s ? this.setAttribute("aria-busy", "true") : this.removeAttribute("aria-busy");
|
|
658
|
+
const j = E(this, "prefix"), F = E(this, "suffix"), z = !s && l ? `<ui-icon class="icon" name="${u(l)}" aria-hidden="true"></ui-icon>` : "", _ = s ? '<span class="spinner" aria-hidden="true" part="spinner"></span>' : "", H = _ || z || j ? `<span class="slot slot--prefix" part="prefix">${_}${z}${s ? "" : '<slot name="prefix"></slot>'}</span>` : "", Y = F ? '<span class="slot slot--suffix" part="suffix"><slot name="suffix"></slot></span>' : "";
|
|
642
659
|
this.setContent(`
|
|
643
|
-
<style>${
|
|
660
|
+
<style>${P}</style>
|
|
644
661
|
<button
|
|
645
|
-
class="btn btn--${
|
|
662
|
+
class="btn btn--${L}"
|
|
646
663
|
part="button"
|
|
647
664
|
type="button"
|
|
648
665
|
data-ui-button="true"
|
|
649
|
-
data-request-type="${
|
|
666
|
+
data-request-type="${M}"
|
|
650
667
|
aria-busy="${s ? "true" : "false"}"
|
|
651
668
|
${k ? `aria-label="${u(k)}"` : ""}
|
|
652
|
-
${
|
|
669
|
+
${A ? "disabled" : ""}
|
|
653
670
|
>
|
|
654
|
-
${
|
|
671
|
+
${H}
|
|
655
672
|
<span class="slot slot--label" part="label"><slot></slot></span>
|
|
656
673
|
${Y}
|
|
657
|
-
${s ? `<span class="sr-only">${u(
|
|
674
|
+
${s ? `<span class="sr-only">${u(O)}</span>` : ""}
|
|
658
675
|
</button>
|
|
659
|
-
`), this._attachSlotListeners();
|
|
676
|
+
`), this._syncForwardedState(), this._attachSlotListeners();
|
|
660
677
|
}
|
|
661
678
|
}
|
|
662
|
-
typeof customElements < "u" && !customElements.get("ui-button") && customElements.define("ui-button",
|
|
679
|
+
typeof customElements < "u" && !customElements.get("ui-button") && customElements.define("ui-button", X);
|
|
663
680
|
export {
|
|
664
|
-
|
|
681
|
+
X as U
|
|
665
682
|
};
|
|
@@ -189,8 +189,8 @@ const z = `
|
|
|
189
189
|
}
|
|
190
190
|
|
|
191
191
|
:host([tone="brand"]) { --ui-icon-color: var(--ui-color-primary, var(--ui-primary, #2563eb)); }
|
|
192
|
-
:host([tone="success"]) { --ui-icon-color: var(--ui-color-success, var(--ui-success, #
|
|
193
|
-
:host([tone="warning"]) { --ui-icon-color: var(--ui-color-warning, var(--ui-warning, #
|
|
192
|
+
:host([tone="success"]) { --ui-icon-color: var(--ui-color-success, var(--ui-success, #15803d)); }
|
|
193
|
+
:host([tone="warning"]) { --ui-icon-color: var(--ui-color-warning, var(--ui-warning, #b45309)); }
|
|
194
194
|
:host([tone="danger"]) { --ui-icon-color: var(--ui-color-danger, var(--ui-error, #dc2626)); }
|
|
195
195
|
|
|
196
196
|
:host([shape="square"]) { --ui-icon-radius: 4px; }
|