@conduction/nextcloud-vue 0.1.0-beta.1 → 0.1.0-beta.11

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 (208) hide show
  1. package/README.md +226 -0
  2. package/css/index.css +5 -0
  3. package/dist/nextcloud-vue.cjs.js +79416 -7715
  4. package/dist/nextcloud-vue.cjs.js.map +1 -1
  5. package/dist/nextcloud-vue.css +3583 -504
  6. package/dist/nextcloud-vue.esm.js +79343 -7692
  7. package/dist/nextcloud-vue.esm.js.map +1 -1
  8. package/l10n/en.json +164 -0
  9. package/l10n/nl.json +164 -0
  10. package/package.json +104 -63
  11. package/src/components/CnActionsBar/CnActionsBar.vue +254 -0
  12. package/src/components/CnActionsBar/index.js +1 -0
  13. package/src/components/CnAdvancedFormDialog/CnAdvancedFormDialog.vue +570 -0
  14. package/src/components/CnAdvancedFormDialog/CnDataTab.vue +217 -0
  15. package/src/components/CnAdvancedFormDialog/CnMetadataTab.vue +121 -0
  16. package/src/components/CnAdvancedFormDialog/CnPropertiesTab.vue +422 -0
  17. package/src/components/CnAdvancedFormDialog/CnPropertyValueCell.vue +247 -0
  18. package/src/components/CnAdvancedFormDialog/index.js +1 -0
  19. package/src/components/CnCard/CnCard.vue +415 -0
  20. package/src/components/CnCard/index.js +1 -0
  21. package/src/components/CnCardGrid/CnCardGrid.vue +156 -152
  22. package/src/components/CnCardGrid/index.js +1 -1
  23. package/src/components/CnCellRenderer/CnCellRenderer.vue +132 -132
  24. package/src/components/CnCellRenderer/index.js +1 -1
  25. package/src/components/CnChartWidget/CnChartWidget.vue +346 -0
  26. package/src/components/CnChartWidget/index.js +1 -0
  27. package/src/components/CnConfigurationCard/CnConfigurationCard.vue +77 -77
  28. package/src/components/CnConfigurationCard/index.js +1 -1
  29. package/src/components/CnContextMenu/CnContextMenu.vue +142 -0
  30. package/src/components/CnContextMenu/index.js +1 -0
  31. package/src/components/CnCopyDialog/CnCopyDialog.vue +266 -0
  32. package/src/components/CnCopyDialog/index.js +1 -0
  33. package/src/components/CnDashboardGrid/CnDashboardGrid.vue +229 -0
  34. package/src/components/CnDashboardGrid/index.js +1 -0
  35. package/src/components/CnDashboardPage/CnDashboardPage.vue +397 -0
  36. package/src/components/CnDashboardPage/index.js +1 -0
  37. package/src/components/CnDataTable/CnDataTable.vue +362 -354
  38. package/src/components/CnDataTable/index.js +1 -1
  39. package/src/components/CnDeleteDialog/CnDeleteDialog.vue +177 -0
  40. package/src/components/CnDeleteDialog/index.js +1 -0
  41. package/src/components/CnDetailCard/CnDetailCard.vue +225 -0
  42. package/src/components/CnDetailCard/index.js +1 -0
  43. package/src/components/CnDetailGrid/CnDetailGrid.vue +256 -0
  44. package/src/components/CnDetailGrid/index.js +1 -0
  45. package/src/components/CnDetailPage/CnDetailPage.vue +432 -0
  46. package/src/components/CnDetailPage/index.js +1 -0
  47. package/src/components/CnFacetSidebar/CnFacetSidebar.vue +234 -223
  48. package/src/components/CnFacetSidebar/index.js +1 -1
  49. package/src/components/CnFilterBar/CnFilterBar.vue +153 -152
  50. package/src/components/CnFilterBar/index.js +1 -1
  51. package/src/components/CnFormDialog/CnFormDialog.vue +1047 -0
  52. package/src/components/CnFormDialog/index.js +1 -0
  53. package/src/components/CnIcon/CnIcon.vue +89 -0
  54. package/src/components/CnIcon/index.js +1 -0
  55. package/src/components/CnIndexPage/CnIndexPage.vue +980 -682
  56. package/src/components/CnIndexPage/index.js +1 -1
  57. package/src/components/CnIndexSidebar/CnIndexSidebar.vue +536 -0
  58. package/src/components/CnIndexSidebar/index.js +1 -0
  59. package/src/components/CnInfoWidget/CnInfoWidget.vue +219 -0
  60. package/src/components/CnInfoWidget/index.js +1 -0
  61. package/src/components/CnItemCard/CnItemCard.vue +134 -0
  62. package/src/components/CnItemCard/index.js +1 -0
  63. package/src/components/CnJsonViewer/CnJsonViewer.vue +312 -0
  64. package/src/components/CnJsonViewer/index.js +1 -0
  65. package/src/components/CnKpiGrid/CnKpiGrid.vue +93 -89
  66. package/src/components/CnKpiGrid/index.js +1 -1
  67. package/src/components/CnMassActionBar/CnMassActionBar.vue +161 -160
  68. package/src/components/CnMassActionBar/index.js +1 -1
  69. package/src/components/CnMassCopyDialog/CnMassCopyDialog.vue +327 -320
  70. package/src/components/CnMassCopyDialog/index.js +1 -1
  71. package/src/components/CnMassDeleteDialog/CnMassDeleteDialog.vue +245 -238
  72. package/src/components/CnMassDeleteDialog/index.js +1 -1
  73. package/src/components/CnMassExportDialog/CnMassExportDialog.vue +191 -190
  74. package/src/components/CnMassExportDialog/index.js +1 -1
  75. package/src/components/CnMassImportDialog/CnMassImportDialog.vue +494 -491
  76. package/src/components/CnMassImportDialog/index.js +1 -1
  77. package/src/components/CnNoteCard/CnNoteCard.vue +149 -0
  78. package/src/components/CnNoteCard/index.js +1 -0
  79. package/src/components/CnNotesCard/CnNotesCard.vue +416 -0
  80. package/src/components/CnNotesCard/index.js +1 -0
  81. package/src/components/CnObjectCard/CnObjectCard.vue +294 -292
  82. package/src/components/CnObjectCard/index.js +1 -1
  83. package/src/components/CnObjectDataWidget/CnObjectDataWidget.vue +854 -0
  84. package/src/components/CnObjectDataWidget/index.js +1 -0
  85. package/src/components/CnObjectMetadataWidget/CnObjectMetadataWidget.vue +289 -0
  86. package/src/components/CnObjectMetadataWidget/index.js +1 -0
  87. package/src/components/CnObjectSidebar/CnAuditTrailTab.vue +369 -0
  88. package/src/components/CnObjectSidebar/CnFilesTab.vue +287 -0
  89. package/src/components/CnObjectSidebar/CnNotesTab.vue +250 -0
  90. package/src/components/CnObjectSidebar/CnObjectSidebar.vue +255 -0
  91. package/src/components/CnObjectSidebar/CnTagsTab.vue +259 -0
  92. package/src/components/CnObjectSidebar/CnTasksTab.vue +483 -0
  93. package/src/components/CnObjectSidebar/index.js +6 -0
  94. package/src/components/CnPageHeader/CnPageHeader.vue +61 -0
  95. package/src/components/CnPageHeader/index.js +1 -0
  96. package/src/components/CnPagination/CnPagination.vue +253 -252
  97. package/src/components/CnPagination/index.js +1 -1
  98. package/src/components/CnProgressBar/CnProgressBar.vue +262 -0
  99. package/src/components/CnProgressBar/index.js +1 -0
  100. package/src/components/CnRegisterMapping/CnRegisterMapping.vue +793 -0
  101. package/src/components/CnRegisterMapping/index.js +1 -0
  102. package/src/components/CnRowActions/CnRowActions.vue +95 -73
  103. package/src/components/CnRowActions/index.js +1 -1
  104. package/src/components/CnSchemaFormDialog/CnSchemaConfigurationTab.vue +226 -0
  105. package/src/components/CnSchemaFormDialog/CnSchemaFormDialog.vue +788 -0
  106. package/src/components/CnSchemaFormDialog/CnSchemaPropertiesTab.vue +305 -0
  107. package/src/components/CnSchemaFormDialog/CnSchemaPropertyActions.vue +1398 -0
  108. package/src/components/CnSchemaFormDialog/CnSchemaSecurityTab.vue +236 -0
  109. package/src/components/CnSchemaFormDialog/index.js +1 -0
  110. package/src/components/CnSettingsCard/CnSettingsCard.vue +92 -92
  111. package/src/components/CnSettingsCard/index.js +1 -1
  112. package/src/components/CnSettingsSection/CnSettingsSection.vue +267 -266
  113. package/src/components/CnSettingsSection/index.js +1 -1
  114. package/src/components/CnStatsBlock/CnStatsBlock.vue +437 -366
  115. package/src/components/CnStatsBlock/index.js +1 -1
  116. package/src/components/CnStatsPanel/CnStatsPanel.vue +321 -0
  117. package/src/components/CnStatsPanel/index.js +1 -0
  118. package/src/components/CnStatusBadge/CnStatusBadge.vue +90 -77
  119. package/src/components/CnStatusBadge/index.js +1 -1
  120. package/src/components/CnTabbedFormDialog/CnTabbedFormDialog.vue +545 -0
  121. package/src/components/CnTabbedFormDialog/index.js +1 -0
  122. package/src/components/CnTableWidget/CnTableWidget.vue +333 -0
  123. package/src/components/CnTableWidget/index.js +1 -0
  124. package/src/components/CnTasksCard/CnTasksCard.vue +374 -0
  125. package/src/components/CnTasksCard/index.js +1 -0
  126. package/src/components/CnTileWidget/CnTileWidget.vue +159 -0
  127. package/src/components/CnTileWidget/index.js +1 -0
  128. package/src/components/CnTimelineStages/CnTimelineStages.vue +294 -0
  129. package/src/components/CnTimelineStages/index.js +1 -0
  130. package/src/components/CnUserActionMenu/CnUserActionMenu.vue +436 -0
  131. package/src/components/CnUserActionMenu/index.js +1 -0
  132. package/src/components/CnVersionInfoCard/CnVersionInfoCard.vue +313 -312
  133. package/src/components/CnVersionInfoCard/index.js +1 -1
  134. package/src/components/CnWidgetRenderer/CnWidgetRenderer.vue +180 -0
  135. package/src/components/CnWidgetRenderer/index.js +1 -0
  136. package/src/components/CnWidgetWrapper/CnWidgetWrapper.vue +248 -0
  137. package/src/components/CnWidgetWrapper/index.js +1 -0
  138. package/src/components/index.js +57 -25
  139. package/src/composables/index.js +5 -3
  140. package/src/composables/useContextMenu.js +126 -0
  141. package/src/composables/useDashboardView.js +286 -0
  142. package/src/composables/useDetailView.js +290 -132
  143. package/src/composables/useListView.js +364 -153
  144. package/src/composables/useSubResource.js +142 -142
  145. package/src/constants/metadata.js +30 -0
  146. package/src/css/CnSchemaFormDialog.css +546 -0
  147. package/src/css/__sample_nextcloud_tokens.css +110 -0
  148. package/src/css/actions-bar.css +54 -0
  149. package/src/css/badge.css +83 -51
  150. package/src/css/card.css +129 -128
  151. package/src/css/context-menu.css +20 -0
  152. package/src/css/dashboard.css +70 -0
  153. package/src/css/detail-page.css +235 -0
  154. package/src/css/detail.css +68 -68
  155. package/src/css/index-page.css +44 -0
  156. package/src/css/index-sidebar.css +193 -0
  157. package/src/css/index.css +17 -8
  158. package/src/css/layout.css +90 -90
  159. package/src/css/page-header.css +35 -0
  160. package/src/css/pagination.css +72 -72
  161. package/src/css/table.css +142 -143
  162. package/src/css/timeline-stages.css +220 -0
  163. package/src/css/utilities.css +46 -46
  164. package/src/index.js +95 -50
  165. package/src/l10n/index.js +12 -0
  166. package/src/mixins/gridLayout.js +118 -0
  167. package/src/store/createCrudStore.d.ts +350 -0
  168. package/src/store/createCrudStore.js +413 -0
  169. package/src/store/createSubResourcePlugin.js +125 -135
  170. package/src/store/index.js +4 -3
  171. package/src/store/pluginMerge.js +55 -0
  172. package/src/store/plugins/auditTrails.js +357 -17
  173. package/src/store/plugins/files.js +250 -186
  174. package/src/store/plugins/index.js +8 -4
  175. package/src/store/plugins/lifecycle.js +180 -180
  176. package/src/store/plugins/logs.d.ts +22 -0
  177. package/src/store/plugins/logs.js +172 -0
  178. package/src/store/plugins/registerMapping.js +195 -0
  179. package/src/store/plugins/relations.js +68 -68
  180. package/src/store/plugins/search.js +385 -0
  181. package/src/store/plugins/selection.js +104 -0
  182. package/src/store/useObjectStore.js +793 -625
  183. package/src/types/auditTrail.d.ts +32 -32
  184. package/src/types/file.d.ts +23 -23
  185. package/src/types/index.d.ts +67 -35
  186. package/src/types/notification.d.ts +36 -36
  187. package/src/types/object.d.ts +40 -40
  188. package/src/types/organisation.d.ts +41 -41
  189. package/src/types/register.d.ts +25 -25
  190. package/src/types/schema.d.ts +39 -39
  191. package/src/types/shared.d.ts +79 -79
  192. package/src/types/source.d.ts +14 -14
  193. package/src/types/task.d.ts +31 -31
  194. package/src/utils/errors.js +96 -96
  195. package/src/utils/getTheme.js +9 -0
  196. package/src/utils/headers.js +80 -44
  197. package/src/utils/id.js +13 -0
  198. package/src/utils/index.js +4 -3
  199. package/src/utils/schema.js +423 -287
  200. package/src/utils/widgetVisibility.js +162 -0
  201. package/src/components/CnDetailViewLayout/CnDetailViewLayout.vue +0 -88
  202. package/src/components/CnDetailViewLayout/index.js +0 -1
  203. package/src/components/CnEmptyState/CnEmptyState.vue +0 -78
  204. package/src/components/CnEmptyState/index.js +0 -1
  205. package/src/components/CnListViewLayout/CnListViewLayout.vue +0 -80
  206. package/src/components/CnListViewLayout/index.js +0 -1
  207. package/src/components/CnViewModeToggle/CnViewModeToggle.vue +0 -77
  208. package/src/components/CnViewModeToggle/index.js +0 -1
