Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@radix-ui/react-popover

Package Overview
Dependencies
Maintainers
8
Versions
247
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@radix-ui/react-popover - npm Package Compare versions

Comparing version 0.1.1-rc.16 to 0.1.1-rc.17

2

dist/index.d.ts

@@ -8,2 +8,3 @@ import * as React from "react";

import { RemoveScroll } from "react-remove-scroll";
export const createPopoverScope: import("@radix-ui/react-context").CreateScope;
export interface PopoverProps {

@@ -14,2 +15,3 @@ open?: boolean;

modal?: boolean;
children?: React.ReactNode;
}

@@ -16,0 +18,0 @@ export const Popover: React.FC<PopoverProps>;

2

dist/index.js

@@ -1,2 +0,2 @@

var e,r=require("aria-hidden").hideOthers,o=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-id").useId,n=require("@radix-ui/react-primitive").Primitive,u=require("@radix-ui/react-presence").Presence,s=require("@radix-ui/react-focus-guards").useFocusGuards,a=require("@radix-ui/react-portal").Portal,c=require("@radix-ui/react-focus-scope").FocusScope,i=require("@radix-ui/react-dismissable-layer").DismissableLayer,l=g({},require("@radix-ui/react-popper")),d=require("@radix-ui/react-use-controllable-state").useControllableState,p=require("@radix-ui/react-context").createContext,f=require("@radix-ui/react-compose-refs").useComposedRefs,m=require("@radix-ui/primitive").composeEventHandlers,v=g({},require("react")),C=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function g(e,r){return Object.keys(r).forEach((function(o){"default"!==o&&"__esModule"!==o&&Object.defineProperty(e,o,{enumerable:!0,get:function(){return r[o]}})})),e}const[P,h]=p("Popover"),x=e=>{const{children:r,open:o,defaultOpen:n,onOpenChange:u,modal:s=!1}=e,a=v.useRef(null),[c,i]=v.useState(!1),[p=!1,f]=d({prop:o,defaultProp:n,onChange:u});/*#__PURE__*/return v.createElement(l.Root,null,/*#__PURE__*/v.createElement(P,{contentId:t(),triggerRef:a,open:p,onOpenChange:f,onOpenToggle:v.useCallback((()=>f((e=>!e))),[f]),hasCustomAnchor:c,onCustomAnchorAdd:v.useCallback((()=>i(!0)),[]),onCustomAnchorRemove:v.useCallback((()=>i(!1)),[]),modal:s},r))};exports.Popover=x;const E=/*#__PURE__*/v.forwardRef(((e,r)=>{const o=h("PopoverAnchor"),{onCustomAnchorAdd:t,onCustomAnchorRemove:n}=o;return v.useEffect((()=>(t(),()=>n())),[t,n]),/*#__PURE__*/v.createElement(l.Anchor,C({},e,{ref:r}))}));exports.PopoverAnchor=E;const O=/*#__PURE__*/v.forwardRef(((e,r)=>{const o=h("PopoverTrigger"),t=f(r,o.triggerRef),u=/*#__PURE__*/v.createElement(n.button,C({type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":D(o.open)},e,{ref:t,onClick:m(e.onClick,o.onOpenToggle)}));return o.hasCustomAnchor?u:/*#__PURE__*/v.createElement(l.Anchor,{asChild:!0},u)}));exports.PopoverTrigger=O;const A=/*#__PURE__*/v.forwardRef(((e,r)=>{const{forceMount:o,...t}=e,n=h("PopoverContent");/*#__PURE__*/return v.createElement(u,{present:o||n.open},n.modal?/*#__PURE__*/v.createElement(R,C({},t,{ref:r})):/*#__PURE__*/v.createElement(b,C({},t,{ref:r})))}));exports.PopoverContent=A;const R=/*#__PURE__*/v.forwardRef(((e,t)=>{const{allowPinchZoom:n,portalled:u=!0,...s}=e,c=h("PopoverContent"),i=v.useRef(null),l=f(t,i),d=v.useRef(!1);v.useEffect((()=>{const e=i.current;if(e)return r(e)}),[]);const p=u?a:v.Fragment;/*#__PURE__*/return v.createElement(p,null,/*#__PURE__*/v.createElement(o,{allowPinchZoom:n},/*#__PURE__*/v.createElement(F,C({},s,{ref:l,trapFocus:c.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:m(e.onCloseAutoFocus,(e=>{var r;e.preventDefault(),d.current||null===(r=c.triggerRef.current)||void 0===r||r.focus()})),onPointerDownOutside:m(e.onPointerDownOutside,(e=>{const r=e.detail.originalEvent,o=0===r.button&&!0===r.ctrlKey,t=2===r.button||o;d.current=t}),{checkForDefaultPrevented:!1}),onFocusOutside:m(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})}))))})),b=/*#__PURE__*/v.forwardRef(((e,r)=>{const{portalled:o=!0,...t}=e,n=h("PopoverContent"),u=v.useRef(!1),s=o?a:v.Fragment;/*#__PURE__*/return v.createElement(s,null,/*#__PURE__*/v.createElement(F,C({},t,{ref:r,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:r=>{var o,t;(null===(o=e.onCloseAutoFocus)||void 0===o||o.call(e,r),r.defaultPrevented)||(u.current||null===(t=n.triggerRef.current)||void 0===t||t.focus(),r.preventDefault());u.current=!1},onInteractOutside:r=>{var o,t;null===(o=e.onInteractOutside)||void 0===o||o.call(e,r),r.defaultPrevented||(u.current=!0);const s=r.target;(null===(t=n.triggerRef.current)||void 0===t?void 0:t.contains(s))&&r.preventDefault()}})))})),F=/*#__PURE__*/v.forwardRef(((e,r)=>{const{trapFocus:o,onOpenAutoFocus:t,onCloseAutoFocus:n,disableOutsidePointerEvents:u,onEscapeKeyDown:a,onPointerDownOutside:d,onFocusOutside:p,onInteractOutside:f,...m}=e,g=h("PopoverContent");return s(),/*#__PURE__*/v.createElement(c,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:t,onUnmountAutoFocus:n},/*#__PURE__*/v.createElement(i,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:f,onEscapeKeyDown:a,onPointerDownOutside:d,onFocusOutside:p,onDismiss:()=>g.onOpenChange(!1)},/*#__PURE__*/v.createElement(l.Content,C({"data-state":D(g.open),role:"dialog",id:g.contentId},m,{ref:r,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))})),w=/*#__PURE__*/v.forwardRef(((e,r)=>{const o=h("PopoverClose");/*#__PURE__*/return v.createElement(n.button,C({type:"button"},e,{ref:r,onClick:m(e.onClick,(()=>o.onOpenChange(!1)))}))}));exports.PopoverClose=w;const q=/*#__PURE__*/v.forwardRef(((e,r)=>/*#__PURE__*/v.createElement(l.Arrow,C({},e,{ref:r}))));function D(e){return e?"open":"closed"}exports.PopoverArrow=q;const y=x;exports.Root=y;const k=E;exports.Anchor=k;const I=O;exports.Trigger=I;const T=A;exports.Content=T;const M=w;exports.Close=M;const S=q;exports.Arrow=S;
var e,o=require("aria-hidden").hideOthers,r=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-id").useId,n=require("@radix-ui/react-primitive").Primitive,s=require("@radix-ui/react-presence").Presence,c=require("@radix-ui/react-focus-guards").useFocusGuards,u=require("@radix-ui/react-portal").Portal,a=require("@radix-ui/react-focus-scope").FocusScope,i=require("@radix-ui/react-dismissable-layer").DismissableLayer,l=require("@radix-ui/react-popper"),p=h({},l),d=l.createPopperScope,f=require("@radix-ui/react-use-controllable-state").useControllableState,v=require("@radix-ui/react-context").createContextScope,m=require("@radix-ui/react-compose-refs").useComposedRefs,P=require("@radix-ui/primitive").composeEventHandlers,C=h({},require("react")),g=(e=require("@babel/runtime/helpers/extends"))&&e.__esModule?e.default:e;function h(e,o){return Object.keys(o).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return o[r]}})})),e}const[x,E]=v("Popover",[d]);exports.createPopoverScope=E;const O=d(),[A,R]=x("Popover"),b=e=>{const{__scopePopover:o,children:r,open:n,defaultOpen:s,onOpenChange:c,modal:u=!1}=e,a=O(o),i=C.useRef(null),[l,d]=C.useState(!1),[v=!1,m]=f({prop:n,defaultProp:s,onChange:c});/*#__PURE__*/return C.createElement(p.Root,a,/*#__PURE__*/C.createElement(A,{scope:o,contentId:t(),triggerRef:i,open:v,onOpenChange:m,onOpenToggle:C.useCallback((()=>m((e=>!e))),[m]),hasCustomAnchor:l,onCustomAnchorAdd:C.useCallback((()=>d(!0)),[]),onCustomAnchorRemove:C.useCallback((()=>d(!1)),[]),modal:u},r))};exports.Popover=b;const _=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,n=R("PopoverAnchor",r),s=O(r),{onCustomAnchorAdd:c,onCustomAnchorRemove:u}=n;return C.useEffect((()=>(c(),()=>u())),[c,u]),/*#__PURE__*/C.createElement(p.Anchor,g({},s,t,{ref:o}))}));exports.PopoverAnchor=_;const F=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,s=R("PopoverTrigger",r),c=O(r),u=m(o,s.triggerRef),a=/*#__PURE__*/C.createElement(n.button,g({type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":S(s.open)},t,{ref:u,onClick:P(e.onClick,s.onOpenToggle)}));return s.hasCustomAnchor?a:/*#__PURE__*/C.createElement(p.Anchor,g({asChild:!0},c),a)}));exports.PopoverTrigger=F;const w=/*#__PURE__*/C.forwardRef(((e,o)=>{const{forceMount:r,...t}=e,n=R("PopoverContent",e.__scopePopover);/*#__PURE__*/return C.createElement(s,{present:r||n.open},n.modal?/*#__PURE__*/C.createElement(q,g({},t,{ref:o})):/*#__PURE__*/C.createElement(D,g({},t,{ref:o})))}));exports.PopoverContent=w;const q=/*#__PURE__*/C.forwardRef(((e,t)=>{const{allowPinchZoom:n,portalled:s=!0,...c}=e,a=R("PopoverContent",e.__scopePopover),i=C.useRef(null),l=m(t,i),p=C.useRef(!1);C.useEffect((()=>{const e=i.current;if(e)return o(e)}),[]);const d=s?u:C.Fragment;/*#__PURE__*/return C.createElement(d,null,/*#__PURE__*/C.createElement(r,{allowPinchZoom:n},/*#__PURE__*/C.createElement(y,g({},c,{ref:l,trapFocus:a.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:P(e.onCloseAutoFocus,(e=>{var o;e.preventDefault(),p.current||null===(o=a.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:P(e.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,r=0===o.button&&!0===o.ctrlKey,t=2===o.button||r;p.current=t}),{checkForDefaultPrevented:!1}),onFocusOutside:P(e.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})}))))})),D=/*#__PURE__*/C.forwardRef(((e,o)=>{const{portalled:r=!0,...t}=e,n=R("PopoverContent",e.__scopePopover),s=C.useRef(!1),c=r?u:C.Fragment;/*#__PURE__*/return C.createElement(c,null,/*#__PURE__*/C.createElement(y,g({},t,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var r,t;(null===(r=e.onCloseAutoFocus)||void 0===r||r.call(e,o),o.defaultPrevented)||(s.current||null===(t=n.triggerRef.current)||void 0===t||t.focus(),o.preventDefault());s.current=!1},onInteractOutside:o=>{var r,t;null===(r=e.onInteractOutside)||void 0===r||r.call(e,o),o.defaultPrevented||(s.current=!0);const c=o.target;(null===(t=n.triggerRef.current)||void 0===t?void 0:t.contains(c))&&o.preventDefault()}})))})),y=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopePopover:r,trapFocus:t,onOpenAutoFocus:n,onCloseAutoFocus:s,disableOutsidePointerEvents:u,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:v,...m}=e,P=R("PopoverContent",r),h=O(r);return c(),/*#__PURE__*/C.createElement(a,{asChild:!0,loop:!0,trapped:t,onMountAutoFocus:n,onUnmountAutoFocus:s},/*#__PURE__*/C.createElement(i,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:v,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:f,onDismiss:()=>P.onOpenChange(!1)},/*#__PURE__*/C.createElement(p.Content,g({"data-state":S(P.open),role:"dialog",id:P.contentId},h,m,{ref:o,style:{...m.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))})),k=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,s=R("PopoverClose",r);/*#__PURE__*/return C.createElement(n.button,g({type:"button"},t,{ref:o,onClick:P(e.onClick,(()=>s.onOpenChange(!1)))}))}));exports.PopoverClose=k;const I=/*#__PURE__*/C.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,n=O(r);/*#__PURE__*/return C.createElement(p.Arrow,g({},n,t,{ref:o}))}));function S(e){return e?"open":"closed"}exports.PopoverArrow=I;const T=b;exports.Root=T;const M=_;exports.Anchor=M;const K=F;exports.Trigger=K;const j=w;exports.Content=j;const Z=k;exports.Close=Z;const G=I;exports.Arrow=G;
//# sourceMappingURL=index.js.map

