@bcc-code/component-library-vue 0.0.0-dev.5cf5377

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.
Files changed (33) hide show
  1. package/README.md +184 -0
  2. package/dist/component-library.js +69546 -0
  3. package/dist/component-library.umd.cjs +11694 -0
  4. package/dist/index.css +1 -0
  5. package/dist/theme.css +2404 -0
  6. package/dist-types/components/custom/BccAvatar/BccAvatar.vue.d.ts +19 -0
  7. package/dist-types/components/custom/BccBadge/BccBadge.vue.d.ts +32 -0
  8. package/dist-types/components/custom/BccCapacityIndicator/BccCapacityIndicator.vue.d.ts +23 -0
  9. package/dist-types/components/custom/BccCircleLoader/BccCircleLoader.vue.d.ts +3 -0
  10. package/dist-types/components/custom/BccDialKnob/BccDialKnob.vue.d.ts +64 -0
  11. package/dist-types/components/custom/BccFrame/BccFrame.vue.d.ts +39 -0
  12. package/dist-types/components/custom/BccGraphic/BccGraphic.vue.d.ts +47 -0
  13. package/dist-types/components/custom/BccNpsResult/BccNpsResult.vue.d.ts +21 -0
  14. package/dist-types/components/custom/BccNpsScore/BccNpsScore.vue.d.ts +36 -0
  15. package/dist-types/components/custom/BccReact/BccReact.vue.d.ts +11 -0
  16. package/dist-types/components/custom/BccReact/BccReactEmoji.vue.d.ts +4 -0
  17. package/dist-types/components/custom/BccReact/types.d.ts +18 -0
  18. package/dist-types/components/custom/BccTabs/BccTabs.vue.d.ts +38 -0
  19. package/dist-types/components/custom/BccTag/BccTag.vue.d.ts +27 -0
  20. package/dist-types/components/custom/BccToggle/BccToggle.vue.d.ts +19 -0
  21. package/dist-types/components/custom/index.d.ts +30 -0
  22. package/dist-types/components/wrapped/BccButton.vue.d.ts +21 -0
  23. package/dist-types/components/wrapped/BccCheckbox.vue.d.ts +17 -0
  24. package/dist-types/components/wrapped/BccInput.vue.d.ts +48 -0
  25. package/dist-types/components/wrapped/BccMessage.vue.d.ts +19 -0
  26. package/dist-types/components/wrapped/BccToggleButton.vue.d.ts +21 -0
  27. package/dist-types/components/wrapped/index.d.ts +14 -0
  28. package/dist-types/composables/animatedNumber.d.ts +4 -0
  29. package/dist-types/contexts.d.ts +52 -0
  30. package/dist-types/index.d.ts +146 -0
  31. package/dist-types/setup.d.ts +2 -0
  32. package/dist-types/types.d.ts +4 -0
  33. package/package.json +103 -0
package/README.md ADDED
@@ -0,0 +1,184 @@
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
+ ### Patching PrimeVue icons
139
+
140
+ Some PrimeVue icons are replaced with [@bcc-code/icons-vue](https://www.npmjs.com/package/@bcc-code/icons-vue) so the library uses BCC iconography. The patch is maintained with pnpm’s built-in patching.
141
+
142
+ **1. Start or re-enter the patch**
143
+
144
+ ```bash
145
+ pnpm patch @primevue/icons
146
+ ```
147
+
148
+ pnpm will print a path to a writable copy of the package (e.g. `node_modules/.pnpm_patches/@primevue/icons@4.5.4`).
149
+
150
+ **2. Edit the icon mappings**
151
+
152
+ - **Main barrel:** Edit `index.mjs` in that folder. Each line that re-exports from `@bcc-code/icons-vue` defines one override, e.g.:
153
+
154
+ ```js
155
+ export { ExpandMoreIcon as ChevronDownIcon } from '@bcc-code/icons-vue';
156
+ ```
157
+
158
+ - **Per-icon files:** After changing the main `index.mjs`, run the sync script so each icon’s own `index.mjs` (e.g. `chevrondown/index.mjs`) is updated to use the same BCC component:
159
+
160
+ ```bash
161
+ pnpm run sync:primevue-icon-patches
162
+ ```
163
+
164
+ That way both `@primevue/icons` and `@primevue/icons/chevrondown` (and other overridden icons) use the BCC icon.
165
+
166
+ **3. Save the patch**
167
+
168
+ From the **project root** (where `package.json` lives), run:
169
+
170
+ ```bash
171
+ pnpm patch-commit <path-pnpm-printed-in-step-1>
172
+ ```
173
+
174
+ Example, if pnpm printed `~/Projects/bcc-design/component-library/node_modules/.pnpm_patches/@primevue/icons@4.5.4`:
175
+
176
+ ```bash
177
+ pnpm patch-commit node_modules/.pnpm_patches/@primevue/icons@4.5.4
178
+ ```
179
+
180
+ The patch is written to `patches/@primevue__icons.patch` and applied automatically on `pnpm install`.
181
+
182
+ ## License
183
+
184
+ Apache-2.0