@voidable/ui 0.10.0 → 0.11.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 (102) hide show
  1. package/dist/base.d.ts +6 -0
  2. package/dist/base.js +2 -2
  3. package/dist/chunks/{base-BxmMM3B7.js → base-BGrS4eIl.js} +9 -0
  4. package/dist/chunks/data-BpiiNapL.js +95 -0
  5. package/dist/chunks/{modal-CgGp_fCs.js → modal-DWGkNdNG.js} +2 -2
  6. package/dist/chunks/{overlay-hLJ7IQHx.js → overlay-CH7L4N-h.js} +1 -1
  7. package/dist/chunks/{projection-SnR79EHI.js → projection-oPe6ipjL.js} +1 -1
  8. package/dist/components/accordion.js +1 -1
  9. package/dist/components/action-input.js +2 -2
  10. package/dist/components/alert.d.ts +11 -0
  11. package/dist/components/alert.js +10 -3
  12. package/dist/components/avatar.js +2 -2
  13. package/dist/components/badge.d.ts +8 -2
  14. package/dist/components/badge.js +1 -4
  15. package/dist/components/banner.d.ts +9 -0
  16. package/dist/components/banner.js +10 -3
  17. package/dist/components/bar-chart.d.ts +21 -7
  18. package/dist/components/bar-chart.js +65 -43
  19. package/dist/components/breadcrumbs.js +1 -1
  20. package/dist/components/button.js +1 -1
  21. package/dist/components/calendar.d.ts +40 -2
  22. package/dist/components/calendar.js +110 -21
  23. package/dist/components/card.js +1 -1
  24. package/dist/components/carousel.js +3 -3
  25. package/dist/components/charts/data.d.ts +72 -0
  26. package/dist/components/checkbox-group.js +2 -2
  27. package/dist/components/checkbox.js +2 -2
  28. package/dist/components/collapsible.js +1 -1
  29. package/dist/components/color-picker.js +2 -2
  30. package/dist/components/combobox.js +3 -3
  31. package/dist/components/compose-input.js +2 -2
  32. package/dist/components/dialog.js +1 -1
  33. package/dist/components/divider.js +2 -2
  34. package/dist/components/donut-chart.d.ts +22 -6
  35. package/dist/components/donut-chart.js +95 -69
  36. package/dist/components/drawer.js +1 -1
  37. package/dist/components/dropdown-menu.js +2 -2
  38. package/dist/components/editable.js +2 -2
  39. package/dist/components/error-fallback.js +1 -1
  40. package/dist/components/field.js +2 -2
  41. package/dist/components/file-upload.d.ts +20 -5
  42. package/dist/components/file-upload.js +51 -21
  43. package/dist/components/gauge.d.ts +32 -8
  44. package/dist/components/gauge.js +202 -130
  45. package/dist/components/hamburger.d.ts +12 -1
  46. package/dist/components/hamburger.js +24 -13
  47. package/dist/components/hover-card.js +2 -2
  48. package/dist/components/indicator.js +2 -2
  49. package/dist/components/input.js +2 -2
  50. package/dist/components/line-chart.d.ts +22 -7
  51. package/dist/components/line-chart.js +76 -54
  52. package/dist/components/list.js +1 -1
  53. package/dist/components/menu.js +1 -1
  54. package/dist/components/multiselect.js +3 -3
  55. package/dist/components/nav-bar.d.ts +9 -0
  56. package/dist/components/nav-bar.js +16 -3
  57. package/dist/components/nav-menu.js +1 -1
  58. package/dist/components/number-input.js +2 -2
  59. package/dist/components/pagination.js +2 -2
  60. package/dist/components/panel.js +1 -1
  61. package/dist/components/pin-input.js +2 -2
  62. package/dist/components/popover.js +2 -2
  63. package/dist/components/progress.js +2 -2
  64. package/dist/components/radio-group.js +2 -2
  65. package/dist/components/radio.js +2 -2
  66. package/dist/components/scroll-area.js +2 -2
  67. package/dist/components/segmented-control.js +1 -1
  68. package/dist/components/select.js +2 -2
  69. package/dist/components/sidebar.js +1 -1
  70. package/dist/components/skeleton.js +1 -1
  71. package/dist/components/slider.js +2 -2
  72. package/dist/components/spinner.js +2 -2
  73. package/dist/components/stat.d.ts +13 -1
  74. package/dist/components/stat.js +28 -20
  75. package/dist/components/status-dot.js +1 -1
  76. package/dist/components/stepper.js +2 -2
  77. package/dist/components/switch.js +2 -2
  78. package/dist/components/table.d.ts +4 -0
  79. package/dist/components/table.js +42 -29
  80. package/dist/components/tabs.js +1 -1
  81. package/dist/components/tag.js +2 -2
  82. package/dist/components/tags-input.js +2 -2
  83. package/dist/components/textarea.js +2 -2
  84. package/dist/components/toast.js +1 -1
  85. package/dist/components/toggle-group.js +1 -1
  86. package/dist/components/toggle.js +1 -1
  87. package/dist/components/tooltip.js +2 -2
  88. package/dist/components.json +15 -13
  89. package/dist/custom-elements.json +272 -70
  90. package/dist/dev/types.d.ts +3 -1
  91. package/dist/dev.js +54 -9
  92. package/dist/index.js +1 -1
  93. package/dist/llms.txt +1 -1
  94. package/dist/reference.md +81 -56
  95. package/dist/types/elements.d.ts +13 -13
  96. package/dist/types/react.d.ts +2 -2
  97. package/dist/types/solid.d.ts +2 -2
  98. package/dist/types/svelte.d.ts +2 -2
  99. package/dist/types/vue.d.ts +2 -2
  100. package/dist/vscode.html-custom-data.json +95 -21
  101. package/dist/web-types.json +173 -44
  102. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
