@adea-ai/ui 0.71.0 → 0.71.2

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 (99) hide show
  1. package/dist/components/composites/appearance-editor/appearance-editor.js +1 -1
  2. package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
  3. package/dist/components/composites/stat/stat.d.ts.map +1 -1
  4. package/dist/components/composites/stat/stat.js +8 -8
  5. package/dist/components/composites/stat/stat.js.map +1 -1
  6. package/dist/components/composites/update-dialog/update-dialog.d.ts +7 -0
  7. package/dist/components/composites/update-dialog/update-dialog.d.ts.map +1 -1
  8. package/dist/components/composites/update-dialog/update-dialog.js +71 -26
  9. package/dist/components/composites/update-dialog/update-dialog.js.map +1 -1
  10. package/dist/components/conversation/internal/chat-composer-shell.js +1 -1
  11. package/dist/components/conversation/internal/chat-composer-shell.js.map +1 -1
  12. package/dist/components/conversation/message-composer.d.ts.map +1 -1
  13. package/dist/components/conversation/message-composer.js +1 -1
  14. package/dist/components/conversation/message-composer.js.map +1 -1
  15. package/dist/components/ui/alert/alert.d.ts +3 -1
  16. package/dist/components/ui/alert/alert.d.ts.map +1 -1
  17. package/dist/components/ui/alert/alert.js +18 -8
  18. package/dist/components/ui/alert/alert.js.map +1 -1
  19. package/dist/components/ui/badge/badge.js +4 -4
  20. package/dist/components/ui/badge/badge.js.map +1 -1
  21. package/dist/components/ui/context-menu/context-menu.d.ts.map +1 -1
  22. package/dist/components/ui/context-menu/context-menu.js +2 -2
  23. package/dist/components/ui/context-menu/context-menu.js.map +1 -1
  24. package/dist/components/ui/dialog/dialog.d.ts +17 -1
  25. package/dist/components/ui/dialog/dialog.d.ts.map +1 -1
  26. package/dist/components/ui/dialog/dialog.js +120 -2
  27. package/dist/components/ui/dialog/dialog.js.map +1 -1
  28. package/dist/components/ui/diff-block/diff-block.js +2 -2
  29. package/dist/components/ui/diff-block/diff-block.js.map +1 -1
  30. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts +3 -2
  31. package/dist/components/ui/dropdown-menu/dropdown-menu.d.ts.map +1 -1
  32. package/dist/components/ui/dropdown-menu/dropdown-menu.js +5 -4
  33. package/dist/components/ui/dropdown-menu/dropdown-menu.js.map +1 -1
  34. package/dist/components/ui/entity-icon/entity-icon.d.ts +3 -3
  35. package/dist/components/ui/entity-icon/entity-icon.js +7 -7
  36. package/dist/components/ui/entity-icon/entity-icon.js.map +1 -1
  37. package/dist/components/ui/field/field.js +1 -1
  38. package/dist/components/ui/field/field.js.map +1 -1
  39. package/dist/components/ui/menubar/menubar.d.ts.map +1 -1
  40. package/dist/components/ui/menubar/menubar.js +2 -2
  41. package/dist/components/ui/menubar/menubar.js.map +1 -1
  42. package/dist/components/ui/modal-dialog/modal-dialog.d.ts +12 -2
  43. package/dist/components/ui/modal-dialog/modal-dialog.d.ts.map +1 -1
  44. package/dist/components/ui/modal-dialog/modal-dialog.js +44 -27
  45. package/dist/components/ui/modal-dialog/modal-dialog.js.map +1 -1
  46. package/dist/components/ui/status-chip/status-chip.js +4 -4
  47. package/dist/components/ui/status-chip/status-chip.js.map +1 -1
  48. package/dist/lib/overlay.d.ts +2 -0
  49. package/dist/lib/overlay.d.ts.map +1 -1
  50. package/dist/lib/overlay.js +3 -1
  51. package/dist/lib/overlay.js.map +1 -1
  52. package/dist/lib/themes.d.ts +7 -0
  53. package/dist/lib/themes.d.ts.map +1 -1
  54. package/dist/lib/themes.js +22 -1
  55. package/dist/lib/themes.js.map +1 -1
  56. package/dist/lib/tokens.d.ts.map +1 -1
  57. package/dist/lib/tokens.js +4 -4
  58. package/dist/lib/tokens.js.map +1 -1
  59. package/dist/r/src/components/composites/appearance-editor/appearance-editor.tsx +1 -1
  60. package/dist/r/src/components/composites/stat/stat.tsx +5 -8
  61. package/dist/r/src/components/composites/update-dialog/update-dialog.tsx +98 -26
  62. package/dist/r/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  63. package/dist/r/src/components/conversation/message-composer.tsx +3 -1
  64. package/dist/r/src/components/ui/alert/alert.tsx +20 -7
  65. package/dist/r/src/components/ui/badge/badge.tsx +4 -4
  66. package/dist/r/src/components/ui/context-menu/context-menu.tsx +2 -2
  67. package/dist/r/src/components/ui/dialog/dialog.tsx +204 -2
  68. package/dist/r/src/components/ui/diff-block/diff-block.tsx +4 -4
  69. package/dist/r/src/components/ui/dropdown-menu/dropdown-menu.tsx +5 -4
  70. package/dist/r/src/components/ui/entity-icon/entity-icon.tsx +7 -7
  71. package/dist/r/src/components/ui/field/field.tsx +1 -1
  72. package/dist/r/src/components/ui/menubar/menubar.tsx +2 -2
  73. package/dist/r/src/components/ui/modal-dialog/modal-dialog.tsx +24 -2
  74. package/dist/r/src/components/ui/status-chip/status-chip.tsx +4 -4
  75. package/dist/r/src/lib/overlay.ts +4 -0
  76. package/dist/r/src/lib/themes.ts +29 -0
  77. package/dist/r/src/lib/tokens.ts +19 -4
  78. package/dist/r/src/styles/theme.css +10 -10
  79. package/package.json +1 -1
  80. package/src/components/composites/appearance-editor/appearance-editor.tsx +1 -1
  81. package/src/components/composites/stat/stat.tsx +5 -8
  82. package/src/components/composites/update-dialog/update-dialog.tsx +98 -26
  83. package/src/components/conversation/internal/chat-composer-shell.tsx +1 -1
  84. package/src/components/conversation/message-composer.tsx +3 -1
  85. package/src/components/ui/alert/alert.tsx +20 -7
  86. package/src/components/ui/badge/badge.tsx +4 -4
  87. package/src/components/ui/context-menu/context-menu.tsx +2 -2
  88. package/src/components/ui/dialog/dialog.tsx +204 -2
  89. package/src/components/ui/diff-block/diff-block.tsx +4 -4
  90. package/src/components/ui/dropdown-menu/dropdown-menu.tsx +5 -4
  91. package/src/components/ui/entity-icon/entity-icon.tsx +7 -7
  92. package/src/components/ui/field/field.tsx +1 -1
  93. package/src/components/ui/menubar/menubar.tsx +2 -2
  94. package/src/components/ui/modal-dialog/modal-dialog.tsx +24 -2
  95. package/src/components/ui/status-chip/status-chip.tsx +4 -4
  96. package/src/lib/overlay.ts +4 -0
  97. package/src/lib/themes.ts +29 -0
  98. package/src/lib/tokens.ts +19 -4
  99. package/src/styles/theme.css +10 -10
