@bridge-ui/vue 0.17.2 → 0.18.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 (151) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +33 -33
  2. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
  3. package/dist/Components/CalendarRange/composables/useCalendarRange.js +1 -1
  4. package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +1 -0
  5. package/dist/Components/ChartAxis/chartAxis.types.d.ts +17 -7
  6. package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +2 -2
  7. package/dist/Components/ChartAxis/composables/useChartAxis.js +15 -10
  8. package/dist/Components/ChartBar/ChartBar.js +5 -0
  9. package/dist/Components/ChartBar/ChartBar.vue.d.ts +16 -0
  10. package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +59 -0
  11. package/dist/Components/ChartBar/chartBar.types.d.ts +56 -0
  12. package/dist/Components/ChartBar/composables/useChartBar.d.ts +26 -0
  13. package/dist/Components/ChartBar/composables/useChartBar.js +13 -0
  14. package/dist/Components/ChartBar/index.d.ts +4 -0
  15. package/dist/Components/ChartBar/index.js +4 -0
  16. package/dist/Components/ChartBarSeries/ChartBarSeries.js +5 -0
  17. package/dist/Components/ChartBarSeries/ChartBarSeries.vue.d.ts +6 -0
  18. package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +25 -0
  19. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +45 -0
  20. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
  21. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +20 -0
  22. package/dist/Components/ChartBarSeries/index.d.ts +3 -0
  23. package/dist/Components/ChartBarSeries/index.js +3 -0
  24. package/dist/Components/ChartFunnel/ChartFunnel.js +5 -0
  25. package/dist/Components/ChartFunnel/ChartFunnel.vue.d.ts +16 -0
  26. package/dist/Components/ChartFunnel/ChartFunnel.vue_vue_type_script_setup_true_lang.js +59 -0
  27. package/dist/Components/ChartFunnel/chartFunnel.types.d.ts +54 -0
  28. package/dist/Components/ChartFunnel/composables/useChartFunnel.d.ts +29 -0
  29. package/dist/Components/ChartFunnel/composables/useChartFunnel.js +68 -0
  30. package/dist/Components/ChartFunnel/index.d.ts +4 -0
  31. package/dist/Components/ChartFunnel/index.js +4 -0
  32. package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +2 -0
  33. package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -13
  34. package/dist/Components/ChartLegend/chartLegend.types.d.ts +41 -5
  35. package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +9 -5
  36. package/dist/Components/ChartLegend/composables/useChartLegend.js +88 -54
  37. package/dist/Components/ChartLine/ChartLine.js +5 -0
  38. package/dist/Components/ChartLine/ChartLine.vue.d.ts +20 -0
  39. package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +76 -0
  40. package/dist/Components/ChartLine/chartLine.types.d.ts +72 -0
  41. package/dist/Components/ChartLine/composables/useChartLine.d.ts +26 -0
  42. package/dist/Components/ChartLine/composables/useChartLine.js +13 -0
  43. package/dist/Components/ChartLine/index.d.ts +4 -0
  44. package/dist/Components/ChartLine/index.js +4 -0
  45. package/dist/Components/ChartLineSeries/ChartLineSeries.js +5 -0
  46. package/dist/Components/ChartLineSeries/ChartLineSeries.vue.d.ts +10 -0
  47. package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +42 -0
  48. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +75 -0
  49. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
  50. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +25 -0
  51. package/dist/Components/ChartLineSeries/index.d.ts +3 -0
  52. package/dist/Components/ChartLineSeries/index.js +3 -0
  53. package/dist/Components/ChartPie/ChartPie.js +5 -0
  54. package/dist/Components/ChartPie/ChartPie.vue.d.ts +15 -0
  55. package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +73 -0
  56. package/dist/Components/ChartPie/chartPie.types.d.ts +73 -0
  57. package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
  58. package/dist/Components/ChartPie/composables/useChartPie.js +71 -0
  59. package/dist/Components/ChartPie/index.d.ts +4 -0
  60. package/dist/Components/ChartPie/index.js +4 -0
  61. package/dist/Components/ChartScatter/ChartScatter.js +5 -0
  62. package/dist/Components/{Chart/Chart.vue.d.ts → ChartScatter/ChartScatter.vue.d.ts} +3 -2
  63. package/dist/Components/ChartScatter/ChartScatter.vue_vue_type_script_setup_true_lang.js +49 -0
  64. package/dist/Components/ChartScatter/chartScatter.types.d.ts +23 -0
  65. package/dist/Components/ChartScatter/composables/useChartScatter.d.ts +29 -0
  66. package/dist/Components/ChartScatter/composables/useChartScatter.js +103 -0
  67. package/dist/Components/ChartScatter/index.d.ts +4 -0
  68. package/dist/Components/ChartScatter/index.js +4 -0
  69. package/dist/Components/ChartScatterSeries/ChartScatterSeries.js +5 -0
  70. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue.d.ts +4 -0
  71. package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +21 -0
  72. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +38 -0
  73. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
  74. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +18 -0
  75. package/dist/Components/ChartScatterSeries/index.d.ts +3 -0
  76. package/dist/Components/ChartScatterSeries/index.js +3 -0
  77. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +18 -10
  78. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +24 -9
  79. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +3 -1
  80. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +79 -65
  81. package/dist/Components/ColorPicker/composables/useColorPicker.js +1 -1
  82. package/dist/Components/DatePicker/composables/useDatePicker.js +1 -1
  83. package/dist/Components/DateRangePicker/composables/useDateRangePicker.js +1 -1
  84. package/dist/Components/DateTimePicker/composables/useDateTimePicker.js +1 -1
  85. package/dist/Components/DateTimeRangePicker/composables/useDateTimeRangePicker.js +1 -1
  86. package/dist/Components/FormField/composables/useFormField.js +3 -1
  87. package/dist/Components/OtpField/composables/useOtpField.js +90 -89
  88. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  89. package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
  90. package/dist/Components/TimePicker/composables/useTimePicker.js +1 -1
  91. package/dist/Components/TimeRangePicker/composables/useTimeRangePicker.js +1 -1
  92. package/dist/Utils/Charts/ChartFrame.js +5 -0
  93. package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
  94. package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
  95. package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +16 -18
  96. package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
  97. package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
  98. package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
  99. package/dist/Utils/Charts/echarts/bar.js +22 -0
  100. package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
  101. package/dist/Utils/Charts/echarts/cartesian.js +255 -0
  102. package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
  103. package/dist/Utils/Charts/echarts/funnel.js +79 -0
  104. package/dist/Utils/Charts/echarts/line.d.ts +5 -0
  105. package/dist/Utils/Charts/echarts/line.js +19 -0
  106. package/dist/Utils/Charts/echarts/part.d.ts +19 -0
  107. package/dist/Utils/Charts/echarts/part.js +45 -0
  108. package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
  109. package/dist/Utils/Charts/echarts/pie.js +75 -0
  110. package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
  111. package/dist/Utils/Charts/echarts/plot.js +52 -0
  112. package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
  113. package/dist/Utils/Charts/echarts/scatter.js +152 -0
  114. package/dist/Utils/Charts/index.d.ts +6 -0
  115. package/dist/Utils/Charts/index.js +6 -0
  116. package/dist/Utils/Charts/useChartCartesian.d.ts +57 -0
  117. package/dist/Utils/Charts/useChartCartesian.js +155 -0
  118. package/dist/Utils/Charts/useChartPart.d.ts +45 -0
  119. package/dist/Utils/Charts/useChartPart.js +97 -0
  120. package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
  121. package/dist/Utils/Charts/useChartRegistry.js +40 -0
  122. package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
  123. package/dist/Utils/Charts/useChartRoot.js +342 -0
  124. package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
  125. package/dist/Utils/Charts/useChartSeries.js +22 -0
  126. package/dist/augments.d.ts +23 -7
  127. package/docs/README.md +6 -1
  128. package/docs/components/Chart.md +114 -154
  129. package/docs/components/ChartBar.md +137 -0
  130. package/docs/components/ChartFunnel.md +62 -0
  131. package/docs/components/ChartLine.md +151 -0
  132. package/docs/components/ChartPie.md +115 -0
  133. package/docs/components/ChartScatter.md +84 -0
  134. package/package.json +2 -2
  135. package/dist/Components/Chart/Chart.js +0 -5
  136. package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
  137. package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
  138. package/dist/Components/Chart/composables/useChart.d.ts +0 -40
  139. package/dist/Components/Chart/composables/useChart.js +0 -346
  140. package/dist/Components/Chart/echartsChart.d.ts +0 -14
  141. package/dist/Components/Chart/echartsChart.js +0 -199
  142. package/dist/Components/Chart/index.d.ts +0 -4
  143. package/dist/Components/Chart/index.js +0 -4
  144. package/dist/Components/ChartSeries/ChartSeries.js +0 -5
  145. package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
  146. package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
  147. package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
  148. package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
  149. package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
  150. package/dist/Components/ChartSeries/index.d.ts +0 -3
  151. package/dist/Components/ChartSeries/index.js +0 -3
