@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.
Files changed (250) hide show
  1. package/README.md +168 -9
  2. package/dist/angular/index.d.ts +20 -0
  3. package/dist/angular/index.js +78 -0
  4. package/dist/autoloader-core.d.ts +45 -0
  5. package/dist/autoloader-table.generated.d.ts +5 -0
  6. package/dist/autoloader.d.ts +13 -0
  7. package/dist/autoloader.js +229 -0
  8. package/dist/base.d.ts +173 -2
  9. package/dist/base.js +2 -9
  10. package/dist/chunks/base-CMruMbxC.js +824 -0
  11. package/dist/chunks/disclosure-Bj_49GcC.js +23 -0
  12. package/dist/chunks/dismiss-Drsy_dE5.js +37 -0
  13. package/dist/chunks/form-control-C0vH6gii.js +300 -0
  14. package/dist/chunks/keyboard-MQpfTX5I.js +46 -0
  15. package/dist/chunks/keyboard-activation-CV0m4hkn.js +29 -0
  16. package/dist/chunks/modal-D_YVy2vg.js +71 -0
  17. package/dist/chunks/overlay-BywGMcDW.js +467 -0
  18. package/dist/chunks/parts-D30c8OoG.js +229 -0
  19. package/dist/chunks/{shape-FJvZa8FW.js → shape-C_LW7EjG.js} +12 -4
  20. package/dist/components/accordion.d.ts +38 -10
  21. package/dist/components/accordion.js +51 -53
  22. package/dist/components/action-input.d.ts +64 -6
  23. package/dist/components/action-input.js +84 -41
  24. package/dist/components/alert.d.ts +24 -10
  25. package/dist/components/alert.js +26 -27
  26. package/dist/components/avatar.d.ts +8 -2
  27. package/dist/components/avatar.js +3 -3
  28. package/dist/components/badge.d.ts +8 -3
  29. package/dist/components/badge.js +2 -2
  30. package/dist/components/banner.d.ts +21 -10
  31. package/dist/components/banner.js +27 -27
  32. package/dist/components/bar-chart.d.ts +30 -6
  33. package/dist/components/bar-chart.js +29 -39
  34. package/dist/components/breadcrumbs.d.ts +19 -6
  35. package/dist/components/breadcrumbs.js +16 -22
  36. package/dist/components/button.d.ts +64 -10
  37. package/dist/components/button.js +70 -26
  38. package/dist/components/calendar.d.ts +65 -10
  39. package/dist/components/calendar.js +157 -106
  40. package/dist/components/card.d.ts +14 -9
  41. package/dist/components/card.js +8 -22
  42. package/dist/components/carousel.d.ts +65 -14
  43. package/dist/components/carousel.js +84 -93
  44. package/dist/components/charts/scale.d.ts +0 -1
  45. package/dist/components/charts/shape.d.ts +0 -1
  46. package/dist/components/checkbox-group.d.ts +38 -5
  47. package/dist/components/checkbox-group.js +61 -20
  48. package/dist/components/checkbox.d.ts +53 -7
  49. package/dist/components/checkbox.js +66 -29
  50. package/dist/components/collapsible.d.ts +29 -9
  51. package/dist/components/collapsible.js +42 -44
  52. package/dist/components/color-picker.d.ts +20 -4
  53. package/dist/components/color-picker.js +35 -29
  54. package/dist/components/combobox.d.ts +84 -10
  55. package/dist/components/combobox.js +142 -45
  56. package/dist/components/compose-input.d.ts +8 -1
  57. package/dist/components/compose-input.js +9 -3
  58. package/dist/components/dialog.d.ts +24 -20
  59. package/dist/components/dialog.js +8 -57
  60. package/dist/components/divider.d.ts +8 -1
  61. package/dist/components/divider.js +3 -3
  62. package/dist/components/donut-chart.d.ts +28 -5
  63. package/dist/components/donut-chart.js +55 -54
  64. package/dist/components/drawer.d.ts +19 -18
  65. package/dist/components/drawer.js +9 -53
  66. package/dist/components/dropdown-menu.d.ts +62 -7
  67. package/dist/components/dropdown-menu.js +124 -33
  68. package/dist/components/editable.d.ts +37 -3
  69. package/dist/components/editable.js +45 -24
  70. package/dist/components/error-fallback.d.ts +36 -5
  71. package/dist/components/error-fallback.js +73 -23
  72. package/dist/components/field.d.ts +38 -4
  73. package/dist/components/field.js +63 -21
  74. package/dist/components/file-upload.d.ts +23 -2
  75. package/dist/components/file-upload.js +47 -24
  76. package/dist/components/gauge.d.ts +48 -9
  77. package/dist/components/gauge.js +57 -55
  78. package/dist/components/hamburger.d.ts +19 -4
  79. package/dist/components/hamburger.js +28 -19
  80. package/dist/components/hover-card.d.ts +40 -14
  81. package/dist/components/hover-card.js +76 -59
  82. package/dist/components/indicator.d.ts +18 -7
  83. package/dist/components/indicator.js +16 -18
  84. package/dist/components/input.d.ts +70 -5
  85. package/dist/components/input.js +83 -20
  86. package/dist/components/line-chart.d.ts +27 -5
  87. package/dist/components/line-chart.js +19 -21
  88. package/dist/components/list.d.ts +10 -1
  89. package/dist/components/list.js +3 -3
  90. package/dist/components/menu.d.ts +67 -21
  91. package/dist/components/menu.js +116 -115
  92. package/dist/components/multiselect.d.ts +108 -13
  93. package/dist/components/multiselect.js +207 -70
  94. package/dist/components/nav-bar.d.ts +12 -7
  95. package/dist/components/nav-bar.js +11 -21
  96. package/dist/components/nav-menu.d.ts +52 -12
  97. package/dist/components/nav-menu.js +68 -70
  98. package/dist/components/number-input.d.ts +76 -8
  99. package/dist/components/number-input.js +117 -51
  100. package/dist/components/pagination.d.ts +19 -1
  101. package/dist/components/pagination.js +68 -7
  102. package/dist/components/panel.d.ts +16 -8
  103. package/dist/components/panel.js +20 -20
  104. package/dist/components/pin-input.d.ts +41 -4
  105. package/dist/components/pin-input.js +45 -27
  106. package/dist/components/popover.d.ts +29 -11
  107. package/dist/components/popover.js +47 -35
  108. package/dist/components/progress.d.ts +7 -3
  109. package/dist/components/progress.js +3 -3
  110. package/dist/components/radio-group.d.ts +30 -5
  111. package/dist/components/radio-group.js +56 -19
  112. package/dist/components/radio.d.ts +47 -7
  113. package/dist/components/radio.js +68 -29
  114. package/dist/components/scroll-area.d.ts +8 -5
  115. package/dist/components/scroll-area.js +19 -20
  116. package/dist/components/segmented-control.d.ts +52 -8
  117. package/dist/components/segmented-control.js +66 -36
  118. package/dist/components/select.d.ts +59 -12
  119. package/dist/components/select.js +96 -46
  120. package/dist/components/sidebar.d.ts +22 -3
  121. package/dist/components/sidebar.js +20 -10
  122. package/dist/components/skeleton.d.ts +5 -2
  123. package/dist/components/skeleton.js +4 -4
  124. package/dist/components/slider.d.ts +27 -5
  125. package/dist/components/slider.js +29 -17
  126. package/dist/components/spinner.d.ts +6 -2
  127. package/dist/components/spinner.js +3 -3
  128. package/dist/components/stat.d.ts +21 -4
  129. package/dist/components/stat.js +7 -3
  130. package/dist/components/status-dot.d.ts +4 -1
  131. package/dist/components/status-dot.js +3 -3
  132. package/dist/components/stepper.d.ts +5 -1
  133. package/dist/components/stepper.js +2 -2
  134. package/dist/components/switch.d.ts +24 -5
  135. package/dist/components/switch.js +37 -19
  136. package/dist/components/table.d.ts +51 -2
  137. package/dist/components/table.js +157 -8
  138. package/dist/components/tabs.d.ts +49 -17
  139. package/dist/components/tabs.js +85 -54
  140. package/dist/components/tag.d.ts +17 -7
  141. package/dist/components/tag.js +19 -21
  142. package/dist/components/tags-input.d.ts +33 -4
  143. package/dist/components/tags-input.js +40 -30
  144. package/dist/components/textarea.d.ts +61 -5
  145. package/dist/components/textarea.js +58 -21
  146. package/dist/components/toast.d.ts +89 -15
  147. package/dist/components/toast.js +105 -30
  148. package/dist/components/toggle-group.d.ts +30 -3
  149. package/dist/components/toggle-group.js +43 -16
  150. package/dist/components/toggle.d.ts +25 -4
  151. package/dist/components/toggle.js +28 -18
  152. package/dist/components/tooltip.d.ts +31 -12
  153. package/dist/components/tooltip.js +62 -28
  154. package/dist/components.json +1518 -0
  155. package/dist/custom-elements.json +31817 -0
  156. package/dist/dev/index.d.ts +40 -0
  157. package/dist/dev/rules.d.ts +46 -0
  158. package/dist/dev/table.generated.d.ts +8 -0
  159. package/dist/dev/types.d.ts +113 -0
  160. package/dist/dev.js +3364 -0
  161. package/dist/disclosure.d.ts +30 -0
  162. package/dist/dismiss.d.ts +20 -0
  163. package/dist/form-control.d.ts +92 -0
  164. package/dist/index.d.ts +5 -4
  165. package/dist/index.js +24 -24
  166. package/dist/keyboard-activation.d.ts +31 -0
  167. package/dist/keyboard.d.ts +32 -0
  168. package/dist/modal.d.ts +44 -0
  169. package/dist/overlay.d.ts +249 -0
  170. package/dist/parts.d.ts +171 -0
  171. package/dist/projection.d.ts +370 -0
  172. package/dist/types/elements.d.ts +648 -0
  173. package/dist/types/react.d.ts +163 -0
  174. package/dist/types/solid.d.ts +164 -0
  175. package/dist/types/solid2.d.ts +161 -0
  176. package/dist/types/svelte.d.ts +154 -0
  177. package/dist/types/vue.d.ts +156 -0
  178. package/dist/vscode.html-custom-data.json +6004 -0
  179. package/dist/web-types.json +8365 -0
  180. package/package.json +113 -21
  181. package/dist/base.d.ts.map +0 -1
  182. package/dist/components/accordion.d.ts.map +0 -1
  183. package/dist/components/action-input.d.ts.map +0 -1
  184. package/dist/components/alert.d.ts.map +0 -1
  185. package/dist/components/avatar.d.ts.map +0 -1
  186. package/dist/components/badge.d.ts.map +0 -1
  187. package/dist/components/banner.d.ts.map +0 -1
  188. package/dist/components/bar-chart.d.ts.map +0 -1
  189. package/dist/components/breadcrumbs.d.ts.map +0 -1
  190. package/dist/components/button.d.ts.map +0 -1
  191. package/dist/components/calendar.d.ts.map +0 -1
  192. package/dist/components/card.d.ts.map +0 -1
  193. package/dist/components/carousel.d.ts.map +0 -1
  194. package/dist/components/charts/scale.d.ts.map +0 -1
  195. package/dist/components/charts/shape.d.ts.map +0 -1
  196. package/dist/components/checkbox-group.d.ts.map +0 -1
  197. package/dist/components/checkbox.d.ts.map +0 -1
  198. package/dist/components/collapsible.d.ts.map +0 -1
  199. package/dist/components/color-picker.d.ts.map +0 -1
  200. package/dist/components/combobox.d.ts.map +0 -1
  201. package/dist/components/compose-input.d.ts.map +0 -1
  202. package/dist/components/dialog.d.ts.map +0 -1
  203. package/dist/components/divider.d.ts.map +0 -1
  204. package/dist/components/donut-chart.d.ts.map +0 -1
  205. package/dist/components/drawer.d.ts.map +0 -1
  206. package/dist/components/dropdown-menu.d.ts.map +0 -1
  207. package/dist/components/editable.d.ts.map +0 -1
  208. package/dist/components/error-fallback.d.ts.map +0 -1
  209. package/dist/components/field.d.ts.map +0 -1
  210. package/dist/components/file-upload.d.ts.map +0 -1
  211. package/dist/components/gauge.d.ts.map +0 -1
  212. package/dist/components/hamburger.d.ts.map +0 -1
  213. package/dist/components/hover-card.d.ts.map +0 -1
  214. package/dist/components/indicator.d.ts.map +0 -1
  215. package/dist/components/input.d.ts.map +0 -1
  216. package/dist/components/line-chart.d.ts.map +0 -1
  217. package/dist/components/list.d.ts.map +0 -1
  218. package/dist/components/menu.d.ts.map +0 -1
  219. package/dist/components/multiselect.d.ts.map +0 -1
  220. package/dist/components/nav-bar.d.ts.map +0 -1
  221. package/dist/components/nav-menu.d.ts.map +0 -1
  222. package/dist/components/number-input.d.ts.map +0 -1
  223. package/dist/components/pagination.d.ts.map +0 -1
  224. package/dist/components/panel.d.ts.map +0 -1
  225. package/dist/components/pin-input.d.ts.map +0 -1
  226. package/dist/components/popover.d.ts.map +0 -1
  227. package/dist/components/progress.d.ts.map +0 -1
  228. package/dist/components/radio-group.d.ts.map +0 -1
  229. package/dist/components/radio.d.ts.map +0 -1
  230. package/dist/components/scroll-area.d.ts.map +0 -1
  231. package/dist/components/segmented-control.d.ts.map +0 -1
  232. package/dist/components/select.d.ts.map +0 -1
  233. package/dist/components/sidebar.d.ts.map +0 -1
  234. package/dist/components/skeleton.d.ts.map +0 -1
  235. package/dist/components/slider.d.ts.map +0 -1
  236. package/dist/components/spinner.d.ts.map +0 -1
  237. package/dist/components/stat.d.ts.map +0 -1
  238. package/dist/components/status-dot.d.ts.map +0 -1
  239. package/dist/components/stepper.d.ts.map +0 -1
  240. package/dist/components/switch.d.ts.map +0 -1
  241. package/dist/components/table.d.ts.map +0 -1
  242. package/dist/components/tabs.d.ts.map +0 -1
  243. package/dist/components/tag.d.ts.map +0 -1
  244. package/dist/components/tags-input.d.ts.map +0 -1
  245. package/dist/components/textarea.d.ts.map +0 -1
  246. package/dist/components/toast.d.ts.map +0 -1
  247. package/dist/components/toggle-group.d.ts.map +0 -1
  248. package/dist/components/toggle.d.ts.map +0 -1
  249. package/dist/components/tooltip.d.ts.map +0 -1
  250. package/dist/index.d.ts.map +0 -1
