@bcc-code/component-library-vue 0.1.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 +140 -0
- package/dist/component-library.js +71064 -0
- package/dist/component-library.umd.cjs +11733 -0
- package/dist/index.css +1 -0
- package/dist/theme.css +2337 -0
- package/dist-types/components/custom/BccAvatar/BccAvatar.vue.d.ts +19 -0
- package/dist-types/components/custom/BccBadge/BccBadge.vue.d.ts +32 -0
- package/dist-types/components/custom/BccCapacityIndicator/BccCapacityIndicator.vue.d.ts +23 -0
- package/dist-types/components/custom/BccCircleLoader/BccCircleLoader.vue.d.ts +3 -0
- package/dist-types/components/custom/BccDialKnob/BccDialKnob.vue.d.ts +64 -0
- package/dist-types/components/custom/BccFrame/BccFrame.vue.d.ts +39 -0
- package/dist-types/components/custom/BccGraphic/BccGraphic.vue.d.ts +47 -0
- package/dist-types/components/custom/BccNpsResult/BccNpsResult.vue.d.ts +21 -0
- package/dist-types/components/custom/BccNpsScore/BccNpsScore.vue.d.ts +36 -0
- package/dist-types/components/custom/BccReact/BccReact.vue.d.ts +11 -0
- package/dist-types/components/custom/BccReact/BccReactEmoji.vue.d.ts +4 -0
- package/dist-types/components/custom/BccReact/types.d.ts +18 -0
- package/dist-types/components/custom/BccTag/BccTag.vue.d.ts +27 -0
- package/dist-types/components/custom/BccToggle/BccToggle.vue.d.ts +19 -0
- package/dist-types/components/custom/index.d.ts +28 -0
- package/dist-types/components/wrapped/BccButton.vue.d.ts +20 -0
- package/dist-types/components/wrapped/BccCheckbox.vue.d.ts +17 -0
- package/dist-types/components/wrapped/BccInput.vue.d.ts +48 -0
- package/dist-types/components/wrapped/BccMessage.vue.d.ts +19 -0
- package/dist-types/components/wrapped/BccTabs.vue.d.ts +37 -0
- package/dist-types/components/wrapped/BccToggleButton.vue.d.ts +21 -0
- package/dist-types/components/wrapped/index.d.ts +16 -0
- package/dist-types/composables/animatedNumber.d.ts +4 -0
- package/dist-types/contexts.d.ts +52 -0
- package/dist-types/index.d.ts +146 -0
- package/dist-types/setup.d.ts +2 -0
- package/dist-types/types.d.ts +2 -0
- package/package.json +96 -0
package/README.md
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# @bcc-code/component-library-vue
|
|
2
|
+
|
|
3
|
+
Vue 3 component library built on [PrimeVue](https://primevue.org/) and BCC design tokens. You only need this package—no separate Tailwind or PrimeVue install.
|
|
4
|
+
|
|
5
|
+
## View on with [Storybook](https://components.bcc.no)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @bcc-code/component-library-vue
|
|
11
|
+
# or
|
|
12
|
+
npm install @bcc-code/component-library-vue
|
|
13
|
+
# or
|
|
14
|
+
yarn add @bcc-code/component-library-vue
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Peer dependency:** Vue 3.
|
|
18
|
+
|
|
19
|
+
## Quick start
|
|
20
|
+
|
|
21
|
+
1. **Register the library** in your app (e.g. `main.ts`):
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createApp } from 'vue';
|
|
25
|
+
import App from './App.vue';
|
|
26
|
+
import { BccComponentLibrary } from '@bcc-code/component-library-vue';
|
|
27
|
+
|
|
28
|
+
const app = createApp(App);
|
|
29
|
+
app.use(BccComponentLibrary);
|
|
30
|
+
app.mount('#app');
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
2. **Add styles** using one of the two options below.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Styling: two options
|
|
38
|
+
|
|
39
|
+
### Option 1 — Recommended: full Tailwind in your app
|
|
40
|
+
|
|
41
|
+
Use this if you want Tailwind utility classes in your own templates and only ship the classes you use (tree-shaking).
|
|
42
|
+
|
|
43
|
+
1. **Add the Tailwind Vite plugin** (the package brings Tailwind in as a dependency; you only wire it up):
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
// vite.config.ts
|
|
47
|
+
import tailwindcss from '@tailwindcss/vite';
|
|
48
|
+
|
|
49
|
+
export default defineConfig({
|
|
50
|
+
plugins: [vue(), tailwindcss()],
|
|
51
|
+
// ...
|
|
52
|
+
});
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
2. **Import the theme in your main CSS file** (e.g. `src/main.css` or `src/assets/main.css`):
|
|
56
|
+
|
|
57
|
+
```css
|
|
58
|
+
@import '@bcc-code/component-library-vue/theme.css';
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Tailwind will run as part of your build and only include the utility classes that appear in your app and in the library.
|
|
62
|
+
|
|
63
|
+
### Option 2 — Pre-built CSS only
|
|
64
|
+
|
|
65
|
+
Use this if you don’t want Tailwind in your project and only need the library’s styles and components.
|
|
66
|
+
|
|
67
|
+
In your entry file (e.g. `main.ts`), before mounting the app:
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import '@bcc-code/component-library-vue/style.css';
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
You get the BCC theme and component styles only; no Tailwind utilities in your app.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Using components
|
|
78
|
+
|
|
79
|
+
All components are namespaced with `Bcc`. Use them in templates or register them globally after `app.use(BccComponentLibrary)`.
|
|
80
|
+
|
|
81
|
+
**Example:**
|
|
82
|
+
|
|
83
|
+
```vue
|
|
84
|
+
<template>
|
|
85
|
+
<div class="flex gap-4 p-4">
|
|
86
|
+
<BccButton label="Save" />
|
|
87
|
+
<BccInput v-model="name" placeholder="Name" />
|
|
88
|
+
</div>
|
|
89
|
+
</template>
|
|
90
|
+
|
|
91
|
+
<script setup lang="ts">
|
|
92
|
+
import { BccButton, BccInput } from '@bcc-code/component-library-vue';
|
|
93
|
+
import { ref } from 'vue';
|
|
94
|
+
|
|
95
|
+
const name = ref('');
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
# Setup
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
// main.ts
|
|
103
|
+
import { BccComponentLibrary } from '@bcc-code/component-library-vue';
|
|
104
|
+
|
|
105
|
+
const app = createApp(…)
|
|
106
|
+
BccComponentLibrary(app);
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```css
|
|
110
|
+
/* styles.css */
|
|
111
|
+
@import '@bcc-code/component-library-vue/theme.css';
|
|
112
|
+
|
|
113
|
+
/* Optional include the archivo font */
|
|
114
|
+
@import '@bcc-code/component-library-vue/archivo-font.css';
|
|
115
|
+
font-family:
|
|
116
|
+
Archivo,
|
|
117
|
+
system-ui,
|
|
118
|
+
-apple-system,
|
|
119
|
+
BlinkMacSystemFont,
|
|
120
|
+
'Segoe UI',
|
|
121
|
+
'Open Sans',
|
|
122
|
+
sans-serif;
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The library exports both **custom BCC components** (e.g. `BccBadge`, `BccFrame`, `BccReact`) and **wrapped PrimeVue components** (e.g. `BccButton`, `BccDialog`, `BccDataTable`). PrimeVue services (Toast, Confirm, Dialog) are configured by `BccComponentLibrary`; use the composables `useToast`, `useConfirm`, and `useDialog` from the library when you need them.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
pnpm install
|
|
133
|
+
pnpm run start # Storybook on port 6006
|
|
134
|
+
pnpm run build # Typecheck, types, and Vite build
|
|
135
|
+
pnpm run build:vite # Vite build only (includes theme.css)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## License
|
|
139
|
+
|
|
140
|
+
Apache-2.0
|