@reach/alert-dialog
Advanced tools
Comparing version 0.7.4 to 0.8.0
@@ -67,9 +67,11 @@ 'use strict'; | ||
}); | ||
AlertDialogOverlay.displayName = "AlertDialogOverlay"; | ||
{ | ||
AlertDialogOverlay.displayName = "AlertDialogOverlay"; | ||
AlertDialogOverlay.propTypes = { | ||
isOpen: PropTypes.bool, | ||
onDismiss: PropTypes.func, | ||
leastDestructiveRef: function leastDestructiveRef() {}, | ||
leastDestructiveRef: function leastDestructiveRef() { | ||
return null; | ||
}, | ||
children: PropTypes.node | ||
@@ -121,5 +123,5 @@ }; | ||
}); | ||
AlertDialogContent.displayName = "AlertDialogContent"; | ||
{ | ||
AlertDialogContent.displayName = "AlertDialogContent"; | ||
AlertDialogContent.propTypes = { | ||
@@ -152,4 +154,7 @@ children: PropTypes.node | ||
}; | ||
AlertDialogLabel.displayName = "AlertDialogLabel"; //////////////////////////////////////////////////////////////////////////////// | ||
{ | ||
AlertDialogLabel.displayName = "AlertDialogLabel"; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
@@ -166,2 +171,3 @@ * AlertDialogDescription | ||
var AlertDialogDescription = function AlertDialogDescription(props) { | ||
@@ -176,4 +182,7 @@ var _useContext3 = React.useContext(AlertDialogContext), | ||
}; | ||
AlertDialogDescription.displayName = "AlertDialogDescription"; //////////////////////////////////////////////////////////////////////////////// | ||
{ | ||
AlertDialogDescription.displayName = "AlertDialogDescription"; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
@@ -188,2 +197,3 @@ * AlertDialog | ||
var AlertDialog = function AlertDialog(_ref3) { | ||
@@ -203,9 +213,11 @@ var id = _ref3.id, | ||
}; | ||
AlertDialog.displayName = "AlertDialog"; | ||
{ | ||
AlertDialog.displayName = "AlertDialog"; | ||
AlertDialog.propTypes = { | ||
isOpen: PropTypes.bool, | ||
onDismiss: PropTypes.func, | ||
leastDestructiveRef: function leastDestructiveRef() {}, | ||
leastDestructiveRef: function leastDestructiveRef() { | ||
return null; | ||
}, | ||
children: PropTypes.node | ||
@@ -212,0 +224,0 @@ }; |
@@ -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("react"),a=e(t),r=require("@reach/dialog"),i=require("@reach/auto-id"),l=require("@reach/utils"),n=e(require("invariant"));function o(e,t){if(null==e)return{};var a,r,i={},l=Object.keys(e);for(r=0;r<l.length;r++)t.indexOf(a=l[r])>=0||(i[a]=e[a]);return i}require("prop-types");var s=l.createNamedContext("AlertDialogContext",{}),d=t.forwardRef((function(e,t){var n=e.leastDestructiveRef,d=o(e,["leastDestructiveRef"]),c=i.useId(d.id),u=c?l.makeId("alert-dialog",c):void 0,f=c?l.makeId("alert-dialog-description",c):void 0;return a.createElement(s.Provider,{value:{labelId:u,descriptionId:f,leastDestructiveRef:n}},a.createElement(r.DialogOverlay,Object.assign({},d,{ref:t,"data-reach-alert-dialog-overlay":!0,initialFocusRef:n})))}));d.displayName="AlertDialogOverlay";var c=t.forwardRef((function(e,i){var l=e.children,d=o(e,["children"]),c=t.useContext(s),u=c.labelId,f=c.leastDestructiveRef;return t.useEffect((function(){u&&(document.getElementById(u)||n(!1)),f||n(!1)}),[u,f]),a.createElement(r.DialogContent,Object.assign({role:"alertdialog","aria-labelledby":u},d,{ref:i,"data-reach-alert-dialong-content":!0,"data-reach-alert-dialog-content":!0}),l)}));c.displayName="AlertDialogContent";var u=function(e){var r=t.useContext(s);return a.createElement("div",Object.assign({},e,{id:r.labelId,"data-reach-alert-dialog-label":!0}))};u.displayName="AlertDialogLabel";var f=function(e){var r=t.useContext(s);return a.createElement("div",Object.assign({},e,{id:r.descriptionId,"data-reach-alert-dialog-description":!0}))};f.displayName="AlertDialogDescription";var v=function(e){var t=e.id,r=e.isOpen,i=e.onDismiss,l=e.leastDestructiveRef,n=o(e,["id","isOpen","onDismiss","leastDestructiveRef"]);return a.createElement(d,Object.assign({},{isOpen:r,onDismiss:i,leastDestructiveRef:l,id:t}),a.createElement(c,Object.assign({},n)))};v.displayName="AlertDialog",exports.AlertDialog=v,exports.AlertDialogContent=c,exports.AlertDialogDescription=f,exports.AlertDialogLabel=u,exports.AlertDialogOverlay=d; | ||
"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("react"),r=e(t),a=require("@reach/dialog"),i=require("@reach/auto-id"),l=require("@reach/utils"),n=e(require("invariant"));function o(e,t){if(null==e)return{};var r,a,i={},l=Object.keys(e);for(a=0;a<l.length;a++)t.indexOf(r=l[a])>=0||(i[r]=e[r]);return i}require("prop-types");var s=l.createNamedContext("AlertDialogContext",{}),c=t.forwardRef((function(e,t){var n=e.leastDestructiveRef,c=o(e,["leastDestructiveRef"]),d=i.useId(c.id),u=d?l.makeId("alert-dialog",d):void 0,f=d?l.makeId("alert-dialog-description",d):void 0;return r.createElement(s.Provider,{value:{labelId:u,descriptionId:f,leastDestructiveRef:n}},r.createElement(a.DialogOverlay,Object.assign({},c,{ref:t,"data-reach-alert-dialog-overlay":!0,initialFocusRef:n})))})),d=t.forwardRef((function(e,i){var l=e.children,c=o(e,["children"]),d=t.useContext(s),u=d.labelId,f=d.leastDestructiveRef;return t.useEffect((function(){u&&(document.getElementById(u)||n(!1)),f||n(!1)}),[u,f]),r.createElement(a.DialogContent,Object.assign({role:"alertdialog","aria-labelledby":u},c,{ref:i,"data-reach-alert-dialong-content":!0,"data-reach-alert-dialog-content":!0}),l)}));exports.AlertDialog=function(e){var t=e.id,a=e.isOpen,i=e.onDismiss,l=e.leastDestructiveRef,n=o(e,["id","isOpen","onDismiss","leastDestructiveRef"]);return r.createElement(c,Object.assign({},{isOpen:a,onDismiss:i,leastDestructiveRef:l,id:t}),r.createElement(d,Object.assign({},n)))},exports.AlertDialogContent=d,exports.AlertDialogDescription=function(e){var a=t.useContext(s);return r.createElement("div",Object.assign({},e,{id:a.descriptionId,"data-reach-alert-dialog-description":!0}))},exports.AlertDialogLabel=function(e){var a=t.useContext(s);return r.createElement("div",Object.assign({},e,{id:a.labelId,"data-reach-alert-dialog-label":!0}))},exports.AlertDialogOverlay=c; | ||
//# sourceMappingURL=alert-dialog.cjs.production.min.js.map |
@@ -60,9 +60,11 @@ import React, { forwardRef, useContext, useEffect } from 'react'; | ||
}); | ||
AlertDialogOverlay.displayName = "AlertDialogOverlay"; | ||
if (process.env.NODE_ENV !== "production") { | ||
AlertDialogOverlay.displayName = "AlertDialogOverlay"; | ||
AlertDialogOverlay.propTypes = { | ||
isOpen: PropTypes.bool, | ||
onDismiss: PropTypes.func, | ||
leastDestructiveRef: function leastDestructiveRef() {}, | ||
leastDestructiveRef: function leastDestructiveRef() { | ||
return null; | ||
}, | ||
children: PropTypes.node | ||
@@ -114,5 +116,5 @@ }; | ||
}); | ||
AlertDialogContent.displayName = "AlertDialogContent"; | ||
if (process.env.NODE_ENV !== "production") { | ||
AlertDialogContent.displayName = "AlertDialogContent"; | ||
AlertDialogContent.propTypes = { | ||
@@ -145,4 +147,7 @@ children: PropTypes.node | ||
}; | ||
AlertDialogLabel.displayName = "AlertDialogLabel"; //////////////////////////////////////////////////////////////////////////////// | ||
if (process.env.NODE_ENV !== "production") { | ||
AlertDialogLabel.displayName = "AlertDialogLabel"; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
@@ -159,2 +164,3 @@ * AlertDialogDescription | ||
var AlertDialogDescription = function AlertDialogDescription(props) { | ||
@@ -169,4 +175,7 @@ var _useContext3 = useContext(AlertDialogContext), | ||
}; | ||
AlertDialogDescription.displayName = "AlertDialogDescription"; //////////////////////////////////////////////////////////////////////////////// | ||
if (process.env.NODE_ENV !== "production") { | ||
AlertDialogDescription.displayName = "AlertDialogDescription"; | ||
} //////////////////////////////////////////////////////////////////////////////// | ||
/** | ||
@@ -181,2 +190,3 @@ * AlertDialog | ||
var AlertDialog = function AlertDialog(_ref3) { | ||
@@ -196,9 +206,11 @@ var id = _ref3.id, | ||
}; | ||
AlertDialog.displayName = "AlertDialog"; | ||
if (process.env.NODE_ENV !== "production") { | ||
AlertDialog.displayName = "AlertDialog"; | ||
AlertDialog.propTypes = { | ||
isOpen: PropTypes.bool, | ||
onDismiss: PropTypes.func, | ||
leastDestructiveRef: function leastDestructiveRef() {}, | ||
leastDestructiveRef: function leastDestructiveRef() { | ||
return null; | ||
}, | ||
children: PropTypes.node | ||
@@ -205,0 +217,0 @@ }; |
@@ -59,3 +59,3 @@ /** | ||
*/ | ||
onDismiss?: (() => void) | undefined; | ||
onDismiss?: ((event?: React.SyntheticEvent<Element, Event> | undefined) => void) | undefined; | ||
/** | ||
@@ -67,3 +67,3 @@ * To prevent accidental data loss, an alert dialog should focus the least | ||
*/ | ||
leastDestructiveRef: React.RefObject<HTMLElement>; | ||
leastDestructiveRef?: React.RefObject<HTMLElement> | undefined; | ||
/** | ||
@@ -172,3 +172,3 @@ * Accepts any renderable content but should generally be restricted to | ||
*/ | ||
onDismiss?: () => void; | ||
onDismiss?: (event?: React.SyntheticEvent) => void; | ||
/** | ||
@@ -180,3 +180,3 @@ * To prevent accidental data loss, an alert dialog should focus the least | ||
*/ | ||
leastDestructiveRef: React.RefObject<HTMLElement>; | ||
leastDestructiveRef?: React.RefObject<HTMLElement>; | ||
/** | ||
@@ -183,0 +183,0 @@ * Accepts any renderable content but should generally be restricted to |
{ | ||
"name": "@reach/alert-dialog", | ||
"version": "0.7.4", | ||
"version": "0.8.0", | ||
"description": "Accessible React Alert Dialog.", | ||
@@ -18,5 +18,5 @@ "author": "React Training <hello@reacttraining.com>", | ||
"dependencies": { | ||
"@reach/auto-id": "^0.7.4", | ||
"@reach/dialog": "^0.7.4", | ||
"@reach/utils": "^0.7.4", | ||
"@reach/auto-id": "^0.8.0", | ||
"@reach/dialog": "^0.8.0", | ||
"@reach/utils": "^0.8.0", | ||
"invariant": "^2.2.4", | ||
@@ -36,3 +36,3 @@ "prop-types": "^15.7.2" | ||
], | ||
"gitHead": "f460709e283a60dd5ea62952b7feaf88546a50ff" | ||
"gitHead": "7702c46373c7f11adc21184e7def9977203e9326" | ||
} |
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
67068
577
8
+ Added@reach/auto-id@0.8.6(transitive)
+ Added@reach/dialog@0.8.6(transitive)
+ Added@reach/portal@0.8.6(transitive)
+ Added@reach/utils@0.8.6(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedwarning@4.0.3(transitive)
- Removed@reach/auto-id@0.7.4(transitive)
- Removed@reach/dialog@0.7.4(transitive)
- Removed@reach/portal@0.7.4(transitive)
- Removed@reach/utils@0.7.4(transitive)
Updated@reach/auto-id@^0.8.0
Updated@reach/dialog@^0.8.0
Updated@reach/utils@^0.8.0