@@ -1,2 +0,2 @@

import{hideOthers as e}from"aria-hidden";import{RemoveScroll as o}from"react-remove-scroll";import{useId as r}from"@radix-ui/react-id";import{Primitive as t}from"@radix-ui/react-primitive";import{Presence as n}from"@radix-ui/react-presence";import{useFocusGuards as a}from"@radix-ui/react-focus-guards";import{Portal as c}from"@radix-ui/react-portal";import{FocusScope as s}from"@radix-ui/react-focus-scope";import{DismissableLayer as i}from"@radix-ui/react-dismissable-layer";import*as u from"@radix-ui/react-popper";import{useControllableState as l}from"@radix-ui/react-use-controllable-state";import{createContext as p}from"@radix-ui/react-context";import{useComposedRefs as d}from"@radix-ui/react-compose-refs";import{composeEventHandlers as m}from"@radix-ui/primitive";import*as f from"react";import v from"@babel/runtime/helpers/esm/extends";const[C,g]=p("Popover");export const Popover=e=>{const{children:o,open:t,defaultOpen:n,onOpenChange:a,modal:c=!1}=e,s=f.useRef(null),[i,p]=f.useState(!1),[d=!1,m]=l({prop:t,defaultProp:n,onChange:a});/*#__PURE__*/return f.createElement(u.Root,null,/*#__PURE__*/f.createElement(C,{contentId:r(),triggerRef:s,open:d,onOpenChange:m,onOpenToggle:f.useCallback((()=>m((e=>!e))),[m]),hasCustomAnchor:i,onCustomAnchorAdd:f.useCallback((()=>p(!0)),[]),onCustomAnchorRemove:f.useCallback((()=>p(!1)),[]),modal:c},o))};/*#__PURE__*/export const PopoverAnchor=/*#__PURE__*/f.forwardRef(((e,o)=>{const r=g("PopoverAnchor"),{onCustomAnchorAdd:t,onCustomAnchorRemove:n}=r;return f.useEffect((()=>(t(),()=>n())),[t,n]),/*#__PURE__*/f.createElement(u.Anchor,v({},e,{ref:o}))}));/*#__PURE__*/export const PopoverTrigger=/*#__PURE__*/f.forwardRef(((e,o)=>{const r=g("PopoverTrigger"),n=d(o,r.triggerRef),a=/*#__PURE__*/f.createElement(t.button,v({type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":E(r.open)},e,{ref:n,onClick:m(e.onClick,r.onOpenToggle)}));return r.hasCustomAnchor?a:/*#__PURE__*/f.createElement(u.Anchor,{asChild:!0},a)}));/*#__PURE__*/export const PopoverContent=/*#__PURE__*/f.forwardRef(((e,o)=>{const{forceMount:r,...t}=e,a=g("PopoverContent");/*#__PURE__*/return f.createElement(n,{present:r||a.open},a.modal?/*#__PURE__*/f.createElement(P,v({},t,{ref:o})):/*#__PURE__*/f.createElement(h,v({},t,{ref:o})))}));/*#__PURE__*/const P=/*#__PURE__*/f.forwardRef(((r,t)=>{const{allowPinchZoom:n,portalled:a=!0,...s}=r,i=g("PopoverContent"),u=f.useRef(null),l=d(t,u),p=f.useRef(!1);f.useEffect((()=>{const o=u.current;if(o)return e(o)}),[]);const C=a?c:f.Fragment;/*#__PURE__*/return f.createElement(C,null,/*#__PURE__*/f.createElement(o,{allowPinchZoom:n},/*#__PURE__*/f.createElement(x,v({},s,{ref:l,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:m(r.onCloseAutoFocus,(e=>{var o;e.preventDefault(),p.current||null===(o=i.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:m(r.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,r=0===o.button&&!0===o.ctrlKey,t=2===o.button||r;p.current=t}),{checkForDefaultPrevented:!1}),onFocusOutside:m(r.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})}))))})),h=/*#__PURE__*/f.forwardRef(((e,o)=>{const{portalled:r=!0,...t}=e,n=g("PopoverContent"),a=f.useRef(!1),s=r?c:f.Fragment;/*#__PURE__*/return f.createElement(s,null,/*#__PURE__*/f.createElement(x,v({},t,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var r,t;(null===(r=e.onCloseAutoFocus)||void 0===r||r.call(e,o),o.defaultPrevented)||(a.current||null===(t=n.triggerRef.current)||void 0===t||t.focus(),o.preventDefault());a.current=!1},onInteractOutside:o=>{var r,t;null===(r=e.onInteractOutside)||void 0===r||r.call(e,o),o.defaultPrevented||(a.current=!0);const c=o.target;(null===(t=n.triggerRef.current)||void 0===t?void 0:t.contains(c))&&o.preventDefault()}})))})),x=/*#__PURE__*/f.forwardRef(((e,o)=>{const{trapFocus:r,onOpenAutoFocus:t,onCloseAutoFocus:n,disableOutsidePointerEvents:c,onEscapeKeyDown:l,onPointerDownOutside:p,onFocusOutside:d,onInteractOutside:m,...C}=e,P=g("PopoverContent");return a(),/*#__PURE__*/f.createElement(s,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:t,onUnmountAutoFocus:n},/*#__PURE__*/f.createElement(i,{asChild:!0,disableOutsidePointerEvents:c,onInteractOutside:m,onEscapeKeyDown:l,onPointerDownOutside:p,onFocusOutside:d,onDismiss:()=>P.onOpenChange(!1)},/*#__PURE__*/f.createElement(u.Content,v({"data-state":E(P.open),role:"dialog",id:P.contentId},C,{ref:o,style:{...C.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))}));export const PopoverClose=/*#__PURE__*/f.forwardRef(((e,o)=>{const r=g("PopoverClose");/*#__PURE__*/return f.createElement(t.button,v({type:"button"},e,{ref:o,onClick:m(e.onClick,(()=>r.onOpenChange(!1)))}))}));/*#__PURE__*/export const PopoverArrow=/*#__PURE__*/f.forwardRef(((e,o)=>/*#__PURE__*/f.createElement(u.Arrow,v({},e,{ref:o}))));/*#__PURE__*/function E(e){return e?"open":"closed"}export const Root=Popover;export const Anchor=PopoverAnchor;export const Trigger=PopoverTrigger;export const Content=PopoverContent;export const Close=PopoverClose;export const Arrow=PopoverArrow;
import{hideOthers as e}from"aria-hidden";import{RemoveScroll as o}from"react-remove-scroll";import{useId as r}from"@radix-ui/react-id";import{Primitive as t}from"@radix-ui/react-primitive";import{Presence as n}from"@radix-ui/react-presence";import{useFocusGuards as c}from"@radix-ui/react-focus-guards";import{Portal as a}from"@radix-ui/react-portal";import{FocusScope as s}from"@radix-ui/react-focus-scope";import{DismissableLayer as i}from"@radix-ui/react-dismissable-layer";import*as p from"@radix-ui/react-popper";import{createPopperScope as u}from"@radix-ui/react-popper";import{useControllableState as l}from"@radix-ui/react-use-controllable-state";import{createContextScope as d}from"@radix-ui/react-context";import{useComposedRefs as m}from"@radix-ui/react-compose-refs";import{composeEventHandlers as f}from"@radix-ui/primitive";import*as v from"react";import P from"@babel/runtime/helpers/esm/extends";const[C,g]=d("Popover",[u]);export{g as createPopoverScope};const x=u(),[h,E]=C("Popover");export const Popover=e=>{const{__scopePopover:o,children:t,open:n,defaultOpen:c,onOpenChange:a,modal:s=!1}=e,i=x(o),u=v.useRef(null),[d,m]=v.useState(!1),[f=!1,P]=l({prop:n,defaultProp:c,onChange:a});/*#__PURE__*/return v.createElement(p.Root,i,/*#__PURE__*/v.createElement(h,{scope:o,contentId:r(),triggerRef:u,open:f,onOpenChange:P,onOpenToggle:v.useCallback((()=>P((e=>!e))),[P]),hasCustomAnchor:d,onCustomAnchorAdd:v.useCallback((()=>m(!0)),[]),onCustomAnchorRemove:v.useCallback((()=>m(!1)),[]),modal:s},t))};/*#__PURE__*/export const PopoverAnchor=/*#__PURE__*/v.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,n=E("PopoverAnchor",r),c=x(r),{onCustomAnchorAdd:a,onCustomAnchorRemove:s}=n;return v.useEffect((()=>(a(),()=>s())),[a,s]),/*#__PURE__*/v.createElement(p.Anchor,P({},c,t,{ref:o}))}));/*#__PURE__*/export const PopoverTrigger=/*#__PURE__*/v.forwardRef(((e,o)=>{const{__scopePopover:r,...n}=e,c=E("PopoverTrigger",r),a=x(r),s=m(o,c.triggerRef),i=/*#__PURE__*/v.createElement(t.button,P({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":w(c.open)},n,{ref:s,onClick:f(e.onClick,c.onOpenToggle)}));return c.hasCustomAnchor?i:/*#__PURE__*/v.createElement(p.Anchor,P({asChild:!0},a),i)}));/*#__PURE__*/export const PopoverContent=/*#__PURE__*/v.forwardRef(((e,o)=>{const{forceMount:r,...t}=e,c=E("PopoverContent",e.__scopePopover);/*#__PURE__*/return v.createElement(n,{present:r||c.open},c.modal?/*#__PURE__*/v.createElement(A,P({},t,{ref:o})):/*#__PURE__*/v.createElement(O,P({},t,{ref:o})))}));/*#__PURE__*/const A=/*#__PURE__*/v.forwardRef(((r,t)=>{const{allowPinchZoom:n,portalled:c=!0,...s}=r,i=E("PopoverContent",r.__scopePopover),p=v.useRef(null),u=m(t,p),l=v.useRef(!1);v.useEffect((()=>{const o=p.current;if(o)return e(o)}),[]);const d=c?a:v.Fragment;/*#__PURE__*/return v.createElement(d,null,/*#__PURE__*/v.createElement(o,{allowPinchZoom:n},/*#__PURE__*/v.createElement(R,P({},s,{ref:u,trapFocus:i.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:f(r.onCloseAutoFocus,(e=>{var o;e.preventDefault(),l.current||null===(o=i.triggerRef.current)||void 0===o||o.focus()})),onPointerDownOutside:f(r.onPointerDownOutside,(e=>{const o=e.detail.originalEvent,r=0===o.button&&!0===o.ctrlKey,t=2===o.button||r;l.current=t}),{checkForDefaultPrevented:!1}),onFocusOutside:f(r.onFocusOutside,(e=>e.preventDefault()),{checkForDefaultPrevented:!1})}))))})),O=/*#__PURE__*/v.forwardRef(((e,o)=>{const{portalled:r=!0,...t}=e,n=E("PopoverContent",e.__scopePopover),c=v.useRef(!1),s=r?a:v.Fragment;/*#__PURE__*/return v.createElement(s,null,/*#__PURE__*/v.createElement(R,P({},t,{ref:o,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var r,t;(null===(r=e.onCloseAutoFocus)||void 0===r||r.call(e,o),o.defaultPrevented)||(c.current||null===(t=n.triggerRef.current)||void 0===t||t.focus(),o.preventDefault());c.current=!1},onInteractOutside:o=>{var r,t;null===(r=e.onInteractOutside)||void 0===r||r.call(e,o),o.defaultPrevented||(c.current=!0);const a=o.target;(null===(t=n.triggerRef.current)||void 0===t?void 0:t.contains(a))&&o.preventDefault()}})))})),R=/*#__PURE__*/v.forwardRef(((e,o)=>{const{__scopePopover:r,trapFocus:t,onOpenAutoFocus:n,onCloseAutoFocus:a,disableOutsidePointerEvents:u,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:m,onInteractOutside:f,...C}=e,g=E("PopoverContent",r),h=x(r);return c(),/*#__PURE__*/v.createElement(s,{asChild:!0,loop:!0,trapped:t,onMountAutoFocus:n,onUnmountAutoFocus:a},/*#__PURE__*/v.createElement(i,{asChild:!0,disableOutsidePointerEvents:u,onInteractOutside:f,onEscapeKeyDown:l,onPointerDownOutside:d,onFocusOutside:m,onDismiss:()=>g.onOpenChange(!1)},/*#__PURE__*/v.createElement(p.Content,P({"data-state":w(g.open),role:"dialog",id:g.contentId},h,C,{ref:o,style:{...C.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}}))))}));export const PopoverClose=/*#__PURE__*/v.forwardRef(((e,o)=>{const{__scopePopover:r,...n}=e,c=E("PopoverClose",r);/*#__PURE__*/return v.createElement(t.button,P({type:"button"},n,{ref:o,onClick:f(e.onClick,(()=>c.onOpenChange(!1)))}))}));/*#__PURE__*/export const PopoverArrow=/*#__PURE__*/v.forwardRef(((e,o)=>{const{__scopePopover:r,...t}=e,n=x(r);/*#__PURE__*/return v.createElement(p.Arrow,P({},n,t,{ref:o}))}));/*#__PURE__*/function w(e){return e?"open":"closed"}export const Root=Popover;export const Anchor=PopoverAnchor;export const Trigger=PopoverTrigger;export const Content=PopoverContent;export const Close=PopoverClose;export const Arrow=PopoverArrow;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-popover",
"version": "0.1.1-rc.16",
"version": "0.1.1-rc.17",
"license": "MIT",

@@ -22,11 +22,11 @@ "source": "src/index.ts",

"@radix-ui/react-compose-refs": "0.1.0",
"@radix-ui/react-context": "0.1.0",
"@radix-ui/react-dismissable-layer": "0.1.1-rc.16",
"@radix-ui/react-context": "0.1.1-rc.1",
"@radix-ui/react-dismissable-layer": "0.1.1-rc.17",
"@radix-ui/react-focus-guards": "0.1.0",
"@radix-ui/react-focus-scope": "0.1.1-rc.16",
"@radix-ui/react-id": "0.1.0",
"@radix-ui/react-popper": "0.1.1-rc.16",
"@radix-ui/react-portal": "0.1.1-rc.16",
"@radix-ui/react-presence": "0.1.1-rc.13",
"@radix-ui/react-primitive": "0.1.1-rc.16",
"@radix-ui/react-focus-scope": "0.1.1-rc.17",
"@radix-ui/react-id": "0.1.1-rc.1",
"@radix-ui/react-popper": "0.1.1-rc.17",
"@radix-ui/react-portal": "0.1.1-rc.17",
"@radix-ui/react-presence": "0.1.1-rc.14",
"@radix-ui/react-primitive": "0.1.1-rc.17",
"@radix-ui/react-use-controllable-state": "0.1.0",

@@ -33,0 +33,0 @@ "aria-hidden": "^1.1.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc