@voidable/ui 0.6.1 → 0.8.1

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,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/status-dot.ts
@@ -7,10 +7,10 @@ var r = class extends e {
7
7
  super(...e), this.status = "offline";
8
8
  }
9
9
  connectedCallback() {
10
- super.connectedCallback(), this.setAttribute("role", "status"), this.setAttribute("aria-label", this._ariaLabel());
10
+ super.connectedCallback(), this.setHostAttribute("role", "status"), this.setHostAttribute("aria-label", this._ariaLabel());
11
11
  }
12
12
  updated(e) {
13
- e.has("status") && this.setAttribute("aria-label", this._ariaLabel());
13
+ e.has("status") && this.setHostAttribute("aria-label", this._ariaLabel());
14
14
  }
15
15
  _ariaLabel() {
16
16
  switch (this.status) {
@@ -1,7 +1,12 @@
1
1
  import { VoidElement } from '../base.js';
2
2
  /** Multi-step progress tracker for onboarding flows, checkout funnels, and guided wizards. */
3
3
  export declare class VoidStepper extends VoidElement {
4
+ /** Zero-based index of the current step. Earlier steps show as completed, later ones as upcoming. */
4
5
  value: number;
6
+ /**
7
+ * Step labels as one comma-separated string, in order: `Account, Plan, Payment`. The element draws
8
+ * them; it does not hold any step content.
9
+ */
5
10
  steps: string;
6
11
  connectedCallback(): void;
7
12
  render(): import('lit').TemplateResult<1>;
@@ -11,4 +16,3 @@ declare global {
11
16
  'void-stepper': VoidStepper;
12
17
  }
13
18
  }
14
- //# sourceMappingURL=stepper.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, nothing as r } from "lit";
4
4
  import { property as i } from "lit/decorators.js";
@@ -8,7 +8,7 @@ var a = class extends e {
8
8
  super(...e), this.value = 0, this.steps = "";
9
9
  }
10
10
  connectedCallback() {
11
- super.connectedCallback(), this.setAttribute("role", "navigation"), this.setAttribute("aria-label", "Progress");
11
+ super.connectedCallback(), this.setHostAttribute("role", "navigation"), this.setHostAttribute("aria-label", "Progress");
12
12
  }
13
13
  render() {
14
14
  return n`${this.steps.split(",").map((e) => e.trim()).filter(Boolean).map((e, t) => {
@@ -1,15 +1,34 @@
1
1
  import { VoidElement } from '../base.js';
2
+ import { KeyboardActivation } from '../keyboard-activation.js';
3
+ import { FormSubmission } from '../form-control.js';
4
+ declare const VoidSwitch_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
2
5
  /** On/off toggle for feature flags, notification preferences, and settings that take immediate effect. */
3
- export declare class VoidSwitch extends VoidElement {
6
+ export declare class VoidSwitch extends VoidSwitch_base {
7
+ /** Enter and Space fire a real `click`, as on a native button. */
8
+ protected readonly _activation: KeyboardActivation;
9
+ /** Whether the switch is on. The attribute is the initial state and the form's reset target. */
4
10
  checked: boolean;
11
+ /**
12
+ * Stop the switch reacting and exclude it from the form submission. Also disabled by an enclosing
13
+ * `<fieldset disabled>`.
14
+ */
5
15
  disabled: boolean;
6
- color: 'default' | 'error' | 'warning' | 'success' | 'info' | 'notice';
7
- size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
16
+ /** Submitted under `name` while checked (like a native checkbox). */
17
+ value: string;
18
+ /**
19
+ * Status colour of the switch when on: `default`, `error`, `warning`, `caution`, `success`, `info`,
20
+ * `notice` or `highlight`.
21
+ */
22
+ color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
23
+ /** Size step: `sm`, `md` (default) or `lg`. */
24
+ size: 'sm' | 'md' | 'lg';
8
25
  connectedCallback(): void;
9
26
  disconnectedCallback(): void;
10
27
  updated(changed: Map<string, unknown>): void;
28
+ protected formSubmission(): FormSubmission;
29
+ protected formSnapshot(): unknown;
30
+ protected formRestore(state: unknown): void;
11
31
  private _handleClick;
12
- private _handleKeydown;
13
32
  render(): import('lit').TemplateResult<1>;
14
33
  }
15
34
  declare global {
@@ -17,4 +36,4 @@ declare global {
17
36
  'void-switch': VoidSwitch;
18
37
  }
19
38
  }
20
- //# sourceMappingURL=switch.d.ts.map
39
+ export {};
@@ -1,45 +1,63 @@
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 { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
+ import { t as r } from "../chunks/form-control-C0vH6gii.js";
5
+ import { html as i } from "lit";
6
+ import { property as a } from "lit/decorators.js";
5
7
  //#region src/components/switch.ts
6
- var i = class extends e {
8
+ var o = class extends r(e) {
7
9
  constructor(...e) {
8
- super(...e), this.checked = !1, this.disabled = !1, this.color = "default", this.size = "md", this._handleClick = () => {
9
- this.disabled || (this.checked = !this.checked, this.dispatchEvent(new CustomEvent("void-change", {
10
+ super(...e), this._activation = new n(this, { disabled: () => this.formDisabled }), this.checked = !1, this.disabled = !1, this.value = "on", this.color = "default", this.size = "md", this._handleClick = () => {
11
+ this.formDisabled || (this.checked = !this.checked, this.dispatchEvent(new CustomEvent("void-change", {
10
12
  bubbles: !0,
11
13
  composed: !0,
12
- detail: { checked: this.checked }
14
+ detail: {
15
+ value: this.value,
16
+ checked: this.checked
17
+ }
13
18
  })));
14
- }, this._handleKeydown = (e) => {
15
- (e.key === " " || e.key === "Enter") && !this.disabled && (e.preventDefault(), this._handleClick());
16
19
  };
17
20
  }
18
21
  connectedCallback() {
19
- super.connectedCallback(), this.setAttribute("role", "switch"), this.setAttribute("tabindex", this.disabled ? "-1" : "0"), this.setAttribute("aria-checked", String(this.checked)), this.addEventListener("click", this._handleClick), this.addEventListener("keydown", this._handleKeydown);
22
+ super.connectedCallback(), this.setHostAttribute("role", "switch"), this.setHostAttribute("tabindex", this.disabled ? "-1" : "0"), this.setHostAttribute("aria-checked", String(this.checked)), this.addEventListener("click", this._handleClick);
20
23
  }
21
24
  disconnectedCallback() {
22
- super.disconnectedCallback(), this.removeEventListener("click", this._handleClick), this.removeEventListener("keydown", this._handleKeydown);
25
+ super.disconnectedCallback(), this.removeEventListener("click", this._handleClick);
23
26
  }
24
27
  updated(e) {
25
- e.has("checked") && this.setAttribute("aria-checked", String(this.checked)), e.has("disabled") && (this.setAttribute("aria-disabled", String(this.disabled)), this.setAttribute("tabindex", this.disabled ? "-1" : "0"));
28
+ if (e.has("checked") && this.setHostAttribute("aria-checked", String(this.checked)), e.has("disabled") || e.has("ancestorDisabled")) {
29
+ let e = this.formDisabled;
30
+ this.setHostAttribute("aria-disabled", e ? "true" : null), this.setHostAttribute("tabindex", e ? "-1" : "0");
31
+ }
32
+ }
33
+ formSubmission() {
34
+ return this.checked ? this.value : null;
35
+ }
36
+ formSnapshot() {
37
+ return this.checked;
38
+ }
39
+ formRestore(e) {
40
+ this.checked = !!e;
26
41
  }
27
42
  render() {
28
- return n`<span class="void-switch-track"><span class="void-switch-thumb"></span></span>`;
43
+ return i`<span class="void-switch-track"><span class="void-switch-thumb"></span></span>`;
29
44
  }
30
45
  };
31
- t([r({
46
+ t([a({
32
47
  type: Boolean,
33
48
  reflect: !0
34
- })], i.prototype, "checked", void 0), t([r({
49
+ })], o.prototype, "checked", void 0), t([a({
35
50
  type: Boolean,
36
51
  reflect: !0
37
- })], i.prototype, "disabled", void 0), t([r({
52
+ })], o.prototype, "disabled", void 0), t([a({
53
+ type: String,
54
+ reflect: !0
55
+ })], o.prototype, "value", void 0), t([a({
38
56
  type: String,
39
57
  reflect: !0
40
- })], i.prototype, "color", void 0), t([r({
58
+ })], o.prototype, "color", void 0), t([a({
41
59
  type: String,
42
60
  reflect: !0
43
- })], i.prototype, "size", void 0), customElements.get("void-switch") || customElements.define("void-switch", i);
61
+ })], o.prototype, "size", void 0), customElements.get("void-switch") || customElements.define("void-switch", o);
44
62
  //#endregion
45
- export { i as VoidSwitch };
63
+ export { o as VoidSwitch };
@@ -1,14 +1,63 @@
1
+ import { PropertyValues } from 'lit';
1
2
  import { VoidElement } from '../base.js';
2
- /** Styled data table for admin lists, report grids, and comparison layouts. */
3
+ /**
4
+ * Data table around a native `<table>`: sets how it looks (`striped`, `hoverable`, `compact`,
5
+ * `bordered`, `inset`), how it behaves when the container is narrow (`stack`) and when it is wider
6
+ * than its container (`scrollable`, `sticky-header`, `sticky-column`).
7
+ *
8
+ * **Stacked presentation.** `stack` turns each row into a block of label and value pairs while the
9
+ * table's container (not the viewport) is narrower than a breakpoint (`stack="48rem"`, `stack="always"`). The label of a cell is the
10
+ * text of the header cell of its column; it is copied to the cell as `data-label` (a `data-label`
11
+ * written on a cell is kept). `data-stack` on a header cell sets the role of a column in the block:
12
+ * `title` (the block's heading, no label), `select` (a row checkbox, beside the title), `actions`
13
+ * (buttons, grouped at the end) or `hide` (left out). It is copied to the cells of the column.
14
+ * `data-align="end"` on a header cell right-aligns a numeric column. Because browsers can drop table
15
+ * semantics when `display` changes, a table with `stack` carries explicit table, row and cell roles.
16
+ *
17
+ * **Overflow.** Nothing is clipped by default, so a menu, popover or tooltip opened from a cell is
18
+ * always fully visible. `scrollable` makes the table its own horizontal scroll region: it is
19
+ * focusable and labelled (`label`, else the `<caption>`, else `aria-label`) only while it actually
20
+ * overflows, and fades its edges while there is more to scroll to. `max-height` makes the region
21
+ * scroll vertically too, which is what `sticky-header` needs; without it a sticky header sticks to
22
+ * the page.
23
+ *
24
+ * @cssprop --void-table-max-height - Height at which a scrollable table starts scrolling vertically.
25
+ */
3
26
  export declare class VoidTable extends VoidElement {
27
+ #private;
28
+ /** Shade every other body row. */
4
29
  striped: boolean;
30
+ /** Highlight the body row under the pointer. */
5
31
  hoverable: boolean;
32
+ /** Reduce the padding of the cells for a denser table. */
6
33
  compact: boolean;
34
+ /** Draw a border around every cell. */
7
35
  bordered: boolean;
36
+ /** For a table placed in a card or panel: its dividers and stripes run to the container's edge and its text stays aligned with the container's content. */
37
+ inset: boolean;
38
+ /**
39
+ * Presents each row as a block of label and value pairs while the table's container is narrow.
40
+ * Present without a value: stack below the theme's breakpoint (`--void-table-stack-at`, 40rem).
41
+ * A CSS length (`48rem`, `600px`) sets the breakpoint for this table, `always` stacks at every
42
+ * width. Absent: always a table.
43
+ */
44
+ stack: string | null;
45
+ /** Makes the table a horizontal scroll region (focusable and labelled while it overflows) with faded edges. */
46
+ scrollable: boolean;
47
+ /** Keeps the header row in view: against the table's own scroll (with `max-height`) or against the page. */
48
+ stickyHeader: boolean;
49
+ /** Keeps the first column in view while the table scrolls horizontally. */
50
+ stickyColumn: boolean;
51
+ /** Height (a CSS length) at which a scrollable table scrolls vertically. */
52
+ maxHeight: string | null;
53
+ /** Accessible name of the scroll region (default: the table's caption, then `aria-label`). */
54
+ label: string | null;
55
+ connectedCallback(): void;
56
+ disconnectedCallback(): void;
57
+ protected updated(changed: PropertyValues): void;
8
58
  }
9
59
  declare global {
10
60
  interface HTMLElementTagNameMap {
11
61
  'void-table': VoidTable;
12
62
  }
13
63
  }
14
- //# sourceMappingURL=table.d.ts.map
@@ -1,24 +1,173 @@
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/table.ts
5
- var r = class extends e {
5
+ var r = "button, a[href], input, select, textarea, [tabindex], [role=\"checkbox\"], [role=\"button\"], [role=\"switch\"]", i = 100, a = {
6
+ TABLE: "table",
7
+ THEAD: "rowgroup",
8
+ TBODY: "rowgroup",
9
+ TFOOT: "rowgroup",
10
+ TR: "row",
11
+ TD: "cell",
12
+ CAPTION: "caption"
13
+ };
14
+ function o(e) {
15
+ return Array.from(e.children).filter((e) => e.tagName === "TD" || e.tagName === "TH");
16
+ }
17
+ function s(e) {
18
+ return Math.max(1, Number.parseInt(e.getAttribute("colspan") ?? "1", 10) || 1);
19
+ }
20
+ var c = class extends e {
6
21
  constructor(...e) {
7
- super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1;
22
+ super(...e), this.striped = !1, this.hoverable = !1, this.compact = !1, this.bordered = !1, this.inset = !1, this.stack = null, this.scrollable = !1, this.stickyHeader = !1, this.stickyColumn = !1, this.maxHeight = null, this.label = null, this.#e = null, this.#t = null, this.#n = !1, this.#r = /* @__PURE__ */ new WeakMap(), this.#i = /* @__PURE__ */ new WeakMap(), this.#a = /* @__PURE__ */ new WeakMap(), this.#o = null, this.#s = !1, this.#c = !1, this.#l = () => this.#v();
23
+ }
24
+ #e;
25
+ #t;
26
+ #n;
27
+ #r;
28
+ #i;
29
+ #a;
30
+ #o;
31
+ #s;
32
+ #c;
33
+ connectedCallback() {
34
+ super.connectedCallback(), this.#e ??= new MutationObserver(() => this.#u()), this.#e.observe(this, {
35
+ childList: !0,
36
+ subtree: !0,
37
+ characterData: !0,
38
+ attributes: !0,
39
+ attributeFilter: [
40
+ "data-label",
41
+ "data-stack",
42
+ "data-align",
43
+ "role",
44
+ "colspan"
45
+ ]
46
+ }), typeof ResizeObserver < "u" && (this.#t ??= new ResizeObserver(() => this.#u()), this.#t.observe(this)), this.addEventListener("scroll", this.#l, { passive: !0 }), this.#u();
47
+ }
48
+ disconnectedCallback() {
49
+ super.disconnectedCallback(), this.#e?.disconnect(), this.#t?.disconnect(), this.removeEventListener("scroll", this.#l);
50
+ }
51
+ updated(e) {
52
+ super.updated(e), this.setHostStyle("--void-table-max-height", this.maxHeight || "");
53
+ let t = (this.stack ?? "").trim();
54
+ /^\d*\.?\d+(px|rem|em)$/.test(t) ? (this.setHostStyle("--void-table-stack-at", t), this.#c = !0) : this.#c &&= (this.setHostStyle("--void-table-stack-at", null), !1), this.#u();
55
+ }
56
+ #l;
57
+ #u() {
58
+ this.#n || (this.#n = !0, queueMicrotask(() => {
59
+ this.#n = !1, this.isConnected && (this.#d(this.stack !== null), this.#g(), this.#e?.takeRecords());
60
+ }));
61
+ }
62
+ #d(e) {
63
+ let t = !1, n = !1, a = 0;
64
+ for (let i of this.querySelectorAll("table")) {
65
+ if (i.closest("void-table") !== this) continue;
66
+ e && this.#m(i);
67
+ let c = this.#f(i), l = [];
68
+ if (c) for (let e of o(c)) {
69
+ let i = {
70
+ label: e.hasAttribute("data-label") ? e.getAttribute("data-label") ?? "" : (e.textContent ?? "").replace(/\s+/g, " ").trim(),
71
+ stack: e.getAttribute("data-stack"),
72
+ align: e.getAttribute("data-align")
73
+ };
74
+ i.stack === "title" && (t = !0), i.stack === "select" && (n = !0);
75
+ let a = e.querySelector(r) !== null;
76
+ a !== e.hasAttribute("data-controls") && e.toggleAttribute("data-controls", a);
77
+ for (let t = 0; t < s(e); t++) l.push(i);
78
+ }
79
+ if (c) {
80
+ let e = c.querySelector("[data-controls]") !== null;
81
+ e !== c.hasAttribute("data-controls") && c.toggleAttribute("data-controls", e);
82
+ }
83
+ if (e) for (let e of i.querySelectorAll(":scope > caption, :scope > thead, :scope > tbody, :scope > tfoot")) this.#m(e);
84
+ for (let t of Array.from(i.querySelectorAll("tr"))) {
85
+ if (t.closest("table") !== i) continue;
86
+ a++, e && this.#m(t);
87
+ let n = t.parentElement?.tagName === "THEAD" || t === c, r = 0;
88
+ for (let i of o(t)) {
89
+ if (e && (i.tagName === "TH" ? this.#m(i, n || i.getAttribute("scope") === "col" ? "columnheader" : "rowheader") : this.#m(i)), !n) {
90
+ let t = l[r];
91
+ t && (e && this.#p(i, "data-label", t.label, this.#r, !0), this.#p(i, "data-stack", t.stack, this.#i), this.#p(i, "data-align", t.align, this.#a));
92
+ }
93
+ r += s(i);
94
+ }
95
+ }
96
+ }
97
+ this.setHostAttribute("data-stack-title", t ? "" : null), this.setHostAttribute("data-stack-select", n ? "" : null), this.setHostAttribute("data-long", a > i ? "" : null);
98
+ }
99
+ #f(e) {
100
+ let t = e.querySelectorAll(":scope > thead > tr");
101
+ if (t.length) return t[t.length - 1];
102
+ let n = e.querySelector(":scope > tbody > tr, :scope > tr");
103
+ return n && o(n).every((e) => e.tagName === "TH") ? n : null;
104
+ }
105
+ #p(e, t, n, r, i = !1) {
106
+ let a = e.getAttribute(t), o = r.get(e);
107
+ if (a !== null && a !== o) return;
108
+ let s = n === null || !i && n === "" ? null : n;
109
+ s === null ? (a !== null && e.removeAttribute(t), r.delete(e)) : (a !== s && e.setAttribute(t, s), r.set(e, s));
110
+ }
111
+ #m(e, t = a[e.tagName]) {
112
+ t && (e.hasAttribute("role") || e.setAttribute("role", t));
113
+ }
114
+ get #h() {
115
+ return this.scrollable && this.scrollWidth > this.clientWidth + 1;
116
+ }
117
+ #g() {
118
+ let e = this.#h;
119
+ if (this.setHostAttribute("data-overflowing", e ? "" : null), !e) {
120
+ this.#_(), this.setHostAttribute("data-overflow-start", null), this.setHostAttribute("data-overflow-end", null);
121
+ return;
122
+ }
123
+ let t = this.getAttribute("aria-label"), n = t !== null && t !== this.#o, r = this.label || (n || this.hasAttribute("aria-labelledby") ? "" : (this.querySelector("caption")?.textContent ?? "").replace(/\s+/g, " ").trim());
124
+ !r && !n && !this.hasAttribute("aria-labelledby") && !this.#s && (this.#s = !0, console.warn("<void-table scrollable>: the scroll region has no accessible name. Set label, aria-label or add a <caption>.", this)), this.setHostAttribute("tabindex", "0"), (!this.hasAttribute("role") || this.getAttribute("role") === "region") && this.setHostAttribute("role", "region"), r && !n && (this.setHostAttribute("aria-label", r), this.#o = r), this.#v();
125
+ }
126
+ #_() {
127
+ this.setHostAttribute("tabindex", null), this.getAttribute("role") === "region" && this.setHostAttribute("role", null), this.#o !== null && (this.getAttribute("aria-label") === this.#o && this.setHostAttribute("aria-label", null), this.#o = null);
128
+ }
129
+ #v() {
130
+ if (!this.#h) return;
131
+ let e = this.scrollWidth - this.clientWidth, t = Math.abs(this.scrollLeft);
132
+ this.setHostAttribute("data-overflow-start", t > 1 ? "" : null), this.setHostAttribute("data-overflow-end", t < e - 1 ? "" : null);
8
133
  }
9
134
  };
10
135
  t([n({
11
136
  type: Boolean,
12
137
  reflect: !0
13
- })], r.prototype, "striped", void 0), t([n({
138
+ })], c.prototype, "striped", void 0), t([n({
139
+ type: Boolean,
140
+ reflect: !0
141
+ })], c.prototype, "hoverable", void 0), t([n({
142
+ type: Boolean,
143
+ reflect: !0
144
+ })], c.prototype, "compact", void 0), t([n({
14
145
  type: Boolean,
15
146
  reflect: !0
16
- })], r.prototype, "hoverable", void 0), t([n({
147
+ })], c.prototype, "bordered", void 0), t([n({
17
148
  type: Boolean,
18
149
  reflect: !0
19
- })], r.prototype, "compact", void 0), t([n({
150
+ })], c.prototype, "inset", void 0), t([n({
151
+ type: String,
152
+ reflect: !0
153
+ })], c.prototype, "stack", void 0), t([n({
154
+ type: Boolean,
155
+ reflect: !0
156
+ })], c.prototype, "scrollable", void 0), t([n({
157
+ type: Boolean,
158
+ reflect: !0,
159
+ attribute: "sticky-header"
160
+ })], c.prototype, "stickyHeader", void 0), t([n({
20
161
  type: Boolean,
162
+ reflect: !0,
163
+ attribute: "sticky-column"
164
+ })], c.prototype, "stickyColumn", void 0), t([n({
165
+ type: String,
166
+ reflect: !0,
167
+ attribute: "max-height"
168
+ })], c.prototype, "maxHeight", void 0), t([n({
169
+ type: String,
21
170
  reflect: !0
22
- })], r.prototype, "bordered", void 0), customElements.get("void-table") || customElements.define("void-table", r);
171
+ })], c.prototype, "label", void 0), customElements.get("void-table") || customElements.define("void-table", c);
23
172
  //#endregion
24
- export { r as VoidTable };
173
+ export { c as VoidTable };
@@ -1,28 +1,60 @@
1
1
  import { VoidElement } from '../base.js';
2
- /** Individual tab content panel within a VoidTabs component. */
3
- export declare class VoidTabPanel extends VoidElement {
4
- tab: string;
5
- label: string;
6
- active: boolean;
7
- connectedCallback(): void;
8
- protected updated(_changed: Map<string, unknown>): void;
9
- }
10
- /** Tabbed section navigation for settings pages, detail views, and parallel content categories. */
2
+ import { PartsController } from '../parts.js';
3
+ /**
4
+ * Tabbed section navigation for settings pages, detail views, and parallel content categories.
5
+ *
6
+ * Three parts, all written by the author and never moved: `<void-tabs-list>` holding one `<void-tabs-trigger>`
7
+ * per tab (its `value` names the tab, its text is the label, `disabled` disables it), and one
8
+ * `<void-tabs-content>` per panel, matched to its trigger by `value`. Follows the WAI-ARIA tabs pattern: the list is the
9
+ * `tablist`, triggers are `tab`s and contents `tabpanel`s, wired with `aria-selected`, `aria-controls` and
10
+ * `aria-labelledby` (ids are generated only where the author gave none), and a roving tabindex (the selected tab,
11
+ * or the first enabled tab while none is selected, is the single tab stop; the visible panel is a tab stop too).
12
+ * Keyboard: ArrowRight and ArrowLeft move focus to the next and previous tab (wrapping, skipping disabled tabs),
13
+ * Home and End to the first and last, Enter or Space select the focused tab; with `activation="auto"` moving focus
14
+ * selects the tab. The selected trigger and the visible content carry `active` (for the theme and for server
15
+ * markup that must look right before the script loads).
16
+ *
17
+ * @fires {CustomEvent<{ value: string }>} void-change - The user selected a tab.
18
+ */
11
19
  export declare class VoidTabs extends VoidElement {
20
+ /**
21
+ * The `value` of the selected tab. As an attribute it is the initial tab; selecting a tab updates it (it
22
+ * reflects) and fires `void-change`.
23
+ */
12
24
  value: string;
25
+ /** Size step of the tabs: `sm`, `md` (default) or `lg`. */
13
26
  size: 'sm' | 'md' | 'lg';
14
- private _panels;
27
+ /**
28
+ * `manual` (default): arrow keys move focus and Enter or Space select the focused tab.
29
+ * `auto`: focusing a tab with the arrow keys selects it.
30
+ */
31
+ activation: 'manual' | 'auto';
32
+ protected readonly _parts: PartsController;
33
+ /** The value last seen on a trigger, to tell a removed selection from a value whose tab has not arrived yet. */
34
+ private _matchedValue;
15
35
  connectedCallback(): void;
16
- private _syncPanels;
17
- protected updated(_changed: Map<string, unknown>): void;
18
- render(): import('lit').TemplateResult<1>;
19
- private _onTabClick;
20
- private _onTabKeydown;
36
+ disconnectedCallback(): void;
37
+ protected updated(changed: Map<string, unknown>): void;
38
+ private _triggers;
39
+ private _disabled;
40
+ private _valueOf;
41
+ /**
42
+ * When the tab the value points at has been removed (by the server, a
43
+ * framework), select the tab the `value` attribute names, else the first
44
+ * enabled tab, so a tab stays selected and a panel visible. A value that
45
+ * never had a tab (tabs still arriving) is left alone. Programmatic, so no
46
+ * void-change is dispatched.
47
+ */
48
+ private _reconcileRemovedSelection;
49
+ /** Writes roles, ids, selection, the roving tab stop and the panel links onto the parts. */
50
+ private _wire;
51
+ private _select;
52
+ private _triggerOf;
53
+ private _onClick;
54
+ private _onKeydown;
21
55
  }
22
56
  declare global {
23
57
  interface HTMLElementTagNameMap {
24
- 'void-tab-panel': VoidTabPanel;
25
58
  'void-tabs': VoidTabs;
26
59
  }
27
60
  }
28
- //# sourceMappingURL=tabs.d.ts.map