@cognitap/radiant 0.0.77 → 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.
- package/CHANGELOG.md +25 -2
- package/dist/library/charts/Charts.d.ts.map +1 -1
- package/dist/library/charts/Charts.js +5 -1
- package/dist/library/charts/Charts.js.map +1 -1
- package/dist/library/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/library/components/AppShell/AppShell.js +6 -5
- package/dist/library/components/AppShell/AppShell.js.map +1 -1
- package/dist/library/components/Breadcrumb/Breadcrumb.d.ts +2 -1
- package/dist/library/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/library/components/Breadcrumb/Breadcrumb.js +4 -9
- package/dist/library/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/library/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/library/components/Carousel/Carousel.js +5 -3
- package/dist/library/components/Carousel/Carousel.js.map +1 -1
- package/dist/library/components/Checkbox/Checkbox.d.ts +3 -1
- package/dist/library/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/library/components/Checkbox/Checkbox.js +7 -7
- package/dist/library/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/library/components/CodeBlock/CodeBlock.js +2 -2
- package/dist/library/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/library/components/Collapsible/Collapsible.d.ts.map +1 -1
- package/dist/library/components/Collapsible/Collapsible.js +3 -5
- package/dist/library/components/Collapsible/Collapsible.js.map +1 -1
- package/dist/library/components/Combobox/Combobox.d.ts +9 -1
- package/dist/library/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/library/components/Combobox/Combobox.js +13 -12
- package/dist/library/components/Combobox/Combobox.js.map +1 -1
- package/dist/library/components/Combobox/comboboxStyles.d.ts.map +1 -1
- package/dist/library/components/Combobox/comboboxStyles.js +5 -2
- package/dist/library/components/Combobox/comboboxStyles.js.map +1 -1
- package/dist/library/components/Command/Command.d.ts +1 -4
- package/dist/library/components/Command/Command.d.ts.map +1 -1
- package/dist/library/components/Command/Command.js +2 -8
- package/dist/library/components/Command/Command.js.map +1 -1
- package/dist/library/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/library/components/ContextMenu/ContextMenu.js +2 -1
- package/dist/library/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/library/components/Dialog/Dialog.d.ts +3 -0
- package/dist/library/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/library/components/Dialog/Dialog.js +8 -9
- package/dist/library/components/Dialog/Dialog.js.map +1 -1
- package/dist/library/components/Fieldset/Fieldset.d.ts +1 -1
- package/dist/library/components/Fieldset/Fieldset.d.ts.map +1 -1
- package/dist/library/components/Fieldset/Fieldset.js +2 -2
- package/dist/library/components/Fieldset/Fieldset.js.map +1 -1
- package/dist/library/components/FileInput/FileInput.d.ts +3 -1
- package/dist/library/components/FileInput/FileInput.d.ts.map +1 -1
- package/dist/library/components/FileInput/FileInput.js +5 -3
- package/dist/library/components/FileInput/FileInput.js.map +1 -1
- package/dist/library/components/Form/Form.d.ts.map +1 -1
- package/dist/library/components/Form/Form.js +12 -7
- package/dist/library/components/Form/Form.js.map +1 -1
- package/dist/library/components/HoverCard/HoverCard.d.ts +1 -0
- package/dist/library/components/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/library/components/HoverCard/HoverCard.js +1 -0
- package/dist/library/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/library/components/Input/Input.d.ts +3 -1
- package/dist/library/components/Input/Input.d.ts.map +1 -1
- package/dist/library/components/Input/Input.js +6 -11
- package/dist/library/components/Input/Input.js.map +1 -1
- package/dist/library/components/InputGroup/InputGroup.d.ts.map +1 -1
- package/dist/library/components/InputGroup/InputGroup.js +2 -1
- package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/library/components/Link/Link.d.ts +4 -2
- package/dist/library/components/Link/Link.d.ts.map +1 -1
- package/dist/library/components/Link/Link.js +6 -3
- package/dist/library/components/Link/Link.js.map +1 -1
- package/dist/library/components/Menu/Menu.d.ts +13 -3
- package/dist/library/components/Menu/Menu.d.ts.map +1 -1
- package/dist/library/components/Menu/Menu.js +23 -8
- package/dist/library/components/Menu/Menu.js.map +1 -1
- package/dist/library/components/Menubar/Menubar.d.ts.map +1 -1
- package/dist/library/components/Menubar/Menubar.js +1 -1
- package/dist/library/components/Menubar/Menubar.js.map +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.js +2 -1
- package/dist/library/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/library/components/NavLink/NavLink.d.ts.map +1 -1
- package/dist/library/components/NavLink/NavLink.js +5 -3
- package/dist/library/components/NavLink/NavLink.js.map +1 -1
- package/dist/library/components/NavigationMenu/NavigationMenu.d.ts +1 -1
- package/dist/library/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
- package/dist/library/components/NavigationMenu/NavigationMenu.js +10 -3
- package/dist/library/components/NavigationMenu/NavigationMenu.js.map +1 -1
- package/dist/library/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/library/components/NumberField/NumberField.js +1 -1
- package/dist/library/components/NumberField/NumberField.js.map +1 -1
- package/dist/library/components/OTPField/OTPField.d.ts.map +1 -1
- package/dist/library/components/OTPField/OTPField.js +2 -1
- package/dist/library/components/OTPField/OTPField.js.map +1 -1
- package/dist/library/components/Pagination/Pagination.d.ts +2 -1
- package/dist/library/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/library/components/Pagination/Pagination.js +4 -6
- package/dist/library/components/Pagination/Pagination.js.map +1 -1
- package/dist/library/components/Popover/Popover.d.ts.map +1 -1
- package/dist/library/components/Popover/Popover.js +4 -2
- package/dist/library/components/Popover/Popover.js.map +1 -1
- package/dist/library/components/RadioGroup/RadioGroup.d.ts +4 -2
- package/dist/library/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/library/components/RadioGroup/RadioGroup.js +9 -10
- package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/library/components/Resizable/Resizable.d.ts.map +1 -1
- package/dist/library/components/Resizable/Resizable.js +2 -1
- package/dist/library/components/Resizable/Resizable.js.map +1 -1
- package/dist/library/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/library/components/ScrollArea/ScrollArea.js +2 -1
- package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/library/components/Select/Select.d.ts +7 -0
- package/dist/library/components/Select/Select.d.ts.map +1 -1
- package/dist/library/components/Select/Select.js +11 -10
- package/dist/library/components/Select/Select.js.map +1 -1
- package/dist/library/components/Select/selectStyles.d.ts.map +1 -1
- package/dist/library/components/Select/selectStyles.js +3 -1
- package/dist/library/components/Select/selectStyles.js.map +1 -1
- package/dist/library/components/Slider/Slider.d.ts +3 -1
- package/dist/library/components/Slider/Slider.d.ts.map +1 -1
- package/dist/library/components/Slider/Slider.js +6 -8
- package/dist/library/components/Slider/Slider.js.map +1 -1
- package/dist/library/components/Switch/Switch.d.ts +3 -1
- package/dist/library/components/Switch/Switch.d.ts.map +1 -1
- package/dist/library/components/Switch/Switch.js +6 -7
- package/dist/library/components/Switch/Switch.js.map +1 -1
- package/dist/library/components/Table/Table.d.ts.map +1 -1
- package/dist/library/components/Table/Table.js +2 -1
- package/dist/library/components/Table/Table.js.map +1 -1
- package/dist/library/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/library/components/Tabs/Tabs.js +8 -6
- package/dist/library/components/Tabs/Tabs.js.map +1 -1
- package/dist/library/components/TagsInput/TagsInput.d.ts +3 -1
- package/dist/library/components/TagsInput/TagsInput.d.ts.map +1 -1
- package/dist/library/components/TagsInput/TagsInput.js +8 -5
- package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
- package/dist/library/components/Textarea/Textarea.d.ts +3 -1
- package/dist/library/components/Textarea/Textarea.d.ts.map +1 -1
- package/dist/library/components/Textarea/Textarea.js +6 -7
- package/dist/library/components/Textarea/Textarea.js.map +1 -1
- package/dist/library/components/Toast/Toast.d.ts +2 -1
- package/dist/library/components/Toast/Toast.d.ts.map +1 -1
- package/dist/library/components/Toast/Toast.js +21 -8
- package/dist/library/components/Toast/Toast.js.map +1 -1
- package/dist/library/components/Tooltip/Tooltip.d.ts +1 -0
- package/dist/library/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/library/components/Tooltip/Tooltip.js +1 -1
- package/dist/library/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/library/components/shared/actionStyles.d.ts.map +1 -1
- package/dist/library/components/shared/actionStyles.js +3 -1
- package/dist/library/components/shared/actionStyles.js.map +1 -1
- package/dist/library/components/shared/focusStyles.d.ts +13 -0
- package/dist/library/components/shared/focusStyles.d.ts.map +1 -0
- package/dist/library/components/shared/focusStyles.js +17 -0
- package/dist/library/components/shared/focusStyles.js.map +1 -0
- package/dist/library/index.d.ts +1 -1
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js.map +1 -1
- package/dist/library/react/useToastTimer.js +1 -1
- package/dist/library/react/useToastTimer.js.map +1 -1
- package/dist/library/styles.css +1 -1
- package/dist/library/themes/components.d.ts +12 -0
- package/dist/library/themes/components.d.ts.map +1 -1
- package/dist/library/themes/components.js +15 -3
- package/dist/library/themes/components.js.map +1 -1
- package/docs/architecture.md +87 -73
- package/docs/theming.md +5 -0
- package/package.json +1 -1
- package/src/charts/Charts.tsx +5 -2
- package/src/components/AppShell/AppShell.tsx +9 -5
- package/src/components/Breadcrumb/Breadcrumb.tsx +5 -9
- package/src/components/Carousel/Carousel.tsx +8 -3
- package/src/components/Checkbox/Checkbox.tsx +9 -6
- package/src/components/CodeBlock/CodeBlock.tsx +2 -2
- package/src/components/Collapsible/Collapsible.tsx +3 -5
- package/src/components/Combobox/Combobox.tsx +71 -15
- package/src/components/Combobox/comboboxStyles.ts +5 -2
- package/src/components/Command/Command.tsx +2 -9
- package/src/components/ContextMenu/ContextMenu.tsx +2 -4
- package/src/components/Dialog/Dialog.tsx +29 -13
- package/src/components/Fieldset/Fieldset.tsx +3 -3
- package/src/components/FileInput/FileInput.tsx +8 -2
- package/src/components/Form/Form.tsx +10 -6
- package/src/components/HoverCard/HoverCard.tsx +5 -1
- package/src/components/Input/Input.tsx +13 -12
- package/src/components/InputGroup/InputGroup.tsx +4 -2
- package/src/components/Link/Link.tsx +9 -3
- package/src/components/Menu/Menu.tsx +51 -9
- package/src/components/Menubar/Menubar.tsx +1 -0
- package/src/components/NativeSelect/NativeSelect.tsx +3 -1
- package/src/components/NavLink/NavLink.tsx +8 -5
- package/src/components/NavigationMenu/NavigationMenu.tsx +14 -11
- package/src/components/NumberField/NumberField.tsx +1 -0
- package/src/components/OTPField/OTPField.tsx +4 -1
- package/src/components/Pagination/Pagination.tsx +5 -7
- package/src/components/Popover/Popover.tsx +4 -1
- package/src/components/RadioGroup/RadioGroup.tsx +13 -7
- package/src/components/Resizable/Resizable.tsx +4 -2
- package/src/components/ScrollArea/ScrollArea.tsx +2 -1
- package/src/components/Select/Select.tsx +27 -13
- package/src/components/Select/selectStyles.ts +3 -1
- package/src/components/Slider/Slider.tsx +8 -7
- package/src/components/Switch/Switch.tsx +8 -6
- package/src/components/Table/Table.tsx +3 -1
- package/src/components/Tabs/Tabs.tsx +8 -7
- package/src/components/TagsInput/TagsInput.tsx +10 -3
- package/src/components/Textarea/Textarea.tsx +8 -6
- package/src/components/Toast/Toast.tsx +26 -11
- package/src/components/Tooltip/Tooltip.tsx +2 -1
- package/src/components/shared/actionStyles.ts +3 -1
- package/src/components/shared/focusStyles.ts +28 -0
- package/src/index.ts +1 -0
- package/src/react/useToastTimer.ts +1 -1
- package/src/themes/components.ts +15 -3
|
@@ -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'
|
|
@@ -33,6 +34,7 @@ import { useToastTimer } from '../../react/useToastTimer.js'
|
|
|
33
34
|
import { useTransitionHost } from '../../motion/host.js'
|
|
34
35
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
35
36
|
import { scrollbarClass } from '../shared/scrollbarStyles.js'
|
|
37
|
+
import { focusRingClass } from '../shared/focusStyles.js'
|
|
36
38
|
|
|
37
39
|
export type ToastProviderProps = { duration?: number; children?: ReactNode }
|
|
38
40
|
export type ToastAnnouncement = AlertAnnouncement
|
|
@@ -63,7 +65,8 @@ export type ToastRenderProps = ButtonRenderProps
|
|
|
63
65
|
export type ToastViewportProps = Omit<
|
|
64
66
|
ComponentProps<'section'>,
|
|
65
67
|
'style' | 'role' | 'tabIndex' | 'aria-keyshortcuts'
|
|
66
|
-
> &
|
|
68
|
+
> &
|
|
69
|
+
AccessibleName & { style?: ThemeStyle; 'data-slot'?: string; hotkey?: boolean }
|
|
67
70
|
type Queue = {
|
|
68
71
|
duration: number
|
|
69
72
|
queue: string[]
|
|
@@ -188,15 +191,22 @@ export function Toast({
|
|
|
188
191
|
if (!['off', 'polite', 'assertive'].includes(announce))
|
|
189
192
|
throw new TypeError('Toast announce must be off, polite or assertive.')
|
|
190
193
|
const nodeRef = useRef<HTMLDivElement>(null)
|
|
191
|
-
const [label, setLabel] = useState('
|
|
194
|
+
const [label, setLabel] = useState('')
|
|
192
195
|
const focused = useRef(false)
|
|
193
196
|
const returnTo = useRef<HTMLElement | null>(null)
|
|
194
197
|
const update = useRef(() => {})
|
|
195
|
-
const
|
|
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 })
|
|
196
202
|
useLayoutEffect(() => {
|
|
197
|
-
latest.current = {
|
|
203
|
+
latest.current = {
|
|
204
|
+
announce,
|
|
205
|
+
announcement,
|
|
206
|
+
named: { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy }
|
|
207
|
+
}
|
|
198
208
|
update.current()
|
|
199
|
-
}, [announce, announcement])
|
|
209
|
+
}, [announce, announcement, ariaLabel, ariaLabelledBy])
|
|
200
210
|
useLayoutEffect(() => (state.value ? register(id) : undefined), [state.value, register, id])
|
|
201
211
|
useLayoutEffect(() => {
|
|
202
212
|
const node = nodeRef.current
|
|
@@ -211,7 +221,8 @@ export function Toast({
|
|
|
211
221
|
)
|
|
212
222
|
)
|
|
213
223
|
const title = parts.find(part => part.dataset.slot?.split(' ').includes('toast-title'))
|
|
214
|
-
|
|
224
|
+
const name = title?.innerText.trim() ?? ''
|
|
225
|
+
setLabel(name)
|
|
215
226
|
const text =
|
|
216
227
|
latest.current.announcement ??
|
|
217
228
|
parts
|
|
@@ -219,9 +230,11 @@ export function Toast({
|
|
|
219
230
|
.filter(Boolean)
|
|
220
231
|
.join(' ')
|
|
221
232
|
announceText(id, text, latest.current.announce, win)
|
|
233
|
+
return name
|
|
222
234
|
}
|
|
223
235
|
update.current = publish
|
|
224
|
-
|
|
236
|
+
// A toast is named by its ToastTitle unless the consumer names it.
|
|
237
|
+
if (!publish()) requireAccessibleName('Toast without a ToastTitle', latest.current.named)
|
|
225
238
|
const observer = new win.MutationObserver(publish)
|
|
226
239
|
observer.observe(node, { childList: true, subtree: true, characterData: true })
|
|
227
240
|
return () => {
|
|
@@ -252,21 +265,23 @@ export function Toast({
|
|
|
252
265
|
{...props}
|
|
253
266
|
ref={transitionRef}
|
|
254
267
|
announce="off"
|
|
255
|
-
aria-label={
|
|
268
|
+
aria-label={
|
|
269
|
+
props['aria-label'] ?? (props['aria-labelledby'] ? undefined : label || undefined)
|
|
270
|
+
}
|
|
256
271
|
hidden={!visible}
|
|
257
272
|
inert={!visible}
|
|
258
273
|
aria-hidden={!visible || undefined}
|
|
259
274
|
tabIndex={-1}
|
|
260
275
|
data-slot={joinIds('toast', props['data-slot'])}
|
|
261
276
|
data-state={visible ? 'open' : 'closed'}
|
|
262
|
-
data-queued={
|
|
277
|
+
data-queued={state.value && !visible ? '' : undefined}
|
|
263
278
|
data-motion={motion}
|
|
264
279
|
data-urgency={announce}
|
|
265
280
|
className={cn(
|
|
266
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))]',
|
|
267
282
|
scrollbarClass,
|
|
268
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)))]',
|
|
269
|
-
|
|
284
|
+
focusRingClass,
|
|
270
285
|
'forced-colors:border-[CanvasText] forced-colors:bg-[Canvas] forced-colors:text-[CanvasText] forced-colors:shadow-none',
|
|
271
286
|
active && !off && 'opacity-[var(--_rad-popup-enter,0)] motion-reduce:opacity-100',
|
|
272
287
|
className
|
|
@@ -348,6 +363,7 @@ export function ToastClose({ onClick, ...props }: ToastCloseProps) {
|
|
|
348
363
|
)
|
|
349
364
|
}
|
|
350
365
|
export function ToastViewport({ hotkey = true, ref, className, ...props }: ToastViewportProps) {
|
|
366
|
+
requireAccessibleName('ToastViewport', props)
|
|
351
367
|
useQueue()
|
|
352
368
|
const nativeProps = { ...props, role: undefined }
|
|
353
369
|
const nodeRef = useRef<HTMLElement>(null)
|
|
@@ -381,7 +397,6 @@ export function ToastViewport({ hotkey = true, ref, className, ...props }: Toast
|
|
|
381
397
|
<section
|
|
382
398
|
{...nativeProps}
|
|
383
399
|
ref={host}
|
|
384
|
-
aria-label={props['aria-labelledby'] ? undefined : (props['aria-label'] ?? 'Notifications')}
|
|
385
400
|
aria-keyshortcuts={hotkey ? 'F8' : undefined}
|
|
386
401
|
tabIndex={-1}
|
|
387
402
|
data-slot={joinIds('toast-viewport', props['data-slot'])}
|
|
@@ -112,6 +112,7 @@ export type TooltipContentProps = Omit<
|
|
|
112
112
|
sideOffset?: number
|
|
113
113
|
collisionPadding?: number
|
|
114
114
|
motion?: 'inherit' | 'off'
|
|
115
|
+
'data-slot'?: string
|
|
115
116
|
}
|
|
116
117
|
export function TooltipTrigger({
|
|
117
118
|
ref,
|
|
@@ -189,7 +190,7 @@ export function TooltipContent({
|
|
|
189
190
|
role="tooltip"
|
|
190
191
|
popover="manual"
|
|
191
192
|
tabIndex={undefined}
|
|
192
|
-
data-slot=
|
|
193
|
+
data-slot={joinIds('tooltip-content', props['data-slot'])}
|
|
193
194
|
data-state={tip.open ? 'open' : 'closed'}
|
|
194
195
|
data-side={side}
|
|
195
196
|
data-align={align}
|
|
@@ -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
|
-
|
|
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
|
@@ -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.
|
|
32
|
+
node.toggleAttribute('data-paused', paused)
|
|
33
33
|
if (paused) timer.pause()
|
|
34
34
|
else timer.resume()
|
|
35
35
|
}
|
package/src/themes/components.ts
CHANGED
|
@@ -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',
|