Socket
Socket
Sign inDemoInstall

@reach/dialog

Package Overview
Dependencies
Maintainers
4
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/dialog - npm Package Compare versions

Comparing version 0.10.5 to 0.11.0

52

dist/dialog.cjs.development.js

@@ -5,12 +5,16 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = require('react');
var React__default = _interopDefault(React);
var Portal = _interopDefault(require('@reach/portal'));
var Portal = require('@reach/portal');
var utils = require('@reach/utils');
var FocusLock = _interopDefault(require('react-focus-lock'));
var FocusLock = require('react-focus-lock');
var reactRemoveScroll = require('react-remove-scroll');
var PropTypes = _interopDefault(require('prop-types'));
var PropTypes = require('prop-types');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
var Portal__default = /*#__PURE__*/_interopDefaultLegacy(Portal);
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock);
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
function _extends() {

@@ -50,5 +54,5 @@ _extends = Object.assign || function (target) {

var overlayPropTypes = {
allowPinchZoom: PropTypes.bool,
dangerouslyBypassFocusLock: PropTypes.bool,
dangerouslyBypassScrollLock: PropTypes.bool,
allowPinchZoom: PropTypes__default['default'].bool,
dangerouslyBypassFocusLock: PropTypes__default['default'].bool,
dangerouslyBypassScrollLock: PropTypes__default['default'].bool,
// TODO:

@@ -58,3 +62,3 @@ initialFocusRef: function initialFocusRef() {

},
onDismiss: PropTypes.func
onDismiss: PropTypes__default['default'].func
}; ////////////////////////////////////////////////////////////////////////////////

@@ -70,3 +74,3 @@

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay
* @see Docs https://reach.tech/dialog#dialogoverlay
*/

@@ -97,5 +101,5 @@

}, [isOpen]);
return isOpen ? React__default.createElement(Portal, {
return isOpen ? React__default['default'].createElement(Portal__default['default'], {
"data-reach-dialog-wrapper": ""
}, React__default.createElement(DialogInner, Object.assign({
}, React__default['default'].createElement(DialogInner, Object.assign({
ref: forwardedRef

@@ -108,3 +112,3 @@ }, props))) : null;

DialogOverlay.propTypes = /*#__PURE__*/_extends({}, overlayPropTypes, {
isOpen: PropTypes.bool
isOpen: PropTypes__default['default'].bool
});

@@ -164,3 +168,3 @@ } ////////////////////////////////////////////////////////////////////////////////

}, []);
return React__default.createElement(FocusLock, {
return React__default['default'].createElement(FocusLock__default['default'], {
autoFocus: true,

@@ -171,6 +175,6 @@ returnFocus: true,

crossFrame: unstable_lockFocusAcrossFrames
}, React__default.createElement(reactRemoveScroll.RemoveScroll, {
}, React__default['default'].createElement(reactRemoveScroll.RemoveScroll, {
allowPinchZoom: allowPinchZoom,
enabled: !dangerouslyBypassScrollLock
}, React__default.createElement("div", Object.assign({}, props, {
}, React__default['default'].createElement("div", Object.assign({}, props, {
ref: ref,

@@ -208,3 +212,3 @@ "data-reach-dialog-overlay": "",

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent
* @see Docs https://reach.tech/dialog#dialogcontent
*/

@@ -218,3 +222,3 @@

return React__default.createElement("div", Object.assign({
return React__default['default'].createElement("div", Object.assign({
"aria-modal": "true",

@@ -246,3 +250,3 @@ role: "dialog",

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog
* @see Docs https://reach.tech/dialog#dialog
*/

@@ -260,3 +264,3 @@

return React__default.createElement(DialogOverlay, {
return React__default['default'].createElement(DialogOverlay, {
allowPinchZoom: allowPinchZoom,

@@ -266,3 +270,3 @@ initialFocusRef: initialFocusRef,

onDismiss: onDismiss
}, React__default.createElement(DialogContent, Object.assign({
}, React__default['default'].createElement(DialogContent, Object.assign({
ref: forwardedRef

@@ -275,4 +279,4 @@ }, props)));

Dialog.propTypes = {
isOpen: PropTypes.bool,
onDismiss: PropTypes.func,
isOpen: PropTypes__default['default'].bool,
onDismiss: PropTypes__default['default'].func,
"aria-label": ariaLabelType,

@@ -279,0 +283,0 @@ "aria-labelledby": ariaLabelType

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

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var o=require("react"),n=e(o),r=e(require("@reach/portal")),t=require("@reach/utils"),a=e(require("react-focus-lock")),i=require("react-remove-scroll");function c(e,o){if(null==e)return{};var n,r,t={},a=Object.keys(e);for(r=0;r<a.length;r++)o.indexOf(n=a[r])>=0||(t[n]=e[n]);return t}e(require("prop-types"));var s=o.forwardRef((function(e,a){var i=e.isOpen,s=void 0===i||i,l=c(e,["isOpen"]);return o.useEffect((function(){return t.checkStyles("dialog")}),[]),o.useEffect((function(){s?window.__REACH_DISABLE_TOOLTIPS=!0:window.requestAnimationFrame((function(){window.__REACH_DISABLE_TOOLTIPS=!1}))}),[s]),s?n.createElement(r,{"data-reach-dialog-wrapper":""},n.createElement(u,Object.assign({ref:a},l))):null})),u=o.forwardRef((function(e,r){var s=e.allowPinchZoom,u=e.dangerouslyBypassFocusLock,l=void 0!==u&&u,f=e.dangerouslyBypassScrollLock,d=void 0!==f&&f,p=e.initialFocusRef,v=e.onClick,m=e.onDismiss,w=void 0===m?t.noop:m,g=e.onKeyDown,y=e.onMouseDown,E=e.unstable_lockFocusAcrossFrames,h=void 0===E||E,b=c(e,["allowPinchZoom","dangerouslyBypassFocusLock","dangerouslyBypassScrollLock","initialFocusRef","onClick","onDismiss","onKeyDown","onMouseDown","unstable_lockFocusAcrossFrames"]),k=o.useRef(null),D=o.useRef(null),O=t.useForkedRef(D,r),F=o.useCallback((function(){p&&p.current&&p.current.focus()}),[p]);return o.useEffect((function(){return D.current?(o=[],n=[],r=t.getOwnerDocument(e=D.current)||document,e?(Array.prototype.forEach.call(r.querySelectorAll("body > *"),(function(r){var t,a;if(r!==(null===(t=e.parentNode)||void 0===t||null===(a=t.parentNode)||void 0===a?void 0:a.parentNode)){var i=r.getAttribute("aria-hidden");null!==i&&"false"!==i||(o.push(i),n.push(r),r.setAttribute("aria-hidden","true"))}})),function(){n.forEach((function(e,n){var r=o[n];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}):t.noop):void 0;var e,o,n,r}),[]),n.createElement(a,{autoFocus:!0,returnFocus:!0,onActivation:F,disabled:l,crossFrame:h},n.createElement(i.RemoveScroll,{allowPinchZoom:s,enabled:!d},n.createElement("div",Object.assign({},b,{ref:O,"data-reach-dialog-overlay":"",onClick:t.wrapEvent(v,(function(e){k.current===e.target&&(e.stopPropagation(),w(e))})),onKeyDown:t.wrapEvent(g,(function(e){"Escape"===e.key&&(e.stopPropagation(),w(e))})),onMouseDown:t.wrapEvent(y,(function(e){k.current=e.target}))}))))})),l=o.forwardRef((function(e,o){var r=e.onClick,a=c(e,["onClick","onKeyDown"]);return n.createElement("div",Object.assign({"aria-modal":"true",role:"dialog",tabIndex:-1},a,{ref:o,"data-reach-dialog-content":"",onClick:t.wrapEvent(r,(function(e){e.stopPropagation()}))}))})),f=o.forwardRef((function(e,o){var r=e.allowPinchZoom,a=void 0!==r&&r,i=e.initialFocusRef,u=e.isOpen,f=e.onDismiss,d=void 0===f?t.noop:f,p=c(e,["allowPinchZoom","initialFocusRef","isOpen","onDismiss"]);return n.createElement(s,{allowPinchZoom:a,initialFocusRef:i,isOpen:u,onDismiss:d},n.createElement(l,Object.assign({ref:o},p)))}));exports.Dialog=f,exports.DialogContent=l,exports.DialogOverlay=s,exports.default=f;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),o=require("@reach/portal"),n=require("@reach/utils"),r=require("react-focus-lock"),t=require("react-remove-scroll");function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("prop-types");var i=a(e),u=a(o),l=a(r);function c(e,o){if(null==e)return{};var n,r,t={},a=Object.keys(e);for(r=0;r<a.length;r++)o.indexOf(n=a[r])>=0||(t[n]=e[n]);return t}var s=e.forwardRef((function(o,r){var t=o.isOpen,a=void 0===t||t,l=c(o,["isOpen"]);return e.useEffect((function(){return n.checkStyles("dialog")}),[]),e.useEffect((function(){a?window.__REACH_DISABLE_TOOLTIPS=!0:window.requestAnimationFrame((function(){window.__REACH_DISABLE_TOOLTIPS=!1}))}),[a]),a?i.default.createElement(u.default,{"data-reach-dialog-wrapper":""},i.default.createElement(f,Object.assign({ref:r},l))):null})),f=e.forwardRef((function(o,r){var a=o.allowPinchZoom,u=o.dangerouslyBypassFocusLock,s=void 0!==u&&u,f=o.dangerouslyBypassScrollLock,d=void 0!==f&&f,p=o.initialFocusRef,v=o.onClick,m=o.onDismiss,w=void 0===m?n.noop:m,g=o.onKeyDown,y=o.onMouseDown,E=o.unstable_lockFocusAcrossFrames,h=void 0===E||E,b=c(o,["allowPinchZoom","dangerouslyBypassFocusLock","dangerouslyBypassScrollLock","initialFocusRef","onClick","onDismiss","onKeyDown","onMouseDown","unstable_lockFocusAcrossFrames"]),k=e.useRef(null),D=e.useRef(null),O=n.useForkedRef(D,r),F=e.useCallback((function(){p&&p.current&&p.current.focus()}),[p]);return e.useEffect((function(){return D.current?(o=[],r=[],t=n.getOwnerDocument(e=D.current)||document,e?(Array.prototype.forEach.call(t.querySelectorAll("body > *"),(function(n){var t,a;if(n!==(null===(t=e.parentNode)||void 0===t||null===(a=t.parentNode)||void 0===a?void 0:a.parentNode)){var i=n.getAttribute("aria-hidden");null!==i&&"false"!==i||(o.push(i),r.push(n),n.setAttribute("aria-hidden","true"))}})),function(){r.forEach((function(e,n){var r=o[n];null===r?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r)}))}):n.noop):void 0;var e,o,r,t}),[]),i.default.createElement(l.default,{autoFocus:!0,returnFocus:!0,onActivation:F,disabled:s,crossFrame:h},i.default.createElement(t.RemoveScroll,{allowPinchZoom:a,enabled:!d},i.default.createElement("div",Object.assign({},b,{ref:O,"data-reach-dialog-overlay":"",onClick:n.wrapEvent(v,(function(e){k.current===e.target&&(e.stopPropagation(),w(e))})),onKeyDown:n.wrapEvent(g,(function(e){"Escape"===e.key&&(e.stopPropagation(),w(e))})),onMouseDown:n.wrapEvent(y,(function(e){k.current=e.target}))}))))})),d=e.forwardRef((function(e,o){var r=e.onClick,t=c(e,["onClick","onKeyDown"]);return i.default.createElement("div",Object.assign({"aria-modal":"true",role:"dialog",tabIndex:-1},t,{ref:o,"data-reach-dialog-content":"",onClick:n.wrapEvent(r,(function(e){e.stopPropagation()}))}))})),p=e.forwardRef((function(e,o){var r=e.allowPinchZoom,t=void 0!==r&&r,a=e.initialFocusRef,u=e.isOpen,l=e.onDismiss,f=void 0===l?n.noop:l,p=c(e,["allowPinchZoom","initialFocusRef","isOpen","onDismiss"]);return i.default.createElement(s,{allowPinchZoom:t,initialFocusRef:a,isOpen:u,onDismiss:f},i.default.createElement(d,Object.assign({ref:o},p)))}));exports.Dialog=p,exports.DialogContent=d,exports.DialogOverlay=s,exports.default=p;
//# sourceMappingURL=dialog.cjs.production.min.js.map

@@ -60,3 +60,3 @@ import React, { forwardRef, useEffect, useRef, useCallback } from 'react';

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay
* @see Docs https://reach.tech/dialog#dialogoverlay
*/

@@ -194,3 +194,3 @@

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent
* @see Docs https://reach.tech/dialog#dialogcontent
*/

@@ -231,3 +231,3 @@

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog
* @see Docs https://reach.tech/dialog#dialog
*/

@@ -234,0 +234,0 @@

@@ -6,3 +6,3 @@ /**

*
* @see Docs https://reacttraining.com/reach-ui/dialog
* @see Docs https://reach.tech/dialog
* @see Source https://github.com/reach/reach-ui/tree/main/packages/dialog

@@ -20,3 +20,3 @@ * @see WAI-ARIA https://www.w3.org/TR/wai-aria-practices-1.2/#dialog_modal

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay
* @see Docs https://reach.tech/dialog#dialogoverlay
*/

@@ -28,3 +28,3 @@ export declare const DialogOverlay: React.ForwardRefExoticComponent<{

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-allowpinchzoom
* @see Docs https://reach.tech/dialog#dialog-allowpinchzoom
*/

@@ -35,3 +35,3 @@ allowPinchZoom?: boolean | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-children
* @see Docs https://reach.tech/dialog#dialog-children
*/

@@ -43,3 +43,3 @@ children?: React.ReactNode;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-initialfocusref
* @see Docs https://reach.tech/dialog#dialog-initialfocusref
*/

@@ -50,3 +50,3 @@ initialFocusRef?: React.RefObject<any> | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-isopen
* @see Docs https://reach.tech/dialog#dialog-isopen
*/

@@ -65,3 +65,3 @@ isOpen?: boolean | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-ondismiss
* @see Docs https://reach.tech/dialog#dialog-ondismiss
*/

@@ -104,3 +104,3 @@ onDismiss?: ((event?: React.SyntheticEvent<Element, Event> | undefined) => void) | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay-dangerouslybypassfocuslock
* @see Docs https://reach.tech/dialog#dialogoverlay-dangerouslybypassfocuslock
* @see https://github.com/theKashey/react-focus-lock

@@ -122,3 +122,3 @@ * @see https://github.com/reach/reach-ui/issues/615

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay-dangerouslybypassscrolllock
* @see Docs https://reach.tech/dialog#dialogoverlay-dangerouslybypassscrolllock
* @see https://github.com/theKashey/react-remove-scroll

@@ -145,3 +145,3 @@ */

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay-dangerouslybypassfocuslock
* @see Docs https://reach.tech/dialog#dialogoverlay-dangerouslybypassfocuslock
* @see https://github.com/theKashey/react-focus-lock

@@ -163,3 +163,3 @@ * @see https://github.com/reach/reach-ui/issues/615

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogoverlay-dangerouslybypassscrolllock
* @see Docs https://reach.tech/dialog#dialogoverlay-dangerouslybypassscrolllock
* @see https://github.com/theKashey/react-remove-scroll

@@ -182,3 +182,3 @@ */

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent
* @see Docs https://reach.tech/dialog#dialogcontent
*/

@@ -189,3 +189,3 @@ export declare const DialogContent: React.ForwardRefExoticComponent<{

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent-children
* @see Docs https://reach.tech/dialog#dialogcontent-children
*/

@@ -195,3 +195,3 @@ children?: React.ReactNode;

/**
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent-props
* @see Docs https://reach.tech/dialog#dialogcontent-props
*/

@@ -202,3 +202,3 @@ export declare type DialogContentProps = {

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialogcontent-children
* @see Docs https://reach.tech/dialog#dialogcontent-children
*/

@@ -213,3 +213,3 @@ children?: React.ReactNode;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog
* @see Docs https://reach.tech/dialog#dialog
*/

@@ -221,3 +221,3 @@ export declare const Dialog: React.ForwardRefExoticComponent<{

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-allowpinchzoom
* @see Docs https://reach.tech/dialog#dialog-allowpinchzoom
*/

@@ -228,3 +228,3 @@ allowPinchZoom?: boolean | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-children
* @see Docs https://reach.tech/dialog#dialog-children
*/

@@ -236,3 +236,3 @@ children?: React.ReactNode;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-initialfocusref
* @see Docs https://reach.tech/dialog#dialog-initialfocusref
*/

@@ -243,3 +243,3 @@ initialFocusRef?: React.RefObject<any> | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-isopen
* @see Docs https://reach.tech/dialog#dialog-isopen
*/

@@ -258,3 +258,3 @@ isOpen?: boolean | undefined;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-ondismiss
* @see Docs https://reach.tech/dialog#dialog-ondismiss
*/

@@ -282,3 +282,3 @@ onDismiss?: ((event?: React.SyntheticEvent<Element, Event> | undefined) => void) | undefined;

/**
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-props
* @see Docs https://reach.tech/dialog#dialog-props
*/

@@ -290,3 +290,3 @@ export declare type DialogProps = {

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-allowpinchzoom
* @see Docs https://reach.tech/dialog#dialog-allowpinchzoom
*/

@@ -297,3 +297,3 @@ allowPinchZoom?: boolean;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-children
* @see Docs https://reach.tech/dialog#dialog-children
*/

@@ -305,3 +305,3 @@ children?: React.ReactNode;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-initialfocusref
* @see Docs https://reach.tech/dialog#dialog-initialfocusref
*/

@@ -312,3 +312,3 @@ initialFocusRef?: React.RefObject<any>;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-isopen
* @see Docs https://reach.tech/dialog#dialog-isopen
*/

@@ -327,3 +327,3 @@ isOpen?: boolean;

*
* @see Docs https://reacttraining.com/reach-ui/dialog#dialog-ondismiss
* @see Docs https://reach.tech/dialog#dialog-ondismiss
*/

@@ -330,0 +330,0 @@ onDismiss?: (event?: React.SyntheticEvent) => void;

{
"name": "@reach/dialog",
"version": "0.10.5",
"version": "0.11.0",
"description": "Accessible React Modal Dialog.",

@@ -13,7 +13,7 @@ "author": "React Training <hello@reacttraining.com>",

"scripts": {
"build": "ts-node ../../scripts/build"
"build": "ts-node --transpile-only ../../scripts/build-package $npm_package_name"
},
"dependencies": {
"@reach/portal": "0.10.5",
"@reach/utils": "0.10.5",
"@reach/portal": "0.11.0",
"@reach/utils": "0.11.0",
"prop-types": "^15.7.2",

@@ -36,3 +36,3 @@ "react-focus-lock": "^2.3.1",

],
"gitHead": "86a046f54d53b6420e392b3fa56dd991d9d4e458"
"gitHead": "7eaa66982cd17fb012c13c97e6a1770f75b6ce00"
}

@@ -5,3 +5,3 @@ # @reach/dialog

[Docs](https://reacttraining.com/reach-ui/dialog) | [Source](https://github.com/reach/reach-ui/tree/main/packages/dialog) | [WAI-ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/#dialog_modal)
[Docs](https://reach.tech/dialog) | [Source](https://github.com/reach/reach-ui/tree/main/packages/dialog) | [WAI-ARIA](https://www.w3.org/TR/wai-aria-practices-1.2/#dialog_modal)

@@ -8,0 +8,0 @@ An accessible dialog or modal window.

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