@cognitap/radiant 0.0.79 → 0.0.81
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/dist/library/charts/Charts.d.ts +1 -2
- package/dist/library/charts/Charts.d.ts.map +1 -1
- package/dist/library/charts/Charts.js +4 -4
- package/dist/library/charts/Charts.js.map +1 -1
- package/dist/library/components/AppShell/AppShell.d.ts +1 -6
- package/dist/library/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/library/components/AppShell/AppShell.js +4 -10
- package/dist/library/components/AppShell/AppShell.js.map +1 -1
- package/dist/library/components/Carousel/Carousel.d.ts +9 -5
- package/dist/library/components/Carousel/Carousel.d.ts.map +1 -1
- package/dist/library/components/Carousel/Carousel.js +14 -6
- package/dist/library/components/Carousel/Carousel.js.map +1 -1
- package/dist/library/components/Combobox/Combobox.d.ts +6 -0
- package/dist/library/components/Combobox/Combobox.d.ts.map +1 -1
- package/dist/library/components/Combobox/Combobox.js +41 -6
- package/dist/library/components/Combobox/Combobox.js.map +1 -1
- package/dist/library/components/Combobox/comboboxStyles.d.ts +3 -0
- package/dist/library/components/Combobox/comboboxStyles.d.ts.map +1 -1
- package/dist/library/components/Combobox/comboboxStyles.js +20 -1
- package/dist/library/components/Combobox/comboboxStyles.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 +4 -1
- package/dist/library/components/Form/Form.js.map +1 -1
- package/dist/library/components/MultiSelect/MultiSelect.d.ts +4 -1
- package/dist/library/components/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/library/components/MultiSelect/MultiSelect.js +6 -1
- package/dist/library/components/MultiSelect/MultiSelect.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 +61 -48
- package/dist/library/components/NavigationMenu/NavigationMenu.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 +6 -7
- package/dist/library/components/Resizable/Resizable.js.map +1 -1
- package/dist/library/index.d.ts +7 -7
- package/dist/library/index.d.ts.map +1 -1
- package/dist/library/index.js +3 -3
- package/dist/library/index.js.map +1 -1
- package/dist/library/react/useComboboxPopup.d.ts.map +1 -1
- package/dist/library/react/useComboboxPopup.js +5 -3
- package/dist/library/react/useComboboxPopup.js.map +1 -1
- package/dist/library/styles.css +1 -1
- package/docs/theming.md +10 -10
- package/package.json +1 -1
- package/src/charts/Charts.tsx +10 -7
- package/src/components/AppShell/AppShell.tsx +4 -14
- package/src/components/Carousel/Carousel.tsx +34 -6
- package/src/components/Combobox/Combobox.tsx +76 -13
- package/src/components/Combobox/comboboxStyles.ts +22 -1
- package/src/components/Form/Form.tsx +5 -2
- package/src/components/MultiSelect/MultiSelect.tsx +8 -0
- package/src/components/NavigationMenu/NavigationMenu.tsx +76 -58
- package/src/components/Resizable/Resizable.tsx +9 -11
- package/src/index.ts +7 -5
- package/src/react/useComboboxPopup.ts +5 -3
|
@@ -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'
|
|
@@ -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),
|
|
@@ -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
|
}
|
package/src/index.ts
CHANGED
|
@@ -573,11 +573,12 @@ export { Tag } from './components/Tag/Tag.js'
|
|
|
573
573
|
export type { TagProps } from './components/Tag/Tag.js'
|
|
574
574
|
export { TagsInput } from './components/TagsInput/TagsInput.js'
|
|
575
575
|
export type { TagsInputProps } from './components/TagsInput/TagsInput.js'
|
|
576
|
-
export { ComboboxTags } from './components/Combobox/Combobox.js'
|
|
576
|
+
export { ComboboxTags, ComboboxControl } from './components/Combobox/Combobox.js'
|
|
577
577
|
export type {
|
|
578
578
|
ComboboxMultipleProps,
|
|
579
579
|
ComboboxMultipleState,
|
|
580
|
-
ComboboxTagsProps
|
|
580
|
+
ComboboxTagsProps,
|
|
581
|
+
ComboboxControlProps
|
|
581
582
|
} from './components/Combobox/Combobox.js'
|
|
582
583
|
export { OTPField } from './components/OTPField/OTPField.js'
|
|
583
584
|
export { ButtonGroup } from './components/ButtonGroup/ButtonGroup.js'
|
|
@@ -611,6 +612,7 @@ export {
|
|
|
611
612
|
MultiSelectItem,
|
|
612
613
|
MultiSelectStatus,
|
|
613
614
|
MultiSelectTags,
|
|
615
|
+
MultiSelectControl,
|
|
614
616
|
useMultiSelect
|
|
615
617
|
} from './components/MultiSelect/MultiSelect.js'
|
|
616
618
|
export type {
|
|
@@ -625,6 +627,7 @@ export type {
|
|
|
625
627
|
MultiSelectItemProps,
|
|
626
628
|
MultiSelectStatusProps,
|
|
627
629
|
MultiSelectTagsProps,
|
|
630
|
+
MultiSelectControlProps,
|
|
628
631
|
MultiSelectRenderProps
|
|
629
632
|
} from './components/MultiSelect/MultiSelect.js'
|
|
630
633
|
|
|
@@ -750,7 +753,6 @@ export {
|
|
|
750
753
|
export type {
|
|
751
754
|
NavigationMenuProps,
|
|
752
755
|
NavigationMenuState,
|
|
753
|
-
NavigationMenuItemConfig,
|
|
754
756
|
NavigationMenuListProps,
|
|
755
757
|
NavigationMenuItemProps,
|
|
756
758
|
NavigationMenuTriggerProps,
|
|
@@ -770,8 +772,7 @@ export {
|
|
|
770
772
|
SidebarTrigger,
|
|
771
773
|
SidebarLabel,
|
|
772
774
|
SidebarContent,
|
|
773
|
-
useAppShell
|
|
774
|
-
useSidebar
|
|
775
|
+
useAppShell
|
|
775
776
|
} from './components/AppShell/AppShell.js'
|
|
776
777
|
export type {
|
|
777
778
|
AppShellProps,
|
|
@@ -813,5 +814,6 @@ export {
|
|
|
813
814
|
type CarouselState,
|
|
814
815
|
type CarouselViewportProps,
|
|
815
816
|
type CarouselActionProps,
|
|
817
|
+
type CarouselAutoPlayProps,
|
|
816
818
|
type CarouselIndicatorsProps
|
|
817
819
|
} from './components/Carousel/Carousel.js'
|
|
@@ -58,12 +58,14 @@ export function useComboboxPopup(
|
|
|
58
58
|
}
|
|
59
59
|
const doc = input.ownerDocument
|
|
60
60
|
const win = doc.defaultView!
|
|
61
|
+
// A multiple Combobox anchors to the field well around its chips, not to the editor alone.
|
|
62
|
+
const anchorNode = input.closest<HTMLElement>('[data-slot~="multi-select-control"]') ?? input
|
|
61
63
|
const seedWidth = () => {
|
|
62
64
|
const available =
|
|
63
65
|
(win.visualViewport?.width ?? win.innerWidth) - 2 * Math.max(0, collisionPadding)
|
|
64
66
|
node.style.setProperty(
|
|
65
67
|
'--_rad-combobox-width',
|
|
66
|
-
`${Math.min(
|
|
68
|
+
`${Math.min(anchorNode.getBoundingClientRect().width, Math.max(0, available))}px`
|
|
67
69
|
)
|
|
68
70
|
}
|
|
69
71
|
seedWidth()
|
|
@@ -73,7 +75,7 @@ export function useComboboxPopup(
|
|
|
73
75
|
seedWidth()
|
|
74
76
|
const viewport = win.visualViewport
|
|
75
77
|
const css = win.getComputedStyle(node)
|
|
76
|
-
const anchor =
|
|
78
|
+
const anchor = anchorNode.getBoundingClientRect()
|
|
77
79
|
const padding = Math.max(0, collisionPadding)
|
|
78
80
|
const list = node.querySelector<HTMLElement>('[data-slot~="combobox-listbox"]')
|
|
79
81
|
const status = node.querySelector<HTMLElement>('[data-slot~="combobox-status"]')
|
|
@@ -139,7 +141,7 @@ export function useComboboxPopup(
|
|
|
139
141
|
}
|
|
140
142
|
const observer = new win.ResizeObserver(schedule)
|
|
141
143
|
const mutations = new win.MutationObserver(schedule)
|
|
142
|
-
observer.observe(
|
|
144
|
+
observer.observe(anchorNode)
|
|
143
145
|
observer.observe(node)
|
|
144
146
|
mutations.observe(node, { childList: true, subtree: true, characterData: true })
|
|
145
147
|
doc.addEventListener('pointerdown', outside, true)
|