@voidable/ui 0.9.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 (114) hide show
  1. package/dist/base-entry.d.ts +1 -0
  2. package/dist/base.d.ts +8 -1
  3. package/dist/base.js +5 -1
  4. package/dist/chunks/base-BGrS4eIl.js +307 -0
  5. package/dist/chunks/data-BpiiNapL.js +95 -0
  6. package/dist/chunks/{keyboard-MQpfTX5I.js → keyboard-CEhMSkws.js} +19 -3
  7. package/dist/chunks/{modal-hivQ4YoU.js → modal-DWGkNdNG.js} +3 -3
  8. package/dist/chunks/{overlay-BywGMcDW.js → overlay-CH7L4N-h.js} +2 -2
  9. package/dist/chunks/{parts-CMQQop0D.js → parts-DI_3VpSy.js} +21 -17
  10. package/dist/chunks/{base-CMruMbxC.js → projection-oPe6ipjL.js} +105 -389
  11. package/dist/components/accordion.js +2 -2
  12. package/dist/components/action-input.d.ts +2 -2
  13. package/dist/components/action-input.js +56 -54
  14. package/dist/components/alert.d.ts +11 -0
  15. package/dist/components/alert.js +11 -4
  16. package/dist/components/avatar.js +13 -11
  17. package/dist/components/badge.d.ts +8 -2
  18. package/dist/components/badge.js +1 -4
  19. package/dist/components/banner.d.ts +9 -0
  20. package/dist/components/banner.js +11 -4
  21. package/dist/components/bar-chart.d.ts +21 -7
  22. package/dist/components/bar-chart.js +67 -43
  23. package/dist/components/breadcrumbs.js +2 -2
  24. package/dist/components/button.js +1 -1
  25. package/dist/components/calendar.d.ts +40 -2
  26. package/dist/components/calendar.js +170 -79
  27. package/dist/components/card.js +1 -1
  28. package/dist/components/carousel.js +20 -19
  29. package/dist/components/charts/data.d.ts +72 -0
  30. package/dist/components/checkbox-group.js +13 -12
  31. package/dist/components/checkbox.js +17 -16
  32. package/dist/components/collapsible.js +2 -2
  33. package/dist/components/color-picker.js +26 -24
  34. package/dist/components/combobox.js +17 -16
  35. package/dist/components/compose-input.js +13 -11
  36. package/dist/components/dialog.js +1 -1
  37. package/dist/components/divider.js +11 -9
  38. package/dist/components/donut-chart.d.ts +22 -6
  39. package/dist/components/donut-chart.js +96 -68
  40. package/dist/components/drawer.d.ts +2 -2
  41. package/dist/components/drawer.js +1 -1
  42. package/dist/components/dropdown-menu.js +4 -4
  43. package/dist/components/editable.js +13 -12
  44. package/dist/components/error-fallback.js +2 -2
  45. package/dist/components/field.js +10 -9
  46. package/dist/components/file-upload.d.ts +20 -5
  47. package/dist/components/file-upload.js +52 -20
  48. package/dist/components/gauge.d.ts +32 -8
  49. package/dist/components/gauge.js +209 -135
  50. package/dist/components/hamburger.d.ts +12 -1
  51. package/dist/components/hamburger.js +33 -20
  52. package/dist/components/hover-card.js +3 -3
  53. package/dist/components/indicator.js +14 -12
  54. package/dist/components/input.js +41 -39
  55. package/dist/components/line-chart.d.ts +22 -7
  56. package/dist/components/line-chart.js +80 -56
  57. package/dist/components/list.js +1 -1
  58. package/dist/components/menu.js +3 -3
  59. package/dist/components/multiselect.js +30 -29
  60. package/dist/components/nav-bar.d.ts +9 -0
  61. package/dist/components/nav-bar.js +16 -3
  62. package/dist/components/nav-menu.js +20 -19
  63. package/dist/components/number-input.js +17 -15
  64. package/dist/components/pagination.js +22 -20
  65. package/dist/components/panel.js +2 -2
  66. package/dist/components/pin-input.js +32 -30
  67. package/dist/components/popover.js +3 -3
  68. package/dist/components/progress.js +14 -12
  69. package/dist/components/radio-group.js +13 -11
  70. package/dist/components/radio.d.ts +25 -0
  71. package/dist/components/radio.js +78 -29
  72. package/dist/components/scroll-area.js +8 -7
  73. package/dist/components/segmented-control.js +21 -21
  74. package/dist/components/select.js +49 -47
  75. package/dist/components/sidebar.d.ts +2 -2
  76. package/dist/components/sidebar.js +2 -2
  77. package/dist/components/skeleton.js +1 -1
  78. package/dist/components/slider.js +16 -14
  79. package/dist/components/spinner.js +11 -9
  80. package/dist/components/stat.d.ts +13 -1
  81. package/dist/components/stat.js +29 -19
  82. package/dist/components/status-dot.js +1 -1
  83. package/dist/components/stepper.js +15 -13
  84. package/dist/components/switch.js +14 -12
  85. package/dist/components/table.d.ts +4 -0
  86. package/dist/components/table.js +42 -29
  87. package/dist/components/tabs.js +29 -29
  88. package/dist/components/tag.js +9 -8
  89. package/dist/components/tags-input.js +24 -22
  90. package/dist/components/textarea.js +34 -32
  91. package/dist/components/toast.d.ts +19 -2
  92. package/dist/components/toast.js +43 -10
  93. package/dist/components/toggle-group.js +16 -15
  94. package/dist/components/toggle.js +1 -1
  95. package/dist/components/tooltip.js +3 -3
  96. package/dist/components.json +15 -13
  97. package/dist/custom-elements.json +320 -88
  98. package/dist/dev/types.d.ts +3 -1
  99. package/dist/dev.js +85 -16
  100. package/dist/index.js +1 -1
  101. package/dist/keyboard.d.ts +10 -0
  102. package/dist/llms.txt +1 -1
  103. package/dist/parts.d.ts +5 -0
  104. package/dist/projection-api.d.ts +23 -0
  105. package/dist/projection.d.ts +8 -2
  106. package/dist/reference.md +84 -59
  107. package/dist/types/elements.d.ts +13 -13
  108. package/dist/types/react.d.ts +2 -2
  109. package/dist/types/solid.d.ts +2 -2
  110. package/dist/types/svelte.d.ts +2 -2
  111. package/dist/types/vue.d.ts +2 -2
  112. package/dist/vscode.html-custom-data.json +108 -28
  113. package/dist/web-types.json +189 -60
  114. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { n } from "../chunks/parts-CMQQop0D.js";
