@openviking/react 0.1.4 → 0.1.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 (139) hide show
  1. package/README.md +15 -11
  2. package/dist/28~0.js +15 -0
  3. package/dist/2~0.js +6 -3
  4. package/dist/37~0.js +27 -0
  5. package/dist/3c~0.js +17 -9
  6. package/dist/3~0.js +4 -2
  7. package/dist/ae~0.js +6 -2
  8. package/dist/a~0.js +79 -72
  9. package/dist/ck~0.js +4 -0
  10. package/dist/client/paths.d.ts +4 -0
  11. package/dist/client/provider.d.ts +10 -6
  12. package/dist/components/agent-connect/agent-connect-code-block.d.ts +14 -0
  13. package/dist/components/agent-connect/agent-connect-copy.d.ts +3 -0
  14. package/dist/components/agent-connect/agent-connect-design.d.ts +1 -1
  15. package/dist/components/agent-connect/agent-connect-installer.d.ts +1 -0
  16. package/dist/components/agent-connect/agent-connect-instructions-view.d.ts +4 -6
  17. package/dist/components/agent-connect/agent-connect-instructions.d.ts +13 -0
  18. package/dist/components/agent-connect/agent-connect-markdown.d.ts +8 -2
  19. package/dist/components/agent-connect/agent-connect-mask.d.ts +10 -0
  20. package/dist/components/agent-connect/agent-connect.d.ts +1 -1
  21. package/dist/components/agent-connect/locales/en-US.d.ts +3 -0
  22. package/dist/components/agent-connect/style.css +163 -5
  23. package/dist/components/agent-connect/types.d.ts +5 -3
  24. package/dist/components/agent-connect/use-agent-connect-copy.d.ts +6 -0
  25. package/dist/components/directory-tour/style.css +46 -2
  26. package/dist/components/directory-tour/types.d.ts +2 -1
  27. package/dist/components/experience-dashboard/dashboard-tabs.d.ts +11 -0
  28. package/dist/components/experience-dashboard/experience-dashboard.d.ts +2 -0
  29. package/dist/components/experience-dashboard/experience-impact.d.ts +11 -0
  30. package/dist/components/experience-dashboard/experience-list.d.ts +9 -0
  31. package/dist/components/experience-dashboard/experience-pagination.d.ts +8 -0
  32. package/dist/components/experience-dashboard/experience-tests.d.ts +6 -0
  33. package/dist/components/experience-dashboard/experience-trajectories.d.ts +6 -0
  34. package/dist/components/experience-dashboard/index.d.ts +2 -0
  35. package/dist/components/experience-dashboard/labels.d.ts +2 -0
  36. package/dist/components/experience-dashboard/style.css +699 -0
  37. package/dist/components/experience-dashboard/style.js +0 -0
  38. package/dist/components/experience-dashboard/types.d.ts +106 -0
  39. package/dist/components/experience-dashboard.js +1 -0
  40. package/dist/components/file-browser-entries/file-browser-entries.d.ts +1 -1
  41. package/dist/components/file-browser-entries/style.css +259 -13
  42. package/dist/components/file-browser-entries/types.d.ts +2 -2
  43. package/dist/components/file-preview/style.css +48 -4
  44. package/dist/components/file-preview/types.d.ts +2 -2
  45. package/dist/components/file-tree/style.css +63 -4
  46. package/dist/components/file-tree/types.d.ts +2 -2
  47. package/dist/components/scope-switcher/scope-switcher.d.ts +2 -2
  48. package/dist/components/scope-switcher/style.css +48 -4
  49. package/dist/components/scope-switcher/types.d.ts +5 -5
  50. package/dist/components/scope-switcher.js +1 -1
  51. package/dist/components/style.css +2451 -139
  52. package/dist/components/tui/style.css +122 -36
  53. package/dist/components/tui/tui.d.ts +1 -1
  54. package/dist/components/tui/types.d.ts +2 -2
  55. package/dist/components/viking-bot/ark-message-list-view.d.ts +4 -1
  56. package/dist/components/viking-bot/interaction/types.d.ts +2 -2
  57. package/dist/components/viking-bot/interaction/viking-bot-interaction.d.ts +1 -1
  58. package/dist/components/viking-bot/session-actions.d.ts +2 -2
  59. package/dist/components/viking-bot/style.css +159 -12
  60. package/dist/components/viking-bot/types.d.ts +7 -7
  61. package/dist/components/viking-bot/viking-bot.d.ts +1 -1
  62. package/dist/components/wiki-dashboard/index.d.ts +2 -0
  63. package/dist/components/wiki-dashboard/labels.d.ts +2 -0
  64. package/dist/components/wiki-dashboard/style.css +741 -0
  65. package/dist/components/wiki-dashboard/style.js +0 -0
  66. package/dist/components/wiki-dashboard/types.d.ts +92 -0
  67. package/dist/components/wiki-dashboard/wiki-action-button.d.ts +9 -0
  68. package/dist/components/wiki-dashboard/wiki-conflict-card.d.ts +15 -0
  69. package/dist/components/wiki-dashboard/wiki-dashboard.d.ts +2 -0
  70. package/dist/components/wiki-dashboard/wiki-file-icon.d.ts +3 -0
  71. package/dist/components/wiki-dashboard/wiki-severity-filter.d.ts +8 -0
  72. package/dist/components/wiki-dashboard.js +1 -0
  73. package/dist/c~0.js +169 -155
  74. package/dist/e~0.js +3 -1
  75. package/dist/fi~0.js +354 -0
  76. package/dist/fj~0.js +503 -0
  77. package/dist/f~0.js +661 -309
  78. package/dist/icons/index.d.ts +28 -0
  79. package/dist/icons.js +1 -1
  80. package/dist/index.d.ts +4 -0
  81. package/dist/index.js +3 -1
  82. package/dist/k~0.js +277 -1
  83. package/dist/lk~0.js +55 -13
  84. package/dist/l~0.js +1096 -187
  85. package/dist/modules/console/console.d.ts +1 -1
  86. package/dist/modules/console/index.d.ts +1 -2
  87. package/dist/modules/console/style.css +377 -56
  88. package/dist/modules/console/types.d.ts +2 -2
  89. package/dist/modules/console/use-console.d.ts +1 -1
  90. package/dist/modules/console.js +1 -1
  91. package/dist/modules/file-browser/dashboard-data.d.ts +9 -0
  92. package/dist/modules/file-browser/dashboard-indicator.d.ts +8 -0
  93. package/dist/modules/file-browser/dashboard-labels.d.ts +9 -0
  94. package/dist/modules/file-browser/dashboard-model.d.ts +14 -0
  95. package/dist/modules/file-browser/dashboard-resource.d.ts +12 -0
  96. package/dist/modules/file-browser/experience-dashboard-pane.d.ts +8 -0
  97. package/dist/modules/file-browser/experience-data.d.ts +31 -0
  98. package/dist/modules/file-browser/file-browser-labels.d.ts +1 -1
  99. package/dist/modules/file-browser/file-browser-tree-pane.d.ts +3 -2
  100. package/dist/modules/file-browser/file-browser.d.ts +1 -1
  101. package/dist/modules/file-browser/fs-directories.d.ts +8 -0
  102. package/dist/modules/file-browser/fs-lines.d.ts +36 -0
  103. package/dist/modules/file-browser/fs-memory-fields.d.ts +65 -0
  104. package/dist/modules/file-browser/fs-model.d.ts +12 -2
  105. package/dist/modules/file-browser/fs-read-file.d.ts +14 -0
  106. package/dist/modules/file-browser/fs-selection.d.ts +4 -0
  107. package/dist/modules/file-browser/index.d.ts +2 -2
  108. package/dist/modules/file-browser/style.css +1883 -25
  109. package/dist/modules/file-browser/types.d.ts +64 -2
  110. package/dist/modules/file-browser/use-browser-dashboards.d.ts +31 -0
  111. package/dist/modules/file-browser/use-dashboard-query.d.ts +9 -0
  112. package/dist/modules/file-browser/use-experience-dashboard.d.ts +27 -0
  113. package/dist/modules/file-browser/use-file-browser.d.ts +2 -45
  114. package/dist/modules/file-browser/use-fs-tree.d.ts +2 -0
  115. package/dist/modules/file-browser/use-wiki-dashboard.d.ts +17 -0
  116. package/dist/modules/file-browser/wiki-conflicts.d.ts +12 -0
  117. package/dist/modules/file-browser/wiki-dashboard-pane.d.ts +14 -0
  118. package/dist/modules/file-browser.js +1 -1
  119. package/dist/modules/scope-cascade/controller.d.ts +2 -2
  120. package/dist/modules/scope-cascade/index.d.ts +1 -2
  121. package/dist/modules/scope-cascade/scope-cascade.d.ts +2 -2
  122. package/dist/modules/scope-cascade/style.css +48 -4
  123. package/dist/modules/scope-cascade/types.d.ts +9 -4
  124. package/dist/modules/scope-cascade/use-scope-cascade.d.ts +2 -2
  125. package/dist/modules/scope-cascade.js +1 -1
  126. package/dist/modules/style.css +2459 -192
  127. package/dist/n~0.js +16 -130
  128. package/dist/rt~0.js +152 -0
  129. package/dist/r~0.js +17 -38
  130. package/dist/shared/components/popover/popover.d.ts +1 -1
  131. package/dist/shared/components/popover/types.d.ts +7 -1
  132. package/dist/shared/dashboard/dashboard-state.d.ts +12 -0
  133. package/dist/shared/locale-context.d.ts +8 -0
  134. package/dist/static/image/dashboard-background.png +0 -0
  135. package/dist/style.css +9445 -4822
  136. package/dist/u~0.js +324 -96
  137. package/dist/viking-bot-composer~0.js +4 -2
  138. package/dist/viking-bot-interaction~0.js +3 -1
  139. package/package.json +14 -2
