@cognitap/radiant 0.0.76 → 0.0.78

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 (214) hide show
  1. package/CHANGELOG.md +29 -2
  2. package/dist/library/charts/Charts.d.ts.map +1 -1
  3. package/dist/library/charts/Charts.js +5 -1
  4. package/dist/library/charts/Charts.js.map +1 -1
  5. package/dist/library/components/AppShell/AppShell.d.ts.map +1 -1
  6. package/dist/library/components/AppShell/AppShell.js +6 -5
  7. package/dist/library/components/AppShell/AppShell.js.map +1 -1
  8. package/dist/library/components/Breadcrumb/Breadcrumb.d.ts +2 -1
  9. package/dist/library/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  10. package/dist/library/components/Breadcrumb/Breadcrumb.js +4 -9
  11. package/dist/library/components/Breadcrumb/Breadcrumb.js.map +1 -1
  12. package/dist/library/components/Carousel/Carousel.d.ts.map +1 -1
  13. package/dist/library/components/Carousel/Carousel.js +6 -3
  14. package/dist/library/components/Carousel/Carousel.js.map +1 -1
  15. package/dist/library/components/Checkbox/Checkbox.d.ts +3 -1
  16. package/dist/library/components/Checkbox/Checkbox.d.ts.map +1 -1
  17. package/dist/library/components/Checkbox/Checkbox.js +7 -7
  18. package/dist/library/components/Checkbox/Checkbox.js.map +1 -1
  19. package/dist/library/components/CodeBlock/CodeBlock.js +2 -2
  20. package/dist/library/components/CodeBlock/CodeBlock.js.map +1 -1
  21. package/dist/library/components/Collapsible/Collapsible.d.ts.map +1 -1
  22. package/dist/library/components/Collapsible/Collapsible.js +3 -5
  23. package/dist/library/components/Collapsible/Collapsible.js.map +1 -1
  24. package/dist/library/components/Combobox/Combobox.d.ts +9 -1
  25. package/dist/library/components/Combobox/Combobox.d.ts.map +1 -1
  26. package/dist/library/components/Combobox/Combobox.js +15 -13
  27. package/dist/library/components/Combobox/Combobox.js.map +1 -1
  28. package/dist/library/components/Combobox/comboboxStyles.d.ts.map +1 -1
  29. package/dist/library/components/Combobox/comboboxStyles.js +5 -2
  30. package/dist/library/components/Combobox/comboboxStyles.js.map +1 -1
  31. package/dist/library/components/Command/Command.d.ts +1 -4
  32. package/dist/library/components/Command/Command.d.ts.map +1 -1
  33. package/dist/library/components/Command/Command.js +2 -8
  34. package/dist/library/components/Command/Command.js.map +1 -1
  35. package/dist/library/components/ContextMenu/ContextMenu.d.ts.map +1 -1
  36. package/dist/library/components/ContextMenu/ContextMenu.js +2 -1
  37. package/dist/library/components/ContextMenu/ContextMenu.js.map +1 -1
  38. package/dist/library/components/Dialog/Dialog.d.ts +3 -0
  39. package/dist/library/components/Dialog/Dialog.d.ts.map +1 -1
  40. package/dist/library/components/Dialog/Dialog.js +10 -9
  41. package/dist/library/components/Dialog/Dialog.js.map +1 -1
  42. package/dist/library/components/Drawer/Drawer.d.ts.map +1 -1
  43. package/dist/library/components/Drawer/Drawer.js +2 -0
  44. package/dist/library/components/Drawer/Drawer.js.map +1 -1
  45. package/dist/library/components/Fieldset/Fieldset.d.ts +1 -1
  46. package/dist/library/components/Fieldset/Fieldset.d.ts.map +1 -1
  47. package/dist/library/components/Fieldset/Fieldset.js +2 -2
  48. package/dist/library/components/Fieldset/Fieldset.js.map +1 -1
  49. package/dist/library/components/FileInput/FileInput.d.ts +3 -1
  50. package/dist/library/components/FileInput/FileInput.d.ts.map +1 -1
  51. package/dist/library/components/FileInput/FileInput.js +5 -3
  52. package/dist/library/components/FileInput/FileInput.js.map +1 -1
  53. package/dist/library/components/Form/Form.d.ts.map +1 -1
  54. package/dist/library/components/Form/Form.js +12 -7
  55. package/dist/library/components/Form/Form.js.map +1 -1
  56. package/dist/library/components/HoverCard/HoverCard.d.ts +1 -0
  57. package/dist/library/components/HoverCard/HoverCard.d.ts.map +1 -1
  58. package/dist/library/components/HoverCard/HoverCard.js +1 -0
  59. package/dist/library/components/HoverCard/HoverCard.js.map +1 -1
  60. package/dist/library/components/Input/Input.d.ts +3 -1
  61. package/dist/library/components/Input/Input.d.ts.map +1 -1
  62. package/dist/library/components/Input/Input.js +6 -11
  63. package/dist/library/components/Input/Input.js.map +1 -1
  64. package/dist/library/components/InputGroup/InputGroup.d.ts.map +1 -1
  65. package/dist/library/components/InputGroup/InputGroup.js +2 -1
  66. package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
  67. package/dist/library/components/Link/Link.d.ts +4 -2
  68. package/dist/library/components/Link/Link.d.ts.map +1 -1
  69. package/dist/library/components/Link/Link.js +6 -3
  70. package/dist/library/components/Link/Link.js.map +1 -1
  71. package/dist/library/components/Menu/Menu.d.ts +13 -3
  72. package/dist/library/components/Menu/Menu.d.ts.map +1 -1
  73. package/dist/library/components/Menu/Menu.js +23 -8
  74. package/dist/library/components/Menu/Menu.js.map +1 -1
  75. package/dist/library/components/Menubar/Menubar.d.ts.map +1 -1
  76. package/dist/library/components/Menubar/Menubar.js +1 -1
  77. package/dist/library/components/Menubar/Menubar.js.map +1 -1
  78. package/dist/library/components/NativeSelect/NativeSelect.d.ts.map +1 -1
  79. package/dist/library/components/NativeSelect/NativeSelect.js +2 -1
  80. package/dist/library/components/NativeSelect/NativeSelect.js.map +1 -1
  81. package/dist/library/components/NavLink/NavLink.d.ts.map +1 -1
  82. package/dist/library/components/NavLink/NavLink.js +5 -3
  83. package/dist/library/components/NavLink/NavLink.js.map +1 -1
  84. package/dist/library/components/NavigationMenu/NavigationMenu.d.ts +1 -1
  85. package/dist/library/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
  86. package/dist/library/components/NavigationMenu/NavigationMenu.js +11 -3
  87. package/dist/library/components/NavigationMenu/NavigationMenu.js.map +1 -1
  88. package/dist/library/components/NumberField/NumberField.d.ts.map +1 -1
  89. package/dist/library/components/NumberField/NumberField.js +1 -1
  90. package/dist/library/components/NumberField/NumberField.js.map +1 -1
  91. package/dist/library/components/OTPField/OTPField.d.ts.map +1 -1
  92. package/dist/library/components/OTPField/OTPField.js +2 -1
  93. package/dist/library/components/OTPField/OTPField.js.map +1 -1
  94. package/dist/library/components/Pagination/Pagination.d.ts +2 -1
  95. package/dist/library/components/Pagination/Pagination.d.ts.map +1 -1
  96. package/dist/library/components/Pagination/Pagination.js +4 -6
  97. package/dist/library/components/Pagination/Pagination.js.map +1 -1
  98. package/dist/library/components/Popover/Popover.d.ts.map +1 -1
  99. package/dist/library/components/Popover/Popover.js +6 -2
  100. package/dist/library/components/Popover/Popover.js.map +1 -1
  101. package/dist/library/components/RadioGroup/RadioGroup.d.ts +4 -2
  102. package/dist/library/components/RadioGroup/RadioGroup.d.ts.map +1 -1
  103. package/dist/library/components/RadioGroup/RadioGroup.js +9 -10
  104. package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
  105. package/dist/library/components/Resizable/Resizable.d.ts.map +1 -1
  106. package/dist/library/components/Resizable/Resizable.js +2 -1
  107. package/dist/library/components/Resizable/Resizable.js.map +1 -1
  108. package/dist/library/components/ScrollArea/ScrollArea.d.ts.map +1 -1
  109. package/dist/library/components/ScrollArea/ScrollArea.js +2 -1
  110. package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
  111. package/dist/library/components/Select/Select.d.ts +7 -0
  112. package/dist/library/components/Select/Select.d.ts.map +1 -1
  113. package/dist/library/components/Select/Select.js +12 -10
  114. package/dist/library/components/Select/Select.js.map +1 -1
  115. package/dist/library/components/Select/selectStyles.d.ts.map +1 -1
  116. package/dist/library/components/Select/selectStyles.js +3 -1
  117. package/dist/library/components/Select/selectStyles.js.map +1 -1
  118. package/dist/library/components/Slider/Slider.d.ts +3 -1
  119. package/dist/library/components/Slider/Slider.d.ts.map +1 -1
  120. package/dist/library/components/Slider/Slider.js +6 -8
  121. package/dist/library/components/Slider/Slider.js.map +1 -1
  122. package/dist/library/components/Switch/Switch.d.ts +3 -1
  123. package/dist/library/components/Switch/Switch.d.ts.map +1 -1
  124. package/dist/library/components/Switch/Switch.js +6 -7
  125. package/dist/library/components/Switch/Switch.js.map +1 -1
  126. package/dist/library/components/Table/Table.d.ts.map +1 -1
  127. package/dist/library/components/Table/Table.js +3 -1
  128. package/dist/library/components/Table/Table.js.map +1 -1
  129. package/dist/library/components/Tabs/Tabs.d.ts.map +1 -1
  130. package/dist/library/components/Tabs/Tabs.js +10 -7
  131. package/dist/library/components/Tabs/Tabs.js.map +1 -1
  132. package/dist/library/components/TagsInput/TagsInput.d.ts +3 -1
  133. package/dist/library/components/TagsInput/TagsInput.d.ts.map +1 -1
  134. package/dist/library/components/TagsInput/TagsInput.js +8 -5
  135. package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
  136. package/dist/library/components/Textarea/Textarea.d.ts +3 -1
  137. package/dist/library/components/Textarea/Textarea.d.ts.map +1 -1
  138. package/dist/library/components/Textarea/Textarea.js +8 -7
  139. package/dist/library/components/Textarea/Textarea.js.map +1 -1
  140. package/dist/library/components/Toast/Toast.d.ts +2 -1
  141. package/dist/library/components/Toast/Toast.d.ts.map +1 -1
  142. package/dist/library/components/Toast/Toast.js +22 -8
  143. package/dist/library/components/Toast/Toast.js.map +1 -1
  144. package/dist/library/components/Tooltip/Tooltip.d.ts +1 -0
  145. package/dist/library/components/Tooltip/Tooltip.d.ts.map +1 -1
  146. package/dist/library/components/Tooltip/Tooltip.js +3 -2
  147. package/dist/library/components/Tooltip/Tooltip.js.map +1 -1
  148. package/dist/library/components/shared/actionStyles.d.ts.map +1 -1
  149. package/dist/library/components/shared/actionStyles.js +3 -1
  150. package/dist/library/components/shared/actionStyles.js.map +1 -1
  151. package/dist/library/components/shared/focusStyles.d.ts +13 -0
  152. package/dist/library/components/shared/focusStyles.d.ts.map +1 -0
  153. package/dist/library/components/shared/focusStyles.js +17 -0
  154. package/dist/library/components/shared/focusStyles.js.map +1 -0
  155. package/dist/library/index.d.ts +1 -1
  156. package/dist/library/index.d.ts.map +1 -1
  157. package/dist/library/index.js.map +1 -1
  158. package/dist/library/react/useToastTimer.js +1 -1
  159. package/dist/library/react/useToastTimer.js.map +1 -1
  160. package/dist/library/styles.css +1 -1
  161. package/dist/library/themes/components.d.ts +12 -0
  162. package/dist/library/themes/components.d.ts.map +1 -1
  163. package/dist/library/themes/components.js +15 -3
  164. package/dist/library/themes/components.js.map +1 -1
  165. package/docs/architecture.md +87 -73
  166. package/docs/theming.md +9 -0
  167. package/package.json +1 -1
  168. package/src/charts/Charts.tsx +5 -2
  169. package/src/components/AppShell/AppShell.tsx +9 -5
  170. package/src/components/Breadcrumb/Breadcrumb.tsx +5 -9
  171. package/src/components/Carousel/Carousel.tsx +10 -3
  172. package/src/components/Checkbox/Checkbox.tsx +9 -6
  173. package/src/components/CodeBlock/CodeBlock.tsx +2 -2
  174. package/src/components/Collapsible/Collapsible.tsx +3 -5
  175. package/src/components/Combobox/Combobox.tsx +73 -15
  176. package/src/components/Combobox/comboboxStyles.ts +5 -2
  177. package/src/components/Command/Command.tsx +2 -9
  178. package/src/components/ContextMenu/ContextMenu.tsx +2 -4
  179. package/src/components/Dialog/Dialog.tsx +31 -13
  180. package/src/components/Drawer/Drawer.tsx +2 -0
  181. package/src/components/Fieldset/Fieldset.tsx +3 -3
  182. package/src/components/FileInput/FileInput.tsx +8 -2
  183. package/src/components/Form/Form.tsx +10 -6
  184. package/src/components/HoverCard/HoverCard.tsx +5 -1
  185. package/src/components/Input/Input.tsx +13 -12
  186. package/src/components/InputGroup/InputGroup.tsx +4 -2
  187. package/src/components/Link/Link.tsx +9 -3
  188. package/src/components/Menu/Menu.tsx +51 -9
  189. package/src/components/Menubar/Menubar.tsx +1 -0
  190. package/src/components/NativeSelect/NativeSelect.tsx +3 -1
  191. package/src/components/NavLink/NavLink.tsx +8 -5
  192. package/src/components/NavigationMenu/NavigationMenu.tsx +16 -11
  193. package/src/components/NumberField/NumberField.tsx +1 -0
  194. package/src/components/OTPField/OTPField.tsx +4 -1
  195. package/src/components/Pagination/Pagination.tsx +5 -7
  196. package/src/components/Popover/Popover.tsx +6 -1
  197. package/src/components/RadioGroup/RadioGroup.tsx +13 -7
  198. package/src/components/Resizable/Resizable.tsx +4 -2
  199. package/src/components/ScrollArea/ScrollArea.tsx +2 -1
  200. package/src/components/Select/Select.tsx +29 -13
  201. package/src/components/Select/selectStyles.ts +3 -1
  202. package/src/components/Slider/Slider.tsx +8 -7
  203. package/src/components/Switch/Switch.tsx +8 -6
  204. package/src/components/Table/Table.tsx +5 -1
  205. package/src/components/Tabs/Tabs.tsx +10 -8
  206. package/src/components/TagsInput/TagsInput.tsx +10 -3
  207. package/src/components/Textarea/Textarea.tsx +10 -6
  208. package/src/components/Toast/Toast.tsx +28 -11
  209. package/src/components/Tooltip/Tooltip.tsx +4 -1
  210. package/src/components/shared/actionStyles.ts +3 -1
  211. package/src/components/shared/focusStyles.ts +28 -0
  212. package/src/index.ts +1 -0
  213. package/src/react/useToastTimer.ts +1 -1
  214. package/src/themes/components.ts +15 -3
