@voicenter-team/voicenter-ui-plus 3.4.6 → 3.4.7

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 (29) hide show
  1. package/README.md +558 -502
  2. package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
  3. package/library/components/VcCheckbox/VcCheckbox.vue.mjs +1 -1
  4. package/library/components/VcCheckbox/VcCheckboxButton.vue.mjs +1 -1
  5. package/library/components/VcDatePicker/VcDatePicker.vue.mjs +1 -1
  6. package/library/components/VcDropdown/VcDropdownItem.vue.mjs +1 -1
  7. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
  8. package/library/components/VcForm/VcForm.vue.mjs +1 -1
  9. package/library/components/VcForm/VcFormItem.vue.mjs +1 -1
  10. package/library/components/VcHtmlEditor/VcHtmlEditorToolbar.vue.mjs +1 -1
  11. package/library/components/VcInput/VcInput.vue.mjs +1 -1
  12. package/library/components/VcMdEditor/VcMdEditor.vue.mjs +1 -1
  13. package/library/components/VcMdEditor/VcMdEditorToolbar.vue.mjs +1 -1
  14. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +1 -1
  15. package/library/components/VcRadio/VcRadio.vue.mjs +1 -1
  16. package/library/components/VcSelect/VcSelect.vue.mjs +1 -1
  17. package/library/components/VcSlider/VcSlider.vue.mjs +1 -1
  18. package/library/index.mjs.gz +0 -0
  19. package/library/localization/index.mjs.gz +0 -0
  20. package/library/plugin.mjs.gz +0 -0
  21. package/library/style.css +1 -1
  22. package/library/style.css.br +0 -0
  23. package/library/style.css.gz +0 -0
  24. package/library/theme/index.mjs.gz +0 -0
  25. package/library/types/localization/locales/en.json.d.ts +187 -187
  26. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  27. package/package.json +215 -215
  28. package/tailwind.config.js +192 -192
  29. /package/library/assets/node_modules/element-plus/theme-chalk/src/{tooltip.css → date-picker.css} +0 -0
