vue-chrts 0.1.12-test.2 → 0.2.0-beta.2

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.
@@ -1,9 +1,14 @@
1
- import { defineComponent as x, computed as c, createApp as A, createElementBlock as b, openBlock as t, normalizeClass as L, createVNode as p, createCommentVNode as m, unref as i, withCtx as V, createBlock as l } from "vue";
2
- import { Orientation as s, StackedBar as P, GroupedBar as O } from "@unovis/ts";
3
- import { VisXYContainer as C, VisTooltip as F, VisGroupedBar as G, VisStackedBar as N, VisAxis as T, VisBulletLegend as j } from "@unovis/vue";
4
- import w from "../Tooltip.js";
5
- import { LegendPosition as E } from "../../types.js";
6
- const H = /* @__PURE__ */ x({
1
+ import { defineComponent as C, useSlots as N, useTemplateRef as O, ref as D, computed as T, createElementBlock as m, openBlock as n, normalizeClass as L, createVNode as g, createCommentVNode as c, createElementVNode as w, unref as i, withCtx as E, createBlock as u, Fragment as M, renderList as S, renderSlot as v } from "vue";
2
+ import { Orientation as l, StackedBar as j, GroupedBar as z } from "@unovis/ts";
3
+ import { getFirstPropertyValue as H } from "../../utils.js";
4
+ import { useStackedGrouped as W } from "./stackedGroupedUtils.js";
5
+ import { VisXYContainer as X, VisTooltip as Y, VisStackedBar as B, VisGroupedBar as $, VisAxis as A, VisBulletLegend as R } from "@unovis/vue";
6
+ import q from "../Tooltip.js";
7
+ import { LegendPosition as U } from "../../types.js";
8
+ const I = {
9
+ ref: "slotWrapper",
10
+ class: "hidden"
11
+ }, ae = /* @__PURE__ */ C({
7
12
  __name: "BarChart",
8
13
  props: {
9
14
  data: {},
@@ -20,16 +25,17 @@ const H = /* @__PURE__ */ x({
20
25
  categories: {},
21
26
  xFormatter: {},
22
27
  yFormatter: {},
23
- yNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
28
+ yNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
24
29
  minMaxTicksOnly: { type: Boolean },
25
- xNumTicks: { default: (a) => a.data.length > 24 ? 24 / 4 : a.data.length - 1 },
30
+ xNumTicks: { default: (t) => t.data.length > 24 ? 24 / 4 : t.data.length - 1 },
26
31
  xExplicitTicks: {},
27
32
  yAxis: {},
28
33
  groupPadding: {},
29
34
  barPadding: {},
30
35
  radius: {},
31
36
  hideLegend: { type: Boolean },
32
- orientation: { default: s.Vertical },
37
+ hideTooltip: { type: Boolean, default: !1 },
38
+ orientation: { default: l.Vertical },
33
39
  legendPosition: {},
34
40
  xDomainLine: { type: Boolean },
35
41
  yDomainLine: { type: Boolean },
@@ -38,69 +44,80 @@ const H = /* @__PURE__ */ x({
38
44
  xGridLine: { type: Boolean },
39
45
  yGridLine: { type: Boolean, default: !0 },
40
46
  hideXAxis: { type: Boolean },
41
- hideYAxis: { type: Boolean }
47
+ hideYAxis: { type: Boolean },
48
+ stackAndGrouped: { type: Boolean },
49
+ xAxis: {}
42
50
  },
43
- setup(a) {
44
- const n = a;
45
- if (!n.yAxis || n.yAxis.length === 0)
51
+ emits: ["click"],
52
+ setup(t, { emit: V }) {
53
+ const x = V, a = t, P = N(), y = O("slotWrapper"), r = D();
54
+ if (!a.yAxis || a.yAxis.length === 0)
46
55
  throw new Error("yAxis is required");
47
- const y = c(() => n.yAxis.map((e) => (o) => o[e])), g = (e, o) => Object.values(n.categories)[o].color, k = c(
48
- () => n.legendPosition === E.Top
49
- ), f = c(() => (e, o) => {
50
- if (typeof window > "u" || typeof document > "u")
51
- return "";
52
- const u = Object.keys(n.categories), B = Object.keys(e).find((r) => !u.includes(r));
53
- try {
54
- const r = A(w, {
55
- data: e,
56
- categories: n.categories,
57
- toolTipTitle: e[B],
58
- yFormatter: n.yFormatter
59
- }), h = document.createElement("div");
60
- r.mount(h);
61
- const v = h.innerHTML;
62
- return r.unmount(), v;
63
- } catch {
64
- return "";
65
- }
66
- });
67
- return (e, o) => (t(), b("div", {
68
- class: L(["flex flex-col space-y-4", { "flex-col-reverse": k.value }])
56
+ const k = T(() => a.yAxis.map((e) => (d) => d[e])), f = (e, d) => {
57
+ var o;
58
+ return (o = Object.values(a.categories)[d]) == null ? void 0 : o.color;
59
+ }, s = W({
60
+ data: a.data,
61
+ categories: a.categories,
62
+ stackAndGrouped: a.stackAndGrouped,
63
+ xAxis: a.xAxis
64
+ }), h = T(
65
+ () => a.legendPosition === U.Top
66
+ );
67
+ function b(e) {
68
+ return r.value = e, G();
69
+ }
70
+ function G(e) {
71
+ return typeof window > "u" ? "" : y.value ? y.value.innerHTML : "";
72
+ }
73
+ return (e, d) => (n(), m("div", {
74
+ class: L(["flex flex-col space-y-4", { "flex-col-reverse": h.value }]),
75
+ onClick: d[0] || (d[0] = (o) => x("click", o, r.value))
69
76
  }, [
70
- p(i(C), {
77
+ g(i(X), {
71
78
  padding: e.padding,
72
79
  height: e.height
73
80
  }, {
74
- default: V(() => [
75
- p(i(F), {
81
+ default: E(() => [
82
+ g(i(Y), {
76
83
  triggers: {
77
- [i(O).selectors.bar]: f.value,
78
- [i(P).selectors.bar]: f.value
84
+ [i(z).selectors.bar]: b,
85
+ [i(j).selectors.bar]: b
79
86
  }
80
87
  }, null, 8, ["triggers"]),
81
- e.stacked ? (t(), l(i(N), {
82
- key: 1,
88
+ e.stackAndGrouped ? (n(!0), m(M, { key: 0 }, S(i(s).states, (o) => (n(), u(i(B), {
89
+ key: o,
90
+ data: i(s).chartData,
91
+ x: (p, F) => F + i(s).positions[o],
92
+ y: i(s).bars[o],
93
+ color: i(s).colorFunctions[o],
94
+ "rounded-corners": e.radius ?? 0,
95
+ "group-padding": e.groupPadding ?? 0,
96
+ "bar-padding": e.barPadding ?? 0.2,
97
+ orientation: e.orientation ?? i(l).Vertical
98
+ }, null, 8, ["data", "x", "y", "color", "rounded-corners", "group-padding", "bar-padding", "orientation"]))), 128)) : e.stacked ? (n(), u(i(B), {
99
+ key: 2,
83
100
  data: e.data,
84
- x: (u, d) => d,
85
- y: y.value,
86
- color: g,
101
+ x: (o, p) => p,
102
+ y: k.value,
103
+ color: f,
87
104
  "rounded-corners": e.radius ?? 0,
88
105
  "group-padding": e.groupPadding ?? 0,
89
106
  "bar-padding": e.barPadding ?? 0.2,
90
- orientation: e.orientation ?? i(s).Vertical
91
- }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (t(), l(i(G), {
92
- key: 0,
107
+ orientation: e.orientation ?? i(l).Vertical
108
+ }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])) : (n(), u(i($), {
109
+ key: 1,
93
110
  data: e.data,
94
- x: (u, d) => d,
95
- y: y.value,
96
- color: g,
111
+ x: (o, p) => p,
112
+ y: k.value,
113
+ color: f,
97
114
  "rounded-corners": e.radius ?? 0,
98
115
  "group-padding": e.groupPadding ?? 0,
99
116
  "bar-padding": e.barPadding ?? 0.2,
100
- orientation: e.orientation ?? i(s).Vertical
117
+ orientation: e.orientation ?? i(l).Vertical
101
118
  }, null, 8, ["data", "x", "y", "rounded-corners", "group-padding", "bar-padding", "orientation"])),
102
- e.hideXAxis ? m("", !0) : (t(), l(i(T), {
103
- key: 2,
119
+ e.hideXAxis ? c("", !0) : (n(), u(i(A), {
120
+ key: 3,
104
121
  type: "x",
105
122
  "tick-format": e.xFormatter,
106
123
  label: e.xLabel,
@@ -111,11 +128,11 @@ const H = /* @__PURE__ */ x({
111
128
  "tick-values": e.xExplicitTicks,
112
129
  minMaxTicksOnly: e.minMaxTicksOnly
113
130
  }, null, 8, ["tick-format", "label", "grid-line", "domain-line", "tick-line", "num-ticks", "tick-values", "minMaxTicksOnly"])),
114
- e.hideYAxis ? m("", !0) : (t(), l(i(T), {
115
- key: 3,
131
+ e.hideYAxis ? c("", !0) : (n(), u(i(A), {
132
+ key: 4,
116
133
  type: "y",
117
134
  label: e.yLabel,
118
- "grid-line": e.orientation !== i(s).Horizontal && e.yGridLine,
135
+ "grid-line": e.orientation !== i(l).Horizontal && e.yGridLine,
119
136
  "domain-line": !!e.yDomainLine,
120
137
  "tick-format": e.yFormatter,
121
138
  "num-ticks": e.yNumTicks,
@@ -124,17 +141,30 @@ const H = /* @__PURE__ */ x({
124
141
  ]),
125
142
  _: 1
126
143
  }, 8, ["padding", "height"]),
127
- e.hideLegend ? m("", !0) : (t(), b("div", {
144
+ e.hideLegend ? c("", !0) : (n(), m("div", {
128
145
  key: 0,
129
- class: L(["flex items center justify-end", { "pb-4": k.value }])
146
+ class: L(["flex items center justify-end", { "pb-4": h.value }])
130
147
  }, [
131
- p(i(j), {
132
- items: Object.values(e.categories)
148
+ g(i(R), {
149
+ items: Object.values(a.categories)
133
150
  }, null, 8, ["items"])
134
- ], 2))
151
+ ], 2)),
152
+ w("div", I, [
153
+ i(P).tooltip ? v(e.$slots, "tooltip", {
154
+ key: 0,
155
+ values: r.value
156
+ }) : r.value ? v(e.$slots, "fallback", { key: 1 }, () => [
157
+ g(q, {
158
+ data: r.value,
159
+ categories: a.categories,
160
+ toolTipTitle: i(H)(r.value) ?? "",
161
+ yFormatter: a.orientation === i(l).Horizontal ? a.xFormatter : a.yFormatter
162
+ }, null, 8, ["data", "categories", "toolTipTitle", "yFormatter"])
163
+ ]) : c("", !0)
164
+ ], 512)
135
165
  ], 2));
136
166
  }
137
167
  });
138
168
  export {
139
- H as default
169
+ ae as default
140
170
  };
@@ -1,10 +1,17 @@
1
1
  import { BarChartProps } from './types';
2
2
  declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
- props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: T | undefined) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & BarChartProps<T> & Partial<{}>> & import('vue').PublicProps;
4
6
  expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
5
7
  attrs: any;
6
- slots: {};
7
- emit: {};
8
+ slots: {
9
+ tooltip?(_: {
10
+ values: any;
11
+ }): any;
12
+ fallback?(_: {}): any;
13
+ };
14
+ emit: (e: "click", event: MouseEvent, values?: T) => void;
8
15
  }>) => import('vue').VNode & {
9
16
  __ctx?: Awaited<typeof __VLS_setup>;
10
17
  };
@@ -0,0 +1,19 @@
1
+ import { ComputedRef } from 'vue';
2
+ export interface StackedGroupedConfig<T> {
3
+ data: T[];
4
+ categories: Record<string, {
5
+ color?: string;
6
+ }>;
7
+ stackAndGrouped: boolean;
8
+ xAxis?: keyof T;
9
+ }
10
+ export interface StackedGroupedResult<T> {
11
+ states: string[];
12
+ groupedByState: Record<string, string[]>;
13
+ colors: Record<string, string[]>;
14
+ bars: Record<string, ((d: any) => any)[]>;
15
+ colorFunctions: Record<string, (d: unknown, i: number) => string>;
16
+ positions: Record<string, number>;
17
+ chartData: T[] | any[];
18
+ }
19
+ export declare function useStackedGrouped<T extends {}>(config: StackedGroupedConfig<T>): ComputedRef<StackedGroupedResult<T>>;
@@ -0,0 +1,67 @@
1
+ import { computed as u } from "vue";
2
+ import { flattenData as i } from "../../utils.js";
3
+ function b(t) {
4
+ return u(() => {
5
+ const o = f(t.categories), e = l(t.categories, o), r = p(e, t.categories), c = d(e), n = m(r), s = h(o);
6
+ console.log(t, "config");
7
+ const a = t.stackAndGrouped ? i(t.data, t.xAxis) : t.data;
8
+ return {
9
+ states: o,
10
+ groupedByState: e,
11
+ colors: r,
12
+ bars: c,
13
+ colorFunctions: n,
14
+ positions: s,
15
+ chartData: a
16
+ };
17
+ });
18
+ }
19
+ function f(t) {
20
+ const o = /* @__PURE__ */ new Set();
21
+ return Object.keys(t).forEach((r) => {
22
+ const c = r.match(/([A-Z][a-z]+)$/);
23
+ c && o.add(c[1]);
24
+ }), Array.from(o);
25
+ }
26
+ function l(t, o) {
27
+ const e = {};
28
+ return o.forEach((r) => {
29
+ e[r] = Object.keys(t).filter(
30
+ (c) => c.endsWith(r)
31
+ );
32
+ }), e;
33
+ }
34
+ function p(t, o) {
35
+ const e = {};
36
+ return Object.entries(t).forEach(([r, c]) => {
37
+ e[r] = c.map((n) => {
38
+ var s;
39
+ return ((s = o[n]) == null ? void 0 : s.color) ?? "#ccc";
40
+ });
41
+ }), e;
42
+ }
43
+ function d(t) {
44
+ const o = {};
45
+ return Object.entries(t).forEach(([e, r]) => {
46
+ o[e] = r.map((c) => {
47
+ const n = c.replace(e, "").toLowerCase();
48
+ return (s) => s[n + e];
49
+ });
50
+ }), o;
51
+ }
52
+ function m(t) {
53
+ const o = {};
54
+ return Object.entries(t).forEach(([e, r]) => {
55
+ o[e] = (c, n) => r[n] ?? "#ccc";
56
+ }), o;
57
+ }
58
+ function h(t) {
59
+ const o = t.length, e = 0.4, r = {};
60
+ return t.forEach((c, n) => {
61
+ const s = (n - (o - 1) / 2) * e;
62
+ r[c] = s;
63
+ }), r;
64
+ }
65
+ export {
66
+ b as useStackedGrouped
67
+ };
@@ -1,5 +1,5 @@
1
- import { BulletLegendItemInterface, Orientation, LegendPosition } from '../../types';
2
- export interface BarChartProps<T> {
1
+ import { BulletLegendItemInterface, Orientation, LegendPosition, axisFormatter } from '../../types';
2
+ type BarChartPropsBase<T> = {
3
3
  /**
4
4
  * The data to be displayed in the bar chart.
5
5
  * Each element of the array represents a data point.
@@ -23,9 +23,9 @@ export interface BarChartProps<T> {
23
23
  */
24
24
  yLabel?: string;
25
25
  /**
26
- * Optional padding applied to the chart.
27
- * Allows specifying individual padding values for the top, right, bottom, and left sides.
28
- */
26
+ * Optional padding applied to the chart.
27
+ * Allows specifying individual padding values for the top, right, bottom, and left sides.
28
+ */
29
29
  padding?: {
30
30
  top: number;
31
31
  right: number;
@@ -38,19 +38,19 @@ export interface BarChartProps<T> {
38
38
  */
39
39
  categories: Record<string, BulletLegendItemInterface>;
40
40
  /**
41
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
42
- * @param {number} i - The index of the tick in the `ticks` array.
43
- * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
44
- * @returns {string} The formatted string representation of the tick.
45
- */
46
- xFormatter?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);
41
+ * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the x-axis.
42
+ * @param {number} i - The index of the tick in the `ticks` array.
43
+ * @param {(number[]|Date[])} ticks - An array of all tick values for the x-axis.
44
+ * @returns {string} The formatted string representation of the tick.
45
+ */
46
+ xFormatter?: axisFormatter;
47
47
  /**
48
- * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
49
- * @param {number} i - The index of the tick in the `ticks` array.
50
- * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
51
- * @returns {string} The formatted string representation of the tick.
52
- */
53
- yFormatter?: ((tick: number, i: number, ticks: number[]) => string) | ((tick: Date, i: number, ticks: Date[]) => string);
48
+ * @param {number|Date} tick - The value of the tick. This can be a number or a Date object depending on the scale of the y-axis.
49
+ * @param {number} i - The index of the tick in the `ticks` array.
50
+ * @param {(number[]|Date[])} ticks - An array of all tick values for the y-axis.
51
+ * @returns {string} The formatted string representation of the tick.
52
+ */
53
+ yFormatter?: axisFormatter;
54
54
  /**
55
55
  * The desired number of ticks on the y-axis.
56
56
  */
@@ -87,6 +87,10 @@ export interface BarChartProps<T> {
87
87
  * If `true`, hides the chart legend.
88
88
  */
89
89
  hideLegend?: boolean;
90
+ /**
91
+ * If `true`, hides the chart tooltip.
92
+ */
93
+ hideTooltip?: boolean;
90
94
  /**
91
95
  * The orientation of the bars (vertical or horizontal).
92
96
  * See `Orientation` for available options.
@@ -129,4 +133,22 @@ export interface BarChartProps<T> {
129
133
  * If `true`, hide the y-axis.
130
134
  */
131
135
  hideYAxis?: boolean;
132
- }
136
+ };
137
+ type BarChartPropsStackAndGrouped<T> = BarChartPropsBase<T> & {
138
+ stackAndGrouped: true;
139
+ /**
140
+ * The key in the data object type 'T' to be used for the x-axis values.
141
+ * Required when stackAndGrouped is true.
142
+ */
143
+ xAxis: keyof T;
144
+ };
145
+ type BarChartPropsNormal<T> = BarChartPropsBase<T> & {
146
+ stackAndGrouped?: false;
147
+ /**
148
+ * The key in the data object type 'T' to be used for the x-axis values.
149
+ * Optional when stackAndGrouped is not true.
150
+ */
151
+ xAxis?: keyof T;
152
+ };
153
+ export type BarChartProps<T> = BarChartPropsStackAndGrouped<T> | BarChartPropsNormal<T>;
154
+ export {};
@@ -1,11 +1,14 @@
1
- import { defineComponent as u, createElementBlock as n, openBlock as i, Fragment as m, createElementVNode as f, createCommentVNode as p, createVNode as t, renderSlot as g, unref as o, withCtx as h } from "vue";
2
- import { Donut as v } from "@unovis/ts";
3
- import { VisSingleContainer as y, VisTooltip as V, VisDonut as b, VisBulletLegend as C } from "@unovis/vue";
4
- import { DonutType as _ } from "./types.js";
5
- const k = { class: "flex items-center justify-center" }, B = {
1
+ import { defineComponent as V, useSlots as b, useTemplateRef as D, ref as S, createElementBlock as d, openBlock as c, Fragment as T, createElementVNode as o, createCommentVNode as p, createVNode as r, renderSlot as a, unref as l, withCtx as w, normalizeStyle as B, toDisplayString as L } from "vue";
2
+ import { Donut as $ } from "@unovis/ts";
3
+ import { DonutType as H } from "./types.js";
4
+ import { VisSingleContainer as N, VisTooltip as W, VisDonut as _, VisBulletLegend as j } from "@unovis/vue";
5
+ const z = {
6
+ ref: "slotWrapper",
7
+ class: "hidden"
8
+ }, A = { class: "flex items-center" }, E = {
6
9
  key: 0,
7
10
  class: "flex items-center justify-center mt-4"
8
- }, w = /* @__PURE__ */ u({
11
+ }, q = /* @__PURE__ */ V({
9
12
  __name: "DonutChart",
10
13
  props: {
11
14
  type: {},
@@ -13,46 +16,68 @@ const k = { class: "flex items-center justify-center" }, B = {
13
16
  height: {},
14
17
  radius: {},
15
18
  hideLegend: { type: Boolean },
16
- labels: {}
19
+ labels: {},
20
+ padAngle: {}
17
21
  },
18
- setup(l) {
19
- const r = l, s = (e) => e, a = r.type === _.Half, d = {
20
- [v.selectors.segment]: (e) => `<div class='flex items-center'><div class='w-2 h-2 rounded-full mr-2' style='background-color: ${r.labels[e.index].color} ;'></div>
21
- <div>${e.data}</div>
22
- </vistooltip>
23
- </vissinglecontainer>
24
- </div>`
25
- };
26
- return (e, D) => (i(), n(m, null, [
27
- f("div", k, [
28
- t(o(y), {
22
+ emits: ["click"],
23
+ setup(f, { emit: m }) {
24
+ const g = m, n = f, h = b(), i = D("slotWrapper"), t = S(), v = (e) => e, y = n.type === H.Half;
25
+ function k(e) {
26
+ return t.value = e, C();
27
+ }
28
+ function C(e) {
29
+ return typeof window > "u" ? "" : i.value ? i.value.innerHTML : "";
30
+ }
31
+ return (e, u) => (c(), d(T, null, [
32
+ o("div", {
33
+ class: "flex items-center justify-center",
34
+ onClick: u[0] || (u[0] = (s) => g("click", s, t.value))
35
+ }, [
36
+ r(l(N), {
29
37
  data: e.data,
30
38
  height: e.height,
31
39
  margin: {}
32
40
  }, {
33
- default: h(() => [
34
- t(o(V), {
41
+ default: w(() => [
42
+ r(l(W), {
35
43
  "horizontal-shift": 20,
36
44
  "vertical-shift": 20,
37
- triggers: d
38
- }),
39
- t(o(b), {
40
- value: s,
45
+ triggers: {
46
+ [l($).selectors.segment]: k
47
+ }
48
+ }, null, 8, ["triggers"]),
49
+ r(l(_), {
50
+ value: v,
41
51
  "corner-radius": e.radius,
42
- color: r.labels.map((c) => c.color),
43
- "angle-range": a ? [-1.5707963267948966, 1.5707963267948966] : []
44
- }, null, 8, ["corner-radius", "color", "angle-range"])
52
+ color: n.labels.map((s) => s.color),
53
+ "angle-range": y ? [-1.5707963267948966, 1.5707963267948966] : [],
54
+ "pad-angle": n.padAngle || 0
55
+ }, null, 8, ["corner-radius", "color", "angle-range", "pad-angle"])
45
56
  ]),
46
57
  _: 1
47
58
  }, 8, ["data", "height"]),
48
- g(e.$slots, "default")
59
+ a(e.$slots, "default"),
60
+ o("div", z, [
61
+ l(h).tooltip ? a(e.$slots, "tooltip", {
62
+ key: 0,
63
+ values: t.value
64
+ }) : t.value ? a(e.$slots, "fallback", { key: 1 }, () => [
65
+ o("div", A, [
66
+ o("div", {
67
+ class: "w-2 h-2 rounded-full mr-2",
68
+ style: B(`background-color: ${n.labels[t.value.index].color} ;`)
69
+ }, null, 4),
70
+ o("div", null, L(t.value.data), 1)
71
+ ])
72
+ ]) : p("", !0)
73
+ ], 512)
49
74
  ]),
50
- e.hideLegend ? p("", !0) : (i(), n("div", B, [
51
- t(o(C), { items: e.labels }, null, 8, ["items"])
75
+ e.hideLegend ? p("", !0) : (c(), d("div", E, [
76
+ r(l(j), { items: e.labels }, null, 8, ["items"])
52
77
  ]))
53
78
  ], 64));
54
79
  }
55
80
  });
56
81
  export {
57
- w as default
82
+ q as default
58
83
  };
@@ -1,18 +1,22 @@
1
1
  import { DonutChartProps } from './types';
2
- declare function __VLS_template(): {
3
- attrs: Partial<{}>;
2
+ declare const _default: <T extends {}>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
4
+ readonly onClick?: ((event: MouseEvent, values?: any) => any) | undefined;
5
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onClick"> & DonutChartProps & Partial<{}>> & import('vue').PublicProps;
6
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
7
+ attrs: any;
4
8
  slots: {
5
9
  default?(_: {}): any;
10
+ tooltip?(_: {
11
+ values: any;
12
+ }): any;
13
+ fallback?(_: {}): any;
6
14
  };
7
- refs: {};
8
- rootEl: any;
15
+ emit: (e: "click", event: MouseEvent, values?: any) => void;
16
+ }>) => import('vue').VNode & {
17
+ __ctx?: Awaited<typeof __VLS_setup>;
9
18
  };
10
- type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
11
- declare const __VLS_component: import('vue').DefineComponent<DonutChartProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<DonutChartProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
12
- declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
13
19
  export default _default;
14
- type __VLS_WithTemplateSlots<T, S> = T & {
15
- new (): {
16
- $slots: S;
17
- };
18
- };
20
+ type __VLS_PrettifyLocal<T> = {
21
+ [K in keyof T]: T[K];
22
+ } & {};
@@ -1,4 +1,4 @@
1
- interface DonutChartProps {
1
+ export type DonutChartProps = {
2
2
  /**
3
3
  * The type of donut chart to render.
4
4
  * See `DonutType` for available options.
@@ -28,9 +28,13 @@ interface DonutChartProps {
28
28
  name: string;
29
29
  color: string;
30
30
  }[];
31
- }
31
+ /**
32
+ * Pad angle. Default: 0
33
+ */
34
+ padAngle?: number;
35
+ };
32
36
  declare enum DonutType {
33
37
  Half = "half",
34
38
  Full = "full"
35
39
  }
36
- export { type DonutChartProps, DonutType };
40
+ export { DonutType };