@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,151 @@
1
+ # ChartLine
2
+
3
+ Line and area charts: trends, stacked areas, steps, reference lines, time axes, and sparklines. Compose with `ChartLineSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { ChartLine } from "@bridge-ui/vue/Components/ChartLine";
9
+ import { ChartLineSeries } from "@bridge-ui/vue/Components/ChartLineSeries";
10
+ ```
11
+
12
+ ## Examples
13
+
14
+ ### Usage
15
+
16
+ ```vue
17
+ <script setup lang="ts">
18
+ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
19
+ </script>
20
+
21
+ <template>
22
+ <ChartLine :categories="months">
23
+ <ChartLineSeries name="Revenue" :data="[120, 180, 150, 220, 260, 240]" />
24
+ <ChartLegend />
25
+ <ChartTooltip />
26
+ </ChartLine>
27
+ </template>
28
+ ```
29
+
30
+ ### Area
31
+
32
+ `area` fills under the line. Set it on the root for every series, or per series.
33
+
34
+ ```vue
35
+ <ChartLine area curve="smooth" :categories="months">
36
+ <ChartLineSeries name="Visitors" :data="visitors" />
37
+ </ChartLine>
38
+ ```
39
+
40
+ ### Stacked area
41
+
42
+ Series with the same `stack` key stack on top of each other.
43
+
44
+ ```vue
45
+ <ChartLine area stack="total" :categories="months">
46
+ <ChartLineSeries name="Organic" :data="organic" />
47
+ <ChartLineSeries name="Paid" :data="paid" />
48
+ <ChartLegend />
49
+ </ChartLine>
50
+ ```
51
+
52
+ ### Step, dashed, and points
53
+
54
+ ```vue
55
+ <ChartLine :categories="days">
56
+ <ChartLineSeries step="end" name="Plan" :data="plan" />
57
+ <ChartLineSeries dashed show-points name="Forecast" :data="forecast" />
58
+ </ChartLine>
59
+ ```
60
+
61
+ ### Reference lines
62
+
63
+ `reference` draws a dashed line for a statistic of the series (`average`, `min`, `max`) or a fixed `value`.
64
+
65
+ ```vue
66
+ <ChartLine :categories="months">
67
+ <ChartLineSeries
68
+ name="Spending"
69
+ :data="spending"
70
+ :reference="[{ type: 'average' }, { value: 3000, label: 'Budget' }]"
71
+ />
72
+ </ChartLine>
73
+ ```
74
+
75
+ ### Time axis
76
+
77
+ Pass dates as `categories` to get a time axis: points are spaced by elapsed time, and tick labels (days, months, years) follow the span and the Bridge locale. `format-date` formats the dates in the tooltip, data table, and summary.
78
+
79
+ ```vue
80
+ <script setup lang="ts">
81
+ const days = [new Date(2026, 9, 1), new Date(2026, 9, 2), new Date(2026, 9, 6)];
82
+ </script>
83
+
84
+ <template>
85
+ <ChartLine :categories="days" :format-date="(date) => format(date, 'dd/MM')">
86
+ <ChartLineSeries area name="Spent" :data="[120, 260, 410]" />
87
+ <ChartAxis position="x" :format-tick="(time) => format(time, 'dd')" />
88
+ </ChartLine>
89
+ </template>
90
+ ```
91
+
92
+ ### Sparkline
93
+
94
+ `sparkline` drops axes, grid, and padding, and defaults the height to `48`. The summary and data table stay.
95
+
96
+ ```vue
97
+ <ChartLine sparkline :categories="weeks">
98
+ <ChartLineSeries area name="Balance" :data="balance" />
99
+ </ChartLine>
100
+ ```
101
+
102
+ ### Value labels
103
+
104
+ ```vue
105
+ <ChartLine labels :categories="months" :format-label="(value) => `${value}k`">
106
+ <ChartLineSeries name="Revenue" :data="revenue" />
107
+ </ChartLine>
108
+ ```
109
+
110
+ ### Gaps
111
+
112
+ `null` values leave a gap and are skipped in the tooltip.
113
+
114
+ ```vue
115
+ <ChartLineSeries name="Costs" :data="[80, 90, null, 140, 150, 170]" />
116
+ ```
117
+
118
+ ## Props (`ChartLine`)
119
+
120
+ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
121
+
122
+ | Prop | Type | Default | Description |
123
+ | -------------- | --------------------------------------- | ---------- | ----------------------------------------------- |
124
+ | `categories` | `string[] \| Date[]` | required | Category labels, or dates for a time axis. |
125
+ | `area` | `boolean` | `false` | Fill under every series. |
126
+ | `curve` | `"linear" \| "smooth"` | `"linear"` | Interpolation for every series. |
127
+ | `step` | `false \| "start" \| "middle" \| "end"` | `false` | Step line for every series. |
128
+ | `stack` | `string` | — | Stack every series under this key. |
129
+ | `labels` | `boolean` | `false` | Value labels on every series. |
130
+ | `show-points` | `boolean` | `false` | Always draw point symbols. |
131
+ | `sparkline` | `boolean` | `false` | No axes, grid, or padding; 48px default height. |
132
+ | `format-date` | `(date: Date) => string` | — | Date labels in the tooltip, table, and summary. |
133
+ | `format-label` | `(value: number) => string` | — | Value labels and reference line labels. |
134
+
135
+ ## Props (`ChartLineSeries`)
136
+
137
+ Unset options fall back to the `ChartLine` props.
138
+
139
+ | Prop | Type | Default | Description |
140
+ | ------------- | --------------------------------------- | -------- | -------------------------------------------------------------------------------------- |
141
+ | `name` | `string` | required | Legend, tooltip, and table name. |
142
+ | `data` | `(number \| null)[]` | required | One value per category; `null` leaves a gap. |
143
+ | `color` | `ChartColorValue` | palette | Token key or CSS color. |
144
+ | `area` | `boolean` | root | Fill under the line. |
145
+ | `curve` | `"linear" \| "smooth"` | root | Interpolation. |
146
+ | `step` | `false \| "start" \| "middle" \| "end"` | root | Step line. |
147
+ | `stack` | `string` | root | Stack key. |
148
+ | `dashed` | `boolean` | `false` | Dashed stroke. |
149
+ | `labels` | `boolean` | root | Value labels. |
150
+ | `show-points` | `boolean` | root | Point symbols. |
151
+ | `reference` | `ChartReference \| ChartReference[]` | — | `{ type: "average" \| "min" \| "max" }` or `{ value }`, each with an optional `label`. |
@@ -0,0 +1,115 @@
1
+ # ChartPie
2
+
3
+ Pie and donut charts: the share of each part in a whole. Slices 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 { ChartPie } from "@bridge-ui/vue/Components/ChartPie";
9
+ ```
10
+
11
+ ## Examples
12
+
13
+ ### Usage
14
+
15
+ ```vue
16
+ <script setup lang="ts">
17
+ const tags = [
18
+ { label: "Housing", value: 3450 },
19
+ { label: "Kids", value: 1310 },
20
+ { label: "Groceries", value: 1240 },
21
+ ];
22
+ </script>
23
+
24
+ <template>
25
+ <ChartPie :data="tags">
26
+ <ChartLegend />
27
+ <ChartTooltip />
28
+ </ChartPie>
29
+ </template>
30
+ ```
31
+
32
+ Non-positive values are skipped. Shares are whole percents that always sum to 100.
33
+
34
+ ### Donut with center content
35
+
36
+ ```vue
37
+ <ChartPie :data="tags" variant="donut">
38
+ <template #center>
39
+ <strong>R$ 6,9 mil</strong>
40
+ <span>in outflows</span>
41
+ </template>
42
+
43
+ <ChartLegend show-percent position="right" />
44
+ </ChartPie>
45
+ ```
46
+
47
+ `thickness` sets the ring width as a fraction of the radius (default `0.3`).
48
+
49
+ ### Labels: plot, legend, or both
50
+
51
+ `labels` turns slice labels on the plot on, and `label-position` places them (`"outside"` by default, or `"inside"`). The legend comes from `ChartLegend`.
52
+
53
+ Plot only:
54
+
55
+ ```vue
56
+ <ChartPie labels :data="tags" />
57
+ ```
58
+
59
+ Legend only:
60
+
61
+ ```vue
62
+ <ChartPie :data="tags">
63
+ <ChartLegend show-percent />
64
+ </ChartPie>
65
+ ```
66
+
67
+ Both:
68
+
69
+ ```vue
70
+ <ChartPie labels :data="tags" label-position="inside" label-content="percent">
71
+ <ChartLegend />
72
+ </ChartPie>
73
+ ```
74
+
75
+ `label-content` is `"label"`, `"value"`, `"percent"`, or a function that receives `{ label, value, percent }`.
76
+
77
+ ### Slice colors
78
+
79
+ ```vue
80
+ <ChartPie
81
+ :data="[
82
+ { label: 'Paid', value: 32, color: 'success' },
83
+ { label: 'Late', value: 4, color: 'error' },
84
+ ]"
85
+ />
86
+ ```
87
+
88
+ ### Group small slices
89
+
90
+ `max-slices` keeps the largest slices and groups the rest into "Other".
91
+
92
+ ```vue
93
+ <ChartPie :data="tags" :max-slices="5" />
94
+ ```
95
+
96
+ ### Hiding slices
97
+
98
+ Legend entries hide and show slices; shares are recomputed for the visible slices. The data table keeps the shares of all data.
99
+
100
+ ## Props (`ChartPie`)
101
+
102
+ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
103
+
104
+ | Prop | Type | Default | Description |
105
+ | ---------------- | ------------------------------------------------------ | ----------- | ---------------------------------------------- |
106
+ | `data` | `{ label, value, color? }[]` | required | Slices in order. |
107
+ | `variant` | `"pie" \| "donut"` | `"pie"` | `donut` leaves a hole for the `center` slot. |
108
+ | `thickness` | `number` | `0.3` | Donut ring thickness (fraction of the radius). |
109
+ | `labels` | `boolean` | `false` | Slice labels on the plot. |
110
+ | `label-position` | `"inside" \| "outside"` | `"outside"` | Where plot labels sit. |
111
+ | `label-content` | `"label" \| "value" \| "percent" \| (slice) => string` | `"label"` | What plot labels show. |
112
+ | `min-angle` | `number` | `2` | Minimum slice angle (deg). |
113
+ | `max-slices` | `number` | — | Group the rest into "Other". |
114
+
115
+ Slots: `center` (inside the donut hole), `empty`, `loading`, `default`.
@@ -0,0 +1,84 @@
1
+ # ChartScatter
2
+
3
+ Scatter and bubble charts: the relation between two numbers, with an optional third value as bubble size. Both axes are numeric. Compose with `ChartScatterSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`. Shared parts, colors, and a11y are in [Chart](./Chart.md).
4
+
5
+ ## Import
6
+
7
+ ```ts
8
+ import { ChartScatter } from "@bridge-ui/vue/Components/ChartScatter";
9
+ import { ChartScatterSeries } from "@bridge-ui/vue/Components/ChartScatterSeries";
10
+ ```
11
+
12
+ ## Examples
13
+
14
+ ### Usage
15
+
16
+ ```vue
17
+ <ChartScatter>
18
+ <ChartScatterSeries
19
+ name="Customers"
20
+ :data="[
21
+ [24, 340],
22
+ [31, 520],
23
+ [45, 410],
24
+ ]"
25
+ />
26
+ <ChartAxis label="Age" position="x" />
27
+ <ChartAxis position="y" label="Ticket" />
28
+ <ChartTooltip />
29
+ </ChartScatter>
30
+ ```
31
+
32
+ The tooltip shows the series name and each value, labelled with the axis titles.
33
+
34
+ ### Bubbles
35
+
36
+ A third value per point sets the bubble size. `bubble-size` maps the smallest and largest values (across all series) to a diameter range, scaled by area: a value twice as big covers twice the area.
37
+
38
+ ```vue
39
+ <ChartScatter :bubble-size="[8, 48]">
40
+ <ChartScatterSeries
41
+ name="Countries"
42
+ size-name="Population"
43
+ :data="[
44
+ [12000, 76, 210],
45
+ [45000, 82, 38],
46
+ ]"
47
+ />
48
+ </ChartScatter>
49
+ ```
50
+
51
+ `size-name` labels the third value in the tooltip and data table.
52
+
53
+ ### Several groups
54
+
55
+ ```vue
56
+ <ChartScatter :symbol-size="6">
57
+ <ChartScatterSeries name="Customers" :data="customers" />
58
+ <ChartScatterSeries name="Leads" :data="leads" />
59
+ <ChartLegend />
60
+ </ChartScatter>
61
+ ```
62
+
63
+ ## Keyboard
64
+
65
+ Arrow keys move through the points ordered by `x`, then `y`. Each point is announced with its series and values.
66
+
67
+ ## Props (`ChartScatter`)
68
+
69
+ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
70
+
71
+ | Prop | Type | Default | Description |
72
+ | ------------- | ------------------ | --------- | -------------------------------------------------- |
73
+ | `symbol-size` | `number` | `8` | Point diameter (px) for `[x, y]` points. |
74
+ | `bubble-size` | `[number, number]` | `[8, 40]` | Min / max bubble diameter (px) for `[x, y, size]`. |
75
+
76
+ ## Props (`ChartScatterSeries`)
77
+
78
+ | Prop | Type | Default | Description |
79
+ | ------------- | -------------------------------------------------- | -------- | ------------------------------------------ |
80
+ | `name` | `string` | required | Legend, tooltip, and table name. |
81
+ | `data` | `[number, number][] \| [number, number, number][]` | required | Points; the third value makes a bubble. |
82
+ | `color` | `ChartColorValue` | palette | Token key or CSS color. |
83
+ | `size-name` | `string` | `"Size"` | Label for the third value. |
84
+ | `symbol-size` | `number` | root | Point size override (ignored for bubbles). |
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "license": "MIT",
4
- "version": "0.17.2",
4
+ "version": "0.18.0",
5
5
  "author": "BridgeUI",
6
6
  "sideEffects": false,
7
7
  "name": "@bridge-ui/vue",
@@ -109,7 +109,7 @@
109
109
  }
110
110
  },
111
111
  "dependencies": {
112
- "@bridge-ui/core": "^0.17.2",
112
+ "@bridge-ui/core": "^0.18.0",
113
113
  "@tailwindcss/typography": "^0.5.20",
114
114
  "clsx": "^2.1.1",
115
115
  "es-toolkit": "^1.52.0",
@@ -1,5 +0,0 @@
1
- import e from "./Chart.vue_vue_type_script_setup_true_lang.js";
2
- //#region src/Components/Chart/Chart.vue
3
- var t = e;
4
- //#endregion
5
- export { t as default };
@@ -1,52 +0,0 @@
1
- import { useChart as e } from "./composables/useChart.js";
2
- import t from "../../Utils/LoadingSpin.js";
3
- import { Fragment as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, guardReactiveProps as l, mergeProps as u, normalizeProps as d, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, useTemplateRef as _ } from "vue";
4
- //#region src/Components/Chart/Chart.vue?vue&type=script&setup=true&lang.ts
5
- var v = { scope: "col" }, y = { scope: "row" }, b = /*@__PURE__*/ c({
6
- inheritAttrs: !1,
7
- __name: "Chart",
8
- props: {
9
- animation: {
10
- type: Boolean,
11
- default: void 0
12
- },
13
- categories: {},
14
- classes: {},
15
- customProps: {},
16
- height: {},
17
- loading: {
18
- type: Boolean,
19
- default: !1
20
- },
21
- palette: {},
22
- size: {},
23
- summary: {},
24
- width: {}
25
- },
26
- setup(c) {
27
- let b = c, x = _("root"), S = _("plot"), C = _("host"), { table: w, isEmpty: T, hostBind: E, plotBind: D, rootBind: O, liveBind: k, emptyBind: A, isLoading: j, tableBind: M, loadingBind: N, announcement: P, emptyMessage: F } = e(b, {
28
- size: "md",
29
- height: 280,
30
- animation: !0
31
- }, {
32
- hostRef: C,
33
- plotRef: S,
34
- rootRef: x
35
- });
36
- return (e, c) => (f(), i("div", u({ ref: "root" }, g(O)), [
37
- a("div", u({ ref: "plot" }, g(D)), [
38
- a("div", u({ ref: "host" }, g(E)), null, 16),
39
- g(j) ? (f(), i("div", d(u({ key: 0 }, g(N))), [m(e.$slots, "loading", {}, () => [s(t)])], 16)) : r("", !0),
40
- g(T) ? (f(), i("div", d(u({ key: 1 }, g(A))), [m(e.$slots, "empty", {}, () => [o(h(g(F)), 1)])], 16)) : r("", !0)
41
- ], 16),
42
- m(e.$slots, "default"),
43
- a("table", d(l(g(M))), [a("thead", null, [a("tr", null, [a("th", v, h(g(w).categoryLabel), 1), (f(!0), i(n, null, p(g(w).series, (e) => (f(), i("th", {
44
- scope: "col",
45
- key: e.id
46
- }, h(e.name), 1))), 128))])]), a("tbody", null, [(f(!0), i(n, null, p(g(w).rows, (e) => (f(), i("tr", { key: e.category }, [a("th", y, h(e.category), 1), (f(!0), i(n, null, p(e.values, (e, t) => (f(), i("td", { key: g(w).series[t]?.id ?? t }, h(e), 1))), 128))]))), 128))])], 16),
47
- a("div", d(l(g(k))), h(g(P)), 17)
48
- ], 16));
49
- }
50
- });
51
- //#endregion
52
- export { b as default };
@@ -1,94 +0,0 @@
1
- import { ComputedRef, InjectionKey } from 'vue';
2
- import { ChartAnchor, ChartAxisPosition, ChartRenderAxis, ChartSeriesEntry, ChartTooltipItem } from '@bridge-ui/core/Domain';
3
- /**
4
- * Registered series with its resolved color and legend visibility.
5
- */
6
- export type ChartResolvedSeries = ChartSeriesEntry & {
7
- /**
8
- * Whether the series is hidden from the legend toggle.
9
- */
10
- hidden: boolean;
11
- /**
12
- * Computed CSS color (empty until the first layout pass).
13
- */
14
- resolvedColor: string;
15
- };
16
- /**
17
- * Shared chart state for `ChartSeries` / `ChartAxis` / `ChartLegend` /
18
- * `ChartTooltip` descendants.
19
- */
20
- export type ChartContextValue = {
21
- /**
22
- * Active category index (pointer or keyboard). `null` when idle.
23
- */
24
- activeIndex: null | number;
25
- /**
26
- * Category labels.
27
- */
28
- categories: string[];
29
- /**
30
- * Root size (px) used to keep the tooltip inside the chart.
31
- */
32
- getBounds: () => {
33
- height: number;
34
- width: number;
35
- };
36
- /**
37
- * Tooltip anchor for a category, relative to the chart root.
38
- */
39
- getTooltipAnchor: (index: number) => null | ChartAnchor;
40
- /**
41
- * Emphasizes one series in the plot. `null` clears it.
42
- */
43
- highlightSeries: (id: null | string) => void;
44
- /**
45
- * Stable id prefix for chart parts.
46
- */
47
- id: string;
48
- /**
49
- * Locale used to format values.
50
- */
51
- locale: string;
52
- /**
53
- * Removes axis options registered by `ChartAxis`.
54
- */
55
- removeAxis: (position: ChartAxisPosition) => void;
56
- /**
57
- * Removes a series by id.
58
- */
59
- removeSeries: (id: string) => void;
60
- /**
61
- * Registered series in mount order, with colors and visibility.
62
- */
63
- series: ChartResolvedSeries[];
64
- /**
65
- * Sets axis options (no-op when unchanged).
66
- */
67
- setAxis: (position: ChartAxisPosition, options: Partial<ChartRenderAxis>) => void;
68
- /**
69
- * Shows / hides a series by id.
70
- */
71
- toggleSeries: (id: string) => void;
72
- /**
73
- * Merged size token classes for legend and tooltip.
74
- */
75
- tokenClasses: {
76
- legend?: string;
77
- legendItem?: string;
78
- swatch?: string;
79
- tooltip?: string;
80
- };
81
- /**
82
- * Tooltip rows for `activeIndex` (visible series, non-null values).
83
- */
84
- tooltipItems: ChartTooltipItem[];
85
- /**
86
- * Adds or replaces a series by `id`, keeping its position (no-op when unchanged).
87
- */
88
- upsertSeries: (entry: ChartSeriesEntry) => void;
89
- };
90
- export declare const CHART_INJECTION_KEY: InjectionKey<ComputedRef<ChartContextValue>>;
91
- /**
92
- * Injects the nearest `Chart` context. Throws when used outside `Chart`.
93
- */
94
- export declare function useChartContext(): ComputedRef<ChartContextValue>;
@@ -1,40 +0,0 @@
1
- import { HTMLAttributes, Ref } from 'vue';
2
- import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
3
- import { ChartOwnProps } from '../chart.types';
4
- import { ChartContextValue } from '../chartInjectionKey';
5
- type ChartRegistryProps = Pick<ChartOwnProps, "size" | "height" | "classes" | "palette" | "animation" | "customProps">;
6
- type ChartLibDefaults = LibDefaultsShape<ChartOwnProps, "size" | "height" | "animation">;
7
- type ChartMerged = MergeLibDefaults<ChartRegistryProps, ChartLibDefaults>;
8
- type ChartElementRef = Readonly<Ref<null | HTMLDivElement>>;
9
- export declare function useChart(props: ChartOwnProps, libDefaults: ChartLibDefaults, elements: {
10
- hostRef: ChartElementRef;
11
- plotRef: ChartElementRef;
12
- rootRef: ChartElementRef;
13
- }): {
14
- table: import('vue').ComputedRef<{
15
- categoryLabel: string;
16
- series: {
17
- id: string;
18
- name: string;
19
- }[];
20
- rows: {
21
- category: string;
22
- values: string[];
23
- }[];
24
- }>;
25
- merged: import('vue').ComputedRef<ChartMerged>;
26
- isEmpty: import('vue').ComputedRef<boolean>;
27
- summary: import('vue').ComputedRef<string>;
28
- hostBind: import('vue').ComputedRef<HTMLAttributes>;
29
- plotBind: import('vue').ComputedRef<HTMLAttributes>;
30
- rootBind: import('vue').ComputedRef<HTMLAttributes>;
31
- liveBind: import('vue').ComputedRef<HTMLAttributes>;
32
- emptyBind: import('vue').ComputedRef<HTMLAttributes>;
33
- isLoading: import('vue').ComputedRef<boolean>;
34
- tableBind: import('vue').ComputedRef<HTMLAttributes>;
35
- loadingBind: import('vue').ComputedRef<HTMLAttributes>;
36
- announcement: import('vue').ComputedRef<string>;
37
- contextValue: import('vue').ComputedRef<ChartContextValue>;
38
- emptyMessage: import('vue').ComputedRef<string>;
39
- };
40
- export {};