@voidable/ui 0.6.1 → 0.8.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 +168 -9
- package/dist/angular/index.d.ts +20 -0
- package/dist/angular/index.js +78 -0
- package/dist/autoloader-core.d.ts +45 -0
- package/dist/autoloader-table.generated.d.ts +5 -0
- package/dist/autoloader.d.ts +13 -0
- package/dist/autoloader.js +229 -0
- package/dist/base.d.ts +173 -2
- package/dist/base.js +2 -9
- package/dist/chunks/base-CMruMbxC.js +824 -0
- package/dist/chunks/disclosure-Bj_49GcC.js +23 -0
- package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
- package/dist/chunks/form-control-C0vH6gii.js +300 -0
- package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
- package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
- package/dist/chunks/modal-D_YVy2vg.js +71 -0
- package/dist/chunks/overlay-BywGMcDW.js +467 -0
- package/dist/chunks/parts-D30c8OoG.js +229 -0
- package/dist/chunks/{shape-FJvZa8FW.js → shape-C_LW7EjG.js} +12 -4
- package/dist/components/accordion.d.ts +38 -10
- package/dist/components/accordion.js +51 -53
- package/dist/components/action-input.d.ts +64 -6
- package/dist/components/action-input.js +84 -41
- package/dist/components/alert.d.ts +24 -10
- package/dist/components/alert.js +26 -27
- package/dist/components/avatar.d.ts +8 -2
- package/dist/components/avatar.js +3 -3
- package/dist/components/badge.d.ts +8 -3
- package/dist/components/badge.js +2 -2
- package/dist/components/banner.d.ts +21 -10
- package/dist/components/banner.js +27 -27
- package/dist/components/bar-chart.d.ts +30 -6
- package/dist/components/bar-chart.js +29 -39
- package/dist/components/breadcrumbs.d.ts +19 -6
- package/dist/components/breadcrumbs.js +16 -22
- package/dist/components/button.d.ts +64 -10
- package/dist/components/button.js +70 -26
- package/dist/components/calendar.d.ts +65 -10
- package/dist/components/calendar.js +157 -106
- package/dist/components/card.d.ts +14 -9
- package/dist/components/card.js +8 -22
- package/dist/components/carousel.d.ts +65 -14
- package/dist/components/carousel.js +84 -93
- package/dist/components/charts/scale.d.ts +0 -1
- package/dist/components/charts/shape.d.ts +0 -1
- package/dist/components/checkbox-group.d.ts +38 -5
- package/dist/components/checkbox-group.js +61 -20
- package/dist/components/checkbox.d.ts +53 -7
- package/dist/components/checkbox.js +66 -29
- package/dist/components/collapsible.d.ts +29 -9
- package/dist/components/collapsible.js +42 -44
- package/dist/components/color-picker.d.ts +20 -4
- package/dist/components/color-picker.js +35 -29
- package/dist/components/combobox.d.ts +84 -10
- package/dist/components/combobox.js +142 -45
- package/dist/components/compose-input.d.ts +8 -1
- package/dist/components/compose-input.js +9 -3
- package/dist/components/dialog.d.ts +24 -20
- package/dist/components/dialog.js +8 -57
- package/dist/components/divider.d.ts +8 -1
- package/dist/components/divider.js +3 -3
- package/dist/components/donut-chart.d.ts +28 -5
- package/dist/components/donut-chart.js +55 -54
- package/dist/components/drawer.d.ts +19 -18
- package/dist/components/drawer.js +9 -53
- package/dist/components/dropdown-menu.d.ts +62 -7
- package/dist/components/dropdown-menu.js +124 -33
- package/dist/components/editable.d.ts +37 -3
- package/dist/components/editable.js +45 -24
- package/dist/components/error-fallback.d.ts +36 -5
- package/dist/components/error-fallback.js +73 -23
- package/dist/components/field.d.ts +38 -4
- package/dist/components/field.js +63 -21
- package/dist/components/file-upload.d.ts +23 -2
- package/dist/components/file-upload.js +47 -24
- package/dist/components/gauge.d.ts +48 -9
- package/dist/components/gauge.js +57 -55
- package/dist/components/hamburger.d.ts +19 -4
- package/dist/components/hamburger.js +28 -19
- package/dist/components/hover-card.d.ts +40 -14
- package/dist/components/hover-card.js +76 -59
- package/dist/components/indicator.d.ts +18 -7
- package/dist/components/indicator.js +16 -18
- package/dist/components/input.d.ts +70 -5
- package/dist/components/input.js +83 -20
- package/dist/components/line-chart.d.ts +27 -5
- package/dist/components/line-chart.js +19 -21
- package/dist/components/list.d.ts +10 -1
- package/dist/components/list.js +3 -3
- package/dist/components/menu.d.ts +67 -21
- package/dist/components/menu.js +116 -115
- package/dist/components/multiselect.d.ts +108 -13
- package/dist/components/multiselect.js +207 -70
- package/dist/components/nav-bar.d.ts +12 -7
- package/dist/components/nav-bar.js +11 -21
- package/dist/components/nav-menu.d.ts +52 -12
- package/dist/components/nav-menu.js +68 -70
- package/dist/components/number-input.d.ts +76 -8
- package/dist/components/number-input.js +117 -51
- package/dist/components/pagination.d.ts +19 -1
- package/dist/components/pagination.js +68 -7
- package/dist/components/panel.d.ts +16 -8
- package/dist/components/panel.js +20 -20
- package/dist/components/pin-input.d.ts +41 -4
- package/dist/components/pin-input.js +45 -27
- package/dist/components/popover.d.ts +29 -11
- package/dist/components/popover.js +47 -35
- package/dist/components/progress.d.ts +7 -3
- package/dist/components/progress.js +3 -3
- package/dist/components/radio-group.d.ts +30 -5
- package/dist/components/radio-group.js +56 -19
- package/dist/components/radio.d.ts +47 -7
- package/dist/components/radio.js +68 -29
- package/dist/components/scroll-area.d.ts +8 -5
- package/dist/components/scroll-area.js +19 -20
- package/dist/components/segmented-control.d.ts +52 -8
- package/dist/components/segmented-control.js +66 -36
- package/dist/components/select.d.ts +59 -12
- package/dist/components/select.js +96 -46
- package/dist/components/sidebar.d.ts +22 -3
- package/dist/components/sidebar.js +20 -10
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +4 -4
- package/dist/components/slider.d.ts +27 -5
- package/dist/components/slider.js +29 -17
- package/dist/components/spinner.d.ts +6 -2
- package/dist/components/spinner.js +3 -3
- package/dist/components/stat.d.ts +21 -4
- package/dist/components/stat.js +7 -3
- package/dist/components/status-dot.d.ts +4 -1
- package/dist/components/status-dot.js +3 -3
- package/dist/components/stepper.d.ts +5 -1
- package/dist/components/stepper.js +2 -2
- package/dist/components/switch.d.ts +24 -5
- package/dist/components/switch.js +37 -19
- package/dist/components/table.d.ts +51 -2
- package/dist/components/table.js +157 -8
- package/dist/components/tabs.d.ts +49 -17
- package/dist/components/tabs.js +85 -54
- package/dist/components/tag.d.ts +17 -7
- package/dist/components/tag.js +19 -21
- package/dist/components/tags-input.d.ts +33 -4
- package/dist/components/tags-input.js +40 -30
- package/dist/components/textarea.d.ts +61 -5
- package/dist/components/textarea.js +58 -21
- package/dist/components/toast.d.ts +89 -15
- package/dist/components/toast.js +105 -30
- package/dist/components/toggle-group.d.ts +30 -3
- package/dist/components/toggle-group.js +43 -16
- package/dist/components/toggle.d.ts +25 -4
- package/dist/components/toggle.js +28 -18
- package/dist/components/tooltip.d.ts +31 -12
- package/dist/components/tooltip.js +62 -28
- package/dist/components.json +1518 -0
- package/dist/custom-elements.json +31817 -0
- package/dist/dev/index.d.ts +40 -0
- package/dist/dev/rules.d.ts +46 -0
- package/dist/dev/table.generated.d.ts +8 -0
- package/dist/dev/types.d.ts +113 -0
- package/dist/dev.js +3364 -0
- package/dist/disclosure.d.ts +30 -0
- package/dist/dismiss.d.ts +20 -0
- package/dist/form-control.d.ts +92 -0
- package/dist/index.d.ts +5 -4
- package/dist/index.js +24 -24
- package/dist/keyboard-activation.d.ts +31 -0
- package/dist/keyboard.d.ts +32 -0
- package/dist/modal.d.ts +44 -0
- package/dist/overlay.d.ts +249 -0
- package/dist/parts.d.ts +171 -0
- package/dist/projection.d.ts +370 -0
- package/dist/types/elements.d.ts +648 -0
- package/dist/types/react.d.ts +163 -0
- package/dist/types/solid.d.ts +164 -0
- package/dist/types/solid2.d.ts +161 -0
- package/dist/types/svelte.d.ts +154 -0
- package/dist/types/vue.d.ts +156 -0
- package/dist/vscode.html-custom-data.json +6004 -0
- package/dist/web-types.json +8365 -0
- package/package.json +113 -21
- package/dist/base.d.ts.map +0 -1
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/action-input.d.ts.map +0 -1
- package/dist/components/alert.d.ts.map +0 -1
- package/dist/components/avatar.d.ts.map +0 -1
- package/dist/components/badge.d.ts.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/bar-chart.d.ts.map +0 -1
- package/dist/components/breadcrumbs.d.ts.map +0 -1
- package/dist/components/button.d.ts.map +0 -1
- package/dist/components/calendar.d.ts.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/carousel.d.ts.map +0 -1
- package/dist/components/charts/scale.d.ts.map +0 -1
- package/dist/components/charts/shape.d.ts.map +0 -1
- package/dist/components/checkbox-group.d.ts.map +0 -1
- package/dist/components/checkbox.d.ts.map +0 -1
- package/dist/components/collapsible.d.ts.map +0 -1
- package/dist/components/color-picker.d.ts.map +0 -1
- package/dist/components/combobox.d.ts.map +0 -1
- package/dist/components/compose-input.d.ts.map +0 -1
- package/dist/components/dialog.d.ts.map +0 -1
- package/dist/components/divider.d.ts.map +0 -1
- package/dist/components/donut-chart.d.ts.map +0 -1
- package/dist/components/drawer.d.ts.map +0 -1
- package/dist/components/dropdown-menu.d.ts.map +0 -1
- package/dist/components/editable.d.ts.map +0 -1
- package/dist/components/error-fallback.d.ts.map +0 -1
- package/dist/components/field.d.ts.map +0 -1
- package/dist/components/file-upload.d.ts.map +0 -1
- package/dist/components/gauge.d.ts.map +0 -1
- package/dist/components/hamburger.d.ts.map +0 -1
- package/dist/components/hover-card.d.ts.map +0 -1
- package/dist/components/indicator.d.ts.map +0 -1
- package/dist/components/input.d.ts.map +0 -1
- package/dist/components/line-chart.d.ts.map +0 -1
- package/dist/components/list.d.ts.map +0 -1
- package/dist/components/menu.d.ts.map +0 -1
- package/dist/components/multiselect.d.ts.map +0 -1
- package/dist/components/nav-bar.d.ts.map +0 -1
- package/dist/components/nav-menu.d.ts.map +0 -1
- package/dist/components/number-input.d.ts.map +0 -1
- package/dist/components/pagination.d.ts.map +0 -1
- package/dist/components/panel.d.ts.map +0 -1
- package/dist/components/pin-input.d.ts.map +0 -1
- package/dist/components/popover.d.ts.map +0 -1
- package/dist/components/progress.d.ts.map +0 -1
- package/dist/components/radio-group.d.ts.map +0 -1
- package/dist/components/radio.d.ts.map +0 -1
- package/dist/components/scroll-area.d.ts.map +0 -1
- package/dist/components/segmented-control.d.ts.map +0 -1
- package/dist/components/select.d.ts.map +0 -1
- package/dist/components/sidebar.d.ts.map +0 -1
- package/dist/components/skeleton.d.ts.map +0 -1
- package/dist/components/slider.d.ts.map +0 -1
- package/dist/components/spinner.d.ts.map +0 -1
- package/dist/components/stat.d.ts.map +0 -1
- package/dist/components/status-dot.d.ts.map +0 -1
- package/dist/components/stepper.d.ts.map +0 -1
- package/dist/components/switch.d.ts.map +0 -1
- package/dist/components/table.d.ts.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tag.d.ts.map +0 -1
- package/dist/components/tags-input.d.ts.map +0 -1
- package/dist/components/textarea.d.ts.map +0 -1
- package/dist/components/toast.d.ts.map +0 -1
- package/dist/components/toggle-group.d.ts.map +0 -1
- package/dist/components/toggle.d.ts.map +0 -1
- package/dist/components/tooltip.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
|
@@ -43,10 +43,18 @@ function r(e, t) {
|
|
|
43
43
|
return `${r} L ${e[e.length - 1][0].toFixed(2)} ${t.toFixed(2)} L ${i} ${t.toFixed(2)} Z`;
|
|
44
44
|
}
|
|
45
45
|
function i(e, t, n, r, i, a = 0) {
|
|
46
|
-
let o = e
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
let o = (e) => String(Number(e.toFixed(2)));
|
|
47
|
+
if (Math.abs(i - r) >= 2 * Math.PI - 1e-9) {
|
|
48
|
+
let r = (n, r) => {
|
|
49
|
+
let i = o(n), a = (t - n).toFixed(2), s = (t + n).toFixed(2);
|
|
50
|
+
return `M ${e.toFixed(2)} ${a} A ${i} ${i} 0 1 ${r} ${e.toFixed(2)} ${s} A ${i} ${i} 0 1 ${r} ${e.toFixed(2)} ${a} Z`;
|
|
51
|
+
};
|
|
52
|
+
return a > 0 ? `${r(n, 1)} ${r(a, 0)}` : r(n, 1);
|
|
53
|
+
}
|
|
54
|
+
let s = o(n), c = e + n * Math.cos(r), l = t + n * Math.sin(r), u = e + n * Math.cos(i), d = t + n * Math.sin(i), f = +(i - r > Math.PI);
|
|
55
|
+
if (a <= 0) return `M ${e} ${t} L ${c.toFixed(2)} ${l.toFixed(2)} A ${s} ${s} 0 ${f} 1 ${u.toFixed(2)} ${d.toFixed(2)} Z`;
|
|
56
|
+
let p = e + a * Math.cos(i), m = t + a * Math.sin(i), h = e + a * Math.cos(r), g = t + a * Math.sin(r);
|
|
57
|
+
return `M ${c.toFixed(2)} ${l.toFixed(2)} A ${s} ${s} 0 ${f} 1 ${u.toFixed(2)} ${d.toFixed(2)} L ${p.toFixed(2)} ${m.toFixed(2)} A ${o(a)} ${o(a)} 0 ${f} 0 ${h.toFixed(2)} ${g.toFixed(2)} Z`;
|
|
50
58
|
}
|
|
51
59
|
//#endregion
|
|
52
60
|
export { n as a, r as i, t as n, e as r, i as t };
|
|
@@ -1,20 +1,49 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
-
|
|
2
|
+
import { PartsController } from '../parts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Collapsible section container for FAQs, settings panels, and long-form content organized into expandable items.
|
|
5
|
+
*
|
|
6
|
+
* Holds `<void-accordion-item>`s; each item holds a `<void-accordion-trigger>` (the heading text that toggles it)
|
|
7
|
+
* and a `<void-accordion-content>`. All of them are written by the author and never moved.
|
|
8
|
+
*/
|
|
3
9
|
export declare class VoidAccordion extends VoidElement {
|
|
10
|
+
/** Let several items stay open at once. Without it, opening an item closes the others in the accordion. */
|
|
4
11
|
multiple: boolean;
|
|
5
12
|
}
|
|
6
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* One collapsible item of a `<void-accordion>`: a `<void-accordion-trigger>` followed by a
|
|
15
|
+
* `<void-accordion-content>`. The trigger becomes the button that toggles the item (`role="button"`, a tab stop,
|
|
16
|
+
* Enter and Space, `aria-expanded`, `aria-controls`); the content is the region it names. Closed content is hidden
|
|
17
|
+
* by the theme from the item's `open` attribute, before the script loads as well, and opens and closes with a height
|
|
18
|
+
* animation (a grid row, no measuring; off under `prefers-reduced-motion` and when `--void-anim-scale` is 0). Where the
|
|
19
|
+
* browser supports `hidden="until-found"` the closed content carries it, so it is out of the accessibility tree and
|
|
20
|
+
* find-in-page opens the item when it finds text inside.
|
|
21
|
+
*
|
|
22
|
+
* @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' | 'find' }>} void-open - The item opened: a click on the trigger,
|
|
23
|
+
* Enter or Space on it, or find-in-page found text inside. Does not bubble.
|
|
24
|
+
* @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' | 'outside' }>} void-close - The item is closing: the user
|
|
25
|
+
* closed it (cancelable: `preventDefault()` keeps it open), or another item opened in a single-open accordion
|
|
26
|
+
* (`outside`). Does not bubble.
|
|
27
|
+
*/
|
|
7
28
|
export declare class VoidAccordionItem extends VoidElement {
|
|
8
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Whether the content is shown. Add the attribute to start open; it is updated when the user toggles
|
|
31
|
+
* the item.
|
|
32
|
+
*/
|
|
9
33
|
open: boolean;
|
|
10
|
-
|
|
11
|
-
private
|
|
12
|
-
private _didSetup;
|
|
34
|
+
protected readonly _parts: PartsController;
|
|
35
|
+
private readonly _closed;
|
|
13
36
|
connectedCallback(): void;
|
|
37
|
+
disconnectedCallback(): void;
|
|
14
38
|
protected updated(changed: Map<string, unknown>): void;
|
|
15
|
-
private
|
|
16
|
-
|
|
17
|
-
|
|
39
|
+
private _wire;
|
|
40
|
+
/** Find-in-page (or a link, or a text fragment) reached text inside the closed content: open. */
|
|
41
|
+
private _onBeforeMatch;
|
|
42
|
+
private _fromTrigger;
|
|
43
|
+
private _onClick;
|
|
44
|
+
private _onKeydown;
|
|
45
|
+
private _toggle;
|
|
46
|
+
private _open;
|
|
18
47
|
}
|
|
19
48
|
declare global {
|
|
20
49
|
interface HTMLElementTagNameMap {
|
|
@@ -22,4 +51,3 @@ declare global {
|
|
|
22
51
|
'void-accordion-item': VoidAccordionItem;
|
|
23
52
|
}
|
|
24
53
|
}
|
|
25
|
-
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1,73 +1,71 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { n } from "../chunks/parts-D30c8OoG.js";
|
|
4
|
+
import { t as r } from "../chunks/disclosure-Bj_49GcC.js";
|
|
5
|
+
import { property as i } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/accordion.ts
|
|
6
|
-
var
|
|
7
|
+
var a = class extends e {
|
|
7
8
|
constructor(...e) {
|
|
8
9
|
super(...e), this.multiple = !1;
|
|
9
10
|
}
|
|
10
11
|
};
|
|
11
|
-
t([
|
|
12
|
+
t([i({
|
|
12
13
|
type: Boolean,
|
|
13
14
|
reflect: !0
|
|
14
|
-
})],
|
|
15
|
-
var
|
|
15
|
+
})], a.prototype, "multiple", void 0), customElements.get("void-accordion") || customElements.define("void-accordion", a);
|
|
16
|
+
var o = class t extends e {
|
|
16
17
|
constructor(...e) {
|
|
17
|
-
super(...e), this.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
composed: !0,
|
|
27
|
-
detail: { open: this.open }
|
|
28
|
-
}));
|
|
29
|
-
}, this._handleKeydown = (e) => {
|
|
30
|
-
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._handleClick(e));
|
|
18
|
+
super(...e), this.open = !1, this._parts = new n(this, {
|
|
19
|
+
tags: ["void-accordion-trigger", "void-accordion-content"],
|
|
20
|
+
onChange: () => this._wire()
|
|
21
|
+
}), this._closed = new r(this, this._parts), this._onBeforeMatch = (e) => {
|
|
22
|
+
this.open || e.target !== this._parts.one("void-accordion-content") || this._open("find");
|
|
23
|
+
}, this._onClick = (e) => {
|
|
24
|
+
this._fromTrigger(e) && (e.preventDefault(), this._toggle("trigger"));
|
|
25
|
+
}, this._onKeydown = (e) => {
|
|
26
|
+
e.key !== "Enter" && e.key !== " " || !this._fromTrigger(e) || e.defaultPrevented || e.target.closest("a, button, input, select, textarea") || (e.preventDefault(), this._toggle("keyboard"));
|
|
31
27
|
};
|
|
32
28
|
}
|
|
33
29
|
connectedCallback() {
|
|
34
|
-
super.connectedCallback(), this.
|
|
30
|
+
super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown), this.addEventListener("beforematch", this._onBeforeMatch);
|
|
31
|
+
}
|
|
32
|
+
disconnectedCallback() {
|
|
33
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._onClick), this.removeEventListener("keydown", this._onKeydown), this.removeEventListener("beforematch", this._onBeforeMatch);
|
|
35
34
|
}
|
|
36
35
|
updated(e) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
super.updated(e), e.has("open") && this._wire();
|
|
37
|
+
}
|
|
38
|
+
_wire() {
|
|
39
|
+
let e = this._parts.one("void-accordion-trigger"), t = this._parts.one("void-accordion-content");
|
|
40
|
+
e && (this._parts.set(e, "role", "button"), this._parts.set(e, "tabindex", "0"), this._parts.set(e, "aria-expanded", String(this.open)), this._parts.set(e, "aria-controls", t ? this._parts.id(t, "void-accordion-content") : null)), t && (this._parts.set(t, "role", "region"), this._parts.set(t, "aria-labelledby", e ? this._parts.id(e, "void-accordion-trigger") : null)), this._closed.sync(t, this.open);
|
|
41
|
+
}
|
|
42
|
+
_fromTrigger(e) {
|
|
43
|
+
let t = this._parts.one("void-accordion-trigger");
|
|
44
|
+
return !!t && e.target instanceof Node && t.contains(e.target);
|
|
45
|
+
}
|
|
46
|
+
_toggle(e) {
|
|
47
|
+
this.open ? this.dispatchEvent(new CustomEvent("void-close", {
|
|
48
|
+
bubbles: !1,
|
|
49
|
+
cancelable: !0,
|
|
50
|
+
detail: { reason: e }
|
|
51
|
+
})) && (this.open = !1) : this._open(e);
|
|
42
52
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
${this.heading}
|
|
55
|
-
<svg class="void-accordion-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
56
|
-
<path d="M6 4l4 4-4 4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
|
|
57
|
-
</svg>
|
|
58
|
-
</button>
|
|
59
|
-
<div
|
|
60
|
-
id="content-${this._id}"
|
|
61
|
-
class="void-accordion-content"
|
|
62
|
-
role="region"
|
|
63
|
-
aria-labelledby="trigger-${this._id}"
|
|
64
|
-
></div>
|
|
65
|
-
`;
|
|
53
|
+
_open(e) {
|
|
54
|
+
this.open = !0;
|
|
55
|
+
let n = this.parentElement;
|
|
56
|
+
if (n instanceof a && !n.multiple) for (let e of Array.from(n.children)) e !== this && e instanceof t && e.open && (e.open = !1, e.dispatchEvent(new CustomEvent("void-close", {
|
|
57
|
+
bubbles: !1,
|
|
58
|
+
detail: { reason: "outside" }
|
|
59
|
+
})));
|
|
60
|
+
this.dispatchEvent(new CustomEvent("void-open", {
|
|
61
|
+
bubbles: !1,
|
|
62
|
+
detail: { reason: e }
|
|
63
|
+
}));
|
|
66
64
|
}
|
|
67
65
|
};
|
|
68
|
-
t([
|
|
66
|
+
t([i({
|
|
69
67
|
type: Boolean,
|
|
70
68
|
reflect: !0
|
|
71
|
-
})],
|
|
69
|
+
})], o.prototype, "open", void 0), customElements.get("void-accordion-item") || customElements.define("void-accordion-item", o);
|
|
72
70
|
//#endregion
|
|
73
|
-
export {
|
|
71
|
+
export { a as VoidAccordion, o as VoidAccordionItem };
|
|
@@ -1,20 +1,78 @@
|
|
|
1
1
|
import { VoidElement } from '../base.js';
|
|
2
|
+
declare const VoidActionInput_base: (new (...args: any[]) => import('../form-control.js').VoidNativeFormControl) & typeof VoidElement;
|
|
2
3
|
/** Input field with an attached icon button — used for copy-to-clipboard inputs, search boxes, and similar patterns. */
|
|
3
|
-
export declare class VoidActionInput extends
|
|
4
|
+
export declare class VoidActionInput extends VoidActionInput_base {
|
|
5
|
+
/** The host's `aria-label` / `aria-labelledby` name the inner control. */
|
|
6
|
+
static labelTarget: string;
|
|
7
|
+
/** While focus is inside, a morph does not apply the server's value over what the user is typing. */
|
|
8
|
+
static editState: string[];
|
|
9
|
+
/**
|
|
10
|
+
* The text in the field. As an attribute it is the initial value; read or set the `value` property for
|
|
11
|
+
* the current text.
|
|
12
|
+
*/
|
|
4
13
|
value: string;
|
|
14
|
+
/**
|
|
15
|
+
* Hint text shown while the field is empty. It also names the field for assistive technology when
|
|
16
|
+
* there is no `aria-label`.
|
|
17
|
+
*/
|
|
5
18
|
placeholder: string;
|
|
19
|
+
/** Stop the field and its button reacting and exclude the value from the form submission. */
|
|
6
20
|
disabled: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Show the value but do not let the user edit it; the field is still focusable and submitted. The
|
|
23
|
+
* action button still works, which is what a copy-to-clipboard field wants.
|
|
24
|
+
*/
|
|
7
25
|
readonly: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The control must have a value before its form can be submitted. An empty control is invalid
|
|
28
|
+
* (`valueMissing`) and the browser reports it, as for a native field.
|
|
29
|
+
*/
|
|
30
|
+
required: boolean;
|
|
31
|
+
/** Key the value is submitted under in the form's `FormData`. Without a name the field submits nothing. */
|
|
8
32
|
name: string;
|
|
33
|
+
/** Autofill hint forwarded to the native control (`autocomplete`), e.g. `current-password`, `one-time-code`, `email`. */
|
|
9
34
|
autocomplete: string;
|
|
35
|
+
/** Minimum number of characters, enforced by the native control (`minlength`) and reported through validity. */
|
|
36
|
+
minlength: number | undefined;
|
|
37
|
+
/** Maximum number of characters accepted by the native control (`maxlength`). */
|
|
38
|
+
maxlength: number | undefined;
|
|
39
|
+
/** Regular expression the value must match (`pattern`), reported through validity. */
|
|
40
|
+
pattern: string;
|
|
41
|
+
/** Virtual keyboard hint forwarded to the native control (`inputmode`). */
|
|
42
|
+
inputMode: '' | 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
|
43
|
+
/** Label of the mobile keyboard's enter key (`enterkeyhint`). */
|
|
44
|
+
enterKeyHint: '' | 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';
|
|
45
|
+
/** Capitalisation behaviour of virtual keyboards (`autocapitalize`). */
|
|
46
|
+
autocapitalize: '' | 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';
|
|
47
|
+
/**
|
|
48
|
+
* The host's `spellcheck` attribute as written (`"true"`, `"false"`, `""`, or absent for the browser default),
|
|
49
|
+
* forwarded to the native control: the native enumerated attribute, not a boolean.
|
|
50
|
+
*/
|
|
51
|
+
protected spellcheckAttr: string | null;
|
|
52
|
+
/** Size step: `sm`, `md` (default) or `lg`. */
|
|
10
53
|
size: 'sm' | 'md' | 'lg';
|
|
11
|
-
|
|
12
|
-
|
|
54
|
+
/**
|
|
55
|
+
* Status colour of the action button: `default`, `error`, `warning`, `caution`, `success`, `info`,
|
|
56
|
+
* `notice` or `highlight`.
|
|
57
|
+
*/
|
|
58
|
+
color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
|
|
59
|
+
/** Native input type; any text-like type is forwarded to the native control. */
|
|
60
|
+
type: 'text' | 'password' | 'search' | 'email' | 'tel' | 'url';
|
|
61
|
+
/**
|
|
62
|
+
* Icon on the button: `search` (default), `copy`, `clipboard`, `send`, `eye`, `eye-off`, `check`, `x`
|
|
63
|
+
* or `arrow-right`. Any other value draws the search icon.
|
|
64
|
+
*/
|
|
13
65
|
icon: string;
|
|
66
|
+
/** Accessible name of the button and its tooltip. Defaults to `Action`; say what it does (`Copy link`). */
|
|
14
67
|
actionLabel: string;
|
|
15
|
-
|
|
16
|
-
|
|
68
|
+
/** Which side of the field the button sits on: `right` (default) or `left`. */
|
|
69
|
+
iconSide: 'left' | 'right';
|
|
70
|
+
/** Where the button's tooltip appears: `top` (default), `bottom`, `left` or `right`. */
|
|
71
|
+
tooltipSide: 'top' | 'bottom' | 'left' | 'right';
|
|
17
72
|
private _renderIcon;
|
|
73
|
+
protected formWriteNativeDefault(state: unknown): void;
|
|
74
|
+
protected formReadNative(): void;
|
|
75
|
+
protected formSyncNative(): void;
|
|
18
76
|
private _onInput;
|
|
19
77
|
private _onChange;
|
|
20
78
|
private _onAction;
|
|
@@ -25,4 +83,4 @@ declare global {
|
|
|
25
83
|
'void-action-input': VoidActionInput;
|
|
26
84
|
}
|
|
27
85
|
}
|
|
28
|
-
|
|
86
|
+
export {};
|
|
@@ -1,26 +1,46 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { n } from "../chunks/form-control-C0vH6gii.js";
|
|
4
|
+
import { html as r, nothing as i } from "lit";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
6
|
+
import { live as o } from "lit/directives/live.js";
|
|
5
7
|
//#region src/components/action-input.ts
|
|
6
|
-
var
|
|
8
|
+
var s = class extends n(e) {
|
|
7
9
|
constructor(...e) {
|
|
8
|
-
super(...e), this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.name = "", this.autocomplete = "", this.size = "md", this.color = "default", this.type = "text", this.icon = "search", this.actionLabel = "Action", this.
|
|
10
|
+
super(...e), this.value = "", this.placeholder = "", this.disabled = !1, this.readonly = !1, this.required = !1, this.name = "", this.autocomplete = "", this.minlength = void 0, this.maxlength = void 0, this.pattern = "", this.inputMode = "", this.enterKeyHint = "", this.autocapitalize = "", this.spellcheckAttr = null, this.size = "md", this.color = "default", this.type = "text", this.icon = "search", this.actionLabel = "Action", this.iconSide = "right", this.tooltipSide = "top";
|
|
11
|
+
}
|
|
12
|
+
static {
|
|
13
|
+
this.labelTarget = ".void-action-input-field";
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
this.editState = ["value"];
|
|
9
17
|
}
|
|
10
18
|
_renderIcon() {
|
|
11
19
|
switch (this.icon) {
|
|
12
|
-
case "copy": return
|
|
13
|
-
case "search": return
|
|
14
|
-
case "send": return
|
|
15
|
-
case "eye": return
|
|
16
|
-
case "eye-off": return
|
|
17
|
-
case "check": return
|
|
18
|
-
case "x": return
|
|
19
|
-
case "arrow-right": return
|
|
20
|
-
case "clipboard": return
|
|
21
|
-
default: return
|
|
20
|
+
case "copy": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 9.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667l0 -8.666"/><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"/></svg>`;
|
|
21
|
+
case "search": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"/><path d="M21 21l-6 -6"/></svg>`;
|
|
22
|
+
case "send": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 14l11 -11"/><path d="M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5"/></svg>`;
|
|
23
|
+
case "eye": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0"/><path d="M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6"/></svg>`;
|
|
24
|
+
case "eye-off": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/><path d="M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87"/><path d="M3 3l18 18"/></svg>`;
|
|
25
|
+
case "check": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l5 5l10 -10"/></svg>`;
|
|
26
|
+
case "x": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18 6l-12 12"/><path d="M6 6l12 12"/></svg>`;
|
|
27
|
+
case "arrow-right": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M5 12l14 0"/><path d="M13 18l6 -6"/><path d="M13 6l6 6"/></svg>`;
|
|
28
|
+
case "clipboard": return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2"/><path d="M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2"/></svg>`;
|
|
29
|
+
default: return r`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M3 10a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"/><path d="M21 21l-6 -6"/></svg>`;
|
|
22
30
|
}
|
|
23
31
|
}
|
|
32
|
+
formWriteNativeDefault(e) {
|
|
33
|
+
let t = this.querySelector(".void-action-input-field");
|
|
34
|
+
t && (t.defaultValue = String(e ?? ""));
|
|
35
|
+
}
|
|
36
|
+
formReadNative() {
|
|
37
|
+
let e = this.querySelector(".void-action-input-field");
|
|
38
|
+
e && (this.value = e.value);
|
|
39
|
+
}
|
|
40
|
+
formSyncNative() {
|
|
41
|
+
let e = this.querySelector(".void-action-input-field");
|
|
42
|
+
e && e.value !== this.value && (e.value = this.value);
|
|
43
|
+
}
|
|
24
44
|
_onInput(e) {
|
|
25
45
|
let t = e.target;
|
|
26
46
|
this.value = t.value, this.dispatchEvent(new CustomEvent("void-input", {
|
|
@@ -45,73 +65,96 @@ var i = class extends e {
|
|
|
45
65
|
}));
|
|
46
66
|
}
|
|
47
67
|
render() {
|
|
48
|
-
let e =
|
|
49
|
-
<void-tooltip
|
|
50
|
-
<button
|
|
68
|
+
let e = r`
|
|
69
|
+
<void-tooltip side=${this.tooltipSide}>
|
|
70
|
+
<void-tooltip-trigger><button
|
|
51
71
|
class="void-action-input-btn"
|
|
52
72
|
type="button"
|
|
53
73
|
?disabled=${this.disabled}
|
|
54
74
|
aria-label=${this.actionLabel}
|
|
55
75
|
@click=${this._onAction}
|
|
56
|
-
>${this._renderIcon()}</button>
|
|
76
|
+
>${this._renderIcon()}</button></void-tooltip-trigger>
|
|
77
|
+
<void-tooltip-content>${this.actionLabel}</void-tooltip-content>
|
|
57
78
|
</void-tooltip>
|
|
58
79
|
`;
|
|
59
|
-
return
|
|
60
|
-
${this.
|
|
80
|
+
return r`
|
|
81
|
+
${this.iconSide === "left" ? e : ""}
|
|
61
82
|
<input
|
|
62
83
|
class="void-action-input-field"
|
|
63
84
|
type=${this.type}
|
|
64
|
-
.value=${this.value}
|
|
85
|
+
.value=${o(this.value)}
|
|
65
86
|
placeholder=${this.placeholder}
|
|
66
87
|
?disabled=${this.disabled}
|
|
67
88
|
?readonly=${this.readonly}
|
|
89
|
+
?required=${this.required}
|
|
68
90
|
name=${this.name}
|
|
69
|
-
|
|
70
|
-
|
|
91
|
+
form=${this.formAttr ?? i}
|
|
92
|
+
autocomplete=${this.autocomplete || i}
|
|
93
|
+
minlength=${this.minlength ?? i}
|
|
94
|
+
maxlength=${this.maxlength ?? i}
|
|
95
|
+
pattern=${this.pattern || i}
|
|
96
|
+
inputmode=${this.inputMode || i}
|
|
97
|
+
enterkeyhint=${this.enterKeyHint || i}
|
|
98
|
+
autocapitalize=${this.autocapitalize || i}
|
|
99
|
+
spellcheck=${this.spellcheckAttr ?? i}
|
|
100
|
+
aria-label=${this.placeholder || i}
|
|
71
101
|
@input=${this._onInput}
|
|
72
102
|
@change=${this._onChange}
|
|
73
103
|
/>
|
|
74
|
-
${this.
|
|
104
|
+
${this.iconSide === "right" ? e : ""}
|
|
75
105
|
`;
|
|
76
106
|
}
|
|
77
107
|
};
|
|
78
|
-
t([
|
|
108
|
+
t([a({ type: String })], s.prototype, "value", void 0), t([a({
|
|
79
109
|
type: String,
|
|
80
110
|
reflect: !0
|
|
81
|
-
})],
|
|
111
|
+
})], s.prototype, "placeholder", void 0), t([a({
|
|
112
|
+
type: Boolean,
|
|
113
|
+
reflect: !0
|
|
114
|
+
})], s.prototype, "disabled", void 0), t([a({
|
|
82
115
|
type: Boolean,
|
|
83
116
|
reflect: !0
|
|
84
|
-
})],
|
|
117
|
+
})], s.prototype, "readonly", void 0), t([a({
|
|
85
118
|
type: Boolean,
|
|
86
119
|
reflect: !0
|
|
87
|
-
})],
|
|
120
|
+
})], s.prototype, "required", void 0), t([a({
|
|
88
121
|
type: String,
|
|
89
122
|
reflect: !0
|
|
90
|
-
})],
|
|
123
|
+
})], s.prototype, "name", void 0), t([a({
|
|
91
124
|
type: String,
|
|
92
125
|
reflect: !0
|
|
93
|
-
})],
|
|
126
|
+
})], s.prototype, "autocomplete", void 0), t([a({ type: Number })], s.prototype, "minlength", void 0), t([a({ type: Number })], s.prototype, "maxlength", void 0), t([a({ type: String })], s.prototype, "pattern", void 0), t([a({
|
|
127
|
+
type: String,
|
|
128
|
+
attribute: "inputmode"
|
|
129
|
+
})], s.prototype, "inputMode", void 0), t([a({
|
|
130
|
+
type: String,
|
|
131
|
+
attribute: "enterkeyhint"
|
|
132
|
+
})], s.prototype, "enterKeyHint", void 0), t([a({ type: String })], s.prototype, "autocapitalize", void 0), t([a({
|
|
133
|
+
type: String,
|
|
134
|
+
attribute: "spellcheck"
|
|
135
|
+
})], s.prototype, "spellcheckAttr", void 0), t([a({
|
|
94
136
|
type: String,
|
|
95
137
|
reflect: !0
|
|
96
|
-
})],
|
|
138
|
+
})], s.prototype, "size", void 0), t([a({
|
|
97
139
|
type: String,
|
|
98
140
|
reflect: !0
|
|
99
|
-
})],
|
|
141
|
+
})], s.prototype, "color", void 0), t([a({
|
|
100
142
|
type: String,
|
|
101
143
|
reflect: !0
|
|
102
|
-
})],
|
|
144
|
+
})], s.prototype, "type", void 0), t([a({
|
|
103
145
|
type: String,
|
|
104
146
|
reflect: !0
|
|
105
|
-
})],
|
|
147
|
+
})], s.prototype, "icon", void 0), t([a({
|
|
106
148
|
type: String,
|
|
107
149
|
attribute: "action-label"
|
|
108
|
-
})],
|
|
150
|
+
})], s.prototype, "actionLabel", void 0), t([a({
|
|
109
151
|
type: String,
|
|
110
|
-
reflect: !0
|
|
111
|
-
|
|
152
|
+
reflect: !0,
|
|
153
|
+
attribute: "icon-side"
|
|
154
|
+
})], s.prototype, "iconSide", void 0), t([a({
|
|
112
155
|
type: String,
|
|
113
156
|
reflect: !0,
|
|
114
|
-
attribute: "tooltip-
|
|
115
|
-
})],
|
|
157
|
+
attribute: "tooltip-side"
|
|
158
|
+
})], s.prototype, "tooltipSide", void 0), customElements.get("void-action-input") || customElements.define("void-action-input", s);
|
|
116
159
|
//#endregion
|
|
117
|
-
export {
|
|
160
|
+
export { s as VoidActionInput };
|
|
@@ -1,20 +1,34 @@
|
|
|
1
|
-
import { nothing } from 'lit';
|
|
2
1
|
import { VoidElement } from '../base.js';
|
|
3
|
-
|
|
2
|
+
import { PartsController } from '../parts.js';
|
|
3
|
+
/**
|
|
4
|
+
* Inline contextual message for form validation feedback, permission warnings, and system status notices.
|
|
5
|
+
*
|
|
6
|
+
* Its text is written as parts: an optional `<void-alert-title>`, the `<void-alert-description>` and an optional
|
|
7
|
+
* `<void-alert-close>`. The parts are never moved. The close part wraps the one control the author writes (a
|
|
8
|
+
* `<button type="button" aria-label="Dismiss">`); pressing it fires `void-close` and, unless that is cancelled, removes the alert (focus inside
|
|
9
|
+
* it moves on to the next focusable element). Without a close part the alert cannot be dismissed.
|
|
10
|
+
*
|
|
11
|
+
* @fires {CustomEvent<{ reason: 'close-button' }>} void-close - The close control was pressed. Cancelable: `preventDefault()`
|
|
12
|
+
* keeps the alert; otherwise it removes itself afterwards. Does not bubble.
|
|
13
|
+
*/
|
|
4
14
|
export declare class VoidAlert extends VoidElement {
|
|
5
|
-
|
|
6
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Status colour of the message: `default`, `error`, `warning`, `caution`, `success`, `info`,
|
|
17
|
+
* `notice` or `highlight`. Pick the one that matches the meaning (error for a failure, success for a confirmation).
|
|
18
|
+
*/
|
|
19
|
+
color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
|
|
20
|
+
/**
|
|
21
|
+
* `subtle` (default) tints the background; `filled` fills it with the status colour for a louder
|
|
22
|
+
* message.
|
|
23
|
+
*/
|
|
7
24
|
variant: 'subtle' | 'filled';
|
|
8
|
-
|
|
9
|
-
private _didSetup;
|
|
25
|
+
protected readonly _parts: PartsController;
|
|
10
26
|
connectedCallback(): void;
|
|
11
|
-
|
|
12
|
-
private
|
|
13
|
-
render(): typeof nothing | import('lit').TemplateResult<1>;
|
|
27
|
+
disconnectedCallback(): void;
|
|
28
|
+
private _onClick;
|
|
14
29
|
}
|
|
15
30
|
declare global {
|
|
16
31
|
interface HTMLElementTagNameMap {
|
|
17
32
|
'void-alert': VoidAlert;
|
|
18
33
|
}
|
|
19
34
|
}
|
|
20
|
-
//# sourceMappingURL=alert.d.ts.map
|
package/dist/components/alert.js
CHANGED
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e } from "../chunks/base-CMruMbxC.js";
|
|
2
2
|
import { t } from "../chunks/decorate-CaYbmmmm.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { n } from "../chunks/parts-D30c8OoG.js";
|
|
4
|
+
import { n as r, t as i } from "../chunks/dismiss-Drsy_dE5.js";
|
|
5
|
+
import { property as a } from "lit/decorators.js";
|
|
5
6
|
//#region src/components/alert.ts
|
|
6
|
-
var
|
|
7
|
+
var o = class extends e {
|
|
7
8
|
constructor(...e) {
|
|
8
|
-
super(...e), this.color = "default", this.
|
|
9
|
+
super(...e), this.color = "default", this.variant = "subtle", this._parts = new n(this, {
|
|
10
|
+
tags: [
|
|
11
|
+
"void-alert-title",
|
|
12
|
+
"void-alert-description",
|
|
13
|
+
"void-alert-close"
|
|
14
|
+
],
|
|
15
|
+
onChange: () => void 0
|
|
16
|
+
}), this._onClick = (e) => {
|
|
17
|
+
i(this._parts.one("void-alert-close"), e) && this.dispatchEvent(new CustomEvent("void-close", {
|
|
18
|
+
bubbles: !1,
|
|
19
|
+
cancelable: !0,
|
|
20
|
+
detail: { reason: "close-button" }
|
|
21
|
+
})) && r(this);
|
|
22
|
+
};
|
|
9
23
|
}
|
|
10
24
|
connectedCallback() {
|
|
11
|
-
super.connectedCallback(), this.
|
|
25
|
+
super.connectedCallback(), this.setHostAttribute("role", "alert"), this.addEventListener("click", this._onClick);
|
|
12
26
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this._didSetup = !0;
|
|
16
|
-
for (let e of this._userContent) this.appendChild(e);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
_dismiss() {
|
|
20
|
-
this.dispatchEvent(new CustomEvent("void-dismiss", {
|
|
21
|
-
bubbles: !0,
|
|
22
|
-
composed: !0
|
|
23
|
-
})), this.remove();
|
|
24
|
-
}
|
|
25
|
-
render() {
|
|
26
|
-
return this.dismissible ? n`<button type="button" class="void-alert-close" aria-label="Dismiss" @click="${this._dismiss}">×</button>` : r;
|
|
27
|
+
disconnectedCallback() {
|
|
28
|
+
super.disconnectedCallback(), this.removeEventListener("click", this._onClick);
|
|
27
29
|
}
|
|
28
30
|
};
|
|
29
|
-
t([
|
|
31
|
+
t([a({
|
|
30
32
|
type: String,
|
|
31
33
|
reflect: !0
|
|
32
|
-
})],
|
|
33
|
-
type: Boolean,
|
|
34
|
-
reflect: !0
|
|
35
|
-
})], a.prototype, "dismissible", void 0), t([i({
|
|
34
|
+
})], o.prototype, "color", void 0), t([a({
|
|
36
35
|
type: String,
|
|
37
36
|
reflect: !0
|
|
38
|
-
})],
|
|
37
|
+
})], o.prototype, "variant", void 0), customElements.get("void-alert") || customElements.define("void-alert", o);
|
|
39
38
|
//#endregion
|
|
40
|
-
export {
|
|
39
|
+
export { o as VoidAlert };
|