@voidable/ui 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) hide show
  1. package/dist/angular/index.d.ts +2 -2
  2. package/dist/angular/index.js +2 -1
  3. package/dist/base.d.ts +6 -0
  4. package/dist/base.js +2 -2
  5. package/dist/chunks/activation-B8aBarKd.js +4 -0
  6. package/dist/chunks/{base-BxmMM3B7.js → base-BGrS4eIl.js} +9 -0
  7. package/dist/chunks/carousel-C9u0bg5l.js +10 -0
  8. package/dist/chunks/choice-BTrsi7OW.js +16 -0
  9. package/dist/chunks/data-Baycjoo4.js +96 -0
  10. package/dist/chunks/fields-MEqz-olE.js +21 -0
  11. package/dist/chunks/{form-control-C0vH6gii.js → form-control-fL-Hhy91.js} +49 -48
  12. package/dist/chunks/{keyboard-CEhMSkws.js → keyboard-ChtDvhB_.js} +4 -23
  13. package/dist/chunks/{keyboard-activation-CV0m4hkn.js → keyboard-activation-BfEyoaMT.js} +4 -6
  14. package/dist/chunks/menu-CxRRgkJI.js +21 -0
  15. package/dist/chunks/{modal-CgGp_fCs.js → modal-Cz2-Ov76.js} +24 -16
  16. package/dist/chunks/nav-menu-Bx284Dk6.js +12 -0
  17. package/dist/chunks/{overlay-hLJ7IQHx.js → overlay-BuV-4Yvt.js} +76 -69
  18. package/dist/chunks/overlay-K1ilWC1p.js +4 -0
  19. package/dist/chunks/pickers-CjlFgNke.js +36 -0
  20. package/dist/chunks/{projection-SnR79EHI.js → projection-oPe6ipjL.js} +1 -1
  21. package/dist/chunks/table-BBpqwWEi.js +4 -0
  22. package/dist/chunks/tabs-Buf3EBWq.js +10 -0
  23. package/dist/components/accordion.d.ts +7 -0
  24. package/dist/components/accordion.js +23 -15
  25. package/dist/components/action-input.d.ts +2 -1
  26. package/dist/components/action-input.js +60 -56
  27. package/dist/components/alert.d.ts +11 -0
  28. package/dist/components/alert.js +10 -3
  29. package/dist/components/avatar.js +2 -2
  30. package/dist/components/badge.d.ts +8 -2
  31. package/dist/components/badge.js +1 -4
  32. package/dist/components/banner.d.ts +9 -0
  33. package/dist/components/banner.js +10 -3
  34. package/dist/components/bar-chart.d.ts +21 -7
  35. package/dist/components/bar-chart.js +68 -45
  36. package/dist/components/breadcrumbs.d.ts +2 -0
  37. package/dist/components/breadcrumbs.js +16 -12
  38. package/dist/components/button.d.ts +7 -0
  39. package/dist/components/button.js +24 -17
  40. package/dist/components/calendar.d.ts +85 -12
  41. package/dist/components/calendar.js +263 -120
  42. package/dist/components/card.js +1 -1
  43. package/dist/components/carousel.d.ts +22 -0
  44. package/dist/components/carousel.js +66 -37
  45. package/dist/components/charts/data.d.ts +72 -0
  46. package/dist/components/checkbox-group.js +23 -22
  47. package/dist/components/checkbox.d.ts +7 -0
  48. package/dist/components/checkbox.js +30 -25
  49. package/dist/components/collapsible.d.ts +7 -0
  50. package/dist/components/collapsible.js +20 -12
  51. package/dist/components/color-picker.js +29 -28
  52. package/dist/components/combobox.d.ts +13 -1
  53. package/dist/components/combobox.js +55 -42
  54. package/dist/components/compose-input.d.ts +9 -1
  55. package/dist/components/compose-input.js +29 -17
  56. package/dist/components/dialog.js +1 -1
  57. package/dist/components/divider.js +2 -2
  58. package/dist/components/donut-chart.d.ts +22 -6
  59. package/dist/components/donut-chart.js +97 -70
  60. package/dist/components/drawer.js +1 -1
  61. package/dist/components/dropdown-menu.d.ts +22 -0
  62. package/dist/components/dropdown-menu.js +55 -40
  63. package/dist/components/editable.d.ts +11 -1
  64. package/dist/components/editable.js +36 -23
  65. package/dist/components/error-fallback.d.ts +4 -2
  66. package/dist/components/error-fallback.js +35 -29
  67. package/dist/components/field.js +2 -2
  68. package/dist/components/file-upload.d.ts +29 -5
  69. package/dist/components/file-upload.js +84 -28
  70. package/dist/components/gauge.d.ts +32 -8
  71. package/dist/components/gauge.js +206 -133
  72. package/dist/components/hamburger.d.ts +19 -1
  73. package/dist/components/hamburger.js +45 -25
  74. package/dist/components/hover-card.d.ts +7 -0
  75. package/dist/components/hover-card.js +23 -15
  76. package/dist/components/indicator.js +16 -15
  77. package/dist/components/input.js +3 -3
  78. package/dist/components/line-chart.d.ts +22 -7
  79. package/dist/components/line-chart.js +80 -57
  80. package/dist/components/list.js +1 -1
  81. package/dist/components/menu.d.ts +25 -0
  82. package/dist/components/menu.js +56 -34
  83. package/dist/components/multiselect.d.ts +17 -1
  84. package/dist/components/multiselect.js +97 -75
  85. package/dist/components/nav-bar.d.ts +9 -0
  86. package/dist/components/nav-bar.js +16 -3
  87. package/dist/components/nav-menu.d.ts +9 -0
  88. package/dist/components/nav-menu.js +31 -24
  89. package/dist/components/number-input.d.ts +15 -1
  90. package/dist/components/number-input.js +72 -38
  91. package/dist/components/pagination.js +26 -25
  92. package/dist/components/panel.js +1 -1
  93. package/dist/components/pin-input.d.ts +11 -0
  94. package/dist/components/pin-input.js +47 -33
  95. package/dist/components/popover.d.ts +7 -0
  96. package/dist/components/popover.js +22 -14
  97. package/dist/components/progress.js +2 -2
  98. package/dist/components/radio-group.js +3 -3
  99. package/dist/components/radio.d.ts +10 -1
  100. package/dist/components/radio.js +38 -33
  101. package/dist/components/scroll-area.js +2 -2
  102. package/dist/components/segmented-control.d.ts +14 -0
  103. package/dist/components/segmented-control.js +41 -29
  104. package/dist/components/select.js +2 -2
  105. package/dist/components/sidebar.d.ts +1 -0
  106. package/dist/components/sidebar.js +15 -11
  107. package/dist/components/skeleton.js +1 -1
  108. package/dist/components/slider.js +3 -3
  109. package/dist/components/spinner.d.ts +5 -3
  110. package/dist/components/spinner.js +22 -15
  111. package/dist/components/stat.d.ts +13 -1
  112. package/dist/components/stat.js +28 -20
  113. package/dist/components/status-dot.d.ts +2 -2
  114. package/dist/components/status-dot.js +13 -15
  115. package/dist/components/stepper.d.ts +2 -0
  116. package/dist/components/stepper.js +21 -14
  117. package/dist/components/switch.d.ts +7 -0
  118. package/dist/components/switch.js +25 -17
  119. package/dist/components/table.d.ts +81 -1
  120. package/dist/components/table.js +571 -69
  121. package/dist/components/tabs.d.ts +11 -0
  122. package/dist/components/tabs.js +43 -34
  123. package/dist/components/tag.js +13 -12
  124. package/dist/components/tags-input.d.ts +10 -1
  125. package/dist/components/tags-input.js +43 -31
  126. package/dist/components/textarea.js +3 -3
  127. package/dist/components/toast.d.ts +2 -0
  128. package/dist/components/toast.js +36 -29
  129. package/dist/components/toggle-group.d.ts +8 -0
  130. package/dist/components/toggle-group.js +25 -18
  131. package/dist/components/toggle.d.ts +7 -0
  132. package/dist/components/toggle.js +24 -16
  133. package/dist/components/tooltip.d.ts +7 -0
  134. package/dist/components/tooltip.js +21 -13
  135. package/dist/components.json +108 -84
  136. package/dist/custom-elements.json +4520 -236
  137. package/dist/dev/rules.d.ts +0 -1
  138. package/dist/dev/types.d.ts +5 -1
  139. package/dist/dev.js +298 -122
  140. package/dist/index.d.ts +4 -0
  141. package/dist/index.js +69 -67
  142. package/dist/keyboard-activation.d.ts +9 -9
  143. package/dist/keyboard.d.ts +2 -10
  144. package/dist/keymaps/activation.d.ts +8 -0
  145. package/dist/keymaps/carousel.d.ts +9 -0
  146. package/dist/keymaps/choice.d.ts +21 -0
  147. package/dist/keymaps/fields.d.ts +31 -0
  148. package/dist/keymaps/index.d.ts +2 -0
  149. package/dist/keymaps/menu.d.ts +36 -0
  150. package/dist/keymaps/nav-menu.d.ts +11 -0
  151. package/dist/keymaps/overlay.d.ts +4 -0
  152. package/dist/keymaps/pickers.d.ts +36 -0
  153. package/dist/keymaps/table.d.ts +8 -0
  154. package/dist/keymaps/tabs.d.ts +7 -0
  155. package/dist/keymaps.js +51 -0
  156. package/dist/keys.d.ts +46 -0
  157. package/dist/keys.js +57 -0
  158. package/dist/llms.txt +11 -3
  159. package/dist/messages/ar.d.ts +1 -0
  160. package/dist/messages/ar.js +130 -0
  161. package/dist/messages/fr.d.ts +1 -0
  162. package/dist/messages/fr.js +109 -0
  163. package/dist/messages.d.ts +213 -0
  164. package/dist/messages.js +190 -0
  165. package/dist/modal.d.ts +7 -0
  166. package/dist/reference.md +885 -60
  167. package/dist/testing/index.d.ts +46 -0
  168. package/dist/testing.js +79 -0
  169. package/dist/types/elements.d.ts +100 -84
  170. package/dist/types/react.d.ts +7 -3
  171. package/dist/types/solid.d.ts +7 -3
  172. package/dist/types/solid2.d.ts +4 -0
  173. package/dist/types/svelte.d.ts +7 -3
  174. package/dist/types/vue.d.ts +7 -3
  175. package/dist/vscode.html-custom-data.json +478 -38
  176. package/dist/web-types.json +1001 -111
  177. package/package.json +22 -2
