@bcc-code/component-library-vue 0.0.0-dev.00675f2

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 (41) hide show
  1. package/README.md +193 -0
  2. package/dist/component-library.js +72287 -0
  3. package/dist/component-library.umd.cjs +11694 -0
  4. package/dist/index.css +1 -0
  5. package/dist/theme.css +2597 -0
  6. package/dist-types/components/custom/BccAppNavigation/BccAppNavigation.vue.d.ts +32 -0
  7. package/dist-types/components/custom/BccBadge/BccBadge.vue.d.ts +34 -0
  8. package/dist-types/components/custom/BccCapacityIndicator/BccCapacityIndicator.vue.d.ts +26 -0
  9. package/dist-types/components/custom/BccCircleLoader/BccCircleLoader.vue.d.ts +11 -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 +12 -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/BccStepIndicator/BccStepIndicator.vue.d.ts +28 -0
  19. package/dist-types/components/custom/BccTag/BccTag.vue.d.ts +28 -0
  20. package/dist-types/components/custom/BccTopNavigation/BccTopNavigation.vue.d.ts +55 -0
  21. package/dist-types/components/custom/index.d.ts +30 -0
  22. package/dist-types/components/wrapped/BccAvatar/BccAvatar.vue.d.ts +19 -0
  23. package/dist-types/components/wrapped/BccButton.vue.d.ts +22 -0
  24. package/dist-types/components/wrapped/BccCheckbox.vue.d.ts +18 -0
  25. package/dist-types/components/wrapped/BccChip/BccChip.vue.d.ts +18 -0
  26. package/dist-types/components/wrapped/BccImage.vue.d.ts +17 -0
  27. package/dist-types/components/wrapped/BccInput.vue.d.ts +48 -0
  28. package/dist-types/components/wrapped/BccMenu/BccMenu.vue.d.ts +28 -0
  29. package/dist-types/components/wrapped/BccMessage.vue.d.ts +21 -0
  30. package/dist-types/components/wrapped/BccRadioButton.vue.d.ts +19 -0
  31. package/dist-types/components/wrapped/BccSelectButton.vue.d.ts +20 -0
  32. package/dist-types/components/wrapped/BccTabs/BccTabs.vue.d.ts +40 -0
  33. package/dist-types/components/wrapped/BccToggle/BccToggle.vue.d.ts +30 -0
  34. package/dist-types/components/wrapped/BccToggleButton.vue.d.ts +21 -0
  35. package/dist-types/components/wrapped/index.d.ts +31 -0
  36. package/dist-types/composables/animatedNumber.d.ts +4 -0
  37. package/dist-types/contexts.d.ts +52 -0
  38. package/dist-types/index.d.ts +151 -0
  39. package/dist-types/setup.d.ts +2 -0
  40. package/dist-types/types.d.ts +4 -0
  41. package/package.json +105 -0
