@lifesg/react-design-system 1.0.0-alpha.20 → 1.0.0-alpha.22

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 (71) hide show
  1. package/animations/index.d.ts +1 -0
  2. package/animations/index.js +6 -3
  3. package/animations/index.js.map +1 -1
  4. package/animations/loading-dots-spinner/loading-dots-spinner.d.ts +2 -0
  5. package/animations/loading-dots-spinner/lottie-animation.d.ts +2 -0
  6. package/calendar/calendar-day.d.ts +11 -0
  7. package/calendar/calendar-day.style.d.ts +23 -0
  8. package/calendar/calendar-month.d.ts +12 -0
  9. package/calendar/calendar-month.style.d.ts +12 -0
  10. package/calendar/calendar-year.d.ts +12 -0
  11. package/calendar/calendar-year.style.d.ts +12 -0
  12. package/calendar/calendar.d.ts +4 -0
  13. package/calendar/calendar.style.d.ts +35 -0
  14. package/calendar/index.d.ts +2 -0
  15. package/calendar/index.js +381 -0
  16. package/calendar/index.js.map +1 -0
  17. package/calendar/package.json +7 -0
  18. package/calendar/types.d.ts +15 -0
  19. package/cjs/index.js +451 -221
  20. package/cjs/index.js.map +1 -1
  21. package/date-input/index.js +115 -115
  22. package/date-input/index.js.map +1 -1
  23. package/error-display/index.js +1 -0
  24. package/error-display/index.js.map +1 -1
  25. package/form/index.js +440 -471
  26. package/form/index.js.map +1 -1
  27. package/index.d.ts +2 -0
  28. package/index.js +486 -256
  29. package/index.js.map +1 -1
  30. package/input/index.js +71 -70
  31. package/input/index.js.map +1 -1
  32. package/input/input.style.d.ts +3 -7
  33. package/input-group/index.js +375 -363
  34. package/input-group/index.js.map +1 -1
  35. package/input-group/input-group-list-addon.d.ts +1 -1
  36. package/input-group/input-group-list-addon.style.d.ts +9 -1
  37. package/input-group/input-group.style.d.ts +4 -7
  38. package/input-group/types.d.ts +3 -2
  39. package/input-select/index.js +10 -4
  40. package/input-select/index.js.map +1 -1
  41. package/modal/index.js +1 -1
  42. package/modal/index.js.map +1 -1
  43. package/navbar/index.js +1 -1
  44. package/navbar/index.js.map +1 -1
  45. package/otp-input/index.d.ts +2 -0
  46. package/otp-input/index.js +600 -0
  47. package/otp-input/index.js.map +1 -0
  48. package/otp-input/otp-input.d.ts +3 -0
  49. package/otp-input/otp-input.styles.d.ts +5 -0
  50. package/otp-input/package.json +7 -0
  51. package/otp-input/types.d.ts +22 -0
  52. package/overlay/index.js +1 -1
  53. package/overlay/index.js.map +1 -1
  54. package/package.json +1 -1
  55. package/phone-number-input/index.d.ts +1 -0
  56. package/phone-number-input/index.js +375 -365
  57. package/phone-number-input/index.js.map +1 -1
  58. package/phone-number-input/phone-number-input-helper.d.ts +2 -2
  59. package/phone-number-input/phone-number-input.d.ts +1 -1
  60. package/phone-number-input/types.d.ts +9 -0
  61. package/popover/index.js +1 -1
  62. package/popover/index.js.map +1 -1
  63. package/shared/dropdown-list/dropdown-list.d.ts +1 -1
  64. package/shared/dropdown-list/types.d.ts +1 -0
  65. package/shared/input-wrapper/input-wrapper.d.ts +8 -0
  66. package/unit-number/index.js +256 -302
  67. package/unit-number/index.js.map +1 -1
  68. package/unit-number/unit-number-input.style.d.ts +7 -12
  69. package/util/calendar-helper.d.ts +10 -0
  70. package/util/index.d.ts +1 -0
  71. package/phone-number-input/phone-number-input.styles.d.ts +0 -1
