@radix-ui/react-hover-card 0.1.6-rc.3 → 0.1.6-rc.32
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/index.d.ts +12 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -5
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +33 -8
- package/dist/index.module.js.map +1 -1
- package/package.json +9 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import * as PopperPrimitive from "@radix-ui/react-popper";
|
|
3
|
+
import { UnstablePortal } from "@radix-ui/react-portal";
|
|
3
4
|
import * as Radix from "@radix-ui/react-primitive";
|
|
4
5
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
5
6
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
@@ -17,6 +18,16 @@ type PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;
|
|
|
17
18
|
export interface HoverCardTriggerProps extends PrimitiveLinkProps {
|
|
18
19
|
}
|
|
19
20
|
export const HoverCardTrigger: React.ForwardRefExoticComponent<HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
21
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;
|
|
22
|
+
export interface HoverCardPortalProps extends Omit<PortalProps, 'asChild'> {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Used to force mounting when more control is needed. Useful when
|
|
26
|
+
* controlling animation with React animation libraries.
|
|
27
|
+
*/
|
|
28
|
+
forceMount?: true;
|
|
29
|
+
}
|
|
30
|
+
export const HoverCardPortal: React.FC<HoverCardPortalProps>;
|
|
20
31
|
export interface HoverCardContentProps extends HoverCardContentImplProps {
|
|
21
32
|
/**
|
|
22
33
|
* Used to force mounting when more control is needed. Useful when
|
|
@@ -49,11 +60,6 @@ interface HoverCardContentImplProps extends PopperContentProps {
|
|
|
49
60
|
* Can be prevented.
|
|
50
61
|
*/
|
|
51
62
|
onInteractOutside?: DismissableLayerProps['onInteractOutside'];
|
|
52
|
-
/**
|
|
53
|
-
* Whether the `HoverCard` should render in a `Portal`
|
|
54
|
-
* (default: `true`)
|
|
55
|
-
*/
|
|
56
|
-
portalled?: boolean;
|
|
57
63
|
}
|
|
58
64
|
type PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;
|
|
59
65
|
export interface HoverCardArrowProps extends PopperArrowProps {
|
|
@@ -61,6 +67,7 @@ export interface HoverCardArrowProps extends PopperArrowProps {
|
|
|
61
67
|
export const HoverCardArrow: React.ForwardRefExoticComponent<HoverCardArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
62
68
|
export const Root: React.FC<HoverCardProps>;
|
|
63
69
|
export const Trigger: React.ForwardRefExoticComponent<HoverCardTriggerProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
70
|
+
export const Portal: React.FC<HoverCardPortalProps>;
|
|
64
71
|
export const Content: React.ForwardRefExoticComponent<HoverCardContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
65
72
|
export const Arrow: React.ForwardRefExoticComponent<HoverCardArrowProps & React.RefAttributes<SVGSVGElement>>;
|
|
66
73
|
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;AAsBA,OAAA,2FAEE,CAAC;AAcH;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,OAAA,MAAM,WAAW,MAAM,EAAE,CAAC,cAAc,C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AC;AAC/B,OAAA,MAAM,qGAA0B,CAAC;AACjC,OAAA,MAAM,gGAAsB,CAAC","sources":["packages/react/hover-card/src/packages/react/hover-card/src/HoverCard.tsx","packages/react/hover-card/src/packages/react/hover-card/src/index.ts","packages/react/hover-card/src/index.ts"],"sourcesContent":[null,null,"export * from './HoverCard';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -37,10 +37,12 @@ var $e5715e9205c1e1fe$exports = {};
|
|
|
37
37
|
$parcel$export($e5715e9205c1e1fe$exports, "createHoverCardScope", () => $e5715e9205c1e1fe$export$47b6998a836b7260);
|
|
38
38
|
$parcel$export($e5715e9205c1e1fe$exports, "HoverCard", () => $e5715e9205c1e1fe$export$57a077cc9fbe653e);
|
|
39
39
|
$parcel$export($e5715e9205c1e1fe$exports, "HoverCardTrigger", () => $e5715e9205c1e1fe$export$ef9f7fd8e4ba882f);
|
|
40
|
+
$parcel$export($e5715e9205c1e1fe$exports, "HoverCardPortal", () => $e5715e9205c1e1fe$export$b384c6e0a789f88b);
|
|
40
41
|
$parcel$export($e5715e9205c1e1fe$exports, "HoverCardContent", () => $e5715e9205c1e1fe$export$aa4724a5938c586);
|
|
41
42
|
$parcel$export($e5715e9205c1e1fe$exports, "HoverCardArrow", () => $e5715e9205c1e1fe$export$b9744d3e7456d806);
|
|
42
43
|
$parcel$export($e5715e9205c1e1fe$exports, "Root", () => $e5715e9205c1e1fe$export$be92b6f5f03c0fe9);
|
|
43
44
|
$parcel$export($e5715e9205c1e1fe$exports, "Trigger", () => $e5715e9205c1e1fe$export$41fb9f06171c75f4);
|
|
45
|
+
$parcel$export($e5715e9205c1e1fe$exports, "Portal", () => $e5715e9205c1e1fe$export$602eac185826482c);
|
|
44
46
|
$parcel$export($e5715e9205c1e1fe$exports, "Content", () => $e5715e9205c1e1fe$export$7c6e2c02157bb7d2);
|
|
45
47
|
$parcel$export($e5715e9205c1e1fe$exports, "Arrow", () => $e5715e9205c1e1fe$export$21b07c8f274aebd5);
|
|
46
48
|
|
|
@@ -136,11 +138,34 @@ const $e5715e9205c1e1fe$export$ef9f7fd8e4ba882f = /*#__PURE__*/ $eFX7w$react.for
|
|
|
136
138
|
/*#__PURE__*/ Object.assign($e5715e9205c1e1fe$export$ef9f7fd8e4ba882f, {
|
|
137
139
|
displayName: $e5715e9205c1e1fe$var$TRIGGER_NAME
|
|
138
140
|
});
|
|
141
|
+
/* -------------------------------------------------------------------------------------------------
|
|
142
|
+
* HoverCardPortal
|
|
143
|
+
* -----------------------------------------------------------------------------------------------*/ const $e5715e9205c1e1fe$var$PORTAL_NAME = 'HoverCardPortal';
|
|
144
|
+
const [$e5715e9205c1e1fe$var$PortalProvider, $e5715e9205c1e1fe$var$usePortalContext] = $e5715e9205c1e1fe$var$createHoverCardContext($e5715e9205c1e1fe$var$PORTAL_NAME, {
|
|
145
|
+
forceMount: undefined
|
|
146
|
+
});
|
|
147
|
+
const $e5715e9205c1e1fe$export$b384c6e0a789f88b = (props)=>{
|
|
148
|
+
const { __scopeHoverCard: __scopeHoverCard , forceMount: forceMount , children: children , container: container } = props;
|
|
149
|
+
const context = $e5715e9205c1e1fe$var$useHoverCardContext($e5715e9205c1e1fe$var$PORTAL_NAME, __scopeHoverCard);
|
|
150
|
+
return /*#__PURE__*/ $eFX7w$react.createElement($e5715e9205c1e1fe$var$PortalProvider, {
|
|
151
|
+
scope: __scopeHoverCard,
|
|
152
|
+
forceMount: forceMount
|
|
153
|
+
}, /*#__PURE__*/ $eFX7w$react.createElement($eFX7w$radixuireactpresence.Presence, {
|
|
154
|
+
present: forceMount || context.open
|
|
155
|
+
}, /*#__PURE__*/ $eFX7w$react.createElement($eFX7w$radixuireactportal.UnstablePortal, {
|
|
156
|
+
asChild: true,
|
|
157
|
+
container: container
|
|
158
|
+
}, children)));
|
|
159
|
+
};
|
|
160
|
+
/*#__PURE__*/ Object.assign($e5715e9205c1e1fe$export$b384c6e0a789f88b, {
|
|
161
|
+
displayName: $e5715e9205c1e1fe$var$PORTAL_NAME
|
|
162
|
+
});
|
|
139
163
|
/* -------------------------------------------------------------------------------------------------
|
|
140
164
|
* HoverCardContent
|
|
141
165
|
* -----------------------------------------------------------------------------------------------*/ const $e5715e9205c1e1fe$var$CONTENT_NAME = 'HoverCardContent';
|
|
142
166
|
const $e5715e9205c1e1fe$export$aa4724a5938c586 = /*#__PURE__*/ $eFX7w$react.forwardRef((props, forwardedRef)=>{
|
|
143
|
-
const
|
|
167
|
+
const portalContext = $e5715e9205c1e1fe$var$usePortalContext($e5715e9205c1e1fe$var$CONTENT_NAME, props.__scopeHoverCard);
|
|
168
|
+
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
|
|
144
169
|
const context = $e5715e9205c1e1fe$var$useHoverCardContext($e5715e9205c1e1fe$var$CONTENT_NAME, props.__scopeHoverCard);
|
|
145
170
|
return /*#__PURE__*/ $eFX7w$react.createElement($eFX7w$radixuireactpresence.Presence, {
|
|
146
171
|
present: forceMount || context.open
|
|
@@ -156,12 +181,11 @@ const $e5715e9205c1e1fe$export$aa4724a5938c586 = /*#__PURE__*/ $eFX7w$react.forw
|
|
|
156
181
|
displayName: $e5715e9205c1e1fe$var$CONTENT_NAME
|
|
157
182
|
});
|
|
158
183
|
/* ---------------------------------------------------------------------------------------------- */ const $e5715e9205c1e1fe$var$HoverCardContentImpl = /*#__PURE__*/ $eFX7w$react.forwardRef((props, forwardedRef)=>{
|
|
159
|
-
const { __scopeHoverCard: __scopeHoverCard ,
|
|
184
|
+
const { __scopeHoverCard: __scopeHoverCard , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , ...contentProps } = props;
|
|
160
185
|
const context = $e5715e9205c1e1fe$var$useHoverCardContext($e5715e9205c1e1fe$var$CONTENT_NAME, __scopeHoverCard);
|
|
161
186
|
const popperScope = $e5715e9205c1e1fe$var$usePopperScope(__scopeHoverCard);
|
|
162
187
|
const ref = $eFX7w$react.useRef(null);
|
|
163
188
|
const composedRefs = $eFX7w$radixuireactcomposerefs.useComposedRefs(forwardedRef, ref);
|
|
164
|
-
const PortalWrapper = portalled ? $eFX7w$radixuireactportal.Portal : $eFX7w$react.Fragment;
|
|
165
189
|
$eFX7w$react.useEffect(()=>{
|
|
166
190
|
if (ref.current) {
|
|
167
191
|
const tabbables = $e5715e9205c1e1fe$var$getTabbableNodes(ref.current);
|
|
@@ -169,7 +193,7 @@ const $e5715e9205c1e1fe$export$aa4724a5938c586 = /*#__PURE__*/ $eFX7w$react.forw
|
|
|
169
193
|
);
|
|
170
194
|
}
|
|
171
195
|
});
|
|
172
|
-
return /*#__PURE__*/ $eFX7w$react.createElement(
|
|
196
|
+
return /*#__PURE__*/ $eFX7w$react.createElement($eFX7w$radixuireactdismissablelayer.DismissableLayer, {
|
|
173
197
|
asChild: true,
|
|
174
198
|
disableOutsidePointerEvents: false,
|
|
175
199
|
onInteractOutside: onInteractOutside,
|
|
@@ -184,7 +208,7 @@ const $e5715e9205c1e1fe$export$aa4724a5938c586 = /*#__PURE__*/ $eFX7w$react.forw
|
|
|
184
208
|
// re-namespace exposed content custom property
|
|
185
209
|
['--radix-hover-card-content-transform-origin']: 'var(--radix-popper-transform-origin)'
|
|
186
210
|
}
|
|
187
|
-
})))
|
|
211
|
+
})));
|
|
188
212
|
});
|
|
189
213
|
/* -------------------------------------------------------------------------------------------------
|
|
190
214
|
* HoverCardArrow
|
|
@@ -221,6 +245,7 @@ const $e5715e9205c1e1fe$export$b9744d3e7456d806 = /*#__PURE__*/ $eFX7w$react.for
|
|
|
221
245
|
}
|
|
222
246
|
const $e5715e9205c1e1fe$export$be92b6f5f03c0fe9 = $e5715e9205c1e1fe$export$57a077cc9fbe653e;
|
|
223
247
|
const $e5715e9205c1e1fe$export$41fb9f06171c75f4 = $e5715e9205c1e1fe$export$ef9f7fd8e4ba882f;
|
|
248
|
+
const $e5715e9205c1e1fe$export$602eac185826482c = $e5715e9205c1e1fe$export$b384c6e0a789f88b;
|
|
224
249
|
const $e5715e9205c1e1fe$export$7c6e2c02157bb7d2 = $e5715e9205c1e1fe$export$aa4724a5938c586;
|
|
225
250
|
const $e5715e9205c1e1fe$export$21b07c8f274aebd5 = $e5715e9205c1e1fe$export$b9744d3e7456d806;
|
|
226
251
|
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;ACeA;;oGAEA,CAEA,MAAMW,oCAAc,GAAG,WAAvB,AAAA;AAGA,MAAM,CAACC,4CAAD,EAAyBC,yCAAzB,CAAA,GAAiDX,6CAAkB,CAACS,oCAAD,EAAiB;IACxFL,2CADwF;CAAjB,CAAzE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,2CAAiB,EAAxC,AAAA;AAUA,MAAM,CAACS,uCAAD,EAAoBC,yCAApB,CAAA,GACJJ,4CAAsB,CAAwBD,oCAAxB,CADxB,AAAA;AAYA,MAAMM,yCAAmC,GAAIC,CAAAA,KAAD,GAAwC;IAClF,MAAM,E,kBACJC,gBADI,CAAA,E,UAEJC,QAFI,CAAA,EAGJC,IAAI,EAAEC,QAHF,CAAA,E,aAIJC,WAJI,CAAA,E,cAKJC,YALI,CAAA,aAMJC,SAAS,GAAG,GANR,eAOJC,UAAU,GAAG,GAAbA,GAPI,GAQFR,KARJ,AAAM;IASN,MAAMS,WAAW,GAAGb,oCAAc,CAACK,gBAAD,CAAlC,AAAA;IACA,MAAMS,YAAY,GAAG5B,mBAAA,CAAa,CAAb,CAArB,AAAA;IACA,MAAM8B,aAAa,GAAG9B,mBAAA,CAAa,CAAb,CAAtB,AAAA;IAEA,MAAM,CAACqB,IAAI,GAAG,KAAR,EAAeU,OAAf,CAAA,GAA0B5B,4DAAoB,CAAC;QACnD6B,IAAI,EAAEV,QAD6C;QAEnDW,WAAW,EAAEV,WAFsC;QAGnDW,QAAQ,E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AAGC,CAAAA,IAAD,GAAe;YACzB,2EAAA;YACA,yEAAA;YACA,mDAAA;YACA,OAAOA,IAAI,CAACC,QAAL,IAAiB,CAAjB,GAAqBJ,UAAU,CAACK,aAAhC,GAAgDL,UAAU,CAACM,WAAlE,CAAA;SACD;KANY,CAAf,AAA6E;IAQ7E,MAAOT,MAAM,CAACU,QAAP,EAAP,CAA0BX,KAAK,CAACY,IAAN,CAAWX,MAAM,CAACY,WAAlB,CAA1B,CAAA;IACA,OAAOb,KAAP,CAAA;CACD;AAED,MAAMc,yCAAI,GAAGrF,yCAAb,AAAA;AACA,MAAMsF,yCAAO,GAAG1D,yCAAhB,AAAA;AACA,MAAM2D,yCAAO,GAAG3C,wCAAhB,AAAA;AACA,MAAM4C,yCAAK,GAAGvB,yCAAd,AAAA;;ADpTA","sources":["packages/react/hover-card/src/index.ts","packages/react/hover-card/src/HoverCard.tsx"],"sourcesContent":["export * from './HoverCard';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCard\n * -----------------------------------------------------------------------------------------------*/\n\nconst HOVERCARD_NAME = 'HoverCard';\n\ntype ScopedProps<P> = P & { __scopeHoverCard?: Scope };\nconst [createHoverCardContext, createHoverCardScope] = createContextScope(HOVERCARD_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ntype HoverCardContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpen(): void;\n onClose(): void;\n onDismiss(): void;\n};\n\nconst [HoverCardProvider, useHoverCardContext] =\n createHoverCardContext<HoverCardContextValue>(HOVERCARD_NAME);\n\ninterface HoverCardProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openDelay?: number;\n closeDelay?: number;\n}\n\nconst HoverCard: React.FC<HoverCardProps> = (props: ScopedProps<HoverCardProps>) => {\n const {\n __scopeHoverCard,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n openDelay = 700,\n closeDelay = 300,\n } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const handleOpen = React.useCallback(() => {\n clearTimeout(closeTimerRef.current);\n openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);\n }, [openDelay, setOpen]);\n\n const handleClose = React.useCallback(() => {\n clearTimeout(openTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);\n }, [closeDelay, setOpen]);\n\n const handleDismiss = React.useCallback(() => setOpen(false), [setOpen]);\n\n // cleanup any queued state updates on unmount\n React.useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current);\n clearTimeout(closeTimerRef.current);\n };\n }, []);\n\n return (\n <HoverCardProvider\n scope={__scopeHoverCard}\n open={open}\n onOpenChange={setOpen}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n >\n <PopperPrimitive.Root {...popperScope}>{children}</PopperPrimitive.Root>\n </HoverCardProvider>\n );\n};\n\nHoverCard.displayName = HOVERCARD_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'HoverCardTrigger';\n\ntype HoverCardTriggerElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface HoverCardTriggerProps extends PrimitiveLinkProps {}\n\nconst HoverCardTrigger = React.forwardRef<HoverCardTriggerElement, HoverCardTriggerProps>(\n (props: ScopedProps<HoverCardTriggerProps>, forwardedRef) => {\n const { __scopeHoverCard, ...triggerProps } = props;\n const context = useHoverCardContext(TRIGGER_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.a\n data-state={context.open ? 'open' : 'closed'}\n {...triggerProps}\n ref={forwardedRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n onFocus={composeEventHandlers(props.onFocus, context.onOpen)}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n // prevent focus event on touch devices\n onTouchStart={composeEventHandlers(props.onTouchStart, (event) => event.preventDefault())}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nHoverCardTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'HoverCardContent';\n\ntype HoverCardContentElement = HoverCardContentImplElement;\ninterface HoverCardContentProps extends HoverCardContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(\n (props: ScopedProps<HoverCardContentProps>, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useHoverCardContext(CONTENT_NAME, props.__scopeHoverCard);\n return (\n <Presence present={forceMount || context.open}>\n <HoverCardContentImpl\n data-state={context.open ? 'open' : 'closed'}\n {...contentProps}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nHoverCardContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype HoverCardContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface HoverCardContentImplProps extends PopperContentProps {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `HoverCard`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n /**\n * Event handler called when the focus moves outside of the `HoverCard`.\n * Can be prevented.\n */\n onFocusOutside?: DismissableLayerProps['onFocusOutside'];\n /**\n * Event handler called when an interaction happens outside the `HoverCard`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: DismissableLayerProps['onInteractOutside'];\n /**\n * Whether the `HoverCard` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n}\n\nconst HoverCardContentImpl = React.forwardRef<\n HoverCardContentImplElement,\n HoverCardContentImplProps\n>((props: ScopedProps<HoverCardContentImplProps>, forwardedRef) => {\n const {\n __scopeHoverCard,\n portalled = true,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = useHoverCardContext(CONTENT_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n const ref = React.useRef<HoverCardContentImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const PortalWrapper = portalled ? Portal : React.Fragment;\n\n React.useEffect(() => {\n if (ref.current) {\n const tabbables = getTabbableNodes(ref.current);\n tabbables.forEach((tabbable) => tabbable.setAttribute('tabindex', '-1'));\n }\n });\n\n return (\n <PortalWrapper>\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={context.onDismiss}\n >\n <PopperPrimitive.Content\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom property\n ['--radix-hover-card-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n />\n </DismissableLayer>\n </PortalWrapper>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'HoverCardArrow';\n\ntype HoverCardArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface HoverCardArrowProps extends PopperArrowProps {}\n\nconst HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(\n (props: ScopedProps<HoverCardArrowProps>, forwardedRef) => {\n const { __scopeHoverCard, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nHoverCardArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction excludeTouch<E>(eventHandler: () => void) {\n return (event: React.PointerEvent<E>) =>\n event.pointerType === 'touch' ? undefined : eventHandler();\n}\n\n/**\n * Returns a list of nodes that can be in the tab sequence.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n */\nfunction getTabbableNodes(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n return nodes;\n}\n\nconst Root = HoverCard;\nconst Trigger = HoverCardTrigger;\nconst Content = HoverCardContent;\nconst Arrow = HoverCardArrow;\n\nexport {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Content,\n Arrow,\n};\nexport type { HoverCardProps, HoverCardTriggerProps, HoverCardContentProps, HoverCardArrowProps };\n"],"names":["React","composeEventHandlers","createContextScope","useControllableState","useComposedRefs","PopperPrimitive","createPopperScope","Portal","Presence","Primitive","DismissableLayer","HOVERCARD_NAME","createHoverCardContext","createHoverCardScope","usePopperScope","HoverCardProvider","useHoverCardContext","HoverCard","props","__scopeHoverCard","children","open","openProp","defaultOpen","onOpenChange","openDelay","closeDelay","popperScope","openTimerRef","useRef","closeTimerRef","setOpen","prop","defaultProp","onChange","handleOpen","useCallback","clearTimeout","current","window","setTimeout","handleClose","handleDismiss","useEffect","TRIGGER_NAME","HoverCardTrigger","forwardRef","forwardedRef","triggerProps","context","onPointerEnter","excludeTouch","onOpen","onPointerLeave","onClose","onFocus","onBlur","onTouchStart","event","preventDefault","CONTENT_NAME","HoverCardContent","forceMount","contentProps","HoverCardContentImpl","portalled","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","ref","composedRefs","PortalWrapper","Fragment","tabbables","getTabbableNodes","forEach","tabbable","setAttribute","onDismiss","style","ARROW_NAME","HoverCardArrow","arrowProps","eventHandler","pointerType","undefined","container","nodes","walker","document","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tabIndex","FILTER_ACCEPT","FILTER_SKIP","nextNode","push","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ADpVA","sources":["packages/react/hover-card/src/index.ts","packages/react/hover-card/src/HoverCard.tsx"],"sourcesContent":["export * from './HoverCard';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCard\n * -----------------------------------------------------------------------------------------------*/\n\nconst HOVERCARD_NAME = 'HoverCard';\n\ntype ScopedProps<P> = P & { __scopeHoverCard?: Scope };\nconst [createHoverCardContext, createHoverCardScope] = createContextScope(HOVERCARD_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ntype HoverCardContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpen(): void;\n onClose(): void;\n onDismiss(): void;\n};\n\nconst [HoverCardProvider, useHoverCardContext] =\n createHoverCardContext<HoverCardContextValue>(HOVERCARD_NAME);\n\ninterface HoverCardProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openDelay?: number;\n closeDelay?: number;\n}\n\nconst HoverCard: React.FC<HoverCardProps> = (props: ScopedProps<HoverCardProps>) => {\n const {\n __scopeHoverCard,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n openDelay = 700,\n closeDelay = 300,\n } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const handleOpen = React.useCallback(() => {\n clearTimeout(closeTimerRef.current);\n openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);\n }, [openDelay, setOpen]);\n\n const handleClose = React.useCallback(() => {\n clearTimeout(openTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);\n }, [closeDelay, setOpen]);\n\n const handleDismiss = React.useCallback(() => setOpen(false), [setOpen]);\n\n // cleanup any queued state updates on unmount\n React.useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current);\n clearTimeout(closeTimerRef.current);\n };\n }, []);\n\n return (\n <HoverCardProvider\n scope={__scopeHoverCard}\n open={open}\n onOpenChange={setOpen}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n >\n <PopperPrimitive.Root {...popperScope}>{children}</PopperPrimitive.Root>\n </HoverCardProvider>\n );\n};\n\nHoverCard.displayName = HOVERCARD_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'HoverCardTrigger';\n\ntype HoverCardTriggerElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface HoverCardTriggerProps extends PrimitiveLinkProps {}\n\nconst HoverCardTrigger = React.forwardRef<HoverCardTriggerElement, HoverCardTriggerProps>(\n (props: ScopedProps<HoverCardTriggerProps>, forwardedRef) => {\n const { __scopeHoverCard, ...triggerProps } = props;\n const context = useHoverCardContext(TRIGGER_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.a\n data-state={context.open ? 'open' : 'closed'}\n {...triggerProps}\n ref={forwardedRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n onFocus={composeEventHandlers(props.onFocus, context.onOpen)}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n // prevent focus event on touch devices\n onTouchStart={composeEventHandlers(props.onTouchStart, (event) => event.preventDefault())}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nHoverCardTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'HoverCardPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createHoverCardContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;\ninterface HoverCardPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardPortal: React.FC<HoverCardPortalProps> = (\n props: ScopedProps<HoverCardPortalProps>\n) => {\n const { __scopeHoverCard, forceMount, children, container } = props;\n const context = useHoverCardContext(PORTAL_NAME, __scopeHoverCard);\n return (\n <PortalProvider scope={__scopeHoverCard} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <UnstablePortal asChild container={container}>\n {children}\n </UnstablePortal>\n </Presence>\n </PortalProvider>\n );\n};\n\nHoverCardPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'HoverCardContent';\n\ntype HoverCardContentElement = HoverCardContentImplElement;\ninterface HoverCardContentProps extends HoverCardContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(\n (props: ScopedProps<HoverCardContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeHoverCard);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useHoverCardContext(CONTENT_NAME, props.__scopeHoverCard);\n return (\n <Presence present={forceMount || context.open}>\n <HoverCardContentImpl\n data-state={context.open ? 'open' : 'closed'}\n {...contentProps}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nHoverCardContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype HoverCardContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface HoverCardContentImplProps extends PopperContentProps {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `HoverCard`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n /**\n * Event handler called when the focus moves outside of the `HoverCard`.\n * Can be prevented.\n */\n onFocusOutside?: DismissableLayerProps['onFocusOutside'];\n /**\n * Event handler called when an interaction happens outside the `HoverCard`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: DismissableLayerProps['onInteractOutside'];\n}\n\nconst HoverCardContentImpl = React.forwardRef<\n HoverCardContentImplElement,\n HoverCardContentImplProps\n>((props: ScopedProps<HoverCardContentImplProps>, forwardedRef) => {\n const {\n __scopeHoverCard,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = useHoverCardContext(CONTENT_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n const ref = React.useRef<HoverCardContentImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n if (ref.current) {\n const tabbables = getTabbableNodes(ref.current);\n tabbables.forEach((tabbable) => tabbable.setAttribute('tabindex', '-1'));\n }\n });\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={context.onDismiss}\n >\n <PopperPrimitive.Content\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom property\n ['--radix-hover-card-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n />\n </DismissableLayer>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'HoverCardArrow';\n\ntype HoverCardArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface HoverCardArrowProps extends PopperArrowProps {}\n\nconst HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(\n (props: ScopedProps<HoverCardArrowProps>, forwardedRef) => {\n const { __scopeHoverCard, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nHoverCardArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction excludeTouch<E>(eventHandler: () => void) {\n return (event: React.PointerEvent<E>) =>\n event.pointerType === 'touch' ? undefined : eventHandler();\n}\n\n/**\n * Returns a list of nodes that can be in the tab sequence.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n */\nfunction getTabbableNodes(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n return nodes;\n}\n\nconst Root = HoverCard;\nconst Trigger = HoverCardTrigger;\nconst Portal = HoverCardPortal;\nconst Content = HoverCardContent;\nconst Arrow = HoverCardArrow;\n\nexport {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardPortal,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n};\nexport type {\n HoverCardProps,\n HoverCardTriggerProps,\n HoverCardPortalProps,\n HoverCardContentProps,\n HoverCardArrowProps,\n};\n"],"names":["React","composeEventHandlers","createContextScope","useControllableState","useComposedRefs","PopperPrimitive","createPopperScope","UnstablePortal","Presence","Primitive","DismissableLayer","HOVERCARD_NAME","createHoverCardContext","createHoverCardScope","usePopperScope","HoverCardProvider","useHoverCardContext","HoverCard","props","__scopeHoverCard","children","open","openProp","defaultOpen","onOpenChange","openDelay","closeDelay","popperScope","openTimerRef","useRef","closeTimerRef","setOpen","prop","defaultProp","onChange","handleOpen","useCallback","clearTimeout","current","window","setTimeout","handleClose","handleDismiss","useEffect","TRIGGER_NAME","HoverCardTrigger","forwardRef","forwardedRef","triggerProps","context","onPointerEnter","excludeTouch","onOpen","onPointerLeave","onClose","onFocus","onBlur","onTouchStart","event","preventDefault","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","undefined","HoverCardPortal","container","CONTENT_NAME","HoverCardContent","portalContext","contentProps","HoverCardContentImpl","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","ref","composedRefs","tabbables","getTabbableNodes","forEach","tabbable","setAttribute","onDismiss","style","ARROW_NAME","HoverCardArrow","arrowProps","eventHandler","pointerType","nodes","walker","document","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tabIndex","FILTER_ACCEPT","FILTER_SKIP","nextNode","push","currentNode","Root","Trigger","Portal","Content","Arrow"],"version":3,"file":"index.js.map"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import $eRSIW$babelruntimehelpersesmextends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import {useRef as $eRSIW$useRef, useCallback as $eRSIW$useCallback, useEffect as $eRSIW$useEffect, createElement as $eRSIW$createElement, forwardRef as $eRSIW$forwardRef
|
|
2
|
+
import {useRef as $eRSIW$useRef, useCallback as $eRSIW$useCallback, useEffect as $eRSIW$useEffect, createElement as $eRSIW$createElement, forwardRef as $eRSIW$forwardRef} from "react";
|
|
3
3
|
import {composeEventHandlers as $eRSIW$composeEventHandlers} from "@radix-ui/primitive";
|
|
4
4
|
import {createContextScope as $eRSIW$createContextScope} from "@radix-ui/react-context";
|
|
5
5
|
import {useControllableState as $eRSIW$useControllableState} from "@radix-ui/react-use-controllable-state";
|
|
6
6
|
import {useComposedRefs as $eRSIW$useComposedRefs} from "@radix-ui/react-compose-refs";
|
|
7
7
|
import {createPopperScope as $eRSIW$createPopperScope, Root as $eRSIW$Root, Anchor as $eRSIW$Anchor, Content as $eRSIW$Content, Arrow as $eRSIW$Arrow} from "@radix-ui/react-popper";
|
|
8
|
-
import {
|
|
8
|
+
import {UnstablePortal as $eRSIW$UnstablePortal} from "@radix-ui/react-portal";
|
|
9
9
|
import {Presence as $eRSIW$Presence} from "@radix-ui/react-presence";
|
|
10
10
|
import {Primitive as $eRSIW$Primitive} from "@radix-ui/react-primitive";
|
|
11
11
|
import {DismissableLayer as $eRSIW$DismissableLayer} from "@radix-ui/react-dismissable-layer";
|
|
@@ -18,10 +18,12 @@ var $cef8881cdc69808e$exports = {};
|
|
|
18
18
|
$parcel$export($cef8881cdc69808e$exports, "createHoverCardScope", () => $cef8881cdc69808e$export$47b6998a836b7260);
|
|
19
19
|
$parcel$export($cef8881cdc69808e$exports, "HoverCard", () => $cef8881cdc69808e$export$57a077cc9fbe653e);
|
|
20
20
|
$parcel$export($cef8881cdc69808e$exports, "HoverCardTrigger", () => $cef8881cdc69808e$export$ef9f7fd8e4ba882f);
|
|
21
|
+
$parcel$export($cef8881cdc69808e$exports, "HoverCardPortal", () => $cef8881cdc69808e$export$b384c6e0a789f88b);
|
|
21
22
|
$parcel$export($cef8881cdc69808e$exports, "HoverCardContent", () => $cef8881cdc69808e$export$aa4724a5938c586);
|
|
22
23
|
$parcel$export($cef8881cdc69808e$exports, "HoverCardArrow", () => $cef8881cdc69808e$export$b9744d3e7456d806);
|
|
23
24
|
$parcel$export($cef8881cdc69808e$exports, "Root", () => $cef8881cdc69808e$export$be92b6f5f03c0fe9);
|
|
24
25
|
$parcel$export($cef8881cdc69808e$exports, "Trigger", () => $cef8881cdc69808e$export$41fb9f06171c75f4);
|
|
26
|
+
$parcel$export($cef8881cdc69808e$exports, "Portal", () => $cef8881cdc69808e$export$602eac185826482c);
|
|
25
27
|
$parcel$export($cef8881cdc69808e$exports, "Content", () => $cef8881cdc69808e$export$7c6e2c02157bb7d2);
|
|
26
28
|
$parcel$export($cef8881cdc69808e$exports, "Arrow", () => $cef8881cdc69808e$export$21b07c8f274aebd5);
|
|
27
29
|
|
|
@@ -117,11 +119,34 @@ const $cef8881cdc69808e$export$ef9f7fd8e4ba882f = /*#__PURE__*/ $eRSIW$forwardRe
|
|
|
117
119
|
/*#__PURE__*/ Object.assign($cef8881cdc69808e$export$ef9f7fd8e4ba882f, {
|
|
118
120
|
displayName: $cef8881cdc69808e$var$TRIGGER_NAME
|
|
119
121
|
});
|
|
122
|
+
/* -------------------------------------------------------------------------------------------------
|
|
123
|
+
* HoverCardPortal
|
|
124
|
+
* -----------------------------------------------------------------------------------------------*/ const $cef8881cdc69808e$var$PORTAL_NAME = 'HoverCardPortal';
|
|
125
|
+
const [$cef8881cdc69808e$var$PortalProvider, $cef8881cdc69808e$var$usePortalContext] = $cef8881cdc69808e$var$createHoverCardContext($cef8881cdc69808e$var$PORTAL_NAME, {
|
|
126
|
+
forceMount: undefined
|
|
127
|
+
});
|
|
128
|
+
const $cef8881cdc69808e$export$b384c6e0a789f88b = (props)=>{
|
|
129
|
+
const { __scopeHoverCard: __scopeHoverCard , forceMount: forceMount , children: children , container: container } = props;
|
|
130
|
+
const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$PORTAL_NAME, __scopeHoverCard);
|
|
131
|
+
return /*#__PURE__*/ $eRSIW$createElement($cef8881cdc69808e$var$PortalProvider, {
|
|
132
|
+
scope: __scopeHoverCard,
|
|
133
|
+
forceMount: forceMount
|
|
134
|
+
}, /*#__PURE__*/ $eRSIW$createElement($eRSIW$Presence, {
|
|
135
|
+
present: forceMount || context.open
|
|
136
|
+
}, /*#__PURE__*/ $eRSIW$createElement($eRSIW$UnstablePortal, {
|
|
137
|
+
asChild: true,
|
|
138
|
+
container: container
|
|
139
|
+
}, children)));
|
|
140
|
+
};
|
|
141
|
+
/*#__PURE__*/ Object.assign($cef8881cdc69808e$export$b384c6e0a789f88b, {
|
|
142
|
+
displayName: $cef8881cdc69808e$var$PORTAL_NAME
|
|
143
|
+
});
|
|
120
144
|
/* -------------------------------------------------------------------------------------------------
|
|
121
145
|
* HoverCardContent
|
|
122
146
|
* -----------------------------------------------------------------------------------------------*/ const $cef8881cdc69808e$var$CONTENT_NAME = 'HoverCardContent';
|
|
123
147
|
const $cef8881cdc69808e$export$aa4724a5938c586 = /*#__PURE__*/ $eRSIW$forwardRef((props, forwardedRef)=>{
|
|
124
|
-
const
|
|
148
|
+
const portalContext = $cef8881cdc69808e$var$usePortalContext($cef8881cdc69808e$var$CONTENT_NAME, props.__scopeHoverCard);
|
|
149
|
+
const { forceMount: forceMount = portalContext.forceMount , ...contentProps } = props;
|
|
125
150
|
const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$CONTENT_NAME, props.__scopeHoverCard);
|
|
126
151
|
return /*#__PURE__*/ $eRSIW$createElement($eRSIW$Presence, {
|
|
127
152
|
present: forceMount || context.open
|
|
@@ -137,12 +162,11 @@ const $cef8881cdc69808e$export$aa4724a5938c586 = /*#__PURE__*/ $eRSIW$forwardRef
|
|
|
137
162
|
displayName: $cef8881cdc69808e$var$CONTENT_NAME
|
|
138
163
|
});
|
|
139
164
|
/* ---------------------------------------------------------------------------------------------- */ const $cef8881cdc69808e$var$HoverCardContentImpl = /*#__PURE__*/ $eRSIW$forwardRef((props, forwardedRef)=>{
|
|
140
|
-
const { __scopeHoverCard: __scopeHoverCard ,
|
|
165
|
+
const { __scopeHoverCard: __scopeHoverCard , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , ...contentProps } = props;
|
|
141
166
|
const context = $cef8881cdc69808e$var$useHoverCardContext($cef8881cdc69808e$var$CONTENT_NAME, __scopeHoverCard);
|
|
142
167
|
const popperScope = $cef8881cdc69808e$var$usePopperScope(__scopeHoverCard);
|
|
143
168
|
const ref = $eRSIW$useRef(null);
|
|
144
169
|
const composedRefs = $eRSIW$useComposedRefs(forwardedRef, ref);
|
|
145
|
-
const PortalWrapper = portalled ? $eRSIW$Portal : $eRSIW$Fragment;
|
|
146
170
|
$eRSIW$useEffect(()=>{
|
|
147
171
|
if (ref.current) {
|
|
148
172
|
const tabbables = $cef8881cdc69808e$var$getTabbableNodes(ref.current);
|
|
@@ -150,7 +174,7 @@ const $cef8881cdc69808e$export$aa4724a5938c586 = /*#__PURE__*/ $eRSIW$forwardRef
|
|
|
150
174
|
);
|
|
151
175
|
}
|
|
152
176
|
});
|
|
153
|
-
return /*#__PURE__*/ $eRSIW$createElement(
|
|
177
|
+
return /*#__PURE__*/ $eRSIW$createElement($eRSIW$DismissableLayer, {
|
|
154
178
|
asChild: true,
|
|
155
179
|
disableOutsidePointerEvents: false,
|
|
156
180
|
onInteractOutside: onInteractOutside,
|
|
@@ -165,7 +189,7 @@ const $cef8881cdc69808e$export$aa4724a5938c586 = /*#__PURE__*/ $eRSIW$forwardRef
|
|
|
165
189
|
// re-namespace exposed content custom property
|
|
166
190
|
['--radix-hover-card-content-transform-origin']: 'var(--radix-popper-transform-origin)'
|
|
167
191
|
}
|
|
168
|
-
})))
|
|
192
|
+
})));
|
|
169
193
|
});
|
|
170
194
|
/* -------------------------------------------------------------------------------------------------
|
|
171
195
|
* HoverCardArrow
|
|
@@ -202,11 +226,12 @@ const $cef8881cdc69808e$export$b9744d3e7456d806 = /*#__PURE__*/ $eRSIW$forwardRe
|
|
|
202
226
|
}
|
|
203
227
|
const $cef8881cdc69808e$export$be92b6f5f03c0fe9 = $cef8881cdc69808e$export$57a077cc9fbe653e;
|
|
204
228
|
const $cef8881cdc69808e$export$41fb9f06171c75f4 = $cef8881cdc69808e$export$ef9f7fd8e4ba882f;
|
|
229
|
+
const $cef8881cdc69808e$export$602eac185826482c = $cef8881cdc69808e$export$b384c6e0a789f88b;
|
|
205
230
|
const $cef8881cdc69808e$export$7c6e2c02157bb7d2 = $cef8881cdc69808e$export$aa4724a5938c586;
|
|
206
231
|
const $cef8881cdc69808e$export$21b07c8f274aebd5 = $cef8881cdc69808e$export$b9744d3e7456d806;
|
|
207
232
|
|
|
208
233
|
|
|
209
234
|
|
|
210
235
|
|
|
211
|
-
export {$cef8881cdc69808e$export$47b6998a836b7260 as createHoverCardScope, $cef8881cdc69808e$export$57a077cc9fbe653e as HoverCard, $cef8881cdc69808e$export$ef9f7fd8e4ba882f as HoverCardTrigger, $cef8881cdc69808e$export$aa4724a5938c586 as HoverCardContent, $cef8881cdc69808e$export$b9744d3e7456d806 as HoverCardArrow, $cef8881cdc69808e$export$be92b6f5f03c0fe9 as Root, $cef8881cdc69808e$export$41fb9f06171c75f4 as Trigger, $cef8881cdc69808e$export$7c6e2c02157bb7d2 as Content, $cef8881cdc69808e$export$21b07c8f274aebd5 as Arrow};
|
|
236
|
+
export {$cef8881cdc69808e$export$47b6998a836b7260 as createHoverCardScope, $cef8881cdc69808e$export$57a077cc9fbe653e as HoverCard, $cef8881cdc69808e$export$ef9f7fd8e4ba882f as HoverCardTrigger, $cef8881cdc69808e$export$b384c6e0a789f88b as HoverCardPortal, $cef8881cdc69808e$export$aa4724a5938c586 as HoverCardContent, $cef8881cdc69808e$export$b9744d3e7456d806 as HoverCardArrow, $cef8881cdc69808e$export$be92b6f5f03c0fe9 as Root, $cef8881cdc69808e$export$41fb9f06171c75f4 as Trigger, $cef8881cdc69808e$export$602eac185826482c as Portal, $cef8881cdc69808e$export$7c6e2c02157bb7d2 as Content, $cef8881cdc69808e$export$21b07c8f274aebd5 as Arrow};
|
|
212
237
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;ACeA;;oGAEA,CAEA,MAAMW,oCAAc,GAAG,WAAvB,AAAA;AAGA,MAAM,CAACC,4CAAD,EAAyBC,yCAAzB,CAAA,GAAiDX,yBAAkB,CAACS,oCAAD,EAAiB;IACxFL,wBADwF;CAAjB,CAAzE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,wBAAiB,EAAxC,AAAA;AAUA,MAAM,CAACS,uCAAD,EAAoBC,yCAApB,CAAA,GACJJ,4CAAsB,CAAwBD,oCAAxB,CADxB,AAAA;AAYA,MAAMM,yCAAmC,GAAIC,CAAAA,KAAD,GAAwC;IAClF,MAAM,E,kBACJC,gBADI,CAAA,E,UAEJC,QAFI,CAAA,EAGJC,IAAI,EAAEC,QAHF,CAAA,E,aAIJC,WAJI,CAAA,E,cAKJC,YALI,CAAA,aAMJC,SAAS,GAAG,G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,CAEA,SAASI,kCAAT,CAAyBiC,YAAzB,EAAmD;IACjD,OAAQ1B,CAAAA,KAAD,GACLA,KAAK,CAAC2B,WAAN,KAAsB,OAAtB,GAAgCC,SAAhC,GAA4CF,YAAY,EAD1D;IAAA,CAAA;CAED;AAED;;;GAGA,CACA,SAAST,sCAAT,CAA0BY,SAA1B,EAAkD;IAChD,MAAMC,KAAoB,GAAG,EAA7B,AAAA;IACA,MAAMC,MAAM,GAAGC,QAAQ,CAACC,gBAAT,CAA0BJ,SAA1B,EAAqCK,UAAU,CAACC,YAAhD,EAA8D;QAC3EC,UAAU,EAAGC,CAAAA,IAAD,GAAe;YACzB,2EAAA;YACA,yEAAA;YACA,mDAAA;YACA,OAAOA,IAAI,CAACC,QAAL,IAAiB,CAAjB,GAAqBJ,UAAU,CAACK,aAAhC,GAAgDL,UAAU,CAACM,WAAlE,CAAA;SACD;KANY,CAAf,AAA6E;IAQ7E,MAAOT,MAAM,CAACU,QAAP,EAAP,CAA0BX,KAAK,CAACY,IAAN,CAAWX,MAAM,CAACY,WAAlB,CAA1B,CAAA;IACA,OAAOb,KAAP,CAAA;CACD;AAED,MAAMc,yCAAI,GAAGrF,yCAAb,AAAA;AACA,MAAMsF,yCAAO,GAAG1D,yCAAhB,AAAA;AACA,MAAM2D,yCAAO,GAAG3C,wCAAhB,AAAA;AACA,MAAM4C,yCAAK,GAAGvB,yCAAd,AAAA;;ADpTA","sources":["packages/react/hover-card/src/index.ts","packages/react/hover-card/src/HoverCard.tsx"],"sourcesContent":["export * from './HoverCard';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { Portal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCard\n * -----------------------------------------------------------------------------------------------*/\n\nconst HOVERCARD_NAME = 'HoverCard';\n\ntype ScopedProps<P> = P & { __scopeHoverCard?: Scope };\nconst [createHoverCardContext, createHoverCardScope] = createContextScope(HOVERCARD_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ntype HoverCardContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpen(): void;\n onClose(): void;\n onDismiss(): void;\n};\n\nconst [HoverCardProvider, useHoverCardContext] =\n createHoverCardContext<HoverCardContextValue>(HOVERCARD_NAME);\n\ninterface HoverCardProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openDelay?: number;\n closeDelay?: number;\n}\n\nconst HoverCard: React.FC<HoverCardProps> = (props: ScopedProps<HoverCardProps>) => {\n const {\n __scopeHoverCard,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n openDelay = 700,\n closeDelay = 300,\n } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const handleOpen = React.useCallback(() => {\n clearTimeout(closeTimerRef.current);\n openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);\n }, [openDelay, setOpen]);\n\n const handleClose = React.useCallback(() => {\n clearTimeout(openTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);\n }, [closeDelay, setOpen]);\n\n const handleDismiss = React.useCallback(() => setOpen(false), [setOpen]);\n\n // cleanup any queued state updates on unmount\n React.useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current);\n clearTimeout(closeTimerRef.current);\n };\n }, []);\n\n return (\n <HoverCardProvider\n scope={__scopeHoverCard}\n open={open}\n onOpenChange={setOpen}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n >\n <PopperPrimitive.Root {...popperScope}>{children}</PopperPrimitive.Root>\n </HoverCardProvider>\n );\n};\n\nHoverCard.displayName = HOVERCARD_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'HoverCardTrigger';\n\ntype HoverCardTriggerElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface HoverCardTriggerProps extends PrimitiveLinkProps {}\n\nconst HoverCardTrigger = React.forwardRef<HoverCardTriggerElement, HoverCardTriggerProps>(\n (props: ScopedProps<HoverCardTriggerProps>, forwardedRef) => {\n const { __scopeHoverCard, ...triggerProps } = props;\n const context = useHoverCardContext(TRIGGER_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.a\n data-state={context.open ? 'open' : 'closed'}\n {...triggerProps}\n ref={forwardedRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n onFocus={composeEventHandlers(props.onFocus, context.onOpen)}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n // prevent focus event on touch devices\n onTouchStart={composeEventHandlers(props.onTouchStart, (event) => event.preventDefault())}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nHoverCardTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'HoverCardContent';\n\ntype HoverCardContentElement = HoverCardContentImplElement;\ninterface HoverCardContentProps extends HoverCardContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(\n (props: ScopedProps<HoverCardContentProps>, forwardedRef) => {\n const { forceMount, ...contentProps } = props;\n const context = useHoverCardContext(CONTENT_NAME, props.__scopeHoverCard);\n return (\n <Presence present={forceMount || context.open}>\n <HoverCardContentImpl\n data-state={context.open ? 'open' : 'closed'}\n {...contentProps}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nHoverCardContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype HoverCardContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface HoverCardContentImplProps extends PopperContentProps {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `HoverCard`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n /**\n * Event handler called when the focus moves outside of the `HoverCard`.\n * Can be prevented.\n */\n onFocusOutside?: DismissableLayerProps['onFocusOutside'];\n /**\n * Event handler called when an interaction happens outside the `HoverCard`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: DismissableLayerProps['onInteractOutside'];\n /**\n * Whether the `HoverCard` should render in a `Portal`\n * (default: `true`)\n */\n portalled?: boolean;\n}\n\nconst HoverCardContentImpl = React.forwardRef<\n HoverCardContentImplElement,\n HoverCardContentImplProps\n>((props: ScopedProps<HoverCardContentImplProps>, forwardedRef) => {\n const {\n __scopeHoverCard,\n portalled = true,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = useHoverCardContext(CONTENT_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n const ref = React.useRef<HoverCardContentImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n const PortalWrapper = portalled ? Portal : React.Fragment;\n\n React.useEffect(() => {\n if (ref.current) {\n const tabbables = getTabbableNodes(ref.current);\n tabbables.forEach((tabbable) => tabbable.setAttribute('tabindex', '-1'));\n }\n });\n\n return (\n <PortalWrapper>\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={context.onDismiss}\n >\n <PopperPrimitive.Content\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom property\n ['--radix-hover-card-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n />\n </DismissableLayer>\n </PortalWrapper>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'HoverCardArrow';\n\ntype HoverCardArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface HoverCardArrowProps extends PopperArrowProps {}\n\nconst HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(\n (props: ScopedProps<HoverCardArrowProps>, forwardedRef) => {\n const { __scopeHoverCard, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nHoverCardArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction excludeTouch<E>(eventHandler: () => void) {\n return (event: React.PointerEvent<E>) =>\n event.pointerType === 'touch' ? undefined : eventHandler();\n}\n\n/**\n * Returns a list of nodes that can be in the tab sequence.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n */\nfunction getTabbableNodes(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n return nodes;\n}\n\nconst Root = HoverCard;\nconst Trigger = HoverCardTrigger;\nconst Content = HoverCardContent;\nconst Arrow = HoverCardArrow;\n\nexport {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Content,\n Arrow,\n};\nexport type { HoverCardProps, HoverCardTriggerProps, HoverCardContentProps, HoverCardArrowProps };\n"],"names":["React","composeEventHandlers","createContextScope","useControllableState","useComposedRefs","PopperPrimitive","createPopperScope","Portal","Presence","Primitive","DismissableLayer","HOVERCARD_NAME","createHoverCardContext","createHoverCardScope","usePopperScope","HoverCardProvider","useHoverCardContext","HoverCard","props","__scopeHoverCard","children","open","openProp","defaultOpen","onOpenChange","openDelay","closeDelay","popperScope","openTimerRef","useRef","closeTimerRef","setOpen","prop","defaultProp","onChange","handleOpen","useCallback","clearTimeout","current","window","setTimeout","handleClose","handleDismiss","useEffect","TRIGGER_NAME","HoverCardTrigger","forwardRef","forwardedRef","triggerProps","context","onPointerEnter","excludeTouch","onOpen","onPointerLeave","onClose","onFocus","onBlur","onTouchStart","event","preventDefault","CONTENT_NAME","HoverCardContent","forceMount","contentProps","HoverCardContentImpl","portalled","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","ref","composedRefs","PortalWrapper","Fragment","tabbables","getTabbableNodes","forEach","tabbable","setAttribute","onDismiss","style","ARROW_NAME","HoverCardArrow","arrowProps","eventHandler","pointerType","undefined","container","nodes","walker","document","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tabIndex","FILTER_ACCEPT","FILTER_SKIP","nextNode","push","currentNode","Root","Trigger","Content","Arrow"],"version":3,"file":"index.module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;ACeA;;oGAEA,CAEA,MAAMW,oCAAc,GAAG,WAAvB,AAAA;AAGA,MAAM,CAACC,4CAAD,EAAyBC,yCAAzB,CAAA,GAAiDX,yBAAkB,CAACS,oCAAD,EAAiB;IACxFL,wBADwF;CAAjB,CAAzE,AAAA;AAGA,MAAMQ,oCAAc,GAAGR,wBAAiB,EAAxC,AAAA;AAUA,MAAM,CAACS,uCAAD,EAAoBC,yCAApB,CAAA,GACJJ,4CAAsB,CAAwBD,oCAAxB,CADxB,AAAA;AAYA,MAAMM,yCAAmC,GAAIC,CAAAA,KAAD,GAAwC;IAClF,MAAM,E,kBACJC,gBADI,CAAA,E,UAEJC,QAFI,CAAA,EAGJC,IAAI,EAAEC,QAHF,CAAA,E,aAIJC,WAJI,CAAA,E,cAKJC,YALI,CAAA,aAMJC,SAAS,GAAG,GANR,eAOJC,UAAU,GAAG,GAAbA,GAPI,GAQFR,KARJ,AAAM;IASN,MAAMS,WAAW,GAAGb,oCAAc,CAACK,gBAAD,CAAlC,AAAA;IACA,MAAMS,YAAY,GAAG5B,aAAA,CAAa,CAAb,CAArB,AAAA;IACA,MAAM8B,aAAa,GAAG9B,aAAA,CAAa,CAAb,CAAtB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7E,MAAOT,MAAM,CAACU,QAAP,EAAP,CAA0BX,KAAK,CAACY,IAAN,CAAWX,MAAM,CAACY,WAAlB,CAA1B,CAAA;IACA,OAAOb,KAAP,CAAA;CACD;AAED,MAAMc,yCAAI,GAAGvF,yCAAb,AAAA;AACA,MAAMwF,yCAAO,GAAG5D,yCAAhB,AAAA;AACA,MAAM6D,yCAAM,GAAGzC,yCAAf,AAAA;AACA,MAAM0C,yCAAO,GAAGvC,wCAAhB,AAAA;AACA,MAAMwC,yCAAK,GAAGtB,yCAAd,AAAA;;ADpVA","sources":["packages/react/hover-card/src/index.ts","packages/react/hover-card/src/HoverCard.tsx"],"sourcesContent":["export * from './HoverCard';\n","import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport * as PopperPrimitive from '@radix-ui/react-popper';\nimport { createPopperScope } from '@radix-ui/react-popper';\nimport { UnstablePortal } from '@radix-ui/react-portal';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport { DismissableLayer } from '@radix-ui/react-dismissable-layer';\n\nimport type * as Radix from '@radix-ui/react-primitive';\nimport type { Scope } from '@radix-ui/react-context';\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCard\n * -----------------------------------------------------------------------------------------------*/\n\nconst HOVERCARD_NAME = 'HoverCard';\n\ntype ScopedProps<P> = P & { __scopeHoverCard?: Scope };\nconst [createHoverCardContext, createHoverCardScope] = createContextScope(HOVERCARD_NAME, [\n createPopperScope,\n]);\nconst usePopperScope = createPopperScope();\n\ntype HoverCardContextValue = {\n open: boolean;\n onOpenChange(open: boolean): void;\n onOpen(): void;\n onClose(): void;\n onDismiss(): void;\n};\n\nconst [HoverCardProvider, useHoverCardContext] =\n createHoverCardContext<HoverCardContextValue>(HOVERCARD_NAME);\n\ninterface HoverCardProps {\n children?: React.ReactNode;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openDelay?: number;\n closeDelay?: number;\n}\n\nconst HoverCard: React.FC<HoverCardProps> = (props: ScopedProps<HoverCardProps>) => {\n const {\n __scopeHoverCard,\n children,\n open: openProp,\n defaultOpen,\n onOpenChange,\n openDelay = 700,\n closeDelay = 300,\n } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n const openTimerRef = React.useRef(0);\n const closeTimerRef = React.useRef(0);\n\n const [open = false, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: defaultOpen,\n onChange: onOpenChange,\n });\n\n const handleOpen = React.useCallback(() => {\n clearTimeout(closeTimerRef.current);\n openTimerRef.current = window.setTimeout(() => setOpen(true), openDelay);\n }, [openDelay, setOpen]);\n\n const handleClose = React.useCallback(() => {\n clearTimeout(openTimerRef.current);\n closeTimerRef.current = window.setTimeout(() => setOpen(false), closeDelay);\n }, [closeDelay, setOpen]);\n\n const handleDismiss = React.useCallback(() => setOpen(false), [setOpen]);\n\n // cleanup any queued state updates on unmount\n React.useEffect(() => {\n return () => {\n clearTimeout(openTimerRef.current);\n clearTimeout(closeTimerRef.current);\n };\n }, []);\n\n return (\n <HoverCardProvider\n scope={__scopeHoverCard}\n open={open}\n onOpenChange={setOpen}\n onOpen={handleOpen}\n onClose={handleClose}\n onDismiss={handleDismiss}\n >\n <PopperPrimitive.Root {...popperScope}>{children}</PopperPrimitive.Root>\n </HoverCardProvider>\n );\n};\n\nHoverCard.displayName = HOVERCARD_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'HoverCardTrigger';\n\ntype HoverCardTriggerElement = React.ElementRef<typeof Primitive.a>;\ntype PrimitiveLinkProps = Radix.ComponentPropsWithoutRef<typeof Primitive.a>;\ninterface HoverCardTriggerProps extends PrimitiveLinkProps {}\n\nconst HoverCardTrigger = React.forwardRef<HoverCardTriggerElement, HoverCardTriggerProps>(\n (props: ScopedProps<HoverCardTriggerProps>, forwardedRef) => {\n const { __scopeHoverCard, ...triggerProps } = props;\n const context = useHoverCardContext(TRIGGER_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n return (\n <PopperPrimitive.Anchor asChild {...popperScope}>\n <Primitive.a\n data-state={context.open ? 'open' : 'closed'}\n {...triggerProps}\n ref={forwardedRef}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n onFocus={composeEventHandlers(props.onFocus, context.onOpen)}\n onBlur={composeEventHandlers(props.onBlur, context.onClose)}\n // prevent focus event on touch devices\n onTouchStart={composeEventHandlers(props.onTouchStart, (event) => event.preventDefault())}\n />\n </PopperPrimitive.Anchor>\n );\n }\n);\n\nHoverCardTrigger.displayName = TRIGGER_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardPortal\n * -----------------------------------------------------------------------------------------------*/\n\nconst PORTAL_NAME = 'HoverCardPortal';\n\ntype PortalContextValue = { forceMount?: true };\nconst [PortalProvider, usePortalContext] = createHoverCardContext<PortalContextValue>(PORTAL_NAME, {\n forceMount: undefined,\n});\n\ntype PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;\ninterface HoverCardPortalProps extends Omit<PortalProps, 'asChild'> {\n children?: React.ReactNode;\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardPortal: React.FC<HoverCardPortalProps> = (\n props: ScopedProps<HoverCardPortalProps>\n) => {\n const { __scopeHoverCard, forceMount, children, container } = props;\n const context = useHoverCardContext(PORTAL_NAME, __scopeHoverCard);\n return (\n <PortalProvider scope={__scopeHoverCard} forceMount={forceMount}>\n <Presence present={forceMount || context.open}>\n <UnstablePortal asChild container={container}>\n {children}\n </UnstablePortal>\n </Presence>\n </PortalProvider>\n );\n};\n\nHoverCardPortal.displayName = PORTAL_NAME;\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardContent\n * -----------------------------------------------------------------------------------------------*/\n\nconst CONTENT_NAME = 'HoverCardContent';\n\ntype HoverCardContentElement = HoverCardContentImplElement;\ninterface HoverCardContentProps extends HoverCardContentImplProps {\n /**\n * Used to force mounting when more control is needed. Useful when\n * controlling animation with React animation libraries.\n */\n forceMount?: true;\n}\n\nconst HoverCardContent = React.forwardRef<HoverCardContentElement, HoverCardContentProps>(\n (props: ScopedProps<HoverCardContentProps>, forwardedRef) => {\n const portalContext = usePortalContext(CONTENT_NAME, props.__scopeHoverCard);\n const { forceMount = portalContext.forceMount, ...contentProps } = props;\n const context = useHoverCardContext(CONTENT_NAME, props.__scopeHoverCard);\n return (\n <Presence present={forceMount || context.open}>\n <HoverCardContentImpl\n data-state={context.open ? 'open' : 'closed'}\n {...contentProps}\n onPointerEnter={composeEventHandlers(props.onPointerEnter, excludeTouch(context.onOpen))}\n onPointerLeave={composeEventHandlers(props.onPointerLeave, excludeTouch(context.onClose))}\n ref={forwardedRef}\n />\n </Presence>\n );\n }\n);\n\nHoverCardContent.displayName = CONTENT_NAME;\n\n/* ---------------------------------------------------------------------------------------------- */\n\ntype HoverCardContentImplElement = React.ElementRef<typeof PopperPrimitive.Content>;\ntype DismissableLayerProps = Radix.ComponentPropsWithoutRef<typeof DismissableLayer>;\ntype PopperContentProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Content>;\ninterface HoverCardContentImplProps extends PopperContentProps {\n /**\n * Event handler called when the escape key is down.\n * Can be prevented.\n */\n onEscapeKeyDown?: DismissableLayerProps['onEscapeKeyDown'];\n /**\n * Event handler called when the a `pointerdown` event happens outside of the `HoverCard`.\n * Can be prevented.\n */\n onPointerDownOutside?: DismissableLayerProps['onPointerDownOutside'];\n /**\n * Event handler called when the focus moves outside of the `HoverCard`.\n * Can be prevented.\n */\n onFocusOutside?: DismissableLayerProps['onFocusOutside'];\n /**\n * Event handler called when an interaction happens outside the `HoverCard`.\n * Specifically, when a `pointerdown` event happens outside or focus moves outside of it.\n * Can be prevented.\n */\n onInteractOutside?: DismissableLayerProps['onInteractOutside'];\n}\n\nconst HoverCardContentImpl = React.forwardRef<\n HoverCardContentImplElement,\n HoverCardContentImplProps\n>((props: ScopedProps<HoverCardContentImplProps>, forwardedRef) => {\n const {\n __scopeHoverCard,\n onEscapeKeyDown,\n onPointerDownOutside,\n onFocusOutside,\n onInteractOutside,\n ...contentProps\n } = props;\n const context = useHoverCardContext(CONTENT_NAME, __scopeHoverCard);\n const popperScope = usePopperScope(__scopeHoverCard);\n const ref = React.useRef<HoverCardContentImplElement>(null);\n const composedRefs = useComposedRefs(forwardedRef, ref);\n\n React.useEffect(() => {\n if (ref.current) {\n const tabbables = getTabbableNodes(ref.current);\n tabbables.forEach((tabbable) => tabbable.setAttribute('tabindex', '-1'));\n }\n });\n\n return (\n <DismissableLayer\n asChild\n disableOutsidePointerEvents={false}\n onInteractOutside={onInteractOutside}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={onPointerDownOutside}\n onFocusOutside={onFocusOutside}\n onDismiss={context.onDismiss}\n >\n <PopperPrimitive.Content\n {...popperScope}\n {...contentProps}\n ref={composedRefs}\n style={{\n ...contentProps.style,\n // re-namespace exposed content custom property\n ['--radix-hover-card-content-transform-origin' as any]:\n 'var(--radix-popper-transform-origin)',\n }}\n />\n </DismissableLayer>\n );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * HoverCardArrow\n * -----------------------------------------------------------------------------------------------*/\n\nconst ARROW_NAME = 'HoverCardArrow';\n\ntype HoverCardArrowElement = React.ElementRef<typeof PopperPrimitive.Arrow>;\ntype PopperArrowProps = Radix.ComponentPropsWithoutRef<typeof PopperPrimitive.Arrow>;\ninterface HoverCardArrowProps extends PopperArrowProps {}\n\nconst HoverCardArrow = React.forwardRef<HoverCardArrowElement, HoverCardArrowProps>(\n (props: ScopedProps<HoverCardArrowProps>, forwardedRef) => {\n const { __scopeHoverCard, ...arrowProps } = props;\n const popperScope = usePopperScope(__scopeHoverCard);\n return <PopperPrimitive.Arrow {...popperScope} {...arrowProps} ref={forwardedRef} />;\n }\n);\n\nHoverCardArrow.displayName = ARROW_NAME;\n\n/* -----------------------------------------------------------------------------------------------*/\n\nfunction excludeTouch<E>(eventHandler: () => void) {\n return (event: React.PointerEvent<E>) =>\n event.pointerType === 'touch' ? undefined : eventHandler();\n}\n\n/**\n * Returns a list of nodes that can be in the tab sequence.\n * @see: https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker\n */\nfunction getTabbableNodes(container: HTMLElement) {\n const nodes: HTMLElement[] = [];\n const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, {\n acceptNode: (node: any) => {\n // `.tabIndex` is not the same as the `tabindex` attribute. It works on the\n // runtime's understanding of tabbability, so this automatically accounts\n // for any kind of element that could be tabbed to.\n return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;\n },\n });\n while (walker.nextNode()) nodes.push(walker.currentNode as HTMLElement);\n return nodes;\n}\n\nconst Root = HoverCard;\nconst Trigger = HoverCardTrigger;\nconst Portal = HoverCardPortal;\nconst Content = HoverCardContent;\nconst Arrow = HoverCardArrow;\n\nexport {\n createHoverCardScope,\n //\n HoverCard,\n HoverCardTrigger,\n HoverCardPortal,\n HoverCardContent,\n HoverCardArrow,\n //\n Root,\n Trigger,\n Portal,\n Content,\n Arrow,\n};\nexport type {\n HoverCardProps,\n HoverCardTriggerProps,\n HoverCardPortalProps,\n HoverCardContentProps,\n HoverCardArrowProps,\n};\n"],"names":["React","composeEventHandlers","createContextScope","useControllableState","useComposedRefs","PopperPrimitive","createPopperScope","UnstablePortal","Presence","Primitive","DismissableLayer","HOVERCARD_NAME","createHoverCardContext","createHoverCardScope","usePopperScope","HoverCardProvider","useHoverCardContext","HoverCard","props","__scopeHoverCard","children","open","openProp","defaultOpen","onOpenChange","openDelay","closeDelay","popperScope","openTimerRef","useRef","closeTimerRef","setOpen","prop","defaultProp","onChange","handleOpen","useCallback","clearTimeout","current","window","setTimeout","handleClose","handleDismiss","useEffect","TRIGGER_NAME","HoverCardTrigger","forwardRef","forwardedRef","triggerProps","context","onPointerEnter","excludeTouch","onOpen","onPointerLeave","onClose","onFocus","onBlur","onTouchStart","event","preventDefault","PORTAL_NAME","PortalProvider","usePortalContext","forceMount","undefined","HoverCardPortal","container","CONTENT_NAME","HoverCardContent","portalContext","contentProps","HoverCardContentImpl","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","ref","composedRefs","tabbables","getTabbableNodes","forEach","tabbable","setAttribute","onDismiss","style","ARROW_NAME","HoverCardArrow","arrowProps","eventHandler","pointerType","nodes","walker","document","createTreeWalker","NodeFilter","SHOW_ELEMENT","acceptNode","node","tabIndex","FILTER_ACCEPT","FILTER_SKIP","nextNode","push","currentNode","Root","Trigger","Portal","Content","Arrow"],"version":3,"file":"index.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@radix-ui/react-hover-card",
|
|
3
|
-
"version": "0.1.6-rc.
|
|
3
|
+
"version": "0.1.6-rc.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@babel/runtime": "^7.13.10",
|
|
20
20
|
"@radix-ui/primitive": "0.1.0",
|
|
21
|
-
"@radix-ui/react-compose-refs": "0.1.1-rc.
|
|
22
|
-
"@radix-ui/react-context": "0.1.2-rc.
|
|
23
|
-
"@radix-ui/react-dismissable-layer": "0.1.6-rc.
|
|
24
|
-
"@radix-ui/react-popper": "0.1.5-rc.
|
|
25
|
-
"@radix-ui/react-portal": "0.1.5-rc.
|
|
26
|
-
"@radix-ui/react-presence": "0.1.3-rc.
|
|
27
|
-
"@radix-ui/react-primitive": "0.1.5-rc.
|
|
28
|
-
"@radix-ui/react-use-controllable-state": "0.1.1-rc.
|
|
21
|
+
"@radix-ui/react-compose-refs": "0.1.1-rc.32",
|
|
22
|
+
"@radix-ui/react-context": "0.1.2-rc.32",
|
|
23
|
+
"@radix-ui/react-dismissable-layer": "0.1.6-rc.32",
|
|
24
|
+
"@radix-ui/react-popper": "0.1.5-rc.32",
|
|
25
|
+
"@radix-ui/react-portal": "0.1.5-rc.32",
|
|
26
|
+
"@radix-ui/react-presence": "0.1.3-rc.32",
|
|
27
|
+
"@radix-ui/react-primitive": "0.1.5-rc.32",
|
|
28
|
+
"@radix-ui/react-use-controllable-state": "0.1.1-rc.32"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"react": "^16.8 || ^17.0 || ^18.0",
|