package/README.md ADDED
@@ -0,0 +1,193 @@
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
+ **pnpm and BCC packages:** The library depends on `@bcc-code/icons-vue` and `@bcc-code/design-tokens`. To use them in your app (e.g. `import { CheckIcon } from '@bcc-code/icons-vue'` or design token imports) without adding those packages to your own `package.json`, add this to your project’s **`.npmrc`** so pnpm hoists them:
20
+
21
+ ```ini
22
+ public-hoist-pattern[]=@bcc-code/icons-vue
23
+ public-hoist-pattern[]=@bcc-code/design-tokens
24
+ ```
25
+
26
+ Then run `pnpm install` again. With npm or Yarn this is not needed.
27
+
28
+ ## Quick start
29
+
30
+ 1. **Register the library** in your app (e.g. `main.ts`):
31
+
32
+ ```ts
33
+ import { createApp } from 'vue';
34
+ import App from './App.vue';
35
+ import { BccComponentLibrary } from '@bcc-code/component-library-vue';
36
+
37
+ const app = createApp(App);
38
+ app.use(BccComponentLibrary);
39
+ app.mount('#app');
40
+ ```
41
+
42
+ 2. **Add styles** using one of the two options below.
43
+
44
+ ---
45
+
46
+ ## Styling: two options
47
+
48
+ ### Option 1 — Recommended: full Tailwind in your app
49
+
50
+ Use this if you want Tailwind utility classes in your own templates and only ship the classes you use (tree-shaking).
51
+
52
+ 1. **Add the Tailwind Vite plugin** (the package brings Tailwind in as a dependency; you only wire it up):
53
+
54
+ ```ts
55
+ // vite.config.ts
56
+ import tailwindcss from '@tailwindcss/vite';
57
+
58
+ export default defineConfig({
59
+ plugins: [vue(), tailwindcss()],
60
+ // ...
61
+ });
62
+ ```
63
+
64
+ 2. **Import the theme in your main CSS file** (e.g. `src/main.css` or `src/assets/main.css`):
65
+
66
+ ```css
67
+ @import '@bcc-code/component-library-vue/theme.css';
68
+ ```
69
+
70
+ Tailwind will run as part of your build and only include the utility classes that appear in your app and in the library.
71
+
72
+ ### Option 2 — Pre-built CSS only
73
+
74
+ Use this if you don’t want Tailwind in your project and only need the library’s styles and components.
75
+
76
+ In your entry file (e.g. `main.ts`), before mounting the app:
77
+
78
+ ```ts
79
+ import '@bcc-code/component-library-vue/style.css';
80
+ ```
81
+
82
+ You get the BCC theme and component styles only; no Tailwind utilities in your app.
83
+
84
+ ---
85
+
86
+ ## Using components
87
+
88
+ All components are namespaced with `Bcc`. Use them in templates or register them globally after `app.use(BccComponentLibrary)`.
89
+
90
+ **Example:**
91
+
92
+ ```vue
93
+ <template>
94
+ <div class="flex gap-4 p-4">
95
+ <BccButton label="Save" />
96
+ <BccInput v-model="name" placeholder="Name" />
97
+ </div>
98
+ </template>
99
+
100
+ <script setup lang="ts">
101
+ import { BccButton, BccInput } from '@bcc-code/component-library-vue';
102
+ import { ref } from 'vue';
103
+
104
+ const name = ref('');
105
+ </script>
106
+ ```
107
+
108
+ # Setup
109
+
110
+ ```ts
111
+ // main.ts
112
+ import { BccComponentLibrary } from '@bcc-code/component-library-vue';
113
+
114
+ const app = createApp(…)
115
+ BccComponentLibrary(app);
116
+ ```
117
+
118
+ ```css
119
+ /* styles.css */
120
+ @import '@bcc-code/component-library-vue/theme.css';
121
+
122
+ /* Optional include the archivo font */
123
+ @import '@bcc-code/component-library-vue/archivo-font.css';
124
+ font-family:
125
+ Archivo,
126
+ system-ui,
127
+ -apple-system,
128
+ BlinkMacSystemFont,
129
+ 'Segoe UI',
130
+ 'Open Sans',
131
+ sans-serif;
132
+ ```
133
+
134
+ 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.
135
+
136
+ ---
137
+
138
+ ## Development
139
+
140
+ ```bash
141
+ pnpm install
142
+ pnpm run start # Storybook on port 6006
143
+ pnpm run build # Typecheck, types, and Vite build
144
+ pnpm run build:vite # Vite build only (includes theme.css)
145
+ ```
146
+
147
+ ### Patching PrimeVue icons
148
+
149
+ 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.
150
+
151
+ **1. Start or re-enter the patch**
152
+
153
+ ```bash
154
+ pnpm patch @primevue/icons
155
+ ```
156
+
157
+ pnpm will print a path to a writable copy of the package (e.g. `node_modules/.pnpm_patches/@primevue/icons@4.5.4`).
158
+
159
+ **2. Edit the icon mappings**
160
+
161
+ - **Main barrel:** Edit `index.mjs` in that folder. Each line that re-exports from `@bcc-code/icons-vue` defines one override, e.g.:
162
+
163
+ ```js
164
+ export { ExpandMoreIcon as ChevronDownIcon } from '@bcc-code/icons-vue';
165
+ ```
166
+
167
+ - **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:
168
+
169
+ ```bash
170
+ pnpm run sync:primevue-icon-patches
171
+ ```
172
+
173
+ That way both `@primevue/icons` and `@primevue/icons/chevrondown` (and other overridden icons) use the BCC icon.
174
+
175
+ **3. Save the patch**
176
+
177
+ From the **project root** (where `package.json` lives), run:
178
+
179
+ ```bash
180
+ pnpm patch-commit <path-pnpm-printed-in-step-1>
181
+ ```
182
+
183
+ Example, if pnpm printed `~/Projects/bcc-design/component-library/node_modules/.pnpm_patches/@primevue/icons@4.5.4`:
184
+
185
+ ```bash
186
+ pnpm patch-commit node_modules/.pnpm_patches/@primevue/icons@4.5.4
187
+ ```
188
+
189
+ The patch is written to `patches/@primevue__icons.patch` and applied automatically on `pnpm install`.
190
+
191
+ ## License
192
+
193
+ Apache-2.0