@equisoft/design-elements-react 9.11.4-snapshot.20260209010213 → 9.11.4-snapshot.20260210185541

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.
package/dist/bundle.js CHANGED
@@ -2531,7 +2531,7 @@
2531
2531
  flex-direction: row;
2532
2532
  gap: var(--spacing-1halfx);
2533
2533
  position: relative;
2534
- `,Cw={information:"dialog",action:"dialog",alert:"alertdialog"},Ow=({appElement:r,ariaDescribedby:n,ariaHideApp:o,dialogType:a="action",cancelButton:i,children:l,className:s,confirmButton:c,footerContent:d,hasCloseButton:u,isOpen:p,width:m,parentSelector:h,shouldCloseOnOverlayClick:f=!0,subtitle:g,title:b,titleIcon:v,onRequestClose:y})=>{const{isMobile:x}=_(),{t:k}=D("modal-dialog"),w=ai(),M=(0,t.useRef)(null),S="alert"===a?"alertOctagon":v,E=!!S;function C(){var e;null===(e=null==c?void 0:c.onConfirm)||void 0===e||e.call(c)}function O(){(null==i?void 0:i.onCancel)?i.onCancel():y()}return(0,e.jsxs)(ww,{ariaDescribedby:n,ariaHideApp:o,ariaLabelledBy:w,className:s,modalHeader:function(){const r=E?Ew:t.Fragment;return(0,e.jsxs)(r,{children:[S&&(0,e.jsx)(Sw,{$dialogType:a,name:S,size:"24","data-testid":"title-icon","aria-hidden":"true"}),(0,e.jsx)(or,{id:w,ref:M,type:"medium",tag:"h2",noMargin:!0,bold:!0,children:b})]})}(),hasCloseButton:u,modalFooter:d||function(){const t="alert"===a?"destructive-primary":"primary";return(0,e.jsxs)(Mw,{isMobile:x,children:["information"!==a&&(0,e.jsx)(Vt,{"data-testid":"cancel-button",label:(null==i?void 0:i.label)||k("cancelButtonLabel"),buttonType:"tertiary",onClick:O}),(0,e.jsx)(Vt,{"data-testid":"confirm-button",label:(null==c?void 0:c.label)||k("confirmButtonLabel"),buttonType:t,onClick:C})]})}(),parentSelector:h,role:Cw[a],onAfterOpen:()=>{var e;return null===(e=M.current)||void 0===e?void 0:e.focus()},onRequestClose:y,isOpen:p,appElement:r,shouldCloseOnOverlayClick:f,width:m,children:[g?(0,e.jsx)(or,{tag:"h3",type:"small",noMargin:!0,bold:!0,children:g}):null,l]})};function $w(e=!1){const[r,n]=(0,t.useState)(e);return{isModalOpen:r,openModal:()=>n(!0),closeModal:()=>n(!1)}}Ow.displayName="ModalDialog";const zw=p("TextInput",["control","leftAdornment","rightAdornment"]);const Dw=a().input`
2534
+ `,Cw={information:"dialog",action:"dialog",alert:"alertdialog"},Ow=({appElement:r,ariaDescribedby:n,ariaHideApp:o,dialogType:a="action",cancelButton:i,children:l,className:s,confirmButton:c,footerContent:d,hasCloseButton:u,isOpen:p,width:m,parentSelector:h,shouldCloseOnOverlayClick:f=!0,subtitle:g,title:b,titleIcon:v,onRequestClose:y,onAfterClose:x})=>{const{isMobile:k}=_(),{t:w}=D("modal-dialog"),M=ai(),S=(0,t.useRef)(null),E="alert"===a?"alertOctagon":v,C=!!E;function O(){var e;null===(e=null==c?void 0:c.onConfirm)||void 0===e||e.call(c)}function $(){(null==i?void 0:i.onCancel)?i.onCancel():y()}return(0,e.jsxs)(ww,{ariaDescribedby:n,ariaHideApp:o,ariaLabelledBy:M,className:s,modalHeader:function(){const r=C?Ew:t.Fragment;return(0,e.jsxs)(r,{children:[E&&(0,e.jsx)(Sw,{$dialogType:a,name:E,size:"24","data-testid":"title-icon","aria-hidden":"true"}),(0,e.jsx)(or,{id:M,ref:S,type:"medium",tag:"h2",noMargin:!0,bold:!0,children:b})]})}(),hasCloseButton:u,modalFooter:d||function(){const t="alert"===a?"destructive-primary":"primary";return(0,e.jsxs)(Mw,{isMobile:k,children:["information"!==a&&(0,e.jsx)(Vt,{"data-testid":"cancel-button",label:(null==i?void 0:i.label)||w("cancelButtonLabel"),buttonType:"tertiary",onClick:$}),(0,e.jsx)(Vt,{"data-testid":"confirm-button",label:(null==c?void 0:c.label)||w("confirmButtonLabel"),buttonType:t,onClick:O})]})}(),parentSelector:h,role:Cw[a],onAfterOpen:()=>{var e;return null===(e=S.current)||void 0===e?void 0:e.focus()},onAfterClose:x,onRequestClose:y,isOpen:p,appElement:r,shouldCloseOnOverlayClick:f,width:m,children:[g?(0,e.jsx)(or,{tag:"h3",type:"small",noMargin:!0,bold:!0,children:g}):null,l]})};function $w(e=!1){const[r,n]=(0,t.useState)(e);return{isModalOpen:r,openModal:()=>n(!0),closeModal:()=>n(!1)}}Ow.displayName="ModalDialog";const zw=p("TextInput",["control","leftAdornment","rightAdornment"]);const Dw=a().input`
2535
2535
  ${({theme:e,isMobile:t})=>af({theme:e,isMobile:t,isFocusable:!1})};
