@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.
package/form/index.js CHANGED
@@ -2258,7 +2258,7 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
2258
2258
  margin-right: 0.75rem;
2259
2259
  `,lx=k(Rs)`
2260
2260
  margin-top: 0;
2261
- `,cx=i.forwardRef(((n,r)=>{const{label:i,value:o,errorMessage:s,id:c="form-textarea","data-error-testid":u,"data-testid":d,onChange:f,layoutType:h,mobileCols:p,tabletCols:m,desktopCols:g}=n,b=Z(n,["label","value","errorMessage","id","data-error-testid","data-testid","onChange","layoutType","mobileCols","tabletCols","desktopCols"]),[y,v]=l(o);a((()=>{v(o)}),[o]);return t(Qs,Object.assign({id:c,label:i,disabled:b.disabled,layoutType:h,mobileCols:p,tabletCols:m,desktopCols:g},{children:[e(ox,Object.assign({id:`${c}-base`,"data-testid":d||c,value:y,error:!!s,onChange:e=>{const t=e.target.value;b.maxLength&&t.length>b.maxLength||(v(t),e.target.value=t,f&&f(e))},ref:r},b)),t(ax,{children:[s&&e(sx,{children:e(lx,Object.assign({weight:"semibold","data-testid":u||(c?`${c}-error-message`:"error-message")},{children:s}))}),b.maxLength&&e(nx,{disabled:b.disabled,value:y,maxLength:b.maxLength,renderCustomCounter:b.renderCustomCounter})]})]}))}));var ux,dx;!function(e){e.AM="AM",e.PM="PM"}(ux||(ux={})),function(e){e.getTimeValues=(e,t)=>{const n={hour:"",minute:"",period:ux.AM};if(!t)return n;try{if("24hr"===e){const r=px(t,e);n.minute=vr.padValue(r.minute);const i=parseInt(r.hour);0===Math.floor(i/12)?(n.period=ux.AM,n.hour=0===i?"12":vr.padValue(i.toString())):(n.period=ux.PM,n.hour=12===i?i.toString():vr.padValue((i-12).toString()))}else{const r=px(t,e);n.hour=vr.padValue(r.hour),n.minute=vr.padValue(r.minute),n.period="am"===r.period.toLowerCase()?ux.AM:ux.PM}return n}catch(e){return n}},e.updateMinutes=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?vr.padValue("0"):"55";const r=Math.floor(n/5),i=(("add"===t?r+1:n%5==0?r-1:r)%12+12)%12;return vr.padValue((5*i).toString())},e.updateHours=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?vr.padValue("1"):"12";const r="add"===t?n+1:n-1;return r<=12&&r>0?vr.padValue(r.toString()):13===r?vr.padValue("1"):"12"},e.convertTo24HourFormat=e=>{const t=parseInt(e.hour);let n;return n=e.period===ux.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 vr.padValue(n)},e.formatDisplayValue=(e,t)=>{try{const n=px(e,t),r=vr.padValue(n.hour);let i=`${r}:${vr.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})}(dx||(dx={}));const fx=(e,t)=>{const n=parseInt(e);return"24hr"===t?n>=0&&n<=23:n>=1&&n<=12},hx=e=>{const t=parseInt(e);return t>=0&&t<=59},px=(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(!fx(n[0],t)||!hx(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(!fx(n[0],t)||!hx(n[1]))throw r;return{hour:n[0],minute:n[1]};var i},mx=k.div`
2261
+ `,cx=i.forwardRef(((r,i)=>{const{label:o,value:s,errorMessage:c,id:u="form-textarea","data-error-testid":d,"data-testid":f,onChange:h,layoutType:p,mobileCols:m,tabletCols:g,desktopCols:b}=r,y=Z(r,["label","value","errorMessage","id","data-error-testid","data-testid","onChange","layoutType","mobileCols","tabletCols","desktopCols"]),[v,w]=l(s);a((()=>{w(s)}),[s]);return t(Qs,Object.assign({id:u,label:o,disabled:y.disabled,layoutType:p,mobileCols:m,tabletCols:g,desktopCols:b},{children:[e(ox,Object.assign({id:`${u}-base`,"data-testid":f||u,value:v,error:!!c,onChange:e=>{const t=e.target.value;y.maxLength&&t.length>y.maxLength||(w(t),e.target.value=t,h&&h(e))},ref:i},y)),c||y.maxLength?t(ax,{children:[c&&e(sx,{children:e(lx,Object.assign({weight:"semibold","data-testid":d||(u?`${u}-error-message`:"error-message")},{children:c}))}),y.maxLength&&e(nx,{disabled:y.disabled,value:v,maxLength:y.maxLength,renderCustomCounter:y.renderCustomCounter})]}):e(n,{})]}))}));var ux,dx;!function(e){e.AM="AM",e.PM="PM"}(ux||(ux={})),function(e){e.getTimeValues=(e,t)=>{const n={hour:"",minute:"",period:ux.AM};if(!t)return n;try{if("24hr"===e){const r=px(t,e);n.minute=vr.padValue(r.minute);const i=parseInt(r.hour);0===Math.floor(i/12)?(n.period=ux.AM,n.hour=0===i?"12":vr.padValue(i.toString())):(n.period=ux.PM,n.hour=12===i?i.toString():vr.padValue((i-12).toString()))}else{const r=px(t,e);n.hour=vr.padValue(r.hour),n.minute=vr.padValue(r.minute),n.period="am"===r.period.toLowerCase()?ux.AM:ux.PM}return n}catch(e){return n}},e.updateMinutes=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?vr.padValue("0"):"55";const r=Math.floor(n/5),i=(("add"===t?r+1:n%5==0?r-1:r)%12+12)%12;return vr.padValue((5*i).toString())},e.updateHours=(e,t)=>{const n=parseInt(e);if(isNaN(n))return"add"===t?vr.padValue("1"):"12";const r="add"===t?n+1:n-1;return r<=12&&r>0?vr.padValue(r.toString()):13===r?vr.padValue("1"):"12"},e.convertTo24HourFormat=e=>{const t=parseInt(e.hour);let n;return n=e.period===ux.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 vr.padValue(n)},e.formatDisplayValue=(e,t)=>{try{const n=px(e,t),r=vr.padValue(n.hour);let i=`${r}:${vr.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})}(dx||(dx={}));const fx=(e,t)=>{const n=parseInt(e);return"24hr"===t?n>=0&&n<=23:n>=1&&n<=12},hx=e=>{const t=parseInt(e);return t>=0&&t<=59},px=(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(!fx(n[0],t)||!hx(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(!fx(n[0],t)||!hx(n[1]))throw r;return{hour:n[0],minute:n[1]};var i},mx=k.div`
2262
2262
  position: relative;
2263
2263
  display: inline-flex;
2264
2264
  min-width: 10.375rem;