@justanarthur/modo-ui 2.1.0 → 2.3.0
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/blocks/desktop-shell/index.tsx +2 -1
- package/components/inputs/checkbox/index.tsx +5 -0
- package/components/inputs/combobox/index.tsx +9 -4
- package/components/inputs/radio/index.tsx +5 -0
- package/components/inputs/select/index.tsx +23 -3
- package/components/inputs/slider/comfortable.tsx +10 -4
- package/components/inputs/slider/compact.tsx +153 -71
- package/components/inputs/slider/examples.mdx +24 -0
- package/components/inputs/slider/geometry.ts +18 -6
- package/components/inputs/slider/index.tsx +30 -8
- package/components/inputs/slider/value-display.tsx +16 -9
- package/components/inputs/switch/index.tsx +5 -0
- package/components/inputs/textarea/examples.mdx +19 -0
- package/components/inputs/textarea/index.tsx +42 -5
- package/components/navigation/sidebar/sidebar-group.tsx +2 -1
- package/components/navigation/sidebar/sidebar-menu-sub.tsx +2 -1
- package/components/navigation/sidebar/sidebar-shell.tsx +2 -1
- package/components/navigation/tree/index.tsx +2 -1
- package/components/overlays/dropdown/index.tsx +50 -8
- package/components/overlays/dropdown/submenu.tsx +41 -10
- package/components/overlays/tooltip/examples.mdx +13 -0
- package/components/overlays/tooltip/index.tsx +58 -16
- package/dist/blocks/desktop-shell/index.js +10 -9
- package/dist/blocks/sidebar-app/index.js +11 -10
- package/dist/components/actions/button/index.js +2 -2
- package/dist/components/actions/copy/index.js +4 -4
- package/dist/components/containers/accordion/index.d.ts +1 -1
- package/dist/components/containers/accordion/index.js +2 -2
- package/dist/components/containers/card/index.js +3 -3
- package/dist/components/data-display/log-view/index.js +3 -3
- package/dist/components/inputs/checkbox/index.d.ts +2 -0
- package/dist/components/inputs/checkbox/index.js +1 -1
- package/dist/components/inputs/color-picker/index.js +5 -5
- package/dist/components/inputs/combobox/index.d.ts +1 -1
- package/dist/components/inputs/combobox/index.js +2 -2
- package/dist/components/inputs/date-time/date-picker/index.js +7 -7
- package/dist/components/inputs/date-time/date-range-picker/index.js +7 -7
- package/dist/components/inputs/date-time/duration-picker/index.js +7 -7
- package/dist/components/inputs/date-time/month-picker/index.js +7 -7
- package/dist/components/inputs/date-time/time-picker/index.js +7 -7
- package/dist/components/inputs/field/index.js +2 -2
- package/dist/components/inputs/file-dropzone/index.js +3 -3
- package/dist/components/inputs/key-value/index.js +3 -3
- package/dist/components/inputs/radio/index.d.ts +2 -0
- package/dist/components/inputs/radio/index.js +1 -1
- package/dist/components/inputs/search/index.js +6 -6
- package/dist/components/inputs/select/index.d.ts +22 -4
- package/dist/components/inputs/select/index.js +3 -3
- package/dist/components/inputs/slider/index.d.ts +12 -3
- package/dist/components/inputs/slider/index.js +1 -1
- package/dist/components/inputs/switch/index.d.ts +2 -0
- package/dist/components/inputs/switch/index.js +1 -1
- package/dist/components/inputs/textarea/index.d.ts +8 -1
- package/dist/components/inputs/textarea/index.js +1 -1
- package/dist/components/navigation/breadcrumb/index.js +4 -4
- package/dist/components/navigation/navigation-menu/index.js +2 -2
- package/dist/components/navigation/pagination/index.js +3 -3
- package/dist/components/navigation/sidebar/index.js +8 -7
- package/dist/components/navigation/tree/index.js +2 -1
- package/dist/components/overlays/alert-dialog/index.d.ts +3 -3
- package/dist/components/overlays/alert-dialog/index.js +5 -5
- package/dist/components/overlays/command/index.d.ts +1 -1
- package/dist/components/overlays/command/index.js +5 -5
- package/dist/components/overlays/context-menu/index.d.ts +20 -1
- package/dist/components/overlays/context-menu/index.js +4 -4
- package/dist/components/overlays/dialog/index.d.ts +3 -3
- package/dist/components/overlays/dialog/index.js +4 -4
- package/dist/components/overlays/dropdown/index.d.ts +30 -8
- package/dist/components/overlays/dropdown/index.js +3 -3
- package/dist/components/overlays/lightbox/index.js +3 -3
- package/dist/components/overlays/popover/index.d.ts +6 -6
- package/dist/components/overlays/popover/index.js +3 -3
- package/dist/components/overlays/preview-card/index.js +2 -2
- package/dist/components/overlays/sheet/index.d.ts +3 -3
- package/dist/components/overlays/sheet/index.js +5 -5
- package/dist/components/overlays/toast/index.d.ts +1 -1
- package/dist/components/overlays/toast/index.js +3 -3
- package/dist/components/overlays/tooltip/index.d.ts +35 -10
- package/dist/components/overlays/tooltip/index.js +3 -3
- package/dist/docs/index.js +9 -8
- package/dist/index.d.ts +92 -38
- package/dist/index.js +47 -46
- package/dist/lib/inert.d.ts +7 -0
- package/dist/lib/inert.js +6 -0
- package/dist/lib/overlay.d.ts +20 -13
- package/dist/lib/overlay.js +2 -1
- package/dist/lib/slot.d.ts +5 -2
- package/dist/lib/slot.js +1 -1
- package/dist/primitives/layout/resizable/index.d.ts +4 -2
- package/dist/primitives/layout/resizable/index.js +1 -1
- package/dist/primitives/systems/morph/index.js +3 -3
- package/dist/primitives/systems/motion/index.js +3 -3
- package/dist/shared/{components-s90v3jpr.js → components-01e24999.js} +60 -11
- package/dist/shared/{components-a1ms36qq.js → components-1f5624hb.js} +1 -1
- package/dist/shared/{components-9z7bq8gn.js → components-1sbnbq6a.js} +1 -1
- package/dist/shared/{components-w2at9ntm.js → components-27fatggq.js} +1 -1
- package/dist/shared/{components-fmyvz4r2.js → components-2bq4ng4d.js} +4 -4
- package/dist/shared/components-2myjk2zf.js +8 -0
- package/dist/shared/{components-hz6armxa.js → components-2tw25pk6.js} +3 -0
- package/dist/shared/{components-nhmgr5xc.js → components-2v4mmw1s.js} +10 -7
- package/dist/shared/{components-twyj2y8c.js → components-3rt5c1qt.js} +1 -1
- package/dist/shared/{components-91mmbrw3.js → components-3sb31vw5.js} +1 -1
- package/dist/shared/{components-1f3a7gmg.js → components-4fswe4kh.js} +1 -1
- package/dist/shared/{components-gsstwhtv.js → components-5vezp3e5.js} +3 -0
- package/dist/shared/{components-ee09xmkh.js → components-6g8a5nrs.js} +4 -1
- package/dist/shared/{components-h0x2pj2y.js → components-6xtntksc.js} +17 -3
- package/dist/shared/{components-1asw2ph0.js → components-7g2q2ccp.js} +1 -1
- package/dist/shared/{components-kwxye0an.js → components-7wjkag2j.js} +4 -2
- package/dist/shared/{components-vfreweq3.js → components-83jn0raj.js} +1 -1
- package/dist/shared/{components-1bnf96sr.js → components-8e0fjgm9.js} +37 -9
- package/dist/shared/{components-j79a6jqa.js → components-8ybvpebx.js} +1 -1
- package/dist/shared/{components-me742146.js → components-a3brpprb.js} +1 -1
- package/dist/shared/{components-ev0ytbqb.js → components-abqfs5fh.js} +1 -1
- package/dist/shared/{components-r5q9gdh4.js → components-agjpst9b.js} +5 -5
- package/dist/shared/{components-6rtawx8y.js → components-e52xgvd9.js} +4 -4
- package/dist/shared/{components-0cpte6s1.js → components-eebf7f9c.js} +4 -3
- package/dist/shared/{components-xa9fvd5b.js → components-etgpz4zk.js} +1 -1
- package/dist/shared/{components-b9bj65j3.js → components-ex2xtqv7.js} +6 -6
- package/dist/shared/{components-n0gbyp5a.js → components-fjg4j430.js} +5 -5
- package/dist/shared/{components-280grw6q.js → components-fxw1122w.js} +1 -1
- package/dist/shared/{components-y8m64zdw.js → components-gnsvnejm.js} +1 -1
- package/dist/shared/{components-7mj5wsv3.js → components-gr82tz50.js} +21 -3
- package/dist/shared/{components-22h8dvt1.js → components-k25zw9g8.js} +3 -3
- package/dist/shared/{components-a1mwqxsv.js → components-k2gg1agj.js} +3 -3
- package/dist/shared/{components-wx1dcp2n.js → components-kz6ak6kj.js} +1 -1
- package/dist/shared/{components-yf2gtq68.js → components-m7d7r3r8.js} +8 -5
- package/dist/shared/{components-62510420.js → components-mvwf8ckh.js} +4 -4
- package/dist/shared/{components-2m2hg11x.js → components-nh05qz8b.js} +3 -3
- package/dist/shared/{components-77gxngmc.js → components-nred2e6g.js} +5 -5
- package/dist/shared/{components-3rvrdsa9.js → components-s2pnh8h9.js} +1 -1
- package/dist/shared/{components-xnkc892z.js → components-t4j0r23n.js} +1 -1
- package/dist/shared/{components-rgng034x.js → components-tcm3k3wj.js} +24 -3
- package/dist/shared/{components-p32aqk3q.js → components-vx286kq7.js} +110 -73
- package/dist/shared/{components-b2kjsn1s.js → components-vykcfb5r.js} +1 -1
- package/dist/shared/{components-hcftn5r8.js → components-x5v7e0fz.js} +3 -0
- package/dist/shared/{components-0h2mng6m.js → components-ycwhrqe1.js} +1 -1
- package/dist/shared/{components-chda6b23.js → components-ypxst3cn.js} +33 -4
- package/dist/shared/{components-14wzcym0.js → components-z87sanbc.js} +5 -5
- package/dist/shared/{components-fqsgd07c.js → components-zv63s4fh.js} +2 -2
- package/dist/styles.css +5 -1
- package/lib/inert.ts +15 -0
- package/lib/overlay.tsx +49 -5
- package/lib/slot.tsx +9 -3
- package/package.json +6 -1
- package/primitives/layout/resizable/index.tsx +35 -7
|
@@ -56,6 +56,8 @@ interface SwitchProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
56
56
|
disabled?: boolean
|
|
57
57
|
/** Submits the switch under this name in a form, while on. */
|
|
58
58
|
name?: string
|
|
59
|
+
/** Must be on before its form submits: the browser's validation (and an enclosing Field's) reports it missing. Defaults to `false`. */
|
|
60
|
+
required?: boolean
|
|
59
61
|
/** The value submitted while on. Defaults to `"on"`. */
|
|
60
62
|
value?: string
|
|
61
63
|
/** Transition for the thumb's slide and hover/press stretch. Defaults to the `spring.moderate` motion token. */
|
|
@@ -147,6 +149,7 @@ const Switch = forwardRef<HTMLDivElement, SwitchProps>(
|
|
|
147
149
|
onCheckedChange,
|
|
148
150
|
disabled = false,
|
|
149
151
|
name,
|
|
152
|
+
required,
|
|
150
153
|
value,
|
|
151
154
|
thumbTransition,
|
|
152
155
|
size,
|
|
@@ -305,6 +308,7 @@ const Switch = forwardRef<HTMLDivElement, SwitchProps>(
|
|
|
305
308
|
toggle()
|
|
306
309
|
}}
|
|
307
310
|
name={name}
|
|
311
|
+
required={required}
|
|
308
312
|
value={value}
|
|
309
313
|
disabled={disabled}
|
|
310
314
|
onPointerEnter={e => {
|
|
@@ -354,6 +358,7 @@ const Switch = forwardRef<HTMLDivElement, SwitchProps>(
|
|
|
354
358
|
<SwitchPrimitive.Root
|
|
355
359
|
checked={isChecked}
|
|
356
360
|
name={name}
|
|
361
|
+
required={required}
|
|
357
362
|
value={value}
|
|
358
363
|
aria-labelledby={labelId}
|
|
359
364
|
aria-describedby={description ? descriptionId : undefined}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Textarea from './index'
|
|
2
|
+
import Button from '../../actions/button'
|
|
2
3
|
import Input, { InputGroup, Label } from '../input'
|
|
3
4
|
|
|
4
5
|
# Basic
|
|
@@ -86,3 +87,21 @@ Inside `InputGroup.Field` the textarea joins the group's hover, and the field's
|
|
|
86
87
|
<div className="w-72 max-w-full">
|
|
87
88
|
<Textarea defaultValue="Read only for now" disabled />
|
|
88
89
|
</div>
|
|
90
|
+
|
|
91
|
+
# Uncontrolled
|
|
92
|
+
|
|
93
|
+
With neither `value` nor `onValueChange` the DOM holds the text, so `ref` is the real `<textarea>`: `defaultValue`, `ref.current.value = ''` and a native form reset behave as on any textarea. Type, grow the box, then reset: the text goes back to its default and the box re-fits.
|
|
94
|
+
|
|
95
|
+
<form className="flex flex-col items-start gap-2 w-72 max-w-full">
|
|
96
|
+
<Textarea name="note" aria-label="Note" defaultValue={'First line\nSecond line\nThird line\nFourth line'} />
|
|
97
|
+
<Button type="reset" variant="ghost">Reset</Button>
|
|
98
|
+
</form>
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
const ref = useRef<HTMLTextAreaElement>(null)
|
|
102
|
+
|
|
103
|
+
<Textarea ref={ref} name="note" defaultValue="Hello" />
|
|
104
|
+
|
|
105
|
+
ref.current.value // what was typed
|
|
106
|
+
ref.current.value = '' // clears it
|
|
107
|
+
```
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
'use client'
|
|
7
7
|
|
|
8
8
|
import { Field } from '@base-ui/react/field'
|
|
9
|
-
import { forwardRef, type Ref, type TextareaHTMLAttributes, useRef } from 'react'
|
|
9
|
+
import { forwardRef, type Ref, type TextareaHTMLAttributes, useEffect, useRef } from 'react'
|
|
10
10
|
import { focusControlOnPress, useFieldBox } from '../../../lib/field-box'
|
|
11
11
|
import type { FieldVariant } from '../../../lib/field-classes'
|
|
12
12
|
import { mergeRefs } from '../../../lib/merge-refs'
|
|
@@ -23,7 +23,7 @@ interface TextareaProps
|
|
|
23
23
|
value?: string
|
|
24
24
|
/** Initial value when uncontrolled. Defaults to `''`. */
|
|
25
25
|
defaultValue?: string
|
|
26
|
-
/** Called with the new value on every change. */
|
|
26
|
+
/** Called with the new value on every change. With neither `value` nor `onValueChange` the textarea keeps its text in the DOM, for forms that read it through a `ref`. */
|
|
27
27
|
onValueChange?: (value: string) => void
|
|
28
28
|
/** Rows shown when empty; the box never gets shorter. Defaults to `3`. */
|
|
29
29
|
minRows?: number
|
|
@@ -66,6 +66,13 @@ const PADDING_Y: Record<SizeVariant, string> = {
|
|
|
66
66
|
* or put it in an `InputGroup.Field` to label it, join the group's hover and
|
|
67
67
|
* take the field's error.
|
|
68
68
|
*
|
|
69
|
+
* With neither `value` nor `onValueChange` it is a plain uncontrolled
|
|
70
|
+
* `<textarea>`: the DOM holds the text, `ref` is the real element, and
|
|
71
|
+
* `defaultValue`, `ref.current.value = ''` and a native `form.reset()` all
|
|
72
|
+
* behave as on any textarea (the box re-fits after each), which is what a
|
|
73
|
+
* form library reading fields through refs (`register()`) needs. Pass it
|
|
74
|
+
* `name`, `ref` and `defaultValue`.
|
|
75
|
+
*
|
|
69
76
|
* @example {@include ./examples.mdx}
|
|
70
77
|
*/
|
|
71
78
|
const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
@@ -88,11 +95,42 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
88
95
|
ref,
|
|
89
96
|
) => {
|
|
90
97
|
const [value, setValue] = useControllableState(valueProp, defaultValue, onValueChange)
|
|
98
|
+
const domHeld = valueProp === undefined && onValueChange === undefined
|
|
91
99
|
|
|
92
100
|
const textareaRef = useRef<HTMLTextAreaElement | null>(null)
|
|
93
101
|
const box = useFieldBox({ variant, invalid, disabled, readOnly, required, size })
|
|
94
102
|
|
|
95
|
-
useAutosizeTextarea(textareaRef, { minRows, maxRows }, [value, box.size.variant])
|
|
103
|
+
const resize = useAutosizeTextarea(textareaRef, { minRows, maxRows }, [value, box.size.variant])
|
|
104
|
+
|
|
105
|
+
// DOM-held text changes without a render: re-fit when code assigns `value` (the setter is
|
|
106
|
+
// wrapped on the element, over React's own value tracker) and once a form reset has put the
|
|
107
|
+
// default back.
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
const el = textareaRef.current
|
|
110
|
+
if (!domHeld || !el) return
|
|
111
|
+
const own = Object.getOwnPropertyDescriptor(el, 'value')
|
|
112
|
+
const base = own ?? Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype, 'value')
|
|
113
|
+
const set = base?.set
|
|
114
|
+
if (set) {
|
|
115
|
+
Object.defineProperty(el, 'value', {
|
|
116
|
+
configurable: true,
|
|
117
|
+
enumerable: base.enumerable,
|
|
118
|
+
get: base.get,
|
|
119
|
+
set(next: string) {
|
|
120
|
+
set.call(this, next)
|
|
121
|
+
resize()
|
|
122
|
+
},
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
const form = el.form
|
|
126
|
+
const onReset = () => setTimeout(resize)
|
|
127
|
+
form?.addEventListener('reset', onReset)
|
|
128
|
+
return () => {
|
|
129
|
+
form?.removeEventListener('reset', onReset)
|
|
130
|
+
if (own) Object.defineProperty(el, 'value', own)
|
|
131
|
+
else if (set) Reflect.deleteProperty(el, 'value')
|
|
132
|
+
}
|
|
133
|
+
}, [domHeld, resize])
|
|
96
134
|
|
|
97
135
|
return (
|
|
98
136
|
// biome-ignore lint/a11y/noStaticElementInteractions: the textarea is the focusable control; the box only forwards pointer focus from its padding.
|
|
@@ -105,8 +143,7 @@ const Textarea = forwardRef<HTMLTextAreaElement, TextareaProps>(
|
|
|
105
143
|
<Field.Control
|
|
106
144
|
ref={mergeRefs(textareaRef, ref) as Ref<HTMLElement>}
|
|
107
145
|
render={<textarea rows={minRows} {...props} />}
|
|
108
|
-
|
|
109
|
-
onChange={e => setValue(e.target.value)}
|
|
146
|
+
{...(domHeld ? { defaultValue, onChange: resize } : { value, onChange: e => setValue(e.target.value) })}
|
|
110
147
|
disabled={box.disabled}
|
|
111
148
|
readOnly={box.readOnly}
|
|
112
149
|
required={box.required}
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
useState,
|
|
26
26
|
} from 'react'
|
|
27
27
|
import { useIcon } from '../../../lib/icon-context'
|
|
28
|
+
import { inertProps } from '../../../lib/inert'
|
|
28
29
|
import { useShape } from '../../../lib/shape-context'
|
|
29
30
|
import { useSize } from '../../../lib/size-context'
|
|
30
31
|
import { resolveSlotTemplate, slotElement } from '../../../lib/slot'
|
|
@@ -103,7 +104,7 @@ const SidebarGroup = forwardRef<HTMLDivElement, SidebarGroupProps>(
|
|
|
103
104
|
if (open) setSettled(true)
|
|
104
105
|
}}
|
|
105
106
|
>
|
|
106
|
-
<div ref={fold.contentRef} className="flex w-full min-w-0 flex-col" {...(open
|
|
107
|
+
<div ref={fold.contentRef} className="flex w-full min-w-0 flex-col" {...inertProps(!open)}>
|
|
107
108
|
{tail.filter(k => !isHeaderAction(k))}
|
|
108
109
|
</div>
|
|
109
110
|
</motion.div>
|
|
@@ -19,6 +19,7 @@ import {
|
|
|
19
19
|
useRef,
|
|
20
20
|
} from 'react'
|
|
21
21
|
import type { IconComponent } from '../../../lib/icon-context'
|
|
22
|
+
import { inertProps } from '../../../lib/inert'
|
|
22
23
|
import { mergeRefs, useMergeRefs } from '../../../lib/merge-refs'
|
|
23
24
|
import { useShape } from '../../../lib/shape-context'
|
|
24
25
|
import { type SizeVariant, useSize } from '../../../lib/size-context'
|
|
@@ -61,7 +62,7 @@ const SidebarMenuSub = forwardRef<HTMLUListElement, SidebarMenuSubProps>(
|
|
|
61
62
|
data-sidebar="menu-sub"
|
|
62
63
|
data-state={open ? 'open' : 'closed'}
|
|
63
64
|
aria-hidden={open ? undefined : true}
|
|
64
|
-
{...(open
|
|
65
|
+
{...inertProps(!open)}
|
|
65
66
|
className={cn(
|
|
66
67
|
// A margin, not a translate, so the measured rects include it:
|
|
67
68
|
// 15px + the 1px border + pl-2 + the row's pl-2 lands the label on
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
import { motion } from 'motion/react'
|
|
11
11
|
import { type CSSProperties, forwardRef, type HTMLAttributes, useEffect, useRef, useState } from 'react'
|
|
12
|
+
import { inertProps } from '../../../lib/inert'
|
|
12
13
|
import { useMergeRefs } from '../../../lib/merge-refs'
|
|
13
14
|
import { useReduceMotion } from '../../../lib/reduced-motion'
|
|
14
15
|
import { useShape } from '../../../lib/shape-context'
|
|
@@ -130,7 +131,7 @@ const SidebarShell = forwardRef<HTMLDivElement, SidebarShellProps>(
|
|
|
130
131
|
animate={{ x: open ? '0%' : side === 'left' ? '-100%' : '100%' }}
|
|
131
132
|
transition={transition}
|
|
132
133
|
// Mid-drag the rail inside holds the pointer through a collapse preview.
|
|
133
|
-
{...(open
|
|
134
|
+
{...inertProps(!open && !isResizing)}
|
|
134
135
|
>
|
|
135
136
|
{variant === 'floating' ? (
|
|
136
137
|
<div
|
|
@@ -24,6 +24,7 @@ import { FluidHoverHighlight } from '../../../lib/fluid-hover-highlight'
|
|
|
24
24
|
import { FocusRing } from '../../../lib/focus-ring'
|
|
25
25
|
import { GooIndicator } from '../../../lib/goo-indicator'
|
|
26
26
|
import { type IconComponent, useIcon } from '../../../lib/icon-context'
|
|
27
|
+
import { inertProps } from '../../../lib/inert'
|
|
27
28
|
import { useReduceMotion } from '../../../lib/reduced-motion'
|
|
28
29
|
import { useShape } from '../../../lib/shape-context'
|
|
29
30
|
import { type SizeVariant, useSize } from '../../../lib/size-context'
|
|
@@ -127,7 +128,7 @@ function TreeGroup({ open, items, depth }: { open: boolean; items: TreeItem[]; d
|
|
|
127
128
|
ref={ref}
|
|
128
129
|
role="group"
|
|
129
130
|
data-tree-group={open ? 'open' : 'closed'}
|
|
130
|
-
{...(open
|
|
131
|
+
{...inertProps(!open)}
|
|
131
132
|
className={cn('flex flex-col border-l border-border pl-[var(--space-1)]', GUIDE[size.variant])}
|
|
132
133
|
>
|
|
133
134
|
{items.map(item => (
|
|
@@ -21,7 +21,13 @@ import { FluidHoverHighlight } from '../../../lib/fluid-hover-highlight'
|
|
|
21
21
|
import { FocusRing } from '../../../lib/focus-ring'
|
|
22
22
|
import { GooIndicator } from '../../../lib/goo-indicator'
|
|
23
23
|
import { useMergeRefs } from '../../../lib/merge-refs'
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
type AnchorProps,
|
|
26
|
+
type CollisionProps,
|
|
27
|
+
OverlayContext,
|
|
28
|
+
positionerProps,
|
|
29
|
+
useOverlayRoot,
|
|
30
|
+
} from '../../../lib/overlay'
|
|
25
31
|
import { isDisabledRow, POPUP_SHAPE } from '../../../lib/popup'
|
|
26
32
|
import { PopupSeparator } from '../../../lib/popup-rows'
|
|
27
33
|
import { useRowGroup } from '../../../lib/row-group'
|
|
@@ -156,10 +162,11 @@ type DropdownComponent = ForwardRefExoticComponent<DropdownProps & RefAttributes
|
|
|
156
162
|
*
|
|
157
163
|
* Statics:
|
|
158
164
|
* - `Dropdown.Menu` — the popup root: `open`, `defaultOpen`, `onOpenChange`
|
|
159
|
-
* (with Base UI's details: `reason`, `cancel()`), `disabled`, `size`.
|
|
165
|
+
* (with Base UI's details: `reason`, `cancel()`), `disabled`, `modal`, `size`.
|
|
160
166
|
* - `Dropdown.Trigger` — `render` or `asChild`.
|
|
161
167
|
* - `Dropdown.Content` — the popup panel: the selection props above, `side`,
|
|
162
|
-
* `align`, `sideOffset`, `
|
|
168
|
+
* `align`, `sideOffset`, `alignOffset`, `collisionPadding`,
|
|
169
|
+
* `collisionBoundary`, `positionerClassName`, `container`, `keepMounted`, `initialFocus`,
|
|
163
170
|
* `finalFocus` and the morph options `from`, `effect`, `hideSource`, `tier`.
|
|
164
171
|
* - `Dropdown.Item` — a row: `label` or `children`, `textValue`, `icon`,
|
|
165
172
|
* `index`, `inset`, `checked`, `onSelect(event)` (`preventDefault()` keeps
|
|
@@ -294,18 +301,27 @@ interface DropdownMenuProps {
|
|
|
294
301
|
onOpenChange?: (open: boolean, details: DropdownOpenChangeDetails) => void
|
|
295
302
|
/** Disables the menu. Defaults to `false`. */
|
|
296
303
|
disabled?: boolean
|
|
304
|
+
/** Locks the page scroll while the menu is open and keeps the pointer off everything outside it. Non-modal, the page keeps scrolling and the popup follows its trigger. Defaults to `false`. */
|
|
305
|
+
modal?: boolean
|
|
297
306
|
/** Pins trigger-side content and the portalled popup rows to one step of the size ladder (default 36px, compact 28px — see Sizes). Omitted, they follow the surrounding SizeProvider. */
|
|
298
307
|
size?: SizeVariant
|
|
299
308
|
}
|
|
300
309
|
|
|
301
|
-
function DropdownMenu({
|
|
310
|
+
function DropdownMenu({
|
|
311
|
+
children,
|
|
312
|
+
open,
|
|
313
|
+
defaultOpen,
|
|
314
|
+
onOpenChange,
|
|
315
|
+
disabled = false,
|
|
316
|
+
modal = false,
|
|
317
|
+
size,
|
|
318
|
+
}: DropdownMenuProps) {
|
|
302
319
|
// Reported here rather than through the root's state, so the handler gets the details and can cancel.
|
|
303
320
|
const root = useOverlayRoot({ open, defaultOpen })
|
|
304
321
|
|
|
305
322
|
return (
|
|
306
323
|
<SizeScope size={size}>
|
|
307
324
|
<OverlayContext.Provider value={root.state}>
|
|
308
|
-
{/* Non-modal: the page keeps scrolling and the popup follows its trigger. */}
|
|
309
325
|
<Menu.Root
|
|
310
326
|
open={root.open}
|
|
311
327
|
onOpenChange={(next, details) => {
|
|
@@ -313,7 +329,7 @@ function DropdownMenu({ children, open, defaultOpen, onOpenChange, disabled = fa
|
|
|
313
329
|
if (!details.isCanceled) root.onOpenChange(next, details)
|
|
314
330
|
}}
|
|
315
331
|
disabled={disabled}
|
|
316
|
-
modal={
|
|
332
|
+
modal={modal}
|
|
317
333
|
>
|
|
318
334
|
{children}
|
|
319
335
|
</Menu.Root>
|
|
@@ -339,6 +355,7 @@ interface DropdownContentProps
|
|
|
339
355
|
extends PanelSelectionProps,
|
|
340
356
|
MenuFocusProps,
|
|
341
357
|
AnchorProps,
|
|
358
|
+
CollisionProps,
|
|
342
359
|
MorphProps,
|
|
343
360
|
Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
344
361
|
/** `Dropdown.Item` rows, plus `Dropdown.Label`, `Dropdown.Separator`, `Dropdown.Search`, `Dropdown.Empty`. */
|
|
@@ -350,12 +367,37 @@ interface DropdownContentProps
|
|
|
350
367
|
}
|
|
351
368
|
|
|
352
369
|
const DropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(
|
|
353
|
-
(
|
|
370
|
+
(
|
|
371
|
+
{
|
|
372
|
+
side,
|
|
373
|
+
align,
|
|
374
|
+
sideOffset,
|
|
375
|
+
alignOffset,
|
|
376
|
+
collisionPadding,
|
|
377
|
+
collisionBoundary,
|
|
378
|
+
positionerClassName,
|
|
379
|
+
effect,
|
|
380
|
+
hideSource,
|
|
381
|
+
className,
|
|
382
|
+
...props
|
|
383
|
+
},
|
|
384
|
+
ref,
|
|
385
|
+
) => (
|
|
354
386
|
<MenuPopup
|
|
355
387
|
ref={ref}
|
|
356
388
|
part="Dropdown.Content"
|
|
357
389
|
positioner={positionerProps(
|
|
358
|
-
{
|
|
390
|
+
{
|
|
391
|
+
side,
|
|
392
|
+
align,
|
|
393
|
+
sideOffset,
|
|
394
|
+
alignOffset,
|
|
395
|
+
collisionPadding,
|
|
396
|
+
collisionBoundary,
|
|
397
|
+
positionerClassName,
|
|
398
|
+
effect,
|
|
399
|
+
hideSource,
|
|
400
|
+
},
|
|
359
401
|
{ side: 'bottom', align: 'start', sideOffset: 6 },
|
|
360
402
|
)}
|
|
361
403
|
focusFirstRow
|
|
@@ -10,7 +10,14 @@
|
|
|
10
10
|
import { Menu, type MenuRootChangeEventDetails } from '@base-ui/react/menu'
|
|
11
11
|
import { forwardRef, type HTMLAttributes, type ReactNode, useMemo } from 'react'
|
|
12
12
|
import { useIcon } from '../../../lib/icon-context'
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
type AnchorProps,
|
|
15
|
+
type CollisionProps,
|
|
16
|
+
OverlayContext,
|
|
17
|
+
positionerProps,
|
|
18
|
+
useOverlay,
|
|
19
|
+
useOverlayRoot,
|
|
20
|
+
} from '../../../lib/overlay'
|
|
14
21
|
import { useSize } from '../../../lib/size-context'
|
|
15
22
|
import type { MorphProps } from '../../../lib/use-morph'
|
|
16
23
|
import { cn } from '../../../lib/utils'
|
|
@@ -124,6 +131,7 @@ interface DropdownSubContentProps
|
|
|
124
131
|
extends PanelSelectionProps,
|
|
125
132
|
MenuFocusProps,
|
|
126
133
|
AnchorProps,
|
|
134
|
+
CollisionProps,
|
|
127
135
|
MorphProps,
|
|
128
136
|
Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
129
137
|
/** The submenu's rows: the same parts as `Dropdown.Content`, another `Dropdown.Sub` included. */
|
|
@@ -134,6 +142,8 @@ interface DropdownSubContentProps
|
|
|
134
142
|
align?: AnchorProps['align']
|
|
135
143
|
/** Gap to the parent menu in px, the length of the goo neck. Defaults to `8`. */
|
|
136
144
|
sideOffset?: number
|
|
145
|
+
/** Shift along the aligned edge in px. Defaults to `-4`: the panel's padding, so its first row lines up with the trigger row. */
|
|
146
|
+
alignOffset?: CollisionProps['alignOffset']
|
|
137
147
|
/** Extra classes for the submenu surface: it is 14rem wide by default. */
|
|
138
148
|
className?: string
|
|
139
149
|
/** Keep the submenu mounted (hidden) while closed, so its rows keep their own state across opens. A kept parent keeps it too. Defaults to `false`. */
|
|
@@ -142,18 +152,39 @@ interface DropdownSubContentProps
|
|
|
142
152
|
|
|
143
153
|
/** The submenu's panel, lifted above the menu it came from and grown out of its trigger row. */
|
|
144
154
|
const DropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(
|
|
145
|
-
(
|
|
155
|
+
(
|
|
156
|
+
{
|
|
157
|
+
side,
|
|
158
|
+
align,
|
|
159
|
+
sideOffset,
|
|
160
|
+
alignOffset = -4,
|
|
161
|
+
collisionPadding,
|
|
162
|
+
collisionBoundary,
|
|
163
|
+
positionerClassName,
|
|
164
|
+
effect,
|
|
165
|
+
hideSource,
|
|
166
|
+
className,
|
|
167
|
+
...props
|
|
168
|
+
},
|
|
169
|
+
ref,
|
|
170
|
+
) => (
|
|
146
171
|
<MenuPopup
|
|
147
172
|
ref={ref}
|
|
148
173
|
part="Dropdown.SubContent"
|
|
149
|
-
positioner={
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
174
|
+
positioner={positionerProps(
|
|
175
|
+
{
|
|
176
|
+
side,
|
|
177
|
+
align,
|
|
178
|
+
sideOffset,
|
|
179
|
+
alignOffset,
|
|
180
|
+
collisionPadding,
|
|
181
|
+
collisionBoundary,
|
|
182
|
+
positionerClassName,
|
|
183
|
+
effect,
|
|
184
|
+
hideSource,
|
|
185
|
+
},
|
|
186
|
+
{ side: 'right', align: 'start', sideOffset: 8 },
|
|
187
|
+
)}
|
|
157
188
|
focusFirstRow={false}
|
|
158
189
|
effect={effect}
|
|
159
190
|
hideSource={hideSource}
|
|
@@ -98,3 +98,16 @@ tooltips skip it, and the morph: the next label shows in place.
|
|
|
98
98
|
</Tooltip>
|
|
99
99
|
</div>
|
|
100
100
|
</Tooltip.Provider>
|
|
101
|
+
|
|
102
|
+
# Close delay
|
|
103
|
+
|
|
104
|
+
`closeDelay` keeps the label up for a moment after the pointer leaves. Set it per tooltip or for a whole `Tooltip.Provider`.
|
|
105
|
+
|
|
106
|
+
<div className="flex flex-wrap gap-3">
|
|
107
|
+
<Tooltip content="Closes at once">
|
|
108
|
+
<Button variant="secondary">Default</Button>
|
|
109
|
+
</Tooltip>
|
|
110
|
+
<Tooltip content="Lingers for 500ms" closeDelay={500}>
|
|
111
|
+
<Button variant="secondary">500ms close delay</Button>
|
|
112
|
+
</Tooltip>
|
|
113
|
+
</div>
|
|
@@ -28,6 +28,7 @@ import { useMergeRefs } from '../../../lib/merge-refs'
|
|
|
28
28
|
import { MorphSurface } from '../../../lib/morph-layers'
|
|
29
29
|
import {
|
|
30
30
|
type Align,
|
|
31
|
+
type CollisionProps,
|
|
31
32
|
PortalContainer,
|
|
32
33
|
positionerProps,
|
|
33
34
|
type Side,
|
|
@@ -59,6 +60,10 @@ interface TooltipProviderProps {
|
|
|
59
60
|
delayDuration?: number
|
|
60
61
|
/** After a tooltip closes, adjacent tooltips opened within this window skip the hover delay, in ms. Defaults to `300`. */
|
|
61
62
|
skipDelayDuration?: number
|
|
63
|
+
/** Same as `skipDelayDuration` (Base UI's name); `timeout` wins when both are set. */
|
|
64
|
+
timeout?: number
|
|
65
|
+
/** Delay before tooltips close once the pointer leaves, in ms. Defaults to `0`. */
|
|
66
|
+
closeDelay?: number
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
/**
|
|
@@ -66,10 +71,21 @@ interface TooltipProviderProps {
|
|
|
66
71
|
* shows its tooltip at once instead of re-waiting the delay. Wrap once at
|
|
67
72
|
* the app or section level; a bare Tooltip still works without it.
|
|
68
73
|
*/
|
|
69
|
-
function TooltipProvider({
|
|
74
|
+
function TooltipProvider({
|
|
75
|
+
children,
|
|
76
|
+
delay,
|
|
77
|
+
delayDuration,
|
|
78
|
+
skipDelayDuration = 300,
|
|
79
|
+
timeout,
|
|
80
|
+
closeDelay,
|
|
81
|
+
}: TooltipProviderProps) {
|
|
70
82
|
return (
|
|
71
83
|
<TooltipGroupContext.Provider value={true}>
|
|
72
|
-
<TooltipPrimitive.Provider
|
|
84
|
+
<TooltipPrimitive.Provider
|
|
85
|
+
delay={delay ?? delayDuration ?? DEFAULT_DELAY}
|
|
86
|
+
timeout={timeout ?? skipDelayDuration}
|
|
87
|
+
closeDelay={closeDelay}
|
|
88
|
+
>
|
|
73
89
|
{children}
|
|
74
90
|
</TooltipPrimitive.Provider>
|
|
75
91
|
</TooltipGroupContext.Provider>
|
|
@@ -85,6 +101,7 @@ interface TooltipState {
|
|
|
85
101
|
// Set when Base UI closed this tooltip to hand off to a grouped neighbour.
|
|
86
102
|
handedOff: MutableRefObject<boolean>
|
|
87
103
|
delayDuration?: number
|
|
104
|
+
closeDelay?: number
|
|
88
105
|
followCursor?: 'x' | 'y'
|
|
89
106
|
followOffset: MotionValue<number>
|
|
90
107
|
}
|
|
@@ -102,6 +119,7 @@ interface TooltipRootProps {
|
|
|
102
119
|
defaultOpen?: boolean
|
|
103
120
|
onOpenChange?: (open: boolean) => void
|
|
104
121
|
delayDuration?: number
|
|
122
|
+
closeDelay?: number
|
|
105
123
|
followCursor?: 'x' | 'y'
|
|
106
124
|
children?: ReactNode
|
|
107
125
|
}
|
|
@@ -111,6 +129,7 @@ function TooltipRoot({
|
|
|
111
129
|
defaultOpen,
|
|
112
130
|
onOpenChange,
|
|
113
131
|
delayDuration,
|
|
132
|
+
closeDelay,
|
|
114
133
|
followCursor,
|
|
115
134
|
children,
|
|
116
135
|
}: TooltipRootProps) {
|
|
@@ -129,8 +148,8 @@ function TooltipRoot({
|
|
|
129
148
|
}, [held, followCursor, followOffset])
|
|
130
149
|
|
|
131
150
|
const state = useMemo<TooltipState>(
|
|
132
|
-
() => ({ open, origin: root.state.origin, handedOff, delayDuration, followCursor, followOffset }),
|
|
133
|
-
[open, root.state.origin, delayDuration, followCursor, followOffset],
|
|
151
|
+
() => ({ open, origin: root.state.origin, handedOff, delayDuration, closeDelay, followCursor, followOffset }),
|
|
152
|
+
[open, root.state.origin, delayDuration, closeDelay, followCursor, followOffset],
|
|
134
153
|
)
|
|
135
154
|
|
|
136
155
|
const tooltip = (
|
|
@@ -159,7 +178,7 @@ type TooltipTriggerProps = SlotProps
|
|
|
159
178
|
|
|
160
179
|
const TooltipTrigger = forwardRef<HTMLButtonElement, TooltipTriggerProps>(
|
|
161
180
|
({ render, asChild, children, onPointerMove, ...props }, ref) => {
|
|
162
|
-
const { delayDuration, followCursor, followOffset } = useTooltipState('Tooltip.Trigger')
|
|
181
|
+
const { delayDuration, closeDelay, followCursor, followOffset } = useTooltipState('Tooltip.Trigger')
|
|
163
182
|
const el = slotRender(render, asChild, children)
|
|
164
183
|
|
|
165
184
|
const follow = (event: PointerEvent<HTMLButtonElement>) => {
|
|
@@ -172,8 +191,14 @@ const TooltipTrigger = forwardRef<HTMLButtonElement, TooltipTriggerProps>(
|
|
|
172
191
|
)
|
|
173
192
|
}
|
|
174
193
|
|
|
175
|
-
// Left undefined, the
|
|
176
|
-
const shared = {
|
|
194
|
+
// Left undefined, the delays come from the provider.
|
|
195
|
+
const shared = {
|
|
196
|
+
ref,
|
|
197
|
+
delay: delayDuration,
|
|
198
|
+
closeDelay,
|
|
199
|
+
onPointerMove: followCursor ? follow : onPointerMove,
|
|
200
|
+
...props,
|
|
201
|
+
}
|
|
177
202
|
return el ? (
|
|
178
203
|
<TooltipPrimitive.Trigger {...shared} render={el} />
|
|
179
204
|
) : (
|
|
@@ -183,7 +208,7 @@ const TooltipTrigger = forwardRef<HTMLButtonElement, TooltipTriggerProps>(
|
|
|
183
208
|
)
|
|
184
209
|
TooltipTrigger.displayName = 'TooltipTrigger'
|
|
185
210
|
|
|
186
|
-
interface TooltipContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className'> {
|
|
211
|
+
interface TooltipContentProps extends CollisionProps, Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'className'> {
|
|
187
212
|
/** The label. */
|
|
188
213
|
children?: ReactNode
|
|
189
214
|
/** The element the label renders as, inside the inverted surface; `children` go inside it. */
|
|
@@ -200,7 +225,7 @@ interface TooltipContentProps extends Omit<HTMLAttributes<HTMLDivElement>, 'chil
|
|
|
200
225
|
container?: HTMLElement | null
|
|
201
226
|
/** Classes for the label's surface. */
|
|
202
227
|
className?: string
|
|
203
|
-
/**
|
|
228
|
+
/** Same as `positionerClassName`: extra classes for the portalled positioner element, where a z utility lifts the whole tooltip above other fixed layers (default `z-50`). */
|
|
204
229
|
contentClassName?: string
|
|
205
230
|
/** Where the label grows from (see Morph): the trigger, the pointer, its own center, a viewport edge, or a ref to any element. Defaults to `'trigger'`. */
|
|
206
231
|
from?: MorphFrom
|
|
@@ -219,6 +244,10 @@ const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
|
219
244
|
side = 'top',
|
|
220
245
|
align,
|
|
221
246
|
sideOffset = 8,
|
|
247
|
+
alignOffset,
|
|
248
|
+
collisionPadding,
|
|
249
|
+
collisionBoundary,
|
|
250
|
+
positionerClassName,
|
|
222
251
|
container,
|
|
223
252
|
className,
|
|
224
253
|
contentClassName,
|
|
@@ -241,7 +270,7 @@ const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
|
241
270
|
})
|
|
242
271
|
const popupRef = useMergeRefs(ref, morph.popupRef)
|
|
243
272
|
const positioner = positionerProps(
|
|
244
|
-
{ side, align, sideOffset, effect },
|
|
273
|
+
{ side, align, sideOffset, alignOffset, collisionPadding, collisionBoundary, positionerClassName, effect },
|
|
245
274
|
{ side: 'top', align: 'center', sideOffset: 8 },
|
|
246
275
|
)
|
|
247
276
|
const label = render
|
|
@@ -280,7 +309,7 @@ const TooltipContent = forwardRef<HTMLDivElement, TooltipContentProps>(
|
|
|
280
309
|
)
|
|
281
310
|
TooltipContent.displayName = 'TooltipContent'
|
|
282
311
|
|
|
283
|
-
interface TooltipProps {
|
|
312
|
+
interface TooltipProps extends CollisionProps {
|
|
284
313
|
/** The content displayed inside the tooltip. Leave it out to use `Tooltip` as the root of a compound tooltip (`Tooltip.Trigger` + `Tooltip.Content` inside). */
|
|
285
314
|
content?: ReactNode
|
|
286
315
|
/** The trigger element, which must accept a ref; or, without `content`, the compound parts. */
|
|
@@ -297,9 +326,11 @@ interface TooltipProps {
|
|
|
297
326
|
delay?: number
|
|
298
327
|
/** Same as `delay` (Radix's name); `delay` wins when both are set. */
|
|
299
328
|
delayDuration?: number
|
|
329
|
+
/** Delay before this tooltip closes once the pointer leaves, in ms. Defaults to `0`, or to the ambient `TooltipProvider`'s `closeDelay`. */
|
|
330
|
+
closeDelay?: number
|
|
300
331
|
/** Additional classes applied to the tooltip content container. */
|
|
301
332
|
className?: string
|
|
302
|
-
/**
|
|
333
|
+
/** Same as `positionerClassName`: extra classes for the portalled positioner element, where a z utility lifts the whole tooltip above other fixed layers (default `z-50`). */
|
|
303
334
|
contentClassName?: string
|
|
304
335
|
/** Controlled open state: `true` holds it open, `false` holds it closed, `undefined` leaves it to hover and focus. */
|
|
305
336
|
open?: boolean
|
|
@@ -331,20 +362,22 @@ interface TooltipProps {
|
|
|
331
362
|
* Leave `content` out and `Tooltip` is the root of a compound tooltip: a
|
|
332
363
|
* `Tooltip.Trigger` and a `Tooltip.Content` inside it. The root keeps the
|
|
333
364
|
* state props (`open`, `defaultOpen`, `onOpenChange`, `delay` or `delayDuration`,
|
|
334
|
-
* `followCursor`); placement and the morph move to the content. The label
|
|
365
|
+
* `closeDelay`, `followCursor`); placement and the morph move to the content. The label
|
|
335
366
|
* looks and moves the same either way.
|
|
336
367
|
*
|
|
337
368
|
* Statics:
|
|
338
369
|
* - `Tooltip.Trigger` — the described element: `render={<Button/>}` or
|
|
339
370
|
* `asChild`, else a plain button around `children`.
|
|
340
371
|
* - `Tooltip.Content` — the label: `side`, `align`, `sideOffset`,
|
|
341
|
-
* `
|
|
372
|
+
* `alignOffset`, `collisionPadding`, `collisionBoundary`, `container`,
|
|
373
|
+
* `positionerClassName` (or `contentClassName`), the morph options `from`, `effect`,
|
|
342
374
|
* `tier`, and `render` or `asChild` for the label's own element; other
|
|
343
375
|
* props land on the popup.
|
|
344
376
|
* - `Tooltip.Provider` — `TooltipProvider`: groups tooltips so moving from
|
|
345
377
|
* one trigger to an adjacent one skips the hover delay, and the morph: the
|
|
346
378
|
* next label shows in place. `delay` (or `delayDuration`) sets the hover
|
|
347
|
-
* delay of every tooltip in it, `
|
|
379
|
+
* delay of every tooltip in it, `closeDelay` how long they linger, and
|
|
380
|
+
* `skipDelayDuration` (or `timeout`) the hand-off window.
|
|
348
381
|
* - `Tooltip.PortalContainer` — the shared `PortalContainer`: portal every
|
|
349
382
|
* descendant tooltip into a given element instead of the body.
|
|
350
383
|
*
|
|
@@ -360,8 +393,13 @@ const Tooltip = Object.assign(
|
|
|
360
393
|
align,
|
|
361
394
|
sideOffset,
|
|
362
395
|
container,
|
|
396
|
+
alignOffset,
|
|
397
|
+
collisionPadding,
|
|
398
|
+
collisionBoundary,
|
|
399
|
+
positionerClassName,
|
|
363
400
|
delay,
|
|
364
401
|
delayDuration,
|
|
402
|
+
closeDelay,
|
|
365
403
|
className,
|
|
366
404
|
contentClassName,
|
|
367
405
|
open,
|
|
@@ -372,7 +410,7 @@ const Tooltip = Object.assign(
|
|
|
372
410
|
effect,
|
|
373
411
|
tier,
|
|
374
412
|
}: TooltipProps) {
|
|
375
|
-
const root = { open, defaultOpen, onOpenChange, delayDuration: delay ?? delayDuration, followCursor }
|
|
413
|
+
const root = { open, defaultOpen, onOpenChange, delayDuration: delay ?? delayDuration, closeDelay, followCursor }
|
|
376
414
|
if (content === undefined) return <TooltipRoot {...root}>{children}</TooltipRoot>
|
|
377
415
|
|
|
378
416
|
return (
|
|
@@ -382,6 +420,10 @@ const Tooltip = Object.assign(
|
|
|
382
420
|
side={side}
|
|
383
421
|
align={align}
|
|
384
422
|
sideOffset={sideOffset}
|
|
423
|
+
alignOffset={alignOffset}
|
|
424
|
+
collisionPadding={collisionPadding}
|
|
425
|
+
collisionBoundary={collisionBoundary}
|
|
426
|
+
positionerClassName={positionerClassName}
|
|
385
427
|
container={container}
|
|
386
428
|
className={className}
|
|
387
429
|
contentClassName={contentClassName}
|