@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,10 +1,17 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  /** User identity display for comment threads, user lists, and profile cards; falls back to initials when no image is provided. */
3
3
  export declare class VoidAvatar extends VoidElement {
4
+ /** URL of the image. When it is empty, or the image fails to load, the avatar shows `initials` instead. */
4
5
  src: string;
6
+ /**
7
+ * Accessible name of the avatar, normally the person's name. Without it the name falls back to
8
+ * `initials`.
9
+ */
5
10
  alt: string;
11
+ /** One to three letters shown when there is no image. Used as the accessible name when `alt` is empty. */
6
12
  initials: string;
7
- size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
13
+ /** Size step: `sm`, `md` (default) or `lg`. */
14
+ size: 'sm' | 'md' | 'lg';
8
15
  connectedCallback(): void;
9
16
  updated(changed: Map<string, unknown>): void;
10
17
  render(): import('lit').TemplateResult<1>;
@@ -15,4 +22,3 @@ declare global {
15
22
  'void-avatar': VoidAvatar;
16
23
  }
17
24
  }
18
- //# sourceMappingURL=avatar.d.ts.map
@@ -1,4 +1,4 @@
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
3
  import { html as n } from "lit";
4
4
  import { property as r } from "lit/decorators.js";
@@ -10,10 +10,10 @@ var i = class extends e {
10
10
  };
11
11
  }
12
12
  connectedCallback() {
13
- super.connectedCallback(), this.setAttribute("role", "img"), this.setAttribute("aria-label", this.alt || this.initials);
13
+ super.connectedCallback(), this.setHostAttribute("role", "img"), this.setHostAttribute("aria-label", this.alt || this.initials);
14
14
  }
15
15
  updated(e) {
16
- (e.has("alt") || e.has("initials")) && this.setAttribute("aria-label", this.alt || this.initials);
16
+ (e.has("alt") || e.has("initials")) && this.setHostAttribute("aria-label", this.alt || this.initials);
17
17
  }
18
18
  render() {
19
19
  return this.src ? n`<img src="${this.src}" alt="${this.alt}" @error="${this._onImgError}" />` : this.initials ? n`<span class="void-avatar-initials">${this.initials}</span>` : n``;
@@ -1,9 +1,15 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  /** Small status chip for issue trackers, tag systems, and categorization UIs where color conveys state at a glance. */
3
3
  export declare class VoidBadge extends VoidElement {
4
- color: 'default' | 'error' | 'warning' | 'success' | 'info' | 'notice' | 'highlight';
4
+ /**
5
+ * Status colour: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`.
6
+ * Colour carries the state, so also say the state in the badge text.
7
+ */
8
+ color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
9
+ /** `filled` (default) fills the badge with its colour; `outline` draws only a border and tinted text. */
5
10
  variant: 'filled' | 'outline';
6
- size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
11
+ /** Size step: `sm`, `md` (default) or `lg`. */
12
+ size: 'sm' | 'md' | 'lg';
7
13
  connectedCallback(): void;
8
14
  }
9
15
  declare global {
@@ -11,4 +17,3 @@ declare global {
11
17
  'void-badge': VoidBadge;
12
18
  }
13
19
  }
14
- //# sourceMappingURL=badge.d.ts.map
@@ -1,4 +1,4 @@
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
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/badge.ts
@@ -7,7 +7,7 @@ var r = class extends e {
7
7
  super(...e), this.color = "default", this.variant = "filled", this.size = "md";
8
8
  }
9
9
  connectedCallback() {
10
- super.connectedCallback(), this.setAttribute("role", "status");
10
+ super.connectedCallback(), this.setHostAttribute("role", "status");
11
11
  }
12
12
  };