@@ -3,17 +3,21 @@
3
3
  import type { ComponentProps } from 'react'
4
4
  import { cva } from 'class-variance-authority'
5
5
  import { cn } from '../../cn.js'
6
+ import { joinIds } from '../../internal/ids.js'
6
7
  import { controlBorderClass, controlMetrics } from '../shared/controlStyles.js'
7
8
  import { useNativeOwner, type ValueOwner } from '../../react/useNativeOwner.js'
8
9
  import type { ThemeStyle } from '../../themes/defineTheme.js'
9
10
  import type { ControlSize } from '../../presentation.js'
10
11
  import { useFieldControl } from '../Field/Field.js'
12
+ import { scrollbarClass } from '../shared/scrollbarStyles.js'
13
+ import { focusRingClass } from '../shared/focusStyles.js'
11
14
 
12
15
  const textareaVariants = cva([
13
16
  controlBorderClass,
14
17
  'box-border w-full min-w-0',
15
18
  'min-h-[var(--rad-textarea-min-height,var(--_rad-control-height))]',
16
19
  'resize-y overflow-auto',
20
+ scrollbarClass,
17
21
  'py-[var(--rad-textarea-padding-block,calc((var(--_rad-control-height)_-_1lh)/2_-_var(--rad-textarea-border-width,var(--rad-control-border-width,1px))))]',
18
22
  'px-[var(--rad-textarea-padding,var(--_rad-control-padding))]',
19
23
  'font-[family-name:var(--rad-textarea-font-family,var(--rad-typography-roles-ui-body-family,system-ui,sans-serif))] tracking-[var(--rad-typography-roles-ui-body-letter-spacing,-0.011em)]',
@@ -29,11 +33,8 @@ const textareaVariants = cva([
29
33
  '[corner-shape:var(--rad-textarea-corner-shape,var(--rad-control-corner-shape,round))]',
30
34
  '[box-shadow:var(--rad-textarea-shadow,var(--rad-control-field-shadow,none))] [backdrop-filter:var(--rad-control-field-backdrop-filter,none)]',
31
35
  'placeholder:[color:var(--rad-textarea-placeholder,var(--rad-color-placeholder,oklch(0.5_0.01_286)))]',
32
- 'focus-visible:outline-solid',
33
- 'focus-visible:[outline-color:var(--rad-textarea-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))]',
34
- 'focus-visible:[outline-width:var(--rad-textarea-focus-width,var(--rad-focus-width,2px))]',
35
- 'focus-visible:[outline-offset:var(--rad-textarea-focus-offset,var(--rad-focus-offset,2px))]',
36
- 'focus-visible:[outline-style:var(--rad-textarea-focus-style,var(--rad-focus-style,solid))]',
36
+ focusRingClass,
37
+ 'focus-visible:[--_rad-focus-color:var(--rad-textarea-focus-color)] focus-visible:[--_rad-focus-width:var(--rad-textarea-focus-width)] focus-visible:[--_rad-focus-offset:var(--rad-textarea-focus-offset)] focus-visible:[--_rad-focus-style:var(--rad-textarea-focus-style)]',
37
38
  'data-invalid:[border-color:var(--rad-textarea-invalid-border,var(--rad-color-invalid,oklch(0.56_0.19_25)))]',
38
39
  'disabled:cursor-not-allowed',
39
40
  'disabled:[background:var(--rad-textarea-disabled-background,var(--rad-color-disabled-background,oklch(0.96_0.005_286)))]',
@@ -52,6 +53,8 @@ export type TextareaProps = Omit<
52
53
  controlSize?: ControlSize
53
54
  /** Applied to the native textarea, including caller-owned motion styles. */
54
55
  style?: ThemeStyle
56
+ /** Additional composed identities; the textarea token is always retained. */
57
+ 'data-slot'?: string
55
58
  }
56
59
 
57
60
  /** Native editing, selection, events and ref; Field supplies owned form relationships. */
@@ -76,6 +79,7 @@ export function TextareaRoot({
76
79
  'aria-describedby': ariaDescribedBy,
77
80
  'aria-invalid': ariaInvalid,
78
81
  'aria-required': ariaRequired,
82
+ 'data-slot': slot,
79
83
  ...props
80
84
  }: TextareaProps & { family?: 'input-group-textarea' }) {
81
85
  useNativeOwner('Textarea', props.value, props.defaultValue)
@@ -96,7 +100,7 @@ export function TextareaRoot({
96
100
  {...control}
97
101
  className={cn(textareaVariants(), controlMetrics({ controlSize }), className)}
98
102
  data-control-size={controlSize}
99
- data-slot={family ? `textarea ${family}` : 'textarea'}
103
+ data-slot={joinIds('textarea', family, slot)}
100
104
  rows={rows}
101
105
  />
102
106
  )
@@ -23,6 +23,7 @@ import {
23
23
  import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
24
24
  import { cn } from '../../cn.js'
25
25
  import { joinIds } from '../../internal/ids.js'
26
+ import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
26
27
  import type { WithoutToggle } from '../../internal/types.js'
27
28
  import { composeAction } from '../../internal/events.js'
28
29
  import { validateToastDuration } from '../../internal/toast.js'
@@ -32,6 +33,8 @@ import { useComposedRefs } from '../../react/useComposedRefs.js'
32
33
  import { useToastTimer } from '../../react/useToastTimer.js'
33
34
  import { useTransitionHost } from '../../motion/host.js'
34
35
  import type { ThemeStyle } from '../../themes/defineTheme.js'
36
+ import { scrollbarClass } from '../shared/scrollbarStyles.js'
37
+ import { focusRingClass } from '../shared/focusStyles.js'
35
38
 
36
39
  export type ToastProviderProps = { duration?: number; children?: ReactNode }
37
40
  export type ToastAnnouncement = AlertAnnouncement
@@ -62,7 +65,8 @@ export type ToastRenderProps = ButtonRenderProps
62
65
  export type ToastViewportProps = Omit<
63
66
  ComponentProps<'section'>,
64
67
  'style' | 'role' | 'tabIndex' | 'aria-keyshortcuts'
65
- > & { style?: ThemeStyle; 'data-slot'?: string; hotkey?: boolean }
68
+ > &
69
+ AccessibleName & { style?: ThemeStyle; 'data-slot'?: string; hotkey?: boolean }
66
70
  type Queue = {
67
71
  duration: number
68
72
  queue: string[]
@@ -187,15 +191,22 @@ export function Toast({
187
191
  if (!['off', 'polite', 'assertive'].includes(announce))
188
192
  throw new TypeError('Toast announce must be off, polite or assertive.')
189
193
  const nodeRef = useRef<HTMLDivElement>(null)
190
- const [label, setLabel] = useState('Notification')
194
+ const [label, setLabel] = useState('')
191
195
  const focused = useRef(false)
192
196
  const returnTo = useRef<HTMLElement | null>(null)
193
197
  const update = useRef(() => {})
194
- const latest = useRef({ announce, announcement })
198
+ const ariaLabel = props['aria-label'],
199
+ ariaLabelledBy = props['aria-labelledby']
200
+ const named = { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }
201
+ const latest = useRef({ announce, announcement, named })
195
202
  useLayoutEffect(() => {
196
- latest.current = { announce, announcement }
203
+ latest.current = {
204
+ announce,
205
+ announcement,
206
+ named: { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }
207
+ }
197
208
  update.current()
198
- }, [announce, announcement])
209
+ }, [announce, announcement, ariaLabel, ariaLabelledBy])
199
210
  useLayoutEffect(() => (state.value ? register(id) : undefined), [state.value, register, id])
200
211
  useLayoutEffect(() => {
201
212
  const node = nodeRef.current
@@ -210,7 +221,8 @@ export function Toast({
210
221
  )
211
222
  )
212
223
  const title = parts.find(part => part.dataset.slot?.split(' ').includes('toast-title'))
213
- setLabel(title?.innerText || 'Notification')
224
+ const name = title?.innerText.trim() ?? ''
225
+ setLabel(name)
214
226
  const text =
215
227
  latest.current.announcement ??
216
228
  parts
@@ -218,9 +230,11 @@ export function Toast({
218
230
  .filter(Boolean)
219
231
  .join(' ')
220
232
  announceText(id, text, latest.current.announce, win)
233
+ return name
221
234
  }
222
235
  update.current = publish
223
- publish()
236
+ // A toast is named by its ToastTitle unless the consumer names it.
237
+ if (!publish()) requireAccessibleName('Toast without a ToastTitle', latest.current.named)
224
238
  const observer = new win.MutationObserver(publish)
225
239
  observer.observe(node, { childList: true, subtree: true, characterData: true })
226
240
  return () => {
@@ -251,20 +265,23 @@ export function Toast({
251
265
  {...props}
252
266
  ref={transitionRef}
253
267
  announce="off"
254
- aria-label={props['aria-label'] ?? (props['aria-labelledby'] ? undefined : label)}
268
+ aria-label={
269
+ props['aria-label'] ?? (props['aria-labelledby'] ? undefined : label || undefined)
270
+ }
255
271
  hidden={!visible}
256
272
  inert={!visible}
257
273
  aria-hidden={!visible || undefined}
258
274
  tabIndex={-1}
259
275
  data-slot={joinIds('toast', props['data-slot'])}
260
276
  data-state={visible ? 'open' : 'closed'}
261
- data-queued={(state.value && !visible) || undefined}
277
+ data-queued={state.value && !visible ? '' : undefined}
262
278
  data-motion={motion}
263
279
  data-urgency={announce}
264
280
  className={cn(
265
281
  '[&[hidden]]:hidden pointer-events-auto max-h-[calc(100dvh-2rem)] overflow-auto overscroll-contain outline-none p-[var(--rad-toast-padding,var(--rad-surface-padding,1.5rem))] gap-[var(--rad-toast-gap,var(--rad-spacing-header-gap,0.375rem))] rounded-[var(--rad-toast-radius,var(--rad-surface-radius,0.75rem))]',
282
+ scrollbarClass,
266
283
  'bg-[var(--rad-toast-background,var(--_action-soft))] [color:var(--rad-toast-color,var(--_action-ink))] [border-color:var(--rad-toast-border-color,var(--_action-edge))] [border-width:var(--rad-toast-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-toast-border-style,var(--rad-surface-border-style,solid))] [box-shadow:var(--rad-toast-shadow,var(--rad-surface-overlay-shadow,0_24px_64px_-16px_rgb(0_0_0/0.3)))]',
267
- 'focus-visible:outline-solid focus-visible:outline-[var(--rad-color-focus)] focus-visible:outline-[length:var(--rad-focus-width,2px)] focus-visible:outline-offset-[var(--rad-focus-offset,2px)]',
284
+ focusRingClass,
268
285
  'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText] forced-colors:shadow-none',
269
286
  active && !off && 'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100',
270
287
  className
@@ -346,6 +363,7 @@ export function ToastClose({ onClick, ...props }: ToastCloseProps) {
346
363
  )
347
364
  }
348
365
  export function ToastViewport({ hotkey = true, ref, className, ...props }: ToastViewportProps) {
366
+ requireAccessibleName('ToastViewport', props)
349
367
  useQueue()
350
368
  const nativeProps = { ...props, role: undefined }
351
369
  const nodeRef = useRef<HTMLElement>(null)
@@ -379,7 +397,6 @@ export function ToastViewport({ hotkey = true, ref, className, ...props }: Toast
379
397
  <section
380
398
  {...nativeProps}
381
399
  ref={host}
382
- aria-label={props['aria-labelledby'] ? undefined : (props['aria-label'] ?? 'Notifications')}
383
400
  aria-keyshortcuts={hotkey ? 'F8' : undefined}
384
401
  tabIndex={-1}
385
402
  data-slot={joinIds('toast-viewport', props['data-slot'])}
@@ -23,6 +23,7 @@ import { useHoverSurface } from '../../react/useHoverSurface.js'
23
23
  import { usePopoverSurface } from '../../react/usePopoverSurface.js'
24
24
  import { useTransitionHost } from '../../motion/host.js'
25
25
  import type { ThemeStyle } from '../../themes/defineTheme.js'
26
+ import { scrollbarClass } from '../shared/scrollbarStyles.js'
26
27
 
27
28
  export type TooltipProps = StateOwner<'open', boolean> & {
28
29
  onOpenChange?: (open: boolean) => void
@@ -111,6 +112,7 @@ export type TooltipContentProps = Omit<
111
112
  sideOffset?: number
112
113
  collisionPadding?: number
113
114
  motion?: 'inherit' | 'off'
115
+ 'data-slot'?: string
114
116
  }
115
117
  export function TooltipTrigger({
116
118
  ref,
@@ -188,7 +190,7 @@ export function TooltipContent({
188
190
  role="tooltip"
189
191
  popover="manual"
190
192
  tabIndex={undefined}
191
- data-slot="tooltip-content"
193
+ data-slot={joinIds('tooltip-content', props['data-slot'])}
192
194
  data-state={tip.open ? 'open' : 'closed'}
193
195
  data-side={side}
194
196
  data-align={align}
@@ -201,6 +203,7 @@ export function TooltipContent({
201
203
  })}
202
204
  className={cn(
203
205
  'fixed right-auto bottom-auto m-0 box-border block min-w-0 w-max overflow-auto break-words text-start antialiased [&:not(:popover-open)]:hidden!',
206
+ scrollbarClass,
204
207
  'left-[var(--_rad-popover-left,0px)] top-[var(--_rad-popover-top,0px)] max-w-[min(var(--rad-tooltip-max-width,20rem),var(--_rad-popover-max-width,calc(100vw-1rem)))] max-h-[var(--_rad-popover-max-height,calc(100dvh-1rem))]',
205
208
  // Tooltips hold a line or two, so the overlay radius is capped before it turns them into pills.
206
209
  'p-[var(--rad-tooltip-padding,0.625rem)] rounded-[var(--rad-tooltip-radius,min(var(--rad-surface-radius,0.75rem),0.5rem))] [corner-shape:var(--rad-surface-corner-shape,round)]',
@@ -1,4 +1,5 @@
1
1
  import { cva } from 'class-variance-authority'
2
+ import { focusRingClass } from './focusStyles.js'
2
3
 
3
4
  // Palette and readable ink are shared by actions, text links and inline feedback. Ink is
4
5
  // mixed toward the scope foreground so pale warning/accent fills stay readable
@@ -54,7 +55,8 @@ export const actionVariants = cva(
54
55
  'not-disabled:not-aria-busy:motion-safe:active:scale-[var(--rad-button-press-scale,var(--rad-motion-press-scale,0.97))] not-disabled:not-aria-busy:motion-safe:active:translate-y-[var(--rad-button-press-shift,var(--rad-motion-press-shift-y,0px))] not-disabled:not-aria-busy:motion-safe:active:translate-x-[var(--rad-button-press-shift-x,var(--rad-motion-press-shift-x,0px))]',
55
56
  'not-disabled:not-aria-busy:active:rounded-(--_btn-radius-pressed) not-disabled:not-aria-busy:active:[corner-shape:var(--rad-button-corner-shape-pressed,var(--rad-control-action-corner-shape-pressed,var(--_btn-corner)))]',
56
57
  'not-disabled:not-aria-busy:active:[--_btn-highlight:0] not-disabled:not-aria-busy:active:[--_btn-sheen:0] not-disabled:not-aria-busy:active:shadow-[var(--rad-button-shadow-pressed,var(--_btn-shadow-pressed))]',
57
- 'focus-visible:outline-solid focus-visible:[outline-color:var(--rad-button-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] focus-visible:[outline-width:var(--rad-button-focus-width,var(--rad-focus-width,2px))] focus-visible:[outline-offset:var(--rad-button-focus-offset,var(--rad-focus-offset,2px))] focus-visible:[outline-style:var(--rad-button-focus-style,var(--rad-focus-style,solid))]',
58
+ focusRingClass,
59
+ 'focus-visible:[--_rad-focus-color:var(--rad-button-focus-color)] focus-visible:[--_rad-focus-width:var(--rad-button-focus-width)] focus-visible:[--_rad-focus-offset:var(--rad-button-focus-offset)] focus-visible:[--_rad-focus-style:var(--rad-button-focus-style)]',
58
60
  'in-[[data-slot~=field][data-disabled]]:[--_rad-disabled-opacity:1]',
59
61
  'disabled:cursor-not-allowed disabled:opacity-[var(--_rad-disabled-opacity,var(--rad-button-disabled-opacity,var(--rad-state-disabled-opacity,0.5)))]',
60
62
  'aria-busy:cursor-progress',
@@ -0,0 +1,28 @@
1
+ // Every focus ring reads one chain: the family's slot, then the shared focus tokens, then the
2
+ // baseline. A family with its own focus tokens fills the private `--_rad-focus-*` slots under
3
+ // the same state that draws its ring, so the slots never leak into nested hosts.
4
+ // An unset family token leaves its slot empty and the shared token takes over.
5
+
6
+ /** The ring for a host that takes keyboard focus itself. */
7
+ export const focusRingClass =
8
+ 'focus-visible:outline-[color:var(--_rad-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] focus-visible:outline-[length:var(--_rad-focus-width,var(--rad-focus-width,2px))] focus-visible:outline-offset-[var(--_rad-focus-offset,var(--rad-focus-offset,2px))] focus-visible:[outline-style:var(--_rad-focus-style,var(--rad-focus-style,solid))] forced-colors:focus-visible:outline-[Highlight]'
9
+
10
+ /** A scroll box draws its ring inside its edge, where overflow cannot clip it. */
11
+ export const focusRingInsetClass =
12
+ 'focus-visible:[--_rad-focus-offset:calc(0px_-_var(--_rad-focus-width,var(--rad-focus-width,2px)))]'
13
+
14
+ /** The ring for a visible stand-in that follows a focused `peer` input. */
15
+ export const peerFocusRingClass =
16
+ 'peer-focus-visible:outline-[color:var(--_rad-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] peer-focus-visible:outline-[length:var(--_rad-focus-width,var(--rad-focus-width,2px))] peer-focus-visible:outline-offset-[var(--_rad-focus-offset,var(--rad-focus-offset,2px))] peer-focus-visible:[outline-style:var(--_rad-focus-style,var(--rad-focus-style,solid))] forced-colors:peer-focus-visible:outline-[Highlight]'
17
+
18
+ /** The ring for a field shell around a focused child control. */
19
+ export const focusWithinRingClass =
20
+ 'focus-within:outline-[color:var(--_rad-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] focus-within:outline-[length:var(--_rad-focus-width,var(--rad-focus-width,2px))] focus-within:outline-offset-[var(--_rad-focus-offset,var(--rad-focus-offset,2px))] focus-within:[outline-style:var(--_rad-focus-style,var(--rad-focus-style,solid))] forced-colors:focus-within:outline-[Highlight]'
21
+
22
+ /** The ring for a field shell whose direct input child has keyboard focus. */
23
+ export const childFocusRingClass =
24
+ 'has-[>input:focus-visible]:outline-[color:var(--_rad-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] has-[>input:focus-visible]:outline-[length:var(--_rad-focus-width,var(--rad-focus-width,2px))] has-[>input:focus-visible]:outline-offset-[var(--_rad-focus-offset,var(--rad-focus-offset,2px))] has-[>input:focus-visible]:[outline-style:var(--_rad-focus-style,var(--rad-focus-style,solid))] forced-colors:has-[>input:focus-visible]:outline-[Highlight]'
25
+
26
+ /** The ring for a slot that shows where a hidden input's caret is. */
27
+ export const activeRingClass =
28
+ 'data-active:outline-[color:var(--_rad-focus-color,var(--rad-color-focus,oklch(0.55_0.13_255)))] data-active:outline-[length:var(--_rad-focus-width,var(--rad-focus-width,2px))] data-active:outline-offset-[var(--_rad-focus-offset,var(--rad-focus-offset,2px))] data-active:[outline-style:var(--_rad-focus-style,var(--rad-focus-style,solid))] forced-colors:data-active:outline-[Highlight]'
package/src/index.ts CHANGED
@@ -314,6 +314,7 @@ export type {
314
314
  MenuTriggerProps,
315
315
  MenuContentProps,
316
316
  MenuItemProps,
317
+ MenuItemTone,
317
318
  MenuPortalProps,
318
319
  MenuRenderProps
319
320
  } from './components/Menu/Menu.js'
@@ -29,7 +29,7 @@ export function useToastTimer(
29
29
  let hovering = node.matches(':hover')
30
30
  const sync = () => {
31
31
  const paused = hovering || node.contains(doc.activeElement) || doc.hidden
32
- node.dataset.paused = String(paused)
32
+ node.toggleAttribute('data-paused', paused)
33
33
  if (paused) timer.pause()
34
34
  else timer.resume()
35
35
  }
@@ -61,7 +61,8 @@ export const componentRegistry = {
61
61
  indent: 'css',
62
62
  focusColor: 'css',
63
63
  focusWidth: 'css',
64
- focusOffset: 'css'
64
+ focusOffset: 'css',
65
+ focusStyle: 'css'
65
66
  },
66
67
  navigationMenu: {
67
68
  gap: 'css',
@@ -103,7 +104,8 @@ export const componentRegistry = {
103
104
  handleActiveBackground: 'css',
104
105
  focusColor: 'css',
105
106
  focusWidth: 'css',
106
- focusOffset: 'css'
107
+ focusOffset: 'css',
108
+ focusStyle: 'css'
107
109
  },
108
110
  numberField: { gap: 'css' },
109
111
  passwordInput: { gap: 'css' },
@@ -136,6 +138,7 @@ export const componentRegistry = {
136
138
  focusColor: 'css',
137
139
  focusWidth: 'css',
138
140
  focusOffset: 'css',
141
+ focusStyle: 'css',
139
142
  invalidBorder: 'css',
140
143
  disabledBackground: 'css'
141
144
  },
@@ -150,6 +153,7 @@ export const componentRegistry = {
150
153
  focusColor: 'css',
151
154
  focusWidth: 'css',
152
155
  focusOffset: 'css',
156
+ focusStyle: 'css',
153
157
  invalidBorder: 'css'
154
158
  },
155
159
  kbd: {
@@ -373,6 +377,9 @@ export const componentRegistry = {
373
377
  cornerShape: 'css',
374
378
  shadow: 'css',
375
379
  focusColor: 'css',
380
+ focusWidth: 'css',
381
+ focusOffset: 'css',
382
+ focusStyle: 'css',
376
383
  contentPadding: 'css',
377
384
  contentRadius: 'css',
378
385
  contentBackground: 'css',
@@ -397,6 +404,9 @@ export const componentRegistry = {
397
404
  cornerShape: 'css',
398
405
  shadow: 'css',
399
406
  focusColor: 'css',
407
+ focusWidth: 'css',
408
+ focusOffset: 'css',
409
+ focusStyle: 'css',
400
410
  contentPadding: 'css',
401
411
  contentRadius: 'css',
402
412
  contentBackground: 'css',
@@ -587,7 +597,9 @@ export const componentRegistry = {
587
597
  itemPadding: 'css',
588
598
  itemRadius: 'css',
589
599
  itemFocusBackground: 'css',
590
- itemFocusColor: 'css'
600
+ itemFocusColor: 'css',
601
+ itemWarningColor: 'css',
602
+ itemDangerColor: 'css'
591
603
  },
592
604
  alert: {
593
605
  radius: 'css',