@lifesg/react-design-system 1.1.1 → 1.1.2

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.
Files changed (51) hide show
  1. package/accordion/index.js +6 -6
  2. package/accordion/index.js.map +1 -1
  3. package/calendar/index.js +2 -2
  4. package/calendar/index.js.map +1 -1
  5. package/cjs/index.js +12 -12
  6. package/cjs/index.js.map +1 -1
  7. package/date-input/index.js +2 -2
  8. package/date-input/index.js.map +1 -1
  9. package/feedback-rating/index.js +6 -6
  10. package/feedback-rating/index.js.map +1 -1
  11. package/filter/index.js +3 -3
  12. package/filter/index.js.map +1 -1
  13. package/form/index.js +4 -4
  14. package/form/index.js.map +1 -1
  15. package/icon-button/index.js +2 -2
  16. package/icon-button/index.js.map +1 -1
  17. package/image-button/index.js +1 -1
  18. package/image-button/index.js.map +1 -1
  19. package/index.js +12 -12
  20. package/index.js.map +1 -1
  21. package/input/index.js +1 -1
  22. package/input/index.js.map +1 -1
  23. package/input-group/index.js +3 -3
  24. package/input-group/index.js.map +1 -1
  25. package/input-select/index.js +2 -2
  26. package/input-select/index.js.map +1 -1
  27. package/modal/index.js +1 -1
  28. package/modal/index.js.map +1 -1
  29. package/navbar/index.js +2 -2
  30. package/navbar/index.js.map +1 -1
  31. package/notification-banner/index.js +1 -1
  32. package/notification-banner/index.js.map +1 -1
  33. package/otp-input/index.js +3 -3
  34. package/otp-input/index.js.map +1 -1
  35. package/package.json +1 -1
  36. package/phone-number-input/index.js +3 -3
  37. package/phone-number-input/index.js.map +1 -1
  38. package/popover/index.js +1 -1
  39. package/popover/index.js.map +1 -1
  40. package/smart-app-banner/index.js +7 -7
  41. package/smart-app-banner/index.js.map +1 -1
  42. package/time-range-picker/index.js +1 -1
  43. package/time-range-picker/index.js.map +1 -1
  44. package/time-slot-bar/index.js +1 -1
  45. package/time-slot-bar/index.js.map +1 -1
  46. package/timepicker/index.js +1 -1
  47. package/timepicker/index.js.map +1 -1
  48. package/toast/index.js +1 -1
  49. package/toast/index.js.map +1 -1
  50. package/unit-number/index.js +1 -1
  51. package/unit-number/index.js.map +1 -1
@@ -555,7 +555,7 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
555
555
  background-color: ${Ba.Neutral[7]};
556
556
  `}
557
557
  }
558
- `,Ts=i.forwardRef((({children:e,focusHighlight:t=!0,focusOutline:r="none",...o},i)=>n(Es,{ref:i,$outline:r,$highlight:t,...o,children:e}))),Is=x`
558
+ `,Ts=i.forwardRef((({children:e,focusHighlight:t=!0,focusOutline:r="none",type:o="button",...i},a)=>n(Es,{ref:a,$outline:r,$highlight:t,type:o,...i,children:e}))),Is=x`
559
559
  color: ${Ba.Neutral[3]};
560
560
  height: 1rem;
561
561
  width: 1rem;
@@ -690,7 +690,7 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
690
690
  `:x`
691
691
  margin: auto 0 auto 0.625rem; // to counter the padding
692
692
  `}
