@bridge-ui/vue 0.17.3 → 0.19.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 (164) hide show
  1. package/ai/skills/bridge-ui-components/SKILL.md +36 -35
  2. package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
  3. package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +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 +64 -0
  11. package/dist/Components/ChartBar/chartBar.types.d.ts +66 -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 +28 -0
  19. package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +67 -0
  20. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.d.ts +5 -0
  21. package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +23 -0
  22. package/dist/Components/ChartBarSeries/index.d.ts +4 -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 +77 -0
  40. package/dist/Components/ChartLine/chartLine.types.d.ts +79 -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 +45 -0
  48. package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +96 -0
  49. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.d.ts +5 -0
  50. package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +28 -0
  51. package/dist/Components/ChartLineSeries/index.d.ts +4 -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 +76 -0
  56. package/dist/Components/ChartPie/chartPie.types.d.ts +92 -0
  57. package/dist/Components/ChartPie/composables/useChartPie.d.ts +30 -0
  58. package/dist/Components/ChartPie/composables/useChartPie.js +81 -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 +108 -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 +22 -0
  72. package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +45 -0
  73. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.d.ts +4 -0
  74. package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +19 -0
  75. package/dist/Components/ChartScatterSeries/index.d.ts +4 -0
  76. package/dist/Components/ChartScatterSeries/index.js +3 -0
  77. package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +22 -10
  78. package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +28 -9
  79. package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +4 -1
  80. package/dist/Components/ChartTooltip/composables/useChartTooltip.js +81 -63
  81. package/dist/Components/Heading/Heading.js +5 -0
  82. package/dist/Components/Heading/Heading.vue.d.ts +11 -0
  83. package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
  84. package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
  85. package/dist/Components/Heading/composables/useHeading.js +56 -0
  86. package/dist/Components/Heading/heading.types.d.ts +56 -0
  87. package/dist/Components/Heading/index.d.ts +3 -0
  88. package/dist/Components/Heading/index.js +3 -0
  89. package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
  90. package/dist/Components/Spinner/composables/useSpinner.d.ts +1 -1
  91. package/dist/Components/Text/Text.js +5 -0
  92. package/dist/Components/Text/Text.vue.d.ts +11 -0
  93. package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
  94. package/dist/Components/Text/composables/useText.d.ts +9 -0
  95. package/dist/Components/Text/composables/useText.js +56 -0
  96. package/dist/Components/Text/index.d.ts +3 -0
  97. package/dist/Components/Text/index.js +3 -0
  98. package/dist/Components/Text/text.types.d.ts +76 -0
  99. package/dist/Utils/Charts/ChartFrame.js +5 -0
  100. package/dist/Utils/Charts/ChartFrame.vue.d.ts +24 -0
  101. package/dist/Utils/Charts/ChartFrame.vue_vue_type_script_setup_true_lang.js +41 -0
  102. package/dist/{Components/Chart → Utils/Charts}/chart.types.d.ts +33 -18
  103. package/dist/Utils/Charts/chartInjectionKey.d.ts +151 -0
  104. package/dist/{Components/Chart → Utils/Charts}/chartInjectionKey.js +2 -2
  105. package/dist/Utils/Charts/echarts/bar.d.ts +6 -0
  106. package/dist/Utils/Charts/echarts/bar.js +23 -0
  107. package/dist/Utils/Charts/echarts/cartesian.d.ts +15 -0
  108. package/dist/Utils/Charts/echarts/cartesian.js +290 -0
  109. package/dist/Utils/Charts/echarts/funnel.d.ts +15 -0
  110. package/dist/Utils/Charts/echarts/funnel.js +79 -0
  111. package/dist/Utils/Charts/echarts/line.d.ts +5 -0
  112. package/dist/Utils/Charts/echarts/line.js +20 -0
  113. package/dist/Utils/Charts/echarts/part.d.ts +19 -0
  114. package/dist/Utils/Charts/echarts/part.js +45 -0
  115. package/dist/Utils/Charts/echarts/pie.d.ts +14 -0
  116. package/dist/Utils/Charts/echarts/pie.js +76 -0
  117. package/dist/Utils/Charts/echarts/plot.d.ts +44 -0
  118. package/dist/Utils/Charts/echarts/plot.js +52 -0
  119. package/dist/Utils/Charts/echarts/scatter.d.ts +14 -0
  120. package/dist/Utils/Charts/echarts/scatter.js +161 -0
  121. package/dist/Utils/Charts/index.d.ts +6 -0
  122. package/dist/Utils/Charts/index.js +6 -0
  123. package/dist/Utils/Charts/useChartCartesian.d.ts +59 -0
  124. package/dist/Utils/Charts/useChartCartesian.js +169 -0
  125. package/dist/Utils/Charts/useChartPart.d.ts +45 -0
  126. package/dist/Utils/Charts/useChartPart.js +97 -0
  127. package/dist/Utils/Charts/useChartRegistry.d.ts +13 -0
  128. package/dist/Utils/Charts/useChartRegistry.js +40 -0
  129. package/dist/Utils/Charts/useChartRoot.d.ts +156 -0
  130. package/dist/Utils/Charts/useChartRoot.js +342 -0
  131. package/dist/Utils/Charts/useChartSeries.d.ts +10 -0
  132. package/dist/Utils/Charts/useChartSeries.js +22 -0
  133. package/dist/augments.d.ts +33 -7
  134. package/dist/index.d.ts +4 -0
  135. package/dist/index.js +90 -86
  136. package/docs/README.md +8 -1
  137. package/docs/components/BridgeUIProvider.md +1 -1
  138. package/docs/components/Card.md +15 -0
  139. package/docs/components/Chart.md +118 -151
  140. package/docs/components/ChartBar.md +190 -0
  141. package/docs/components/ChartFunnel.md +62 -0
  142. package/docs/components/ChartLine.md +192 -0
  143. package/docs/components/ChartPie.md +138 -0
  144. package/docs/components/ChartScatter.md +102 -0
  145. package/docs/components/Heading.md +85 -0
  146. package/docs/components/Text.md +118 -0
  147. package/package.json +2 -2
  148. package/dist/Components/Chart/Chart.js +0 -5
  149. package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +0 -52
  150. package/dist/Components/Chart/chartInjectionKey.d.ts +0 -94
  151. package/dist/Components/Chart/composables/useChart.d.ts +0 -40
  152. package/dist/Components/Chart/composables/useChart.js +0 -346
  153. package/dist/Components/Chart/echartsChart.d.ts +0 -14
  154. package/dist/Components/Chart/echartsChart.js +0 -199
  155. package/dist/Components/Chart/index.d.ts +0 -4
  156. package/dist/Components/Chart/index.js +0 -4
  157. package/dist/Components/ChartSeries/ChartSeries.js +0 -5
  158. package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +0 -4
  159. package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +0 -24
  160. package/dist/Components/ChartSeries/chartSeries.types.d.ts +0 -37
  161. package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +0 -10
  162. package/dist/Components/ChartSeries/composables/useChartSeries.js +0 -29
  163. package/dist/Components/ChartSeries/index.d.ts +0 -3
  164. package/dist/Components/ChartSeries/index.js +0 -3
