@webority/ui-react 0.68.1 → 0.68.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{useEffect as r,useRef as i,useState as a}from"react";import{Modal as o}from"react-bootstrap";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`danger`,`success`,`warning`],u=[`center`,`top`],d=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,f={sm:380,md:440,lg:640,xl:880},p=`wui-modal-fullscreen`,m=!1;function h(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||m||(m=!0,console.warn("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function g({open:m,eyebrow:
|
|
1
|
+
import e from"./warnInvalidValue.js";import t from"./warnUnknownProps.js";import n from"./AppIcon.js";import{useEffect as r,useRef as i,useState as a}from"react";import{Modal as o}from"react-bootstrap";import{jsx as s,jsxs as c}from"react/jsx-runtime";var l=[`default`,`danger`,`success`,`warning`],u=[`center`,`top`],d=`a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex="-1"])`,f={sm:380,md:440,lg:640,xl:880},p=`wui-modal-fullscreen`,m=!1;function h(){let e=!0;try{e=process.env.NODE_ENV!==`production`}catch{e=!0}!e||m||(m=!0,console.warn("[@webority/ui-react] <AppModal hideHeader> has no accessible name — pass `ariaLabel` (or a string `title`)."))}function g(e,t){if(e.key!==`Tab`)return;let n=Array.from(t.querySelectorAll(d));if(!n.length){e.preventDefault(),t.focus();return}let r=n[0],i=n[n.length-1],a=document.activeElement;e.shiftKey&&(a===r||a===t)?(e.preventDefault(),i.focus()):!e.shiftKey&&a===i&&(e.preventDefault(),r.focus())}function _(){let e=[];for(let t of document.body.children)t.hasAttribute(`inert`)||t.matches(`.modal, .modal-backdrop`)||(t.setAttribute(`inert`,``),e.push(t));return e}function v({open:m,eyebrow:v,title:y,subtitle:b,headerIcon:x,tone:S=`default`,dismissible:C=!0,onClose:w,footer:T,size:E=`md`,placement:D=`center`,hideHeader:O=!1,staticBackdrop:k=!1,confirmDiscard:A,dirty:j=!1,ariaLabel:M,className:N=``,children:P,...F}){t(`AppModal`,F),e(`AppModal`,`tone`,S,l),e(`AppModal`,`placement`,D,u),e(`AppModal`,`size`,typeof E==`string`?E:null,[...Object.keys(f),`fullscreen`]);let{style:I,...L}=F;O&&!M&&typeof y!=`string`&&h();let R=i(null),z=i(null),[B,V]=a(!1);r(()=>{m||V(!1)},[m]),r(()=>{B&&z.current?.focus()},[B]),r(()=>{let e=R.current?.closest(`.modal`);e&&(A?e.setAttribute(`confirm-discard`,A):e.removeAttribute(`confirm-discard`))},[m,A]),r(()=>{if(!m)return;let e=R.current?.closest(`.modal-content`);if(!e)return;let t=()=>Array.from(e.querySelectorAll(d));(e.querySelector(`[data-autofocus]`)||t().find(e=>!e.classList.contains(`wui-modal-close`))||t()[0]||e).focus?.();let n=e.closest(`.modal`),r=_(),i=e=>g(e,n);return n?.addEventListener(`keydown`,i),()=>{n?.removeEventListener(`keydown`,i);for(let e of r)e.removeAttribute(`inert`);n&&setTimeout(()=>{n.isConnected&&!n.classList.contains(`show`)&&n.dispatchEvent(new Event(`transitionend`,{bubbles:!0}))},500)}},[m]);let H=()=>{if(A&&j){V(!0);return}w?.()},U=()=>{V(!1),w?.()},W=()=>{V(!1),(R.current?.querySelector(`input:not([type="hidden"]):not([disabled]),select:not([disabled]),textarea:not([disabled])`))?.focus()},G=E===`fullscreen`,K=typeof E==`number`?E:f[E]??f.md,q=[`wui-modal`,S==="default"?``:`tone-${S}`,N].filter(Boolean).join(` `);return c(o,{...L,show:m,onHide:H,backdrop:!k||`static`,keyboard:!k,autoFocus:!1,enforceFocus:!0,restoreFocus:!0,centered:D!==`top`,className:G?`wui-modal-shell ${p}`:`wui-modal-shell`,style:G?I:{"--wui-modal-max-width":`${K}px`,...I},dialogClassName:`wui-rb-dialog`,contentClassName:q,backdropClassName:`wui-modal-dim`,"aria-label":M||(typeof y==`string`?y:void 0),children:[!O&&c(`div`,{className:`wui-modal-header`,children:[c(`div`,{className:`wui-modal-heading`,children:[x&&s(`span`,{className:`wui-modal-headicon`,children:s(n,{name:x,size:18})}),c(`div`,{className:`wui-modal-headtext`,children:[v&&s(`div`,{className:`wui-modal-eyebrow`,children:v}),s(`div`,{className:`wui-modal-title`,children:y}),b&&s(`div`,{className:`wui-modal-subtitle`,children:b})]})]}),C&&s(`button`,{type:`button`,className:`wui-modal-close`,onClick:H,"aria-label":`Close`,children:s(`svg`,{width:`18`,height:`18`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:s(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]}),s(`div`,{className:`wui-modal-body`,ref:R,children:P}),(T||B)&&c(`div`,{className:B?`wui-modal-footer wui-drawer-discarding`:`wui-modal-footer`,children:[B&&c(`div`,{className:`wui-drawer-discard`,role:`alert`,children:[s(`span`,{className:`wui-drawer-discard-text`,children:A}),s(`button`,{type:`button`,className:`btn btn-danger btn-sm`,"data-wui-discard-confirm":``,ref:z,onClick:U,children:`Discard`}),s(`button`,{type:`button`,className:`btn btn-secondary btn-sm`,"data-wui-discard-keep":``,onClick:W,children:`Keep editing`})]}),T]})]})}export{v as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webority/ui-react",
|
|
3
|
-
"version": "0.68.
|
|
3
|
+
"version": "0.68.3",
|
|
4
4
|
"description": "Webority shared React component library — App* primitives on react-bootstrap + the @webority/theme design system.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"type": "module",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
},
|
|
28
28
|
"sideEffects": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@webority/theme": "0.68.
|
|
31
|
-
"@webority/ui-elements": "0.68.
|
|
30
|
+
"@webority/theme": "0.68.3",
|
|
31
|
+
"@webority/ui-elements": "0.68.3"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@webority/analytics": "^0.23.0",
|