@@ -4,6 +4,7 @@ import type { ComponentProps } from 'solid-js'
4
4
  import { splitProps } from 'solid-js'
5
5
  import {
6
6
  menuContentPadding,
7
+ destructiveMenuItem,
7
8
  menuItem,
8
9
  menuLabel,
9
10
  menuSeparator,
@@ -98,8 +99,7 @@ export function MenubarItem(
98
99
  class={cn(
99
100
  menuItem,
100
101
  {
101
- 'text-destructive data-[highlighted]:bg-destructive-subtle data-[highlighted]:text-destructive':
102
- local.variant === 'destructive',
102
+ [destructiveMenuItem]: local.variant === 'destructive',
103
103
  },
104
104
  local.class
105
105
  )}
@@ -1,7 +1,8 @@
1
- import type { ComponentProps, JSX } from 'solid-js'
1
+ import type { Accessor, ComponentProps, JSX } from 'solid-js'
2
2
  import { Show, createEffect, createSignal, onCleanup, splitProps } from 'solid-js'
3
3
  import { cn } from '#lib/utils'
4
4
  import {
5
+ createDialogFocusRestoration,
5
6
  Dialog,
6
7
  DialogContent,
7
8
  DialogDescription,
@@ -12,7 +13,7 @@ import {
12
13
  /**
13
14
  * ModalDialog.
14
15
  *
15
- * A dialog that owns three things `Dialog` leaves to its caller, each of which is a
16
+ * A dialog that owns four things `Dialog` leaves to its caller, each of which is a
16
17
  * real defect when it is missed:
17
18
  *
18
19
  * 1. **It unmounts while closed.** An always-mounted dialog that closes as a side
@@ -27,6 +28,11 @@ import {
27
28
  * from `title`, so its name does not depend on the title id registration effect.
28
29
  * Pass `aria-label` to use a different name while keeping the visible title;
29
30
  * pass `aria-labelledby` when another visible label should take precedence.
31
+ * 4. **It returns focus to the opener.** The opener is captured before the dialog
32
+ * autofocuses and restored after the owner closes, unless a close-autofocus
33
+ * handler takes control or focus has moved to another layer. For controlled
34
+ * dialogs without a composed trigger, pass `restoreFocusRef` when the opener
35
+ * cannot be inferred from the focused element.
30
36
  *
31
37
  * Use `Dialog` directly when you need its composition; use this when you want a
32
38
  * dialog that is correct by default.
@@ -50,6 +56,11 @@ export type ModalDialogProps = Omit<
50
56
  'aria-label'?: string
51
57
  /** Names the dialog from a visible element; ARIA gives it precedence over `aria-label`. */
52
58
  'aria-labelledby'?: string
59
+ /**
60
+ * Supplies the external control to focus when this controlled dialog closes.
61
+ * Defaults to the element focused immediately before the dialog opens.
62
+ */
63
+ restoreFocusRef?: Accessor<HTMLElement | undefined>
53
64
  children?: JSX.Element
54
65
  }
55
66
 
@@ -65,9 +76,18 @@ export function ModalDialog(props: ModalDialogProps) {
65
76
  'children',
66
77
  'aria-label',
67
78
  'aria-labelledby',
79
+ 'restoreFocusRef',
80
+ 'onOpenAutoFocus',
81
+ 'onCloseAutoFocus',
68
82
  ])
69
83
 
70
84
  const [content, setContent] = createSignal<HTMLElement>()
85
+ const focusRestoration = createDialogFocusRestoration({
86
+ open: () => local.open,
87
+ restoreFocusRef: local.restoreFocusRef,
88
+ onOpenAutoFocus: local.onOpenAutoFocus,
89
+ onCloseAutoFocus: local.onCloseAutoFocus,
90
+ })
71
91
 
72
92
  createEffect(() => {
73
93
  if (!local.open) return
@@ -100,6 +120,8 @@ export function ModalDialog(props: ModalDialogProps) {
100
120
  local['aria-labelledby'] ?? (local['aria-label'] !== undefined ? '' : undefined)
101
121
  }
102
122
  {...rest}
123
+ onOpenAutoFocus={focusRestoration.onOpenAutoFocus}
124
+ onCloseAutoFocus={focusRestoration.onCloseAutoFocus}
103
125
  >
104
126
  <DialogHeader>
105
127
  <DialogTitle class="flex items-center gap-2">
@@ -47,10 +47,10 @@ export const statusDotVariants = cva('size-2 shrink-0 rounded-full', {
47
47
 
48
48
  const labelTone: Record<StatusTone, string> = {
49
49
  neutral: 'text-foreground',
50
- success: 'text-success',
51
- warning: 'text-warning',
52
- danger: 'text-destructive',
53
- info: 'text-info',
50
+ success: 'text-foreground',
51
+ warning: 'text-foreground',
52
+ danger: 'text-foreground',
53
+ info: 'text-foreground',
54
54
  unknown: 'text-muted-foreground',
55
55
  }
56
56
 
@@ -59,6 +59,10 @@ export const menuItem = [
59
59
  '[&_svg:not([class*=text-])]:text-muted-foreground',
60
60
  ].join(' ')
61
61
 
62
+ /** A destructive action keeps readable text and marks its row with a status edge. */
63
+ export const destructiveMenuItem =
64
+ 'border-s-2 border-destructive ps-1.5 text-foreground data-[highlighted]:bg-destructive-subtle'
65
+
62
66
  /** The label above a group of menu rows. */
63
67
  export const menuLabel =
64
68
  'px-2 py-1.5 text-2xs font-medium tracking-wide text-muted-foreground uppercase'
package/src/lib/themes.ts CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  getAccent,
41
41
  hasTheme,
42
42
  statusForeground,
43
+ tint,
43
44
  primaryHover,
44
45
  primarySubtleCss,
45
46
  syntaxRoles,
@@ -76,9 +77,16 @@ export type ThemeColors = {
76
77
  accentForeground: string
77
78
  destructive: string
78
79
  destructiveForeground: string
80
+ destructiveSubtle: string
79
81
  success: string
82
+ successForeground: string
83
+ successSubtle: string
80
84
  warning: string
85
+ warningForeground: string
86
+ warningSubtle: string
81
87
  info: string
88
+ infoForeground: string
89
+ infoSubtle: string
82
90
  border: string
83
91
  input: string
84
92
  ring: string
@@ -186,9 +194,16 @@ const ROLE_FOR: Readonly<Record<keyof ThemeColors, keyof AdeaThemeRecord['colors
186
194
  destructive: 'error',
187
195
  // Overwritten below from the measured pairing; nominal here so the table is total.
188
196
  destructiveForeground: 'error',
197
+ destructiveSubtle: 'error',
189
198
  success: 'success',
199
+ successForeground: 'success',
200
+ successSubtle: 'success',
190
201
  warning: 'warning',
202
+ warningForeground: 'warning',
203
+ warningSubtle: 'warning',
191
204
  info: 'info',
205
+ infoForeground: 'info',
206
+ infoSubtle: 'info',
192
207
  border: 'border',
193
208
  input: 'border',
194
209
  ring: 'accent',
@@ -208,6 +223,13 @@ function toVariant(theme: AdeaThemeRecord): ThemeVariant {
208
223
  // red it is black and on a deep red it is white, and using the body text would put
209
224
  // white on a mid-tone red at about 3:1.
210
225
  colors.destructiveForeground = statusForeground(theme, 'error')
226
+ colors.destructiveSubtle = tint(theme.colors.error, theme.colors.background)
227
+ colors.successForeground = statusForeground(theme, 'success')
228
+ colors.successSubtle = tint(theme.colors.success, theme.colors.background)
229
+ colors.warningForeground = statusForeground(theme, 'warning')
230
+ colors.warningSubtle = tint(theme.colors.warning, theme.colors.background)
231
+ colors.infoForeground = statusForeground(theme, 'info')
232
+ colors.infoSubtle = tint(theme.colors.info, theme.colors.background)
211
233
 
212
234
  const syntax = syntaxRoles(theme)
213
235
 
@@ -374,9 +396,16 @@ export function themeCssVariables(theme: ThemeVariant): Record<string, string> {
374
396
  '--accent-foreground': c.accentForeground,
375
397
  '--destructive': c.destructive,
376
398
  '--destructive-foreground': c.destructiveForeground,
399
+ '--destructive-subtle': c.destructiveSubtle,
377
400
  '--success': c.success,
401
+ '--success-foreground': c.successForeground,
402
+ '--success-subtle': c.successSubtle,
378
403
  '--warning': c.warning,
404
+ '--warning-foreground': c.warningForeground,
405
+ '--warning-subtle': c.warningSubtle,
379
406
  '--info': c.info,
407
+ '--info-foreground': c.infoForeground,
408
+ '--info-subtle': c.infoSubtle,
380
409
  '--border': c.border,
381
410
  '--input': c.input,
382
411
  '--ring': c.ring,
package/src/lib/tokens.ts CHANGED
@@ -196,11 +196,16 @@ export const colorTokens: TokenDefinition[] = [
196
196
  name: 'destructive-subtle',
197
197
  kind: 'color',
198
198
  themed: true,
199
- description: 'Tinted destructive fill: alert banners, invalid fields.',
199
+ description: 'Opaque destructive tint against the canvas; subtle labels use foreground.',
200
200
  },
201
201
  { name: 'success', kind: 'color', themed: true, description: 'A completed or healthy state.' },
202
202
  { name: 'success-foreground', kind: 'color', themed: true, description: 'Label on `success`.' },
203
- { name: 'success-subtle', kind: 'color', themed: true, description: 'Tinted success fill.' },
203
+ {
204
+ name: 'success-subtle',
205
+ kind: 'color',
206
+ themed: true,
207
+ description: 'Opaque success tint against the canvas; subtle labels use foreground.',
208
+ },
204
209
  {
205
210
  name: 'warning',
206
211
  kind: 'color',
@@ -208,10 +213,20 @@ export const colorTokens: TokenDefinition[] = [
208
213
  description: 'Something needs attention but is not broken.',
209
214
  },
210
215
  { name: 'warning-foreground', kind: 'color', themed: true, description: 'Label on `warning`.' },
211
- { name: 'warning-subtle', kind: 'color', themed: true, description: 'Tinted warning fill.' },
216
+ {
217
+ name: 'warning-subtle',
218
+ kind: 'color',
219
+ themed: true,
220
+ description: 'Opaque warning tint against the canvas; subtle labels use foreground.',
221
+ },
212
222
  { name: 'info', kind: 'color', themed: true, description: 'Neutral information.' },
213
223
  { name: 'info-foreground', kind: 'color', themed: true, description: 'Label on `info`.' },
214
- { name: 'info-subtle', kind: 'color', themed: true, description: 'Tinted info fill.' },
224
+ {
225
+ name: 'info-subtle',
226
+ kind: 'color',
227
+ themed: true,
228
+ description: 'Opaque info tint against the canvas; subtle labels use foreground.',
229
+ },
215
230
 
216
231
  // Lines
217
232
  {
@@ -78,7 +78,7 @@
78
78
  --muted: oklch(0.898 0.0108 261.79);
79
79
  --muted-foreground: oklch(0.474 0.0245 265.01);
80
80
 
81
- /* Status. The fills are catalogue roles; the labels are measured. */
81
+ /* Status fills; solid labels and subtle surfaces come from the catalogue. */
82
82
  --destructive: oklch(0.4705 0.1626 25.78);
83
83
  --destructive-foreground: oklch(0.933 0.016 261.79);
84
84
  --success: oklch(0.4311 0.1809 145.62);
@@ -87,10 +87,10 @@
87
87
  --warning-foreground: oklch(0.933 0.016 261.79);
88
88
  --info: oklch(0.4915 0.1155 202.14);
89
89
  --info-foreground: oklch(0.933 0.016 261.79);
90
- --destructive-subtle: color-mix(in oklch, var(--destructive) 16%, transparent);
91
- --success-subtle: color-mix(in oklch, var(--success) 16%, transparent);
92
- --warning-subtle: color-mix(in oklch, var(--warning) 16%, transparent);
93
- --info-subtle: color-mix(in oklch, var(--info) 16%, transparent);
90
+ --destructive-subtle: oklch(0.8683 0.0365 279.15);
91
+ --success-subtle: oklch(0.8627 0.0391 245.53);
92
+ --warning-subtle: oklch(0.8662 0.0334 286.73);
93
+ --info-subtle: oklch(0.8712 0.0299 253.44);
94
94
 
95
95
  /* Lines */
96
96
  --border: oklch(0.783 0.0144 261.79);
@@ -213,7 +213,7 @@
213
213
  --muted: oklch(0.2268 0.0288 265.37);
214
214
  --muted-foreground: oklch(0.6308 0.0224 262.91);
215
215
 
216
- /* Status. The fills are catalogue roles; the labels are measured. */
216
+ /* Status fills; solid labels and subtle surfaces come from the catalogue. */
217
217
  --destructive: oklch(0.7345 0.1626 25.78);
218
218
  --destructive-foreground: oklch(0.1918 0.0238 265.37);
219
219
  --success: oklch(0.6951 0.1809 145.62);
@@ -222,10 +222,10 @@
222
222
  --warning-foreground: oklch(0.1918 0.0238 265.37);
223
223
  --info: oklch(0.7555 0.1155 202.14);
224
224
  --info-foreground: oklch(0.1918 0.0238 265.37);
225
- --destructive-subtle: color-mix(in oklch, var(--destructive) 16%, transparent);
226
- --success-subtle: color-mix(in oklch, var(--success) 16%, transparent);
227
- --warning-subtle: color-mix(in oklch, var(--warning) 16%, transparent);
228
- --info-subtle: color-mix(in oklch, var(--info) 16%, transparent);
225
+ --destructive-subtle: oklch(0.2678 0.0432 282.23);
226
+ --success-subtle: oklch(0.2623 0.0458 248.61);
227
+ --warning-subtle: oklch(0.2657 0.0401 289.81);
228
+ --info-subtle: oklch(0.2707 0.0366 256.52);
229
229
 
230
230
  /* Lines */
231
231
  --border: oklch(0.3418 0.0214 265.37);