@lifesg/react-design-system 2.0.0-canary.3 → 2.0.0-canary.4

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 (60) hide show
  1. package/README.md +6 -0
  2. package/accordion/accordion.d.ts +1 -1
  3. package/accordion/index.js +1 -1
  4. package/accordion/index.js.map +1 -1
  5. package/accordion/types.d.ts +1 -0
  6. package/cjs/index.js +304 -113
  7. package/cjs/index.js.map +1 -1
  8. package/feedback-rating/index.js +6 -6
  9. package/feedback-rating/index.js.map +1 -1
  10. package/filter/index.js +1 -1
  11. package/filter/index.js.map +1 -1
  12. package/form/index.js +95 -95
  13. package/form/index.js.map +1 -1
  14. package/index.d.ts +1 -0
  15. package/index.js +289 -98
  16. package/index.js.map +1 -1
  17. package/input/index.js +1 -1
  18. package/input/index.js.map +1 -1
  19. package/input-group/index.js +3 -3
  20. package/input-group/index.js.map +1 -1
  21. package/input-multi-select/index.js +2 -2
  22. package/input-multi-select/index.js.map +1 -1
  23. package/input-range-select/index.js +2 -2
  24. package/input-range-select/index.js.map +1 -1
  25. package/input-select/index.js +2 -2
  26. package/input-select/index.js.map +1 -1
  27. package/navbar/index.js +1 -1
  28. package/navbar/index.js.map +1 -1
  29. package/otp-input/index.js +2 -2
  30. package/otp-input/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/pagination/index.js +3 -3
  33. package/pagination/index.js.map +1 -1
  34. package/phone-number-input/index.js +3 -3
  35. package/phone-number-input/index.js.map +1 -1
  36. package/sidenav/index.d.ts +2 -0
  37. package/sidenav/index.js +456 -0
  38. package/sidenav/index.js.map +1 -0
  39. package/sidenav/package.json +7 -0
  40. package/sidenav/sidenav-context.d.ts +15 -0
  41. package/sidenav/sidenav-drawer-item.d.ts +3 -0
  42. package/sidenav/sidenav-drawer-item.styles.d.ts +19 -0
  43. package/sidenav/sidenav-drawer-subitem.d.ts +3 -0
  44. package/sidenav/sidenav-drawer-subitem.styles.d.ts +3 -0
  45. package/sidenav/sidenav-group.d.ts +3 -0
  46. package/sidenav/sidenav-group.styles.d.ts +2 -0
  47. package/sidenav/sidenav-item.d.ts +3 -0
  48. package/sidenav/sidenav-item.styles.d.ts +9 -0
  49. package/sidenav/sidenav.d.ts +8 -0
  50. package/sidenav/sidenav.styles.d.ts +11 -0
  51. package/sidenav/types.d.ts +58 -0
  52. package/smart-app-banner/index.js +1 -1
  53. package/smart-app-banner/index.js.map +1 -1
  54. package/time-range-picker/index.js +2 -2
  55. package/time-range-picker/index.js.map +1 -1
  56. package/timepicker/index.js +6 -6
  57. package/timepicker/index.js.map +1 -1
  58. package/unit-number/index.js +1 -1
  59. package/unit-number/index.js.map +1 -1
  60. package/util/use-event-listener.d.ts +2 -2
