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

@radix-ui/react-dialog

Package Overview
Dependencies
Maintainers
5
Versions
237
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.5 to 0.0.6

2

dist/index.js

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

var e,r,t=require("aria-hidden").hideOthers,o=require("react-remove-scroll").RemoveScroll,n=require("@radix-ui/react-focus-guards").useFocusGuards,a=require("@radix-ui/react-primitive").Primitive,u=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-portal").Portal,l=require("@radix-ui/react-focus-scope").FocusScope,c=require("@radix-ui/react-dismissable-layer").DismissableLayer,s=require("@radix-ui/utils"),f=s.getSelector,p=s.makeId,d=require("@radix-ui/react-utils"),v=d.createContext,g=d.useComposedRefs,y=d.composeEventHandlers,O=d.useControlledState,m=d.useId,b=d.composeRefs,D=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function C(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?C(Object(t),!0).forEach((function(r){w(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function w(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function P(){return(P=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 E(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)t=a[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[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,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(o=(u=i.next()).done)&&(t.push(u.value),!r||t.length!==r);o=!0);}catch(e){n=!0,a=e}finally{try{o||null==i.return||i.return()}finally{if(n)throw a}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return x(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 x(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 x(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 S=j(v("DialogContext","Dialog"),2),F=S[0],R=S[1],k=function(e){var r=e.children,t=e.id,o=e.open,n=e.defaultOpen,a=e.onOpenChange,u=D.useRef(null),i=p("dialog",m()),l=t||i,c=j(O({prop:o,defaultProp:n,onChange:a}),2),s=c[0],f=void 0!==s&&s,d=c[1],v=D.useMemo((function(){return{triggerRef:u,id:l,open:f,setOpen:d}}),[l,f,d]);return D.createElement(F.Provider,{value:v},r)};exports.Dialog=k,k.displayName="Dialog";var A=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"button":t,n=e.selector,u=void 0===n?f("DialogTrigger"):n,i=E(e,["as","selector"]),l=R("DialogTrigger"),c=g(r,l.triggerRef);return D.createElement(a,P({type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.id},i,{as:o,selector:u,ref:c,onClick:y(e.onClick,(function(){return l.setOpen(!0)}))}))}));exports.DialogTrigger=A,A.displayName="DialogTrigger";var q=D.forwardRef((function(e,r){var t=e.forceMount,o=E(e,["forceMount"]),n=R("DialogOverlay");return D.createElement(u,{present:t||n.open},D.createElement(M,P({},o,{"data-state":B(n.open),ref:r})))}));exports.DialogOverlay=q;var M=D.forwardRef((function(e,r){var t=e.selector,o=void 0===t?f("DialogOverlay"):t,n=E(e,["selector"]);return D.createElement(i,null,D.createElement(a,P({},n,{selector:o,ref:r})))}));q.displayName="DialogOverlay";var T=D.forwardRef((function(e,r){var t=e.forceMount,o=E(e,["forceMount"]),n=R("DialogContent");return D.createElement(u,{present:t||n.open},D.createElement(I,P({},o,{"data-state":B(n.open),ref:r})))}));exports.DialogContent=T;var I=D.forwardRef((function(e,r){var u=e.selector,s=void 0===u?f("DialogContent"):u,p=e.onOpenAutoFocus,d=e.onCloseAutoFocus,v=e.onEscapeKeyDown,g=e.onPointerDownOutside,O=E(e,["selector","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),m=R("DialogContent");n();var C=D.useRef(null);return D.useEffect((function(){var e=C.current;if(e)return t(e)}),[]),D.createElement(i,null,D.createElement(o,null,D.createElement(l,{trapped:!0,onMountAutoFocus:p,onUnmountAutoFocus:d},(function(e){return D.createElement(c,{disableOutsidePointerEvents:!0,onEscapeKeyDown:v,onPointerDownOutside:g,onFocusOutside:function(e){return e.preventDefault()},onDismiss:function(){return m.setOpen(!1)}},(function(t){return D.createElement(a,P({role:"dialog","aria-modal":!0},O,{selector:s,ref:b(r,C,e.ref,t.ref),id:m.id,style:h(h({},t.style),O.style),onBlurCapture:y(O.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(O.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(O.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(O.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));T.displayName="DialogContent";var N=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"button":t,n=e.selector,u=void 0===n?f("DialogClose"):n,i=E(e,["as","selector"]),l=R("DialogClose");return D.createElement(a,P({type:"button"},i,{as:o,selector:u,ref:r,onClick:y(e.onClick,(function(){return l.setOpen(!1)}))}))}));function B(e){return e?"open":"closed"}exports.DialogClose=N,N.displayName="DialogClose";var K=k;exports.Root=K;var U=A;exports.Trigger=U;var _=q;exports.Overlay=_;var G=T;exports.Content=G;var H=N;exports.Close=H;
var e,r,t=require("aria-hidden").hideOthers,o=require("react-remove-scroll").RemoveScroll,n=require("@radix-ui/react-focus-guards").useFocusGuards,a=require("@radix-ui/react-primitive").Primitive,u=require("@radix-ui/react-presence").Presence,i=require("@radix-ui/react-portal").Portal,l=require("@radix-ui/react-focus-scope").FocusScope,c=require("@radix-ui/react-dismissable-layer").DismissableLayer,s=require("@radix-ui/utils"),f=s.getSelector,p=s.makeId,d=require("@radix-ui/react-utils"),v=d.createContext,g=d.useComposedRefs,y=d.composeEventHandlers,O=d.useControlledState,m=d.useId,b=d.composeRefs,D=(e={},r=require("react"),Object.keys(r).forEach((function(t){"default"!==t&&"__esModule"!==t&&Object.defineProperty(e,t,{enumerable:!0,get:function(){return r[t]}})})),e);function C(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?C(Object(t),!0).forEach((function(r){w(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):C(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function w(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function P(){return(P=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 E(e,r){if(null==e)return{};var t,o,n=function(e,r){if(null==e)return{};var t,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)t=a[o],r.indexOf(t)>=0||(n[t]=e[t]);return n}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)t=a[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,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(o=(u=i.next()).done)&&(t.push(u.value),!r||t.length!==r);o=!0);}catch(e){n=!0,a=e}finally{try{o||null==i.return||i.return()}finally{if(n)throw a}}return t}(e,r)||function(e,r){if(!e)return;if("string"==typeof e)return x(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 x(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 x(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 S=j(v("DialogContext","Dialog"),2),F=S[0],R=S[1],k=function(e){var r=e.children,t=e.id,o=e.open,n=e.defaultOpen,a=e.onOpenChange,u=D.useRef(null),i=p("dialog",m()),l=t||i,c=j(O({prop:o,defaultProp:n,onChange:a}),2),s=c[0],f=void 0!==s&&s,d=c[1],v=D.useMemo((function(){return{triggerRef:u,id:l,open:f,setOpen:d}}),[l,f,d]);return D.createElement(F.Provider,{value:v},r)};exports.Dialog=k,k.displayName="Dialog";var A=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"button":t,n=e.selector,u=void 0===n?f("DialogTrigger"):n,i=E(e,["as","selector"]),l=R("DialogTrigger"),c=g(r,l.triggerRef);return D.createElement(a,P({type:"button","aria-haspopup":"dialog","aria-expanded":l.open,"aria-controls":l.id,"data-state":B(l.open)},i,{as:o,selector:u,ref:c,onClick:y(e.onClick,(function(){return l.setOpen(!0)}))}))}));exports.DialogTrigger=A,A.displayName="DialogTrigger";var q=D.forwardRef((function(e,r){var t=e.forceMount,o=E(e,["forceMount"]),n=R("DialogOverlay");return D.createElement(u,{present:t||n.open},D.createElement(M,P({"data-state":B(n.open)},o,{ref:r})))}));exports.DialogOverlay=q;var M=D.forwardRef((function(e,r){var t=e.selector,o=void 0===t?f("DialogOverlay"):t,n=E(e,["selector"]);return D.createElement(i,null,D.createElement(a,P({},n,{selector:o,ref:r})))}));q.displayName="DialogOverlay";var T=D.forwardRef((function(e,r){var t=e.forceMount,o=E(e,["forceMount"]),n=R("DialogContent");return D.createElement(u,{present:t||n.open},D.createElement(I,P({"data-state":B(n.open)},o,{ref:r})))}));exports.DialogContent=T;var I=D.forwardRef((function(e,r){var u=e.selector,s=void 0===u?f("DialogContent"):u,p=e.onOpenAutoFocus,d=e.onCloseAutoFocus,v=e.onEscapeKeyDown,g=e.onPointerDownOutside,O=E(e,["selector","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),m=R("DialogContent");n();var C=D.useRef(null);return D.useEffect((function(){var e=C.current;if(e)return t(e)}),[]),D.createElement(i,null,D.createElement(o,null,D.createElement(l,{trapped:m.open,onMountAutoFocus:p,onUnmountAutoFocus:d},(function(e){return D.createElement(c,{disableOutsidePointerEvents:!0,onEscapeKeyDown:v,onPointerDownOutside:g,onFocusOutside:function(e){return e.preventDefault()},onDismiss:function(){return m.setOpen(!1)}},(function(t){return D.createElement(a,P({role:"dialog","aria-modal":!0},O,{selector:s,ref:b(r,C,e.ref,t.ref),id:m.id,style:h(h({},t.style),O.style),onBlurCapture:y(O.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(O.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(O.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(O.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));T.displayName="DialogContent";var N=D.forwardRef((function(e,r){var t=e.as,o=void 0===t?"button":t,n=e.selector,u=void 0===n?f("DialogClose"):n,i=E(e,["as","selector"]),l=R("DialogClose");return D.createElement(a,P({type:"button"},i,{as:o,selector:u,ref:r,onClick:y(e.onClick,(function(){return l.setOpen(!1)}))}))}));function B(e){return e?"open":"closed"}exports.DialogClose=N,N.displayName="DialogClose";var K=k;exports.Root=K;var U=A;exports.Trigger=U;var _=q;exports.Overlay=_;var G=T;exports.Content=G;var H=N;exports.Close=H;
//# sourceMappingURL=index.js.map

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

import{hideOthers as e}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as r}from"@radix-ui/react-focus-guards";import{Primitive as o}from"@radix-ui/react-primitive";import{Presence as n}from"@radix-ui/react-presence";import{Portal as a}from"@radix-ui/react-portal";import{FocusScope as c}from"@radix-ui/react-focus-scope";import{DismissableLayer as l}from"@radix-ui/react-dismissable-layer";import{getSelector as i,makeId as s}from"@radix-ui/utils";import{createContext as u,useComposedRefs as p,composeEventHandlers as f,useControlledState as d,useId as g,composeRefs as m}from"@radix-ui/react-utils";import*as O from"react";function y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,o)}return r}function D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y(Object(r),!0).forEach((function(t){b(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function b(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var r,o,n=function(e,t){if(null==e)return{};var r,o,n={},a=Object.keys(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||(n[r]=e[r]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)r=a[o],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}const[w,x]=u("DialogContext","Dialog");export const Dialog=e=>{const{children:t,id:r,open:o,defaultOpen:n,onOpenChange:a}=e,c=O.useRef(null),l=s("dialog",g()),i=r||l,[u=!1,p]=d({prop:o,defaultProp:n,onChange:a}),f=O.useMemo((()=>({triggerRef:c,id:i,open:u,setOpen:p})),[i,u,p]);return O.createElement(w.Provider,{value:f},t)};Dialog.displayName="Dialog";const E="DialogTrigger",P="button";export const DialogTrigger=O.forwardRef(((e,t)=>{const{as:r=P,selector:n=i(E)}=e,a=v(e,["as","selector"]),c=x(E),l=p(t,c.triggerRef);return O.createElement(o,C({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id},a,{as:r,selector:n,ref:l,onClick:f(e.onClick,(()=>c.setOpen(!0)))}))}));DialogTrigger.displayName=E;const h="DialogOverlay";export const DialogOverlay=O.forwardRef(((e,t)=>{const{forceMount:r}=e,o=v(e,["forceMount"]),a=x(h);return O.createElement(n,{present:r||a.open},O.createElement(j,C({},o,{"data-state":T(a.open),ref:t})))}));const j=O.forwardRef(((e,t)=>{const{selector:r=i(h)}=e,n=v(e,["selector"]);return O.createElement(a,null,O.createElement(o,C({},n,{selector:r,ref:t})))}));DialogOverlay.displayName=h;const F="DialogContent";export const DialogContent=O.forwardRef(((e,t)=>{const{forceMount:r}=e,o=v(e,["forceMount"]),a=x(F);return O.createElement(n,{present:r||a.open},O.createElement(R,C({},o,{"data-state":T(a.open),ref:t})))}));const R=O.forwardRef(((n,s)=>{const{selector:u=i(F),onOpenAutoFocus:p,onCloseAutoFocus:d,onEscapeKeyDown:g,onPointerDownOutside:y}=n,b=v(n,["selector","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),w=x(F);r();const E=O.useRef(null);return O.useEffect((()=>{const t=E.current;if(t)return e(t)}),[]),O.createElement(a,null,O.createElement(t,null,O.createElement(c,{trapped:!0,onMountAutoFocus:p,onUnmountAutoFocus:d},(e=>O.createElement(l,{disableOutsidePointerEvents:!0,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.setOpen(!1)},(t=>O.createElement(o,C({role:"dialog","aria-modal":!0},b,{selector:u,ref:m(s,E,e.ref,t.ref),id:w.id,style:D(D({},t.style),b.style),onBlurCapture:f(b.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(b.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(b.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(b.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));DialogContent.displayName=F;const k="DialogClose",M="button";export const DialogClose=O.forwardRef(((e,t)=>{const{as:r=M,selector:n=i(k)}=e,a=v(e,["as","selector"]),c=x(k);return O.createElement(o,C({type:"button"},a,{as:r,selector:n,ref:t,onClick:f(e.onClick,(()=>c.setOpen(!1)))}))}));function T(e){return e?"open":"closed"}DialogClose.displayName=k;export const Root=Dialog;export const Trigger=DialogTrigger;export const Overlay=DialogOverlay;export const Content=DialogContent;export const Close=DialogClose;
import{hideOthers as e}from"aria-hidden";import{RemoveScroll as t}from"react-remove-scroll";import{useFocusGuards as o}from"@radix-ui/react-focus-guards";import{Primitive as r}from"@radix-ui/react-primitive";import{Presence as n}from"@radix-ui/react-presence";import{Portal as a}from"@radix-ui/react-portal";import{FocusScope as c}from"@radix-ui/react-focus-scope";import{DismissableLayer as l}from"@radix-ui/react-dismissable-layer";import{getSelector as i,makeId as s}from"@radix-ui/utils";import{createContext as u,useComposedRefs as p,composeEventHandlers as f,useControlledState as d,useId as g,composeRefs as m}from"@radix-ui/react-utils";import*as O from"react";function y(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function D(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?y(Object(o),!0).forEach((function(t){b(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):y(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function b(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function C(){return(C=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e}).apply(this,arguments)}function v(e,t){if(null==e)return{};var o,r,n=function(e,t){if(null==e)return{};var o,r,n={},a=Object.keys(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||(n[o]=e[o]);return n}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r<a.length;r++)o=a[r],t.indexOf(o)>=0||Object.prototype.propertyIsEnumerable.call(e,o)&&(n[o]=e[o])}return n}const[w,x]=u("DialogContext","Dialog");export const Dialog=e=>{const{children:t,id:o,open:r,defaultOpen:n,onOpenChange:a}=e,c=O.useRef(null),l=s("dialog",g()),i=o||l,[u=!1,p]=d({prop:r,defaultProp:n,onChange:a}),f=O.useMemo((()=>({triggerRef:c,id:i,open:u,setOpen:p})),[i,u,p]);return O.createElement(w.Provider,{value:f},t)};Dialog.displayName="Dialog";const E="DialogTrigger",P="button";export const DialogTrigger=O.forwardRef(((e,t)=>{const{as:o=P,selector:n=i(E)}=e,a=v(e,["as","selector"]),c=x(E),l=p(t,c.triggerRef);return O.createElement(r,C({type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.id,"data-state":T(c.open)},a,{as:o,selector:n,ref:l,onClick:f(e.onClick,(()=>c.setOpen(!0)))}))}));DialogTrigger.displayName=E;const h="DialogOverlay";export const DialogOverlay=O.forwardRef(((e,t)=>{const{forceMount:o}=e,r=v(e,["forceMount"]),a=x(h);return O.createElement(n,{present:o||a.open},O.createElement(j,C({"data-state":T(a.open)},r,{ref:t})))}));const j=O.forwardRef(((e,t)=>{const{selector:o=i(h)}=e,n=v(e,["selector"]);return O.createElement(a,null,O.createElement(r,C({},n,{selector:o,ref:t})))}));DialogOverlay.displayName=h;const F="DialogContent";export const DialogContent=O.forwardRef(((e,t)=>{const{forceMount:o}=e,r=v(e,["forceMount"]),a=x(F);return O.createElement(n,{present:o||a.open},O.createElement(R,C({"data-state":T(a.open)},r,{ref:t})))}));const R=O.forwardRef(((n,s)=>{const{selector:u=i(F),onOpenAutoFocus:p,onCloseAutoFocus:d,onEscapeKeyDown:g,onPointerDownOutside:y}=n,b=v(n,["selector","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),w=x(F);o();const E=O.useRef(null);return O.useEffect((()=>{const t=E.current;if(t)return e(t)}),[]),O.createElement(a,null,O.createElement(t,null,O.createElement(c,{trapped:w.open,onMountAutoFocus:p,onUnmountAutoFocus:d},(e=>O.createElement(l,{disableOutsidePointerEvents:!0,onEscapeKeyDown:g,onPointerDownOutside:y,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.setOpen(!1)},(t=>O.createElement(r,C({role:"dialog","aria-modal":!0},b,{selector:u,ref:m(s,E,e.ref,t.ref),id:w.id,style:D(D({},t.style),b.style),onBlurCapture:f(b.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:f(b.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:f(b.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:f(b.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));DialogContent.displayName=F;const k="DialogClose",M="button";export const DialogClose=O.forwardRef(((e,t)=>{const{as:o=M,selector:n=i(k)}=e,a=v(e,["as","selector"]),c=x(k);return O.createElement(r,C({type:"button"},a,{as:o,selector:n,ref:t,onClick:f(e.onClick,(()=>c.setOpen(!1)))}))}));function T(e){return e?"open":"closed"}DialogClose.displayName=k;export const Root=Dialog;export const Trigger=DialogTrigger;export const Overlay=DialogOverlay;export const Content=DialogContent;export const Close=DialogClose;
//# sourceMappingURL=index.module.js.map
{
"name": "@radix-ui/react-dialog",
"version": "0.0.5",
"version": "0.0.6",
"license": "MIT",

@@ -19,10 +19,10 @@ "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-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-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",

@@ -29,0 +29,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