@bridge-ui/vue 0.18.0 → 0.20.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/skills/bridge-ui-components/SKILL.md +35 -34
- package/ai/skills/bridge-ui-setup/SKILL.md +1 -1
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +257 -265
- package/dist/Components/Calendar/composables/useCalendar.d.ts +1 -1
- package/dist/Components/Calendar/composables/useCalendar.js +192 -187
- package/dist/Components/CalendarMonth/composables/useCalendarMonth.d.ts +1 -1
- package/dist/Components/CalendarRange/composables/useCalendarRange.d.ts +1 -1
- package/dist/Components/CalendarRange/composables/useCalendarRange.js +243 -238
- package/dist/Components/ChartBar/ChartBar.vue_vue_type_script_setup_true_lang.js +5 -0
- package/dist/Components/ChartBar/chartBar.types.d.ts +11 -1
- package/dist/Components/ChartBar/composables/useChartBar.js +4 -4
- package/dist/Components/ChartBar/index.d.ts +1 -1
- package/dist/Components/ChartBarSeries/ChartBarSeries.vue_vue_type_script_setup_true_lang.js +4 -1
- package/dist/Components/ChartBarSeries/chartBarSeries.types.d.ts +24 -2
- package/dist/Components/ChartBarSeries/composables/useChartBarSeries.js +3 -0
- package/dist/Components/ChartBarSeries/index.d.ts +1 -0
- package/dist/Components/ChartFunnel/composables/useChartFunnel.js +10 -10
- package/dist/Components/ChartLine/ChartLine.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartLine/chartLine.types.d.ts +7 -0
- package/dist/Components/ChartLine/composables/useChartLine.js +1 -1
- package/dist/Components/ChartLineSeries/ChartLineSeries.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/Components/ChartLineSeries/chartLineSeries.types.d.ts +23 -2
- package/dist/Components/ChartLineSeries/composables/useChartLineSeries.js +3 -0
- package/dist/Components/ChartLineSeries/index.d.ts +1 -0
- package/dist/Components/ChartPie/ChartPie.vue_vue_type_script_setup_true_lang.js +3 -0
- package/dist/Components/ChartPie/chartPie.types.d.ts +20 -1
- package/dist/Components/ChartPie/composables/useChartPie.d.ts +1 -1
- package/dist/Components/ChartPie/composables/useChartPie.js +39 -29
- package/dist/Components/ChartScatter/composables/useChartScatter.js +63 -58
- package/dist/Components/ChartScatterSeries/ChartScatterSeries.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/ChartScatterSeries/chartScatterSeries.types.d.ts +8 -1
- package/dist/Components/ChartScatterSeries/composables/useChartScatterSeries.js +2 -1
- package/dist/Components/ChartScatterSeries/index.d.ts +1 -0
- package/dist/Components/ChartTooltip/ChartTooltip.vue_vue_type_script_setup_true_lang.js +11 -7
- package/dist/Components/ChartTooltip/chartTooltip.types.d.ts +4 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.d.ts +1 -0
- package/dist/Components/ChartTooltip/composables/useChartTooltip.js +4 -0
- package/dist/Components/DataTable/DataTableColumnsMenu.vue.d.ts +1 -2
- package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -66
- package/dist/Components/DataTable/composables/useDataTable.js +267 -349
- package/dist/Components/DataTable/composables/useDataTableColumnsMenu.d.ts +1 -2
- package/dist/Components/Heading/Heading.js +5 -0
- package/dist/Components/Heading/Heading.vue.d.ts +11 -0
- package/dist/Components/Heading/Heading.vue_vue_type_script_setup_true_lang.js +29 -0
- package/dist/Components/Heading/composables/useHeading.d.ts +10 -0
- package/dist/Components/Heading/composables/useHeading.js +56 -0
- package/dist/Components/Heading/heading.types.d.ts +56 -0
- package/dist/Components/Heading/index.d.ts +3 -0
- package/dist/Components/Heading/index.js +3 -0
- package/dist/Components/ListItem/composables/useListItem.js +29 -30
- package/dist/Components/Listbox/composables/useListboxNavigation.d.ts +0 -5
- package/dist/Components/Listbox/composables/useListboxNavigation.js +23 -50
- package/dist/Components/Listbox/index.d.ts +1 -1
- package/dist/Components/Listbox/index.js +5 -5
- package/dist/Components/ResizablePanel/composables/useResizablePanel.d.ts +1 -1
- package/dist/Components/RichTextEditor/composables/useRichTextEditor.js +31 -31
- package/dist/Components/Select/composables/useSelect.js +201 -211
- package/dist/Components/Slider/composables/useSlider.js +93 -122
- package/dist/Components/Text/Text.js +5 -0
- package/dist/Components/Text/Text.vue.d.ts +11 -0
- package/dist/Components/Text/Text.vue_vue_type_script_setup_true_lang.js +33 -0
- package/dist/Components/Text/composables/useText.d.ts +9 -0
- package/dist/Components/Text/composables/useText.js +56 -0
- package/dist/Components/Text/index.d.ts +3 -0
- package/dist/Components/Text/index.js +3 -0
- package/dist/Components/Text/text.types.d.ts +76 -0
- package/dist/Utils/Charts/chart.types.d.ts +17 -0
- package/dist/Utils/Charts/chartInjectionKey.d.ts +2 -2
- package/dist/Utils/Charts/index.d.ts +1 -1
- package/dist/Utils/Charts/useChartCartesian.d.ts +4 -2
- package/dist/Utils/Charts/useChartCartesian.js +90 -76
- package/dist/augments.d.ts +10 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +175 -171
- package/docs/README.md +2 -0
- package/docs/components/BridgeUIProvider.md +1 -1
- package/docs/components/Card.md +15 -0
- package/docs/components/Chart.md +17 -10
- package/docs/components/ChartBar.md +70 -17
- package/docs/components/ChartLine.md +57 -16
- package/docs/components/ChartPie.md +33 -10
- package/docs/components/ChartScatter.md +25 -7
- package/docs/components/Heading.md +85 -0
- package/docs/components/Text.md +118 -0
- package/package.json +2 -2
- package/dist/Components/RichTextEditor/tiptapEditor.d.ts +0 -111
- package/dist/Components/RichTextEditor/tiptapEditor.js +0 -121
- package/dist/Utils/Charts/echarts/bar.d.ts +0 -6
- package/dist/Utils/Charts/echarts/bar.js +0 -22
- package/dist/Utils/Charts/echarts/cartesian.d.ts +0 -15
- package/dist/Utils/Charts/echarts/cartesian.js +0 -255
- package/dist/Utils/Charts/echarts/funnel.d.ts +0 -15
- package/dist/Utils/Charts/echarts/funnel.js +0 -79
- package/dist/Utils/Charts/echarts/line.d.ts +0 -5
- package/dist/Utils/Charts/echarts/line.js +0 -19
- package/dist/Utils/Charts/echarts/part.d.ts +0 -19
- package/dist/Utils/Charts/echarts/part.js +0 -45
- package/dist/Utils/Charts/echarts/pie.d.ts +0 -14
- package/dist/Utils/Charts/echarts/pie.js +0 -75
- package/dist/Utils/Charts/echarts/plot.d.ts +0 -44
- package/dist/Utils/Charts/echarts/plot.js +0 -52
- package/dist/Utils/Charts/echarts/scatter.d.ts +0 -14
- package/dist/Utils/Charts/echarts/scatter.js +0 -152
|
@@ -42,13 +42,50 @@ const months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun"];
|
|
|
42
42
|
Series with the same `stack` key stack on top of each other.
|
|
43
43
|
|
|
44
44
|
```vue
|
|
45
|
-
<ChartLine area stack="total" :categories="months">
|
|
46
|
-
<ChartLineSeries name="Organic" :data="organic" />
|
|
47
|
-
<ChartLineSeries name="Paid" :data="paid" />
|
|
45
|
+
<ChartLine area stack="total" :area-opacity="0.6" :categories="months">
|
|
46
|
+
<ChartLineSeries color="info" name="Organic" :data="organic" />
|
|
47
|
+
<ChartLineSeries name="Paid" :data="paid" color="warning" />
|
|
48
48
|
<ChartLegend />
|
|
49
49
|
</ChartLine>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
`area-opacity` sets the fill opacity (`0.15` by default). Stacked bands read better with a stronger fill. Set it on the root for every series, or per series.
|
|
53
|
+
|
|
54
|
+
### Color by value
|
|
55
|
+
|
|
56
|
+
`color-ranges` recolors the line (and its area) piece by piece. A value in `[min, max)` takes the range color; values outside every range keep the series color. Range labels show in the tooltip, the data table, and the keyboard announcements.
|
|
57
|
+
|
|
58
|
+
```vue
|
|
59
|
+
<ChartLine :categories="days">
|
|
60
|
+
<ChartLineSeries
|
|
61
|
+
name="AQI"
|
|
62
|
+
:data="aqi"
|
|
63
|
+
:reference="[{ value: 50 }, { value: 100 }]"
|
|
64
|
+
:color-ranges="[
|
|
65
|
+
{ max: 50, color: 'success', label: 'Good' },
|
|
66
|
+
{ min: 50, max: 100, color: 'warning', label: 'Moderate' },
|
|
67
|
+
{ min: 100, color: 'error', label: 'Unhealthy' },
|
|
68
|
+
]"
|
|
69
|
+
/>
|
|
70
|
+
<ChartTooltip />
|
|
71
|
+
</ChartLine>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Highlight categories
|
|
75
|
+
|
|
76
|
+
With `color-by="category"`, `min` and `max` are category indices (zero-based, both included): the line changes color over that stretch of the axis. On a time axis the indices still point at the categories.
|
|
77
|
+
|
|
78
|
+
```vue
|
|
79
|
+
<ChartLine area curve="smooth" :categories="months">
|
|
80
|
+
<ChartLineSeries
|
|
81
|
+
name="Visitors"
|
|
82
|
+
:data="visitors"
|
|
83
|
+
color-by="category"
|
|
84
|
+
:color-ranges="[{ min: 2, max: 4, color: 'warning', label: 'Campaign' }]"
|
|
85
|
+
/>
|
|
86
|
+
</ChartLine>
|
|
87
|
+
```
|
|
88
|
+
|
|
52
89
|
### Step, dashed, and points
|
|
53
90
|
|
|
54
91
|
```vue
|
|
@@ -123,6 +160,7 @@ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in
|
|
|
123
160
|
| -------------- | --------------------------------------- | ---------- | ----------------------------------------------- |
|
|
124
161
|
| `categories` | `string[] \| Date[]` | required | Category labels, or dates for a time axis. |
|
|
125
162
|
| `area` | `boolean` | `false` | Fill under every series. |
|
|
163
|
+
| `area-opacity` | `number` | `0.15` | Area fill opacity (`0`–`1`) for every series. |
|
|
126
164
|
| `curve` | `"linear" \| "smooth"` | `"linear"` | Interpolation for every series. |
|
|
127
165
|
| `step` | `false \| "start" \| "middle" \| "end"` | `false` | Step line for every series. |
|
|
128
166
|
| `stack` | `string` | — | Stack every series under this key. |
|
|
@@ -136,16 +174,19 @@ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in
|
|
|
136
174
|
|
|
137
175
|
Unset options fall back to the `ChartLine` props.
|
|
138
176
|
|
|
139
|
-
| Prop
|
|
140
|
-
|
|
|
141
|
-
| `name`
|
|
142
|
-
| `data`
|
|
143
|
-
| `color`
|
|
144
|
-
| `area`
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
177
|
+
| Prop | Type | Default | Description |
|
|
178
|
+
| -------------- | --------------------------------------- | --------- | ------------------------------------------------------------------------------------------- |
|
|
179
|
+
| `name` | `string` | required | Legend, tooltip, and table name. |
|
|
180
|
+
| `data` | `(number \| null)[]` | required | One value per category; `null` leaves a gap. |
|
|
181
|
+
| `color` | `ChartColorValue` | palette | Token key or CSS color. |
|
|
182
|
+
| `area` | `boolean` | root | Fill under the line. |
|
|
183
|
+
| `area-opacity` | `number` | root | Area fill opacity (`0`–`1`). |
|
|
184
|
+
| `curve` | `"linear" \| "smooth"` | root | Interpolation. |
|
|
185
|
+
| `step` | `false \| "start" \| "middle" \| "end"` | root | Step line. |
|
|
186
|
+
| `stack` | `string` | root | Stack key. |
|
|
187
|
+
| `dashed` | `boolean` | `false` | Dashed stroke. |
|
|
188
|
+
| `labels` | `boolean` | root | Value labels. |
|
|
189
|
+
| `show-points` | `boolean` | root | Point symbols. |
|
|
190
|
+
| `reference` | `ChartReference \| ChartReference[]` | — | `{ type: "average" \| "min" \| "max" }` or `{ value }`, each with an optional `label`. |
|
|
191
|
+
| `color-ranges` | `ChartColorRangeOption[]` | — | `{ min?, max?, color, label? }`: the line takes `color` where the value is in `[min, max)`. |
|
|
192
|
+
| `color-by` | `"value" \| "category"` | `"value"` | `category` matches `color-ranges` against category indices (both ends included). |
|
|
@@ -85,6 +85,26 @@ Both:
|
|
|
85
85
|
/>
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
+
### Gaps and rounded corners
|
|
89
|
+
|
|
90
|
+
`pad-angle` sets the gap between slices (deg) and `corner-radius` rounds the slice corners (px). A pie is solid by default; a donut gets `:pad-angle="1"` and `:corner-radius="2"`.
|
|
91
|
+
|
|
92
|
+
```vue
|
|
93
|
+
<ChartPie :data="tags" :pad-angle="3" variant="donut" :corner-radius="8" />
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Nightingale (rose)
|
|
97
|
+
|
|
98
|
+
`rose` draws each slice with a radius that shows its value. With `"radius"` the angle still shows the share; with `"area"` every slice gets the same angle and only the radius changes.
|
|
99
|
+
|
|
100
|
+
```vue
|
|
101
|
+
<ChartPie :data="tags" rose="radius">
|
|
102
|
+
<ChartLegend show-percent />
|
|
103
|
+
</ChartPie>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`rose` works with `variant="donut"`. The tooltip, legend, and data table still show each slice's share of the total.
|
|
107
|
+
|
|
88
108
|
### Group small slices
|
|
89
109
|
|
|
90
110
|
`max-slices` keeps the largest slices and groups the rest into "Other".
|
|
@@ -101,15 +121,18 @@ Legend entries hide and show slices; shares are recomputed for the visible slice
|
|
|
101
121
|
|
|
102
122
|
Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in [Chart](./Chart.md#props-every-root).
|
|
103
123
|
|
|
104
|
-
| Prop | Type | Default
|
|
105
|
-
| ---------------- | ------------------------------------------------------ |
|
|
106
|
-
| `data` | `{ label, value, color? }[]` | required
|
|
107
|
-
| `variant` | `"pie" \| "donut"` | `"pie"`
|
|
108
|
-
| `thickness` | `number` | `0.3`
|
|
109
|
-
| `labels` | `boolean` | `false`
|
|
110
|
-
| `label-position` | `"inside" \| "outside"` | `"outside"`
|
|
111
|
-
| `label-content` | `"label" \| "value" \| "percent" \| (slice) => string` | `"label"`
|
|
112
|
-
| `min-angle` | `number` | `2`
|
|
113
|
-
| `
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| ---------------- | ------------------------------------------------------ | --------------------- | ---------------------------------------------- |
|
|
126
|
+
| `data` | `{ label, value, color? }[]` | required | Slices in order. |
|
|
127
|
+
| `variant` | `"pie" \| "donut"` | `"pie"` | `donut` leaves a hole for the `center` slot. |
|
|
128
|
+
| `thickness` | `number` | `0.3` | Donut ring thickness (fraction of the radius). |
|
|
129
|
+
| `labels` | `boolean` | `false` | Slice labels on the plot. |
|
|
130
|
+
| `label-position` | `"inside" \| "outside"` | `"outside"` | Where plot labels sit. |
|
|
131
|
+
| `label-content` | `"label" \| "value" \| "percent" \| (slice) => string` | `"label"` | What plot labels show. |
|
|
132
|
+
| `min-angle` | `number` | `2` | Minimum slice angle (deg). |
|
|
133
|
+
| `pad-angle` | `number` | `0` (`1` for `donut`) | Gap between slices (deg). |
|
|
134
|
+
| `corner-radius` | `number` | `0` (`2` for `donut`) | Slice corner radius (px). |
|
|
135
|
+
| `rose` | `"radius" \| "area"` | — | Nightingale pie: slice radius shows the value. |
|
|
136
|
+
| `max-slices` | `number` | — | Group the rest into "Other". |
|
|
114
137
|
|
|
115
138
|
Slots: `center` (inside the donut hole), `empty`, `loading`, `default`.
|
|
@@ -60,6 +60,23 @@ A third value per point sets the bubble size. `bubble-size` maps the smallest an
|
|
|
60
60
|
</ChartScatter>
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
### Color by range
|
|
64
|
+
|
|
65
|
+
`color-ranges` recolors single points by their `y`. A `y` in `[min, max)` takes the range color; other points keep the series color. Range labels show in the tooltip and the data table.
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<ChartScatter>
|
|
69
|
+
<ChartScatterSeries
|
|
70
|
+
name="Runs"
|
|
71
|
+
:data="runs"
|
|
72
|
+
:color-ranges="[
|
|
73
|
+
{ max: 5, color: 'success', label: 'Fast' },
|
|
74
|
+
{ min: 5, color: 'warning', label: 'Slow' },
|
|
75
|
+
]"
|
|
76
|
+
/>
|
|
77
|
+
</ChartScatter>
|
|
78
|
+
```
|
|
79
|
+
|
|
63
80
|
## Keyboard
|
|
64
81
|
|
|
65
82
|
Arrow keys move through the points ordered by `x`, then `y`. Each point is announced with its series and values.
|
|
@@ -75,10 +92,11 @@ Shared root props (`height`, `palette`, `loading`, `summary`, …) are listed in
|
|
|
75
92
|
|
|
76
93
|
## Props (`ChartScatterSeries`)
|
|
77
94
|
|
|
78
|
-
| Prop
|
|
79
|
-
|
|
|
80
|
-
| `name`
|
|
81
|
-
| `data`
|
|
82
|
-
| `color`
|
|
83
|
-
| `size-name`
|
|
84
|
-
| `symbol-size`
|
|
95
|
+
| Prop | Type | Default | Description |
|
|
96
|
+
| -------------- | -------------------------------------------------- | -------- | ------------------------------------------------------------------------------ |
|
|
97
|
+
| `name` | `string` | required | Legend, tooltip, and table name. |
|
|
98
|
+
| `data` | `[number, number][] \| [number, number, number][]` | required | Points; the third value makes a bubble. |
|
|
99
|
+
| `color` | `ChartColorValue` | palette | Token key or CSS color. |
|
|
100
|
+
| `size-name` | `string` | `"Size"` | Label for the third value. |
|
|
101
|
+
| `symbol-size` | `number` | root | Point size override (ignored for bubbles). |
|
|
102
|
+
| `color-ranges` | `ChartColorRangeOption[]` | — | `{ min?, max?, color, label? }`: points with `y` in `[min, max)` take `color`. |
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Heading
|
|
2
|
+
|
|
3
|
+
Section and page titles. `level` sets the element (`h1`–`h6`) and the default font size; `size` changes only the look.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Heading } from "@bridge-ui/vue/Components/Heading";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<Heading :level="1">Workspaces</Heading>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Levels
|
|
20
|
+
|
|
21
|
+
Without `size`, each level has its own font size.
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<Heading :level="1">Level 1</Heading>
|
|
25
|
+
<Heading :level="2">Level 2</Heading>
|
|
26
|
+
<Heading :level="3">Level 3</Heading>
|
|
27
|
+
<Heading :level="4">Level 4</Heading>
|
|
28
|
+
<Heading :level="5">Level 5</Heading>
|
|
29
|
+
<Heading :level="6">Level 6</Heading>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Size
|
|
33
|
+
|
|
34
|
+
Keep the right level for the page outline and set the look with `size`.
|
|
35
|
+
|
|
36
|
+
```vue
|
|
37
|
+
<Heading size="lg" :level="2">
|
|
38
|
+
Recent transactions
|
|
39
|
+
</Heading>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Tone, color, and weight
|
|
43
|
+
|
|
44
|
+
`Heading` shares `variant`, `color`, and `weight` with `Text`. `global.defaultColor` does not apply; the default stays `dark`.
|
|
45
|
+
|
|
46
|
+
```vue
|
|
47
|
+
<Heading :level="3" variant="muted">
|
|
48
|
+
Archived
|
|
49
|
+
</Heading>
|
|
50
|
+
<Heading :level="3" weight="bold" color="primary">
|
|
51
|
+
Highlights
|
|
52
|
+
</Heading>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Provider tokens
|
|
56
|
+
|
|
57
|
+
`tokens.level` sets the font size per level.
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<BridgeUIProvider
|
|
61
|
+
:components="{
|
|
62
|
+
Heading: {
|
|
63
|
+
defaultProps: { weight: 'bold' },
|
|
64
|
+
tokens: { level: { '1': 'text-4xl', '2': 'text-3xl' } },
|
|
65
|
+
},
|
|
66
|
+
}"
|
|
67
|
+
>
|
|
68
|
+
<App />
|
|
69
|
+
</BridgeUIProvider>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Props
|
|
73
|
+
|
|
74
|
+
| Prop | Type | Default | Description |
|
|
75
|
+
| --------- | ---------------------------- | ------------ | ------------------------------------------------------------------------------------------- |
|
|
76
|
+
| `classes` | `HeadingClasses` | — | The classes to apply to the heading. |
|
|
77
|
+
| `color` | `TextColor` | `"dark"` | The color of the heading. Ignores `global.defaultColor`. |
|
|
78
|
+
| `level` | `1 \| 2 \| 3 \| 4 \| 5 \| 6` | `2` | The heading level. Sets the element (`h1`–`h6`) and, when `size` is not set, the font size. |
|
|
79
|
+
| `size` | `TextSize` | — | The font size of the heading. When unset, it follows `level`. |
|
|
80
|
+
| `variant` | `TextVariant` | `"default"` | The tone of the heading: `default` for main text, `muted` for secondary text. |
|
|
81
|
+
| `weight` | `TextWeight` | `"semibold"` | The font weight of the heading. |
|
|
82
|
+
|
|
83
|
+
## Related components
|
|
84
|
+
|
|
85
|
+
Text, Card, EmptyState
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# Text
|
|
2
|
+
|
|
3
|
+
Body text with a semantic tone (`default` or `muted`), a color, a size, and a weight. Colors cover light and dark themes, so pages do not repeat `text-dark-* dark:text-dark-*` pairs.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Text } from "@bridge-ui/vue/Components/Text";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Examples
|
|
12
|
+
|
|
13
|
+
### Usage
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<Text>Monthly summary for your workspace.</Text>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Muted
|
|
20
|
+
|
|
21
|
+
Use `variant="muted"` for subtitles, captions, and metadata.
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<Text size="xs" variant="muted">
|
|
25
|
+
Compared to last month
|
|
26
|
+
</Text>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Values
|
|
30
|
+
|
|
31
|
+
`numeric` aligns digits (tabular figures) for money and counts.
|
|
32
|
+
|
|
33
|
+
```vue
|
|
34
|
+
<Text numeric size="2xl" weight="semibold">
|
|
35
|
+
$9,300.00
|
|
36
|
+
</Text>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Color
|
|
40
|
+
|
|
41
|
+
`color` works with both variants. `global.defaultColor` does not apply to `Text`; the default stays `dark`.
|
|
42
|
+
|
|
43
|
+
```vue
|
|
44
|
+
<Text numeric color="success" weight="semibold">
|
|
45
|
+
+$1,250.00
|
|
46
|
+
</Text>
|
|
47
|
+
<Text numeric color="error" weight="semibold">
|
|
48
|
+
−$480.00
|
|
49
|
+
</Text>
|
|
50
|
+
<Text size="sm" color="error" variant="muted">
|
|
51
|
+
Payment overdue
|
|
52
|
+
</Text>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Label
|
|
56
|
+
|
|
57
|
+
```vue
|
|
58
|
+
<Text uppercase size="xs" variant="muted" weight="medium">
|
|
59
|
+
Balance
|
|
60
|
+
</Text>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Element
|
|
64
|
+
|
|
65
|
+
`Text` renders a `p` by default. Use `as` for inline or list content.
|
|
66
|
+
|
|
67
|
+
```vue
|
|
68
|
+
<Text as="span" size="sm" variant="muted">
|
|
69
|
+
Updated 5 minutes ago
|
|
70
|
+
</Text>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Truncate
|
|
74
|
+
|
|
75
|
+
```vue
|
|
76
|
+
<Text truncate class="max-w-48">
|
|
77
|
+
A very long account name that does not fit
|
|
78
|
+
</Text>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Provider defaults and tokens
|
|
82
|
+
|
|
83
|
+
Change the muted tone for the whole app in one place with `tokens`, or set defaults with `defaultProps`.
|
|
84
|
+
|
|
85
|
+
```vue
|
|
86
|
+
<BridgeUIProvider
|
|
87
|
+
:components="{
|
|
88
|
+
Text: {
|
|
89
|
+
defaultProps: { size: 'sm' },
|
|
90
|
+
tokens: {
|
|
91
|
+
variant: {
|
|
92
|
+
muted: { dark: 'text-dark-600 dark:text-dark-300' },
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
}"
|
|
97
|
+
>
|
|
98
|
+
<App />
|
|
99
|
+
</BridgeUIProvider>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Props
|
|
103
|
+
|
|
104
|
+
| Prop | Type | Default | Description |
|
|
105
|
+
| ----------- | ---------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------- |
|
|
106
|
+
| `as` | `"p" \| "dd" \| "dt" \| "em" \| "li" \| "div" \| "span" \| "label" \| "small" \| "strong" \| "figcaption"` | `"p"` | The element rendered as the root. |
|
|
107
|
+
| `classes` | `TextClasses` | — | The classes to apply to the text. |
|
|
108
|
+
| `color` | `TextColor` | `"dark"` | The color of the text. Ignores `global.defaultColor`. |
|
|
109
|
+
| `numeric` | `boolean` | `false` | Whether digits use tabular figures and tight tracking (money, counts). |
|
|
110
|
+
| `size` | `TextSize` | `"md"` | The size of the text (`2xs` to `4xl`). |
|
|
111
|
+
| `truncate` | `boolean` | `false` | Whether the text is cut to one line with an ellipsis. |
|
|
112
|
+
| `uppercase` | `boolean` | `false` | Whether the text is uppercase with wide tracking (small labels). |
|
|
113
|
+
| `variant` | `TextVariant` | `"default"` | The tone of the text: `default` for main text, `muted` for secondary text. |
|
|
114
|
+
| `weight` | `TextWeight` | `"normal"` | The font weight of the text (`normal`, `medium`, `semibold`, `bold`). |
|
|
115
|
+
|
|
116
|
+
## Related components
|
|
117
|
+
|
|
118
|
+
Heading, Card, Label
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.20.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.
|
|
112
|
+
"@bridge-ui/core": "^0.20.0",
|
|
113
113
|
"@tailwindcss/typography": "^0.5.20",
|
|
114
114
|
"clsx": "^2.1.1",
|
|
115
115
|
"es-toolkit": "^1.52.0",
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { RichTextA11yOptions, RichTextFormat, RichTextTool, RichTextToolPayload, RichTextValue } from '@bridge-ui/core/Domain';
|
|
2
|
-
/**
|
|
3
|
-
* Options for {@link mountTiptapEditor}.
|
|
4
|
-
*/
|
|
5
|
-
export type TiptapMountOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* `aria-describedby` on the editable root.
|
|
8
|
-
*/
|
|
9
|
-
ariaDescribedBy?: string;
|
|
10
|
-
/**
|
|
11
|
-
* `aria-disabled` on the editable root.
|
|
12
|
-
*/
|
|
13
|
-
ariaDisabled?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* `aria-invalid` on the editable root.
|
|
16
|
-
*/
|
|
17
|
-
ariaInvalid?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* `aria-readonly` on the editable root.
|
|
20
|
-
*/
|
|
21
|
-
ariaReadonly?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Disable editing and command execution.
|
|
24
|
-
*/
|
|
25
|
-
disabled?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Host element the editor mounts into.
|
|
28
|
-
*/
|
|
29
|
-
element: HTMLElement;
|
|
30
|
-
/**
|
|
31
|
-
* Document format for `value` / `onChange` / handle get/set.
|
|
32
|
-
*/
|
|
33
|
-
format: RichTextFormat;
|
|
34
|
-
/**
|
|
35
|
-
* Optional `id` applied to the editable root (for FormField label association).
|
|
36
|
-
*/
|
|
37
|
-
id?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Called whenever the document changes.
|
|
40
|
-
*/
|
|
41
|
-
onChange: (value: RichTextValue) => void;
|
|
42
|
-
/**
|
|
43
|
-
* Called when the selection changes (toolbar active state).
|
|
44
|
-
*/
|
|
45
|
-
onSelectionChange?: () => void;
|
|
46
|
-
/**
|
|
47
|
-
* Empty-state hint in the content area.
|
|
48
|
-
*/
|
|
49
|
-
placeholder?: string;
|
|
50
|
-
/**
|
|
51
|
-
* View-only surface; commands should no-op.
|
|
52
|
-
*/
|
|
53
|
-
readOnly?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Initial document for the mount `format`.
|
|
56
|
-
*/
|
|
57
|
-
value?: RichTextValue;
|
|
58
|
-
};
|
|
59
|
-
/**
|
|
60
|
-
* Per-editor handle returned by {@link mountTiptapEditor}.
|
|
61
|
-
*/
|
|
62
|
-
export type TiptapEditorHandle = {
|
|
63
|
-
/**
|
|
64
|
-
* Blurs the editable surface when supported.
|
|
65
|
-
*/
|
|
66
|
-
blur: () => void;
|
|
67
|
-
/**
|
|
68
|
-
* Whether `tool` can run in the current selection / state.
|
|
69
|
-
*/
|
|
70
|
-
can: (tool: RichTextTool) => boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Tears down the editor instance.
|
|
73
|
-
*/
|
|
74
|
-
destroy: () => void;
|
|
75
|
-
/**
|
|
76
|
-
* Focuses the editable surface.
|
|
77
|
-
*/
|
|
78
|
-
focus: () => void;
|
|
79
|
-
/**
|
|
80
|
-
* Returns the current document in the mount `format`.
|
|
81
|
-
*/
|
|
82
|
-
getValue: () => RichTextValue;
|
|
83
|
-
/**
|
|
84
|
-
* Whether `tool` is active in the current selection.
|
|
85
|
-
*/
|
|
86
|
-
isActive: (tool: RichTextTool) => boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Runs a toolbar command (toggle mark, set link, …).
|
|
89
|
-
*/
|
|
90
|
-
run: (tool: RichTextTool, payload?: RichTextToolPayload) => void;
|
|
91
|
-
/**
|
|
92
|
-
* Updates a11y attributes and the empty-state placeholder after mount.
|
|
93
|
-
*/
|
|
94
|
-
setA11y: (options: RichTextA11yOptions) => void;
|
|
95
|
-
/**
|
|
96
|
-
* Updates the disabled flag after mount.
|
|
97
|
-
*/
|
|
98
|
-
setDisabled: (disabled: boolean) => void;
|
|
99
|
-
/**
|
|
100
|
-
* Updates the read-only flag after mount.
|
|
101
|
-
*/
|
|
102
|
-
setReadOnly: (readOnly: boolean) => void;
|
|
103
|
-
/**
|
|
104
|
-
* Replaces the document. Must match the mount `format`.
|
|
105
|
-
*/
|
|
106
|
-
setValue: (value: RichTextValue) => void;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Mounts a TipTap editor into `options.element` and returns a handle.
|
|
110
|
-
*/
|
|
111
|
-
export declare function mountTiptapEditor(options: TiptapMountOptions): TiptapEditorHandle;
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { get as e, isNil as t, isString as n } from "es-toolkit/compat";
|
|
2
|
-
import { applyRichTextEditableA11y as r } from "@bridge-ui/core/Domain";
|
|
3
|
-
import { Editor as i } from "@tiptap/core";
|
|
4
|
-
import a from "@tiptap/extension-placeholder";
|
|
5
|
-
import o from "@tiptap/starter-kit";
|
|
6
|
-
//#region src/Components/RichTextEditor/tiptapEditor.ts
|
|
7
|
-
var s = "bridge-rich-text-editable";
|
|
8
|
-
function c(e, t) {
|
|
9
|
-
return t === "json" ? e.getJSON() : e.getHTML();
|
|
10
|
-
}
|
|
11
|
-
function l(e, n) {
|
|
12
|
-
let r = e.extensionManager.extensions.find((e) => e.name === "placeholder");
|
|
13
|
-
t(r) || r.options.placeholder === n || (r.options.placeholder = n, e.view.dispatch(e.state.tr));
|
|
14
|
-
}
|
|
15
|
-
var u = {
|
|
16
|
-
bold: (e) => e.isActive("bold"),
|
|
17
|
-
link: (e) => e.isActive("link"),
|
|
18
|
-
italic: (e) => e.isActive("italic"),
|
|
19
|
-
strike: (e) => e.isActive("strike"),
|
|
20
|
-
codeBlock: (e) => e.isActive("codeBlock"),
|
|
21
|
-
underline: (e) => e.isActive("underline"),
|
|
22
|
-
blockquote: (e) => e.isActive("blockquote"),
|
|
23
|
-
bulletList: (e) => e.isActive("bulletList"),
|
|
24
|
-
orderedList: (e) => e.isActive("orderedList"),
|
|
25
|
-
heading1: (e) => e.isActive("heading", { level: 1 }),
|
|
26
|
-
heading2: (e) => e.isActive("heading", { level: 2 }),
|
|
27
|
-
heading3: (e) => e.isActive("heading", { level: 3 })
|
|
28
|
-
}, d = {
|
|
29
|
-
link: () => !0,
|
|
30
|
-
bold: (e) => e.can().toggleBold(),
|
|
31
|
-
italic: (e) => e.can().toggleItalic(),
|
|
32
|
-
strike: (e) => e.can().toggleStrike(),
|
|
33
|
-
codeBlock: (e) => e.can().toggleCodeBlock(),
|
|
34
|
-
underline: (e) => e.can().toggleUnderline(),
|
|
35
|
-
blockquote: (e) => e.can().toggleBlockquote(),
|
|
36
|
-
bulletList: (e) => e.can().toggleBulletList(),
|
|
37
|
-
orderedList: (e) => e.can().toggleOrderedList(),
|
|
38
|
-
heading1: (e) => e.can().toggleHeading({ level: 1 }),
|
|
39
|
-
heading2: (e) => e.can().toggleHeading({ level: 2 }),
|
|
40
|
-
heading3: (e) => e.can().toggleHeading({ level: 3 })
|
|
41
|
-
}, f = {
|
|
42
|
-
bold: (e) => e.chain().focus().toggleBold().run(),
|
|
43
|
-
italic: (e) => e.chain().focus().toggleItalic().run(),
|
|
44
|
-
strike: (e) => e.chain().focus().toggleStrike().run(),
|
|
45
|
-
codeBlock: (e) => e.chain().focus().toggleCodeBlock().run(),
|
|
46
|
-
underline: (e) => e.chain().focus().toggleUnderline().run(),
|
|
47
|
-
blockquote: (e) => e.chain().focus().toggleBlockquote().run(),
|
|
48
|
-
bulletList: (e) => e.chain().focus().toggleBulletList().run(),
|
|
49
|
-
orderedList: (e) => e.chain().focus().toggleOrderedList().run(),
|
|
50
|
-
heading1: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
51
|
-
heading2: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
52
|
-
heading3: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
53
|
-
link: (e, n) => {
|
|
54
|
-
if (!t(n?.href) && n.href.length > 0) {
|
|
55
|
-
e.chain().focus().extendMarkRange("link").setLink({ href: n.href }).run();
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
e.isActive("link") && e.chain().focus().unsetLink().run();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
function p(t, n) {
|
|
62
|
-
return e(u, n, () => !1)(t);
|
|
63
|
-
}
|
|
64
|
-
function m(t, n) {
|
|
65
|
-
return e(d, n, () => !1)(t);
|
|
66
|
-
}
|
|
67
|
-
function h(t, n, r) {
|
|
68
|
-
e(f, n, () => void 0)(t, r);
|
|
69
|
-
}
|
|
70
|
-
function g(e) {
|
|
71
|
-
let t = e.disabled === !0, u = e.readOnly === !0, d = !1, f = new i({
|
|
72
|
-
autofocus: !1,
|
|
73
|
-
element: e.element,
|
|
74
|
-
editable: !t && !u,
|
|
75
|
-
onSelectionUpdate: () => {
|
|
76
|
-
e.onSelectionChange?.();
|
|
77
|
-
},
|
|
78
|
-
editorProps: { attributes: { class: s } },
|
|
79
|
-
onUpdate: ({ editor: t }) => {
|
|
80
|
-
e.onChange(c(t, e.format));
|
|
81
|
-
},
|
|
82
|
-
content: e.value ?? (e.format === "json" ? {
|
|
83
|
-
type: "doc",
|
|
84
|
-
content: []
|
|
85
|
-
} : ""),
|
|
86
|
-
extensions: [o.configure({ link: { openOnClick: !1 } }), a.configure({ placeholder: e.placeholder ?? "" })]
|
|
87
|
-
});
|
|
88
|
-
return r(f.view.dom, e), {
|
|
89
|
-
getValue: () => c(f, e.format),
|
|
90
|
-
blur: () => {
|
|
91
|
-
d || f.commands.blur();
|
|
92
|
-
},
|
|
93
|
-
focus: () => {
|
|
94
|
-
d || f.commands.focus();
|
|
95
|
-
},
|
|
96
|
-
isActive: (e) => !d && p(f, e),
|
|
97
|
-
destroy: () => {
|
|
98
|
-
d || (d = !0, f.destroy());
|
|
99
|
-
},
|
|
100
|
-
can: (e) => d || t || u ? !1 : m(f, e),
|
|
101
|
-
setDisabled: (e) => {
|
|
102
|
-
d || (t = e, f.setEditable(!t && !u, !1));
|
|
103
|
-
},
|
|
104
|
-
setReadOnly: (e) => {
|
|
105
|
-
d || (u = e, f.setEditable(!t && !u, !1));
|
|
106
|
-
},
|
|
107
|
-
run: (e, n) => {
|
|
108
|
-
d || t || u || h(f, e, n);
|
|
109
|
-
},
|
|
110
|
-
setA11y: (e) => {
|
|
111
|
-
d || (r(f.view.dom, e), l(f, e.placeholder ?? ""));
|
|
112
|
-
},
|
|
113
|
-
setValue: (t) => {
|
|
114
|
-
if (d) return;
|
|
115
|
-
let r = e.format === "html" ? n(t) ? t : "" : t;
|
|
116
|
-
f.commands.setContent(r, { emitUpdate: !1 });
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
|
-
//#endregion
|
|
121
|
-
export { g as mountTiptapEditor };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ChartCartesianRenderOptions, ChartHandle, ChartMountOptions } from '@bridge-ui/core/Domain';
|
|
2
|
-
/**
|
|
3
|
-
* Mounts a bar plot (tree-shaken: bar and line series, for bar + line
|
|
4
|
-
* charts).
|
|
5
|
-
*/
|
|
6
|
-
export declare function mountEchartsBar(options: ChartMountOptions<ChartCartesianRenderOptions>): ChartHandle<ChartCartesianRenderOptions>;
|