3
+ import { n } from "../chunks/parts-DI_3VpSy.js";
4
4
  import { n as r, t as i } from "../chunks/dismiss-Drsy_dE5.js";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/toast.ts
@@ -13,8 +13,8 @@ var o = class extends e {
13
13
  "void-toast-actions",
14
14
  "void-toast-close"
15
15
  ],
16
- onChange: () => void 0
17
- }), this._remaining = 0, this._timerStart = 0, this._hovered = !1, this._focused = !1, this._onEnter = () => {
16
+ onChange: () => this._syncRole()
17
+ }), this._remaining = 0, this._timerStart = 0, this._hovered = !1, this._focused = !1, this._labelledBy = null, this._onEnter = () => {
18
18
  this._hovered = !0, this._pause();
19
19
  }, this._onLeave = () => {
20
20
  this._hovered = !1, this._resume();
@@ -32,11 +32,16 @@ var o = class extends e {
32
32
  disconnectedCallback() {
33
33
  super.disconnectedCallback(), clearTimeout(this._timer), this._timer = void 0, this.removeEventListener("mouseenter", this._onEnter), this.removeEventListener("mouseleave", this._onLeave), this.removeEventListener("focusin", this._onFocusIn), this.removeEventListener("focusout", this._onFocusOut), this.removeEventListener("click", this._onClick);
34
34
  }
35
- updated(e) {
36
- super.updated(e), e.has("color") && this._syncRole();
37
- }
38
35
  _syncRole() {
39
- this.setHostAttribute("role", this.color === "error" || this.color === "warning" ? "alert" : "status");
36
+ this.setHostAttribute("role", "group");
37
+ let e = this._parts.one("void-toast-title") ?? this._parts.one("void-toast-description"), t = this.getAttribute("aria-labelledby"), n = this._labelledBy !== null && t === this._labelledBy;
38
+ e && !this.hasAttribute("aria-label") && (t === null || n) ? (this._labelledBy = this._parts.id(e, e.localName), this.setHostAttribute("aria-labelledby", this._labelledBy)) : n && (this._labelledBy = null, this.setHostAttribute("aria-labelledby", null));
39
+ }
40
+ announcement() {
41
+ let e = (e) => e?.textContent?.replace(/\s+/g, " ").trim() ?? "", t = e(this._parts.one("void-toast-title")), n = e(this._parts.one("void-toast-description"));
42
+ if (t || n) return [t, n].filter(Boolean).join(". ");
43
+ let r = this.cloneNode(!0);
44
+ return r.querySelectorAll("void-toast-close, void-toast-actions").forEach((e) => e.remove()), e(r);
40
45
  }
41
46
  _startTimer() {
42
47
  this._timerStart = Date.now(), this._timer = setTimeout(() => this._close("timeout"), this._remaining);
@@ -64,13 +69,41 @@ t([a({
64
69
  })], o.prototype, "color", void 0), t([a({ type: Number })], o.prototype, "duration", void 0), customElements.get("void-toast") || customElements.define("void-toast", o);
65
70
  var s = class extends e {
66
71
  constructor(...e) {
67
- super(...e), this.placement = "bottom-right", this._observer = null;
72
+ super(...e), this.placement = "bottom-right", this._observer = null, this._announceTimers = /* @__PURE__ */ new Map();
68
73
  }
69
74
  connectedCallback() {
70
- super.connectedCallback(), this.setHostAttribute("role", "region"), this.setHostAttribute("aria-label", "Notifications"), this.setHostAttribute("aria-live", "polite"), typeof this.showPopover == "function" && this.setHostAttribute("popover", "manual"), this._observer ??= new MutationObserver((e) => this._syncShown(e.some((e) => e.addedNodes.length > 0))), this._observer.observe(this, { childList: !0 }), this._syncShown(!0);
75
+ super.connectedCallback(), this.setHostAttribute("role", "region"), this.setHostAttribute("aria-label", "Notifications"), typeof this.showPopover == "function" && this.setHostAttribute("popover", "manual"), this._ensureAnnouncers(), this._observer ??= new MutationObserver((e) => {
76
+ this._syncShown(e.some((e) => e.addedNodes.length > 0));
77
+ for (let t of e) for (let e of t.addedNodes) e instanceof o && this._announce(e);
78
+ }), this._observer.observe(this, { childList: !0 }), this._syncShown(!0);
79
+ for (let e of this.querySelectorAll(":scope > void-toast")) this._announce(e);
71
80
  }
72
81
  disconnectedCallback() {
73
82
  super.disconnectedCallback(), this._observer?.disconnect();
83
+ for (let e of this._announceTimers.values()) clearTimeout(e);
84
+ this._announceTimers.clear();
85
+ }
86
+ _ensureAnnouncers() {
87
+ let e = this.shadowRoot ?? this.attachShadow({ mode: "open" });
88
+ if (e.querySelector("slot")) return;
89
+ let t = this.ownerDocument, n = t.createElement("style");
90
+ n.textContent = "[data-void-announcer]{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;pointer-events:none}", e.append(n);
91
+ for (let [n, r] of [["polite", "status"], ["assertive", "alert"]]) {
92
+ let i = t.createElement("div");
93
+ i.setAttribute("data-void-announcer", n), i.setAttribute("role", r), i.setAttribute("aria-live", n), i.setAttribute("aria-atomic", "true"), e.append(i);
94
+ }
95
+ e.append(t.createElement("slot"));
96
+ }
97
+ _region(e) {
98
+ return this.shadowRoot?.querySelector(`[data-void-announcer="${e}"]`) ?? null;
99
+ }
100
+ _announce(e) {
101
+ let t = e.color === "error" || e.color === "warning" ? "assertive" : "polite", n = this._region(t);
102
+ n && (clearTimeout(this._announceTimers.get(n)), n.textContent = "", this._announceTimers.set(n, setTimeout(() => {
103
+ this._announceTimers.delete(n), e.isConnected && (n.textContent = e.announcement(), this._announceTimers.set(n, setTimeout(() => {
104
+ this._announceTimers.delete(n), n.textContent = "";
105
+ }, 5e3)));
106
+ }, 150)));
74
107
  }
75
108
  _syncShown(e) {
76
109
  if (typeof this.showPopover != "function" || !this.isConnected) return;
@@ -1,9 +1,10 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.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 { property as r } from "lit/decorators.js";
4
+ import { r } from "../chunks/keyboard-CEhMSkws.js";
5
+ import { property as i } from "lit/decorators.js";
5
6
  //#region src/components/toggle-group.ts
6
- var i = class extends n(e) {
7
+ var a = class extends n(e) {
7
8
  constructor(...e) {
8
9
  super(...e), this.value = "", this.multiple = !1, this.disabled = !1, this.size = "md", this.color = "default", this.orientation = "horizontal", this._handleChildChange = (e) => {
9
10
  let t = e.target.closest("void-toggle");
@@ -31,11 +32,11 @@ var i = class extends n(e) {
31
32
  }, this._handleKeydown = (e) => {
32
33
  let t = this._toggles().filter((e) => !e.disabled);
33
34
  if (!t.length) return;
34
- let n = this.orientation === "horizontal", r = n ? "ArrowRight" : "ArrowDown", i = n ? "ArrowLeft" : "ArrowUp";
35
- if (e.key !== r && e.key !== i) return;
35
+ let n = this.orientation === "horizontal", i = r(this), a = n ? i.next : "ArrowDown", o = n ? i.prev : "ArrowUp";
36
+ if (e.key !== a && e.key !== o) return;
36
37
  e.preventDefault();
37
- let a = t.indexOf(e.target), o;
38
- o = e.key === r ? a < 0 ? 0 : (a + 1) % t.length : a < 0 ? t.length - 1 : (a - 1 + t.length) % t.length, t[o].focus();
38
+ let s = t.indexOf(e.target), c;
39
+ c = e.key === a ? s < 0 ? 0 : (s + 1) % t.length : s < 0 ? t.length - 1 : (s - 1 + t.length) % t.length, t[c].focus();
39
40
  };
40
41
  }
41
42
  connectedCallback() {
@@ -84,24 +85,24 @@ var i = class extends n(e) {
84
85
  e.pressed = t.includes(n), this.disabled && (e.disabled = !0), e.size = this.size, this.color !== "default" && (e.color = this.color);
85
86
  }
86
87
  };
87
- t([r({
88
+ t([i({
88
89
  type: String,
89
90
  reflect: !0
90
- })], i.prototype, "value", void 0), t([r({
91
+ })], a.prototype, "value", void 0), t([i({
91
92
  type: Boolean,
92
93
  reflect: !0
93
- })], i.prototype, "multiple", void 0), t([r({
94
+ })], a.prototype, "multiple", void 0), t([i({
94
95
  type: Boolean,
95
96
  reflect: !0
96
- })], i.prototype, "disabled", void 0), t([r({
97
+ })], a.prototype, "disabled", void 0), t([i({
97
98
  type: String,
98
99
  reflect: !0
99
- })], i.prototype, "size", void 0), t([r({
100
+ })], a.prototype, "size", void 0), t([i({
100
101
  type: String,
101
102
  reflect: !0
102
- })], i.prototype, "color", void 0), t([r({
103
+ })], a.prototype, "color", void 0), t([i({
103
104
  type: String,
104
105
  reflect: !0
105
- })], i.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", i);
106
+ })], a.prototype, "orientation", void 0), customElements.get("void-toggle-group") || customElements.define("void-toggle-group", a);
106
107
  //#endregion
107
- export { i as VoidToggleGroup };
108
+ export { a as VoidToggleGroup };
@@ -1,4 +1,4 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.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 { i as r, r as i } from "../chunks/form-control-C0vH6gii.js";
@@ -1,7 +1,7 @@
1
- import { t as e } from "../chunks/base-CMruMbxC.js";
1
+ import { t as e } from "../chunks/base-BGrS4eIl.js";
2
2
  import { t } from "../chunks/decorate-CaYbmmmm.js";
3
- import { i as n, n as r } from "../chunks/parts-CMQQop0D.js";
4
- import { t as i } from "../chunks/overlay-BywGMcDW.js";
3
+ import { i as n, n as r } from "../chunks/parts-DI_3VpSy.js";
4
+ import { t as i } from "../chunks/overlay-CH7L4N-h.js";
5
5
  import { property as a } from "lit/decorators.js";
6
6
  //#region src/components/tooltip.ts
7
7
  var o = class extends e {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$comment": "Generated from custom-elements.json by packages/ui/cem/generate.js. Do not edit.",
3
3
  "package": "@voidable/ui",
4
- "version": "0.9.0",
4
+ "version": "0.11.0",
5
5
  "componentCount": 66,
6
6
  "tagCount": 78,
7
7
  "eventNames": [
@@ -15,6 +15,7 @@
15
15
  "void-expand",
16
16
  "void-input",
17
17
  "void-open",
18
+ "void-reject",
18
19
  "void-remove",
19
20
  "void-retry",
20
21
  "void-select",
@@ -832,8 +833,8 @@
832
833
  "tag": "void-bar-chart",
833
834
  "className": "VoidBarChart",
834
835
  "module": "dist/components/bar-chart.js",
835
- "attributes": 5,
836
- "properties": 6,
836
+ "attributes": 7,
837
+ "properties": 7,
837
838
  "events": []
838
839
  },
839
840
  {
@@ -966,12 +967,12 @@
966
967
  "tag": "void-date-picker",
967
968
  "className": "VoidDatePicker",
968
969
  "module": "dist/components/calendar.js",
969
- "attributes": 13,
970
- "properties": 13,
970
+ "attributes": 14,
971
+ "properties": 14,
971
972
  "events": [
973
+ "void-change",
972
974
  "void-open",
973
- "void-close",
974
- "void-change"
975
+ "void-close"
975
976
  ]
976
977
  },
977
978
  {
@@ -997,8 +998,8 @@
997
998
  "tag": "void-donut-chart",
998
999
  "className": "VoidDonutChart",
999
1000
  "module": "dist/components/donut-chart.js",
1000
- "attributes": 7,
1001
- "properties": 8,
1001
+ "attributes": 9,
1002
+ "properties": 9,
1002
1003
  "events": []
1003
1004
  },
1004
1005
  {
@@ -1071,6 +1072,7 @@
1071
1072
  "attributes": 7,
1072
1073
  "properties": 7,
1073
1074
  "events": [
1075
+ "void-reject",
1074
1076
  "void-change"
1075
1077
  ]
1076
1078
  },
@@ -1078,8 +1080,8 @@
1078
1080
  "tag": "void-gauge",
1079
1081
  "className": "VoidGauge",
1080
1082
  "module": "dist/components/gauge.js",
1081
- "attributes": 17,
1082
- "properties": 19,
1083
+ "attributes": 20,
1084
+ "properties": 20,
1083
1085
  "events": []
1084
1086
  },
1085
1087
  {
@@ -1127,8 +1129,8 @@
1127
1129
  "tag": "void-line-chart",
1128
1130
  "className": "VoidLineChart",
1129
1131
  "module": "dist/components/line-chart.js",
1130
- "attributes": 5,
1131
- "properties": 6,
1132
+ "attributes": 7,
1133
+ "properties": 7,
1132
1134
  "events": []
1133
1135
  },
1134
1136
  {