@bridge-ui/vue 0.5.1 → 0.7.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 +2 -2
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +1 -1
- package/dist/Adapters/I18n/useI18nAdapter.js +4 -1
- package/dist/Components/Accordion/Accordion.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/Accordion/accordion.types.d.ts +2 -2
- package/dist/Components/Alert/alertDefaultIcons.js +1 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +2 -2
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +150 -145
- package/dist/Components/BaseField/BaseField.vue_vue_type_script_setup_true_lang.js +33 -28
- package/dist/Components/BaseField/BaseFieldCorner.js +5 -0
- package/dist/Components/BaseField/BaseFieldCorner.vue.d.ts +17 -0
- package/dist/Components/BaseField/BaseFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/BaseField/baseField.types.d.ts +4 -2
- package/dist/Components/BaseField/composables/useBaseField.d.ts +1 -1
- package/dist/Components/BaseField/composables/useBaseField.js +11 -8
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/Button/button.types.d.ts +6 -0
- package/dist/Components/Button/composables/useButton.d.ts +4 -1
- package/dist/Components/Button/composables/useButton.js +88 -69
- package/dist/Components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue.d.ts +14 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/Components/ButtonGroup/buttonGroup.types.d.ts +93 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.d.ts +7 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.js +4 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.d.ts +16 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.js +66 -0
- package/dist/Components/ButtonGroup/index.d.ts +4 -0
- package/dist/Components/ButtonGroup/index.js +4 -0
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/CalendarRange/CalendarRange.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Checkbox/composables/useCheckbox.js +1 -1
- package/dist/Components/ColorField/composables/useColorField.d.ts +1 -1
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +180 -158
- package/dist/Components/DataTable/DataTableColumnsMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterOptions.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTablePagination.js +5 -0
- package/dist/Components/DataTable/DataTablePagination.vue.d.ts +24 -0
- package/dist/Components/DataTable/DataTablePagination.vue_vue_type_script_setup_true_lang.js +40 -0
- package/dist/Components/DataTable/DataTableSortButton.vue.d.ts +5 -11
- package/dist/Components/DataTable/DataTableSortButton.vue_vue_type_script_setup_true_lang.js +22 -26
- package/dist/Components/DataTable/composables/useDataTable.d.ts +8 -6
- package/dist/Components/DataTable/composables/useDataTable.js +268 -263
- package/dist/Components/DataTable/composables/useDataTablePagination.d.ts +69 -0
- package/dist/Components/DataTable/composables/useDataTablePagination.js +130 -0
- package/dist/Components/DataTable/dataTable.types.d.ts +27 -12
- package/dist/Components/DataTable/dataTablePagination.types.d.ts +169 -0
- package/dist/Components/DataTable/index.d.ts +2 -1
- package/dist/Components/DateField/composables/useDateField.d.ts +1 -1
- package/dist/Components/DateRangeField/composables/useDateRangeField.d.ts +1 -1
- package/dist/Components/DateTimeField/composables/useDateTimeField.d.ts +1 -1
- package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.d.ts +1 -1
- package/dist/Components/FieldOverlay/composables/useFieldOverlay.js +4 -1
- package/dist/Components/FormField/FilledFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/FilledFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/FormFieldCorner.js +5 -0
- package/dist/Components/FormField/FormFieldCorner.vue.d.ts +17 -0
- package/dist/Components/FormField/FormFieldCorner.vue_vue_type_script_setup_true_lang.js +17 -0
- package/dist/Components/FormField/NotchedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/NotchedFormField.vue_vue_type_script_setup_true_lang.js +31 -26
- package/dist/Components/FormField/OutlinedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/OutlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/StackedFormField.vue.d.ts +6 -6
- package/dist/Components/FormField/StackedFormField.vue_vue_type_script_setup_true_lang.js +34 -29
- package/dist/Components/FormField/UnderlinedFormField.vue.d.ts +7 -7
- package/dist/Components/FormField/UnderlinedFormField.vue_vue_type_script_setup_true_lang.js +32 -27
- package/dist/Components/FormField/composables/useFormField.d.ts +1 -1
- package/dist/Components/FormField/composables/useFormField.js +15 -9
- package/dist/Components/FormField/formField.types.d.ts +4 -2
- package/dist/Components/List/composables/useList.js +1 -1
- package/dist/Components/ListItem/ListItem.vue.d.ts +1 -1
- package/dist/Components/ListItem/composables/useListItem.d.ts +2 -2
- package/dist/Components/ListItem/composables/useListItem.js +101 -86
- package/dist/Components/ListSection/composables/useListSection.js +34 -31
- package/dist/Components/ListSection/listSection.types.d.ts +2 -1
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +82 -82
- package/dist/Components/Listbox/collectComposedListboxOptions.d.ts +5 -0
- package/dist/Components/Listbox/collectComposedListboxOptions.js +27 -0
- package/dist/Components/NumberField/composables/useNumberField.d.ts +1 -1
- package/dist/Components/OtpField/composables/useOtpField.d.ts +1 -1
- package/dist/Components/Pagination/Pagination.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/Components/Pagination/composables/usePagination.d.ts +4 -2
- package/dist/Components/Pagination/composables/usePagination.js +125 -127
- package/dist/Components/Pagination/pagination.types.d.ts +5 -5
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +1 -1
- package/dist/Components/Radio/composables/useRadio.js +2 -1
- package/dist/Components/Select/composables/useSelect.d.ts +2 -2
- package/dist/Components/Select/composables/useSelect.js +104 -99
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +29 -28
- package/dist/Components/Sidebar/composables/useSidebarTrigger.js +14 -14
- package/dist/Components/Slider/composables/useSlider.d.ts +1 -1
- package/dist/Components/Slider/composables/useSlider.js +53 -53
- package/dist/Components/Snackbar/snackbarDefaultIcons.js +1 -0
- package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +13 -12
- package/dist/Components/Tabs/composables/useTabs.js +16 -10
- package/dist/Components/Tabs/tabs.types.d.ts +3 -3
- package/dist/Components/TextField/composables/useTextField.d.ts +1 -1
- package/dist/Components/Textarea/composables/useTextarea.d.ts +1 -1
- package/dist/Components/TimeField/composables/useTimeField.d.ts +1 -1
- package/dist/Components/TimePanel/composables/useTimePanel.js +106 -106
- package/dist/Components/TimeRangeField/composables/useTimeRangeField.d.ts +1 -1
- package/dist/augments.d.ts +5 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +150 -147
- package/docs/README.md +1 -0
- package/docs/components/Accordion.md +1 -1
- package/docs/components/Badge.md +2 -0
- package/docs/components/Button.md +5 -1
- package/docs/components/ButtonGroup.md +124 -0
- package/docs/components/DataTable.md +9 -11
- package/docs/components/Divider.md +1 -0
- package/docs/components/I18n.md +65 -24
- package/docs/components/Pagination.md +5 -3
- package/docs/components/Table.md +2 -2
- package/docs/components/Tabs.md +24 -6
- package/docs/components/ToggleGroup.md +1 -1
- package/docs/examples/i18n-dictionary.ts +31 -10
- package/docs/examples/i18n-vue-i18n.ts +7 -6
- package/docs/examples/icon-fontawesome.ts +4 -0
- package/docs/examples/icon-heroicons.ts +5 -1
- package/docs/examples/icon-lucide.ts +4 -0
- package/docs/examples/icon-phosphor.ts +4 -0
- package/docs/examples/icon-tabler.ts +4 -0
- package/package.json +2 -2
package/docs/components/I18n.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# i18n
|
|
2
2
|
|
|
3
|
-
Bridge chrome strings (aria-labels, empty/loading copy) resolve through an optional i18n adapter on `BridgeUIProvider` / `createBridgeUI` (`global.i18n`). Without an adapter, the English source string is returned
|
|
3
|
+
Bridge chrome strings (aria-labels, empty/loading copy) resolve through an optional i18n adapter on `BridgeUIProvider` / `createBridgeUI` (`global.i18n`). Without an adapter, the English source string is returned, with `{{name}}` replaced from `params`, and `|` plural forms when `count` is set.
|
|
4
4
|
|
|
5
5
|
Lookup is **gettext-style**: the source English text is the key. Multi-locale
|
|
6
6
|
adapters can keep the active locale internally via optional `setLocale`.
|
|
@@ -11,10 +11,14 @@ const resolveMessage = useResolveMessage();
|
|
|
11
11
|
resolveMessage("Hide password");
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
`useResolveMessage` reads the active adapter from context. **
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
`useResolveMessage` reads the active adapter from context. **Pluralization
|
|
15
|
+
uses the `count` argument** on `t(message, count, params)`: vue-i18n / i18next
|
|
16
|
+
handle it in `t`; dictionary adapters call `selectPluralMessage` on `|` forms
|
|
17
|
+
(`one | other`). Without an adapter, `resolveMessage` still replaces `{{name}}`
|
|
18
|
+
and picks `|` forms when `count` is set. Adapters that used `t(message, params)`
|
|
19
|
+
should move interpolation vars to the third argument. Bridge `setLocale`
|
|
20
|
+
updates `global.locale` and calls optional `adapter.setLocale` — persistence
|
|
21
|
+
(localStorage, backend) stays in the app.
|
|
18
22
|
|
|
19
23
|
Implement `I18nAdapter` as a plain object — Bridge only defines the interface.
|
|
20
24
|
|
|
@@ -44,8 +48,9 @@ const resolveMessage = useResolveMessage();
|
|
|
44
48
|
|
|
45
49
|
### Dictionary adapter
|
|
46
50
|
|
|
47
|
-
Locale-keyed source→string map
|
|
48
|
-
|
|
51
|
+
Locale-keyed source→string map with `{{name}}` replace. Plural values use
|
|
52
|
+
`one | other` (or `zero | one | other`). Optional `setLocale` updates the
|
|
53
|
+
active locale used by `t`.
|
|
49
54
|
|
|
50
55
|
```ts
|
|
51
56
|
import { createBridgeUI } from "@bridge-ui/vue";
|
|
@@ -61,14 +66,20 @@ const bridge = createBridgeUI({
|
|
|
61
66
|
### Custom adapter
|
|
62
67
|
|
|
63
68
|
```ts
|
|
64
|
-
import { get } from "es-toolkit/compat";
|
|
65
|
-
import
|
|
69
|
+
import { get, isNil } from "es-toolkit/compat";
|
|
70
|
+
import {
|
|
71
|
+
interpolateMessage,
|
|
72
|
+
selectPluralMessage,
|
|
73
|
+
type I18nAdapter,
|
|
74
|
+
} from "@bridge-ui/vue";
|
|
66
75
|
|
|
67
76
|
const messages: Record<string, Record<string, string>> = {
|
|
68
77
|
"pt-BR": {
|
|
69
78
|
Close: "Fechar",
|
|
70
79
|
"Hide password": "Ocultar senha",
|
|
71
80
|
"Clear selection": "Limpar seleção",
|
|
81
|
+
"{{selected}} of {{total}} row(s) selected.":
|
|
82
|
+
"{{selected}} de {{total}} linha selecionada. | {{selected}} de {{total}} linhas selecionadas.",
|
|
72
83
|
},
|
|
73
84
|
};
|
|
74
85
|
|
|
@@ -78,8 +89,13 @@ const i18n: I18nAdapter = {
|
|
|
78
89
|
setLocale(next) {
|
|
79
90
|
locale = next;
|
|
80
91
|
},
|
|
81
|
-
t(message) {
|
|
82
|
-
|
|
92
|
+
t(message, count, params) {
|
|
93
|
+
const translated = get(messages, [locale, message], message);
|
|
94
|
+
const template = isNil(count)
|
|
95
|
+
? translated
|
|
96
|
+
: selectPluralMessage(translated, count);
|
|
97
|
+
|
|
98
|
+
return interpolateMessage(template, params);
|
|
83
99
|
},
|
|
84
100
|
};
|
|
85
101
|
```
|
|
@@ -94,7 +110,7 @@ const vueI18n = createI18n({ legacy: false, locale: "en-US", messages: {} });
|
|
|
94
110
|
const i18n = createVueI18nAdapter(vueI18n.global);
|
|
95
111
|
|
|
96
112
|
const resolveMessage = useResolveMessage();
|
|
97
|
-
resolveMessage("{count} item",
|
|
113
|
+
resolveMessage("{count} item", 3);
|
|
98
114
|
// → vue-i18n handles interpolation / plural rules
|
|
99
115
|
|
|
100
116
|
setLocale("pt-BR"); // Bridge locale + i18n.locale via adapter.setLocale
|
|
@@ -104,22 +120,47 @@ Other ready examples:
|
|
|
104
120
|
|
|
105
121
|
| File | Library | Replace / plural |
|
|
106
122
|
| -------------------- | -------------------- | ---------------- |
|
|
107
|
-
| `i18n-dictionary.ts` | In-memory dictionary |
|
|
123
|
+
| `i18n-dictionary.ts` | In-memory dictionary | Yes (`\|` forms) |
|
|
108
124
|
| `i18n-vue-i18n.ts` | vue-i18n | Yes (via lib) |
|
|
109
125
|
|
|
110
126
|
## Chrome strings
|
|
111
127
|
|
|
112
|
-
| Source (key)
|
|
113
|
-
|
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
128
|
+
| Source (key) |
|
|
129
|
+
| -------------------------------------------- |
|
|
130
|
+
| `OK` |
|
|
131
|
+
| `Next` |
|
|
132
|
+
| `Close` |
|
|
133
|
+
| `Reset` |
|
|
134
|
+
| `Search` |
|
|
135
|
+
| `Columns` |
|
|
136
|
+
| `Loading` |
|
|
137
|
+
| `No data` |
|
|
138
|
+
| `Previous` |
|
|
139
|
+
| `Last page` |
|
|
140
|
+
| `Expand row` |
|
|
141
|
+
| `First page` |
|
|
142
|
+
| `Loading...` |
|
|
143
|
+
| `No options` |
|
|
144
|
+
| `Pagination` |
|
|
145
|
+
| `Select row` |
|
|
146
|
+
| `Filter column` |
|
|
147
|
+
| `Hide password` |
|
|
148
|
+
| `Rows per page` |
|
|
149
|
+
| `Show password` |
|
|
150
|
+
| `Cancel sorting` |
|
|
151
|
+
| `Sort ascending` |
|
|
152
|
+
| `Clear selection` |
|
|
153
|
+
| `Decrement value` |
|
|
154
|
+
| `Increment value` |
|
|
155
|
+
| `Select all rows` |
|
|
156
|
+
| `Sort descending` |
|
|
157
|
+
| `Select all items` |
|
|
158
|
+
| `Page {{page}} of {{count}}` |
|
|
159
|
+
| `{{selected}} of {{total}} row(s) selected.` |
|
|
160
|
+
|
|
161
|
+
The selection summary calls `t` with `count` (selected rows). Dictionary
|
|
162
|
+
values for that key use `one | other`.
|
|
122
163
|
|
|
123
164
|
## Related components
|
|
124
165
|
|
|
125
|
-
BridgeUIProvider, PasswordField, NumberField, Select, Listbox, Snackbar
|
|
166
|
+
BridgeUIProvider, DataTable, Pagination, PasswordField, NumberField, Select, Listbox, Snackbar
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Pagination
|
|
2
2
|
|
|
3
|
-
Page controls for lists and tables: previous/next, page numbers, and a simple cursor-friendly prev/next mode.
|
|
3
|
+
Page controls for lists and tables: previous/next with labels, page numbers, and a simple cursor-friendly prev/next mode. `Previous` and `Next` resolve through the i18n adapter.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -27,15 +27,17 @@ const page = ref(1);
|
|
|
27
27
|
|
|
28
28
|
### Variants
|
|
29
29
|
|
|
30
|
+
`ghost` (default), `text`, `outlined`.
|
|
31
|
+
|
|
30
32
|
```vue
|
|
31
|
-
<Pagination :count="12" v-model="page" variant="text" />
|
|
32
33
|
<Pagination :count="12" v-model="page" variant="ghost" />
|
|
34
|
+
<Pagination :count="12" v-model="page" variant="text" />
|
|
33
35
|
<Pagination :count="12" v-model="page" variant="outlined" />
|
|
34
36
|
```
|
|
35
37
|
|
|
36
38
|
### Rounded
|
|
37
39
|
|
|
38
|
-
Applies to `ghost` item corners and the `outlined` group / edge controls.
|
|
40
|
+
Applies to `ghost` and `text` item corners and the `outlined` group / edge controls.
|
|
39
41
|
|
|
40
42
|
```vue
|
|
41
43
|
<Pagination :count="12" rounded="lg" v-model="page" variant="ghost" />
|
package/docs/components/Table.md
CHANGED
|
@@ -46,7 +46,7 @@ Same three chrome treatments as `DataTable`. Pair with `Pagination` under the ta
|
|
|
46
46
|
|
|
47
47
|
```vue
|
|
48
48
|
<Table variant="plain" />
|
|
49
|
-
<Pagination :count="12" v-model="page" variant="
|
|
49
|
+
<Pagination :count="12" v-model="page" variant="ghost" />
|
|
50
50
|
|
|
51
51
|
<Table variant="ghost" />
|
|
52
52
|
<Pagination :count="12" v-model="page" variant="ghost" />
|
|
@@ -57,7 +57,7 @@ Same three chrome treatments as `DataTable`. Pair with `Pagination` under the ta
|
|
|
57
57
|
|
|
58
58
|
| Table `variant` | Pagination `variant` |
|
|
59
59
|
| --------------- | -------------------- |
|
|
60
|
-
| `plain` | `
|
|
60
|
+
| `plain` | `ghost` |
|
|
61
61
|
| `ghost` | `ghost` |
|
|
62
62
|
| `bordered` | `outlined` |
|
|
63
63
|
|
package/docs/components/Tabs.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Tabs
|
|
2
2
|
|
|
3
|
-
Organize related content into tabbed views. Use with `TabList`, `Tab`, and `TabPanel`.
|
|
3
|
+
Organize related content into tabbed views. Use with `TabList`, `Tab`, and `TabPanel`. The selected tab uses a quiet surface from `variant`; `color` optionally tints selected text and the `line` / `solid` / `enclosed` indicator.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -90,10 +90,28 @@ import { TabPanel } from "@bridge-ui/vue/Components/TabPanel";
|
|
|
90
90
|
|
|
91
91
|
### Variants
|
|
92
92
|
|
|
93
|
-
`
|
|
93
|
+
`pill` (default), `line`, `plain`, `solid`, `enclosed`.
|
|
94
94
|
|
|
95
95
|
```vue
|
|
96
|
-
<Tabs v-model="tab"
|
|
96
|
+
<Tabs v-model="tab">
|
|
97
|
+
<TabList>
|
|
98
|
+
<Tab value="one">One</Tab>
|
|
99
|
+
<Tab value="two">Two</Tab>
|
|
100
|
+
</TabList>
|
|
101
|
+
<TabPanel value="one">First</TabPanel>
|
|
102
|
+
<TabPanel value="two">Second</TabPanel>
|
|
103
|
+
</Tabs>
|
|
104
|
+
|
|
105
|
+
<Tabs v-model="tab" variant="line">
|
|
106
|
+
<TabList>
|
|
107
|
+
<Tab value="one">One</Tab>
|
|
108
|
+
<Tab value="two">Two</Tab>
|
|
109
|
+
</TabList>
|
|
110
|
+
<TabPanel value="one">First</TabPanel>
|
|
111
|
+
<TabPanel value="two">Second</TabPanel>
|
|
112
|
+
</Tabs>
|
|
113
|
+
|
|
114
|
+
<Tabs v-model="tab" variant="plain">
|
|
97
115
|
<TabList>
|
|
98
116
|
<Tab value="one">One</Tab>
|
|
99
117
|
<Tab value="two">Two</Tab>
|
|
@@ -102,7 +120,7 @@ import { TabPanel } from "@bridge-ui/vue/Components/TabPanel";
|
|
|
102
120
|
<TabPanel value="two">Second</TabPanel>
|
|
103
121
|
</Tabs>
|
|
104
122
|
|
|
105
|
-
<Tabs
|
|
123
|
+
<Tabs v-model="tab" variant="solid">
|
|
106
124
|
<TabList>
|
|
107
125
|
<Tab value="one">One</Tab>
|
|
108
126
|
<Tab value="two">Two</Tab>
|
|
@@ -152,11 +170,11 @@ import { TabPanel } from "@bridge-ui/vue/Components/TabPanel";
|
|
|
152
170
|
| Prop | Type | Default |
|
|
153
171
|
| ------------- | ----------------- | -------------- |
|
|
154
172
|
| `activation` | `TabsActivation` | `"automatic"` |
|
|
155
|
-
| `color` | `TabsColor` | `"
|
|
173
|
+
| `color` | `TabsColor` | `"dark"` |
|
|
156
174
|
| `keepMounted` | `boolean` | `true` |
|
|
157
175
|
| `orientation` | `TabsOrientation` | `"horizontal"` |
|
|
158
176
|
| `size` | `TabsSize` | `"md"` |
|
|
159
|
-
| `variant` | `TabsVariant` | `"
|
|
177
|
+
| `variant` | `TabsVariant` | `"pill"` |
|
|
160
178
|
|
|
161
179
|
### v-model
|
|
162
180
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ToggleGroup
|
|
2
2
|
|
|
3
|
-
Segmented control for one or more labeled options in a shared track. Single selection by default; set `multiple` for multi-select. Use `Switch` for on/off. Compose with `ToggleItem`.
|
|
3
|
+
Segmented control for one or more labeled options in a shared track. Single selection by default; set `multiple` for multi-select. Use `ButtonGroup` for grouped actions that do not select a value. Use `Switch` for on/off. Compose with `ToggleItem`.
|
|
4
4
|
|
|
5
5
|
## Import
|
|
6
6
|
|
|
@@ -5,15 +5,19 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Source English strings are the lookup keys (same strings Bridge passes to
|
|
7
7
|
* `resolveMessage`). Messages are keyed by locale; optional `setLocale` updates
|
|
8
|
-
* the active locale used by `t`.
|
|
9
|
-
*
|
|
8
|
+
* the active locale used by `t`. `t` replaces `{{name}}` from `params` and
|
|
9
|
+
* picks `|` plural forms when `count` is set (`one | other`).
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
// ** External Imports
|
|
13
|
-
import { get } from "es-toolkit/compat";
|
|
13
|
+
import { get, isNil } from "es-toolkit/compat";
|
|
14
14
|
|
|
15
15
|
// ** Core Imports
|
|
16
|
-
import
|
|
16
|
+
import {
|
|
17
|
+
interpolateMessage,
|
|
18
|
+
selectPluralMessage,
|
|
19
|
+
type I18nAdapter,
|
|
20
|
+
} from "@bridge-ui/core/Adapters";
|
|
17
21
|
|
|
18
22
|
// prettier-ignore
|
|
19
23
|
const MESSAGES: Record<string, Record<string, string>> = {
|
|
@@ -21,22 +25,34 @@ const MESSAGES: Record<string, Record<string, string>> = {
|
|
|
21
25
|
"pt-BR": {
|
|
22
26
|
"OK": "OK",
|
|
23
27
|
"Close": "Fechar",
|
|
24
|
-
"
|
|
28
|
+
"Next": "Próxima",
|
|
25
29
|
"Columns": "Colunas",
|
|
30
|
+
"Reset": "Redefinir",
|
|
26
31
|
"Search": "Pesquisar",
|
|
27
32
|
"No data": "Sem dados",
|
|
28
|
-
"
|
|
33
|
+
"Previous": "Anterior",
|
|
34
|
+
"Loading": "Carregando",
|
|
35
|
+
"Pagination": "Paginação",
|
|
36
|
+
"Last page": "Última página",
|
|
29
37
|
"Loading...": "Carregando...",
|
|
30
38
|
"No options": "Nenhuma opção",
|
|
31
|
-
"
|
|
39
|
+
"Expand row": "Expandir linha",
|
|
40
|
+
"First page": "Primeira página",
|
|
32
41
|
"Hide password": "Ocultar senha",
|
|
42
|
+
"Select row": "Selecionar linha",
|
|
33
43
|
"Show password": "Mostrar senha",
|
|
34
44
|
"Filter column": "Filtrar coluna",
|
|
35
45
|
"Clear selection": "Limpar seleção",
|
|
36
46
|
"Decrement value": "Diminuir valor",
|
|
37
47
|
"Increment value": "Aumentar valor",
|
|
38
|
-
"
|
|
48
|
+
"Rows per page": "Linhas por página",
|
|
49
|
+
"Sort ascending": "Ordenar crescente",
|
|
50
|
+
"Cancel sorting": "Cancelar ordenação",
|
|
51
|
+
"Sort descending": "Ordenar decrescente",
|
|
39
52
|
"Select all items": "Selecionar todos os itens",
|
|
53
|
+
"Select all rows": "Selecionar todas as linhas",
|
|
54
|
+
"Page {{page}} of {{count}}": "Página {{page}} de {{count}}",
|
|
55
|
+
"{{selected}} of {{total}} row(s) selected.": "{{selected}} de {{total}} linha selecionada. | {{selected}} de {{total}} linhas selecionadas.",
|
|
40
56
|
},
|
|
41
57
|
};
|
|
42
58
|
|
|
@@ -51,8 +67,13 @@ export function createDictionaryI18nAdapter(): I18nAdapter {
|
|
|
51
67
|
setLocale(next) {
|
|
52
68
|
locale = next;
|
|
53
69
|
},
|
|
54
|
-
t(message) {
|
|
55
|
-
|
|
70
|
+
t(message, count, params) {
|
|
71
|
+
const translated = get(MESSAGES, [locale, message], message);
|
|
72
|
+
const template = isNil(count)
|
|
73
|
+
? translated
|
|
74
|
+
: selectPluralMessage(translated, count);
|
|
75
|
+
|
|
76
|
+
return interpolateMessage(template, params);
|
|
56
77
|
},
|
|
57
78
|
};
|
|
58
79
|
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.i18n`.
|
|
4
4
|
* Not published as an npm package.
|
|
5
5
|
*
|
|
6
|
-
* Passes Bridge source strings and `params`
|
|
7
|
-
* (interpolation
|
|
6
|
+
* Passes Bridge source strings, `count`, and `params` to `i18n.t`
|
|
7
|
+
* (interpolation and `|` pluralization stay in vue-i18n).
|
|
8
8
|
* `setLocale` on the adapter is invoked by Bridge `setLocale`.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
// ** External Imports
|
|
12
|
+
import { isNil } from "es-toolkit/compat";
|
|
12
13
|
import type { Composer } from "vue-i18n";
|
|
13
14
|
|
|
14
15
|
// ** Core Imports
|
|
@@ -23,12 +24,12 @@ export function createVueI18nAdapter(i18n: Composer): I18nAdapter {
|
|
|
23
24
|
setLocale(locale) {
|
|
24
25
|
i18n.locale.value = locale;
|
|
25
26
|
},
|
|
26
|
-
t(message, params) {
|
|
27
|
-
if (
|
|
28
|
-
return i18n.t(message, params);
|
|
27
|
+
t(message, count, params) {
|
|
28
|
+
if (isNil(count)) {
|
|
29
|
+
return params ? i18n.t(message, params) : i18n.t(message);
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
return i18n.t(message);
|
|
32
|
+
return params ? i18n.t(message, count, params) : i18n.t(message, count);
|
|
32
33
|
},
|
|
33
34
|
};
|
|
34
35
|
}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
// ** External Imports
|
|
11
11
|
import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
12
12
|
import {
|
|
13
|
+
faAnglesLeft,
|
|
14
|
+
faAnglesRight,
|
|
13
15
|
faBell,
|
|
14
16
|
faCalendarDays,
|
|
15
17
|
faCheck,
|
|
@@ -117,7 +119,9 @@ const icons = {
|
|
|
117
119
|
alert: faCircleExclamation,
|
|
118
120
|
chevronDown: faChevronDown,
|
|
119
121
|
chevronLeft: faChevronLeft,
|
|
122
|
+
chevronsLeft: faAnglesLeft,
|
|
120
123
|
chevronRight: faChevronRight,
|
|
124
|
+
chevronsRight: faAnglesRight,
|
|
121
125
|
warning: faTriangleExclamation,
|
|
122
126
|
} satisfies Record<SemanticIconName, unknown>;
|
|
123
127
|
|
|
@@ -13,6 +13,8 @@ import {
|
|
|
13
13
|
CalendarDaysIcon,
|
|
14
14
|
CheckCircleIcon,
|
|
15
15
|
CheckIcon,
|
|
16
|
+
ChevronDoubleLeftIcon,
|
|
17
|
+
ChevronDoubleRightIcon,
|
|
16
18
|
ChevronDownIcon,
|
|
17
19
|
ChevronLeftIcon,
|
|
18
20
|
ChevronRightIcon,
|
|
@@ -67,8 +69,10 @@ const icons = {
|
|
|
67
69
|
chevronDown: ChevronDownIcon,
|
|
68
70
|
chevronLeft: ChevronLeftIcon,
|
|
69
71
|
chevronRight: ChevronRightIcon,
|
|
70
|
-
warning: ExclamationTriangleIcon,
|
|
71
72
|
chevronUpDown: ChevronUpDownIcon,
|
|
73
|
+
warning: ExclamationTriangleIcon,
|
|
74
|
+
chevronsLeft: ChevronDoubleLeftIcon,
|
|
75
|
+
chevronsRight: ChevronDoubleRightIcon,
|
|
72
76
|
} satisfies Record<SemanticIconName, unknown>;
|
|
73
77
|
|
|
74
78
|
/**
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
ChevronDown,
|
|
13
13
|
ChevronLeft,
|
|
14
14
|
ChevronRight,
|
|
15
|
+
ChevronsLeft,
|
|
16
|
+
ChevronsRight,
|
|
15
17
|
ChevronsUpDown,
|
|
16
18
|
ChevronUp,
|
|
17
19
|
CircleAlert,
|
|
@@ -68,6 +70,8 @@ const icons = {
|
|
|
68
70
|
chevronDown: ChevronDown,
|
|
69
71
|
chevronLeft: ChevronLeft,
|
|
70
72
|
chevronRight: ChevronRight,
|
|
73
|
+
chevronsLeft: ChevronsLeft,
|
|
74
|
+
chevronsRight: ChevronsRight,
|
|
71
75
|
chevronUpDown: ChevronsUpDown,
|
|
72
76
|
} satisfies Record<SemanticIconName, unknown>;
|
|
73
77
|
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
import {
|
|
9
9
|
PhBell,
|
|
10
10
|
PhCalendarDots,
|
|
11
|
+
PhCaretDoubleLeft,
|
|
12
|
+
PhCaretDoubleRight,
|
|
11
13
|
PhCaretDown,
|
|
12
14
|
PhCaretLeft,
|
|
13
15
|
PhCaretRight,
|
|
@@ -69,6 +71,8 @@ const icons = {
|
|
|
69
71
|
download: PhDownloadSimple,
|
|
70
72
|
chevronRight: PhCaretRight,
|
|
71
73
|
chevronUpDown: PhCaretUpDown,
|
|
74
|
+
chevronsLeft: PhCaretDoubleLeft,
|
|
75
|
+
chevronsRight: PhCaretDoubleRight,
|
|
72
76
|
} satisfies Record<SemanticIconName, unknown>;
|
|
73
77
|
|
|
74
78
|
/**
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
IconChevronDown,
|
|
15
15
|
IconChevronLeft,
|
|
16
16
|
IconChevronRight,
|
|
17
|
+
IconChevronsLeft,
|
|
18
|
+
IconChevronsRight,
|
|
17
19
|
IconChevronUp,
|
|
18
20
|
IconCircleCheck,
|
|
19
21
|
IconCircleX,
|
|
@@ -69,6 +71,8 @@ const icons = {
|
|
|
69
71
|
chevronDown: IconChevronDown,
|
|
70
72
|
chevronLeft: IconChevronLeft,
|
|
71
73
|
chevronRight: IconChevronRight,
|
|
74
|
+
chevronsLeft: IconChevronsLeft,
|
|
75
|
+
chevronsRight: IconChevronsRight,
|
|
72
76
|
} satisfies Record<SemanticIconName, unknown>;
|
|
73
77
|
|
|
74
78
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@bridge-ui/core": "^0.
|
|
92
|
+
"@bridge-ui/core": "^0.7.0",
|
|
93
93
|
"clsx": "^2.1.1",
|
|
94
94
|
"es-toolkit": "^1.50.0",
|
|
95
95
|
"tailwind-merge": "^3.6.0"
|