@reach/alert
Advanced tools
Comparing version 0.8.0 to 0.8.2
@@ -90,6 +90,2 @@ 'use strict'; | ||
function createMirror(type, doc) { | ||
if (doc === void 0) { | ||
doc = document; | ||
} | ||
var key = ++keys[type]; | ||
@@ -157,4 +153,3 @@ | ||
React.useEffect(function () { | ||
var _ref2 = ref.current || {}, | ||
ownerDocument = _ref2.ownerDocument; | ||
var ownerDocument = utils.getOwnerDocument(ref.current) || document; | ||
@@ -161,0 +156,0 @@ if (!mounted.current) { |
@@ -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"),r=e(t),n=require("react-dom"),u=e(require("@reach/visually-hidden")),i=require("@reach/utils");require("prop-types");var c,o={polite:-1,assertive:-1},l={polite:{},assertive:{}},a={polite:null,assertive:null},f=t.forwardRef((function(e,n){var u=e.children,c=e.type,o=void 0===c?"polite":c,l=function(e,t){if(null==e)return{};var r,n,u={},i=Object.keys(e);for(n=0;n<i.length;n++)t.indexOf(r=i[n])>=0||(u[r]=e[r]);return u}(e,["children","type"]),a=t.useRef(null),f=i.useForkedRef(n,a),d=t.useMemo((function(){return r.createElement("div",Object.assign({},l,{ref:f,"data-reach-alert":!0}),u)}),[u,l]);return function(e,r,n){var u=i.usePrevious(e),c=t.useRef(null),o=t.useRef(!1);t.useEffect((function(){var t=(n.current||{}).ownerDocument;o.current?u!==e?(c.current&&c.current.unmount(),c.current=s(e,t),c.current.mount(r)):c.current&&c.current.update(r):(o.current=!0,c.current=s(e,t),c.current.mount(r))}),[r,e,u]),t.useEffect((function(){return function(){c.current&&c.current.unmount()}}),[])}(o,d,a),d}));function s(e,t){void 0===t&&(t=document);var r=++o[e];return{mount:function n(u){if(a[e])l[e][r]=u,d();else{var i=t.createElement("div");i.setAttribute("data-reach-live-"+e,"true"),a[e]=i,t.body.appendChild(a[e]),n(u)}},update:function(t){l[e][r]=t,d()},unmount:function(){delete l[e][r],d()}}}function d(){null!=c&&window.clearTimeout(c),c=window.setTimeout((function(){Object.keys(l).forEach((function(e){var t=e;a[t]&&n.render(r.createElement(u,null,r.createElement("div",{role:"assertive"===t?"alert":"status","aria-live":t},Object.keys(l[t]).map((function(e){return r.cloneElement(l[t][e],{key:e,ref:null})})))),a[t])}))}),500)}exports.Alert=f,exports.default=f; | ||
"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),n=require("react-dom"),u=e(require("@reach/visually-hidden")),c=require("@reach/utils");require("prop-types");var i,o={polite:-1,assertive:-1},l={polite:{},assertive:{}},a={polite:null,assertive:null},f=t.forwardRef((function(e,n){var u=e.children,i=e.type,o=void 0===i?"polite":i,l=function(e,t){if(null==e)return{};var r,n,u={},c=Object.keys(e);for(n=0;n<c.length;n++)t.indexOf(r=c[n])>=0||(u[r]=e[r]);return u}(e,["children","type"]),a=t.useRef(null),f=c.useForkedRef(n,a),d=t.useMemo((function(){return r.createElement("div",Object.assign({},l,{ref:f,"data-reach-alert":!0}),u)}),[u,l]);return function(e,r,n){var u=c.usePrevious(e),i=t.useRef(null),o=t.useRef(!1);t.useEffect((function(){var t=c.getOwnerDocument(n.current)||document;o.current?u!==e?(i.current&&i.current.unmount(),i.current=s(e,t),i.current.mount(r)):i.current&&i.current.update(r):(o.current=!0,i.current=s(e,t),i.current.mount(r))}),[r,e,u]),t.useEffect((function(){return function(){i.current&&i.current.unmount()}}),[])}(o,d,a),d}));function s(e,t){var r=++o[e];return{mount:function n(u){if(a[e])l[e][r]=u,d();else{var c=t.createElement("div");c.setAttribute("data-reach-live-"+e,"true"),a[e]=c,t.body.appendChild(a[e]),n(u)}},update:function(t){l[e][r]=t,d()},unmount:function(){delete l[e][r],d()}}}function d(){null!=i&&window.clearTimeout(i),i=window.setTimeout((function(){Object.keys(l).forEach((function(e){var t=e;a[t]&&n.render(r.createElement(u,null,r.createElement("div",{role:"assertive"===t?"alert":"status","aria-live":t},Object.keys(l[t]).map((function(e){return r.cloneElement(l[t][e],{key:e,ref:null})})))),a[t])}))}),500)}exports.Alert=f,exports.default=f; | ||
//# sourceMappingURL=alert.cjs.production.min.js.map |
import React, { forwardRef, useRef, useMemo, useEffect } from 'react'; | ||
import { render } from 'react-dom'; | ||
import VisuallyHidden from '@reach/visually-hidden'; | ||
import { useForkedRef, usePrevious } from '@reach/utils'; | ||
import { useForkedRef, usePrevious, getOwnerDocument } from '@reach/utils'; | ||
import PropTypes from 'prop-types'; | ||
@@ -83,6 +83,2 @@ | ||
function createMirror(type, doc) { | ||
if (doc === void 0) { | ||
doc = document; | ||
} | ||
var key = ++keys[type]; | ||
@@ -150,4 +146,3 @@ | ||
useEffect(function () { | ||
var _ref2 = ref.current || {}, | ||
ownerDocument = _ref2.ownerDocument; | ||
var ownerDocument = getOwnerDocument(ref.current) || document; | ||
@@ -154,0 +149,0 @@ if (!mounted.current) { |
{ | ||
"name": "@reach/alert", | ||
"version": "0.8.0", | ||
"version": "0.8.2", | ||
"description": "Screen-reader-friendly alert messages.", | ||
@@ -13,3 +13,3 @@ "author": "React Training <hello@reacttraining.com>", | ||
"scripts": { | ||
"build": "yarn clean && cross-env NODE_ENV=production tsdx build --format=cjs,esm --tsconfig tsconfig.build.json", | ||
"build": "yarn clean && yarn compile", | ||
"clean": "rm -rf ./dist", | ||
@@ -19,5 +19,6 @@ "compile": "cross-env NODE_ENV=production tsdx build --format=cjs,esm --tsconfig tsconfig.build.json" | ||
"dependencies": { | ||
"@reach/utils": "^0.8.0", | ||
"@reach/visually-hidden": "^0.8.0", | ||
"prop-types": "^15.7.2" | ||
"@reach/utils": "^0.8.2", | ||
"@reach/visually-hidden": "^0.8.2", | ||
"prop-types": "^15.7.2", | ||
"tslib": "^1.10.0" | ||
}, | ||
@@ -35,3 +36,3 @@ "peerDependencies": { | ||
], | ||
"gitHead": "7702c46373c7f11adc21184e7def9977203e9326" | ||
"gitHead": "ed24a5bb43a87adc36179283ca1de2c5af4ea26e" | ||
} |
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
47269
6
369
+ Addedtslib@^1.10.0
Updated@reach/utils@^0.8.2