@@ -1,174 +1,156 @@
1
1
  # Chart
2
2
 
3
- Composable line, bar, and area charts. Bridge owns the legend, tooltip, tokens, dark mode, and a11y (summary, keyboard navigation, data table). The plot engine is ECharts.
3
+ Charts for dashboards and reports. Pick the root for the shape of your data; every root shares the same legend, tooltip, tokens, dark mode, and a11y (summary, keyboard navigation, data table). The plot engine is ECharts.
4
4
 
5
- Compose `Chart` with `ChartSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`.
5
+ | Root | Use for | Data |
6
+ | ----------------------------------- | -------------------------------------------------------------- | ----------------------------------------- |
7
+ | [`ChartLine`](./ChartLine.md) | Trends, areas, stacked areas, steps, sparklines | `ChartLineSeries`, one value per category |
8
+ | [`ChartBar`](./ChartBar.md) | Comparisons, rankings (horizontal), stacked totals, bar + line | `ChartBarSeries` (+ `ChartLineSeries`) |
9
+ | [`ChartScatter`](./ChartScatter.md) | Correlation between two numbers, bubbles | `ChartScatterSeries`, `[x, y]` points |
10
+ | [`ChartPie`](./ChartPie.md) | Share of a whole (pie, donut) | `data` on the root |
11
+ | [`ChartFunnel`](./ChartFunnel.md) | Conversion through ordered stages | `data` on the root |
12
+
13
+ Shared parts:
14
+
15
+ | Part | Line | Bar | Scatter | Pie | Funnel |
16
+ | -------------- | ---- | --- | ------- | --- | ------ |
17
+ | `ChartLegend` | ✅ | ✅ | ✅ | ✅ | ✅ |
18
+ | `ChartTooltip` | ✅ | ✅ | ✅ | ✅ | ✅ |
19
+ | `ChartAxis` | ✅ | ✅ | ✅ | — | — |
6
20
 
7
21
  ## Import
8
22
 
9
23
  ```ts
10
- import { Chart } from "@bridge-ui/vue/Components/Chart";
11
24
  import { ChartAxis } from "@bridge-ui/vue/Components/ChartAxis";
12
25
  import { ChartLegend } from "@bridge-ui/vue/Components/ChartLegend";
13
- import { ChartSeries } from "@bridge-ui/vue/Components/ChartSeries";
14
26
  import { ChartTooltip } from "@bridge-ui/vue/Components/ChartTooltip";
15
27
  ```
16
28
 
17
- Install `echarts` next to `@bridge-ui/vue` when you use `Chart`. The import is tree-shaken (line, bar, grid, SVG renderer). `Chart` stays off the `@bridge-ui/vue` root so apps that never import it do not load `echarts`.
29
+ Install `echarts` next to `@bridge-ui/vue` when you use a chart. Each root imports only its own series (line, bar, scatter, pie, or funnel) and the SVG renderer. Charts stay off the `@bridge-ui/vue` root so apps that never chart do not load `echarts`.
18
30
 
19
31
  ## Examples
20
32
 
21
- ### Usage
33
+ ### Axes
34
+
35
+ `position="x"` is the horizontal axis and `position="y"` the vertical one. On a horizontal `ChartBar` the categories sit on `y` and the values on `x`.
22
36
 
23
37
  ```vue
24
- <script setup lang="ts">
25
- const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
26
- </script>
27
-
28
- <template>
29
- <Chart :categories="months">
30
- <ChartSeries name="Revenue" :data="[120, 180, 150, 220, 260, 240]" />
31
- <ChartLegend />
32
- <ChartTooltip />
33
- </Chart>
34
- </template>
38
+ <ChartLine :categories="months">
39
+ <ChartLineSeries name="Revenue" :data="revenue" />
40
+ <ChartAxis
41
+ position="x"
42
+ label="Month"
43
+ :format-category="(month) => month.toUpperCase()"
44
+ />
45
+ <ChartAxis :min="0" position="y" :format-tick="(value) => `$${value}`" />
46
+ </ChartLine>
35
47
  ```
36
48
 
37
- ### Bar
49
+ `format-category` formats category labels (`string`). `format-tick` formats numbers: the value on a value axis, or the timestamp (ms) on a time axis. Grid lines are on for the value axis and off for the category axis by default.
38
50
 
39
- ```vue
40
- <Chart :height="320" :categories="months">
41
- <ChartSeries type="bar" name="Online" :data="online" />
42
- <ChartSeries type="bar" name="Retail" :data="retail" />
43
- <ChartLegend align="start" position="top" />
44
- <ChartTooltip />
45
- </Chart>
46
- ```
51
+ ### Legend
47
52
 
48
- ### Area
53
+ Legend entries are toggle buttons: click to hide or show a series or slice, hover or focus to emphasize it.
49
54
 
50
55
  ```vue
51
- <Chart :categories="months">
52
- <ChartSeries type="area" curve="smooth" name="Visitors" :data="visitors" />
53
- <ChartTooltip />
54
- </Chart>
56
+ <ChartLegend :interactive="false" />
57
+ <ChartLegend align="end" position="top" />
55
58
  ```
56
59
 
57
- ### Mixed series
58
-
59
- Bars and lines share the value axis.
60
+ `left` and `right` stack the entries beside the plot. With slices (pie, funnel), `show-value` and `show-percent` add value and share columns.
60
61
 
61
62
  ```vue
62
- <Chart :categories="months">
63
- <ChartSeries type="bar" name="Orders" :data="orders" />
64
- <ChartSeries name="Returns" :data="returns" />
65
- <ChartLegend />
66
- <ChartTooltip />
67
- </Chart>
63
+ <ChartPie :data="tags" variant="donut">
64
+ <ChartLegend show-percent position="right" />
65
+ </ChartPie>
68
66
  ```
69
67
 
70
- ### Gaps
71
-
72
- `null` values leave a gap in lines and areas and are skipped in the tooltip.
68
+ ### Tooltip
73
69
 
74
70
  ```vue
75
- <ChartSeries name="Costs" :data="[80, 90, null, 140, 150, 170]" />
71
+ <ChartTooltip :format-value="(value) => currency.format(value)" />
76
72
  ```
77
73
 
78
- ### Axes
79
-
80
74
  ```vue
81
- <Chart :categories="months">
82
- <ChartSeries name="Revenue" :data="revenue" />
83
- <ChartAxis position="x" label="Month" />
84
- <ChartAxis :min="0" position="y" :format-tick="(value) => `$${value}`" />
85
- </Chart>
75
+ <ChartTooltip>
76
+ <template #content="{ title, items }">
77
+ <span>{{ title }}: {{ items.length }} series</span>
78
+ </template>
79
+ </ChartTooltip>
86
80
  ```
87
81
 
88
- `format-tick` receives the category on `x` and the value on `y`. Grid lines are on for `y` and off for `x` by default.
82
+ The tooltip title is the category (line, bar) or the series name (scatter). Slices show one row with the value and the share; format the share with `format-percent`.
89
83
 
90
84
  ### Colors
91
85
 
92
- Series take palette colors in order. Override the palette on `Chart`, or pass a token key or any CSS color to `ChartSeries`.
86
+ Series and slices take palette colors in order. Override the palette on the root, or pass a token key or any CSS color.
93
87
 
94
88
  ```vue
95
- <Chart :categories="months" :palette="['info', 'warning']">
96
- <ChartSeries name="Plan" :data="plan" />
97
- <ChartSeries name="Actual" :data="actual" color="#8b5cf6" />
98
- </Chart>
89
+ <ChartLine :categories="months" :palette="['info', 'warning']">
90
+ <ChartLineSeries name="Plan" :data="plan" />
91
+ <ChartLineSeries name="Actual" :data="actual" color="#8b5cf6" />
92
+ </ChartLine>
99
93
  ```
100
94
 
101
95
  Token keys (`primary`, `info`, `success`, `warning`, `error`, `secondary`, `dark`, `black`) follow light and dark mode automatically.
102
96
 
103
- ### Legend
97
+ Colors can also follow the data:
104
98
 
105
- Legend entries are toggle buttons: click to hide or show a series, hover or focus to emphasize it.
99
+ - `color-ranges` on `ChartLineSeries`, `ChartBarSeries`, and `ChartScatterSeries` recolors points, bars, or stretches of a line by value ([ChartLine](./ChartLine.md#color-by-value), [ChartBar](./ChartBar.md#color-by-value), [ChartScatter](./ChartScatter.md#color-by-range)).
100
+ - `category-colors` on `ChartBar` gives each category its own color, and `tone="muted"` lightens a series ([ChartBar](./ChartBar.md#category-colors)).
106
101
 
107
- ```vue
108
- <ChartLegend :interactive="false" />
109
- <ChartLegend align="end" position="top" />
110
- ```
111
-
112
- ### Tooltip
113
-
114
- ```vue
115
- <ChartTooltip :format-value="(value) => currency.format(value)" />
116
- ```
117
-
118
- ```vue
119
- <ChartTooltip>
120
- <template #content="{ category, items }">
121
- <span>{{ category }}: {{ items.length }} series</span>
122
- </template>
123
- </ChartTooltip>
124
- ```
102
+ Color is never the only cue: range labels show in the tooltip, the data table, and the keyboard announcements.
125
103
 
126
104
  ### Loading and empty
127
105
 
128
106
  While `loading` is true, the plot stays visible behind a translucent overlay with a spinner, and the root gets `aria-busy`. Use the `loading` slot to replace the spinner.
129
107
 
130
108
  ```vue
131
- <Chart :loading="isLoading" :categories="months">
132
- <ChartSeries name="Revenue" :data="revenue" />
133
- </Chart>
109
+ <ChartBar :loading="isLoading" :categories="months">
110
+ <ChartBarSeries name="Orders" :data="orders" />
111
+ </ChartBar>
134
112
  ```
135
113
 
136
114
  ```vue
137
- <Chart :categories="months">
138
- <template #empty>No sales in this period</template>
139
- </Chart>
115
+ <ChartPie :data="[]">
116
+ <template #empty>No outflows this month</template>
117
+ </ChartPie>
140
118
  ```
141
119
 
142
120
  ### Summary
143
121
 
144
- `Chart` generates a text summary (series names and category range) for screen readers. Pass `summary` to describe the takeaway instead.
122
+ Each root generates a text summary for screen readers. Pass `summary` to describe the takeaway instead.
145
123
 
146
124
  ```vue
147
- <Chart :categories="months" summary="Revenue doubled from January to June.">
148
- <ChartSeries name="Revenue" :data="revenue" />
149
- </Chart>
125
+ <ChartLine :categories="months" summary="Revenue doubled from January to June.">
126
+ <ChartLineSeries name="Revenue" :data="revenue" />
127
+ </ChartLine>
150
128
  ```
151
129
 
152
130
  ### Registry defaults
153
131
 
132
+ Each root has its own registry entry (`ChartLine`, `ChartBar`, `ChartScatter`, `ChartPie`, `ChartFunnel`).
133
+
154
134
  ```vue
155
135
  <BridgeUIProvider
156
136
  :components="{
157
- ChartSeries: { defaultProps: { curve: 'smooth' } },
158
137
  ChartLegend: { defaultProps: { position: 'top' } },
159
- Chart: { defaultProps: { height: 320, palette: ['primary', 'success'] } },
138
+ ChartLine: { defaultProps: { curve: 'smooth', height: 320 } },
139
+ ChartBar: { defaultProps: { palette: ['primary', 'success'] } },
160
140
  }"
161
141
  >
162
142
  <App />
163
143
  </BridgeUIProvider>
164
144
  ```
165
145
 
166
- Theme tokens (`Chart.tokens.theme`) set the grid, axis, and label colors as Tailwind text-color classes:
146
+ Theme tokens (`tokens.theme`) set the grid, axis, and label colors as Tailwind text-color classes:
167
147
 
168
148
  ```vue
169
149
  <BridgeUIProvider
170
150
  :components="{
171
- Chart: { tokens: { theme: { grid: 'text-dark-100 dark:text-dark-800' } } },
151
+ ChartLine: {
152
+ tokens: { theme: { grid: 'text-dark-100 dark:text-dark-800' } },
153
+ },
172
154
  }"
173
155
  >
174
156
  <App />
@@ -178,77 +160,62 @@ Theme tokens (`Chart.tokens.theme`) set the grid, axis, and label colors as Tail
178
160
  ## Accessibility
179
161
 
180
162
  - The root is a `figure`; the plot is a focusable `img` labelled by `summary` (or the generated summary).
181
- - Arrow keys move between categories, `Home` / `End` jump to the edges, `Escape` clears. The tooltip follows the keyboard, and the values are announced through a live region.
163
+ - Arrow keys move between items (categories, points, slices, or stages), `Home` / `End` jump to the edges, `Escape` clears. The tooltip follows the keyboard, and the values are announced through a live region.
182
164
  - A data table with every value is always rendered, visually hidden.
183
165
  - The tooltip is decorative (`aria-hidden`); the same information is in the table and announcements.
184
166
  - Engine animation is off under `prefers-reduced-motion`.
185
167
 
186
- ## Props (`Chart`)
187
-
188
- | Prop | Type | Default | Description |
189
- | ------------- | -------------------- | ------------------------ | --------------------------------------------------- |
190
- | `animation` | `boolean` | `true` | Engine transitions (always off for reduced motion). |
191
- | `categories` | `string[]` | required | Category labels; one value per category per series. |
192
- | `classes` | `ChartClasses` | — | `root`, `plot`, `loading`, `empty`, `table`. |
193
- | `height` | `number \| string` | `280` | Plot height. |
194
- | `loading` | `boolean` | `false` | Shows the spinner overlay. |
195
- | `palette` | `ChartSeriesColor[]` | primary, info, success … | Series colors in order. |
196
- | `size` | `ChartSize` | `"md"` | Density of labels, legend, and tooltip. |
197
- | `summary` | `string` | generated | Accessible description of the plot. |
198
- | `width` | `number \| string` | `"100%"` | Root width. |
199
- | `customProps` | `ChartCustomProps` | — | Extra props for `root` and `plot`. |
200
-
201
- ### Slots (`Chart`)
202
-
203
- | Slot | Description |
204
- | --------- | ---------------------------------------------------------- |
205
- | `default` | `ChartSeries`, `ChartAxis`, `ChartLegend`, `ChartTooltip`. |
206
- | `empty` | Content shown when there is nothing to plot. |
207
- | `loading` | Content shown while `loading` is true. |
208
-
209
- ## Props (`ChartSeries`)
210
-
211
- | Prop | Type | Default | Description |
212
- | ------- | --------------------------- | ---------- | ---------------------------------------- |
213
- | `color` | `ChartSeriesColor` | palette | Token key or CSS color. |
214
- | `curve` | `"linear" \| "smooth"` | `"linear"` | Line interpolation for `line` / `area`. |
215
- | `data` | `(number \| null)[]` | required | One value per category; `null` is a gap. |
216
- | `name` | `string` | required | Legend, tooltip, and table label. |
217
- | `type` | `"line" \| "bar" \| "area"` | `"line"` | Series family. |
168
+ ## Props (every root)
169
+
170
+ | Prop | Type | Default | Description |
171
+ | -------------- | ------------------- | ------------------------ | ------------------------------------------------------ |
172
+ | `animation` | `boolean` | `true` | Engine transitions (always off for reduced motion). |
173
+ | `classes` | `ChartClasses` | — | `root`, `plot`, `center`, `loading`, `empty`, `table`. |
174
+ | `height` | `number \| string` | `280` | Plot height. |
175
+ | `loading` | `boolean` | `false` | Shows the spinner overlay. |
176
+ | `palette` | `ChartColorValue[]` | primary, info, success … | Colors in order. |
177
+ | `size` | `ChartSize` | `"md"` | Density of labels, legend, and tooltip. |
178
+ | `summary` | `string` | generated | Accessible description of the plot. |
179
+ | `width` | `number \| string` | `"100%"` | Root width. |
180
+ | `custom-props` | `ChartCustomProps` | — | Extra props for `root` and `plot`. |
181
+
182
+ Slots: `default` (series, `ChartAxis`, `ChartLegend`, `ChartTooltip`), `empty`, `loading`.
218
183
 
219
184
  ## Props (`ChartAxis`)
220
185
 
221
- | Prop | Type | Default | Description |
222
- | ------------ | ------------------------------------- | ----------------------------- | --------------------------------- |
223
- | `formatTick` | `(value: number \| string) => string` | — | Tick label formatter. |
224
- | `grid` | `boolean` | `true` on `y`, `false` on `x` | Grid lines. |
225
- | `hidden` | `boolean` | `false` | Hides the axis line and labels. |
226
- | `label` | `string` | — | Axis title. |
227
- | `max` | `number` | auto | Value axis upper bound. |
228
- | `min` | `number` | auto | Value axis lower bound. |
229
- | `position` | `"x" \| "y"` | required | Categories (`x`) or values (`y`). |
230
- | `tickCount` | `number` | auto | Preferred number of ticks. |
186
+ | Prop | Type | Default | Description |
187
+ | ----------------- | ------------------------------ | --------------------------- | ----------------------------------- |
188
+ | `position` | `"x" \| "y"` | required | Horizontal (`x`) or vertical (`y`). |
189
+ | `label` | `string` | — | Axis title. |
190
+ | `grid` | `boolean` | value axis on, category off | Grid lines. |
191
+ | `hidden` | `boolean` | `false` | Hides the axis line and labels. |
192
+ | `min` | `number` | — | Lower bound (value or time axis). |
193
+ | `max` | `number` | — | Upper bound (value or time axis). |
194
+ | `tick-count` | `number` | — | Preferred number of ticks. |
195
+ | `format-tick` | `(value: number) => string` | — | Value or time (ms) tick formatter. |
196
+ | `format-category` | `(category: string) => string` | — | Category tick formatter. |
231
197
 
232
198
  ## Props (`ChartLegend`)
233
199
 
234
- | Prop | Type | Default | Description |
235
- | ------------- | ------------------------------ | ---------- | ------------------------------------------ |
236
- | `align` | `"start" \| "center" \| "end"` | `"center"` | Horizontal alignment. |
237
- | `classes` | `ChartLegendClasses` | — | `root`, `item`, `swatch`, `label`. |
238
- | `interactive` | `boolean` | `true` | Entries toggle and emphasize their series. |
239
- | `position` | `"top" \| "bottom"` | `"bottom"` | Above or below the plot. |
240
- | `customProps` | `ChartLegendCustomProps` | — | Extra props for `root` and `item`. |
200
+ | Prop | Type | Default | Description |
201
+ | ---------------- | ---------------------------------------- | ---------- | ------------------------------------------------------ |
202
+ | `align` | `"start" \| "center" \| "end"` | `"center"` | Entry alignment. |
203
+ | `position` | `"top" \| "bottom" \| "left" \| "right"` | `"bottom"` | Where the legend sits. |
204
+ | `interactive` | `boolean` | `true` | Entries toggle and emphasize items. |
205
+ | `show-value` | `boolean` | `false` | Value column (pie, funnel). |
206
+ | `show-percent` | `boolean` | `false` | Share column (pie, funnel). |
207
+ | `format-value` | `(value: number) => string` | — | Value column formatter. |
208
+ | `format-percent` | `(percent: number) => string` | — | Share column formatter. |
209
+ | `classes` | `ChartLegendClasses` | — | `root`, `item`, `swatch`, `label`, `value`, `percent`. |
210
+ | `custom-props` | `ChartLegendCustomProps` | — | Extra props for `root` and `item`. |
241
211
 
242
212
  ## Props (`ChartTooltip`)
243
213
 
244
- | Prop | Type | Default | Description |
245
- | ------------- | --------------------------------- | -------------------- | ---------------------------------------------------- |
246
- | `classes` | `ChartTooltipClasses` | — | `root`, `title`, `item`, `swatch`, `label`, `value`. |
247
- | `formatValue` | `(value: number, item) => string` | locale number format | Value formatter. |
248
- | `customProps` | `ChartTooltipCustomProps` | — | Extra props for `root`. |
249
-
250
- ### Slots (`ChartTooltip`)
214
+ | Prop | Type | Default | Description |
215
+ | ---------------- | --------------------------- | ------- | ----------------------------------------------------------------------- |
216
+ | `format-value` | `(value, item) => string` | — | Value formatter. |
217
+ | `format-percent` | `(percent, item) => string` | — | Share formatter (pie, funnel). |
218
+ | `classes` | `ChartTooltipClasses` | — | `root`, `title`, `item`, `swatch`, `label`, `value`, `percent`, `note`. |
219
+ | `custom-props` | `ChartTooltipCustomProps` | — | Extra props for `root`. |
251
220
 
252
- | Slot | Props | Description |
253
- | --------- | ---------------------------- | ---------------------------- |
254
- | `content` | `{ category, index, items }` | Replaces the title and rows. |
221
+ Slot: `content` (`{ index, title, color, items }`) replaces the title and rows.
@@ -0,0 +1,190 @@
1
+ # ChartBar
2
+
3
+ Bar charts: comparisons, rankings, stacked totals, negative values, and time axes. Compose with `ChartBarSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { ChartBar } from "@bridge-ui/vue/Components/ChartBar";
9
+ import { ChartBarSeries } from "@bridge-ui/vue/Components/ChartBarSeries";
10
+ import { ChartLineSeries } from "@bridge-ui/vue/Components/ChartLineSeries";
11
+ ```
12
+
13
+ ## Examples
14
+
15
+ ### Usage
16
+
17
+ ```vue
18
+ <ChartBar :height="320" :categories="months">
19
+ <ChartBarSeries name="Online" :data="online" />
20
+ <ChartBarSeries name="Retail" :data="retail" />
21
+ <ChartLegend align="start" position="top" />
22
+ <ChartTooltip />
23
+ </ChartBar>
24
+ ```
25
+
26
+ ### Horizontal
27
+
28
+ `orientation="horizontal"` lists the categories top to bottom on the `y` axis. Value formatting moves to `x`.
29
+
30
+ ```vue
31
+ <ChartBar :categories="tags" orientation="horizontal">
32
+ <ChartBarSeries :data="spent" name="October" />
33
+ <ChartAxis position="x" :format-tick="(value) => currency.format(value)" />
34
+ </ChartBar>
35
+ ```
36
+
37
+ ### Stacked
38
+
39
+ Series with the same `stack` key stack. Only the outermost bar of each stack is rounded.
40
+
41
+ ```vue
42
+ <ChartBar labels stack="total" :categories="months">
43
+ <ChartBarSeries name="Online" :data="online" />
44
+ <ChartBarSeries name="Retail" :data="retail" />
45
+ <ChartLegend />
46
+ </ChartBar>
47
+ ```
48
+
49
+ Inside labels that do not fit their segment are hidden.
50
+
51
+ ### Bar + line
52
+
53
+ `ChartLineSeries` inside `ChartBar` draws a line over the bars on the same value axis, with the points centered on each category. Line options (`dashed`, `show-points`, `curve`, `area`, `reference`) work as in `ChartLine`.
54
+
55
+ ```vue
56
+ <ChartBar :categories="months">
57
+ <ChartBarSeries name="Orders" :data="orders" />
58
+ <ChartLineSeries dashed name="Returns" :data="returns" />
59
+ <ChartLegend />
60
+ <ChartTooltip />
61
+ </ChartBar>
62
+ ```
63
+
64
+ The `ChartBar` `stack` applies to bars only: a line stays on its own values (a target, an average) unless you give it a `stack`.
65
+
66
+ `ChartBar` loads the ECharts line series too, so bar + line charts need no extra import.
67
+
68
+ ### Category colors
69
+
70
+ `category-colors` gives each category its own bar color. Every bar series in a category shares that color; `tone="muted"` tells a comparison series apart with a lighter shade of the same color.
71
+
72
+ ```vue
73
+ <script setup lang="ts">
74
+ const tagColors = {
75
+ housing: "primary",
76
+ groceries: "success",
77
+ transport: "warning",
78
+ delivery: "#8b5cf6",
79
+ };
80
+ </script>
81
+
82
+ <template>
83
+ <ChartBar :categories="tags" :category-colors="tagColors">
84
+ <ChartBarSeries name="October" :data="october" />
85
+ <ChartBarSeries tone="muted" :data="average" name="6-month average" />
86
+ <ChartLegend />
87
+ <ChartTooltip />
88
+ </ChartBar>
89
+ </template>
90
+ ```
91
+
92
+ `category-colors` takes a record keyed by category label, an array in category order, or `true` (the bare `category-colors` attribute) to use the palette in category order. Categories without a color take the palette entry at their index.
93
+
94
+ With category colors the legend shows each series in a neutral color (muted series in a lighter shade), and the tooltip shows the bar colors. `ChartLineSeries` inside keep their own color.
95
+
96
+ `tone="muted"` also works without `category-colors`: it lightens the series color (a previous period next to the current one). Muted shades mix toward the background behind the chart, so they follow light and dark mode.
97
+
98
+ ### Color by value
99
+
100
+ `color-ranges` recolors single bars by value. A value in `[min, max)` takes the range color; bars outside every range keep the series color. Range labels show in the tooltip, the data table, and the keyboard announcements.
101
+
102
+ ```vue
103
+ <ChartBar :categories="months">
104
+ <ChartBarSeries
105
+ name="Spent"
106
+ :data="spent"
107
+ :color-ranges="[
108
+ { max: 1000, color: 'success', label: 'On budget' },
109
+ { min: 1000, color: 'error', label: 'Over budget' },
110
+ ]"
111
+ />
112
+ </ChartBar>
113
+ ```
114
+
115
+ With `color-by="category"`, `min` and `max` are category indices (both included) instead of values. Ranges win over `category-colors`.
116
+
117
+ ### Negative values
118
+
119
+ Bars round the end that points away from zero.
120
+
121
+ ```vue
122
+ <ChartBar :categories="months">
123
+ <ChartBarSeries name="Balance" :data="[1200, -400, 800, -150]" />
124
+ </ChartBar>
125
+ ```
126
+
127
+ ### Reference lines
128
+
129
+ ```vue
130
+ <ChartBar :categories="months">
131
+ <ChartBarSeries name="Orders" :data="orders" :reference="{ type: 'average' }" />
132
+ </ChartBar>
133
+ ```
134
+
135
+ ### Value labels
136
+
137
+ ```vue
138
+ <ChartBar labels :categories="months" :format-label="(value) => `${value}%`">
139
+ <ChartBarSeries name="Share" :data="share" />
140
+ </ChartBar>
141
+ ```
142
+
143
+ ### Time axis
144
+
145
+ Dates as `categories` place bars by time. See [ChartLine](./ChartLine.md#time-axis).
146
+
147
+ ```vue
148
+ <ChartBar :categories="days">
149
+ <ChartBarSeries name="Spent" :data="spentPerDay" />
150
+ </ChartBar>
151
+ ```
152
+
153
+ ### Square corners
154
+
155
+ ```vue
156
+ <ChartBar :radius="0" :categories="months">
157
+ <ChartBarSeries name="Orders" :data="orders" />
158
+ </ChartBar>
159
+ ```
160
+
161
+ ## Props (`ChartBar`)
162
+
163
+ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
164
+
165
+ | Prop | Type | Default | Description |
166
+ | ----------------- | ----------------------------------------------------------------- | ------------ | ------------------------------------------------------------------------------------ |
167
+ | `categories` | `string[] \| Date[]` | required | Category labels, or dates for a time axis. |
168
+ | `category-colors` | `boolean \| ChartColorValue[] \| Record<string, ChartColorValue>` | — | Bar color per category (record by label, array by index, or `true` for the palette). |
169
+ | `orientation` | `"vertical" \| "horizontal"` | `"vertical"` | `horizontal` puts categories on `y`. |
170
+ | `stack` | `string` | — | Stack every bar series under this key. |
171
+ | `labels` | `boolean` | `false` | Value labels on every series. |
172
+ | `radius` | `number` | `4` | Corner radius (px) on the value end. |
173
+ | `format-date` | `(date: Date) => string` | — | Date labels in the tooltip, table, and summary. |
174
+ | `format-label` | `(value: number) => string` | — | Value labels and reference line labels. |
175
+
176
+ ## Props (`ChartBarSeries`)
177
+
178
+ Unset options fall back to the `ChartBar` props.
179
+
180
+ | Prop | Type | Default | Description |
181
+ | -------------- | ------------------------------------ | --------- | -------------------------------------------------------------------------------------- |
182
+ | `name` | `string` | required | Legend, tooltip, and table name. |
183
+ | `data` | `(number \| null)[]` | required | One value per category. |
184
+ | `color` | `ChartColorValue` | palette | Token key or CSS color. |
185
+ | `stack` | `string` | root | Stack key. |
186
+ | `labels` | `boolean` | root | Value labels. |
187
+ | `reference` | `ChartReference \| ChartReference[]` | — | `{ type: "average" \| "min" \| "max" }` or `{ value }`, each with an optional `label`. |
188
+ | `tone` | `"solid" \| "muted"` | `"solid"` | `muted` mixes the bar colors toward the background. |
189
+ | `color-ranges` | `ChartColorRangeOption[]` | — | `{ min?, max?, color, label? }`: bars with a value in `[min, max)` take `color`. |
190
+ | `color-by` | `"value" \| "category"` | `"value"` | `category` matches `color-ranges` against category indices (both ends included). |
@@ -0,0 +1,62 @@
1
+ # ChartFunnel
2
+
3
+ Funnel charts: conversion through ordered stages. Stages come from `data`; compose with `ChartLegend` and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { ChartFunnel } from "@bridge-ui/vue/Components/ChartFunnel";
9
+ ```
10
+
11
+ ## Examples
12
+
13
+ ### Usage
14
+
15
+ ```vue
16
+ <ChartFunnel
17
+ :data="[
18
+ { label: 'Visited', value: 1200 },
19
+ { label: 'Signed up', value: 420 },
20
+ { label: 'Paid', value: 96 },
21
+ ]"
22
+ >
23
+ <ChartTooltip />
24
+ </ChartFunnel>
25
+ ```
26
+
27
+ Stages are sorted from the largest by default. Shares compare each stage to the largest one, whatever the order: with `sort="none"`, a stage after a smaller one can show a higher share.
28
+
29
+ ### Order
30
+
31
+ ```vue
32
+ <ChartFunnel sort="none" :data="steps" />
33
+ ```
34
+
35
+ ### Labels and legend
36
+
37
+ Stage labels are on and sit inside the shape by default. `label-position="outside"` moves them next to it, `:labels="false"` hides them, and `label-content` picks the text.
38
+
39
+ ```vue
40
+ <ChartFunnel :data="steps" label-content="percent" label-position="outside">
41
+ <ChartLegend show-value show-percent />
42
+ </ChartFunnel>
43
+ ```
44
+
45
+ ### Alignment
46
+
47
+ ```vue
48
+ <ChartFunnel align="left" :data="steps" />
49
+ ```
50
+
51
+ ## Props (`ChartFunnel`)
52
+
53
+ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
54
+
55
+ | Prop | Type | Default | Description |
56
+ | ---------------- | ------------------------------------------------------ | -------------- | --------------------------- |
57
+ | `data` | `{ label, value, color? }[]` | required | Stages. |
58
+ | `sort` | `"descending" \| "ascending" \| "none"` | `"descending"` | Stage order, top to bottom. |
59
+ | `align` | `"center" \| "left" \| "right"` | `"center"` | Shape alignment. |
60
+ | `labels` | `boolean` | `true` | Stage labels on the plot. |
61
+ | `label-position` | `"inside" \| "outside"` | `"inside"` | Where plot labels sit. |
62
+ | `label-content` | `"label" \| "value" \| "percent" \| (stage) => string` | `"label"` | What plot labels show. |