@conduction/nextcloud-vue 0.1.0-beta.4 → 0.1.0-beta.6

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 (71) hide show
  1. package/dist/nextcloud-vue.cjs +67614 -0
  2. package/dist/nextcloud-vue.cjs.js +9559 -8983
  3. package/dist/nextcloud-vue.cjs.js.map +1 -1
  4. package/dist/nextcloud-vue.cjs.map +1 -0
  5. package/dist/nextcloud-vue.css +1231 -1231
  6. package/dist/nextcloud-vue.esm.js +9559 -8983
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/package.json +14 -5
  9. package/src/components/CnActionsBar/CnActionsBar.vue +235 -235
  10. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +579 -579
  11. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -217
  12. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -121
  13. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +418 -418
  14. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -247
  15. package/src/components/CnCardGrid/CnCardGrid.vue +152 -152
  16. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  17. package/src/components/CnChartWidget/CnChartWidget.vue +320 -320
  18. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  19. package/src/components/CnCopyDialog/CnCopyDialog.vue +250 -250
  20. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +225 -225
  21. package/src/components/CnDashboardPage/CnDashboardPage.vue +390 -390
  22. package/src/components/CnDataTable/CnDataTable.vue +349 -349
  23. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +170 -170
  24. package/src/components/CnDetailCard/CnDetailCard.vue +214 -214
  25. package/src/components/CnDetailPage/CnDetailPage.vue +285 -281
  26. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +231 -231
  27. package/src/components/CnFilterBar/CnFilterBar.vue +152 -152
  28. package/src/components/CnFormDialog/CnFormDialog.vue +302 -11
  29. package/src/components/CnIcon/CnIcon.vue +89 -89
  30. package/src/components/CnIndexPage/CnIndexPage.vue +884 -874
  31. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +503 -503
  32. package/src/components/CnItemCard/CnItemCard.vue +132 -132
  33. package/src/components/CnKpiGrid/CnKpiGrid.vue +89 -89
  34. package/src/components/CnMassActionBar/CnMassActionBar.vue +160 -160
  35. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +320 -320
  36. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +238 -238
  37. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +190 -190
  38. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +491 -491
  39. package/src/components/CnNoteCard/CnNoteCard.vue +149 -149
  40. package/src/components/CnNotesCard/CnNotesCard.vue +413 -413
  41. package/src/components/CnObjectCard/CnObjectCard.vue +292 -292
  42. package/src/components/CnObjectCard/eslint-setup.md +235 -0
  43. package/src/components/CnObjectCard/package.json-or.json +132 -0
  44. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +876 -876
  45. package/src/components/CnPageHeader/CnPageHeader.vue +57 -57
  46. package/src/components/CnPagination/CnPagination.vue +252 -252
  47. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +792 -792
  48. package/src/components/CnRowActions/CnRowActions.vue +95 -73
  49. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -226
  50. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +787 -787
  51. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -305
  52. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -1398
  53. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -236
  54. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  55. package/src/components/CnSettingsSection/CnSettingsSection.vue +266 -266
  56. package/src/components/CnStatsBlock/CnStatsBlock.vue +420 -420
  57. package/src/components/CnStatusBadge/CnStatusBadge.vue +77 -77
  58. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +540 -540
  59. package/src/components/CnTasksCard/CnTasksCard.vue +373 -373
  60. package/src/components/CnTileWidget/CnTileWidget.vue +159 -159
  61. package/src/components/CnTimelineStages/CnTimelineStages.vue +292 -292
  62. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +435 -435
  63. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +312 -312
  64. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -180
  65. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +211 -211
  66. package/src/index.js +1 -1
  67. package/src/types/notification.d.ts +13 -13
  68. package/src/types/organisation.d.ts +15 -15
  69. package/src/types/schema.d.ts +13 -13
  70. package/src/types/task.d.ts +6 -6
  71. package/src/utils/headers.js +5 -3
