@voidable/ui 0.11.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/angular/index.d.ts +2 -2
- package/dist/angular/index.js +2 -1
- package/dist/chunks/activation-B8aBarKd.js +4 -0
- package/dist/chunks/carousel-C9u0bg5l.js +10 -0
- package/dist/chunks/choice-BTrsi7OW.js +16 -0
- package/dist/chunks/data-Baycjoo4.js +96 -0
- package/dist/chunks/fields-MEqz-olE.js +21 -0
- package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
- package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
- package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
- package/dist/chunks/menu-CxRRgkJI.js +21 -0
- package/dist/chunks/{modal-DWGkNdNG.js → modal-Cz2-Ov76.js} +23 -15
- package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
- package/dist/chunks/{overlay-CH7L4N-h.js → overlay-BuV-4Yvt.js} +75 -68
- package/dist/chunks/overlay-K1ilWC1p.js +4 -0
- package/dist/chunks/pickers-CjlFgNke.js +36 -0
- package/dist/chunks/table-BBpqwWEi.js +4 -0
- package/dist/chunks/tabs-Buf3EBWq.js +10 -0
- package/dist/components/accordion.d.ts +7 -0
- package/dist/components/accordion.js +22 -14
- package/dist/components/action-input.d.ts +2 -1
- package/dist/components/action-input.js +59 -55
- package/dist/components/bar-chart.js +41 -40
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +15 -11
- package/dist/components/button.d.ts +7 -0
- package/dist/components/button.js +23 -16
- package/dist/components/calendar.d.ts +45 -10
- package/dist/components/calendar.js +183 -129
- package/dist/components/carousel.d.ts +22 -0
- package/dist/components/carousel.js +64 -35
- package/dist/components/charts/data.d.ts +2 -2
- package/dist/components/checkbox-group.js +22 -21
- package/dist/components/checkbox.d.ts +7 -0
- package/dist/components/checkbox.js +29 -24
- package/dist/components/collapsible.d.ts +7 -0
- package/dist/components/collapsible.js +19 -11
- package/dist/components/color-picker.js +28 -27
- package/dist/components/combobox.d.ts +13 -1
- package/dist/components/combobox.js +54 -41
- package/dist/components/compose-input.d.ts +9 -1
- package/dist/components/compose-input.js +28 -16
- package/dist/components/dialog.js +1 -1
- package/dist/components/donut-chart.js +57 -56
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.d.ts +22 -0
- package/dist/components/dropdown-menu.js +54 -39
- package/dist/components/editable.d.ts +11 -1
- package/dist/components/editable.js +35 -22
- package/dist/components/error-fallback.d.ts +4 -2
- package/dist/components/error-fallback.js +34 -28
- package/dist/components/file-upload.d.ts +9 -0
- package/dist/components/file-upload.js +54 -28
- package/dist/components/gauge.js +108 -107
- package/dist/components/hamburger.d.ts +7 -0
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +7 -0
- package/dist/components/hover-card.js +22 -14
- package/dist/components/indicator.js +15 -14
- package/dist/components/input.js +1 -1
- package/dist/components/line-chart.js +43 -42
- package/dist/components/menu.d.ts +25 -0
- package/dist/components/menu.js +55 -33
- package/dist/components/multiselect.d.ts +17 -1
- package/dist/components/multiselect.js +96 -74
- package/dist/components/nav-menu.d.ts +9 -0
- package/dist/components/nav-menu.js +30 -23
- package/dist/components/number-input.d.ts +15 -1
- package/dist/components/number-input.js +71 -37
- package/dist/components/pagination.js +25 -24
- package/dist/components/pin-input.d.ts +11 -0
- package/dist/components/pin-input.js +46 -32
- package/dist/components/popover.d.ts +7 -0
- package/dist/components/popover.js +21 -13
- package/dist/components/radio-group.js +1 -1
- package/dist/components/radio.d.ts +10 -1
- package/dist/components/radio.js +37 -32
- package/dist/components/segmented-control.d.ts +14 -0
- package/dist/components/segmented-control.js +40 -28
- package/dist/components/sidebar.d.ts +1 -0
- package/dist/components/sidebar.js +14 -10
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +5 -3
- package/dist/components/spinner.js +21 -14
- package/dist/components/stat.js +1 -1
- package/dist/components/status-dot.d.ts +2 -2
- package/dist/components/status-dot.js +12 -14
- package/dist/components/stepper.d.ts +2 -0
- package/dist/components/stepper.js +20 -13
- package/dist/components/switch.d.ts +7 -0
- package/dist/components/switch.js +24 -16
- package/dist/components/table.d.ts +77 -1
- package/dist/components/table.js +562 -73
- package/dist/components/tabs.d.ts +11 -0
- package/dist/components/tabs.js +42 -33
- package/dist/components/tag.js +12 -11
- package/dist/components/tags-input.d.ts +10 -1
- package/dist/components/tags-input.js +42 -30
- package/dist/components/textarea.js +1 -1
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +35 -28
- package/dist/components/toggle-group.d.ts +8 -0
- package/dist/components/toggle-group.js +24 -17
- package/dist/components/toggle.d.ts +7 -0
- package/dist/components/toggle.js +23 -15
- package/dist/components/tooltip.d.ts +7 -0
- package/dist/components/tooltip.js +20 -12
- package/dist/components.json +96 -74
- package/dist/custom-elements.json +4213 -131
- package/dist/dev/rules.d.ts +0 -1
- package/dist/dev/types.d.ts +3 -1
- package/dist/dev.js +244 -113
- package/dist/index.d.ts +4 -0
- package/dist/index.js +68 -66
- package/dist/keyboard-activation.d.ts +9 -9
- package/dist/keyboard.d.ts +2 -10
- package/dist/keymaps/activation.d.ts +8 -0
- package/dist/keymaps/carousel.d.ts +9 -0
- package/dist/keymaps/choice.d.ts +21 -0
- package/dist/keymaps/fields.d.ts +31 -0
- package/dist/keymaps/index.d.ts +2 -0
- package/dist/keymaps/menu.d.ts +36 -0
- package/dist/keymaps/nav-menu.d.ts +11 -0
- package/dist/keymaps/overlay.d.ts +4 -0
- package/dist/keymaps/pickers.d.ts +36 -0
- package/dist/keymaps/table.d.ts +8 -0
- package/dist/keymaps/tabs.d.ts +7 -0
- package/dist/keymaps.js +51 -0
- package/dist/keys.d.ts +46 -0
- package/dist/keys.js +57 -0
- package/dist/llms.txt +11 -3
- package/dist/messages/ar.d.ts +1 -0
- package/dist/messages/ar.js +130 -0
- package/dist/messages/fr.d.ts +1 -0
- package/dist/messages/fr.js +109 -0
- package/dist/messages.d.ts +213 -0
- package/dist/messages.js +190 -0
- package/dist/modal.d.ts +7 -0
- package/dist/reference.md +817 -17
- package/dist/testing/index.d.ts +46 -0
- package/dist/testing.js +79 -0
- package/dist/types/elements.d.ts +89 -73
- package/dist/types/react.d.ts +5 -1
- package/dist/types/solid.d.ts +5 -1
- package/dist/types/solid2.d.ts +4 -0
- package/dist/types/svelte.d.ts +5 -1
- package/dist/types/vue.d.ts +5 -1
- package/dist/vscode.html-custom-data.json +384 -18
- package/dist/web-types.json +830 -69
- package/package.json +22 -2
- package/dist/chunks/data-BpiiNapL.js +0 -95
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { t as l } from "../chunks/
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { r } from "../chunks/projection-oPe6ipjL.js";
|
|
5
|
+
import { i, n as a, o, r as s, s as c, t as l } from "../chunks/data-Baycjoo4.js";
|
|
6
|
+
import { t as u } from "../chunks/shape-C_LW7EjG.js";
|
|
7
|
+
import { html as d, nothing as f, svg as p } from "lit";
|
|
8
|
+
import { property as m, state as h } from "lit/decorators.js";
|
|
9
|
+
import { guard as g } from "lit/directives/guard.js";
|
|
9
10
|
//#region src/components/donut-chart.ts
|
|
10
|
-
|
|
11
|
-
function
|
|
11
|
+
r();
|
|
12
|
+
function _(e) {
|
|
12
13
|
return Number.isFinite(e) ? e : 0;
|
|
13
14
|
}
|
|
14
|
-
function
|
|
15
|
+
function v(e) {
|
|
15
16
|
return 1 - (1 - e) ** 3;
|
|
16
17
|
}
|
|
17
|
-
function
|
|
18
|
+
function y(e) {
|
|
18
19
|
return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
|
|
19
20
|
}
|
|
20
|
-
function
|
|
21
|
+
function b(e) {
|
|
21
22
|
return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
|
|
22
23
|
}
|
|
23
|
-
var
|
|
24
|
+
var x = class extends e {
|
|
24
25
|
constructor(...e) {
|
|
25
26
|
super(...e), this.size = 220, this.inner = .6, this.gaps = !1, this.variant = "filled", this.showValue = !1, this.showTotal = !1, this.ariaLabel = "", this.showTable = !1, this._data = { segments: [] }, this._source = { text: null }, this._entered = !1, this._phase = "pre", this._hoverSegment = null, this._hoverX = 0, this._hoverY = 0, this._progress = 0, this._progressFrom = 0, this._displayValues = /* @__PURE__ */ new Map(), this._targetValues = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._displayTotal = 0, this._displayTotalFrom = 0, this._targetTotal = 0, this._animStart = 0, this._animDuration = 0, this._rafHandle = 0, this._onMouseMove = (e) => {
|
|
26
27
|
let t = this.querySelector("svg");
|
|
@@ -38,7 +39,7 @@ var b = class extends e {
|
|
|
38
39
|
f < 0 && (f += 2 * Math.PI);
|
|
39
40
|
let p = 2 * Math.PI, m = 0;
|
|
40
41
|
for (let e = 0; e < n.length; e++) {
|
|
41
|
-
let t =
|
|
42
|
+
let t = _(n[e].value) / this._targetTotal * p;
|
|
42
43
|
if (f >= m && f < m + t) {
|
|
43
44
|
this._hoverSegment !== e && (this._hoverSegment = e), this._hoverX = i, this._hoverY = a;
|
|
44
45
|
return;
|
|
@@ -49,7 +50,7 @@ var b = class extends e {
|
|
|
49
50
|
}, this._onMouseLeave = () => {
|
|
50
51
|
this._hoverSegment = null;
|
|
51
52
|
}, this._tick = (e) => {
|
|
52
|
-
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r =
|
|
53
|
+
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = v(n);
|
|
53
54
|
this._progress = this._progressFrom + (1 - this._progressFrom) * r;
|
|
54
55
|
for (let [e, t] of this._targetValues) {
|
|
55
56
|
let n = this._animFrom.get(e) ?? 0;
|
|
@@ -62,31 +63,31 @@ var b = class extends e {
|
|
|
62
63
|
return this._data;
|
|
63
64
|
}
|
|
64
65
|
set data(e) {
|
|
65
|
-
let t =
|
|
66
|
+
let t = o(e, this._source, {
|
|
66
67
|
attr: "data",
|
|
67
68
|
shape: "{\"segments\":[{\"name\":\"Search\",\"value\":40},{\"name\":\"Direct\",\"value\":25}]}",
|
|
68
69
|
empty: () => ({ segments: [] }),
|
|
69
70
|
normalize: (e) => {
|
|
70
|
-
if (!
|
|
71
|
-
let t =
|
|
71
|
+
if (!s(e)) return null;
|
|
72
|
+
let t = i(e.segments ?? []);
|
|
72
73
|
return t ? { segments: t } : null;
|
|
73
74
|
},
|
|
74
75
|
warn: (e, t) => this.reportDev("invalid-data", e, t)
|
|
75
76
|
});
|
|
76
77
|
if (!t) return;
|
|
77
|
-
let n = t.value,
|
|
78
|
+
let n = t.value, r = this._data.segments, a = this._progress, c = new Map(this._displayValues), l = this._displayTotal;
|
|
78
79
|
this._data = n, this._refreshTargets(), this.requestUpdate(), this._entered && this.updateComplete.then(() => {
|
|
79
80
|
let e = /* @__PURE__ */ new Map();
|
|
80
|
-
for (let t = 0; t <
|
|
81
|
+
for (let t = 0; t < r.length; t++) e.set(t, c.get(t) ?? 0);
|
|
81
82
|
for (let t = 0; t < n.segments.length; t++) e.has(t) || e.set(t, 0);
|
|
82
|
-
this._startAnimation(e, l,
|
|
83
|
+
this._startAnimation(e, l, a >= 1 ? 1 : a, !1);
|
|
83
84
|
});
|
|
84
85
|
}
|
|
85
86
|
_refreshTargets() {
|
|
86
87
|
this._targetValues.clear();
|
|
87
88
|
let e = this._data.segments;
|
|
88
|
-
for (let t = 0; t < e.length; t++) this._targetValues.set(t,
|
|
89
|
-
this._targetTotal = e.reduce((e, t) => e +
|
|
89
|
+
for (let t = 0; t < e.length; t++) this._targetValues.set(t, _(e[t].value));
|
|
90
|
+
this._targetTotal = e.reduce((e, t) => e + _(t.value), 0);
|
|
90
91
|
}
|
|
91
92
|
connectedCallback() {
|
|
92
93
|
super.connectedCallback(), this.setHostAttribute("role", "figure"), this._refreshTargets(), requestAnimationFrame(() => {
|
|
@@ -106,65 +107,65 @@ var b = class extends e {
|
|
|
106
107
|
this._phase = "animating", this._rafHandle = requestAnimationFrame(this._tick);
|
|
107
108
|
}
|
|
108
109
|
render() {
|
|
109
|
-
let { segments: e } = this._data, t = e.reduce((e, t) => e +
|
|
110
|
-
if (e.length === 0 || t === 0) return
|
|
111
|
-
let n = this.size / 2, r = this.size / 2, i = this.size / 2 - 4, a = i * this.inner, o = Math.max(this._displayTotal, .001), s = 2 * Math.PI, c = -Math.PI / 2 + this._progress * s,
|
|
110
|
+
let { segments: e } = this._data, t = e.reduce((e, t) => e + _(t.value), 0);
|
|
111
|
+
if (e.length === 0 || t === 0) return d`<svg viewBox="0 0 ${this.size} ${this.size}" aria-hidden="true"></svg>${this._table()}`;
|
|
112
|
+
let n = this.size / 2, r = this.size / 2, i = this.size / 2 - 4, a = i * this.inner, o = Math.max(this._displayTotal, .001), s = 2 * Math.PI, c = -Math.PI / 2 + this._progress * s, l = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * s, m = e.filter((e, t) => (this._displayValues.get(t) ?? 0) > 0).length, h = (m > 1 ? l / e.length : 0) / 2, g = [], v = -Math.PI / 2;
|
|
112
113
|
for (let t = 0; t < e.length; t++) {
|
|
113
|
-
let
|
|
114
|
-
if (
|
|
115
|
-
let e =
|
|
116
|
-
|
|
114
|
+
let l = e[t], d = this._displayValues.get(t) ?? 0, f = v, _ = f + d / o * s, y = Math.min(_, c);
|
|
115
|
+
if (y > f + .001) {
|
|
116
|
+
let e = l.color ?? `var(--void-chart-series-${t % 6 + 1})`, o = f + h, c = m === 1 && y >= f + s - 1e-9 ? o + s : Math.max(o + .001, y - h);
|
|
117
|
+
g.push(p`
|
|
117
118
|
<path
|
|
118
119
|
class="void-donut-chart-segment"
|
|
119
|
-
d=${
|
|
120
|
+
d=${u(n, r, i, o, c, a)}
|
|
120
121
|
style="--segment-color: ${e}"
|
|
121
122
|
data-segment-index=${t}
|
|
122
123
|
></path>
|
|
123
124
|
`);
|
|
124
125
|
}
|
|
125
|
-
|
|
126
|
+
v = _;
|
|
126
127
|
}
|
|
127
|
-
return
|
|
128
|
+
return d`
|
|
128
129
|
<svg
|
|
129
130
|
viewBox="0 0 ${this.size} ${this.size}"
|
|
130
131
|
aria-hidden="true"
|
|
131
132
|
data-phase=${this._phase}
|
|
132
133
|
>
|
|
133
|
-
${
|
|
134
|
-
${this.showTotal ?
|
|
134
|
+
${g}
|
|
135
|
+
${this.showTotal ? p`
|
|
135
136
|
<g class="void-donut-chart-total">
|
|
136
|
-
<text x=${n} y=${r} text-anchor="middle" dy="0.32em">${
|
|
137
|
+
<text x=${n} y=${r} text-anchor="middle" dy="0.32em">${y(this._displayTotal)}</text>
|
|
137
138
|
</g>
|
|
138
|
-
` :
|
|
139
|
-
${this.showValue ?
|
|
139
|
+
` : f}
|
|
140
|
+
${this.showValue ? p`
|
|
140
141
|
<g class="void-donut-chart-labels">
|
|
141
142
|
${e.map((e, t) => {
|
|
142
143
|
let c = this._displayValues.get(t) ?? 0;
|
|
143
|
-
if (c < .001) return
|
|
144
|
+
if (c < .001) return f;
|
|
144
145
|
let l = -Math.PI / 2;
|
|
145
146
|
for (let e = 0; e < t; e++) l += (this._displayValues.get(e) ?? 0) / o * s;
|
|
146
|
-
let u = l + c / o * s / 2,
|
|
147
|
-
return
|
|
147
|
+
let u = l + c / o * s / 2, d = (i + a) / 2;
|
|
148
|
+
return p`<text x=${n + d * Math.cos(u)} y=${r + d * Math.sin(u)} text-anchor="middle" dy="0.32em">${b(c)}</text>`;
|
|
148
149
|
})}
|
|
149
150
|
</g>
|
|
150
|
-
` :
|
|
151
|
+
` : f}
|
|
151
152
|
|
|
152
|
-
${this._hoverSegment !== null && this._hoverSegment < e.length ? this._renderHoverTooltip(e, this._hoverSegment) :
|
|
153
|
+
${this._hoverSegment !== null && this._hoverSegment < e.length ? this._renderHoverTooltip(e, this._hoverSegment) : f}
|
|
153
154
|
</svg>
|
|
154
155
|
${this._table()}
|
|
155
156
|
`;
|
|
156
157
|
}
|
|
157
158
|
_table() {
|
|
158
|
-
let e = this._data.segments, t = this.ariaLabel || "
|
|
159
|
-
return
|
|
159
|
+
let e = this._data.segments, t = this.ariaLabel || n(this, "chart.donut");
|
|
160
|
+
return g([
|
|
160
161
|
e,
|
|
161
162
|
t,
|
|
162
|
-
|
|
163
|
-
], () =>
|
|
163
|
+
l(this)
|
|
164
|
+
], () => a("void-donut-chart-table", c(this, t, e)));
|
|
164
165
|
}
|
|
165
166
|
_renderHoverTooltip(e, t) {
|
|
166
|
-
let n = e[t], r = this._displayValues.get(t) ??
|
|
167
|
-
return c < 8 && (c = 8), c + 44 > this.size - 8 && (c = this.size - 44 - 8),
|
|
167
|
+
let n = e[t], r = this._displayValues.get(t) ?? _(n.value), i = [...this._displayValues.values()].reduce((e, t) => e + t, 0) || this._targetTotal || 1, a = Math.round(r / i * 100), o = this.size / 2, s = this._hoverX < o ? this.size - 140 - 8 : 8, c = this._hoverY - 44 / 2;
|
|
168
|
+
return c < 8 && (c = 8), c + 44 > this.size - 8 && (c = this.size - 44 - 8), p`
|
|
168
169
|
<g class="void-donut-chart-hover" pointer-events="none">
|
|
169
170
|
<rect
|
|
170
171
|
class="void-donut-chart-tooltip-bg"
|
|
@@ -181,15 +182,15 @@ var b = class extends e {
|
|
|
181
182
|
class="void-donut-chart-tooltip-value"
|
|
182
183
|
x=${s + 8}
|
|
183
184
|
y=${c + 8 + 14 + 10}
|
|
184
|
-
>${
|
|
185
|
+
>${b(r)} <tspan class="void-donut-chart-tooltip-pct">(${a}%)</tspan></text>
|
|
185
186
|
</g>
|
|
186
187
|
`;
|
|
187
188
|
}
|
|
188
189
|
};
|
|
189
|
-
t([
|
|
190
|
+
t([m({
|
|
190
191
|
type: Number,
|
|
191
192
|
reflect: !0
|
|
192
|
-
})],
|
|
193
|
+
})], x.prototype, "size", void 0), t([m({ type: Number })], x.prototype, "inner", void 0), t([m({ converter: {
|
|
193
194
|
fromAttribute(e) {
|
|
194
195
|
if (e === null || e === "" || e === "true") return !0;
|
|
195
196
|
if (e === "false") return !1;
|
|
@@ -199,18 +200,18 @@ t([p({
|
|
|
199
200
|
toAttribute(e) {
|
|
200
201
|
return e === !0 ? "" : e === !1 ? "false" : String(e);
|
|
201
202
|
}
|
|
202
|
-
} })],
|
|
203
|
+
} })], x.prototype, "gaps", void 0), t([m({ reflect: !0 })], x.prototype, "variant", void 0), t([m({
|
|
203
204
|
type: Boolean,
|
|
204
205
|
attribute: "show-value",
|
|
205
206
|
reflect: !0
|
|
206
|
-
})],
|
|
207
|
+
})], x.prototype, "showValue", void 0), t([m({
|
|
207
208
|
type: Boolean,
|
|
208
209
|
attribute: "show-total",
|
|
209
210
|
reflect: !0
|
|
210
|
-
})],
|
|
211
|
+
})], x.prototype, "showTotal", void 0), t([m({ attribute: "aria-label" })], x.prototype, "ariaLabel", void 0), t([m({
|
|
211
212
|
type: Boolean,
|
|
212
213
|
attribute: "show-table",
|
|
213
214
|
reflect: !0
|
|
214
|
-
})],
|
|
215
|
+
})], x.prototype, "showTable", void 0), t([m({ attribute: "data" })], x.prototype, "data", null), t([h()], x.prototype, "_phase", void 0), t([h()], x.prototype, "_hoverSegment", void 0), t([h()], x.prototype, "_hoverX", void 0), t([h()], x.prototype, "_hoverY", void 0), customElements.get("void-donut-chart") || customElements.define("void-donut-chart", x);
|
|
215
216
|
//#endregion
|
|
216
|
-
export {
|
|
217
|
+
export { x as VoidDonutChart };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as e } from "../chunks/decorate-CaYbmmmm.js";
|
|
2
|
-
import { t } from "../chunks/modal-
|
|
2
|
+
import { t } from "../chunks/modal-Cz2-Ov76.js";
|
|
3
3
|
import { property as n } from "lit/decorators.js";
|
|
4
4
|
//#region src/components/drawer.ts
|
|
5
5
|
var r = class extends t {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
2
|
import { KeyboardActivation } from '../keyboard-activation.js';
|
|
3
|
+
import { KeyOverrides } from '../keys.js';
|
|
3
4
|
import { OverlayController } from '../overlay.js';
|
|
4
5
|
import { PartsController } from '../parts.js';
|
|
5
6
|
/**
|
|
@@ -24,6 +25,21 @@ import { PartsController } from '../parts.js';
|
|
|
24
25
|
* The menu is closing. Cancelable when the user caused it (every reason but `parent` and `api`).
|
|
25
26
|
*/
|
|
26
27
|
export declare class VoidDropdownMenu extends VoidElement {
|
|
28
|
+
/** Key bindings for this element's actions, as JSON (`{"close":[]}`); `[]` switches an action off. See the keyboard guide. */
|
|
29
|
+
keys: KeyOverrides | null;
|
|
30
|
+
/** @internal The actions of this element and their default keys. */
|
|
31
|
+
static readonly keyMap: {
|
|
32
|
+
leave: string[];
|
|
33
|
+
next: string[];
|
|
34
|
+
previous: string[];
|
|
35
|
+
first: string[];
|
|
36
|
+
last: string[];
|
|
37
|
+
typeahead: string[];
|
|
38
|
+
close: string[];
|
|
39
|
+
open: string[];
|
|
40
|
+
openLast: string[];
|
|
41
|
+
activate: string[];
|
|
42
|
+
};
|
|
27
43
|
/** Whether the menu is open. A click on the trigger toggles it; choosing an item, Escape, Tab or a press outside closes it. */
|
|
28
44
|
open: boolean;
|
|
29
45
|
/** Side of the trigger the menu opens on; it flips to the opposite side when there is no room. */
|
|
@@ -61,6 +77,12 @@ export declare class VoidDropdownMenu extends VoidElement {
|
|
|
61
77
|
* @fires {CustomEvent<{ item: VoidDropdownMenuItem; value: string }>} void-select - The item was chosen.
|
|
62
78
|
*/
|
|
63
79
|
export declare class VoidDropdownMenuItem extends VoidElement {
|
|
80
|
+
/** Key bindings for this element's actions, as JSON (`{"activate":["Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
81
|
+
keys: KeyOverrides | null;
|
|
82
|
+
/** @internal The actions of this element and their default keys. */
|
|
83
|
+
static readonly keyMap: {
|
|
84
|
+
activate: string[];
|
|
85
|
+
};
|
|
64
86
|
/** What the item stands for, passed as `detail.value` of `void-select` (empty when not set). */
|
|
65
87
|
value: string;
|
|
66
88
|
/** Enter and Space fire a real `click`, as on a native button. */
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { t as i } from "../chunks/keyboard-activation-BfEyoaMT.js";
|
|
5
|
+
import { t as a } from "../chunks/activation-B8aBarKd.js";
|
|
6
|
+
import { i as o, n as s } from "../chunks/parts-DI_3VpSy.js";
|
|
7
|
+
import { r as c, t as l } from "../chunks/keyboard-ChtDvhB_.js";
|
|
8
|
+
import { t as u } from "../chunks/overlay-BuV-4Yvt.js";
|
|
9
|
+
import { n as d, r as f, t as p } from "../chunks/menu-CxRRgkJI.js";
|
|
10
|
+
import { property as m } from "lit/decorators.js";
|
|
8
11
|
//#region src/components/dropdown-menu.ts
|
|
9
|
-
var
|
|
12
|
+
var h = class extends e {
|
|
10
13
|
constructor(...e) {
|
|
11
|
-
super(...e), this.open = !1, this.side = "bottom", this.align = "start", this._parts = new
|
|
14
|
+
super(...e), this.keys = null, this.open = !1, this.side = "bottom", this.align = "start", this._parts = new s(this, {
|
|
12
15
|
tags: [
|
|
13
16
|
"void-dropdown-menu-trigger",
|
|
14
17
|
"void-dropdown-menu-content",
|
|
@@ -18,7 +21,7 @@ var u = class extends e {
|
|
|
18
21
|
onChange: () => {
|
|
19
22
|
this._wire(), this.requestUpdate();
|
|
20
23
|
}
|
|
21
|
-
}), this._focusLast = !1, this._typeahead = new
|
|
24
|
+
}), this._focusLast = !1, this._typeahead = new l(), this._overlay = new u(this, {
|
|
22
25
|
kind: "menu",
|
|
23
26
|
surface: () => this._content(),
|
|
24
27
|
isOpen: () => this.open,
|
|
@@ -46,34 +49,37 @@ var u = class extends e {
|
|
|
46
49
|
t && t.contains(e.target) && this._overlay.toggle("trigger");
|
|
47
50
|
}, this._handleSelect = (e) => {
|
|
48
51
|
let t = e.target;
|
|
49
|
-
!(t instanceof
|
|
52
|
+
!(t instanceof _) || !this._parts.owns(t) || t.keepOpen || this._overlay.requestClose("select");
|
|
50
53
|
}, this._handleKeydown = (e) => {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
let t = e.target, r = this._triggerEl;
|
|
55
|
+
if (r && this._parts.one("void-dropdown-menu-trigger")?.contains(t)) {
|
|
56
|
+
let i = n(this, e, f);
|
|
57
|
+
i === "open" || i === "openLast" ? (e.preventDefault(), this._openAndFocus(i === "open" ? "first" : "last")) : i === "activate" && !g(r, t) && (e.preventDefault(), this.open ? this._overlay.requestClose("trigger") : this._openAndFocus("first"));
|
|
55
58
|
return;
|
|
56
59
|
}
|
|
57
|
-
let
|
|
58
|
-
if (!this.open || !
|
|
59
|
-
let
|
|
60
|
-
if (
|
|
61
|
-
else if (
|
|
62
|
-
else if (
|
|
63
|
-
else if (
|
|
64
|
-
else if (
|
|
60
|
+
let i = this._content(), a = t.closest("void-dropdown-menu-item");
|
|
61
|
+
if (!this.open || !i?.contains(t) || !a) return;
|
|
62
|
+
let o = this._items(), s = o.indexOf(a), l = o.map(() => !1), u, p = n(this, e, d);
|
|
63
|
+
if (p === "next") u = o[c(l, s, 1)];
|
|
64
|
+
else if (p === "previous") u = o[c(l, s, -1)];
|
|
65
|
+
else if (p === "first") u = o[0];
|
|
66
|
+
else if (p === "last") u = o[o.length - 1];
|
|
67
|
+
else if (p === "leave") {
|
|
65
68
|
this._overlay.requestClose("blur");
|
|
66
69
|
return;
|
|
67
|
-
} else if (
|
|
68
|
-
let t = this._typeahead.match(e.key,
|
|
69
|
-
t >= 0 && (e.preventDefault(),
|
|
70
|
+
} else if (p === "typeahead" && e.key !== " ") {
|
|
71
|
+
let t = this._typeahead.match(e.key, o.map((e) => e.textContent ?? ""), l, s);
|
|
72
|
+
t >= 0 && (e.preventDefault(), o[t].focus());
|
|
70
73
|
return;
|
|
71
74
|
} else return;
|
|
72
75
|
e.preventDefault(), u?.focus();
|
|
73
76
|
};
|
|
74
77
|
}
|
|
78
|
+
static {
|
|
79
|
+
this.keyMap = p;
|
|
80
|
+
}
|
|
75
81
|
get _triggerEl() {
|
|
76
|
-
return
|
|
82
|
+
return o(this._parts.one("void-dropdown-menu-trigger"));
|
|
77
83
|
}
|
|
78
84
|
_content() {
|
|
79
85
|
return this._parts.one("void-dropdown-menu-content");
|
|
@@ -103,24 +109,27 @@ var u = class extends e {
|
|
|
103
109
|
this._focusLast = e === "last", this._overlay.requestOpen("keyboard");
|
|
104
110
|
}
|
|
105
111
|
};
|
|
106
|
-
t([
|
|
112
|
+
t([m({
|
|
113
|
+
attribute: "keys",
|
|
114
|
+
converter: r
|
|
115
|
+
})], h.prototype, "keys", void 0), t([m({
|
|
107
116
|
type: Boolean,
|
|
108
117
|
reflect: !0
|
|
109
|
-
})],
|
|
118
|
+
})], h.prototype, "open", void 0), t([m({
|
|
110
119
|
type: String,
|
|
111
120
|
reflect: !0
|
|
112
|
-
})],
|
|
121
|
+
})], h.prototype, "side", void 0), t([m({
|
|
113
122
|
type: String,
|
|
114
123
|
reflect: !0
|
|
115
|
-
})],
|
|
116
|
-
function
|
|
124
|
+
})], h.prototype, "align", void 0);
|
|
125
|
+
function g(e, t) {
|
|
117
126
|
let n = t.closest("button, a[href], input, summary");
|
|
118
127
|
return !!n && e.contains(n);
|
|
119
128
|
}
|
|
120
|
-
customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu",
|
|
121
|
-
var
|
|
129
|
+
customElements.get("void-dropdown-menu") || customElements.define("void-dropdown-menu", h);
|
|
130
|
+
var _ = class extends e {
|
|
122
131
|
constructor(...e) {
|
|
123
|
-
super(...e), this.value = "", this._activation = new
|
|
132
|
+
super(...e), this.keys = null, this.value = "", this._activation = new i(this, { disabled: () => this.disabled }), this.disabled = !1, this.destructive = !1, this.keepOpen = !1, this._handleClick = (e) => {
|
|
124
133
|
if (this.disabled) {
|
|
125
134
|
e.stopImmediatePropagation();
|
|
126
135
|
return;
|
|
@@ -135,6 +144,9 @@ var f = class extends e {
|
|
|
135
144
|
}));
|
|
136
145
|
};
|
|
137
146
|
}
|
|
147
|
+
static {
|
|
148
|
+
this.keyMap = a;
|
|
149
|
+
}
|
|
138
150
|
connectedCallback() {
|
|
139
151
|
super.connectedCallback(), this.setHostAttribute("role", "menuitem"), this.setHostAttribute("tabindex", "-1"), this.addEventListener("click", this._handleClick);
|
|
140
152
|
}
|
|
@@ -145,19 +157,22 @@ var f = class extends e {
|
|
|
145
157
|
e.has("disabled") && this.setHostAttribute("aria-disabled", this.disabled ? "true" : null);
|
|
146
158
|
}
|
|
147
159
|
};
|
|
148
|
-
t([
|
|
160
|
+
t([m({
|
|
161
|
+
attribute: "keys",
|
|
162
|
+
converter: r
|
|
163
|
+
})], _.prototype, "keys", void 0), t([m({
|
|
149
164
|
type: String,
|
|
150
165
|
reflect: !0
|
|
151
|
-
})],
|
|
166
|
+
})], _.prototype, "value", void 0), t([m({
|
|
152
167
|
type: Boolean,
|
|
153
168
|
reflect: !0
|
|
154
|
-
})],
|
|
169
|
+
})], _.prototype, "disabled", void 0), t([m({
|
|
155
170
|
type: Boolean,
|
|
156
171
|
reflect: !0
|
|
157
|
-
})],
|
|
172
|
+
})], _.prototype, "destructive", void 0), t([m({
|
|
158
173
|
type: Boolean,
|
|
159
174
|
reflect: !0,
|
|
160
175
|
attribute: "keep-open"
|
|
161
|
-
})],
|
|
176
|
+
})], _.prototype, "keepOpen", void 0), customElements.get("void-dropdown-menu-item") || customElements.define("void-dropdown-menu-item", _);
|
|
162
177
|
//#endregion
|
|
163
|
-
export {
|
|
178
|
+
export { h as VoidDropdownMenu, _ as VoidDropdownMenuItem };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
+
import { KeyOverrides } from '../keys.js';
|
|
2
3
|
declare const VoidEditable_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
3
4
|
/**
|
|
4
5
|
* Inline editable text for renaming items, editing headings, and click-to-edit table cells.
|
|
@@ -9,6 +10,14 @@ declare const VoidEditable_base: (new (...args: any[]) => import('../form-contro
|
|
|
9
10
|
* the previous value. Use `both` (default) or `blur` to commit on blur.
|
|
10
11
|
*/
|
|
11
12
|
export declare class VoidEditable extends VoidEditable_base {
|
|
13
|
+
/** Key bindings for this element's actions, as JSON (`{"cancel":[]}`); `[]` switches an action off. See the keyboard guide. */
|
|
14
|
+
keys: KeyOverrides | null;
|
|
15
|
+
/** @internal The actions of this element and their default keys. */
|
|
16
|
+
static readonly keyMap: {
|
|
17
|
+
submit: string[];
|
|
18
|
+
cancel: string[];
|
|
19
|
+
activate: string[];
|
|
20
|
+
};
|
|
12
21
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
13
22
|
static labelTarget: string;
|
|
14
23
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
@@ -25,8 +34,9 @@ export declare class VoidEditable extends VoidEditable_base {
|
|
|
25
34
|
editing: boolean;
|
|
26
35
|
/** Stop the field entering edit mode and exclude the value from the form submission. */
|
|
27
36
|
disabled: boolean;
|
|
28
|
-
/** Text shown while the value is empty and the field is not being edited. Defaults to `Click to edit
|
|
37
|
+
/** Text shown while the value is empty and the field is not being edited. Defaults to the `editable.placeholder` message (English: `Click to edit`). */
|
|
29
38
|
placeholder: string;
|
|
39
|
+
private get _hint();
|
|
30
40
|
/**
|
|
31
41
|
* How an edit is committed: `enter` only on Enter (blur cancels), `blur` only when focus leaves, or
|
|
32
42
|
* `both` (default).
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { msg as i } from "../messages.js";
|
|
5
|
+
import { t as a } from "../chunks/form-control-fL-Hhy91.js";
|
|
6
|
+
import { n as o } from "../chunks/projection-oPe6ipjL.js";
|
|
7
|
+
import { i as s, n as c, r as l } from "../chunks/fields-MEqz-olE.js";
|
|
8
|
+
import { html as u, nothing as d } from "lit";
|
|
9
|
+
import { property as f } from "lit/decorators.js";
|
|
10
|
+
import { live as p } from "lit/directives/live.js";
|
|
8
11
|
//#region src/components/editable.ts
|
|
9
|
-
var
|
|
12
|
+
var m = class extends a(e) {
|
|
10
13
|
constructor(...e) {
|
|
11
|
-
super(...e), this.value = "", this.editing = !1, this.disabled = !1, this.placeholder = "
|
|
14
|
+
super(...e), this.keys = null, this.value = "", this.editing = !1, this.disabled = !1, this.placeholder = "", this.submitMode = "both", this.size = "md", this._previousValue = "", this._draft = null, this._handleClick = () => {
|
|
12
15
|
this.formDisabled || this.editing || this._enterEditMode();
|
|
13
16
|
}, this._handlePreviewKeydown = (e) => {
|
|
14
|
-
this.formDisabled || this.editing || (e
|
|
17
|
+
this.formDisabled || this.editing || n(this, e, s) === "activate" && (e.preventDefault(), this._enterEditMode());
|
|
15
18
|
}, this._handleInput = (e) => {
|
|
16
19
|
if (!this.editing) return;
|
|
17
20
|
let t = e.target.value;
|
|
@@ -21,21 +24,28 @@ var c = class extends n(e) {
|
|
|
21
24
|
detail: { value: t }
|
|
22
25
|
}));
|
|
23
26
|
}, this._handleInputKeydown = (e) => {
|
|
24
|
-
|
|
27
|
+
let t = n(this, e, c);
|
|
28
|
+
if (t === "cancel") {
|
|
25
29
|
e.preventDefault(), this._cancel();
|
|
26
30
|
return;
|
|
27
31
|
}
|
|
28
|
-
|
|
32
|
+
t === "submit" && (this.submitMode === "enter" || this.submitMode === "both") && (e.preventDefault(), this._confirm());
|
|
29
33
|
}, this._handleBlur = () => {
|
|
30
|
-
!this.editing ||
|
|
34
|
+
!this.editing || o(this) || (this.submitMode === "blur" || this.submitMode === "both" ? this._confirm() : this._cancel());
|
|
31
35
|
};
|
|
32
36
|
}
|
|
37
|
+
static {
|
|
38
|
+
this.keyMap = l;
|
|
39
|
+
}
|
|
33
40
|
static {
|
|
34
41
|
this.labelTarget = ".void-editable-preview, .void-editable-input";
|
|
35
42
|
}
|
|
36
43
|
static {
|
|
37
44
|
this.editState = ["value"];
|
|
38
45
|
}
|
|
46
|
+
get _hint() {
|
|
47
|
+
return this.placeholder || i(this, "editable.placeholder");
|
|
48
|
+
}
|
|
39
49
|
static {
|
|
40
50
|
this.clientState = { _draft: "value" };
|
|
41
51
|
}
|
|
@@ -46,16 +56,16 @@ var c = class extends n(e) {
|
|
|
46
56
|
super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("dblclick", this._handleClick);
|
|
47
57
|
}
|
|
48
58
|
render() {
|
|
49
|
-
return
|
|
59
|
+
return u`
|
|
50
60
|
<span
|
|
51
61
|
class="void-editable-preview"
|
|
52
62
|
role="button"
|
|
53
|
-
tabindex=${this.formDisabled ?
|
|
63
|
+
tabindex=${this.formDisabled ? d : "0"}
|
|
54
64
|
@keydown=${this._handlePreviewKeydown}
|
|
55
|
-
>${this.value ||
|
|
65
|
+
>${this.value || u`<span class="void-editable-placeholder">${this._hint}</span>`}</span>
|
|
56
66
|
<input
|
|
57
67
|
class="void-editable-input"
|
|
58
|
-
.value=${
|
|
68
|
+
.value=${p(this._draft ?? this.value)}
|
|
59
69
|
@input=${this._handleInput}
|
|
60
70
|
@keydown=${this._handleInputKeydown}
|
|
61
71
|
@blur=${this._handleBlur}
|
|
@@ -83,22 +93,25 @@ var c = class extends n(e) {
|
|
|
83
93
|
}));
|
|
84
94
|
}
|
|
85
95
|
};
|
|
86
|
-
t([
|
|
96
|
+
t([f({
|
|
97
|
+
attribute: "keys",
|
|
98
|
+
converter: r
|
|
99
|
+
})], m.prototype, "keys", void 0), t([f({
|
|
87
100
|
type: String,
|
|
88
101
|
reflect: !0
|
|
89
|
-
})],
|
|
102
|
+
})], m.prototype, "value", void 0), t([f({
|
|
90
103
|
type: Boolean,
|
|
91
104
|
reflect: !0
|
|
92
|
-
})],
|
|
105
|
+
})], m.prototype, "editing", void 0), t([f({
|
|
93
106
|
type: Boolean,
|
|
94
107
|
reflect: !0
|
|
95
|
-
})],
|
|
108
|
+
})], m.prototype, "disabled", void 0), t([f({ type: String })], m.prototype, "placeholder", void 0), t([f({
|
|
96
109
|
type: String,
|
|
97
110
|
reflect: !0,
|
|
98
111
|
attribute: "submit-mode"
|
|
99
|
-
})],
|
|
112
|
+
})], m.prototype, "submitMode", void 0), t([f({
|
|
100
113
|
type: String,
|
|
101
114
|
reflect: !0
|
|
102
|
-
})],
|
|
115
|
+
})], m.prototype, "size", void 0), customElements.get("void-editable") || customElements.define("void-editable", m);
|
|
103
116
|
//#endregion
|
|
104
|
-
export {
|
|
117
|
+
export { m as VoidEditable };
|
|
@@ -16,7 +16,7 @@ import { PartsController } from '../parts.js';
|
|
|
16
16
|
* @fires {CustomEvent} void-retry - The built-in retry button was pressed (the element retries nothing itself).
|
|
17
17
|
*/
|
|
18
18
|
export declare class VoidErrorFallback extends VoidElement {
|
|
19
|
-
/** Headline of the built-in default. Defaults to `Something went wrong
|
|
19
|
+
/** Headline of the built-in default. Defaults to the `errorFallback.heading` message (English: `Something went wrong`). Ignored when the author writes parts. */
|
|
20
20
|
heading: string;
|
|
21
21
|
/** Detail shown under the headline in the built-in default, such as what failed or what to try. Optional. */
|
|
22
22
|
message: string;
|
|
@@ -25,10 +25,12 @@ export declare class VoidErrorFallback extends VoidElement {
|
|
|
25
25
|
* anything itself, so listen for the event and reload. Ignored when the author writes parts.
|
|
26
26
|
*/
|
|
27
27
|
retryable: boolean;
|
|
28
|
-
/** Text of the built-in retry button. Defaults to `Try again
|
|
28
|
+
/** Text of the built-in retry button. Defaults to the `errorFallback.retry` message (English: `Try again`). Only used with `retryable`. */
|
|
29
29
|
retryLabel: string;
|
|
30
30
|
/** Leave out the warning icon above the headline (it is drawn by default). */
|
|
31
31
|
hideIcon: boolean;
|
|
32
|
+
/** The built-in text last written, so a change of language rewrites it. */
|
|
33
|
+
private _shown;
|
|
32
34
|
protected readonly _parts: PartsController;
|
|
33
35
|
constructor();
|
|
34
36
|
connectedCallback(): void;
|