@vokril/ui-solid 0.33.5 → 0.35.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.
Files changed (95) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +40 -0
  3. package/dist/Alert-DCIet3Ol.cjs +1 -0
  4. package/dist/Alert-DyBaU25r.js +59 -0
  5. package/dist/Badge-BXLrs2z-.cjs +1 -0
  6. package/dist/Badge-BguTObKo.js +99 -0
  7. package/dist/CommandPalette-3wKYPO9u.cjs +2 -0
  8. package/dist/CommandPalette-BnZwM7DE.js +4130 -0
  9. package/dist/PageSkeleton-3f-2SBNK.cjs +30 -0
  10. package/dist/{PageSkeleton-BRuqaDzr.js → PageSkeleton-lfENszyc.js} +516 -569
  11. package/dist/{StatusBarNotificationBell-DE1jIaBt.js → StatusBarNotificationBell-GbkAwC4w.js} +4242 -4154
  12. package/dist/StatusBarNotificationBell-fegn26_s.cjs +53 -0
  13. package/dist/_internal/contract/browser/workspace.d.cts +5 -0
  14. package/dist/_internal/contract/browser/workspace.d.ts +5 -0
  15. package/dist/_internal/contract/notification.d.cts +30 -4
  16. package/dist/_internal/contract/notification.d.ts +30 -4
  17. package/dist/_internal/contract/notificationCatalog.d.cts +15 -1
  18. package/dist/_internal/contract/notificationCatalog.d.ts +15 -1
  19. package/dist/feedback/index.cjs +1 -1
  20. package/dist/feedback/index.js +38 -36
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.js +430 -428
  23. package/dist/notificationCatalog-DmwTAO09.cjs +1 -0
  24. package/dist/notificationCatalog-otJ1LHFH.js +72 -0
  25. package/dist/notifications/createNotificationPreviewRuntime.d.cts +1 -0
  26. package/dist/notifications/createNotificationPreviewRuntime.d.ts +1 -0
  27. package/dist/notifications/fireNotification.d.cts +14 -7
  28. package/dist/notifications/fireNotification.d.ts +14 -7
  29. package/dist/notifications/index.cjs +1 -1
  30. package/dist/notifications/index.js +2 -2
  31. package/dist/notifications/nativeEngine.d.cts +8 -1
  32. package/dist/notifications/nativeEngine.d.ts +8 -1
  33. package/dist/notifications/notificationService.d.cts +2 -1
  34. package/dist/notifications/notificationService.d.ts +2 -1
  35. package/dist/notifications/notifications.notifications.d.cts +0 -1
  36. package/dist/notifications/notifications.notifications.d.ts +0 -1
  37. package/dist/notifications/toast.d.cts +19 -3
  38. package/dist/notifications/toast.d.ts +19 -3
  39. package/dist/notifications/toastFilterPolicy.d.cts +15 -1
  40. package/dist/notifications/toastFilterPolicy.d.ts +15 -1
  41. package/dist/overlay/ConfirmDialog.d.cts +36 -0
  42. package/dist/overlay/ConfirmDialog.d.ts +36 -0
  43. package/dist/overlay/dialogNudge.d.cts +16 -0
  44. package/dist/overlay/dialogNudge.d.ts +16 -0
  45. package/dist/overlay/index.cjs +1 -1
  46. package/dist/overlay/index.js +1 -1
  47. package/dist/server/Alert-DWGobTUk.js +45 -0
  48. package/dist/server/Alert-DulmzLv9.cjs +1 -0
  49. package/dist/server/Badge-C1Jn--DR.js +68 -0
  50. package/dist/server/Badge-wsDCVlA8.cjs +1 -0
  51. package/dist/server/CommandPalette-B3EE1iMo.js +3376 -0
  52. package/dist/server/CommandPalette-DKURJBBZ.cjs +1 -0
  53. package/dist/server/PageSkeleton-CP8EmxyS.cjs +30 -0
  54. package/dist/server/{PageSkeleton-CFs7AdTA.js → PageSkeleton-HhO6CRZ8.js} +392 -431
  55. package/dist/server/{StatusBarNotificationBell-y5cPAlMY.js → StatusBarNotificationBell-BfBGKXDG.js} +4256 -4168
  56. package/dist/server/StatusBarNotificationBell-CB919YAX.cjs +52 -0
  57. package/dist/server/feedback/index.cjs +1 -1
  58. package/dist/server/feedback/index.js +38 -36
  59. package/dist/server/index.cjs +1 -1
  60. package/dist/server/index.js +294 -292
  61. package/dist/server/notificationCatalog-BKcY-o-R.js +57 -0
  62. package/dist/server/notificationCatalog-DR3ZggWn.cjs +1 -0
  63. package/dist/server/notifications/index.cjs +1 -1
  64. package/dist/server/notifications/index.js +2 -2
  65. package/dist/server/overlay/index.cjs +1 -1
  66. package/dist/server/overlay/index.js +1 -1
  67. package/dist/solid/notifications/NotificationItem.jsx +4 -3
  68. package/dist/solid/notifications/catalogAdapter.js +8 -9
  69. package/dist/solid/notifications/createNotificationPreviewRuntime.js +34 -18
  70. package/dist/solid/notifications/fireNotification.js +9 -5
  71. package/dist/solid/notifications/notificationOverlaySnapshot.js +1 -0
  72. package/dist/solid/notifications/notificationService.js +1 -0
  73. package/dist/solid/notifications/notifications.notifications.js +8 -0
  74. package/dist/solid/notifications/toast.js +70 -31
  75. package/dist/solid/notifications/toastFilterPolicy.js +8 -0
  76. package/dist/solid/overlay/ConfirmDialog.jsx +54 -10
  77. package/dist/solid/overlay/ConfirmDialog.module.css.js +6 -0
  78. package/dist/solid/overlay/DangerousActionDialog.jsx +8 -3
  79. package/dist/solid/overlay/DangerousActionDialog.module.css.js +1 -0
  80. package/dist/solid/overlay/dialogNudge.js +18 -0
  81. package/dist/style.css +1 -1
  82. package/dist/ui.css +1 -1
  83. package/package.json +1 -1
  84. package/dist/CommandPalette-BKa5pT_B.js +0 -4029
  85. package/dist/CommandPalette-Bq5ydWBA.cjs +0 -2
  86. package/dist/PageSkeleton-Cz2bckO4.cjs +0 -30
  87. package/dist/StatusBarNotificationBell-CLrNtOO9.cjs +0 -50
  88. package/dist/notificationCatalog-CRERhjp6.js +0 -168
  89. package/dist/notificationCatalog-DqTkd7M6.cjs +0 -1
  90. package/dist/server/CommandPalette-BU9QCOyy.cjs +0 -1
  91. package/dist/server/CommandPalette-Dj08M64T.js +0 -3305
  92. package/dist/server/PageSkeleton-D0KOKLsb.cjs +0 -30
  93. package/dist/server/StatusBarNotificationBell-fLacxZ0X.cjs +0 -49
  94. package/dist/server/notificationCatalog-CEDltsJS.cjs +0 -1
  95. package/dist/server/notificationCatalog-Cl1dH4aJ.js +0 -122