@@ -1,420 +1,420 @@
1
- <template>
2
- <component
3
- :is="componentTag"
4
- class="cn-stats-block"
5
- :class="rootClasses"
6
- v-bind="componentAttrs"
7
- @click="onClick">
8
- <!-- Icon -->
9
- <div v-if="hasIcon" class="cn-stats-block__icon" :class="iconClasses">
10
- <slot name="icon">
11
- <component :is="icon" v-if="icon" :size="iconSize" />
12
- </slot>
13
- </div>
14
-
15
- <!-- Content -->
16
- <div class="cn-stats-block__content">
17
- <div class="cn-stats-block__header">
18
- <h4>{{ title || 'Objects' }}</h4>
19
- </div>
20
-
21
- <div v-if="count > 0 || (showZeroCount && count === 0)" class="cn-stats-block__count">
22
- <span class="cn-stats-block__count-value">{{ formattedCount }}</span>
23
- <span class="cn-stats-block__count-label">{{ countLabel }}</span>
24
- </div>
25
- <div v-else-if="loading" class="cn-stats-block__loading">
26
- <NcLoadingIcon :size="16" />
27
- {{ loadingLabel }}
28
- </div>
29
- <div v-else class="cn-stats-block__empty">
30
- {{ emptyLabel }}
31
- </div>
32
-
33
- <!-- Breakdown details -->
34
- <div v-if="breakdown && (count > 0 || showZeroCount)" class="cn-stats-block__breakdown">
35
- <div
36
- v-for="(value, key) in breakdown"
37
- :key="key"
38
- class="cn-stats-block__breakdown-item">
39
- <span class="cn-stats-block__breakdown-label">{{ formatBreakdownLabel(key) }}</span>
40
- <span
41
- class="cn-stats-block__breakdown-value"
42
- :class="'cn-stats-block__breakdown-value--' + key">
43
- {{ value }}
44
- </span>
45
- </div>
46
- </div>
47
- </div>
48
- </component>
49
- </template>
50
-
51
- <script>
52
- import { NcLoadingIcon } from '@nextcloud/vue'
53
-
54
- /**
55
- * CnStatsBlock — Statistics display card with icon, count, and optional breakdown.
56
- *
57
- * Supports vertical (default) and horizontal layouts, color variants, icons,
58
- * and clickable state. Use in a CnKpiGrid for responsive dashboard layouts.
59
- *
60
- * @example Basic vertical (default)
61
- * <CnStatsBlock title="Cases" :count="42" count-label="open cases" />
62
- *
63
- * @example Horizontal with icon and variant
64
- * <CnStatsBlock
65
- * title="Open Cases"
66
- * :count="42"
67
- * :icon="BriefcaseOutline"
68
- * variant="primary"
69
- * horizontal
70
- * clickable
71
- * @click="goToCases" />
72
- *
73
- * @example With route-based navigation (renders as <router-link>)
74
- * <CnStatsBlock
75
- * title="Open Cases"
76
- * :count="42"
77
- * :icon="BriefcaseOutline"
78
- * variant="primary"
79
- * :route="{ name: 'Cases', query: { status: 'open' } }" />
80
- *
81
- * @example With breakdown
82
- * <CnStatsBlock
83
- * title="Cases"
84
- * :count="42"
85
- * :breakdown="{ total: 100, invalid: 3, deleted: 5, published: 92 }" />
86
- *
87
- * @example Custom icon slot
88
- * <CnStatsBlock title="Files" :count="128">
89
- * <template #icon>
90
- * <FileDocumentOutline :size="24" />
91
- * </template>
92
- * </CnStatsBlock>
93
- */
94
- export default {
95
- name: 'CnStatsBlock',
96
-
97
- components: {
98
- NcLoadingIcon,
99
- },
100
-
101
- props: {
102
- /** Block title */
103
- title: {
104
- type: String,
105
- default: '',
106
- },
107
- /** The main count number to display prominently */
108
- count: {
109
- type: Number,
110
- default: 0,
111
- },
112
- /** Label displayed next to the count */
113
- countLabel: {
114
- type: String,
115
- default: 'objects',
116
- },
117
- /** Detailed breakdown object (key-value pairs) */
118
- breakdown: {
119
- type: Object,
120
- default: null,
121
- },
122
- /** Whether data is currently loading */
123
- loading: {
124
- type: Boolean,
125
- default: false,
126
- },
127
- /** Text shown while loading */
128
- loadingLabel: {
129
- type: String,
130
- default: 'Loading...',
131
- },
132
- /** Text shown when count is 0 */
133
- emptyLabel: {
134
- type: String,
135
- default: 'No items found',
136
- },
137
- /** Icon component (e.g., imported MDI icon) */
138
- icon: {
139
- type: [Object, Function],
140
- default: null,
141
- },
142
- /** Icon size in pixels */
143
- iconSize: {
144
- type: Number,
145
- default: 24,
146
- },
147
- /** Color variant: 'default', 'primary', 'success', 'warning', 'error' */
148
- variant: {
149
- type: String,
150
- default: 'default',
151
- validator: (v) => ['default', 'primary', 'success', 'warning', 'error'].includes(v),
152
- },
153
- /** Use horizontal layout (icon left, content right) */
154
- horizontal: {
155
- type: Boolean,
156
- default: false,
157
- },
158
- /** Whether the card is clickable */
159
- clickable: {
160
- type: Boolean,
161
- default: false,
162
- },
163
- /** Whether to display 0 as a count value instead of the empty label */
164
- showZeroCount: {
165
- type: Boolean,
166
- default: false,
167
- },
168
- /**
169
- * Vue Router location object for declarative navigation.
170
- * When set, the card renders as a <router-link> and clickable styles are implied.
171
- * @example { name: 'Cases', query: { status: 'open' } }
172
- * @example { path: '/catalogi' }
173
- */
174
- route: {
175
- type: Object,
176
- default: null,
177
- },
178
- },
179
-
180
- computed: {
181
- hasIcon() {
182
- return this.icon !== null || this.$scopedSlots.icon || this.$slots.icon
183
- },
184
-
185
- formattedCount() {
186
- return this.count.toLocaleString()
187
- },
188
-
189
- /**
190
- * Whether the card is interactive (clickable or has a route).
191
- * Used for applying hover/focus styles.
192
- */
193
- isInteractive() {
194
- return !!this.route || this.clickable
195
- },
196
-
197
- /**
198
- * Determines which HTML element or component to render.
199
- * - route set → 'router-link' (SPA navigation)
200
- * - clickable → 'a' (app handles click via event)
201
- * - neither → 'div' (static display)
202
- */
203
- componentTag() {
204
- if (this.route) return 'router-link'
205
- if (this.clickable) return 'a'
206
- return 'div'
207
- },
208
-
209
- /**
210
- * Dynamic attributes for the root element based on rendering mode.
211
- */
212
- componentAttrs() {
213
- if (this.route) return { to: this.route, tabindex: '0' }
214
- if (this.clickable) return { href: '#', role: 'button', tabindex: '0' }
215
- return {}
216
- },
217
-
218
- rootClasses() {
219
- return {
220
- 'cn-stats-block--horizontal': this.horizontal,
221
- 'cn-stats-block--clickable': this.isInteractive,
222
- [`cn-stats-block--${this.variant}`]: this.variant !== 'default',
223
- }
224
- },
225
-
226
- iconClasses() {
227
- return {
228
- [`cn-stats-block__icon--${this.variant}`]: this.variant !== 'default',
229
- }
230
- },
231
- },
232
-
233
- methods: {
234
- formatBreakdownLabel(key) {
235
- return key.charAt(0).toUpperCase() + key.slice(1) + ':'
236
- },
237
-
238
- onClick(event) {
239
- // When route is set, router-link handles navigation — do not emit click
240
- if (this.route) return
241
- if (this.clickable) {
242
- event.preventDefault()
243
- this.$emit('click', event)
244
- }
245
- },
246
- },
247
- }
248
- </script>
249
-
250
- <style scoped>
251
- .cn-stats-block {
252
- background: var(--color-background-hover);
253
- border-radius: var(--border-radius-large, 10px);
254
- padding: 1rem;
255
- display: flex;
256
- flex-direction: column;
257
- align-items: center;
258
- text-decoration: none;
259
- color: inherit;
260
- border: 2px solid transparent;
261
- transition: border-color 0.15s ease, box-shadow 0.15s ease;
262
- }
263
-
264
- .cn-stats-block--horizontal {
265
- flex-direction: row;
266
- align-items: flex-start;
267
- gap: 16px;
268
- }
269
-
270
- .cn-stats-block--horizontal .cn-stats-block__content {
271
- text-align: left;
272
- }
273
-
274
- .cn-stats-block--horizontal .cn-stats-block__count {
275
- justify-content: flex-start;
276
- }
277
-
278
- .cn-stats-block--clickable {
279
- cursor: pointer;
280
- }
281
-
282
- .cn-stats-block--clickable:hover {
283
- border-color: var(--color-primary-element);
284
- box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
285
- }
286
-
287
- .cn-stats-block--clickable:focus-visible {
288
- outline: 2px solid var(--color-primary-element);
289
- outline-offset: 2px;
290
- }
291
-
292
- /* Icon */
293
- .cn-stats-block__icon {
294
- display: flex;
295
- align-items: center;
296
- justify-content: center;
297
- width: 44px;
298
- height: 44px;
299
- border-radius: 50%;
300
- background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
301
- color: var(--color-primary-element);
302
- flex-shrink: 0;
303
- margin-bottom: 8px;
304
- }
305
-
306
- .cn-stats-block--horizontal .cn-stats-block__icon {
307
- margin-bottom: 0;
308
- }
309
-
310
- .cn-stats-block__icon--primary {
311
- background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
312
- color: var(--color-primary-element);
313
- }
314
-
315
- .cn-stats-block__icon--success {
316
- background: rgba(70, 186, 97, 0.1);
317
- color: var(--color-success);
318
- }
319
-
320
- .cn-stats-block__icon--warning {
321
- background: rgba(232, 163, 24, 0.1);
322
- color: var(--color-warning);
323
- }
324
-
325
- .cn-stats-block__icon--error {
326
- background: rgba(224, 36, 36, 0.1);
327
- color: var(--color-error);
328
- }
329
-
330
- /* Content */
331
- .cn-stats-block__content {
332
- flex: 1;
333
- min-width: 0;
334
- text-align: center;
335
- }
336
-
337
- .cn-stats-block__header h4 {
338
- margin-top: 0;
339
- margin-bottom: 0.5rem;
340
- color: var(--color-main-text);
341
- font-size: 14px;
342
- font-weight: 600;
343
- }
344
-
345
- .cn-stats-block__count {
346
- display: flex;
347
- align-items: baseline;
348
- justify-content: center;
349
- gap: 0.5rem;
350
- font-size: 1.2rem;
351
- margin-bottom: 0.5rem;
352
- }
353
-
354
- .cn-stats-block__count-value {
355
- font-size: 2rem;
356
- font-weight: bold;
357
- color: var(--color-primary-element);
358
- }
359
-
360
- .cn-stats-block--primary .cn-stats-block__count-value { color: var(--color-primary-element); }
361
- .cn-stats-block--success .cn-stats-block__count-value { color: var(--color-success); }
362
- .cn-stats-block--warning .cn-stats-block__count-value { color: var(--color-warning); }
363
- .cn-stats-block--error .cn-stats-block__count-value { color: var(--color-error); }
364
-
365
- .cn-stats-block__count-label {
366
- color: var(--color-text-maxcontrast);
367
- }
368
-
369
- .cn-stats-block__loading {
370
- display: flex;
371
- align-items: center;
372
- justify-content: center;
373
- gap: 0.5rem;
374
- color: var(--color-text-maxcontrast);
375
- margin-bottom: 0.5rem;
376
- }
377
-
378
- .cn-stats-block__empty {
379
- text-align: center;
380
- color: var(--color-text-maxcontrast);
381
- font-style: italic;
382
- margin-bottom: 0.5rem;
383
- }
384
-
385
- .cn-stats-block__breakdown {
386
- margin-top: 0.5rem;
387
- padding: 0.75rem;
388
- background: var(--color-background-hover);
389
- border-radius: var(--border-radius);
390
- border: 1px solid var(--color-border);
391
- width: 100%;
392
- }
393
-
394
- .cn-stats-block__breakdown-item {
395
- display: flex;
396
- justify-content: space-between;
397
- align-items: center;
398
- margin-bottom: 0.5rem;
399
- }
400
-
401
- .cn-stats-block__breakdown-item:last-child {
402
- margin-bottom: 0;
403
- }
404
-
405
- .cn-stats-block__breakdown-label {
406
- font-weight: 500;
407
- color: var(--color-main-text);
408
- }
409
-
410
- .cn-stats-block__breakdown-value {
411
- font-weight: 600;
412
- padding: 0.25rem 0.5rem;
413
- border-radius: var(--border-radius);
414
- background: var(--color-background-hover);
415
- }
416
-
417
- .cn-stats-block__breakdown-value--invalid { color: var(--color-element-warning); }
418
- .cn-stats-block__breakdown-value--deleted { color: var(--color-element-error); }
419
- .cn-stats-block__breakdown-value--published { color: var(--color-element-success); }
420
- </style>
1
+ <template>
2
+ <component
3
+ :is="componentTag"
4
+ class="cn-stats-block"
5
+ :class="rootClasses"
6
+ v-bind="componentAttrs"
7
+ @click="onClick">
8
+ <!-- Icon -->
9
+ <div v-if="hasIcon" class="cn-stats-block__icon" :class="iconClasses">
10
+ <slot name="icon">
11
+ <component :is="icon" v-if="icon" :size="iconSize" />
12
+ </slot>
13
+ </div>
14
+
15
+ <!-- Content -->
16
+ <div class="cn-stats-block__content">
17
+ <div class="cn-stats-block__header">
18
+ <h4>{{ title || 'Objects' }}</h4>
19
+ </div>
20
+
21
+ <div v-if="count > 0 || (showZeroCount && count === 0)" class="cn-stats-block__count">
22
+ <span class="cn-stats-block__count-value">{{ formattedCount }}</span>
23
+ <span class="cn-stats-block__count-label">{{ countLabel }}</span>
24
+ </div>
25
+ <div v-else-if="loading" class="cn-stats-block__loading">
26
+ <NcLoadingIcon :size="16" />
27
+ {{ loadingLabel }}
28
+ </div>
29
+ <div v-else class="cn-stats-block__empty">
30
+ {{ emptyLabel }}
31
+ </div>
32
+
33
+ <!-- Breakdown details -->
34
+ <div v-if="breakdown && (count > 0 || showZeroCount)" class="cn-stats-block__breakdown">
35
+ <div
36
+ v-for="(value, key) in breakdown"
37
+ :key="key"
38
+ class="cn-stats-block__breakdown-item">
39
+ <span class="cn-stats-block__breakdown-label">{{ formatBreakdownLabel(key) }}</span>
40
+ <span
41
+ class="cn-stats-block__breakdown-value"
42
+ :class="'cn-stats-block__breakdown-value--' + key">
43
+ {{ value }}
44
+ </span>
45
+ </div>
46
+ </div>
47
+ </div>
48
+ </component>
49
+ </template>
50
+
51
+ <script>
52
+ import { NcLoadingIcon } from '@nextcloud/vue'
53
+
54
+ /**
55
+ * CnStatsBlock — Statistics display card with icon, count, and optional breakdown.
56
+ *
57
+ * Supports vertical (default) and horizontal layouts, color variants, icons,
58
+ * and clickable state. Use in a CnKpiGrid for responsive dashboard layouts.
59
+ *
60
+ * @example Basic vertical (default)
61
+ * <CnStatsBlock title="Cases" :count="42" count-label="open cases" />
62
+ *
63
+ * @example Horizontal with icon and variant
64
+ * <CnStatsBlock
65
+ * title="Open Cases"
66
+ * :count="42"
67
+ * :icon="BriefcaseOutline"
68
+ * variant="primary"
69
+ * horizontal
70
+ * clickable
71
+ * @click="goToCases" />
72
+ *
73
+ * @example With route-based navigation (renders as <router-link>)
74
+ * <CnStatsBlock
75
+ * title="Open Cases"
76
+ * :count="42"
77
+ * :icon="BriefcaseOutline"
78
+ * variant="primary"
79
+ * :route="{ name: 'Cases', query: { status: 'open' } }" />
80
+ *
81
+ * @example With breakdown
82
+ * <CnStatsBlock
83
+ * title="Cases"
84
+ * :count="42"
85
+ * :breakdown="{ total: 100, invalid: 3, deleted: 5, published: 92 }" />
86
+ *
87
+ * @example Custom icon slot
88
+ * <CnStatsBlock title="Files" :count="128">
89
+ * <template #icon>
90
+ * <FileDocumentOutline :size="24" />
91
+ * </template>
92
+ * </CnStatsBlock>
93
+ */
94
+ export default {
95
+ name: 'CnStatsBlock',
96
+
97
+ components: {
98
+ NcLoadingIcon,
99
+ },
100
+
101
+ props: {
102
+ /** Block title */
103
+ title: {
104
+ type: String,
105
+ default: '',
106
+ },
107
+ /** The main count number to display prominently */
108
+ count: {
109
+ type: Number,
110
+ default: 0,
111
+ },
112
+ /** Label displayed next to the count */
113
+ countLabel: {
114
+ type: String,
115
+ default: 'objects',
116
+ },
117
+ /** Detailed breakdown object (key-value pairs) */
118
+ breakdown: {
119
+ type: Object,
120
+ default: null,
121
+ },
122
+ /** Whether data is currently loading */
123
+ loading: {
124
+ type: Boolean,
125
+ default: false,
126
+ },
127
+ /** Text shown while loading */
128
+ loadingLabel: {
129
+ type: String,
130
+ default: 'Loading...',
131
+ },
132
+ /** Text shown when count is 0 */
133
+ emptyLabel: {
134
+ type: String,
135
+ default: 'No items found',
136
+ },
137
+ /** Icon component (e.g., imported MDI icon) */
138
+ icon: {
139
+ type: [Object, Function],
140
+ default: null,
141
+ },
142
+ /** Icon size in pixels */
143
+ iconSize: {
144
+ type: Number,
145
+ default: 24,
146
+ },
147
+ /** Color variant: 'default', 'primary', 'success', 'warning', 'error' */
148
+ variant: {
149
+ type: String,
150
+ default: 'default',
151
+ validator: (v) => ['default', 'primary', 'success', 'warning', 'error'].includes(v),
152
+ },
153
+ /** Use horizontal layout (icon left, content right) */
154
+ horizontal: {
155
+ type: Boolean,
156
+ default: false,
157
+ },
158
+ /** Whether the card is clickable */
159
+ clickable: {
160
+ type: Boolean,
161
+ default: false,
162
+ },
163
+ /** Whether to display 0 as a count value instead of the empty label */
164
+ showZeroCount: {
165
+ type: Boolean,
166
+ default: false,
167
+ },
168
+ /**
169
+ * Vue Router location object for declarative navigation.
170
+ * When set, the card renders as a <router-link> and clickable styles are implied.
171
+ * @example { name: 'Cases', query: { status: 'open' } }
172
+ * @example { path: '/catalogi' }
173
+ */
174
+ route: {
175
+ type: Object,
176
+ default: null,
177
+ },
178
+ },
179
+
180
+ computed: {
181
+ hasIcon() {
182
+ return this.icon !== null || this.$scopedSlots.icon || this.$slots.icon
183
+ },
184
+
185
+ formattedCount() {
186
+ return this.count.toLocaleString()
187
+ },
188
+
189
+ /**
190
+ * Whether the card is interactive (clickable or has a route).
191
+ * Used for applying hover/focus styles.
192
+ */
193
+ isInteractive() {
194
+ return !!this.route || this.clickable
195
+ },
196
+
197
+ /**
198
+ * Determines which HTML element or component to render.
199
+ * - route set → 'router-link' (SPA navigation)
200
+ * - clickable → 'a' (app handles click via event)
201
+ * - neither → 'div' (static display)
202
+ */
203
+ componentTag() {
204
+ if (this.route) return 'router-link'
205
+ if (this.clickable) return 'a'
206
+ return 'div'
207
+ },
208
+
209
+ /**
210
+ * Dynamic attributes for the root element based on rendering mode.
211
+ */
212
+ componentAttrs() {
213
+ if (this.route) return { to: this.route, tabindex: '0' }
214
+ if (this.clickable) return { href: '#', role: 'button', tabindex: '0' }
215
+ return {}
216
+ },
217
+
218
+ rootClasses() {
219
+ return {
220
+ 'cn-stats-block--horizontal': this.horizontal,
221
+ 'cn-stats-block--clickable': this.isInteractive,
222
+ [`cn-stats-block--${this.variant}`]: this.variant !== 'default',
223
+ }
224
+ },
225
+
226
+ iconClasses() {
227
+ return {
228
+ [`cn-stats-block__icon--${this.variant}`]: this.variant !== 'default',
229
+ }
230
+ },
231
+ },
232
+
233
+ methods: {
234
+ formatBreakdownLabel(key) {
235
+ return key.charAt(0).toUpperCase() + key.slice(1) + ':'
236
+ },
237
+
238
+ onClick(event) {
239
+ // When route is set, router-link handles navigation — do not emit click
240
+ if (this.route) return
241
+ if (this.clickable) {
242
+ event.preventDefault()
243
+ this.$emit('click', event)
244
+ }
245
+ },
246
+ },
247
+ }
248
+ </script>
249
+
250
+ <style scoped>
251
+ .cn-stats-block {
252
+ background: var(--color-background-hover);
253
+ border-radius: var(--border-radius-large, 10px);
254
+ padding: 1rem;
255
+ display: flex;
256
+ flex-direction: column;
257
+ align-items: center;
258
+ text-decoration: none;
259
+ color: inherit;
260
+ border: 2px solid transparent;
261
+ transition: border-color 0.15s ease, box-shadow 0.15s ease;
262
+ }
263
+
264
+ .cn-stats-block--horizontal {
265
+ flex-direction: row;
266
+ align-items: flex-start;
267
+ gap: 16px;
268
+ }
269
+
270
+ .cn-stats-block--horizontal .cn-stats-block__content {
271
+ text-align: left;
272
+ }
273
+
274
+ .cn-stats-block--horizontal .cn-stats-block__count {
275
+ justify-content: flex-start;
276
+ }
277
+
278
+ .cn-stats-block--clickable {
279
+ cursor: pointer;
280
+ }
281
+
282
+ .cn-stats-block--clickable:hover {
283
+ border-color: var(--color-primary-element);
284
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
285
+ }
286
+
287
+ .cn-stats-block--clickable:focus-visible {
288
+ outline: 2px solid var(--color-primary-element);
289
+ outline-offset: 2px;
290
+ }
291
+
292
+ /* Icon */
293
+ .cn-stats-block__icon {
294
+ display: flex;
295
+ align-items: center;
296
+ justify-content: center;
297
+ width: 44px;
298
+ height: 44px;
299
+ border-radius: 50%;
300
+ background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
301
+ color: var(--color-primary-element);
302
+ flex-shrink: 0;
303
+ margin-bottom: 8px;
304
+ }
305
+
306
+ .cn-stats-block--horizontal .cn-stats-block__icon {
307
+ margin-bottom: 0;
308
+ }
309
+
310
+ .cn-stats-block__icon--primary {
311
+ background: var(--color-primary-element-light, rgba(0, 130, 201, 0.1));
312
+ color: var(--color-primary-element);
313
+ }
314
+
315
+ .cn-stats-block__icon--success {
316
+ background: rgba(70, 186, 97, 0.1);
317
+ color: var(--color-success);
318
+ }
319
+
320
+ .cn-stats-block__icon--warning {
321
+ background: rgba(232, 163, 24, 0.1);
322
+ color: var(--color-warning);
323
+ }
324
+
325
+ .cn-stats-block__icon--error {
326
+ background: rgba(224, 36, 36, 0.1);
327
+ color: var(--color-error);
328
+ }
329
+
330
+ /* Content */
331
+ .cn-stats-block__content {
332
+ flex: 1;
333
+ min-width: 0;
334
+ text-align: center;
335
+ }
336
+
337
+ .cn-stats-block__header h4 {
338
+ margin-top: 0;
339
+ margin-bottom: 0.5rem;
340
+ color: var(--color-main-text);
341
+ font-size: 14px;
342
+ font-weight: 600;
343
+ }
344
+
345
+ .cn-stats-block__count {
346
+ display: flex;
347
+ align-items: baseline;
348
+ justify-content: center;
349
+ gap: 0.5rem;
350
+ font-size: 1.2rem;
351
+ margin-bottom: 0.5rem;
352
+ }
353
+
354
+ .cn-stats-block__count-value {
355
+ font-size: 2rem;
356
+ font-weight: bold;
357
+ color: var(--color-primary-element);
358
+ }
359
+
360
+ .cn-stats-block--primary .cn-stats-block__count-value { color: var(--color-primary-element); }
361
+ .cn-stats-block--success .cn-stats-block__count-value { color: var(--color-success); }
362
+ .cn-stats-block--warning .cn-stats-block__count-value { color: var(--color-warning); }
363
+ .cn-stats-block--error .cn-stats-block__count-value { color: var(--color-error); }
364
+
365
+ .cn-stats-block__count-label {
366
+ color: var(--color-text-maxcontrast);
367
+ }
368
+
369
+ .cn-stats-block__loading {
370
+ display: flex;
371
+ align-items: center;
372
+ justify-content: center;
373
+ gap: 0.5rem;
374
+ color: var(--color-text-maxcontrast);
375
+ margin-bottom: 0.5rem;
376
+ }
377
+
378
+ .cn-stats-block__empty {
379
+ text-align: center;
380
+ color: var(--color-text-maxcontrast);
381
+ font-style: italic;
382
+ margin-bottom: 0.5rem;
383
+ }
384
+
385
+ .cn-stats-block__breakdown {
386
+ margin-top: 0.5rem;
387
+ padding: 0.75rem;
388
+ background: var(--color-background-hover);
389
+ border-radius: var(--border-radius);
390
+ border: 1px solid var(--color-border);
391
+ width: 100%;
392
+ }
393
+
394
+ .cn-stats-block__breakdown-item {
395
+ display: flex;
396
+ justify-content: space-between;
397
+ align-items: center;
398
+ margin-bottom: 0.5rem;
399
+ }
400
+
401
+ .cn-stats-block__breakdown-item:last-child {
402
+ margin-bottom: 0;
403
+ }
404
+
405
+ .cn-stats-block__breakdown-label {
406
+ font-weight: 500;
407
+ color: var(--color-main-text);
408
+ }
409
+
410
+ .cn-stats-block__breakdown-value {
411
+ font-weight: 600;
412
+ padding: 0.25rem 0.5rem;
413
+ border-radius: var(--border-radius);
414
+ background: var(--color-background-hover);
415
+ }
416
+
417
+ .cn-stats-block__breakdown-value--invalid { color: var(--color-element-warning); }
418
+ .cn-stats-block__breakdown-value--deleted { color: var(--color-element-error); }
419
+ .cn-stats-block__breakdown-value--published { color: var(--color-element-success); }
420
+ </style>