@treeui/vue 0.13.0 → 0.15.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 (184) hide show
  1. package/dist/components/TAppShell.cjs.map +1 -1
  2. package/dist/components/TAppShell.js.map +1 -1
  3. package/dist/components/TAppShell.vue.d.ts +25 -0
  4. package/dist/components/TAppShell.vue.d.ts.map +1 -1
  5. package/dist/components/TAppShell.vue_vue_type_script_setup_true_lang.cjs +1 -1
  6. package/dist/components/TAppShell.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  7. package/dist/components/TAppShell.vue_vue_type_script_setup_true_lang.js +166 -104
  8. package/dist/components/TAppShell.vue_vue_type_script_setup_true_lang.js.map +1 -1
  9. package/dist/components/TButton.cjs.map +1 -1
  10. package/dist/components/TButton.js.map +1 -1
  11. package/dist/components/TButton.vue.d.ts +8 -2
  12. package/dist/components/TButton.vue.d.ts.map +1 -1
  13. package/dist/components/TButton.vue_vue_type_script_setup_true_lang.cjs +1 -1
  14. package/dist/components/TButton.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  15. package/dist/components/TButton.vue_vue_type_script_setup_true_lang.js +12 -3
  16. package/dist/components/TButton.vue_vue_type_script_setup_true_lang.js.map +1 -1
  17. package/dist/components/TChart.cjs.map +1 -1
  18. package/dist/components/TChart.js.map +1 -1
  19. package/dist/components/TChart.vue.d.ts.map +1 -1
  20. package/dist/components/TChart.vue_vue_type_script_setup_true_lang.cjs +1 -1
  21. package/dist/components/TChart.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  22. package/dist/components/TChart.vue_vue_type_script_setup_true_lang.js +58 -58
  23. package/dist/components/TChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  24. package/dist/components/TColorSwatch.cjs +2 -0
  25. package/dist/components/TColorSwatch.cjs.map +1 -0
  26. package/dist/components/TColorSwatch.js +7 -0
  27. package/dist/components/TColorSwatch.js.map +1 -0
  28. package/dist/components/TColorSwatch.vue.d.ts +33 -0
  29. package/dist/components/TColorSwatch.vue.d.ts.map +1 -0
  30. package/dist/components/TColorSwatch.vue_vue_type_script_setup_true_lang.cjs +2 -0
  31. package/dist/components/TColorSwatch.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  32. package/dist/components/TColorSwatch.vue_vue_type_script_setup_true_lang.js +63 -0
  33. package/dist/components/TColorSwatch.vue_vue_type_script_setup_true_lang.js.map +1 -0
  34. package/dist/components/TDropdown.vue.d.ts +1 -1
  35. package/dist/components/TDropdown.vue.d.ts.map +1 -1
  36. package/dist/components/TFileUpload.cjs.map +1 -1
  37. package/dist/components/TFileUpload.js.map +1 -1
  38. package/dist/components/TFileUpload.vue.d.ts +77 -10
  39. package/dist/components/TFileUpload.vue.d.ts.map +1 -1
  40. package/dist/components/TFileUpload.vue_vue_type_script_setup_true_lang.cjs +1 -1
  41. package/dist/components/TFileUpload.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  42. package/dist/components/TFileUpload.vue_vue_type_script_setup_true_lang.js +393 -144
  43. package/dist/components/TFileUpload.vue_vue_type_script_setup_true_lang.js.map +1 -1
  44. package/dist/components/TInput.cjs.map +1 -1
  45. package/dist/components/TInput.js.map +1 -1
  46. package/dist/components/TInput.vue.d.ts +4 -1
  47. package/dist/components/TInput.vue.d.ts.map +1 -1
  48. package/dist/components/TInput.vue_vue_type_script_setup_true_lang.cjs +1 -1
  49. package/dist/components/TInput.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  50. package/dist/components/TInput.vue_vue_type_script_setup_true_lang.js +2 -0
  51. package/dist/components/TInput.vue_vue_type_script_setup_true_lang.js.map +1 -1
  52. package/dist/components/TKbd.cjs +2 -0
  53. package/dist/components/TKbd.cjs.map +1 -0
  54. package/dist/components/TKbd.js +7 -0
  55. package/dist/components/TKbd.js.map +1 -0
  56. package/dist/components/TKbd.vue.d.ts +18 -0
  57. package/dist/components/TKbd.vue.d.ts.map +1 -0
  58. package/dist/components/TKbd.vue_vue_type_script_setup_true_lang.cjs +2 -0
  59. package/dist/components/TKbd.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  60. package/dist/components/TKbd.vue_vue_type_script_setup_true_lang.js +12 -0
  61. package/dist/components/TKbd.vue_vue_type_script_setup_true_lang.js.map +1 -0
  62. package/dist/components/TNavMenu.cjs.map +1 -1
  63. package/dist/components/TNavMenu.js.map +1 -1
  64. package/dist/components/TNavMenu.vue.d.ts +9 -0
  65. package/dist/components/TNavMenu.vue.d.ts.map +1 -1
  66. package/dist/components/TNavMenu.vue_vue_type_script_setup_true_lang.cjs +1 -1
  67. package/dist/components/TNavMenu.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  68. package/dist/components/TNavMenu.vue_vue_type_script_setup_true_lang.js +67 -55
  69. package/dist/components/TNavMenu.vue_vue_type_script_setup_true_lang.js.map +1 -1
  70. package/dist/components/TPage.cjs +2 -0
  71. package/dist/components/TPage.cjs.map +1 -0
  72. package/dist/components/TPage.js +7 -0
  73. package/dist/components/TPage.js.map +1 -0
  74. package/dist/components/TPage.vue.d.ts +35 -0
  75. package/dist/components/TPage.vue.d.ts.map +1 -0
  76. package/dist/components/TPage.vue_vue_type_script_setup_true_lang.cjs +2 -0
  77. package/dist/components/TPage.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  78. package/dist/components/TPage.vue_vue_type_script_setup_true_lang.js +49 -0
  79. package/dist/components/TPage.vue_vue_type_script_setup_true_lang.js.map +1 -0
  80. package/dist/components/TPageHeader.cjs +2 -0
  81. package/dist/components/TPageHeader.cjs.map +1 -0
  82. package/dist/components/TPageHeader.js +7 -0
  83. package/dist/components/TPageHeader.js.map +1 -0
  84. package/dist/components/TPageHeader.vue.d.ts +40 -0
  85. package/dist/components/TPageHeader.vue.d.ts.map +1 -0
  86. package/dist/components/TPageHeader.vue_vue_type_script_setup_true_lang.cjs +2 -0
  87. package/dist/components/TPageHeader.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  88. package/dist/components/TPageHeader.vue_vue_type_script_setup_true_lang.js +54 -0
  89. package/dist/components/TPageHeader.vue_vue_type_script_setup_true_lang.js.map +1 -0
  90. package/dist/components/TPopover.vue.d.ts +1 -1
  91. package/dist/components/TPopover.vue.d.ts.map +1 -1
  92. package/dist/components/TSelect.cjs.map +1 -1
  93. package/dist/components/TSelect.js.map +1 -1
  94. package/dist/components/TSelect.vue.d.ts +4 -1
  95. package/dist/components/TSelect.vue.d.ts.map +1 -1
  96. package/dist/components/TSelect.vue_vue_type_script_setup_true_lang.cjs +1 -1
  97. package/dist/components/TSelect.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  98. package/dist/components/TSelect.vue_vue_type_script_setup_true_lang.js +2 -0
  99. package/dist/components/TSelect.vue_vue_type_script_setup_true_lang.js.map +1 -1
  100. package/dist/components/TSidebar.vue_vue_type_script_setup_true_lang.cjs +1 -1
  101. package/dist/components/TSidebar.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  102. package/dist/components/TSidebar.vue_vue_type_script_setup_true_lang.js +1 -4
  103. package/dist/components/TSidebar.vue_vue_type_script_setup_true_lang.js.map +1 -1
  104. package/dist/components/TSpacer.cjs +2 -0
  105. package/dist/components/TSpacer.cjs.map +1 -0
  106. package/dist/components/TSpacer.js +7 -0
  107. package/dist/components/TSpacer.js.map +1 -0
  108. package/dist/components/TSpacer.vue.d.ts +8 -0
  109. package/dist/components/TSpacer.vue.d.ts.map +1 -0
  110. package/dist/components/TSpacer.vue_vue_type_script_setup_true_lang.cjs +2 -0
  111. package/dist/components/TSpacer.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  112. package/dist/components/TSpacer.vue_vue_type_script_setup_true_lang.js +16 -0
  113. package/dist/components/TSpacer.vue_vue_type_script_setup_true_lang.js.map +1 -0
  114. package/dist/components/TSplit.cjs +2 -0
  115. package/dist/components/TSplit.cjs.map +1 -0
  116. package/dist/components/TSplit.js +7 -0
  117. package/dist/components/TSplit.js.map +1 -0
  118. package/dist/components/TSplit.vue.d.ts +38 -0
  119. package/dist/components/TSplit.vue.d.ts.map +1 -0
  120. package/dist/components/TSplit.vue_vue_type_script_setup_true_lang.cjs +2 -0
  121. package/dist/components/TSplit.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  122. package/dist/components/TSplit.vue_vue_type_script_setup_true_lang.js +43 -0
  123. package/dist/components/TSplit.vue_vue_type_script_setup_true_lang.js.map +1 -0
  124. package/dist/components/TStack.cjs.map +1 -1
  125. package/dist/components/TStack.js.map +1 -1
  126. package/dist/components/TStack.vue.d.ts +3 -0
  127. package/dist/components/TStack.vue.d.ts.map +1 -1
  128. package/dist/components/TStack.vue_vue_type_script_setup_true_lang.cjs +1 -1
  129. package/dist/components/TStack.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  130. package/dist/components/TStack.vue_vue_type_script_setup_true_lang.js +6 -1
  131. package/dist/components/TStack.vue_vue_type_script_setup_true_lang.js.map +1 -1
  132. package/dist/components/TStackItem.cjs +2 -0
  133. package/dist/components/TStackItem.cjs.map +1 -0
  134. package/dist/components/TStackItem.js +7 -0
  135. package/dist/components/TStackItem.js.map +1 -0
  136. package/dist/components/TStackItem.vue.d.ts +38 -0
  137. package/dist/components/TStackItem.vue.d.ts.map +1 -0
  138. package/dist/components/TStackItem.vue_vue_type_script_setup_true_lang.cjs +2 -0
  139. package/dist/components/TStackItem.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  140. package/dist/components/TStackItem.vue_vue_type_script_setup_true_lang.js +45 -0
  141. package/dist/components/TStackItem.vue_vue_type_script_setup_true_lang.js.map +1 -0
  142. package/dist/components/TText.cjs +2 -0
  143. package/dist/components/TText.cjs.map +1 -0
  144. package/dist/components/TText.js +7 -0
  145. package/dist/components/TText.js.map +1 -0
  146. package/dist/components/TText.vue.d.ts +39 -0
  147. package/dist/components/TText.vue.d.ts.map +1 -0
  148. package/dist/components/TText.vue_vue_type_script_setup_true_lang.cjs +2 -0
  149. package/dist/components/TText.vue_vue_type_script_setup_true_lang.cjs.map +1 -0
  150. package/dist/components/TText.vue_vue_type_script_setup_true_lang.js +32 -0
  151. package/dist/components/TText.vue_vue_type_script_setup_true_lang.js.map +1 -0
  152. package/dist/components/TTextarea.cjs.map +1 -1
  153. package/dist/components/TTextarea.js.map +1 -1
  154. package/dist/components/TTextarea.vue.d.ts +4 -1
  155. package/dist/components/TTextarea.vue.d.ts.map +1 -1
  156. package/dist/components/TTextarea.vue_vue_type_script_setup_true_lang.cjs +1 -1
  157. package/dist/components/TTextarea.vue_vue_type_script_setup_true_lang.cjs.map +1 -1
  158. package/dist/components/TTextarea.vue_vue_type_script_setup_true_lang.js +2 -0
  159. package/dist/components/TTextarea.vue_vue_type_script_setup_true_lang.js.map +1 -1
  160. package/dist/components/index.d.ts +12 -1
  161. package/dist/components/index.d.ts.map +1 -1
  162. package/dist/composables/useTheme.cjs +2 -0
  163. package/dist/composables/useTheme.cjs.map +1 -0
  164. package/dist/composables/useTheme.d.ts +38 -0
  165. package/dist/composables/useTheme.d.ts.map +1 -0
  166. package/dist/composables/useTheme.js +54 -0
  167. package/dist/composables/useTheme.js.map +1 -0
  168. package/dist/index.cjs +1 -1
  169. package/dist/index.d.ts +2 -0
  170. package/dist/index.d.ts.map +1 -1
  171. package/dist/index.js +64 -55
  172. package/dist/plugin.cjs +1 -1
  173. package/dist/plugin.cjs.map +1 -1
  174. package/dist/plugin.d.ts.map +1 -1
  175. package/dist/plugin.js +113 -97
  176. package/dist/plugin.js.map +1 -1
  177. package/dist/style.css +1 -1
  178. package/dist/types/contracts.cjs +1 -1
  179. package/dist/types/contracts.cjs.map +1 -1
  180. package/dist/types/contracts.d.ts +8 -1
  181. package/dist/types/contracts.d.ts.map +1 -1
  182. package/dist/types/contracts.js +8 -2
  183. package/dist/types/contracts.js.map +1 -1
  184. package/package.json +2 -2
