@voidable/ui 0.9.0 → 0.10.0
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/base-entry.d.ts +1 -0
- package/dist/base.d.ts +2 -1
- package/dist/base.js +5 -1
- package/dist/chunks/base-BxmMM3B7.js +298 -0
- package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
- package/dist/chunks/{modal-hivQ4YoU.js → modal-CgGp_fCs.js} +3 -3
- package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
- package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
- package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-input.d.ts +2 -2
- package/dist/components/action-input.js +56 -54
- package/dist/components/alert.js +2 -2
- package/dist/components/avatar.js +13 -11
- package/dist/components/badge.js +1 -1
- package/dist/components/banner.js +2 -2
- package/dist/components/bar-chart.js +31 -29
- package/dist/components/breadcrumbs.js +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/calendar.js +78 -76
- package/dist/components/card.js +1 -1
- package/dist/components/carousel.js +18 -17
- package/dist/components/checkbox-group.js +13 -12
- package/dist/components/checkbox.js +17 -16
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.js +26 -24
- package/dist/components/combobox.js +17 -16
- package/dist/components/compose-input.js +13 -11
- package/dist/components/dialog.js +1 -1
- package/dist/components/divider.js +11 -9
- package/dist/components/donut-chart.js +51 -49
- package/dist/components/drawer.d.ts +2 -2
- package/dist/components/drawer.js +1 -1
- package/dist/components/dropdown-menu.js +4 -4
- package/dist/components/editable.js +13 -12
- package/dist/components/error-fallback.js +2 -2
- package/dist/components/field.js +10 -9
- package/dist/components/file-upload.js +19 -17
- package/dist/components/gauge.js +88 -86
- package/dist/components/hamburger.js +11 -9
- package/dist/components/hover-card.js +3 -3
- package/dist/components/indicator.js +14 -12
- package/dist/components/input.js +41 -39
- package/dist/components/line-chart.js +41 -39
- package/dist/components/list.js +1 -1
- package/dist/components/menu.js +3 -3
- package/dist/components/multiselect.js +30 -29
- package/dist/components/nav-bar.js +1 -1
- package/dist/components/nav-menu.js +20 -19
- package/dist/components/number-input.js +17 -15
- package/dist/components/pagination.js +22 -20
- package/dist/components/panel.js +2 -2
- package/dist/components/pin-input.js +32 -30
- package/dist/components/popover.js +3 -3
- package/dist/components/progress.js +14 -12
- package/dist/components/radio-group.js +13 -11
- package/dist/components/radio.d.ts +25 -0
- package/dist/components/radio.js +78 -29
- package/dist/components/scroll-area.js +8 -7
- package/dist/components/segmented-control.js +21 -21
- package/dist/components/select.js +49 -47
- package/dist/components/sidebar.d.ts +2 -2
- package/dist/components/sidebar.js +2 -2
- package/dist/components/skeleton.js +1 -1
- package/dist/components/slider.js +16 -14
- package/dist/components/spinner.js +11 -9
- package/dist/components/stat.js +19 -17
- package/dist/components/status-dot.js +1 -1
- package/dist/components/stepper.js +15 -13
- package/dist/components/switch.js +14 -12
- package/dist/components/table.js +1 -1
- package/dist/components/tabs.js +29 -29
- package/dist/components/tag.js +9 -8
- package/dist/components/tags-input.js +24 -22
- package/dist/components/textarea.js +34 -32
- package/dist/components/toast.d.ts +19 -2
- package/dist/components/toast.js +43 -10
- package/dist/components/toggle-group.js +16 -15
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.js +3 -3
- package/dist/components.json +1 -1
- package/dist/custom-elements.json +48 -18
- package/dist/dev.js +31 -7
- package/dist/index.js +1 -1
- package/dist/keyboard.d.ts +10 -0
- package/dist/llms.txt +1 -1
- package/dist/parts.d.ts +5 -0
- package/dist/projection-api.d.ts +23 -0
- package/dist/projection.d.ts +8 -2
- package/dist/reference.md +4 -4
- package/dist/vscode.html-custom-data.json +13 -7
- package/dist/web-types.json +17 -17
- package/package.json +1 -1
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { r } from "../chunks/projection-SnR79EHI.js";
|
|
5
|
+
import { html as i, nothing as a } from "lit";
|
|
6
|
+
import { property as o } from "lit/decorators.js";
|
|
7
|
+
import { live as s } from "lit/directives/live.js";
|
|
7
8
|
//#region src/components/color-picker.ts
|
|
8
|
-
|
|
9
|
+
r();
|
|
10
|
+
var c = class t extends n(e) {
|
|
9
11
|
constructor(...e) {
|
|
10
12
|
super(...e), this.value = "#000000", this.disabled = !1, this.size = "md", this.swatches = [], this.hideInput = !1, this.compact = !1, this.open = !1, this._hue = 0, this._saturation = 0, this._brightness = 0, this._dragging = null, this._boundPointerMove = null, this._boundPointerUp = null, this._onDocumentClick = (e) => {
|
|
11
13
|
this.open && (this.contains(e.target) || (this.open = !1));
|
|
@@ -120,7 +122,7 @@ var s = class t extends n(e) {
|
|
|
120
122
|
e.has("value") && !this._dragging && this._syncFromHex(this.value), this._applyCustomProperties(), e.has("open") && (this.open ? document.addEventListener("click", this._onDocumentClick, !0) : document.removeEventListener("click", this._onDocumentClick, !0));
|
|
121
123
|
}
|
|
122
124
|
_renderPicker() {
|
|
123
|
-
return
|
|
125
|
+
return i`
|
|
124
126
|
<div class="void-color-picker">
|
|
125
127
|
<div
|
|
126
128
|
class="void-color-picker-area"
|
|
@@ -134,25 +136,25 @@ var s = class t extends n(e) {
|
|
|
134
136
|
>
|
|
135
137
|
<div class="void-color-picker-hue-thumb"></div>
|
|
136
138
|
</div>
|
|
137
|
-
${this.hideInput ?
|
|
139
|
+
${this.hideInput ? i`
|
|
138
140
|
<div class="void-color-picker-preview"></div>
|
|
139
|
-
` :
|
|
141
|
+
` : i`
|
|
140
142
|
<div class="void-color-picker-field">
|
|
141
143
|
<span class="void-color-picker-field-swatch"></span>
|
|
142
144
|
<span class="void-color-picker-field-separator"></span>
|
|
143
145
|
<input
|
|
144
146
|
class="void-color-picker-input"
|
|
145
147
|
type="text"
|
|
146
|
-
.value=${
|
|
148
|
+
.value=${s(this.value)}
|
|
147
149
|
?disabled=${this.disabled}
|
|
148
150
|
maxlength="7"
|
|
149
151
|
@change=${this._onHexInput}
|
|
150
152
|
/>
|
|
151
153
|
</div>
|
|
152
154
|
`}
|
|
153
|
-
${this.swatches.length > 0 ?
|
|
155
|
+
${this.swatches.length > 0 ? i`
|
|
154
156
|
<div class="void-color-picker-swatches">
|
|
155
|
-
${this.swatches.map((e) =>
|
|
157
|
+
${this.swatches.map((e) => i`
|
|
156
158
|
<button
|
|
157
159
|
type="button"
|
|
158
160
|
class="void-color-picker-swatch"
|
|
@@ -163,12 +165,12 @@ var s = class t extends n(e) {
|
|
|
163
165
|
></button>
|
|
164
166
|
`)}
|
|
165
167
|
</div>
|
|
166
|
-
` :
|
|
168
|
+
` : a}
|
|
167
169
|
</div>
|
|
168
170
|
`;
|
|
169
171
|
}
|
|
170
172
|
render() {
|
|
171
|
-
return this.compact ?
|
|
173
|
+
return this.compact ? i`
|
|
172
174
|
<div class="void-color-picker-compact">
|
|
173
175
|
<button
|
|
174
176
|
type="button"
|
|
@@ -183,41 +185,41 @@ var s = class t extends n(e) {
|
|
|
183
185
|
<input
|
|
184
186
|
class="void-color-picker-compact-input"
|
|
185
187
|
type="text"
|
|
186
|
-
.value=${
|
|
188
|
+
.value=${s(this.value)}
|
|
187
189
|
?disabled=${this.disabled}
|
|
188
190
|
maxlength="7"
|
|
189
191
|
@click=${(e) => e.stopPropagation()}
|
|
190
192
|
@change=${this._onCompactHexInput}
|
|
191
193
|
/>
|
|
192
194
|
</button>
|
|
193
|
-
${this.open ?
|
|
195
|
+
${this.open ? i`
|
|
194
196
|
<div class="void-color-picker-compact-dropdown" role="dialog" aria-label="Color picker">
|
|
195
197
|
${this._renderPicker()}
|
|
196
198
|
</div>
|
|
197
|
-
` :
|
|
199
|
+
` : a}
|
|
198
200
|
</div>
|
|
199
201
|
` : this._renderPicker();
|
|
200
202
|
}
|
|
201
203
|
};
|
|
202
|
-
t([
|
|
204
|
+
t([o({
|
|
203
205
|
type: String,
|
|
204
206
|
reflect: !0
|
|
205
|
-
})],
|
|
207
|
+
})], c.prototype, "value", void 0), t([o({
|
|
206
208
|
type: Boolean,
|
|
207
209
|
reflect: !0
|
|
208
|
-
})],
|
|
210
|
+
})], c.prototype, "disabled", void 0), t([o({
|
|
209
211
|
type: String,
|
|
210
212
|
reflect: !0
|
|
211
|
-
})],
|
|
213
|
+
})], c.prototype, "size", void 0), t([o({ type: Array })], c.prototype, "swatches", void 0), t([o({
|
|
212
214
|
type: Boolean,
|
|
213
215
|
attribute: "hide-input",
|
|
214
216
|
reflect: !0
|
|
215
|
-
})],
|
|
217
|
+
})], c.prototype, "hideInput", void 0), t([o({
|
|
216
218
|
type: Boolean,
|
|
217
219
|
reflect: !0
|
|
218
|
-
})],
|
|
220
|
+
})], c.prototype, "compact", void 0), t([o({
|
|
219
221
|
type: Boolean,
|
|
220
222
|
reflect: !0
|
|
221
|
-
})],
|
|
223
|
+
})], c.prototype, "open", void 0), customElements.get("void-color-picker") || customElements.define("void-color-picker", c);
|
|
222
224
|
//#endregion
|
|
223
|
-
export {
|
|
225
|
+
export { c as VoidColorPicker };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as r, t as i } from "../chunks/projection-SnR79EHI.js";
|
|
5
|
+
import { n as a } from "../chunks/parts-DI_3VpSy.js";
|
|
6
|
+
import { a as o, n as s } from "../chunks/keyboard-CEhMSkws.js";
|
|
7
|
+
import { t as c } from "../chunks/overlay-hLJ7IQHx.js";
|
|
7
8
|
import { optionLabel as l } from "./multiselect.js";
|
|
8
9
|
import { html as u, nothing as d } from "lit";
|
|
9
10
|
import { property as f } from "lit/decorators.js";
|
|
10
11
|
import { live as p } from "lit/directives/live.js";
|
|
11
12
|
//#region src/components/combobox.ts
|
|
12
|
-
var m = class extends
|
|
13
|
-
constructor(...
|
|
14
|
-
super(...
|
|
13
|
+
var m = class extends n(e) {
|
|
14
|
+
constructor(...e) {
|
|
15
|
+
super(...e), this.value = "", this.placeholder = "Search...", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._query = "", this._active = null, this._wiring = !1, this._projection = new i(this, { placement: "start" }), this._parts = new a(this, {
|
|
15
16
|
tags: ["void-combobox-content", "void-option"],
|
|
16
17
|
onChange: () => {
|
|
17
18
|
this._wire(), this._wiring || this.requestUpdate();
|
|
@@ -34,7 +35,7 @@ var m = class extends i(n) {
|
|
|
34
35
|
let n = e.target.closest("void-option");
|
|
35
36
|
n && !n.disabled && this._options.includes(n) && this._selectOption(n);
|
|
36
37
|
}, this._onInputFocus = () => {
|
|
37
|
-
this.disabled ||
|
|
38
|
+
this.disabled || r(this) || (this._overlay.requestOpen("focus"), this._query = "", this._active = null);
|
|
38
39
|
}, this._onInput = (e) => {
|
|
39
40
|
this._query = e.target.value, this.open = !0, this._active = null, this.requestUpdate();
|
|
40
41
|
}, this._onInputKeydown = (e) => {
|
|
@@ -166,22 +167,22 @@ var m = class extends i(n) {
|
|
|
166
167
|
}));
|
|
167
168
|
}
|
|
168
169
|
};
|
|
169
|
-
|
|
170
|
+
t([f({
|
|
170
171
|
type: String,
|
|
171
172
|
reflect: !0
|
|
172
|
-
})], m.prototype, "value", void 0),
|
|
173
|
+
})], m.prototype, "value", void 0), t([f({ type: String })], m.prototype, "placeholder", void 0), t([f({
|
|
173
174
|
type: Boolean,
|
|
174
175
|
reflect: !0
|
|
175
|
-
})], m.prototype, "disabled", void 0),
|
|
176
|
+
})], m.prototype, "disabled", void 0), t([f({
|
|
176
177
|
type: String,
|
|
177
178
|
reflect: !0
|
|
178
|
-
})], m.prototype, "size", void 0),
|
|
179
|
+
})], m.prototype, "size", void 0), t([f({
|
|
179
180
|
type: String,
|
|
180
181
|
reflect: !0
|
|
181
|
-
})], m.prototype, "error", void 0),
|
|
182
|
+
})], m.prototype, "error", void 0), t([f({
|
|
182
183
|
type: String,
|
|
183
184
|
reflect: !0
|
|
184
|
-
})], m.prototype, "name", void 0),
|
|
185
|
+
})], m.prototype, "name", void 0), t([f({
|
|
185
186
|
type: Boolean,
|
|
186
187
|
reflect: !0
|
|
187
188
|
})], m.prototype, "open", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", m);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { r as n } from "../chunks/projection-SnR79EHI.js";
|
|
4
|
+
import { html as r } from "lit";
|
|
5
|
+
import { property as i, query as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/compose-input.ts
|
|
6
|
-
|
|
7
|
+
n();
|
|
8
|
+
var o = class extends e {
|
|
7
9
|
constructor(...e) {
|
|
8
10
|
super(...e), this.value = "", this.placeholder = "Type a message...", this.disabled = !1, this.maxlength = 0;
|
|
9
11
|
}
|
|
@@ -14,7 +16,7 @@ var a = class extends e {
|
|
|
14
16
|
this.editState = ["value"];
|
|
15
17
|
}
|
|
16
18
|
render() {
|
|
17
|
-
return
|
|
19
|
+
return r`
|
|
18
20
|
<div class="void-compose-input-wrapper">
|
|
19
21
|
<textarea
|
|
20
22
|
class="void-compose-input-textarea"
|
|
@@ -63,18 +65,18 @@ var a = class extends e {
|
|
|
63
65
|
}));
|
|
64
66
|
}
|
|
65
67
|
};
|
|
66
|
-
t([
|
|
68
|
+
t([i({
|
|
67
69
|
type: String,
|
|
68
70
|
reflect: !0
|
|
69
|
-
})],
|
|
71
|
+
})], o.prototype, "value", void 0), t([i({
|
|
70
72
|
type: String,
|
|
71
73
|
reflect: !0
|
|
72
|
-
})],
|
|
74
|
+
})], o.prototype, "placeholder", void 0), t([i({
|
|
73
75
|
type: Boolean,
|
|
74
76
|
reflect: !0
|
|
75
|
-
})],
|
|
77
|
+
})], o.prototype, "disabled", void 0), t([i({
|
|
76
78
|
type: Number,
|
|
77
79
|
reflect: !0
|
|
78
|
-
})],
|
|
80
|
+
})], o.prototype, "maxlength", void 0), t([a(".void-compose-input-textarea")], o.prototype, "_textarea", void 0), customElements.get("void-compose-input") || customElements.define("void-compose-input", o);
|
|
79
81
|
//#endregion
|
|
80
|
-
export {
|
|
82
|
+
export { o as VoidComposeInput };
|
|
@@ -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-CgGp_fCs.js";
|
|
3
3
|
import { property as n } from "lit/decorators.js";
|
|
4
4
|
//#region src/components/dialog.ts
|
|
5
5
|
var r = class extends t {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { r as n } from "../chunks/projection-SnR79EHI.js";
|
|
4
|
+
import { html as r, nothing as i } from "lit";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/divider.ts
|
|
6
|
-
|
|
7
|
+
n();
|
|
8
|
+
var o = class extends e {
|
|
7
9
|
constructor(...e) {
|
|
8
10
|
super(...e), this.label = void 0, this.orientation = "horizontal";
|
|
9
11
|
}
|
|
@@ -14,15 +16,15 @@ var a = class extends e {
|
|
|
14
16
|
e.has("orientation") && this.setHostAttribute("aria-orientation", this.orientation);
|
|
15
17
|
}
|
|
16
18
|
render() {
|
|
17
|
-
return this.label ?
|
|
19
|
+
return this.label ? r`${this.label}` : i;
|
|
18
20
|
}
|
|
19
21
|
};
|
|
20
|
-
t([
|
|
22
|
+
t([a({
|
|
21
23
|
type: String,
|
|
22
24
|
reflect: !0
|
|
23
|
-
})],
|
|
25
|
+
})], o.prototype, "label", void 0), t([a({
|
|
24
26
|
type: String,
|
|
25
27
|
reflect: !0
|
|
26
|
-
})],
|
|
28
|
+
})], o.prototype, "orientation", void 0), customElements.get("void-divider") || customElements.define("void-divider", o);
|
|
27
29
|
//#endregion
|
|
28
|
-
export {
|
|
30
|
+
export { o as VoidDivider };
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { r as n } from "../chunks/projection-SnR79EHI.js";
|
|
4
|
+
import { t as r } from "../chunks/shape-C_LW7EjG.js";
|
|
5
|
+
import { html as i, nothing as a, svg as o } from "lit";
|
|
6
|
+
import { property as s, state as c } from "lit/decorators.js";
|
|
6
7
|
//#region src/components/donut-chart.ts
|
|
7
|
-
|
|
8
|
+
n();
|
|
9
|
+
function l(e) {
|
|
8
10
|
return Number.isFinite(e) ? e : 0;
|
|
9
11
|
}
|
|
10
|
-
function
|
|
12
|
+
function u(e) {
|
|
11
13
|
return 1 - (1 - e) ** 3;
|
|
12
14
|
}
|
|
13
|
-
function
|
|
15
|
+
function d(e) {
|
|
14
16
|
return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
|
|
15
17
|
}
|
|
16
|
-
function
|
|
18
|
+
function f(e) {
|
|
17
19
|
return Math.abs(e) >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e4 ? 0 : 1)}k` : Math.round(e).toString();
|
|
18
20
|
}
|
|
19
|
-
var
|
|
21
|
+
var p = class extends e {
|
|
20
22
|
constructor(...e) {
|
|
21
23
|
super(...e), this.size = 220, this.inner = .6, this.gaps = !1, this.variant = "filled", this.showValue = !1, this.showTotal = !1, this.ariaLabel = "", this._data = { segments: [] }, 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) => {
|
|
22
24
|
let t = this.querySelector("svg");
|
|
@@ -25,16 +27,16 @@ var f = class extends e {
|
|
|
25
27
|
if (n.length === 0 || this._displayTotal <= 0) return;
|
|
26
28
|
let r = t.getBoundingClientRect();
|
|
27
29
|
if (r.width === 0) return;
|
|
28
|
-
let i = (e.clientX - r.left) / r.width * this.size, a = (e.clientY - r.top) / r.height * this.size, o = this.size / 2, s = this.size / 2,
|
|
30
|
+
let i = (e.clientX - r.left) / r.width * this.size, a = (e.clientY - r.top) / r.height * this.size, o = this.size / 2, s = this.size / 2, c = i - o, u = a - s, d = Math.sqrt(c * c + u * u), f = this.size / 2 - 4;
|
|
29
31
|
if (d < f * this.inner || d > f) {
|
|
30
32
|
this._hoverSegment !== null && (this._hoverSegment = null);
|
|
31
33
|
return;
|
|
32
34
|
}
|
|
33
|
-
let p = Math.atan2(u,
|
|
35
|
+
let p = Math.atan2(u, c) - -Math.PI / 2;
|
|
34
36
|
p < 0 && (p += 2 * Math.PI);
|
|
35
37
|
let m = 2 * Math.PI, h = 0;
|
|
36
38
|
for (let e = 0; e < n.length; e++) {
|
|
37
|
-
let t =
|
|
39
|
+
let t = l(n[e].value) / this._targetTotal * m;
|
|
38
40
|
if (p >= h && p < h + t) {
|
|
39
41
|
this._hoverSegment !== e && (this._hoverSegment = e), this._hoverX = i, this._hoverY = a;
|
|
40
42
|
return;
|
|
@@ -45,7 +47,7 @@ var f = class extends e {
|
|
|
45
47
|
}, this._onMouseLeave = () => {
|
|
46
48
|
this._hoverSegment = null;
|
|
47
49
|
}, this._tick = (e) => {
|
|
48
|
-
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r =
|
|
50
|
+
let t = e - this._animStart, n = Math.min(t / this._animDuration, 1), r = u(n);
|
|
49
51
|
this._progress = this._progressFrom + (1 - this._progressFrom) * r;
|
|
50
52
|
for (let [e, t] of this._targetValues) {
|
|
51
53
|
let n = this._animFrom.get(e) ?? 0;
|
|
@@ -69,8 +71,8 @@ var f = class extends e {
|
|
|
69
71
|
_refreshTargets() {
|
|
70
72
|
this._targetValues.clear();
|
|
71
73
|
let e = this._data.segments;
|
|
72
|
-
for (let t = 0; t < e.length; t++) this._targetValues.set(t,
|
|
73
|
-
this._targetTotal = e.reduce((e, t) => e +
|
|
74
|
+
for (let t = 0; t < e.length; t++) this._targetValues.set(t, l(e[t].value));
|
|
75
|
+
this._targetTotal = e.reduce((e, t) => e + l(t.value), 0);
|
|
74
76
|
}
|
|
75
77
|
connectedCallback() {
|
|
76
78
|
super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
|
|
@@ -90,25 +92,25 @@ var f = class extends e {
|
|
|
90
92
|
this._phase = "animating", this._rafHandle = requestAnimationFrame(this._tick);
|
|
91
93
|
}
|
|
92
94
|
render() {
|
|
93
|
-
let { segments: e } = this._data, t = e.reduce((e, t) => e +
|
|
94
|
-
if (e.length === 0 || t === 0) return
|
|
95
|
-
let
|
|
95
|
+
let { segments: e } = this._data, t = e.reduce((e, t) => e + l(t.value), 0);
|
|
96
|
+
if (e.length === 0 || t === 0) return i`<svg viewBox="0 0 ${this.size} ${this.size}" role="img" aria-label=${this.ariaLabel || "Donut chart"}></svg>`;
|
|
97
|
+
let n = this.size / 2, s = this.size / 2, c = this.size / 2 - 4, u = c * this.inner, p = Math.max(this._displayTotal, .001), m = 2 * Math.PI, h = -Math.PI / 2 + this._progress * m, g = (this.gaps === !0 ? 1 : this.gaps === !1 ? 0 : this.gaps) / 100 * m, _ = e.filter((e, t) => (this._displayValues.get(t) ?? 0) > 0).length, v = (_ > 1 ? g / e.length : 0) / 2, y = [], b = -Math.PI / 2;
|
|
96
98
|
for (let t = 0; t < e.length; t++) {
|
|
97
|
-
let
|
|
98
|
-
if (
|
|
99
|
-
let e =
|
|
100
|
-
y.push(
|
|
99
|
+
let i = e[t], a = this._displayValues.get(t) ?? 0, l = b, d = l + a / p * m, f = Math.min(d, h);
|
|
100
|
+
if (f > l + .001) {
|
|
101
|
+
let e = i.color ?? `var(--void-chart-series-${t % 6 + 1})`, a = l + v, d = _ === 1 && f >= l + m - 1e-9 ? a + m : Math.max(a + .001, f - v);
|
|
102
|
+
y.push(o`
|
|
101
103
|
<path
|
|
102
104
|
class="void-donut-chart-segment"
|
|
103
|
-
d=${n
|
|
105
|
+
d=${r(n, s, c, a, d, u)}
|
|
104
106
|
style="--segment-color: ${e}"
|
|
105
107
|
data-segment-index=${t}
|
|
106
108
|
></path>
|
|
107
109
|
`);
|
|
108
110
|
}
|
|
109
|
-
b =
|
|
111
|
+
b = d;
|
|
110
112
|
}
|
|
111
|
-
return
|
|
113
|
+
return i`
|
|
112
114
|
<svg
|
|
113
115
|
viewBox="0 0 ${this.size} ${this.size}"
|
|
114
116
|
role="img"
|
|
@@ -116,56 +118,56 @@ var f = class extends e {
|
|
|
116
118
|
data-phase=${this._phase}
|
|
117
119
|
>
|
|
118
120
|
${y}
|
|
119
|
-
${this.showTotal ?
|
|
121
|
+
${this.showTotal ? o`
|
|
120
122
|
<g class="void-donut-chart-total">
|
|
121
|
-
<text x=${
|
|
123
|
+
<text x=${n} y=${s} text-anchor="middle" dy="0.32em">${d(this._displayTotal)}</text>
|
|
122
124
|
</g>
|
|
123
|
-
` :
|
|
124
|
-
${this.showValue ?
|
|
125
|
+
` : a}
|
|
126
|
+
${this.showValue ? o`
|
|
125
127
|
<g class="void-donut-chart-labels">
|
|
126
128
|
${e.map((e, t) => {
|
|
127
|
-
let
|
|
128
|
-
if (
|
|
129
|
-
let
|
|
130
|
-
for (let e = 0; e < t; e++)
|
|
131
|
-
let
|
|
132
|
-
return
|
|
129
|
+
let r = this._displayValues.get(t) ?? 0;
|
|
130
|
+
if (r < .001) return a;
|
|
131
|
+
let i = -Math.PI / 2;
|
|
132
|
+
for (let e = 0; e < t; e++) i += (this._displayValues.get(e) ?? 0) / p * m;
|
|
133
|
+
let l = i + r / p * m / 2, d = (c + u) / 2;
|
|
134
|
+
return o`<text x=${n + d * Math.cos(l)} y=${s + d * Math.sin(l)} text-anchor="middle" dy="0.32em">${f(r)}</text>`;
|
|
133
135
|
})}
|
|
134
136
|
</g>
|
|
135
|
-
` :
|
|
137
|
+
` : a}
|
|
136
138
|
|
|
137
|
-
${this._hoverSegment !== null && this._hoverSegment < e.length ? this._renderHoverTooltip(e, this._hoverSegment) :
|
|
139
|
+
${this._hoverSegment !== null && this._hoverSegment < e.length ? this._renderHoverTooltip(e, this._hoverSegment) : a}
|
|
138
140
|
</svg>
|
|
139
141
|
`;
|
|
140
142
|
}
|
|
141
143
|
_renderHoverTooltip(e, t) {
|
|
142
|
-
let n = e[t], r = this._displayValues.get(t) ??
|
|
143
|
-
return u < 8 && (u = 8), u + 44 > this.size - 8 && (u = this.size - 44 - 8),
|
|
144
|
+
let n = e[t], r = this._displayValues.get(t) ?? l(n.value), i = [...this._displayValues.values()].reduce((e, t) => e + t, 0) || this._targetTotal || 1, a = Math.round(r / i * 100), s = this.size / 2, c = this._hoverX < s ? this.size - 140 - 8 : 8, u = this._hoverY - 44 / 2;
|
|
145
|
+
return u < 8 && (u = 8), u + 44 > this.size - 8 && (u = this.size - 44 - 8), o`
|
|
144
146
|
<g class="void-donut-chart-hover" pointer-events="none">
|
|
145
147
|
<rect
|
|
146
148
|
class="void-donut-chart-tooltip-bg"
|
|
147
|
-
x=${
|
|
149
|
+
x=${c} y=${u}
|
|
148
150
|
width=${140} height=${44}
|
|
149
151
|
rx="6" ry="6"
|
|
150
152
|
></rect>
|
|
151
153
|
<text
|
|
152
154
|
class="void-donut-chart-tooltip-name"
|
|
153
|
-
x=${
|
|
155
|
+
x=${c + 8}
|
|
154
156
|
y=${u + 8 + 10}
|
|
155
157
|
>${n.name}</text>
|
|
156
158
|
<text
|
|
157
159
|
class="void-donut-chart-tooltip-value"
|
|
158
|
-
x=${
|
|
160
|
+
x=${c + 8}
|
|
159
161
|
y=${u + 8 + 14 + 10}
|
|
160
|
-
>${
|
|
162
|
+
>${f(r)} <tspan class="void-donut-chart-tooltip-pct">(${a}%)</tspan></text>
|
|
161
163
|
</g>
|
|
162
164
|
`;
|
|
163
165
|
}
|
|
164
166
|
};
|
|
165
|
-
t([
|
|
167
|
+
t([s({
|
|
166
168
|
type: Number,
|
|
167
169
|
reflect: !0
|
|
168
|
-
})],
|
|
170
|
+
})], p.prototype, "size", void 0), t([s({ type: Number })], p.prototype, "inner", void 0), t([s({ converter: {
|
|
169
171
|
fromAttribute(e) {
|
|
170
172
|
if (e === null || e === "" || e === "true") return !0;
|
|
171
173
|
if (e === "false") return !1;
|
|
@@ -175,14 +177,14 @@ t([o({
|
|
|
175
177
|
toAttribute(e) {
|
|
176
178
|
return e === !0 ? "" : e === !1 ? "false" : String(e);
|
|
177
179
|
}
|
|
178
|
-
} })],
|
|
180
|
+
} })], p.prototype, "gaps", void 0), t([s({ reflect: !0 })], p.prototype, "variant", void 0), t([s({
|
|
179
181
|
type: Boolean,
|
|
180
182
|
attribute: "show-value",
|
|
181
183
|
reflect: !0
|
|
182
|
-
})],
|
|
184
|
+
})], p.prototype, "showValue", void 0), t([s({
|
|
183
185
|
type: Boolean,
|
|
184
186
|
attribute: "show-total",
|
|
185
187
|
reflect: !0
|
|
186
|
-
})],
|
|
188
|
+
})], p.prototype, "showTotal", void 0), t([s({ attribute: "aria-label" })], p.prototype, "ariaLabel", void 0), t([c()], p.prototype, "_phase", void 0), t([c()], p.prototype, "_hoverSegment", void 0), t([c()], p.prototype, "_hoverX", void 0), t([c()], p.prototype, "_hoverY", void 0), customElements.get("void-donut-chart") || customElements.define("void-donut-chart", p);
|
|
187
189
|
//#endregion
|
|
188
|
-
export {
|
|
190
|
+
export { p as VoidDonutChart };
|
|
@@ -15,8 +15,8 @@ import { VoidModal } from '../modal.js';
|
|
|
15
15
|
* drawer is closing. Cancelable when the user caused it (`escape`, `outside`, `close-button`).
|
|
16
16
|
*/
|
|
17
17
|
export declare class VoidDrawer extends VoidModal {
|
|
18
|
-
/**
|
|
19
|
-
side: 'left' | 'right' | 'top' | 'bottom';
|
|
18
|
+
/** Edge the drawer slides in from: `right` (default), `left`, `top` or `bottom` (the screen edges), or `start` or `end` (the side the text starts or ends on, so they swap in right-to-left). */
|
|
19
|
+
side: 'left' | 'right' | 'start' | 'end' | 'top' | 'bottom';
|
|
20
20
|
/** Width of a side drawer, or height of a top or bottom one: `sm`, `md` (default) or `lg`. */
|
|
21
21
|
size: 'sm' | 'md' | 'lg';
|
|
22
22
|
}
|
|
@@ -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-CgGp_fCs.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,9 +1,9 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
3
|
import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
|
|
4
|
-
import { i as r, n as i } from "../chunks/parts-
|
|
5
|
-
import {
|
|
6
|
-
import { t as c } from "../chunks/overlay-
|
|
4
|
+
import { i as r, n as i } from "../chunks/parts-DI_3VpSy.js";
|
|
5
|
+
import { a, i as o, t as s } from "../chunks/keyboard-CEhMSkws.js";
|
|
6
|
+
import { t as c } from "../chunks/overlay-hLJ7IQHx.js";
|
|
7
7
|
import { property as l } from "lit/decorators.js";
|
|
8
8
|
//#region src/components/dropdown-menu.ts
|
|
9
9
|
var u = class extends e {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
3
|
-
import { t as
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { n as r } from "../chunks/projection-SnR79EHI.js";
|
|
4
5
|
import { html as i, nothing as a } from "lit";
|
|
5
6
|
import { property as o } from "lit/decorators.js";
|
|
6
7
|
import { live as s } from "lit/directives/live.js";
|
|
7
8
|
//#region src/components/editable.ts
|
|
8
|
-
var c = class extends
|
|
9
|
-
constructor(...
|
|
10
|
-
super(...
|
|
9
|
+
var c = class extends n(e) {
|
|
10
|
+
constructor(...e) {
|
|
11
|
+
super(...e), this.value = "", this.editing = !1, this.disabled = !1, this.placeholder = "Click to edit", this.submitMode = "both", this.size = "md", this._previousValue = "", this._draft = null, this._handleClick = () => {
|
|
11
12
|
this.formDisabled || this.editing || this._enterEditMode();
|
|
12
13
|
}, this._handlePreviewKeydown = (e) => {
|
|
13
14
|
this.formDisabled || this.editing || (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._enterEditMode());
|
|
@@ -26,7 +27,7 @@ var c = class extends r(t) {
|
|
|
26
27
|
}
|
|
27
28
|
e.key === "Enter" && (this.submitMode === "enter" || this.submitMode === "both") && (e.preventDefault(), this._confirm());
|
|
28
29
|
}, this._handleBlur = () => {
|
|
29
|
-
!this.editing ||
|
|
30
|
+
!this.editing || r(this) || (this.submitMode === "blur" || this.submitMode === "both" ? this._confirm() : this._cancel());
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
33
|
static {
|
|
@@ -82,20 +83,20 @@ var c = class extends r(t) {
|
|
|
82
83
|
}));
|
|
83
84
|
}
|
|
84
85
|
};
|
|
85
|
-
|
|
86
|
+
t([o({
|
|
86
87
|
type: String,
|
|
87
88
|
reflect: !0
|
|
88
|
-
})], c.prototype, "value", void 0),
|
|
89
|
+
})], c.prototype, "value", void 0), t([o({
|
|
89
90
|
type: Boolean,
|
|
90
91
|
reflect: !0
|
|
91
|
-
})], c.prototype, "editing", void 0),
|
|
92
|
+
})], c.prototype, "editing", void 0), t([o({
|
|
92
93
|
type: Boolean,
|
|
93
94
|
reflect: !0
|
|
94
|
-
})], c.prototype, "disabled", void 0),
|
|
95
|
+
})], c.prototype, "disabled", void 0), t([o({ type: String })], c.prototype, "placeholder", void 0), t([o({
|
|
95
96
|
type: String,
|
|
96
97
|
reflect: !0,
|
|
97
98
|
attribute: "submit-mode"
|
|
98
|
-
})], c.prototype, "submitMode", void 0),
|
|
99
|
+
})], c.prototype, "submitMode", void 0), t([o({
|
|
99
100
|
type: String,
|
|
100
101
|
reflect: !0
|
|
101
102
|
})], c.prototype, "size", void 0), customElements.get("void-editable") || customElements.define("void-editable", c);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "../chunks/base-
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import { n, t as r } from "../chunks/parts-
|
|
3
|
+
import { n, t as r } from "../chunks/parts-DI_3VpSy.js";
|
|
4
4
|
import { property as i } from "lit/decorators.js";
|
|
5
5
|
//#region src/components/error-fallback.ts
|
|
6
6
|
var a = [
|
package/dist/components/field.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t
|
|
1
|
+
import { t as e } from "../chunks/base-BxmMM3B7.js";
|
|
2
|
+
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
+
import { t as n } from "../chunks/projection-SnR79EHI.js";
|
|
3
4
|
import { html as r, nothing as i } from "lit";
|
|
4
5
|
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/field.ts
|
|
6
|
-
var o = "", s = class extends
|
|
7
|
-
constructor(...
|
|
8
|
-
super(...
|
|
7
|
+
var o = "", s = class extends e {
|
|
8
|
+
constructor(...e) {
|
|
9
|
+
super(...e), this.label = "", this.error = "", this.helper = "", this.required = !1, this._uid = Math.random().toString(36).slice(2), this._labelledControl = null, this._controlObserver = null, this._projection = new n(this, {
|
|
9
10
|
regions: [{
|
|
10
11
|
name: "control",
|
|
11
12
|
target: () => this.querySelector(":scope > .void-field-control")
|
|
@@ -67,16 +68,16 @@ var o = "", s = class extends t {
|
|
|
67
68
|
`;
|
|
68
69
|
}
|
|
69
70
|
};
|
|
70
|
-
|
|
71
|
+
t([a({
|
|
71
72
|
type: String,
|
|
72
73
|
reflect: !0
|
|
73
|
-
})], s.prototype, "label", void 0),
|
|
74
|
+
})], s.prototype, "label", void 0), t([a({
|
|
74
75
|
type: String,
|
|
75
76
|
reflect: !0
|
|
76
|
-
})], s.prototype, "error", void 0),
|
|
77
|
+
})], s.prototype, "error", void 0), t([a({
|
|
77
78
|
type: String,
|
|
78
79
|
reflect: !0
|
|
79
|
-
})], s.prototype, "helper", void 0),
|
|
80
|
+
})], s.prototype, "helper", void 0), t([a({
|
|
80
81
|
type: Boolean,
|
|
81
82
|
reflect: !0
|
|
82
83
|
})], s.prototype, "required", void 0), customElements.get("void-field") || customElements.define("void-field", s);
|