@voidable/ui 0.8.1 → 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/README.md +8 -0
- 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-D_YVy2vg.js → modal-CgGp_fCs.js} +3 -3
- package/dist/chunks/{overlay-BywGMcDW.js → overlay-hLJ7IQHx.js} +2 -2
- package/dist/chunks/{parts-D30c8OoG.js → parts-DI_3VpSy.js} +25 -18
- package/dist/chunks/{base-CMruMbxC.js → projection-SnR79EHI.js} +105 -389
- package/dist/chunks/secret-value-CmTtVkMg.js +14 -0
- package/dist/chunks/value-list-CH6GjYXM.js +28 -0
- package/dist/components/accordion.js +2 -2
- package/dist/components/action-input.d.ts +8 -4
- package/dist/components/action-input.js +61 -49
- 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.d.ts +10 -0
- package/dist/components/checkbox-group.js +36 -23
- package/dist/components/checkbox.d.ts +2 -2
- package/dist/components/checkbox.js +17 -16
- package/dist/components/collapsible.js +2 -2
- package/dist/components/color-picker.d.ts +2 -2
- package/dist/components/color-picker.js +26 -24
- package/dist/components/combobox.d.ts +4 -2
- package/dist/components/combobox.js +22 -18
- package/dist/components/compose-input.d.ts +1 -1
- package/dist/components/compose-input.js +15 -10
- 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.d.ts +1 -1
- 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 +90 -85
- 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.d.ts +6 -2
- package/dist/components/input.js +46 -34
- 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.d.ts +9 -0
- package/dist/components/multiselect.js +64 -54
- package/dist/components/nav-bar.js +1 -1
- package/dist/components/nav-menu.js +20 -19
- package/dist/components/number-input.d.ts +2 -2
- 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.d.ts +6 -2
- package/dist/components/pin-input.js +39 -27
- package/dist/components/popover.js +3 -3
- package/dist/components/progress.js +14 -12
- package/dist/components/radio-group.d.ts +2 -2
- package/dist/components/radio-group.js +15 -10
- 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.d.ts +1 -1
- package/dist/components/segmented-control.js +21 -21
- package/dist/components/select.d.ts +67 -16
- package/dist/components/select.js +183 -56
- 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.d.ts +2 -2
- package/dist/components/slider.js +18 -13
- 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.d.ts +1 -1
- 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.d.ts +1 -1
- package/dist/components/tags-input.js +25 -19
- package/dist/components/textarea.d.ts +2 -2
- package/dist/components/textarea.js +36 -31
- package/dist/components/toast.d.ts +19 -2
- package/dist/components/toast.js +43 -10
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +16 -15
- package/dist/components/toggle.js +5 -2
- package/dist/components/tooltip.js +3 -3
- package/dist/components.json +3 -3
- package/dist/custom-elements.json +133 -67
- package/dist/dev/types.d.ts +2 -3
- package/dist/dev.js +81 -55
- package/dist/index.js +1 -1
- package/dist/keyboard.d.ts +10 -0
- package/dist/llms.txt +125 -0
- package/dist/parts.d.ts +8 -1
- package/dist/projection-api.d.ts +23 -0
- package/dist/projection.d.ts +8 -2
- package/dist/reference.md +4575 -0
- package/dist/secret-value.d.ts +17 -0
- package/dist/types/elements.d.ts +2 -2
- package/dist/value-list.d.ts +14 -0
- package/dist/vscode.html-custom-data.json +46 -26
- package/dist/web-types.json +73 -53
- package/package.json +5 -3
|
@@ -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 } from "../chunks/parts-
|
|
3
|
+
import { n } from "../chunks/parts-DI_3VpSy.js";
|
|
4
4
|
import { t as r } from "../chunks/disclosure-Bj_49GcC.js";
|
|
5
5
|
import { property as i } from "lit/decorators.js";
|
|
6
6
|
//#region src/components/collapsible.ts
|
|
@@ -5,8 +5,8 @@ export declare class VoidColorPicker extends VoidColorPicker_base {
|
|
|
5
5
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
6
6
|
static labelTarget: string;
|
|
7
7
|
/**
|
|
8
|
-
* Selected colour as a hex string (six digits after the hash). Defaults to black.
|
|
9
|
-
*
|
|
8
|
+
* Selected colour as a hex string (six digits after the hash). Defaults to black. Reflected to the attribute as it
|
|
9
|
+
* changes; the form's reset target stays the value it started with.
|
|
10
10
|
*/
|
|
11
11
|
value: string;
|
|
12
12
|
/** Stop the picker reacting and exclude the value from the form submission. */
|
|
@@ -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 };
|
|
@@ -33,8 +33,8 @@ export declare class VoidCombobox extends VoidCombobox_base {
|
|
|
33
33
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
34
34
|
static labelTarget: string;
|
|
35
35
|
/**
|
|
36
|
-
* `value` of the chosen `void-option`.
|
|
37
|
-
*
|
|
36
|
+
* `value` of the chosen `void-option`. Reflected to the attribute as the choice changes. Written in markup
|
|
37
|
+
* it is the initial choice (without it, an option marked `selected` is), which a form reset restores.
|
|
38
38
|
*/
|
|
39
39
|
value: string;
|
|
40
40
|
/**
|
|
@@ -69,6 +69,8 @@ export declare class VoidCombobox extends VoidCombobox_base {
|
|
|
69
69
|
private get _options();
|
|
70
70
|
/** Options the current query leaves in the list, in document order. */
|
|
71
71
|
private get _visible();
|
|
72
|
+
/** The markup wrote a `value` attribute (read before the reflected default can add one). */
|
|
73
|
+
private _authoredValue;
|
|
72
74
|
connectedCallback(): void;
|
|
73
75
|
/** Whether the initial choice has been settled (a value, or an option marked `selected`). */
|
|
74
76
|
private _initial;
|
|
@@ -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();
|
|
@@ -27,14 +28,14 @@ var m = class extends i(n) {
|
|
|
27
28
|
attr: (e, t, n) => this._parts.set(e, t, n),
|
|
28
29
|
style: (e, t, n) => this._parts.style(e, t, n),
|
|
29
30
|
initialFocus: () => !1
|
|
30
|
-
}), this._initial = !1, this._onPointerDown = (e) => {
|
|
31
|
+
}), this._authoredValue = null, this._initial = !1, this._onPointerDown = (e) => {
|
|
31
32
|
let t = this._content();
|
|
32
33
|
if (!t || !t.contains(e.target)) return;
|
|
33
34
|
e.preventDefault();
|
|
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) => {
|
|
@@ -73,11 +74,11 @@ var m = class extends i(n) {
|
|
|
73
74
|
return this._options.filter((t) => l(t).toLowerCase().includes(e));
|
|
74
75
|
}
|
|
75
76
|
connectedCallback() {
|
|
76
|
-
super.connectedCallback(), this.addEventListener("mousedown", this._onPointerDown);
|
|
77
|
+
this._authoredValue ??= this.hasAttribute("value"), super.connectedCallback(), this.addEventListener("mousedown", this._onPointerDown);
|
|
77
78
|
}
|
|
78
79
|
_adoptSelected(e) {
|
|
79
80
|
if (this._initial) return;
|
|
80
|
-
if (this.value || this.
|
|
81
|
+
if (this.value || this._authoredValue) {
|
|
81
82
|
this._initial = !0;
|
|
82
83
|
return;
|
|
83
84
|
}
|
|
@@ -166,19 +167,22 @@ var m = class extends i(n) {
|
|
|
166
167
|
}));
|
|
167
168
|
}
|
|
168
169
|
};
|
|
169
|
-
|
|
170
|
+
t([f({
|
|
171
|
+
type: String,
|
|
172
|
+
reflect: !0
|
|
173
|
+
})], m.prototype, "value", void 0), t([f({ type: String })], m.prototype, "placeholder", void 0), t([f({
|
|
170
174
|
type: Boolean,
|
|
171
175
|
reflect: !0
|
|
172
|
-
})], m.prototype, "disabled", void 0),
|
|
176
|
+
})], m.prototype, "disabled", void 0), t([f({
|
|
173
177
|
type: String,
|
|
174
178
|
reflect: !0
|
|
175
|
-
})], m.prototype, "size", void 0),
|
|
179
|
+
})], m.prototype, "size", void 0), t([f({
|
|
176
180
|
type: String,
|
|
177
181
|
reflect: !0
|
|
178
|
-
})], m.prototype, "error", void 0),
|
|
182
|
+
})], m.prototype, "error", void 0), t([f({
|
|
179
183
|
type: String,
|
|
180
184
|
reflect: !0
|
|
181
|
-
})], m.prototype, "name", void 0),
|
|
185
|
+
})], m.prototype, "name", void 0), t([f({
|
|
182
186
|
type: Boolean,
|
|
183
187
|
reflect: !0
|
|
184
188
|
})], m.prototype, "open", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", m);
|
|
@@ -5,7 +5,7 @@ export declare class VoidComposeInput extends VoidElement {
|
|
|
5
5
|
static labelTarget: string;
|
|
6
6
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
7
7
|
static editState: string[];
|
|
8
|
-
/** The draft text. It is cleared after each send. */
|
|
8
|
+
/** The draft text, reflected to the `value` attribute as it changes. It is cleared after each send. */
|
|
9
9
|
value: string;
|
|
10
10
|
/** Hint shown while the box is empty. Defaults to `Type a message...`. */
|
|
11
11
|
placeholder: string;
|
|
@@ -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,15 +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({
|
|
72
|
+
type: String,
|
|
73
|
+
reflect: !0
|
|
74
|
+
})], o.prototype, "placeholder", void 0), t([i({
|
|
70
75
|
type: Boolean,
|
|
71
76
|
reflect: !0
|
|
72
|
-
})],
|
|
77
|
+
})], o.prototype, "disabled", void 0), t([i({
|
|
73
78
|
type: Number,
|
|
74
79
|
reflect: !0
|
|
75
|
-
})],
|
|
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);
|
|
76
81
|
//#endregion
|
|
77
|
-
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 {
|
|
@@ -14,7 +14,7 @@ export declare class VoidEditable extends VoidEditable_base {
|
|
|
14
14
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
15
15
|
static editState: string[];
|
|
16
16
|
/**
|
|
17
|
-
* The committed text.
|
|
17
|
+
* The committed text. Reflected to the attribute as it changes; the form's reset target stays the value it started with. Text still
|
|
18
18
|
* being edited is not part of it until committed.
|
|
19
19
|
*/
|
|
20
20
|
value: string;
|