@@ -1,21 +1,41 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Simple expand/collapse panel for FAQ sections, spoiler text, and progressive disclosure of secondary content. */
2
+ import { PartsController } from '../parts.js';
3
+ /**
4
+ * Simple expand/collapse panel for FAQ sections, spoiler text, and progressive disclosure of secondary content.
5
+ *
6
+ * Written as two parts: a `<void-collapsible-trigger>` (the heading text that toggles it) followed by a
7
+ * `<void-collapsible-content>`. Both are written by the author and never moved. The trigger becomes the button
8
+ * (`role="button"`, a tab stop, Enter and Space, `aria-expanded`, `aria-controls`); the content is the region it
9
+ * names. Closed content is hidden by the theme from the host's `open` attribute, before the script loads as well, and
10
+ * opens and closes with a height animation (a grid row, no measuring; off under `prefers-reduced-motion` and when
11
+ * `--void-anim-scale` is 0). Where the browser supports `hidden="until-found"` the closed content carries it, so it is
12
+ * out of the accessibility tree and find-in-page opens the panel when it finds text inside.
13
+ *
14
+ * @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' | 'find' }>} void-open - The panel opened: a click on the trigger,
15
+ * Enter or Space on it, or find-in-page found text inside. Does not bubble.
16
+ * @fires {CustomEvent<{ reason: 'trigger' | 'keyboard' }>} void-close - The user is closing the panel. Cancelable:
17
+ * `preventDefault()` keeps it open. Does not bubble.
18
+ */
3
19
  export declare class VoidCollapsible extends VoidElement {
4
- heading: string;
20
+ /** Whether the content is shown. Add the attribute to start open; it follows the user's toggling. */
5
21
  open: boolean;
22
+ /** Stop the panel from toggling. The trigger ignores clicks and Enter or Space. */
6
23
  disabled: boolean;
7
- private _id;
8
- private _userContent;
9
- private _didSetup;
24
+ protected readonly _parts: PartsController;
25
+ private readonly _closed;
10
26
  connectedCallback(): void;
27
+ disconnectedCallback(): void;
11
28
  protected updated(changed: Map<string, unknown>): void;
12
- private _handleClick;
13
- private _handleKeydown;
14
- render(): import('lit').TemplateResult<1>;
29
+ private _wire;
30
+ /** Find-in-page (or a link, or a text fragment) reached text inside the closed content: open. */
31
+ private _onBeforeMatch;
32
+ private _fromTrigger;
33
+ private _onClick;
34
+ private _onKeydown;
35
+ private _toggle;
15
36
  }