@@ -15,13 +15,28 @@ function toMessage(value) {
15
15
  return '';
16
16
  return String(value);
17
17
  }
18
+ function joinBody(first, second) {
19
+ if (first && second)
20
+ return `${first}\n\n${second}`;
21
+ return first || second || undefined;
22
+ }
23
+ export function cardLines(message, options) {
24
+ const description = options.subtitle?.trim() || options.description?.trim() || undefined;
25
+ const title = options.title?.trim();
26
+ if (!title)
27
+ return { title: message, body: description };
28
+ return { title, body: joinBody(message.trim() ? message : undefined, description) };
29
+ }
30
+ function recordedText(titleLine, message, options) {
31
+ return options.title?.trim() && message.trim() ? `${titleLine}\n${message}` : titleLine;
32
+ }
18
33
  export function enrichErrorToast(message, options, vendorMatch, onOpenDocs) {
19
34
  const text = toMessage(message);
20
- const titleFromOptions = options.title?.trim();
21
- const description = options.subtitle?.trim() || options.description?.trim();
22
- let displayText = titleFromOptions ?? text;
23
- let bodyText = description;
24
- if (vendorMatch && !titleFromOptions) {
35
+ const titled = Boolean(options.title?.trim());
36
+ const lines = cardLines(text, options);
37
+ let displayText = lines.title;
38
+ let bodyText = lines.body;
39
+ if (vendorMatch && !titled) {
25
40
  const formatted = vendorMatch.helpers.formatCode(vendorMatch.code);
26
41
  const splitRegex = new RegExp(`^\\s*${escapeRegExpCharacters(formatted)}\\s*[:-]\\s*(.+)$`, 'i');
27
42
  const match = text.match(splitRegex);
@@ -61,21 +76,28 @@ function issueKeysOf(options) {
61
76
  remindKey: options.remindKey,
62
77
  };
63
78
  }
64
- function applyNotificationRulesFromSettings(input) {
79
+ function applyNotificationRulesFromSettings(input, options) {
80
+ if (options.origin === 'user-action')
81
+ return input;
65
82
  return applyNotificationRules(input, notificationSettings.get().notificationRules);
66
83
  }
84
+ function successToastsOff(priority, options) {
85
+ return (!notificationSettings.get().showSuccessToasts &&
86
+ priority !== 'urgent' &&
87
+ options.origin !== 'user-action');
88
+ }
67
89
  export function createToast(deps) {
68
90
  const { sinks, timeline } = deps;
69
91
  return {
70
92
  success(message, options = {}) {
71
93
  const text = toMessage(message);
72
- const settings = notificationSettings.get();
94
+ const lines = cardLines(text, options);
73
95
  const ruled = applyNotificationRulesFromSettings({
74
96
  severity: 'success',
75
- title: text,
97
+ title: lines.title,
76
98
  priority: options.priority ?? 'default',
77
99
  source: options.source ?? 'general',
78
- });
100
+ }, options);
79
101
  if (!ruled)
80
102
  return '';
81
103
  const decision = decideFilter({
@@ -85,15 +107,17 @@ export function createToast(deps) {
85
107
  priority: ruled.priority,
86
108
  recordTimeline: options.recordTimeline,
87
109
  filter: deps.filter(),
110
+ origin: options.origin,
88
111
  ...issueKeysOf(options),
89
112
  });
90
113
  if (decision.recordTimeline)
91
- timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
92
- if (!settings.showSuccessToasts && ruled.priority !== 'urgent')
114
+ timeline.add(recordedText(ruled.title, text, options), ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
115
+ if (successToastsOff(ruled.priority, options))
93
116
  return '';
94
117
  const handle = fire(sinks, {
95
118
  severity: ruled.severity,
96
119
  title: ruled.title,
120
+ body: lines.body,
97
121
  options: { ...options, source: ruled.source, priority: ruled.priority },
98
122
  decision,
99
123
  ...(options.action ? { primaryAction: options.action } : {}),
@@ -106,14 +130,14 @@ export function createToast(deps) {
106
130
  const enrichment = enrichErrorToast(text, options, vendorMatch, deps.openExternal);
107
131
  const hasVendorCode = vendorMatch !== null;
108
132
  const bodyText = enrichment.bodyText;
109
- const timelineText = bodyText ? `${enrichment.displayText}\n${bodyText}` : text;
133
+ const timelineText = bodyText ? `${enrichment.displayText}\n${bodyText}` : enrichment.displayText;
110
134
  const vendorUrgent = hasVendorCode && notificationSettings.get().vendorCodesAreUrgent;
111
135
  const ruled = applyNotificationRulesFromSettings({
112
136
  severity: 'error',
113
137
  title: enrichment.displayText,
114
138
  priority: options.priority ?? (vendorUrgent ? 'urgent' : 'default'),
115
139
  source: options.source ?? (hasVendorCode ? 'vendor-error' : 'general'),
116
- });
140
+ }, options);
117
141
  if (!ruled)
118
142
  return '';
119
143
  const { source, priority } = ruled;
@@ -124,6 +148,7 @@ export function createToast(deps) {
124
148
  priority,
125
149
  recordTimeline: options.recordTimeline,
126
150
  filter: deps.filter(),
151
+ origin: options.origin,
127
152
  ...issueKeysOf(options),
128
153
  });
129
154
  if (decision.recordTimeline)
@@ -131,7 +156,8 @@ export function createToast(deps) {
131
156
  const handle = fire(sinks, {
132
157
  severity: ruled.severity,
133
158
  title: ruled.title,
134
- options: { ...options, source, priority, ...(bodyText ? { description: bodyText } : {}) },
159
+ body: bodyText,
160
+ options: { ...options, source, priority },
135
161
  decision,
136
162
  ...(enrichment.primaryAction ? { primaryAction: enrichment.primaryAction } : {}),
137
163
  ...(options.vendorError ? { vendorError: options.vendorError } : {}),
@@ -146,30 +172,33 @@ export function createToast(deps) {
146
172
  },
147
173
  queryCompleted(message, options = {}) {
148
174
  const text = toMessage(message);
175
+ const lines = cardLines(text, options);
149
176
  const settings = notificationSettings.get();
150
177
  const source = options.source ?? 'sql-execution';
151
178
  const priority = options.priority ?? 'default';
152
179
  const decision = decideFilter({
153
180
  source,
154
- title: text,
181
+ title: lines.title,
155
182
  severity: 'success',
156
183
  priority,
157
184
  recordTimeline: options.recordTimeline,
158
185
  filter: deps.filter(),
186
+ origin: options.origin,
159
187
  ...issueKeysOf(options),
160
188
  });
161
189
  if (decision.recordTimeline)
162
- timeline.add(text, 'success', source, priority, toTimelineActions(options.action));
190
+ timeline.add(recordedText(lines.title, text, options), 'success', source, priority, toTimelineActions(options.action));
163
191
  if (settings.notificationsEnabled &&
164
192
  settings.soundOnQueryCompletion &&
165
193
  !(settings.quietHoursMutesSounds && isInQuietHours(settings, new Date()))) {
166
194
  sinks.audio.playQueryCompletedCue();
167
195
  }
168
- if (!settings.showSuccessToasts && priority !== 'urgent')
196
+ if (successToastsOff(priority, options))
169
197
  return '';
170
198
  const handle = fire(sinks, {
171
199
  severity: 'success',
172
- title: text,
200
+ title: lines.title,
201
+ body: lines.body,
173
202
  options: { ...options, source, priority },
174
203
  decision,
175
204
  ...(options.action ? { primaryAction: options.action } : {}),
@@ -183,19 +212,24 @@ export function createToast(deps) {
183
212
  const priority = options.priority ?? 'default';
184
213
  const explicitId = options.id !== undefined ? String(options.id) : undefined;
185
214
  const keys = issueKeysOf(options);
215
+ const lines = cardLines(text, options);
216
+ const titled = Boolean(options.title?.trim());
217
+ const linesOf = (next) => titled ? { body: cardLines(next, options).body } : { title: next };
218
+ const recorded = (next) => titled ? recordedText(lines.title, next, options) : next;
186
219
  const decision = decideFilter({
187
220
  source,
188
- title: text,
221
+ title: lines.title,
189
222
  severity: 'info',
190
223
  priority,
191
224
  recordTimeline: options.recordTimeline,
192
225
  filter: deps.filter(),
226
+ origin: options.origin,
193
227
  ...keys,
194
228
  });
195
229
  if (decision.recordTimeline)
196
- timeline.add(text, 'info', source, priority);
230
+ timeline.add(recorded(text), 'info', source, priority);
197
231
  if (!decision.showToast &&
198
- (turnedDownOnCard(source, text, keys) ||
232
+ (turnedDownOnCard(source, lines.title, keys) ||
199
233
  priority === 'acknowledgment-required')) {
200
234
  if (explicitId !== undefined)
201
235
  sinks.engine.reject(explicitId);
@@ -207,18 +241,19 @@ export function createToast(deps) {
207
241
  const handle = sinks.engine.notify({
208
242
  id,
209
243
  severity: 'info',
210
- title: text,
244
+ title: lines.title,
245
+ ...(lines.body ? { body: lines.body } : {}),
211
246
  ...cardPresentation({ ...options, source }),
212
247
  source,
213
248
  priority,
214
249
  sticky: true,
215
250
  progress: onCancel ? { onCancel } : {},
216
- remindKey: keys.remindKey ?? keys.dontShowAgainKey ?? deriveImplicitRemindKey(source, text),
251
+ remindKey: keys.remindKey ?? keys.dontShowAgainKey ?? deriveImplicitRemindKey(source, lines.title),
217
252
  ...(actions.length > 0 ? { actions } : {}),
218
253
  });
219
254
  return {
220
255
  update: (next, value) => {
221
- handle.update({ title: next });
256
+ handle.update(linesOf(next));
222
257
  if (value !== undefined) {
223
258
  handle.setProgress({
224
259
  value: Math.max(0, Math.min(1, value)),
@@ -229,15 +264,15 @@ export function createToast(deps) {
229
264
  success: (final) => {
230
265
  const msg = final ?? text;
231
266
  if (decision.recordTimeline)
232
- timeline.add(msg, 'success', source, priority);
233
- handle.update({ title: msg, severity: 'success', sticky: false, progress: { done: true } });
267
+ timeline.add(recorded(msg), 'success', source, priority);
268
+ handle.update({ ...linesOf(msg), severity: 'success', sticky: false, progress: { done: true } });
234
269
  },
235
270
  fail: (final) => {
236
271
  const msg = final ?? text;
237
272
  if (decision.recordTimeline)
238
- timeline.add(msg, 'error', source, priority);
273
+ timeline.add(recorded(msg), 'error', source, priority);
239
274
  handle.update({
240
- title: msg,
275
+ ...linesOf(msg),
241
276
  severity: 'error',
242
277
  sticky: true,
243
278
  progress: { done: true },
@@ -258,12 +293,14 @@ export function createToast(deps) {
258
293
  };
259
294
  }
260
295
  function plainVerb(deps, severity, message, options) {
296
+ const text = toMessage(message);
297
+ const lines = cardLines(text, options);
261
298
  const ruled = applyNotificationRulesFromSettings({
262
299
  severity,
263
- title: toMessage(message),
300
+ title: lines.title,
264
301
  priority: options.priority ?? 'default',
265
302
  source: options.source ?? 'general',
266
- });
303
+ }, options);
267
304
  if (!ruled)
268
305
  return '';
269
306
  const decision = decideFilter({
@@ -273,13 +310,15 @@ function plainVerb(deps, severity, message, options) {
273
310
  priority: ruled.priority,
274
311
  recordTimeline: options.recordTimeline,
275
312
  filter: deps.filter(),
313
+ origin: options.origin,
276
314
  ...issueKeysOf(options),
277
315
  });
278
316
  if (decision.recordTimeline)
279
- deps.timeline.add(ruled.title, ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
317
+ deps.timeline.add(recordedText(ruled.title, text, options), ruled.severity, ruled.source, ruled.priority, toTimelineActions(options.action));
280
318
  const handle = fire(deps.sinks, {
281
319
  severity: ruled.severity,
282
320
  title: ruled.title,
321
+ body: lines.body,
283
322
  options: { ...options, source: ruled.source, priority: ruled.priority },
284
323
  decision,
285
324
  ...(options.action ? { primaryAction: options.action } : {}),
@@ -16,6 +16,14 @@ export function cardRemindKey(card) {
16
16
  export function decideFilter(input, settings, gates) {
17
17
  const { priority } = input;
18
18
  const allowTimeline = input.recordTimeline !== false;
19
+ if (input.origin === 'user-action') {
20
+ const settled = decideFilter({ priority, recordTimeline: input.recordTimeline }, settings, gates);
21
+ return {
22
+ showToast: true,
23
+ recordTimeline: allowTimeline,
24
+ ...(settled.showToast ? {} : { withoutSound: true }),
25
+ };
26
+ }
19
27
  if (!settings.notificationsEnabled) {
20
28
  return { showToast: false, recordTimeline: false };
21
29
  }
@@ -1,10 +1,13 @@
1
- import { Show, createEffect, createMemo, createSignal, createUniqueId, on, onCleanup, } from 'solid-js';
1
+ import { For, Show, createEffect, createMemo, createSignal, createUniqueId, on, onCleanup, } from 'solid-js';
2
2
  import { OverlayPortal } from './OverlayPortal';
3
3
  import { Button } from '../forms/Button';
4
4
  import { Checkbox } from '../forms/Checkbox';
5
5
  import { Input } from '../forms/Input';
6
6
  import { Textarea } from '../forms/Textarea';
7
+ import { Alert } from '../feedback/Alert';
8
+ import { Badge } from '../feedback/Badge';
7
9
  import { createDialogFocusScope } from './dialogFocusScope';
10
+ import { nudgeDialog } from './dialogNudge';
8
11
  import { trapTabFocusWithin } from './modalFocusContainment';
9
12
  import { resolveDialogShellKeyIntent } from './dialogShellKeyIntent';
10
13
  import { createOverlayCloseGuard } from './overlayCloseGuard';
@@ -19,12 +22,24 @@ const hostDocOf = (host) => (host?.() ?? getMainWindow().window).document;
19
22
  export function ConfirmDialog(props) {
20
23
  const variant = createMemo(() => props.variant ?? 'default');
21
24
  const sticky = createMemo(() => Boolean(props.sticky));
25
+ const acknowledge = createMemo(() => Boolean(props.acknowledge) && !sticky());
26
+ const holdsBackdrop = createMemo(() => sticky() || (variant() === 'danger' && !acknowledge()));
22
27
  const cancelLabel = createMemo(() => props.cancelLabel ?? t('Cancel'));
28
+ const confirmLabel = createMemo(() => props.confirmLabel ?? (acknowledge() ? t('Close') : t('Confirm')));
23
29
  const checkboxOption = createMemo(() => props.checkbox);
30
+ const details = createMemo(() => props.details ?? []);
31
+ const warnings = createMemo(() => props.warnings ?? []);
24
32
  const titleId = createUniqueId();
25
33
  const placeId = createUniqueId();
26
34
  const messageId = createUniqueId();
27
- const describedBy = () => props.place ? `${placeId} ${messageId}` : messageId;
35
+ const warningsId = createUniqueId();
36
+ const describedBy = () => [
37
+ props.place ? placeId : null,
38
+ messageId,
39
+ warnings().length > 0 ? warningsId : null,
40
+ ]
41
+ .filter((id) => id !== null)
42
+ .join(' ');
28
43
  const [remaining, setRemaining] = createSignal(0);
29
44
  createEffect(() => {
30
45
  if (!props.open()) {
@@ -56,14 +71,18 @@ export function ConfirmDialog(props) {
56
71
  const handleOverlayMouseDown = (event) => {
57
72
  const onOverlay = event.target === event.currentTarget;
58
73
  overlayGuard.noteMouseDown(onOverlay);
59
- if (onOverlay && sticky())
74
+ if (onOverlay && holdsBackdrop())
60
75
  event.preventDefault();
61
76
  };
62
77
  const handleOverlayClick = (event) => {
63
- if (overlayGuard.shouldCloseOnClick(event.target === event.currentTarget) &&
64
- !sticky()) {
78
+ if (!overlayGuard.shouldCloseOnClick(event.target === event.currentTarget))
79
+ return;
80
+ if (!holdsBackdrop()) {
65
81
  props.onCancel(answer());
82
+ return;
66
83
  }
84
+ if (dialogElement)
85
+ nudgeDialog(dialogElement);
67
86
  };
68
87
  const handleOverlayKeyDown = (event) => {
69
88
  if (event.target !== event.currentTarget)
@@ -100,7 +119,7 @@ export function ConfirmDialog(props) {
100
119
  if (!el.isConnected)
101
120
  return;
102
121
  const buttons = Array.from(el.querySelectorAll('button:not([disabled])'));
103
- const isDanger = variant() === 'danger';
122
+ const isDanger = variant() === 'danger' && !acknowledge();
104
123
  const targetBtn = isDanger
105
124
  ? sticky()
106
125
  ? undefined
@@ -114,6 +133,15 @@ export function ConfirmDialog(props) {
114
133
  <div class={styles.overlay} tabIndex={-1} onMouseDown={handleOverlayMouseDown} onClick={handleOverlayClick} onKeyDown={handleOverlayKeyDown}>
115
134
  <div ref={captureAndFocus} class={styles.dialog} role="alertdialog" aria-modal="true" aria-labelledby={titleId} aria-describedby={describedBy()} tabIndex={-1} onKeyDown={handleKeyDown}>
116
135
  <div class={styles.header}>
136
+ <Show when={(props.badges ?? []).length > 0}>
137
+ <div class={styles.badges}>
138
+ <For each={props.badges}>
139
+ {(badge) => (<Badge size="sm" tone={badge.tone ?? 'neutral'}>
140
+ {badge.label}
141
+ </Badge>)}
142
+ </For>
143
+ </div>
144
+ </Show>
117
145
  <h3 id={titleId} class={styles.title}>
118
146
  {props.title}
119
147
  </h3>
@@ -125,6 +153,22 @@ export function ConfirmDialog(props) {
125
153
  <p id={messageId} class={styles.message}>
126
154
  {props.message}
127
155
  </p>
156
+ <Show when={details().length > 0}>
157
+ <ul class={styles.details}>
158
+ <For each={details()}>{(line) => <li>{line}</li>}</For>
159
+ </ul>
160
+ </Show>
161
+ <Show when={warnings().length > 0}>
162
+ <div id={warningsId} class={styles.warnings}>
163
+ <Alert tone={variant() === 'danger' ? 'danger' : 'warning'} urgency="polite">
164
+ <Show when={warnings().length > 1} fallback={<p class={styles.warningLine}>{warnings()[0]}</p>}>
165
+ <ul class={styles.warningList}>
166
+ <For each={warnings()}>{(line) => <li>{line}</li>}</For>
167
+ </ul>
168
+ </Show>
169
+ </Alert>
170
+ </div>
171
+ </Show>
128
172
  <Show when={props.code}>
129
173
  {(code) => (<OverlayScrollArea rootClass={styles.codeScroll} viewportClass={styles.code}>
130
174
  <pre class={styles.codePre} aria-label={t('Statement')}>
@@ -139,20 +183,20 @@ export function ConfirmDialog(props) {
139
183
  </Show>
140
184
  </div>
141
185
  <div class={styles.footer}>
142
- <Show when={!sticky()}>
186
+ <Show when={!sticky() && !acknowledge()}>
143
187
  <Button size="lg" variant="secondary" onClick={() => props.onCancel(answer())}>
144
188
  {cancelLabel()}
145
189
  </Button>
146
190
  </Show>
147
- <Button size="lg" variant={variant() === 'danger'
191
+ <Button size="lg" variant={variant() === 'danger' && !acknowledge()
148
192
  ? 'dangerSolid'
149
193
  : 'primary'} disabled={remaining() > 0} onClick={() => props.onConfirm(answer())}>
150
194
  {remaining() > 0
151
195
  ? t('{label} ({seconds})', {
152
- label: props.confirmLabel ?? t('Confirm'),
196
+ label: confirmLabel(),
153
197
  seconds: remaining(),
154
198
  })
155
- : (props.confirmLabel ?? t('Confirm'))}
199
+ : confirmLabel()}
156
200
  </Button>
157
201
  </div>
158
202
  </div>
@@ -4,7 +4,13 @@ export default {
4
4
  "dialogBackdropFadeIn": "vk_dialogBackdropFadeIn_bgihT",
5
5
  "dialog": "vk_dialog_3YL-7",
6
6
  "dialogEntranceScaleUp": "vk_dialogEntranceScaleUp_Ab6Az",
7
+ "dialogNudge": "vk_dialogNudge_H2018",
7
8
  "header": "vk_header_asYMs",
9
+ "badges": "vk_badges_yPJ6e",
10
+ "details": "vk_details_RXi6U",
11
+ "warnings": "vk_warnings_M8Sqk",
12
+ "warningLine": "vk_warningLine_BbPrX",
13
+ "warningList": "vk_warningList_M4udI",
8
14
  "title": "vk_title_0fm8I vk_titleLg_Iswm3",
9
15
  "body": "vk_body_U-3RF",
10
16
  "message": "vk_message_UsUIn",
@@ -4,6 +4,7 @@ import { requestOwnerAnimationFrame } from './ownerAnimationFrame';
4
4
  import { t } from '../i18n/i18n';
5
5
  import { resolveDangerousActionDialogKeyIntent } from './dangerousActionDialogKeyIntent';
6
6
  import { createDialogFocusScope } from './dialogFocusScope';
7
+ import { nudgeDialog } from './dialogNudge';
7
8
  import { trapTabFocusWithin } from './modalFocusContainment';
8
9
  import { createOverlayCloseGuard } from './overlayCloseGuard';
9
10
  import { getActiveWindow, getMainWindow } from '../host/window';
@@ -152,11 +153,15 @@ export function createDangerousActionDialog(defaultHost) {
152
153
  });
153
154
  onCleanup(stopCountdown);
154
155
  const handleOverlayMouseDown = (event) => {
155
- overlayGuard.noteMouseDown(event.target === event.currentTarget);
156
+ const onOverlay = event.target === event.currentTarget;
157
+ overlayGuard.noteMouseDown(onOverlay);
158
+ if (onOverlay)
159
+ event.preventDefault();
156
160
  };
157
161
  const handleOverlayClick = (event) => {
158
- if (overlayGuard.shouldCloseOnClick(event.target === event.currentTarget))
159
- settle(false);
162
+ if (overlayGuard.shouldCloseOnClick(event.target === event.currentTarget) &&
163
+ dialogElement)
164
+ nudgeDialog(dialogElement);
160
165
  };
161
166
  const handleKeyDown = (event) => {
162
167
  const intent = resolveDangerousActionDialogKeyIntent(event.key, {
@@ -4,6 +4,7 @@ export default {
4
4
  "dialogBackdropFadeIn": "vk_dialogBackdropFadeIn_UuemA",
5
5
  "dialog": "vk_dialog_Yf7zX",
6
6
  "dialogEntranceScaleUp": "vk_dialogEntranceScaleUp_xRcng",
7
+ "dialogNudge": "vk_dialogNudge_PrAjO",
7
8
  "header": "vk_header_CYXMR",
8
9
  "warningIcon": "vk_warningIcon_qizN5",
9
10
  "title": "vk_title_DPV4m vk_titleLg_Iswm3",
@@ -0,0 +1,18 @@
1
+ export const NUDGE_HOLD_MS = 600;
2
+ export const NUDGE_ATTRIBUTE = 'data-nudge';
3
+ const timers = new WeakMap();
4
+ export function nudgeDialog(dialog) {
5
+ const view = dialog.ownerDocument.defaultView;
6
+ if (view === null)
7
+ return;
8
+ const previous = timers.get(dialog);
9
+ if (previous !== undefined)
10
+ view.clearTimeout(previous);
11
+ dialog.removeAttribute(NUDGE_ATTRIBUTE);
12
+ void dialog.offsetWidth;
13
+ dialog.setAttribute(NUDGE_ATTRIBUTE, '');
14
+ timers.set(dialog, view.setTimeout(() => {
15
+ timers.delete(dialog);
16
+ dialog.removeAttribute(NUDGE_ATTRIBUTE);
17
+ }, NUDGE_HOLD_MS));
18
+ }