693
- `,nl=i.forwardRef((({disabledDates:e,onYearMonthDisplayChange:o,onCalendarView:i,onSelect:a,onHover:c,onDismiss:u,actionComponent:d,isOpen:f,value:p,endValue:m,currentFocus:g,withButton:y,variant:b,between:w,type:$="standalone",...S},x)=>{const[_,O]=l(M()),[C,k]=l("default"),[D,j]=l(),[B,P]=l(),[A,E]=l(),[T,I]=l(!0),H=s(null),L=s(null),R=function(e){void 0===e&&(e={});var t=e.skipOnMount,n=void 0!==t&&t,r=e.refreshMode,o=e.refreshRate,i=void 0===o?1e3:o,a=e.refreshOptions,c=e.handleWidth,u=void 0===c||c,d=e.handleHeight,h=void 0===d||d,f=e.targetRef,p=e.observerOptions,m=e.onResize,g=s(n),y=s(null),v=null!=f?f:y,b=s(),w=l({width:void 0,height:void 0}),$=w[0],S=w[1];return xe((function(){if(!we()){var e=Se(m,S,u,h);b.current=ve((function(t){(u||h)&&t.forEach((function(t){var n=t&&t.contentRect||{},r=n.width,o=n.height;!g.current&&!we()&&e({width:r,height:o}),g.current=!1}))}),r,i,a);var t=new window.ResizeObserver(b.current);return v.current&&t.observe(v.current,p),function(){t.disconnect();var e=b.current;e&&e.cancel&&e.cancel()}}}),[r,i,a,u,h,m,p,v.current]),F({ref:v},$)}();v(x,(()=>({defaultView(){k("default"),i("default")}})),[]),h((()=>{f&&(O(M()),k("default"),"range"===b&&p?.length&&m?.length&&I(!1))}),[f]),h((()=>{const e="end"===g?m:p;E(M(e)),e&&O(M(e))}),[g]),h((()=>{I(!0),p?("input"===d&&O(M(p)),j(p),O(M(p))):j(void 0)}),[p]),h((()=>{I(!0),m?("input"===d&&O(M(m)),P(m)):P(void 0)}),[m]);const z=()=>{switch(C){case"default":E((e=>e.subtract(1,"month"))),O((e=>{const t=e.subtract(1,"month");return Z(t),t}));break;case"month-options":O((e=>e.subtract(1,"year")));break;case"year-options":O((e=>e.subtract(10,"year")))}},N=()=>{switch(C){case"default":E((e=>e.add(1,"month"))),O((e=>{const t=e.add(1,"month");return Z(t),t}));break;case"month-options":O((e=>e.add(1,"year")));break;case"year-options":O((e=>e.add(10,"year")))}},V=e=>{const t=e.format("YYYY-MM-DD");O(e),E(e),G(t),Q(t)},Y=e=>{O(e),E(e),Z(e)},W=()=>{O(M("end"===g?m:p)),X("reset")},q=e=>{U(e)},Q=e=>{a&&a(e)},U=e=>{c&&c(e)},Z=e=>{if(o){const t={month:e.month()+1,year:e.year()};o(t)}},X=e=>{u&&u(e)},G=e=>{if(g)switch(g){case"start":default:j(e);break;case"end":P(e)}else j(e)},J=()=>{"month-options"!==C?(k("month-options"),te("month-options"),R.ref.current.focus()):(k("default"),O(A),te("default"))},K=()=>{"default"!==C?(k("default"),O(A),te("default")):(k("year-options"),te("year-options"))},ee=()=>{if("year-options"===C){const{beginDecade:e,endDecade:t}=ho.getStartEndDecade(_);return`${e} to ${t}`}return M(_).format("YYYY")},te=e=>{i&&i(e)},ne=()=>t(r,{children:[t(Zs,{type:"button",tabIndex:-1,$type:$,$expandedDisplay:"month-options"===C,$visible:"default"===C,id:"month-dropdown",onClick:J,children:[n(Xs,{$type:$,children:M(_).format("MMM")}),n(Rs,{})]}),t(Zs,{type:"button",tabIndex:-1,$type:$,$expandedDisplay:"default"!==C,id:"year-dropdown",onClick:K,children:[n(Xs,{$type:$,children:ee()}),n(Rs,{})]})]}),re=()=>{switch(C){case"month-options":return n(as,{type:$,calendarDate:_,currentFocus:g,selectedStartDate:D,selectedEndDate:B,viewCalendarDate:A,between:w,isNewSelection:T,onMonthSelect:Y});case"year-options":return n(us,{type:$,calendarDate:_,currentFocus:g,selectedStartDate:D,selectedEndDate:B,viewCalendarDate:A,between:w,isNewSelection:T,onYearSelect:Y});default:return null}},oe=()=>{switch($){case"standalone":default:return n(Us,{children:ne()});case"input":return t(qs,{children:[n(Qs,{children:ne()}),t(Gs,{children:[n(Js,{tabIndex:-1,onClick:z,children:n(Hs,{})}),n(Js,{tabIndex:-1,onClick:N,children:n(Ls,{})})]})]})}},ie=()=>{if("standalone"===$||!y)return;let e=!0;const r=["default"].includes(C);switch(b){case"single":e=!D;break;case"range":e=!D||!B}const o=!!r&&e;return t(Ks,{children:[n(el,{ref:L,"data-testid":"cancel-button",styleType:"light",onClick:W,children:"Cancel"}),n(el,{"data-testid":"done-button",ref:H,onClick:()=>(e=>{e||(O(A),X("confirmed"))})(o),disabled:o,children:"Done"})]})},ae=()=>t(Ns,{ref:R.ref,tabIndex:-1,"data-id":"calendar-container",$type:$,...S,children:["standalone"===$&&n(tl,{$direction:"left",onClick:z,children:n(Hs,{})}),t(Vs,{children:[oe(),t(Ys,{children:[n(ns,{type:$,calendarDate:_,currentFocus:g,disabledDates:e,selectedStartDate:D,selectedEndDate:B,variant:b,between:w,isNewSelection:T,onSelect:V,onHover:q}),n(Ws,{$visible:"default"!==C,children:re()})]}),ie()]}),"standalone"===$&&n(tl,{$direction:"right",onClick:N,children:n(Ls,{})})]}),se=zr({height:f?R.height+64:0});return"input"===$?n(zs,{style:se,children:ae()}):n(r,{children:ae()})}));var rl;M.extend(ts),function(e){const t=/^\d{4}-\d{2}-\d{2}$/;e.validate=(e,n,r,o)=>{if(!e||!n)return!1;if(M(e).isAfter(n))return!1;if(r&&r.length&&r.some((t=>[e,n].includes(t))))return!1;if(o&&o.length){if(![e,n].every((e=>M(e).isBetween(o[0],o[1],"day","[]"))))return!1;if(!o.every((e=>t.test(e))))return!1}return!0},e.validateSingle=(e,n,r)=>{if(0===e.length)return!1;if(n&&n.length&&n.some((t=>e===t)))return!1;if(r&&r.length&&!M(e).isBetween(r[0],r[1],"day","[]")){if(!M(e).isBetween(r[0],r[1],"day","[]"))return!1;if(!r.every((e=>t.test(e))))return!1}return!0},e.getFormattedRawValue=(e,t)=>{const[n,r,o]=e.split("-"),i=[o,r,n];let a;if(t){const[e,n,r]=t.split("-");a=[r,n,e]}return{start:i,end:a}},e.sleep=(e,t)=>new Promise((n=>{const r=setTimeout(n,e);t.signal.addEventListener("abort",(()=>{clearTimeout(r)}))}))}(rl||(rl={}));const ol=[1,3,5,7,8,10,12],il=[4,6,9,11];var al,sl,ll;!function(e){e.clampDay=(t,n,r)=>{const o=parseInt(t),i=parseInt(n),a=parseInt(r);return 0==o?"1":ol.includes(i)?Math.min(o,31).toString():il.includes(i)?Math.min(o,30).toString():2===i?e.isLeapYear(a)?Math.min(o,29).toString():Math.min(o,28).toString():t},e.clampMonth=e=>{const t=parseInt(e);return 0==t?"1":t>12?"12":e},e.isLeapYear=e=>e%4==0&&e%100!=0||e%400==0,e.getTimeDiffInMinutes=(e,t,n="HH:mm")=>{const r=M(e,n);return M(t,n).diff(r,"minute")}}(al||(al={})),function(e){e.generate=()=>Math.random().toString(36).substring(2,9)}(sl||(sl={})),function(e){e.transformWithSpaces=(e,t)=>{const n="(.{"+t+"})";return e.replace(/[^\dA-Z]/gi,"").replace(new RegExp(n,"g"),"$1 ").trim()},e.padValue=(e,t)=>{if("0"===e)return t?e:e.padStart(2,"0");if(""===e)return e;return parseInt(e).toString().padStart(2,"0")},e.shouldTruncateToTwoLines=(e,t)=>{const n=Math.floor(t/9);return e.length>=2*n||1===e.split(" ").length&&e.length>n},e.truncateOneLine=(e,t,n,r)=>{let o=0;t>n&&(o=Math.floor((t-n)/8));const i=r+o;if(i<e.length){const t=Math.floor(i/2);return e.substring(0,t)+" ... "+e.substring(e.length-t,e.length)}return e}}(ll||(ll={}));const cl=S.div`
693
+ `,nl=i.forwardRef((({disabledDates:e,onYearMonthDisplayChange:o,onCalendarView:i,onSelect:a,onHover:c,onDismiss:u,actionComponent:d,isOpen:f,value:p,endValue:m,currentFocus:g,withButton:y,variant:b,between:w,type:$="standalone",...S},x)=>{const[_,O]=l(M()),[C,k]=l("default"),[D,j]=l(),[B,P]=l(),[A,E]=l(),[T,I]=l(!0),H=s(null),L=s(null),R=function(e){void 0===e&&(e={});var t=e.skipOnMount,n=void 0!==t&&t,r=e.refreshMode,o=e.refreshRate,i=void 0===o?1e3:o,a=e.refreshOptions,c=e.handleWidth,u=void 0===c||c,d=e.handleHeight,h=void 0===d||d,f=e.targetRef,p=e.observerOptions,m=e.onResize,g=s(n),y=s(null),v=null!=f?f:y,b=s(),w=l({width:void 0,height:void 0}),$=w[0],S=w[1];return xe((function(){if(!we()){var e=Se(m,S,u,h);b.current=ve((function(t){(u||h)&&t.forEach((function(t){var n=t&&t.contentRect||{},r=n.width,o=n.height;!g.current&&!we()&&e({width:r,height:o}),g.current=!1}))}),r,i,a);var t=new window.ResizeObserver(b.current);return v.current&&t.observe(v.current,p),function(){t.disconnect();var e=b.current;e&&e.cancel&&e.cancel()}}}),[r,i,a,u,h,m,p,v.current]),F({ref:v},$)}();v(x,(()=>({defaultView(){k("default"),i("default")}})),[]),h((()=>{f&&(O(M()),k("default"),"range"===b&&p?.length&&m?.length&&I(!1))}),[f]),h((()=>{const e="end"===g?m:p;E(M(e)),e&&O(M(e))}),[g]),h((()=>{I(!0),p?("input"===d&&O(M(p)),j(p),O(M(p))):j(void 0)}),[p]),h((()=>{I(!0),m?("input"===d&&O(M(m)),P(m)):P(void 0)}),[m]);const z=()=>{switch(C){case"default":E((e=>e.subtract(1,"month"))),O((e=>{const t=e.subtract(1,"month");return Z(t),t}));break;case"month-options":O((e=>e.subtract(1,"year")));break;case"year-options":O((e=>e.subtract(10,"year")))}},N=()=>{switch(C){case"default":E((e=>e.add(1,"month"))),O((e=>{const t=e.add(1,"month");return Z(t),t}));break;case"month-options":O((e=>e.add(1,"year")));break;case"year-options":O((e=>e.add(10,"year")))}},V=e=>{const t=e.format("YYYY-MM-DD");O(e),E(e),G(t),Q(t)},Y=e=>{O(e),E(e),Z(e)},W=()=>{O(M("end"===g?m:p)),X("reset")},q=e=>{U(e)},Q=e=>{a&&a(e)},U=e=>{c&&c(e)},Z=e=>{if(o){const t={month:e.month()+1,year:e.year()};o(t)}},X=e=>{u&&u(e)},G=e=>{if(g)switch(g){case"start":default:j(e);break;case"end":P(e)}else j(e)},J=()=>{"month-options"!==C?(k("month-options"),te("month-options"),R.ref.current.focus()):(k("default"),O(A),te("default"))},K=()=>{"default"!==C?(k("default"),O(A),te("default")):(k("year-options"),te("year-options"))},ee=()=>{if("year-options"===C){const{beginDecade:e,endDecade:t}=ho.getStartEndDecade(_);return`${e} to ${t}`}return M(_).format("YYYY")},te=e=>{i&&i(e)},ne=()=>t(r,{children:[t(Zs,{type:"button",tabIndex:-1,$type:$,$expandedDisplay:"month-options"===C,$visible:"default"===C,id:"month-dropdown",onClick:J,children:[n(Xs,{$type:$,children:M(_).format("MMM")}),n(Rs,{})]}),t(Zs,{type:"button",tabIndex:-1,$type:$,$expandedDisplay:"default"!==C,id:"year-dropdown",onClick:K,children:[n(Xs,{$type:$,children:ee()}),n(Rs,{})]})]}),re=()=>{switch(C){case"month-options":return n(as,{type:$,calendarDate:_,currentFocus:g,selectedStartDate:D,selectedEndDate:B,viewCalendarDate:A,between:w,isNewSelection:T,onMonthSelect:Y});case"year-options":return n(us,{type:$,calendarDate:_,currentFocus:g,selectedStartDate:D,selectedEndDate:B,viewCalendarDate:A,between:w,isNewSelection:T,onYearSelect:Y});default:return null}},oe=()=>{switch($){case"standalone":default:return n(Us,{children:ne()});case"input":return t(qs,{children:[n(Qs,{children:ne()}),t(Gs,{children:[n(Js,{tabIndex:-1,onClick:z,children:n(Hs,{})}),n(Js,{tabIndex:-1,onClick:N,children:n(Ls,{})})]})]})}},ie=()=>{if("standalone"===$||!y)return;let e=!0;const r=["default"].includes(C);switch(b){case"single":e=!D;break;case"range":e=!D||!B}const o=!!r&&e;return t(Ks,{children:[n(el,{ref:L,type:"button","data-testid":"cancel-button",styleType:"light",onClick:W,children:"Cancel"}),n(el,{"data-testid":"done-button",type:"button",ref:H,onClick:()=>(e=>{e||(O(A),X("confirmed"))})(o),disabled:o,children:"Done"})]})},ae=()=>t(Ns,{ref:R.ref,tabIndex:-1,"data-id":"calendar-container",$type:$,...S,children:["standalone"===$&&n(tl,{$direction:"left",onClick:z,children:n(Hs,{})}),t(Vs,{children:[oe(),t(Ys,{children:[n(ns,{type:$,calendarDate:_,currentFocus:g,disabledDates:e,selectedStartDate:D,selectedEndDate:B,variant:b,between:w,isNewSelection:T,onSelect:V,onHover:q}),n(Ws,{$visible:"default"!==C,children:re()})]}),ie()]}),"standalone"===$&&n(tl,{$direction:"right",onClick:N,children:n(Ls,{})})]}),se=zr({height:f?R.height+64:0});return"input"===$?n(zs,{style:se,children:ae()}):n(r,{children:ae()})}));var rl;M.extend(ts),function(e){const t=/^\d{4}-\d{2}-\d{2}$/;e.validate=(e,n,r,o)=>{if(!e||!n)return!1;if(M(e).isAfter(n))return!1;if(r&&r.length&&r.some((t=>[e,n].includes(t))))return!1;if(o&&o.length){if(![e,n].every((e=>M(e).isBetween(o[0],o[1],"day","[]"))))return!1;if(!o.every((e=>t.test(e))))return!1}return!0},e.validateSingle=(e,n,r)=>{if(0===e.length)return!1;if(n&&n.length&&n.some((t=>e===t)))return!1;if(r&&r.length&&!M(e).isBetween(r[0],r[1],"day","[]")){if(!M(e).isBetween(r[0],r[1],"day","[]"))return!1;if(!r.every((e=>t.test(e))))return!1}return!0},e.getFormattedRawValue=(e,t)=>{const[n,r,o]=e.split("-"),i=[o,r,n];let a;if(t){const[e,n,r]=t.split("-");a=[r,n,e]}return{start:i,end:a}},e.sleep=(e,t)=>new Promise((n=>{const r=setTimeout(n,e);t.signal.addEventListener("abort",(()=>{clearTimeout(r)}))}))}(rl||(rl={}));const ol=[1,3,5,7,8,10,12],il=[4,6,9,11];var al,sl,ll;!function(e){e.clampDay=(t,n,r)=>{const o=parseInt(t),i=parseInt(n),a=parseInt(r);return 0==o?"1":ol.includes(i)?Math.min(o,31).toString():il.includes(i)?Math.min(o,30).toString():2===i?e.isLeapYear(a)?Math.min(o,29).toString():Math.min(o,28).toString():t},e.clampMonth=e=>{const t=parseInt(e);return 0==t?"1":t>12?"12":e},e.isLeapYear=e=>e%4==0&&e%100!=0||e%400==0,e.getTimeDiffInMinutes=(e,t,n="HH:mm")=>{const r=M(e,n);return M(t,n).diff(r,"minute")}}(al||(al={})),function(e){e.generate=()=>Math.random().toString(36).substring(2,9)}(sl||(sl={})),function(e){e.transformWithSpaces=(e,t)=>{const n="(.{"+t+"})";return e.replace(/[^\dA-Z]/gi,"").replace(new RegExp(n,"g"),"$1 ").trim()},e.padValue=(e,t)=>{if("0"===e)return t?e:e.padStart(2,"0");if(""===e)return e;return parseInt(e).toString().padStart(2,"0")},e.shouldTruncateToTwoLines=(e,t)=>{const n=Math.floor(t/9);return e.length>=2*n||1===e.split(" ").length&&e.length>n},e.truncateOneLine=(e,t,n,r)=>{let o=0;t>n&&(o=Math.floor((t-n)/8));const i=r+o;if(i<e.length){const t=Math.floor(i/2);return e.substring(0,t)+" ... "+e.substring(e.length-t,e.length)}return e}}(ll||(ll={}));const cl=S.div`
694
694
  position: relative;
695
695
  display: flex;
696
696
  align-items: center;