@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,156 @@
1
+ import { ComputedRef, HTMLAttributes } from 'vue';
2
+ import { BridgeUIComponentsConfig } from '@bridge-ui/core/Config';
3
+ import { ChartBaseRenderOptions, ChartHandle, ChartMountOptions, ChartRenderTheme, ChartTable, ChartTooltipContent } from '@bridge-ui/core/Domain';
4
+ import { ChartClasses, ChartRootOwnProps } from './chart.types';
5
+ import { ChartContextValue, ChartLegendItem, ChartLegendPosition } from './chartInjectionKey';
6
+ /**
7
+ * Registry names of the chart roots.
8
+ */
9
+ export type ChartRootName = Extract<keyof BridgeUIComponentsConfig, "ChartBar" | "ChartPie" | "ChartLine" | "ChartFunnel" | "ChartScatter">;
10
+ /**
11
+ * Merged props every chart root resolves.
12
+ */
13
+ export type ChartRootMerged = Pick<ChartRootOwnProps, "palette" | "customProps"> & {
14
+ animation: boolean;
15
+ height: number | string;
16
+ size: string;
17
+ };
18
+ /**
19
+ * Bridge keys shared by every chart root.
20
+ */
21
+ export declare const chartRootBridgeKeys: readonly ["size", "width", "height", "classes", "loading", "palette", "summary", "animation", "customProps"];
22
+ type ChartActive = {
23
+ index: null | number;
24
+ source: "pointer" | "keyboard";
25
+ };
26
+ /**
27
+ * Shared state for a chart root: registry merge, tokens, theme, plot size,
28
+ * active item, hidden items, and the mounted plot handle.
29
+ */
30
+ export declare function useChartRoot<Merged extends ChartRootMerged>({ props, bridgeKeys, libDefaults, registryKeys, componentName, fallbackProps, }: {
31
+ bridgeKeys: readonly string[];
32
+ componentName: ChartRootName;
33
+ /**
34
+ * Props that win over registry defaults but lose to explicit props
35
+ * (e.g. the sparkline height).
36
+ */
37
+ fallbackProps?: () => Partial<ChartRootOwnProps>;
38
+ libDefaults: Partial<Merged>;
39
+ props: ChartRootOwnProps;
40
+ registryKeys: readonly string[];
41
+ }): {
42
+ split: ComputedRef<{
43
+ componentProps: Record<string, unknown> & ChartRootOwnProps;
44
+ inheritedAttrs: HTMLAttributes & Record<string, unknown>;
45
+ }>;
46
+ theme: import('vue').ShallowRef<ChartRenderTheme | null, ChartRenderTheme | null>;
47
+ merged: ComputedRef<Merged>;
48
+ active: import('vue').ShallowRef<ChartActive, ChartActive>;
49
+ hidden: import('vue').Ref<string[], string[]>;
50
+ locale: ComputedRef<string>;
51
+ chartId: string;
52
+ palette: ComputedRef<string[]>;
53
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
54
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
55
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
56
+ plotSize: import('vue').ShallowRef<{
57
+ width: number;
58
+ height: number;
59
+ }, {
60
+ width: number;
61
+ height: number;
62
+ }>;
63
+ sizeItem: ComputedRef<any>;
64
+ animation: ComputedRef<boolean>;
65
+ handleRef: import('vue').ShallowRef<ChartHandle<ChartBaseRenderOptions> | null, ChartHandle<ChartBaseRenderOptions> | null>;
66
+ getBounds: () => {
67
+ width: number;
68
+ height: number;
69
+ };
70
+ schemeTick: import('vue').Ref<number, number>;
71
+ toggleItem: (id: string) => void;
72
+ bridgeTheme: ComputedRef<string | undefined>;
73
+ customProps: ComputedRef<import('./chart.types').ChartCustomProps | undefined>;
74
+ colorClasses: ComputedRef<Partial<{
75
+ black: import('@bridge-ui/core/Tokens').ChartColorItem;
76
+ dark: import('@bridge-ui/core/Tokens').ChartColorItem;
77
+ error: import('@bridge-ui/core/Tokens').ChartColorItem;
78
+ info: import('@bridge-ui/core/Tokens').ChartColorItem;
79
+ primary: import('@bridge-ui/core/Tokens').ChartColorItem;
80
+ secondary: import('@bridge-ui/core/Tokens').ChartColorItem;
81
+ success: import('@bridge-ui/core/Tokens').ChartColorItem;
82
+ warning: import('@bridge-ui/core/Tokens').ChartColorItem;
83
+ }>>;
84
+ highlightItem: (id: null | string) => void;
85
+ mergedClasses: ComputedRef<Partial<ChartClasses>>;
86
+ legendPosition: import('vue').Ref<ChartLegendPosition | null, ChartLegendPosition | null>;
87
+ resolveMessage: (message: string, countOrParams?: number | import('@bridge-ui/core/Adapters').MessageParams, params?: import('@bridge-ui/core/Adapters').MessageParams) => string;
88
+ componentProps: ComputedRef<Record<string, unknown> & ChartRootOwnProps>;
89
+ getTooltipAnchor: (index: number) => {
90
+ y: number;
91
+ x: number;
92
+ } | null;
93
+ setLegendPosition: (position: null | ChartLegendPosition) => void;
94
+ onActiveIndexChange: (index: null | number) => void;
95
+ };
96
+ /**
97
+ * State returned by {@link useChartRoot}.
98
+ */
99
+ export type ChartRootState = ReturnType<typeof useChartRoot>;
100
+ /**
101
+ * Resolves item colors (token keys or CSS colors) to computed CSS colors.
102
+ * Items without `color` take palette entries in order.
103
+ */
104
+ export declare function useChartColors(root: ChartRootState, items: () => ReadonlyArray<{
105
+ color?: string;
106
+ id: string;
107
+ }>): import('vue').ShallowRef<Record<string, string>, Record<string, string>>;
108
+ /**
109
+ * Mounts the plot into the host once the theme and size are known, then
110
+ * pushes every new options object to it.
111
+ */
112
+ export declare function useChartPlot<Options extends ChartBaseRenderOptions>(root: ChartRootState, { mount, options, }: {
113
+ mount: (options: ChartMountOptions<Options>) => ChartHandle<Options>;
114
+ options: ComputedRef<null | Options>;
115
+ }): void;
116
+ /**
117
+ * Root, plot, and overlay binds plus keyboard navigation over `count` items.
118
+ */
119
+ export declare function useChartFrame(root: ChartRootState, state: ComputedRef<{
120
+ count: number;
121
+ isEmpty: boolean;
122
+ summary: string;
123
+ table: ChartTable;
124
+ tooltip: null | ChartTooltipContent;
125
+ }>): {
126
+ label: ComputedRef<string>;
127
+ table: ComputedRef<ChartTable>;
128
+ isEmpty: ComputedRef<boolean>;
129
+ hostBind: ComputedRef<HTMLAttributes>;
130
+ plotBind: ComputedRef<HTMLAttributes>;
131
+ rootBind: ComputedRef<HTMLAttributes>;
132
+ liveBind: ComputedRef<HTMLAttributes>;
133
+ emptyBind: ComputedRef<HTMLAttributes>;
134
+ isLoading: ComputedRef<boolean>;
135
+ tableBind: ComputedRef<HTMLAttributes>;
136
+ centerBind: ComputedRef<HTMLAttributes>;
137
+ loadingBind: ComputedRef<HTMLAttributes>;
138
+ announcement: ComputedRef<string>;
139
+ emptyMessage: ComputedRef<string>;
140
+ rootRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
141
+ plotRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
142
+ hostRef: import('vue').ShallowRef<HTMLDivElement | null, HTMLDivElement | null>;
143
+ };
144
+ /**
145
+ * Frame state returned by {@link useChartFrame}.
146
+ */
147
+ export type ChartFrameState = ReturnType<typeof useChartFrame>;
148
+ /**
149
+ * Provides the context value for the chart parts.
150
+ */
151
+ export declare function useChartContextValue(root: ChartRootState, state: ComputedRef<Pick<ChartContextValue, "family" | "setAxis" | "tooltip" | "removeAxis" | "legendItems" | "removeSeries" | "upsertSeries">>): ComputedRef<ChartContextValue>;
152
+ /**
153
+ * Legend entries from items, their resolved colors, and the hidden ids.
154
+ */
155
+ export declare function toChartLegendItems(items: ReadonlyArray<Pick<ChartLegendItem, "id" | "name" | "value" | "percent">>, colors: Record<string, string>, hidden: readonly string[]): ChartLegendItem[];
156
+ export {};
@@ -0,0 +1,342 @@
1
+ import { useResolveMessage as e } from "../../Adapters/I18n/useI18nAdapter.js";
2
+ import { mergePartBind as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../index.js";
3
+ import { CHART_INJECTION_KEY as i } from "./chartInjectionKey.js";
4
+ import { computed as a, onBeforeUnmount as o, onMounted as s, provide as c, ref as l, shallowRef as u, useAttrs as d, useId as f, watch as p } from "vue";
5
+ import { get as m, isEqual as h, isNil as g, isUndefined as _, omit as v, omitBy as y, pick as b } from "es-toolkit/compat";
6
+ import { DEFAULT_CHART_HEIGHT as x, DEFAULT_CHART_PALETTE as S, formatChartAnnouncement as C, getAdjacentChartIndex as w, resolveChartColor as T, toChartCssSize as E } from "@bridge-ui/core/Domain";
7
+ import { chartColorProps as D, chartSizeProps as O, chartThemeProps as k } from "@bridge-ui/core/Tokens";
8
+ import { cn as A, mergeBridgeUILayeredClasses as j, splitComponentProps as ee } from "@bridge-ui/core/Utils";
9
+ import { observeColorScheme as te, prefersReducedMotion as ne, readChartTheme as M, readCssColor as N } from "@bridge-ui/core/Runtime";
10
+ //#region src/Utils/Charts/useChartRoot.ts
11
+ var P = [
12
+ "size",
13
+ "width",
14
+ "height",
15
+ "classes",
16
+ "loading",
17
+ "palette",
18
+ "summary",
19
+ "animation",
20
+ "customProps"
21
+ ];
22
+ function F({ props: t, bridgeKeys: i, libDefaults: c, registryKeys: v, componentName: x, fallbackProps: C }) {
23
+ let w = f(), T = d(), E = `bridge-chart${w}`, A = e(), N = u(null), P = u(null), F = u(null), I = u(null), L = l(0), R = l([]), z = u({
24
+ width: 0,
25
+ height: 0
26
+ }), B = u(null), V = l(null), H = u({
27
+ index: null,
28
+ source: "pointer"
29
+ }), U = a(() => ee({
30
+ bridgeKeys: i,
31
+ props: {
32
+ ...C?.(),
33
+ ...y({
34
+ ...T,
35
+ ...t
36
+ }, _)
37
+ }
38
+ })), W = a(() => U.value.componentProps), { bridge: G, merged: K, entry: q } = n({
39
+ libDefaults: c,
40
+ componentName: x,
41
+ props: () => b(W.value, v)
42
+ }), re = r({
43
+ entry: q,
44
+ props: () => W.value
45
+ }), ie = a(() => G?.global.value.locale ?? "en-US"), J = a(() => K.value.customProps), ae = a(() => JSON.stringify(W.value.palette ?? K.value.palette ?? S)), oe = a(() => JSON.parse(ae.value)), se = a(() => j(O, q.value?.tokens?.size)), ce = a(() => j(D, q.value?.tokens?.color)), Y = a(() => j(k, q.value?.tokens?.theme)), X = a(() => m(se.value, K.value.size)), Z = a(() => G?.global.value.theme), Q;
46
+ s(() => {
47
+ Q = te(() => {
48
+ L.value += 1;
49
+ });
50
+ }), o(() => {
51
+ Q?.();
52
+ }), p([
53
+ N,
54
+ L,
55
+ Y,
56
+ () => X.value?.root,
57
+ Z
58
+ ], () => {
59
+ let e = N.value;
60
+ if (g(e)) return;
61
+ let t = M(e, {
62
+ axis: Y.value.axis ?? "",
63
+ grid: Y.value.grid ?? "",
64
+ text: Y.value.text ?? ""
65
+ });
66
+ h(B.value, t) || (B.value = t);
67
+ }, {
68
+ flush: "post",
69
+ immediate: !0
70
+ }), p(P, (e, t, n) => {
71
+ if (g(e)) return;
72
+ let r = () => {
73
+ let t = e.clientWidth, n = e.clientHeight;
74
+ (z.value.width !== t || z.value.height !== n) && (z.value = {
75
+ width: t,
76
+ height: n
77
+ });
78
+ };
79
+ if (r(), typeof ResizeObserver > "u") return;
80
+ let i = new ResizeObserver(r);
81
+ i.observe(e), n(() => {
82
+ i.disconnect();
83
+ });
84
+ }, {
85
+ flush: "post",
86
+ immediate: !0
87
+ });
88
+ function $(e) {
89
+ R.value = R.value.includes(e) ? R.value.filter((t) => t !== e) : [...R.value, e];
90
+ }
91
+ function le(e) {
92
+ I.value?.highlight(e);
93
+ }
94
+ function ue(e) {
95
+ H.value.index !== e && (H.value = {
96
+ index: e,
97
+ source: "pointer"
98
+ });
99
+ }
100
+ function de(e) {
101
+ let t = I.value?.getAnchor(e), n = P.value;
102
+ return g(t) || g(n) ? null : {
103
+ y: t.y + n.offsetTop,
104
+ x: t.x + n.offsetLeft
105
+ };
106
+ }
107
+ function fe() {
108
+ return {
109
+ width: N.value?.clientWidth ?? 0,
110
+ height: N.value?.clientHeight ?? 0
111
+ };
112
+ }
113
+ function pe(e) {
114
+ V.value = e;
115
+ }
116
+ return {
117
+ split: U,
118
+ theme: B,
119
+ merged: K,
120
+ active: H,
121
+ hidden: R,
122
+ locale: ie,
123
+ chartId: E,
124
+ palette: oe,
125
+ rootRef: N,
126
+ plotRef: P,
127
+ hostRef: F,
128
+ plotSize: z,
129
+ sizeItem: X,
130
+ animation: a(() => K.value.animation !== !1 && !ne()),
131
+ handleRef: I,
132
+ getBounds: fe,
133
+ schemeTick: L,
134
+ toggleItem: $,
135
+ bridgeTheme: Z,
136
+ customProps: J,
137
+ colorClasses: ce,
138
+ highlightItem: le,
139
+ mergedClasses: re,
140
+ legendPosition: V,
141
+ resolveMessage: A,
142
+ componentProps: W,
143
+ getTooltipAnchor: de,
144
+ setLegendPosition: pe,
145
+ onActiveIndexChange: ue
146
+ };
147
+ }
148
+ function I(e, t) {
149
+ let n = u({}), r = a(() => t().map((t, n) => {
150
+ let r = T({
151
+ index: n,
152
+ color: t.color,
153
+ palette: e.palette.value
154
+ });
155
+ return {
156
+ color: r,
157
+ id: t.id,
158
+ className: m(e.colorClasses.value, [r, "series"])
159
+ };
160
+ }));
161
+ return p([
162
+ e.rootRef,
163
+ e.schemeTick,
164
+ e.bridgeTheme,
165
+ r
166
+ ], () => {
167
+ let t = e.rootRef.value;
168
+ if (g(t)) return;
169
+ let i = {};
170
+ r.value.forEach((e) => {
171
+ i[e.id] = g(e.className) ? N(t, { color: e.color }) : N(t, { className: e.className });
172
+ }), h(n.value, i) || (n.value = i);
173
+ }, {
174
+ flush: "post",
175
+ immediate: !0
176
+ }), n;
177
+ }
178
+ function L(e, { mount: t, options: n }) {
179
+ let r = null, i = null, s = a(() => !g(e.hostRef.value) && !g(n.value));
180
+ function c() {
181
+ e.handleRef.value?.destroy(), e.handleRef.value = null, i = null, r?.remove(), r = null;
182
+ }
183
+ p([e.hostRef, s], () => {
184
+ c();
185
+ let a = e.hostRef.value, o = n.value;
186
+ if (!s.value || g(a) || g(o)) return;
187
+ let l = document.createElement("div");
188
+ l.className = "absolute inset-0", a.appendChild(l), r = l, e.handleRef.value = t({
189
+ ...o,
190
+ element: l,
191
+ onActiveIndexChange: e.onActiveIndexChange
192
+ }), i = o;
193
+ }, {
194
+ flush: "post",
195
+ immediate: !0
196
+ }), p(n, (t) => {
197
+ let n = e.handleRef.value;
198
+ g(n) || g(t) || i === t || (i = t, n.update(t));
199
+ }, { flush: "post" }), p(e.active, (t) => {
200
+ t.source === "keyboard" && e.handleRef.value?.setActiveIndex(t.index);
201
+ }, { flush: "post" }), o(() => {
202
+ c();
203
+ });
204
+ }
205
+ function R(e, n) {
206
+ let { active: r, customProps: i, mergedClasses: o, componentProps: s } = e, c = a(() => s.value.loading === !0), l = a(() => !c.value && n.value.isEmpty), u = a(() => e.resolveMessage("No data")), d = a(() => g(s.value.summary) ? n.value.isEmpty ? u.value : n.value.summary : s.value.summary), f = a(() => {
207
+ let t = n.value.tooltip;
208
+ return r.value.source !== "keyboard" || g(t) ? "" : C({
209
+ title: t.title,
210
+ items: t.items,
211
+ locale: e.locale.value
212
+ });
213
+ }), p = a(() => {
214
+ let t = e.legendPosition.value;
215
+ return t === "left" || t === "right";
216
+ });
217
+ function h(e) {
218
+ if (i.value?.plot?.onKeydown?.(e), e.defaultPrevented) return;
219
+ let t = w({
220
+ key: e.key,
221
+ count: n.value.count,
222
+ current: r.value.index
223
+ });
224
+ t !== void 0 && (e.preventDefault(), r.value = {
225
+ index: t,
226
+ source: "keyboard"
227
+ });
228
+ }
229
+ function _(e) {
230
+ i.value?.plot?.onBlur?.(e), r.value.source === "keyboard" && (r.value = {
231
+ index: null,
232
+ source: "keyboard"
233
+ });
234
+ }
235
+ let y = a(() => t(v(i.value?.root, ["style"]), v(e.split.value.inheritedAttrs, ["style"]), {
236
+ role: "figure",
237
+ "aria-busy": c.value || void 0,
238
+ style: [
239
+ { width: E(s.value.width, "100%") },
240
+ e.split.value.inheritedAttrs.style,
241
+ i.value?.root?.style
242
+ ],
243
+ class: A({
244
+ "relative flex min-w-0 gap-3": !0,
245
+ "flex-col": !p.value,
246
+ "flex-row items-center gap-6": p.value,
247
+ [m(e.sizeItem.value, "root") ?? ""]: !0,
248
+ [m(o.value, "root") ?? ""]: !0
249
+ })
250
+ })), b = a(() => t(v(i.value?.plot, [
251
+ "style",
252
+ "onBlur",
253
+ "onKeydown"
254
+ ]), void 0, {
255
+ role: "img",
256
+ tabindex: 0,
257
+ onBlur: _,
258
+ onKeydown: h,
259
+ "aria-label": d.value,
260
+ style: [{ height: E(e.merged.value.height, `${x}px`) }, i.value?.plot?.style],
261
+ class: A({
262
+ "relative min-w-0 rounded-md outline-none": !0,
263
+ "w-full": !p.value,
264
+ "flex-1": p.value,
265
+ "focus-visible:ring-2 focus-visible:ring-primary-500/50": !0,
266
+ [m(o.value, "plot") ?? ""]: !0
267
+ })
268
+ })), S = a(() => ({
269
+ "aria-hidden": !0,
270
+ class: "absolute inset-0"
271
+ })), T = a(() => ({ class: A({
272
+ "pointer-events-none absolute inset-0 flex flex-col items-center justify-center text-center": !0,
273
+ [m(o.value, "center") ?? ""]: !0
274
+ }) })), D = a(() => ({ class: A({
275
+ "absolute inset-0 z-10 flex items-center justify-center": !0,
276
+ "bg-white/50 dark:bg-dark-900/50": !0,
277
+ [m(o.value, "loading") ?? ""]: !0
278
+ }) })), O = a(() => ({ class: A({
279
+ "absolute inset-0 z-10 flex items-center justify-center": !0,
280
+ "text-dark-500 dark:text-dark-400": !0,
281
+ [m(o.value, "empty") ?? ""]: !0
282
+ }) })), k = a(() => ({
283
+ id: `${e.chartId}-table`,
284
+ class: A({
285
+ "sr-only block": !0,
286
+ [m(o.value, "table") ?? ""]: !0
287
+ })
288
+ })), j = a(() => ({
289
+ role: "status",
290
+ class: "sr-only",
291
+ "aria-atomic": !0,
292
+ "aria-live": "polite"
293
+ }));
294
+ return {
295
+ label: d,
296
+ table: a(() => n.value.table),
297
+ isEmpty: l,
298
+ hostBind: S,
299
+ plotBind: b,
300
+ rootBind: y,
301
+ liveBind: j,
302
+ emptyBind: O,
303
+ isLoading: c,
304
+ tableBind: k,
305
+ centerBind: T,
306
+ loadingBind: D,
307
+ announcement: f,
308
+ emptyMessage: u,
309
+ rootRef: e.rootRef,
310
+ plotRef: e.plotRef,
311
+ hostRef: e.hostRef
312
+ };
313
+ }
314
+ function z(e, t) {
315
+ let n = a(() => ({
316
+ ...t.value,
317
+ id: e.chartId,
318
+ getBounds: e.getBounds,
319
+ locale: e.locale.value,
320
+ toggleItem: e.toggleItem,
321
+ highlightItem: e.highlightItem,
322
+ activeIndex: e.active.value.index,
323
+ getTooltipAnchor: e.getTooltipAnchor,
324
+ setLegendPosition: e.setLegendPosition,
325
+ tokenClasses: {
326
+ legend: m(e.sizeItem.value, "legend"),
327
+ swatch: m(e.sizeItem.value, "swatch"),
328
+ tooltip: m(e.sizeItem.value, "tooltip"),
329
+ legendItem: m(e.sizeItem.value, "legendItem")
330
+ }
331
+ }));
332
+ return c(i, n), n;
333
+ }
334
+ function B(e, t, n) {
335
+ return e.map((e) => ({
336
+ ...e,
337
+ color: t[e.id] ?? "",
338
+ hidden: n.includes(e.id)
339
+ }));
340
+ }
341
+ //#endregion
342
+ export { P as chartRootBridgeKeys, B as toChartLegendItems, I as useChartColors, z as useChartContextValue, R as useChartFrame, L as useChartPlot, F as useChartRoot };
@@ -0,0 +1,10 @@
1
+ import { ChartFamily, ChartSeriesRegistration } from './chartInjectionKey';
2
+ /**
3
+ * Registers a series on the nearest chart root while mounted. Throws when
4
+ * the root is not one of `families` (`ChartBarSeries` inside `ChartLine`).
5
+ */
6
+ export declare function useChartSeries<Entry extends ChartSeriesRegistration>({ entry, families, componentName, }: {
7
+ componentName: string;
8
+ entry: () => Omit<Entry, "id">;
9
+ families: readonly ChartFamily[];
10
+ }): import('vue').ComputedRef<Entry>;
@@ -0,0 +1,22 @@
1
+ import { useChartContext as e } from "./chartInjectionKey.js";
2
+ import { computed as t, onBeforeUnmount as n, useId as r, watch as i } from "vue";
3
+ import { isNil as a, upperFirst as o } from "es-toolkit/compat";
4
+ //#region src/Utils/Charts/useChartSeries.ts
5
+ function s(e) {
6
+ return `Chart${o(e)}`;
7
+ }
8
+ function c({ entry: o, families: c, componentName: l }) {
9
+ let u = r(), d = e(), { upsertSeries: f, removeSeries: p } = d.value;
10
+ if (!c.includes(d.value.family) || a(f) || a(p)) throw Error(`${l} must be used within ${c.map(s).join(" or ")}`);
11
+ let m = `${d.value.id}-series${u}`, h = t(() => ({
12
+ ...o(),
13
+ id: m
14
+ }));
15
+ return i(h, (e) => {
16
+ f(e);
17
+ }, { immediate: !0 }), n(() => {
18
+ p(m);
19
+ }), h;
20
+ }
21
+ //#endregion
22
+ export { c as useChartSeries };
@@ -8,9 +8,12 @@ import { ButtonGroupClasses, ButtonGroupProps } from './Components/ButtonGroup';
8
8
  import { CardClasses, CardProps } from './Components/Card';
9
9
  import { CarouselClasses, CarouselProps } from './Components/Carousel';
10
10
  import { CarouselSlideClasses } from './Components/CarouselSlide';
11
- import { ChartClasses, ChartProps } from './Components/Chart';
11
+ import { ChartBarProps } from './Components/ChartBar';
12
+ import { ChartFunnelProps } from './Components/ChartFunnel';
12
13
  import { ChartLegendClasses, ChartLegendProps } from './Components/ChartLegend';
13
- import { ChartSeriesProps } from './Components/ChartSeries';
14
+ import { ChartClasses, ChartLineProps } from './Components/ChartLine';
15
+ import { ChartPieProps } from './Components/ChartPie';
16
+ import { ChartScatterProps } from './Components/ChartScatter';
14
17
  import { ChartTooltipClasses } from './Components/ChartTooltip';
15
18
  import { CheckboxClasses, CheckboxProps } from './Components/Checkbox';
16
19
  import { ChipClasses, ChipProps } from './Components/Chip';
@@ -83,16 +86,29 @@ declare module "@bridge-ui/core/Config" {
83
86
  interface CarouselSlideConfigOverrides {
84
87
  classes: CarouselSlideClasses;
85
88
  }
86
- interface ChartConfigOverrides {
89
+ interface ChartBarConfigOverrides {
87
90
  classes: ChartClasses;
88
- defaultProps: Partial<Pick<ChartProps, "size" | "height" | "palette" | "animation">>;
91
+ defaultProps: Partial<Pick<ChartBarProps, "size" | "height" | "labels" | "radius" | "palette" | "animation" | "orientation">>;
92
+ }
93
+ interface ChartFunnelConfigOverrides {
94
+ classes: ChartClasses;
95
+ defaultProps: Partial<Pick<ChartFunnelProps, "size" | "sort" | "align" | "height" | "labels" | "palette" | "animation" | "labelPosition">>;
89
96
  }
90
97
  interface ChartLegendConfigOverrides {
91
98
  classes: ChartLegendClasses;
92
- defaultProps: Partial<Pick<ChartLegendProps, "align" | "position" | "interactive">>;
99
+ defaultProps: Partial<Pick<ChartLegendProps, "align" | "position" | "showValue" | "interactive" | "showPercent">>;
100
+ }
101
+ interface ChartLineConfigOverrides {
102
+ classes: ChartClasses;
103
+ defaultProps: Partial<Pick<ChartLineProps, "area" | "size" | "step" | "curve" | "height" | "labels" | "palette" | "animation" | "showPoints">>;
93
104
  }
94
- interface ChartSeriesConfigOverrides {
95
- defaultProps: Partial<Pick<ChartSeriesProps, "type" | "curve">>;
105
+ interface ChartPieConfigOverrides {
106
+ classes: ChartClasses;
107
+ defaultProps: Partial<Pick<ChartPieProps, "size" | "height" | "labels" | "palette" | "variant" | "minAngle" | "animation" | "thickness" | "labelPosition">>;
108
+ }
109
+ interface ChartScatterConfigOverrides {
110
+ classes: ChartClasses;
111
+ defaultProps: Partial<Pick<ChartScatterProps, "size" | "height" | "palette" | "animation" | "bubbleSize" | "symbolSize">>;
96
112
  }
97
113
  interface ChartTooltipConfigOverrides {
98
114
  classes: ChartTooltipClasses;
package/docs/README.md CHANGED
@@ -22,7 +22,12 @@ Component reference for **Vue**. This folder ships with the npm package.
22
22
  - [CalendarYear](./components/CalendarYear.md)
23
23
  - [Card](./components/Card.md)
24
24
  - [Carousel](./components/Carousel.md)
25
- - [Chart](./components/Chart.md)
25
+ - [Chart](./components/Chart.md) (overview, `ChartAxis`, `ChartLegend`, `ChartTooltip`)
26
+ - [ChartBar](./components/ChartBar.md)
27
+ - [ChartFunnel](./components/ChartFunnel.md)
28
+ - [ChartLine](./components/ChartLine.md)
29
+ - [ChartPie](./components/ChartPie.md)
30
+ - [ChartScatter](./components/ChartScatter.md)
26
31
  - [Checkbox](./components/Checkbox.md)
27
32
  - [ColorField](./components/ColorField.md)
28
33
  - [ColorPicker](./components/ColorPicker.md)