@@ -0,0 +1,159 @@
1
+ <!--
2
+ CnTileWidget — Quick-access tile with icon and link.
3
+
4
+ A simple, colorful tile for app shortcuts or external links.
5
+ Supports SVG paths, CSS icon classes, image URLs, and emoji icons.
6
+ -->
7
+ <template>
8
+ <div
9
+ v-if="tile"
10
+ class="cn-tile-widget"
11
+ :style="tileStyles">
12
+ <a
13
+ :href="tileUrl"
14
+ class="cn-tile-widget__link"
15
+ :target="tile.linkType === 'url' ? '_blank' : '_self'"
16
+ rel="noopener noreferrer">
17
+ <!-- SVG icon -->
18
+ <svg
19
+ v-if="tile.iconType === 'svg'"
20
+ class="cn-tile-widget__icon cn-tile-widget__icon--svg"
21
+ :style="{ fill: tile.textColor || '#ffffff' }"
22
+ viewBox="0 0 24 24">
23
+ <path :d="tile.icon" />
24
+ </svg>
25
+ <!-- Other icon types -->
26
+ <div v-else class="cn-tile-widget__icon">
27
+ <span v-if="tile.iconType === 'class'" :class="['icon', tile.icon]" />
28
+ <img v-else-if="tile.iconType === 'url'" :src="tile.icon" alt="">
29
+ <span v-else-if="tile.iconType === 'emoji'" class="cn-tile-widget__emoji">{{ tile.icon }}</span>
30
+ </div>
31
+ <div class="cn-tile-widget__title" :style="{ color: tile.textColor || '#ffffff' }">
32
+ {{ tile.title }}
33
+ </div>
34
+ </a>
35
+ </div>
36
+ </template>
37
+
38
+ <script>
39
+ import { generateUrl } from '@nextcloud/router'
40
+
41
+ /**
42
+ * CnTileWidget — Quick-access tile with icon and link.
43
+ *
44
+ * @example
45
+ * <CnTileWidget :tile="{
46
+ * title: 'Files',
47
+ * icon: 'M12,2C6.48,...',
48
+ * iconType: 'svg',
49
+ * backgroundColor: '#0082c9',
50
+ * textColor: '#ffffff',
51
+ * linkType: 'app',
52
+ * linkValue: 'files',
53
+ * }" />
54
+ */
55
+ export default {
56
+ name: 'CnTileWidget',
57
+
58
+ props: {
59
+ /**
60
+ * Tile configuration object.
61
+ * @type {{ title: string, icon: string, iconType: 'svg'|'class'|'url'|'emoji', backgroundColor?: string, textColor?: string, linkType: 'app'|'url', linkValue: string }}
62
+ */
63
+ tile: {
64
+ type: Object,
65
+ required: true,
66
+ },
67
+ },
68
+
69
+ computed: {
70
+ tileUrl() {
71
+ if (this.tile.linkType === 'app') {
72
+ return generateUrl('/apps/' + this.tile.linkValue)
73
+ }
74
+ return this.tile.linkValue || '#'
75
+ },
76
+
77
+ tileStyles() {
78
+ return {
79
+ '--cn-tile-bg': this.tile.backgroundColor || '#0082c9',
80
+ '--cn-tile-text': this.tile.textColor || '#ffffff',
81
+ }
82
+ },
83
+ },
84
+ }
85
+ </script>
86
+
87
+ <style scoped>
88
+ .cn-tile-widget {
89
+ height: 100%;
90
+ width: 100%;
91
+ position: absolute;
92
+ top: 0;
93
+ left: 0;
94
+ overflow: hidden;
95
+ background-color: var(--cn-tile-bg);
96
+ }
97
+
98
+ .cn-tile-widget__link {
99
+ display: flex;
100
+ flex-direction: column;
101
+ align-items: center;
102
+ justify-content: center;
103
+ height: 100%;
104
+ width: 100%;
105
+ text-decoration: none;
106
+ padding: 20px;
107
+ gap: 12px;
108
+ transition: transform 0.2s ease, opacity 0.2s ease;
109
+ background-color: var(--cn-tile-bg);
110
+ color: var(--cn-tile-text);
111
+ }
112
+
113
+ .cn-tile-widget__link:hover {
114
+ transform: scale(1.02);
115
+ opacity: 0.95;
116
+ }
117
+
118
+ .cn-tile-widget__icon {
119
+ font-size: 48px;
120
+ width: 48px;
121
+ height: 48px;
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ flex-shrink: 0;
126
+ }
127
+
128
+ .cn-tile-widget__icon--svg {
129
+ width: 48px;
130
+ height: 48px;
131
+ }
132
+
133
+ .cn-tile-widget__icon span.icon {
134
+ display: inline-block;
135
+ width: 48px;
136
+ height: 48px;
137
+ background-size: 48px;
138
+ filter: brightness(0) invert(1);
139
+ }
140
+
141
+ .cn-tile-widget__icon img {
142
+ width: 100%;
143
+ height: 100%;
144
+ object-fit: contain;
145
+ }
146
+
147
+ .cn-tile-widget__emoji {
148
+ font-size: 48px;
149
+ }
150
+
151
+ .cn-tile-widget__title {
152
+ font-size: 16px;
153
+ font-weight: 700;
154
+ text-align: center;
155
+ word-break: break-word;
156
+ line-height: 1.3;
157
+ color: var(--cn-tile-text);
158
+ }
159
+ </style>
@@ -0,0 +1 @@
1
+ export { default as CnTileWidget } from './CnTileWidget.vue'
@@ -0,0 +1,294 @@
1
+ <!--
2
+ CnTimelineStages — Visualizes sequential progression through named stages.
3
+
4
+ Used in case management, pipeline tracking, and any workflow with discrete
5
+ phases. Supports horizontal/vertical orientation, small/medium sizes,
6
+ clickable interaction, keyboard navigation (roving tabindex), and ARIA roles.
7
+
8
+ All colors use Nextcloud CSS variables so NL Design System theming
9
+ applies automatically.
10
+ -->
11
+ <template>
12
+ <div
13
+ v-if="stages.length > 0"
14
+ :class="rootClasses"
15
+ role="list"
16
+ :aria-label="ariaLabel">
17
+ <div
18
+ v-for="(stage, index) in stages"
19
+ :key="stage.id"
20
+ ref="stageNodes"
21
+ :class="stageClasses(index)"
22
+ role="listitem"
23
+ :aria-current="stageStates[index] === 'current' ? 'step' : undefined"
24
+ :tabindex="clickable ? (focusedIndex === index ? 0 : -1) : undefined"
25
+ @click="onStageClick(stage, index)"
26
+ @keydown="onKeydown($event, stage, index)">
27
+ <!-- Indicator -->
28
+ <slot
29
+ name="indicator"
30
+ :stage="stage"
31
+ :index="index"
32
+ :state="stageStates[index]">
33
+ <span class="cn-timeline-stages__indicator">
34
+ <!-- Completed: checkmark SVG -->
35
+ <svg
36
+ v-if="stageStates[index] === 'completed'"
37
+ aria-hidden="true"
38
+ viewBox="0 0 24 24"
39
+ class="cn-timeline-stages__checkmark">
40
+ <path
41
+ fill="currentColor"
42
+ d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z" />
43
+ </svg>
44
+ <!-- Current: filled dot -->
45
+ <span
46
+ v-else-if="stageStates[index] === 'current'"
47
+ class="cn-timeline-stages__dot" />
48
+ </span>
49
+ </slot>
50
+ <!-- Label + Subtitle -->
51
+ <slot
52
+ name="label"
53
+ :stage="stage"
54
+ :index="index"
55
+ :state="stageStates[index]">
56
+ <span class="cn-timeline-stages__label">
57
+ {{ stage.label }}
58
+ </span>
59
+ <span
60
+ v-if="stage.subtitle"
61
+ class="cn-timeline-stages__subtitle">
62
+ {{ stage.subtitle }}
63
+ </span>
64
+ </slot>
65
+ </div>
66
+ </div>
67
+ </template>
68
+
69
+ <script>
70
+ import { translate as t } from '@nextcloud/l10n'
71
+
72
+ /**
73
+ * CnTimelineStages — Timeline/progress stages component.
74
+ *
75
+ * Renders a sequence of named stages with completed/current/upcoming states,
76
+ * connected by a track line. Supports horizontal and vertical layout,
77
+ * small and medium sizes, clickable stages, keyboard navigation, and ARIA roles.
78
+ *
79
+ * @example Basic horizontal timeline
80
+ * <CnTimelineStages
81
+ * :stages="[
82
+ * { id: 'new', label: 'New' },
83
+ * { id: 'review', label: 'Review', subtitle: 'Mar 15' },
84
+ * { id: 'done', label: 'Done' },
85
+ * ]"
86
+ * currentStage="review" />
87
+ *
88
+ * @example Vertical clickable timeline
89
+ * <CnTimelineStages
90
+ * :stages="pipelineStages"
91
+ * :currentStage="deal.stage"
92
+ * orientation="vertical"
93
+ * :clickable="true"
94
+ * v-on:stage-click="onStageClick" />
95
+ */
96
+ export default {
97
+ name: 'CnTimelineStages',
98
+
99
+ props: {
100
+ /**
101
+ * Array of stage objects. Each must have `id` (unique) and `label` (display text).
102
+ * Optional `subtitle` for secondary text below the label.
103
+ * @type {{ id: string, label: string, subtitle?: string }[]}
104
+ */
105
+ stages: {
106
+ type: Array,
107
+ required: true,
108
+ validator: (stages) => stages.every((s) => s.id !== undefined && s.label !== undefined),
109
+ },
110
+ /**
111
+ * The `id` of the currently active stage. Stages before it are "completed",
112
+ * stages after it are "upcoming". If null/undefined or not matching any id,
113
+ * all stages are "upcoming".
114
+ * @type {string|number|null}
115
+ */
116
+ currentStage: {
117
+ type: [String, Number],
118
+ default: null,
119
+ },
120
+ /**
121
+ * Layout orientation: "horizontal" (left-to-right) or "vertical" (top-to-bottom).
122
+ * @type {string}
123
+ */
124
+ orientation: {
125
+ type: String,
126
+ default: 'horizontal',
127
+ validator: (v) => ['horizontal', 'vertical'].includes(v),
128
+ },
129
+ /**
130
+ * Size variant: "medium" (32px indicators) or "small" (20px indicators).
131
+ * @type {string}
132
+ */
133
+ size: {
134
+ type: String,
135
+ default: 'medium',
136
+ validator: (v) => ['small', 'medium'].includes(v),
137
+ },
138
+ /**
139
+ * Whether stages are clickable. When true, stages emit `stage-click`
140
+ * on click/Enter/Space and support keyboard navigation with arrow keys.
141
+ * @type {boolean}
142
+ */
143
+ clickable: {
144
+ type: Boolean,
145
+ default: false,
146
+ },
147
+ /**
148
+ * Accessible label for the timeline container.
149
+ * @type {string}
150
+ */
151
+ ariaLabel: {
152
+ type: String,
153
+ default: () => t('nextcloud-vue', 'Progress stages'),
154
+ },
155
+ },
156
+
157
+ data() {
158
+ return {
159
+ /** @type {number} Index of the currently focused stage (roving tabindex) */
160
+ focusedIndex: 0,
161
+ }
162
+ },
163
+
164
+ computed: {
165
+ /**
166
+ * Root element CSS classes based on orientation and size props.
167
+ * @return {object}
168
+ */
169
+ rootClasses() {
170
+ return {
171
+ 'cn-timeline-stages': true,
172
+ 'cn-timeline-stages--horizontal': this.orientation === 'horizontal',
173
+ 'cn-timeline-stages--vertical': this.orientation === 'vertical',
174
+ 'cn-timeline-stages--small': this.size === 'small',
175
+ 'cn-timeline-stages--clickable': this.clickable,
176
+ }
177
+ },
178
+ /**
179
+ * Index of the current stage in the stages array, or -1 if not found.
180
+ * @return {number}
181
+ */
182
+ currentStageIndex() {
183
+ if (this.currentStage == null) return -1
184
+ return this.stages.findIndex((s) => s.id === this.currentStage)
185
+ },
186
+ /**
187
+ * Pre-calculated states for all stages to avoid repeated stageState() calls in template.
188
+ * @return {Array<'completed'|'current'|'upcoming'>}
189
+ */
190
+ stageStates() {
191
+ return this.stages.map((stage, index) => this.stageState(index))
192
+ },
193
+ },
194
+
195
+ mounted() {
196
+ this.scrollCurrentIntoView()
197
+ },
198
+
199
+ methods: {
200
+ /**
201
+ * Derive the visual state of a stage by its index.
202
+ * @param {number} index Stage index
203
+ * @return {'completed'|'current'|'upcoming'}
204
+ */
205
+ stageState(index) {
206
+ if (this.currentStageIndex === -1) return 'upcoming'
207
+ if (index < this.currentStageIndex) return 'completed'
208
+ if (index === this.currentStageIndex) return 'current'
209
+ return 'upcoming'
210
+ },
211
+ /**
212
+ * CSS classes for a stage node.
213
+ * @param {number} index Stage index
214
+ * @return {object}
215
+ */
216
+ stageClasses(index) {
217
+ const state = this.stageState(index)
218
+ return {
219
+ 'cn-timeline-stages__stage': true,
220
+ [`cn-timeline-stages__stage--${state}`]: true,
221
+ }
222
+ },
223
+ /**
224
+ * Handle click on a stage node.
225
+ * @param {object} stage The stage object
226
+ * @param {number} index The stage index
227
+ */
228
+ onStageClick(stage, index) {
229
+ if (!this.clickable) return
230
+ /**
231
+ * Emitted when a clickable stage is activated (click, Enter, or Space).
232
+ * @event stage-click
233
+ * @type {{ stage: object, index: number }}
234
+ */
235
+ this.$emit('stage-click', { stage, index })
236
+ },
237
+ /**
238
+ * Keyboard handler for arrow keys, Enter, and Space.
239
+ * Implements roving tabindex pattern.
240
+ * @param {KeyboardEvent} event The keyboard event
241
+ * @param {object} stage The stage object
242
+ * @param {number} index The stage index
243
+ */
244
+ onKeydown(event, stage, index) {
245
+ if (!this.clickable) return
246
+
247
+ const isHorizontal = this.orientation === 'horizontal'
248
+ const nextKeys = isHorizontal ? ['ArrowRight'] : ['ArrowDown']
249
+ const prevKeys = isHorizontal ? ['ArrowLeft'] : ['ArrowUp']
250
+
251
+ if (nextKeys.includes(event.key)) {
252
+ event.preventDefault()
253
+ this.moveFocus(index + 1)
254
+ } else if (prevKeys.includes(event.key)) {
255
+ event.preventDefault()
256
+ this.moveFocus(index - 1)
257
+ } else if (event.key === 'Enter' || event.key === ' ') {
258
+ event.preventDefault()
259
+ this.$emit('stage-click', { stage, index })
260
+ }
261
+ },
262
+ /**
263
+ * Move focus to a new stage index (roving tabindex).
264
+ * @param {number} newIndex Target index
265
+ */
266
+ moveFocus(newIndex) {
267
+ if (newIndex < 0 || newIndex >= this.stages.length) return
268
+ this.focusedIndex = newIndex
269
+ this.$nextTick(() => {
270
+ const nodes = this.$refs.stageNodes
271
+ if (nodes && nodes[newIndex]) {
272
+ nodes[newIndex].focus()
273
+ }
274
+ })
275
+ },
276
+ /**
277
+ * Scroll the current stage into view on mount (horizontal overflow).
278
+ */
279
+ scrollCurrentIntoView() {
280
+ if (this.orientation !== 'horizontal' || this.currentStageIndex === -1) return
281
+ this.$nextTick(() => {
282
+ const nodes = this.$refs.stageNodes
283
+ if (nodes && nodes[this.currentStageIndex]) {
284
+ nodes[this.currentStageIndex].scrollIntoView({
285
+ behavior: 'smooth',
286
+ block: 'nearest',
287
+ inline: 'center',
288
+ })
289
+ }
290
+ })
291
+ },
292
+ },
293
+ }
294
+ </script>
@@ -0,0 +1 @@
1
+ export { default as CnTimelineStages } from './CnTimelineStages.vue'