@interop-ui/react-dialog
Advanced tools
Comparing version 0.0.1-14 to 0.0.1-15
import * as React from "react"; | ||
import { DismissableLayerProps } from "@interop-ui/react-dismissable-layer"; | ||
import { FocusScopeProps } from "@interop-ui/react-focus-scope"; | ||
import { DismissableLayer } from "@interop-ui/react-dismissable-layer"; | ||
import { FocusScope } from "@interop-ui/react-focus-scope"; | ||
type DismissableLayerProps = React.ComponentProps<typeof DismissableLayer>; | ||
type FocusScopeProps = React.ComponentProps<typeof FocusScope>; | ||
type DialogOwnProps = { | ||
@@ -12,5 +14,20 @@ id?: string; | ||
export const DialogTrigger: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>; | ||
export const DialogOverlay: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<{}, never>>; | ||
type DialogOverlayOwnProps = { | ||
/** | ||
* Used to force mounting when more control is needed. Useful when | ||
* controlling animation with React animation libraries. | ||
*/ | ||
forceMount?: true; | ||
}; | ||
export const DialogOverlay: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@interop-ui/react-polymorphic").MergeProps<{}, DialogOverlayOwnProps>>; | ||
type DialogContentOwnProps = { | ||
/** | ||
* Used to force mounting when more control is needed. Useful when | ||
* controlling animation with React animation libraries. | ||
*/ | ||
forceMount?: true; | ||
}; | ||
export const DialogContent: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@interop-ui/react-polymorphic").MergeProps<DialogContentImplOwnProps, DialogContentOwnProps>>; | ||
type DialogContentImplOwnProps = { | ||
/** | ||
* Event handler called when auto-focusing on open. | ||
@@ -36,5 +53,9 @@ * Can be prevented. | ||
}; | ||
export const DialogContent: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", Pick<DialogContentOwnProps, "onEscapeKeyDown" | "onPointerDownOutside" | "onOpenAutoFocus" | "onCloseAutoFocus">>; | ||
export const DialogClose: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>; | ||
export const Root: React.FC<DialogOwnProps>; | ||
export const Trigger: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>; | ||
export const Overlay: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@interop-ui/react-polymorphic").MergeProps<{}, DialogOverlayOwnProps>>; | ||
export const Content: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", import("@interop-ui/react-polymorphic").MergeProps<DialogContentImplOwnProps, DialogContentOwnProps>>; | ||
export const Close: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"button", {}>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -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-portal").Portal,i=require("@interop-ui/react-focus-scope").FocusScope,u=require("@interop-ui/react-dismissable-layer").DismissableLayer,l=require("@interop-ui/react-debug-context").useDebugContext,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,y=d.useComposedRefs,O=d.composeEventHandlers,v=d.useControlledState,b=d.useId,m=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){j(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 j(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 n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])}return e}).apply(this,arguments)}function w(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 E(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 F(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 F(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 F(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=E(g("DialogContext","Dialog"),2),k=S[0],A=S[1],x=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",b()),l=t||u,c=E(v({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(k.Provider,{value:g},r)};exports.Dialog=x,x.displayName="Dialog";var I=f((function(e,r){var t=e.as,n=void 0===t?"button":t,o=e.onClick,a=w(e,["as","onClick"]),i=A("DialogTrigger"),u=y(r,i.triggerRef);return D.createElement(n,P({},s("DialogTrigger"),{ref:u,type:"button","aria-haspopup":"dialog","aria-expanded":i.isOpen,"aria-controls":i.id,onClick:O(o,(function(){return i.setIsOpen(!0)}))},a))}));exports.DialogTrigger=I,I.displayName="DialogTrigger";var q=f((function(e,r){return A("DialogOverlay").isOpen?D.createElement(R,P({ref:r},e)):null}));exports.DialogOverlay=q;var R=f((function(e,r){var t=e.as,n=void 0===t?"div":t,o=w(e,["as"]);return D.createElement(a,null,D.createElement(n,P({},s("DialogOverlay"),{ref:r},o)))}));q.displayName="DialogOverlay";var T=f((function(e,r){return A("DialogContent").isOpen?D.createElement(M,P({ref:r},e)):null}));exports.DialogContent=T;var M=f((function(e,r){var c=e.as,p=void 0===c?"div":c,f=e.onOpenAutoFocus,d=e.onCloseAutoFocus,g=e.onEscapeKeyDown,y=e.onPointerDownOutside,v=w(e,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),b=A("DialogContent"),C=l().disableLock?D.Fragment:n;o();var j=D.useRef(null);return D.useEffect((function(){var e=j.current;if(e)return t(e)}),[]),D.createElement(a,null,D.createElement(C,null,D.createElement(i,{trapped:!0,onMountAutoFocus:f,onUnmountAutoFocus:d},(function(e){return D.createElement(u,{disableOutsidePointerEvents:!0,onEscapeKeyDown:g,onPointerDownOutside:y,onDismiss:function(){return b.setIsOpen(!1)}},(function(t){return D.createElement(p,P({},s("DialogContent"),{role:"dialog","aria-modal":!0},v,{ref:m(r,j,e.ref,t.ref),id:b.id,style:h(h({},t.style),v.style),onBlurCapture:O(v.onBlurCapture,t.onBlurCapture,{checkForDefaultPrevented:!1}),onFocusCapture:O(v.onFocusCapture,t.onFocusCapture,{checkForDefaultPrevented:!1}),onMouseDownCapture:O(v.onMouseDownCapture,t.onMouseDownCapture,{checkForDefaultPrevented:!1}),onTouchStartCapture:O(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=w(e,["as","onClick"]),i=A("DialogClose");return D.createElement(n,P({},s("DialogClose"),{ref:r,type:"button"},a,{onClick:O(o,(function(){return i.setIsOpen(!1)}))}))}));exports.DialogClose=N,N.displayName="DialogClose"; | ||
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; | ||
//# 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{Portal as r}from"@interop-ui/react-portal";import{FocusScope as n}from"@interop-ui/react-focus-scope";import{DismissableLayer as a}from"@interop-ui/react-dismissable-layer";import{useDebugContext as i}from"@interop-ui/react-debug-context";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 f,useControlledState as g,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){b(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 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[h,P]=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]=g({prop:r,defaultProp:n,onChange:a}),f=D.useMemo((()=>({triggerRef:i,id:c,isOpen:u,setIsOpen:p})),[c,u,p]);return D.createElement(h.Provider,{value:f},t)};Dialog.displayName="Dialog";const E="button";export const DialogTrigger=c(((e,t)=>{const{as:o=E,onClick:r}=e,n=v(e,["as","onClick"]),a=P("DialogTrigger"),i=p(t,a.triggerRef);return D.createElement(o,C({},l("DialogTrigger"),{ref:i,type:"button","aria-haspopup":"dialog","aria-expanded":a.isOpen,"aria-controls":a.id,onClick:f(r,(()=>a.setIsOpen(!0)))},n))}));DialogTrigger.displayName="DialogTrigger";const w="div";export const DialogOverlay=c(((e,t)=>P("DialogOverlay").isOpen?D.createElement(j,C({ref:t},e)):null));const j=c(((e,t)=>{const{as:o=w}=e,n=v(e,["as"]);return D.createElement(r,null,D.createElement(o,C({},l("DialogOverlay"),{ref:t},n)))}));DialogOverlay.displayName="DialogOverlay";const F="div";export const DialogContent=c(((e,t)=>P("DialogContent").isOpen?D.createElement(k,C({ref:t},e)):null));const k=c(((s,c)=>{const{as:u=F,onOpenAutoFocus:p,onCloseAutoFocus:g,onEscapeKeyDown:m,onPointerDownOutside:d}=s,b=v(s,["as","onOpenAutoFocus","onCloseAutoFocus","onEscapeKeyDown","onPointerDownOutside"]),h=P("DialogContent"),E=i().disableLock?D.Fragment:t;o();const w=D.useRef(null);return D.useEffect((()=>{const t=w.current;if(t)return e(t)}),[]),D.createElement(r,null,D.createElement(E,null,D.createElement(n,{trapped:!0,onMountAutoFocus:p,onUnmountAutoFocus:g},(e=>D.createElement(a,{disableOutsidePointerEvents:!0,onEscapeKeyDown:m,onPointerDownOutside:d,onDismiss:()=>h.setIsOpen(!1)},(t=>D.createElement(u,C({},l("DialogContent"),{role:"dialog","aria-modal":!0},b,{ref:O(c,w,e.ref,t.ref),id:h.id,style:y(y({},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="DialogContent";const x="button";export const DialogClose=c(((e,t)=>{const{as:o=x,onClick:r}=e,n=v(e,["as","onClick"]),a=P("DialogClose");return D.createElement(o,C({},l("DialogClose"),{ref:t,type:"button"},n,{onClick:f(r,(()=>a.setIsOpen(!1)))}))}));DialogClose.displayName="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 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; | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@interop-ui/react-dialog", | ||
"version": "0.0.1-14", | ||
"version": "0.0.1-15", | ||
"license": "MIT", | ||
@@ -20,10 +20,10 @@ "source": "src/index.ts", | ||
"dependencies": { | ||
"@interop-ui/react-debug-context": "0.0.1-12", | ||
"@interop-ui/react-dismissable-layer": "0.0.1-4", | ||
"@interop-ui/react-focus-guards": "0.0.1-1", | ||
"@interop-ui/react-focus-scope": "0.0.1-4", | ||
"@interop-ui/react-polymorphic": "0.0.1-0", | ||
"@interop-ui/react-portal": "0.0.1-13", | ||
"@interop-ui/react-utils": "0.0.1-13", | ||
"@interop-ui/utils": "0.0.1-5", | ||
"@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", | ||
"aria-hidden": "^1.1.1", | ||
@@ -30,0 +30,0 @@ "react-remove-scroll": "^2.4.0" |
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
50499
103
+ Added@interop-ui/react-dismissable-layer@0.0.1-5(transitive)
+ Added@interop-ui/react-focus-guards@0.0.1-2(transitive)
+ Added@interop-ui/react-focus-scope@0.0.1-5(transitive)
+ Added@interop-ui/react-polymorphic@0.0.1-1(transitive)
+ Added@interop-ui/react-portal@0.0.1-14(transitive)
+ Added@interop-ui/react-presence@0.0.1-0(transitive)
+ Added@interop-ui/react-utils@0.0.1-14(transitive)
+ Added@interop-ui/utils@0.0.1-6(transitive)
+ Added@xstate/fsm@1.6.5(transitive)
- Removed@interop-ui/react-debug-context@0.0.1-12(transitive)
- Removed@interop-ui/react-dismissable-layer@0.0.1-4(transitive)
- Removed@interop-ui/react-focus-guards@0.0.1-1(transitive)
- Removed@interop-ui/react-focus-scope@0.0.1-4(transitive)
- Removed@interop-ui/react-polymorphic@0.0.1-0(transitive)
- Removed@interop-ui/react-portal@0.0.1-13(transitive)
- Removed@interop-ui/react-utils@0.0.1-13(transitive)
- Removed@interop-ui/utils@0.0.1-5(transitive)
Updated@interop-ui/utils@0.0.1-6