package/README.md CHANGED
@@ -1,502 +1,558 @@
1
- # Voicenter UI library for Vue
2
- This is Vue 3.x + Typescript component library made for Voicenter systems.
3
-
4
- > **v3.0.0 is a tree-shaking release with breaking changes.** See [`MIGRATION_v3.md`](./MIGRATION_v3.md). The separate `*-extended` package is gone — every component lives in this package now.
5
-
6
- ## Installation
7
-
8
- ```bash
9
- npm i @voicenter-team/voicenter-ui-plus
10
- npm i vue@^3.5 element-plus @vueuse/core dayjs lodash-es libphonenumber-js maska
11
- ```
12
-
13
- ### Sass compiler (build-time)
14
-
15
- This library customizes element-plus theming via SCSS variable injection at build time. Your bundler needs to be able to compile SCSS. If your project doesn't already use Sass, add it as a dev dependency:
16
-
17
- ```bash
18
- npm i -D sass-embedded
19
- ```
20
-
21
- This is a **build-time only** requirement — it doesn't add anything to your runtime bundle. Most Vue 3 / Vite projects already have it.
22
-
23
- Optional peer deps — install only for the heavy components you use:
24
-
25
- | Component | Peer deps |
26
- |---|---|
27
- | `VcPdfDocument` | `pdfjs-dist@^2.9.359` |
28
- | `VcSoundPlayer` | `wavesurfer.js` |
29
- | `VcExcelFileUploader` | `xlsx` |
30
- | `VcImageUploader` | `vue-advanced-cropper` |
31
- | `VcHtmlEditor` / `VcJsonSchema` | `codemirror @codemirror/lang-html @codemirror/lang-json @codemirror/lang-markdown vue-codemirror6` |
32
- | `VcMdEditor` | `@milkdown/crepe @milkdown/kit @milkdown/vue @prosemirror-adapter/vue` |
33
-
34
- ### If you're on Vite 8 / rolldown (and skipping some optional peers)
35
-
36
- Vite 8's rolldown-based bundler validates named imports against optional-peer-dep stubs and fails the build with `MISSING_EXPORT` errors when a heavy component's peer is uninstalled — even when you don't use that component. Add the unused optional peers to `build.rollupOptions.external` in your `vite.config.ts`:
37
-
38
- ```ts
39
- // vite.config.ts
40
- import { defineConfig } from 'vite'
41
- import vue from '@vitejs/plugin-vue'
42
-
43
- export default defineConfig({
44
- plugins: [ vue() ],
45
- build: {
46
- rollupOptions: {
47
- external: [
48
- // List only the heavy peers you DON'T install
49
- /^@milkdown\//, /^@prosemirror/, /^@codemirror\//, /^codemirror/,
50
- /^vue-codemirror6/, /^vue-advanced-cropper/,
51
- 'wavesurfer.js', 'xlsx', 'pdfjs-dist', /^pdfjs-dist\//
52
- ]
53
- }
54
- }
55
- })
56
- ```
57
-
58
- Earlier Vite versions (5, 6, 7 with rollup) and webpack 5+ don't require this — the older rollup variant warns but doesn't error on optional-peer named imports.
59
-
60
- ## Usage
61
-
62
- ### Tree-shake mode (recommended)
63
- ```ts
64
- import { VcButton, VcInput } from '@voicenter-team/voicenter-ui-plus'
65
- // Use as local components — no app.use() needed.
66
- ```
67
- Bundlers drop unused components and their CSS. A consumer importing only `VcButton` ships ~50–150 KB JS + ~10–30 KB CSS.
68
-
69
- If you use `useConfirmModal`, `useConfirmPopup`, or `NotifyService`, mount global overlays in `App.vue`:
70
-
71
- ```vue
72
- <script setup lang="ts">
73
- import { VcPluginOverlays } from '@voicenter-team/voicenter-ui-plus'
74
- </script>
75
-
76
- <template>
77
- <RouterView />
78
- <VcPluginOverlays />
79
- </template>
80
- ```
81
-
82
- ### Plugin mode (global registration)
83
- ```ts
84
- import VoicenterUI from '@voicenter-team/voicenter-ui-plus/plugin'
85
- import '@voicenter-team/voicenter-ui-plus/style.css'
86
-
87
- // Overlay composables can be imported from the same entry:
88
- // import { useConfirmModal, useConfirmPopup, VcPluginOverlays } from '@voicenter-team/voicenter-ui-plus/plugin'
89
-
90
- app.use(VoicenterUI, {
91
- themeConfig, // theme config (see below)
92
- lang: 'en', // localization
93
- injectIconFont: true // inject icon-font <link> tags into <head>
94
- })
95
- // Confirm modals/popovers/notifications: auto-mounted via VcPluginOverlays
96
- // (mountOverlays: true by default). Opt out with mountOverlays: false and
97
- // add <VcPluginOverlays /> to App.vue — also registered globally by the plugin.
98
- ```
99
-
100
- ### Global overlays
101
-
102
- Several APIs are **state-only** — they update global reactive singletons but do not render UI by themselves:
103
-
104
- | API | Overlay component |
105
- |---|---|
106
- | `useConfirmModal` | `VcConfirmModal` |
107
- | `useConfirmPopup` | `VcConfirmPopover` |
108
- | `NotifyService` / `$notify` | `VcNotification` |
109
-
110
- **Plugin mode:** mounted automatically on `app.use()` (default). Pass `mountOverlays: false` to mount manually.
111
-
112
- **Notifications:** one top-right host by default. For multiple positions, use `overlayNotifications` in plugin config or mount your own:
113
-
114
- ```ts
115
- app.use(VoicenterUI, {
116
- overlayNotifications: [
117
- { group: 'top-right', position: 'top-right' },
118
- { group: 'bottom-right', position: 'bottom-right' },
119
- ],
120
- })
121
- // NotifyService.add({ group: 'bottom-right', ... })
122
- ```
123
-
124
- Or `overlayNotifications: 'none'` and put `<VcNotification />` in App.vue (confirms still auto-mount).
125
-
126
- **Tree-shake mode:** add `<VcPluginOverlays />` to `App.vue` (bundles confirm hosts; configure via `notifications` prop).
127
-
128
- Entity components such as `VcEntityListTable` call `useConfirmModal` internally — delete confirmations require overlays to be mounted.
129
-
130
- 2.1. If you are using tailwind update your `tailwind.config.js` with:
131
- ```js
132
- const voiceTailwindScheme = require('@voicenter-team/voicenter-ui-plus/src/theme/tailwindScheme')
133
-
134
- module.exports = {
135
- ...yourConfiguration,
136
- theme: {
137
- colors: {
138
- ...voiceTailwindScheme
139
- },
140
- borderColor: {
141
- ...voiceTailwindScheme
142
- }
143
- }
144
- }
145
- ```
146
-
147
- ### Theming specification
148
- The `themeConfig` which is passed as options to the VoicenterUI `vue.use` data could have the following specifications:
149
-
150
- ### Local
151
- **Config:**
152
- ```js
153
- {
154
- type: 'local'
155
- themeName: 'red' | 'blue' | '...'
156
- onSetupCallback: () => {
157
- console.log('Loaded!')
158
- }
159
- }
160
- ```
161
- **Description:**
162
-
163
- Such configuration will append to the document element the CSS variables from one of the configuration passed in `themeName` parameter which it will get from theme specification delivered alongside with library
164
-
165
- **Params:**
166
- - **themeName**
167
- - The name of the theme to be injected
168
- - **onSetupCallback**
169
- - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
170
-
171
- ### Remote
172
- **Config:**
173
- ```js
174
- {
175
- type: 'remote'
176
- brandingSectionName: 'someName'
177
- apiUrl: 'someUrl'
178
- brandingSectionName: {
179
- property: 'data'
180
- }
181
- onSetupCallback: () => {
182
- console.log('Loaded!')
183
- }
184
- }
185
- ```
186
- **Description:**
187
-
188
- Such configuration will initiate the call to the specified apiUrl in order to retrieve the JSON object with key-value properties of the CSS variables to inject to document element
189
-
190
- **Params:**
191
- - **brandingSectionName**
192
- - [Optional] The name of the section (tagSection) in the database configuration which will be passed to the API in payload and on response retrieved replaced from resulted values
193
- - **apiUrl**
194
- - The API url to which the POST request will be initiated
195
- - **onSetupCallback**
196
- - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
197
- - **brandingSectionName**
198
- - [Optional] The payload data that will be sent to the request
199
-
200
- ### Custom JSON
201
- **Config:**
202
- ```js
203
- {
204
- type: 'customJson'
205
- config: {
206
- black: '#000000'
207
- }
208
- onSetupCallback: () => {
209
- console.log('Loaded!')
210
- }
211
- }
212
- ```
213
- **Description:**
214
-
215
- Such configuration will initiate the styling with custom provided theme
216
-
217
- **Params:**
218
- - **config**
219
- - The object where the key is the variable to be set and the value is the variable value. Check the [themes object](https://github.com/VoicenterTeam/voicenter-ui-plus/blob/master/src/theme/themes.json) to check existing variables
220
- - **onSetupCallback**
221
- - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
222
-
223
- ## Date Handling
224
-
225
- This library uses **dayjs** for all date operations and formatting. When working with date-related components, use dayjs format tokens (NOT date-fns format tokens).
226
-
227
- ### Format Tokens
228
-
229
- **Important**: Use dayjs format tokens:
230
- - `DD` - Day of month (2 digits) - **NOT** `dd`
231
- - `YYYY` - 4-digit year - **NOT** `yyyy`
232
- - `MM` - Month (2 digits)
233
- - `HH` - 24-hour format
234
- - `mm` - Minutes
235
- - `ss` - Seconds
236
-
237
- ### Common Formats
238
-
239
- ```typescript
240
- 'DD/MM/YYYY' // 31/12/2024
241
- 'DD-MM-YYYY' // 31-12-2024
242
- 'YYYY-MM-DD' // 2024-12-31
243
- 'DD/MM/YYYY, HH:mm' // 31/12/2024, 14:30
244
- 'DD/MM/YYYY HH:mm:ss' // 31/12/2024 14:30:45
245
- ```
246
-
247
- ### Usage Example
248
-
249
- ```vue
250
- <VcDatePicker
251
- v-model="date"
252
- format="DD/MM/YYYY"
253
- input-date-format="DD/MM/YYYY"
254
- input-time-format="HH:mm"
255
- />
256
- ```
257
-
258
- ## Date Utility Functions
259
-
260
- The library provides a comprehensive set of date utility functions built on dayjs. These utilities are available for use in external projects.
261
-
262
- ### Import Date Utilities
263
-
264
- ```typescript
265
- import {
266
- formatDate,
267
- parseDate,
268
- addDays,
269
- subtractDays,
270
- getHours,
271
- getMinutes,
272
- getSeconds,
273
- setTime,
274
- isAfter,
275
- isSameAfter,
276
- isBefore,
277
- isSameBefore,
278
- format,
279
- add,
280
- sub,
281
- addFp,
282
- subFp
283
- } from '@voicenter-team/voicenter-ui-plus'
284
- ```
285
-
286
- ### Basic Date Operations
287
-
288
- #### Formatting Dates
289
-
290
- ```typescript
291
- // Format a date with default format (YYYY-MM-DD)
292
- const formatted = formatDate(new Date())
293
- // Result: "2024-12-31"
294
-
295
- // Format with custom format
296
- const custom = formatDate(new Date(), 'DD/MM/YYYY')
297
- // Result: "31/12/2024"
298
-
299
- // Using format function (alias)
300
- const formatted2 = format(new Date(), 'DD/MM/YYYY HH:mm')
301
- // Result: "31/12/2024 14:30"
302
- ```
303
-
304
- #### Parsing Dates
305
-
306
- ```typescript
307
- // Parse a date string with format
308
- const date = parseDate('31/12/2024', 'DD/MM/YYYY')
309
- // Returns: Date object
310
- ```
311
-
312
- ### Date Arithmetic
313
-
314
- #### Adding/Subtracting Days
315
-
316
- ```typescript
317
- // Add days
318
- const futureDate = addDays(new Date(), 7)
319
- // Returns: Date 7 days from now
320
-
321
- // Subtract days
322
- const pastDate = subtractDays(new Date(), 5)
323
- // Returns: Date 5 days ago
324
- ```
325
-
326
- #### Adding/Subtracting Time Units
327
-
328
- ```typescript
329
- // Add multiple time units
330
- const newDate = add(new Date(), {
331
- years: 1,
332
- months: 2,
333
- days: 5,
334
- hours: 3,
335
- minutes: 30
336
- })
337
-
338
- // Subtract multiple time units
339
- const earlierDate = sub(new Date(), {
340
- weeks: 2,
341
- days: 3,
342
- hours: 12
343
- })
344
-
345
- // Functional programming style (reversed arguments)
346
- const fpDate = addFp({ days: 7 }, new Date())
347
- const fpDate2 = subFp({ hours: 5 }, new Date())
348
- ```
349
-
350
- ### Time Operations
351
-
352
- #### Getting Time Components
353
-
354
- ```typescript
355
- const date = new Date('2024-12-31T14:30:45')
356
-
357
- const hours = getHours(date) // 14
358
- const minutes = getMinutes(date) // 30
359
- const seconds = getSeconds(date) // 45
360
- ```
361
-
362
- #### Setting Time
363
-
364
- ```typescript
365
- // Set time on a date (returns new Date object)
366
- const newDate = setTime(new Date(), {
367
- hours: 14,
368
- minutes: 30,
369
- seconds: 0
370
- })
371
- ```
372
-
373
- ### Date Comparisons
374
-
375
- ```typescript
376
- const date1 = new Date('2024-12-31')
377
- const date2 = new Date('2025-01-01')
378
-
379
- // Check if date1 is after date2
380
- const isLater = isAfter(date1, date2, 'day')
381
- // Returns: false
382
-
383
- // Check if date1 is same or after date2
384
- const isSameOrLater = isSameAfter(date1, date2, 'day')
385
- // Returns: false
386
-
387
- // Check if date1 is before date2
388
- const isEarlier = isBefore(date1, date2, 'day')
389
- // Returns: true
390
-
391
- // Check if date1 is same or before date2
392
- const isSameOrEarlier = isSameBefore(date1, date2, 'day')
393
- // Returns: true
394
- ```
395
-
396
- **Comparison Units**: The comparison functions accept a `units` parameter (default: `'minute'`). Valid units:
397
- - `'year'`, `'month'`, `'week'`, `'day'`
398
- - `'hour'`, `'minute'`, `'second'`
399
-
400
- ### Complete Usage Example
401
-
402
- ```typescript
403
- import {
404
- formatDate,
405
- addDays,
406
- isAfter,
407
- format,
408
- add,
409
- getHours,
410
- setTime
411
- } from '@voicenter-team/voicenter-ui-plus'
412
-
413
- // Format today's date
414
- const today = formatDate(new Date(), 'DD/MM/YYYY')
415
-
416
- // Get date 30 days from now
417
- const futureDate = addDays(new Date(), 30)
418
-
419
- // Check if a date is in the future
420
- const isFuture = isAfter(futureDate, new Date(), 'day')
421
-
422
- // Add 2 weeks and 3 days
423
- const deadline = add(new Date(), {
424
- weeks: 2,
425
- days: 3
426
- })
427
-
428
- // Get current hour
429
- const currentHour = getHours(new Date())
430
-
431
- // Set specific time
432
- const meetingTime = setTime(new Date(), {
433
- hours: 14,
434
- minutes: 30
435
- })
436
-
437
- // Format the result
438
- const formattedDeadline = format(deadline, 'DD/MM/YYYY HH:mm')
439
- ```
440
-
441
- ### Notes
442
-
443
- - All functions accept `Date`, `string`, or `number` as date input
444
- - All date manipulation functions return new `Date` objects (immutable)
445
- - Format strings use dayjs format tokens (see Format Tokens section above)
446
- - These utilities are built on dayjs and maintain compatibility with dayjs format patterns
447
-
448
- ## Contributing: adding a new component
449
-
450
- The public component surface is defined in **one place**: [`script/components-manifest.mjs`](./script/components-manifest.mjs) — one line per component.
451
-
452
- ```js
453
- { name: 'VcMyThing', path: 'components/VcMyThing/VcMyThing.vue' },
454
- ```
455
-
456
- `npm run generate:entries` materializes the manifest into three fully
457
- generated files (never edit them by hand — the next generator run
458
- overwrites them, and the verifier fails the build until they match):
459
-
460
- - `src/components.gen.ts` — named exports, re-exported by `src/index.ts`
461
- (tree-shake mode);
462
- - `src/plugin-components.gen.ts` — `registerComponents(app)`, called by
463
- the plugin's install (global registration mode);
464
- - `src/components/exports.ts` — the `GlobalComponents` template typing.
465
-
466
- `src/index.ts` and `src/plugin.ts` themselves stay hand-written and small.
467
- The `.gen` modules are safe to route through only because
468
- `rewriteCssImports()` in `vite.config.ts` strips the CSS imports that
469
- `vite-plugin-lib-inject-css` aggregates onto them — each component's CSS
470
- stays in its own chunk, so per-component CSS tree-shaking survives. Don't
471
- rename the `.gen` files without updating that strip list (the verifier
472
- guards this wiring too).
473
-
474
- Typical flows:
475
-
476
- - **New component**: `node script/create-component.mjs` — scaffolds the
477
- component folder, adds the manifest line, and regenerates all entries.
478
- - **Existing .vue file**: add one line to the manifest, then
479
- `npm run generate:entries`.
480
-
481
- Every manifest entry is exported from the package root AND registered
482
- globally in plugin mode — there are no partial modes.
483
-
484
- `npm run verify:entries` is the safety net: it independently cross-checks
485
- the manifest, the three generated files and the filesystem (a component
486
- file that exists but is missing from the manifest fails too). It runs in
487
- the pre-commit hook (together with `lint-staged` and `ts-check`; hooks are
488
- installed automatically by `npm install` via husky) and in CI, so an
489
- inconsistent component surface cannot reach `master`.
490
-
491
- ## Documentation
492
-
493
- ### Live Documentation
494
- Visit [documentation](https://voicenter-ui.netlify.app/) for interactive component examples and demos.
495
-
496
- ## Project Documentation
497
- For detailed technical documentation, see the [`docs/`](./docs/) directory:
498
-
499
- - **[Quick Start Guide](./docs/AGENTS_QUICK_START.md)** - For developers working on the library
500
- - **[Integration Guide](./docs/AGENTS_INTEGRATION_GUIDE.md)** - For using the library in other projects
501
- - **[Architecture Overview](./docs/ARCHITECTURE.md)** - Project structure and technical details
502
- - **[Documentation Guide](./docs/DOCUMENTATION_GUIDE.md)** - Working with the documentation system
1
+ # Voicenter UI library for Vue
2
+ This is Vue 3.x + Typescript component library made for Voicenter systems.
3
+
4
+ > **v3.0.0 is a tree-shaking release with breaking changes.** See [`MIGRATION_v3.md`](./MIGRATION_v3.md). The separate `*-extended` package is gone — every component lives in this package now.
5
+
6
+ ## Installation
7
+
8
+ ```bash
9
+ npm i @voicenter-team/voicenter-ui-plus
10
+ npm i vue@^3.5 element-plus @vueuse/core dayjs lodash-es libphonenumber-js maska
11
+ ```
12
+
13
+ ### Sass compiler (build-time)
14
+
15
+ This library customizes element-plus theming via SCSS variable injection at build time. Your bundler needs to be able to compile SCSS. If your project doesn't already use Sass, add it as a dev dependency:
16
+
17
+ ```bash
18
+ npm i -D sass-embedded
19
+ ```
20
+
21
+ This is a **build-time only** requirement — it doesn't add anything to your runtime bundle. Most Vue 3 / Vite projects already have it.
22
+
23
+ Optional peer deps — install only for the heavy components you use:
24
+
25
+ | Component | Peer deps |
26
+ |---|---|
27
+ | `VcPdfDocument` | `pdfjs-dist@^2.16.105` |
28
+ | `VcSoundPlayer` | `wavesurfer.js` |
29
+ | `VcExcelFileUploader` | `xlsx` |
30
+ | `VcImageUploader` | `vue-advanced-cropper` |
31
+ | `VcHtmlEditor` / `VcJsonSchema` | `codemirror @codemirror/lang-html @codemirror/lang-json @codemirror/lang-markdown vue-codemirror6` |
32
+ | `VcMdEditor` | `@milkdown/crepe @milkdown/kit @milkdown/vue @prosemirror-adapter/vue` |
33
+
34
+ ### If you're on Vite 8 / rolldown (and skipping some optional peers)
35
+
36
+ Vite 8's rolldown-based bundler validates named imports against optional-peer-dep stubs and fails the build with `MISSING_EXPORT` errors when a heavy component's peer is uninstalled — even when you don't use that component. Add the unused optional peers to `build.rollupOptions.external` in your `vite.config.ts`:
37
+
38
+ ```ts
39
+ // vite.config.ts
40
+ import { defineConfig } from 'vite'
41
+ import vue from '@vitejs/plugin-vue'
42
+
43
+ export default defineConfig({
44
+ plugins: [ vue() ],
45
+ build: {
46
+ rollupOptions: {
47
+ external: [
48
+ // List only the heavy peers you DON'T install
49
+ /^@milkdown\//, /^@prosemirror/, /^@codemirror\//, /^codemirror/,
50
+ /^vue-codemirror6/, /^vue-advanced-cropper/,
51
+ 'wavesurfer.js', 'xlsx', 'pdfjs-dist', /^pdfjs-dist\//
52
+ ]
53
+ }
54
+ }
55
+ })
56
+ ```
57
+
58
+ Earlier Vite versions (5, 6, 7 with rollup) and webpack 5+ don't require this — the older rollup variant warns but doesn't error on optional-peer named imports.
59
+
60
+ ## Usage
61
+
62
+ ### Tree-shake mode (recommended)
63
+ ```ts
64
+ import { VcButton, VcInput } from '@voicenter-team/voicenter-ui-plus'
65
+ // Use as local components — no app.use() needed.
66
+ ```
67
+ Bundlers drop unused components and their CSS. A consumer importing only `VcButton` ships ~50–150 KB JS + ~10–30 KB CSS.
68
+
69
+ If you use `useConfirmModal`, `useConfirmPopup`, or `NotifyService`, mount global overlays in `App.vue`:
70
+
71
+ ```vue
72
+ <script setup lang="ts">
73
+ import { VcPluginOverlays } from '@voicenter-team/voicenter-ui-plus'
74
+ </script>
75
+
76
+ <template>
77
+ <RouterView />
78
+ <VcPluginOverlays />
79
+ </template>
80
+ ```
81
+
82
+ ### Plugin mode (global registration)
83
+ ```ts
84
+ import VoicenterUI from '@voicenter-team/voicenter-ui-plus/plugin'
85
+ import '@voicenter-team/voicenter-ui-plus/style.css'
86
+
87
+ // Overlay composables can be imported from the same entry:
88
+ // import { useConfirmModal, useConfirmPopup, VcPluginOverlays } from '@voicenter-team/voicenter-ui-plus/plugin'
89
+
90
+ app.use(VoicenterUI, {
91
+ themeConfig, // theme config (see below)
92
+ lang: 'en', // localization
93
+ injectIconFont: true // inject icon-font <link> tags into <head>
94
+ })
95
+ // Confirm modals/popovers/notifications: auto-mounted via VcPluginOverlays
96
+ // (mountOverlays: true by default). Opt out with mountOverlays: false and
97
+ // add <VcPluginOverlays /> to App.vue — also registered globally by the plugin.
98
+ ```
99
+
100
+ ### Global overlays
101
+
102
+ Several APIs are **state-only** — they update global reactive singletons but do not render UI by themselves:
103
+
104
+ | API | Overlay component |
105
+ |---|---|
106
+ | `useConfirmModal` | `VcConfirmModal` |
107
+ | `useConfirmPopup` | `VcConfirmPopover` |
108
+ | `NotifyService` / `$notify` | `VcNotification` |
109
+
110
+ **Plugin mode:** mounted automatically on `app.use()` (default). Pass `mountOverlays: false` to mount manually.
111
+
112
+ **Notifications:** one top-right host by default. For multiple positions, use `overlayNotifications` in plugin config or mount your own:
113
+
114
+ ```ts
115
+ app.use(VoicenterUI, {
116
+ overlayNotifications: [
117
+ { group: 'top-right', position: 'top-right' },
118
+ { group: 'bottom-right', position: 'bottom-right' },
119
+ ],
120
+ })
121
+ // NotifyService.add({ group: 'bottom-right', ... })
122
+ ```
123
+
124
+ Or `overlayNotifications: 'none'` and put `<VcNotification />` in App.vue (confirms still auto-mount).
125
+
126
+ **Tree-shake mode:** add `<VcPluginOverlays />` to `App.vue` (bundles confirm hosts; configure via `notifications` prop).
127
+
128
+ Entity components such as `VcEntityListTable` call `useConfirmModal` internally — delete confirmations require overlays to be mounted.
129
+
130
+ ### Tailwind
131
+
132
+ Tailwind's colours come from the library scheme, so the utility classes and the theme are one set of tokens. `theme.colors` replaces Tailwind's own palette on purpose: only the library's colours exist as classes.
133
+
134
+ ```js
135
+ // tailwind.config.js
136
+ const voiceTailwindScheme = require('@voicenter-team/voicenter-ui-plus/src/theme/tailwindScheme')
137
+
138
+ module.exports = {
139
+ ...yourConfiguration,
140
+ theme: {
141
+ colors: { ...voiceTailwindScheme },
142
+ borderColor: { ...voiceTailwindScheme },
143
+ fill: voiceTailwindScheme
144
+ }
145
+ }
146
+ ```
147
+
148
+ Import the application's own stylesheet after the library, so the application's utilities win ties of equal specificity with the library's CSS (`.hidden` is the usual one).
149
+
150
+ ### Theming specification
151
+ The `themeConfig` which is passed as options to the VoicenterUI `vue.use` data could have the following specifications:
152
+
153
+ ### Local
154
+ **Config:**
155
+ ```js
156
+ {
157
+ type: 'local'
158
+ themeName: 'red' | 'blue' | '...'
159
+ onSetupCallback: () => {
160
+ console.log('Loaded!')
161
+ }
162
+ }
163
+ ```
164
+ **Description:**
165
+
166
+ Such configuration will append to the document element the CSS variables from one of the configuration passed in `themeName` parameter which it will get from theme specification delivered alongside with library
167
+
168
+ **Params:**
169
+ - **themeName**
170
+ - The name of the theme to be injected
171
+ - **onSetupCallback**
172
+ - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
173
+
174
+ ### Remote
175
+ **Config:**
176
+ ```js
177
+ {
178
+ type: 'remote'
179
+ brandingSectionName: 'someName'
180
+ apiUrl: 'someUrl'
181
+ brandingSectionName: {
182
+ property: 'data'
183
+ }
184
+ onSetupCallback: () => {
185
+ console.log('Loaded!')
186
+ }
187
+ }
188
+ ```
189
+ **Description:**
190
+
191
+ Such configuration will initiate the call to the specified apiUrl in order to retrieve the JSON object with key-value properties of the CSS variables to inject to document element
192
+
193
+ **Params:**
194
+ - **brandingSectionName**
195
+ - [Optional] The name of the section (tagSection) in the database configuration which will be passed to the API in payload and on response retrieved replaced from resulted values
196
+ - **apiUrl**
197
+ - The API url to which the POST request will be initiated
198
+ - **onSetupCallback**
199
+ - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
200
+ - **brandingSectionName**
201
+ - [Optional] The payload data that will be sent to the request
202
+
203
+ ### Custom JSON
204
+ **Config:**
205
+ ```js
206
+ {
207
+ type: 'customJson'
208
+ config: {
209
+ black: '#000000'
210
+ }
211
+ onSetupCallback: () => {
212
+ console.log('Loaded!')
213
+ }
214
+ }
215
+ ```
216
+ **Description:**
217
+
218
+ Such configuration will initiate the styling with custom provided theme
219
+
220
+ **Params:**
221
+ - **config**
222
+ - The object where the key is the variable to be set and the value is the variable value. Check the [themes object](https://github.com/VoicenterTeam/voicenter-ui-plus/blob/master/src/theme/themes.json) to check existing variables
223
+ - **onSetupCallback**
224
+ - The function which will be called right after the variables will be injected into the document element. First parameter of which is the theme object which was set up
225
+
226
+ ### None
227
+ `{ type: 'none', onSetupCallback?: (theme) => void }` injects no theme variables; the application sets them itself.
228
+
229
+ ## Using ui-plus in an application
230
+
231
+ How an application builds its UI with ui-plus. Agents working in a consuming project read this section before any UI work; it describes the version installed next to it.
232
+
233
+ ### Where the facts are
234
+
235
+ The installed package is the truth. Read it before saying what ui-plus has or how a component behaves.
236
+
237
+ - **Every component**: `library/types/components/exports.d.ts`. One component's props, events and slots: `library/types/components/<VcName>/<VcName>.vue.d.ts`.
238
+ - **Composables, services, directives, the entity base**: `library/types/composables/`, `library/types/services/`, `library/types/directives/`, `library/types/entity/`.
239
+ - **Types**: prop, event and configuration types are exported from the package root (`import type { UIConfig } from '@voicenter-team/voicenter-ui-plus'`). Generic components take type parameters in the template: `<VcSelect<User, 'id', 'name'> v-model="selected" :options="users" value-key="id" label-key="name" />`.
240
+ - **Colour tokens**: `src/theme/themes.json` (each key is the CSS variable `--<key>`) and `src/theme/tailwindScheme.js` (the Tailwind colour names).
241
+ - **Examples**: the [live documentation](https://voicenter-ui.netlify.app/).
242
+
243
+ ### Choosing a component
244
+
245
+ - Interaction components come from ui-plus: buttons, inputs, selects, date pickers, checkboxes, tabs, tables, modals, drawers, tooltips, popovers, uploaders, notifications, confirmations. Search `exports.d.ts` by what the user is shown (a picker of people, an on/off switch, a list with a search) before concluding a component is missing.
246
+ - A component is used **as the library draws it**: through its props, slots and variants. Fitting it into the layout is free: width, spacing, wrapping, alignment.
247
+ - A **custom control** needs the project owner's explicit yes, asked before it is written: which element is needed, what was searched in ui-plus, why nothing fits. Custom means any of:
248
+ - a new interaction component;
249
+ - a ui-plus component whose own CSS variables (`--el-*`, the ones ui-plus sets on `.vc-*`) or internal classes are overridden to change how it looks or behaves as a control: its track, rows, selected, hover or active state, shape or indicator;
250
+ - a ui-plus component used for a role it is not built for, such as a segmented switcher drawn as a searchable list.
251
+ - Until that yes, the closest ui-plus component is used as drawn, and the difference from the design is the first open point of the report: what the design draws, which component was used, how they differ. No agent or orchestrator gives this approval in the owner's place.
252
+ - A report names a control by what is on screen: a restyled ui-plus component is reported as custom.
253
+ - A design hand-off (Figma, mock-up, screenshot, a specification) says what the user should see. It never justifies a restyle or a custom control.
254
+
255
+ ### Colours
256
+
257
+ - Every colour is a ui-plus token: a Tailwind class from the library scheme (`text-default-text`, `text-secondary-text`, `text-primary`, `bg-main-bg`, `bg-light-bg`, `border-ui-lines`, `text-success`, `text-error`) or a theme variable in a style (`color: var(--default-text)`). Status colours, tags, icons and chart series included.
258
+ - Hex values, `rgb()`/`rgba()`, arbitrary classes such as `bg-[#…]` and new colour variables stay out of application code. Such colours already in a project are not a precedent.
259
+ - The theme configuration (`themeConfig`, usually a `colors.json`) sets the library theme. It is not a palette to add colours to.
260
+
261
+ ### Notifications and confirmations
262
+
263
+ `NotifyService`, `useConfirmModal` and `useConfirmPopup` render only through the hosts described in [Global overlays](#global-overlays), mounted once in the application. A `VcNotification` host shows only the messages of its own `group`, so where the application mounts one host per group, every notification names one of those groups.
264
+
265
+ ### Text direction
266
+
267
+ ui-plus follows the `dir` attribute of `<html>`: `useRTL()` reads it and updates when it changes. The application sets the direction there, once.
268
+
269
+ ### Server-side rendering
270
+
271
+ ui-plus is built and tested for client-rendered Vue applications. Its composables read `document` and `window` when they are called (`useRTL` among them), and the package ships no Nuxt module. An application with server-side rendering proves one page that uses ui-plus in development and in a production build before relying on it, and reports what fails.
272
+
273
+ ### Troubleshooting
274
+
275
+ - **Component not found or a blank page**: in tree-shake mode a component is a local import, never a globally registered tag. In plugin mode both `app.use(VoicenterUI, …)` and `import '@voicenter-team/voicenter-ui-plus/style.css'` are present.
276
+ - **`Cannot find module 'pdfjs-dist'` (or another optional peer) at build time**: install the peer, or stop importing its component.
277
+ - **Duplicate styles, a huge CSS payload**: the two modes are mixed (named imports plus the global `style.css`). Pick one (`MIGRATION_v3.md`, §1).
278
+ - **PDF.js worker not loading**: the worker is a sibling asset resolved with `new URL('./pdf.worker.min.js', import.meta.url)`; the bundler must support that pattern (Vite, webpack 5+, Rollup and esbuild do).
279
+
280
+ ## Date Handling
281
+
282
+ This library uses **dayjs** for all date operations and formatting. When working with date-related components, use dayjs format tokens (NOT date-fns format tokens).
283
+
284
+ ### Format Tokens
285
+
286
+ **Important**: Use dayjs format tokens:
287
+ - `DD` - Day of month (2 digits) - **NOT** `dd`
288
+ - `YYYY` - 4-digit year - **NOT** `yyyy`
289
+ - `MM` - Month (2 digits)
290
+ - `HH` - 24-hour format
291
+ - `mm` - Minutes
292
+ - `ss` - Seconds
293
+
294
+ ### Common Formats
295
+
296
+ ```typescript
297
+ 'DD/MM/YYYY' // 31/12/2024
298
+ 'DD-MM-YYYY' // 31-12-2024
299
+ 'YYYY-MM-DD' // 2024-12-31
300
+ 'DD/MM/YYYY, HH:mm' // 31/12/2024, 14:30
301
+ 'DD/MM/YYYY HH:mm:ss' // 31/12/2024 14:30:45
302
+ ```
303
+
304
+ ### Usage Example
305
+
306
+ ```vue
307
+ <VcDatePicker
308
+ v-model="date"
309
+ format="DD/MM/YYYY"
310
+ input-date-format="DD/MM/YYYY"
311
+ input-time-format="HH:mm"
312
+ />
313
+ ```
314
+
315
+ ## Date Utility Functions
316
+
317
+ The library provides a comprehensive set of date utility functions built on dayjs. These utilities are available for use in external projects.
318
+
319
+ ### Import Date Utilities
320
+
321
+ ```typescript
322
+ import {
323
+ formatDate,
324
+ parseDate,
325
+ addDays,
326
+ subtractDays,
327
+ getHours,
328
+ getMinutes,
329
+ getSeconds,
330
+ setTime,
331
+ isAfter,
332
+ isSameAfter,
333
+ isBefore,
334
+ isSameBefore,
335
+ format,
336
+ add,
337
+ sub,
338
+ addFp,
339
+ subFp
340
+ } from '@voicenter-team/voicenter-ui-plus'
341
+ ```
342
+
343
+ ### Basic Date Operations
344
+
345
+ #### Formatting Dates
346
+
347
+ ```typescript
348
+ // Format a date with default format (YYYY-MM-DD)
349
+ const formatted = formatDate(new Date())
350
+ // Result: "2024-12-31"
351
+
352
+ // Format with custom format
353
+ const custom = formatDate(new Date(), 'DD/MM/YYYY')
354
+ // Result: "31/12/2024"
355
+
356
+ // Using format function (alias)
357
+ const formatted2 = format(new Date(), 'DD/MM/YYYY HH:mm')
358
+ // Result: "31/12/2024 14:30"
359
+ ```
360
+
361
+ #### Parsing Dates
362
+
363
+ ```typescript
364
+ // Parse a date string with format
365
+ const date = parseDate('31/12/2024', 'DD/MM/YYYY')
366
+ // Returns: Date object
367
+ ```
368
+
369
+ ### Date Arithmetic
370
+
371
+ #### Adding/Subtracting Days
372
+
373
+ ```typescript
374
+ // Add days
375
+ const futureDate = addDays(new Date(), 7)
376
+ // Returns: Date 7 days from now
377
+
378
+ // Subtract days
379
+ const pastDate = subtractDays(new Date(), 5)
380
+ // Returns: Date 5 days ago
381
+ ```
382
+
383
+ #### Adding/Subtracting Time Units
384
+
385
+ ```typescript
386
+ // Add multiple time units
387
+ const newDate = add(new Date(), {
388
+ years: 1,
389
+ months: 2,
390
+ days: 5,
391
+ hours: 3,
392
+ minutes: 30
393
+ })
394
+
395
+ // Subtract multiple time units
396
+ const earlierDate = sub(new Date(), {
397
+ weeks: 2,
398
+ days: 3,
399
+ hours: 12
400
+ })
401
+
402
+ // Functional programming style (reversed arguments)
403
+ const fpDate = addFp({ days: 7 }, new Date())
404
+ const fpDate2 = subFp({ hours: 5 }, new Date())
405
+ ```
406
+
407
+ ### Time Operations
408
+
409
+ #### Getting Time Components
410
+
411
+ ```typescript
412
+ const date = new Date('2024-12-31T14:30:45')
413
+
414
+ const hours = getHours(date) // 14
415
+ const minutes = getMinutes(date) // 30
416
+ const seconds = getSeconds(date) // 45
417
+ ```
418
+
419
+ #### Setting Time
420
+
421
+ ```typescript
422
+ // Set time on a date (returns new Date object)
423
+ const newDate = setTime(new Date(), {
424
+ hours: 14,
425
+ minutes: 30,
426
+ seconds: 0
427
+ })
428
+ ```
429
+
430
+ ### Date Comparisons
431
+
432
+ ```typescript
433
+ const date1 = new Date('2024-12-31')
434
+ const date2 = new Date('2025-01-01')
435
+
436
+ // Check if date1 is after date2
437
+ const isLater = isAfter(date1, date2, 'day')
438
+ // Returns: false
439
+
440
+ // Check if date1 is same or after date2
441
+ const isSameOrLater = isSameAfter(date1, date2, 'day')
442
+ // Returns: false
443
+
444
+ // Check if date1 is before date2
445
+ const isEarlier = isBefore(date1, date2, 'day')
446
+ // Returns: true
447
+
448
+ // Check if date1 is same or before date2
449
+ const isSameOrEarlier = isSameBefore(date1, date2, 'day')
450
+ // Returns: true
451
+ ```
452
+
453
+ **Comparison Units**: The comparison functions accept a `units` parameter (default: `'minute'`). Valid units:
454
+ - `'year'`, `'month'`, `'week'`, `'day'`
455
+ - `'hour'`, `'minute'`, `'second'`
456
+
457
+ ### Complete Usage Example
458
+
459
+ ```typescript
460
+ import {
461
+ formatDate,
462
+ addDays,
463
+ isAfter,
464
+ format,
465
+ add,
466
+ getHours,
467
+ setTime
468
+ } from '@voicenter-team/voicenter-ui-plus'
469
+
470
+ // Format today's date
471
+ const today = formatDate(new Date(), 'DD/MM/YYYY')
472
+
473
+ // Get date 30 days from now
474
+ const futureDate = addDays(new Date(), 30)
475
+
476
+ // Check if a date is in the future
477
+ const isFuture = isAfter(futureDate, new Date(), 'day')
478
+
479
+ // Add 2 weeks and 3 days
480
+ const deadline = add(new Date(), {
481
+ weeks: 2,
482
+ days: 3
483
+ })
484
+
485
+ // Get current hour
486
+ const currentHour = getHours(new Date())
487
+
488
+ // Set specific time
489
+ const meetingTime = setTime(new Date(), {
490
+ hours: 14,
491
+ minutes: 30
492
+ })
493
+
494
+ // Format the result
495
+ const formattedDeadline = format(deadline, 'DD/MM/YYYY HH:mm')
496
+ ```
497
+
498
+ ### Notes
499
+
500
+ - All functions accept `Date`, `string`, or `number` as date input
501
+ - All date manipulation functions return new `Date` objects (immutable)
502
+ - Format strings use dayjs format tokens (see Format Tokens section above)
503
+ - These utilities are built on dayjs and maintain compatibility with dayjs format patterns
504
+
505
+ ## Contributing: adding a new component
506
+
507
+ The public component surface is defined in **one place**: [`script/components-manifest.mjs`](./script/components-manifest.mjs) — one line per component.
508
+
509
+ ```js
510
+ { name: 'VcMyThing', path: 'components/VcMyThing/VcMyThing.vue' },
511
+ ```
512
+
513
+ `npm run generate:entries` materializes the manifest into three fully
514
+ generated files (never edit them by hand — the next generator run
515
+ overwrites them, and the verifier fails the build until they match):
516
+
517
+ - `src/components.gen.ts` — named exports, re-exported by `src/index.ts`
518
+ (tree-shake mode);
519
+ - `src/plugin-components.gen.ts` — `registerComponents(app)`, called by
520
+ the plugin's install (global registration mode);
521
+ - `src/components/exports.ts` — the `GlobalComponents` template typing.
522
+
523
+ `src/index.ts` and `src/plugin.ts` themselves stay hand-written and small.
524
+ The `.gen` modules are safe to route through only because
525
+ `rewriteCssImports()` in `vite.config.ts` strips the CSS imports that
526
+ `vite-plugin-lib-inject-css` aggregates onto them — each component's CSS
527
+ stays in its own chunk, so per-component CSS tree-shaking survives. Don't
528
+ rename the `.gen` files without updating that strip list (the verifier
529
+ guards this wiring too).
530
+
531
+ Typical flows:
532
+
533
+ - **New component**: `node script/create-component.mjs` — scaffolds the
534
+ component folder, adds the manifest line, and regenerates all entries.
535
+ - **Existing .vue file**: add one line to the manifest, then
536
+ `npm run generate:entries`.
537
+
538
+ Every manifest entry is exported from the package root AND registered
539
+ globally in plugin mode — there are no partial modes.
540
+
541
+ `npm run verify:entries` is the safety net: it independently cross-checks
542
+ the manifest, the three generated files and the filesystem (a component
543
+ file that exists but is missing from the manifest fails too). It runs in
544
+ the pre-commit hook (together with `lint-staged` and `ts-check`; hooks are
545
+ installed automatically by `npm install` via husky) and in CI, so an
546
+ inconsistent component surface cannot reach `master`.
547
+
548
+ ## Documentation
549
+
550
+ ### Live Documentation
551
+ Visit [documentation](https://voicenter-ui.netlify.app/) for interactive component examples and demos.
552
+
553
+ ## Project Documentation
554
+ For detailed technical documentation, see the [`docs/`](./docs/) directory:
555
+
556
+ - **[Quick Start Guide](./docs/AGENTS_QUICK_START.md)** - For developers working on the library
557
+ - **[Architecture Overview](./docs/ARCHITECTURE.md)** - Project structure and technical details
558
+ - **[Documentation Guide](./docs/DOCUMENTATION_GUIDE.md)** - Working with the documentation system