@@ -0,0 +1,54 @@
1
+ import { HTMLAttributes } from 'vue';
2
+ import { ChartFunnelAlign, ChartFunnelSort, ChartLabelContent, ChartLabelPosition, ChartSlice } from '@bridge-ui/core/Domain';
3
+ import { MergeHtmlProps } from '@bridge-ui/core/Utils';
4
+ import { ChartColorValue, ChartRootOwnProps } from '../../Utils/Charts';
5
+ /**
6
+ * Funnel chart root. Takes its stages from `data`; compose with
7
+ * `ChartLegend` and `ChartTooltip`.
8
+ */
9
+ export interface ChartFunnelOwnProps extends ChartRootOwnProps {
10
+ /**
11
+ * Shape alignment.
12
+ *
13
+ * @default "center"
14
+ */
15
+ align?: ChartFunnelAlign;
16
+ /**
17
+ * Stages. Percents compare each stage to the largest one.
18
+ */
19
+ data: ChartFunnelStage[];
20
+ /**
21
+ * What plot labels show: `"label"`, `"value"`, `"percent"`, or custom text.
22
+ *
23
+ * @default "label"
24
+ */
25
+ labelContent?: ChartLabelContent;
26
+ /**
27
+ * Where plot labels sit when `labels` is on.
28
+ *
29
+ * @default "inside"
30
+ */
31
+ labelPosition?: ChartLabelPosition;
32
+ /**
33
+ * Shows stage labels on the plot. Legend labels come from `ChartLegend`.
34
+ *
35
+ * @default true
36
+ */
37
+ labels?: boolean;
38
+ /**
39
+ * Stage order, top to bottom. `"none"` keeps the `data` order.
40
+ *
41
+ * @default "descending"
42
+ */
43
+ sort?: ChartFunnelSort;
44
+ }
45
+ /**
46
+ * One stage: label, value, and an optional color (token key or CSS color).
47
+ */
48
+ export interface ChartFunnelStage extends Omit<ChartSlice, "color"> {
49
+ /**
50
+ * Stage color. Falls back to the palette.
51
+ */
52
+ color?: ChartColorValue;
53
+ }
54
+ export type ChartFunnelProps = MergeHtmlProps<ChartFunnelOwnProps, HTMLAttributes>;
@@ -0,0 +1,29 @@
1
+ import { ChartFunnelRenderOptions } from '@bridge-ui/core/Domain';
2
+ import { ChartFunnelOwnProps } from '../chartFunnel.types';
3
+ import { ChartRootMerged } from '../../../Utils/Charts';
4
+ type ChartFunnelMerged = ChartRootMerged & Pick<ChartFunnelOwnProps, "sort" | "align" | "labels" | "labelPosition">;
5
+ export declare function useChartFunnel(props: ChartFunnelOwnProps, libDefaults: Partial<ChartFunnelMerged>): {
6
+ merged: import('vue').ComputedRef<ChartFunnelMerged>;
7
+ frame: {
8
+ label: import('vue').ComputedRef<string>;
9
+ table: import('vue').ComputedRef<import('@bridge-ui/core/Domain').ChartTable>;
10
+ isEmpty: import('vue').ComputedRef<boolean>;
11
+ hostBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
12
+ plotBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
13
+ rootBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
14
+ liveBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
15
+ emptyBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
16
+ isLoading: import('vue').ComputedRef<boolean>;
17
+ tableBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
18
+ centerBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
19
+ loadingBind: import('vue').ComputedRef<import('vue').HTMLAttributes>;
20
+ announcement: import('vue').ComputedRef<string>;
21
+ emptyMessage: import('vue').ComputedRef<string>;
22
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
23
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
24
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
25
+ };
26
+ context: import('vue').ComputedRef<import('../../../Utils/Charts').ChartContextValue>;
27
+ options: import('vue').ComputedRef<ChartFunnelRenderOptions | null>;
28
+ };
29
+ export {};
@@ -0,0 +1,68 @@
1
+ import { chartRootBridgeKeys as e, useChartRoot as t } from "../../../Utils/Charts/useChartRoot.js";
2
+ import { mountEchartsFunnel as n } from "../../../Utils/Charts/echarts/funnel.js";
3
+ import { useChartPart as r } from "../../../Utils/Charts/useChartPart.js";
4
+ import { computed as i } from "vue";
5
+ import { getChartFunnelPercents as a, getChartFunnelSummaryParams as o, sortChartStages as s } from "@bridge-ui/core/Domain";
6
+ //#region src/Components/ChartFunnel/composables/useChartFunnel.ts
7
+ var c = [
8
+ ...e,
9
+ "data",
10
+ "sort",
11
+ "align",
12
+ "labels",
13
+ "labelContent",
14
+ "labelPosition"
15
+ ], l = [
16
+ "size",
17
+ "sort",
18
+ "align",
19
+ "height",
20
+ "labels",
21
+ "classes",
22
+ "animation",
23
+ "customProps",
24
+ "labelPosition"
25
+ ];
26
+ function u(e, u) {
27
+ let d = t({
28
+ props: e,
29
+ libDefaults: u,
30
+ componentName: "ChartFunnel",
31
+ bridgeKeys: c,
32
+ registryKeys: l
33
+ }), { merged: f, locale: p, resolveMessage: m } = d, h = i(() => f.value.labels ?? !0);
34
+ function g(e) {
35
+ return s(e, f.value.sort ?? "descending");
36
+ }
37
+ function _(e) {
38
+ return {
39
+ ...e,
40
+ labels: h.value,
41
+ align: f.value.align ?? "center",
42
+ labelPosition: f.value.labelPosition ?? "inside"
43
+ };
44
+ }
45
+ function v(e) {
46
+ return m("Funnel chart with {{count}} stages, from {{first}} ({{firstValue}}) to {{last}} ({{lastValue}}).", o({
47
+ slices: e,
48
+ locale: p.value
49
+ }));
50
+ }
51
+ return {
52
+ ...r(d, {
53
+ order: g,
54
+ summary: v,
55
+ buildOptions: _,
56
+ family: "funnel",
57
+ positiveOnly: !1,
58
+ data: () => e.data,
59
+ mount: n,
60
+ labels: () => h.value,
61
+ percents: a,
62
+ labelContent: () => e.labelContent
63
+ }),
64
+ merged: f
65
+ };
66
+ }
67
+ //#endregion
68
+ export { u as useChartFunnel };
@@ -0,0 +1,4 @@
1
+ export type { ChartFunnelOwnProps, ChartFunnelProps, ChartFunnelStage, } from './chartFunnel.types';
2
+ export { default as ChartFunnel } from './ChartFunnel.vue';
3
+ export { useChartFunnel } from './composables/useChartFunnel';
4
+ export { useChartContext, type ChartClasses, type ChartColorOverrides, type ChartColorValue, type ChartContextValue, type ChartCustomProps, type ChartSizeOverrides, type ChartSlots, } from '../../Utils/Charts';
@@ -0,0 +1,4 @@
1
+ import { useChartContext as e } from "../../Utils/Charts/chartInjectionKey.js";
2
+ import { useChartFunnel as t } from "./composables/useChartFunnel.js";
3
+ import n from "./ChartFunnel.js";
4
+ export { n as ChartFunnel, e as useChartContext, t as useChartFunnel };
@@ -1,6 +1,8 @@
1
1
  import { ChartLegendOwnProps } from './chartLegend.types';