13
13
  t([n({
@@ -1,20 +1,31 @@
1
- import { nothing } from 'lit';
2
1
  import { VoidElement } from '../base.js';
3
- /** Full-width site-level announcement for maintenance windows, cookie consent, and promotional messaging. */
2
+ import { PartsController } from '../parts.js';
3
+ /**
4
+ * Full-width site-level announcement for maintenance windows, cookie consent, and promotional messaging.
5
+ *
6
+ * Its text is written as parts: an optional `<void-banner-title>`, the `<void-banner-description>`, an optional
7
+ * `<void-banner-actions>` (buttons or links) and an optional `<void-banner-close>`. The parts are never moved. The
8
+ * close part wraps the one control the author writes (a `<void-button aria-label="Dismiss">`); pressing it fires
9
+ * `void-close` and removes the banner (focus inside it moves on to the next focusable element). Without a close part the banner cannot be dismissed.
10
+ *
11
+ * @fires {CustomEvent<{ reason: 'close-button' }>} void-close - The close part was pressed; the banner removes itself
12
+ * afterwards unless a listener cancels the event. Does not bubble.
13
+ */
4
14
  export declare class VoidBanner extends VoidElement {
5
- color: 'default' | 'error' | 'warning' | 'success' | 'info' | 'notice';
6
- dismissable: boolean;
15
+ /**
16
+ * Status colour of the announcement: `default`, `error`, `warning`, `caution`, `success`, `info`,
17
+ * `notice` or `highlight`.
18
+ */
19
+ color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
20
+ /** `subtle` (default) tints the background; `filled` fills it with the status colour. */
7
21
  variant: 'subtle' | 'filled';
8
- private _userContent;
9
- private _didSetup;
22
+ protected readonly _parts: PartsController;
10
23
  connectedCallback(): void;
11
- protected updated(_changed: Map<string, unknown>): void;
12
- private _close;
13
- render(): typeof nothing | import('lit').TemplateResult<1>;
24
+ disconnectedCallback(): void;
25
+ private _onClick;
14
26
  }
15
27
  declare global {
16
28
  interface HTMLElementTagNameMap {
17
29
  'void-banner': VoidBanner;
18
30
  }
19
31
  }
20
- //# sourceMappingURL=banner.d.ts.map
@@ -1,40 +1,40 @@
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 { 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/banner.ts
6
- var a = class extends e {
7
+ var o = class extends e {
7
8
  constructor(...e) {
8
- super(...e), this.color = "default", this.dismissable = !1, this.variant = "subtle", this._userContent = [], this._didSetup = !1;
9
+ super(...e), this.color = "default", this.variant = "subtle", this._parts = new n(this, {
10
+ tags: [
11
+ "void-banner-title",
12
+ "void-banner-description",
13
+ "void-banner-actions",
14
+ "void-banner-close"
15
+ ],
16
+ onChange: () => void 0
17
+ }), this._onClick = (e) => {
18
+ i(this._parts.one("void-banner-close"), e) && this.dispatchEvent(new CustomEvent("void-close", {
19
+ bubbles: !1,
20
+ cancelable: !0,
21
+ detail: { reason: "close-button" }
22
+ })) && r(this);
23
+ };
9
24
  }
10
25
  connectedCallback() {
11
- super.connectedCallback(), this.setAttribute("role", "banner"), this._didSetup || (this._userContent = Array.from(this.childNodes));
26
+ super.connectedCallback(), this.setHostAttribute("role", "banner"), this.addEventListener("click", this._onClick);
12
27
  }
13
- updated(e) {
14
- if (super.updated(e), !this._didSetup) {
15
- this._didSetup = !0;
16
- for (let e of this._userContent) this.appendChild(e);
17
- }
18
- }
19
- _close() {
20
- this.dispatchEvent(new CustomEvent("void-close", {
21
- bubbles: !0,
22
- composed: !0
23
- })), this.remove();
24
- }
25
- render() {
26
- return this.dismissable ? n`<button type="button" class="void-banner-close" aria-label="Close" @click="${this._close}">&times;</button>` : r;
28
+ disconnectedCallback() {
29
+ super.disconnectedCallback(), this.removeEventListener("click", this._onClick);
27
30
  }
28
31
  };
29
- t([i({
32
+ t([a({
30
33
  type: String,
31
34
  reflect: !0
32
- })], a.prototype, "color", void 0), t([i({
33
- type: Boolean,
34
- reflect: !0
35
- })], a.prototype, "dismissable", void 0), t([i({
35
+ })], o.prototype, "color", void 0), t([a({
36
36
  type: String,
37
37
  reflect: !0
38
- })], a.prototype, "variant", void 0), customElements.get("void-banner") || customElements.define("void-banner", a);
38
+ })], o.prototype, "variant", void 0), customElements.get("void-banner") || customElements.define("void-banner", o);
39
39
  //#endregion
40
- export { a as VoidBanner };
40
+ export { o as VoidBanner };
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit';
1
+ import { VoidElement } from '../base.js';
2
2
  export interface BarChartSeries {
3
3
  name: string;
4
4
  values: number[];
@@ -13,14 +13,39 @@ export interface BarChartData {
13
13
  series: BarChartSeries[];
14
14
  labels?: string[];
15
15
  }
16
- export declare class VoidBarChart extends LitElement {
17
- createRenderRoot(): this;
16
+ /**
17
+ * Bar chart for comparing categories and series, drawn in SVG with animated bars. Give it `data`
18
+ * (`{ series: [{ name, values }], labels }`) from script; it has no children. The chart is an image to
19
+ * assistive technology, so set `aria-label` and state the key figures in the surrounding text.
20
+ */
21
+ export declare class VoidBarChart extends VoidElement {
22
+ /** Height of the chart in pixels. Defaults to 220. The width fills the container. */
18
23
  height: number;
19
- showValues: boolean;
24
+ /** Print each bar's value above it (below it for a negative value), abbreviated above 1000 (`1.2k`). */
25
+ showValue: boolean;
26
+ /**
27
+ * How bars are drawn: `filled` (default, solid), `outline` (tinted fill with a border) or `wireframe`
28
+ * (border only).
29
+ */
20
30
  variant: 'filled' | 'outline' | 'wireframe';
31
+ /**
32
+ * Accessible name of the chart, such as `Revenue by quarter`. The chart is an image to assistive
33
+ * technology, so set it and put the key figures in the text around it.
34
+ */
21
35
  ariaLabel: string;
22
- stagger: boolean | number;
36
+ /**
37
+ * Delay in milliseconds between the bars as they animate in, one after another. Without it the theme's
38
+ * `--void-stagger-chart-bars` applies; `stagger="0"` animates them together.
39
+ */
40
+ stagger: number | null;
23
41
  private _data;
42
+ /**
43
+ * The chart's data: `{ series: [{ name, values, color?, colors? }], labels? }`. `values` are aligned with
44
+ * `labels` (the category names along the axis); `color` colours a whole series and `colors` overrides single
45
+ * bars. Negative values are bars below a zero baseline: the value axis then spans the lowest value as
46
+ * well, and a baseline is drawn at zero. Property only: assign a new object to update the chart and
47
+ * animate to it.
48
+ */
24
49
  get data(): BarChartData;
25
50
  set data(next: BarChartData);
26
51
  private _phase;
@@ -44,4 +69,3 @@ declare global {
44
69
  'void-bar-chart': VoidBarChart;
45
70
  }
46
71
  }
47
- //# sourceMappingURL=bar-chart.d.ts.map
@@ -1,6 +1,7 @@
1
- import { t as e } from "../chunks/decorate-CaYbmmmm.js";
2
- import { n as t, t as n } from "../chunks/scale-_ccSuoYg.js";
3
- import { LitElement as r, html as i, nothing as a, svg as o } from "lit";
1
+ import { t as e } from "../chunks/base-CMruMbxC.js";
2
+ import { t } from "../chunks/decorate-CaYbmmmm.js";
3
+ import { n, t as r } from "../chunks/scale-_ccSuoYg.js";
4
+ import { html as i, nothing as a, svg as o } from "lit";
4
5
  import { property as s, state as c } from "lit/decorators.js";
5
6
  //#region src/components/bar-chart.ts
6
7
  function l(e) {
@@ -17,9 +18,9 @@ function f(e) {
17
18
  let t = 10 ** Math.floor(Math.log10(e)), n = e / t;
18
19
  return (n <= 1 ? 1 : n <= 2 ? 2 : n <= 5 ? 5 : 10) * t;
19
20
  }
20
- var p = class extends r {
21
+ var p = class extends e {
21
22
  constructor(...e) {
22
- super(...e), this.height = 220, this.showValues = !1, this.variant = "filled", this.ariaLabel = "", this.stagger = !0, this._data = { series: [] }, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._staggerMs = 0, this._rafHandle = 0, this._tick = (e) => {
23
+ super(...e), this.height = 220, this.showValue = !1, this.variant = "filled", this.ariaLabel = "", this.stagger = null, this._data = { series: [] }, this._phase = "pre", this._display = /* @__PURE__ */ new Map(), this._targets = /* @__PURE__ */ new Map(), this._animFrom = /* @__PURE__ */ new Map(), this._animStart = 0, this._animDuration = 0, this._staggerMs = 0, this._rafHandle = 0, this._tick = (e) => {
23
24
  let t = e - this._animStart, n = !1;
24
25
  for (let [e, r] of this._targets) {
25
26
  let [, i] = e.split("-"), a = Number(i) * this._staggerMs, o = a + this._animDuration, s = this._animFrom.get(e) ?? 0;
@@ -33,9 +34,6 @@ var p = class extends r {
33
34
  this.requestUpdate(), n ? this._rafHandle = requestAnimationFrame(this._tick) : this._phase = "idle";
34
35
  };
35
36
  }
36
- createRenderRoot() {
37
- return this;
38
- }
39
37
  get data() {
40
38
  return this._data;
41
39
  }
@@ -48,11 +46,11 @@ var p = class extends r {
48
46
  }
49
47
  _refreshTargets() {
50
48
  this._targets.clear(), this._data.series.forEach((e, t) => {
51
- e.values.forEach((e, n) => this._targets.set(this._key(t, n), e));
49
+ e.values.forEach((e, n) => this._targets.set(this._key(t, n), Number.isFinite(e) ? e : 0));
52
50
  });
53
51
  }
54
52
  connectedCallback() {
55
- super.connectedCallback(), this.setAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
53
+ super.connectedCallback(), this.setHostAttribute("role", "img"), this._refreshTargets(), requestAnimationFrame(() => {
56
54
  this._startAnimation(/* @__PURE__ */ new Map());
57
55
  });
58
56
  }
@@ -62,16 +60,16 @@ var p = class extends r {
62
60
  _startAnimation(e) {
63
61
  cancelAnimationFrame(this._rafHandle);
64
62
  let t = getComputedStyle(this), n = t.getPropertyValue("--void-anim-scale").trim(), r = n === "" ? 1 : parseFloat(n), i = parseFloat(t.getPropertyValue("--void-duration-chart-enter")) || 700, a = parseFloat(t.getPropertyValue("--void-stagger-chart-bars")) || 40;
65
- if (this._animDuration = i * r, this.stagger === !1 ? this._staggerMs = 0 : this.stagger === !0 ? this._staggerMs = a * r : this._staggerMs = this.stagger * r, this._animFrom = e, this._animStart = performance.now(), this._animDuration <= 0) {
63
+ if (this._animDuration = i * r, this.stagger === null || Number.isNaN(this.stagger) ? this._staggerMs = a * r : this._staggerMs = this.stagger * r, this._animFrom = e, this._animStart = performance.now(), this._animDuration <= 0) {
66
64
  this._display = new Map(this._targets), this._phase = "idle", this.requestUpdate();
67
65
  return;
68
66
  }
69
67
  this._phase = "animating", this._rafHandle = requestAnimationFrame(this._tick);
70
68
  }
71
69
  render() {
72
- let { series: e, labels: r = [] } = this._data;
73
- if (e.length === 0) return i`<svg viewBox="0 0 600 ${this.height}" aria-label=${this.ariaLabel}></svg>`;
74
- let s = this.height - 16 - 32, c = Math.max(...e.map((e) => e.values.length)), l = e.flatMap((e) => e.values), p = new t([0, f(Math.max(...l, 0) * 1.1) || 1], [16 + s, 16]), m = new n(c, [40, 584], .2), h = p.ticks(5);
70
+ let { series: e, labels: t = [] } = this._data;
71
+ if (e.length === 0) return i`<svg viewBox="0 0 600 ${this.height}" role="img" aria-label=${this.ariaLabel || "Bar chart"}></svg>`;
72
+ let s = this.height - 16 - 32, c = Math.max(...e.map((e) => e.values.length)), l = e.flatMap((e) => e.values).filter(Number.isFinite), p = Math.max(...l, 0), m = Math.min(...l, 0), h = m < 0 ? -f(-m * 1.1) : 0, g = new n([h, p > 0 || h === 0 ? f(p * 1.1) || 1 : 0], [16 + s, 16]), _ = g.scale(0), v = new r(c, [40, 584], .2), y = g.ticks(5);
75
73
  return i`
76
74
  <svg
77
75
  viewBox="0 0 600 ${this.height}"
@@ -81,25 +79,27 @@ var p = class extends r {
81
79
  data-phase=${this._phase}
82
80
  >
83
81
  <g class="void-bar-chart-grid">
84
- ${h.map((e) => {
85
- let t = p.scale(e);
82
+ ${y.map((e) => {
83
+ let t = g.scale(e);
86
84
  return o`<line x1=${40} x2=${584} y1=${t} y2=${t}></line>`;
87
85
  })}
88
86
  </g>
89
87
 
88
+ ${h < 0 ? o`<line class="void-bar-chart-baseline" x1=${40} x2=${584} y1=${_} y2=${_}></line>` : a}
89
+
90
90
  <g class="void-bar-chart-y-axis">
91
- ${h.map((e) => o`<text x=${32} y=${p.scale(e)} dy="0.32em" text-anchor="end">${u(e)}</text>`)}
91
+ ${y.map((e) => o`<text x=${32} y=${g.scale(e)} dy="0.32em" text-anchor="end">${u(e)}</text>`)}
92
92
  </g>
93
93
 
94
94
  ${e.map((t, n) => {
95
- let r = t.color ?? `var(--void-chart-series-${n % 6 + 1})`, i = m.bandwidth / e.length;
95
+ let r = t.color ?? `var(--void-chart-series-${n % 6 + 1})`, i = v.bandwidth / e.length;
96
96
  return o`
97
97
  <g class="void-bar-chart-series" style="--series-color: ${r}">
98
98
  ${t.values.map((e, r) => {
99
- let c = this._display.get(this._key(n, r)) ?? 0, l = m.scale(r) + i * n, u = p.scale(c), d = Math.max(0, 16 + s - u), f = t.colors?.[r];
99
+ let s = this._display.get(this._key(n, r)) ?? 0, c = v.scale(r) + i * n, l = g.scale(s), u = Math.min(l, _), d = Math.abs(_ - l), f = t.colors?.[r];
100
100
  return o`<rect
101
101
  class="void-bar-chart-bar"
102
- x=${l}
102
+ x=${c}
103
103
  y=${u}
104
104
  width=${i - 2}
105
105
  height=${d}
@@ -110,42 +110,32 @@ var p = class extends r {
110
110
  `;
111
111
  })}
112
112
 
113
- ${this.showValues ? e.map((t, n) => {
114
- let r = m.bandwidth / e.length;
113
+ ${this.showValue ? e.map((t, n) => {
114
+ let r = v.bandwidth / e.length;
115
115
  return o`
116
116
  <g class="void-bar-chart-values">
117
117
  ${t.values.map((e, t) => {
118
- let i = this._display.get(this._key(n, t)) ?? 0;
119
- return o`<text x=${m.scale(t) + r * n + (r - 2) / 2} y=${p.scale(i) - 6} text-anchor="middle">${d(i)}</text>`;
118
+ let i = this._display.get(this._key(n, t)) ?? 0, a = v.scale(t) + r * n + (r - 2) / 2, s = g.scale(i);
119
+ return o`<text x=${a} y=${i < 0 ? s + 14 : s - 6} text-anchor="middle">${d(i)}</text>`;
120
120
  })}
121
121
  </g>
122
122
  `;
123
123
  }) : a}
124
124
 
125
125
  <g class="void-bar-chart-x-axis">
126
- ${r.slice(0, c).map((e, t) => o`<text x=${m.scale(t) + m.bandwidth / 2} y=${16 + s + 18} text-anchor="middle">${e}</text>`)}
126
+ ${t.slice(0, c).map((e, t) => o`<text x=${v.scale(t) + v.bandwidth / 2} y=${16 + s + 18} text-anchor="middle">${e}</text>`)}
127
127
  </g>
128
128
  </svg>
129
129
  `;
130
130
  }
131
131
  };
132
- e([s({
132
+ t([s({
133
133
  type: Number,
134
134
  reflect: !0
135
- })], p.prototype, "height", void 0), e([s({
135
+ })], p.prototype, "height", void 0), t([s({
136
136
  type: Boolean,
137
- attribute: "show-values",
137
+ attribute: "show-value",
138
138
  reflect: !0
139
- })], p.prototype, "showValues", void 0), e([s({ reflect: !0 })], p.prototype, "variant", void 0), e([s({ attribute: "aria-label" })], p.prototype, "ariaLabel", void 0), e([s({ converter: {
140
- fromAttribute(e) {
141
- if (e === null || e === "" || e === "true") return !0;
142
- if (e === "false") return !1;
143
- let t = Number(e);
144
- return isNaN(t) ? !0 : t;
145
- },
146
- toAttribute(e) {
147
- return e === !0 ? "" : e === !1 ? "false" : String(e);
148
- }
149
- } })], p.prototype, "stagger", void 0), e([c()], p.prototype, "_phase", void 0), customElements.get("void-bar-chart") || customElements.define("void-bar-chart", p);
139
+ })], p.prototype, "showValue", void 0), t([s({ reflect: !0 })], p.prototype, "variant", void 0), t([s({ attribute: "aria-label" })], p.prototype, "ariaLabel", void 0), t([s({ type: Number })], p.prototype, "stagger", void 0), t([c()], p.prototype, "_phase", void 0), customElements.get("void-bar-chart") || customElements.define("void-bar-chart", p);
150
140
  //#endregion
151
141
  export { p as VoidBarChart };
@@ -1,16 +1,29 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Navigation trail for deep page hierarchies in dashboards, e-commerce category trees, and file browsers. */
2
+ import { PartsController } from '../parts.js';
3
+ /**
4
+ * Navigation trail for deep page hierarchies in dashboards, e-commerce category trees, and file browsers.
5
+ *
6
+ * A navigation landmark named "Breadcrumb" holding an ordered list, as in the ARIA Authoring Practices breadcrumb
7
+ * pattern: write one `<void-breadcrumbs-list>` and, in it, one `<void-breadcrumbs-item>` per crumb, each holding a
8
+ * link (or plain text for the page you are on). Mark the current page with `aria-current="page"` on its item. The
9
+ * list and the items are CSS-only parts; the component gives them `role="list"` and `role="listitem"` (so a screen
10
+ * reader says "list, 3 items" and "2 of 3"), also for items added, removed or reordered later. It renders nothing of
11
+ * its own: the separators are drawn by the theme between the items and are not exposed to assistive technology.
12
+ */
3
13
  export declare class VoidBreadcrumbs extends VoidElement {
14
+ /**
15
+ * Character drawn between the crumbs. Defaults to `/`. It is drawn by CSS and hidden from assistive
16
+ * technology.
17
+ */
4
18
  separator: string;
5
- private _items;
6
- private _didSetup;
19
+ protected readonly _parts: PartsController;
20
+ /** Writes the list and list-item roles onto the parts: items count only inside the list part. */
21
+ private _wire;
7
22
  connectedCallback(): void;
8
- protected updated(_changed: Map<string, unknown>): void;
9
- render(): import('lit').TemplateResult<1>;
23
+ protected updated(changed: Map<string, unknown>): void;
10
24
  }
11
25
  declare global {
12
26
  interface HTMLElementTagNameMap {
13
27
  'void-breadcrumbs': VoidBreadcrumbs;
14
28
  }
15
29
  }
16
- //# sourceMappingURL=breadcrumbs.d.ts.map
@@ -1,33 +1,27 @@
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";
3
+ import { n } from "../chunks/parts-D30c8OoG.js";
4
4
  import { property as r } from "lit/decorators.js";
5
5
  //#region src/components/breadcrumbs.ts
6
- var i = class extends e {
6
+ var i = "void-breadcrumbs-list", a = "void-breadcrumbs-item", o = class extends e {
7
7
  constructor(...e) {
8
- super(...e), this.separator = "/", this._items = [], this._didSetup = !1;
8
+ super(...e), this.separator = "/", this._parts = new n(this, {
9
+ tags: [i, a],
10
+ onChange: () => this._wire()
11
+ });
12
+ }
13
+ _wire() {
14
+ let e = this._parts.one(i);
15
+ e && this._parts.set(e, "role", "list");
16
+ for (let t of this._parts.within(e, a)) this._parts.set(t, "role", "listitem");
9
17
  }
10
18
  connectedCallback() {
11
- super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Breadcrumb"), this._didSetup || (this._items = Array.from(this.children));
19
+ super.connectedCallback(), this.setHostAttribute("role", "navigation"), this.setHostAttribute("aria-label", "Breadcrumb");
12
20
  }
13
21
  updated(e) {
14
- if (super.updated(e), !this._didSetup) {
15
- this._didSetup = !0;
16
- let e = this.querySelector(".void-breadcrumbs-list");
17
- if (!e) return;
18
- this._items.forEach((t, n) => {
19
- let r = document.createElement("li");
20
- r.className = "void-breadcrumbs-item", r.setAttribute("data-separator", this.separator), n === this._items.length - 1 && r.setAttribute("aria-current", "page"), r.appendChild(t), e.appendChild(r);
21
- });
22
- } else if (e.has("separator")) {
23
- let e = Array.from(this.querySelectorAll(".void-breadcrumbs-item"));
24
- for (let t of e) t.setAttribute("data-separator", this.separator);
25
- }
26
- }
27
- render() {
28
- return n`<ol class="void-breadcrumbs-list"></ol>`;
22
+ super.updated(e), e.has("separator") && this.setHostStyle("--_void-breadcrumbs-separator", JSON.stringify(this.separator));
29
23
  }
30
24
  };
31
- t([r({ type: String })], i.prototype, "separator", void 0), customElements.get("void-breadcrumbs") || customElements.define("void-breadcrumbs", i);
25
+ t([r({ type: String })], o.prototype, "separator", void 0), customElements.get("void-breadcrumbs") || customElements.define("void-breadcrumbs", o);
32
26
  //#endregion
33
- export { i as VoidBreadcrumbs };
27
+ export { o as VoidBreadcrumbs };
@@ -1,25 +1,79 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Action trigger for forms, dialogs, and toolbars; supports loading states and semantic color variants. */
2
+ import { KeyboardActivation } from '../keyboard-activation.js';
3
+ /**
4
+ * Action trigger for forms, dialogs, and toolbars; supports semantic color variants.
5
+ *
6
+ * Holding a link or a native button (`<void-button><a href="/docs">Docs</a></void-button>`) makes it a link
7
+ * button: the inner element is then the one control, so the host is presentational (no role, no tab stop, no key
8
+ * handling) and the theme draws the button's focus ring when the inner element has focus. `disabled` on a link
9
+ * button sets `aria-disabled="true"` and `tabindex="-1"` on the link and stops it navigating (a link cannot be
10
+ * disabled); on an inner `<button>` it disables that button.
11
+ */
3
12
  export declare class VoidButton extends VoidElement {
4
- static formAssociated: boolean;
5
- variant: 'outline' | 'filled';
6
- color: 'default' | 'error' | 'warning' | 'success' | 'info' | 'notice';
13
+ /**
14
+ * Visual weight. `outline` (default) is a bordered button, `filled` is the
15
+ * primary action, and `ghost` draws no border or fill until hovered: use it
16
+ * for row actions, toolbars and the quiet button beside a primary one.
17
+ */
18
+ variant: 'outline' | 'filled' | 'ghost';
19
+ /**
20
+ * Status colour: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`. Use `error`
21
+ * for a destructive action such as Delete.
22
+ */
23
+ color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
24
+ /**
25
+ * Stop the button reacting: clicks and Enter or Space do nothing and it leaves the tab order. A button
26
+ * inside a `<fieldset disabled>` is disabled too.
27
+ */
7
28
  disabled: boolean;
29
+ /**
30
+ * What it does to the surrounding form: `button` (default) nothing, `submit` submits the form (running
31
+ * validation), `reset` resets it. Set `submit` on the primary action of a form.
32
+ */
8
33
  type: 'button' | 'submit' | 'reset';
9
- size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
10
- private _internals;
11
- constructor();
12
- /** Return the associated form, via ElementInternals or DOM traversal. */
34
+ /** Size step: `sm`, `md` (default) or `lg`. Controls of the same step share one height. */
35
+ size: 'sm' | 'md' | 'lg';
36
+ /** Watches every ancestor's `disabled` attribute (a `<fieldset disabled>`). */
37
+ private _unwatch;
38
+ /**
39
+ * The control of a link button: a direct child `<a href>` or `<button>` (`<void-button><a href>…</a></void-button>`).
40
+ * While there is one it is the only interactive element and the host is presentational.
41
+ */
42
+ private get _control();
43
+ /** What the button wrote on the control while disabled, to take back off when it is enabled or replaced. */
44
+ private _inert;
45
+ private _observer;
46
+ private _syncQueued;
47
+ /**
48
+ * Keyboard activation is a real `click`, as on a native button: Enter on keydown, Space on keyup. A link button
49
+ * has no keyboard handling of its own: the inner link or button takes the keys (Enter follows the link, Space
50
+ * does nothing on a link), as it does when the key's target is not the host.
51
+ */
52
+ protected readonly _activation: KeyboardActivation;
53
+ /** The form the button sits in. */
13
54
  private get _form();
14
55
  connectedCallback(): void;
15
56
  disconnectedCallback(): void;
16
57
  updated(changed: Map<string, unknown>): void;
58
+ /** True when disabled directly or via an ancestor `<fieldset disabled>`. */
59
+ get formDisabled(): boolean;
60
+ private _requestSync;
61
+ /** Writes the host's button semantics, or, for a link button, none and the disabled state of its control. */
62
+ private _syncDisabledState;
63
+ /**
64
+ * A link cannot be disabled: it is announced as disabled (`aria-disabled`), leaves the tab order, and
65
+ * `_handleClick` stops it navigating. A native button is disabled for real. Only what is not already there is
66
+ * written, and remembered so enabling takes back exactly that.
67
+ */
68
+ private _disableControl;
69
+ /** Takes back what a disabled state wrote on a control that is enabled now (or no longer the control). */
70
+ private _release;
71
+ /** A click on the link or button inside a disabled button goes nowhere: not to its own listeners, not to the page. */
72
+ private _blockDisabledControl;
17
73
  private _handleClick;
18
- private _handleKeydown;
19
74
  }
20
75
  declare global {
21
76
  interface HTMLElementTagNameMap {
22
77
  'void-button': VoidButton;
23
78
  }
24
79
  }
25
- //# sourceMappingURL=button.d.ts.map