@voidable/ui 0.11.0 → 0.12.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/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,13 +1,14 @@
|
|
|
1
1
|
import { t as e } from "../chunks/base-BGrS4eIl.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import { r } from "../chunks/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { msg as n } from "../messages.js";
|
|
4
|
+
import { t as r } from "../chunks/form-control-fL-Hhy91.js";
|
|
5
|
+
import { r as i } from "../chunks/projection-oPe6ipjL.js";
|
|
6
|
+
import { html as a, nothing as o } from "lit";
|
|
7
|
+
import { property as s } from "lit/decorators.js";
|
|
8
|
+
import { live as c } from "lit/directives/live.js";
|
|
8
9
|
//#region src/components/color-picker.ts
|
|
9
|
-
|
|
10
|
-
var
|
|
10
|
+
i();
|
|
11
|
+
var l = class t extends r(e) {
|
|
11
12
|
constructor(...e) {
|
|
12
13
|
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) => {
|
|
13
14
|
this.open && (this.contains(e.target) || (this.open = !1));
|
|
@@ -122,7 +123,7 @@ var c = class t extends n(e) {
|
|
|
122
123
|
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));
|
|
123
124
|
}
|
|
124
125
|
_renderPicker() {
|
|
125
|
-
return
|
|
126
|
+
return a`
|
|
126
127
|
<div class="void-color-picker">
|
|
127
128
|
<div
|
|
128
129
|
class="void-color-picker-area"
|
|
@@ -136,25 +137,25 @@ var c = class t extends n(e) {
|
|
|
136
137
|
>
|
|
137
138
|
<div class="void-color-picker-hue-thumb"></div>
|
|
138
139
|
</div>
|
|
139
|
-
${this.hideInput ?
|
|
140
|
+
${this.hideInput ? a`
|
|
140
141
|
<div class="void-color-picker-preview"></div>
|
|
141
|
-
` :
|
|
142
|
+
` : a`
|
|
142
143
|
<div class="void-color-picker-field">
|
|
143
144
|
<span class="void-color-picker-field-swatch"></span>
|
|
144
145
|
<span class="void-color-picker-field-separator"></span>
|
|
145
146
|
<input
|
|
146
147
|
class="void-color-picker-input"
|
|
147
148
|
type="text"
|
|
148
|
-
.value=${
|
|
149
|
+
.value=${c(this.value)}
|
|
149
150
|
?disabled=${this.disabled}
|
|
150
151
|
maxlength="7"
|
|
151
152
|
@change=${this._onHexInput}
|
|
152
153
|
/>
|
|
153
154
|
</div>
|
|
154
155
|
`}
|
|
155
|
-
${this.swatches.length > 0 ?
|
|
156
|
+
${this.swatches.length > 0 ? a`
|
|
156
157
|
<div class="void-color-picker-swatches">
|
|
157
|
-
${this.swatches.map((e) =>
|
|
158
|
+
${this.swatches.map((e) => a`
|
|
158
159
|
<button
|
|
159
160
|
type="button"
|
|
160
161
|
class="void-color-picker-swatch"
|
|
@@ -165,12 +166,12 @@ var c = class t extends n(e) {
|
|
|
165
166
|
></button>
|
|
166
167
|
`)}
|
|
167
168
|
</div>
|
|
168
|
-
` :
|
|
169
|
+
` : o}
|
|
169
170
|
</div>
|
|
170
171
|
`;
|
|
171
172
|
}
|
|
172
173
|
render() {
|
|
173
|
-
return this.compact ?
|
|
174
|
+
return this.compact ? a`
|
|
174
175
|
<div class="void-color-picker-compact">
|
|
175
176
|
<button
|
|
176
177
|
type="button"
|
|
@@ -185,41 +186,41 @@ var c = class t extends n(e) {
|
|
|
185
186
|
<input
|
|
186
187
|
class="void-color-picker-compact-input"
|
|
187
188
|
type="text"
|
|
188
|
-
.value=${
|
|
189
|
+
.value=${c(this.value)}
|
|
189
190
|
?disabled=${this.disabled}
|
|
190
191
|
maxlength="7"
|
|
191
192
|
@click=${(e) => e.stopPropagation()}
|
|
192
193
|
@change=${this._onCompactHexInput}
|
|
193
194
|
/>
|
|
194
195
|
</button>
|
|
195
|
-
${this.open ?
|
|
196
|
-
<div class="void-color-picker-compact-dropdown" role="dialog" aria-label
|
|
196
|
+
${this.open ? a`
|
|
197
|
+
<div class="void-color-picker-compact-dropdown" role="dialog" aria-label=${n(this, "colorPicker.label")}>
|
|
197
198
|
${this._renderPicker()}
|
|
198
199
|
</div>
|
|
199
|
-
` :
|
|
200
|
+
` : o}
|
|
200
201
|
</div>
|
|
201
202
|
` : this._renderPicker();
|
|
202
203
|
}
|
|
203
204
|
};
|
|
204
|
-
t([
|
|
205
|
+
t([s({
|
|
205
206
|
type: String,
|
|
206
207
|
reflect: !0
|
|
207
|
-
})],
|
|
208
|
+
})], l.prototype, "value", void 0), t([s({
|
|
208
209
|
type: Boolean,
|
|
209
210
|
reflect: !0
|
|
210
|
-
})],
|
|
211
|
+
})], l.prototype, "disabled", void 0), t([s({
|
|
211
212
|
type: String,
|
|
212
213
|
reflect: !0
|
|
213
|
-
})],
|
|
214
|
+
})], l.prototype, "size", void 0), t([s({ type: Array })], l.prototype, "swatches", void 0), t([s({
|
|
214
215
|
type: Boolean,
|
|
215
216
|
attribute: "hide-input",
|
|
216
217
|
reflect: !0
|
|
217
|
-
})],
|
|
218
|
+
})], l.prototype, "hideInput", void 0), t([s({
|
|
218
219
|
type: Boolean,
|
|
219
220
|
reflect: !0
|
|
220
|
-
})],
|
|
221
|
+
})], l.prototype, "compact", void 0), t([s({
|
|
221
222
|
type: Boolean,
|
|
222
223
|
reflect: !0
|
|
223
|
-
})],
|
|
224
|
+
})], l.prototype, "open", void 0), customElements.get("void-color-picker") || customElements.define("void-color-picker", l);
|
|
224
225
|
//#endregion
|
|
225
|
-
export {
|
|
226
|
+
export { l as VoidColorPicker };
|
|
@@ -2,6 +2,7 @@ import { VoidElement } from '../base.js';
|
|
|
2
2
|
import { OverlayController } from '../overlay.js';
|
|
3
3
|
import { PartsController } from '../parts.js';
|
|
4
4
|
import { ProjectionController } from '../projection.js';
|
|
5
|
+
import { KeyOverrides } from '../keys.js';
|
|
5
6
|
declare const VoidCombobox_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
|
|
6
7
|
/**
|
|
7
8
|
* Filterable dropdown for long option lists like country selectors, user assignment fields, and tag pickers.
|
|
@@ -30,6 +31,16 @@ declare const VoidCombobox_base: (new (...args: any[]) => import('../form-contro
|
|
|
30
31
|
* @fires {CustomEvent<{ reason: 'escape' | 'outside' | 'blur' | 'select' | 'parent' | 'api' }>} void-close - The option list is closing.
|
|
31
32
|
*/
|
|
32
33
|
export declare class VoidCombobox extends VoidCombobox_base {
|
|
34
|
+
/** Key bindings for this element's actions, as JSON (`{"close":["Escape"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
35
|
+
keys: KeyOverrides | null;
|
|
36
|
+
/** @internal The actions of this element and their default keys. */
|
|
37
|
+
static readonly keyMap: {
|
|
38
|
+
next: string[];
|
|
39
|
+
previous: string[];
|
|
40
|
+
open: string[];
|
|
41
|
+
activate: string[];
|
|
42
|
+
close: string[];
|
|
43
|
+
};
|
|
33
44
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
34
45
|
static labelTarget: string;
|
|
35
46
|
/**
|
|
@@ -38,10 +49,11 @@ export declare class VoidCombobox extends VoidCombobox_base {
|
|
|
38
49
|
*/
|
|
39
50
|
value: string;
|
|
40
51
|
/**
|
|
41
|
-
* Hint shown in the search field while it is empty. Defaults to `Search
|
|
52
|
+
* Hint shown in the search field while it is empty. Defaults to the `combobox.placeholder` message (English: `Search...`). It is also the field's
|
|
42
53
|
* accessible name when no `void-field` label names it.
|
|
43
54
|
*/
|
|
44
55
|
placeholder: string;
|
|
56
|
+
private get _hint();
|
|
45
57
|
/** Stop the field opening and exclude the value from the form submission. */
|
|
46
58
|
disabled: boolean;
|
|
47
59
|
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
@@ -1,23 +1,26 @@
|
|
|
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 {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
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, t as s } from "../chunks/projection-oPe6ipjL.js";
|
|
7
|
+
import { n as c } from "../chunks/parts-DI_3VpSy.js";
|
|
8
|
+
import { n as l, r as u } from "../chunks/keyboard-ChtDvhB_.js";
|
|
9
|
+
import { n as d } from "../chunks/pickers-CjlFgNke.js";
|
|
10
|
+
import { t as f } from "../chunks/overlay-BuV-4Yvt.js";
|
|
11
|
+
import { optionLabel as p } from "./multiselect.js";
|
|
12
|
+
import { html as m, nothing as h } from "lit";
|
|
13
|
+
import { property as g } from "lit/decorators.js";
|
|
14
|
+
import { live as _ } from "lit/directives/live.js";
|
|
12
15
|
//#region src/components/combobox.ts
|
|
13
|
-
var
|
|
16
|
+
var v = class extends a(e) {
|
|
14
17
|
constructor(...e) {
|
|
15
|
-
super(...e), this.value = "", this.placeholder = "
|
|
18
|
+
super(...e), this.keys = null, this.value = "", this.placeholder = "", this.disabled = !1, this.size = "md", this.error = "", this.name = "", this.open = !1, this._query = "", this._active = null, this._wiring = !1, this._projection = new s(this, { placement: "start" }), this._parts = new c(this, {
|
|
16
19
|
tags: ["void-combobox-content", "void-option"],
|
|
17
20
|
onChange: () => {
|
|
18
21
|
this._wire(), this._wiring || this.requestUpdate();
|
|
19
22
|
}
|
|
20
|
-
}), this._overlay = new
|
|
23
|
+
}), this._overlay = new f(this, {
|
|
21
24
|
kind: "listbox",
|
|
22
25
|
surface: () => this._content(),
|
|
23
26
|
isOpen: () => this.open && !this.disabled,
|
|
@@ -35,29 +38,36 @@ var m = class extends n(e) {
|
|
|
35
38
|
let n = e.target.closest("void-option");
|
|
36
39
|
n && !n.disabled && this._options.includes(n) && this._selectOption(n);
|
|
37
40
|
}, this._onInputFocus = () => {
|
|
38
|
-
this.disabled ||
|
|
41
|
+
this.disabled || o(this) || (this._overlay.requestOpen("focus"), this._query = "", this._active = null);
|
|
39
42
|
}, this._onInput = (e) => {
|
|
40
43
|
this._query = e.target.value, this.open = !0, this._active = null, this.requestUpdate();
|
|
41
44
|
}, this._onInputKeydown = (e) => {
|
|
42
45
|
if (this.disabled || e.isComposing) return;
|
|
43
|
-
let t = e.key;
|
|
44
|
-
if (
|
|
45
|
-
if (e.preventDefault(), this.open)
|
|
46
|
-
else
|
|
46
|
+
let t = e.key, r = n(this, e);
|
|
47
|
+
if (r === "next" || r === "previous") {
|
|
48
|
+
if (e.preventDefault(), this.open) this._moveActive(r === "next" ? "next" : "prev");
|
|
49
|
+
else {
|
|
50
|
+
this._query = "", this._overlay.requestOpen("keyboard");
|
|
47
51
|
let e = this._visible.find((e) => e.value === this.value && !e.disabled);
|
|
48
|
-
e ? this._active = e : this._moveActive(
|
|
52
|
+
e ? this._active = e : this._moveActive(r === "next" ? "next" : "prev");
|
|
49
53
|
}
|
|
50
54
|
this.requestUpdate();
|
|
51
|
-
} else
|
|
55
|
+
} else r === "open" ? (e.preventDefault(), this.open || (this._query = "", this._overlay.requestOpen("keyboard")), this.requestUpdate()) : r === "activate" ? this.open && this._active && !this._active.disabled ? (e.preventDefault(), this._selectOption(this._active)) : this.open && this._close("escape") : r === "close" ? this.open && (e.preventDefault(), e.stopPropagation(), this._close("escape")) : !e.defaultPrevented && (t === "ArrowLeft" || t === "ArrowRight" || t === "Home" || t === "End") && this._active && (this._active = null, this.requestUpdate());
|
|
52
56
|
}, this._onInputBlur = () => {
|
|
53
57
|
setTimeout(() => {
|
|
54
58
|
this.contains(document.activeElement) && document.activeElement?.tagName === "INPUT" || this._close("blur");
|
|
55
59
|
}, 150);
|
|
56
60
|
};
|
|
57
61
|
}
|
|
62
|
+
static {
|
|
63
|
+
this.keyMap = d;
|
|
64
|
+
}
|
|
58
65
|
static {
|
|
59
66
|
this.labelTarget = "input[role=combobox]";
|
|
60
67
|
}
|
|
68
|
+
get _hint() {
|
|
69
|
+
return this.placeholder || i(this, "combobox.placeholder");
|
|
70
|
+
}
|
|
61
71
|
_content() {
|
|
62
72
|
return this._parts.one("void-combobox-content");
|
|
63
73
|
}
|
|
@@ -71,7 +81,7 @@ var m = class extends n(e) {
|
|
|
71
81
|
get _visible() {
|
|
72
82
|
if (!this._query) return this._options;
|
|
73
83
|
let e = this._query.toLowerCase();
|
|
74
|
-
return this._options.filter((t) =>
|
|
84
|
+
return this._options.filter((t) => p(t).toLowerCase().includes(e));
|
|
75
85
|
}
|
|
76
86
|
connectedCallback() {
|
|
77
87
|
this._authoredValue ??= this.hasAttribute("value"), super.connectedCallback(), this.addEventListener("mousedown", this._onPointerDown);
|
|
@@ -98,47 +108,47 @@ var m = class extends n(e) {
|
|
|
98
108
|
this.open && this._active?.scrollIntoView?.({ block: "nearest" });
|
|
99
109
|
}
|
|
100
110
|
_wire() {
|
|
101
|
-
let e = this._content(), t = this._input(), n = this._options, r = this.open && !this.disabled,
|
|
111
|
+
let e = this._content(), t = this._input(), n = this._options, r = this.open && !this.disabled, a = r ? this._query.toLowerCase() : "";
|
|
102
112
|
this._adoptSelected(n), this._active && (!n.includes(this._active) || this._active.disabled) && (this._active = null);
|
|
103
|
-
let
|
|
113
|
+
let o = 0;
|
|
104
114
|
for (let e of n) {
|
|
105
115
|
this._parts.set(e, "role", "option"), this._parts.id(e, "void-option"), this._parts.set(e, "aria-selected", e.value === this.value ? "true" : null), this._parts.set(e, "aria-disabled", e.disabled ? "true" : null);
|
|
106
|
-
let t = !
|
|
107
|
-
this._parts.set(e, "hidden", !t), t ?
|
|
116
|
+
let t = !a || p(e).toLowerCase().includes(a);
|
|
117
|
+
this._parts.set(e, "hidden", !t), t ? o++ : e === this._active && (this._active = null), this._parts.set(e, "active", e === this._active);
|
|
108
118
|
}
|
|
109
119
|
if (e) {
|
|
110
120
|
this._parts.set(e, "popover", "manual"), this._parts.set(e, "role", "listbox"), this._parts.id(e, "void-combobox-content");
|
|
111
121
|
let n = r ? t?.getAttribute("aria-labelledby") ?? null : null;
|
|
112
|
-
this._parts.set(e, "aria-labelledby", n), this._parts.set(e, "aria-label", r && !n && (t?.getAttribute("aria-label") || this.
|
|
122
|
+
this._parts.set(e, "aria-labelledby", n), this._parts.set(e, "aria-label", r && !n && (t?.getAttribute("aria-label") || this._hint) || null), this.setHostStyle("--_void-combobox-empty", JSON.stringify(i(this, "combobox.empty"))), this._parts.set(e, "empty", o === 0), t && this._parts.set(t, "aria-activedescendant", r && this._active ? this._parts.id(this._active, "void-option") : null);
|
|
113
123
|
}
|
|
114
124
|
}
|
|
115
125
|
_controls(e) {
|
|
116
126
|
let t = e ? this._content() : null;
|
|
117
|
-
return t ? this._parts.id(t, "void-combobox-content") :
|
|
127
|
+
return t ? this._parts.id(t, "void-combobox-content") : h;
|
|
118
128
|
}
|
|
119
129
|
render() {
|
|
120
130
|
let e = this._options.find((e) => e.value === this.value), t = this.open && !this.disabled;
|
|
121
|
-
return
|
|
131
|
+
return m`
|
|
122
132
|
<input
|
|
123
133
|
class="void-combobox-input"
|
|
124
134
|
role="combobox"
|
|
125
|
-
.value=${
|
|
126
|
-
placeholder=${this.
|
|
127
|
-
aria-label=${this.
|
|
135
|
+
.value=${_(t ? this._query : e ? p(e) : this.value || "")}
|
|
136
|
+
placeholder=${this._hint}
|
|
137
|
+
aria-label=${this._hint}
|
|
128
138
|
?disabled=${this.disabled}
|
|
129
139
|
autocomplete="off"
|
|
130
140
|
aria-autocomplete="list"
|
|
131
141
|
aria-haspopup="listbox"
|
|
132
142
|
aria-expanded=${String(t)}
|
|
133
143
|
aria-controls=${this._controls(t)}
|
|
134
|
-
aria-required=${this.required ? "true" :
|
|
144
|
+
aria-required=${this.required ? "true" : h}
|
|
135
145
|
aria-invalid=${this.error ? "true" : "false"}
|
|
136
146
|
@focus=${this._onInputFocus}
|
|
137
147
|
@input=${this._onInput}
|
|
138
148
|
@keydown=${this._onInputKeydown}
|
|
139
149
|
@blur=${this._onInputBlur}
|
|
140
150
|
/>
|
|
141
|
-
${this.error ?
|
|
151
|
+
${this.error ? m`<span class="void-combobox-error">${this.error}</span>` : h}
|
|
142
152
|
`;
|
|
143
153
|
}
|
|
144
154
|
disconnectedCallback() {
|
|
@@ -157,7 +167,7 @@ var m = class extends n(e) {
|
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
let i;
|
|
160
|
-
i = e === "next" ?
|
|
170
|
+
i = e === "next" ? u(n, r, 1) : r < 0 ? l(n, -1) : u(n, r, -1), this._active = i >= 0 ? t[i] : null;
|
|
161
171
|
}
|
|
162
172
|
_selectOption(e) {
|
|
163
173
|
this._initial = !0, this.value = e.value, this._close("select"), this.dispatchEvent(new CustomEvent("void-change", {
|
|
@@ -167,24 +177,27 @@ var m = class extends n(e) {
|
|
|
167
177
|
}));
|
|
168
178
|
}
|
|
169
179
|
};
|
|
170
|
-
t([
|
|
180
|
+
t([g({
|
|
181
|
+
attribute: "keys",
|
|
182
|
+
converter: r
|
|
183
|
+
})], v.prototype, "keys", void 0), t([g({
|
|
171
184
|
type: String,
|
|
172
185
|
reflect: !0
|
|
173
|
-
})],
|
|
186
|
+
})], v.prototype, "value", void 0), t([g({ type: String })], v.prototype, "placeholder", void 0), t([g({
|
|
174
187
|
type: Boolean,
|
|
175
188
|
reflect: !0
|
|
176
|
-
})],
|
|
189
|
+
})], v.prototype, "disabled", void 0), t([g({
|
|
177
190
|
type: String,
|
|
178
191
|
reflect: !0
|
|
179
|
-
})],
|
|
192
|
+
})], v.prototype, "size", void 0), t([g({
|
|
180
193
|
type: String,
|
|
181
194
|
reflect: !0
|
|
182
|
-
})],
|
|
195
|
+
})], v.prototype, "error", void 0), t([g({
|
|
183
196
|
type: String,
|
|
184
197
|
reflect: !0
|
|
185
|
-
})],
|
|
198
|
+
})], v.prototype, "name", void 0), t([g({
|
|
186
199
|
type: Boolean,
|
|
187
200
|
reflect: !0
|
|
188
|
-
})],
|
|
201
|
+
})], v.prototype, "open", void 0), customElements.get("void-combobox") || customElements.define("void-combobox", v);
|
|
189
202
|
//#endregion
|
|
190
|
-
export {
|
|
203
|
+
export { v as VoidCombobox };
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
+
import { KeyOverrides } from '../keys.js';
|
|
2
3
|
/** Rich text entry area for messaging UIs, comment boxes, and social post composers. */
|
|
3
4
|
export declare class VoidComposeInput extends VoidElement {
|
|
5
|
+
/** Key bindings for this element's actions, as JSON (`{"send":["Control+Enter"]}`); `[]` switches an action off. See the keyboard guide. */
|
|
6
|
+
keys: KeyOverrides | null;
|
|
7
|
+
/** @internal The actions of this element and their default keys. */
|
|
8
|
+
static readonly keyMap: {
|
|
9
|
+
send: string[];
|
|
10
|
+
};
|
|
4
11
|
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
5
12
|
static labelTarget: string;
|
|
6
13
|
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
7
14
|
static editState: string[];
|
|
8
15
|
/** The draft text, reflected to the `value` attribute as it changes. It is cleared after each send. */
|
|
9
16
|
value: string;
|
|
10
|
-
/** Hint shown while the box is empty. Defaults to `Type a message
|
|
17
|
+
/** Hint shown while the box is empty. Defaults to the `composeInput.placeholder` message (English: `Type a message...`). */
|
|
11
18
|
placeholder: string;
|
|
19
|
+
private get _hint();
|
|
12
20
|
/** Stop the box and the send button reacting. */
|
|
13
21
|
disabled: boolean;
|
|
14
22
|
/** Maximum number of characters. 0 (the default) means no limit. */
|
|
@@ -1,13 +1,19 @@
|
|
|
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 {
|
|
3
|
+
import { actionFor as n, keysConverter as r } from "../keys.js";
|
|
4
|
+
import { msg as i } from "../messages.js";
|
|
5
|
+
import { r as a } from "../chunks/projection-oPe6ipjL.js";
|
|
6
|
+
import { t as o } from "../chunks/fields-MEqz-olE.js";
|
|
7
|
+
import { html as s } from "lit";
|
|
8
|
+
import { property as c, query as l } from "lit/decorators.js";
|
|
6
9
|
//#region src/components/compose-input.ts
|
|
7
|
-
|
|
8
|
-
var
|
|
10
|
+
a();
|
|
11
|
+
var u = class extends e {
|
|
9
12
|
constructor(...e) {
|
|
10
|
-
super(...e), this.value = "", this.placeholder = "
|
|
13
|
+
super(...e), this.keys = null, this.value = "", this.placeholder = "", this.disabled = !1, this.maxlength = 0;
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.keyMap = o;
|
|
11
17
|
}
|
|
12
18
|
static {
|
|
13
19
|
this.labelTarget = "textarea";
|
|
@@ -15,13 +21,16 @@ var o = class extends e {
|
|
|
15
21
|
static {
|
|
16
22
|
this.editState = ["value"];
|
|
17
23
|
}
|
|
24
|
+
get _hint() {
|
|
25
|
+
return this.placeholder || i(this, "composeInput.placeholder");
|
|
26
|
+
}
|
|
18
27
|
render() {
|
|
19
|
-
return
|
|
28
|
+
return s`
|
|
20
29
|
<div class="void-compose-input-wrapper">
|
|
21
30
|
<textarea
|
|
22
31
|
class="void-compose-input-textarea"
|
|
23
32
|
.value=${this.value}
|
|
24
|
-
placeholder=${this.
|
|
33
|
+
placeholder=${this._hint}
|
|
25
34
|
?disabled=${this.disabled}
|
|
26
35
|
maxlength=${this.maxlength > 0 ? this.maxlength : ""}
|
|
27
36
|
rows="1"
|
|
@@ -33,7 +42,7 @@ var o = class extends e {
|
|
|
33
42
|
type="button"
|
|
34
43
|
?disabled=${this.disabled || !this.value}
|
|
35
44
|
@click=${this._onSend}
|
|
36
|
-
aria-label
|
|
45
|
+
aria-label=${i(this, "composeInput.send")}
|
|
37
46
|
>
|
|
38
47
|
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
39
48
|
<path d="M2 8L14 8M14 8L9 3M14 8L9 13" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
@@ -53,7 +62,7 @@ var o = class extends e {
|
|
|
53
62
|
}));
|
|
54
63
|
}
|
|
55
64
|
_onKeydown(e) {
|
|
56
|
-
e
|
|
65
|
+
n(this, e) === "send" && (e.preventDefault(), this._onSend());
|
|
57
66
|
}
|
|
58
67
|
_onSend() {
|
|
59
68
|
if (this.disabled || !this.value) return;
|
|
@@ -65,18 +74,21 @@ var o = class extends e {
|
|
|
65
74
|
}));
|
|
66
75
|
}
|
|
67
76
|
};
|
|
68
|
-
t([
|
|
77
|
+
t([c({
|
|
78
|
+
attribute: "keys",
|
|
79
|
+
converter: r
|
|
80
|
+
})], u.prototype, "keys", void 0), t([c({
|
|
69
81
|
type: String,
|
|
70
82
|
reflect: !0
|
|
71
|
-
})],
|
|
83
|
+
})], u.prototype, "value", void 0), t([c({
|
|
72
84
|
type: String,
|
|
73
85
|
reflect: !0
|
|
74
|
-
})],
|
|
86
|
+
})], u.prototype, "placeholder", void 0), t([c({
|
|
75
87
|
type: Boolean,
|
|
76
88
|
reflect: !0
|
|
77
|
-
})],
|
|
89
|
+
})], u.prototype, "disabled", void 0), t([c({
|
|
78
90
|
type: Number,
|
|
79
91
|
reflect: !0
|
|
80
|
-
})],
|
|
92
|
+
})], u.prototype, "maxlength", void 0), t([l(".void-compose-input-textarea")], u.prototype, "_textarea", void 0), customElements.get("void-compose-input") || customElements.define("void-compose-input", u);
|
|
81
93
|
//#endregion
|
|
82
|
-
export {
|
|
94
|
+
export { u 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-Cz2-Ov76.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 {
|