mgv-backoffice 1.0.13 → 1.2.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 +735 -70
- package/dist/index.d.ts +1 -27
- package/dist/{components → src/components}/BaseAlert.vue.d.ts +2 -2
- package/dist/src/components/BaseAppLayout.vue.d.ts +31 -0
- package/dist/{components → src/components}/BaseButton.vue.d.ts +5 -2
- package/dist/src/components/BaseCollapsibleSection.vue.d.ts +35 -0
- package/dist/src/components/BaseConfirmModal.vue.d.ts +23 -0
- package/dist/src/components/BaseEntityPickerModal.vue.d.ts +58 -0
- package/dist/{components → src/components}/BaseLogo.vue.d.ts +3 -3
- package/dist/{components → src/components}/BaseModal.vue.d.ts +4 -3
- package/dist/src/components/BaseModalShell.vue.d.ts +43 -0
- package/dist/src/components/BaseNotFoundPage.vue.d.ts +17 -0
- package/dist/src/components/BaseSidebar.vue.d.ts +46 -0
- package/dist/src/components/BaseTextInputModal.vue.d.ts +46 -0
- package/dist/{components → src/components}/BaseToast.vue.d.ts +14 -2
- package/dist/{components → src/components}/Pagination.vue.d.ts +0 -3
- package/dist/src/composables/useDebounce.d.ts +10 -0
- package/dist/src/composables/useEscapeKey.d.ts +6 -0
- package/dist/src/composables/useMobileSidebar.d.ts +6 -0
- package/dist/src/composables/useTheme.d.ts +19 -0
- package/dist/src/composables/useThemeClasses.d.ts +62 -0
- package/dist/src/composables/useToast.d.ts +19 -0
- package/dist/{enums → src/enums}/AlertEnum.d.ts +1 -1
- package/dist/{enums → src/enums}/BaseButtonSizeEnum.d.ts +1 -1
- package/dist/src/enums/BaseLogoEnum.d.ts +7 -0
- package/dist/src/index.d.ts +46 -0
- package/dist/src/types/entityPicker.d.ts +11 -0
- package/dist/src/types/sidebar.d.ts +22 -0
- package/dist/src/utils/httpColors.d.ts +19 -0
- package/dist/ui-lib.css +3 -0
- package/dist/ui-lib.js +1624 -1011
- package/dist/ui-lib.umd.cjs +1 -1
- package/package.json +14 -14
- package/src/components/BaseAlert.vue +2 -2
- package/src/components/BaseAppLayout.vue +65 -0
- package/src/components/BaseBreadcrumb.vue +2 -1
- package/src/components/BaseButton.vue +152 -132
- package/src/components/BaseCollapsibleSection.vue +107 -0
- package/src/components/BaseConfirmModal.vue +110 -0
- package/src/components/BaseEntityPickerModal.vue +330 -0
- package/src/components/BaseLogo.vue +5 -5
- package/src/components/BaseModal.vue +95 -75
- package/src/components/BaseModalShell.vue +115 -0
- package/src/components/BaseNotFoundPage.vue +51 -0
- package/src/components/BaseSidebar.vue +223 -0
- package/src/components/BaseTextInputModal.vue +144 -0
- package/src/components/BaseToast.vue +41 -20
- package/src/components/ColoredSquares.vue +2 -4
- package/src/components/Pagination.vue +137 -136
- package/src/components/TrendArrow.vue +1 -1
- package/src/composables/useDebounce.ts +32 -0
- package/src/composables/useEscapeKey.ts +15 -0
- package/src/composables/useMobileSidebar.ts +23 -0
- package/src/composables/useTheme.ts +69 -0
- package/src/composables/useThemeClasses.ts +133 -0
- package/src/composables/useToast.ts +56 -0
- package/src/enums/AlertEnum.ts +1 -1
- package/src/enums/BaseButtonSizeEnum.ts +1 -1
- package/src/enums/BaseLogoEnum.ts +4 -1
- package/src/index.ts +64 -36
- package/src/types/entityPicker.ts +11 -0
- package/src/types/sidebar.ts +24 -0
- package/src/utils/httpColors.ts +68 -0
- package/src/utils/util.ts +61 -53
- package/dist/enums/BaseLogoEnum.d.ts +0 -5
- package/dist/style.css +0 -1
- /package/dist/{components → src/components}/BaseBadge.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseBreadcrumb.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseLine.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseRow.vue.d.ts +0 -0
- /package/dist/{components → src/components}/BaseSpinner.vue.d.ts +0 -0
- /package/dist/{components → src/components}/ColoredSquares.vue.d.ts +0 -0
- /package/dist/{components → src/components}/EarningsCard.vue.d.ts +0 -0
- /package/dist/{components → src/components}/EuroAmount.vue.d.ts +0 -0
- /package/dist/{components → src/components}/TrendArrow.vue.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseBadgeEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseButtonEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseModalEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/BaseToastEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/ColorsEnums.d.ts +0 -0
- /package/dist/{enums → src/enums}/LineEnum.d.ts +0 -0
- /package/dist/{enums → src/enums}/PositioningEnum.d.ts +0 -0
- /package/dist/{utils → src/utils}/util.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,113 +1,778 @@
|
|
|
1
|
-
### Login
|
|
2
|
-
|
|
3
|
-
npm login
|
|
4
|
-
|
|
5
1
|
# mgv-backoffice
|
|
6
2
|
|
|
7
|
-
Shared Vue 3 UI component library.
|
|
3
|
+
Shared Vue 3 UI component library built with TypeScript and Tailwind CSS.
|
|
8
4
|
|
|
9
|
-
##
|
|
5
|
+
## Installation
|
|
10
6
|
|
|
11
|
-
|
|
12
|
-
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install mgv-backoffice
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
### Peer Dependencies
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
These must be installed in your project:
|
|
15
14
|
|
|
16
15
|
```bash
|
|
17
|
-
npm install
|
|
16
|
+
npm install vue@^3.3.0 vue-router@^4.0.0 @heroicons/vue@^2.0.0
|
|
18
17
|
```
|
|
19
18
|
|
|
20
|
-
|
|
19
|
+
### Import Styles
|
|
21
20
|
|
|
22
|
-
|
|
21
|
+
Include the library's stylesheet in your app entry point:
|
|
23
22
|
|
|
24
|
-
```
|
|
25
|
-
|
|
23
|
+
```ts
|
|
24
|
+
import 'mgv-backoffice/dist/style.css'
|
|
26
25
|
```
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
### Tailwind Safelist
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
If your project uses Tailwind, import the safelist so dynamic classes used by this library are generated correctly:
|
|
31
30
|
|
|
32
|
-
```
|
|
33
|
-
|
|
31
|
+
```js
|
|
32
|
+
// In your Tailwind config
|
|
33
|
+
import safelist from 'mgv-backoffice/tailwind.safelist'
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Or include the pre-built CSS safelist:
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
```css
|
|
39
|
+
@import 'mgv-backoffice/tailwind.safelist.css';
|
|
40
|
+
```
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
---
|
|
41
43
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
## Components
|
|
45
|
+
|
|
46
|
+
### BaseAlert
|
|
45
47
|
|
|
46
|
-
|
|
47
|
-
npm version minor
|
|
48
|
+
Dismissible alert banner with color-coded variants.
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
**Props:**
|
|
51
|
+
|
|
52
|
+
| Prop | Type | Default | Description |
|
|
53
|
+
| ------- | ----------- | ------------------ | ------------------------ |
|
|
54
|
+
| `title` | `String` | `AlertEnum.ERROR` | Text displayed in alert |
|
|
55
|
+
| `color` | `AlertEnum` | `AlertEnum.ERROR` | Alert color variant |
|
|
56
|
+
|
|
57
|
+
**Example:**
|
|
58
|
+
|
|
59
|
+
```vue
|
|
60
|
+
<template>
|
|
61
|
+
<BaseAlert title="Operation successful" :color="AlertEnum.SUCCESS" />
|
|
62
|
+
<BaseAlert title="Something went wrong" :color="AlertEnum.ERROR" />
|
|
63
|
+
</template>
|
|
64
|
+
|
|
65
|
+
<script setup lang="ts">
|
|
66
|
+
import { BaseAlert, AlertEnum } from 'mgv-backoffice'
|
|
67
|
+
</script>
|
|
51
68
|
```
|
|
52
69
|
|
|
53
|
-
|
|
70
|
+
---
|
|
54
71
|
|
|
55
|
-
###
|
|
72
|
+
### BaseBadge
|
|
56
73
|
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
Colored status badge/pill.
|
|
75
|
+
|
|
76
|
+
**Props:**
|
|
77
|
+
|
|
78
|
+
| Prop | Type | Default | Description |
|
|
79
|
+
| ------- | -------- | ------- | --------------------------------- |
|
|
80
|
+
| `color` | `String` | — | Color variant (use `ColorsEnums`) |
|
|
81
|
+
|
|
82
|
+
**Slots:** `default` — badge label content.
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
|
|
86
|
+
```vue
|
|
87
|
+
<template>
|
|
88
|
+
<BaseBadge :color="ColorsEnums.GREEN">Active</BaseBadge>
|
|
89
|
+
<BaseBadge :color="ColorsEnums.RED">Inactive</BaseBadge>
|
|
90
|
+
</template>
|
|
91
|
+
|
|
92
|
+
<script setup lang="ts">
|
|
93
|
+
import { BaseBadge, ColorsEnums } from 'mgv-backoffice'
|
|
94
|
+
</script>
|
|
59
95
|
```
|
|
60
96
|
|
|
61
|
-
|
|
97
|
+
---
|
|
62
98
|
|
|
63
|
-
###
|
|
99
|
+
### BaseBreadcrumb
|
|
64
100
|
|
|
65
|
-
|
|
66
|
-
|
|
101
|
+
Breadcrumb navigation. Provide items manually or pass a URL path for auto-generation.
|
|
102
|
+
|
|
103
|
+
**Props:**
|
|
104
|
+
|
|
105
|
+
| Prop | Type | Default | Description |
|
|
106
|
+
| ------- | --------------- | ----------- | ------------------------------------------ |
|
|
107
|
+
| `items` | `BreadCrumb[]` | `undefined` | Manual breadcrumb entries |
|
|
108
|
+
| `path` | `String` | `undefined` | URL path for auto-generated breadcrumbs |
|
|
109
|
+
|
|
110
|
+
**BreadCrumb type:**
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
interface BreadCrumb {
|
|
114
|
+
name: string
|
|
115
|
+
url: string
|
|
116
|
+
}
|
|
67
117
|
```
|
|
68
118
|
|
|
69
|
-
|
|
119
|
+
**Example:**
|
|
120
|
+
|
|
121
|
+
```vue
|
|
122
|
+
<template>
|
|
123
|
+
<!-- Manual -->
|
|
124
|
+
<BaseBreadcrumb :items="[
|
|
125
|
+
{ name: 'Home', url: '/' },
|
|
126
|
+
{ name: 'Users', url: '/users' },
|
|
127
|
+
{ name: 'Profile', url: '/users/1' }
|
|
128
|
+
]" />
|
|
129
|
+
|
|
130
|
+
<!-- Auto-generated from path -->
|
|
131
|
+
<BaseBreadcrumb path="/users/settings/profile" />
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script setup lang="ts">
|
|
135
|
+
import { BaseBreadcrumb } from 'mgv-backoffice'
|
|
136
|
+
import type { BreadCrumb } from 'mgv-backoffice'
|
|
137
|
+
</script>
|
|
138
|
+
```
|
|
70
139
|
|
|
71
|
-
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
### BaseButton
|
|
143
|
+
|
|
144
|
+
Button with color, size, loading state, and Vue Router integration.
|
|
145
|
+
|
|
146
|
+
**Props:**
|
|
147
|
+
|
|
148
|
+
| Prop | Type | Default | Description |
|
|
149
|
+
| ------------- | ----------------------------------- | --------------------- | ------------------------------------ |
|
|
150
|
+
| `description` | `String` | **required** | Button label text |
|
|
151
|
+
| `color` | `String` | `BaseButtonEnum.BLUE` | Color variant |
|
|
152
|
+
| `to` | `String` | — | Vue Router path (renders `<router-link>`) |
|
|
153
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | HTML button type |
|
|
154
|
+
| `icon` | `String` | — | Right-side icon name |
|
|
155
|
+
| `iconSize` | `String` | — | Icon size class |
|
|
156
|
+
| `iconLeft` | `String` | — | Left-side icon name |
|
|
157
|
+
| `isRounded` | `Boolean` | — | Fully rounded corners |
|
|
158
|
+
| `isDisable` | `Boolean` | — | Disabled state |
|
|
159
|
+
| `size` | `String` | — | Size variant (use `BaseButtonSizeEnum`) |
|
|
160
|
+
| `isLoading` | `Boolean` | — | Show loading spinner |
|
|
161
|
+
|
|
162
|
+
**Slots:** `default`
|
|
163
|
+
|
|
164
|
+
**Example:**
|
|
165
|
+
|
|
166
|
+
```vue
|
|
167
|
+
<template>
|
|
168
|
+
<BaseButton description="Submit" :color="BaseButtonEnum.GREEN" type="submit" />
|
|
169
|
+
<BaseButton description="Go to Users" :to="'/users'" />
|
|
170
|
+
<BaseButton description="Saving..." :isLoading="true" :isDisable="true" />
|
|
171
|
+
<BaseButton
|
|
172
|
+
description="Delete"
|
|
173
|
+
:color="BaseButtonEnum.RED"
|
|
174
|
+
:size="BaseButtonSizeEnum.SMALL"
|
|
175
|
+
/>
|
|
176
|
+
</template>
|
|
177
|
+
|
|
178
|
+
<script setup lang="ts">
|
|
179
|
+
import { BaseButton, BaseButtonEnum, BaseButtonSizeEnum } from 'mgv-backoffice'
|
|
180
|
+
</script>
|
|
181
|
+
```
|
|
72
182
|
|
|
73
|
-
|
|
74
|
-
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
### BaseLine
|
|
186
|
+
|
|
187
|
+
Horizontal divider with style variants.
|
|
188
|
+
|
|
189
|
+
**Props:**
|
|
190
|
+
|
|
191
|
+
| Prop | Type | Default | Description |
|
|
192
|
+
| ------ | -------- | --------------- | ----------------- |
|
|
193
|
+
| `mode` | `String` | `LineEnum.BASE` | Divider style |
|
|
194
|
+
|
|
195
|
+
**Example:**
|
|
196
|
+
|
|
197
|
+
```vue
|
|
198
|
+
<template>
|
|
199
|
+
<BaseLine />
|
|
200
|
+
<BaseLine :mode="LineEnum.SQUARE" />
|
|
201
|
+
</template>
|
|
202
|
+
|
|
203
|
+
<script setup lang="ts">
|
|
204
|
+
import { BaseLine, LineEnum } from 'mgv-backoffice'
|
|
205
|
+
</script>
|
|
75
206
|
```
|
|
76
207
|
|
|
77
|
-
|
|
208
|
+
---
|
|
78
209
|
|
|
79
|
-
|
|
80
|
-
|
|
210
|
+
### BaseLogo
|
|
211
|
+
|
|
212
|
+
SVG brand logo component.
|
|
213
|
+
|
|
214
|
+
**Props:**
|
|
215
|
+
|
|
216
|
+
| Prop | Type | Default | Description |
|
|
217
|
+
| ------ | -------- | ---------------------- | ------------ |
|
|
218
|
+
| `size` | `String` | `BaseLoginEnum.MEDIUM` | Logo size |
|
|
219
|
+
|
|
220
|
+
**Example:**
|
|
221
|
+
|
|
222
|
+
```vue
|
|
223
|
+
<template>
|
|
224
|
+
<BaseLogo :size="BaseLoginEnum.LARGE" />
|
|
225
|
+
</template>
|
|
226
|
+
|
|
227
|
+
<script setup lang="ts">
|
|
228
|
+
import { BaseLogo, BaseLoginEnum } from 'mgv-backoffice'
|
|
229
|
+
</script>
|
|
81
230
|
```
|
|
82
231
|
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
### BaseModal
|
|
235
|
+
|
|
236
|
+
Confirmation dialog with support for delete and success modes.
|
|
237
|
+
|
|
238
|
+
**Props:**
|
|
239
|
+
|
|
240
|
+
| Prop | Type | Default | Description |
|
|
241
|
+
| ------------- | -------- | ----------- |-------------------------------------|
|
|
242
|
+
| `title` | `String` | **required**| Modal heading |
|
|
243
|
+
| `description` | `String` | — | Body text |
|
|
244
|
+
| `to` | `String` | `"/"` | Redirect path on confirm |
|
|
245
|
+
| `mode` | `String` | `'SUCCESS'` | Modal variant (use `BaseModalEnum`) |
|
|
246
|
+
|
|
247
|
+
**Events:**
|
|
248
|
+
|
|
249
|
+
| Event | Description |
|
|
250
|
+
| -------------- | ------------------------------- |
|
|
251
|
+
| `closeModal` | Emitted when modal is dismissed |
|
|
252
|
+
| `confirmModal` | Emitted on confirm action |
|
|
253
|
+
|
|
254
|
+
**Example:**
|
|
255
|
+
|
|
256
|
+
```vue
|
|
257
|
+
<template>
|
|
258
|
+
<BaseModal
|
|
259
|
+
title="Delete this item?"
|
|
260
|
+
description="This action cannot be undone."
|
|
261
|
+
:mode="BaseModalEnum.DELETE"
|
|
262
|
+
@closeModal="showModal = false"
|
|
263
|
+
@confirmModal="handleDelete"
|
|
264
|
+
/>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<script setup lang="ts">
|
|
268
|
+
import { ref } from 'vue'
|
|
269
|
+
import { BaseModal, BaseModalEnum } from 'mgv-backoffice'
|
|
270
|
+
|
|
271
|
+
const showModal = ref(true)
|
|
272
|
+
const handleDelete = () => { /* ... */ }
|
|
273
|
+
</script>
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
### BaseRow
|
|
279
|
+
|
|
280
|
+
Card-like content container with border and shadow.
|
|
281
|
+
|
|
282
|
+
**Props:**
|
|
283
|
+
|
|
284
|
+
| Prop | Type | Default | Description |
|
|
285
|
+
| --------- | -------- | --------- | ---------------------- |
|
|
286
|
+
| `bgColor` | `String` | `"white"` | Background color class |
|
|
287
|
+
|
|
288
|
+
**Slots:** `default` — row content.
|
|
289
|
+
|
|
290
|
+
**Example:**
|
|
291
|
+
|
|
292
|
+
```vue
|
|
293
|
+
<template>
|
|
294
|
+
<BaseRow>
|
|
295
|
+
<p>Card content goes here</p>
|
|
296
|
+
</BaseRow>
|
|
297
|
+
</template>
|
|
298
|
+
|
|
299
|
+
<script setup lang="ts">
|
|
300
|
+
import { BaseRow } from 'mgv-backoffice'
|
|
301
|
+
</script>
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
### BaseSpinner
|
|
307
|
+
|
|
308
|
+
Simple animated loading spinner.
|
|
309
|
+
|
|
310
|
+
**Props:** None
|
|
311
|
+
|
|
312
|
+
**Example:**
|
|
313
|
+
|
|
314
|
+
```vue
|
|
315
|
+
<template>
|
|
316
|
+
<BaseSpinner />
|
|
317
|
+
</template>
|
|
318
|
+
|
|
319
|
+
<script setup lang="ts">
|
|
320
|
+
import { BaseSpinner } from 'mgv-backoffice'
|
|
321
|
+
</script>
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
### BaseToast
|
|
327
|
+
|
|
328
|
+
Toast notification with positioning and auto-dismiss.
|
|
329
|
+
|
|
330
|
+
**Props:**
|
|
331
|
+
|
|
332
|
+
| Prop | Type | Default | Description |
|
|
333
|
+
| -------------- | ---------------- | --------- | ------------------------------------------ |
|
|
334
|
+
| `mode` | `BaseToastEnum` | **required** | Toast variant (SUCCESS, WARNING, ERROR) |
|
|
335
|
+
| `description` | `String` | **required** | Message text |
|
|
336
|
+
| `hasCloseIcon` | `Boolean` | `true` | Show close button |
|
|
337
|
+
| `positioning` | `String` | `'right'` | Screen position (use `PositioningEnum`) |
|
|
338
|
+
|
|
339
|
+
**Example:**
|
|
340
|
+
|
|
341
|
+
```vue
|
|
342
|
+
<template>
|
|
343
|
+
<BaseToast
|
|
344
|
+
:mode="BaseToastEnum.SUCCESS"
|
|
345
|
+
description="Changes saved successfully!"
|
|
346
|
+
:positioning="PositioningEnum.TOP_RIGHT"
|
|
347
|
+
/>
|
|
348
|
+
</template>
|
|
349
|
+
|
|
350
|
+
<script setup lang="ts">
|
|
351
|
+
import { BaseToast, BaseToastEnum, PositioningEnum } from 'mgv-backoffice'
|
|
352
|
+
</script>
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
---
|
|
356
|
+
|
|
357
|
+
### ColoredSquares
|
|
358
|
+
|
|
359
|
+
Colored square indicator with randomized pastel accent.
|
|
360
|
+
|
|
361
|
+
**Props:**
|
|
362
|
+
|
|
363
|
+
| Prop | Type | Default | Description |
|
|
364
|
+
| ------- | -------- | ------- | --------------------------------- |
|
|
365
|
+
| `color` | `String` | — | Color variant (use `ColorsEnums`) |
|
|
366
|
+
|
|
367
|
+
**Slots:** `default` — label content.
|
|
368
|
+
|
|
369
|
+
**Example:**
|
|
370
|
+
|
|
371
|
+
```vue
|
|
372
|
+
<template>
|
|
373
|
+
<ColoredSquares :color="ColorsEnums.BLUE">Category A</ColoredSquares>
|
|
374
|
+
</template>
|
|
375
|
+
|
|
376
|
+
<script setup lang="ts">
|
|
377
|
+
import { ColoredSquares, ColorsEnums } from 'mgv-backoffice'
|
|
378
|
+
</script>
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
### EarningsCard
|
|
384
|
+
|
|
385
|
+
Earnings summary card with formatted currency display.
|
|
386
|
+
|
|
387
|
+
**Props:**
|
|
388
|
+
|
|
389
|
+
| Prop | Type | Default | Description |
|
|
390
|
+
| ---------- | -------- |-------------------------|----------------------|
|
|
391
|
+
| `title` | `String` | `'TOTAL EARNINGS'` | Card heading |
|
|
392
|
+
| `amount` | `Number` | `0` | Monetary value |
|
|
393
|
+
| `subtitle` | `String` | `'Lifetime commission'` | Subheading text |
|
|
394
|
+
| `badge` | `String` | `''` | Optional badge label |
|
|
395
|
+
| `currency` | `String` | `'$'` | Currency symbol |
|
|
396
|
+
|
|
397
|
+
**Example:**
|
|
398
|
+
|
|
399
|
+
```vue
|
|
400
|
+
<template>
|
|
401
|
+
<EarningsCard
|
|
402
|
+
title="Monthly Revenue"
|
|
403
|
+
:amount="12500"
|
|
404
|
+
subtitle="April 2026"
|
|
405
|
+
currency="€"
|
|
406
|
+
/>
|
|
407
|
+
</template>
|
|
408
|
+
|
|
409
|
+
<script setup lang="ts">
|
|
410
|
+
import { EarningsCard } from 'mgv-backoffice'
|
|
411
|
+
</script>
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### EuroAmount
|
|
417
|
+
|
|
418
|
+
Formatted euro currency display with conditional color coding.
|
|
419
|
+
|
|
420
|
+
**Props:**
|
|
421
|
+
|
|
422
|
+
| Prop | Type | Default | Description |
|
|
423
|
+
| -------------- | --------- | ------- |-------------------------------------------------|
|
|
424
|
+
| `amount` | `Number` | — | Value to display |
|
|
425
|
+
| `beforeAmount` | `Number` | `null` | Previous value (green if amount > beforeAmount) |
|
|
426
|
+
| `showCurrency` | `Boolean` | `true` | Show euro symbol |
|
|
427
|
+
|
|
428
|
+
**Example:**
|
|
429
|
+
|
|
430
|
+
```vue
|
|
431
|
+
<template>
|
|
432
|
+
<!-- Shows green (amount > beforeAmount) -->
|
|
433
|
+
<EuroAmount :amount="1500" :beforeAmount="1200" />
|
|
434
|
+
|
|
435
|
+
<!-- Shows red (negative) -->
|
|
436
|
+
<EuroAmount :amount="-300" />
|
|
437
|
+
|
|
438
|
+
<!-- Without currency symbol -->
|
|
439
|
+
<EuroAmount :amount="800" :showCurrency="false" />
|
|
440
|
+
</template>
|
|
441
|
+
|
|
442
|
+
<script setup lang="ts">
|
|
443
|
+
import { EuroAmount } from 'mgv-backoffice'
|
|
444
|
+
</script>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### Pagination
|
|
450
|
+
|
|
451
|
+
Page navigation with smart ellipsis for large page counts.
|
|
452
|
+
|
|
453
|
+
**Props:**
|
|
454
|
+
|
|
455
|
+
| Prop | Type | Default | Description |
|
|
456
|
+
| -------------- | -------- | ------- | ----------------------- |
|
|
457
|
+
| `totalItems` | `Number` | `10` | Total number of items |
|
|
458
|
+
| `itemsPerPage` | `Number` | `20` | Items shown per page |
|
|
459
|
+
|
|
460
|
+
**Events:**
|
|
461
|
+
|
|
462
|
+
| Event | Payload | Description |
|
|
463
|
+
| -------------- | -------- |----------------------------------|
|
|
464
|
+
| `page-changed` | `Number` | Emitted with the new page number |
|
|
465
|
+
|
|
466
|
+
**Example:**
|
|
467
|
+
|
|
468
|
+
```vue
|
|
469
|
+
<template>
|
|
470
|
+
<Pagination
|
|
471
|
+
:totalItems="200"
|
|
472
|
+
:itemsPerPage="10"
|
|
473
|
+
@page-changed="onPageChange"
|
|
474
|
+
/>
|
|
475
|
+
</template>
|
|
476
|
+
|
|
477
|
+
<script setup lang="ts">
|
|
478
|
+
import { Pagination } from 'mgv-backoffice'
|
|
479
|
+
|
|
480
|
+
const onPageChange = (page: number) => {
|
|
481
|
+
console.log('Page:', page)
|
|
482
|
+
}
|
|
483
|
+
</script>
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
### TrendArrow
|
|
489
|
+
|
|
490
|
+
Up/down trend indicator displayed as a colored badge.
|
|
491
|
+
|
|
492
|
+
**Props:**
|
|
493
|
+
|
|
494
|
+
| Prop | Type | Default | Description |
|
|
495
|
+
| -------- | -------- | ------- |------------------------------------------------------|
|
|
496
|
+
| `number` | `Number` | — | Positive = green arrow up, negative = red arrow down |
|
|
497
|
+
| `icon` | `String` | — | Optional icon override |
|
|
498
|
+
|
|
499
|
+
**Example:**
|
|
500
|
+
|
|
501
|
+
```vue
|
|
502
|
+
<template>
|
|
503
|
+
<TrendArrow :number="12.5" /> <!-- Green up arrow -->
|
|
504
|
+
<TrendArrow :number="-3.2" /> <!-- Red down arrow -->
|
|
505
|
+
</template>
|
|
506
|
+
|
|
507
|
+
<script setup lang="ts">
|
|
508
|
+
import { TrendArrow } from 'mgv-backoffice'
|
|
509
|
+
</script>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
---
|
|
513
|
+
|
|
514
|
+
## Enums
|
|
515
|
+
|
|
516
|
+
All enums are importable directly from the package:
|
|
517
|
+
|
|
83
518
|
```ts
|
|
84
|
-
import {
|
|
85
|
-
|
|
519
|
+
import {
|
|
520
|
+
AlertEnum,
|
|
521
|
+
BaseBadgeEnum,
|
|
522
|
+
BaseButtonEnum,
|
|
523
|
+
BaseButtonSizeEnum,
|
|
524
|
+
BaseLoginEnum,
|
|
525
|
+
BaseModalEnum,
|
|
526
|
+
BaseToastEnum,
|
|
527
|
+
ColorsEnums,
|
|
528
|
+
LineEnum,
|
|
529
|
+
PositioningEnum
|
|
530
|
+
} from 'mgv-backoffice'
|
|
86
531
|
```
|
|
87
532
|
|
|
88
|
-
|
|
533
|
+
| Enum | Values |
|
|
534
|
+
| -------------------- |---------------------------------------------------------------|
|
|
535
|
+
| `AlertEnum` | `WARNING`, `ERROR`, `SUCCESS`, `INFROM` |
|
|
536
|
+
| `BaseBadgeEnum` | `WIN`, `LOSE` |
|
|
537
|
+
| `BaseButtonEnum` | `RED`, `BLUE`, `WHITE`, `DARK`, `GREEN`, `YELLOW`, `PURPLE` |
|
|
538
|
+
| `BaseButtonSizeEnum` | `EXTRA_SMALL`, `SMALL`, `BASE`, `LARGE`, `EXTRA_LARGE` |
|
|
539
|
+
| `BaseLoginEnum` | `SMALL`, `MEDIUM`, `LARGE` |
|
|
540
|
+
| `BaseModalEnum` | `DELETE`, `SUCCESS` |
|
|
541
|
+
| `BaseToastEnum` | `SUCCESS`, `WARNING`, `ERROR` |
|
|
542
|
+
| `ColorsEnums` | `NONE`, `RED`, `YELLOW`, `BLACK`, `GRAY`, `GREEN`, `BLUE` |
|
|
543
|
+
| `LineEnum` | `BASE`, `BASE_SHORTER`, `SQUARE` |
|
|
544
|
+
| `PositioningEnum` | `TOP_LEFT`, `TOP_RIGHT`, `BOTTOM_LEFT`, `BOTTOM_RIGHT` |
|
|
545
|
+
|
|
546
|
+
---
|
|
547
|
+
|
|
548
|
+
## Types
|
|
549
|
+
|
|
550
|
+
```ts
|
|
551
|
+
import type { BreadCrumb } from 'mgv-backoffice'
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
| Type | Shape |
|
|
555
|
+
| ------------ | -------------------------------------- |
|
|
556
|
+
| `BreadCrumb` | `{ name: string; url: string }` |
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Utilities
|
|
561
|
+
|
|
562
|
+
```ts
|
|
563
|
+
import { getBaseColor, getBaseColorOf } from 'mgv-backoffice'
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
| Function | Signature | Returns |
|
|
567
|
+
| ---------------- | ---------------------------------- | ----------------------------------- |
|
|
568
|
+
| `getBaseColor` | `(c: AlertEnum) => string` | Tailwind color name for alert type |
|
|
569
|
+
| `getBaseColorOf` | `(c: ColorsEnums) => string` | Tailwind color name for color enum |
|
|
570
|
+
|
|
571
|
+
### HTTP colours
|
|
572
|
+
|
|
573
|
+
```ts
|
|
574
|
+
import {
|
|
575
|
+
methodBadgeSolid,
|
|
576
|
+
methodBadgeBright,
|
|
577
|
+
statusBadgeSolid,
|
|
578
|
+
statusBadgeTinted,
|
|
579
|
+
} from 'mgv-backoffice'
|
|
580
|
+
```
|
|
581
|
+
|
|
582
|
+
Tailwind class helpers for HTTP method and status code badges. `Solid` variants
|
|
583
|
+
return saturated `bg-*-600` classes for use on neutral surfaces; `Bright` /
|
|
584
|
+
`Tinted` variants return softer combinations suitable for cards. `statusBadgeTinted`
|
|
585
|
+
takes `(status, isDark)` to adapt between themes.
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
## Layout & shells (Tier 2 — full backoffice chrome)
|
|
590
|
+
|
|
591
|
+
### BaseAppLayout
|
|
592
|
+
|
|
593
|
+
Root layout: dark/light page background, skip link, `<main>`-with-inert wrapper.
|
|
594
|
+
|
|
595
|
+
**Props:**
|
|
596
|
+
|
|
597
|
+
| Prop | Type | Default | Description |
|
|
598
|
+
| ---- | ---- | ------- | ----------- |
|
|
599
|
+
| `showSidebar` | `Boolean` | `true` | Render the `sidebar` slot. Set false for full-bleed pages. |
|
|
600
|
+
| `skipLinkLabel` | `String` | `'Skip to main content'` | Label for the accessibility skip link. |
|
|
601
|
+
|
|
602
|
+
**Slots:** `sidebar`, `default` (page content).
|
|
603
|
+
|
|
604
|
+
```vue
|
|
605
|
+
<BaseAppLayout :show-sidebar="route.name !== 'presentation'">
|
|
606
|
+
<template #sidebar><AppSidebar /></template>
|
|
607
|
+
<RouterView />
|
|
608
|
+
</BaseAppLayout>
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
### BaseSidebar
|
|
612
|
+
|
|
613
|
+
Responsive sidebar with desktop fixed-positioning and mobile off-canvas
|
|
614
|
+
behavior, focus management, optional theme toggle, and configurable nav
|
|
615
|
+
sections.
|
|
616
|
+
|
|
617
|
+
**Props:**
|
|
618
|
+
|
|
619
|
+
| Prop | Type | Default | Description |
|
|
620
|
+
| ---- | ---- | ------- | ----------- |
|
|
621
|
+
| `sections` | `NavSection[]` | **required** | Grouped nav items. |
|
|
622
|
+
| `homeRouteName` | `String` | `'home'` | Route name for the logo / "go home" click. |
|
|
623
|
+
| `appName` | `String` | `''` | Optional app name in the footer. |
|
|
624
|
+
| `version` | `String` | `''` | Optional version string in the footer. |
|
|
625
|
+
| `showThemeToggle` | `Boolean` | `true` | Toggle the dark/light switch in the footer. |
|
|
626
|
+
|
|
627
|
+
**Slots:**
|
|
628
|
+
|
|
629
|
+
| Slot | Slot props | Description |
|
|
630
|
+
| -------- | ---------- | ----------- |
|
|
631
|
+
| `logo` | `{ size }` | Brand logo. Receives a `size` hint (28px in mobile bar, 52px in sidebar). |
|
|
632
|
+
| `status` | — | Footer status row (e.g. health indicator, sync state). |
|
|
633
|
+
| `footer` | — | Replaces the default `appName v0` line. |
|
|
634
|
+
|
|
635
|
+
**Types:**
|
|
636
|
+
|
|
637
|
+
```ts
|
|
638
|
+
import type { NavItem, NavSection } from 'mgv-backoffice'
|
|
639
|
+
|
|
640
|
+
interface NavItem {
|
|
641
|
+
name: string // Vue Router route name
|
|
642
|
+
label: string // display text
|
|
643
|
+
icon: Component // typically a Heroicon
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
interface NavSection {
|
|
647
|
+
title: string
|
|
648
|
+
items: NavItem[]
|
|
649
|
+
}
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
```vue
|
|
653
|
+
<BaseSidebar :sections="navSections" home-route-name="projects" app-name="WireMate UI" :version="appVersion">
|
|
654
|
+
<template #logo="{ size }"><WireMateLogo :size="size" /></template>
|
|
655
|
+
<template #status>
|
|
656
|
+
<HealthIndicator />
|
|
657
|
+
</template>
|
|
658
|
+
</BaseSidebar>
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
---
|
|
662
|
+
|
|
663
|
+
## Modals & sections
|
|
664
|
+
|
|
665
|
+
### BaseModalShell
|
|
666
|
+
|
|
667
|
+
Shared modal chrome — `Teleport` to body, backdrop, themed card, escape key,
|
|
668
|
+
aria-modal. Compose this rather than building modals from scratch.
|
|
669
|
+
|
|
670
|
+
**Props:**
|
|
671
|
+
|
|
672
|
+
| Prop | Type | Default | Description |
|
|
673
|
+
| --------------- | --------- | ----------- | ----------- |
|
|
674
|
+
| `title` | `String` | **required** | Modal heading. |
|
|
675
|
+
| `maxWidthClass` | `String` | `'max-w-md'` | Tailwind max-w utility for the card. |
|
|
676
|
+
| `manualClose` | `Boolean` | `false` | If true, backdrop click and Escape do NOT auto-emit `cancel`. |
|
|
677
|
+
|
|
678
|
+
**Slots:** `icon`, `default`, `footer`.
|
|
679
|
+
**Events:** `cancel`, `backdrop`.
|
|
680
|
+
|
|
681
|
+
### BaseConfirmModal
|
|
682
|
+
|
|
683
|
+
Confirmation dialog built on `BaseModalShell`. Variant chooses red (danger) or
|
|
684
|
+
amber (warning) styling.
|
|
685
|
+
|
|
686
|
+
**Props:** `title`, `message`, `confirmText`, `cancelText`, `submittingText`,
|
|
687
|
+
`variant: 'danger' | 'warning'`, `submitting`.
|
|
688
|
+
|
|
689
|
+
**Events:** `confirm`, `cancel`.
|
|
690
|
+
|
|
691
|
+
### BaseTextInputModal
|
|
692
|
+
|
|
693
|
+
"Ask the user for a single string and confirm" dialog. Preserves typed input
|
|
694
|
+
on stray backdrop clicks; Escape always cancels.
|
|
695
|
+
|
|
696
|
+
**Props:** `title`, `message`, `initialValue`, `placeholder`, `inputLabel`,
|
|
697
|
+
`confirmText`, `cancelText`, `submittingText`, `submitting`.
|
|
698
|
+
|
|
699
|
+
**Slots:** `icon` — override the default emerald document icon.
|
|
700
|
+
**Events:** `confirm(value: string)`, `cancel`.
|
|
701
|
+
|
|
702
|
+
### BaseEntityPickerModal
|
|
703
|
+
|
|
704
|
+
Searchable "pick one from a list" dialog. Pass `items` directly or an async
|
|
705
|
+
`loader` that runs on mount.
|
|
706
|
+
|
|
707
|
+
**Props:** `title`, `message?`, `items?: EntityPickerItem[]`,
|
|
708
|
+
`loader?: () => Promise<EntityPickerItem[]>`, `excludeId?`,
|
|
709
|
+
`variant: 'emerald' | 'purple' | 'blue' | 'red' | 'amber'`,
|
|
710
|
+
`searchPlaceholder`, `emptyMessage`, `noMatchMessage`, `confirmText`,
|
|
711
|
+
`cancelText`, `submittingText`, `submitting`.
|
|
712
|
+
|
|
713
|
+
**Events:** `confirm(itemId: string)`, `cancel`.
|
|
714
|
+
|
|
715
|
+
```ts
|
|
716
|
+
interface EntityPickerItem { id: string; label: string }
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### BaseCollapsibleSection
|
|
720
|
+
|
|
721
|
+
Section wrapper with a clickable header, optional badge, and a `default` slot
|
|
722
|
+
for the body. Parent owns the `collapsed` state.
|
|
723
|
+
|
|
724
|
+
**Props:** `title`, `collapsed`, `badge?`, `bodyClass?`.
|
|
725
|
+
**Events:** `toggle`.
|
|
726
|
+
|
|
727
|
+
### BaseNotFoundPage
|
|
728
|
+
|
|
729
|
+
Drop-in 404 view.
|
|
730
|
+
|
|
731
|
+
**Props:** `code` (`'404'`), `message` (`'Page not found'`),
|
|
732
|
+
`homeRouteName` (`'home'`), `homeLabel` (`'Go home'`).
|
|
733
|
+
|
|
734
|
+
---
|
|
735
|
+
|
|
736
|
+
## Composables
|
|
737
|
+
|
|
738
|
+
```ts
|
|
739
|
+
import {
|
|
740
|
+
useTheme,
|
|
741
|
+
useThemeClasses,
|
|
742
|
+
useEscapeKey,
|
|
743
|
+
useDebouncedRef,
|
|
744
|
+
useToast,
|
|
745
|
+
useMobileSidebar,
|
|
746
|
+
} from 'mgv-backoffice'
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
| Composable | Purpose |
|
|
750
|
+
| ---------- | ------- |
|
|
751
|
+
| `useTheme({ storageKey? })` | Singleton dark/light controller. Toggles `<html class="dark">` and persists via localStorage (default key `'mgv-theme'`). Consumers should call once at app entry with their app-specific storage key. |
|
|
752
|
+
| `useThemeClasses()` | Named Tailwind class roles for dark/light (card, border, primaryText, mutedText, dimText, input, ghostButton, emeraldText, redText, …). Returns computed refs auto-unwrapped in templates. |
|
|
753
|
+
| `useEscapeKey(handler)` | Component-scoped Escape key listener. |
|
|
754
|
+
| `useDebouncedRef(source, delay?)` | Debounced mirror of a ref. Timer cleared on scope dispose. |
|
|
755
|
+
| `useToast(durationMs?)` | Per-component toast state: `{ showToast, toastMessage, toastType, showToastMessage }`. |
|
|
756
|
+
| `useMobileSidebar()` | Singleton state shared between `BaseSidebar` and `BaseAppLayout` for the off-canvas open/closed flag. |
|
|
757
|
+
|
|
758
|
+
---
|
|
759
|
+
|
|
760
|
+
## Tailwind setup for consumers
|
|
761
|
+
|
|
762
|
+
The lib's components rely on Tailwind utility classes (including dark-mode
|
|
763
|
+
variants). Consumers should add the lib's `dist` output to their Tailwind
|
|
764
|
+
`content` paths so the JIT can see the class names:
|
|
765
|
+
|
|
766
|
+
```js
|
|
767
|
+
// tailwind.config.js
|
|
768
|
+
export default {
|
|
769
|
+
content: [
|
|
770
|
+
'./index.html',
|
|
771
|
+
'./src/**/*.{vue,ts}',
|
|
772
|
+
'./node_modules/mgv-backoffice/dist/**/*.{js,mjs,cjs,vue}',
|
|
773
|
+
],
|
|
774
|
+
}
|
|
775
|
+
```
|
|
89
776
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
| BaseAlert | Dismissible alert banner |
|
|
93
|
-
| BaseBadge | Colored status badge |
|
|
94
|
-
| BaseBreadcrumb | Auto-generated or manual breadcrumb nav |
|
|
95
|
-
| BaseButton | Button with color, size, loading, and routing support |
|
|
96
|
-
| BaseLine | Horizontal divider |
|
|
97
|
-
| BaseLogo | SVG brand logo |
|
|
98
|
-
| BaseModal | Confirmation modal dialog |
|
|
99
|
-
| BaseRow | Card-like content container |
|
|
100
|
-
| BaseSpinner | Loading spinner |
|
|
101
|
-
| BaseToast | Toast notification |
|
|
102
|
-
| ColoredSquares | Colored square indicator |
|
|
103
|
-
| EuroAmount | Formatted euro currency display |
|
|
104
|
-
| Pagination | Page navigation |
|
|
105
|
-
| TrendArrow | Up/down trend indicator with badge |
|
|
106
|
-
|
|
107
|
-
## Peer dependencies
|
|
108
|
-
|
|
109
|
-
These must be installed in the consuming project:
|
|
110
|
-
|
|
111
|
-
- `vue` ^3.3.0
|
|
112
|
-
- `vue-router` ^4.0.0
|
|
113
|
-
- `@heroicons/vue` ^2.0.0
|
|
777
|
+
The legacy `tailwind.safelist.js` only covers the v1 components; the
|
|
778
|
+
recommended path for v4+ is the `content` glob above.
|