@@ -1,5 +1,5 @@
1
1
  import { CountryValue } from "./types";
2
2
  export declare namespace PhoneNumberInputHelper {
3
- const getCountries: CountryValue[];
4
- const formatNumber: (text: string, country: CountryValue | undefined) => string;
3
+ const getCountries: () => CountryValue[];
4
+ const formatNumber: (numberText?: string, country?: CountryValue) => string;
5
5
  }
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import { PhoneNumberInputProps } from "./types";
3
- export declare const PhoneNumberInput: ({ onChange, value, allowClear, onClear, error, optionPlaceholder, optionSearchPlaceholder, enableSearch, onHideOptions, onShowOptions, placeholder, ...otherProps }: PhoneNumberInputProps) => JSX.Element;
3
+ export declare const PhoneNumberInput: ({ onChange, value, allowClear, onClear, onBlur, error, fixedCountry, optionPlaceholder, optionSearchPlaceholder, enableSearch, onHideOptions, onShowOptions, placeholder, ...otherProps }: PhoneNumberInputProps) => JSX.Element;
@@ -15,14 +15,23 @@ export interface PhoneNumberInputValue {
15
15
  number?: string | undefined;
16
16
  }
17
17
  export interface PhoneNumberInputProps extends React.AriaAttributes {
18
+ /** The value of the input */
18
19
  value?: PhoneNumberInputValue | undefined;
19
20
  error?: boolean | undefined;
20
21
  /** Specifies if the clear button should be present in the input */
21
22
  allowClear?: boolean | undefined;
22
23
  "data-testid"?: string | undefined;
24
+ className?: string | undefined;
25
+ /**
26
+ * Specifies if the country code is a fixed value and the user
27
+ * cannot select another option
28
+ */
29
+ fixedCountry?: boolean | undefined;
23
30
  onChange?: ((value: PhoneNumberInputValue) => void) | undefined;
24
31
  /** Called when the clear button in the input field is clicked */
25
32
  onClear?: () => void | undefined;
33
+ /** Called when a defocus happens */
34
+ onBlur?: (() => void) | undefined;
26
35
  /** The placeholder value for the dropdown selector */
27
36
  optionPlaceholder?: string | undefined;
28
37
  /** The placeholder value for the dropdown search */
package/popover/index.js CHANGED
@@ -229,7 +229,7 @@ var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.pr
229
229
  `,e.$disableTransition&&(t+=s`
230
230
  transition: none;
231
231
  `),t}}
232
- `,bn=({show:e=!1,rootId:t,onOverlayClick:r,children:c,backgroundOpacity:s,backgroundBlur:d=!0,disableTransition:f=!1,enableOverlayClick:p=!1,zIndex:h,id:y})=>{const[m,g]=i(null),[v,b]=i(),w=a(),S=a(null),x=c&&o.cloneElement(c,{ref:S}),$=y?`lifesg-ds-overlay-root-${y}`:"lifesg-ds-overlay-root";l((()=>{if(e){const e=O();if(_(e),!e){const e=setTimeout((()=>{C("add")}),200);return()=>clearTimeout(e)}}else if(!w.current){const e=setTimeout((()=>{C("remove")}),200);return()=>clearTimeout(e)}}),[e]),l((()=>{g(F());const e=O();return _(e),e||j(),()=>{C("remove")}}),[]);const _=e=>{w.current=e,b(e)},F=()=>document&&t?document.getElementById(t):document?document.body:null,O=()=>document.body.classList.contains(Sn),j=()=>{if(!document.getElementById(wn)){const e=document.createElement("style");e.id=wn;const t=document.documentElement.clientWidth,n=window.innerWidth-t;e.innerHTML=`\n\t\t\t\t.${Sn} {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding-right: ${n}px !important;\n\t\t\t\t\t-ms-overflow-style: none;\n\t\t\t\t\tscrollbar-width: none;\n\t\t\t\t}\n\n\t\t\t\t.${Sn}::-webkit-scrollbar {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t`,document.body.appendChild(e)}},C=e=>{const t=document.body.classList.contains(Sn);"add"!==e||t?"remove"===e&&t&&document.body.classList.remove(Sn):document.body.classList.add(Sn)},H=e=>{e.preventDefault();const t=S.current?.firstChild;t&&t.contains(e.target)||r&&p&&r()};return m?u.createPortal(n(gn,{id:$,"data-testid":$,$show:e,zIndex:h,$stacked:v,children:c&&n(vn,{"data-testid":"overlay-wrapper",$show:e,$backgroundOpacity:s||(v?.5:.8),$backgroundBlur:d,$disableTransition:f,$enableOverlayClick:p,onClick:H,children:x})}),m):null},wn="lifesg-ds-overlay-stylesheet",Sn="lifesg-ds-overlay-open",xn=e=>Object.keys(h).reduce(((t,n)=>{const r=h[n];return t[n]=`@media screen and (${e}: ${r}px)`,t}),{}),$n=xn("max-width"),_n=(xn("min-width"),c.div`
232
+ `,bn=({show:e=!1,rootId:t,onOverlayClick:r,children:c,backgroundOpacity:s,backgroundBlur:d=!0,disableTransition:f=!1,enableOverlayClick:p=!1,zIndex:h,id:y})=>{const[m,g]=i(null),[v,b]=i(),w=a(),S=a(null),x=c&&o.cloneElement(c,{ref:S}),$=y?`lifesg-ds-overlay-root-${y}`:"lifesg-ds-overlay-root";l((()=>{if(e){const e=O();if(_(e),!e){const e=setTimeout((()=>{C("add")}),200);return()=>clearTimeout(e)}}else if(!w.current){const e=setTimeout((()=>{C("remove")}),200);return()=>clearTimeout(e)}}),[e]),l((()=>{g(F());const e=O();return _(e),e||j(),()=>{C("remove")}}),[]);const _=e=>{w.current=e,b(e)},F=()=>document&&t?document.getElementById(t):document?document.body:null,O=()=>document.body.classList.contains(Sn),j=()=>{if(!document.getElementById(wn)){const e=document.createElement("style");e.id=wn;const t=document.documentElement.clientWidth,n=window.innerWidth-t;e.innerHTML=`\n\t\t\t\t.${Sn} {\n\t\t\t\t\toverflow: hidden;\n\t\t\t\t\tpadding-right: ${n}px !important;\n\t\t\t\t\t-ms-overflow-style: none;\n\t\t\t\t\tscrollbar-width: none;\n\t\t\t\t}\n\n\t\t\t\t.${Sn}::-webkit-scrollbar {\n\t\t\t\t\tdisplay: none;\n\t\t\t\t}\n\t\t\t`,document.body.appendChild(e)}},C=e=>{const t=document.body.classList.contains(Sn);"add"!==e||t?"remove"===e&&t&&document.body.classList.remove(Sn):document.body.classList.add(Sn)},H=e=>{const t=S.current?.firstChild;t&&t.contains(e.target)||r&&p&&(e.preventDefault(),r())};return m?u.createPortal(n(gn,{id:$,"data-testid":$,$show:e,zIndex:h,$stacked:v,children:c&&n(vn,{"data-testid":"overlay-wrapper",$show:e,$backgroundOpacity:s||(v?.5:.8),$backgroundBlur:d,$disableTransition:f,$enableOverlayClick:p,onClick:H,children:x})}),m):null},wn="lifesg-ds-overlay-stylesheet",Sn="lifesg-ds-overlay-open",xn=e=>Object.keys(h).reduce(((t,n)=>{const r=h[n];return t[n]=`@media screen and (${e}: ${r}px)`,t}),{}),$n=xn("max-width"),_n=(xn("min-width"),c.div`
233
233
  position: relative;
234
234
  display: flex;
235
235
  justify-content: center;