@cognitap/radiant 0.0.77 → 0.0.79
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 +36 -2
- package/README.md +6 -3
- package/RELEASE_POLICY.md +8 -19
- package/dist/library/charts/Charts.d.ts.map +1 -1
- package/dist/library/charts/Charts.js +6 -2
- package/dist/library/charts/Charts.js.map +1 -1
- package/dist/library/components/Accordion/Accordion.js +1 -1
- package/dist/library/components/Accordion/Accordion.js.map +1 -1
- package/dist/library/components/Alert/Alert.js +1 -1
- package/dist/library/components/Alert/Alert.js.map +1 -1
- package/dist/library/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/library/components/AppShell/AppShell.js +7 -6
- package/dist/library/components/AppShell/AppShell.js.map +1 -1
- package/dist/library/components/AspectRatio/AspectRatio.js +1 -1
- package/dist/library/components/AspectRatio/AspectRatio.js.map +1 -1
- package/dist/library/components/Avatar/Avatar.js +1 -1
- package/dist/library/components/Avatar/Avatar.js.map +1 -1
- package/dist/library/components/Badge/Badge.js +1 -1
- package/dist/library/components/Badge/Badge.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 +5 -10
- package/dist/library/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/library/components/Button/Button.js +1 -1
- package/dist/library/components/Button/Button.js.map +1 -1
- package/dist/library/components/ButtonGroup/ButtonGroup.js +1 -1
- package/dist/library/components/ButtonGroup/ButtonGroup.js.map +1 -1
- package/dist/library/components/Card/Card.js +1 -1
- package/dist/library/components/Card/Card.js.map +1 -1
- package/dist/library/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/library/components/Carousel/Carousel.js +11 -9
- 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 +8 -8
- package/dist/library/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/library/components/CheckboxGroup/CheckboxGroup.js +1 -1
- package/dist/library/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/library/components/CodeBlock/CodeBlock.js +3 -3
- 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 +4 -6
- 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 +14 -13
- 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 +3 -9
- 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 +3 -2
- 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 +9 -10
- package/dist/library/components/Dialog/Dialog.js.map +1 -1
- package/dist/library/components/Drawer/Drawer.js +1 -1
- package/dist/library/components/Drawer/Drawer.js.map +1 -1
- package/dist/library/components/EmptyState/EmptyState.js +1 -1
- package/dist/library/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/library/components/Field/Field.js +1 -1
- package/dist/library/components/Field/Field.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 +3 -3
- 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 +6 -4
- 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 +16 -11
- 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 +2 -1
- package/dist/library/components/HoverCard/HoverCard.js.map +1 -1
- package/dist/library/components/InlineCode/InlineCode.js +1 -1
- package/dist/library/components/InlineCode/InlineCode.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 +7 -12
- 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 +3 -2
- package/dist/library/components/InputGroup/InputGroup.js.map +1 -1
- package/dist/library/components/Kbd/Kbd.js +1 -1
- package/dist/library/components/Kbd/Kbd.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 +7 -4
- 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 +24 -9
- 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 +2 -2
- package/dist/library/components/Menubar/Menubar.js.map +1 -1
- package/dist/library/components/Meter/Meter.js +1 -1
- package/dist/library/components/Meter/Meter.js.map +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.d.ts.map +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.js +3 -2
- 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 +6 -4
- 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 +11 -4
- 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 +2 -2
- 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 +3 -2
- 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 +5 -7
- package/dist/library/components/Pagination/Pagination.js.map +1 -1
- package/dist/library/components/PasswordInput/PasswordInput.js +1 -1
- package/dist/library/components/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/library/components/Popover/Popover.d.ts.map +1 -1
- package/dist/library/components/Popover/Popover.js +5 -3
- package/dist/library/components/Popover/Popover.js.map +1 -1
- package/dist/library/components/Progress/Progress.js +1 -1
- package/dist/library/components/Progress/Progress.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 +10 -11
- 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 +3 -2
- 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 +3 -2
- 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 +12 -11
- 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/Separator/Separator.js +1 -1
- package/dist/library/components/Separator/Separator.js.map +1 -1
- package/dist/library/components/Skeleton/Skeleton.js +1 -1
- package/dist/library/components/Skeleton/Skeleton.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 +7 -9
- package/dist/library/components/Slider/Slider.js.map +1 -1
- package/dist/library/components/Spinner/Spinner.js +1 -1
- package/dist/library/components/Spinner/Spinner.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 +7 -8
- 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 +3 -2
- 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 +9 -7
- package/dist/library/components/Tabs/Tabs.js.map +1 -1
- package/dist/library/components/Tag/Tag.js +1 -1
- package/dist/library/components/Tag/Tag.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 +9 -6
- 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 +7 -8
- package/dist/library/components/Textarea/Textarea.js.map +1 -1
- package/dist/library/components/ThemeScope/ThemeScope.js +1 -1
- package/dist/library/components/ThemeScope/ThemeScope.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 +22 -9
- package/dist/library/components/Toast/Toast.js.map +1 -1
- package/dist/library/components/ToggleGroup/ToggleGroup.js +3 -1
- package/dist/library/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/library/components/Toolbar/Toolbar.js +1 -1
- package/dist/library/components/Toolbar/Toolbar.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 +2 -2
- 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/motion/MotionLink.js +1 -1
- package/dist/library/motion/MotionLink.js.map +1 -1
- package/dist/library/react/useComboboxPopup.d.ts.map +1 -1
- package/dist/library/react/useComboboxPopup.js +45 -6
- package/dist/library/react/useComboboxPopup.js.map +1 -1
- package/dist/library/react/useRovingFocus.d.ts.map +1 -1
- package/dist/library/react/useRovingFocus.js +76 -11
- package/dist/library/react/useRovingFocus.js.map +1 -1
- package/dist/library/react/useToastTimer.d.ts.map +1 -1
- package/dist/library/react/useToastTimer.js +29 -10
- 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/accessibility.md +23 -111
- package/docs/architecture.md +48 -228
- package/docs/motion.md +65 -130
- package/docs/theming.md +51 -422
- package/package.json +21 -13
- package/src/charts/Charts.tsx +6 -3
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/AppShell/AppShell.tsx +10 -6
- package/src/components/AspectRatio/AspectRatio.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Badge/Badge.tsx +1 -1
- package/src/components/Breadcrumb/Breadcrumb.tsx +6 -10
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/ButtonGroup/ButtonGroup.tsx +1 -1
- package/src/components/Card/Card.tsx +1 -1
- package/src/components/Carousel/Carousel.tsx +14 -9
- package/src/components/Checkbox/Checkbox.tsx +10 -7
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +3 -3
- package/src/components/Collapsible/Collapsible.tsx +4 -6
- package/src/components/Combobox/Combobox.tsx +72 -16
- package/src/components/Combobox/comboboxStyles.ts +5 -2
- package/src/components/Command/Command.tsx +3 -10
- package/src/components/ContextMenu/ContextMenu.tsx +3 -5
- package/src/components/Dialog/Dialog.tsx +30 -14
- package/src/components/Drawer/Drawer.tsx +1 -1
- package/src/components/EmptyState/EmptyState.tsx +1 -1
- package/src/components/Field/Field.tsx +1 -1
- package/src/components/Fieldset/Fieldset.tsx +4 -4
- package/src/components/FileInput/FileInput.tsx +9 -3
- package/src/components/Form/Form.tsx +14 -10
- package/src/components/HoverCard/HoverCard.tsx +6 -2
- package/src/components/InlineCode/InlineCode.tsx +1 -1
- package/src/components/Input/Input.tsx +14 -13
- package/src/components/InputGroup/InputGroup.tsx +5 -3
- package/src/components/Kbd/Kbd.tsx +1 -1
- package/src/components/Link/Link.tsx +10 -4
- package/src/components/Menu/Menu.tsx +52 -10
- package/src/components/Menubar/Menubar.tsx +2 -1
- package/src/components/Meter/Meter.tsx +1 -1
- package/src/components/NativeSelect/NativeSelect.tsx +4 -2
- package/src/components/NavLink/NavLink.tsx +9 -6
- package/src/components/NavigationMenu/NavigationMenu.tsx +15 -12
- package/src/components/NumberField/NumberField.tsx +2 -1
- package/src/components/OTPField/OTPField.tsx +5 -2
- package/src/components/Pagination/Pagination.tsx +6 -8
- package/src/components/PasswordInput/PasswordInput.tsx +1 -1
- package/src/components/Popover/Popover.tsx +5 -2
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +14 -8
- package/src/components/Resizable/Resizable.tsx +5 -3
- package/src/components/ScrollArea/ScrollArea.tsx +3 -2
- package/src/components/Select/Select.tsx +28 -14
- package/src/components/Select/selectStyles.ts +3 -1
- package/src/components/Separator/Separator.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Slider/Slider.tsx +9 -8
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +9 -7
- package/src/components/Table/Table.tsx +4 -2
- package/src/components/Tabs/Tabs.tsx +9 -8
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/TagsInput/TagsInput.tsx +11 -4
- package/src/components/Textarea/Textarea.tsx +9 -7
- package/src/components/ThemeScope/ThemeScope.tsx +1 -1
- package/src/components/Toast/Toast.tsx +27 -12
- package/src/components/ToggleGroup/ToggleGroup.tsx +3 -1
- package/src/components/Toolbar/Toolbar.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +3 -2
- package/src/components/shared/actionStyles.ts +3 -1
- package/src/components/shared/focusStyles.ts +28 -0
- package/src/css.d.ts +2 -0
- package/src/index.ts +1 -0
- package/src/motion/MotionLink.tsx +1 -1
- package/src/react/useComboboxPopup.ts +38 -6
- package/src/react/useRovingFocus.ts +73 -8
- package/src/react/useToastTimer.ts +25 -10
- package/src/styles.d.ts +1 -0
- package/src/themes/baseline.css +1 -1
- package/src/themes/components.ts +15 -3
- package/src/typography.css +17 -12
- package/dist/library/cn.d.ts +0 -3
- package/dist/library/cn.d.ts.map +0 -1
- package/dist/library/cn.js +0 -370
- package/dist/library/cn.js.map +0 -1
- package/src/cn.ts +0 -372
package/src/charts/Charts.tsx
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
type ComponentProps,
|
|
8
8
|
type ReactNode
|
|
9
9
|
} from 'react'
|
|
10
|
-
import { cn } from '
|
|
10
|
+
import { cn } from 'cn'
|
|
11
11
|
import { joinIds } from '../internal/ids.js'
|
|
12
12
|
import {
|
|
13
13
|
chartGeometry,
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
import type { PartStyle } from '../presentation.js'
|
|
32
32
|
import type { ThemeStyle } from '../themes/defineTheme.js'
|
|
33
33
|
export type { ChartDatum, ChartSeries } from '../internal/charts.js'
|
|
34
|
+
import { focusRingClass } from '../components/shared/focusStyles.js'
|
|
34
35
|
export type ChartProps = Omit<
|
|
35
36
|
ComponentProps<'figure'>,
|
|
36
37
|
'children' | 'style' | 'aria-labelledby' | 'aria-label' | 'role'
|
|
@@ -72,8 +73,10 @@ const colors = [
|
|
|
72
73
|
const color = (index: number) => colors[index % colors.length]!
|
|
73
74
|
const dashes = ['', '8 4', '2 4', '10 3 2 3', '4 3', '12 6']
|
|
74
75
|
const format = (value: number) => String(value)
|
|
75
|
-
const pointClass =
|
|
76
|
-
'box-border inline-flex size-6 cursor-pointer select-none items-center justify-center rounded-full border-0 bg-transparent p-0 [color:inherit] hover:bg-[color-mix(in_oklch,currentColor_8%,transparent)]
|
|
76
|
+
const pointClass = [
|
|
77
|
+
'box-border inline-flex size-6 cursor-pointer select-none items-center justify-center rounded-full border-0 bg-transparent p-0 [color:inherit] hover:bg-[color-mix(in_oklch,currentColor_8%,transparent)] forced-colors:text-[CanvasText]',
|
|
78
|
+
focusRingClass
|
|
79
|
+
].join(' ')
|
|
77
80
|
export type ChartDataTableProps = Omit<TableProps, 'children'> &
|
|
78
81
|
Pick<ChartProps, 'data' | 'series' | 'formatValue' | 'categoryLabel'> & { label: string }
|
|
79
82
|
export function ChartDataTable({
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ComponentProps, ReactNode } from 'react'
|
|
4
4
|
import { createContext, useContext, useState } from 'react'
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from 'cn'
|
|
6
6
|
import { joinIds } from '../../internal/ids.js'
|
|
7
7
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
8
8
|
import { composeAction } from '../../internal/events.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { headings, type HeadingLevel } from '../../internal/headings.js'
|
|
2
2
|
import type { ComponentProps } from 'react'
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from 'cn'
|
|
4
4
|
import { actionTone } from '../shared/actionStyles.js'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import type { Tone } from '../../presentation.js'
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from '../shared/composedLink.js'
|
|
22
22
|
import { scrollbarClass } from '../shared/scrollbarStyles.js'
|
|
23
23
|
import { Drawer, DrawerContent, DrawerTitle, DrawerClose, useDrawer } from '../Drawer/Drawer.js'
|
|
24
|
-
import { cn } from '
|
|
24
|
+
import { cn } from 'cn'
|
|
25
25
|
import { joinIds } from '../../internal/ids.js'
|
|
26
26
|
import { composeAction } from '../../internal/events.js'
|
|
27
27
|
import type { WithoutToggle, DistributiveOmit } from '../../internal/types.js'
|
|
@@ -31,6 +31,7 @@ import type { StateOwner } from '../../react/useNativeOwner.js'
|
|
|
31
31
|
import { useTransitionHost } from '../../motion/host.js'
|
|
32
32
|
import type { PartStyle } from '../../presentation.js'
|
|
33
33
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
34
|
+
import { focusRingClass, focusRingInsetClass } from '../shared/focusStyles.js'
|
|
34
35
|
|
|
35
36
|
export type AppShellProps = Omit<ComponentProps<'div'>, 'style'> &
|
|
36
37
|
StateOwner<'collapsed', boolean> &
|
|
@@ -200,8 +201,8 @@ export function AppShell({
|
|
|
200
201
|
{...props}
|
|
201
202
|
ref={layoutRef}
|
|
202
203
|
data-slot={joinIds('app-shell', props['data-slot'])}
|
|
203
|
-
data-collapsed={collapse.value
|
|
204
|
-
data-mobile={mobile
|
|
204
|
+
data-collapsed={collapse.value ? '' : undefined}
|
|
205
|
+
data-mobile={mobile ? '' : undefined}
|
|
205
206
|
data-state={
|
|
206
207
|
mobile ? (drawer.value ? 'open' : 'closed') : collapse.value ? 'closed' : 'open'
|
|
207
208
|
}
|
|
@@ -271,7 +272,9 @@ export function AppShellMain({ className, ...props }: AppShellMainProps) {
|
|
|
271
272
|
tabIndex={-1}
|
|
272
273
|
data-slot={joinIds('app-shell-main', props['data-slot'])}
|
|
273
274
|
className={cn(
|
|
274
|
-
'relative box-border size-full min-h-0 min-w-0 overflow-auto p-[var(--rad-app-shell-main-padding,var(--rad-surface-padding,1.5rem))]
|
|
275
|
+
'relative box-border size-full min-h-0 min-w-0 overflow-auto p-[var(--rad-app-shell-main-padding,var(--rad-surface-padding,1.5rem))]',
|
|
276
|
+
focusRingClass,
|
|
277
|
+
focusRingInsetClass,
|
|
275
278
|
scrollbarClass,
|
|
276
279
|
className
|
|
277
280
|
)}
|
|
@@ -373,7 +376,7 @@ export function Sidebar({
|
|
|
373
376
|
aria-labelledby={shell.labelId}
|
|
374
377
|
tabIndex={0}
|
|
375
378
|
data-slot={joinIds('sidebar', props['data-slot'])}
|
|
376
|
-
data-collapsed={collapsed
|
|
379
|
+
data-collapsed={collapsed ? '' : undefined}
|
|
377
380
|
data-state={shell.mobile ? (shell.open ? 'open' : 'closed') : collapsed ? 'closed' : 'open'}
|
|
378
381
|
className={cn(
|
|
379
382
|
'relative box-border flex size-full min-h-0 min-w-0 flex-col overflow-auto gap-[var(--rad-sidebar-gap,1rem)] p-[var(--rad-sidebar-padding,0.5rem)] border-0 border-e-[length:var(--rad-sidebar-border-width,var(--rad-surface-border-width,1px))] [border-style:var(--rad-surface-border-style,solid)] border-[var(--rad-sidebar-border-color,var(--rad-color-border))] bg-[var(--rad-sidebar-background,var(--rad-color-surface))] text-[var(--rad-sidebar-color,var(--rad-color-foreground))]',
|
|
@@ -478,6 +481,7 @@ export function SidebarTrigger({
|
|
|
478
481
|
aria-expanded={shell.mobile ? shell.open : !shell.collapsed}
|
|
479
482
|
aria-controls={shell.mobile ? shell.drawerId : shell.sidebarId}
|
|
480
483
|
aria-haspopup={shell.mobile ? 'dialog' : undefined}
|
|
484
|
+
data-state={(shell.mobile ? shell.open : !shell.collapsed) ? 'open' : 'closed'}
|
|
481
485
|
data-slot={joinIds('sidebar-trigger', props['data-slot'])}
|
|
482
486
|
onClick={composeAction(onClick, () =>
|
|
483
487
|
shell.mobile ? shell.setOpen(!shell.open) : shell.setCollapsed(!shell.collapsed)
|
|
@@ -513,7 +517,7 @@ export function SidebarContent({ expandedOnly = false, className, ...props }: Si
|
|
|
513
517
|
hidden={hidden}
|
|
514
518
|
inert={hidden}
|
|
515
519
|
data-slot={joinIds('sidebar-content', props['data-slot'])}
|
|
516
|
-
data-expanded-only={expandedOnly
|
|
520
|
+
data-expanded-only={expandedOnly ? '' : undefined}
|
|
517
521
|
className={cn('min-w-0 [hidden]:hidden', className)}
|
|
518
522
|
/>
|
|
519
523
|
)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useEffect, useRef, useState, type ComponentProps } from 'react'
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from 'cn'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import type { ControlSize, PartStyle } from '../../presentation.js'
|
|
7
7
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -4,15 +4,15 @@ import {
|
|
|
4
4
|
type ComposedLinkProps,
|
|
5
5
|
type ComposedLinkRenderProps
|
|
6
6
|
} from '../shared/composedLink.js'
|
|
7
|
-
import { cn } from '
|
|
8
|
-
import { requireAccessibleName } from '../../internal/accessibleName.js'
|
|
7
|
+
import { cn } from 'cn'
|
|
8
|
+
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
9
9
|
import { joinIds } from '../../internal/ids.js'
|
|
10
10
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
11
11
|
type Part<Host extends 'nav' | 'ol' | 'li' | 'span'> = Omit<
|
|
12
12
|
ComponentProps<Host>,
|
|
13
13
|
'style' | 'role'
|
|
14
14
|
> & { style?: ThemeStyle; 'data-slot'?: string }
|
|
15
|
-
export type BreadcrumbProps = Part<'nav'>
|
|
15
|
+
export type BreadcrumbProps = Part<'nav'> & AccessibleName
|
|
16
16
|
export type BreadcrumbListProps = Part<'ol'>
|
|
17
17
|
export type BreadcrumbItemProps = Part<'li'>
|
|
18
18
|
export type BreadcrumbPageProps = Omit<Part<'span'>, 'aria-current'>
|
|
@@ -20,17 +20,11 @@ export type BreadcrumbSeparatorProps = Omit<Part<'span'>, 'aria-hidden' | 'tabIn
|
|
|
20
20
|
export type BreadcrumbLinkRenderProps = ComposedLinkRenderProps
|
|
21
21
|
export type BreadcrumbLinkProps = Omit<ComposedLinkProps, 'aria-current'> & { current?: boolean }
|
|
22
22
|
export function Breadcrumb({ className, ...props }: BreadcrumbProps) {
|
|
23
|
-
|
|
24
|
-
const name = {
|
|
25
|
-
'aria-label': props['aria-label'] ?? (labelledBy ? undefined : 'Breadcrumb'),
|
|
26
|
-
'aria-labelledby': labelledBy
|
|
27
|
-
}
|
|
28
|
-
requireAccessibleName('Breadcrumb', name)
|
|
23
|
+
requireAccessibleName('Breadcrumb', props)
|
|
29
24
|
const nativeProps = { ...props, role: undefined }
|
|
30
25
|
return (
|
|
31
26
|
<nav
|
|
32
27
|
{...nativeProps}
|
|
33
|
-
{...name}
|
|
34
28
|
data-slot={joinIds('breadcrumb', props['data-slot'])}
|
|
35
29
|
className={cn(
|
|
36
30
|
'min-w-0 max-w-full text-start [color:var(--rad-breadcrumb-color,var(--rad-color-muted-foreground))] font-[family-name:var(--rad-typography-roles-ui-body-family,system-ui,sans-serif)] text-[length:var(--rad-breadcrumb-font-size,var(--rad-typography-roles-ui-body-size,0.875rem))] leading-[var(--rad-typography-roles-ui-body-line-height,1.5)]',
|
|
@@ -83,6 +77,7 @@ export function BreadcrumbLink({
|
|
|
83
77
|
variant={variant}
|
|
84
78
|
tone={tone}
|
|
85
79
|
aria-current={current ? 'page' : undefined}
|
|
80
|
+
data-selected={current ? '' : undefined}
|
|
86
81
|
className={cn(
|
|
87
82
|
'min-w-0 [overflow-wrap:anywhere] [color:var(--rad-breadcrumb-link-color,var(--rad-color-muted-foreground))] hover:[color:var(--rad-breadcrumb-link-hover-color,var(--rad-color-foreground))]',
|
|
88
83
|
className
|
|
@@ -98,6 +93,7 @@ export function BreadcrumbPage({ className, ...props }: BreadcrumbPageProps) {
|
|
|
98
93
|
<span
|
|
99
94
|
{...nativeProps}
|
|
100
95
|
aria-current="page"
|
|
96
|
+
data-selected=""
|
|
101
97
|
data-slot={joinIds('breadcrumb-page', props['data-slot'])}
|
|
102
98
|
className={cn(
|
|
103
99
|
'min-w-0 [overflow-wrap:anywhere] [color:var(--rad-breadcrumb-current-color,var(--rad-color-foreground))] font-[family-name:var(--rad-typography-roles-ui-label-family,system-ui,sans-serif)] font-[number:var(--rad-typography-roles-ui-label-weight,600)] tracking-[var(--rad-typography-roles-ui-label-letter-spacing,-0.011em)]',
|
|
@@ -7,7 +7,7 @@ import { usePressHost } from '../../motion/host.js'
|
|
|
7
7
|
import { actionVariants } from '../shared/actionStyles.js'
|
|
8
8
|
import type { ButtonVariant, ControlSize, Tone } from '../../presentation.js'
|
|
9
9
|
import { Spinner } from '../Spinner/Spinner.js'
|
|
10
|
-
import { cn } from '
|
|
10
|
+
import { cn } from 'cn'
|
|
11
11
|
import { joinIds } from '../../internal/ids.js'
|
|
12
12
|
import { composeAction } from '../../internal/events.js'
|
|
13
13
|
import { useControllableState } from '../../react/useControllableState.js'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* oxlint-disable jsx-a11y/prefer-tag-over-role -- A passive action group uses a div; fieldset would introduce form grouping. */
|
|
2
2
|
import type { ComponentProps } from 'react'
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from 'cn'
|
|
4
4
|
import { joinIds } from '../../internal/ids.js'
|
|
5
5
|
import type { Orientation } from '../../presentation.js'
|
|
6
6
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { headings as headingTag, type HeadingLevel } from '../../internal/headings.js'
|
|
2
2
|
import type { ComponentProps } from 'react'
|
|
3
3
|
import { cva } from 'class-variance-authority'
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from 'cn'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
7
7
|
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type ReactNode
|
|
14
14
|
} from 'react'
|
|
15
15
|
import { Button, type ButtonProps } from '../Button/Button.js'
|
|
16
|
-
import { cn } from '
|
|
16
|
+
import { cn } from 'cn'
|
|
17
17
|
import { joinIds } from '../../internal/ids.js'
|
|
18
18
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
19
19
|
import type { WithoutToggle } from '../../internal/types.js'
|
|
@@ -22,6 +22,7 @@ import type { ValueOwner } from '../../react/useNativeOwner.js'
|
|
|
22
22
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
23
23
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
24
24
|
import { scrollbarClass } from '../shared/scrollbarStyles.js'
|
|
25
|
+
import { focusRingClass } from '../shared/focusStyles.js'
|
|
25
26
|
|
|
26
27
|
export type CarouselItem = { value: string; label?: string; children: ReactNode }
|
|
27
28
|
export type CarouselProps = Omit<ComponentProps<'section'>, 'style' | 'role'> &
|
|
@@ -48,12 +49,13 @@ type Binding = CarouselState & {
|
|
|
48
49
|
viewportId: string
|
|
49
50
|
setViewport: (node: HTMLDivElement | null) => void
|
|
50
51
|
slideLabel: (index: number, count: number) => string
|
|
52
|
+
name: { 'aria-label'?: string; 'aria-labelledby'?: string }
|
|
51
53
|
}
|
|
52
54
|
const Context = createContext<Binding | null>(null)
|
|
53
55
|
export function useCarousel(): CarouselState | null {
|
|
54
56
|
return useContext(Context)
|
|
55
57
|
}
|
|
56
|
-
function
|
|
58
|
+
function useBinding() {
|
|
57
59
|
const value = useContext(Context)
|
|
58
60
|
if (!value) throw new Error('Carousel parts must be inside Carousel.')
|
|
59
61
|
return value
|
|
@@ -247,7 +249,8 @@ export function Carousel({
|
|
|
247
249
|
items,
|
|
248
250
|
viewportId,
|
|
249
251
|
setViewport,
|
|
250
|
-
slideLabel
|
|
252
|
+
slideLabel,
|
|
253
|
+
name: { 'aria-label': props['aria-label'], 'aria-labelledby': props['aria-labelledby'] }
|
|
251
254
|
}}
|
|
252
255
|
>
|
|
253
256
|
<section
|
|
@@ -306,7 +309,7 @@ export function CarouselViewport({
|
|
|
306
309
|
onClickCapture,
|
|
307
310
|
...props
|
|
308
311
|
}: CarouselViewportProps) {
|
|
309
|
-
const state =
|
|
312
|
+
const state = useBinding(),
|
|
310
313
|
host = useRef<HTMLDivElement>(null),
|
|
311
314
|
owned = useComposedRefs(host, state.setViewport),
|
|
312
315
|
composed = useComposedRefs(owned, ref),
|
|
@@ -340,11 +343,12 @@ export function CarouselViewport({
|
|
|
340
343
|
ref={composed}
|
|
341
344
|
id={state.viewportId}
|
|
342
345
|
role="group"
|
|
343
|
-
|
|
346
|
+
{...(props['aria-label'] || props['aria-labelledby'] ? {} : state.name)}
|
|
344
347
|
tabIndex={0}
|
|
345
348
|
data-slot={joinIds('carousel-viewport', props['data-slot'])}
|
|
346
349
|
className={cn(
|
|
347
|
-
'flex min-w-0 overflow-x-auto overscroll-x-contain snap-x snap-mandatory [touch-action:pan-x_pan-y] gap-[var(--rad-carousel-slide-gap,0px)] rounded-[var(--rad-carousel-radius,var(--rad-surface-radius,0.75rem))] [corner-shape:var(--rad-surface-corner-shape,round)]
|
|
350
|
+
'flex min-w-0 overflow-x-auto overscroll-x-contain snap-x snap-mandatory [touch-action:pan-x_pan-y] gap-[var(--rad-carousel-slide-gap,0px)] rounded-[var(--rad-carousel-radius,var(--rad-surface-radius,0.75rem))] [corner-shape:var(--rad-surface-corner-shape,round)]',
|
|
351
|
+
focusRingClass,
|
|
348
352
|
scrollbarClass,
|
|
349
353
|
className
|
|
350
354
|
)}
|
|
@@ -453,7 +457,7 @@ export function CarouselViewport({
|
|
|
453
457
|
/* oxlint-enable jsx-a11y/no-noninteractive-element-interactions, jsx-a11y/no-noninteractive-tabindex */
|
|
454
458
|
export type CarouselActionProps = WithoutToggle<ButtonProps>
|
|
455
459
|
function Action({ direction, ...props }: CarouselActionProps & { direction: -1 | 1 }) {
|
|
456
|
-
const state =
|
|
460
|
+
const state = useBinding(),
|
|
457
461
|
item = state.items[state.index + direction]
|
|
458
462
|
return (
|
|
459
463
|
<Button
|
|
@@ -498,7 +502,7 @@ export function CarouselIndicators({
|
|
|
498
502
|
className,
|
|
499
503
|
...props
|
|
500
504
|
}: CarouselIndicatorsProps) {
|
|
501
|
-
const state =
|
|
505
|
+
const state = useBinding()
|
|
502
506
|
return (
|
|
503
507
|
<div
|
|
504
508
|
{...props}
|
|
@@ -512,6 +516,7 @@ export function CarouselIndicators({
|
|
|
512
516
|
tone="neutral"
|
|
513
517
|
aria-label={indicatorLabel(index, state.count)}
|
|
514
518
|
aria-current={state.value === item.value ? 'true' : undefined}
|
|
519
|
+
data-selected={state.value === item.value ? '' : undefined}
|
|
515
520
|
aria-controls={state.viewportId}
|
|
516
521
|
onClick={() => state.setValue(item.value)}
|
|
517
522
|
>
|
|
@@ -522,7 +527,7 @@ export function CarouselIndicators({
|
|
|
522
527
|
)
|
|
523
528
|
}
|
|
524
529
|
export function CarouselAutoPlay({ onClick, ...props }: CarouselActionProps) {
|
|
525
|
-
const state =
|
|
530
|
+
const state = useBinding()
|
|
526
531
|
return (
|
|
527
532
|
<Button
|
|
528
533
|
{...props}
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import { useCallback, useLayoutEffect, useRef, type ComponentProps, type ReactNode } from 'react'
|
|
4
4
|
import { cva } from 'class-variance-authority'
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from 'cn'
|
|
6
|
+
import { joinIds } from '../../internal/ids.js'
|
|
6
7
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
7
8
|
import { useNativeOwner, type CheckedOwner } from '../../react/useNativeOwner.js'
|
|
8
9
|
import { controlBorderClass, controlMetrics, indicatorPressClass } from '../shared/controlStyles.js'
|
|
9
10
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
10
11
|
import type { ControlSize, ControlParts } from '../../presentation.js'
|
|
11
12
|
import { useFieldControl } from '../Field/Field.js'
|
|
13
|
+
import { focusRingClass } from '../shared/focusStyles.js'
|
|
12
14
|
|
|
13
15
|
const checkboxVariants = cva([
|
|
14
16
|
controlBorderClass,
|
|
@@ -27,11 +29,9 @@ const checkboxVariants = cva([
|
|
|
27
29
|
'[box-shadow:var(--rad-control-indicator-shadow,none)]',
|
|
28
30
|
'checked:[box-shadow:var(--rad-control-indicator-checked-shadow,none)] indeterminate:[box-shadow:var(--rad-control-indicator-checked-shadow,none)]',
|
|
29
31
|
'data-invalid:[border-color:var(--rad-checkbox-invalid-border,var(--rad-color-invalid,oklch(0.56_0.19_25)))]',
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
'focus-visible:[
|
|
33
|
-
'focus-visible:[outline-offset:var(--rad-checkbox-focus-offset,var(--rad-focus-offset,2px))]',
|
|
34
|
-
'focus-visible:[outline-style:var(--rad-checkbox-focus-style,var(--rad-focus-style,solid))]',
|
|
32
|
+
'in-[[data-slot~=checkbox-group][data-invalid]]:[border-color:var(--rad-checkbox-invalid-border,var(--rad-color-invalid,oklch(0.56_0.19_25)))]',
|
|
33
|
+
focusRingClass,
|
|
34
|
+
'focus-visible:[--_rad-focus-color:var(--rad-checkbox-focus-color)] focus-visible:[--_rad-focus-width:var(--rad-checkbox-focus-width)] focus-visible:[--_rad-focus-offset:var(--rad-checkbox-focus-offset)] focus-visible:[--_rad-focus-style:var(--rad-checkbox-focus-style)]',
|
|
35
35
|
'disabled:cursor-not-allowed',
|
|
36
36
|
'disabled:[border-color:var(--rad-checkbox-disabled-border,var(--rad-color-disabled-border,oklch(0.88_0.005_286)))]',
|
|
37
37
|
'disabled:checked:bg-[var(--rad-checkbox-disabled-background,var(--rad-color-disabled-background,oklch(0.96_0.005_286)))]',
|
|
@@ -63,6 +63,8 @@ export type CheckboxProps = Omit<
|
|
|
63
63
|
controlSize?: ControlSize
|
|
64
64
|
/** Input styles. Parts style the wrapper, label and decorative indicators. */
|
|
65
65
|
style?: ThemeStyle
|
|
66
|
+
/** Additional composed identities; the checkbox token is always retained. */
|
|
67
|
+
'data-slot'?: string
|
|
66
68
|
parts?: ControlParts
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -86,6 +88,7 @@ export function Checkbox({
|
|
|
86
88
|
'aria-describedby': ariaDescribedBy,
|
|
87
89
|
'aria-invalid': ariaInvalid,
|
|
88
90
|
'aria-required': ariaRequired,
|
|
91
|
+
'data-slot': slot,
|
|
89
92
|
...props
|
|
90
93
|
}: CheckboxProps) {
|
|
91
94
|
const controlled = useNativeOwner('Checkbox', checked, defaultChecked)
|
|
@@ -134,7 +137,7 @@ export function Checkbox({
|
|
|
134
137
|
ref={hostRef}
|
|
135
138
|
className={cn(checkboxVariants(), controlMetrics({ controlSize }), className)}
|
|
136
139
|
data-control-size={controlSize}
|
|
137
|
-
data-slot=
|
|
140
|
+
data-slot={joinIds('checkbox', slot)}
|
|
138
141
|
type="checkbox"
|
|
139
142
|
/>
|
|
140
143
|
<svg
|
|
@@ -14,7 +14,7 @@ import { Checkbox, type CheckboxProps } from '../Checkbox/Checkbox.js'
|
|
|
14
14
|
import { Field, type FieldProps } from '../Field/Field.js'
|
|
15
15
|
import { useNativeOwner, type ValueOwner, type CheckedOwner } from '../../react/useNativeOwner.js'
|
|
16
16
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
17
|
-
import { cn } from '
|
|
17
|
+
import { cn } from 'cn'
|
|
18
18
|
import { joinIds } from '../../internal/ids.js'
|
|
19
19
|
import type { ControlSize, PartStyle } from '../../presentation.js'
|
|
20
20
|
type OptionPresentation = Omit<
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react'
|
|
12
12
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
13
13
|
import { ScrollArea, type ScrollAreaProps } from '../ScrollArea/ScrollArea.js'
|
|
14
|
-
import { cn } from '
|
|
14
|
+
import { cn } from 'cn'
|
|
15
15
|
import { joinIds } from '../../internal/ids.js'
|
|
16
16
|
import { composeAction } from '../../internal/events.js'
|
|
17
17
|
import type { DistributiveOmit, WithoutToggle } from '../../internal/types.js'
|
|
@@ -117,7 +117,7 @@ export function CodeBlock({
|
|
|
117
117
|
{...props}
|
|
118
118
|
data-slot={joinIds('code-block', props['data-slot'])}
|
|
119
119
|
data-language={language}
|
|
120
|
-
data-line-numbers={lineNumbers
|
|
120
|
+
data-line-numbers={lineNumbers ? '' : undefined}
|
|
121
121
|
data-copy-state={pending ? 'pending' : phase}
|
|
122
122
|
className={cn(
|
|
123
123
|
'box-border min-w-0 w-full overflow-hidden rounded-[var(--rad-code-block-radius,var(--rad-surface-radius,0.75rem))] [corner-shape:var(--rad-surface-corner-shape,round)]',
|
|
@@ -176,7 +176,7 @@ export function CodeBlockViewport({
|
|
|
176
176
|
orientation={orientation}
|
|
177
177
|
data-slot={joinIds('code-block-viewport', props['data-slot'])}
|
|
178
178
|
className={cn(
|
|
179
|
-
'max-h-[var(--rad-code-block-max-height,24rem)] focus-visible:[
|
|
179
|
+
'max-h-[var(--rad-code-block-max-height,24rem)] focus-visible:[--_rad-focus-offset:calc(-1px_-_var(--_rad-focus-width,var(--rad-focus-width,2px)))]',
|
|
180
180
|
className
|
|
181
181
|
)}
|
|
182
182
|
>
|
|
@@ -4,12 +4,13 @@ import type { ComponentProps, ToggleEvent } from 'react'
|
|
|
4
4
|
import { createContext, useContext, useId, useLayoutEffect, useRef } from 'react'
|
|
5
5
|
import { cva } from 'class-variance-authority'
|
|
6
6
|
import { useTransitionHost } from '../../motion/host.js'
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from 'cn'
|
|
8
8
|
import { joinIds } from '../../internal/ids.js'
|
|
9
9
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
10
10
|
import { useControllableState } from '../../react/useControllableState.js'
|
|
11
11
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
12
12
|
import type { StateOwner } from '../../react/useNativeOwner.js'
|
|
13
|
+
import { focusRingClass } from '../shared/focusStyles.js'
|
|
13
14
|
|
|
14
15
|
const colorMotionClass =
|
|
15
16
|
'transition-colors duration-[var(--rad-motion-color-duration,150ms)] motion-reduce:transition-none'
|
|
@@ -46,11 +47,8 @@ const collapsibleTriggerVariants = cva([
|
|
|
46
47
|
'rounded-[max(0px,calc(var(--rad-collapsible-radius,var(--rad-surface-radius,0.75rem))-var(--rad-collapsible-border-width,var(--rad-surface-border-width,1px))))]',
|
|
47
48
|
'[corner-shape:var(--rad-collapsible-corner-shape,var(--rad-surface-corner-shape,round))] [details[open]>&]:rounded-b-none',
|
|
48
49
|
'hover:bg-[color-mix(in_oklch,var(--rad-color-foreground,oklch(0.21_0.006_286))_4%,transparent)]',
|
|
49
|
-
|
|
50
|
-
'focus-visible:[
|
|
51
|
-
'focus-visible:[outline-width:var(--rad-collapsible-focus-width,var(--rad-focus-width,2px))]',
|
|
52
|
-
'focus-visible:[outline-offset:var(--rad-collapsible-focus-offset,var(--rad-focus-offset,2px))]',
|
|
53
|
-
'focus-visible:[outline-style:var(--rad-collapsible-focus-style,var(--rad-focus-style,solid))]',
|
|
50
|
+
focusRingClass,
|
|
51
|
+
'focus-visible:[--_rad-focus-color:var(--rad-collapsible-focus-color)] focus-visible:[--_rad-focus-width:var(--rad-collapsible-focus-width)] focus-visible:[--_rad-focus-offset:var(--rad-collapsible-focus-offset)] focus-visible:[--_rad-focus-style:var(--rad-collapsible-focus-style)]',
|
|
54
52
|
'forced-colors:text-[CanvasText]'
|
|
55
53
|
])
|
|
56
54
|
|