@radix-ui/react-popover
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -1,2 +0,2 @@ | ||
var e=require("aria-hidden").hideOthers,r=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-presence").Presence,n=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,c=g({},require("@radix-ui/react-popper")),s=require("@radix-ui/react-utils"),l=s.createContext,p=s.useComposedRefs,f=s.composeEventHandlers,d=s.useControlledState,v=s.useId,y=s.composeRefs,O=s.extendComponent,b=require("@radix-ui/utils").getSelector,m=g({},require("react"));function g(e,r){return Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e}function P(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?P(Object(t),!0).forEach((function(r){C(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function C(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function w(){return(w=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}function x(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},u=Object.keys(e);for(o=0;o<u.length;o++)t=u[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(o=0;o<u.length;o++)t=u[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}function j(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],o=!0,n=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(o=(a=i.next()).done)&&(t.push(a.value),!r||t.length!==r);o=!0);}catch(e){n=!0,u=e}finally{try{o||null==i.return||i.return()}finally{if(n)throw u}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return D(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var F=j(l("PopoverContext","Popover"),2),E=F[0],S=F[1],R=function(e){var r=e.children,t=e.open,o=e.defaultOpen,n=e.onOpenChange,u=m.useRef(null),a="popover-".concat(v()),i=j(d({prop:t,defaultProp:o,onChange:n}),2),c=i[0],s=void 0!==c&&c,l=i[1],p=m.useMemo((function(){return{triggerRef:u,id:a,open:s,setOpen:l}}),[a,s,l]);return m.createElement(E.Provider,{value:p},r)};exports.Popover=R,R.displayName="Popover";var A=m.forwardRef((function(e,r){var o=e.as,n=void 0===o?"button":o,u=e.selector,a=void 0===u?b("PopoverTrigger"):u,i=x(e,["as","selector"]),c=S("PopoverTrigger"),s=p(r,c.triggerRef);return m.createElement(t,w({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id},i,{as:n,selector:a,ref:s,onClick:f(e.onClick,(function(){return c.setOpen((function(e){return!e}))}))}))}));exports.PopoverTrigger=A,A.displayName="PopoverTrigger";var k=m.forwardRef((function(e,r){var t=e.forceMount,n=x(e,["forceMount"]),u=S("PopoverContent");return m.createElement(o,{present:t||u.open},m.createElement(q,w({},n,{ref:r,"data-state":u.open?"open":"closed"})))}));exports.PopoverContent=k;var q=m.forwardRef((function(t,o){var s=t.selector,l=void 0===s?b("PopoverContent"):s,p=t.anchorRef,d=t.trapFocus,v=void 0===d||d,O=t.onOpenAutoFocus,g=t.onCloseAutoFocus,P=t.disableOutsidePointerEvents,D=void 0!==P&&P,F=t.onEscapeKeyDown,E=t.onPointerDownOutside,R=t.onFocusOutside,A=t.onInteractOutside,k=t.disableOutsideScroll,q=void 0!==k&&k,M=t.portalled,T=void 0===M||M,I=x(t,["selector","anchorRef","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","disableOutsideScroll","portalled"]),K=S("PopoverContent"),N=j(m.useState(!1),2),B=N[0],U=N[1],_=T?u:m.Fragment,G=q?r:m.Fragment;n();var H=m.useRef(null);return m.useEffect((function(){var r=H.current;if(r)return e(r)}),[]),m.createElement(_,null,m.createElement(G,null,m.createElement(a,{trapped:!B&&v,onMountAutoFocus:O,onUnmountAutoFocus:function(e){B?e.preventDefault():null==g||g(e)}},(function(e){return m.createElement(i,{disableOutsidePointerEvents:D,onEscapeKeyDown:F,onPointerDownOutside:f(E,(function(e){var r,t=null===(r=K.triggerRef.current)||void 0===r?void 0:r.contains(e.target),o=0===e.button&&!1===e.ctrlKey;U(!D&&o),t&&e.preventDefault(),e.defaultPrevented&&U(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:f(R,(function(e){v&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:A,onDismiss:function(){return K.setOpen(!1)}},(function(r){return m.createElement(c.Root,w({role:"dialog","aria-modal":!0},I,{selector:l,ref:y(o,H,e.ref,r.ref),id:K.id,anchorRef:p||K.triggerRef,style:h(h(h({},r.style),I.style),{},C({},"--radix-popover-content-transform-origin","var(--radix-popper-transform-origin)")),onBlurCapture:f(I.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(I.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(I.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(I.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));k.displayName="PopoverContent";var M=m.forwardRef((function(e,r){var o=e.as,n=void 0===o?"button":o,u=e.selector,a=void 0===u?b("PopoverClose"):u,i=x(e,["as","selector"]),c=S("PopoverClose");return m.createElement(t,w({type:"button"},i,{as:n,selector:a,ref:r,onClick:f(e.onClick,(function(){return c.setOpen(!1)}))}))}));exports.PopoverClose=M,M.displayName="PopoverClose";var T=O(c.Arrow,"PopoverArrow");exports.PopoverArrow=T;var I=R;exports.Root=I;var K=A;exports.Trigger=K;var N=k;exports.Content=N;var B=M;exports.Close=B;var U=T;exports.Arrow=U; | ||
var e=require("aria-hidden").hideOthers,r=require("react-remove-scroll").RemoveScroll,t=require("@radix-ui/react-primitive").Primitive,o=require("@radix-ui/react-presence").Presence,n=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,c=g({},require("@radix-ui/react-popper")),s=require("@radix-ui/react-utils"),l=s.createContext,p=s.useComposedRefs,f=s.composeEventHandlers,d=s.useControlledState,v=s.useId,y=s.composeRefs,O=s.extendComponent,b=require("@radix-ui/utils").getSelector,m=g({},require("react"));function g(e,r){return Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e}function P(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function h(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?P(Object(t),!0).forEach((function(r){C(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):P(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function C(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function w(){return(w=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e}).apply(this,arguments)}function x(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},u=Object.keys(e);for(o=0;o<u.length;o++)t=u[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(o=0;o<u.length;o++)t=u[o],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(n[t]=e[t])}return n}function j(e,r){return function(e){if(Array.isArray(e))return e}(e)||function(e,r){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var t=[],o=!0,n=!1,u=void 0;try{for(var a,i=e[Symbol.iterator]();!(o=(a=i.next()).done)&&(t.push(a.value),!r||t.length!==r);o=!0);}catch(e){n=!0,u=e}finally{try{o||null==i.return||i.return()}finally{if(n)throw u}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return D(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return D(e,r)}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,o=new Array(r);t<r;t++)o[t]=e[t];return o}var F=j(l("PopoverContext","Popover"),2),E=F[0],S=F[1],R=function(e){var r=e.children,t=e.open,o=e.defaultOpen,n=e.onOpenChange,u=m.useRef(null),a="popover-".concat(v()),i=j(d({prop:t,defaultProp:o,onChange:n}),2),c=i[0],s=void 0!==c&&c,l=i[1],p=m.useMemo((function(){return{triggerRef:u,id:a,open:s,setOpen:l}}),[a,s,l]);return m.createElement(E.Provider,{value:p},r)};exports.Popover=R,R.displayName="Popover";var A=m.forwardRef((function(e,r){var o=e.as,n=void 0===o?"button":o,u=e.selector,a=void 0===u?b("PopoverTrigger"):u,i=x(e,["as","selector"]),c=S("PopoverTrigger"),s=p(r,c.triggerRef);return m.createElement(t,w({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id,"data-state":c.open?"open":"closed"},i,{as:n,selector:a,ref:s,onClick:f(e.onClick,(function(){return c.setOpen((function(e){return!e}))}))}))}));exports.PopoverTrigger=A,A.displayName="PopoverTrigger";var k=m.forwardRef((function(e,r){var t=e.forceMount,n=x(e,["forceMount"]),u=S("PopoverContent");return m.createElement(o,{present:t||u.open},m.createElement(q,w({"data-state":u.open?"open":"closed"},n,{ref:r})))}));exports.PopoverContent=k;var q=m.forwardRef((function(t,o){var s=t.selector,l=void 0===s?b("PopoverContent"):s,p=t.anchorRef,d=t.trapFocus,v=void 0===d||d,O=t.onOpenAutoFocus,g=t.onCloseAutoFocus,P=t.disableOutsidePointerEvents,D=void 0!==P&&P,F=t.onEscapeKeyDown,E=t.onPointerDownOutside,R=t.onFocusOutside,A=t.onInteractOutside,k=t.disableOutsideScroll,q=void 0!==k&&k,M=t.portalled,T=void 0===M||M,I=x(t,["selector","anchorRef","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","disableOutsideScroll","portalled"]),K=S("PopoverContent"),N=j(m.useState(!1),2),B=N[0],U=N[1],_=T?u:m.Fragment,G=q?r:m.Fragment;n();var H=m.useRef(null);return m.useEffect((function(){var r=H.current;if(r)return e(r)}),[]),m.createElement(_,null,m.createElement(G,null,m.createElement(a,{trapped:!B&&(v&&K.open),onMountAutoFocus:O,onUnmountAutoFocus:function(e){B?e.preventDefault():null==g||g(e)}},(function(e){return m.createElement(i,{disableOutsidePointerEvents:D,onEscapeKeyDown:F,onPointerDownOutside:f(E,(function(e){var r,t=null===(r=K.triggerRef.current)||void 0===r?void 0:r.contains(e.target),o=0===e.button&&!1===e.ctrlKey;U(!D&&o),t&&e.preventDefault(),e.defaultPrevented&&U(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:f(R,(function(e){v&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:A,onDismiss:function(){return K.setOpen(!1)}},(function(r){return m.createElement(c.Root,w({role:"dialog","aria-modal":!0},I,{selector:l,ref:y(o,H,e.ref,r.ref),id:K.id,anchorRef:p||K.triggerRef,style:h(h(h({},r.style),I.style),{},C({},"--radix-popover-content-transform-origin","var(--radix-popper-transform-origin)")),onBlurCapture:f(I.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(I.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(I.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(I.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));k.displayName="PopoverContent";var M=m.forwardRef((function(e,r){var o=e.as,n=void 0===o?"button":o,u=e.selector,a=void 0===u?b("PopoverClose"):u,i=x(e,["as","selector"]),c=S("PopoverClose");return m.createElement(t,w({type:"button"},i,{as:n,selector:a,ref:r,onClick:f(e.onClick,(function(){return c.setOpen(!1)}))}))}));exports.PopoverClose=M,M.displayName="PopoverClose";var T=O(c.Arrow,"PopoverArrow");exports.PopoverArrow=T;var I=R;exports.Root=I;var K=A;exports.Trigger=K;var N=k;exports.Content=N;var B=M;exports.Close=B;var U=T;exports.Arrow=U; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{hideOthers as e}from"aria-hidden";import{RemoveScroll as r}from"react-remove-scroll";import{Primitive as o}from"@radix-ui/react-primitive";import{Presence as t}from"@radix-ui/react-presence";import{useFocusGuards as n}from"@radix-ui/react-focus-guards";import{Portal as a}from"@radix-ui/react-portal";import{FocusScope as c}from"@radix-ui/react-focus-scope";import{DismissableLayer as s}from"@radix-ui/react-dismissable-layer";import*as u from"@radix-ui/react-popper";import{createContext as i,useComposedRefs as p,composeEventHandlers as l,useControlledState as f,useId as d,composeRefs as m,extendComponent as v}from"@radix-ui/react-utils";import{getSelector as O}from"@radix-ui/utils";import*as P from"react";function g(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function b(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?g(Object(o),!0).forEach((function(r){y(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function y(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function C(){return(C=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function w(e,r){if(null==e)return{};var o,t,n=function(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||(n[o]=e[o]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}const[h,x]=i("PopoverContext","Popover");export const Popover=e=>{const{children:r,open:o,defaultOpen:t,onOpenChange:n}=e,a=P.useRef(null),c="popover-".concat(d()),[s=!1,u]=f({prop:o,defaultProp:t,onChange:n}),i=P.useMemo((()=>({triggerRef:a,id:c,open:s,setOpen:u})),[c,s,u]);return P.createElement(h.Provider,{value:i},r)};Popover.displayName="Popover";const D="PopoverTrigger",F="button";export const PopoverTrigger=P.forwardRef(((e,r)=>{const{as:t=F,selector:n=O(D)}=e,a=w(e,["as","selector"]),c=x(D),s=p(r,c.triggerRef);return P.createElement(o,C({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id},a,{as:t,selector:n,ref:s,onClick:l(e.onClick,(()=>c.setOpen((e=>!e))))}))}));PopoverTrigger.displayName=D;const E="PopoverContent";export const PopoverContent=P.forwardRef(((e,r)=>{const{forceMount:o}=e,n=w(e,["forceMount"]),a=x(E);return P.createElement(t,{present:o||a.open},P.createElement(j,C({},n,{ref:r,"data-state":a.open?"open":"closed"})))}));const j=P.forwardRef(((o,t)=>{const{selector:i=O(E),anchorRef:p,trapFocus:f=!0,onOpenAutoFocus:d,onCloseAutoFocus:v,disableOutsidePointerEvents:g=!1,onEscapeKeyDown:y,onPointerDownOutside:h,onFocusOutside:D,onInteractOutside:F,disableOutsideScroll:j=!1,portalled:R=!0}=o,k=w(o,["selector","anchorRef","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","disableOutsideScroll","portalled"]),A=x(E),[S,T]=P.useState(!1),M=R?a:P.Fragment,I=j?r:P.Fragment;n();const K=P.useRef(null);return P.useEffect((()=>{const r=K.current;if(r)return e(r)}),[]),P.createElement(M,null,P.createElement(I,null,P.createElement(c,{trapped:!S&&f,onMountAutoFocus:d,onUnmountAutoFocus:e=>{S?e.preventDefault():null==v||v(e)}},(e=>P.createElement(s,{disableOutsidePointerEvents:g,onEscapeKeyDown:y,onPointerDownOutside:l(h,(e=>{var r;const o=null===(r=A.triggerRef.current)||void 0===r?void 0:r.contains(e.target),t=0===e.button&&!1===e.ctrlKey;T(!g&&t),o&&e.preventDefault(),e.defaultPrevented&&T(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:l(D,(e=>{f&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:F,onDismiss:()=>A.setOpen(!1)},(r=>P.createElement(u.Root,C({role:"dialog","aria-modal":!0},k,{selector:i,ref:m(t,K,e.ref,r.ref),id:A.id,anchorRef:p||A.triggerRef,style:b(b(b({},r.style),k.style),{},{"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}),onBlurCapture:l(k.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:l(k.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:l(k.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:l(k.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));PopoverContent.displayName=E;const R="PopoverClose",k="button";export const PopoverClose=P.forwardRef(((e,r)=>{const{as:t=k,selector:n=O(R)}=e,a=w(e,["as","selector"]),c=x(R);return P.createElement(o,C({type:"button"},a,{as:t,selector:n,ref:r,onClick:l(e.onClick,(()=>c.setOpen(!1)))}))}));PopoverClose.displayName=R;export const PopoverArrow=v(u.Arrow,"PopoverArrow");export const Root=Popover;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 r}from"react-remove-scroll";import{Primitive as o}from"@radix-ui/react-primitive";import{Presence as t}from"@radix-ui/react-presence";import{useFocusGuards as n}from"@radix-ui/react-focus-guards";import{Portal as a}from"@radix-ui/react-portal";import{FocusScope as c}from"@radix-ui/react-focus-scope";import{DismissableLayer as s}from"@radix-ui/react-dismissable-layer";import*as u from"@radix-ui/react-popper";import{createContext as p,useComposedRefs as i,composeEventHandlers as l,useControlledState as f,useId as d,composeRefs as m,extendComponent as v}from"@radix-ui/react-utils";import{getSelector as O}from"@radix-ui/utils";import*as P from"react";function g(e,r){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),o.push.apply(o,t)}return o}function b(e){for(var r=1;r<arguments.length;r++){var o=null!=arguments[r]?arguments[r]:{};r%2?g(Object(o),!0).forEach((function(r){y(e,r,o[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):g(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}function y(e,r,o){return r in e?Object.defineProperty(e,r,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[r]=o,e}function C(){return(C=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var o=arguments[r];for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t])}return e}).apply(this,arguments)}function w(e,r){if(null==e)return{};var o,t,n=function(e,r){if(null==e)return{};var o,t,n={},a=Object.keys(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||(n[o]=e[o]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(t=0;t<a.length;t++)o=a[t],r.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}const[h,x]=p("PopoverContext","Popover");export const Popover=e=>{const{children:r,open:o,defaultOpen:t,onOpenChange:n}=e,a=P.useRef(null),c="popover-".concat(d()),[s=!1,u]=f({prop:o,defaultProp:t,onChange:n}),p=P.useMemo((()=>({triggerRef:a,id:c,open:s,setOpen:u})),[c,s,u]);return P.createElement(h.Provider,{value:p},r)};Popover.displayName="Popover";const D="PopoverTrigger",F="button";export const PopoverTrigger=P.forwardRef(((e,r)=>{const{as:t=F,selector:n=O(D)}=e,a=w(e,["as","selector"]),c=x(D),s=i(r,c.triggerRef);return P.createElement(o,C({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id,"data-state":c.open?"open":"closed"},a,{as:t,selector:n,ref:s,onClick:l(e.onClick,(()=>c.setOpen((e=>!e))))}))}));PopoverTrigger.displayName=D;const E="PopoverContent";export const PopoverContent=P.forwardRef(((e,r)=>{const{forceMount:o}=e,n=w(e,["forceMount"]),a=x(E);return P.createElement(t,{present:o||a.open},P.createElement(j,C({"data-state":a.open?"open":"closed"},n,{ref:r})))}));const j=P.forwardRef(((o,t)=>{const{selector:p=O(E),anchorRef:i,trapFocus:f=!0,onOpenAutoFocus:d,onCloseAutoFocus:v,disableOutsidePointerEvents:g=!1,onEscapeKeyDown:y,onPointerDownOutside:h,onFocusOutside:D,onInteractOutside:F,disableOutsideScroll:j=!1,portalled:R=!0}=o,k=w(o,["selector","anchorRef","trapFocus","onOpenAutoFocus","onCloseAutoFocus","disableOutsidePointerEvents","onEscapeKeyDown","onPointerDownOutside","onFocusOutside","onInteractOutside","disableOutsideScroll","portalled"]),A=x(E),[S,T]=P.useState(!1),M=R?a:P.Fragment,I=j?r:P.Fragment;n();const K=P.useRef(null);return P.useEffect((()=>{const r=K.current;if(r)return e(r)}),[]),P.createElement(M,null,P.createElement(I,null,P.createElement(c,{trapped:!S&&(f&&A.open),onMountAutoFocus:d,onUnmountAutoFocus:e=>{S?e.preventDefault():null==v||v(e)}},(e=>P.createElement(s,{disableOutsidePointerEvents:g,onEscapeKeyDown:y,onPointerDownOutside:l(h,(e=>{var r;const o=null===(r=A.triggerRef.current)||void 0===r?void 0:r.contains(e.target),t=0===e.button&&!1===e.ctrlKey;T(!g&&t),o&&e.preventDefault(),e.defaultPrevented&&T(!1)}),{checkForDefaultPrevented:!1}),onFocusOutside:l(D,(e=>{f&&e.preventDefault()}),{checkForDefaultPrevented:!1}),onInteractOutside:F,onDismiss:()=>A.setOpen(!1)},(r=>P.createElement(u.Root,C({role:"dialog","aria-modal":!0},k,{selector:p,ref:m(t,K,e.ref,r.ref),id:A.id,anchorRef:i||A.triggerRef,style:b(b(b({},r.style),k.style),{},{"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)"}),onBlurCapture:l(k.onBlurCapture,r.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:l(k.onFocusCapture,r.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:l(k.onMouseDownCapture,r.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:l(k.onTouchStartCapture,r.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));PopoverContent.displayName=E;const R="PopoverClose",k="button";export const PopoverClose=P.forwardRef(((e,r)=>{const{as:t=k,selector:n=O(R)}=e,a=w(e,["as","selector"]),c=x(R);return P.createElement(o,C({type:"button"},a,{as:t,selector:n,ref:r,onClick:l(e.onClick,(()=>c.setOpen(!1)))}))}));PopoverClose.displayName=R;export const PopoverArrow=v(u.Arrow,"PopoverArrow");export const Root=Popover;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.0.5", | ||
"version": "0.0.6", | ||
"license": "MIT", | ||
@@ -19,11 +19,11 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@radix-ui/react-dismissable-layer": "0.0.4", | ||
"@radix-ui/react-dismissable-layer": "0.0.5", | ||
"@radix-ui/react-focus-guards": "0.0.3", | ||
"@radix-ui/react-focus-scope": "0.0.4", | ||
"@radix-ui/react-polymorphic": "0.0.4", | ||
"@radix-ui/react-popper": "0.0.5", | ||
"@radix-ui/react-portal": "0.0.4", | ||
"@radix-ui/react-presence": "0.0.4", | ||
"@radix-ui/react-primitive": "0.0.3", | ||
"@radix-ui/react-utils": "0.0.4", | ||
"@radix-ui/react-focus-scope": "0.0.5", | ||
"@radix-ui/react-polymorphic": "0.0.5", | ||
"@radix-ui/react-popper": "0.0.6", | ||
"@radix-ui/react-portal": "0.0.5", | ||
"@radix-ui/react-presence": "0.0.5", | ||
"@radix-ui/react-primitive": "0.0.4", | ||
"@radix-ui/react-utils": "0.0.5", | ||
"@radix-ui/utils": "0.0.3", | ||
@@ -30,0 +30,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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63721
+ Added@radix-ui/react-arrow@0.0.5(transitive)
+ Added@radix-ui/react-dismissable-layer@0.0.5(transitive)
+ Added@radix-ui/react-focus-scope@0.0.5(transitive)
+ Added@radix-ui/react-polymorphic@0.0.5(transitive)
+ Added@radix-ui/react-popper@0.0.6(transitive)
+ Added@radix-ui/react-portal@0.0.5(transitive)
+ Added@radix-ui/react-presence@0.0.5(transitive)
+ Added@radix-ui/react-primitive@0.0.4(transitive)
+ Added@radix-ui/react-utils@0.0.5(transitive)
- Removed@radix-ui/react-arrow@0.0.4(transitive)
- Removed@radix-ui/react-dismissable-layer@0.0.4(transitive)
- Removed@radix-ui/react-focus-scope@0.0.4(transitive)
- Removed@radix-ui/react-polymorphic@0.0.4(transitive)
- Removed@radix-ui/react-popper@0.0.5(transitive)
- Removed@radix-ui/react-portal@0.0.4(transitive)
- Removed@radix-ui/react-presence@0.0.4(transitive)
- Removed@radix-ui/react-primitive@0.0.3(transitive)
- Removed@radix-ui/react-utils@0.0.4(transitive)
Updated@radix-ui/react-popper@0.0.6
Updated@radix-ui/react-portal@0.0.5
Updated@radix-ui/react-utils@0.0.5