@xplortech/apollo-vue 2.8.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/README.md +133 -0
- package/css/apollo.css +12909 -0
- package/dist/components.d.ts +71 -0
- package/dist/components.js +705 -0
- package/dist/components.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +2 -0
- package/dist/plugin.js +13 -0
- package/dist/plugin.js.map +1 -0
- package/license +21 -0
- package/package.json +87 -0
package/README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Apollo Vue
|
|
2
|
+
|
|
3
|
+
Vue 3 bindings for the Apollo design system (`@xplortech/apollo-core` web components). Use this package in Vue apps for props, events, and `v-model` on form controls.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Published as **`@xplortech/apollo-vue`** on the public npm registry (same scope as `@xplortech/apollo-core` and `@xplortech/apollo-react`).
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @xplortech/apollo-vue @xplortech/apollo-core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Peer dependencies: **Vue 3+** and **TypeScript 5+**.
|
|
14
|
+
|
|
15
|
+
Import styles once in your app (path may vary with your bundler):
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import '@xplortech/apollo-vue/css/apollo.css';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Registering components
|
|
22
|
+
|
|
23
|
+
### Option A — global plugin (registers custom elements)
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { createApp } from 'vue';
|
|
27
|
+
import { ComponentLibrary } from '@xplortech/apollo-vue';
|
|
28
|
+
import App from './App.vue';
|
|
29
|
+
|
|
30
|
+
const app = createApp(App);
|
|
31
|
+
app.use(ComponentLibrary);
|
|
32
|
+
app.mount('#app');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Option B — import only what you use
|
|
36
|
+
|
|
37
|
+
```vue
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { XplButton, XplInput } from '@xplortech/apollo-vue';
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<XplButton variant="primary">Save</XplButton>
|
|
44
|
+
<XplInput v-model="email" label="Email" type="email" />
|
|
45
|
+
</template>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Importing from `@xplortech/apollo-vue` loads the generated proxies, which call `defineCustomElements()` from `@xplortech/apollo-core/loader`.
|
|
49
|
+
|
|
50
|
+
## `v-model` (form components)
|
|
51
|
+
|
|
52
|
+
These wrappers map `v-model` to the correct property and update event:
|
|
53
|
+
|
|
54
|
+
| Component | `v-model` binds to | Update event (internal) |
|
|
55
|
+
|---------------|--------------------|-------------------------|
|
|
56
|
+
| `XplInput` | `value` | `valueChange` |
|
|
57
|
+
| `XplCheckbox` | `checked` | `checkboxChange` | *|
|
|
58
|
+
| `XplRadio` | `checked` | `radioChange` |
|
|
59
|
+
| `XplToggle` | `checked` | `toggleChange` |
|
|
60
|
+
| `XplSelect` | `selectedValues` | `changeEvent` |
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
|
|
64
|
+
```vue
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { ref } from 'vue';
|
|
67
|
+
import { XplInput, XplCheckbox, XplSelect } from '@xplortech/apollo-vue';
|
|
68
|
+
|
|
69
|
+
const name = ref('');
|
|
70
|
+
const agreed = ref(false);
|
|
71
|
+
const selected = ref<string | string[]>([]);
|
|
72
|
+
</script>
|
|
73
|
+
|
|
74
|
+
<template>
|
|
75
|
+
<XplInput v-model="name" label="Name" />
|
|
76
|
+
<XplCheckbox v-model="agreed" label="I agree" />
|
|
77
|
+
<XplSelect
|
|
78
|
+
v-model="selected"
|
|
79
|
+
label="Choose"
|
|
80
|
+
:choices="[]"
|
|
81
|
+
placeholder="Select…"
|
|
82
|
+
/>
|
|
83
|
+
</template>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
_* `XplCheckbox` `v-model` binds to `checked`. When no `value` prop is set, it emits a **boolean** (checked state). When `value` is also set, it emits the **string** `value` when checked. Type your ref accordingly._
|
|
87
|
+
|
|
88
|
+
**`XplChoicelist`:** there is no `v-model` mapping yet; use `@choicelistChange` / `@choicelistValueChange` and props manually.
|
|
89
|
+
|
|
90
|
+
**Specialized input types:** `<XplInput type="date" />`, `type="time"`, `type="phone"`, `type="color"`, and `type="file"` all work with `v-model`. Internally, `xpl-input` renders a sub-component (e.g. `xpl-input-date`) and forwards its events. Prefer `<XplInput type="date" v-model="val" />` over using `XplInputDate` directly.
|
|
91
|
+
|
|
92
|
+
## Events and complex props
|
|
93
|
+
|
|
94
|
+
Stencil `@Event()` names are exposed as Vue emits (e.g. `@valueChange`, `@checkboxChange`). Pass objects and arrays as props the same way as with other Vue components:
|
|
95
|
+
|
|
96
|
+
```vue
|
|
97
|
+
<script setup lang="ts">
|
|
98
|
+
import { XplTable } from '@xplortech/apollo-vue';
|
|
99
|
+
const rows = [[]];
|
|
100
|
+
const cols = [];
|
|
101
|
+
function onSelect() {}
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
<template>
|
|
105
|
+
<XplTable :data="rows" :columns="cols" @table-select="onSelect" />
|
|
106
|
+
</template>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Suppressing unknown-element warnings
|
|
110
|
+
|
|
111
|
+
If your bundler warns about `xpl-*` tags as unknown custom elements, tell the Vue compiler to treat them as web components:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
// vite.config.ts
|
|
115
|
+
import vue from '@vitejs/plugin-vue';
|
|
116
|
+
|
|
117
|
+
export default {
|
|
118
|
+
plugins: [
|
|
119
|
+
vue({
|
|
120
|
+
template: {
|
|
121
|
+
compilerOptions: {
|
|
122
|
+
isCustomElement: (tag) => tag.startsWith('xpl-'),
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
}),
|
|
126
|
+
],
|
|
127
|
+
};
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Further reading
|
|
131
|
+
|
|
132
|
+
- [Apollo repo](https://github.com/xplor/apollo)
|
|
133
|
+
- Core components and behavior: `@xplortech/apollo-core` / Storybook in this monorepo
|