@bridge-ui/vue 0.15.0 → 0.17.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.
- package/ai/AGENTS.md +1 -1
- package/ai/README.md +1 -1
- package/ai/llms.txt +0 -1
- package/ai/skills/bridge-ui-components/SKILL.md +3 -1
- package/ai/skills/bridge-ui-setup/SKILL.md +8 -8
- package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +42 -44
- package/dist/Actions/actionHostRegistry.d.ts +2 -1
- package/dist/Actions/actionHostRegistry.js +11 -7
- package/dist/Adapters/index.d.ts +0 -1
- package/dist/Adapters/index.js +1 -2
- package/dist/Components/Accordion/composables/useAccordion.js +1 -1
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +248 -258
- package/dist/Components/Chart/Chart.js +5 -0
- package/dist/Components/Chart/Chart.vue.d.ts +14 -0
- package/dist/Components/Chart/Chart.vue_vue_type_script_setup_true_lang.js +52 -0
- package/dist/Components/Chart/chart.types.d.ts +126 -0
- package/dist/Components/Chart/chartInjectionKey.d.ts +94 -0
- package/dist/Components/Chart/chartInjectionKey.js +10 -0
- package/dist/Components/Chart/composables/useChart.d.ts +40 -0
- package/dist/Components/Chart/composables/useChart.js +344 -0
- package/dist/Components/Chart/echartsChart.d.ts +14 -0
- package/dist/Components/Chart/echartsChart.js +199 -0
- package/dist/Components/Chart/index.d.ts +4 -0
- package/dist/Components/Chart/index.js +4 -0
- package/dist/Components/ChartAxis/ChartAxis.js +5 -0
- package/dist/Components/ChartAxis/ChartAxis.vue.d.ts +7 -0
- package/dist/Components/ChartAxis/ChartAxis.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/ChartAxis/chartAxis.types.d.ts +56 -0
- package/dist/Components/ChartAxis/composables/useChartAxis.d.ts +5 -0
- package/dist/Components/ChartAxis/composables/useChartAxis.js +28 -0
- package/dist/Components/ChartAxis/index.d.ts +3 -0
- package/dist/Components/ChartAxis/index.js +3 -0
- package/dist/Components/ChartLegend/ChartLegend.js +5 -0
- package/dist/Components/ChartLegend/ChartLegend.vue.d.ts +6 -0
- package/dist/Components/ChartLegend/ChartLegend.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Components/ChartLegend/chartLegend.types.d.ts +71 -0
- package/dist/Components/ChartLegend/composables/useChartLegend.d.ts +16 -0
- package/dist/Components/ChartLegend/composables/useChartLegend.js +98 -0
- package/dist/Components/ChartLegend/index.d.ts +3 -0
- package/dist/Components/ChartLegend/index.js +3 -0
- package/dist/Components/ChartSeries/ChartSeries.js +5 -0
- package/dist/Components/ChartSeries/ChartSeries.vue.d.ts +4 -0
- package/dist/Components/ChartSeries/ChartSeries.vue_vue_type_script_setup_true_lang.js +24 -0
- package/dist/Components/ChartSeries/chartSeries.types.d.ts +37 -0
- package/dist/Components/ChartSeries/composables/useChartSeries.d.ts +10 -0
- package/dist/Components/ChartSeries/composables/useChartSeries.js +29 -0
- package/dist/Components/ChartSeries/index.d.ts +3 -0
- package/dist/Components/ChartSeries/index.js +3 -0
- package/dist/Components/ChartTooltip/ChartTooltip.js +5 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue.d.ts +11 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +82 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +15 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +110 -0
- package/dist/Components/ChartTooltip/index.d.ts +3 -0
- package/dist/Components/ChartTooltip/index.js +3 -0
- package/dist/Components/DataTable/DataTable.vue.d.ts +5 -3
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +138 -117
- package/dist/Components/DataTable/DataTableCellContent.vue.d.ts +1 -5
- package/dist/Components/DataTable/DataTableCellContent.vue_vue_type_script_setup_true_lang.js +24 -25
- package/dist/Components/DataTable/composables/useDataTable.d.ts +5 -3
- package/dist/Components/DataTable/composables/useDataTable.js +294 -272
- package/dist/Components/DataTable/composables/useDataTablePagination.js +1 -1
- package/dist/Components/DataTable/dataTable.types.d.ts +35 -2
- package/dist/Components/Drawer/composables/useDrawer.js +68 -67
- package/dist/Components/Modal/composables/useModal.js +129 -119
- package/dist/Components/Pagination/Pagination.vue.d.ts +6 -0
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +23 -11
- package/dist/Components/Pagination/composables/usePagination.d.ts +3 -3
- package/dist/Components/Pagination/composables/usePagination.js +95 -84
- package/dist/Components/Pagination/pagination.types.d.ts +30 -2
- package/dist/Components/Resizable/Resizable.js +5 -0
- package/dist/Components/Resizable/Resizable.vue.d.ts +17 -0
- package/dist/Components/Resizable/Resizable.vue_vue_type_script_setup_true_lang.js +30 -0
- package/dist/Components/Resizable/composables/useResizable.d.ts +18 -0
- package/dist/Components/Resizable/composables/useResizable.js +195 -0
- package/dist/Components/Resizable/index.d.ts +4 -0
- package/dist/Components/Resizable/index.js +4 -0
- package/dist/Components/Resizable/resizable.types.d.ts +53 -0
- package/dist/Components/Resizable/resizableInjectionKey.d.ts +111 -0
- package/dist/Components/Resizable/resizableInjectionKey.js +4 -0
- package/dist/Components/ResizableHandle/ResizableHandle.js +5 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue.d.ts +14 -0
- package/dist/Components/ResizableHandle/ResizableHandle.vue_vue_type_script_setup_true_lang.js +31 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.d.ts +35 -0
- package/dist/Components/ResizableHandle/composables/useResizableHandle.js +85 -0
- package/dist/Components/ResizableHandle/index.d.ts +3 -0
- package/dist/Components/ResizableHandle/index.js +3 -0
- package/dist/Components/ResizableHandle/resizableHandle.types.d.ts +58 -0
- package/dist/Components/ResizablePanel/ResizablePanel.js +5 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue.d.ts +24 -0
- package/dist/Components/ResizablePanel/ResizablePanel.vue_vue_type_script_setup_true_lang.js +39 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +21 -0
- package/dist/Components/ResizablePanel/composables/useResizablePanel.js +87 -0
- package/dist/Components/ResizablePanel/index.d.ts +3 -0
- package/dist/Components/ResizablePanel/index.js +3 -0
- package/dist/Components/ResizablePanel/resizablePanel.types.d.ts +71 -0
- package/dist/Components/RichTextEditor/RichTextEditor.vue.d.ts +1 -1
- package/dist/Components/RichTextEditor/RichTextEditor.vue_vue_type_script_setup_true_lang.js +17 -17
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.d.ts +2 -2
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +67 -73
- package/dist/Components/RichTextEditor/richTextEditor.types.d.ts +1 -1
- package/dist/Components/RichTextEditor/tiptapEditor.d.ts +111 -0
- package/dist/Components/RichTextEditor/tiptapEditor.js +121 -0
- package/dist/Components/Select/composables/useSelect.js +147 -157
- package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +6 -7
- package/dist/Components/Snackbar/composables/useSnackbar.js +140 -146
- package/dist/Components/Stepper/composables/useStepper.js +1 -1
- package/dist/Components/Table/composables/useTableCell.d.ts +1 -1
- package/dist/Components/Tabs/composables/useTabs.js +1 -1
- package/dist/Components/ToggleGroup/composables/useToggleGroup.js +3 -3
- package/dist/augments.d.ts +34 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +187 -183
- package/dist/theme.css +1 -1
- package/docs/README.md +4 -3
- package/docs/components/BridgeUIProvider.md +0 -17
- package/docs/components/Chart.md +252 -0
- package/docs/components/DataTable.md +19 -0
- package/docs/components/Pagination.md +17 -5
- package/docs/components/Resizable.md +224 -0
- package/docs/components/RichTextEditor.md +2 -23
- package/package.json +27 -6
- package/dist/Adapters/RichText/index.d.ts +0 -1
- package/dist/Adapters/RichText/index.js +0 -2
- package/dist/Adapters/RichText/mockRichTextAdapter.d.ts +0 -5
- package/dist/Adapters/RichText/useRichTextAdapter.d.ts +0 -12
- package/dist/Adapters/RichText/useRichTextAdapter.js +0 -13
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# Chart
|
|
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.
|
|
4
|
+
|
|
5
|
+
Compose `Chart` with `ChartSeries`, `ChartAxis`, `ChartLegend`, and `ChartTooltip`.
|
|
6
|
+
|
|
7
|
+
## Import
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Chart } from "@bridge-ui/vue/Components/Chart";
|
|
11
|
+
import { ChartAxis } from "@bridge-ui/vue/Components/ChartAxis";
|
|
12
|
+
import { ChartLegend } from "@bridge-ui/vue/Components/ChartLegend";
|
|
13
|
+
import { ChartSeries } from "@bridge-ui/vue/Components/ChartSeries";
|
|
14
|
+
import { ChartTooltip } from "@bridge-ui/vue/Components/ChartTooltip";
|
|
15
|
+
```
|
|
16
|
+
|
|
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`.
|
|
18
|
+
|
|
19
|
+
## Examples
|
|
20
|
+
|
|
21
|
+
### Usage
|
|
22
|
+
|
|
23
|
+
```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>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Bar
|
|
38
|
+
|
|
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
|
+
```
|
|
47
|
+
|
|
48
|
+
### Area
|
|
49
|
+
|
|
50
|
+
```vue
|
|
51
|
+
<Chart :categories="months">
|
|
52
|
+
<ChartSeries type="area" curve="smooth" name="Visitors" :data="visitors" />
|
|
53
|
+
<ChartTooltip />
|
|
54
|
+
</Chart>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Mixed series
|
|
58
|
+
|
|
59
|
+
Bars and lines share the value axis.
|
|
60
|
+
|
|
61
|
+
```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>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Gaps
|
|
71
|
+
|
|
72
|
+
`null` values leave a gap in lines and areas and are skipped in the tooltip.
|
|
73
|
+
|
|
74
|
+
```vue
|
|
75
|
+
<ChartSeries name="Costs" :data="[80, 90, null, 140, 150, 170]" />
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Axes
|
|
79
|
+
|
|
80
|
+
```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>
|
|
86
|
+
```
|
|
87
|
+
|
|
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.
|
|
89
|
+
|
|
90
|
+
### Colors
|
|
91
|
+
|
|
92
|
+
Series take palette colors in order. Override the palette on `Chart`, or pass a token key or any CSS color to `ChartSeries`.
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<Chart :categories="months" :palette="['info', 'warning']">
|
|
96
|
+
<ChartSeries name="Plan" :data="plan" />
|
|
97
|
+
<ChartSeries name="Actual" :data="actual" color="#8b5cf6" />
|
|
98
|
+
</Chart>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Token keys (`primary`, `info`, `success`, `warning`, `error`, `secondary`, `dark`, `black`) follow light and dark mode automatically.
|
|
102
|
+
|
|
103
|
+
### Legend
|
|
104
|
+
|
|
105
|
+
Legend entries are toggle buttons: click to hide or show a series, hover or focus to emphasize it.
|
|
106
|
+
|
|
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
|
+
```
|
|
125
|
+
|
|
126
|
+
### Loading and empty
|
|
127
|
+
|
|
128
|
+
```vue
|
|
129
|
+
<Chart :loading="isLoading" :categories="months">
|
|
130
|
+
<ChartSeries name="Revenue" :data="revenue" />
|
|
131
|
+
</Chart>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
```vue
|
|
135
|
+
<Chart :categories="months">
|
|
136
|
+
<template #empty>No sales in this period</template>
|
|
137
|
+
</Chart>
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Summary
|
|
141
|
+
|
|
142
|
+
`Chart` generates a text summary (series names and category range) for screen readers. Pass `summary` to describe the takeaway instead.
|
|
143
|
+
|
|
144
|
+
```vue
|
|
145
|
+
<Chart :categories="months" summary="Revenue doubled from January to June.">
|
|
146
|
+
<ChartSeries name="Revenue" :data="revenue" />
|
|
147
|
+
</Chart>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Registry defaults
|
|
151
|
+
|
|
152
|
+
```vue
|
|
153
|
+
<BridgeUIProvider
|
|
154
|
+
:components="{
|
|
155
|
+
ChartSeries: { defaultProps: { curve: 'smooth' } },
|
|
156
|
+
ChartLegend: { defaultProps: { position: 'top' } },
|
|
157
|
+
Chart: { defaultProps: { height: 320, palette: ['primary', 'success'] } },
|
|
158
|
+
}"
|
|
159
|
+
>
|
|
160
|
+
<App />
|
|
161
|
+
</BridgeUIProvider>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Theme tokens (`Chart.tokens.theme`) set the grid, axis, and label colors as Tailwind text-color classes:
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<BridgeUIProvider
|
|
168
|
+
:components="{
|
|
169
|
+
Chart: { tokens: { theme: { grid: 'text-dark-100 dark:text-dark-800' } } },
|
|
170
|
+
}"
|
|
171
|
+
>
|
|
172
|
+
<App />
|
|
173
|
+
</BridgeUIProvider>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Accessibility
|
|
177
|
+
|
|
178
|
+
- The root is a `figure`; the plot is a focusable `img` labelled by `summary` (or the generated summary).
|
|
179
|
+
- 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.
|
|
180
|
+
- A data table with every value is always rendered, visually hidden.
|
|
181
|
+
- The tooltip is decorative (`aria-hidden`); the same information is in the table and announcements.
|
|
182
|
+
- Engine animation is off under `prefers-reduced-motion`.
|
|
183
|
+
|
|
184
|
+
## Props (`Chart`)
|
|
185
|
+
|
|
186
|
+
| Prop | Type | Default | Description |
|
|
187
|
+
| ------------- | -------------------- | ------------------------ | --------------------------------------------------- |
|
|
188
|
+
| `animation` | `boolean` | `true` | Engine transitions (always off for reduced motion). |
|
|
189
|
+
| `categories` | `string[]` | required | Category labels; one value per category per series. |
|
|
190
|
+
| `classes` | `ChartClasses` | — | `root`, `plot`, `loading`, `empty`, `table`. |
|
|
191
|
+
| `height` | `number \| string` | `280` | Plot height. |
|
|
192
|
+
| `loading` | `boolean` | `false` | Shows the loading overlay. |
|
|
193
|
+
| `palette` | `ChartSeriesColor[]` | primary, info, success … | Series colors in order. |
|
|
194
|
+
| `size` | `ChartSize` | `"md"` | Density of labels, legend, and tooltip. |
|
|
195
|
+
| `summary` | `string` | generated | Accessible description of the plot. |
|
|
196
|
+
| `width` | `number \| string` | `"100%"` | Root width. |
|
|
197
|
+
| `customProps` | `ChartCustomProps` | — | Extra props for `root` and `plot`. |
|
|
198
|
+
|
|
199
|
+
### Slots (`Chart`)
|
|
200
|
+
|
|
201
|
+
| Slot | Description |
|
|
202
|
+
| --------- | ---------------------------------------------------------- |
|
|
203
|
+
| `default` | `ChartSeries`, `ChartAxis`, `ChartLegend`, `ChartTooltip`. |
|
|
204
|
+
| `empty` | Content shown when there is nothing to plot. |
|
|
205
|
+
| `loading` | Content shown while `loading` is true. |
|
|
206
|
+
|
|
207
|
+
## Props (`ChartSeries`)
|
|
208
|
+
|
|
209
|
+
| Prop | Type | Default | Description |
|
|
210
|
+
| ------- | --------------------------- | ---------- | ---------------------------------------- |
|
|
211
|
+
| `color` | `ChartSeriesColor` | palette | Token key or CSS color. |
|
|
212
|
+
| `curve` | `"linear" \| "smooth"` | `"linear"` | Line interpolation for `line` / `area`. |
|
|
213
|
+
| `data` | `(number \| null)[]` | required | One value per category; `null` is a gap. |
|
|
214
|
+
| `name` | `string` | required | Legend, tooltip, and table label. |
|
|
215
|
+
| `type` | `"line" \| "bar" \| "area"` | `"line"` | Series family. |
|
|
216
|
+
|
|
217
|
+
## Props (`ChartAxis`)
|
|
218
|
+
|
|
219
|
+
| Prop | Type | Default | Description |
|
|
220
|
+
| ------------ | ------------------------------------- | ----------------------------- | --------------------------------- |
|
|
221
|
+
| `formatTick` | `(value: number \| string) => string` | — | Tick label formatter. |
|
|
222
|
+
| `grid` | `boolean` | `true` on `y`, `false` on `x` | Grid lines. |
|
|
223
|
+
| `hidden` | `boolean` | `false` | Hides the axis line and labels. |
|
|
224
|
+
| `label` | `string` | — | Axis title. |
|
|
225
|
+
| `max` | `number` | auto | Value axis upper bound. |
|
|
226
|
+
| `min` | `number` | auto | Value axis lower bound. |
|
|
227
|
+
| `position` | `"x" \| "y"` | required | Categories (`x`) or values (`y`). |
|
|
228
|
+
| `tickCount` | `number` | auto | Preferred number of ticks. |
|
|
229
|
+
|
|
230
|
+
## Props (`ChartLegend`)
|
|
231
|
+
|
|
232
|
+
| Prop | Type | Default | Description |
|
|
233
|
+
| ------------- | ------------------------------ | ---------- | ------------------------------------------ |
|
|
234
|
+
| `align` | `"start" \| "center" \| "end"` | `"center"` | Horizontal alignment. |
|
|
235
|
+
| `classes` | `ChartLegendClasses` | — | `root`, `item`, `swatch`, `label`. |
|
|
236
|
+
| `interactive` | `boolean` | `true` | Entries toggle and emphasize their series. |
|
|
237
|
+
| `position` | `"top" \| "bottom"` | `"bottom"` | Above or below the plot. |
|
|
238
|
+
| `customProps` | `ChartLegendCustomProps` | — | Extra props for `root` and `item`. |
|
|
239
|
+
|
|
240
|
+
## Props (`ChartTooltip`)
|
|
241
|
+
|
|
242
|
+
| Prop | Type | Default | Description |
|
|
243
|
+
| ------------- | --------------------------------- | -------------------- | ---------------------------------------------------- |
|
|
244
|
+
| `classes` | `ChartTooltipClasses` | — | `root`, `title`, `item`, `swatch`, `label`, `value`. |
|
|
245
|
+
| `formatValue` | `(value: number, item) => string` | locale number format | Value formatter. |
|
|
246
|
+
| `customProps` | `ChartTooltipCustomProps` | — | Extra props for `root`. |
|
|
247
|
+
|
|
248
|
+
### Slots (`ChartTooltip`)
|
|
249
|
+
|
|
250
|
+
| Slot | Props | Description |
|
|
251
|
+
| --------- | ---------------------------- | ---------------------------- |
|
|
252
|
+
| `content` | `{ category, index, items }` | Replaces the title and rows. |
|
|
@@ -133,6 +133,25 @@ When `page` and `page-count` (or `total-count`) are set, DataTable does not sort
|
|
|
133
133
|
/>
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
+
### Cursor pagination
|
|
137
|
+
|
|
138
|
+
For APIs that return `next_cursor` / `prev_cursor` instead of a page total, bind `v-model:cursor` (or pass `next-cursor` / `prev-cursor`). DataTable then does not sort, filter, or slice `rows` locally, and the footer shows a previous / next `Pagination` instead of the "Page X of Y" label. The per-page Select stays. A `null` cursor disables its control:
|
|
139
|
+
|
|
140
|
+
```vue
|
|
141
|
+
<DataTable
|
|
142
|
+
:rows="audits"
|
|
143
|
+
:columns="columns"
|
|
144
|
+
v-model:cursor="cursor"
|
|
145
|
+
v-model:sorting="sorting"
|
|
146
|
+
v-model:filters="filters"
|
|
147
|
+
v-model:per-page="perPage"
|
|
148
|
+
:next-cursor="pagination.next_cursor"
|
|
149
|
+
:prev-cursor="pagination.prev_cursor"
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
DataTable never resets the cursor. Set it back to `null` in the app when sorting, filters, or per-page change. `#pagination` also receives `cursor`, `nextCursor`, `prevCursor`, `hasNext`, `hasPrevious`, `onNext`, and `onPrevious`. `customProps.cursorPagination` forwards extra props to the built-in cursor pager. Do not combine cursor props with `page` + `page-count` / `total-count`: cursor paging wins and a warning is logged in development.
|
|
154
|
+
|
|
136
155
|
### Empty, loading, and footer
|
|
137
156
|
|
|
138
157
|
Empty rows render `EmptyState` at the table `size`, with the semantic `inbox` icon and the i18n title `"No data"`. `#empty` replaces it. `loading` keeps the table visible. `loadingVariant="overlay"` (default) dims the table with a spin; `loadingVariant="bar"` dims the table and draws a progress line under the header. `#loading` replaces the indicator. `#footer` renders below the table, above the chrome footer:
|
|
@@ -51,15 +51,27 @@ Applies to `ghost` and `text` item corners and the `outlined` group / edge contr
|
|
|
51
51
|
|
|
52
52
|
### Simple (cursor / prev–next only)
|
|
53
53
|
|
|
54
|
-
For APIs that
|
|
54
|
+
For APIs that return `next_cursor` / `prev_cursor` instead of a page total. `v-model:cursor` is set to `next-cursor` or `prev-cursor` when the user navigates, and a `null` cursor disables its control:
|
|
55
55
|
|
|
56
56
|
```vue
|
|
57
57
|
<Pagination
|
|
58
58
|
mode="simple"
|
|
59
|
+
v-model:cursor="cursor"
|
|
59
60
|
aria-label="Pagination"
|
|
60
|
-
:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
:next-cursor="pagination.next_cursor"
|
|
62
|
+
:prev-cursor="pagination.prev_cursor"
|
|
63
|
+
/>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`has-next` / `has-previous` override the cursor defaults. `next` / `previous` still fire (after `update:cursor`), so prev/next without cursors keeps working:
|
|
67
|
+
|
|
68
|
+
```vue
|
|
69
|
+
<Pagination
|
|
70
|
+
mode="simple"
|
|
71
|
+
:has-next="hasMore"
|
|
72
|
+
v-on:next="loadNext"
|
|
73
|
+
aria-label="Pagination"
|
|
74
|
+
:has-previous="page > 1"
|
|
75
|
+
v-on:previous="loadPrevious"
|
|
64
76
|
/>
|
|
65
77
|
```
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
# Resizable
|
|
2
|
+
|
|
3
|
+
Panels the user can resize by dragging the handle between them or with the keyboard. `Resizable` is the group, `ResizablePanel` is each panel, and `ResizableHandle` sits between two panels.
|
|
4
|
+
|
|
5
|
+
Sizes are percentages of the group. Panels without `default-size` share the space left. Panel order follows the DOM, so panels and handles can be wrapped or rendered with `v-if`.
|
|
6
|
+
|
|
7
|
+
The group fills its parent (`h-full w-full`). Give the parent, or the group through `class`, a height when the panels stack or when the page does not set one.
|
|
8
|
+
|
|
9
|
+
## Import
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Resizable } from "@bridge-ui/vue/Components/Resizable";
|
|
13
|
+
import { ResizableHandle } from "@bridge-ui/vue/Components/ResizableHandle";
|
|
14
|
+
import { ResizablePanel } from "@bridge-ui/vue/Components/ResizablePanel";
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Examples
|
|
18
|
+
|
|
19
|
+
### Usage
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<Resizable class="h-64 rounded-lg border">
|
|
23
|
+
<ResizablePanel :default-size="25">Sidebar</ResizablePanel>
|
|
24
|
+
<ResizableHandle />
|
|
25
|
+
<ResizablePanel>Content</ResizablePanel>
|
|
26
|
+
</Resizable>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Vertical
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<Resizable class="h-96" orientation="vertical">
|
|
33
|
+
<ResizablePanel>Editor</ResizablePanel>
|
|
34
|
+
<ResizableHandle />
|
|
35
|
+
<ResizablePanel :default-size="30">Console</ResizablePanel>
|
|
36
|
+
</Resizable>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Without a grip
|
|
40
|
+
|
|
41
|
+
Each handle shows a grip by default. `hide-grip` leaves only the line.
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<Resizable class="h-64">
|
|
45
|
+
<ResizablePanel>One</ResizablePanel>
|
|
46
|
+
<ResizableHandle hide-grip />
|
|
47
|
+
<ResizablePanel>Two</ResizablePanel>
|
|
48
|
+
</Resizable>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Size limits
|
|
52
|
+
|
|
53
|
+
`min-size` and `max-size` bound a panel while dragging and with the keyboard. Once the panel shrinking next to the handle reaches its `min-size`, the drag goes on to shrink the panels beyond it.
|
|
54
|
+
|
|
55
|
+
```vue
|
|
56
|
+
<Resizable class="h-64">
|
|
57
|
+
<ResizablePanel :min-size="15" :max-size="40" :default-size="25">
|
|
58
|
+
Sidebar
|
|
59
|
+
</ResizablePanel>
|
|
60
|
+
<ResizableHandle />
|
|
61
|
+
<ResizablePanel :min-size="30">Content</ResizablePanel>
|
|
62
|
+
</Resizable>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Nested groups
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<Resizable class="h-96">
|
|
69
|
+
<ResizablePanel :default-size="25">Files</ResizablePanel>
|
|
70
|
+
<ResizableHandle />
|
|
71
|
+
<ResizablePanel>
|
|
72
|
+
<Resizable orientation="vertical">
|
|
73
|
+
<ResizablePanel>Editor</ResizablePanel>
|
|
74
|
+
<ResizableHandle />
|
|
75
|
+
<ResizablePanel :default-size="30">Terminal</ResizablePanel>
|
|
76
|
+
</Resizable>
|
|
77
|
+
</ResizablePanel>
|
|
78
|
+
</Resizable>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Collapsible panel
|
|
82
|
+
|
|
83
|
+
A `collapsible` panel collapses to `collapsed-size` (default `0`) once it is dragged past half of `min-size`. `Enter` on the handle collapses it and expands it back to its last size. Bind `v-model:collapsed` to collapse or expand it from outside.
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<Button @click="collapsed = !collapsed">Toggle sidebar</Button>
|
|
87
|
+
|
|
88
|
+
<Resizable class="h-64">
|
|
89
|
+
<ResizablePanel
|
|
90
|
+
collapsible
|
|
91
|
+
:min-size="15"
|
|
92
|
+
:default-size="25"
|
|
93
|
+
v-model:collapsed="collapsed"
|
|
94
|
+
>
|
|
95
|
+
Sidebar
|
|
96
|
+
</ResizablePanel>
|
|
97
|
+
<ResizableHandle />
|
|
98
|
+
<ResizablePanel>Content</ResizablePanel>
|
|
99
|
+
</Resizable>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`collapsed-size` keeps a strip visible, for example for an icon rail:
|
|
103
|
+
|
|
104
|
+
```vue
|
|
105
|
+
<ResizablePanel collapsible :min-size="20" :collapsed-size="5">
|
|
106
|
+
Sidebar
|
|
107
|
+
</ResizablePanel>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Saving the layout
|
|
111
|
+
|
|
112
|
+
`@layout-change` receives every panel size, in order. Feed saved sizes back through `default-size`.
|
|
113
|
+
|
|
114
|
+
```vue
|
|
115
|
+
<script setup lang="ts">
|
|
116
|
+
const saved = JSON.parse(localStorage.getItem("layout") ?? "[30, 70]");
|
|
117
|
+
|
|
118
|
+
function save(layout: number[]) {
|
|
119
|
+
localStorage.setItem("layout", JSON.stringify(layout));
|
|
120
|
+
}
|
|
121
|
+
</script>
|
|
122
|
+
|
|
123
|
+
<template>
|
|
124
|
+
<Resizable class="h-64" @layout-change="save">
|
|
125
|
+
<ResizablePanel :default-size="saved[0]">Sidebar</ResizablePanel>
|
|
126
|
+
<ResizableHandle />
|
|
127
|
+
<ResizablePanel :default-size="saved[1]">Content</ResizablePanel>
|
|
128
|
+
</Resizable>
|
|
129
|
+
</template>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`ResizablePanel` also emits `resize` with its own size.
|
|
133
|
+
|
|
134
|
+
### Disabled
|
|
135
|
+
|
|
136
|
+
`disabled` on the group locks every handle. On a handle, it locks only that handle.
|
|
137
|
+
|
|
138
|
+
```vue
|
|
139
|
+
<Resizable disabled class="h-64">
|
|
140
|
+
<ResizablePanel>One</ResizablePanel>
|
|
141
|
+
<ResizableHandle />
|
|
142
|
+
<ResizablePanel>Two</ResizablePanel>
|
|
143
|
+
</Resizable>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Right to left
|
|
147
|
+
|
|
148
|
+
`dir="rtl"` flips the horizontal drag and arrow keys, so the panel on the right is the first one.
|
|
149
|
+
|
|
150
|
+
```vue
|
|
151
|
+
<Resizable dir="rtl" class="h-64">
|
|
152
|
+
<ResizablePanel :default-size="25">Sidebar</ResizablePanel>
|
|
153
|
+
<ResizableHandle />
|
|
154
|
+
<ResizablePanel>Content</ResizablePanel>
|
|
155
|
+
</Resizable>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Classes and grip slot
|
|
159
|
+
|
|
160
|
+
```vue
|
|
161
|
+
<ResizableHandle
|
|
162
|
+
:classes="{
|
|
163
|
+
root: 'bg-primary-200',
|
|
164
|
+
grip: 'flex h-5 w-3 items-center justify-center text-xs',
|
|
165
|
+
}"
|
|
166
|
+
>
|
|
167
|
+
<template #grip>⋮</template>
|
|
168
|
+
</ResizableHandle>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Keyboard
|
|
172
|
+
|
|
173
|
+
- Each handle is a focusable `separator`. Its value is the size of the panel before it
|
|
174
|
+
- Horizontal: `ArrowLeft` / `ArrowRight`. Vertical: `ArrowUp` / `ArrowDown`. `dir="rtl"` swaps the horizontal arrows
|
|
175
|
+
- Arrow keys move by `keyboard-step` (default `10`)
|
|
176
|
+
- `Home` shrinks the panel before the handle to its `min-size` (or collapses it when `collapsible`). `End` grows it to its `max-size`
|
|
177
|
+
- `Enter` collapses or expands a `collapsible` panel before the handle
|
|
178
|
+
|
|
179
|
+
## Props
|
|
180
|
+
|
|
181
|
+
### Resizable
|
|
182
|
+
|
|
183
|
+
| Prop | Type | Default | Description |
|
|
184
|
+
| -------------- | ---------------------------- | -------------- | -------------------------------------------- |
|
|
185
|
+
| `classes` | `ResizableClasses` | — | Classes for the group root. |
|
|
186
|
+
| `disabled` | `boolean` | `false` | Lock every handle in the group. |
|
|
187
|
+
| `keyboardStep` | `number` | `10` | Percent an arrow key moves a focused handle. |
|
|
188
|
+
| `orientation` | `"horizontal" \| "vertical"` | `"horizontal"` | Axis the panels are laid out on. |
|
|
189
|
+
|
|
190
|
+
| Event | Payload | Description |
|
|
191
|
+
| -------------- | ------------------ | ----------------------------------------------------- |
|
|
192
|
+
| `layoutChange` | `layout: number[]` | Every panel size (percent), in order, after a change. |
|
|
193
|
+
|
|
194
|
+
### ResizablePanel
|
|
195
|
+
|
|
196
|
+
| Prop | Type | Default | Description |
|
|
197
|
+
| --------------- | ----------------------- | ------- | --------------------------------------------------------------------- |
|
|
198
|
+
| `classes` | `ResizablePanelClasses` | — | Classes for the panel. |
|
|
199
|
+
| `collapsed` | `boolean` | — | Collapsed state, bound with `v-model:collapsed`. Needs `collapsible`. |
|
|
200
|
+
| `collapsedSize` | `number` | `0` | Size while collapsed, in percent. |
|
|
201
|
+
| `collapsible` | `boolean` | `false` | Let the panel collapse past half of `minSize`. |
|
|
202
|
+
| `defaultSize` | `number` | — | Initial size, in percent. Panels without one share the rest. |
|
|
203
|
+
| `maxSize` | `number` | `100` | Largest size, in percent. |
|
|
204
|
+
| `minSize` | `number` | `0` | Smallest size while expanded, in percent. |
|
|
205
|
+
|
|
206
|
+
| Event | Payload | Description |
|
|
207
|
+
| ------------------ | -------------------- | --------------------------------- |
|
|
208
|
+
| `resize` | `size: number` | The panel size changed (percent). |
|
|
209
|
+
| `update:collapsed` | `collapsed: boolean` | The panel collapsed or expanded. |
|
|
210
|
+
|
|
211
|
+
### ResizableHandle
|
|
212
|
+
|
|
213
|
+
| Prop | Type | Default | Description |
|
|
214
|
+
| ------------- | ---------------------------- | ------- | ------------------------------------- |
|
|
215
|
+
| `classes` | `ResizableHandleClasses` | — | Classes for `root` and `grip`. |
|
|
216
|
+
| `customProps` | `ResizableHandleCustomProps` | — | Extra props for the `grip`. |
|
|
217
|
+
| `disabled` | `boolean` | `false` | Lock this handle. |
|
|
218
|
+
| `hideGrip` | `boolean` | `false` | Hide the grip and show only the line. |
|
|
219
|
+
|
|
220
|
+
Slot `grip`: content inside the grip.
|
|
221
|
+
|
|
222
|
+
## Related components
|
|
223
|
+
|
|
224
|
+
Sidebar, Divider
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# RichTextEditor
|
|
2
2
|
|
|
3
|
-
Formatted text input with FormField chrome
|
|
3
|
+
Formatted text input with FormField chrome. Bridge owns the toolbar, tokens, and a11y. The document engine is TipTap.
|
|
4
4
|
|
|
5
5
|
Sanitize HTML before rendering it outside the editor — XSS prevention stays in the app.
|
|
6
6
|
|
|
@@ -10,28 +10,7 @@ Sanitize HTML before rendering it outside the editor — XSS prevention stays in
|
|
|
10
10
|
import { RichTextEditor } from "@bridge-ui/vue/Components/RichTextEditor";
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Provide `global.richText` on `BridgeUIProvider`. Ready adapter:
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { BridgeUIProvider } from "@bridge-ui/vue";
|
|
19
|
-
import { createTiptapRichTextAdapter } from "@bridge-ui/adapters/vue/rich-text-tiptap";
|
|
20
|
-
|
|
21
|
-
const richText = createTiptapRichTextAdapter();
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
```vue
|
|
25
|
-
<BridgeUIProvider :global="{ richText }">
|
|
26
|
-
<App />
|
|
27
|
-
</BridgeUIProvider>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
| Adapter | Peer(s) | Notes |
|
|
31
|
-
| ------------------------------------------ | ------------------------------------------------------------------------------------ | ---------------- |
|
|
32
|
-
| `@bridge-ui/adapters/vue/rich-text-tiptap` | `@tiptap/core`, `@tiptap/pm`, `@tiptap/starter-kit`, `@tiptap/extension-placeholder` | ProseMirror JSON |
|
|
33
|
-
|
|
34
|
-
Custom engines can implement `RichTextEditorAdapter` and pass them via `global.richText`.
|
|
13
|
+
Install `@tiptap/core`, `@tiptap/pm`, `@tiptap/starter-kit`, and `@tiptap/extension-placeholder` next to `@bridge-ui/vue` when you use `RichTextEditor`.
|
|
35
14
|
|
|
36
15
|
## Examples
|
|
37
16
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.17.0",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -54,10 +54,6 @@
|
|
|
54
54
|
"import": "./dist/Adapters/I18n/index.js",
|
|
55
55
|
"types": "./dist/Adapters/I18n/index.d.ts"
|
|
56
56
|
},
|
|
57
|
-
"./Adapters/RichText": {
|
|
58
|
-
"import": "./dist/Adapters/RichText/index.js",
|
|
59
|
-
"types": "./dist/Adapters/RichText/index.d.ts"
|
|
60
|
-
},
|
|
61
57
|
"./Actions": {
|
|
62
58
|
"import": "./dist/Actions/index.js",
|
|
63
59
|
"types": "./dist/Actions/index.d.ts"
|
|
@@ -85,15 +81,35 @@
|
|
|
85
81
|
],
|
|
86
82
|
"peerDependencies": {
|
|
87
83
|
"@tanstack/vue-table": "^9.2.0",
|
|
84
|
+
"@tiptap/core": "^3.0.0",
|
|
85
|
+
"@tiptap/extension-placeholder": "^3.0.0",
|
|
86
|
+
"@tiptap/pm": "^3.0.0",
|
|
87
|
+
"@tiptap/starter-kit": "^3.0.0",
|
|
88
|
+
"echarts": "^6.0.0",
|
|
88
89
|
"vue": "^3.4.0"
|
|
89
90
|
},
|
|
90
91
|
"peerDependenciesMeta": {
|
|
91
92
|
"@tanstack/vue-table": {
|
|
92
93
|
"optional": true
|
|
94
|
+
},
|
|
95
|
+
"@tiptap/core": {
|
|
96
|
+
"optional": true
|
|
97
|
+
},
|
|
98
|
+
"@tiptap/extension-placeholder": {
|
|
99
|
+
"optional": true
|
|
100
|
+
},
|
|
101
|
+
"@tiptap/pm": {
|
|
102
|
+
"optional": true
|
|
103
|
+
},
|
|
104
|
+
"@tiptap/starter-kit": {
|
|
105
|
+
"optional": true
|
|
106
|
+
},
|
|
107
|
+
"echarts": {
|
|
108
|
+
"optional": true
|
|
93
109
|
}
|
|
94
110
|
},
|
|
95
111
|
"dependencies": {
|
|
96
|
-
"@bridge-ui/core": "^0.
|
|
112
|
+
"@bridge-ui/core": "^0.17.0",
|
|
97
113
|
"@tailwindcss/typography": "^0.5.20",
|
|
98
114
|
"clsx": "^2.1.1",
|
|
99
115
|
"es-toolkit": "^1.52.0",
|
|
@@ -114,9 +130,14 @@
|
|
|
114
130
|
"@tailwindcss/cli": "^4.3.3",
|
|
115
131
|
"@tailwindcss/vite": "^4.3.3",
|
|
116
132
|
"@tanstack/vue-table": "^9.2.4",
|
|
133
|
+
"@tiptap/core": "^3.31.3",
|
|
134
|
+
"@tiptap/extension-placeholder": "^3.31.3",
|
|
135
|
+
"@tiptap/pm": "^3.31.3",
|
|
136
|
+
"@tiptap/starter-kit": "^3.31.3",
|
|
117
137
|
"@types/node": "^26.6.2",
|
|
118
138
|
"@vue/language-core": "^3.3.11",
|
|
119
139
|
"@vue/test-utils": "^2.5.1",
|
|
140
|
+
"echarts": "^6.1.0",
|
|
120
141
|
"tailwindcss": "^4.3.3",
|
|
121
142
|
"typescript": "^6.0.3",
|
|
122
143
|
"vue": "^3.5.43",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { setRichTextAdapterForTests, useRichTextAdapter, } from './useRichTextAdapter';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ComputedRef } from 'vue';
|
|
2
|
-
import { RichTextEditorAdapter } from '@bridge-ui/core/Adapters';
|
|
3
|
-
/**
|
|
4
|
-
* Sets a process-wide rich-text adapter fallback. For tests only.
|
|
5
|
-
*/
|
|
6
|
-
export declare function setRichTextAdapterForTests(adapter: undefined | RichTextEditorAdapter): void;
|
|
7
|
-
/**
|
|
8
|
-
* Returns the active rich-text adapter from {@link BridgeUIProvider}.
|
|
9
|
-
* `RichTextEditor` requires `global.richText` (e.g.
|
|
10
|
-
* `@bridge-ui/adapters/vue/rich-text-tiptap`).
|
|
11
|
-
*/
|
|
12
|
-
export declare function useRichTextAdapter(): ComputedRef<undefined | RichTextEditorAdapter>;
|