@@ -4,7 +4,7 @@ import type { ElementRef } from '@angular/core';
4
4
  import type { ControlValueAccessor } from '@angular/forms';
5
5
 
6
6
  /**
7
- * ControlValueAccessor for every Void form control (19 tags, see the
7
+ * ControlValueAccessor for every Void form control (20 tags, see the
8
8
  * selector): `ngModel`, `formControl` and `formControlName` work on them once
9
9
  * this directive is imported.
10
10
  */
@@ -16,5 +16,5 @@ export declare class VoidValueAccessor implements ControlValueAccessor {
16
16
  setDisabledState(isDisabled: boolean): void;
17
17
  handleEvent(event: Event): void;
18
18
  static ɵfac: i0.ɵɵFactoryDeclaration<VoidValueAccessor, never>;
19
- static ɵdir: i0.ɵɵDirectiveDeclaration<VoidValueAccessor, 'void-action-input[ngModel], void-action-input[formControl], void-action-input[formControlName], void-calendar[ngModel], void-calendar[formControl], void-calendar[formControlName], void-checkbox[ngModel], void-checkbox[formControl], void-checkbox[formControlName], void-checkbox-group[ngModel], void-checkbox-group[formControl], void-checkbox-group[formControlName], void-color-picker[ngModel], void-color-picker[formControl], void-color-picker[formControlName], void-combobox[ngModel], void-combobox[formControl], void-combobox[formControlName], void-date-picker[ngModel], void-date-picker[formControl], void-date-picker[formControlName], void-editable[ngModel], void-editable[formControl], void-editable[formControlName], void-input[ngModel], void-input[formControl], void-input[formControlName], void-multiselect[ngModel], void-multiselect[formControl], void-multiselect[formControlName], void-number-input[ngModel], void-number-input[formControl], void-number-input[formControlName], void-pin-input[ngModel], void-pin-input[formControl], void-pin-input[formControlName], void-radio-group[ngModel], void-radio-group[formControl], void-radio-group[formControlName], void-segmented-control[ngModel], void-segmented-control[formControl], void-segmented-control[formControlName], void-slider[ngModel], void-slider[formControl], void-slider[formControlName], void-switch[ngModel], void-switch[formControl], void-switch[formControlName], void-tags-input[ngModel], void-tags-input[formControl], void-tags-input[formControlName], void-textarea[ngModel], void-textarea[formControl], void-textarea[formControlName], void-toggle-group[ngModel], void-toggle-group[formControl], void-toggle-group[formControlName]', never, {}, {}, never, never, true, never>;
19
+ static ɵdir: i0.ɵɵDirectiveDeclaration<VoidValueAccessor, 'void-action-input[ngModel], void-action-input[formControl], void-action-input[formControlName], void-calendar[ngModel], void-calendar[formControl], void-calendar[formControlName], void-checkbox[ngModel], void-checkbox[formControl], void-checkbox[formControlName], void-checkbox-group[ngModel], void-checkbox-group[formControl], void-checkbox-group[formControlName], void-color-picker[ngModel], void-color-picker[formControl], void-color-picker[formControlName], void-combobox[ngModel], void-combobox[formControl], void-combobox[formControlName], void-date-picker[ngModel], void-date-picker[formControl], void-date-picker[formControlName], void-editable[ngModel], void-editable[formControl], void-editable[formControlName], void-input[ngModel], void-input[formControl], void-input[formControlName], void-multiselect[ngModel], void-multiselect[formControl], void-multiselect[formControlName], void-number-input[ngModel], void-number-input[formControl], void-number-input[formControlName], void-pin-input[ngModel], void-pin-input[formControl], void-pin-input[formControlName], void-radio-group[ngModel], void-radio-group[formControl], void-radio-group[formControlName], void-segmented-control[ngModel], void-segmented-control[formControl], void-segmented-control[formControlName], void-slider[ngModel], void-slider[formControl], void-slider[formControlName], void-switch[ngModel], void-switch[formControl], void-switch[formControlName], void-table[ngModel], void-table[formControl], void-table[formControlName], void-tags-input[ngModel], void-tags-input[formControl], void-tags-input[formControlName], void-textarea[ngModel], void-textarea[formControl], void-textarea[formControlName], void-toggle-group[ngModel], void-toggle-group[formControl], void-toggle-group[formControlName]', never, {}, {}, never, never, true, never>;
20
20
  }
