@interop-ui/react-alert-dialog
Advanced tools
Comparing version 0.0.1-10 to 0.0.1-11
@@ -63,4 +63,3 @@ import * as React from "react"; | ||
}; | ||
export const styles: import("@interop-ui/react-utils").PrimitiveStyles<"title" | "root" | "trigger" | "overlay" | "content" | "cancel" | "action" | "description">; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
var e,t,r=require("@interop-ui/react-utils"),n=r.createContext,o=r.createStyleObj,a=r.forwardRef,i=r.useComposedRefs,l=r.useId,c=r.useDocumentRef,s=r.composeEventHandlers,u=require("@interop-ui/utils"),d=u.cssReset,p=u.makeId,f=(u.warning,require("@interop-ui/react-dialog")),b=f.Dialog,y=f.styles,g=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e);function v(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function O(){return(O=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){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(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)&&(o[r]=e[r])}return o}function A(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,o=!1,a=void 0;try{for(var i,l=e[Symbol.iterator]();!(n=(i=l.next()).done)&&(r.push(i.value),!t||r.length!==t);n=!0);}catch(e){o=!0,a=e}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return j(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 j(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 j(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}var C=A(n("AlertDialogContext","AlertDialog"),2),w=C[0],E=C[1],I=A(n("AlertDialogContext","AlertDialog"),2),P=I[0],S=I[1],T=function(e){var t=e.children,r=e.id,n=D(e,["children","id"]),o=p("alert-dialog",l()),a=r||o,i=p(a,"description"),c=p(a,"title");return g.createElement(b,n,g.createElement(w.Provider,{value:g.useMemo((function(){return{descriptionId:i,titleId:c}}),[i,c])},t))};exports.AlertDialog=T;var x=a((function(e,t){var r=e.as,n=void 0===r?"button":r,o=D(e,["as"]);return g.createElement(b.Trigger,O({},Y("trigger"),{as:n,ref:t},o))})),N=a((function(e,t){var r=e.as,n=void 0===r?"div":r,o=D(e,["as"]);return g.createElement(b.Overlay,O({},Y("overlay"),{as:n,ref:t},o))})),R=a((function(e,t){var r=e.as,n=void 0===r?"button":r,o=D(e,["as"]),a=S("AlertDialog.Cancel").cancelRef,l=i(t,a);return g.createElement(b.Close,O({},Y("cancel"),{as:n,ref:l},o))})),q=a((function(e,t){var r=e.as,n=void 0===r?"button":r,o=D(e,["as"]);return g.createElement(b.Close,O({},Y("action"),{as:n,ref:t},o))})),k=a((function(e,t){var r=e.as,n=void 0===r?"div":r,o=e["aria-label"],a=e["aria-labelledby"],l=e["aria-describedby"],u=e.children,d=D(e,["as","aria-label","aria-labelledby","aria-describedby","children"]),p=E("AlertDialogContent"),f=p.descriptionId,y=p.titleId,v=g.useRef(null),m=g.useRef(null),h=c(m),A=i(t,m);return g.createElement(b.Content,O({},Y("content"),{as:n,ref:A,role:"alertdialog","aria-describedby":l||f,"aria-labelledby":o?void 0:a||y,"aria-label":o||void 0},d,{onOpenAutoFocus:s(d.onOpenAutoFocus,(function(e){var t;e.preventDefault(),null===(t=v.current)||void 0===t||t.focus({preventScroll:!0})}))}),g.createElement(P.Provider,{value:g.useMemo((function(){return{cancelRef:v,ownerDocumentRef:h}}),[v,h])},!1,u))})),F=a((function(e,t){var r=e.as,n=void 0===r?"h2":r,o=D(e,["as"]),a=E("AlertDialogTitle").titleId;return g.createElement(n,O({},Y("title"),{ref:t,id:a},o))})),M=a((function(e,t){var r=e.as,n=void 0===r?"p":r,o=D(e,["as"]),a=E("AlertDialogDescription").descriptionId;return g.createElement(n,O({},Y("description"),{ref:t,id:a},o))}));T.Cancel=R,T.Action=q,T.Content=k,T.Description=M,T.Overlay=N,T.Title=F,T.Trigger=x,T.Title.displayName="AlertDialog.Title",T.Cancel.displayName="AlertDialog.Cancel",T.Action.displayName="AlertDialog.Action",T.Content.displayName="AlertDialog.Content",T.Description.displayName="AlertDialog.Description",T.Overlay.displayName="AlertDialog.Overlay",T.Trigger.displayName="AlertDialog.Trigger",T.displayName="AlertDialog";var K=A(o("AlertDialog",{root:y.root,overlay:m(m({},d("div")),y.overlay),trigger:m(m({},d("button")),y.trigger),cancel:m(m({},d("button")),y.close),action:m(m({},d("button")),y.close),content:m(m({},d("div")),y.content),title:m({},d("h2")),description:m({},d("p"))}),2),L=K[0],Y=K[1];exports.styles=L;"".concat("AlertDialog.Content"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Title"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialog.Content",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialog.Content"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Description"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an `id` and passing the same value to the `aria-describedby` prop in ").concat("AlertDialog.Content",". If the description is confusing or duplicative for sighted users, you can use the `interop-ui/react-visually-hidden` component as a wrapper around your description component.\n\nFor more information, see https://LINK-TO-DOCS.com"); | ||
var e,t,r=require("@interop-ui/react-utils"),n=r.createContext,a=r.forwardRef,i=r.useComposedRefs,o=r.useId,l=r.useDocumentRef,c=r.composeEventHandlers,s=require("@interop-ui/utils"),u=s.getPartDataAttrObj,d=s.makeId,f=(s.warning,require("@interop-ui/react-dialog").Dialog),p=(e={},t=require("react"),Object.keys(t).forEach((function(r){"default"!==r&&"__esModule"!==r&&Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})})),e);function g(){return(g=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 y(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function b(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,a=!1,i=void 0;try{for(var o,l=e[Symbol.iterator]();!(n=(o=l.next()).done)&&(r.push(o.value),!t||r.length!==t);n=!0);}catch(e){a=!0,i=e}finally{try{n||null==l.return||l.return()}finally{if(a)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return v(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 v(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 v(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}var m=b(n("AlertDialogContext","AlertDialog"),2),h=m[0],A=m[1],D=b(n("AlertDialogContext","AlertDialog"),2),O=D[0],C=D[1],I=function(e){var t=e.children,r=e.id,n=y(e,["children","id"]),a=d("alert-dialog",o()),i=r||a,l=d(i,"description"),c=d(i,"title");return p.createElement(f,n,p.createElement(h.Provider,{value:p.useMemo((function(){return{descriptionId:l,titleId:c}}),[l,c])},t))};exports.AlertDialog=I;var w=a((function(e,t){var r=e.as,n=void 0===r?"button":r,a=y(e,["as"]);return p.createElement(f.Trigger,g({},u("AlertDialog.Trigger"),{as:n,ref:t},a))})),E=a((function(e,t){var r=e.as,n=void 0===r?"div":r,a=y(e,["as"]);return p.createElement(f.Overlay,g({},u("AlertDialog.Overlay"),{as:n,ref:t},a))})),T=a((function(e,t){var r=e.as,n=void 0===r?"button":r,a=y(e,["as"]),o=C("AlertDialog.Cancel").cancelRef,l=i(t,o);return p.createElement(f.Close,g({},u("AlertDialog.Cancel"),{as:n,ref:l},a))})),j=a((function(e,t){var r=e.as,n=void 0===r?"button":r,a=y(e,["as"]);return p.createElement(f.Close,g({},u("AlertDialog.Action"),{as:n,ref:t},a))})),S=a((function(e,t){var r=e.as,n=void 0===r?"div":r,a=e["aria-label"],o=e["aria-labelledby"],s=e["aria-describedby"],d=e.children,b=y(e,["as","aria-label","aria-labelledby","aria-describedby","children"]),v=A("AlertDialogContent"),m=v.descriptionId,h=v.titleId,D=p.useRef(null),C=p.useRef(null),I=l(C),w=i(t,C);return p.createElement(f.Content,g({},u("AlertDialog.Content"),{as:n,ref:w,role:"alertdialog","aria-describedby":s||m,"aria-labelledby":a?void 0:o||h,"aria-label":a||void 0},b,{onOpenAutoFocus:c(b.onOpenAutoFocus,(function(e){var t;e.preventDefault(),null===(t=D.current)||void 0===t||t.focus({preventScroll:!0})}))}),p.createElement(O.Provider,{value:p.useMemo((function(){return{cancelRef:D,ownerDocumentRef:I}}),[D,I])},!1,d))})),N=a((function(e,t){var r=e.as,n=void 0===r?"h2":r,a=y(e,["as"]),i=A("AlertDialogTitle").titleId;return p.createElement(n,g({},u("AlertDialog.Title"),{ref:t,id:i},a))})),x=a((function(e,t){var r=e.as,n=void 0===r?"p":r,a=y(e,["as"]),i=A("AlertDialogDescription").descriptionId;return p.createElement(n,g({},u("AlertDialog.Description"),{ref:t,id:i},a))}));I.Cancel=T,I.Action=j,I.Content=S,I.Description=x,I.Overlay=E,I.Title=N,I.Trigger=w,I.Title.displayName="AlertDialog.Title",I.Cancel.displayName="AlertDialog.Cancel",I.Action.displayName="AlertDialog.Action",I.Content.displayName="AlertDialog.Content",I.Description.displayName="AlertDialog.Description",I.Overlay.displayName="AlertDialog.Overlay",I.Trigger.displayName="AlertDialog.Trigger",I.displayName="AlertDialog";"".concat("AlertDialog.Content"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Title"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialog.Content",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialog.Content"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Description"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an `id` and passing the same value to the `aria-describedby` prop in ").concat("AlertDialog.Content",". If the description is confusing or duplicative for sighted users, you can use the `interop-ui/react-visually-hidden` component as a wrapper around your description component.\n\nFor more information, see https://LINK-TO-DOCS.com"); | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import{createContext as e,createStyleObj as t,forwardRef as r,useComposedRefs as n,useId as o,useDocumentRef as i,composeEventHandlers as a}from"@interop-ui/react-utils";import{cssReset as l,makeId as c,warning as s}from"@interop-ui/utils";import{Dialog as u,styles as g}from"@interop-ui/react-dialog";import*as p from"react";function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){f(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function f(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function y(){return(y=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){if(null==e)return{};var r,n,o=function(e,t){if(null==e)return{};var r,n,o={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const[m,A]=e("AlertDialogContext","AlertDialog"),[h,v]=e("AlertDialogContext","AlertDialog");export const AlertDialog=function(e){const{children:t,id:r}=e,n=D(e,["children","id"]),i=c("alert-dialog",o()),a=r||i,l=c(a,"description"),s=c(a,"title");return p.createElement(u,n,p.createElement(m.Provider,{value:p.useMemo((()=>({descriptionId:l,titleId:s})),[l,s])},t))};const O="button",C=r((function(e,t){const{as:r=O}=e,n=D(e,["as"]);return p.createElement(u.Trigger,y({},K("trigger"),{as:r,ref:t},n))})),j="div",w=r((function(e,t){const{as:r=j}=e,n=D(e,["as"]);return p.createElement(u.Overlay,y({},K("overlay"),{as:r,ref:t},n))})),P="button",E=r((function(e,t){const{as:r=P}=e,o=D(e,["as"]),{cancelRef:i}=v("AlertDialog.Cancel"),a=n(t,i);return p.createElement(u.Close,y({},K("cancel"),{as:r,ref:a},o))})),I="button",T=r((function(e,t){const{as:r=I}=e,n=D(e,["as"]);return p.createElement(u.Close,y({},K("action"),{as:r,ref:t},n))})),N="div",x=r((function(e,t){const{as:r=N,"aria-label":o,"aria-labelledby":l,"aria-describedby":c,children:s}=e,g=D(e,["as","aria-label","aria-labelledby","aria-describedby","children"]),{descriptionId:d,titleId:b}=A("AlertDialogContent"),f=p.useRef(null),m=p.useRef(null),v=i(m),O=n(t,m);return p.createElement(u.Content,y({},K("content"),{as:r,ref:O,role:"alertdialog","aria-describedby":c||d,"aria-labelledby":o?void 0:l||b,"aria-label":o||void 0},g,{onOpenAutoFocus:a(g.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=f.current)||void 0===t||t.focus({preventScroll:!0})}))}),p.createElement(h.Provider,{value:p.useMemo((()=>({cancelRef:f,ownerDocumentRef:v})),[f,v])},!1,s))})),S="h2",R=r((function(e,t){const{as:r=S}=e,n=D(e,["as"]),{titleId:o}=A("AlertDialogTitle");return p.createElement(r,y({},K("title"),{ref:t,id:o},n))})),F="p",k=r((function(e,t){const{as:r=F}=e,n=D(e,["as"]),{descriptionId:o}=A("AlertDialogDescription");return p.createElement(r,y({},K("description"),{ref:t,id:o},n))}));AlertDialog.Cancel=E,AlertDialog.Action=T,AlertDialog.Content=x,AlertDialog.Description=k,AlertDialog.Overlay=w,AlertDialog.Title=R,AlertDialog.Trigger=C,AlertDialog.Title.displayName="AlertDialog.Title",AlertDialog.Cancel.displayName="AlertDialog.Cancel",AlertDialog.Action.displayName="AlertDialog.Action",AlertDialog.Content.displayName="AlertDialog.Content",AlertDialog.Description.displayName="AlertDialog.Description",AlertDialog.Overlay.displayName="AlertDialog.Overlay",AlertDialog.Trigger.displayName="AlertDialog.Trigger",AlertDialog.displayName="AlertDialog";const[q,K]=t("AlertDialog",{root:g.root,overlay:b(b({},l(j)),g.overlay),trigger:b(b({},l(O)),g.trigger),cancel:b(b({},l(P)),g.close),action:b(b({},l(I)),g.close),content:b(b({},l(N)),g.content),title:b({},l(S)),description:b({},l(F))});export{q as styles};"".concat("AlertDialog.Content"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Title"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialog.Content",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialog.Content"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Description"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an `id` and passing the same value to the `aria-describedby` prop in ").concat("AlertDialog.Content",". If the description is confusing or duplicative for sighted users, you can use the `interop-ui/react-visually-hidden` component as a wrapper around your description component.\n\nFor more information, see https://LINK-TO-DOCS.com"); | ||
import{createContext as e,forwardRef as t,useComposedRefs as r,useId as a,useDocumentRef as o,composeEventHandlers as i}from"@interop-ui/react-utils";import{getPartDataAttrObj as n,makeId as l,warning as s}from"@interop-ui/utils";import{Dialog as c}from"@interop-ui/react-dialog";import*as g from"react";function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e}).apply(this,arguments)}function d(e,t){if(null==e)return{};var r,a,o=function(e,t){if(null==e)return{};var r,a,o={},i=Object.keys(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a<i.length;a++)r=i[a],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}const[p,D]=e("AlertDialogContext","AlertDialog"),[A,f]=e("AlertDialogContext","AlertDialog");export const AlertDialog=function(e){const{children:t,id:r}=e,o=d(e,["children","id"]),i=l("alert-dialog",a()),n=r||i,s=l(n,"description"),u=l(n,"title");return g.createElement(c,o,g.createElement(p.Provider,{value:g.useMemo((()=>({descriptionId:s,titleId:u})),[s,u])},t))};const b="button",y=t((function(e,t){const{as:r=b}=e,a=d(e,["as"]);return g.createElement(c.Trigger,u({},n("AlertDialog.Trigger"),{as:r,ref:t},a))})),m="div",h=t((function(e,t){const{as:r=m}=e,a=d(e,["as"]);return g.createElement(c.Overlay,u({},n("AlertDialog.Overlay"),{as:r,ref:t},a))})),v="button",C=t((function(e,t){const{as:a=v}=e,o=d(e,["as"]),{cancelRef:i}=f("AlertDialog.Cancel"),l=r(t,i);return g.createElement(c.Close,u({},n("AlertDialog.Cancel"),{as:a,ref:l},o))})),O="button",T=t((function(e,t){const{as:r=O}=e,a=d(e,["as"]);return g.createElement(c.Close,u({},n("AlertDialog.Action"),{as:r,ref:t},a))})),E="div",I=t((function(e,t){const{as:a=E,"aria-label":l,"aria-labelledby":s,"aria-describedby":p,children:f}=e,b=d(e,["as","aria-label","aria-labelledby","aria-describedby","children"]),{descriptionId:y,titleId:m}=D("AlertDialogContent"),h=g.useRef(null),v=g.useRef(null),C=o(v),O=r(t,v);return g.createElement(c.Content,u({},n("AlertDialog.Content"),{as:a,ref:O,role:"alertdialog","aria-describedby":p||y,"aria-labelledby":l?void 0:s||m,"aria-label":l||void 0},b,{onOpenAutoFocus:i(b.onOpenAutoFocus,(e=>{var t;e.preventDefault(),null===(t=h.current)||void 0===t||t.focus({preventScroll:!0})}))}),g.createElement(A.Provider,{value:g.useMemo((()=>({cancelRef:h,ownerDocumentRef:C})),[h,C])},!1,f))})),N="h2",w=t((function(e,t){const{as:r=N}=e,a=d(e,["as"]),{titleId:o}=D("AlertDialogTitle");return g.createElement(r,u({},n("AlertDialog.Title"),{ref:t,id:o},a))})),x="p",j=t((function(e,t){const{as:r=x}=e,a=d(e,["as"]),{descriptionId:o}=D("AlertDialogDescription");return g.createElement(r,u({},n("AlertDialog.Description"),{ref:t,id:o},a))}));AlertDialog.Cancel=C,AlertDialog.Action=T,AlertDialog.Content=I,AlertDialog.Description=j,AlertDialog.Overlay=h,AlertDialog.Title=w,AlertDialog.Trigger=y,AlertDialog.Title.displayName="AlertDialog.Title",AlertDialog.Cancel.displayName="AlertDialog.Cancel",AlertDialog.Action.displayName="AlertDialog.Action",AlertDialog.Content.displayName="AlertDialog.Content",AlertDialog.Description.displayName="AlertDialog.Description",AlertDialog.Overlay.displayName="AlertDialog.Overlay",AlertDialog.Trigger.displayName="AlertDialog.Trigger",AlertDialog.displayName="AlertDialog";"".concat("AlertDialog.Content"," requires a label for the component to be accessible for screen reader users.\n\nYou can label the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Title"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a title by assigning it an `id` and passing the same value to the `aria-labelledby` prop in ").concat("AlertDialog.Content",". If the label is confusing or duplicative for sighted users, you can also pass a label directly by using the `aria-label` prop.\n\nFor more information, see https://LINK-TO-DOCS.com"),"".concat("AlertDialog.Content"," requires a description for the component to be accessible for screen reader users.\n\nYou can add a description to the ").concat("AlertDialog.Content"," by passing a ").concat("AlertDialog.Description"," component as a child, which also benefits sighted users by adding visible context to the dialog.\n\nAlternatively, you can use your own component as a description by assigning it an `id` and passing the same value to the `aria-describedby` prop in ").concat("AlertDialog.Content",". If the description is confusing or duplicative for sighted users, you can use the `interop-ui/react-visually-hidden` component as a wrapper around your description component.\n\nFor more information, see https://LINK-TO-DOCS.com"); | ||
//# sourceMappingURL=index.module.js.map |
{ | ||
"name": "@interop-ui/react-alert-dialog", | ||
"version": "0.0.1-10", | ||
"version": "0.0.1-11", | ||
"license": "MIT", | ||
@@ -14,4 +14,3 @@ "source": "src/index.ts", | ||
"scripts": { | ||
"build": "parcel build src/index.ts --no-cache && yarn build:styles", | ||
"build:styles": "node ../../../scripts/build-styles alert-dialog", | ||
"build": "parcel build src/index.ts --no-cache", | ||
"clean": "rm -rf dist", | ||
@@ -22,5 +21,5 @@ "version": "yarn version", | ||
"dependencies": { | ||
"@interop-ui/react-dialog": "0.0.1-12", | ||
"@interop-ui/react-utils": "0.0.1-11", | ||
"@interop-ui/utils": "0.0.1-3" | ||
"@interop-ui/react-dialog": "0.0.1-13", | ||
"@interop-ui/react-utils": "0.0.1-12", | ||
"@interop-ui/utils": "0.0.1-4" | ||
}, | ||
@@ -27,0 +26,0 @@ "devDependencies": { |
@@ -15,18 +15,16 @@ # `react-alert-dialog` | ||
import * as React from 'react'; | ||
import { AlertDialog, styles } from '@interop-ui/react-alert-dialog'; | ||
import { AlertDialog } from '@interop-ui/react-alert-dialog'; | ||
function MyComponent(props) { | ||
function MyComponent() { | ||
return ( | ||
<AlertDialog> | ||
<AlertDialog.Trigger style={styles.trigger}>Delete everything</AlertDialog.Trigger> | ||
<AlertDialog.Overlay style={styles.overlay} /> | ||
<AlertDialog.Content style={styles.content}> | ||
<AlertDialog.Title style={styles.title}>Are you sure?</AlertDialog.Title> | ||
<AlertDialog.Description style={styles.description}> | ||
<AlertDialog.Trigger>Delete everything</AlertDialog.Trigger> | ||
<AlertDialog.Overlay /> | ||
<AlertDialog.Content> | ||
<AlertDialog.Title>Are you sure?</AlertDialog.Title> | ||
<AlertDialog.Description> | ||
This will do a very dangerous thing. Thar be dragons! | ||
</AlertDialog.Description> | ||
<AlertDialog.Action style={styles.action} onClick={deleteFiles}> | ||
Delete them | ||
</AlertDialog.Action> | ||
<AlertDialog.Cancel style={styles.cancel}>Never mind</AlertDialog.Cancel> | ||
<AlertDialog.Action onClick={deleteFiles}>Delete them</AlertDialog.Action> | ||
<AlertDialog.Cancel>Never mind</AlertDialog.Cancel> | ||
</AlertDialog.Content> | ||
@@ -33,0 +31,0 @@ </AlertDialog> |
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
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
106480
11
639
34
+ Added@interop-ui/react-debug-context@0.0.1-12(transitive)
+ Added@interop-ui/react-dialog@0.0.1-13(transitive)
+ Added@interop-ui/react-dismissable-layer@0.0.1-3(transitive)
+ Added@interop-ui/react-focus-guards@0.0.1-1(transitive)
+ Added@interop-ui/react-focus-scope@0.0.1-3(transitive)
+ Added@interop-ui/react-portal@0.0.1-12(transitive)
+ Added@interop-ui/react-utils@0.0.1-12(transitive)
+ Added@interop-ui/utils@0.0.1-4(transitive)
- Removed@interop-ui/react-debug-context@0.0.1-11(transitive)
- Removed@interop-ui/react-dialog@0.0.1-12(transitive)
- Removed@interop-ui/react-dismissable-layer@0.0.1-2(transitive)
- Removed@interop-ui/react-focus-guards@0.0.1-0(transitive)
- Removed@interop-ui/react-focus-scope@0.0.1-2(transitive)
- Removed@interop-ui/react-portal@0.0.1-11(transitive)
- Removed@interop-ui/react-utils@0.0.1-11(transitive)
- Removed@interop-ui/utils@0.0.1-3(transitive)
- Removedlodash.camelcase@4.3.0(transitive)
- Removedlodash.kebabcase@4.1.1(transitive)
Updated@interop-ui/utils@0.0.1-4