@cognitap/radiant 0.0.78 → 0.0.80
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 +18 -0
- package/README.md +6 -3
- package/RELEASE_POLICY.md +8 -19
- package/dist/library/charts/Charts.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- 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.js +6 -6
- package/dist/library/components/Carousel/Carousel.js.map +1 -1
- package/dist/library/components/Checkbox/Checkbox.js +1 -1
- 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 +1 -1
- package/dist/library/components/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/library/components/Collapsible/Collapsible.js +1 -1
- package/dist/library/components/Collapsible/Collapsible.js.map +1 -1
- package/dist/library/components/Combobox/Combobox.js +1 -1
- package/dist/library/components/Combobox/Combobox.js.map +1 -1
- package/dist/library/components/Command/Command.js +1 -1
- package/dist/library/components/Command/Command.js.map +1 -1
- package/dist/library/components/ContextMenu/ContextMenu.js +1 -1
- package/dist/library/components/ContextMenu/ContextMenu.js.map +1 -1
- package/dist/library/components/Dialog/Dialog.js +1 -1
- 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.js +1 -1
- package/dist/library/components/Fieldset/Fieldset.js.map +1 -1
- package/dist/library/components/FileInput/FileInput.js +1 -1
- package/dist/library/components/FileInput/FileInput.js.map +1 -1
- package/dist/library/components/Form/Form.d.ts +1 -1
- package/dist/library/components/Form/Form.d.ts.map +1 -1
- package/dist/library/components/Form/Form.js +8 -5
- package/dist/library/components/Form/Form.js.map +1 -1
- package/dist/library/components/HoverCard/HoverCard.js +1 -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.js +1 -1
- package/dist/library/components/Input/Input.js.map +1 -1
- package/dist/library/components/InputGroup/InputGroup.js +1 -1
- 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.js +1 -1
- package/dist/library/components/Link/Link.js.map +1 -1
- package/dist/library/components/Menu/Menu.js +1 -1
- package/dist/library/components/Menu/Menu.js.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/Meter/Meter.js +1 -1
- package/dist/library/components/Meter/Meter.js.map +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.js +1 -1
- package/dist/library/components/NativeSelect/NativeSelect.js.map +1 -1
- package/dist/library/components/NavLink/NavLink.js +1 -1
- package/dist/library/components/NavLink/NavLink.js.map +1 -1
- package/dist/library/components/NavigationMenu/NavigationMenu.d.ts +1 -6
- package/dist/library/components/NavigationMenu/NavigationMenu.d.ts.map +1 -1
- package/dist/library/components/NavigationMenu/NavigationMenu.js +62 -49
- package/dist/library/components/NavigationMenu/NavigationMenu.js.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.js +1 -1
- package/dist/library/components/OTPField/OTPField.js.map +1 -1
- package/dist/library/components/Pagination/Pagination.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/dist/library/components/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/library/components/Resizable/Resizable.d.ts +0 -2
- package/dist/library/components/Resizable/Resizable.d.ts.map +1 -1
- package/dist/library/components/Resizable/Resizable.js +7 -8
- package/dist/library/components/Resizable/Resizable.js.map +1 -1
- package/dist/library/components/ScrollArea/ScrollArea.js +1 -1
- package/dist/library/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/library/components/Select/Select.js +1 -1
- package/dist/library/components/Select/Select.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.js +1 -1
- 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.js +1 -1
- package/dist/library/components/Switch/Switch.js.map +1 -1
- package/dist/library/components/Table/Table.js +1 -1
- package/dist/library/components/Table/Table.js.map +1 -1
- package/dist/library/components/Tabs/Tabs.js +1 -1
- 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.js +1 -1
- package/dist/library/components/TagsInput/TagsInput.js.map +1 -1
- package/dist/library/components/Textarea/Textarea.js +1 -1
- 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.js +1 -1
- 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.js +1 -1
- package/dist/library/components/Tooltip/Tooltip.js.map +1 -1
- 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 +28 -9
- package/dist/library/react/useToastTimer.js.map +1 -1
- package/dist/library/styles.css +1 -1
- package/docs/accessibility.md +23 -111
- package/docs/architecture.md +48 -242
- package/docs/motion.md +65 -130
- package/docs/theming.md +51 -427
- package/package.json +21 -13
- package/src/charts/Charts.tsx +1 -1
- package/src/components/Accordion/Accordion.tsx +1 -1
- package/src/components/Alert/Alert.tsx +1 -1
- package/src/components/AppShell/AppShell.tsx +1 -1
- 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 +1 -1
- 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 +6 -6
- package/src/components/Checkbox/Checkbox.tsx +1 -1
- package/src/components/CheckboxGroup/CheckboxGroup.tsx +1 -1
- package/src/components/CodeBlock/CodeBlock.tsx +1 -1
- package/src/components/Collapsible/Collapsible.tsx +1 -1
- package/src/components/Combobox/Combobox.tsx +1 -1
- package/src/components/Command/Command.tsx +1 -1
- package/src/components/ContextMenu/ContextMenu.tsx +1 -1
- package/src/components/Dialog/Dialog.tsx +1 -1
- 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 +1 -1
- package/src/components/FileInput/FileInput.tsx +1 -1
- package/src/components/Form/Form.tsx +9 -6
- package/src/components/HoverCard/HoverCard.tsx +1 -1
- package/src/components/InlineCode/InlineCode.tsx +1 -1
- package/src/components/Input/Input.tsx +1 -1
- package/src/components/InputGroup/InputGroup.tsx +1 -1
- package/src/components/Kbd/Kbd.tsx +1 -1
- package/src/components/Link/Link.tsx +1 -1
- package/src/components/Menu/Menu.tsx +1 -1
- package/src/components/Menubar/Menubar.tsx +1 -1
- package/src/components/Meter/Meter.tsx +1 -1
- package/src/components/NativeSelect/NativeSelect.tsx +1 -1
- package/src/components/NavLink/NavLink.tsx +1 -1
- package/src/components/NavigationMenu/NavigationMenu.tsx +77 -59
- package/src/components/NumberField/NumberField.tsx +1 -1
- package/src/components/OTPField/OTPField.tsx +1 -1
- package/src/components/Pagination/Pagination.tsx +1 -1
- package/src/components/PasswordInput/PasswordInput.tsx +1 -1
- package/src/components/Popover/Popover.tsx +1 -1
- package/src/components/Progress/Progress.tsx +1 -1
- package/src/components/RadioGroup/RadioGroup.tsx +1 -1
- package/src/components/Resizable/Resizable.tsx +10 -12
- package/src/components/ScrollArea/ScrollArea.tsx +1 -1
- package/src/components/Select/Select.tsx +1 -1
- package/src/components/Separator/Separator.tsx +1 -1
- package/src/components/Skeleton/Skeleton.tsx +1 -1
- package/src/components/Slider/Slider.tsx +1 -1
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +1 -1
- package/src/components/Tag/Tag.tsx +1 -1
- package/src/components/TagsInput/TagsInput.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +1 -1
- package/src/components/ThemeScope/ThemeScope.tsx +1 -1
- package/src/components/Toast/Toast.tsx +1 -1
- package/src/components/ToggleGroup/ToggleGroup.tsx +3 -1
- package/src/components/Toolbar/Toolbar.tsx +1 -1
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/css.d.ts +2 -0
- package/src/index.ts +0 -1
- 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 +24 -9
- package/src/styles.d.ts +1 -0
- package/src/themes/baseline.css +1 -1
- 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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
useLayoutEffect,
|
|
11
11
|
useRef,
|
|
12
12
|
useState,
|
|
13
|
+
useSyncExternalStore,
|
|
13
14
|
type ComponentProps,
|
|
14
15
|
type RefObject
|
|
15
16
|
} from 'react'
|
|
@@ -19,7 +20,7 @@ import {
|
|
|
19
20
|
type ComposedLinkProps,
|
|
20
21
|
type ComposedLinkRenderProps
|
|
21
22
|
} from '../shared/composedLink.js'
|
|
22
|
-
import { cn } from '
|
|
23
|
+
import { cn } from 'cn'
|
|
23
24
|
import { ScrollArea } from '../ScrollArea/ScrollArea.js'
|
|
24
25
|
import { composeAction } from '../../internal/events.js'
|
|
25
26
|
import { joinIds } from '../../internal/ids.js'
|
|
@@ -34,7 +35,6 @@ import type { ControlSize } from '../../presentation.js'
|
|
|
34
35
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
35
36
|
import { scrollbarClass } from '../shared/scrollbarStyles.js'
|
|
36
37
|
|
|
37
|
-
export type NavigationMenuItemConfig = { value: string; disabled?: boolean }
|
|
38
38
|
export type NavigationMenuProps = Omit<
|
|
39
39
|
ComponentProps<'nav'>,
|
|
40
40
|
'style' | 'role' | 'onChange' | 'defaultValue'
|
|
@@ -43,7 +43,6 @@ export type NavigationMenuProps = Omit<
|
|
|
43
43
|
ValueOwner<string | null> & {
|
|
44
44
|
style?: ThemeStyle
|
|
45
45
|
'data-slot'?: string
|
|
46
|
-
items: readonly NavigationMenuItemConfig[]
|
|
47
46
|
onValueChange?: (value: string | null) => void
|
|
48
47
|
openDelay?: number
|
|
49
48
|
closeDelay?: number
|
|
@@ -59,7 +58,6 @@ export type NavigationMenuState = {
|
|
|
59
58
|
type Hover = ReturnType<typeof useHoverSurface>
|
|
60
59
|
type Binding = NavigationMenuState & {
|
|
61
60
|
visible: string | null
|
|
62
|
-
items: readonly NavigationMenuItemConfig[]
|
|
63
61
|
controlSize: ControlSize
|
|
64
62
|
openDelay: number
|
|
65
63
|
closeDelay: number
|
|
@@ -71,8 +69,9 @@ type Binding = NavigationMenuState & {
|
|
|
71
69
|
ids: (value: string) => { trigger: string; panel: string }
|
|
72
70
|
requestFocus: (value: string, last: boolean) => void
|
|
73
71
|
cancel: () => void
|
|
74
|
-
registerTrigger: (value: string, node: HTMLButtonElement
|
|
75
|
-
registerPanel: (value: string, node: HTMLDivElement
|
|
72
|
+
registerTrigger: (value: string, node: HTMLButtonElement) => () => void
|
|
73
|
+
registerPanel: (value: string, node: HTMLDivElement) => () => void
|
|
74
|
+
reportSection: (value: string, enabled: boolean | undefined) => void
|
|
76
75
|
name: { 'aria-label'?: string; 'aria-labelledby'?: string }
|
|
77
76
|
}
|
|
78
77
|
const Context = createContext<Binding | null>(null)
|
|
@@ -84,10 +83,23 @@ function useBinding() {
|
|
|
84
83
|
if (!value) throw new Error('NavigationMenu parts must render inside NavigationMenu.')
|
|
85
84
|
return value
|
|
86
85
|
}
|
|
87
|
-
function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
86
|
+
function checkValue(value: unknown) {
|
|
87
|
+
if (typeof value !== 'string' || !value)
|
|
88
|
+
throw new TypeError('NavigationMenu values must be nonempty strings.')
|
|
89
|
+
}
|
|
90
|
+
function register<Node>(nodes: Map<string, Node>, kind: string, value: string, node: Node) {
|
|
91
|
+
if (nodes.has(value) && nodes.get(value) !== node)
|
|
92
|
+
throw new TypeError(`NavigationMenu ${kind} values must be unique.`)
|
|
93
|
+
nodes.set(value, node)
|
|
94
|
+
return () => {
|
|
95
|
+
if (nodes.get(value) === node) nodes.delete(value)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const subscribeNever = () => () => {}
|
|
99
|
+
function inOrder<Node extends HTMLElement>(nodes: Iterable<Node>) {
|
|
100
|
+
return Array.from(nodes).sort((a, b) =>
|
|
101
|
+
a.compareDocumentPosition(b) & a.DOCUMENT_POSITION_FOLLOWING ? -1 : 1
|
|
102
|
+
)
|
|
91
103
|
}
|
|
92
104
|
function focusable(panel: HTMLElement) {
|
|
93
105
|
return Array.from(
|
|
@@ -101,7 +113,6 @@ function focusable(panel: HTMLElement) {
|
|
|
101
113
|
)
|
|
102
114
|
}
|
|
103
115
|
export function NavigationMenu({
|
|
104
|
-
items,
|
|
105
116
|
value,
|
|
106
117
|
defaultValue,
|
|
107
118
|
onValueChange,
|
|
@@ -117,17 +128,6 @@ export function NavigationMenu({
|
|
|
117
128
|
...props
|
|
118
129
|
}: NavigationMenuProps) {
|
|
119
130
|
requireAccessibleName('NavigationMenu', props)
|
|
120
|
-
if (
|
|
121
|
-
!Array.isArray(items) ||
|
|
122
|
-
items.some(
|
|
123
|
-
entry =>
|
|
124
|
-
typeof entry.value !== 'string' ||
|
|
125
|
-
!entry.value ||
|
|
126
|
-
(entry.disabled !== undefined && typeof entry.disabled !== 'boolean')
|
|
127
|
-
) ||
|
|
128
|
-
new Set(items.map(entry => entry.value)).size !== items.length
|
|
129
|
-
)
|
|
130
|
-
throw new TypeError('NavigationMenu items require unique nonempty values.')
|
|
131
131
|
if (![openDelay, closeDelay].every(n => Number.isFinite(n) && n >= 0))
|
|
132
132
|
throw new TypeError('NavigationMenu delays must be finite and nonnegative.')
|
|
133
133
|
const state = useControllableState<string | null>({
|
|
@@ -137,15 +137,16 @@ export function NavigationMenu({
|
|
|
137
137
|
initialValue: null,
|
|
138
138
|
onChange: onValueChange
|
|
139
139
|
})
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
140
|
+
if (state.value !== null) checkValue(state.value)
|
|
141
|
+
// Mounted triggers and whether each is enabled. SSR and hydration cannot see them, so they trust the value.
|
|
142
|
+
const [sections, setSections] = useState<ReadonlyMap<string, boolean>>(() => new Map())
|
|
143
|
+
const client = useSyncExternalStore(
|
|
144
|
+
subscribeNever,
|
|
145
|
+
() => true,
|
|
146
|
+
() => false
|
|
147
|
+
)
|
|
145
148
|
const shown =
|
|
146
|
-
|
|
147
|
-
? state.value
|
|
148
|
-
: null
|
|
149
|
+
disabled || state.value === null || (client && !sections.get(state.value)) ? null : state.value
|
|
149
150
|
const root = useRef<HTMLElement>(null),
|
|
150
151
|
viewport = useRef<HTMLDivElement>(null),
|
|
151
152
|
triggers = useRef(new Map<string, HTMLButtonElement>()),
|
|
@@ -159,20 +160,33 @@ export function NavigationMenu({
|
|
|
159
160
|
useLayoutEffect(() => {
|
|
160
161
|
latest.current = shown
|
|
161
162
|
})
|
|
162
|
-
const registerTrigger = useCallback(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
const registerPanel = useCallback(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
163
|
+
const registerTrigger = useCallback(
|
|
164
|
+
(value: string, node: HTMLButtonElement) => register(triggers.current, 'trigger', value, node),
|
|
165
|
+
[]
|
|
166
|
+
)
|
|
167
|
+
const registerPanel = useCallback(
|
|
168
|
+
(value: string, node: HTMLDivElement) => register(panels.current, 'content', value, node),
|
|
169
|
+
[]
|
|
170
|
+
)
|
|
171
|
+
const reportSection = useCallback(
|
|
172
|
+
(value: string, enabled: boolean | undefined) =>
|
|
173
|
+
setSections(previous => {
|
|
174
|
+
if (previous && previous.get(value) === enabled) return previous
|
|
175
|
+
const next = new Map(previous)
|
|
176
|
+
if (enabled === undefined) next.delete(value)
|
|
177
|
+
else next.set(value, enabled)
|
|
178
|
+
return next
|
|
179
|
+
}),
|
|
180
|
+
[]
|
|
181
|
+
)
|
|
170
182
|
const host = useComposedRefs(root, ref)
|
|
171
183
|
const cancel = () => hover.current.forEach(binding => binding.cancel())
|
|
184
|
+
// Requests open only a mounted, enabled trigger's panel.
|
|
172
185
|
const setValue = (next: string | null) => {
|
|
173
|
-
|
|
186
|
+
if (next !== null) checkValue(next)
|
|
174
187
|
cancel()
|
|
175
|
-
|
|
188
|
+
const opener = next === null ? undefined : triggers.current.get(next)
|
|
189
|
+
if (disabled || (next !== null && (!opener || opener.disabled))) return
|
|
176
190
|
state.request(next)
|
|
177
191
|
}
|
|
178
192
|
const requestFocus = (next: string, last: boolean) => {
|
|
@@ -231,7 +245,6 @@ export function NavigationMenu({
|
|
|
231
245
|
controlled: state.controlled,
|
|
232
246
|
disabled,
|
|
233
247
|
setValue,
|
|
234
|
-
items,
|
|
235
248
|
controlSize,
|
|
236
249
|
openDelay,
|
|
237
250
|
closeDelay,
|
|
@@ -244,10 +257,11 @@ export function NavigationMenu({
|
|
|
244
257
|
requestFocus,
|
|
245
258
|
registerTrigger,
|
|
246
259
|
registerPanel,
|
|
260
|
+
reportSection,
|
|
247
261
|
name: { 'aria-label': props['aria-label'], 'aria-labelledby': props['aria-labelledby'] },
|
|
248
262
|
ids: next => ({
|
|
249
|
-
trigger: `${id}-trigger-${
|
|
250
|
-
panel: `${id}-panel-${
|
|
263
|
+
trigger: `${id}-trigger-${encodeURIComponent(next)}`,
|
|
264
|
+
panel: `${id}-panel-${encodeURIComponent(next)}`
|
|
251
265
|
})
|
|
252
266
|
}}
|
|
253
267
|
>
|
|
@@ -353,20 +367,29 @@ export function NavigationMenuTrigger({
|
|
|
353
367
|
tone = 'neutral',
|
|
354
368
|
...props
|
|
355
369
|
}: NavigationMenuTriggerProps) {
|
|
370
|
+
checkValue(value)
|
|
356
371
|
const binding = useBinding(),
|
|
357
|
-
|
|
358
|
-
registerTrigger = binding.registerTrigger,
|
|
372
|
+
{ registerTrigger, reportSection } = binding,
|
|
359
373
|
[node, setNode] = useState<HTMLButtonElement | null>(null),
|
|
360
374
|
register = useCallback(
|
|
361
375
|
(element: HTMLButtonElement | null) => {
|
|
376
|
+
if (!element) return
|
|
362
377
|
setNode(element)
|
|
363
|
-
registerTrigger(value, element)
|
|
378
|
+
const unregister = registerTrigger(value, element)
|
|
379
|
+
return () => {
|
|
380
|
+
setNode(null)
|
|
381
|
+
unregister()
|
|
382
|
+
}
|
|
364
383
|
},
|
|
365
384
|
[registerTrigger, value, setNode]
|
|
366
385
|
),
|
|
367
386
|
host = useComposedRefs(register, ref),
|
|
368
|
-
open = binding.visible === value,
|
|
369
|
-
blocked = binding.disabled ||
|
|
387
|
+
open = binding.visible === value && !disabled,
|
|
388
|
+
blocked = binding.disabled || disabled || props.pending
|
|
389
|
+
useLayoutEffect(() => {
|
|
390
|
+
reportSection(value, !disabled)
|
|
391
|
+
return () => reportSection(value, undefined)
|
|
392
|
+
}, [reportSection, value, disabled])
|
|
370
393
|
const hover = useHoverSurface({
|
|
371
394
|
trigger: node,
|
|
372
395
|
content: binding.viewport,
|
|
@@ -390,7 +413,7 @@ export function NavigationMenuTrigger({
|
|
|
390
413
|
<Button
|
|
391
414
|
{...props}
|
|
392
415
|
ref={host}
|
|
393
|
-
disabled={binding.disabled ||
|
|
416
|
+
disabled={binding.disabled || disabled}
|
|
394
417
|
controlSize={controlSize ?? binding.controlSize}
|
|
395
418
|
variant={variant}
|
|
396
419
|
tone={tone}
|
|
@@ -432,12 +455,9 @@ export function NavigationMenuTrigger({
|
|
|
432
455
|
}
|
|
433
456
|
const keys = ['ArrowLeft', 'ArrowRight', 'Home', 'End']
|
|
434
457
|
if (!keys.includes(event.key)) return
|
|
435
|
-
const nodes = binding.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
(button): button is HTMLButtonElement =>
|
|
439
|
-
!!button && !button.disabled && button.getAttribute('aria-busy') !== 'true'
|
|
440
|
-
)
|
|
458
|
+
const nodes = inOrder(binding.triggers.current.values()).filter(
|
|
459
|
+
button => !button.disabled && button.getAttribute('aria-busy') !== 'true'
|
|
460
|
+
)
|
|
441
461
|
const current = nodes.indexOf(event.currentTarget)
|
|
442
462
|
if (current < 0) return
|
|
443
463
|
const rtl = node?.ownerDocument.defaultView?.getComputedStyle(node).direction === 'rtl',
|
|
@@ -494,13 +514,11 @@ export function NavigationMenuContent({
|
|
|
494
514
|
className,
|
|
495
515
|
...props
|
|
496
516
|
}: NavigationMenuContentProps) {
|
|
517
|
+
checkValue(value)
|
|
497
518
|
const binding = useBinding()
|
|
498
519
|
const registerPanel = binding.registerPanel
|
|
499
|
-
item(binding, value)
|
|
500
520
|
const register = useCallback(
|
|
501
|
-
(node: HTMLDivElement | null) =>
|
|
502
|
-
registerPanel(value, node)
|
|
503
|
-
},
|
|
521
|
+
(node: HTMLDivElement | null) => (node ? registerPanel(value, node) : undefined),
|
|
504
522
|
[registerPanel, value]
|
|
505
523
|
),
|
|
506
524
|
host = useComposedRefs(register, ref),
|
|
@@ -8,7 +8,7 @@ import type { InputProps } from '../Input/Input.js'
|
|
|
8
8
|
import { InputGroup, InputGroupAddon, InputGroupInputRoot } from '../InputGroup/InputGroup.js'
|
|
9
9
|
import { Button } from '../Button/Button.js'
|
|
10
10
|
import { useFieldControl } from '../Field/Field.js'
|
|
11
|
-
import { cn } from '
|
|
11
|
+
import { cn } from 'cn'
|
|
12
12
|
import type { PartStyle } from '../../presentation.js'
|
|
13
13
|
import type { DistributiveOmit } from '../../internal/types.js'
|
|
14
14
|
import { requireAccessibleName } from '../../internal/accessibleName.js'
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { useEffect, useRef, useState } from 'react'
|
|
4
4
|
import { InputRoot, inputVariants, type InputProps } from '../Input/Input.js'
|
|
5
5
|
import { useFieldControl } from '../Field/Field.js'
|
|
6
|
-
import { cn } from '
|
|
6
|
+
import { cn } from 'cn'
|
|
7
7
|
import { controlMetrics } from '../shared/controlStyles.js'
|
|
8
8
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
9
9
|
import { useNativeOwner, type ValueOwner } from '../../react/useNativeOwner.js'
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
type ComposedLinkRenderProps
|
|
7
7
|
} from '../shared/composedLink.js'
|
|
8
8
|
import type { DistributiveOmit } from '../../internal/types.js'
|
|
9
|
-
import { cn } from '
|
|
9
|
+
import { cn } from 'cn'
|
|
10
10
|
import { joinIds } from '../../internal/ids.js'
|
|
11
11
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
12
12
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -6,7 +6,7 @@ import type { InputProps } from '../Input/Input.js'
|
|
|
6
6
|
import { InputGroup, InputGroupAddon, InputGroupInputRoot } from '../InputGroup/InputGroup.js'
|
|
7
7
|
import { Button } from '../Button/Button.js'
|
|
8
8
|
import { useFieldControl } from '../Field/Field.js'
|
|
9
|
-
import { cn } from '
|
|
9
|
+
import { cn } from 'cn'
|
|
10
10
|
import { requireAccessibleName } from '../../internal/accessibleName.js'
|
|
11
11
|
import type { DistributiveOmit } from '../../internal/types.js'
|
|
12
12
|
import { useNativeOwner, type ValueOwner } from '../../react/useNativeOwner.js'
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from 'react'
|
|
13
13
|
import { createPortal } from 'react-dom'
|
|
14
14
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
15
|
-
import { cn } from '
|
|
15
|
+
import { cn } from 'cn'
|
|
16
16
|
import { composeAction } from '../../internal/events.js'
|
|
17
17
|
import { joinIds } from '../../internal/ids.js'
|
|
18
18
|
import type { PopoverSide, PopoverAlign } from '../../internal/popover.js'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react'
|
|
12
12
|
import type { ChangeEvent, ComponentProps, ReactNode } from 'react'
|
|
13
13
|
import { cva } from 'class-variance-authority'
|
|
14
|
-
import { cn } from '
|
|
14
|
+
import { cn } from 'cn'
|
|
15
15
|
import { joinIds } from '../../internal/ids.js'
|
|
16
16
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
17
17
|
import { useNativeOwner, type ValueOwner, type CheckedOwner } from '../../react/useNativeOwner.js'
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
type ComponentProps
|
|
13
13
|
} from 'react'
|
|
14
14
|
import { SeparatorRoot, type SeparatorProps } from '../Separator/Separator.js'
|
|
15
|
-
import { cn } from '
|
|
15
|
+
import { cn } from 'cn'
|
|
16
16
|
import { joinIds } from '../../internal/ids.js'
|
|
17
17
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
18
18
|
import {
|
|
@@ -58,8 +58,6 @@ export type ResizablePanelState = {
|
|
|
58
58
|
}
|
|
59
59
|
export type ResizableState = {
|
|
60
60
|
value: number[]
|
|
61
|
-
controlled: boolean
|
|
62
|
-
orientation: Orientation
|
|
63
61
|
disabled: boolean
|
|
64
62
|
setValue: (value: number[]) => void
|
|
65
63
|
resize: (panel: string, size: number) => void
|
|
@@ -69,6 +67,7 @@ export type ResizableState = {
|
|
|
69
67
|
}
|
|
70
68
|
type Binding = {
|
|
71
69
|
state: ResizableState
|
|
70
|
+
orientation: Orientation
|
|
72
71
|
items: readonly ResizableItem[]
|
|
73
72
|
id: string
|
|
74
73
|
dragging: string | null
|
|
@@ -205,8 +204,6 @@ export function Resizable({
|
|
|
205
204
|
}
|
|
206
205
|
const state: ResizableState = {
|
|
207
206
|
value: selection.value,
|
|
208
|
-
controlled: selection.controlled,
|
|
209
|
-
orientation,
|
|
210
207
|
disabled,
|
|
211
208
|
setValue: value => request(() => [...value]),
|
|
212
209
|
resize,
|
|
@@ -231,6 +228,7 @@ export function Resizable({
|
|
|
231
228
|
}, [])
|
|
232
229
|
const binding: Binding = {
|
|
233
230
|
state,
|
|
231
|
+
orientation,
|
|
234
232
|
items,
|
|
235
233
|
id,
|
|
236
234
|
dragging,
|
|
@@ -439,8 +437,7 @@ export function ResizableHandle({
|
|
|
439
437
|
}, [finishGesture])
|
|
440
438
|
useEffect(() => () => finish(), [finish])
|
|
441
439
|
useLayoutEffect(() => {
|
|
442
|
-
if (disabled || (drag.current && drag.current.orientation !== context.
|
|
443
|
-
finish()
|
|
440
|
+
if (disabled || (drag.current && drag.current.orientation !== context.orientation)) finish()
|
|
444
441
|
})
|
|
445
442
|
return (
|
|
446
443
|
<SeparatorRoot
|
|
@@ -449,9 +446,10 @@ export function ResizableHandle({
|
|
|
449
446
|
tabIndex={disabled ? -1 : 0}
|
|
450
447
|
decorative={false}
|
|
451
448
|
ref={composed}
|
|
452
|
-
orientation={context.
|
|
449
|
+
orientation={context.orientation === 'horizontal' ? 'vertical' : 'horizontal'}
|
|
453
450
|
aria-controls={context.id + '-panel-' + encodeURIComponent(value)}
|
|
454
451
|
aria-disabled={disabled || undefined}
|
|
452
|
+
data-disabled={disabled ? '' : undefined}
|
|
455
453
|
aria-valuenow={context.state.value[index]}
|
|
456
454
|
aria-valuemin={min}
|
|
457
455
|
aria-valuemax={max}
|
|
@@ -466,7 +464,7 @@ export function ResizableHandle({
|
|
|
466
464
|
'aria-disabled:cursor-not-allowed aria-disabled:bg-[var(--rad-resizable-handle-background,transparent)] forced-colors:border-[CanvasText]',
|
|
467
465
|
focusRingClass,
|
|
468
466
|
'focus-visible:[--_rad-focus-color:var(--rad-resizable-focus-color)] focus-visible:[--_rad-focus-width:var(--rad-resizable-focus-width)] focus-visible:[--_rad-focus-offset:var(--rad-resizable-focus-offset,calc(0px_-_var(--_rad-focus-width,var(--rad-focus-width,2px))))] focus-visible:[--_rad-focus-style:var(--rad-resizable-focus-style)]',
|
|
469
|
-
context.
|
|
467
|
+
context.orientation === 'horizontal'
|
|
470
468
|
? 'h-auto w-[length:var(--rad-resizable-handle-size,0.5rem)] cursor-col-resize'
|
|
471
469
|
: 'w-auto h-[length:var(--rad-resizable-handle-size,0.5rem)] cursor-row-resize',
|
|
472
470
|
className
|
|
@@ -485,7 +483,7 @@ export function ResizableHandle({
|
|
|
485
483
|
context.state.resize(value, event.key === 'Home' ? min : max)
|
|
486
484
|
return
|
|
487
485
|
}
|
|
488
|
-
const horizontal = context.
|
|
486
|
+
const horizontal = context.orientation === 'horizontal',
|
|
489
487
|
direction = context.direction(),
|
|
490
488
|
amount = event.shiftKey ? largeStep : step
|
|
491
489
|
const sign = horizontal
|
|
@@ -523,11 +521,11 @@ export function ResizableHandle({
|
|
|
523
521
|
node: event.currentTarget,
|
|
524
522
|
pointer: event.pointerId,
|
|
525
523
|
token,
|
|
526
|
-
start: context.
|
|
524
|
+
start: context.orientation === 'horizontal' ? event.clientX : event.clientY,
|
|
527
525
|
size: context.state.value[index]!,
|
|
528
526
|
room,
|
|
529
527
|
sum: addDecimal(context.state.value[index]!, context.state.value[index + 1]!),
|
|
530
|
-
orientation: context.
|
|
528
|
+
orientation: context.orientation,
|
|
531
529
|
direction: context.direction(),
|
|
532
530
|
cleanup: () => view?.removeEventListener('blur', finish)
|
|
533
531
|
}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type PointerEvent
|
|
14
14
|
} from 'react'
|
|
15
15
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
16
|
-
import { cn } from '
|
|
16
|
+
import { cn } from 'cn'
|
|
17
17
|
import { joinIds } from '../../internal/ids.js'
|
|
18
18
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
19
19
|
import type { Orientation, PartStyle } from '../../presentation.js'
|
|
@@ -16,7 +16,7 @@ import { createPortal } from 'react-dom'
|
|
|
16
16
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
17
17
|
import { useField, useFieldControl } from '../Field/Field.js'
|
|
18
18
|
import type { DistributiveOmit } from '../../internal/types.js'
|
|
19
|
-
import { cn } from '
|
|
19
|
+
import { cn } from 'cn'
|
|
20
20
|
import { joinIds } from '../../internal/ids.js'
|
|
21
21
|
import { controlMetrics, itemGroupLabelClass } from '../shared/controlStyles.js'
|
|
22
22
|
import { matchSelectText, moveSelectFocus, positionSelect } from '../../internal/select.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react'
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from 'cn'
|
|
3
3
|
import { joinIds } from '../../internal/ids.js'
|
|
4
4
|
import type { Orientation } from '../../presentation.js'
|
|
5
5
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useContext, type ComponentProps } from 'react'
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from 'cn'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import { MotionProfileContext } from '../../motion/context.js'
|
|
7
7
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import type { ComponentProps } from 'react'
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from 'cn'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import { useFieldControl } from '../Field/Field.js'
|
|
7
7
|
import { controlBorderClass, controlMetrics } from '../shared/controlStyles.js'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
3
|
import { useContext, type ComponentProps } from 'react'
|
|
4
|
-
import { cn } from '
|
|
4
|
+
import { cn } from 'cn'
|
|
5
5
|
import { joinIds } from '../../internal/ids.js'
|
|
6
6
|
import { MotionProfileContext } from '../../motion/context.js'
|
|
7
7
|
import type { ControlSize, PartStyle } from '../../presentation.js'
|
|
@@ -2,7 +2,7 @@
|
|
|
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
6
|
import { joinIds } from '../../internal/ids.js'
|
|
7
7
|
import { useSwitchDrag } from '../../react/useSwitchDrag.js'
|
|
8
8
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react'
|
|
2
|
-
import { cn } from '
|
|
2
|
+
import { cn } from 'cn'
|
|
3
3
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
4
4
|
import { joinIds } from '../../internal/ids.js'
|
|
5
5
|
import type { ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
type ComponentProps
|
|
10
10
|
} from 'react'
|
|
11
11
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
12
|
-
import { cn } from '
|
|
12
|
+
import { cn } from 'cn'
|
|
13
13
|
import { controlMetrics } from '../shared/controlStyles.js'
|
|
14
14
|
import { scrollbarClass } from '../shared/scrollbarStyles.js'
|
|
15
15
|
import { composeAction } from '../../internal/events.js'
|
|
@@ -4,7 +4,7 @@ import { inlineActionClass } from '../shared/actionStyles.js'
|
|
|
4
4
|
import type { MouseEvent, ReactNode } from 'react'
|
|
5
5
|
import { Badge, type BadgeProps } from '../Badge/Badge.js'
|
|
6
6
|
import { Button } from '../Button/Button.js'
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from 'cn'
|
|
8
8
|
import { joinIds } from '../../internal/ids.js'
|
|
9
9
|
import { requireAccessibleName } from '../../internal/accessibleName.js'
|
|
10
10
|
import type { PartStyle } from '../../presentation.js'
|
|
@@ -4,7 +4,7 @@ import { useId, useLayoutEffect, useRef, useState } from 'react'
|
|
|
4
4
|
import { InputRoot, type InputProps } from '../Input/Input.js'
|
|
5
5
|
import { Tag } from '../Tag/Tag.js'
|
|
6
6
|
import { useFieldControl } from '../Field/Field.js'
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from 'cn'
|
|
8
8
|
import { controlBorderClass, controlMetrics } from '../shared/controlStyles.js'
|
|
9
9
|
import { joinIds } from '../../internal/ids.js'
|
|
10
10
|
import { sameSelection } from '../../internal/selection.js'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ComponentProps } from 'react'
|
|
4
4
|
import { cva } from 'class-variance-authority'
|
|
5
|
-
import { cn } from '
|
|
5
|
+
import { cn } from 'cn'
|
|
6
6
|
import { joinIds } from '../../internal/ids.js'
|
|
7
7
|
import { controlBorderClass, controlMetrics } from '../shared/controlStyles.js'
|
|
8
8
|
import { useNativeOwner, type ValueOwner } from '../../react/useNativeOwner.js'
|
|
@@ -4,7 +4,7 @@ import { MotionProfileContext } from '../../motion/context.js'
|
|
|
4
4
|
|
|
5
5
|
import { createContext, useContext } from 'react'
|
|
6
6
|
import type { ComponentProps } from 'react'
|
|
7
|
-
import { cn } from '
|
|
7
|
+
import { cn } from 'cn'
|
|
8
8
|
import { defaultTheme } from '../../themes/default.js'
|
|
9
9
|
import { modeStyle } from '../../themes/tokens.js'
|
|
10
10
|
import type { Theme, ThemeMode, ThemeStyle } from '../../themes/defineTheme.js'
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
type AlertDescriptionProps
|
|
22
22
|
} from '../Alert/Alert.js'
|
|
23
23
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
24
|
-
import { cn } from '
|
|
24
|
+
import { cn } from 'cn'
|
|
25
25
|
import { joinIds } from '../../internal/ids.js'
|
|
26
26
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
27
27
|
import type { WithoutToggle } from '../../internal/types.js'
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from 'react'
|
|
12
12
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
13
13
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
14
|
-
import { cn } from '
|
|
14
|
+
import { cn } from 'cn'
|
|
15
15
|
import { joinIds } from '../../internal/ids.js'
|
|
16
16
|
import {
|
|
17
17
|
isItemOpen,
|
|
@@ -330,6 +330,8 @@ function Indicator({
|
|
|
330
330
|
attributes: true,
|
|
331
331
|
attributeFilter: ['aria-pressed', 'class', 'style', 'hidden', 'dir']
|
|
332
332
|
})
|
|
333
|
+
for (let parent = root.parentElement; parent; parent = parent.parentElement)
|
|
334
|
+
changes.observe(parent, { attributes: true, attributeFilter: ['dir'] })
|
|
333
335
|
observe()
|
|
334
336
|
measure()
|
|
335
337
|
view.addEventListener('resize', schedule)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { useRef, type ComponentProps } from 'react'
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from 'cn'
|
|
4
4
|
import { joinIds } from '../../internal/ids.js'
|
|
5
5
|
import { requireAccessibleName, type AccessibleName } from '../../internal/accessibleName.js'
|
|
6
6
|
import { useComposedRefs } from '../../react/useComposedRefs.js'
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from 'react'
|
|
13
13
|
import { createPortal } from 'react-dom'
|
|
14
14
|
import { Button, type ButtonProps, type ButtonRenderProps } from '../Button/Button.js'
|
|
15
|
-
import { cn } from '
|
|
15
|
+
import { cn } from 'cn'
|
|
16
16
|
import { joinIds } from '../../internal/ids.js'
|
|
17
17
|
import { composeAction } from '../../internal/events.js'
|
|
18
18
|
import type { PopoverSide, PopoverAlign } from '../../internal/popover.js'
|
package/src/css.d.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { Link, type LinkProps } from '../components/Link/Link.js'
|
|
3
|
-
import { cn } from '
|
|
3
|
+
import { cn } from 'cn'
|
|
4
4
|
import { usePressHost } from './host.js'
|
|
5
5
|
import { callerOwnsPress, springPressClass, offPressClass } from './pressPolicy.js'
|
|
6
6
|
export type MotionLinkProps = LinkProps & {
|