2536
2536
 
2537
2537
  border: 0;
@@ -2598,7 +2598,7 @@
2598
2598
  text-align: ${({$textAlignment:e})=>e};
2599
2599
  width: 132px;
2600
2600
  }
2601
- `;function Aw(e,t,r,n){return null===e?"":function(e,t,r,n="CAD"){return Intl.NumberFormat(r,{style:"currency",currency:n,minimumFractionDigits:t,maximumFractionDigits:t,currencyDisplay:"narrowSymbol"}).format(e)}(e,t,r,n)}function Lw(e,t){return null===e||Number.isNaN(e)?null:Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function Iw(e,t){return""===e?null:Lw(Number(e.replace(",",".")),t)}const Vw=r=>{var{id:n,className:o,readOnly:a,required:i,disabled:l,label:s,onChange:c,precision:d=2,value:u=null,validationErrorMessage:p,locale:m,currency:h="CAD",hint:f,noMargin:g,textAlignment:b="left",toggletip:v}=r,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(r,["id","className","readOnly","required","disabled","label","onChange","precision","value","validationErrorMessage","locale","currency","hint","noMargin","textAlignment","toggletip"]);const{i18n:_,t:x}=D("money-input"),k=null!=m?m:function(e,t){if(!e.match(/^[a-z]{2}-[a-z]{2}$/i))switch(t.toUpperCase()){case"CAD":return`${e}-CA`;case"USD":return`${e}-US`}return e}(_.language,h),w=(0,t.useRef)(null),[M,S]=(0,t.useState)(Aw(u,d,k,h)),[E,C]=(0,t.useState)(Aw(u,d,k,h)),[O,$]=(0,t.useState)(!1),z=$t(y),R=(0,t.useCallback)(e=>{const t=Iw(e,d),r=Aw(t,d,k,h);S(r),E!==r&&(C(r),null==c||c(t,r))},[h,k,E,c,d]);u&&!O&&M!==Aw(u,d,k,h)&&R(u.toString()),(0,t.useEffect)(()=>{null!=w.current&&(O||M===E||R(w.current.value))},[O,M,E,R]),(0,t.useEffect)(()=>{var e;O&&(null===(e=w.current)||void 0===e||e.select())},[O]);const j=(0,t.useCallback)(()=>{$(!1)},[$]),F=(0,t.useCallback)(()=>{const e=Lw(u,d),t=null===e?"":e.toString();S(t),$(!0)},[$,d,u]),N=(0,t.useCallback)(e=>{const t=e.target.value.replace(/[^0-9.,]/g,"");e.preventDefault(),S(t);const r=Iw(t,d),n=Aw(r,d,k,h);null==c||c(r,n)},[h,k,c,d]);return(0,e.jsx)(Tw,Object.assign({$textAlignment:b,id:n,className:o,readOnly:a,required:i,disabled:l,ref:w,type:"text",inputMode:"numeric",value:M,label:s,onChange:N,onBlur:j,onFocus:F,validationErrorMessage:p||x("validationErrorMessage"),hint:f,noMargin:g,toggletip:v},z))};Vw.displayName="MoneyInput";const Hw=`[${[".",","].join("")}]`;function Uw(e,t){return e?e.replace(new RegExp(`${Hw}(?!.*${Hw})`),t):e}function Bw(e){return Uw(e,".")}function qw(e,t){if(""===e||"-"===e)return!0;const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^-?\\d*(${r}?\\d*)?$`).test(e)}const Yw=e=>({value:e,valueAsNumber:""===e?null:Number(Bw(e))});function Ww({defaultValue:e,max:r,min:n,onBlur:o,onChange:a,precision:i,required:l,invalid:s,validationErrorMessage:c,value:d}){var u;const{t:p,i18n:m}=D("numeric-input"),h=(0,t.useMemo)(()=>function(e){try{const t=new Intl.NumberFormat(e).formatToParts(1.1).find(e=>"decimal"===e.type);return(null==t?void 0:t.value)||"."}catch(t){return console.warn(`Could not determine decimal separator for locale "${e}", defaulting to '.'.`,t),"."}}(m.language),[m.language]),f=(0,t.useCallback)(e=>Uw(e,h),[h]),g=(0,t.useCallback)(e=>{if("number"==typeof(t=e)&&Number.isFinite(t))return f(e.toString());var t;if("string"==typeof e){const t=Bw(e);if(qw(t,"."))return f(t)}return console.warn(`Invalid value passed to NumericInput: ${e}`),""},[f]),[b,v]=(0,t.useState)(g(null!==(u=null!=d?d:e)&&void 0!==u?u:"")),y=(0,t.useCallback)((e,t)=>{if(""===e&&l&&!0!==(null==t?void 0:t.skipRequired))return"required";if(""!==e){const t=Bw(e),o=Number(t);if(void 0!==r&&o>r)return"max";if(void 0!==n&&o<n)return"min"}},[r,n,l]),[_,x]=(0,t.useState)(y(b,{skipRequired:!0})),k=(0,t.useCallback)(e=>{const t=y(e);x(t)},[y]),w=(0,t.useCallback)(e=>{e.preventDefault();let t=Uw(function(e){const t=e.clipboardData.getData("text/plain").trim(),r=e.currentTarget,n=r.selectionStart||0,o=r.selectionEnd||0;return function(e,t,r,n){if(t>r||t<0||r>e.length)throw new Error("Invalid index range");return e.slice(0,t)+n+e.slice(r)}(r.value,n,o,t)}(e),h);if(qw(t,h)){if(void 0!==i){const e=mi(Bw(t),i);t=f(e)}}else t=b;qw(t,h)||(t=""),v(t),null==a||a(function(e,t){return Object.assign(Object.assign({},e),{currentTarget:Object.assign(Object.assign({},e.currentTarget),{value:t}),target:Object.assign(Object.assign(Object.assign({},e.currentTarget),e.target),{value:t})})}(e,t),Yw(t)),k(t)},[a,i,h,b,f,k]),M=(0,t.useCallback)(e=>{const t=e.target.value;if(""!==t){if(!qw(t,h))return;if(void 0!==i&&!function(e,t){var r;return!(0===t&&e.includes(".")||t>0&&(null===(r=e.split(".")[1])||void 0===r?void 0:r.length)>t)}(Bw(t),i))return}v(t),null==a||a(e,Yw(t)),void 0===s&&k(t)},[a,i,h,k,s]),S=(0,t.useCallback)(e=>{let t=function(e,t){if(e===t||e===`-${t}`)return"";const r=Bw(e);if(""===r||Number.isNaN(Number(r)))return"";let n=r;return n.endsWith(".")&&(n=n.slice(0,-1)),n.startsWith(".")?n=`0${n}`:n.startsWith("-.")&&(n=`-0${n.substring(1)}`),""===n?"":Uw(n,t)}(e.target.value,h);if(void 0!==i&&""!==t){const e=mi(Bw(t),i);t=f(e)}v(t),l&&""===t?x(y(t)):k(t),null==o||o(e,Yw(t))},[o,l,k,h,i,f,y]),E=(0,t.useCallback)(()=>{void 0===s&&k(b)},[b,s,k]);if(void 0!==d){const e=g(d);e!==b&&(v(e),void 0===s&&k(e))}const C=null!=s?s:void 0!==_,O=null!=c?c:(()=>{switch(_){case"required":return p("requiredValidationErrorMessage");case"max":return p("maxValidationErrorMessage",{max:r});case"min":return p("minValidationErrorMessage",{min:n});default:return}})();return{max:r,min:n,onBlurHandler:S,onChangeHandler:M,onPasteHandler:w,onInvalid:E,precision:i,required:l,invalid:C,validationErrorMessage:O,value:b}}const Gw=a()(Pw)`
2601
+ `;function Aw(e,t,r,n){return null===e?"":function(e,t,r,n="CAD"){return Intl.NumberFormat(r,{style:"currency",currency:n,minimumFractionDigits:t,maximumFractionDigits:t,currencyDisplay:"narrowSymbol"}).format(e)}(e,t,r,n)}function Lw(e,t){return null===e||Number.isNaN(e)?null:Math.round(e*Math.pow(10,t))/Math.pow(10,t)}function Iw(e,t){return""===e?null:Lw(Number(e.replace(",",".")),t)}const Vw=r=>{var{id:n,className:o,readOnly:a,required:i,disabled:l,label:s,onChange:c,precision:d=2,value:u=null,validationErrorMessage:p,locale:m,currency:h="CAD",hint:f,noMargin:g,textAlignment:b="left",toggletip:v}=r,y=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]])}return r}(r,["id","className","readOnly","required","disabled","label","onChange","precision","value","validationErrorMessage","locale","currency","hint","noMargin","textAlignment","toggletip"]);const{i18n:_,t:x}=D("money-input"),k=null!=m?m:function(e,t){if(!e.match(/^[a-z]{2}-[a-z]{2}$/i))switch(t.toUpperCase()){case"CAD":return`${e}-CA`;case"USD":return`${e}-US`}return e}(_.language,h),w=(0,t.useRef)(null),[M,S]=(0,t.useState)(Aw(u,d,k,h)),[E,C]=(0,t.useState)(Aw(u,d,k,h)),[O,$]=(0,t.useState)(!1),z=$t(y),R=(0,t.useCallback)(e=>{const t=Iw(e,d),r=Aw(t,d,k,h);S(r),E!==r&&(C(r),null==c||c(t,r))},[h,k,E,c,d]);null===u||O||M===Aw(u,d,k,h)||R(u.toString()),(0,t.useEffect)(()=>{null!=w.current&&(O||M===E||R(w.current.value))},[O,M,E,R]),(0,t.useEffect)(()=>{var e;O&&(null===(e=w.current)||void 0===e||e.select())},[O]);const j=(0,t.useCallback)(()=>{$(!1)},[$]),F=(0,t.useCallback)(()=>{const e=Lw(u,d),t=null===e?"":e.toString();S(t),$(!0)},[$,d,u]),N=(0,t.useCallback)(e=>{const t=e.target.value.replace(/[^0-9.,]/g,"");e.preventDefault(),S(t);const r=Iw(t,d),n=Aw(r,d,k,h);null==c||c(r,n)},[h,k,c,d]);return(0,e.jsx)(Tw,Object.assign({$textAlignment:b,id:n,className:o,readOnly:a,required:i,disabled:l,ref:w,type:"text",inputMode:"numeric",value:M,label:s,onChange:N,onBlur:j,onFocus:F,validationErrorMessage:p||x("validationErrorMessage"),hint:f,noMargin:g,toggletip:v},z))};Vw.displayName="MoneyInput";const Hw=`[${[".",","].join("")}]`;function Uw(e,t){return e?e.replace(new RegExp(`${Hw}(?!.*${Hw})`),t):e}function Bw(e){return Uw(e,".")}function qw(e,t){if(""===e||"-"===e)return!0;const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`^-?\\d*(${r}?\\d*)?$`).test(e)}const Yw=e=>({value:e,valueAsNumber:""===e?null:Number(Bw(e))});function Ww({defaultValue:e,max:r,min:n,onBlur:o,onChange:a,precision:i,required:l,invalid:s,validationErrorMessage:c,value:d}){var u;const{t:p,i18n:m}=D("numeric-input"),h=(0,t.useMemo)(()=>function(e){try{const t=new Intl.NumberFormat(e).formatToParts(1.1).find(e=>"decimal"===e.type);return(null==t?void 0:t.value)||"."}catch(t){return console.warn(`Could not determine decimal separator for locale "${e}", defaulting to '.'.`,t),"."}}(m.language),[m.language]),f=(0,t.useCallback)(e=>Uw(e,h),[h]),g=(0,t.useCallback)(e=>{if("number"==typeof(t=e)&&Number.isFinite(t))return f(e.toString());var t;if("string"==typeof e){const t=Bw(e);if(qw(t,"."))return f(t)}return console.warn(`Invalid value passed to NumericInput: ${e}`),""},[f]),[b,v]=(0,t.useState)(g(null!==(u=null!=d?d:e)&&void 0!==u?u:"")),y=(0,t.useCallback)((e,t)=>{if(""===e&&l&&!0!==(null==t?void 0:t.skipRequired))return"required";if(""!==e){const t=Bw(e),o=Number(t);if(void 0!==r&&o>r)return"max";if(void 0!==n&&o<n)return"min"}},[r,n,l]),[_,x]=(0,t.useState)(y(b,{skipRequired:!0})),k=(0,t.useCallback)(e=>{const t=y(e);x(t)},[y]),w=(0,t.useCallback)(e=>{e.preventDefault();let t=Uw(function(e){const t=e.clipboardData.getData("text/plain").trim(),r=e.currentTarget,n=r.selectionStart||0,o=r.selectionEnd||0;return function(e,t,r,n){if(t>r||t<0||r>e.length)throw new Error("Invalid index range");return e.slice(0,t)+n+e.slice(r)}(r.value,n,o,t)}(e),h);if(qw(t,h)){if(void 0!==i){const e=mi(Bw(t),i);t=f(e)}}else t=b;qw(t,h)||(t=""),v(t),null==a||a(function(e,t){return Object.assign(Object.assign({},e),{currentTarget:Object.assign(Object.assign({},e.currentTarget),{value:t}),target:Object.assign(Object.assign(Object.assign({},e.currentTarget),e.target),{value:t})})}(e,t),Yw(t)),k(t)},[a,i,h,b,f,k]),M=(0,t.useCallback)(e=>{const t=e.target.value;if(""!==t){if(!qw(t,h))return;if(void 0!==i&&!function(e,t){var r;return!(0===t&&e.includes(".")||t>0&&(null===(r=e.split(".")[1])||void 0===r?void 0:r.length)>t)}(Bw(t),i))return}v(t),null==a||a(e,Yw(t)),void 0===s&&k(t)},[a,i,h,k,s]),S=(0,t.useCallback)(e=>{let t=function(e,t){if(e===t||e===`-${t}`)return"";const r=Bw(e);if(""===r||Number.isNaN(Number(r)))return"";let n=r;return n.endsWith(".")&&(n=n.slice(0,-1)),n.startsWith(".")?n=`0${n}`:n.startsWith("-.")&&(n=`-0${n.substring(1)}`),""===n?"":Uw(n,t)}(e.target.value,h);if(void 0!==i&&""!==t){const e=mi(Bw(t),i);t=f(e)}v(t),l&&""===t?x(y(t)):k(t),null==o||o(e,Yw(t))},[o,l,k,h,i,f,y]),E=(0,t.useCallback)(()=>{void 0===s&&k(b)},[b,s,k]);if(void 0!==d){const e=g(d);e!==b&&(v(e),void 0===s&&k(e))}const C=null!=s?s:void 0!==_,O=null!=c?c:(()=>{switch(_){case"required":return p("requiredValidationErrorMessage");case"max":return p("maxValidationErrorMessage",{max:r});case"min":return p("minValidationErrorMessage",{min:n});default:return}})();return{max:r,min:n,onBlurHandler:S,onChangeHandler:M,onPasteHandler:w,onInvalid:E,precision:i,required:l,invalid:C,validationErrorMessage:O,value:b}}const Gw=a()(Pw)`
2602
2602
  .${zw.control} {
2603
2603
  text-align: ${({$textAlign:e})=>e};
2604
2604
  }
@@ -46,6 +46,8 @@ export interface BaseModalProps {
46
46
  shouldCloseOnOverlayClick?: boolean;
47
47
  parentSelector?: () => HTMLElement;
48
48
  onRequestClose(): void;
49
+ /** Function that will run after the modal has closed */
50
+ onAfterClose?: () => void;
49
51
  }
50
52
  export interface ModalProps extends BaseModalProps {
51
53
  ariaLabel?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equisoft/design-elements-react",
3
- "version": "9.11.4-snapshot.20260209010213",
3
+ "version": "9.11.4-snapshot.20260210185541",
4
4
  "description": "React implementation of the Equisoft design system.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/bundle.js",