@sanity/ui 3.0.0-static.12 → 3.0.0-static.14
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/dist/_chunks-cjs/_visual-editing.js +63 -65
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-es/_visual-editing.mjs +63 -65
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_visual-editing.d.mts +13 -1
- package/dist/_visual-editing.d.ts +13 -1
- package/dist/cli.js +1 -1
- package/dist/css.js +1 -1
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +1 -1
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +27 -5
- package/dist/index.d.ts +27 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/src/css/utils/srOnly/srOnly.ts +2 -1
- package/src/ui/primitives/label/label.tsx +13 -1
- package/src/ui/primitives/popover/popover.tsx +7 -6
- package/src/ui/primitives/popover/{popoverCard.tsx → popoverLayer.tsx} +18 -21
- package/src/ui/primitives/text/text.tsx +13 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +20 -24
- package/src/ui/primitives/tooltip/{tooltipCard.tsx → tooltipLayer.tsx} +16 -19
- package/src/ui/utils/virtualList/virtualList.tsx +1 -3
package/dist/index.d.mts
CHANGED
|
@@ -1561,7 +1561,19 @@ export declare namespace Label {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
1563
|
/** @public */
|
|
1564
|
-
export declare type LabelElementType =
|
|
1564
|
+
export declare type LabelElementType =
|
|
1565
|
+
| 'div'
|
|
1566
|
+
| 'h1'
|
|
1567
|
+
| 'h2'
|
|
1568
|
+
| 'h3'
|
|
1569
|
+
| 'h4'
|
|
1570
|
+
| 'h5'
|
|
1571
|
+
| 'h6'
|
|
1572
|
+
| 'label'
|
|
1573
|
+
| 'li'
|
|
1574
|
+
| 'p'
|
|
1575
|
+
| 'span'
|
|
1576
|
+
| ComponentType
|
|
1565
1577
|
|
|
1566
1578
|
/** @public */
|
|
1567
1579
|
export declare type LabelOwnProps = LabelStyleProps & TextOverflowStyleProps
|
|
@@ -2609,7 +2621,19 @@ export declare type TextAreaProps<E extends TextAreaElementType = TextAreaElemen
|
|
|
2609
2621
|
>
|
|
2610
2622
|
|
|
2611
2623
|
/** @public */
|
|
2612
|
-
export declare type TextElementType =
|
|
2624
|
+
export declare type TextElementType =
|
|
2625
|
+
| 'div'
|
|
2626
|
+
| 'h1'
|
|
2627
|
+
| 'h2'
|
|
2628
|
+
| 'h3'
|
|
2629
|
+
| 'h4'
|
|
2630
|
+
| 'h5'
|
|
2631
|
+
| 'h6'
|
|
2632
|
+
| 'label'
|
|
2633
|
+
| 'li'
|
|
2634
|
+
| 'p'
|
|
2635
|
+
| 'span'
|
|
2636
|
+
| ComponentType
|
|
2613
2637
|
|
|
2614
2638
|
/**
|
|
2615
2639
|
* Single line text input.
|
|
@@ -3303,9 +3327,7 @@ export declare function useTooltipDelayGroup(): TooltipDelayGroupContextValue |
|
|
|
3303
3327
|
*/
|
|
3304
3328
|
export declare function useTree(): TreeContextValue
|
|
3305
3329
|
|
|
3306
|
-
/**
|
|
3307
|
-
* @beta
|
|
3308
|
-
*/
|
|
3330
|
+
/** @beta */
|
|
3309
3331
|
export declare function VirtualList<
|
|
3310
3332
|
E extends VirtualListElementType = typeof DEFAULT_VIRTUAL_LIST_ELEMENT,
|
|
3311
3333
|
>(props: VirtualListProps<E>): JSX.Element
|
package/dist/index.d.ts
CHANGED
|
@@ -1561,7 +1561,19 @@ export declare namespace Label {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
|
|
1563
1563
|
/** @public */
|
|
1564
|
-
export declare type LabelElementType =
|
|
1564
|
+
export declare type LabelElementType =
|
|
1565
|
+
| 'div'
|
|
1566
|
+
| 'h1'
|
|
1567
|
+
| 'h2'
|
|
1568
|
+
| 'h3'
|
|
1569
|
+
| 'h4'
|
|
1570
|
+
| 'h5'
|
|
1571
|
+
| 'h6'
|
|
1572
|
+
| 'label'
|
|
1573
|
+
| 'li'
|
|
1574
|
+
| 'p'
|
|
1575
|
+
| 'span'
|
|
1576
|
+
| ComponentType
|
|
1565
1577
|
|
|
1566
1578
|
/** @public */
|
|
1567
1579
|
export declare type LabelOwnProps = LabelStyleProps & TextOverflowStyleProps
|
|
@@ -2609,7 +2621,19 @@ export declare type TextAreaProps<E extends TextAreaElementType = TextAreaElemen
|
|
|
2609
2621
|
>
|
|
2610
2622
|
|
|
2611
2623
|
/** @public */
|
|
2612
|
-
export declare type TextElementType =
|
|
2624
|
+
export declare type TextElementType =
|
|
2625
|
+
| 'div'
|
|
2626
|
+
| 'h1'
|
|
2627
|
+
| 'h2'
|
|
2628
|
+
| 'h3'
|
|
2629
|
+
| 'h4'
|
|
2630
|
+
| 'h5'
|
|
2631
|
+
| 'h6'
|
|
2632
|
+
| 'label'
|
|
2633
|
+
| 'li'
|
|
2634
|
+
| 'p'
|
|
2635
|
+
| 'span'
|
|
2636
|
+
| ComponentType
|
|
2613
2637
|
|
|
2614
2638
|
/**
|
|
2615
2639
|
* Single line text input.
|
|
@@ -3303,9 +3327,7 @@ export declare function useTooltipDelayGroup(): TooltipDelayGroupContextValue |
|
|
|
3303
3327
|
*/
|
|
3304
3328
|
export declare function useTree(): TreeContextValue
|
|
3305
3329
|
|
|
3306
|
-
/**
|
|
3307
|
-
* @beta
|
|
3308
|
-
*/
|
|
3330
|
+
/** @beta */
|
|
3309
3331
|
export declare function VirtualList<
|
|
3310
3332
|
E extends VirtualListElementType = typeof DEFAULT_VIRTUAL_LIST_ELEMENT,
|
|
3311
3333
|
>(props: VirtualListProps<E>): JSX.Element
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1, buildTheme_v3 } from "@sanity/ui/theme";
|
|
2
|
-
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, EMPTY_ARRAY, useElementSize, Code, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, createGlobalScopedContext, usePrefersReducedMotion,
|
|
2
|
+
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, EMPTY_ARRAY, useElementSize, Code, _isEnterToClickElement, Card, Text, useArrayProp, EMPTY_RECORD, Box, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, createGlobalScopedContext, usePrefersReducedMotion, Z_OFFSETS, Portal, Container, Layer, Grid, LayerProvider, isRecord, Selectable, useCard } from "./_chunks-es/_visual-editing.mjs";
|
|
3
3
|
import { Arrow, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, CardProvider, Checkbox, DEFAULT_ARROW_ELEMENT, DEFAULT_AVATAR_COUNTER_ELEMENT, DEFAULT_AVATAR_ELEMENT, DEFAULT_AVATAR_STACK_ELEMENT, DEFAULT_BADGE_ELEMENT, DEFAULT_BOX_ELEMENT, DEFAULT_BUTTON_ELEMENT, DEFAULT_CARD_ELEMENT, DEFAULT_CHECKBOX_ELEMENT, DEFAULT_CODE_ELEMENT, DEFAULT_CONTAINER_ELEMENT, DEFAULT_ELEMENT_QUERY_ELEMENT, DEFAULT_FLEX_ELEMENT, DEFAULT_GRID_ELEMENT, DEFAULT_HEADING_ELEMENT, DEFAULT_HOTKEYS_ELEMENT, DEFAULT_INLINE_ELEMENT, DEFAULT_KBD_ELEMENT, DEFAULT_LABEL_ELEMENT, DEFAULT_LAYER_ELEMENT, DEFAULT_MENU_DIVIDER_ELEMENT, DEFAULT_MENU_ELEMENT, DEFAULT_MENU_GROUP_ELEMENT, DEFAULT_MENU_ITEM_ELEMENT, DEFAULT_POPOVER_ELEMENT, DEFAULT_RADIO_ELEMENT, DEFAULT_SELECT_ELEMENT, DEFAULT_SPINNER_ELEMENT, DEFAULT_SR_ONLY_ELEMENT, DEFAULT_STACK_ELEMENT, DEFAULT_SWITCH_ELEMENT, DEFAULT_TAB_ELEMENT, DEFAULT_TAB_LIST_ELEMENT, DEFAULT_TEXT_AREA_ELEMENT, DEFAULT_TEXT_ELEMENT, DEFAULT_TEXT_INPUT_ELEMENT, DEFAULT_TOOLTIP_ELEMENT, DEFAULT_VIRTUAL_LIST_ELEMENT, ElementQuery, Heading, Hotkeys, Inline, KBD, Label, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Radio, Select, Spinner, SrOnly, Switch, Tab, TabList, TextArea, ThemeColorProvider, ThemeProvider, Tooltip, TooltipDelayGroupContext, TooltipDelayGroupProvider, VirtualList, _ResizeObserver, _elementSizeObserver, _getArrayProp, _isScrollable, studioTheme, useCustomValidity, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTheme_v2, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.mjs";
|
|
4
4
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
5
|
import { ChevronDownIcon, CloseIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
package/package.json
CHANGED
|
@@ -15,7 +15,19 @@ export const DEFAULT_LABEL_ELEMENT = 'div'
|
|
|
15
15
|
export type LabelOwnProps = LabelStyleProps & TextOverflowStyleProps
|
|
16
16
|
|
|
17
17
|
/** @public */
|
|
18
|
-
export type LabelElementType =
|
|
18
|
+
export type LabelElementType =
|
|
19
|
+
| 'div'
|
|
20
|
+
| 'h1'
|
|
21
|
+
| 'h2'
|
|
22
|
+
| 'h3'
|
|
23
|
+
| 'h4'
|
|
24
|
+
| 'h5'
|
|
25
|
+
| 'h6'
|
|
26
|
+
| 'label'
|
|
27
|
+
| 'li'
|
|
28
|
+
| 'p'
|
|
29
|
+
| 'span'
|
|
30
|
+
| ComponentType
|
|
19
31
|
|
|
20
32
|
/** @public */
|
|
21
33
|
export type LabelProps<E extends LabelElementType = LabelElementType> = Props<LabelOwnProps, E>
|
|
@@ -27,7 +27,7 @@ import {Z_OFFSETS} from '../../constants'
|
|
|
27
27
|
import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
28
28
|
import {origin} from '../../middleware/origin'
|
|
29
29
|
import type {ComponentType, Placement, PopoverMargins, Props} from '../../types'
|
|
30
|
-
import {type LayerOwnProps,
|
|
30
|
+
import {type LayerOwnProps, Portal, useBoundaryElement, useLayer} from '../../utils'
|
|
31
31
|
import {CardProvider, useCard} from '../card'
|
|
32
32
|
import {
|
|
33
33
|
DEFAULT_FALLBACK_PLACEMENTS,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
DEFAULT_POPOVER_PADDING,
|
|
37
37
|
} from './constants'
|
|
38
38
|
import {size} from './floating-ui/size'
|
|
39
|
-
import {
|
|
39
|
+
import {PopoverLayer} from './popoverLayer'
|
|
40
40
|
import type {PopoverUpdateCallback} from './types'
|
|
41
41
|
|
|
42
42
|
/** @public */
|
|
@@ -353,12 +353,12 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
353
353
|
}
|
|
354
354
|
|
|
355
355
|
const popover = (
|
|
356
|
-
|
|
356
|
+
<>
|
|
357
357
|
{/* Optional transparent blocking overlay at the top-most z-index layer. Must be positioned
|
|
358
358
|
before the below popover card. */}
|
|
359
359
|
{modal && <ViewportOverlay />}
|
|
360
360
|
|
|
361
|
-
<
|
|
361
|
+
<PopoverLayer
|
|
362
362
|
{...rest}
|
|
363
363
|
__unstable_margins={margins}
|
|
364
364
|
animate={animate}
|
|
@@ -381,10 +381,11 @@ export function Popover<E extends PopoverElementType = typeof DEFAULT_POPOVER_EL
|
|
|
381
381
|
strategy={strategy}
|
|
382
382
|
x={x}
|
|
383
383
|
y={y}
|
|
384
|
+
zOffset={zOffset}
|
|
384
385
|
>
|
|
385
386
|
{content}
|
|
386
|
-
</
|
|
387
|
-
|
|
387
|
+
</PopoverLayer>
|
|
388
|
+
</>
|
|
388
389
|
)
|
|
389
390
|
|
|
390
391
|
const children =
|
|
@@ -5,8 +5,8 @@ import {CSSProperties, ForwardedRef, useMemo} from 'react'
|
|
|
5
5
|
|
|
6
6
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
7
7
|
import {Placement, PopoverMargins, Props} from '../../types'
|
|
8
|
-
import {Arrow,
|
|
9
|
-
import {
|
|
8
|
+
import {Arrow, Layer, LayerOwnProps} from '../../utils'
|
|
9
|
+
import {CardElementType} from '../card'
|
|
10
10
|
import {Flex} from '../flex'
|
|
11
11
|
import {
|
|
12
12
|
DEFAULT_POPOVER_ARROW_HEIGHT,
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
} from './constants'
|
|
17
17
|
|
|
18
18
|
/** @internal */
|
|
19
|
-
export const
|
|
19
|
+
export const DEFAULT_POPOVER_LAYER_ELEMENT = 'div'
|
|
20
20
|
|
|
21
21
|
/** @internal */
|
|
22
|
-
export type
|
|
22
|
+
export type PopoverLayerOwnProps = LayerOwnProps & {
|
|
23
23
|
/** @beta*/
|
|
24
24
|
__unstable_margins?: PopoverMargins
|
|
25
25
|
animate?: boolean
|
|
@@ -37,20 +37,20 @@ export type PopoverCardOwnProps = CardOwnProps & {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/** @internal */
|
|
40
|
-
export type
|
|
40
|
+
export type PopoverLayerElementType = CardElementType
|
|
41
41
|
|
|
42
42
|
/** @internal */
|
|
43
|
-
export type
|
|
44
|
-
|
|
43
|
+
export type PopoverLayerProps<E extends PopoverLayerElementType = PopoverLayerElementType> = Props<
|
|
44
|
+
PopoverLayerOwnProps,
|
|
45
45
|
E
|
|
46
46
|
>
|
|
47
47
|
|
|
48
|
-
const
|
|
48
|
+
const MotionLayer = motion.create(Layer)
|
|
49
49
|
|
|
50
50
|
/** @internal */
|
|
51
|
-
export function
|
|
52
|
-
|
|
53
|
-
) {
|
|
51
|
+
export function PopoverLayer<
|
|
52
|
+
E extends PopoverLayerElementType = typeof DEFAULT_POPOVER_LAYER_ELEMENT,
|
|
53
|
+
>(props: PopoverLayerProps<E>) {
|
|
54
54
|
const {
|
|
55
55
|
__unstable_margins: marginsProp,
|
|
56
56
|
animate,
|
|
@@ -58,7 +58,7 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
58
58
|
arrowRef,
|
|
59
59
|
arrowX,
|
|
60
60
|
arrowY,
|
|
61
|
-
as =
|
|
61
|
+
as = DEFAULT_POPOVER_LAYER_ELEMENT,
|
|
62
62
|
children,
|
|
63
63
|
maxWidth,
|
|
64
64
|
padding,
|
|
@@ -75,9 +75,7 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
75
75
|
x: xProp,
|
|
76
76
|
y: yProp,
|
|
77
77
|
...rest
|
|
78
|
-
} = props as
|
|
79
|
-
|
|
80
|
-
const layer = useLayer()
|
|
78
|
+
} = props as PopoverLayerProps<typeof DEFAULT_POPOVER_LAYER_ELEMENT>
|
|
81
79
|
|
|
82
80
|
// Get margins: [top, right, bottom, left]
|
|
83
81
|
const margins: PopoverMargins = useMemo(
|
|
@@ -94,14 +92,12 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
94
92
|
left: x,
|
|
95
93
|
originX,
|
|
96
94
|
originY,
|
|
97
|
-
position: strategy,
|
|
98
95
|
top: y,
|
|
99
96
|
width: referenceWidth,
|
|
100
|
-
zIndex: layer.zIndex ?? 100,
|
|
101
97
|
willChange: animate ? 'transform' : undefined,
|
|
102
98
|
...style,
|
|
103
99
|
}),
|
|
104
|
-
[animate,
|
|
100
|
+
[animate, originX, originY, referenceWidth, style, x, y],
|
|
105
101
|
)
|
|
106
102
|
|
|
107
103
|
const arrowStyle: CSSProperties = useMemo(
|
|
@@ -115,7 +111,7 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
115
111
|
)
|
|
116
112
|
|
|
117
113
|
return (
|
|
118
|
-
<
|
|
114
|
+
<MotionLayer
|
|
119
115
|
className={popoverCard()}
|
|
120
116
|
data-ui="Popover"
|
|
121
117
|
{...rest}
|
|
@@ -124,6 +120,7 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
124
120
|
data-placement={placement}
|
|
125
121
|
direction="column"
|
|
126
122
|
display="flex"
|
|
123
|
+
position={strategy}
|
|
127
124
|
radius={radius}
|
|
128
125
|
shadow={shadow}
|
|
129
126
|
sizing="border"
|
|
@@ -156,8 +153,8 @@ export function PopoverCard<E extends PopoverCardElementType = typeof DEFAULT_PO
|
|
|
156
153
|
radius={DEFAULT_POPOVER_ARROW_RADIUS}
|
|
157
154
|
/>
|
|
158
155
|
)}
|
|
159
|
-
</
|
|
156
|
+
</MotionLayer>
|
|
160
157
|
)
|
|
161
158
|
}
|
|
162
159
|
|
|
163
|
-
|
|
160
|
+
PopoverLayer.displayName = 'PopoverCard'
|
|
@@ -15,7 +15,19 @@ export const DEFAULT_TEXT_ELEMENT = 'div'
|
|
|
15
15
|
export type TextOwnProps = TextStyleProps & TextOverflowStyleProps
|
|
16
16
|
|
|
17
17
|
/** @public */
|
|
18
|
-
export type TextElementType =
|
|
18
|
+
export type TextElementType =
|
|
19
|
+
| 'div'
|
|
20
|
+
| 'h1'
|
|
21
|
+
| 'h2'
|
|
22
|
+
| 'h3'
|
|
23
|
+
| 'h4'
|
|
24
|
+
| 'h5'
|
|
25
|
+
| 'h6'
|
|
26
|
+
| 'label'
|
|
27
|
+
| 'li'
|
|
28
|
+
| 'p'
|
|
29
|
+
| 'span'
|
|
30
|
+
| ComponentType
|
|
19
31
|
|
|
20
32
|
/** @public */
|
|
21
33
|
export type TextProps<E extends TextElementType = TextElementType> = Props<TextOwnProps, E>
|
|
@@ -35,7 +35,7 @@ import {useArrayProp, usePrefersReducedMotion} from '../../hooks'
|
|
|
35
35
|
import {useDelayedState} from '../../hooks/useDelayedState'
|
|
36
36
|
import {origin} from '../../middleware/origin'
|
|
37
37
|
import type {ComponentType, Placement, Props} from '../../types'
|
|
38
|
-
import {
|
|
38
|
+
import {type LayerOwnProps, Portal, useBoundaryElement, usePortal} from '../../utils'
|
|
39
39
|
import {getElementRef} from '../../utils/getElementRef'
|
|
40
40
|
import {CardProvider, useCard} from '../card'
|
|
41
41
|
import {Delay} from '../types'
|
|
@@ -44,8 +44,8 @@ import {
|
|
|
44
44
|
DEFAULT_TOOLTIP_DISTANCE,
|
|
45
45
|
DEFAULT_TOOLTIP_PADDING,
|
|
46
46
|
} from './constants'
|
|
47
|
-
import {TooltipCard} from './tooltipCard'
|
|
48
47
|
import {useTooltipDelayGroup} from './tooltipDelayGroup'
|
|
48
|
+
import {TooltipLayer} from './tooltipLayer'
|
|
49
49
|
|
|
50
50
|
/** @public */
|
|
51
51
|
export const DEFAULT_TOOLTIP_ELEMENT = 'div'
|
|
@@ -381,37 +381,33 @@ export function Tooltip<E extends TooltipElementType = typeof DEFAULT_TOOLTIP_EL
|
|
|
381
381
|
if (disabled) return child
|
|
382
382
|
|
|
383
383
|
const node = (
|
|
384
|
-
<
|
|
384
|
+
<TooltipLayer
|
|
385
385
|
data-ui="Tooltip"
|
|
386
|
+
{...rest}
|
|
387
|
+
animate={animate}
|
|
388
|
+
arrow={arrowProp}
|
|
389
|
+
arrowRef={setArrow}
|
|
390
|
+
arrowX={arrowX}
|
|
391
|
+
arrowY={arrowY}
|
|
392
|
+
as={as}
|
|
386
393
|
className={composeClassNames(className, tooltip())}
|
|
394
|
+
originX={originX}
|
|
395
|
+
originY={originY}
|
|
396
|
+
padding={padding}
|
|
397
|
+
placement={placement}
|
|
398
|
+
radius={radius}
|
|
387
399
|
ref={setFloating}
|
|
400
|
+
scheme={scheme}
|
|
401
|
+
shadow={shadow}
|
|
388
402
|
style={{
|
|
389
403
|
...floatingStyles,
|
|
390
404
|
maxWidth: tooltipMaxWidth > 0 ? `${tooltipMaxWidth}px` : undefined,
|
|
391
405
|
}}
|
|
406
|
+
tone={tone}
|
|
392
407
|
zOffset={zOffset}
|
|
393
408
|
>
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
animate={animate}
|
|
397
|
-
arrow={arrowProp}
|
|
398
|
-
arrowRef={setArrow}
|
|
399
|
-
arrowX={arrowX}
|
|
400
|
-
arrowY={arrowY}
|
|
401
|
-
as={as}
|
|
402
|
-
originX={originX}
|
|
403
|
-
originY={originY}
|
|
404
|
-
padding={padding}
|
|
405
|
-
placement={placement}
|
|
406
|
-
radius={radius}
|
|
407
|
-
ref={setFloating}
|
|
408
|
-
scheme={scheme}
|
|
409
|
-
shadow={shadow}
|
|
410
|
-
tone={tone}
|
|
411
|
-
>
|
|
412
|
-
{content}
|
|
413
|
-
</TooltipCard>
|
|
414
|
-
</Layer>
|
|
409
|
+
{content}
|
|
410
|
+
</TooltipLayer>
|
|
415
411
|
)
|
|
416
412
|
|
|
417
413
|
const children =
|
|
@@ -4,8 +4,7 @@ import {type CSSProperties, ForwardedRef, useMemo} from 'react'
|
|
|
4
4
|
|
|
5
5
|
import {POPOVER_MOTION_PROPS} from '../../constants'
|
|
6
6
|
import {Placement, Props} from '../../types'
|
|
7
|
-
import {Arrow} from '../../utils'
|
|
8
|
-
import {Card, CardOwnProps} from '../card'
|
|
7
|
+
import {Arrow, Layer, LayerOwnProps} from '../../utils'
|
|
9
8
|
import {
|
|
10
9
|
DEFAULT_TOOLTIP_ARROW_HEIGHT,
|
|
11
10
|
DEFAULT_TOOLTIP_ARROW_RADIUS,
|
|
@@ -13,10 +12,10 @@ import {
|
|
|
13
12
|
} from './constants'
|
|
14
13
|
|
|
15
14
|
/* @internal */
|
|
16
|
-
export const
|
|
15
|
+
export const DEFAULT_TOOLTIP_LAYER_ELEMENT = 'div'
|
|
17
16
|
|
|
18
17
|
/* @internal */
|
|
19
|
-
export interface
|
|
18
|
+
export interface TooltipLayerOwnProps extends LayerOwnProps {
|
|
20
19
|
animate?: boolean
|
|
21
20
|
arrow: boolean
|
|
22
21
|
arrowRef: ForwardedRef<HTMLDivElement>
|
|
@@ -28,29 +27,27 @@ export interface TooltipCardOwnProps extends CardOwnProps {
|
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
/** @internal */
|
|
31
|
-
export type
|
|
30
|
+
export type TooltipLayerElementType = 'div'
|
|
32
31
|
|
|
33
32
|
/** @internal */
|
|
34
|
-
export type
|
|
35
|
-
|
|
33
|
+
export type TooltipLayerProps<E extends TooltipLayerElementType = TooltipLayerElementType> = Props<
|
|
34
|
+
TooltipLayerOwnProps,
|
|
36
35
|
E
|
|
37
36
|
>
|
|
38
37
|
|
|
39
|
-
const
|
|
38
|
+
const MotionLayer = motion.create(Layer)
|
|
40
39
|
|
|
41
|
-
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
props: TooltipCardProps<E>,
|
|
46
|
-
) {
|
|
40
|
+
/** @internal */
|
|
41
|
+
export function TooltipLayer<
|
|
42
|
+
E extends TooltipLayerElementType = typeof DEFAULT_TOOLTIP_LAYER_ELEMENT,
|
|
43
|
+
>(props: TooltipLayerProps<E>) {
|
|
47
44
|
const {
|
|
48
45
|
animate,
|
|
49
46
|
arrow,
|
|
50
47
|
arrowRef,
|
|
51
48
|
arrowX,
|
|
52
49
|
arrowY,
|
|
53
|
-
as =
|
|
50
|
+
as = DEFAULT_TOOLTIP_LAYER_ELEMENT,
|
|
54
51
|
children,
|
|
55
52
|
originX,
|
|
56
53
|
originY,
|
|
@@ -62,7 +59,7 @@ export function TooltipCard<E extends TooltipCardElementType = typeof DEFAULT_TO
|
|
|
62
59
|
style,
|
|
63
60
|
tone = 'inherit',
|
|
64
61
|
...rest
|
|
65
|
-
} = props as
|
|
62
|
+
} = props as TooltipLayerProps<typeof DEFAULT_TOOLTIP_LAYER_ELEMENT>
|
|
66
63
|
|
|
67
64
|
const rootStyle: CSSProperties = useMemo(
|
|
68
65
|
() => ({
|
|
@@ -85,7 +82,7 @@ export function TooltipCard<E extends TooltipCardElementType = typeof DEFAULT_TO
|
|
|
85
82
|
)
|
|
86
83
|
|
|
87
84
|
return (
|
|
88
|
-
<
|
|
85
|
+
<MotionLayer
|
|
89
86
|
data-ui="Tooltip__card"
|
|
90
87
|
{...rest}
|
|
91
88
|
as={as}
|
|
@@ -115,8 +112,8 @@ export function TooltipCard<E extends TooltipCardElementType = typeof DEFAULT_TO
|
|
|
115
112
|
radius={DEFAULT_TOOLTIP_ARROW_RADIUS}
|
|
116
113
|
/>
|
|
117
114
|
)}
|
|
118
|
-
</
|
|
115
|
+
</MotionLayer>
|
|
119
116
|
)
|
|
120
117
|
}
|
|
121
118
|
|
|
122
|
-
|
|
119
|
+
TooltipLayer.displayName = 'TooltipLayer'
|
|
@@ -46,9 +46,7 @@ export type VirtualListProps<E extends VirtualListElementType = VirtualListEleme
|
|
|
46
46
|
E
|
|
47
47
|
>
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
* @beta
|
|
51
|
-
*/
|
|
49
|
+
/** @beta */
|
|
52
50
|
export function VirtualList<E extends VirtualListElementType = typeof DEFAULT_VIRTUAL_LIST_ELEMENT>(
|
|
53
51
|
props: VirtualListProps<E>,
|
|
54
52
|
) {
|