package/README.md CHANGED
@@ -68,3 +68,9 @@ import { Button } from "@lifesg/react-design-system";
68
68
  ```
69
69
 
70
70
  To see the full suite of components available, visit our [Storybook documentation](https://designsystem.life.gov.sg/react/index.html?path=/story/getting-started-installation--page).
71
+
72
+ <br />
73
+
74
+ ## Migrations
75
+
76
+ If you are migrating from an older version of the Design System, you may refer to our [migration guides](https://github.com/LifeSG/react-design-system/wiki).
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import { AccordionProps } from "./types";
3
- export declare const Accordion: (({ children, title, enableExpandAll, showTitleInMobile, className, }: AccordionProps) => JSX.Element) & {
3
+ export declare const Accordion: (({ children, title, enableExpandAll, initialDisplay, showTitleInMobile, className, }: AccordionProps) => JSX.Element) & {
4
4
  Item: ({ title, children, expanded, type, ...otherProps }: import("./types").AccordionItemProps) => JSX.Element;
5
5
  };
@@ -353,5 +353,5 @@ import e,{jsx as t,jsxs as n}from"react/jsx-runtime";import*as r from"react";imp
353
353
  padding: 1.75rem 1rem; // larger clickable area
354
354
  margin: -1rem -1rem -1rem 0px;
355
355
  white-space: nowrap;
356
- `,ms=Object.assign((({children:e,title:r,enableExpandAll:i=!0,showTitleInMobile:o=!1,className:a})=>{const[l,c]=s(!0),u=e=>{e.preventDefault(),c((e=>!e))};return t(ri.Provider,{value:l,children:n(hs,{className:a,children:[n(ps,{$hasTitle:!!r||o,children:[r&&t(fs,{$showInMobile:o,"data-testid":"accordion-title",children:r}),i&&t(gs,{"data-testid":"accordion-expand-collapse-button",onClick:u,styleType:"link",type:"button",children:l?"Hide all":"Show all"})]}),e]})})}),{Item:({title:e,children:r,expanded:i=!0,type:o="default",...l})=>{const c=g(ri),[u,h]=s(c||i),p=l["data-testid"]||"accordion-item",f=function(e){void 0===e&&(e={});var t=e.skipOnMount,n=void 0!==t&&t,r=e.refreshMode,i=e.refreshRate,o=void 0===i?1e3:i,l=e.refreshOptions,c=e.handleWidth,u=void 0===c||c,d=e.handleHeight,h=void 0===d||d,p=e.targetRef,f=e.observerOptions,g=e.onResize,m=a(n),y=a(null),v=null!=p?p:y,b=a(),w=s({width:void 0,height:void 0}),_=w[0],S=w[1];return ge((function(){if(!he()){var e=fe(g,S,u,h);b.current=ue((function(t){(u||h)&&t.forEach((function(t){var n=t&&t.contentRect||{},r=n.width,i=n.height;!m.current&&!he()&&e({width:r,height:i}),m.current=!1}))}),r,o,l);var t=new window.ResizeObserver(b.current);return v.current&&t.observe(v.current,f),function(){t.disconnect();var e=b.current;e&&e.cancel&&e.cancel()}}}),[r,o,l,u,h,g,f,v.current]),F({ref:v},_)}(),m=f.ref;d((()=>{h(c)}),[c]),d((()=>{h(i)}),[i]);const y=Pr({height:u?f.height:0});return n(Qa,{"data-testid":p,className:l.className,$isCollapsed:u,children:[n(Ga,{children:[t("small"===o?Ya:Za,{"data-testid":`${p}-title`,$isCollapsed:u,children:e}),t(Ja,{"data-testid":`${p}-expand-collapse-button`,onClick:e=>{e.preventDefault(),h((e=>!e))},$isCollapsed:u,focusHighlight:!1,focusOutline:"browser","aria-label":u?"Collapse":"Expand",children:t(Ka,{})})]}),t(es,{style:y,$isCollapsed:u,"data-testid":`${p}-expandable-container`,children:t(ts,{ref:m,id:"content-container",children:r})})]})}});export{ms as Accordion};
356
+ `,ms=Object.assign((({children:e,title:r,enableExpandAll:i=!0,initialDisplay:o="expand-all",showTitleInMobile:a=!1,className:l})=>{const[c,u]=s("expand-all"===o),d=e=>{e.preventDefault(),u((e=>!e))};return t(ri.Provider,{value:c,children:n(hs,{className:l,children:[n(ps,{$hasTitle:!!r||a,children:[r&&t(fs,{$showInMobile:a,"data-testid":"accordion-title",children:r}),i&&t(gs,{"data-testid":"accordion-expand-collapse-button",onClick:d,styleType:"link",type:"button",children:c?"Hide all":"Show all"})]}),e]})})}),{Item:({title:e,children:r,expanded:i=!0,type:o="default",...l})=>{const c=g(ri),[u,h]=s(c??i),p=l["data-testid"]||"accordion-item",f=function(e){void 0===e&&(e={});var t=e.skipOnMount,n=void 0!==t&&t,r=e.refreshMode,i=e.refreshRate,o=void 0===i?1e3:i,l=e.refreshOptions,c=e.handleWidth,u=void 0===c||c,d=e.handleHeight,h=void 0===d||d,p=e.targetRef,f=e.observerOptions,g=e.onResize,m=a(n),y=a(null),v=null!=p?p:y,b=a(),w=s({width:void 0,height:void 0}),_=w[0],S=w[1];return ge((function(){if(!he()){var e=fe(g,S,u,h);b.current=ue((function(t){(u||h)&&t.forEach((function(t){var n=t&&t.contentRect||{},r=n.width,i=n.height;!m.current&&!he()&&e({width:r,height:i}),m.current=!1}))}),r,o,l);var t=new window.ResizeObserver(b.current);return v.current&&t.observe(v.current,f),function(){t.disconnect();var e=b.current;e&&e.cancel&&e.cancel()}}}),[r,o,l,u,h,g,f,v.current]),F({ref:v},_)}(),m=f.ref;d((()=>{h(i)}),[i]),d((()=>{h(c)}),[c]);const y=Pr({height:u?f.height:0});return n(Qa,{"data-testid":p,className:l.className,$isCollapsed:u,children:[n(Ga,{children:[t("small"===o?Ya:Za,{"data-testid":`${p}-title`,$isCollapsed:u,children:e}),t(Ja,{"data-testid":`${p}-expand-collapse-button`,onClick:e=>{e.preventDefault(),h((e=>!e))},$isCollapsed:u,focusHighlight:!1,focusOutline:"browser","aria-label":u?"Collapse":"Expand",children:t(Ka,{})})]}),t(es,{style:y,$isCollapsed:u,"data-testid":`${p}-expandable-container`,children:t(ts,{ref:m,id:"content-container",children:r})})]})}});export{ms as Accordion};
357
357
  //# sourceMappingURL=index.js.map