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

@interop-ui/react-announce

Package Overview
Dependencies
Maintainers
4
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@interop-ui/react-announce - npm Package Compare versions

Comparing version 0.0.1-12 to 0.0.1-13

7

dist/index.d.ts

@@ -5,4 +5,2 @@ import * as React from "react";

type AriaRelevantOptions = 'additions' | 'removals' | 'text';
declare const DEFAULT_TAG = "div";
type AnnounceDOMProps = React.ComponentPropsWithoutRef<typeof DEFAULT_TAG>;
type AnnounceOwnProps = {

@@ -66,7 +64,4 @@ /**

};
export type AnnounceProps = AnnounceDOMProps & AnnounceOwnProps;
export const Announce: import("@interop-ui/react-utils").ForwardRefExoticComponentWithAs<"div", AnnounceProps> & {
displayName: string;
};
export const Announce: import("@interop-ui/react-polymorphic").ForwardRefExoticComponentWithAs<"div", AnnounceOwnProps>;
//# sourceMappingURL=index.d.ts.map

2

dist/index.js

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

var e,t,r,n=require("@interop-ui/react-utils"),i=n.forwardRef,a=n.useComposedRefs,o=n.useLayoutEffect,u=require("@interop-ui/utils"),l=u.getPartDataAttr,c=u.getPartDataAttrObj,f=(e=require("react-dom"))&&e.__esModule?e.default:e,s=(t={},r=require("react"),Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})})),t);function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,i=!1,a=void 0;try{for(var o,u=e[Symbol.iterator]();!(n=(o=u.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){i=!0,a=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return y(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return y(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var b={polite:"status",assertive:"alert",off:"none"},m=new Map,g=i((function(e,t){var r=e.as,n=void 0===r?"div":r,i=e["aria-relevant"],u=e.children,l=e.type,y=void 0===l?"polite":l,g=e.role,A=void 0===g?b[y]:g,O=e.regionIdentifier,j=p(e,["as","aria-relevant","children","type","role","regionIdentifier"]),w=["true",!0].includes(j["aria-atomic"]),E=s.useRef(document),S=s.useCallback((function(e){e&&(E.current=e.ownerDocument)}),[]),x=s.useRef(null),P=a(t,x,S),I=d(s.useState(),2),q=I[0],C=I[1],R=i?Array.isArray(i)?i.join(" "):i:void 0,k=s.useCallback((function(){var e=E.current,t={type:y,role:A,relevant:R,id:O,atomic:w},r=function(e){var t=e.type,r=e.relevant,n=e.role,i=e.atomic,a=e.id;return"[".concat(h(a),"]").concat([["aria-live",t],["aria-atomic",i],["aria-relevant",r],["role",n]].filter((function(e){return!!d(e,2)[1]})).map((function(e){var t=d(e,2),r=t[0],n=t[1];return"[".concat(r,"=").concat(n,"]")})).join(""))}(t);return e.querySelector(r)||function(e,t){var r=t.type,n=t.relevant,i=t.role,a=t.atomic,o=t.id,u=e.createElement("div");u.setAttribute(h(o),""),u.setAttribute("style","position: absolute; top: -1px; width: 1px; height: 1px; overflow: hidden;"),e.body.appendChild(u),u.setAttribute("aria-live",r),u.setAttribute("aria-atomic",String(a||!1)),u.setAttribute("role",i),n&&u.setAttribute("aria-relevant",n);return u}(e,t)}),[w,R,A,y,O]);return o((function(){C(k())}),[k]),s.useEffect((function(){var e=E.current;function t(){r.setAttribute("role",e.hidden?"none":A),r.setAttribute("aria-live",e.hidden?"off":y)}var r=k();if(m.get(r)){var n=m.get(r);m.set(r,n+1)}else e.addEventListener("visibilitychange",t),m.set(r,1);return function(){var n=m.get(r);m.set(r,n-1),1===n&&e.removeEventListener("visibilitychange",t)}}),[k,A,y]),s.createElement(s.Fragment,null,s.createElement(n,v({},j,c("Announce"),{ref:P}),u),q&&f.createPortal(s.createElement("div",null,u),q))}));function h(e){return l("AnnounceRegion")+(e?"-".concat(e):"")}exports.Announce=g,g.displayName="Announce";
var e,t,r,n=require("@interop-ui/react-polymorphic").forwardRefWithAs,i=require("@interop-ui/react-utils"),o=i.useComposedRefs,a=i.useLayoutEffect,u=require("@interop-ui/utils"),l=u.getPartDataAttr,c=u.getPartDataAttrObj,f=(e=require("react-dom"))&&e.__esModule?e.default:e,s=(t={},r=require("react"),Object.keys(r).forEach((function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})})),t);function v(){return(v=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var r=[],n=!0,i=!1,o=void 0;try{for(var a,u=e[Symbol.iterator]();!(n=(a=u.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==u.return||u.return()}finally{if(i)throw o}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return p(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return p(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function y(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var b={polite:"status",assertive:"alert",off:"none"},m=new Map,h=n((function(e,t){var r=e.as,n=void 0===r?"div":r,i=e["aria-relevant"],u=e.children,l=e.type,p=void 0===l?"polite":l,h=e.role,A=void 0===h?b[p]:h,O=e.regionIdentifier,j=y(e,["as","aria-relevant","children","type","role","regionIdentifier"]),w=["true",!0].includes(j["aria-atomic"]),E=s.useRef(document),S=s.useCallback((function(e){e&&(E.current=e.ownerDocument)}),[]),x=s.useRef(null),P=o(t,x,S),q=d(s.useState(),2),I=q[0],C=q[1],R=i?Array.isArray(i)?i.join(" "):i:void 0,k=s.useCallback((function(){var e=E.current,t={type:p,role:A,relevant:R,id:O,atomic:w},r=function(e){var t=e.type,r=e.relevant,n=e.role,i=e.atomic,o=e.id;return"[".concat(g(o),"]").concat([["aria-live",t],["aria-atomic",i],["aria-relevant",r],["role",n]].filter((function(e){return!!d(e,2)[1]})).map((function(e){var t=d(e,2),r=t[0],n=t[1];return"[".concat(r,"=").concat(n,"]")})).join(""))}(t);return e.querySelector(r)||function(e,t){var r=t.type,n=t.relevant,i=t.role,o=t.atomic,a=t.id,u=e.createElement("div");u.setAttribute(g(a),""),u.setAttribute("style","position: absolute; top: -1px; width: 1px; height: 1px; overflow: hidden;"),e.body.appendChild(u),u.setAttribute("aria-live",r),u.setAttribute("aria-atomic",String(o||!1)),u.setAttribute("role",i),n&&u.setAttribute("aria-relevant",n);return u}(e,t)}),[w,R,A,p,O]);return a((function(){C(k())}),[k]),s.useEffect((function(){var e=E.current;function t(){r.setAttribute("role",e.hidden?"none":A),r.setAttribute("aria-live",e.hidden?"off":p)}var r=k();if(m.get(r)){var n=m.get(r);m.set(r,n+1)}else e.addEventListener("visibilitychange",t),m.set(r,1);return function(){var n=m.get(r);m.set(r,n-1),1===n&&e.removeEventListener("visibilitychange",t)}}),[k,A,p]),s.createElement(s.Fragment,null,s.createElement(n,v({},j,c("Announce"),{ref:P}),u),I&&f.createPortal(s.createElement("div",null,u),I))}));function g(e){return l("AnnounceRegion")+(e?"-".concat(e):"")}exports.Announce=h,h.displayName="Announce";
//# sourceMappingURL=index.js.map

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

import{forwardRef as e,useComposedRefs as t,useLayoutEffect as r}from"@interop-ui/react-utils";import{getPartDataAttr as n,getPartDataAttrObj as i}from"@interop-ui/utils";import o from"react-dom";import*as a from"react";function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const u={polite:"status",assertive:"alert",off:"none"},s=new Map,f="div";export const Announce=e((function(e,n){const{as:d=f,"aria-relevant":m,children:v,type:b="polite",role:y=u[b],regionIdentifier:g}=e,h=l(e,["as","aria-relevant","children","type","role","regionIdentifier"]),A=["true",!0].includes(h["aria-atomic"]),O=a.useRef(document),j=a.useCallback((e=>{e&&(O.current=e.ownerDocument)}),[]),E=a.useRef(null),w=t(n,E,j),[x,S]=a.useState(),P=m?Array.isArray(m)?m.join(" "):m:void 0,k=a.useCallback((()=>{const e=O.current,t={type:b,role:y,relevant:P,id:g,atomic:A},r=function({type:e,relevant:t,role:r,atomic:n,id:i}){return"[".concat(p(i),"]").concat([["aria-live",e],["aria-atomic",n],["aria-relevant",t],["role",r]].filter((([,e])=>!!e)).map((([e,t])=>"[".concat(e,"=").concat(t,"]"))).join(""))}(t);return e.querySelector(r)||function(e,{type:t,relevant:r,role:n,atomic:i,id:o}){const a=e.createElement("div");a.setAttribute(p(o),""),a.setAttribute("style","position: absolute; top: -1px; width: 1px; height: 1px; overflow: hidden;"),e.body.appendChild(a),a.setAttribute("aria-live",t),a.setAttribute("aria-atomic",String(i||!1)),a.setAttribute("role",n),r&&a.setAttribute("aria-relevant",r);return a}(e,t)}),[A,P,y,b,g]);return r((()=>{S(k())}),[k]),a.useEffect((()=>{const e=O.current;function t(){r.setAttribute("role",e.hidden?"none":y),r.setAttribute("aria-live",e.hidden?"off":b)}const r=k();if(s.get(r)){const e=s.get(r);s.set(r,e+1)}else e.addEventListener("visibilitychange",t),s.set(r,1);return function(){const n=s.get(r);s.set(r,n-1),1===n&&e.removeEventListener("visibilitychange",t)}}),[k,y,b]),a.createElement(a.Fragment,null,a.createElement(d,c({},h,i("Announce"),{ref:w}),v),x&&o.createPortal(a.createElement("div",null,v),x))}));function p(e){return n("AnnounceRegion")+(e?"-".concat(e):"")}Announce.displayName="Announce";
import{forwardRefWithAs as e}from"@interop-ui/react-polymorphic";import{useComposedRefs as t,useLayoutEffect as r}from"@interop-ui/react-utils";import{getPartDataAttr as n,getPartDataAttrObj as i}from"@interop-ui/utils";import o from"react-dom";import*as a from"react";function c(){return(c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}const u={polite:"status",assertive:"alert",off:"none"},s=new Map,p="div";export const Announce=e(((e,n)=>{const{as:m=p,"aria-relevant":d,children:v,type:y="polite",role:b=u[y],regionIdentifier:g}=e,h=l(e,["as","aria-relevant","children","type","role","regionIdentifier"]),A=["true",!0].includes(h["aria-atomic"]),O=a.useRef(document),j=a.useCallback((e=>{e&&(O.current=e.ownerDocument)}),[]),E=a.useRef(null),w=t(n,E,j),[x,S]=a.useState(),P=d?Array.isArray(d)?d.join(" "):d:void 0,k=a.useCallback((()=>{const e=O.current,t={type:y,role:b,relevant:P,id:g,atomic:A},r=function({type:e,relevant:t,role:r,atomic:n,id:i}){return"[".concat(f(i),"]").concat([["aria-live",e],["aria-atomic",n],["aria-relevant",t],["role",r]].filter((([,e])=>!!e)).map((([e,t])=>"[".concat(e,"=").concat(t,"]"))).join(""))}(t);return e.querySelector(r)||function(e,{type:t,relevant:r,role:n,atomic:i,id:o}){const a=e.createElement("div");a.setAttribute(f(o),""),a.setAttribute("style","position: absolute; top: -1px; width: 1px; height: 1px; overflow: hidden;"),e.body.appendChild(a),a.setAttribute("aria-live",t),a.setAttribute("aria-atomic",String(i||!1)),a.setAttribute("role",n),r&&a.setAttribute("aria-relevant",r);return a}(e,t)}),[A,P,b,y,g]);return r((()=>{S(k())}),[k]),a.useEffect((()=>{const e=O.current;function t(){r.setAttribute("role",e.hidden?"none":b),r.setAttribute("aria-live",e.hidden?"off":y)}const r=k();if(s.get(r)){const e=s.get(r);s.set(r,e+1)}else e.addEventListener("visibilitychange",t),s.set(r,1);return function(){const n=s.get(r);s.set(r,n-1),1===n&&e.removeEventListener("visibilitychange",t)}}),[k,b,y]),a.createElement(a.Fragment,null,a.createElement(m,c({},h,i("Announce"),{ref:w}),v),x&&o.createPortal(a.createElement("div",null,v),x))}));function f(e){return n("AnnounceRegion")+(e?"-".concat(e):"")}Announce.displayName="Announce";
//# sourceMappingURL=index.module.js.map
{
"name": "@interop-ui/react-announce",
"version": "0.0.1-12",
"version": "0.0.1-13",
"license": "MIT",

@@ -20,4 +20,5 @@ "source": "src/index.ts",

"dependencies": {
"@interop-ui/react-utils": "0.0.1-12",
"@interop-ui/utils": "0.0.1-4"
"@interop-ui/react-polymorphic": "0.0.1-0",
"@interop-ui/react-utils": "0.0.1-13",
"@interop-ui/utils": "0.0.1-5"
},

@@ -24,0 +25,0 @@ "devDependencies": {

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