1
  import { VoidElement } from '../base.js';
2
+ import { FormValidityResult } from '../form-control.js';
2
3
  import { OverlayController } from '../overlay.js';
3
4
  declare const VoidCalendar_base: (new (...args: any[]) => import('../form-control.js').VoidInternalsFormControl) & typeof VoidElement;
4
5
  /** Date selection for booking flows, scheduling UIs, and form fields with locale-aware formatting and min/max constraints. */
@@ -72,6 +73,12 @@ declare const VoidDatePicker_base: (new (...args: any[]) => import('../form-cont
72
73
  * field open it with focus on the selected (or current) day. Choosing a day, Escape, or a press outside closes
73
74
  * it and focus returns to the input.
74
75
  *
76
+ * The field also takes a typed date, in `format` or as ISO `YYYY-MM-DD`: it is read when the field loses focus
77
+ * and on Enter, the calendar follows, and `void-change` fires once with the ISO value. A date that is not a date,
78
+ * or is before `min` or after `max`, is refused: the text stays for correction, `error` explains it, the field
79
+ * is `aria-invalid` and described by the message, and the form is not submitted (`badInput`, `rangeUnderflow` or
80
+ * `rangeOverflow`). An empty field clears the value.
81
+ *
75
82
  * @fires {CustomEvent<{ reason: 'trigger' | 'focus' | 'keyboard' | 'api' }>} void-open - The calendar popup
76
83
  * opened: `trigger` from the calendar button, `focus` from a click on the field, `keyboard` from a key.
77
84
  * @fires {CustomEvent<{ reason: 'trigger' | 'select' | 'escape' | 'outside' | 'blur' | 'parent' | 'api' }>} void-close -
@@ -105,12 +112,31 @@ export declare class VoidDatePicker extends VoidDatePicker_base {
105
112
  /** Hint shown in the field while no date is chosen. Defaults to `Select date`. */
106
113
  placeholder: string;
107
114
  /**
108
- * How the chosen date is written in the field, using `YYYY`, `MM` and `DD`. Defaults to `MM/DD/YYYY`.
109
- * Display only; the value stays `YYYY-MM-DD`.
115
+ * How the date is written in the field, using `YYYY`, `MM` and `DD`. Defaults to `MM/DD/YYYY`. A date
116
+ * typed into the field is read the same way (and as ISO `YYYY-MM-DD` always); the value stays `YYYY-MM-DD`.
110
117
  */
111
118
  format: string;
112
119
  /** Status colour of the field: `default`, `error`, `warning`, `caution`, `success`, `info`, `notice` or `highlight`. */
113
120
  color: 'default' | 'error' | 'warning' | 'caution' | 'success' | 'info' | 'notice' | 'highlight';
121
+ /**
122
+ * Mark the field invalid: it gets the error styling and `aria-invalid`. Set it for a server-side message;
123
+ * the field also sets it itself, with the reason, when a typed date is not taken, and clears what it set
124
+ * once a valid date is typed or picked. A message you set is left alone.
125
+ */
126
+ error: string;
127
+ /** Text typed and not committed yet; null while the field shows `value`. Survives re-renders and morphs until committed. */
128
+ private _draft;
129
+ /** Why the committed text was refused, as the browser's validity reports it; null when it was taken. */
130
+ private _rejected;
131
+ /** The message this field wrote into `error`, so one the author wrote is told apart from it. */
132
+ private _ownError;
133
+ private readonly _errorId;
134
+ /** The typed text is the field's own to keep: a server patch of `value` discards it, any other morph does not. */
135
+ static clientState: {
136
+ _draft: string;
137
+ };
138
+ /** While focus is inside, a morph does not apply the server's value over the date the user is typing. */
139
+ static editState: string[];
114
140
  /** The calendar popup, controlled by the input (APG date picker combobox). */
115
141
  private readonly _dropdownId;
116
142
  protected readonly _overlay: OverlayController;
@@ -119,6 +145,18 @@ export declare class VoidDatePicker extends VoidDatePicker_base {
119
145
  render(): import('lit').TemplateResult<1>;
120
146
  private _toggle;
121
147
  private _onInputClick;
148
+ /** What the field shows for the committed value. */
149
+ private get _display();
150
+ private _onInput;
151
+ /** Takes the typed text: a date in `format` or ISO sets the value, anything else is refused and kept for correction. */
152
+ private _commit;
153
+ /** The text was taken (or discarded): no refusal, and the error the field wrote itself goes. */
154
+ private _accept;
155
+ /** A date typed in: keeps the calendar in step through `value`, fires `void-change` once, and closes the calendar. */
156
+ private _setTyped;
157
+ protected formValidity(): FormValidityResult | null;
158
+ protected formRestore(state: unknown): void;
159
+ protected willUpdate(changed: Map<string, unknown>): void;
122
160
  private _onCalendarChange;
123
161
  private _onInputKeydown;
124
162
  }
@@ -1,9 +1,9 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { r } from "../chunks/projection-SnR79EHI.js";
4
+ import { r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { o as i, r as a } from "../chunks/keyboard-CEhMSkws.js";
6
- import { t as o } from "../chunks/overlay-hLJ7IQHx.js";
6
+ import { t as o } from "../chunks/overlay-CH7L4N-h.js";
7
7
  import { html as s, nothing as c } from "lit";
8
8
  import { property as l } from "lit/decorators.js";
9
9
  import { live as u } from "lit/directives/live.js";
@@ -36,7 +36,26 @@ function g(e, t) {
36
36
  let [r, i, a] = n;
37
37
  return t.replace("YYYY", String(r).padStart(4, "0")).replace("MM", String(i + 1).padStart(2, "0")).replace("DD", String(a).padStart(2, "0"));
38
38
  }
39
- var _ = class extends n(e) {
39
+ function _(e, t) {
40
+ let n = e.trim(), r = d(n), i = [], a = "";
41
+ for (let e of t.split(/(YYYY|MM|DD)/)) e === "YYYY" ? (i.push("y"), a += "(\\d{4})") : e === "MM" ? (i.push("m"), a += "(\\d{1,2})") : e === "DD" ? (i.push("d"), a += "(\\d{1,2})") : a += e.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&").replace(/\s+/g, "\\s*");
42
+ let o, s, c, l = r ? null : RegExp(`^${a}$`).exec(n);
43
+ if (r) [o, s, c] = [
44
+ r[0],
45
+ r[1] + 1,
46
+ r[2]
47
+ ];
48
+ else if (l && i.length === 3 && new Set(i).size === 3) {
49
+ let e = (e) => Number(l[i.indexOf(e) + 1]);
50
+ [o, s, c] = [
51
+ e("y"),
52
+ e("m"),
53
+ e("d")
54
+ ];
55
+ } else return null;
56
+ return s < 1 || s > 12 || c < 1 || c > m(o, s - 1) || o < 100 ? null : f(o, s - 1, c);
57
+ }
58
+ var v = class extends n(e) {
40
59
  constructor(...e) {
41
60
  super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this._viewYear = 0, this._viewMonth = 0, this._view = "days", this._focusDate = "", this._yearsPageStart = 0, this._didInit = !1, this._prevMonth = () => {
42
61
  this._viewMonth === 0 ? (this._viewMonth = 11, this._viewYear--) : this._viewMonth--, this._syncFocusToView(), this.requestUpdate();
@@ -354,19 +373,19 @@ var _ = class extends n(e) {
354
373
  t([l({
355
374
  type: String,
356
375
  reflect: !0
357
- })], _.prototype, "value", void 0), t([l({ type: String })], _.prototype, "min", void 0), t([l({ type: String })], _.prototype, "max", void 0), t([l({
376
+ })], v.prototype, "value", void 0), t([l({ type: String })], v.prototype, "min", void 0), t([l({ type: String })], v.prototype, "max", void 0), t([l({
358
377
  type: Boolean,
359
378
  reflect: !0
360
- })], _.prototype, "disabled", void 0), t([l({
379
+ })], v.prototype, "disabled", void 0), t([l({
361
380
  type: String,
362
381
  reflect: !0
363
- })], _.prototype, "size", void 0), t([l({ type: String })], _.prototype, "locale", void 0), t([l({
382
+ })], v.prototype, "size", void 0), t([l({ type: String })], v.prototype, "locale", void 0), t([l({
364
383
  attribute: "first-day",
365
384
  type: Number
366
- })], _.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", _);
367
- var v = class extends n(e) {
385
+ })], v.prototype, "firstDay", void 0), customElements.get("void-calendar") || customElements.define("void-calendar", v);
386
+ var y = class extends n(e) {
368
387
  constructor(...e) {
369
- super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this._dropdownId = i("void-date-picker-dialog"), this._overlay = new o(this, {
388
+ super(...e), this.value = "", this.min = "", this.max = "", this.disabled = !1, this.size = "md", this.locale = "en-US", this.firstDay = 0, this.open = !1, this.placeholder = "Select date", this.format = "MM/DD/YYYY", this.color = "default", this.error = "", this._draft = null, this._rejected = null, this._ownError = "", this._errorId = i("void-date-picker-error"), this._dropdownId = i("void-date-picker-dialog"), this._overlay = new o(this, {
370
389
  kind: "dialog",
371
390
  surface: () => this.querySelector(":scope > .void-date-picker-dropdown"),
372
391
  isOpen: () => this.open,
@@ -380,37 +399,71 @@ var v = class extends n(e) {
380
399
  this.disabled || this._overlay.toggle("trigger");
381
400
  }, this._onInputClick = () => {
382
401
  this.disabled || this._overlay.toggle("focus");
402
+ }, this._onInput = (e) => {
403
+ this._draft = e.target.value;
404
+ }, this._commit = () => {
405
+ if (this._draft === null || this.disabled) return;
406
+ let e = this._draft.trim();
407
+ if (e === this._display) {
408
+ this._draft = null, this._accept();
409
+ return;
410
+ }
411
+ if (e === "") {
412
+ this._draft = null, this._accept(), this._setTyped("");
413
+ return;
414
+ }
415
+ let t = _(e, this.format), n = t ? this.min && t < this.min ? { rangeUnderflow: !0 } : this.max && t > this.max ? { rangeOverflow: !0 } : null : { badInput: !0 };
416
+ if (n || !t) {
417
+ let e = n?.rangeUnderflow ? `Choose ${g(this.min, this.format)} or a later date.` : n?.rangeOverflow ? `Choose ${g(this.max, this.format)} or an earlier date.` : `Enter a date as ${this.format} or YYYY-MM-DD.`;
418
+ this._rejected = {
419
+ flags: n ?? { badInput: !0 },
420
+ message: e
421
+ }, (!this.error || this.error === this._ownError) && (this.error = e, this._ownError = e), this.requestUpdate();
422
+ return;
423
+ }
424
+ this._draft = null, this._accept(), this._setTyped(t);
383
425
  }, this._onCalendarChange = (e) => {
384
- e.stopPropagation(), this.value = e.detail.value, this._overlay.requestClose("select"), this.dispatchEvent(new CustomEvent("void-change", {
426
+ e.stopPropagation(), this._draft = null, this._accept(), this.value = e.detail.value, this._overlay.requestClose("select"), this.dispatchEvent(new CustomEvent("void-change", {
385
427
  bubbles: !0,
386
428
  composed: !0,
387
429
  detail: e.detail
388
430
  }));
389
431
  }, this._onInputKeydown = (e) => {
390
- e.key === "Enter" || e.key === " " ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : e.key === "ArrowDown" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
432
+ e.key === "Enter" && this._draft !== null && this._draft.trim() !== this._display ? (e.preventDefault(), this._commit(), !this._rejected && this.open && this._overlay.requestClose("select")) : e.key === "Enter" || e.key === " " && this._draft === null ? (e.preventDefault(), this.disabled || this._overlay.toggle("keyboard")) : e.key === "ArrowDown" && !this.disabled && (e.preventDefault(), this.open ? this._focusDay() : this._overlay.requestOpen("keyboard"));
391
433
  };
392
434
  }
393
435
  static {
394
436
  this.labelTarget = ".void-date-picker-input";
395
437
  }
438
+ static {
439
+ this.clientState = { _draft: "value" };
440
+ }
441
+ static {
442
+ this.editState = ["value"];
443
+ }
396
444
  async _focusDay() {
397
445
  let e = this.querySelector(":scope > .void-date-picker-dropdown > void-calendar");
398
446
  e && (await e.updateComplete, this.open && e.querySelector("[tabindex=\"0\"]")?.focus({ preventScroll: !0 }));
399
447
  }
400
448
  render() {
449
+ let e = this.value ? g(this.value, this.format) : "", t = this._rejected && this.error === this._ownError ? this.error : "";
401
450
  return s`
402
451
  <div class="void-date-picker-anchor">
403
452
  <input
404
453
  class="void-date-picker-input"
405
- .value=${u(this.value ? g(this.value, this.format) : "")}
454
+ .value=${u(this._draft ?? e)}
406
455
  placeholder=${this.placeholder}
407
456
  ?disabled=${this.disabled}
408
- readonly
457
+ autocomplete="off"
409
458
  role="combobox"
410
459
  aria-label=${this.placeholder}
411
460
  aria-haspopup="dialog"
412
461
  aria-expanded=${String(this.open)}
413
462
  aria-controls=${this._dropdownId}
463
+ aria-invalid=${this.error ? "true" : c}
464
+ aria-describedby=${t ? this._errorId : c}
465
+ @input=${this._onInput}
466
+ @blur=${this._commit}
414
467
  @click=${this._onInputClick}
415
468
  @keydown=${this._onInputKeydown}
416
469
  />
@@ -430,6 +483,7 @@ var v = class extends n(e) {
430
483
  </svg>
431
484
  </button>
432
485
  </div>
486
+ ${t ? s`<span class="void-date-picker-error" id=${this._errorId} role="alert">${t}</span>` : c}
433
487
  ${this.open ? s`
434
488
  <div class="void-date-picker-dropdown" id=${this._dropdownId} role="dialog" aria-label="Choose date" popover="manual">
435
489
  <void-calendar
@@ -446,25 +500,60 @@ var v = class extends n(e) {
446
500
  ` : c}
447
501
  `;
448
502
  }
503
+ get _display() {
504
+ return this.value ? g(this.value, this.format) : "";
505
+ }
506
+ _accept(e = !0) {
507
+ this._rejected = null, this._ownError && this.error === this._ownError && (this.error = ""), this._ownError = "", e && this.requestUpdate();
508
+ }
509
+ _setTyped(e) {
510
+ if (e === this.value) return;
511
+ this.value = e;
512
+ let t = d(e);
513
+ this.dispatchEvent(new CustomEvent("void-change", {
514
+ bubbles: !0,
515
+ composed: !0,
516
+ detail: {
517
+ value: e,
518
+ date: t ? new Date(t[0], t[1], t[2]) : null
519
+ }
520
+ }));
521
+ }
522
+ formValidity() {
523
+ return this._rejected ? {
524
+ flags: this._rejected.flags,
525
+ message: this._rejected.message,
526
+ anchor: this.querySelector(".void-date-picker-input") ?? void 0
527
+ } : super.formValidity();
528
+ }
529
+ formRestore(e) {
530
+ this._draft = null, this._accept(), super.formRestore(e);
531
+ }
532
+ willUpdate(e) {
533
+ super.willUpdate(e), e.has("value") && (this._draft = null, this._rejected && this._accept(!1));
534
+ }
449
535
  };
450
536
  t([l({
451
537
  type: String,
452
538
  reflect: !0
453
- })], v.prototype, "value", void 0), t([l({ type: String })], v.prototype, "min", void 0), t([l({ type: String })], v.prototype, "max", void 0), t([l({
539
+ })], y.prototype, "value", void 0), t([l({ type: String })], y.prototype, "min", void 0), t([l({ type: String })], y.prototype, "max", void 0), t([l({
454
540
  type: Boolean,
455
541
  reflect: !0
456
- })], v.prototype, "disabled", void 0), t([l({
542
+ })], y.prototype, "disabled", void 0), t([l({
457
543
  type: String,
458
544
  reflect: !0
459
- })], v.prototype, "size", void 0), t([l({ type: String })], v.prototype, "locale", void 0), t([l({
545
+ })], y.prototype, "size", void 0), t([l({ type: String })], y.prototype, "locale", void 0), t([l({
460
546
  attribute: "first-day",
461
547
  type: Number
462
- })], v.prototype, "firstDay", void 0), t([l({
548
+ })], y.prototype, "firstDay", void 0), t([l({
463
549
  type: Boolean,
464
550
  reflect: !0
465
- })], v.prototype, "open", void 0), t([l({ type: String })], v.prototype, "placeholder", void 0), t([l({ type: String })], v.prototype, "format", void 0), t([l({
551
+ })], y.prototype, "open", void 0), t([l({ type: String })], y.prototype, "placeholder", void 0), t([l({ type: String })], y.prototype, "format", void 0), t([l({
552
+ type: String,
553
+ reflect: !0
554
+ })], y.prototype, "color", void 0), t([l({
466
555
  type: String,
467
556
  reflect: !0
468
- })], v.prototype, "color", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", v);
557
+ })], y.prototype, "error", void 0), customElements.get("void-date-picker") || customElements.define("void-date-picker", y);
469
558
  //#endregion
470
- export { _ as VoidCalendar, v as VoidDatePicker };
559
+ export { v as VoidCalendar, y as VoidDatePicker };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.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/card.ts
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { n as r } from "../chunks/parts-DI_3VpSy.js";
@@ -55,9 +55,9 @@ var c = class extends e {
55
55
  }
56
56
  _wire() {
57
57
  let e = this._slides, t = e.length, n = this._parts.one("void-carousel-content");
58
- n && this._parts.provide(n, "aria-live", "polite"), e.forEach((e, n) => {
58
+ n && this._parts.set(n, "aria-live", this.autoplay ? "off" : "polite"), e.forEach((e, n) => {
59
59
  this._parts.provide(e, "role", "group"), this._parts.provide(e, "aria-roledescription", "slide");
60
- let r = `Slide ${n + 1} of ${t}`, i = e.getAttribute("aria-label");
60
+ let r = `${n + 1} of ${t}`, i = e.getAttribute("aria-label");
61
61
  (i === null || i === this._labels.get(e)) && (this._parts.set(e, "aria-label", r), this._labels.set(e, r)), this._parts.set(e, "active", n === this.index);
62
62
  });
63
63
  let r = !this.loop && this.index === 0, i = !this.loop && this.index === t - 1, a = this._parts.one("void-carousel-previous"), o = this._parts.one("void-carousel-next");
@@ -0,0 +1,72 @@
1
+ import { nothing, TemplateResult } from 'lit';
2
+ /** Reports a problem with a chart's data through the element's dev warning. */
3
+ export type ChartWarn = (subject: string, message: string) => void;
4
+ /** What an element remembers of the last attribute text it accepted, so an unchanged attribute draws nothing new. */
5
+ export interface ChartSource {
6
+ text: string | null;
7
+ }
8
+ interface ChartInput<T> {
9
+ /** The attribute the text came from, for the warning. */
10
+ attr: string;
11
+ /** What the attribute should look like, for the warning. */
12
+ shape: string;
13
+ empty: () => T;
14
+ /** Turns parsed JSON into the property's value, or null when it has the wrong shape. */
15
+ normalize: (raw: unknown) => T | null;
16
+ warn: ChartWarn;
17
+ }
18
+ /**
19
+ * Resolves what was assigned to a chart's `data` (or `zones`): an object (the property), or the text of the
20
+ * JSON attribute. Returns `null` when the text is the one already accepted (an attribute a server morph left
21
+ * alone), so nothing animates; otherwise the value to use. Invalid text gives the empty value (the chart
22
+ * draws nothing) and a dev warning; it never throws.
23
+ */
24
+ export declare function readChartInput<T>(input: unknown, source: ChartSource, o: ChartInput<T>): {
25
+ value: T;
26
+ } | null;
27
+ export declare const isRecord: (v: unknown) => v is Record<string, unknown>;
28
+ /** `{ series: [{ name, values }], labels }`, as the bar and line charts take it. */
29
+ export declare function normalizeSeriesData<S extends {
30
+ name: string;
31
+ values: number[];
32
+ }>(raw: unknown): {
33
+ series: S[];
34
+ labels?: string[];
35
+ } | null;
36
+ /** `{ segments: [{ name, value }] }`, as the donut takes it; the gauge's segments share the shape. */
37
+ export declare function normalizeSegments<S extends {
38
+ name: string;
39
+ value: number;
40
+ }>(raw: unknown): S[] | null;
41
+ /** The language the text of `el` is in: its closest `lang`, else the browser's. */
42
+ export declare function chartLocale(el: Element): string | undefined;
43
+ /** Numbers the way a reader of this element's language expects them, with their full precision (up to three decimals). */
44
+ export declare function tableNumbers(el: Element): {
45
+ number: (v: number) => string;
46
+ percent: (v: number) => string;
47
+ };
48
+ export interface ChartTable {
49
+ caption: string;
50
+ /** Column headers; for a table with row headers the first is the corner. */
51
+ head: string[];
52
+ rows: Array<{
53
+ header?: string;
54
+ cells: string[];
55
+ }>;
56
+ }
57
+ /**
58
+ * The data table every chart carries: visually hidden, in the accessibility tree, with the chart's label as
59
+ * its caption (the theme shows it below the chart with `show-table`).
60
+ */
61
+ export declare function dataTable(className: string, t: ChartTable | null): TemplateResult | typeof nothing;
62
+ /** The table of a chart whose data is `series` over `labels` (rows are the labels, columns the series). */
63
+ export declare function seriesTable(el: Element, caption: string, series: Array<{
64
+ name: string;
65
+ values: number[];
66
+ }>, labels: string[]): ChartTable | null;
67
+ /** The table of named parts of a whole (donut segments, gauge segments): name, value and share. */
68
+ export declare function segmentsTable(el: Element, caption: string, segments: Array<{
69
+ name: string;
70
+ value: number;
71
+ }>): ChartTable | null;
72
+ export {};
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/form-control-C0vH6gii.js";
4
- import { t as r } from "../chunks/projection-SnR79EHI.js";
4
+ import { t as r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { n as i } from "../chunks/value-list-CH6GjYXM.js";
6
6
  import { html as a, nothing as o } from "lit";
7
7
  import { property as s } from "lit/decorators.js";
@@ -1,8 +1,8 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/keyboard-activation-CV0m4hkn.js";
4
4
  import { n as r } from "../chunks/form-control-C0vH6gii.js";
5
- import { t as i } from "../chunks/projection-SnR79EHI.js";
5
+ import { t as i } from "../chunks/projection-oPe6ipjL.js";
6
6
  import { html as a, nothing as o } from "lit";
7
7
  import { property as s } from "lit/decorators.js";
8
8
  //#region src/components/checkbox.ts
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { n } from "../chunks/parts-DI_3VpSy.js";
4
4
  import { t as r } from "../chunks/disclosure-Bj_49GcC.js";
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { r } from "../chunks/projection-SnR79EHI.js";
4
+ import { r } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { html as i, nothing as a } from "lit";
6
6
  import { property as o } from "lit/decorators.js";
7
7
  import { live as s } from "lit/directives/live.js";
@@ -1,10 +1,10 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
3
  import { t as n } from "../chunks/form-control-C0vH6gii.js";
4
- import { n as r, t as i } from "../chunks/projection-SnR79EHI.js";
4
+ import { n as r, t as i } from "../chunks/projection-oPe6ipjL.js";
5
5
  import { n as a } from "../chunks/parts-DI_3VpSy.js";
6
6
  import { a as o, n as s } from "../chunks/keyboard-CEhMSkws.js";
7
- import { t as c } from "../chunks/overlay-hLJ7IQHx.js";
7
+ import { t as c } from "../chunks/overlay-CH7L4N-h.js";
8
8
  import { optionLabel as l } from "./multiselect.js";
9
9
  import { html as u, nothing as d } from "lit";
10
10
  import { property as f } from "lit/decorators.js";
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r } from "lit";
5
5
  import { property as i, query as a } from "lit/decorators.js";
6
6
  //#region src/components/compose-input.ts
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "../chunks/decorate-CaYbmmmm.js";
2
- import { t } from "../chunks/modal-CgGp_fCs.js";
2
+ import { t } from "../chunks/modal-DWGkNdNG.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  //#region src/components/dialog.ts
5
5
  var r = class extends t {
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-BxmMM3B7.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { r as n } from "../chunks/projection-SnR79EHI.js";
3
+ import { r as n } from "../chunks/projection-oPe6ipjL.js";
4
4
  import { html as r, nothing as i } from "lit";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/divider.ts
@@ -10,8 +10,10 @@ export interface DonutChartData {
10
10
  }
11
11
  /**
12
12
  * Donut chart for part-to-whole breakdowns, drawn in SVG with animated segments and an optional total in the
13
- * centre. Give it `data` (`{ segments: [{ name, value }] }`) from script; it has no children. The chart is an
14
- * image to assistive technology, so set `aria-label` and state the key figures in the surrounding text.
13
+ * centre. Give it `data` (`{ segments: [{ name, value }] }`) as the `data` property or as JSON in the `data`
14
+ * attribute, so server-rendered markup draws it with no script; it has no children. The drawing is hidden
15
+ * from assistive technology and a visually hidden data table (captioned with `aria-label`) carries the
16
+ * values instead; add `show-table` to show the table below the chart too.
15
17
  */
16
18
  export declare class VoidDonutChart extends VoidElement {
17
19
  /** Width and height of the chart in pixels. Defaults to 220. */
@@ -37,17 +39,29 @@ export declare class VoidDonutChart extends VoidElement {
37
39
  /** Print the sum of the segments in the centre of the ring. */
38
40
  showTotal: boolean;
39
41
  /**
40
- * Accessible name of the chart, such as `Traffic by source`. The chart is an image to assistive
41
- * technology, so set it and put the key figures in the text around it.
42
+ * Accessible name of the chart, such as `Traffic by source`; it is also the caption of the data table.
43
+ * Set it: the drawing itself is hidden from assistive technology.
42
44
  */
43
45
  ariaLabel: string;
46
+ /**
47
+ * Show the data table (one row per segment: name, value and share) below the chart. The table is always
48
+ * there for assistive technology; this makes it visible too.
49
+ */
50
+ showTable: boolean;
44
51
  private _data;
52
+ private _source;
53
+ private _entered;
45
54
  /**
46
55
  * The chart's data: `{ segments: [{ name, value, color? }] }`. Each segment's share of the ring is its
47
- * `value` over the sum of all values. Property only: assign a new object to update the chart and animate to it.
56
+ * `value` over the sum of all values. Give it as a property (assign a new object to update the chart and
57
+ * animate to it) or as JSON in the `data` attribute:
58
+ * `<void-donut-chart data='{"segments":[{"name":"Search","value":40},{"name":"Direct","value":25}]}'>`.
59
+ * Invalid JSON draws nothing and is reported by `@voidable/ui/dev`. The property is not reflected to the
60
+ * attribute (the data can be large), and an attribute a server morph leaves unchanged does not animate again.
61
+ * @default { segments: [] }
48
62
  */
49
63
  get data(): DonutChartData;
50
- set data(next: DonutChartData);
64
+ set data(input: DonutChartData);
51
65
  private _phase;
52
66
  private _hoverSegment;
53
67
  private _hoverX;
@@ -71,6 +85,8 @@ export declare class VoidDonutChart extends VoidElement {
71
85
  private _startAnimation;
72
86
  private _tick;
73
87
  render(): TemplateResult<1>;
88
+ /** The data table for assistive technology (and `show-table`), from the data as given, not the animated state. */
89
+ private _table;
74
90
  private _renderHoverTooltip;
75
91
  }
76
92
  declare global {