@lifesg/react-design-system 2.5.0-canary.6 → 2.5.1

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.
@@ -2310,7 +2310,7 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
2310
2310
  margin-right: 0.75rem;
2311
2311
  `,j_=$(nf)`
2312
2312
  margin-top: 0;
2313
- `,E_=i.forwardRef(((n,r)=>{const{label:i,value:o,errorMessage:a,id:s="form-textarea","data-error-testid":l,"data-testid":u,onChange:d,layoutType:f,mobileCols:p,tabletCols:h,desktopCols:m}=n,b=Ie(n,["label","value","errorMessage","id","data-error-testid","data-testid","onChange","layoutType","mobileCols","tabletCols","desktopCols"]),[v,y]=g(o);c((()=>{y(o)}),[o]);return e(vf,Object.assign({id:s,label:i,disabled:b.disabled,layoutType:f,mobileCols:p,tabletCols:h,desktopCols:m},{children:[t(k_,Object.assign({id:`${s}-base`,"data-testid":u||s,value:v,error:!!a,onChange:e=>{const t=e.target.value;b.maxLength&&t.length>b.maxLength||(y(t),e.target.value=t,d&&d(e))},ref:r},b)),e(D_,{children:[a&&t(C_,{children:t(j_,Object.assign({weight:"semibold","data-testid":l||(s?`${s}-error-message`:"error-message")},{children:a}))}),b.maxLength&&t($_,{disabled:b.disabled,value:v,maxLength:b.maxLength,renderCustomCounter:b.renderCustomCounter})]})]}))}));var A_,T_;!function(e){e.AM="AM",e.PM="PM"}(A_||(A_={})),function(e){e.getTimeValues=(e,t)=>{const n={hour:"",minute:"",period:A_.AM};if(!t)return n;try{if("24hr"===e){const r=I_(t,e);n.minute=Dd.padValue(r.minute);const i=parseInt(r.hour);0===Math.floor(i/12)?(n.period=A_.AM,n.hour=0===i?"12":Dd.padValue(i.toString())):(n.period=A_.PM,n.hour=12===i?i.toString():Dd.padValue((i-12).toString()))}else{const r=I_(t,e);n.hour=Dd.padValue(r.hour),n.minute=Dd.padValue(r.minute),n.period="am"===r.period.toLowerCase()?A_.AM:A_.PM}return n}catch(e){return n}},e.updateMinutes=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?Dd.padValue("0"):"55";const r=Math.floor(n/5),i=(("add"===t?r+1:n%5==0?r-1:r)%12+12)%12;return Dd.padValue((5*i).toString())},e.updateHours=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?Dd.padValue("1"):"12";const r="add"===t?n+1:n-1;return r<=12&&r>0?Dd.padValue(r.toString()):13===r?Dd.padValue("1"):"12"},e.convertTo24HourFormat=e=>{const t=parseInt(e.hour);let n;return n=e.period===A_.PM?12===t?t.toString():(t+12).toString():12===t?"00":e.hour,`${n}:${e.minute}`},e.convertHourTo12HourFormat=e=>{const t=parseInt(e),n=t%12==0?12..toString():(t%12).toString();return Dd.padValue(n)},e.formatDisplayValue=(e,t)=>{try{const n=I_(e,t),r=Dd.padValue(n.hour);let i=`${r}:${Dd.padValue(n.minute)}`;return"12hr"===t?(i+=n.period.toLowerCase(),i):i}catch(e){return""}},e.toMinutesSeconds=e=>({minutes:Math.floor(e/60),seconds:e%60})}(T_||(T_={}));const M_=(e,t)=>{const n=parseInt(e);return"24hr"===t?n>=0&&n<=23:n>=1&&n<=12},R_=e=>{const t=parseInt(e);return t>=0&&t<=59},I_=(e,t)=>{const n=e.split(":"),r=new Error("Invalid format");if("12hr"===t){if(2!==n.length||4!==n[1].length)throw r;const e=n[1].substring(0,2),o=n[1].substring(2);if(!M_(n[0],t)||!R_(e)||"am"!==(i=o).toLowerCase()&&"pm"!==i.toLowerCase())throw r;return{hour:n[0],minute:e,period:n[1].substring(2)}}if(2!==n.length)throw r;if(!M_(n[0],t)||!R_(n[1]))throw r;return{hour:n[0],minute:n[1]};var i},F_=$.div`
2313
+ `,E_=i.forwardRef(((r,i)=>{const{label:o,value:a,errorMessage:s,id:l="form-textarea","data-error-testid":u,"data-testid":d,onChange:f,layoutType:p,mobileCols:h,tabletCols:m,desktopCols:b}=r,v=Ie(r,["label","value","errorMessage","id","data-error-testid","data-testid","onChange","layoutType","mobileCols","tabletCols","desktopCols"]),[y,w]=g(a);c((()=>{w(a)}),[a]);return e(vf,Object.assign({id:l,label:o,disabled:v.disabled,layoutType:p,mobileCols:h,tabletCols:m,desktopCols:b},{children:[t(k_,Object.assign({id:`${l}-base`,"data-testid":d||l,value:y,error:!!s,onChange:e=>{const t=e.target.value;v.maxLength&&t.length>v.maxLength||(w(t),e.target.value=t,f&&f(e))},ref:i},v)),s||v.maxLength?e(D_,{children:[s&&t(C_,{children:t(j_,Object.assign({weight:"semibold","data-testid":u||(l?`${l}-error-message`:"error-message")},{children:s}))}),v.maxLength&&t($_,{disabled:v.disabled,value:y,maxLength:v.maxLength,renderCustomCounter:v.renderCustomCounter})]}):t(n,{})]}))}));var A_,T_;!function(e){e.AM="AM",e.PM="PM"}(A_||(A_={})),function(e){e.getTimeValues=(e,t)=>{const n={hour:"",minute:"",period:A_.AM};if(!t)return n;try{if("24hr"===e){const r=I_(t,e);n.minute=Dd.padValue(r.minute);const i=parseInt(r.hour);0===Math.floor(i/12)?(n.period=A_.AM,n.hour=0===i?"12":Dd.padValue(i.toString())):(n.period=A_.PM,n.hour=12===i?i.toString():Dd.padValue((i-12).toString()))}else{const r=I_(t,e);n.hour=Dd.padValue(r.hour),n.minute=Dd.padValue(r.minute),n.period="am"===r.period.toLowerCase()?A_.AM:A_.PM}return n}catch(e){return n}},e.updateMinutes=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?Dd.padValue("0"):"55";const r=Math.floor(n/5),i=(("add"===t?r+1:n%5==0?r-1:r)%12+12)%12;return Dd.padValue((5*i).toString())},e.updateHours=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?Dd.padValue("1"):"12";const r="add"===t?n+1:n-1;return r<=12&&r>0?Dd.padValue(r.toString()):13===r?Dd.padValue("1"):"12"},e.convertTo24HourFormat=e=>{const t=parseInt(e.hour);let n;return n=e.period===A_.PM?12===t?t.toString():(t+12).toString():12===t?"00":e.hour,`${n}:${e.minute}`},e.convertHourTo12HourFormat=e=>{const t=parseInt(e),n=t%12==0?12..toString():(t%12).toString();return Dd.padValue(n)},e.formatDisplayValue=(e,t)=>{try{const n=I_(e,t),r=Dd.padValue(n.hour);let i=`${r}:${Dd.padValue(n.minute)}`;return"12hr"===t?(i+=n.period.toLowerCase(),i):i}catch(e){return""}},e.toMinutesSeconds=e=>({minutes:Math.floor(e/60),seconds:e%60})}(T_||(T_={}));const M_=(e,t)=>{const n=parseInt(e);return"24hr"===t?n>=0&&n<=23:n>=1&&n<=12},R_=e=>{const t=parseInt(e);return t>=0&&t<=59},I_=(e,t)=>{const n=e.split(":"),r=new Error("Invalid format");if("12hr"===t){if(2!==n.length||4!==n[1].length)throw r;const e=n[1].substring(0,2),o=n[1].substring(2);if(!M_(n[0],t)||!R_(e)||"am"!==(i=o).toLowerCase()&&"pm"!==i.toLowerCase())throw r;return{hour:n[0],minute:e,period:n[1].substring(2)}}if(2!==n.length)throw r;if(!M_(n[0],t)||!R_(n[1]))throw r;return{hour:n[0],minute:n[1]};var i},F_=$.div`
2314
2314
  position: relative;
2315
2315
  display: inline-flex;
2316
2316
  min-width: 10.375rem;