16
37
  declare global {
17
38
  interface HTMLElementTagNameMap {
18
39
  'void-collapsible': VoidCollapsible;
19
40
  }
20
41
  }
21
- //# sourceMappingURL=collapsible.d.ts.map
@@ -1,61 +1,59 @@
1
- import { VoidElement as e } from "../base.js";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n } from "lit";
4
- import { property as r } from "lit/decorators.js";
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/collapsible.ts
6
- var i = class extends e {
7
+ var a = class extends e {
7
8
  constructor(...e) {
8
- super(...e), this.heading = "", this.open = !1, this.disabled = !1, this._id = Math.random().toString(36).slice(2), this._userContent = [], this._didSetup = !1, this._handleClick = (e) => {
9
- e.preventDefault(), !this.disabled && (this.open = !this.open, this.dispatchEvent(new CustomEvent("void-toggle", {
10
- bubbles: !0,
11
- composed: !0,
12
- detail: { open: this.open }
9
+ super(...e), this.open = !1, this.disabled = !1, this._parts = new n(this, {
10
+ tags: ["void-collapsible-trigger", "void-collapsible-content"],
11
+ onChange: () => this._wire()
12
+ }), this._closed = new r(this, this._parts), this._onBeforeMatch = (e) => {
13
+ this.open || e.target !== this._parts.one("void-collapsible-content") || (this.open = !0, this.dispatchEvent(new CustomEvent("void-open", {
14
+ bubbles: !1,
15
+ detail: { reason: "find" }
13
16
  })));
14
- }, this._handleKeydown = (e) => {
15
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), this._handleClick(e));
17
+ }, this._onClick = (e) => {
18
+ this._fromTrigger(e) && (e.preventDefault(), this._toggle("trigger"));
19
+ }, this._onKeydown = (e) => {
20
+ e.key !== "Enter" && e.key !== " " || !this._fromTrigger(e) || e.defaultPrevented || e.target.closest("a, button, input, select, textarea") || (e.preventDefault(), this._toggle("keyboard"));
16
21
  };
17
22
  }
18
23
  connectedCallback() {
19
- super.connectedCallback(), this._didSetup || (this._userContent = Array.from(this.childNodes));
24
+ super.connectedCallback(), this.addEventListener("click", this._onClick), this.addEventListener("keydown", this._onKeydown), this.addEventListener("beforematch", this._onBeforeMatch);
25
+ }
26
+ disconnectedCallback() {
27
+ super.disconnectedCallback(), this.removeEventListener("click", this._onClick), this.removeEventListener("keydown", this._onKeydown), this.removeEventListener("beforematch", this._onBeforeMatch);
20
28
  }
21
29
  updated(e) {
22
- if (super.updated(e), !this._didSetup) {
23
- this._didSetup = !0;
24
- let e = this.querySelector(".void-collapsible-inner");
25
- if (e) for (let t of this._userContent) e.appendChild(t);
26
- }
30
+ super.updated(e), (e.has("open") || e.has("disabled")) && this._wire();
31
+ }
32
+ _wire() {
33
+ let e = this._parts.one("void-collapsible-trigger"), t = this._parts.one("void-collapsible-content");
34
+ e && (this._parts.set(e, "role", "button"), this._parts.set(e, "tabindex", this.disabled ? "-1" : "0"), this._parts.set(e, "aria-expanded", String(this.open)), this._parts.set(e, "aria-disabled", this.disabled ? "true" : null), this._parts.set(e, "aria-controls", t ? this._parts.id(t, "void-collapsible-content") : null)), t && (this._parts.set(t, "role", "region"), this._parts.set(t, "aria-labelledby", e ? this._parts.id(e, "void-collapsible-trigger") : null)), this._closed.sync(t, this.open);
35
+ }
36
+ _fromTrigger(e) {
37
+ let t = this._parts.one("void-collapsible-trigger");
38
+ return !!t && e.target instanceof Node && t.contains(e.target);
27
39
  }
28
- render() {
29
- return n`
30
- <button
31
- type="button"
32
- id="trigger-${this._id}"
33
- class="void-collapsible-trigger"
34
- aria-expanded=${String(this.open)}
35
- aria-controls="content-${this._id}"
36
- @click=${this._handleClick}
37
- @keydown=${this._handleKeydown}
38
- >
39
- ${this.heading}
40
- <svg class="void-collapsible-chevron" viewBox="0 0 16 16" fill="none" aria-hidden="true">
41
- <path d="M4 6l4 4 4-4" stroke="currentColor" stroke-width="var(--void-icon-stroke-width)" stroke-linecap="round" stroke-linejoin="round"/>
42
- </svg>
43
- </button>
44
- <div
45
- id="content-${this._id}"
46
- class="void-collapsible-content"
47
- role="region"
48
- aria-labelledby="trigger-${this._id}"
49
- ><div class="void-collapsible-inner"></div></div>
50
- `;
40
+ _toggle(e) {
41
+ this.disabled || (this.open ? this.dispatchEvent(new CustomEvent("void-close", {
42
+ bubbles: !1,
43
+ cancelable: !0,
44
+ detail: { reason: e }
45
+ })) && (this.open = !1) : (this.open = !0, this.dispatchEvent(new CustomEvent("void-open", {
46
+ bubbles: !1,
47
+ detail: { reason: e }
48
+ }))));
51
49
  }
52
50
  };
53
- t([r({ type: String })], i.prototype, "heading", void 0), t([r({
51
+ t([i({
54
52
  type: Boolean,
55
53
  reflect: !0
56
- })], i.prototype, "open", void 0), t([r({
54
+ })], a.prototype, "open", void 0), t([i({
57
55
  type: Boolean,
58
56
  reflect: !0
59
- })], i.prototype, "disabled", void 0), customElements.get("void-collapsible") || customElements.define("void-collapsible", i);
57
+ })], a.prototype, "disabled", void 0), customElements.get("void-collapsible") || customElements.define("void-collapsible", a);
60
58
  //#endregion
61
- export { i as VoidCollapsible };
59
+ export { a as VoidCollapsible };
@@ -1,12 +1,28 @@
1
1
  import { VoidElement } from '../base.js';
2
+ declare const VoidColorPicker_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
2
3
  /** Color selection control with spectrum area, hue slider, hex input, and preset swatches for theme customization and design tools. */
3
- export declare class VoidColorPicker extends VoidElement {
4
+ export declare class VoidColorPicker extends VoidColorPicker_base {
5
+ /** The host's `aria-label` / `aria-labelledby` name the inner control. */
6
+ static labelTarget: string;
7
+ /**
8
+ * Selected colour as a hex string (six digits after the hash). Defaults to black. As an attribute it is the
9
+ * initial value and the form's reset target.
10
+ */
4
11
  value: string;
12
+ /** Stop the picker reacting and exclude the value from the form submission. */
5
13
  disabled: boolean;
14
+ /** Size step: `sm`, `md` (default) or `lg`. */
6
15
  size: 'sm' | 'md' | 'lg';
16
+ /**
17
+ * Preset colours as an array of hex strings shown under the spectrum. Set it as a property from script
18
+ * (`el.swatches = [red, green]`, each a hex string) or as a JSON array in the attribute.
19
+ */
7
20
  swatches: string[];
8
- showInput: boolean;
9
- variant: 'default' | 'compact';
21
+ /** Leave out the hex text field under the spectrum (it is shown by default). */
22
+ hideInput: boolean;
23
+ /** Show only a swatch button that opens the picker in a popup, instead of the full picker inline. */
24
+ compact: boolean;
25
+ /** Whether the compact variant's picker is open. Only meaningful with `compact`. */
10
26
  open: boolean;
11
27
  private _hue;
12
28
  private _saturation;
@@ -44,4 +60,4 @@ declare global {
44
60
  'void-color-picker': VoidColorPicker;
45
61
  }
46
62
  }
47
- //# sourceMappingURL=color-picker.d.ts.map
63
+ export {};
@@ -1,14 +1,19 @@
1
- import { VoidElement as e } from "../base.js";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { html as n, nothing as r } from "lit";
4
- import { property as i } from "lit/decorators.js";
3
+ import { t as 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/color-picker.ts
6
- var a = class t extends e {
8
+ var s = class t extends n(e) {
7
9
  constructor(...e) {
8
- super(...e), this.value = "#000000", this.disabled = !1, this.size = "md", this.swatches = [], this.showInput = !0, this.variant = "default", this.open = !1, this._hue = 0, this._saturation = 0, this._brightness = 0, this._dragging = null, this._boundPointerMove = null, this._boundPointerUp = null, this._onDocumentClick = (e) => {
10
+ 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) => {
9
11
  this.open && (this.contains(e.target) || (this.open = !1));
10
12
  };
11
13
  }
14
+ static {
15
+ this.labelTarget = ".void-color-picker-input, .void-color-picker-compact-input";
16
+ }
12
17
  connectedCallback() {
13
18
  super.connectedCallback(), this._syncFromHex(this.value), this._boundPointerMove = this._onPointerMove.bind(this), this._boundPointerUp = this._onPointerUp.bind(this);
14
19
  }
@@ -17,7 +22,7 @@ var a = class t extends e {
17
22
  }
18
23
  _applyCustomProperties() {
19
24
  let e = this._hsvToHex(this._hue, 100, 100);
20
- this.style.setProperty("--void-cp-hue", e), this.style.setProperty("--void-cp-current", this.value), this.style.setProperty("--void-cp-area-x", `${this._saturation}%`), this.style.setProperty("--void-cp-area-y", `${100 - this._brightness}%`), this.style.setProperty("--void-cp-hue-x", `${this._hue / 360 * 100}%`);
25
+ this.setHostStyle("--void-cp-hue", e), this.setHostStyle("--void-cp-current", this.value), this.setHostStyle("--void-cp-area-x", `${this._saturation}%`), this.setHostStyle("--void-cp-area-y", `${100 - this._brightness}%`), this.setHostStyle("--void-cp-hue-x", `${this._hue / 360 * 100}%`);
21
26
  }
22
27
  _hsvToRgb(e, t, n) {
23
28
  let r = t / 100, i = n / 100, a = i * r, o = a * (1 - Math.abs(e / 60 % 2 - 1)), s = i - a, c = 0, l = 0, u = 0;
@@ -67,10 +72,10 @@ var a = class t extends e {
67
72
  }));
68
73
  }
69
74
  _onAreaPointerDown(e) {
70
- this.disabled || (this._dragging = "area", this._updateAreaFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
75
+ this.formDisabled || (this._dragging = "area", this._updateAreaFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
71
76
  }
72
77
  _onHuePointerDown(e) {
73
- this.disabled || (this._dragging = "hue", this._updateHueFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
78
+ this.formDisabled || (this._dragging = "hue", this._updateHueFromPointer(e), document.addEventListener("pointermove", this._boundPointerMove), document.addEventListener("pointerup", this._boundPointerUp));
74
79
  }
75
80
  _onPointerMove(e) {
76
81
  this._dragging === "area" ? this._updateAreaFromPointer(e) : this._dragging === "hue" && this._updateHueFromPointer(e);
@@ -115,7 +120,7 @@ var a = class t extends e {
115
120
  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));
116
121
  }
117
122
  _renderPicker() {
118
- return n`
123
+ return r`
119
124
  <div class="void-color-picker">
120
125
  <div
121
126
  class="void-color-picker-area"
@@ -129,25 +134,25 @@ var a = class t extends e {
129
134
  >
130
135
  <div class="void-color-picker-hue-thumb"></div>
131
136
  </div>
132
- ${this.showInput ? n`
137
+ ${this.hideInput ? r`
138
+ <div class="void-color-picker-preview"></div>
139
+ ` : r`
133
140
  <div class="void-color-picker-field">
134
141
  <span class="void-color-picker-field-swatch"></span>
135
142
  <span class="void-color-picker-field-separator"></span>
136
143
  <input
137
144
  class="void-color-picker-input"
138
145
  type="text"
139
- .value=${this.value}
146
+ .value=${o(this.value)}
140
147
  ?disabled=${this.disabled}
141
148
  maxlength="7"
142
149
  @change=${this._onHexInput}
143
150
  />
144
151
  </div>
145
- ` : n`
146
- <div class="void-color-picker-preview"></div>
147
152
  `}
148
- ${this.swatches.length > 0 ? n`
153
+ ${this.swatches.length > 0 ? r`
149
154
  <div class="void-color-picker-swatches">
150
- ${this.swatches.map((e) => n`
155
+ ${this.swatches.map((e) => r`
151
156
  <button
152
157
  type="button"
153
158
  class="void-color-picker-swatch"
@@ -158,12 +163,12 @@ var a = class t extends e {
158
163
  ></button>
159
164
  `)}
160
165
  </div>
161
- ` : r}
166
+ ` : i}
162
167
  </div>
163
168
  `;
164
169
  }
165
170
  render() {
166
- return this.variant === "compact" ? n`
171
+ return this.compact ? r`
167
172
  <div class="void-color-picker-compact">
168
173
  <button
169
174
  type="button"
@@ -178,40 +183,41 @@ var a = class t extends e {
178
183
  <input
179
184
  class="void-color-picker-compact-input"
180
185
  type="text"
181
- .value=${this.value}
186
+ .value=${o(this.value)}
182
187
  ?disabled=${this.disabled}
183
188
  maxlength="7"
184
189
  @click=${(e) => e.stopPropagation()}
185
190
  @change=${this._onCompactHexInput}
186
191
  />
187
192
  </button>
188
- ${this.open ? n`
193
+ ${this.open ? r`
189
194
  <div class="void-color-picker-compact-dropdown" role="dialog" aria-label="Color picker">
190
195
  ${this._renderPicker()}
191
196
  </div>
192
- ` : r}
197
+ ` : i}
193
198
  </div>
194
199
  ` : this._renderPicker();
195
200
  }
196
201
  };
197
- t([i({
202
+ t([a({
198
203
  type: String,
199
204
  reflect: !0
200
- })], a.prototype, "value", void 0), t([i({
205
+ })], s.prototype, "value", void 0), t([a({
201
206
  type: Boolean,
202
207
  reflect: !0
203
- })], a.prototype, "disabled", void 0), t([i({
208
+ })], s.prototype, "disabled", void 0), t([a({
204
209
  type: String,
205
210
  reflect: !0
206
- })], a.prototype, "size", void 0), t([i({ type: Array })], a.prototype, "swatches", void 0), t([i({
211
+ })], s.prototype, "size", void 0), t([a({ type: Array })], s.prototype, "swatches", void 0), t([a({
207
212
  type: Boolean,
213
+ attribute: "hide-input",
208
214
  reflect: !0
209
- })], a.prototype, "showInput", void 0), t([i({
210
- type: String,
215
+ })], s.prototype, "hideInput", void 0), t([a({
216
+ type: Boolean,
211
217
  reflect: !0
212
- })], a.prototype, "variant", void 0), t([i({
218
+ })], s.prototype, "compact", void 0), t([a({
213
219
  type: Boolean,
214
220
  reflect: !0
215
- })], a.prototype, "open", void 0), customElements.get("void-color-picker") || customElements.define("void-color-picker", a);
221
+ })], s.prototype, "open", void 0), customElements.get("void-color-picker") || customElements.define("void-color-picker", s);
216
222
  //#endregion
217
- export { a as VoidColorPicker };
223
+ export { s as VoidColorPicker };
@@ -1,25 +1,99 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Filterable dropdown for long option lists like country selectors, user assignment fields, and tag pickers. */
3
- export declare class VoidCombobox extends VoidElement {
2
+ import { OverlayController } from '../overlay.js';
3
+ import { PartsController } from '../parts.js';
4
+ import { ProjectionController } from '../projection.js';
5
+ declare const VoidCombobox_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
6
+ /**
7
+ * Filterable dropdown for long option lists like country selectors, user assignment fields, and tag pickers.
8
+ *
9
+ * One part, `<void-combobox-content>`, holding the `<void-option>`s: it is the list (`role="listbox"`) shown in the
10
+ * top layer under the field. The component renders the text field itself (after the content part) and never
11
+ * moves, copies or wraps the options: each `<void-option>` is the `role="option"` the browser and assistive
12
+ * technology see.
13
+ *
14
+ * Follows the WAI-ARIA "editable combobox with list autocomplete" pattern (manual selection): the rendered input
15
+ * carries `role="combobox"` and keeps DOM focus; the highlighted option is exposed with `aria-activedescendant`
16
+ * and drawn with the `active` attribute; the chosen option has `aria-selected="true"`.
17
+ *
18
+ * Keyboard (focus in the input): ArrowDown opens the list and highlights the chosen option, else the first one
19
+ * (open: the next option, wrapping); ArrowUp the same towards the last; Alt+ArrowDown opens it without
20
+ * highlighting; Enter chooses the highlighted option and closes the list (with nothing highlighted it closes the
21
+ * list and lets a surrounding form submit); Escape closes the list (a second Escape reaches the surrounding
22
+ * dialog); ArrowLeft, ArrowRight, Home and End move the text cursor and take the highlight off the list; typing
23
+ * filters the options; Tab closes the list. Disabled options are skipped.
24
+ *
25
+ * The list is shown in the top layer (never clipped by an `overflow` or `transform` ancestor) and placed under the
26
+ * input with CSS anchor positioning, flipping above it near the bottom of the viewport. A press outside closes it
27
+ * too; focus stays in the input.
28
+ *
29
+ * @fires {CustomEvent<{ reason: 'keyboard' | 'focus' | 'api' }>} void-open - The option list opened.
30
+ * @fires {CustomEvent<{ reason: 'escape' | 'outside' | 'blur' | 'select' | 'parent' | 'api' }>} void-close - The option list is closing.
31
+ */
32
+ export declare class VoidCombobox extends VoidCombobox_base {
33
+ /** The host's `aria-label` / `aria-labelledby` name the inner control. */
34
+ static labelTarget: string;
35
+ /**
36
+ * `value` of the chosen `void-option`. As an attribute it is the initial choice (without it, an option marked
37
+ * `selected` is); read the `value` property for the current one.
38
+ */
4
39
  value: string;
40
+ /**
41
+ * Hint shown in the search field while it is empty. Defaults to `Search...`. It is also the field's
42
+ * accessible name when no `void-field` label names it.
43
+ */
5
44
  placeholder: string;
45
+ /** Stop the field opening and exclude the value from the form submission. */
6
46
  disabled: boolean;
7
- size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
47
+ /** Size step: `sm`, `md` (default) or `lg`. */
48
+ size: 'sm' | 'md' | 'lg';
49
+ /**
50
+ * Mark the field invalid: it gets the error styling and `aria-invalid`. The message itself is shown by
51
+ * the wrapping `void-field`.
52
+ */
8
53
  error: string;
9
54
  name: string;
10
- private _open;
55
+ /** Whether the option list is showing. Reflected, so it can be read (and set) from markup. */
56
+ open: boolean;
11
57
  private _query;
12
- private _options;
58
+ /** The option with visual focus (`aria-activedescendant`), or null. */
59
+ private _active;
60
+ /** Inside updated(): the wiring it runs must not schedule another update. */
61
+ private _wiring;
62
+ /** The rendered input comes first, so reading order puts the field before its (top-layer) list. */
63
+ protected readonly _projection: ProjectionController;
64
+ protected readonly _parts: PartsController;
65
+ protected readonly _overlay: OverlayController;
66
+ private _content;
67
+ private _input;
68
+ /** The options of this combobox, in document order (inside its content part). */
69
+ private get _options();
70
+ /** Options the current query leaves in the list, in document order. */
71
+ private get _visible();
13
72
  connectedCallback(): void;
14
- disconnectedCallback(): void;
15
- updated(_changed: Map<string, unknown>): void;
73
+ /** Whether the initial choice has been settled (a value, or an option marked `selected`). */
74
+ private _initial;
75
+ /** Without an initial value, an option marked `selected` is the initial choice (as in a native select). */
76
+ private _adoptSelected;
77
+ protected willUpdate(changed: Map<string, unknown>): void;
78
+ protected updated(changed: Map<string, unknown>): void;
79
+ /**
80
+ * The content part is the listbox in the top layer; every option is a `role="option"` with an id, chosen
81
+ * (`aria-selected`), highlighted (`active`) and filtered out (`hidden`) by the parent.
82
+ */
83
+ private _wire;
84
+ /** The id of the content part while the list is open (one is generated where the author wrote none). */
85
+ private _controls;
16
86
  render(): import('lit').TemplateResult<1>;
87
+ disconnectedCallback(): void;
88
+ private _onPointerDown;
89
+ /** Closes the list through the overlay stack (so `void-close` carries the reason). */
90
+ private _close;
17
91
  private _onInputFocus;
18
92
  private _onInput;
93
+ /** Moves the highlight: `step` from the current option, or to the first/last enabled option. */
94
+ private _moveActive;
19
95
  private _onInputKeydown;
20
96
  private _onInputBlur;
21
- private _onDocumentClick;
22
- private _onDocumentKeydown;
23
97
  private _selectOption;
24
98
  }
25
99
  declare global {
@@ -27,4 +101,4 @@ declare global {
27
101
  'void-combobox': VoidCombobox;
28
102
  }
29
103
  }
30
- //# sourceMappingURL=combobox.d.ts.map
104
+ export {};