Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@reach/alert

Package Overview
Dependencies
Maintainers
4
Versions
56
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@reach/alert - npm Package Compare versions

Comparing version 0.14.0 to 0.15.0

7

dist/declarations/src/index.d.ts

@@ -26,2 +26,3 @@ /**

import * as React from "react";
import type * as Polymorphic from "@reach/utils/polymorphic";
/**

@@ -36,7 +37,7 @@ * Alert

*/
declare const Alert: import("@reach/utils").ForwardRefExoticComponentWithAs<"div", AlertProps>;
declare const Alert: Polymorphic.ForwardRefComponent<"div", AlertProps>;
/**
* @see Docs https://reach.tech/alert#alert-props
*/
declare type AlertProps = {
interface AlertProps {
/**

@@ -50,5 +51,5 @@ * Controls whether the assistive technology should read immediately

children: React.ReactNode;
};
}
export type { AlertProps };
export { Alert };
export default Alert;

@@ -8,3 +8,5 @@ 'use strict';

var visuallyHidden = require('@reach/visually-hidden');
var utils = require('@reach/utils');
var usePrevious = require('@reach/utils/use-previous');
var ownerDocument = require('@reach/utils/owner-document');
var composeRefs = require('@reach/utils/compose-refs');
var PropTypes = require('prop-types');

@@ -53,3 +55,2 @@

*/
var keys = {

@@ -79,3 +80,3 @@ polite: -1,

var Alert = /*#__PURE__*/utils.forwardRefWithAs(function Alert(_ref, forwardedRef) {
var Alert = /*#__PURE__*/React.forwardRef(function Alert(_ref, forwardedRef) {
var _ref$as = _ref.as,

@@ -89,3 +90,3 @@ Comp = _ref$as === void 0 ? "div" : _ref$as,

var ownRef = React.useRef(null);
var ref = utils.useForkedRef(forwardedRef, ownRef);
var ref = composeRefs.useComposedRefs(forwardedRef, ownRef);
var child = React.useMemo(function () {

@@ -182,15 +183,15 @@ return /*#__PURE__*/React.createElement(Comp, _extends({}, props, {

function useMirrorEffects(regionType, element, ref) {
var prevType = utils.usePrevious(regionType);
var prevType = usePrevious.usePrevious(regionType);
var mirror = React.useRef(null);
var mounted = React.useRef(false);
React.useEffect(function () {
var ownerDocument = utils.getOwnerDocument(ref.current);
var ownerDocument$1 = ownerDocument.getOwnerDocument(ref.current);
if (!mounted.current) {
mounted.current = true;
mirror.current = createMirror(regionType, ownerDocument);
mirror.current = createMirror(regionType, ownerDocument$1);
mirror.current.mount(element);
} else if (prevType !== regionType) {
mirror.current && mirror.current.unmount();
mirror.current = createMirror(regionType, ownerDocument);
mirror.current = createMirror(regionType, ownerDocument$1);
mirror.current.mount(element);

@@ -197,0 +198,0 @@ } else {

@@ -8,3 +8,5 @@ 'use strict';

var visuallyHidden = require('@reach/visually-hidden');
var utils = require('@reach/utils');
var usePrevious = require('@reach/utils/use-previous');
var ownerDocument = require('@reach/utils/owner-document');
var composeRefs = require('@reach/utils/compose-refs');
require('prop-types');

@@ -49,3 +51,2 @@

*/
var keys = {

@@ -75,3 +76,3 @@ polite: -1,

var Alert = /*#__PURE__*/utils.forwardRefWithAs(function Alert(_ref, forwardedRef) {
var Alert = /*#__PURE__*/React.forwardRef(function Alert(_ref, forwardedRef) {
var _ref$as = _ref.as,

@@ -85,3 +86,3 @@ Comp = _ref$as === void 0 ? "div" : _ref$as,

var ownRef = React.useRef(null);
var ref = utils.useForkedRef(forwardedRef, ownRef);
var ref = composeRefs.useComposedRefs(forwardedRef, ownRef);
var child = React.useMemo(function () {

@@ -167,15 +168,15 @@ return /*#__PURE__*/React.createElement(Comp, _extends({}, props, {

function useMirrorEffects(regionType, element, ref) {
var prevType = utils.usePrevious(regionType);
var prevType = usePrevious.usePrevious(regionType);
var mirror = React.useRef(null);
var mounted = React.useRef(false);
React.useEffect(function () {
var ownerDocument = utils.getOwnerDocument(ref.current);
var ownerDocument$1 = ownerDocument.getOwnerDocument(ref.current);
if (!mounted.current) {
mounted.current = true;
mirror.current = createMirror(regionType, ownerDocument);
mirror.current = createMirror(regionType, ownerDocument$1);
mirror.current.mount(element);
} else if (prevType !== regionType) {
mirror.current && mirror.current.unmount();
mirror.current = createMirror(regionType, ownerDocument);
mirror.current = createMirror(regionType, ownerDocument$1);
mirror.current.mount(element);

@@ -182,0 +183,0 @@ } else {

@@ -1,5 +0,7 @@

import { useRef, useMemo, createElement, useEffect, cloneElement } from 'react';
import { forwardRef, useRef, useMemo, createElement, useEffect, cloneElement } from 'react';
import { render } from 'react-dom';
import { VisuallyHidden } from '@reach/visually-hidden';
import { forwardRefWithAs, useForkedRef, usePrevious, getOwnerDocument } from '@reach/utils';
import { usePrevious } from '@reach/utils/use-previous';
import { getOwnerDocument } from '@reach/utils/owner-document';
import { useComposedRefs } from '@reach/utils/compose-refs';
import PropTypes from 'prop-types';

@@ -44,3 +46,2 @@

*/
var keys = {

@@ -70,3 +71,3 @@ polite: -1,

var Alert = /*#__PURE__*/forwardRefWithAs(function Alert(_ref, forwardedRef) {
var Alert = /*#__PURE__*/forwardRef(function Alert(_ref, forwardedRef) {
var _ref$as = _ref.as,

@@ -80,3 +81,3 @@ Comp = _ref$as === void 0 ? "div" : _ref$as,

var ownRef = useRef(null);
var ref = useForkedRef(forwardedRef, ownRef);
var ref = useComposedRefs(forwardedRef, ownRef);
var child = useMemo(function () {

@@ -83,0 +84,0 @@ return /*#__PURE__*/createElement(Comp, _extends({}, props, {

{
"name": "@reach/alert",
"version": "0.14.0",
"version": "0.15.0",
"description": "Screen-reader-friendly alert messages.",
"author": "React Training <hello@reacttraining.com>",
"license": "MIT",
"sideEffects": false,
"sideEffects": [
"*.css"
],
"repository": {

@@ -14,4 +16,4 @@ "type": "git",

"dependencies": {
"@reach/utils": "0.14.0",
"@reach/visually-hidden": "0.14.0",
"@reach/utils": "0.15.0",
"@reach/visually-hidden": "0.15.0",
"prop-types": "^15.7.2",

@@ -21,4 +23,4 @@ "tslib": "^2.1.0"

"devDependencies": {
"react": "^17.0.1",
"react-dom": "^17.0.1"
"react": "^17.0.2",
"react-dom": "^17.0.2"
},

@@ -40,3 +42,3 @@ "peerDependencies": {

],
"gitHead": "80f6ca5f8d25a10887e2bd34d60094402b9bc0a7"
"gitHead": "1449650359c119c1afe25973aa7584e09e2c88bc"
}
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