package/dist/fj~0.js ADDED
@@ -0,0 +1,503 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useId, useRef, useState } from "react";
3
+ import { mergeLabels } from "./nx~0.js";
4
+ import { getFileTypeColor, getFileTypeIcon, WikiWarningIcon, WikiSuccessIcon, WikiEditIcon, WikiDiscussIcon, WikiHistoryIcon, resolveFileTypeIconKey } from "./k~0.js";
5
+ import { Tooltip } from "./rt~0.js";
6
+ import { Popover } from "./r~0.js";
7
+ import { useLocale } from "./28~0.js";
8
+ import { DashboardState } from "./37~0.js";
9
+ const en = {
10
+ title: 'Generation results',
11
+ pendingLabel: 'Pending',
12
+ discuss: 'VikingBot discussion',
13
+ conflicts: 'All conflicts',
14
+ conflictFiles: 'Conflicting files',
15
+ pending: 'Pending conflicts',
16
+ all: 'All',
17
+ severity: 'Severity',
18
+ high: 'High',
19
+ medium: 'Medium',
20
+ low: 'Low',
21
+ fixed: 'Fixed',
22
+ reason: 'Reason',
23
+ file: 'File',
24
+ empty: 'No matching conflicts',
25
+ loading: 'Loading…',
26
+ failed: 'Could not load conflicts',
27
+ retry: 'Retry',
28
+ open: 'Open',
29
+ edit: 'Manual edit',
30
+ solution: 'Solution',
31
+ occurred: 'Detected',
32
+ fixedAt: 'Resolved',
33
+ evidence: 'Resolution basis',
34
+ history: 'Resolution history',
35
+ historyHint: 'View the resolution plan and evidence',
36
+ unavailable: 'Action unavailable',
37
+ limited: 'Showing up to 100 conflicting files'
38
+ };
39
+ const zh = {
40
+ title: '生成效果',
41
+ pendingLabel: '待确认',
42
+ discuss: 'VikingBot 对话',
43
+ conflicts: '全部冲突',
44
+ conflictFiles: '冲突文件数',
45
+ pending: '待确认冲突',
46
+ all: '全部',
47
+ severity: '严重程度',
48
+ high: '严重',
49
+ medium: '中等',
50
+ low: '普通',
51
+ fixed: '已修复',
52
+ reason: '原因',
53
+ file: '文件',
54
+ empty: '暂无符合条件的冲突',
55
+ loading: '加载中…',
56
+ failed: '冲突加载失败',
57
+ retry: '重试',
58
+ open: '打开',
59
+ edit: '人工修改',
60
+ solution: '修复方案',
61
+ occurred: '检测时间',
62
+ fixedAt: '修复时间',
63
+ evidence: '修复依据',
64
+ history: '修复回溯',
65
+ historyHint: '查看修复方案与依据',
66
+ unavailable: '当前不可操作',
67
+ limited: '最多展示 100 个存在待确认冲突的文件'
68
+ };
69
+ const wikiLabels = (locale, labels)=>mergeLabels('zh-CN' === locale ? zh : en, labels);
70
+ function WikiFileIcon({ name }) {
71
+ const Icon = getFileTypeIcon(name);
72
+ const key = resolveFileTypeIconKey(name);
73
+ return /*#__PURE__*/ jsx(Icon, {
74
+ "aria-hidden": "true",
75
+ className: "ov-wiki-dashboard__file-icon",
76
+ style: {
77
+ '--ov-ui-wiki-icon-light': getFileTypeColor(key, 'light'),
78
+ '--ov-ui-wiki-icon-dark': getFileTypeColor(key, 'dark')
79
+ }
80
+ });
81
+ }
82
+ function WikiActionButton({ label, hint, onClick, children, ...aria }) {
83
+ return /*#__PURE__*/ jsx(Tooltip, {
84
+ content: hint,
85
+ children: /*#__PURE__*/ jsx("button", {
86
+ ...aria,
87
+ type: "button",
88
+ "aria-label": label,
89
+ "aria-disabled": !onClick || void 0,
90
+ "aria-description": onClick ? void 0 : hint,
91
+ onClick: ()=>onClick?.(),
92
+ children: children
93
+ })
94
+ });
95
+ }
96
+ function WikiConflictCard({ conflict, path, labels: t, editDisabledReason, discussDisabledReason, onOpenUri, onEdit, onDiscuss }) {
97
+ const [expanded, setExpanded] = useState(false);
98
+ const id = useId();
99
+ const fixed = 'fixed' === conflict.state;
100
+ const StatusIcon = fixed ? WikiSuccessIcon : WikiWarningIcon;
101
+ return /*#__PURE__*/ jsxs("article", {
102
+ className: "ov-wiki-dashboard__conflict",
103
+ children: [
104
+ /*#__PURE__*/ jsxs("div", {
105
+ className: `ov-wiki-dashboard__conflict-row${path ? '' : ' ov-wiki-dashboard__conflict-row--without-path'}`,
106
+ children: [
107
+ /*#__PURE__*/ jsxs("span", {
108
+ className: `ov-wiki-dashboard__status ov-wiki-dashboard__status--${conflict.state}`,
109
+ children: [
110
+ /*#__PURE__*/ jsx(StatusIcon, {
111
+ width: 14,
112
+ height: 14
113
+ }),
114
+ fixed ? t.fixed : t.pendingLabel
115
+ ]
116
+ }),
117
+ /*#__PURE__*/ jsxs("div", {
118
+ className: "ov-wiki-dashboard__issue",
119
+ children: [
120
+ /*#__PURE__*/ jsx("button", {
121
+ type: "button",
122
+ "aria-expanded": expanded,
123
+ "aria-controls": id,
124
+ title: conflict.description,
125
+ onClick: ()=>setExpanded(!expanded),
126
+ children: conflict.description
127
+ }),
128
+ /*#__PURE__*/ jsx("p", {
129
+ title: conflict.reason,
130
+ children: conflict.reason
131
+ }),
132
+ fixed && conflict.fixPlan ? /*#__PURE__*/ jsxs("span", {
133
+ className: "ov-wiki-dashboard__solution",
134
+ children: [
135
+ t.solution,
136
+ ": ",
137
+ conflict.fixPlan
138
+ ]
139
+ }) : null
140
+ ]
141
+ }),
142
+ path ? /*#__PURE__*/ jsxs("div", {
143
+ className: "ov-wiki-dashboard__path",
144
+ children: [
145
+ /*#__PURE__*/ jsx(WikiFileIcon, {
146
+ name: path
147
+ }),
148
+ /*#__PURE__*/ jsx("button", {
149
+ type: "button",
150
+ className: "ov-wiki-dashboard__link",
151
+ title: path,
152
+ disabled: !onOpenUri,
153
+ onClick: ()=>onOpenUri?.(),
154
+ children: path
155
+ })
156
+ ]
157
+ }) : null,
158
+ /*#__PURE__*/ jsx("span", {
159
+ className: `ov-wiki-dashboard__severity ov-wiki-dashboard__severity--${conflict.severity}`,
160
+ children: t[conflict.severity]
161
+ }),
162
+ /*#__PURE__*/ jsx("div", {
163
+ className: "ov-wiki-dashboard__actions",
164
+ children: fixed ? /*#__PURE__*/ jsx(WikiActionButton, {
165
+ label: t.history,
166
+ hint: t.historyHint,
167
+ "aria-expanded": expanded,
168
+ "aria-controls": id,
169
+ onClick: ()=>setExpanded(!expanded),
170
+ children: /*#__PURE__*/ jsx(WikiHistoryIcon, {
171
+ width: 14,
172
+ height: 14
173
+ })
174
+ }) : /*#__PURE__*/ jsxs(Fragment, {
175
+ children: [
176
+ /*#__PURE__*/ jsx(WikiActionButton, {
177
+ label: `${t.edit}: ${conflict.description}`,
178
+ hint: onEdit ? t.edit : editDisabledReason || t.unavailable,
179
+ onClick: onEdit ? ()=>onEdit(conflict) : void 0,
180
+ children: /*#__PURE__*/ jsx(WikiEditIcon, {
181
+ width: 14,
182
+ height: 14
183
+ })
184
+ }),
185
+ /*#__PURE__*/ jsx(WikiActionButton, {
186
+ label: `${t.discuss}: ${conflict.description}`,
187
+ hint: onDiscuss ? t.discuss : discussDisabledReason || t.unavailable,
188
+ onClick: onDiscuss ? ()=>onDiscuss(conflict) : void 0,
189
+ children: /*#__PURE__*/ jsx(WikiDiscussIcon, {
190
+ width: 14,
191
+ height: 14
192
+ })
193
+ })
194
+ ]
195
+ })
196
+ })
197
+ ]
198
+ }),
199
+ /*#__PURE__*/ jsx("div", {
200
+ id: id,
201
+ hidden: !expanded,
202
+ className: "ov-wiki-dashboard__evidence",
203
+ children: /*#__PURE__*/ jsxs("dl", {
204
+ children: [
205
+ /*#__PURE__*/ jsx("dt", {
206
+ children: t.reason
207
+ }),
208
+ /*#__PURE__*/ jsx("dd", {
209
+ children: conflict.reason || '—'
210
+ }),
211
+ /*#__PURE__*/ jsx("dt", {
212
+ children: t.occurred
213
+ }),
214
+ /*#__PURE__*/ jsx("dd", {
215
+ children: /*#__PURE__*/ jsx("time", {
216
+ dateTime: new Date(1000 * conflict.beginTime).toISOString(),
217
+ children: new Date(1000 * conflict.beginTime).toISOString()
218
+ })
219
+ }),
220
+ /*#__PURE__*/ jsx("dt", {
221
+ children: t.fixedAt
222
+ }),
223
+ /*#__PURE__*/ jsx("dd", {
224
+ children: null === conflict.fixTime ? '—' : /*#__PURE__*/ jsx("time", {
225
+ dateTime: new Date(1000 * conflict.fixTime).toISOString(),
226
+ children: new Date(1000 * conflict.fixTime).toISOString()
227
+ })
228
+ }),
229
+ /*#__PURE__*/ jsx("dt", {
230
+ children: t.solution
231
+ }),
232
+ /*#__PURE__*/ jsx("dd", {
233
+ children: conflict.fixPlan || '—'
234
+ }),
235
+ /*#__PURE__*/ jsx("dt", {
236
+ children: t.evidence
237
+ }),
238
+ /*#__PURE__*/ jsx("dd", {
239
+ children: conflict.resolutionBasis || '—'
240
+ })
241
+ ]
242
+ })
243
+ })
244
+ ]
245
+ });
246
+ }
247
+ const SvgSeverityFilter = (props)=>/*#__PURE__*/ jsx("svg", {
248
+ xmlns: "http://www.w3.org/2000/svg",
249
+ width: 14,
250
+ height: 14,
251
+ fill: "none",
252
+ overflow: "visible",
253
+ preserveAspectRatio: "none",
254
+ style: {
255
+ display: "block"
256
+ },
257
+ viewBox: "0 0 14 14",
258
+ ...props,
259
+ children: /*#__PURE__*/ jsx("g", {
260
+ fill: "currentColor",
261
+ children: /*#__PURE__*/ jsx("path", {
262
+ d: "M11.375 9.917a1.458 1.458 0 1 0-2.916-.001 1.458 1.458 0 0 0 2.916 0m.875 0a2.333 2.333 0 1 1-2.77-2.293V2.188a.437.437 0 1 1 .874 0v5.436a2.33 2.33 0 0 1 1.896 2.293M5.542 5.25a1.458 1.458 0 1 0-2.916-.001 1.458 1.458 0 0 0 2.916.001m.875 0c0 1.14-.816 2.087-1.896 2.292v4.27a.438.438 0 0 1-.875 0v-4.27a2.333 2.333 0 0 1 0-4.584v-.77a.438.438 0 0 1 .875 0v.77A2.33 2.33 0 0 1 6.417 5.25"
263
+ })
264
+ })
265
+ });
266
+ const severity_filterreact = SvgSeverityFilter;
267
+ const SvgFilterChevron = (props)=>/*#__PURE__*/ jsx("svg", {
268
+ xmlns: "http://www.w3.org/2000/svg",
269
+ width: 14,
270
+ height: 14,
271
+ fill: "none",
272
+ overflow: "visible",
273
+ preserveAspectRatio: "none",
274
+ style: {
275
+ display: "block"
276
+ },
277
+ viewBox: "0 0 14 14",
278
+ ...props,
279
+ children: /*#__PURE__*/ jsx("path", {
280
+ fill: "currentColor",
281
+ d: "M9.607 5.232a.437.437 0 1 1 .619.619L7.309 8.768a.437.437 0 0 1-.618 0L3.774 5.85a.437.437 0 1 1 .619-.619L7 7.84z"
282
+ })
283
+ });
284
+ const filter_chevronreact = SvgFilterChevron;
285
+ const values = [
286
+ 'all',
287
+ 'high',
288
+ 'medium',
289
+ 'low'
290
+ ];
291
+ function WikiSeverityFilter({ value, onChange, labels: t }) {
292
+ const [open, setOpen] = useState(false);
293
+ const trigger = useRef(null);
294
+ const id = useId();
295
+ const focusSelected = useCallback((node)=>{
296
+ node?.querySelector('[aria-selected="true"]')?.focus();
297
+ }, []);
298
+ const close = ()=>{
299
+ setOpen(false);
300
+ trigger.current?.focus();
301
+ };
302
+ return /*#__PURE__*/ jsx(Popover, {
303
+ trigger: "click",
304
+ placement: "bottom",
305
+ open: open,
306
+ onOpenChange: setOpen,
307
+ role: "presentation",
308
+ className: "ov-wiki-dashboard__severity-popover",
309
+ content: /*#__PURE__*/ jsx("div", {
310
+ ref: focusSelected,
311
+ id: id,
312
+ role: "listbox",
313
+ tabIndex: -1,
314
+ "aria-label": t.severity,
315
+ className: "ov-wiki-dashboard__severity-menu",
316
+ onBlur: (event)=>{
317
+ if (!event.currentTarget.contains(event.relatedTarget) && event.relatedTarget !== trigger.current) setOpen(false);
318
+ },
319
+ onKeyDown: (event)=>{
320
+ if ('Escape' === event.key || 'Tab' === event.key) {
321
+ if ('Escape' === event.key) event.preventDefault();
322
+ close();
323
+ return;
324
+ }
325
+ if (![
326
+ 'ArrowDown',
327
+ 'ArrowUp',
328
+ 'Home',
329
+ 'End'
330
+ ].includes(event.key)) return;
331
+ event.preventDefault();
332
+ const options = [
333
+ ...event.currentTarget.querySelectorAll('[role="option"]')
334
+ ];
335
+ const index = options.indexOf(event.target);
336
+ const next = 'Home' === event.key ? 0 : 'End' === event.key ? options.length - 1 : (index + ('ArrowDown' === event.key ? 1 : -1) + options.length) % options.length;
337
+ options[next]?.focus();
338
+ },
339
+ children: values.map((severity)=>/*#__PURE__*/ jsx("button", {
340
+ type: "button",
341
+ role: "option",
342
+ "aria-selected": value === severity,
343
+ tabIndex: value === severity ? 0 : -1,
344
+ onClick: ()=>{
345
+ onChange(severity);
346
+ close();
347
+ },
348
+ children: t[severity]
349
+ }, severity))
350
+ }),
351
+ children: /*#__PURE__*/ jsxs("button", {
352
+ type: "button",
353
+ "aria-haspopup": "listbox",
354
+ "aria-controls": open ? id : void 0,
355
+ "aria-expanded": open,
356
+ "aria-label": `${t.severity}: ${t[value]}`,
357
+ className: "ov-wiki-dashboard__severity-filter",
358
+ onClick: (event)=>{
359
+ trigger.current = event.currentTarget;
360
+ },
361
+ onKeyDown: (event)=>{
362
+ trigger.current = event.currentTarget;
363
+ if ('ArrowDown' === event.key || 'ArrowUp' === event.key) {
364
+ event.preventDefault();
365
+ setOpen(true);
366
+ }
367
+ },
368
+ children: [
369
+ /*#__PURE__*/ jsx(severity_filterreact, {
370
+ "aria-hidden": "true"
371
+ }),
372
+ /*#__PURE__*/ jsx("span", {
373
+ children: t.severity
374
+ }),
375
+ /*#__PURE__*/ jsx("span", {
376
+ className: "ov-wiki-dashboard__filter-value",
377
+ children: t[value]
378
+ }),
379
+ /*#__PURE__*/ jsx(filter_chevronreact, {
380
+ "aria-hidden": "true"
381
+ })
382
+ ]
383
+ })
384
+ });
385
+ }
386
+ function WikiDashboard(props) {
387
+ const { kind, data, editDisabledReason, discussDisabledReason, locale: localeProp, onOpenUri, onOpenDashboard, onEdit, onDiscuss, labels, loading, error, onRetry, className, ...rest } = props;
388
+ const locale = useLocale(localeProp);
389
+ const t = wikiLabels(locale, labels);
390
+ const [severity, setSeverity] = useState('all');
391
+ const conflicts = 'file' === kind ? data?.conflicts.filter((item)=>'all' === severity || item.severity === severity) ?? [] : [];
392
+ const count = data ? 'file' === kind ? data.conflicts.filter((item)=>'unfixed' === item.state).length : data.conflictFileCount : void 0;
393
+ return /*#__PURE__*/ jsxs("div", {
394
+ ...rest,
395
+ className: [
396
+ 'ov-wiki-dashboard',
397
+ className
398
+ ].filter(Boolean).join(' '),
399
+ children: [
400
+ /*#__PURE__*/ jsx("header", {
401
+ className: "ov-wiki-dashboard__header",
402
+ children: /*#__PURE__*/ jsx("h2", {
403
+ children: t.title
404
+ })
405
+ }),
406
+ /*#__PURE__*/ jsxs("div", {
407
+ className: "ov-wiki-dashboard__body",
408
+ children: [
409
+ /*#__PURE__*/ jsx("dl", {
410
+ className: "ov-wiki-dashboard__statistics",
411
+ children: /*#__PURE__*/ jsxs("div", {
412
+ children: [
413
+ /*#__PURE__*/ jsx(WikiWarningIcon, {
414
+ width: 14,
415
+ height: 14
416
+ }),
417
+ /*#__PURE__*/ jsx("dd", {
418
+ children: void 0 === count ? '—' : 'directory' === kind && count >= 100 ? '99+' : `${count}${'directory' === kind && data?.limited ? '+' : ''}`
419
+ }),
420
+ /*#__PURE__*/ jsx("dt", {
421
+ children: 'file' === kind ? t.pending : t.conflictFiles
422
+ })
423
+ ]
424
+ })
425
+ }),
426
+ /*#__PURE__*/ jsxs("div", {
427
+ className: "ov-wiki-dashboard__toolbar",
428
+ children: [
429
+ /*#__PURE__*/ jsx("h3", {
430
+ children: t.conflicts
431
+ }),
432
+ 'file' === kind ? /*#__PURE__*/ jsx(WikiSeverityFilter, {
433
+ value: severity,
434
+ onChange: setSeverity,
435
+ labels: t
436
+ }) : null
437
+ ]
438
+ }),
439
+ 'file' === kind && conflicts.length ? /*#__PURE__*/ jsx("div", {
440
+ className: "ov-wiki-dashboard__conflicts",
441
+ role: "region",
442
+ "aria-label": t.conflicts,
443
+ tabIndex: 0,
444
+ children: conflicts.map((conflict)=>/*#__PURE__*/ jsx(WikiConflictCard, {
445
+ conflict: conflict,
446
+ path: data?.path,
447
+ labels: t,
448
+ editDisabledReason: editDisabledReason,
449
+ discussDisabledReason: discussDisabledReason,
450
+ onOpenUri: onOpenUri,
451
+ onEdit: onEdit,
452
+ onDiscuss: onDiscuss
453
+ }, conflict.id))
454
+ }) : 'directory' === kind && data?.files.length ? /*#__PURE__*/ jsx("ul", {
455
+ className: "ov-wiki-dashboard__files",
456
+ children: data.files.map((file)=>/*#__PURE__*/ jsxs("li", {
457
+ children: [
458
+ /*#__PURE__*/ jsx(WikiFileIcon, {
459
+ name: file
460
+ }),
461
+ /*#__PURE__*/ jsxs("button", {
462
+ type: "button",
463
+ className: "ov-wiki-dashboard__link",
464
+ disabled: !onOpenDashboard && !onOpenUri,
465
+ onClick: ()=>(onOpenDashboard ?? onOpenUri)?.(file),
466
+ children: [
467
+ /*#__PURE__*/ jsx("span", {
468
+ children: file.split('/').pop()
469
+ }),
470
+ /*#__PURE__*/ jsx("span", {
471
+ className: "ov-wiki-dashboard__file-uri",
472
+ children: file
473
+ })
474
+ ]
475
+ }),
476
+ onEdit ? /*#__PURE__*/ jsx("button", {
477
+ type: "button",
478
+ onClick: ()=>onEdit(file),
479
+ children: t.edit
480
+ }) : null
481
+ ]
482
+ }, file))
483
+ }) : /*#__PURE__*/ jsx(DashboardState, {
484
+ state: {
485
+ loading,
486
+ error,
487
+ onRetry
488
+ },
489
+ empty: t.empty,
490
+ loading: t.loading,
491
+ failed: t.failed,
492
+ retry: t.retry
493
+ }),
494
+ 'directory' === kind && data?.limited ? /*#__PURE__*/ jsx("p", {
495
+ className: "ov-wiki-dashboard__limited",
496
+ children: t.limited
497
+ }) : null
498
+ ]
499
+ })
500
+ ]
501
+ });
502
+ }
503
+ export { WikiDashboard };