@reach/alert-dialog
Advanced tools
Comparing version 0.7.2 to 0.7.3
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } | ||
var tslib = require('tslib'); | ||
var React = require('react'); | ||
var React__default = _interopDefault(React); | ||
var React = _interopDefault(require('react')); | ||
var dialog = require('@reach/dialog'); | ||
@@ -49,3 +46,3 @@ var autoId = require('@reach/auto-id'); | ||
/*#__PURE__*/ | ||
React.createContext({}); //////////////////////////////////////////////////////////////////////////////// | ||
utils.createNamedContext("AlertDialogContext", {}); //////////////////////////////////////////////////////////////////////////////// | ||
@@ -66,3 +63,3 @@ /** | ||
/*#__PURE__*/ | ||
React__default.forwardRef(function AlertDialogOverlay(_a, forwardRef) { | ||
React.forwardRef(function AlertDialogOverlay(_a, forwardRef) { | ||
var leastDestructiveRef = _a.leastDestructiveRef, | ||
@@ -74,3 +71,3 @@ props = tslib.__rest(_a, ["leastDestructiveRef"]); | ||
var descriptionId = id ? utils.makeId("alert-dialog-description", id) : undefined; | ||
return React__default.createElement(AlertDialogContext.Provider, { | ||
return React.createElement(AlertDialogContext.Provider, { | ||
value: { | ||
@@ -81,3 +78,3 @@ labelId: labelId, | ||
} | ||
}, React__default.createElement(dialog.DialogOverlay, tslib.__assign({ | ||
}, React.createElement(dialog.DialogOverlay, tslib.__assign({ | ||
ref: forwardRef, | ||
@@ -117,11 +114,11 @@ "data-reach-alert-dialog-overlay": true, | ||
/*#__PURE__*/ | ||
React__default.forwardRef(function AlertDialogContent(_a, forwardRef) { | ||
React.forwardRef(function AlertDialogContent(_a, forwardRef) { | ||
var children = _a.children, | ||
props = tslib.__rest(_a, ["children"]); | ||
var _b = React__default.useContext(AlertDialogContext), | ||
var _b = React.useContext(AlertDialogContext), | ||
labelId = _b.labelId, | ||
leastDestructiveRef = _b.leastDestructiveRef; | ||
React__default.useEffect(function () { | ||
React.useEffect(function () { | ||
if (labelId) { | ||
@@ -133,3 +130,3 @@ !document.getElementById(labelId) ? invariant(false, "@reach/alert-dialog: You must render a `<AlertDialogLabel>`\n inside an `<AlertDialog/>`.") : void 0; | ||
}, [labelId, leastDestructiveRef]); | ||
return React__default.createElement(dialog.DialogContent, tslib.__assign({ | ||
return React.createElement(dialog.DialogContent, tslib.__assign({ | ||
ref: forwardRef, | ||
@@ -164,4 +161,4 @@ "data-reach-alert-dialong-content": true, | ||
var AlertDialogLabel = function AlertDialogLabel(props) { | ||
var labelId = React__default.useContext(AlertDialogContext).labelId; | ||
return React__default.createElement("div", tslib.__assign({ | ||
var labelId = React.useContext(AlertDialogContext).labelId; | ||
return React.createElement("div", tslib.__assign({ | ||
id: labelId, | ||
@@ -185,4 +182,4 @@ "data-reach-alert-dialog-label": true | ||
var AlertDialogDescription = function AlertDialogDescription(props) { | ||
var descriptionId = React__default.useContext(AlertDialogContext).descriptionId; | ||
return React__default.createElement("div", tslib.__assign({ | ||
var descriptionId = React.useContext(AlertDialogContext).descriptionId; | ||
return React.createElement("div", tslib.__assign({ | ||
id: descriptionId, | ||
@@ -210,3 +207,3 @@ "data-reach-alert-dialog-description": true | ||
return React__default.createElement(AlertDialogOverlay, tslib.__assign({}, { | ||
return React.createElement(AlertDialogOverlay, tslib.__assign({}, { | ||
isOpen: isOpen, | ||
@@ -216,3 +213,3 @@ onDismiss: onDismiss, | ||
id: id | ||
}), React__default.createElement(AlertDialogContent, tslib.__assign({}, props))); | ||
}), React.createElement(AlertDialogContent, tslib.__assign({}, props))); | ||
}; | ||
@@ -219,0 +216,0 @@ AlertDialog.displayName = "AlertDialog"; |
@@ -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 t=require("tslib"),a=require("react"),r=e(a),i=require("@reach/dialog"),l=require("@reach/auto-id"),s=require("@reach/utils"),n=e(require("invariant"));require("prop-types");var o=a.createContext({}),d=r.forwardRef((function(e,a){var n=e.leastDestructiveRef,d=t.__rest(e,["leastDestructiveRef"]),c=l.useId(d.id),u=c?s.makeId("alert-dialog",c):void 0,v=c?s.makeId("alert-dialog-description",c):void 0;return r.createElement(o.Provider,{value:{labelId:u,descriptionId:v,leastDestructiveRef:n}},r.createElement(i.DialogOverlay,t.__assign({ref:a,"data-reach-alert-dialog-overlay":!0,initialFocusRef:n},d)))}));d.displayName="AlertDialogOverlay";var c=r.forwardRef((function(e,a){var l=e.children,s=t.__rest(e,["children"]),d=r.useContext(o),c=d.labelId,u=d.leastDestructiveRef;return r.useEffect((function(){c&&(document.getElementById(c)||n(!1)),u||n(!1)}),[c,u]),r.createElement(i.DialogContent,t.__assign({ref:a,"data-reach-alert-dialong-content":!0,"data-reach-alert-dialog-content":!0,role:"alertdialog","aria-labelledby":c},s),l)}));c.displayName="AlertDialogContent";var u=function(e){var a=r.useContext(o).labelId;return r.createElement("div",t.__assign({id:a,"data-reach-alert-dialog-label":!0},e))};u.displayName="AlertDialogLabel";var v=function(e){var a=r.useContext(o).descriptionId;return r.createElement("div",t.__assign({id:a,"data-reach-alert-dialog-description":!0},e))};v.displayName="AlertDialogDescription";var g=function(e){var a=e.id,i=e.isOpen,l=e.onDismiss,s=e.leastDestructiveRef,n=t.__rest(e,["id","isOpen","onDismiss","leastDestructiveRef"]);return r.createElement(d,t.__assign({},{isOpen:i,onDismiss:l,leastDestructiveRef:s,id:a}),r.createElement(c,t.__assign({},n)))};g.displayName="AlertDialog",exports.AlertDialog=g,exports.AlertDialogContent=c,exports.AlertDialogDescription=v,exports.AlertDialogLabel=u,exports.AlertDialogOverlay=d; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}var t=require("tslib"),a=e(require("react")),r=require("@reach/dialog"),i=require("@reach/auto-id"),l=require("@reach/utils"),n=e(require("invariant"));require("prop-types");var s=l.createNamedContext("AlertDialogContext",{}),o=a.forwardRef((function(e,n){var o=e.leastDestructiveRef,d=t.__rest(e,["leastDestructiveRef"]),c=i.useId(d.id),u=c?l.makeId("alert-dialog",c):void 0,g=c?l.makeId("alert-dialog-description",c):void 0;return a.createElement(s.Provider,{value:{labelId:u,descriptionId:g,leastDestructiveRef:o}},a.createElement(r.DialogOverlay,t.__assign({ref:n,"data-reach-alert-dialog-overlay":!0,initialFocusRef:o},d)))}));o.displayName="AlertDialogOverlay";var d=a.forwardRef((function(e,i){var l=e.children,o=t.__rest(e,["children"]),d=a.useContext(s),c=d.labelId,u=d.leastDestructiveRef;return a.useEffect((function(){c&&(document.getElementById(c)||n(!1)),u||n(!1)}),[c,u]),a.createElement(r.DialogContent,t.__assign({ref:i,"data-reach-alert-dialong-content":!0,"data-reach-alert-dialog-content":!0,role:"alertdialog","aria-labelledby":c},o),l)}));d.displayName="AlertDialogContent";var c=function(e){var r=a.useContext(s).labelId;return a.createElement("div",t.__assign({id:r,"data-reach-alert-dialog-label":!0},e))};c.displayName="AlertDialogLabel";var u=function(e){var r=a.useContext(s).descriptionId;return a.createElement("div",t.__assign({id:r,"data-reach-alert-dialog-description":!0},e))};u.displayName="AlertDialogDescription";var g=function(e){var r=e.id,i=e.isOpen,l=e.onDismiss,n=e.leastDestructiveRef,s=t.__rest(e,["id","isOpen","onDismiss","leastDestructiveRef"]);return a.createElement(o,t.__assign({},{isOpen:i,onDismiss:l,leastDestructiveRef:n,id:r}),a.createElement(d,t.__assign({},s)))};g.displayName="AlertDialog",exports.AlertDialog=g,exports.AlertDialogContent=d,exports.AlertDialogDescription=u,exports.AlertDialogLabel=c,exports.AlertDialogOverlay=o; | ||
//# sourceMappingURL=alert-dialog.cjs.production.min.js.map |
import { __rest, __assign } from 'tslib'; | ||
import React, { createContext } from 'react'; | ||
import React from 'react'; | ||
import { DialogOverlay, DialogContent } from '@reach/dialog'; | ||
import { useId } from '@reach/auto-id'; | ||
import { makeId } from '@reach/utils'; | ||
import { makeId, createNamedContext } from '@reach/utils'; | ||
import invariant from 'invariant'; | ||
@@ -42,3 +42,3 @@ import PropTypes from 'prop-types'; | ||
/*#__PURE__*/ | ||
createContext({}); //////////////////////////////////////////////////////////////////////////////// | ||
createNamedContext("AlertDialogContext", {}); //////////////////////////////////////////////////////////////////////////////// | ||
@@ -45,0 +45,0 @@ /** |
{ | ||
"name": "@reach/alert-dialog", | ||
"version": "0.7.2", | ||
"version": "0.7.3", | ||
"description": "Accessible React Alert Dialog.", | ||
@@ -18,5 +18,5 @@ "author": "React Training <hello@reacttraining.com>", | ||
"dependencies": { | ||
"@reach/auto-id": "^0.7.2", | ||
"@reach/dialog": "^0.7.2", | ||
"@reach/utils": "^0.7.2", | ||
"@reach/auto-id": "^0.7.3", | ||
"@reach/dialog": "^0.7.3", | ||
"@reach/utils": "^0.7.3", | ||
"invariant": "^2.2.4", | ||
@@ -33,5 +33,6 @@ "prop-types": "^15.7.2" | ||
"files": [ | ||
"README.md", | ||
"dist" | ||
], | ||
"gitHead": "96cf6c191cca0f2cbcb7ff578f15e289efeda1e2" | ||
"gitHead": "fe739beb1d94cc58c4e72f88ab58efa58e0de8c8" | ||
} |
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
69082
11
0
50
602
Updated@reach/auto-id@^0.7.3
Updated@reach/dialog@^0.7.3
Updated@reach/utils@^0.7.3