2
2
  declare const __VLS_export: import('vue').DefineComponent<ChartLegendOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChartLegendOwnProps> & Readonly<{}>, {
3
3
  interactive: boolean;
4
+ showPercent: boolean;
5
+ showValue: boolean;
4
6
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
5
7
  declare const _default: typeof __VLS_export;
6
8
  export default _default;
@@ -1,33 +1,53 @@
1
1
  import { useChartLegend as e } from "./composables/useChartLegend.js";
2
- import { Fragment as t, createElementBlock as n, createElementVNode as r, defineComponent as i, guardReactiveProps as a, mergeProps as o, normalizeProps as s, openBlock as c, renderList as l, toDisplayString as u, unref as d } from "vue";
2
+ import { Fragment as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, guardReactiveProps as s, mergeProps as c, normalizeProps as l, openBlock as u, renderList as d, resolveDynamicComponent as f, toDisplayString as p, unref as m, withCtx as h } from "vue";
3
3
  //#region src/Components/ChartLegend/ChartLegend.vue?vue&type=script&setup=true&lang.ts
4
- var f = /*@__PURE__*/ i({
4
+ var g = /*@__PURE__*/ o({
5
5
  inheritAttrs: !1,
6
6
  __name: "ChartLegend",
7
7
  props: {
8
8
  align: {},
9
9
  classes: {},
10
10
  customProps: {},
11
+ formatPercent: {},
12
+ formatValue: {},
11
13
  interactive: {
12
14
  type: Boolean,
13
15
  default: void 0
14
16
  },
15
- position: {}
17
+ position: {},
18
+ showPercent: {
19
+ type: Boolean,
20
+ default: void 0
21
+ },
22
+ showValue: {
23
+ type: Boolean,
24
+ default: void 0
25
+ }
16
26
  },
17
- setup(i) {
18
- let { items: f, rootBind: p, labelBind: m, interactive: h, getItemBind: g, getSwatchBind: _ } = e(i, {
27
+ setup(o) {
28
+ let { items: g, rootBind: _, getValue: v, labelBind: y, valueBind: b, getPercent: x, interactive: S, percentBind: C, getItemBind: w, getSwatchBind: T } = e(o, {
19
29
  align: "center",
30
+ showValue: !1,
20
31
  interactive: !0,
32
+ showPercent: !1,
21
33
  position: "bottom"
22
34
  });
23
- return (e, i) => (c(), n("ul", s(a(d(p))), [(c(!0), n(t, null, l(d(f), (e) => (c(), n("li", { key: e.id }, [d(h) ? (c(), n("button", o({
24
- key: 0,
25
- ref_for: !0
26
- }, d(g)(e)), [r("span", o({ ref_for: !0 }, d(_)(e)), null, 16), r("span", o({ ref_for: !0 }, d(m)), u(e.name), 17)], 16)) : (c(), n("span", o({
27
- key: 1,
28
- ref_for: !0
29
- }, d(g)(e)), [r("span", o({ ref_for: !0 }, d(_)(e)), null, 16), r("span", o({ ref_for: !0 }, d(m)), u(e.name), 17)], 16))]))), 128))], 16));
35
+ return (e, o) => (u(), i("ul", l(s(m(_))), [(u(!0), i(t, null, d(m(g), (e) => (u(), i("li", { key: e.id }, [(u(), n(f(m(S) ? "button" : "span"), c({ ref_for: !0 }, m(w)(e)), {
36
+ default: h(() => [
37
+ a("span", c({ ref_for: !0 }, m(T)(e)), null, 16),
38
+ a("span", c({ ref_for: !0 }, m(y)), p(e.name), 17),
39
+ m(v)(e) === null ? r("", !0) : (u(), i("span", c({
40
+ key: 0,
41
+ ref_for: !0
42
+ }, m(b)), p(m(v)(e)), 17)),
43
+ m(x)(e) === null ? r("", !0) : (u(), i("span", c({
44
+ key: 1,
45
+ ref_for: !0
46
+ }, m(C)), p(m(x)(e)), 17))
47
+ ]),
48
+ _: 2
49
+ }, 1040))]))), 128))], 16));
30
50
  }
31
51
  });
32
52
  //#endregion
33
- export { f as default };
53
+ export { g as default };
@@ -9,6 +9,10 @@ export interface ChartLegendClasses {
9
9
  * Classes merged onto each entry label.
10
10
  */
11
11
  label?: string;
12
+ /**
13
+ * Classes merged onto each percent column.
14
+ */
15
+ percent?: string;
12
16
  /**
13
17
  * Classes merged onto the legend list.
14
18
  */
@@ -17,6 +21,10 @@ export interface ChartLegendClasses {
17
21
  * Classes merged onto each color swatch.
18
22
  */
19
23
  swatch?: string;
24
+ /**
25
+ * Classes merged onto each value column.
26
+ */
27
+ value?: string;
20
28
  }
21
29
  export interface ChartLegendCustomProps {
22
30
  /**
@@ -33,11 +41,12 @@ export interface ChartLegendCustomProps {
33
41
  root?: HTMLAttributes;
34
42
  }
35
43
  /**
36
- * Series legend for the nearest `Chart`. Entries toggle series visibility.
44
+ * Legend for the nearest chart: series (line, bar, scatter) or slices
45
+ * (pie, funnel). Entries toggle visibility.
37
46
  */
38
47
  export interface ChartLegendOwnProps {
39
48
  /**
40
- * Horizontal alignment of the entries.
49
+ * Alignment of the entries along the legend.
41
50
  *
42
51
  * @default "center"
43
52
  */
@@ -55,17 +64,44 @@ export interface ChartLegendOwnProps {
55
64
  */
56
65
  customProps?: ChartLegendCustomProps;
57
66
  /**
58
- * When true, entries are buttons that show / hide their series and
67
+ * Formats the percent column. Defaults to `Intl.NumberFormat` with the
68
+ * Bridge locale.
69
+ *
70
+ * @default undefined
71
+ */
72
+ formatPercent?: (percent: number) => string;
73
+ /**
74
+ * Formats the value column. Defaults to `Intl.NumberFormat` with the
75
+ * Bridge locale.
76
+ *
77
+ * @default undefined
78
+ */
79
+ formatValue?: (value: number) => string;
80
+ /**
81
+ * When true, entries are buttons that show / hide their item and
59
82
  * emphasize it on hover or focus.
60
83
  *
61
84
  * @default true
62
85
  */
63
86
  interactive?: boolean;
64
87
  /**
65
- * Places the legend above or below the plot.
88
+ * Places the legend around the plot. `left` / `right` stack the entries
89
+ * in a column beside the plot.
66
90
  *
67
91
  * @default "bottom"
68
92
  */
69
- position?: "top" | "bottom";
93
+ position?: "top" | "left" | "right" | "bottom";
94
+ /**
95
+ * Shows each slice's share (pie, funnel).
96
+ *
97
+ * @default false
98
+ */
99
+ showPercent?: boolean;
100
+ /**
101
+ * Shows each slice's value (pie, funnel).
102
+ *
103
+ * @default false
104
+ */
105
+ showValue?: boolean;
70
106
  }
71
107
  export type ChartLegendProps = MergeHtmlProps<ChartLegendOwnProps, HTMLAttributes>;
@@ -1,16 +1,20 @@
1
1
  import { ButtonHTMLAttributes, HTMLAttributes } from 'vue';
2
2
  import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
3
- import { ChartResolvedSeries } from '../../Chart/chartInjectionKey';
4
3
  import { ChartLegendOwnProps } from '../chartLegend.types';
5
- type ChartLegendLibDefaults = LibDefaultsShape<ChartLegendOwnProps, "align" | "position" | "interactive">;
4
+ import { ChartLegendItem } from '../../../Utils/Charts';
5
+ type ChartLegendLibDefaults = LibDefaultsShape<ChartLegendOwnProps, "align" | "position" | "showValue" | "interactive" | "showPercent">;
6
6
  type ChartLegendMerged = MergeLibDefaults<ChartLegendOwnProps, ChartLegendLibDefaults>;
7
7
  export declare function useChartLegend(props: ChartLegendOwnProps, libDefaults: ChartLegendLibDefaults): {
8
- items: import('vue').ComputedRef<ChartResolvedSeries[]>;
8
+ items: import('vue').ComputedRef<ChartLegendItem[]>;
9
9
  merged: import('vue').ComputedRef<ChartLegendMerged>;
10
10
  rootBind: import('vue').ComputedRef<HTMLAttributes>;
11
+ getValue: (item: ChartLegendItem) => null | string;
11
12
  labelBind: import('vue').ComputedRef<HTMLAttributes>;
13
+ valueBind: import('vue').ComputedRef<HTMLAttributes>;
14
+ getPercent: (item: ChartLegendItem) => null | string;
12
15
  interactive: import('vue').ComputedRef<boolean>;
13
- getItemBind: (item: ChartResolvedSeries) => ButtonHTMLAttributes;
14
- getSwatchBind: (item: ChartResolvedSeries) => HTMLAttributes;
16
+ percentBind: import('vue').ComputedRef<HTMLAttributes>;
17
+ getItemBind: (item: ChartLegendItem) => ButtonHTMLAttributes;
18
+ getSwatchBind: (item: ChartLegendItem) => HTMLAttributes;
15
19
  };
16
20
  export {};
@@ -1,98 +1,132 @@
1
1
  import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
2
2
  import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
3
- import { useChartContext as i } from "../../Chart/chartInjectionKey.js";
4
- import { computed as a, useAttrs as o } from "vue";
5
- import { get as s } from "es-toolkit/compat";
6
- import { cn as c, splitComponentProps as l } from "@bridge-ui/core/Utils";
3
+ import { useChartContext as i } from "../../../Utils/Charts/chartInjectionKey.js";
4
+ import { computed as a, onBeforeUnmount as o, useAttrs as s, watch as c } from "vue";
5
+ import { get as l, isNil as u } from "es-toolkit/compat";
6
+ import { formatChartPercent as d, formatChartValue as f } from "@bridge-ui/core/Domain";
7
+ import { cn as p, splitComponentProps as m } from "@bridge-ui/core/Utils";
7
8
  //#region src/Components/ChartLegend/composables/useChartLegend.ts
8
- var u = [
9
+ var h = [
9
10
  "align",
10
11
  "classes",
11
12
  "position",
13
+ "showValue",
12
14
  "customProps",
13
- "interactive"
14
- ], d = {
15
+ "formatValue",
16
+ "interactive",
17
+ "showPercent",
18
+ "formatPercent"
19
+ ], g = {
15
20
  end: "justify-end",
16
21
  start: "justify-start",
17
22
  center: "justify-center"
18
23
  };
19
- function f(f, p) {
20
- let m = o(), h = i(), g = e(), _ = a(() => l({
24
+ function _(_, v) {
25
+ let y = s(), b = i(), x = e(), S = a(() => m({
21
26
  props: {
22
- ...m,
23
- ...f
27
+ ...y,
28
+ ..._
24
29
  },
25
- bridgeKeys: u
26
- })), { merged: v, entry: y } = n({
27
- libDefaults: p,
30
+ bridgeKeys: h
31
+ })), { merged: C, entry: w } = n({
32
+ libDefaults: v,
28
33
  componentName: "ChartLegend",
29
- props: () => _.value.componentProps
30
- }), b = r({
31
- entry: y,
32
- props: () => _.value.componentProps
33
- }), x = a(() => v.value.customProps), S = a(() => v.value.interactive !== !1), C = a(() => h.value.series), w = a(() => t(x.value?.root, _.value.inheritedAttrs, {
34
- "aria-label": g("Legend"),
35
- class: c({
36
- "m-0 flex list-none flex-wrap items-center p-0": !0,
37
- "order-first": v.value.position === "top",
38
- [s(d, v.value.align) ?? ""]: !0,
39
- [h.value.tokenClasses.legend ?? ""]: !0,
40
- [s(b.value, "root") ?? ""]: !0
41
- })
42
- }));
43
- function T(e) {
44
- let n = c({
34
+ props: () => S.value.componentProps
35
+ }), T = r({
36
+ entry: w,
37
+ props: () => S.value.componentProps
38
+ }), E = a(() => C.value.customProps), D = a(() => C.value.interactive !== !1), O = a(() => C.value.position === "left" || C.value.position === "right"), k = a(() => b.value.legendItems);
39
+ c(() => C.value.position, (e) => {
40
+ b.value.setLegendPosition(e);
41
+ }, { immediate: !0 }), o(() => {
42
+ b.value.setLegendPosition(null);
43
+ });
44
+ function A(e) {
45
+ return C.value.showValue !== !0 || u(e.value) ? null : C.value.formatValue?.(e.value) ?? f(e.value, b.value.locale);
46
+ }
47
+ function j(e) {
48
+ return C.value.showPercent !== !0 || u(e.value) ? null : u(e.percent) ? "—" : C.value.formatPercent?.(e.percent) ?? d(e.percent, b.value.locale);
49
+ }
50
+ let M = a(() => {
51
+ let e = C.value.position;
52
+ return t(E.value?.root, S.value.inheritedAttrs, {
53
+ "aria-label": x("Legend"),
54
+ class: p({
55
+ "m-0 flex list-none p-0": !0,
56
+ "flex-wrap items-center": !O.value,
57
+ "w-56 max-w-[50%] shrink-0 flex-col": O.value,
58
+ "order-first": e === "top" || e === "left",
59
+ [l(g, C.value.align) ?? ""]: !0,
60
+ [b.value.tokenClasses.legend ?? ""]: !0,
61
+ [l(T.value, "root") ?? ""]: !0
62
+ })
63
+ });
64
+ });
65
+ function N(e) {
66
+ let n = p({
45
67
  "inline-flex items-center rounded-md text-dark-700 dark:text-dark-200": !0,
68
+ "w-full text-start": O.value,
46
69
  "transition-opacity": !0,
47
70
  "opacity-50": e.hidden,
48
- "cursor-pointer outline-none hover:bg-dark-100 focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:hover:bg-dark-800": S.value,
49
- [h.value.tokenClasses.legendItem ?? ""]: !0,
50
- [s(b.value, "item") ?? ""]: !0
71
+ "cursor-pointer outline-none hover:bg-dark-100 focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:hover:bg-dark-800": D.value,
72
+ [b.value.tokenClasses.legendItem ?? ""]: !0,
73
+ [l(T.value, "item") ?? ""]: !0
51
74
  });
52
- return S.value ? t(x.value?.item, void 0, {
75
+ return D.value ? t(E.value?.item, void 0, {
53
76
  type: "button",
54
77
  class: n,
55
78
  "aria-pressed": !e.hidden,
56
79
  onBlur: () => {
57
- h.value.highlightSeries(null);
80
+ b.value.highlightItem(null);
58
81
  },
59
82
  onClick: () => {
60
- h.value.toggleSeries(e.id);
83
+ b.value.toggleItem(e.id);
61
84
  },
62
85
  onFocus: () => {
63
- h.value.highlightSeries(e.id);
86
+ b.value.highlightItem(e.id);
64
87
  },
65
88
  onMouseleave: () => {
66
- h.value.highlightSeries(null);
89
+ b.value.highlightItem(null);
67
90
  },
68
91
  onMouseenter: () => {
69
- h.value.highlightSeries(e.id);
92
+ b.value.highlightItem(e.id);
70
93
  }
71
- }) : t(x.value?.item, void 0, { class: n });
94
+ }) : t(E.value?.item, void 0, { class: n });
72
95
  }
73
- function E(e) {
96
+ function P(e) {
74
97
  return {
75
98
  "aria-hidden": !0,
76
- style: { backgroundColor: e.resolvedColor },
77
- class: c({
99
+ style: { backgroundColor: e.color },
100
+ class: p({
78
101
  "shrink-0 rounded-full": !0,
79
- [h.value.tokenClasses.swatch ?? ""]: !0,
80
- [s(b.value, "swatch") ?? ""]: !0
102
+ [b.value.tokenClasses.swatch ?? ""]: !0,
103
+ [l(T.value, "swatch") ?? ""]: !0
81
104
  })
82
105
  };
83
106
  }
84
107
  return {
85
- items: C,
86
- merged: v,
87
- rootBind: w,
88
- labelBind: a(() => ({ class: c({
108
+ items: k,
109
+ merged: C,
110
+ rootBind: M,
111
+ getValue: A,
112
+ labelBind: a(() => ({ class: p({
89
113
  truncate: !0,
90
- [s(b.value, "label") ?? ""]: !0
114
+ "min-w-0 flex-1": O.value,
115
+ [l(T.value, "label") ?? ""]: !0
116
+ }) })),
117
+ valueBind: a(() => ({ class: p({
118
+ "shrink-0 font-medium tabular-nums": !0,
119
+ [l(T.value, "value") ?? ""]: !0
120
+ }) })),
121
+ getPercent: j,
122
+ interactive: D,
123
+ percentBind: a(() => ({ class: p({
124
+ "shrink-0 text-dark-500 tabular-nums dark:text-dark-400": !0,
125
+ [l(T.value, "percent") ?? ""]: !0
91
126
  }) })),
92
- interactive: S,
93
- getItemBind: T,
94
- getSwatchBind: E
127
+ getItemBind: N,
128
+ getSwatchBind: P
95
129
  };
96
130
  }
97
131
  //#endregion
98
- export { f as useChartLegend };
132
+ export { _ as useChartLegend };
@@ -0,0 +1,5 @@
1
+ import e from "./ChartLine.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/Components/ChartLine/ChartLine.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,20 @@
1
+ import { ChartLineOwnProps } from './chartLine.types';
2
+ import { ChartSlots } from '../../Utils/Charts';
3
+ type __VLS_Slots = ChartSlots;
4
+ declare const __VLS_base: import('vue').DefineComponent<ChartLineOwnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ChartLineOwnProps> & Readonly<{}>, {
5
+ loading: boolean;
6
+ step: import('@bridge-ui/core/Domain').ChartStep;
7
+ area: boolean;
8
+ labels: boolean;
9
+ showPoints: boolean;
10
+ animation: boolean;
11
+ sparkline: boolean;
12
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
14
+ declare const _default: typeof __VLS_export;
15
+ export default _default;
16
+ type __VLS_WithSlots<T, S> = T & {
17
+ new (): {
18
+ $slots: S;
19
+ };
20
+ };
@@ -0,0 +1,76 @@
1
+ import e from "../../Utils/Charts/ChartFrame.js";
2
+ import { useChartLine as t } from "./composables/useChartLine.js";
3
+ import { createBlock as n, createSlots as r, defineComponent as i, openBlock as a, renderSlot as o, unref as s, withCtx as c } from "vue";
4
+ //#region src/Components/ChartLine/ChartLine.vue?vue&type=script&setup=true&lang.ts
5
+ var l = /*@__PURE__*/ i({
6
+ inheritAttrs: !1,
7
+ __name: "ChartLine",
8
+ props: {
9
+ area: {
10
+ type: Boolean,
11
+ default: void 0
12
+ },
13
+ categories: {},
14
+ curve: {},
15
+ formatDate: {},
16
+ formatLabel: {},
17
+ labels: {
18
+ type: Boolean,
19
+ default: void 0
20
+ },
21
+ showPoints: {
22
+ type: Boolean,
23
+ default: void 0
24
+ },
25
+ sparkline: {
26
+ type: Boolean,
27
+ default: !1
28
+ },
29
+ stack: {},
30
+ step: {
31
+ type: [String, Boolean],
32
+ default: void 0
33
+ },
34
+ animation: {
35
+ type: Boolean,
36
+ default: void 0
37
+ },
38
+ classes: {},
39
+ customProps: {},
40
+ height: {},
41
+ loading: {
42
+ type: Boolean,
43
+ default: !1
44
+ },
45
+ palette: {},
46
+ size: {},
47
+ summary: {},
48
+ width: {}
49
+ },
50
+ setup(i) {
51
+ let { frame: l } = t(i, {
52
+ size: "md",
53
+ area: !1,
54
+ step: !1,
55
+ height: 280,
56
+ labels: !1,
57
+ animation: !0,
58
+ curve: "linear",
59
+ showPoints: !1
60
+ });
61
+ return (t, i) => (a(), n(s(e), { frame: s(l) }, r({
62
+ default: c(() => [o(t.$slots, "default")]),
63
+ _: 2
64
+ }, [t.$slots.empty ? {
65
+ name: "empty",
66
+ fn: c(() => [o(t.$slots, "empty")]),
67
+ key: "0"
68
+ } : void 0, t.$slots.loading ? {
69
+ name: "loading",
70
+ fn: c(() => [o(t.$slots, "loading")]),
71
+ key: "1"
72
+ } : void 0]), 1032, ["frame"]));
73
+ }
74
+ });
75
+ //#endregion
76
+ export { l as default };