@@ -1,42 +1,42 @@
1
1
  import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, createElementVNode as i, createTextVNode as a, defineComponent as o, guardReactiveProps as s, normalizeClass as c, normalizeProps as l, normalizeStyle as u, onBeforeUnmount as d, onMounted as f, openBlock as p, ref as m, renderList as h, renderSlot as g, toDisplayString as _, vShow as v, withDirectives as y } from "vue";
2
- import { buildAreaPath as b, buildLinePath as x, linearScale as S, niceScale as C } from "@treeui/utils";
2
+ import { buildAreaPath as b, buildLinePath as x, linearScale as S, niceScale as ee } from "@treeui/utils";
3
3
  //#region src/components/TChart.vue?vue&type=script&setup=true&lang.ts
4
- var ee = {
4
+ var te = {
5
5
  key: 0,
6
6
  class: "t-chart__loading"
7
- }, te = {
7
+ }, ne = {
8
8
  key: 1,
9
9
  class: "t-chart__empty"
10
- }, ne = [
10
+ }, re = [
11
11
  "width",
12
12
  "height",
13
13
  "viewBox"
14
- ], re = { class: "t-chart__grid" }, ie = [
14
+ ], ie = { class: "t-chart__grid" }, ae = [
15
15
  "x1",
16
16
  "x2",
17
17
  "y1",
18
18
  "y2"
19
- ], ae = ["x", "y"], oe = { class: "t-chart__areas" }, se = ["d"], ce = { class: "t-chart__bars" }, le = [
19
+ ], oe = ["x", "y"], se = { class: "t-chart__areas" }, ce = ["d"], le = { class: "t-chart__bars" }, ue = [
20
20
  "x",
21
21
  "y",
22
22
  "width",
23
23
  "height",
24
24
  "rx"
25
- ], ue = { class: "t-chart__lines" }, de = ["d"], fe = ["cx", "cy"], pe = {
25
+ ], de = { class: "t-chart__lines" }, fe = ["d"], pe = ["cx", "cy"], me = {
26
26
  key: 0,
27
27
  class: "t-chart__hover"
28
- }, me = [
28
+ }, he = [
29
29
  "x1",
30
30
  "x2",
31
31
  "y1",
32
32
  "y2"
33
- ], he = ["cx", "cy"], ge = {
33
+ ], ge = ["cx", "cy"], _e = {
34
34
  key: 1,
35
35
  class: "t-chart__x-axis"
36
- }, _e = ["x", "y"], ve = { class: "t-chart__tooltip-label" }, ye = { class: "t-chart__tooltip-list" }, be = { class: "t-chart__tooltip-name" }, xe = { class: "t-chart__tooltip-value" }, w = {
36
+ }, ve = ["x", "y"], ye = { class: "t-chart__tooltip-label" }, be = { class: "t-chart__tooltip-list" }, xe = { class: "t-chart__tooltip-name" }, Se = { class: "t-chart__tooltip-value" }, C = {
37
37
  key: 0,
38
38
  class: "t-chart__legend"
39
- }, T = { class: "t-chart__a11y t-visually-hidden" }, E = { scope: "row" }, D = 24, O = 2, k = /*@__PURE__*/ o({
39
+ }, w = { class: "t-visually-hidden" }, T = { class: "t-chart__a11y" }, E = { scope: "row" }, D = 24, O = 2, k = /*@__PURE__*/ o({
40
40
  __name: "TChart",
41
41
  props: {
42
42
  type: { default: "line" },
@@ -102,16 +102,16 @@ var ee = {
102
102
  t && (N.value = t);
103
103
  }), P.observe(e)));
104
104
  }), d(() => P?.disconnect());
105
- let F = t(() => A.series.filter((e) => e.data.length > 0)), I = t(() => Math.max(0, ...F.value.map((e) => e.data.length))), L = t(() => Array.from({ length: I.value }, (e, t) => t)), R = t(() => F.value.length > 0 && I.value > 0), Se = t(() => A.showLegend ?? F.value.length > 1), z = (e, t) => t.color ?? `var(--tree-color-chart-${e % 8 + 1})`, B = t(() => F.value.map((e, t) => ({
105
+ let F = t(() => A.series.filter((e) => e.data.length > 0)), I = t(() => Math.max(0, ...F.value.map((e) => e.data.length))), L = t(() => Array.from({ length: I.value }, (e, t) => t)), R = t(() => F.value.length > 0 && I.value > 0), Ce = t(() => A.showLegend ?? F.value.length > 1), z = (e, t) => t.color ?? `var(--tree-color-chart-${e % 8 + 1})`, B = t(() => F.value.map((e, t) => ({
106
106
  name: e.name,
107
107
  color: z(t, e)
108
- }))), V = (e) => A.valueFormat ? A.valueFormat(e) : Math.abs(e) >= 1e3 ? e.toLocaleString("en-US") : `${e}`, Ce = t(() => ({
108
+ }))), V = (e) => A.valueFormat ? A.valueFormat(e) : Math.abs(e) >= 1e3 ? e.toLocaleString("en-US") : `${e}`, we = t(() => ({
109
109
  top: 12,
110
110
  right: 12,
111
111
  bottom: A.showXAxis && A.labels.length ? 28 : 10,
112
112
  left: A.showYAxis ? 44 : 10
113
113
  })), H = t(() => {
114
- let { top: e, right: t, bottom: n, left: r } = Ce.value;
114
+ let { top: e, right: t, bottom: n, left: r } = we.value;
115
115
  return {
116
116
  left: r,
117
117
  right: N.value - t,
@@ -124,9 +124,9 @@ var ee = {
124
124
  return this.bottom - this.top;
125
125
  }
126
126
  };
127
- }), we = t(() => !A.stacked || A.type !== "bar" ? [] : Array.from({ length: I.value }, (e, t) => F.value.reduce((e, n) => e + Math.max(0, n.data[t] ?? 0), 0))), U = t(() => {
128
- let e = A.type === "bar" || A.type === "area", t = F.value.flatMap((e) => e.data), n = A.stacked && A.type === "bar" ? we.value : t, r = n.length ? Math.min(...n) : 0, i = n.length ? Math.max(...n) : 1, a = A.minY ?? (e ? Math.min(0, r) : r);
129
- return C(a, A.maxY ?? Math.max(i, a + 1), A.yTicks);
127
+ }), Te = t(() => !A.stacked || A.type !== "bar" ? [] : Array.from({ length: I.value }, (e, t) => F.value.reduce((e, n) => e + Math.max(0, n.data[t] ?? 0), 0))), U = t(() => {
128
+ let e = A.type === "bar" || A.type === "area", t = F.value.flatMap((e) => e.data), n = A.stacked && A.type === "bar" ? Te.value : t, r = n.length ? Math.min(...n) : 0, i = n.length ? Math.max(...n) : 1, a = A.minY ?? (e ? Math.min(0, r) : r);
129
+ return ee(a, A.maxY ?? Math.max(i, a + 1), A.yTicks);
130
130
  }), W = t(() => S([U.value.min, U.value.max], [H.value.bottom, H.value.top])), G = t(() => W.value(Math.max(U.value.min, 0))), K = (e) => {
131
131
  let t = I.value;
132
132
  return t <= 1 ? H.value.left + H.value.innerWidth / 2 : H.value.left + e / (t - 1) * H.value.innerWidth;
@@ -141,7 +141,7 @@ var ee = {
141
141
  area: A.type === "area" ? b(n, H.value.bottom, A.smooth) : "",
142
142
  points: n
143
143
  };
144
- })), Te = t(() => {
144
+ })), Ee = t(() => {
145
145
  if (A.type !== "bar") return [];
146
146
  let e = [], t = q.value, n = Math.min(t * .72, D * F.value.length + O);
147
147
  for (let t = 0; t < I.value; t += 1) {
@@ -179,11 +179,11 @@ var ee = {
179
179
  }
180
180
  }
181
181
  return e;
182
- }), Ee = t(() => U.value.ticks.map((e) => ({
182
+ }), De = t(() => U.value.ticks.map((e) => ({
183
183
  value: e,
184
184
  y: W.value(e),
185
185
  label: V(e)
186
- }))), De = t(() => {
186
+ }))), Oe = t(() => {
187
187
  if (!A.showXAxis) return [];
188
188
  let e = I.value, t = Math.max(2, Math.floor(H.value.innerWidth / 52)), n = Math.max(1, Math.ceil(e / t));
189
189
  return A.labels.slice(0, e).map((t, r) => ({
@@ -191,7 +191,7 @@ var ee = {
191
191
  x: Y(r),
192
192
  show: r % n === 0 || r === e - 1
193
193
  }));
194
- }), Z = m(null), Oe = (e) => {
194
+ }), Z = m(null), Q = (e) => {
195
195
  let t = M.value;
196
196
  if (!t) return null;
197
197
  let n = e - t.getBoundingClientRect().left, r = I.value;
@@ -202,9 +202,9 @@ var ee = {
202
202
  }
203
203
  let i = (n - H.value.left) / Math.max(1, H.value.innerWidth);
204
204
  return Math.min(r - 1, Math.max(0, Math.round(i * (r - 1))));
205
- }, Q = (e) => {
206
- !A.showTooltip || !R.value || (Z.value = Oe(e.clientX));
207
- }, ke = () => {
205
+ }, ke = (e) => {
206
+ !A.showTooltip || !R.value || (Z.value = Q(e.clientX));
207
+ }, Ae = () => {
208
208
  Z.value = null;
209
209
  }, $ = t(() => {
210
210
  let e = Z.value;
@@ -217,7 +217,7 @@ var ee = {
217
217
  color: z(n, t)
218
218
  }))
219
219
  };
220
- }), Ae = t(() => {
220
+ }), je = t(() => {
221
221
  let e = Z.value;
222
222
  if (e === null) return {};
223
223
  let t = Y(e);
@@ -225,16 +225,16 @@ var ee = {
225
225
  left: `${Math.min(Math.max(t, 64), N.value - 64)}px`,
226
226
  top: `${H.value.top}px`
227
227
  };
228
- }), je = t(() => {
228
+ }), Me = t(() => {
229
229
  let e = Z.value;
230
230
  return e === null || A.type === "bar" ? [] : X.value.map((t) => ({
231
231
  x: t.points[e]?.x ?? 0,
232
232
  y: t.points[e]?.y ?? 0,
233
233
  color: t.color
234
234
  }));
235
- }), Me = () => {
235
+ }), Ne = () => {
236
236
  $.value && j("point-click", $.value);
237
- }, Ne = t(() => A.ariaLabel ?? `${A.type} chart with ${F.value.length} series`), Pe = t(() => [
237
+ }, Pe = t(() => A.ariaLabel ?? `${A.type} chart with ${F.value.length} series`), Fe = t(() => [
238
238
  "t-chart",
239
239
  `t-chart--${A.type}`,
240
240
  {
@@ -242,13 +242,13 @@ var ee = {
242
242
  "is-loading": A.loading
243
243
  }
244
244
  ]);
245
- return (t, d) => (p(), r("div", { class: c(Pe.value) }, [
245
+ return (t, d) => (p(), r("div", { class: c(Fe.value) }, [
246
246
  i("div", {
247
247
  ref_key: "canvasRef",
248
248
  ref: M,
249
249
  class: "t-chart__canvas",
250
250
  style: u({ height: `${o.height}px` })
251
- }, [o.loading ? (p(), r("div", ee, [(p(), r(e, null, h(5, (e) => i("span", {
251
+ }, [o.loading ? (p(), r("div", te, [(p(), r(e, null, h(5, (e) => i("span", {
252
252
  key: e,
253
253
  class: "t-chart__loading-bar",
254
254
  style: u({ height: `${30 + e * 37 % 60}%` })
@@ -258,30 +258,30 @@ var ee = {
258
258
  height: o.height,
259
259
  viewBox: `0 0 ${N.value} ${o.height}`,
260
260
  "aria-hidden": "true",
261
- onPointermove: Q,
262
- onPointerleave: ke,
263
- onClick: Me
261
+ onPointermove: ke,
262
+ onPointerleave: Ae,
263
+ onClick: Ne
264
264
  }, [
265
- i("g", re, [(p(!0), r(e, null, h(Ee.value, (t) => (p(), r(e, { key: t.value }, [o.showGrid ? (p(), r("line", {
265
+ i("g", ie, [(p(!0), r(e, null, h(De.value, (t) => (p(), r(e, { key: t.value }, [o.showGrid ? (p(), r("line", {
266
266
  key: 0,
267
267
  class: "t-chart__gridline",
268
268
  x1: H.value.left,
269
269
  x2: H.value.right,
270
270
  y1: t.y,
271
271
  y2: t.y
272
- }, null, 8, ie)) : n("", !0), o.showYAxis ? (p(), r("text", {
272
+ }, null, 8, ae)) : n("", !0), o.showYAxis ? (p(), r("text", {
273
273
  key: 1,
274
274
  class: "t-chart__axis-label t-chart__axis-label--y",
275
275
  x: H.value.left - 8,
276
276
  y: t.y
277
- }, _(t.label), 9, ae)) : n("", !0)], 64))), 128))]),
278
- i("g", oe, [(p(!0), r(e, null, h(X.value, (e, t) => y((p(), r("path", {
277
+ }, _(t.label), 9, oe)) : n("", !0)], 64))), 128))]),
278
+ i("g", se, [(p(!0), r(e, null, h(X.value, (e, t) => y((p(), r("path", {
279
279
  key: `area-${t}`,
280
280
  class: "t-chart__area",
281
281
  d: e.area,
282
282
  style: u({ color: e.color })
283
- }, null, 12, se)), [[v, o.type === "area"]])), 128))]),
284
- i("g", ce, [(p(!0), r(e, null, h(Te.value, (e, t) => (p(), r("rect", {
283
+ }, null, 12, ce)), [[v, o.type === "area"]])), 128))]),
284
+ i("g", le, [(p(!0), r(e, null, h(Ee.value, (e, t) => (p(), r("rect", {
285
285
  key: `bar-${t}`,
286
286
  class: c(["t-chart__bar", { "is-active": Z.value === e.index }]),
287
287
  x: e.x,
@@ -293,47 +293,47 @@ var ee = {
293
293
  color: e.color,
294
294
  animationDelay: `${e.index * 40}ms`
295
295
  })
296
- }, null, 14, le))), 128))]),
297
- i("g", ue, [(p(!0), r(e, null, h(X.value, (t, i) => (p(), r(e, { key: `line-${i}` }, [o.type === "bar" ? n("", !0) : (p(), r("path", {
296
+ }, null, 14, ue))), 128))]),
297
+ i("g", de, [(p(!0), r(e, null, h(X.value, (t, i) => (p(), r(e, { key: `line-${i}` }, [o.type === "bar" ? n("", !0) : (p(), r("path", {
298
298
  key: 0,
299
299
  class: "t-chart__line",
300
300
  d: t.line,
301
301
  "path-length": "1",
302
302
  style: u({ color: t.color })
303
- }, null, 12, de)), o.showPoints && o.type !== "bar" ? (p(!0), r(e, { key: 1 }, h(t.points, (e, n) => (p(), r("circle", {
303
+ }, null, 12, fe)), o.showPoints && o.type !== "bar" ? (p(!0), r(e, { key: 1 }, h(t.points, (e, n) => (p(), r("circle", {
304
304
  key: `point-${i}-${n}`,
305
305
  class: "t-chart__point",
306
306
  cx: e.x,
307
307
  cy: e.y,
308
308
  r: "3",
309
309
  style: u({ color: t.color })
310
- }, null, 12, fe))), 128)) : n("", !0)], 64))), 128))]),
311
- Z.value !== null && o.showTooltip ? (p(), r("g", pe, [i("line", {
310
+ }, null, 12, pe))), 128)) : n("", !0)], 64))), 128))]),
311
+ Z.value !== null && o.showTooltip ? (p(), r("g", me, [i("line", {
312
312
  class: "t-chart__crosshair",
313
313
  x1: Y(Z.value),
314
314
  x2: Y(Z.value),
315
315
  y1: H.value.top,
316
316
  y2: H.value.bottom
317
- }, null, 8, me), (p(!0), r(e, null, h(je.value, (e, t) => (p(), r("circle", {
317
+ }, null, 8, he), (p(!0), r(e, null, h(Me.value, (e, t) => (p(), r("circle", {
318
318
  key: `marker-${t}`,
319
319
  class: "t-chart__marker",
320
320
  cx: e.x,
321
321
  cy: e.y,
322
322
  r: "4",
323
323
  style: u({ color: e.color })
324
- }, null, 12, he))), 128))])) : n("", !0),
325
- o.showXAxis ? (p(), r("g", ge, [(p(!0), r(e, null, h(De.value, (e, t) => y((p(), r("text", {
324
+ }, null, 12, ge))), 128))])) : n("", !0),
325
+ o.showXAxis ? (p(), r("g", _e, [(p(!0), r(e, null, h(Oe.value, (e, t) => y((p(), r("text", {
326
326
  key: `x-${t}`,
327
327
  class: "t-chart__axis-label t-chart__axis-label--x",
328
328
  x: e.x,
329
329
  y: o.height - 8
330
- }, _(e.label), 9, _e)), [[v, e.show]])), 128))])) : n("", !0)
331
- ], 40, ne)), o.showTooltip && $.value ? (p(), r("div", {
330
+ }, _(e.label), 9, ve)), [[v, e.show]])), 128))])) : n("", !0)
331
+ ], 40, re)), o.showTooltip && $.value ? (p(), r("div", {
332
332
  key: 0,
333
333
  class: "t-chart__tooltip",
334
- style: u(Ae.value),
334
+ style: u(je.value),
335
335
  role: "presentation"
336
- }, [g(t.$slots, "tooltip", l(s($.value)), () => [i("p", ve, _($.value.label), 1), i("ul", ye, [(p(!0), r(e, null, h($.value.values, (e, t) => (p(), r("li", {
336
+ }, [g(t.$slots, "tooltip", l(s($.value)), () => [i("p", ye, _($.value.label), 1), i("ul", be, [(p(!0), r(e, null, h($.value.values, (e, t) => (p(), r("li", {
337
337
  key: t,
338
338
  class: "t-chart__tooltip-item"
339
339
  }, [
@@ -342,10 +342,10 @@ var ee = {
342
342
  style: u({ background: e.color }),
343
343
  "aria-hidden": "true"
344
344
  }, null, 4),
345
- i("span", be, _(e.name), 1),
346
- i("span", xe, _(V(e.value)), 1)
347
- ]))), 128))])])], 4)) : n("", !0)], 64)) : (p(), r("div", te, [g(t.$slots, "empty", {}, () => [d[0] ||= a(" No data to display ", -1)])]))], 4),
348
- Se.value && R.value ? (p(), r("div", w, [g(t.$slots, "legend", { series: B.value }, () => [(p(!0), r(e, null, h(B.value, (e, t) => (p(), r("span", {
345
+ i("span", xe, _(e.name), 1),
346
+ i("span", Se, _(V(e.value)), 1)
347
+ ]))), 128))])])], 4)) : n("", !0)], 64)) : (p(), r("div", ne, [g(t.$slots, "empty", {}, () => [d[0] ||= a(" No data to display ", -1)])]))], 4),
348
+ Ce.value && R.value ? (p(), r("div", C, [g(t.$slots, "legend", { series: B.value }, () => [(p(!0), r(e, null, h(B.value, (e, t) => (p(), r("span", {
349
349
  key: t,
350
350
  class: "t-chart__legend-item"
351
351
  }, [i("span", {
@@ -353,14 +353,14 @@ var ee = {
353
353
  style: u({ background: e.color }),
354
354
  "aria-hidden": "true"
355
355
  }, null, 4), a(" " + _(e.name), 1)]))), 128))])])) : n("", !0),
356
- i("table", T, [
357
- i("caption", null, _(Ne.value), 1),
356
+ i("div", w, [i("table", T, [
357
+ i("caption", null, _(Pe.value), 1),
358
358
  i("thead", null, [i("tr", null, [d[1] ||= i("th", { scope: "col" }, " Series ", -1), (p(!0), r(e, null, h(L.value, (e) => (p(), r("th", {
359
359
  key: e,
360
360
  scope: "col"
361
361
  }, _(o.labels[e] ?? ""), 1))), 128))])]),
362
362
  i("tbody", null, [(p(!0), r(e, null, h(F.value, (t, n) => (p(), r("tr", { key: n }, [i("th", E, _(t.name), 1), (p(!0), r(e, null, h(L.value, (e) => (p(), r("td", { key: e }, _(t.data[e] === void 0 ? "" : V(t.data[e])), 1))), 128))]))), 128))])
363
- ])
363
+ ])])
364
364
  ], 2));
365
365
  }
366
366
  });
@@ -1 +1 @@
1
- {"version":3,"file":"TChart.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/TChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue';\nimport {\n buildAreaPath,\n buildLinePath,\n linearScale,\n niceScale,\n type ChartPoint,\n} from '@treeui/utils';\n\nexport type TChartType = 'line' | 'area' | 'bar';\n\nexport interface TChartSeries {\n /** Legend/tooltip name for the series. */\n name: string;\n /** One value per category, aligned to `labels`. */\n data: number[];\n /** Override the series color; defaults to a chart palette token. */\n color?: string;\n}\n\nexport interface TChartActivePayload {\n index: number;\n label: string;\n values: Array<{ name: string; value: number; color: string }>;\n}\n\nconst props = withDefaults(\n defineProps<{\n /** Visual form of the plot. */\n type?: TChartType;\n /** One or more data series. */\n series?: TChartSeries[];\n /** Category labels for the x-axis, aligned to each series' data. */\n labels?: string[];\n /** Plot height in px (width is fluid). */\n height?: number;\n /** Smooth (curved) line/area. */\n smooth?: boolean;\n /**\n * Stack bar series on top of each other instead of grouping side by side.\n * Negative values are clamped to 0 in stacked mode (grouped mode renders them).\n */\n stacked?: boolean;\n /** Draw horizontal gridlines. */\n showGrid?: boolean;\n /** Show the legend. Defaults to on when there is more than one series. */\n showLegend?: boolean;\n /** Show x-axis category labels. */\n showXAxis?: boolean;\n /** Show y-axis value ticks. */\n showYAxis?: boolean;\n /** Show the hover crosshair + tooltip. */\n showTooltip?: boolean;\n /** Always render markers on line/area points (not just on hover). */\n showPoints?: boolean;\n /** Target number of y-axis ticks. */\n yTicks?: number;\n /** Format axis + tooltip values. */\n valueFormat?: (value: number) => string;\n /** Force the low end of the y domain. */\n minY?: number;\n /** Force the high end of the y domain. */\n maxY?: number;\n /** Animate marks on first render (respects prefers-reduced-motion). */\n animated?: boolean;\n /** Render skeleton placeholders instead of the plot. */\n loading?: boolean;\n /** Accessible summary of the chart. */\n ariaLabel?: string;\n }>(),\n {\n type: 'line',\n series: () => [],\n labels: () => [],\n height: 260,\n smooth: false,\n stacked: false,\n showGrid: true,\n showLegend: undefined,\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n showPoints: false,\n yTicks: 5,\n valueFormat: undefined,\n minY: undefined,\n maxY: undefined,\n animated: true,\n loading: false,\n ariaLabel: undefined,\n },\n);\n\nconst emit = defineEmits<{\n 'point-click': [payload: TChartActivePayload];\n}>();\n\ndefineSlots<{\n legend?: (props: { series: Array<{ name: string; color: string }> }) => unknown;\n tooltip?: (props: TChartActivePayload) => unknown;\n empty?: () => unknown;\n}>();\n\n// --- measurement ----------------------------------------------------------\nconst canvasRef = ref<HTMLElement | null>(null);\nconst width = ref(640);\nlet observer: ResizeObserver | null = null;\n\nonMounted(() => {\n const element = canvasRef.value;\n if (!element) return;\n width.value = element.clientWidth || width.value;\n\n if (typeof ResizeObserver !== 'undefined') {\n observer = new ResizeObserver((entries) => {\n const measured = entries[0]?.contentRect.width;\n if (measured) width.value = measured;\n });\n observer.observe(element);\n }\n});\n\nonBeforeUnmount(() => observer?.disconnect());\n\n// --- derived data ---------------------------------------------------------\nconst validSeries = computed(() => props.series.filter((item) => item.data.length > 0));\n\nconst categoryCount = computed(() =>\n Math.max(0, ...validSeries.value.map((item) => item.data.length)),\n);\n\n// Shared category index range, so the a11y table stays rectangular even when\n// series have different lengths.\nconst axisIndices = computed(() =>\n Array.from({ length: categoryCount.value }, (_, index) => index),\n);\n\nconst hasData = computed(() => validSeries.value.length > 0 && categoryCount.value > 0);\n\nconst resolvedShowLegend = computed(() =>\n props.showLegend ?? validSeries.value.length > 1,\n);\n\nconst colorFor = (index: number, series: TChartSeries) =>\n series.color ?? `var(--tree-color-chart-${(index % 8) + 1})`;\n\nconst legendItems = computed(() =>\n validSeries.value.map((series, index) => ({\n name: series.name,\n color: colorFor(index, series),\n })),\n);\n\nconst formatValue = (value: number) => {\n if (props.valueFormat) return props.valueFormat(value);\n if (Math.abs(value) >= 1000) return value.toLocaleString('en-US');\n return `${value}`;\n};\n\n// --- layout ---------------------------------------------------------------\nconst margin = computed(() => ({\n top: 12,\n right: 12,\n bottom: props.showXAxis && props.labels.length ? 28 : 10,\n left: props.showYAxis ? 44 : 10,\n}));\n\nconst plot = computed(() => {\n const { top, right, bottom, left } = margin.value;\n return {\n left,\n right: width.value - right,\n top,\n bottom: props.height - bottom,\n get innerWidth() {\n return this.right - this.left;\n },\n get innerHeight() {\n return this.bottom - this.top;\n },\n };\n});\n\nconst stackedTotals = computed(() => {\n if (!props.stacked || props.type !== 'bar') return [];\n return Array.from({ length: categoryCount.value }, (_, index) =>\n validSeries.value.reduce((sum, series) => sum + Math.max(0, series.data[index] ?? 0), 0),\n );\n});\n\nconst scale = computed(() => {\n const baselineZero = props.type === 'bar' || props.type === 'area';\n const flat = validSeries.value.flatMap((series) => series.data);\n\n const source = props.stacked && props.type === 'bar' ? stackedTotals.value : flat;\n const rawMin = source.length ? Math.min(...source) : 0;\n const rawMax = source.length ? Math.max(...source) : 1;\n\n const min = props.minY ?? (baselineZero ? Math.min(0, rawMin) : rawMin);\n const max = props.maxY ?? Math.max(rawMax, min + 1);\n\n return niceScale(min, max, props.yTicks);\n});\n\nconst yScale = computed(() =>\n linearScale([scale.value.min, scale.value.max], [plot.value.bottom, plot.value.top]),\n);\n\nconst baselineY = computed(() => yScale.value(Math.max(scale.value.min, 0)));\n\n// x-position helpers -------------------------------------------------------\nconst pointX = (index: number) => {\n const count = categoryCount.value;\n if (count <= 1) return plot.value.left + plot.value.innerWidth / 2;\n return plot.value.left + (index / (count - 1)) * plot.value.innerWidth;\n};\n\nconst band = computed(() => plot.value.innerWidth / Math.max(1, categoryCount.value));\nconst bandCenter = (index: number) => plot.value.left + band.value * (index + 0.5);\n\n// active category (for line/area points and axis labels)\nconst activeX = (index: number) =>\n props.type === 'bar' ? bandCenter(index) : pointX(index);\n\n// --- line / area geometry -------------------------------------------------\nconst linePaths = computed(() =>\n props.type === 'bar'\n ? []\n : validSeries.value.map((series, seriesIndex) => {\n const points: ChartPoint[] = series.data.map((value, index) => ({\n x: pointX(index),\n y: yScale.value(value),\n }));\n return {\n color: colorFor(seriesIndex, series),\n line: buildLinePath(points, props.smooth),\n area: props.type === 'area' ? buildAreaPath(points, plot.value.bottom, props.smooth) : '',\n points,\n };\n }),\n);\n\n// --- bar geometry ---------------------------------------------------------\nconst BAR_MAX = 24;\nconst BAR_GAP = 2;\n\nconst bars = computed(() => {\n if (props.type !== 'bar') return [];\n const output: Array<{\n x: number;\n y: number;\n width: number;\n height: number;\n color: string;\n seriesIndex: number;\n index: number;\n }> = [];\n\n const bandWidth = band.value;\n const groupWidth = Math.min(bandWidth * 0.72, BAR_MAX * validSeries.value.length + BAR_GAP);\n\n for (let index = 0; index < categoryCount.value; index += 1) {\n const center = bandCenter(index);\n\n if (props.stacked) {\n const barWidth = Math.min(groupWidth, BAR_MAX);\n let cursorBottom = baselineY.value;\n validSeries.value.forEach((series, seriesIndex) => {\n const value = Math.max(0, series.data[index] ?? 0);\n // Pixel height is proportional to the segment's own value.\n const segmentHeight = baselineY.value - yScale.value(value);\n if (segmentHeight <= 0) return;\n const top = cursorBottom - segmentHeight;\n output.push({\n x: center - barWidth / 2,\n y: top,\n // Trim 2px off each segment for a surface gap between stacked marks.\n height: Math.max(0, segmentHeight - BAR_GAP),\n width: barWidth,\n color: colorFor(seriesIndex, series),\n seriesIndex,\n index,\n });\n cursorBottom = top;\n });\n } else {\n const barWidth = Math.max(1, (groupWidth - BAR_GAP * (validSeries.value.length - 1)) / validSeries.value.length);\n validSeries.value.forEach((series, seriesIndex) => {\n const value = series.data[index] ?? 0;\n const top = yScale.value(value);\n const start = center - groupWidth / 2 + seriesIndex * (barWidth + BAR_GAP);\n output.push({\n x: start,\n y: Math.min(top, baselineY.value),\n width: barWidth,\n height: Math.abs(baselineY.value - top),\n color: colorFor(seriesIndex, series),\n seriesIndex,\n index,\n });\n });\n }\n }\n\n return output;\n});\n\n// --- gridlines & axes -----------------------------------------------------\nconst gridLines = computed(() =>\n scale.value.ticks.map((tick) => ({\n value: tick,\n y: yScale.value(tick),\n label: formatValue(tick),\n })),\n);\n\nconst xLabels = computed(() => {\n if (!props.showXAxis) return [];\n const count = categoryCount.value;\n const maxLabels = Math.max(2, Math.floor(plot.value.innerWidth / 52));\n const step = Math.max(1, Math.ceil(count / maxLabels));\n return props.labels.slice(0, count).map((label, index) => ({\n label,\n x: activeX(index),\n show: index % step === 0 || index === count - 1,\n }));\n});\n\n// --- interaction ----------------------------------------------------------\nconst activeIndex = ref<number | null>(null);\n\nconst pointerToIndex = (clientX: number) => {\n const element = canvasRef.value;\n if (!element) return null;\n const rect = element.getBoundingClientRect();\n const x = clientX - rect.left;\n const count = categoryCount.value;\n if (count === 0) return null;\n\n if (props.type === 'bar') {\n const index = Math.floor((x - plot.value.left) / band.value);\n return Math.min(count - 1, Math.max(0, index));\n }\n\n const ratio = (x - plot.value.left) / Math.max(1, plot.value.innerWidth);\n return Math.min(count - 1, Math.max(0, Math.round(ratio * (count - 1))));\n};\n\nconst onPointerMove = (event: PointerEvent) => {\n if (!props.showTooltip || !hasData.value) return;\n activeIndex.value = pointerToIndex(event.clientX);\n};\n\nconst onPointerLeave = () => {\n activeIndex.value = null;\n};\n\nconst activePayload = computed<TChartActivePayload | null>(() => {\n const index = activeIndex.value;\n if (index === null) return null;\n return {\n index,\n label: props.labels[index] ?? `#${index + 1}`,\n values: validSeries.value.map((series, seriesIndex) => ({\n name: series.name,\n value: series.data[index] ?? 0,\n color: colorFor(seriesIndex, series),\n })),\n };\n});\n\nconst tooltipStyle = computed(() => {\n const index = activeIndex.value;\n if (index === null) return {};\n const x = activeX(index);\n const clamped = Math.min(Math.max(x, 64), width.value - 64);\n return { left: `${clamped}px`, top: `${plot.value.top}px` };\n});\n\nconst activeMarkers = computed(() => {\n const index = activeIndex.value;\n if (index === null || props.type === 'bar') return [];\n return linePaths.value.map((path) => ({\n x: path.points[index]?.x ?? 0,\n y: path.points[index]?.y ?? 0,\n color: path.color,\n }));\n});\n\nconst onClick = () => {\n if (activePayload.value) emit('point-click', activePayload.value);\n};\n\nconst resolvedLabel = computed(\n () => props.ariaLabel ?? `${props.type} chart with ${validSeries.value.length} series`,\n);\n\nconst rootClasses = computed(() => [\n 't-chart',\n `t-chart--${props.type}`,\n {\n 'is-animated': props.animated,\n 'is-loading': props.loading,\n },\n]);\n</script>\n\n<template>\n <div :class=\"rootClasses\">\n <div\n ref=\"canvasRef\"\n class=\"t-chart__canvas\"\n :style=\"{ height: `${height}px` }\"\n >\n <div\n v-if=\"loading\"\n class=\"t-chart__loading\"\n >\n <span\n v-for=\"n in 5\"\n :key=\"n\"\n class=\"t-chart__loading-bar\"\n :style=\"{ height: `${30 + ((n * 37) % 60)}%` }\"\n />\n </div>\n\n <div\n v-else-if=\"!hasData\"\n class=\"t-chart__empty\"\n >\n <slot name=\"empty\">\n No data to display\n </slot>\n </div>\n\n <template v-else>\n <svg\n class=\"t-chart__svg\"\n :width=\"width\"\n :height=\"height\"\n :viewBox=\"`0 0 ${width} ${height}`\"\n aria-hidden=\"true\"\n @pointermove=\"onPointerMove\"\n @pointerleave=\"onPointerLeave\"\n @click=\"onClick\"\n >\n <!-- gridlines + y ticks -->\n <g class=\"t-chart__grid\">\n <template\n v-for=\"line in gridLines\"\n :key=\"line.value\"\n >\n <line\n v-if=\"showGrid\"\n class=\"t-chart__gridline\"\n :x1=\"plot.left\"\n :x2=\"plot.right\"\n :y1=\"line.y\"\n :y2=\"line.y\"\n />\n <text\n v-if=\"showYAxis\"\n class=\"t-chart__axis-label t-chart__axis-label--y\"\n :x=\"plot.left - 8\"\n :y=\"line.y\"\n >\n {{ line.label }}\n </text>\n </template>\n </g>\n\n <!-- area fills -->\n <g class=\"t-chart__areas\">\n <path\n v-for=\"(path, index) in linePaths\"\n v-show=\"type === 'area'\"\n :key=\"`area-${index}`\"\n class=\"t-chart__area\"\n :d=\"path.area\"\n :style=\"{ color: path.color }\"\n />\n </g>\n\n <!-- bars -->\n <g class=\"t-chart__bars\">\n <rect\n v-for=\"(bar, index) in bars\"\n :key=\"`bar-${index}`\"\n class=\"t-chart__bar\"\n :x=\"bar.x\"\n :y=\"bar.y\"\n :width=\"bar.width\"\n :height=\"bar.height\"\n :rx=\"Math.min(4, bar.width / 2)\"\n :style=\"{ color: bar.color, animationDelay: `${bar.index * 40}ms` }\"\n :class=\"{ 'is-active': activeIndex === bar.index }\"\n />\n </g>\n\n <!-- lines + optional static points -->\n <g class=\"t-chart__lines\">\n <template\n v-for=\"(path, index) in linePaths\"\n :key=\"`line-${index}`\"\n >\n <path\n v-if=\"type !== 'bar'\"\n class=\"t-chart__line\"\n :d=\"path.line\"\n path-length=\"1\"\n :style=\"{ color: path.color }\"\n />\n <template v-if=\"showPoints && type !== 'bar'\">\n <circle\n v-for=\"(point, pointIndex) in path.points\"\n :key=\"`point-${index}-${pointIndex}`\"\n class=\"t-chart__point\"\n :cx=\"point.x\"\n :cy=\"point.y\"\n r=\"3\"\n :style=\"{ color: path.color }\"\n />\n </template>\n </template>\n </g>\n\n <!-- hover crosshair + active markers -->\n <g\n v-if=\"activeIndex !== null && showTooltip\"\n class=\"t-chart__hover\"\n >\n <line\n class=\"t-chart__crosshair\"\n :x1=\"activeX(activeIndex)\"\n :x2=\"activeX(activeIndex)\"\n :y1=\"plot.top\"\n :y2=\"plot.bottom\"\n />\n <circle\n v-for=\"(marker, index) in activeMarkers\"\n :key=\"`marker-${index}`\"\n class=\"t-chart__marker\"\n :cx=\"marker.x\"\n :cy=\"marker.y\"\n r=\"4\"\n :style=\"{ color: marker.color }\"\n />\n </g>\n\n <!-- x-axis labels -->\n <g\n v-if=\"showXAxis\"\n class=\"t-chart__x-axis\"\n >\n <text\n v-for=\"(item, index) in xLabels\"\n v-show=\"item.show\"\n :key=\"`x-${index}`\"\n class=\"t-chart__axis-label t-chart__axis-label--x\"\n :x=\"item.x\"\n :y=\"height - 8\"\n >\n {{ item.label }}\n </text>\n </g>\n </svg>\n\n <div\n v-if=\"showTooltip && activePayload\"\n class=\"t-chart__tooltip\"\n :style=\"tooltipStyle\"\n role=\"presentation\"\n >\n <slot\n name=\"tooltip\"\n v-bind=\"activePayload\"\n >\n <p class=\"t-chart__tooltip-label\">\n {{ activePayload.label }}\n </p>\n <ul class=\"t-chart__tooltip-list\">\n <li\n v-for=\"(item, index) in activePayload.values\"\n :key=\"index\"\n class=\"t-chart__tooltip-item\"\n >\n <span\n class=\"t-chart__tooltip-dot\"\n :style=\"{ background: item.color }\"\n aria-hidden=\"true\"\n />\n <span class=\"t-chart__tooltip-name\">{{ item.name }}</span>\n <span class=\"t-chart__tooltip-value\">{{ formatValue(item.value) }}</span>\n </li>\n </ul>\n </slot>\n </div>\n </template>\n </div>\n\n <div\n v-if=\"resolvedShowLegend && hasData\"\n class=\"t-chart__legend\"\n >\n <slot\n name=\"legend\"\n :series=\"legendItems\"\n >\n <span\n v-for=\"(item, index) in legendItems\"\n :key=\"index\"\n class=\"t-chart__legend-item\"\n >\n <span\n class=\"t-chart__legend-swatch\"\n :style=\"{ background: item.color }\"\n aria-hidden=\"true\"\n />\n {{ item.name }}\n </span>\n </slot>\n </div>\n\n <!-- Accessible data table: the chart's data as text for assistive tech. -->\n <table class=\"t-chart__a11y t-visually-hidden\">\n <caption>{{ resolvedLabel }}</caption>\n <thead>\n <tr>\n <th scope=\"col\">\n Series\n </th>\n <th\n v-for=\"index in axisIndices\"\n :key=\"index\"\n scope=\"col\"\n >\n {{ labels[index] ?? '' }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(row, rowIndex) in validSeries\"\n :key=\"rowIndex\"\n >\n <th scope=\"row\">\n {{ row.name }}\n </th>\n <td\n v-for=\"index in axisIndices\"\n :key=\"index\"\n >\n {{ row.data[index] === undefined ? '' : formatValue(row.data[index]) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2EAoPM,IAAU,IACV,IAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA1NhB,IAAM,IAAQ,GAmER,IAAO,GAWP,IAAY,EAAwB,IAAI,GACxC,IAAQ,EAAI,GAAG,GACjB,IAAkC;EAgBtC,AAdA,QAAgB;GACd,IAAM,IAAU,EAAU;GACrB,MACL,EAAM,QAAQ,EAAQ,eAAe,EAAM,OAEvC,OAAO,iBAAmB,QAC5B,IAAW,IAAI,gBAAgB,MAAY;IACzC,IAAM,IAAW,EAAQ,EAAE,EAAE,YAAY;IACzC,AAAI,MAAU,EAAM,QAAQ;GAC9B,CAAC,GACD,EAAS,QAAQ,CAAO;EAE5B,CAAC,GAED,QAAsB,GAAU,WAAW,CAAC;EAG5C,IAAM,IAAc,QAAe,EAAM,OAAO,QAAQ,MAAS,EAAK,KAAK,SAAS,CAAC,CAAC,GAEhF,IAAgB,QACpB,KAAK,IAAI,GAAG,GAAG,EAAY,MAAM,KAAK,MAAS,EAAK,KAAK,MAAM,CAAC,CAClE,GAIM,IAAc,QAClB,MAAM,KAAK,EAAE,QAAQ,EAAc,MAAM,IAAI,GAAG,MAAU,CAAK,CACjE,GAEM,IAAU,QAAe,EAAY,MAAM,SAAS,KAAK,EAAc,QAAQ,CAAC,GAEhF,KAAqB,QACzB,EAAM,cAAc,EAAY,MAAM,SAAS,CACjD,GAEM,KAAY,GAAe,MAC/B,EAAO,SAAS,0BAA2B,IAAQ,IAAK,EAAE,IAEtD,IAAc,QAClB,EAAY,MAAM,KAAK,GAAQ,OAAW;GACxC,MAAM,EAAO;GACb,OAAO,EAAS,GAAO,CAAM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,MAAA,EAFD,OAAM,MAAK,GAAC,YAEhB,EAAA,IAAA,EAAA,EAAA,GACA,EAMK,GAAA,MAAA,EALa,EAAA,QAAT,YADT,EAMK,MAAA;KAJF,KAAK;KACN,OAAM;SAEH,EAAA,OAAO,MAAK,EAAA,GAAA,CAAA;IAIrB,EAeQ,SAAA,MAAA,EAAA,EAAA,EAAA,GAdN,EAaK,GAAA,MAAA,EAZuB,EAAA,QAAlB,GAAK,YADf,EAaK,MAAA,EAXF,KAAK,EAAQ,GAAA,CAEd,EAEK,MAFL,GAEK,EADA,EAAI,IAAI,GAAA,CAAA,IAAA,EAAA,EAAA,GAEb,EAKK,GAAA,MAAA,EAJa,EAAA,QAAT,YADT,EAKK,MAAA,EAHF,KAAK,EAAK,GAAA,EAER,EAAI,KAAK,OAAW,KAAA,IAAS,KAAQ,EAAY,EAAI,KAAK,EAAK,CAAA,GAAA,CAAA"}
1
+ {"version":3,"file":"TChart.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/TChart.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed, onBeforeUnmount, onMounted, ref } from 'vue';\nimport {\n buildAreaPath,\n buildLinePath,\n linearScale,\n niceScale,\n type ChartPoint,\n} from '@treeui/utils';\n\nexport type TChartType = 'line' | 'area' | 'bar';\n\nexport interface TChartSeries {\n /** Legend/tooltip name for the series. */\n name: string;\n /** One value per category, aligned to `labels`. */\n data: number[];\n /** Override the series color; defaults to a chart palette token. */\n color?: string;\n}\n\nexport interface TChartActivePayload {\n index: number;\n label: string;\n values: Array<{ name: string; value: number; color: string }>;\n}\n\nconst props = withDefaults(\n defineProps<{\n /** Visual form of the plot. */\n type?: TChartType;\n /** One or more data series. */\n series?: TChartSeries[];\n /** Category labels for the x-axis, aligned to each series' data. */\n labels?: string[];\n /** Plot height in px (width is fluid). */\n height?: number;\n /** Smooth (curved) line/area. */\n smooth?: boolean;\n /**\n * Stack bar series on top of each other instead of grouping side by side.\n * Negative values are clamped to 0 in stacked mode (grouped mode renders them).\n */\n stacked?: boolean;\n /** Draw horizontal gridlines. */\n showGrid?: boolean;\n /** Show the legend. Defaults to on when there is more than one series. */\n showLegend?: boolean;\n /** Show x-axis category labels. */\n showXAxis?: boolean;\n /** Show y-axis value ticks. */\n showYAxis?: boolean;\n /** Show the hover crosshair + tooltip. */\n showTooltip?: boolean;\n /** Always render markers on line/area points (not just on hover). */\n showPoints?: boolean;\n /** Target number of y-axis ticks. */\n yTicks?: number;\n /** Format axis + tooltip values. */\n valueFormat?: (value: number) => string;\n /** Force the low end of the y domain. */\n minY?: number;\n /** Force the high end of the y domain. */\n maxY?: number;\n /** Animate marks on first render (respects prefers-reduced-motion). */\n animated?: boolean;\n /** Render skeleton placeholders instead of the plot. */\n loading?: boolean;\n /** Accessible summary of the chart. */\n ariaLabel?: string;\n }>(),\n {\n type: 'line',\n series: () => [],\n labels: () => [],\n height: 260,\n smooth: false,\n stacked: false,\n showGrid: true,\n showLegend: undefined,\n showXAxis: true,\n showYAxis: true,\n showTooltip: true,\n showPoints: false,\n yTicks: 5,\n valueFormat: undefined,\n minY: undefined,\n maxY: undefined,\n animated: true,\n loading: false,\n ariaLabel: undefined,\n },\n);\n\nconst emit = defineEmits<{\n 'point-click': [payload: TChartActivePayload];\n}>();\n\ndefineSlots<{\n legend?: (props: { series: Array<{ name: string; color: string }> }) => unknown;\n tooltip?: (props: TChartActivePayload) => unknown;\n empty?: () => unknown;\n}>();\n\n// --- measurement ----------------------------------------------------------\nconst canvasRef = ref<HTMLElement | null>(null);\nconst width = ref(640);\nlet observer: ResizeObserver | null = null;\n\nonMounted(() => {\n const element = canvasRef.value;\n if (!element) return;\n width.value = element.clientWidth || width.value;\n\n if (typeof ResizeObserver !== 'undefined') {\n observer = new ResizeObserver((entries) => {\n const measured = entries[0]?.contentRect.width;\n if (measured) width.value = measured;\n });\n observer.observe(element);\n }\n});\n\nonBeforeUnmount(() => observer?.disconnect());\n\n// --- derived data ---------------------------------------------------------\nconst validSeries = computed(() => props.series.filter((item) => item.data.length > 0));\n\nconst categoryCount = computed(() =>\n Math.max(0, ...validSeries.value.map((item) => item.data.length)),\n);\n\n// Shared category index range, so the a11y table stays rectangular even when\n// series have different lengths.\nconst axisIndices = computed(() =>\n Array.from({ length: categoryCount.value }, (_, index) => index),\n);\n\nconst hasData = computed(() => validSeries.value.length > 0 && categoryCount.value > 0);\n\nconst resolvedShowLegend = computed(() =>\n props.showLegend ?? validSeries.value.length > 1,\n);\n\nconst colorFor = (index: number, series: TChartSeries) =>\n series.color ?? `var(--tree-color-chart-${(index % 8) + 1})`;\n\nconst legendItems = computed(() =>\n validSeries.value.map((series, index) => ({\n name: series.name,\n color: colorFor(index, series),\n })),\n);\n\nconst formatValue = (value: number) => {\n if (props.valueFormat) return props.valueFormat(value);\n if (Math.abs(value) >= 1000) return value.toLocaleString('en-US');\n return `${value}`;\n};\n\n// --- layout ---------------------------------------------------------------\nconst margin = computed(() => ({\n top: 12,\n right: 12,\n bottom: props.showXAxis && props.labels.length ? 28 : 10,\n left: props.showYAxis ? 44 : 10,\n}));\n\nconst plot = computed(() => {\n const { top, right, bottom, left } = margin.value;\n return {\n left,\n right: width.value - right,\n top,\n bottom: props.height - bottom,\n get innerWidth() {\n return this.right - this.left;\n },\n get innerHeight() {\n return this.bottom - this.top;\n },\n };\n});\n\nconst stackedTotals = computed(() => {\n if (!props.stacked || props.type !== 'bar') return [];\n return Array.from({ length: categoryCount.value }, (_, index) =>\n validSeries.value.reduce((sum, series) => sum + Math.max(0, series.data[index] ?? 0), 0),\n );\n});\n\nconst scale = computed(() => {\n const baselineZero = props.type === 'bar' || props.type === 'area';\n const flat = validSeries.value.flatMap((series) => series.data);\n\n const source = props.stacked && props.type === 'bar' ? stackedTotals.value : flat;\n const rawMin = source.length ? Math.min(...source) : 0;\n const rawMax = source.length ? Math.max(...source) : 1;\n\n const min = props.minY ?? (baselineZero ? Math.min(0, rawMin) : rawMin);\n const max = props.maxY ?? Math.max(rawMax, min + 1);\n\n return niceScale(min, max, props.yTicks);\n});\n\nconst yScale = computed(() =>\n linearScale([scale.value.min, scale.value.max], [plot.value.bottom, plot.value.top]),\n);\n\nconst baselineY = computed(() => yScale.value(Math.max(scale.value.min, 0)));\n\n// x-position helpers -------------------------------------------------------\nconst pointX = (index: number) => {\n const count = categoryCount.value;\n if (count <= 1) return plot.value.left + plot.value.innerWidth / 2;\n return plot.value.left + (index / (count - 1)) * plot.value.innerWidth;\n};\n\nconst band = computed(() => plot.value.innerWidth / Math.max(1, categoryCount.value));\nconst bandCenter = (index: number) => plot.value.left + band.value * (index + 0.5);\n\n// active category (for line/area points and axis labels)\nconst activeX = (index: number) =>\n props.type === 'bar' ? bandCenter(index) : pointX(index);\n\n// --- line / area geometry -------------------------------------------------\nconst linePaths = computed(() =>\n props.type === 'bar'\n ? []\n : validSeries.value.map((series, seriesIndex) => {\n const points: ChartPoint[] = series.data.map((value, index) => ({\n x: pointX(index),\n y: yScale.value(value),\n }));\n return {\n color: colorFor(seriesIndex, series),\n line: buildLinePath(points, props.smooth),\n area: props.type === 'area' ? buildAreaPath(points, plot.value.bottom, props.smooth) : '',\n points,\n };\n }),\n);\n\n// --- bar geometry ---------------------------------------------------------\nconst BAR_MAX = 24;\nconst BAR_GAP = 2;\n\nconst bars = computed(() => {\n if (props.type !== 'bar') return [];\n const output: Array<{\n x: number;\n y: number;\n width: number;\n height: number;\n color: string;\n seriesIndex: number;\n index: number;\n }> = [];\n\n const bandWidth = band.value;\n const groupWidth = Math.min(bandWidth * 0.72, BAR_MAX * validSeries.value.length + BAR_GAP);\n\n for (let index = 0; index < categoryCount.value; index += 1) {\n const center = bandCenter(index);\n\n if (props.stacked) {\n const barWidth = Math.min(groupWidth, BAR_MAX);\n let cursorBottom = baselineY.value;\n validSeries.value.forEach((series, seriesIndex) => {\n const value = Math.max(0, series.data[index] ?? 0);\n // Pixel height is proportional to the segment's own value.\n const segmentHeight = baselineY.value - yScale.value(value);\n if (segmentHeight <= 0) return;\n const top = cursorBottom - segmentHeight;\n output.push({\n x: center - barWidth / 2,\n y: top,\n // Trim 2px off each segment for a surface gap between stacked marks.\n height: Math.max(0, segmentHeight - BAR_GAP),\n width: barWidth,\n color: colorFor(seriesIndex, series),\n seriesIndex,\n index,\n });\n cursorBottom = top;\n });\n } else {\n const barWidth = Math.max(1, (groupWidth - BAR_GAP * (validSeries.value.length - 1)) / validSeries.value.length);\n validSeries.value.forEach((series, seriesIndex) => {\n const value = series.data[index] ?? 0;\n const top = yScale.value(value);\n const start = center - groupWidth / 2 + seriesIndex * (barWidth + BAR_GAP);\n output.push({\n x: start,\n y: Math.min(top, baselineY.value),\n width: barWidth,\n height: Math.abs(baselineY.value - top),\n color: colorFor(seriesIndex, series),\n seriesIndex,\n index,\n });\n });\n }\n }\n\n return output;\n});\n\n// --- gridlines & axes -----------------------------------------------------\nconst gridLines = computed(() =>\n scale.value.ticks.map((tick) => ({\n value: tick,\n y: yScale.value(tick),\n label: formatValue(tick),\n })),\n);\n\nconst xLabels = computed(() => {\n if (!props.showXAxis) return [];\n const count = categoryCount.value;\n const maxLabels = Math.max(2, Math.floor(plot.value.innerWidth / 52));\n const step = Math.max(1, Math.ceil(count / maxLabels));\n return props.labels.slice(0, count).map((label, index) => ({\n label,\n x: activeX(index),\n show: index % step === 0 || index === count - 1,\n }));\n});\n\n// --- interaction ----------------------------------------------------------\nconst activeIndex = ref<number | null>(null);\n\nconst pointerToIndex = (clientX: number) => {\n const element = canvasRef.value;\n if (!element) return null;\n const rect = element.getBoundingClientRect();\n const x = clientX - rect.left;\n const count = categoryCount.value;\n if (count === 0) return null;\n\n if (props.type === 'bar') {\n const index = Math.floor((x - plot.value.left) / band.value);\n return Math.min(count - 1, Math.max(0, index));\n }\n\n const ratio = (x - plot.value.left) / Math.max(1, plot.value.innerWidth);\n return Math.min(count - 1, Math.max(0, Math.round(ratio * (count - 1))));\n};\n\nconst onPointerMove = (event: PointerEvent) => {\n if (!props.showTooltip || !hasData.value) return;\n activeIndex.value = pointerToIndex(event.clientX);\n};\n\nconst onPointerLeave = () => {\n activeIndex.value = null;\n};\n\nconst activePayload = computed<TChartActivePayload | null>(() => {\n const index = activeIndex.value;\n if (index === null) return null;\n return {\n index,\n label: props.labels[index] ?? `#${index + 1}`,\n values: validSeries.value.map((series, seriesIndex) => ({\n name: series.name,\n value: series.data[index] ?? 0,\n color: colorFor(seriesIndex, series),\n })),\n };\n});\n\nconst tooltipStyle = computed(() => {\n const index = activeIndex.value;\n if (index === null) return {};\n const x = activeX(index);\n const clamped = Math.min(Math.max(x, 64), width.value - 64);\n return { left: `${clamped}px`, top: `${plot.value.top}px` };\n});\n\nconst activeMarkers = computed(() => {\n const index = activeIndex.value;\n if (index === null || props.type === 'bar') return [];\n return linePaths.value.map((path) => ({\n x: path.points[index]?.x ?? 0,\n y: path.points[index]?.y ?? 0,\n color: path.color,\n }));\n});\n\nconst onClick = () => {\n if (activePayload.value) emit('point-click', activePayload.value);\n};\n\nconst resolvedLabel = computed(\n () => props.ariaLabel ?? `${props.type} chart with ${validSeries.value.length} series`,\n);\n\nconst rootClasses = computed(() => [\n 't-chart',\n `t-chart--${props.type}`,\n {\n 'is-animated': props.animated,\n 'is-loading': props.loading,\n },\n]);\n</script>\n\n<template>\n <div :class=\"rootClasses\">\n <div\n ref=\"canvasRef\"\n class=\"t-chart__canvas\"\n :style=\"{ height: `${height}px` }\"\n >\n <div\n v-if=\"loading\"\n class=\"t-chart__loading\"\n >\n <span\n v-for=\"n in 5\"\n :key=\"n\"\n class=\"t-chart__loading-bar\"\n :style=\"{ height: `${30 + ((n * 37) % 60)}%` }\"\n />\n </div>\n\n <div\n v-else-if=\"!hasData\"\n class=\"t-chart__empty\"\n >\n <slot name=\"empty\">\n No data to display\n </slot>\n </div>\n\n <template v-else>\n <svg\n class=\"t-chart__svg\"\n :width=\"width\"\n :height=\"height\"\n :viewBox=\"`0 0 ${width} ${height}`\"\n aria-hidden=\"true\"\n @pointermove=\"onPointerMove\"\n @pointerleave=\"onPointerLeave\"\n @click=\"onClick\"\n >\n <!-- gridlines + y ticks -->\n <g class=\"t-chart__grid\">\n <template\n v-for=\"line in gridLines\"\n :key=\"line.value\"\n >\n <line\n v-if=\"showGrid\"\n class=\"t-chart__gridline\"\n :x1=\"plot.left\"\n :x2=\"plot.right\"\n :y1=\"line.y\"\n :y2=\"line.y\"\n />\n <text\n v-if=\"showYAxis\"\n class=\"t-chart__axis-label t-chart__axis-label--y\"\n :x=\"plot.left - 8\"\n :y=\"line.y\"\n >\n {{ line.label }}\n </text>\n </template>\n </g>\n\n <!-- area fills -->\n <g class=\"t-chart__areas\">\n <path\n v-for=\"(path, index) in linePaths\"\n v-show=\"type === 'area'\"\n :key=\"`area-${index}`\"\n class=\"t-chart__area\"\n :d=\"path.area\"\n :style=\"{ color: path.color }\"\n />\n </g>\n\n <!-- bars -->\n <g class=\"t-chart__bars\">\n <rect\n v-for=\"(bar, index) in bars\"\n :key=\"`bar-${index}`\"\n class=\"t-chart__bar\"\n :x=\"bar.x\"\n :y=\"bar.y\"\n :width=\"bar.width\"\n :height=\"bar.height\"\n :rx=\"Math.min(4, bar.width / 2)\"\n :style=\"{ color: bar.color, animationDelay: `${bar.index * 40}ms` }\"\n :class=\"{ 'is-active': activeIndex === bar.index }\"\n />\n </g>\n\n <!-- lines + optional static points -->\n <g class=\"t-chart__lines\">\n <template\n v-for=\"(path, index) in linePaths\"\n :key=\"`line-${index}`\"\n >\n <path\n v-if=\"type !== 'bar'\"\n class=\"t-chart__line\"\n :d=\"path.line\"\n path-length=\"1\"\n :style=\"{ color: path.color }\"\n />\n <template v-if=\"showPoints && type !== 'bar'\">\n <circle\n v-for=\"(point, pointIndex) in path.points\"\n :key=\"`point-${index}-${pointIndex}`\"\n class=\"t-chart__point\"\n :cx=\"point.x\"\n :cy=\"point.y\"\n r=\"3\"\n :style=\"{ color: path.color }\"\n />\n </template>\n </template>\n </g>\n\n <!-- hover crosshair + active markers -->\n <g\n v-if=\"activeIndex !== null && showTooltip\"\n class=\"t-chart__hover\"\n >\n <line\n class=\"t-chart__crosshair\"\n :x1=\"activeX(activeIndex)\"\n :x2=\"activeX(activeIndex)\"\n :y1=\"plot.top\"\n :y2=\"plot.bottom\"\n />\n <circle\n v-for=\"(marker, index) in activeMarkers\"\n :key=\"`marker-${index}`\"\n class=\"t-chart__marker\"\n :cx=\"marker.x\"\n :cy=\"marker.y\"\n r=\"4\"\n :style=\"{ color: marker.color }\"\n />\n </g>\n\n <!-- x-axis labels -->\n <g\n v-if=\"showXAxis\"\n class=\"t-chart__x-axis\"\n >\n <text\n v-for=\"(item, index) in xLabels\"\n v-show=\"item.show\"\n :key=\"`x-${index}`\"\n class=\"t-chart__axis-label t-chart__axis-label--x\"\n :x=\"item.x\"\n :y=\"height - 8\"\n >\n {{ item.label }}\n </text>\n </g>\n </svg>\n\n <div\n v-if=\"showTooltip && activePayload\"\n class=\"t-chart__tooltip\"\n :style=\"tooltipStyle\"\n role=\"presentation\"\n >\n <slot\n name=\"tooltip\"\n v-bind=\"activePayload\"\n >\n <p class=\"t-chart__tooltip-label\">\n {{ activePayload.label }}\n </p>\n <ul class=\"t-chart__tooltip-list\">\n <li\n v-for=\"(item, index) in activePayload.values\"\n :key=\"index\"\n class=\"t-chart__tooltip-item\"\n >\n <span\n class=\"t-chart__tooltip-dot\"\n :style=\"{ background: item.color }\"\n aria-hidden=\"true\"\n />\n <span class=\"t-chart__tooltip-name\">{{ item.name }}</span>\n <span class=\"t-chart__tooltip-value\">{{ formatValue(item.value) }}</span>\n </li>\n </ul>\n </slot>\n </div>\n </template>\n </div>\n\n <div\n v-if=\"resolvedShowLegend && hasData\"\n class=\"t-chart__legend\"\n >\n <slot\n name=\"legend\"\n :series=\"legendItems\"\n >\n <span\n v-for=\"(item, index) in legendItems\"\n :key=\"index\"\n class=\"t-chart__legend-item\"\n >\n <span\n class=\"t-chart__legend-swatch\"\n :style=\"{ background: item.color }\"\n aria-hidden=\"true\"\n />\n {{ item.name }}\n </span>\n </slot>\n </div>\n\n <!--\n Accessible data table: the chart's data as text for assistive tech.\n The visually-hidden class goes on a wrapper, not the table: a <table>\n ignores a width below its min-content, so hiding it directly leaves a\n full-width box that pushes the page's scroll width.\n -->\n <div class=\"t-visually-hidden\">\n <table class=\"t-chart__a11y\">\n <caption>{{ resolvedLabel }}</caption>\n <thead>\n <tr>\n <th scope=\"col\">\n Series\n </th>\n <th\n v-for=\"index in axisIndices\"\n :key=\"index\"\n scope=\"col\"\n >\n {{ labels[index] ?? '' }}\n </th>\n </tr>\n </thead>\n <tbody>\n <tr\n v-for=\"(row, rowIndex) in validSeries\"\n :key=\"rowIndex\"\n >\n <th scope=\"row\">\n {{ row.name }}\n </th>\n <td\n v-for=\"index in axisIndices\"\n :key=\"index\"\n >\n {{ row.data[index] === undefined ? '' : formatValue(row.data[index]) }}\n </td>\n </tr>\n </tbody>\n </table>\n </div>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6FAoPM,IAAU,IACV,IAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA1NhB,IAAM,IAAQ,GAmER,IAAO,GAWP,IAAY,EAAwB,IAAI,GACxC,IAAQ,EAAI,GAAG,GACjB,IAAkC;EAgBtC,AAdA,QAAgB;GACd,IAAM,IAAU,EAAU;GACrB,MACL,EAAM,QAAQ,EAAQ,eAAe,EAAM,OAEvC,OAAO,iBAAmB,QAC5B,IAAW,IAAI,gBAAgB,MAAY;IACzC,IAAM,IAAW,EAAQ,EAAE,EAAE,YAAY;IACzC,AAAI,MAAU,EAAM,QAAQ;GAC9B,CAAC,GACD,EAAS,QAAQ,CAAO;EAE5B,CAAC,GAED,QAAsB,GAAU,WAAW,CAAC;EAG5C,IAAM,IAAc,QAAe,EAAM,OAAO,QAAQ,MAAS,EAAK,KAAK,SAAS,CAAC,CAAC,GAEhF,IAAgB,QACpB,KAAK,IAAI,GAAG,GAAG,EAAY,MAA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EAAA,GAZL,EAWO,GAAA,MAAA,EAVmB,EAAA,QAAhB,GAAM,YADhB,EAWO,QAAA;IATJ,KAAK;IACN,OAAM;OAEN,EAIE,QAAA;IAHA,OAAM;IACL,OAAK,EAAA,EAAA,YAAgB,EAAK,MAAK,CAAA;IAChC,eAAY;kBACZ,MACF,EAAG,EAAK,IAAI,GAAA,CAAA,CAAA,CAAA;GAWlB,EAkCM,OAlCN,GAkCM,CAjCJ,EAgCQ,SAhCR,GAgCQ;IA/BN,EAAsC,WAAA,MAAA,EAA1B,GAAA,KAAa,GAAA,CAAA;IACzB,EAaQ,SAAA,MAAA,CAZN,EAWK,MAAA,MAAA,CAAA,AAAA,EAAA,OAVH,EAEK,MAAA,EAFD,OAAM,MAAK,GAAC,YAEhB,EAAA,IAAA,EAAA,EAAA,GACA,EAMK,GAAA,MAAA,EALa,EAAA,QAAT,YADT,EAMK,MAAA;KAJF,KAAK;KACN,OAAM;SAEH,EAAA,OAAO,MAAK,EAAA,GAAA,CAAA;IAIrB,EAeQ,SAAA,MAAA,EAAA,EAAA,EAAA,GAdN,EAaK,GAAA,MAAA,EAZuB,EAAA,QAAlB,GAAK,YADf,EAaK,MAAA,EAXF,KAAK,EAAQ,GAAA,CAEd,EAEK,MAFL,GAEK,EADA,EAAI,IAAI,GAAA,CAAA,IAAA,EAAA,EAAA,GAEb,EAKK,GAAA,MAAA,EAJa,EAAA,QAAT,YADT,EAKK,MAAA,EAHF,KAAK,EAAK,GAAA,EAER,EAAI,KAAK,OAAW,KAAA,IAAS,KAAQ,EAAY,EAAI,KAAK,EAAK,CAAA,GAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ var e=require("./TColorSwatch.vue_vue_type_script_setup_true_lang.cjs").default;exports.default=e;
2
+ //# sourceMappingURL=TColorSwatch.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TColorSwatch.cjs","names":[],"sources":["../../src/components/TColorSwatch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { TSize } from '../types/contracts';\n\nexport interface TColorSwatchOption {\n label: string;\n value: string;\n}\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n /** Preset colors offered as swatches. */\n options?: TColorSwatchOption[];\n /** Append a native colour input for an arbitrary value. */\n allowCustom?: boolean;\n size?: TSize;\n /** Accessible label for the swatch group. */\n label?: string;\n /** Accessible label for the custom colour input. */\n customLabel?: string;\n disabled?: boolean;\n }>(),\n {\n modelValue: undefined,\n options: () => [],\n allowCustom: false,\n size: 'md',\n label: 'Color',\n customLabel: 'Custom color',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst classes = computed(() => ['t-color-swatch', `t-color-swatch--${props.size}`]);\n\nconst isSelected = (value: string) =>\n Boolean(props.modelValue) && props.modelValue?.toLowerCase() === value.toLowerCase();\n\nconst select = (value: string) => {\n if (props.disabled) {\n return;\n }\n emit('update:modelValue', value);\n};\n\nconst onCustomInput = (event: Event) => {\n emit('update:modelValue', (event.target as HTMLInputElement).value);\n};\n</script>\n\n<template>\n <div\n :class=\"classes\"\n role=\"group\"\n :aria-label=\"label\"\n >\n <button\n v-for=\"option in options\"\n :key=\"option.value\"\n type=\"button\"\n class=\"t-color-swatch__option\"\n :class=\"{ 'is-selected': isSelected(option.value) }\"\n :style=\"{ background: option.value }\"\n :aria-label=\"option.label\"\n :aria-pressed=\"isSelected(option.value)\"\n :disabled=\"disabled\"\n @click=\"select(option.value)\"\n />\n\n <input\n v-if=\"allowCustom\"\n class=\"t-color-swatch__custom\"\n type=\"color\"\n :value=\"modelValue\"\n :aria-label=\"customLabel\"\n :disabled=\"disabled\"\n @input=\"onCustomInput\"\n >\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import e from "./TColorSwatch.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/TColorSwatch.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
6
+
7
+ //# sourceMappingURL=TColorSwatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TColorSwatch.js","names":[],"sources":["../../src/components/TColorSwatch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { TSize } from '../types/contracts';\n\nexport interface TColorSwatchOption {\n label: string;\n value: string;\n}\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n /** Preset colors offered as swatches. */\n options?: TColorSwatchOption[];\n /** Append a native colour input for an arbitrary value. */\n allowCustom?: boolean;\n size?: TSize;\n /** Accessible label for the swatch group. */\n label?: string;\n /** Accessible label for the custom colour input. */\n customLabel?: string;\n disabled?: boolean;\n }>(),\n {\n modelValue: undefined,\n options: () => [],\n allowCustom: false,\n size: 'md',\n label: 'Color',\n customLabel: 'Custom color',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst classes = computed(() => ['t-color-swatch', `t-color-swatch--${props.size}`]);\n\nconst isSelected = (value: string) =>\n Boolean(props.modelValue) && props.modelValue?.toLowerCase() === value.toLowerCase();\n\nconst select = (value: string) => {\n if (props.disabled) {\n return;\n }\n emit('update:modelValue', value);\n};\n\nconst onCustomInput = (event: Event) => {\n emit('update:modelValue', (event.target as HTMLInputElement).value);\n};\n</script>\n\n<template>\n <div\n :class=\"classes\"\n role=\"group\"\n :aria-label=\"label\"\n >\n <button\n v-for=\"option in options\"\n :key=\"option.value\"\n type=\"button\"\n class=\"t-color-swatch__option\"\n :class=\"{ 'is-selected': isSelected(option.value) }\"\n :style=\"{ background: option.value }\"\n :aria-label=\"option.label\"\n :aria-pressed=\"isSelected(option.value)\"\n :disabled=\"disabled\"\n @click=\"select(option.value)\"\n />\n\n <input\n v-if=\"allowCustom\"\n class=\"t-color-swatch__custom\"\n type=\"color\"\n :value=\"modelValue\"\n :aria-label=\"customLabel\"\n :disabled=\"disabled\"\n @input=\"onCustomInput\"\n >\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,33 @@
1
+ import { TSize } from '../types/contracts';
2
+ export interface TColorSwatchOption {
3
+ label: string;
4
+ value: string;
5
+ }
6
+ type __VLS_Props = {
7
+ modelValue?: string;
8
+ /** Preset colors offered as swatches. */
9
+ options?: TColorSwatchOption[];
10
+ /** Append a native colour input for an arbitrary value. */
11
+ allowCustom?: boolean;
12
+ size?: TSize;
13
+ /** Accessible label for the swatch group. */
14
+ label?: string;
15
+ /** Accessible label for the custom colour input. */
16
+ customLabel?: string;
17
+ disabled?: boolean;
18
+ };
19
+ declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string) => any;
21
+ }, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
23
+ }>, {
24
+ modelValue: string;
25
+ disabled: boolean;
26
+ size: TSize;
27
+ label: string;
28
+ options: TColorSwatchOption[];
29
+ allowCustom: boolean;
30
+ customLabel: string;
31
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
32
+ export default _default;
33
+ //# sourceMappingURL=TColorSwatch.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TColorSwatch.vue.d.ts","sourceRoot":"","sources":["../../src/components/TColorSwatch.vue"],"names":[],"mappings":"AAwFA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAEhD,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,KAAK,WAAW,GAAG;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,2DAA2D;IAC3D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;;;;;;gBAXa,MAAM;cAUR,OAAO;UALX,KAAK;WAEJ,MAAM;aALJ,kBAAkB,EAAE;iBAEhB,OAAO;iBAKP,MAAM;;AAoHxB,wBASG"}
@@ -0,0 +1,2 @@
1
+ let e=require("vue");var t=[`aria-label`],n=[`aria-label`,`aria-pressed`,`disabled`,`onClick`],r=[`value`,`aria-label`,`disabled`],i=(0,e.defineComponent)({__name:`TColorSwatch`,props:{modelValue:{default:void 0},options:{default:()=>[]},allowCustom:{type:Boolean,default:!1},size:{default:`md`},label:{default:`Color`},customLabel:{default:`Custom color`},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],setup(i,{emit:a}){let o=i,s=a,c=(0,e.computed)(()=>[`t-color-swatch`,`t-color-swatch--${o.size}`]),l=e=>!!o.modelValue&&o.modelValue?.toLowerCase()===e.toLowerCase(),u=e=>{o.disabled||s(`update:modelValue`,e)},d=e=>{s(`update:modelValue`,e.target.value)};return(a,o)=>((0,e.openBlock)(),(0,e.createElementBlock)(`div`,{class:(0,e.normalizeClass)(c.value),role:`group`,"aria-label":i.label},[((0,e.openBlock)(!0),(0,e.createElementBlock)(e.Fragment,null,(0,e.renderList)(i.options,t=>((0,e.openBlock)(),(0,e.createElementBlock)(`button`,{key:t.value,type:`button`,class:(0,e.normalizeClass)([`t-color-swatch__option`,{"is-selected":l(t.value)}]),style:(0,e.normalizeStyle)({background:t.value}),"aria-label":t.label,"aria-pressed":l(t.value),disabled:i.disabled,onClick:e=>u(t.value)},null,14,n))),128)),i.allowCustom?((0,e.openBlock)(),(0,e.createElementBlock)(`input`,{key:0,class:`t-color-swatch__custom`,type:`color`,value:i.modelValue,"aria-label":i.customLabel,disabled:i.disabled,onInput:d},null,40,r)):(0,e.createCommentVNode)(``,!0)],10,t))}});exports.default=i;
2
+ //# sourceMappingURL=TColorSwatch.vue_vue_type_script_setup_true_lang.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TColorSwatch.vue_vue_type_script_setup_true_lang.cjs","names":[],"sources":["../../src/components/TColorSwatch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { TSize } from '../types/contracts';\n\nexport interface TColorSwatchOption {\n label: string;\n value: string;\n}\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n /** Preset colors offered as swatches. */\n options?: TColorSwatchOption[];\n /** Append a native colour input for an arbitrary value. */\n allowCustom?: boolean;\n size?: TSize;\n /** Accessible label for the swatch group. */\n label?: string;\n /** Accessible label for the custom colour input. */\n customLabel?: string;\n disabled?: boolean;\n }>(),\n {\n modelValue: undefined,\n options: () => [],\n allowCustom: false,\n size: 'md',\n label: 'Color',\n customLabel: 'Custom color',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst classes = computed(() => ['t-color-swatch', `t-color-swatch--${props.size}`]);\n\nconst isSelected = (value: string) =>\n Boolean(props.modelValue) && props.modelValue?.toLowerCase() === value.toLowerCase();\n\nconst select = (value: string) => {\n if (props.disabled) {\n return;\n }\n emit('update:modelValue', value);\n};\n\nconst onCustomInput = (event: Event) => {\n emit('update:modelValue', (event.target as HTMLInputElement).value);\n};\n</script>\n\n<template>\n <div\n :class=\"classes\"\n role=\"group\"\n :aria-label=\"label\"\n >\n <button\n v-for=\"option in options\"\n :key=\"option.value\"\n type=\"button\"\n class=\"t-color-swatch__option\"\n :class=\"{ 'is-selected': isSelected(option.value) }\"\n :style=\"{ background: option.value }\"\n :aria-label=\"option.label\"\n :aria-pressed=\"isSelected(option.value)\"\n :disabled=\"disabled\"\n @click=\"select(option.value)\"\n />\n\n <input\n v-if=\"allowCustom\"\n class=\"t-color-swatch__custom\"\n type=\"color\"\n :value=\"modelValue\"\n :aria-label=\"customLabel\"\n :disabled=\"disabled\"\n @input=\"onCustomInput\"\n >\n </div>\n</template>\n"],"mappings":"ubASA,IAAM,EAAQ,EAyBR,EAAO,EAIP,GAAA,EAAA,EAAA,SAAA,KAAyB,CAAC,iBAAkB,mBAAmB,EAAM,MAAM,CAAC,EAE5E,EAAc,GAClB,EAAQ,EAAM,YAAe,EAAM,YAAY,YAAY,IAAM,EAAM,YAAY,EAE/E,EAAU,GAAkB,CAC5B,EAAM,UAGV,EAAK,oBAAqB,CAAK,CACjC,EAEM,EAAiB,GAAiB,CACtC,EAAK,oBAAsB,EAAM,OAA4B,KAAK,CACpE,2DA+BQ,MAAA,CA1BH,OAAA,EAAA,EAAA,eAAA,CAAO,EAAA,KAAO,EACf,KAAK,QACJ,aAAY,EAAA,sDAaX,EAAA,SAAA,MAAA,EAAA,EAAA,WAAA,CAViB,EAAA,QAAV,+CAUP,SAAA,CATC,IAAK,EAAO,MACb,KAAK,SACL,OAAA,EAAA,EAAA,eAAA,CAAK,CAAC,yBAAwB,CAAA,cACL,EAAW,EAAO,KAAK,CAAA,CAAA,CAAA,EAC/C,OAAA,EAAA,EAAA,eAAA,CAAK,CAAA,WAAgB,EAAO,KAAK,CAAA,EACjC,aAAY,EAAO,MACnB,eAAc,EAAW,EAAO,KAAK,EACrC,SAAU,EAAA,SACV,QAAK,GAAE,EAAO,EAAO,KAAK,sBAIrB,EAAA,cAAA,EAAA,EAAA,UAAA,CAAA,GAAA,EAAA,EAAA,mBAAA,CAOP,QAAA,OANC,MAAM,yBACN,KAAK,QACJ,MAAO,EAAA,WACP,aAAY,EAAA,YACZ,SAAU,EAAA,SACV,QAAO"}
@@ -0,0 +1,63 @@
1
+ import { Fragment as e, computed as t, createCommentVNode as n, createElementBlock as r, defineComponent as i, normalizeClass as a, normalizeStyle as o, openBlock as s, renderList as c } from "vue";
2
+ //#region src/components/TColorSwatch.vue?vue&type=script&setup=true&lang.ts
3
+ var l = ["aria-label"], u = [
4
+ "aria-label",
5
+ "aria-pressed",
6
+ "disabled",
7
+ "onClick"
8
+ ], d = [
9
+ "value",
10
+ "aria-label",
11
+ "disabled"
12
+ ], f = /*@__PURE__*/ i({
13
+ __name: "TColorSwatch",
14
+ props: {
15
+ modelValue: { default: void 0 },
16
+ options: { default: () => [] },
17
+ allowCustom: {
18
+ type: Boolean,
19
+ default: !1
20
+ },
21
+ size: { default: "md" },
22
+ label: { default: "Color" },
23
+ customLabel: { default: "Custom color" },
24
+ disabled: {
25
+ type: Boolean,
26
+ default: !1
27
+ }
28
+ },
29
+ emits: ["update:modelValue"],
30
+ setup(i, { emit: f }) {
31
+ let p = i, m = f, h = t(() => ["t-color-swatch", `t-color-swatch--${p.size}`]), g = (e) => !!p.modelValue && p.modelValue?.toLowerCase() === e.toLowerCase(), _ = (e) => {
32
+ p.disabled || m("update:modelValue", e);
33
+ }, v = (e) => {
34
+ m("update:modelValue", e.target.value);
35
+ };
36
+ return (t, f) => (s(), r("div", {
37
+ class: a(h.value),
38
+ role: "group",
39
+ "aria-label": i.label
40
+ }, [(s(!0), r(e, null, c(i.options, (e) => (s(), r("button", {
41
+ key: e.value,
42
+ type: "button",
43
+ class: a(["t-color-swatch__option", { "is-selected": g(e.value) }]),
44
+ style: o({ background: e.value }),
45
+ "aria-label": e.label,
46
+ "aria-pressed": g(e.value),
47
+ disabled: i.disabled,
48
+ onClick: (t) => _(e.value)
49
+ }, null, 14, u))), 128)), i.allowCustom ? (s(), r("input", {
50
+ key: 0,
51
+ class: "t-color-swatch__custom",
52
+ type: "color",
53
+ value: i.modelValue,
54
+ "aria-label": i.customLabel,
55
+ disabled: i.disabled,
56
+ onInput: v
57
+ }, null, 40, d)) : n("", !0)], 10, l));
58
+ }
59
+ });
60
+ //#endregion
61
+ export { f as default };
62
+
63
+ //# sourceMappingURL=TColorSwatch.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TColorSwatch.vue_vue_type_script_setup_true_lang.js","names":[],"sources":["../../src/components/TColorSwatch.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { computed } from 'vue';\nimport type { TSize } from '../types/contracts';\n\nexport interface TColorSwatchOption {\n label: string;\n value: string;\n}\n\nconst props = withDefaults(\n defineProps<{\n modelValue?: string;\n /** Preset colors offered as swatches. */\n options?: TColorSwatchOption[];\n /** Append a native colour input for an arbitrary value. */\n allowCustom?: boolean;\n size?: TSize;\n /** Accessible label for the swatch group. */\n label?: string;\n /** Accessible label for the custom colour input. */\n customLabel?: string;\n disabled?: boolean;\n }>(),\n {\n modelValue: undefined,\n options: () => [],\n allowCustom: false,\n size: 'md',\n label: 'Color',\n customLabel: 'Custom color',\n disabled: false,\n },\n);\n\nconst emit = defineEmits<{\n 'update:modelValue': [value: string];\n}>();\n\nconst classes = computed(() => ['t-color-swatch', `t-color-swatch--${props.size}`]);\n\nconst isSelected = (value: string) =>\n Boolean(props.modelValue) && props.modelValue?.toLowerCase() === value.toLowerCase();\n\nconst select = (value: string) => {\n if (props.disabled) {\n return;\n }\n emit('update:modelValue', value);\n};\n\nconst onCustomInput = (event: Event) => {\n emit('update:modelValue', (event.target as HTMLInputElement).value);\n};\n</script>\n\n<template>\n <div\n :class=\"classes\"\n role=\"group\"\n :aria-label=\"label\"\n >\n <button\n v-for=\"option in options\"\n :key=\"option.value\"\n type=\"button\"\n class=\"t-color-swatch__option\"\n :class=\"{ 'is-selected': isSelected(option.value) }\"\n :style=\"{ background: option.value }\"\n :aria-label=\"option.label\"\n :aria-pressed=\"isSelected(option.value)\"\n :disabled=\"disabled\"\n @click=\"select(option.value)\"\n />\n\n <input\n v-if=\"allowCustom\"\n class=\"t-color-swatch__custom\"\n type=\"color\"\n :value=\"modelValue\"\n :aria-label=\"customLabel\"\n :disabled=\"disabled\"\n @input=\"onCustomInput\"\n >\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASA,IAAM,IAAQ,GAyBR,IAAO,GAIP,IAAU,QAAe,CAAC,kBAAkB,mBAAmB,EAAM,MAAM,CAAC,GAE5E,KAAc,MAClB,EAAQ,EAAM,cAAe,EAAM,YAAY,YAAY,MAAM,EAAM,YAAY,GAE/E,KAAU,MAAkB;GAC5B,EAAM,YAGV,EAAK,qBAAqB,CAAK;EACjC,GAEM,KAAiB,MAAiB;GACtC,EAAK,qBAAsB,EAAM,OAA4B,KAAK;EACpE;yBAIE,EA2BM,OAAA;GA1BH,OAAK,EAAE,EAAA,KAAO;GACf,MAAK;GACJ,cAAY,EAAA;cAEb,EAWE,GAAA,MAAA,EAViB,EAAA,UAAV,YADT,EAWE,UAAA;GATC,KAAK,EAAO;GACb,MAAK;GACL,OAAK,EAAA,CAAC,0BAAwB,EAAA,eACL,EAAW,EAAO,KAAK,EAAA,CAAA,CAAA;GAC/C,OAAK,EAAA,EAAA,YAAgB,EAAO,MAAK,CAAA;GACjC,cAAY,EAAO;GACnB,gBAAc,EAAW,EAAO,KAAK;GACrC,UAAU,EAAA;GACV,UAAK,MAAE,EAAO,EAAO,KAAK;4BAIrB,EAAA,eAAA,EAAA,GADR,EAQC,SAAA;;GANC,OAAM;GACN,MAAK;GACJ,OAAO,EAAA;GACP,cAAY,EAAA;GACZ,UAAU,EAAA;GACV,SAAO"}