@bridge-ui/vue 0.0.7 → 0.0.8
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 +31 -0
- package/ai/README.md +35 -0
- package/ai/guidelines/core.md +44 -0
- package/ai/llms.txt +38 -0
- package/ai/skills/bridge-ui-components/SKILL.md +37 -0
- package/ai/skills/bridge-ui-forms/SKILL.md +38 -0
- package/ai/skills/bridge-ui-overlays/SKILL.md +37 -0
- package/ai/skills/bridge-ui-setup/SKILL.md +38 -0
- package/bin/__tests__/ai.test.ts +319 -0
- package/bin/ai.mjs +469 -0
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +1 -1
- package/dist/Adapters/Icon/useIconAdapter.d.ts +1 -1
- package/dist/Components/Autocomplete/Autocomplete.vue.d.ts +5 -5
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +3 -2
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +6 -2
- package/dist/Components/Avatar/composables/useAvatar.d.ts +1 -1
- package/dist/Components/BaseField/BaseField.js +5 -0
- package/dist/Components/BaseField/BaseField.vue.d.ts +15 -0
- package/dist/Components/BaseField/BaseField.vue_vue_type_script_setup_true_lang.js +41 -0
- package/dist/Components/BaseField/BaseFieldLabel.js +5 -0
- package/dist/Components/{OtpField/OtpFieldLabel.vue.d.ts → BaseField/BaseFieldLabel.vue.d.ts} +2 -2
- package/dist/Components/{OtpField/OtpFieldLabel.vue_vue_type_script_setup_true_lang.js → BaseField/BaseFieldLabel.vue_vue_type_script_setup_true_lang.js} +2 -2
- package/dist/Components/BaseField/baseField.types.d.ts +222 -0
- package/dist/Components/BaseField/composables/useBaseField.d.ts +55 -0
- package/dist/Components/BaseField/composables/useBaseField.js +131 -0
- package/dist/Components/BaseField/index.d.ts +4 -0
- package/dist/Components/BaseField/index.js +3 -0
- package/dist/Components/Button/composables/useButton.d.ts +1 -1
- package/dist/Components/Checkbox/composables/useCheckbox.d.ts +1 -1
- package/dist/Components/Checkbox/composables/useCheckbox.js +1 -1
- package/dist/Components/Chip/Chip.vue.d.ts +1 -1
- package/dist/Components/Chip/composables/useChip.d.ts +1 -1
- package/dist/Components/Drawer/Drawer.vue.d.ts +2 -2
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -1
- package/dist/Components/FormControl/composables/useFormControl.d.ts +11 -2
- package/dist/Components/FormControl/composables/useFormControl.js +57 -53
- package/dist/Components/FormControl/index.d.ts +1 -1
- package/dist/Components/FormField/composables/useFormField.d.ts +5 -1
- package/dist/Components/FormField/composables/useFormField.js +1 -1
- package/dist/Components/ListItem/ListItem.vue.d.ts +1 -1
- package/dist/Components/ListItem/composables/useListItem.d.ts +1 -1
- package/dist/Components/Listbox/Listbox.vue.d.ts +3 -3
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/Components/Listbox/composables/useListbox.d.ts +10 -1
- package/dist/Components/Listbox/composables/useListbox.js +20 -20
- package/dist/Components/Listbox/index.d.ts +1 -0
- package/dist/Components/Listbox/listbox.types.d.ts +6 -0
- package/dist/Components/Menu/Menu.vue.d.ts +2 -2
- package/dist/Components/Modal/Modal.vue.d.ts +2 -2
- package/dist/Components/Modal/composables/useModal.d.ts +1 -1
- package/dist/Components/NumberField/NumberField.vue.d.ts +2 -2
- package/dist/Components/NumberField/composables/useNumberField.d.ts +2 -2
- package/dist/Components/NumberField/composables/useNumberField.js +4 -1
- package/dist/Components/OtpField/OtpField.vue.d.ts +3 -3
- package/dist/Components/OtpField/OtpField.vue_vue_type_script_setup_true_lang.js +34 -52
- package/dist/Components/OtpField/composables/useOtpField.d.ts +40 -213
- package/dist/Components/OtpField/composables/useOtpField.js +92 -150
- package/dist/Components/OtpField/otpField.types.d.ts +10 -180
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +2 -2
- package/dist/Components/PasswordField/composables/usePasswordField.js +4 -1
- package/dist/Components/Radio/composables/useRadio.d.ts +1 -1
- package/dist/Components/Radio/composables/useRadio.js +1 -1
- package/dist/Components/Select/Select.vue.d.ts +4 -4
- package/dist/Components/Select/composables/useSelect.d.ts +3 -2
- package/dist/Components/Select/composables/useSelect.js +6 -2
- package/dist/Components/Slider/Slider.js +5 -0
- package/dist/Components/Slider/Slider.vue.d.ts +25 -0
- package/dist/Components/Slider/Slider.vue_vue_type_script_setup_true_lang.js +113 -0
- package/dist/Components/Slider/composables/useSlider.d.ts +482 -0
- package/dist/Components/Slider/composables/useSlider.js +287 -0
- package/dist/Components/Slider/index.d.ts +4 -0
- package/dist/Components/Slider/index.js +3 -0
- package/dist/Components/Slider/slider.types.d.ts +169 -0
- package/dist/Components/Snackbar/Snackbar.vue.d.ts +2 -2
- package/dist/Components/Switch/composables/useSwitch.d.ts +1 -1
- package/dist/Components/Switch/composables/useSwitch.js +1 -1
- package/dist/Components/Tabs/Tabs.vue.d.ts +2 -2
- package/dist/Components/TextField/composables/useTextField.d.ts +2 -2
- package/dist/Components/TextField/composables/useTextField.js +1 -1
- package/dist/Components/Textarea/composables/useTextarea.d.ts +2 -2
- package/dist/Components/Textarea/composables/useTextarea.js +1 -0
- package/dist/Utils/index.d.ts +3 -3
- package/dist/Utils/index.js +5 -2
- package/dist/augments.d.ts +29 -17
- package/dist/index.d.ts +5 -1
- package/dist/index.js +59 -55
- package/docs/README.md +56 -0
- package/docs/components/Alert.md +96 -0
- package/docs/components/Autocomplete.md +198 -0
- package/docs/components/Avatar.md +60 -0
- package/docs/components/Badge.md +47 -0
- package/docs/components/BaseField.md +126 -0
- package/docs/components/BridgeUIProvider.md +151 -0
- package/docs/components/Button.md +93 -0
- package/docs/components/Card.md +287 -0
- package/docs/components/Checkbox.md +87 -0
- package/docs/components/Divider.md +56 -0
- package/docs/components/Drawer.md +137 -0
- package/docs/components/FormControl.md +66 -0
- package/docs/components/FormField.md +71 -0
- package/docs/components/I18n.md +125 -0
- package/docs/components/Icon.md +88 -0
- package/docs/components/Label.md +31 -0
- package/docs/components/Link.md +71 -0
- package/docs/components/List.md +167 -0
- package/docs/components/Menu.md +97 -0
- package/docs/components/Modal.md +154 -0
- package/docs/components/NumberField.md +80 -0
- package/docs/components/OtpField.md +133 -0
- package/docs/components/PasswordField.md +82 -0
- package/docs/components/Progress.md +68 -0
- package/docs/components/Radio.md +91 -0
- package/docs/components/Select.md +181 -0
- package/docs/components/Skeleton.md +38 -0
- package/docs/components/Slider.md +140 -0
- package/docs/components/Snackbar.md +99 -0
- package/docs/components/Spinner.md +61 -0
- package/docs/components/Switch.md +72 -0
- package/docs/components/Tabs.md +207 -0
- package/docs/components/TextField.md +72 -0
- package/docs/components/Textarea.md +80 -0
- package/docs/components/Tooltip.md +125 -0
- package/docs/components/useBreakpoint.md +100 -0
- package/docs/components/useDialogAction.md +97 -0
- package/docs/components/useDrawerAction.md +75 -0
- package/docs/components/useModalAction.md +75 -0
- package/docs/components/useSnackbarAction.md +85 -0
- package/docs/examples/i18n-dictionary.ts +48 -0
- package/docs/examples/i18n-vue-i18n.ts +34 -0
- package/docs/examples/icon-fontawesome.ts +112 -0
- package/docs/examples/icon-heroicons.ts +57 -0
- package/docs/examples/icon-lucide.ts +57 -0
- package/docs/examples/icon-phosphor.ts +57 -0
- package/docs/examples/icon-tabler.ts +57 -0
- package/package.json +12 -5
- package/dist/Components/OtpField/OtpFieldLabel.js +0 -5
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# useDrawerAction
|
|
2
|
+
|
|
3
|
+
Imperative API to mount custom components inside `Drawer`. Requires `BridgeDrawerHost`.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { useDrawerAction } from "@bridge-ui/vue/Actions";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Mount `BridgeUIHosts` with the matching host (`BridgeDialogHost`, `BridgeDrawerHost`, `BridgeModalHost`, or `BridgeSnackbarHost`) inside `BridgeUIProvider`.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const drawer = useDrawerAction();
|
|
21
|
+
|
|
22
|
+
const id = drawer.open({
|
|
23
|
+
component: SettingsForm,
|
|
24
|
+
drawer: { size: "lg", placement: "right" },
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### open
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<Button v-on:click="openBasic">Open basic</Button>
|
|
32
|
+
|
|
33
|
+
<Button variant="outline" v-on:click="openWithOptions">
|
|
34
|
+
Open with drawer options
|
|
35
|
+
</Button>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### close / closeTop
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<Button
|
|
42
|
+
variant="outline"
|
|
43
|
+
:disabled="!lastId"
|
|
44
|
+
v-on:click="lastId && drawer.close(lastId)"
|
|
45
|
+
>
|
|
46
|
+
close(lastId)
|
|
47
|
+
</Button>
|
|
48
|
+
|
|
49
|
+
<Button variant="outline" v-on:click="drawer.closeTop()">
|
|
50
|
+
closeTop()
|
|
51
|
+
</Button>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Nested stack
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<Button v-on:click="openNested">Open nested example</Button>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
| Method | Description |
|
|
63
|
+
| ------------------- | ------------------------------ |
|
|
64
|
+
| `open(options)` | Push a drawer onto the stack |
|
|
65
|
+
| `close(id)` | Close a specific drawer |
|
|
66
|
+
| `closeTop()` | Close the topmost drawer |
|
|
67
|
+
| `isOpen(id)` | Whether an id is open |
|
|
68
|
+
| `update(id, patch)` | Update props or drawer options |
|
|
69
|
+
| `stackSize` | Current stack depth |
|
|
70
|
+
|
|
71
|
+
**open() options:** `component`, `props`, `drawer` (`size`, `placement`, `transition`, `persistent`), `onClose`, `onClosed`
|
|
72
|
+
|
|
73
|
+
## Related components
|
|
74
|
+
|
|
75
|
+
Drawer, useModalAction, BridgeUIProvider
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# useModalAction
|
|
2
|
+
|
|
3
|
+
Imperative API to mount custom components inside `Modal`. Requires `BridgeModalHost`.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { useModalAction } from "@bridge-ui/vue/Actions";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Mount `BridgeUIHosts` with the matching host (`BridgeDialogHost`, `BridgeModalHost`, or `BridgeSnackbarHost`) inside `BridgeUIProvider`.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const modal = useModalAction();
|
|
21
|
+
|
|
22
|
+
const id = modal.open({
|
|
23
|
+
component: SettingsForm,
|
|
24
|
+
modal: { size: "lg", title: "Settings" },
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### open
|
|
29
|
+
|
|
30
|
+
```vue
|
|
31
|
+
<Button v-on:click="openBasic">Open basic</Button>
|
|
32
|
+
|
|
33
|
+
<Button variant="outline" v-on:click="openWithOptions">
|
|
34
|
+
Open with modal options
|
|
35
|
+
</Button>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### close / closeTop
|
|
39
|
+
|
|
40
|
+
```vue
|
|
41
|
+
<Button
|
|
42
|
+
variant="outline"
|
|
43
|
+
:disabled="!lastId"
|
|
44
|
+
v-on:click="lastId && modal.close(lastId)"
|
|
45
|
+
>
|
|
46
|
+
close(lastId)
|
|
47
|
+
</Button>
|
|
48
|
+
|
|
49
|
+
<Button variant="outline" v-on:click="modal.closeTop()">
|
|
50
|
+
closeTop()
|
|
51
|
+
</Button>
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Nested stack
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<Button v-on:click="openNested">Open nested example</Button>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
| Method | Description |
|
|
63
|
+
| ------------------- | ----------------------------- |
|
|
64
|
+
| `open(options)` | Push a modal onto the stack |
|
|
65
|
+
| `close(id)` | Close a specific modal |
|
|
66
|
+
| `closeTop()` | Close the topmost modal |
|
|
67
|
+
| `isOpen(id)` | Whether an id is open |
|
|
68
|
+
| `update(id, patch)` | Update props or modal options |
|
|
69
|
+
| `stackSize` | Current stack depth |
|
|
70
|
+
|
|
71
|
+
**open() options:** `component`, `props`, `modal` (`size`, `transition`, `persistent`, `align`), `onClose`, `onClosed`
|
|
72
|
+
|
|
73
|
+
## Related components
|
|
74
|
+
|
|
75
|
+
Modal, useDialogAction, BridgeUIProvider
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# useSnackbarAction
|
|
2
|
+
|
|
3
|
+
Imperative API for toast notifications. Requires `BridgeSnackbarHost`.
|
|
4
|
+
|
|
5
|
+
## Import
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { useSnackbarAction } from "@bridge-ui/vue/Actions";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Prerequisites
|
|
12
|
+
|
|
13
|
+
Mount `BridgeUIHosts` with the matching host (`BridgeDialogHost`, `BridgeModalHost`, or `BridgeSnackbarHost`) inside `BridgeUIProvider`.
|
|
14
|
+
|
|
15
|
+
## Examples
|
|
16
|
+
|
|
17
|
+
### Usage
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
const snackbar = useSnackbarAction();
|
|
21
|
+
|
|
22
|
+
snackbar.open({
|
|
23
|
+
title: "Saved",
|
|
24
|
+
color: "success",
|
|
25
|
+
description: "Your changes were saved successfully.",
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### open
|
|
30
|
+
|
|
31
|
+
```vue
|
|
32
|
+
<Button v-on:click="openBasic">Open basic</Button>
|
|
33
|
+
|
|
34
|
+
<Button variant="outline" v-on:click="openWithOptions">
|
|
35
|
+
Open with options
|
|
36
|
+
</Button>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### close / closeAll
|
|
40
|
+
|
|
41
|
+
```vue
|
|
42
|
+
<Button variant="outline" v-on:click="snackbar.closeTop()">
|
|
43
|
+
closeTop()
|
|
44
|
+
</Button>
|
|
45
|
+
|
|
46
|
+
<Button variant="outline" v-on:click="snackbar.closeAll()">
|
|
47
|
+
closeAll()
|
|
48
|
+
</Button>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### update
|
|
52
|
+
|
|
53
|
+
```vue
|
|
54
|
+
<Button v-on:click="openUpdateDemo">Open update demo</Button>
|
|
55
|
+
|
|
56
|
+
<Button
|
|
57
|
+
variant="outline"
|
|
58
|
+
:disabled="!updateDemoId"
|
|
59
|
+
v-on:click="
|
|
60
|
+
snackbar.update(updateDemoId, {
|
|
61
|
+
props: { title: 'Updated title' },
|
|
62
|
+
})
|
|
63
|
+
"
|
|
64
|
+
>
|
|
65
|
+
update props
|
|
66
|
+
</Button>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
| Method | Description |
|
|
72
|
+
| ------------------- | ------------------------------ |
|
|
73
|
+
| `open(options)` | Push a snackbar onto the stack |
|
|
74
|
+
| `close(id)` | Close a specific snackbar |
|
|
75
|
+
| `closeTop()` | Close the topmost snackbar |
|
|
76
|
+
| `closeAll()` | Close all snackbars |
|
|
77
|
+
| `isOpen(id)` | Whether an id is open |
|
|
78
|
+
| `update(id, patch)` | Update snackbar props |
|
|
79
|
+
| `stackSize` | Current stack depth |
|
|
80
|
+
|
|
81
|
+
**open() options:** `title`, `description`, `color`, `duration`, `position`, `onClose`, `onClosed`
|
|
82
|
+
|
|
83
|
+
## Related components
|
|
84
|
+
|
|
85
|
+
Snackbar, Alert, BridgeUIProvider
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example dictionary i18n adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.i18n`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*
|
|
6
|
+
* Source English strings are the lookup keys (same strings Bridge passes to
|
|
7
|
+
* `resolveMessage`). Messages are keyed by locale; optional `setLocale` updates
|
|
8
|
+
* the active locale used by `t`. For replace / pluralization, wrap vue-i18n (or
|
|
9
|
+
* similar) instead.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// ** External Imports
|
|
13
|
+
import { get } from "es-toolkit/compat";
|
|
14
|
+
|
|
15
|
+
// ** Core Imports
|
|
16
|
+
import type { I18nAdapter } from "@bridge-ui/core";
|
|
17
|
+
|
|
18
|
+
// prettier-ignore
|
|
19
|
+
const MESSAGES: Record<string, Record<string, string>> = {
|
|
20
|
+
"en-US": {},
|
|
21
|
+
"pt-BR": {
|
|
22
|
+
"Close": "Fechar",
|
|
23
|
+
"Loading...": "Carregando...",
|
|
24
|
+
"No options": "Nenhuma opção",
|
|
25
|
+
"Hide password": "Ocultar senha",
|
|
26
|
+
"Show password": "Mostrar senha",
|
|
27
|
+
"Clear selection": "Limpar seleção",
|
|
28
|
+
"Decrement value": "Diminuir valor",
|
|
29
|
+
"Increment value": "Aumentar valor",
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Builds a locale-keyed dictionary {@link I18nAdapter} for Bridge chrome strings.
|
|
35
|
+
* Unknown locales / messages fall back to the English source string.
|
|
36
|
+
*/
|
|
37
|
+
export function createDictionaryI18nAdapter(): I18nAdapter {
|
|
38
|
+
let locale = "en-US";
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
setLocale(next) {
|
|
42
|
+
locale = next;
|
|
43
|
+
},
|
|
44
|
+
t(message) {
|
|
45
|
+
return get(MESSAGES, [locale, message], message);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example vue-i18n adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.i18n`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*
|
|
6
|
+
* Passes Bridge source strings and `params` straight to `i18n.t`
|
|
7
|
+
* (interpolation, pluralization, etc. stay in vue-i18n).
|
|
8
|
+
* `setLocale` on the adapter is invoked by Bridge `setLocale`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
// ** External Imports
|
|
12
|
+
import type { Composer } from "vue-i18n";
|
|
13
|
+
|
|
14
|
+
// ** Core Imports
|
|
15
|
+
import type { I18nAdapter } from "@bridge-ui/core";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Builds a vue-i18n-backed {@link I18nAdapter} for Bridge chrome strings.
|
|
19
|
+
* Pass `vueI18n.global` (composition mode) or the result of `useI18n()`.
|
|
20
|
+
*/
|
|
21
|
+
export function createVueI18nAdapter(i18n: Composer): I18nAdapter {
|
|
22
|
+
return {
|
|
23
|
+
setLocale(locale) {
|
|
24
|
+
i18n.locale.value = locale;
|
|
25
|
+
},
|
|
26
|
+
t(message, params) {
|
|
27
|
+
if (params) {
|
|
28
|
+
return i18n.t(message, params);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return i18n.t(message);
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Font Awesome 6 (free solid) adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.icons`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*
|
|
6
|
+
* Font Awesome exports icon definitions, not SVG components. This adapter
|
|
7
|
+
* `normalize`s them so `<Icon :icon="faCoffee" />` works without a manual wrap.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ** External Imports
|
|
11
|
+
import type { IconDefinition } from "@fortawesome/fontawesome-svg-core";
|
|
12
|
+
import {
|
|
13
|
+
faBell,
|
|
14
|
+
faCheck,
|
|
15
|
+
faChevronDown,
|
|
16
|
+
faChevronUp,
|
|
17
|
+
faCircleCheck,
|
|
18
|
+
faCircleExclamation,
|
|
19
|
+
faCircleInfo,
|
|
20
|
+
faCircleXmark,
|
|
21
|
+
faEye,
|
|
22
|
+
faEyeSlash,
|
|
23
|
+
faSpinner,
|
|
24
|
+
faTriangleExclamation,
|
|
25
|
+
faUpDown,
|
|
26
|
+
faUser,
|
|
27
|
+
faXmark,
|
|
28
|
+
} from "@fortawesome/free-solid-svg-icons";
|
|
29
|
+
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
|
|
30
|
+
import { get, isArray, isObject, isString } from "es-toolkit/compat";
|
|
31
|
+
import { defineComponent, h, type Component } from "vue";
|
|
32
|
+
|
|
33
|
+
// ** Core Imports
|
|
34
|
+
import type { IconAdapter, SemanticIconName } from "@bridge-ui/core";
|
|
35
|
+
|
|
36
|
+
declare module "@bridge-ui/core" {
|
|
37
|
+
interface IconSourceValueOverrides {
|
|
38
|
+
fontAwesome: IconDefinition;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const faIconCache = new WeakMap<IconDefinition, Component>();
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Returns whether `value` looks like a Font Awesome {@link IconDefinition}.
|
|
46
|
+
*/
|
|
47
|
+
function isIconDefinition(value: unknown): value is IconDefinition {
|
|
48
|
+
return (
|
|
49
|
+
isObject(value) &&
|
|
50
|
+
isArray((value as IconDefinition).icon) &&
|
|
51
|
+
isString((value as IconDefinition).prefix) &&
|
|
52
|
+
isString((value as IconDefinition).iconName)
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Wraps a Font Awesome icon definition as a Vue SVG component.
|
|
58
|
+
* Prefer `<Icon :icon="faCoffee" />` with this adapter — `normalize` calls this.
|
|
59
|
+
* Results are cached so repeated resolves keep a stable component identity.
|
|
60
|
+
*/
|
|
61
|
+
export function wrapFaIcon(icon: IconDefinition): Component {
|
|
62
|
+
const cached = faIconCache.get(icon);
|
|
63
|
+
|
|
64
|
+
if (cached) {
|
|
65
|
+
return cached;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const FaIcon = defineComponent({
|
|
69
|
+
inheritAttrs: false,
|
|
70
|
+
name: `FaIcon(${icon.iconName})`,
|
|
71
|
+
setup(_, { attrs }) {
|
|
72
|
+
return () => h(FontAwesomeIcon, { ...attrs, icon });
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
faIconCache.set(icon, FaIcon);
|
|
77
|
+
|
|
78
|
+
return FaIcon;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const icons = {
|
|
82
|
+
eye: faEye,
|
|
83
|
+
bell: faBell,
|
|
84
|
+
user: faUser,
|
|
85
|
+
clear: faXmark,
|
|
86
|
+
check: faCheck,
|
|
87
|
+
loader: faSpinner,
|
|
88
|
+
info: faCircleInfo,
|
|
89
|
+
eyeOff: faEyeSlash,
|
|
90
|
+
error: faCircleXmark,
|
|
91
|
+
success: faCircleCheck,
|
|
92
|
+
chevronUp: faChevronUp,
|
|
93
|
+
chevronUpDown: faUpDown,
|
|
94
|
+
alert: faCircleExclamation,
|
|
95
|
+
chevronDown: faChevronDown,
|
|
96
|
+
warning: faTriangleExclamation,
|
|
97
|
+
} satisfies Record<SemanticIconName, unknown>;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Builds a Font Awesome-backed {@link IconAdapter} for Bridge semantic icon names.
|
|
101
|
+
* Pass raw `fa*` definitions to `<Icon />` — they are normalized automatically.
|
|
102
|
+
*/
|
|
103
|
+
export function createFontAwesomeIconAdapter(): IconAdapter {
|
|
104
|
+
return {
|
|
105
|
+
resolve(name) {
|
|
106
|
+
return get(icons, name);
|
|
107
|
+
},
|
|
108
|
+
normalize(source) {
|
|
109
|
+
return isIconDefinition(source) ? wrapFaIcon(source) : source;
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Heroicons adapter for `@bridge-ui/vue` (24px outline).
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.icons`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ** External Imports
|
|
8
|
+
import {
|
|
9
|
+
ArrowPathIcon,
|
|
10
|
+
BellIcon,
|
|
11
|
+
CheckCircleIcon,
|
|
12
|
+
CheckIcon,
|
|
13
|
+
ChevronDownIcon,
|
|
14
|
+
ChevronUpDownIcon,
|
|
15
|
+
ChevronUpIcon,
|
|
16
|
+
ExclamationCircleIcon,
|
|
17
|
+
ExclamationTriangleIcon,
|
|
18
|
+
EyeIcon,
|
|
19
|
+
EyeSlashIcon,
|
|
20
|
+
InformationCircleIcon,
|
|
21
|
+
UserIcon,
|
|
22
|
+
XCircleIcon,
|
|
23
|
+
XMarkIcon,
|
|
24
|
+
} from "@heroicons/vue/24/outline";
|
|
25
|
+
import { get } from "es-toolkit/compat";
|
|
26
|
+
|
|
27
|
+
// ** Core Imports
|
|
28
|
+
import type { IconAdapter, SemanticIconName } from "@bridge-ui/core";
|
|
29
|
+
|
|
30
|
+
const icons = {
|
|
31
|
+
eye: EyeIcon,
|
|
32
|
+
bell: BellIcon,
|
|
33
|
+
user: UserIcon,
|
|
34
|
+
clear: XMarkIcon,
|
|
35
|
+
check: CheckIcon,
|
|
36
|
+
error: XCircleIcon,
|
|
37
|
+
eyeOff: EyeSlashIcon,
|
|
38
|
+
loader: ArrowPathIcon,
|
|
39
|
+
success: CheckCircleIcon,
|
|
40
|
+
chevronUp: ChevronUpIcon,
|
|
41
|
+
info: InformationCircleIcon,
|
|
42
|
+
alert: ExclamationCircleIcon,
|
|
43
|
+
chevronDown: ChevronDownIcon,
|
|
44
|
+
warning: ExclamationTriangleIcon,
|
|
45
|
+
chevronUpDown: ChevronUpDownIcon,
|
|
46
|
+
} satisfies Record<SemanticIconName, unknown>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds a Heroicons-backed {@link IconAdapter} for Bridge semantic icon names.
|
|
50
|
+
*/
|
|
51
|
+
export function createHeroiconsIconAdapter(): IconAdapter {
|
|
52
|
+
return {
|
|
53
|
+
resolve(name) {
|
|
54
|
+
return get(icons, name);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Lucide icon adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.icons`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ** External Imports
|
|
8
|
+
import {
|
|
9
|
+
Bell,
|
|
10
|
+
Check,
|
|
11
|
+
ChevronDown,
|
|
12
|
+
ChevronsUpDown,
|
|
13
|
+
ChevronUp,
|
|
14
|
+
CircleAlert,
|
|
15
|
+
CircleCheck,
|
|
16
|
+
CircleX,
|
|
17
|
+
Eye,
|
|
18
|
+
EyeOff,
|
|
19
|
+
Info,
|
|
20
|
+
Loader2,
|
|
21
|
+
TriangleAlert,
|
|
22
|
+
User,
|
|
23
|
+
X,
|
|
24
|
+
} from "@lucide/vue";
|
|
25
|
+
import { get } from "es-toolkit/compat";
|
|
26
|
+
|
|
27
|
+
// ** Core Imports
|
|
28
|
+
import type { IconAdapter, SemanticIconName } from "@bridge-ui/core";
|
|
29
|
+
|
|
30
|
+
const icons = {
|
|
31
|
+
eye: Eye,
|
|
32
|
+
clear: X,
|
|
33
|
+
bell: Bell,
|
|
34
|
+
info: Info,
|
|
35
|
+
user: User,
|
|
36
|
+
check: Check,
|
|
37
|
+
error: CircleX,
|
|
38
|
+
eyeOff: EyeOff,
|
|
39
|
+
loader: Loader2,
|
|
40
|
+
alert: CircleAlert,
|
|
41
|
+
success: CircleCheck,
|
|
42
|
+
chevronUp: ChevronUp,
|
|
43
|
+
warning: TriangleAlert,
|
|
44
|
+
chevronDown: ChevronDown,
|
|
45
|
+
chevronUpDown: ChevronsUpDown,
|
|
46
|
+
} satisfies Record<SemanticIconName, unknown>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds a Lucide-backed {@link IconAdapter} for Bridge semantic icon names.
|
|
50
|
+
*/
|
|
51
|
+
export function createLucideIconAdapter(): IconAdapter {
|
|
52
|
+
return {
|
|
53
|
+
resolve(name) {
|
|
54
|
+
return get(icons, name);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Phosphor Icons adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.icons`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ** External Imports
|
|
8
|
+
import {
|
|
9
|
+
PhBell,
|
|
10
|
+
PhCaretDown,
|
|
11
|
+
PhCaretUp,
|
|
12
|
+
PhCaretUpDown,
|
|
13
|
+
PhCheck,
|
|
14
|
+
PhCheckCircle,
|
|
15
|
+
PhEye,
|
|
16
|
+
PhEyeSlash,
|
|
17
|
+
PhInfo,
|
|
18
|
+
PhSpinnerGap,
|
|
19
|
+
PhUser,
|
|
20
|
+
PhWarning,
|
|
21
|
+
PhWarningCircle,
|
|
22
|
+
PhX,
|
|
23
|
+
PhXCircle,
|
|
24
|
+
} from "@phosphor-icons/vue";
|
|
25
|
+
import { get } from "es-toolkit/compat";
|
|
26
|
+
|
|
27
|
+
// ** Core Imports
|
|
28
|
+
import type { IconAdapter, SemanticIconName } from "@bridge-ui/core";
|
|
29
|
+
|
|
30
|
+
const icons = {
|
|
31
|
+
eye: PhEye,
|
|
32
|
+
clear: PhX,
|
|
33
|
+
bell: PhBell,
|
|
34
|
+
info: PhInfo,
|
|
35
|
+
user: PhUser,
|
|
36
|
+
check: PhCheck,
|
|
37
|
+
error: PhXCircle,
|
|
38
|
+
eyeOff: PhEyeSlash,
|
|
39
|
+
warning: PhWarning,
|
|
40
|
+
loader: PhSpinnerGap,
|
|
41
|
+
chevronUp: PhCaretUp,
|
|
42
|
+
alert: PhWarningCircle,
|
|
43
|
+
success: PhCheckCircle,
|
|
44
|
+
chevronDown: PhCaretDown,
|
|
45
|
+
chevronUpDown: PhCaretUpDown,
|
|
46
|
+
} satisfies Record<SemanticIconName, unknown>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds a Phosphor-backed {@link IconAdapter} for Bridge semantic icon names.
|
|
50
|
+
*/
|
|
51
|
+
export function createPhosphorIconAdapter(): IconAdapter {
|
|
52
|
+
return {
|
|
53
|
+
resolve(name) {
|
|
54
|
+
return get(icons, name);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Tabler Icons adapter for `@bridge-ui/vue`.
|
|
3
|
+
* Copy into your app or wire via `BridgeUIProvider` / `createBridgeUI` `global.icons`.
|
|
4
|
+
* Not published as an npm package.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ** External Imports
|
|
8
|
+
import {
|
|
9
|
+
IconAlertCircle,
|
|
10
|
+
IconAlertTriangle,
|
|
11
|
+
IconBell,
|
|
12
|
+
IconCheck,
|
|
13
|
+
IconChevronDown,
|
|
14
|
+
IconChevronUp,
|
|
15
|
+
IconCircleCheck,
|
|
16
|
+
IconCircleX,
|
|
17
|
+
IconEye,
|
|
18
|
+
IconEyeOff,
|
|
19
|
+
IconInfoCircle,
|
|
20
|
+
IconLoader2,
|
|
21
|
+
IconSelector,
|
|
22
|
+
IconUser,
|
|
23
|
+
IconX,
|
|
24
|
+
} from "@tabler/icons-vue";
|
|
25
|
+
import { get } from "es-toolkit/compat";
|
|
26
|
+
|
|
27
|
+
// ** Core Imports
|
|
28
|
+
import type { IconAdapter, SemanticIconName } from "@bridge-ui/core";
|
|
29
|
+
|
|
30
|
+
const icons = {
|
|
31
|
+
eye: IconEye,
|
|
32
|
+
clear: IconX,
|
|
33
|
+
bell: IconBell,
|
|
34
|
+
user: IconUser,
|
|
35
|
+
check: IconCheck,
|
|
36
|
+
error: IconCircleX,
|
|
37
|
+
eyeOff: IconEyeOff,
|
|
38
|
+
loader: IconLoader2,
|
|
39
|
+
info: IconInfoCircle,
|
|
40
|
+
alert: IconAlertCircle,
|
|
41
|
+
success: IconCircleCheck,
|
|
42
|
+
chevronUp: IconChevronUp,
|
|
43
|
+
warning: IconAlertTriangle,
|
|
44
|
+
chevronUpDown: IconSelector,
|
|
45
|
+
chevronDown: IconChevronDown,
|
|
46
|
+
} satisfies Record<SemanticIconName, unknown>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Builds a Tabler-backed {@link IconAdapter} for Bridge semantic icon names.
|
|
50
|
+
*/
|
|
51
|
+
export function createTablerIconAdapter(): IconAdapter {
|
|
52
|
+
return {
|
|
53
|
+
resolve(name) {
|
|
54
|
+
return get(icons, name);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.8",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -66,16 +66,24 @@
|
|
|
66
66
|
"style": "./dist/theme.css",
|
|
67
67
|
"import": "./dist/theme.css",
|
|
68
68
|
"default": "./dist/theme.css"
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"./ai/*": "./ai/*",
|
|
71
|
+
"./docs/*": "./docs/*"
|
|
72
|
+
},
|
|
73
|
+
"bin": {
|
|
74
|
+
"bridge-ui-vue-ai": "./bin/ai.mjs"
|
|
70
75
|
},
|
|
71
76
|
"files": [
|
|
72
|
-
"
|
|
77
|
+
"ai",
|
|
78
|
+
"bin",
|
|
79
|
+
"dist",
|
|
80
|
+
"docs"
|
|
73
81
|
],
|
|
74
82
|
"peerDependencies": {
|
|
75
|
-
"@bridge-ui/core": "^0.0.7",
|
|
76
83
|
"vue": "^3.4.0"
|
|
77
84
|
},
|
|
78
85
|
"dependencies": {
|
|
86
|
+
"@bridge-ui/core": "^0.0.8",
|
|
79
87
|
"clsx": "^2.1.1",
|
|
80
88
|
"es-toolkit": "^1.46.1",
|
|
81
89
|
"tailwind-merge": "^3.6.0"
|
|
@@ -90,7 +98,6 @@
|
|
|
90
98
|
"test:cy:open": "cypress open --component"
|
|
91
99
|
},
|
|
92
100
|
"devDependencies": {
|
|
93
|
-
"@bridge-ui/core": "*",
|
|
94
101
|
"@fortawesome/fontawesome-svg-core": "^7.3.1",
|
|
95
102
|
"@fortawesome/free-solid-svg-icons": "^7.3.1",
|
|
96
103
|
"@fortawesome/vue-fontawesome": "^3.3.3",
|