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

@interop-ui/react-dialog

Package Overview
Dependencies
Maintainers
4
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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

Comparing version 0.0.1-15 to 0.0.1-16

6

dist/index.d.ts

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

id?: string;
isOpen?: boolean;
defaultIsOpen?: boolean;
onIsOpenChange?: (isOpen: boolean) => void;
open?: boolean;
defaultOpen?: boolean;
onOpenChange?: (open: boolean) => void;
};

@@ -13,0 +13,0 @@ export const Dialog: React.FC<DialogOwnProps>;

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

var e,r,t=require("aria-hidden").hideOthers,n=require("react-remove-scroll").RemoveScroll,o=require("@interop-ui/react-focus-guards").useFocusGuards,a=require("@interop-ui/react-presence").Presence,i=require("@interop-ui/react-portal").Portal,u=require("@interop-ui/react-focus-scope").FocusScope,l=require("@interop-ui/react-dismissable-layer").DismissableLayer,c=require("@interop-ui/utils"),s=c.getPartDataAttrObj,p=c.makeId,f=require("@interop-ui/react-polymorphic").forwardRefWithAs,d=require("@interop-ui/react-utils"),g=d.createContext,v=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 n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}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){P(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 P(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function j(){return(j=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function E(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function w(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=[],n=!0,o=!1,a=void 0;try{for(var i,u=e[Symbol.iterator]();!(n=(i=u.next()).done)&&(t.push(i.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(o)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,n=new Array(r);t<r;t++)n[t]=e[t];return n}var S=w(g("DialogContext","Dialog"),2),F=S[0],k=S[1],A=function(e){var r=e.children,t=e.id,n=e.isOpen,o=e.defaultIsOpen,a=e.onIsOpenChange,i=D.useRef(null),u=p("dialog",m()),l=t||u,c=w(O({prop:n,defaultProp:o,onChange:a}),2),s=c[0],f=void 0!==s&&s,d=c[1],g=D.useMemo((function(){return{triggerRef:i,id:l,isOpen:f,setIsOpen:d}}),[l,f,d]);return D.createElement(F.Provider,{value:g},r)};exports.Dialog=A,A.displayName="Dialog";var I=f((function(e,r){var t=e.as,n=void 0===t?"button":t,o=e.onClick,a=E(e,["as","onClick"]),i=k("DialogTrigger"),u=v(r,i.triggerRef);return D.createElement(n,j({},s("DialogTrigger"),{ref:u,type:"button","aria-haspopup":"dialog","aria-expanded":i.isOpen,"aria-controls":i.id,onClick:y(o,(function(){return i.setIsOpen(!0)}))},a))}));exports.DialogTrigger=I,I.displayName="DialogTrigger";var q=f((function(e,r){var t=e.forceMount,n=E(e,["forceMount"]),o=k("DialogOverlay");return D.createElement(a,{present:t||o.isOpen},D.createElement(M,j({},n,{"data-state":B(o.isOpen),ref:r})))}));exports.DialogOverlay=q;var M=f((function(e,r){var t=e.as,n=void 0===t?"div":t,o=E(e,["as"]);return D.createElement(i,null,D.createElement(n,j({},s("DialogOverlay"),{ref:r},o)))}));q.displayName="DialogOverlay";var R=f((function(e,r){var t=e.forceMount,n=E(e,["forceMount"]),o=k("DialogContent");return D.createElement(a,{present:t||o.isOpen},D.createElement(T,j({},n,{"data-state":B(o.isOpen),ref:r})))}));exports.DialogContent=R;var T=f((function(e,r){var a=e.as,c=void 0===a?"div":a,p=e.onOpenAutoFocus,f=e.onCloseAutoFocus,d=e.onEscapeKeyDown,g=e.onPointerDownOutside,v=E(e,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),O=k("DialogContent");o();var m=D.useRef(null);return D.useEffect((function(){var e=m.current;if(e)return t(e)}),[]),D.createElement(i,null,D.createElement(n,null,D.createElement(u,{trapped:!0,onMountAutoFocus:p,onUnmountAutoFocus:f},(function(e){return D.createElement(l,{disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:g,onDismiss:function(){return O.setIsOpen(!1)}},(function(t){return D.createElement(c,j({},s("DialogContent"),{role:"dialog","aria-modal":!0},v,{ref:b(r,m,e.ref,t.ref),id:O.id,style:h(h({},t.style),v.style),onBlurCapture:y(v.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(v.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(v.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(v.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));R.displayName="DialogContent";var N=f((function(e,r){var t=e.as,n=void 0===t?"button":t,o=e.onClick,a=E(e,["as","onClick"]),i=k("DialogClose");return D.createElement(n,j({},s("DialogClose"),{ref:r,type:"button"},a,{onClick:y(o,(function(){return i.setIsOpen(!1)}))}))}));function B(e){return e?"open":"closed"}exports.DialogClose=N,N.displayName="DialogClose";var K=A;exports.Root=K;var U=I;exports.Trigger=U;var _=q;exports.Overlay=_;var G=R;exports.Content=G;var H=N;exports.Close=H;
var e,r,t=require("aria-hidden").hideOthers,n=require("react-remove-scroll").RemoveScroll,o=require("@interop-ui/react-focus-guards").useFocusGuards,a=require("@interop-ui/react-presence").Presence,u=require("@interop-ui/react-portal").Portal,i=require("@interop-ui/react-focus-scope").FocusScope,l=require("@interop-ui/react-dismissable-layer").DismissableLayer,c=require("@interop-ui/utils"),s=c.getPartDataAttrObj,p=c.makeId,f=require("@interop-ui/react-polymorphic").forwardRefWithAs,d=require("@interop-ui/react-utils"),g=d.createContext,v=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 n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}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){P(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 P(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function j(){return(j=Object.assign||function(e){for(var r=1;r<arguments.length;r++){var t=arguments[r];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function E(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)t=a[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function w(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=[],n=!0,o=!1,a=void 0;try{for(var u,i=e[Symbol.iterator]();!(n=(u=i.next()).done)&&(t.push(u.value),!r||t.length!==r);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==i.return||i.return()}finally{if(o)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,n=new Array(r);t<r;t++)n[t]=e[t];return n}var S=w(g("DialogContext","Dialog"),2),F=S[0],k=S[1],A=function(e){var r=e.children,t=e.id,n=e.open,o=e.defaultOpen,a=e.onOpenChange,u=D.useRef(null),i=p("dialog",m()),l=t||i,c=w(O({prop:n,defaultProp:o,onChange:a}),2),s=c[0],f=void 0!==s&&s,d=c[1],g=D.useMemo((function(){return{triggerRef:u,id:l,open:f,setOpen:d}}),[l,f,d]);return D.createElement(F.Provider,{value:g},r)};exports.Dialog=A,A.displayName="Dialog";var q=f((function(e,r){var t=e.as,n=void 0===t?"button":t,o=e.onClick,a=E(e,["as","onClick"]),u=k("DialogTrigger"),i=v(r,u.triggerRef);return D.createElement(n,j({},s("DialogTrigger"),{ref:i,type:"button","aria-haspopup":"dialog","aria-expanded":u.open,"aria-controls":u.id,onClick:y(o,(function(){return u.setOpen(!0)}))},a))}));exports.DialogTrigger=q,q.displayName="DialogTrigger";var M=f((function(e,r){var t=e.forceMount,n=E(e,["forceMount"]),o=k("DialogOverlay");return D.createElement(a,{present:t||o.open},D.createElement(R,j({},n,{"data-state":B(o.open),ref:r})))}));exports.DialogOverlay=M;var R=f((function(e,r){var t=e.as,n=void 0===t?"div":t,o=E(e,["as"]);return D.createElement(u,null,D.createElement(n,j({},s("DialogOverlay"),{ref:r},o)))}));M.displayName="DialogOverlay";var T=f((function(e,r){var t=e.forceMount,n=E(e,["forceMount"]),o=k("DialogContent");return D.createElement(a,{present:t||o.open},D.createElement(I,j({},n,{"data-state":B(o.open),ref:r})))}));exports.DialogContent=T;var I=f((function(e,r){var a=e.as,c=void 0===a?"div":a,p=e.onOpenAutoFocus,f=e.onCloseAutoFocus,d=e.onEscapeKeyDown,g=e.onPointerDownOutside,v=E(e,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),O=k("DialogContent");o();var m=D.useRef(null);return D.useEffect((function(){var e=m.current;if(e)return t(e)}),[]),D.createElement(u,null,D.createElement(n,null,D.createElement(i,{trapped:!0,onMountAutoFocus:p,onUnmountAutoFocus:f},(function(e){return D.createElement(l,{disableOutsidePointerEvents:!0,onEscapeKeyDown:d,onPointerDownOutside:g,onDismiss:function(){return O.setOpen(!1)}},(function(t){return D.createElement(c,j({},s("DialogContent"),{role:"dialog","aria-modal":!0},v,{ref:b(r,m,e.ref,t.ref),id:O.id,style:h(h({},t.style),v.style),onBlurCapture:y(v.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:y(v.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:y(v.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:y(v.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))}))}))))}));T.displayName="DialogContent";var N=f((function(e,r){var t=e.as,n=void 0===t?"button":t,o=e.onClick,a=E(e,["as","onClick"]),u=k("DialogClose");return D.createElement(n,j({},s("DialogClose"),{ref:r,type:"button"},a,{onClick:y(o,(function(){return u.setOpen(!1)}))}))}));function B(e){return e?"open":"closed"}exports.DialogClose=N,N.displayName="DialogClose";var K=A;exports.Root=K;var U=q;exports.Trigger=U;var _=M;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 o}from"@interop-ui/react-focus-guards";import{Presence as r}from"@interop-ui/react-presence";import{Portal as n}from"@interop-ui/react-portal";import{FocusScope as a}from"@interop-ui/react-focus-scope";import{DismissableLayer as i}from"@interop-ui/react-dismissable-layer";import{getPartDataAttrObj as l,makeId as s}from"@interop-ui/utils";import{forwardRefWithAs as c}from"@interop-ui/react-polymorphic";import{createContext as u,useComposedRefs as p,composeEventHandlers as g,useControlledState as f,useId as m,composeRefs as O}from"@interop-ui/react-utils";import*as D from"react";function d(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 y(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?d(Object(o),!0).forEach((function(t){C(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function C(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function b(){return(b=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[h,E]=u("DialogContext","Dialog");export const Dialog=e=>{const{children:t,id:o,isOpen:r,defaultIsOpen:n,onIsOpenChange:a}=e,i=D.useRef(null),l=s("dialog",m()),c=o||l,[u=!1,p]=f({prop:r,defaultProp:n,onChange:a}),g=D.useMemo((()=>({triggerRef:i,id:c,isOpen:u,setIsOpen:p})),[c,u,p]);return D.createElement(h.Provider,{value:g},t)};Dialog.displayName="Dialog";const P="button";export const DialogTrigger=c(((e,t)=>{const{as:o=P,onClick:r}=e,n=v(e,["as","onClick"]),a=E("DialogTrigger"),i=p(t,a.triggerRef);return D.createElement(o,b({},l("DialogTrigger"),{ref:i,type:"button","aria-haspopup":"dialog","aria-expanded":a.isOpen,"aria-controls":a.id,onClick:g(r,(()=>a.setIsOpen(!0)))},n))}));DialogTrigger.displayName="DialogTrigger";const w="div";export const DialogOverlay=c(((e,t)=>{const{forceMount:o}=e,n=v(e,["forceMount"]),a=E("DialogOverlay");return D.createElement(r,{present:o||a.isOpen},D.createElement(j,b({},n,{"data-state":T(a.isOpen),ref:t})))}));const j=c(((e,t)=>{const{as:o=w}=e,r=v(e,["as"]);return D.createElement(n,null,D.createElement(o,b({},l("DialogOverlay"),{ref:t},r)))}));DialogOverlay.displayName="DialogOverlay";const x="div";export const DialogContent=c(((e,t)=>{const{forceMount:o}=e,n=v(e,["forceMount"]),a=E("DialogContent");return D.createElement(r,{present:o||a.isOpen},D.createElement(F,b({},n,{"data-state":T(a.isOpen),ref:t})))}));const F=c(((r,s)=>{const{as:c=x,onOpenAutoFocus:u,onCloseAutoFocus:p,onEscapeKeyDown:f,onPointerDownOutside:m}=r,d=v(r,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),C=E("DialogContent");o();const h=D.useRef(null);return D.useEffect((()=>{const t=h.current;if(t)return e(t)}),[]),D.createElement(n,null,D.createElement(t,null,D.createElement(a,{trapped:!0,onMountAutoFocus:u,onUnmountAutoFocus:p},(e=>D.createElement(i,{disableOutsidePointerEvents:!0,onEscapeKeyDown:f,onPointerDownOutside:m,onDismiss:()=>C.setIsOpen(!1)},(t=>D.createElement(c,b({},l("DialogContent"),{role:"dialog","aria-modal":!0},d,{ref:O(s,h,e.ref,t.ref),id:C.id,style:y(y({},t.style),d.style),onBlurCapture:g(d.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:g(d.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:g(d.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:g(d.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));DialogContent.displayName="DialogContent";const k="button";export const DialogClose=c(((e,t)=>{const{as:o=k,onClick:r}=e,n=v(e,["as","onClick"]),a=E("DialogClose");return D.createElement(o,b({},l("DialogClose"),{ref:t,type:"button"},n,{onClick:g(r,(()=>a.setIsOpen(!1)))}))}));function T(e){return e?"open":"closed"}DialogClose.displayName="DialogClose";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"@interop-ui/react-focus-guards";import{Presence as r}from"@interop-ui/react-presence";import{Portal as n}from"@interop-ui/react-portal";import{FocusScope as a}from"@interop-ui/react-focus-scope";import{DismissableLayer as i}from"@interop-ui/react-dismissable-layer";import{getPartDataAttrObj as l,makeId as c}from"@interop-ui/utils";import{forwardRefWithAs as s}from"@interop-ui/react-polymorphic";import{createContext as u,useComposedRefs as p,composeEventHandlers as g,useControlledState as f,useId as m,composeRefs as D}from"@interop-ui/react-utils";import*as O from"react";function d(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 y(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?d(Object(o),!0).forEach((function(t){C(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):d(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}function C(e,t,o){return t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function b(){return(b=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[h,E]=u("DialogContext","Dialog");export const Dialog=e=>{const{children:t,id:o,open:r,defaultOpen:n,onOpenChange:a}=e,i=O.useRef(null),l=c("dialog",m()),s=o||l,[u=!1,p]=f({prop:r,defaultProp:n,onChange:a}),g=O.useMemo((()=>({triggerRef:i,id:s,open:u,setOpen:p})),[s,u,p]);return O.createElement(h.Provider,{value:g},t)};Dialog.displayName="Dialog";const P="button";export const DialogTrigger=s(((e,t)=>{const{as:o=P,onClick:r}=e,n=v(e,["as","onClick"]),a=E("DialogTrigger"),i=p(t,a.triggerRef);return O.createElement(o,b({},l("DialogTrigger"),{ref:i,type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.id,onClick:g(r,(()=>a.setOpen(!0)))},n))}));DialogTrigger.displayName="DialogTrigger";const w="div";export const DialogOverlay=s(((e,t)=>{const{forceMount:o}=e,n=v(e,["forceMount"]),a=E("DialogOverlay");return O.createElement(r,{present:o||a.open},O.createElement(j,b({},n,{"data-state":T(a.open),ref:t})))}));const j=s(((e,t)=>{const{as:o=w}=e,r=v(e,["as"]);return O.createElement(n,null,O.createElement(o,b({},l("DialogOverlay"),{ref:t},r)))}));DialogOverlay.displayName="DialogOverlay";const x="div";export const DialogContent=s(((e,t)=>{const{forceMount:o}=e,n=v(e,["forceMount"]),a=E("DialogContent");return O.createElement(r,{present:o||a.open},O.createElement(F,b({},n,{"data-state":T(a.open),ref:t})))}));const F=s(((r,c)=>{const{as:s=x,onOpenAutoFocus:u,onCloseAutoFocus:p,onEscapeKeyDown:f,onPointerDownOutside:m}=r,d=v(r,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),C=E("DialogContent");o();const h=O.useRef(null);return O.useEffect((()=>{const t=h.current;if(t)return e(t)}),[]),O.createElement(n,null,O.createElement(t,null,O.createElement(a,{trapped:!0,onMountAutoFocus:u,onUnmountAutoFocus:p},(e=>O.createElement(i,{disableOutsidePointerEvents:!0,onEscapeKeyDown:f,onPointerDownOutside:m,onDismiss:()=>C.setOpen(!1)},(t=>O.createElement(s,b({},l("DialogContent"),{role:"dialog","aria-modal":!0},d,{ref:D(c,h,e.ref,t.ref),id:C.id,style:y(y({},t.style),d.style),onBlurCapture:g(d.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:g(d.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:g(d.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:g(d.onTouchStartCapture,t.onTouchStartCapture,{checkForDefaultPrevented:!1})}))))))))}));DialogContent.displayName="DialogContent";const k="button";export const DialogClose=s(((e,t)=>{const{as:o=k,onClick:r}=e,n=v(e,["as","onClick"]),a=E("DialogClose");return O.createElement(o,b({},l("DialogClose"),{ref:t,type:"button"},n,{onClick:g(r,(()=>a.setOpen(!1)))}))}));function T(e){return e?"open":"closed"}DialogClose.displayName="DialogClose";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": "@interop-ui/react-dialog",
"version": "0.0.1-15",
"version": "0.0.1-16",
"license": "MIT",

@@ -20,10 +20,10 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-dismissable-layer": "0.0.1-5",
"@interop-ui/react-focus-guards": "0.0.1-2",
"@interop-ui/react-focus-scope": "0.0.1-5",
"@interop-ui/react-polymorphic": "0.0.1-1",
"@interop-ui/react-portal": "0.0.1-14",
"@interop-ui/react-presence": "0.0.1-0",
"@interop-ui/react-utils": "0.0.1-14",
"@interop-ui/utils": "0.0.1-6",
"@interop-ui/react-dismissable-layer": "0.0.1-6",
"@interop-ui/react-focus-guards": "0.0.1-3",
"@interop-ui/react-focus-scope": "0.0.1-6",
"@interop-ui/react-polymorphic": "0.0.1-2",
"@interop-ui/react-portal": "0.0.1-15",
"@interop-ui/react-presence": "0.0.1-1",
"@interop-ui/react-utils": "0.0.1-15",
"@interop-ui/utils": "0.0.1-7",
"aria-hidden": "^1.1.1",

@@ -30,0 +30,0 @@ "react-remove-scroll": "^2.4.0"

@@ -13,24 +13,2 @@ # `react-dialog`

```js
import * as React from 'react';
import {
Dialog,
DialogTrigger,
DialogOverlay,
DialogContent,
DialogClose,
} from '@interop-ui/react-dialog';
function MyComponent() {
return (
<Dialog>
<DialogTrigger>Open the dialog</DialogTrigger>
<DialogOverlay />
<DialogContent>
<p>Some really cool dialog content!</p>
<DialogClose>Close the dialog</DialogClose>
</DialogContent>
</Dialog>
);
}
```
View docs [here](https://radix-ui.com/primitives/docs/components/dialog).

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