@@ -26,6 +26,7 @@ const CONTROLS = {
26
26
  'void-segmented-control': { prop: 'value', key: 'value', empty: () => '' },
27
27
  'void-slider': { prop: 'value', key: 'value', empty: () => 0 },
28
28
  'void-switch': { prop: 'checked', key: 'checked', empty: () => false },
29
+ 'void-table': { prop: 'value', key: 'value', empty: () => '' },
29
30
  'void-tags-input': { prop: 'value', key: 'value', empty: () => [] },
30
31
  'void-textarea': { prop: 'value', key: 'value', empty: () => '' },
31
32
  'void-toggle-group': { prop: 'value', key: 'value', empty: () => '' },
@@ -70,7 +71,7 @@ export class VoidValueAccessor {
70
71
  version: '19.0.0',
71
72
  type: VoidValueAccessor,
72
73
  isStandalone: true,
73
- selector: 'void-action-input[ngModel], void-action-input[formControl], void-action-input[formControlName], void-calendar[ngModel], void-calendar[formControl], void-calendar[formControlName], void-checkbox[ngModel], void-checkbox[formControl], void-checkbox[formControlName], void-checkbox-group[ngModel], void-checkbox-group[formControl], void-checkbox-group[formControlName], void-color-picker[ngModel], void-color-picker[formControl], void-color-picker[formControlName], void-combobox[ngModel], void-combobox[formControl], void-combobox[formControlName], void-date-picker[ngModel], void-date-picker[formControl], void-date-picker[formControlName], void-editable[ngModel], void-editable[formControl], void-editable[formControlName], void-input[ngModel], void-input[formControl], void-input[formControlName], void-multiselect[ngModel], void-multiselect[formControl], void-multiselect[formControlName], void-number-input[ngModel], void-number-input[formControl], void-number-input[formControlName], void-pin-input[ngModel], void-pin-input[formControl], void-pin-input[formControlName], void-radio-group[ngModel], void-radio-group[formControl], void-radio-group[formControlName], void-segmented-control[ngModel], void-segmented-control[formControl], void-segmented-control[formControlName], void-slider[ngModel], void-slider[formControl], void-slider[formControlName], void-switch[ngModel], void-switch[formControl], void-switch[formControlName], void-tags-input[ngModel], void-tags-input[formControl], void-tags-input[formControlName], void-textarea[ngModel], void-textarea[formControl], void-textarea[formControlName], void-toggle-group[ngModel], void-toggle-group[formControl], void-toggle-group[formControlName]',
74
+ selector: 'void-action-input[ngModel], void-action-input[formControl], void-action-input[formControlName], void-calendar[ngModel], void-calendar[formControl], void-calendar[formControlName], void-checkbox[ngModel], void-checkbox[formControl], void-checkbox[formControlName], void-checkbox-group[ngModel], void-checkbox-group[formControl], void-checkbox-group[formControlName], void-color-picker[ngModel], void-color-picker[formControl], void-color-picker[formControlName], void-combobox[ngModel], void-combobox[formControl], void-combobox[formControlName], void-date-picker[ngModel], void-date-picker[formControl], void-date-picker[formControlName], void-editable[ngModel], void-editable[formControl], void-editable[formControlName], void-input[ngModel], void-input[formControl], void-input[formControlName], void-multiselect[ngModel], void-multiselect[formControl], void-multiselect[formControlName], void-number-input[ngModel], void-number-input[formControl], void-number-input[formControlName], void-pin-input[ngModel], void-pin-input[formControl], void-pin-input[formControlName], void-radio-group[ngModel], void-radio-group[formControl], void-radio-group[formControlName], void-segmented-control[ngModel], void-segmented-control[formControl], void-segmented-control[formControlName], void-slider[ngModel], void-slider[formControl], void-slider[formControlName], void-switch[ngModel], void-switch[formControl], void-switch[formControlName], void-table[ngModel], void-table[formControl], void-table[formControlName], void-tags-input[ngModel], void-tags-input[formControl], void-tags-input[formControlName], void-textarea[ngModel], void-textarea[formControl], void-textarea[formControlName], void-toggle-group[ngModel], void-toggle-group[formControl], void-toggle-group[formControlName]',
74
75
  host: { listeners: { 'void-change': 'handleEvent($event)', 'void-input': 'handleEvent($event)', focusout: 'onTouched()' } },
75
76
  providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: VoidValueAccessor, multi: true }],
76
77
  ngImport: i0,
package/dist/base.d.ts CHANGED
@@ -66,6 +66,12 @@ export declare class VoidElement extends LitElement {
66
66
  * @internal
67
67
  */
68
68
  connectedMoveCallback(): void;
69
+ /**
70
+ * Reports a problem with this element through `@voidable/ui/dev` when it is loaded (a console warning,
71
+ * or a thrown `VoidDevError` in a test suite that asked for that); silent otherwise. Never throws on
72
+ * its own.
73
+ */
74
+ protected reportDev(kind: string, subject: string, message: string): void;
69
75
  protected shouldUpdate(changed: PropertyValues): boolean;
70
76
  protected update(changed: PropertyValues): void;
71
77
  /**
package/dist/base.js CHANGED
@@ -1,5 +1,5 @@
1
- import { t as e } from "./chunks/base-BxmMM3B7.js";
2
- import { r as t } from "./chunks/projection-SnR79EHI.js";
1
+ import { t as e } from "./chunks/base-BGrS4eIl.js";
2
+ import { r as t } from "./chunks/projection-oPe6ipjL.js";
3
3
  //#region src/base-entry.ts
4
4
  t();
5
5
  //#endregion
@@ -0,0 +1,4 @@
1
+ //#region src/keymaps/activation.ts
2
+ var e = { activate: ["Enter", "Space"] }, t = { activate: ["Space"] };
3
+ //#endregion
4
+ export { t as n, e as t };
@@ -96,6 +96,15 @@ var u = 10, d = 1e3, f = Symbol.for("voidable.dev"), p = Symbol.for("@voidable/u
96
96
  this.#a === void 0 && (this.#a = this.#f(this), this.#o = this.outerHTML, !this.__voidProjection && this.render !== e.prototype.render && r.current?.create(this)), super.connectedCallback();
97
97
  }
98
98
  connectedMoveCallback() {}
99
+ reportDev(e, t, n) {
100
+ globalThis[f]?.report?.({
101
+ kind: e,
102
+ tag: this.localName,
103
+ subject: t,
104
+ message: n,
105
+ element: this
106
+ });
107
+ }
99
108
  #f(e) {
100
109
  if (!e.hasAttributes()) return null;
101
110
  let { attrs: t } = l(this), n = e.attributes, r = null;
@@ -0,0 +1,10 @@
1
+ //#region src/keymaps/carousel.ts
2
+ var e = {
3
+ next: ["ArrowInlineEnd"],
4
+ previous: ["ArrowInlineStart"]
5
+ }, t = {
6
+ next: ["ArrowDown"],
7
+ previous: ["ArrowUp"]
8
+ };
9
+ //#endregion
10
+ export { t as n, e as t };
@@ -0,0 +1,16 @@
1
+ //#region src/keymaps/choice.ts
2
+ var e = {
3
+ next: ["ArrowInlineEnd", "ArrowDown"],
4
+ previous: ["ArrowInlineStart", "ArrowUp"]
5
+ }, t = {
6
+ next: ["ArrowInlineEnd"],
7
+ previous: ["ArrowInlineStart"]
8
+ }, n = {
9
+ next: ["ArrowDown"],
10
+ previous: ["ArrowUp"]
11
+ }, r = {
12
+ ...e,
13
+ activate: ["Space"]
14
+ };
15
+ //#endregion
16
+ export { n as i, r as n, t as r, e as t };
@@ -0,0 +1,96 @@
1
+ import { localeOf as e, msg as t } from "../messages.js";
2
+ import { html as n, nothing as r } from "lit";
3
+ //#region src/components/charts/data.ts
4
+ function i(e, t, n) {
5
+ if (typeof e != "string") return t.text = null, { value: e ?? n.empty() };
6
+ if (e === t.text) return null;
7
+ if (t.text = e, e.trim() === "") return { value: n.empty() };
8
+ let r;
9
+ try {
10
+ r = JSON.parse(e);
11
+ } catch (t) {
12
+ return n.warn(n.attr, `${n.attr}="${a(e)}" is not valid JSON (${t.message}), so nothing is drawn. Expected ${n.shape}.`), { value: n.empty() };
13
+ }
14
+ let i = n.normalize(r);
15
+ return i === null ? (n.warn(n.attr, `${n.attr}="${a(e)}" does not have the shape the chart takes, so nothing is drawn. Expected ${n.shape}.`), { value: n.empty() }) : { value: i };
16
+ }
17
+ function a(e) {
18
+ return e.length > 60 ? `${e.slice(0, 57)}...` : e;
19
+ }
20
+ var o = (e) => typeof e == "object" && !!e && !Array.isArray(e), s = (e) => Array.isArray(e) ? e : [];
21
+ function c(e) {
22
+ if (!o(e) || e.series !== void 0 && !Array.isArray(e.series)) return null;
23
+ let t = s(e.series).filter(o).map((e) => ({
24
+ ...e,
25
+ name: String(e.name ?? ""),
26
+ values: s(e.values)
27
+ }));
28
+ return e.labels === void 0 ? { series: t } : {
29
+ series: t,
30
+ labels: s(e.labels).map(String)
31
+ };
32
+ }
33
+ function l(e) {
34
+ return Array.isArray(e) ? e.filter(o).map((e) => ({
35
+ ...e,
36
+ name: String(e.name ?? ""),
37
+ value: e.value
38
+ })) : null;
39
+ }
40
+ function u(t) {
41
+ return e(t);
42
+ }
43
+ function d(e) {
44
+ let t = (t) => {
45
+ try {
46
+ return new Intl.NumberFormat(u(e), t);
47
+ } catch {
48
+ return new Intl.NumberFormat(void 0, t);
49
+ }
50
+ }, n = t({ maximumFractionDigits: 3 }), r = t({
51
+ style: "percent",
52
+ maximumFractionDigits: 1
53
+ });
54
+ return {
55
+ number: (e) => typeof e == "number" && Number.isFinite(e) ? n.format(e) : "–",
56
+ percent: (e) => Number.isFinite(e) ? r.format(e) : "–"
57
+ };
58
+ }
59
+ function f(e, t) {
60
+ return t ? n`<table class=${e}>
61
+ <caption>${t.caption}</caption>
62
+ <thead><tr>${t.head.map((e) => n`<th scope="col">${e}</th>`)}</tr></thead>
63
+ <tbody>${t.rows.map((e) => n`<tr>${e.header === void 0 ? r : n`<th scope="row">${e.header}</th>`}${e.cells.map((e) => n`<td>${e}</td>`)}</tr>`)}</tbody>
64
+ </table>` : r;
65
+ }
66
+ function p(e, n, r, i) {
67
+ if (r.length === 0) return null;
68
+ let a = d(e), o = Math.max(...r.map((e) => e.values.length)), s = [];
69
+ for (let e = 0; e < o; e++) s.push({
70
+ header: i[e] ?? String(e + 1),
71
+ cells: r.map((t) => a.number(t.values[e]))
72
+ });
73
+ return {
74
+ caption: n,
75
+ head: [t(e, "chart.label"), ...r.map((e) => e.name)],
76
+ rows: s
77
+ };
78
+ }
79
+ function m(e, n, r) {
80
+ if (r.length === 0) return null;
81
+ let i = d(e), a = (e) => Number.isFinite(e) ? e : 0, o = r.reduce((e, t) => e + a(t.value), 0);
82
+ return {
83
+ caption: n,
84
+ head: [
85
+ t(e, "chart.segment"),
86
+ t(e, "chart.value"),
87
+ t(e, "chart.share")
88
+ ],
89
+ rows: r.map((e) => ({
90
+ header: e.name,
91
+ cells: [i.number(e.value), o > 0 ? i.percent(a(e.value) / o) : "–"]
92
+ }))
93
+ };
94
+ }
95
+ //#endregion
96
+ export { c as a, p as c, l as i, d as l, f as n, i as o, o as r, m as s, u as t };
@@ -0,0 +1,21 @@
1
+ //#region src/keymaps/fields.ts
2
+ var e = {
3
+ increment: ["ArrowUp"],
4
+ decrement: ["ArrowDown"]
5
+ }, t = {
6
+ previous: ["ArrowInlineStart"],
7
+ next: ["ArrowInlineEnd"],
8
+ deleteBackward: ["Backspace"],
9
+ deleteForward: ["Delete"]
10
+ }, n = {
11
+ add: ["Enter", ","],
12
+ removeLast: ["Backspace"]
13
+ }, r = { send: ["Enter"] }, i = { activate: ["Enter", "Space"] }, a = {
14
+ submit: ["Enter"],
15
+ cancel: ["Escape"]
16
+ }, o = {
17
+ ...i,
18
+ ...a
19
+ };
20
+ //#endregion
21
+ export { e as a, i, a as n, t as o, o as r, n as s, r as t };
@@ -1,7 +1,8 @@
1
1
  import { t as e } from "./decorate-CaYbmmmm.js";
2
- import { property as t, state as n } from "lit/decorators.js";
2
+ import { msg as t } from "../messages.js";
3
+ import { property as n, state as r } from "lit/decorators.js";
3
4
  //#region src/form-control.ts
4
- function r(e) {
5
+ function i(e) {
5
6
  let t = e;
6
7
  for (let n = e.parentElement; n; t = n, n = n.parentElement) {
7
8
  if (n.tagName !== "FIELDSET" || !n.hasAttribute("disabled")) continue;
@@ -10,10 +11,10 @@ function r(e) {
10
11
  }
11
12
  return !1;
12
13
  }
13
- var i = /* @__PURE__ */ new WeakMap();
14
- function a(e, t) {
14
+ var a = /* @__PURE__ */ new WeakMap();
15
+ function o(e, t) {
15
16
  if (typeof MutationObserver > "u") return () => {};
16
- let n = e.getRootNode(), r = i.get(n);
17
+ let n = e.getRootNode(), r = a.get(n);
17
18
  if (!r) {
18
19
  let e = /* @__PURE__ */ new Map(), t = new MutationObserver((t) => {
19
20
  let n = /* @__PURE__ */ new Set();
@@ -29,23 +30,23 @@ function a(e, t) {
29
30
  attributes: !0,
30
31
  attributeFilter: ["disabled"],
31
32
  subtree: !0
32
- }), i.set(n, r = {
33
+ }), a.set(n, r = {
33
34
  observer: t,
34
35
  hosts: e
35
36
  });
36
37
  }
37
38
  r.hosts.set(e, t);
38
- let a = r;
39
+ let i = r;
39
40
  return () => {
40
- a.hosts.delete(e);
41
+ i.hosts.delete(e);
41
42
  };
42
43
  }
43
- function o(e) {
44
+ function s(e) {
44
45
  return Array.isArray(e) ? [...e] : e;
45
46
  }
46
- var s = "input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", c = Symbol("onFormChange"), l = Symbol("formInternals"), u = Symbol("formSubmissionOrUndefined"), d = Symbol("onFormReset"), f = Symbol("listenForReset");
47
- function p(i) {
48
- class a extends i {
47
+ var c = "input:not([type=\"hidden\"]):not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex=\"-1\"])", l = Symbol("onFormChange"), u = Symbol("formInternals"), d = Symbol("formSubmissionOrUndefined"), f = Symbol("onFormReset"), p = Symbol("listenForReset");
48
+ function m(t) {
49
+ class a extends t {
49
50
  #e;
50
51
  #t;
51
52
  #n;
@@ -62,7 +63,7 @@ function p(i) {
62
63
  }, this.#m = () => {
63
64
  this.#a = !0, this.#i = void 0, this.formSync();
64
65
  }, this.#g = (e) => {
65
- e.target instanceof HTMLFormElement && this[d]();
66
+ e.target instanceof HTMLFormElement && this[f]();
66
67
  };
67
68
  let t = this.constructor.formAssociated;
68
69
  try {
@@ -78,7 +79,7 @@ function p(i) {
78
79
  }), this.addEventListener("invalid", this.#m), this.addEventListener("focus", this.#f);
79
80
  }
80
81
  connectedCallback() {
81
- super.connectedCallback(), this.#e || this[f](), this.#l();
82
+ super.connectedCallback(), this.#e || this[p](), this.#l();
82
83
  }
83
84
  disconnectedCallback() {
84
85
  super.disconnectedCallback(), this.#h(), this.#o?.disconnect(), this.#o = null;
@@ -96,18 +97,18 @@ function p(i) {
96
97
  }
97
98
  }
98
99
  formAncestorDisabled() {
99
- return r(this);
100
+ return i(this);
100
101
  }
101
102
  requestUpdate(...e) {
102
- super.requestUpdate(...e), this.hasUpdated && this[c]();
103
+ super.requestUpdate(...e), this.hasUpdated && this[l]();
103
104
  }
104
105
  dispatchEvent(e) {
105
- return e.type === "void-change" && this.hasUpdated && (this.#a = !0, this[c]()), super.dispatchEvent(e);
106
+ return e.type === "void-change" && this.hasUpdated && (this.#a = !0, this[l]()), super.dispatchEvent(e);
106
107
  }
107
- [c]() {
108
+ [l]() {
108
109
  this.formSync();
109
110
  }
110
- get [l]() {
111
+ get [u]() {
111
112
  return this.#e;
112
113
  }
113
114
  get form() {
@@ -117,10 +118,10 @@ function p(i) {
117
118
  return !!this.disabled || this.formAncestorDisabled();
118
119
  }
119
120
  formSnapshot() {
120
- return o(this.value);
121
+ return s(this.value);
121
122
  }
122
123
  formRestore(e) {
123
- this.value = o(e);
124
+ this.value = s(e);
124
125
  }
125
126
  formCaptureDefault() {
126
127
  this.#t = this.formSnapshot(), this.#n = !0;
@@ -131,15 +132,15 @@ function p(i) {
131
132
  formValidity() {
132
133
  return null;
133
134
  }
134
- [u]() {}
135
+ [d]() {}
135
136
  formResetCallback() {
136
- this.#n && (this.#a = !1, this.formRestore(o(this.#t)), this.requestUpdate(), this.formSync());
137
+ this.#n && (this.#a = !1, this.formRestore(s(this.#t)), this.requestUpdate(), this.formSync());
137
138
  }
138
139
  formDisabledCallback() {
139
140
  this.ancestorDisabled = this.formAncestorDisabled(), this.formSync();
140
141
  }
141
142
  formSync() {
142
- let e = this.#e, t = this.formDisabled, n = this[u](), r = t ? null : this.formValidity(), i = !!this.required, a = null;
143
+ let e = this.#e, t = this.formDisabled, n = this[d](), r = t ? null : this.formValidity(), i = !!this.required, a = null;
143
144
  if (n !== void 0) try {
144
145
  a = JSON.stringify(this.formSnapshot()) ?? null;
145
146
  } catch {
@@ -186,7 +187,7 @@ function p(i) {
186
187
  this.setHostAttribute(e, t);
187
188
  }
188
189
  #m;
189
- [f]() {
190
+ [p]() {
190
191
  let e = this.isConnected ? this.form : null;
191
192
  e !== this.#r && (this.#r?.removeEventListener("reset", this.#g, !0), this.#r = e, e?.addEventListener("reset", this.#g, !0));
192
193
  }
@@ -194,17 +195,17 @@ function p(i) {
194
195
  this.#r?.removeEventListener("reset", this.#g, !0), this.#r = null;
195
196
  }
196
197
  #g;
197
- [d]() {
198
+ [f]() {
198
199
  this.formResetCallback();
199
200
  }
200
201
  }
201
- return e([t({
202
+ return e([n({
202
203
  type: String,
203
204
  reflect: !0
204
- })], a.prototype, "name", void 0), e([n()], a.prototype, "ancestorDisabled", void 0), a;
205
+ })], a.prototype, "name", void 0), e([r()], a.prototype, "ancestorDisabled", void 0), a;
205
206
  }
206
- function m(n) {
207
- class r extends p(n) {
207
+ function h(t) {
208
+ class r extends m(t) {
208
209
  #e;
209
210
  #t;
210
211
  #n;
@@ -214,7 +215,7 @@ function m(n) {
214
215
  let e = this.formNativeControl();
215
216
  this.#t && e ? (this.#t = !1, this.formWriteNativeDefault(this.#e)) : this.#t && !this.#n && (this.#n = !0, setTimeout(() => {
216
217
  this.#n = !1, this.#t && this.formNativeControl() && (this.#t = !1, this.formWriteNativeDefault(this.#e));
217
- }, 0)), !this.#t && e && e !== this.#r && (this.#r && this.formWriteNativeDefault(this.#e), this.#r = e), this[f]();
218
+ }, 0)), !this.#t && e && e !== this.#r && (this.#r && this.formWriteNativeDefault(this.#e), this.#r = e), this[p]();
218
219
  } });
219
220
  }
220
221
  get form() {
@@ -223,13 +224,13 @@ function m(n) {
223
224
  formCaptureDefault() {
224
225
  super.formCaptureDefault(), this.#e = this.formSnapshot(), this.#t = !0, this.hasUpdated && this.formNativeControl() && (this.#t = !1, this.formWriteNativeDefault(this.#e));
225
226
  }
226
- [d]() {
227
+ [f]() {
227
228
  setTimeout(() => {
228
229
  this.formReadNative(), this.formSync();
229
230
  }, 0);
230
231
  }
231
- [c]() {
232
- this.formSyncNative(), super[c]();
232
+ [l]() {
233
+ this.formSyncNative(), super[l]();
233
234
  }
234
235
  formSyncNative() {}
235
236
  formWriteNativeDefault(e) {}
@@ -241,10 +242,10 @@ function m(n) {
241
242
  return this.querySelector("input, select, textarea");
242
243
  }
243
244
  }
244
- return e([t({ attribute: "form" })], r.prototype, "formAttr", void 0), r;
245
+ return e([n({ attribute: "form" })], r.prototype, "formAttr", void 0), r;
245
246
  }
246
- function h(n) {
247
- class r extends p(n) {
247
+ function g(r) {
248
+ class i extends m(r) {
248
249
  constructor(...e) {
249
250
  super(...e), this.required = !1;
250
251
  }
@@ -252,21 +253,21 @@ function h(n) {
252
253
  this.formAssociated = !0;
253
254
  }
254
255
  get validity() {
255
- return this[l]?.validity;
256
+ return this[u]?.validity;
256
257
  }
257
258
  get validationMessage() {
258
- return this[l]?.validationMessage ?? "";
259
+ return this[u]?.validationMessage ?? "";
259
260
  }
260
261
  get willValidate() {
261
- return this[l]?.willValidate ?? !1;
262
+ return this[u]?.willValidate ?? !1;
262
263
  }
263
264
  checkValidity() {
264
- return this[l]?.checkValidity() ?? !0;
265
+ return this[u]?.checkValidity() ?? !0;
265
266
  }
266
267
  reportValidity() {
267
- return this[l]?.reportValidity() ?? !0;
268
+ return this[u]?.reportValidity() ?? !0;
268
269
  }
269
- [u]() {
270
+ [d]() {
270
271
  return this.formSubmission();
271
272
  }
272
273
  formSubmission() {
@@ -274,14 +275,14 @@ function h(n) {
274
275
  return e == null ? null : String(e);
275
276
  }
276
277
  formValidationAnchor() {
277
- for (let e of Array.from(this.querySelectorAll(s))) if (typeof e.checkVisibility == "function" ? e.checkVisibility() : e.getClientRects().length > 0) return e;
278
+ for (let e of Array.from(this.querySelectorAll(c))) if (typeof e.checkVisibility == "function" ? e.checkVisibility() : e.getClientRects().length > 0) return e;
278
279
  }
279
280
  formValidity() {
280
281
  if (!this.required) return null;
281
282
  let e = this.formSubmission();
282
283
  return e === null || e.length === 0 ? {
283
284
  flags: { valueMissing: !0 },
284
- message: "Please fill out this field.",
285
+ message: t(this, "valueMissing"),
285
286
  anchor: this.formValidationAnchor()
286
287
  } : null;
287
288
  }
@@ -291,10 +292,10 @@ function h(n) {
291
292
  } catch {}
292
293
  }
293
294
  }
294
- return e([t({
295
+ return e([n({
295
296
  type: Boolean,
296
297
  reflect: !0
297
- })], r.prototype, "required", void 0), r;
298
+ })], i.prototype, "required", void 0), i;
298
299
  }
299
300
  //#endregion
300
- export { a as i, m as n, r, h as t };
301
+ export { o as i, h as n, i as r, g as t };
@@ -15,10 +15,7 @@ function e(e, t, n, r = !0) {
15
15
  function t(t, n) {
16
16
  return e(t, n === 1 ? -1 : t.length, n, !1);
17
17
  }
18
- function n(e) {
19
- return e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey;
20
- }
21
- var r = class {
18
+ var n = class {
22
19
  #e = "";
23
20
  #t;
24
21
  constructor(e = 500) {
@@ -38,25 +35,9 @@ var r = class {
38
35
  reset() {
39
36
  clearTimeout(this.#t), this.#e = "";
40
37
  }
41
- };
38
+ }, r = 0;
42
39
  function i(e) {
43
- try {
44
- if (e.matches(":dir(rtl)")) return !0;
45
- } catch {}
46
- return getComputedStyle(e).direction === "rtl";
47
- }
48
- function a(e) {
49
- return i(e) ? {
50
- next: "ArrowLeft",
51
- prev: "ArrowRight"
52
- } : {
53
- next: "ArrowRight",
54
- prev: "ArrowLeft"
55
- };
56
- }
57
- var o = 0;
58
- function s(e) {
59
- return `${e}-${++o}`;
40
+ return `${e}-${++r}`;
60
41
  }
61
42
  //#endregion
62
- export { e as a, n as i, t as n, s as o, a as r, r as t };
43
+ export { i, t as n, e as r, n as t };
@@ -1,15 +1,13 @@
1
+ import { actionFor as e } from "../keys.js";
1
2
  //#region src/keyboard-activation.ts
2
- var e = (e) => typeof e == "function" ? e() : e ?? !0, t = class {
3
+ var t = class {
3
4
  constructor(t, n = {}) {
4
5
  this._host = t, this._options = n, this._armed = !1, this._disarm = () => {
5
6
  this._armed = !1;
6
7
  }, this._keydown = (t) => {
7
- if (!(t.target !== this._host || t.defaultPrevented || t.altKey || t.ctrlKey || t.metaKey || t.isComposing)) if (t.key === "Enter" && e(this._options.enter)) {
8
- if (this._disabled()) return;
9
- t.preventDefault(), t.repeat || this._activate(t);
10
- } else t.key === " " && e(this._options.space) && (t.preventDefault(), this._armed = !this._disabled());
8
+ t.target !== this._host || this._options.when?.() === !1 || e(this._host, t) !== "activate" || (t.key === " " ? (t.preventDefault(), this._armed = !this._disabled()) : this._disabled() || (t.preventDefault(), t.repeat || this._activate(t)));
11
9
  }, this._keyup = (t) => {
12
- t.key !== " " || t.target !== this._host || !this._armed || (this._armed = !1, !(!e(this._options.space) || this._disabled()) && (t.preventDefault(), this._activate(t)));
10
+ t.key !== " " || t.target !== this._host || !this._armed || (this._armed = !1, !(this._options.when?.() === !1 || this._disabled() || e(this._host, t) !== "activate") && (t.preventDefault(), this._activate(t)));
13
11
  }, t.addController(this);
14
12
  }
15
13
  hostConnected() {
@@ -0,0 +1,21 @@
1
+ //#region src/keymaps/menu.ts
2
+ var e = {
3
+ next: ["ArrowDown"],
4
+ previous: ["ArrowUp"],
5
+ first: ["Home"],
6
+ last: ["End"],
7
+ typeahead: ["Printable"],
8
+ close: ["Escape"]
9
+ }, t = {
10
+ open: ["ArrowDown"],
11
+ openLast: ["ArrowUp"],
12
+ activate: ["Enter", "Space"]
13
+ }, n = {
14
+ ...e,
15
+ leave: ["Tab", "Shift+Tab"]
16
+ }, r = {
17
+ ...t,
18
+ ...n
19
+ };
20
+ //#endregion
21
+ export { e as i, n, t as r, r as t };
@@ -1,12 +1,15 @@
1
- import { t as e } from "./base-BxmMM3B7.js";
1
+ import { t as e } from "./base-BGrS4eIl.js";
2
2
  import { t } from "./decorate-CaYbmmmm.js";
3
- import { n, r } from "./parts-DI_3VpSy.js";
4
- import { t as i } from "./overlay-hLJ7IQHx.js";
5
- import { property as a } from "lit/decorators.js";
3
+ import { keysConverter as n } from "../keys.js";
4
+ import { msg as r } from "../messages.js";
5
+ import { n as i, r as a } from "./parts-DI_3VpSy.js";
6
+ import { t as o } from "./overlay-BuV-4Yvt.js";
7
+ import { t as s } from "./overlay-K1ilWC1p.js";
8
+ import { property as c } from "lit/decorators.js";
6
9
  //#region src/modal.ts
7
- var o = class extends e {
10
+ var l = class extends e {
8
11
  constructor(...e) {
9
- super(...e), this.open = !1, this.hideClose = !1, this._parts = new n(this, {
12
+ super(...e), this.keys = null, this.open = !1, this.hideClose = !1, this._parts = new i(this, {
10
13
  tags: [
11
14
  "title",
12
15
  "description",
@@ -14,7 +17,7 @@ var o = class extends e {
14
17
  "actions"
15
18
  ].map((e) => `${this.localName}-${e}`),
16
19
  onChange: () => this._wire()
17
- }), this._overlay = new i(this, {
20
+ }), this._overlay = new o(this, {
18
21
  kind: "modal",
19
22
  surface: () => this._surface(),
20
23
  isOpen: () => this.open,
@@ -26,8 +29,11 @@ var o = class extends e {
26
29
  this._overlay.requestClose("close-button");
27
30
  };
28
31
  }
32
+ static {
33
+ this.keyMap = s;
34
+ }
29
35
  _chrome() {
30
- return r(this, "<dialog part=\"surface\"><button type=\"button\" part=\"close\" aria-label=\"Close\">&times;</button><slot></slot></dialog>");
36
+ return a(this, "<dialog part=\"surface\"><button type=\"button\" part=\"close\">&times;</button><slot></slot></dialog>");
31
37
  }
32
38
  _surface() {
33
39
  return this._chrome().querySelector("dialog");
@@ -39,10 +45,9 @@ var o = class extends e {
39
45
  this._chrome().querySelector("button").removeEventListener("click", this._close), super.disconnectedCallback();
40
46
  }
41
47
  willUpdate(e) {
42
- if (super.willUpdate(e), e.has("hideClose")) {
43
- let e = this._chrome().querySelector("button");
44
- e.hidden = this.hideClose, e.setAttribute("part", this.hideClose ? "" : "close");
45
- }
48
+ super.willUpdate(e);
49
+ let t = this._chrome().querySelector("button");
50
+ t.setAttribute("aria-label", r(this, "close")), e.has("hideClose") && (t.hidden = this.hideClose, t.setAttribute("part", this.hideClose ? "" : "close"));
46
51
  }
47
52
  static get observedAttributes() {
48
53
  return [...super.observedAttributes, "aria-label"];
@@ -59,13 +64,16 @@ var o = class extends e {
59
64
  t || !i ? e.removeAttribute("aria-label") : e.setAttribute("aria-label", i), t && !("ariaLabelledByElements" in r) && e.setAttribute("aria-label", t.textContent?.trim() ?? "");
60
65
  }
61
66
  };
62
- t([a({
67
+ t([c({
68
+ attribute: "keys",
69
+ converter: n
70
+ })], l.prototype, "keys", void 0), t([c({
63
71
  type: Boolean,
64
72
  reflect: !0
65
- })], o.prototype, "open", void 0), t([a({
73
+ })], l.prototype, "open", void 0), t([c({
66
74
  type: Boolean,
67
75
  attribute: "hide-close",
68
76
  reflect: !0
69
- })], o.prototype, "hideClose", void 0);
77
+ })], l.prototype, "hideClose", void 0);
70
78
  //#endregion
71
- export { o as t };
79
+ export { l as t };