@lifesg/react-design-system 1.0.0-alpha.4 → 1.0.0-alpha.5

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 (151) hide show
  1. package/accordion/index.css +1 -0
  2. package/accordion/index.js +70 -73
  3. package/accordion/index.js.map +1 -1
  4. package/alert/index.css +1 -0
  5. package/alert/index.js +48 -51
  6. package/alert/index.js.map +1 -1
  7. package/animations/index.css +1 -0
  8. package/box-container/index.css +1 -0
  9. package/box-container/index.js +58 -61
  10. package/box-container/index.js.map +1 -1
  11. package/breadcrumb/index.css +1 -0
  12. package/breadcrumb/index.js +52 -55
  13. package/breadcrumb/index.js.map +1 -1
  14. package/button/index.css +1 -0
  15. package/button/index.js +48 -51
  16. package/button/index.js.map +1 -1
  17. package/checkbox/index.css +1 -0
  18. package/checkbox/index.js +5 -8
  19. package/checkbox/index.js.map +1 -1
  20. package/cjs/index.css +1 -0
  21. package/cjs/index.js +675 -81
  22. package/cjs/index.js.map +1 -1
  23. package/color/index.css +1 -0
  24. package/color/index.js.map +1 -1
  25. package/date-input/index.css +1 -0
  26. package/date-input/index.js +53 -68
  27. package/date-input/index.js.map +1 -1
  28. package/footer/footer-download-app.d.ts +2 -0
  29. package/footer/footer-download-app.style.d.ts +6 -0
  30. package/footer/footer-helper.d.ts +12 -0
  31. package/footer/footer.d.ts +3 -0
  32. package/footer/footer.style.d.ts +12 -0
  33. package/footer/index.css +1 -0
  34. package/footer/index.d.ts +2 -0
  35. package/footer/index.js +361 -0
  36. package/footer/index.js.map +1 -0
  37. package/footer/package.json +7 -0
  38. package/footer/types.d.ts +31 -0
  39. package/form/form-label.d.ts +1 -1
  40. package/form/form-label.style.d.ts +1 -0
  41. package/form/index.css +1 -0
  42. package/form/index.d.ts +1 -1
  43. package/form/index.js +194 -191
  44. package/form/index.js.map +1 -1
  45. package/form/types.d.ts +2 -0
  46. package/icon/cross-icon.d.ts +3 -0
  47. package/icon/index.css +1 -0
  48. package/icon/index.js +3 -6
  49. package/icon/index.js.map +1 -1
  50. package/icon/play-icon.d.ts +3 -0
  51. package/icon-button/index.css +1 -0
  52. package/icon-button/index.js +7 -10
  53. package/icon-button/index.js.map +1 -1
  54. package/index.css +1 -0
  55. package/index.d.ts +5 -0
  56. package/index.js +676 -82
  57. package/index.js.map +1 -1
  58. package/input/index.css +1 -0
  59. package/input/index.js +15 -3
  60. package/input/index.js.map +1 -1
  61. package/input/input.style.d.ts +2 -0
  62. package/input-group/index.css +1 -0
  63. package/input-group/index.js +128 -119
  64. package/input-group/index.js.map +1 -1
  65. package/input-group/input-group.style.d.ts +1 -0
  66. package/input-select/index.css +1 -0
  67. package/input-select/index.js +98 -104
  68. package/input-select/index.js.map +1 -1
  69. package/input-textarea/index.css +1 -0
  70. package/input-textarea/index.js +118 -111
  71. package/input-textarea/index.js.map +1 -1
  72. package/input-textarea/textarea-counter.d.ts +2 -1
  73. package/input-textarea/types.d.ts +1 -0
  74. package/layout/container.d.ts +3 -0
  75. package/layout/content.d.ts +3 -0
  76. package/layout/index.css +1 -0
  77. package/layout/index.d.ts +7 -0
  78. package/layout/index.js +51 -0
  79. package/layout/index.js.map +1 -0
  80. package/layout/package.json +7 -0
  81. package/layout/section.d.ts +3 -0
  82. package/layout/types.d.ts +15 -0
  83. package/link-list/index.css +1 -0
  84. package/link-list/index.js +55 -58
  85. package/link-list/index.js.map +1 -1
  86. package/masonry/index.css +1 -0
  87. package/masthead/index.css +1 -0
  88. package/masthead/index.d.ts +1 -0
  89. package/masthead/index.js +5 -0
  90. package/masthead/index.js.map +1 -0
  91. package/masthead/masthead.d.ts +3 -0
  92. package/masthead/package.json +7 -0
  93. package/media/index.css +1 -0
  94. package/modal/index.css +1 -0
  95. package/modal/index.js +12 -15
  96. package/modal/index.js.map +1 -1
  97. package/navbar/brand.d.ts +10 -0
  98. package/navbar/brand.styles.d.ts +5 -0
  99. package/navbar/drawer.d.ts +3 -0
  100. package/navbar/drawer.styles.d.ts +12 -0
  101. package/navbar/index.css +1 -0
  102. package/navbar/index.d.ts +6 -0
  103. package/navbar/index.js +659 -0
  104. package/navbar/index.js.map +1 -0
  105. package/navbar/navbar-action-buttons.d.ts +10 -0
  106. package/navbar/navbar-action-buttons.styles.d.ts +9 -0
  107. package/navbar/navbar-items.d.ts +11 -0
  108. package/navbar/navbar-items.styles.d.ts +10 -0
  109. package/navbar/navbar.d.ts +3 -0
  110. package/navbar/navbar.styles.d.ts +14 -0
  111. package/navbar/package.json +7 -0
  112. package/navbar/types.d.ts +56 -0
  113. package/notification-banner/index.css +1 -0
  114. package/notification-banner/index.d.ts +3 -0
  115. package/notification-banner/index.js +262 -0
  116. package/notification-banner/index.js.map +1 -0
  117. package/notification-banner/notification-banner-hoc.d.ts +3 -0
  118. package/notification-banner/notification-banner-label.d.ts +3 -0
  119. package/notification-banner/notification-banner.d.ts +6 -0
  120. package/notification-banner/notification-banner.styles.d.ts +12 -0
  121. package/notification-banner/package.json +7 -0
  122. package/notification-banner/types.d.ts +22 -0
  123. package/overlay/index.css +1 -0
  124. package/package.json +1 -1
  125. package/popover/index.css +1 -0
  126. package/popover/index.js +55 -58
  127. package/popover/index.js.map +1 -1
  128. package/radio-button/index.css +1 -0
  129. package/radio-button/index.js.map +1 -1
  130. package/text/index.css +1 -0
  131. package/text/index.js +25 -28
  132. package/text/index.js.map +1 -1
  133. package/text-list/index.css +1 -0
  134. package/text-list/index.js.map +1 -1
  135. package/theme/index.css +1 -0
  136. package/theme/index.js.map +1 -1
  137. package/theme/types.d.ts +2 -2
  138. package/timeline/index.css +1 -0
  139. package/timeline/index.js +52 -55
  140. package/timeline/index.js.map +1 -1
  141. package/timepicker/index.css +1 -0
  142. package/timepicker/index.js +88 -91
  143. package/timepicker/index.js.map +1 -1
  144. package/toggle-button/index.css +1 -0
  145. package/toggle-button/index.js +110 -113
  146. package/toggle-button/index.js.map +1 -1
  147. package/tooltip/index.css +1 -0
  148. package/tooltip/index.js +51 -54
  149. package/tooltip/index.js.map +1 -1
  150. package/transition/index.css +1 -0
  151. package/icon/play-alt-icon.d.ts +0 -3
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { ContentProps } from "./types";
3
+ export declare const Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1 @@
1
+ :root{--sgds-masthead-font-family:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--sgds-masthead-background-color:hsl(0, 0%, 94%);--sgds-masthead-text-color:hsl(0, 0%, 28%);--sgds-masthead-link-color:hsl(220, 100%, 47%);--sgds-masthead-link-hover-color:hsl(220, 100%, 37%);--sgds-masthead-tablet-padding-x:1.25rem;--sgds-masthead-tablet-font-size:0.75rem;--sgds-masthead-crest-color:rgb(239, 51, 32)}
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ export declare const Layout: {
3
+ Section: import("react").ForwardRefExoticComponent<import("./types").SectionProps & import("react").RefAttributes<HTMLDivElement>>;
4
+ Container: import("react").ForwardRefExoticComponent<import("./types").ContainerProps & import("react").RefAttributes<HTMLDivElement>>;
5
+ Content: import("react").ForwardRefExoticComponent<import("./types").ContentProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ };
7
+ export * from "./types";
@@ -0,0 +1,51 @@
1
+ import{jsx as t}from"react/jsx-runtime";import e from"react";import i,{css as a}from"styled-components";const r={mobileS:320,mobileM:375,mobileL:480,tablet:1199,desktopM:1399,desktopL:1999,desktop4k:3840},d=t=>Object.keys(r).reduce(((e,i)=>{const a=r[i];return e[i]=`@media screen and (${t}: ${a}px)`,e}),{}),n=d("max-width"),o=(d("min-width"),e.forwardRef(((e,i)=>{const{children:a,"data-testid":r="container",type:d="flex",...n}=e;return t(m,{ref:i,"data-testid":r,type:d,...n,children:a})}))),m=i.div`
2
+ flex-grow: 1;
3
+ margin: 0 auto;
4
+ position: relative;
5
+ width: auto;
6
+
7
+ /* Max width restrictions */
8
+ max-width: 1344px;
9
+
10
+ ${n.desktopM} {
11
+ max-width: 1152px;
12
+ }
13
+
14
+ ${n.tablet} {
15
+ max-width: 960px;
16
+ }
17
+
18
+ ${n.mobileL} {
19
+ width: 100%;
20
+ max-width: unset;
21
+ }
22
+
23
+ ${t=>"grid"===t.type?a`
24
+ column-gap: 2rem;
25
+ display: grid;
26
+ grid-template-columns: repeat(12, minmax(0, 1fr));
27
+ height: auto;
28
+
29
+ ${n.tablet} {
30
+ column-gap: 1.5rem;
31
+ grid-template-columns: repeat(8, minmax(0, 1fr));
32
+ }
33
+
34
+ ${n.mobileL} {
35
+ column-gap: 1rem;
36
+ grid-template-columns: repeat(4, minmax(0, 1fr));
37
+ }
38
+ `:a`
39
+ display: flex;
40
+ height: auto;
41
+ `}
42
+ `,l=e.forwardRef(((e,i)=>{const{children:a,"data-testid":r="section",...d}=e;return t(s,{ref:i,"data-testid":r,...d,children:a})})),s=i.section`
43
+ display: block;
44
+ position: relative;
45
+ padding: 0 1.5rem;
46
+
47
+ // Extra enforcement
48
+ padding-left: 1.5rem !important;
49
+ padding-right: 1.5rem !important;
50
+ `,p=e.forwardRef(((e,i)=>{const{children:a,"data-testid":r="content",className:d,type:n="flex",...m}=e;return t(l,{ref:i,"data-testid":r,className:d,...m,children:t(o,{"data-testid":`${r}-container`,type:n,"data-id":"container",children:a})})})),c={Section:l,Container:o,Content:p};export{c as Layout};
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/spec/media-spec.ts","../../src/media/media.ts","../../src/layout/container.tsx","../../src/layout/section.tsx","../../src/layout/content.tsx","../../src/layout/index.ts"],"sourcesContent":["import { MediaWidth } from \"../media/types\";\n\nexport const MediaWidths: MediaWidth = {\n mobileS: 320,\n mobileM: 375,\n mobileL: 480,\n tablet: 1199,\n desktopM: 1399,\n desktopL: 1999,\n desktop4k: 3840,\n};\n","import { MediaWidths as MediaWidthsSpec } from \"../spec/media-spec\";\nimport { MediaType, MediaWidth } from \"./types\";\n\n// =============================================================================\n// HELPER FUNCTION\n// =============================================================================\nconst getMediaQuerySpec = (type: \"max-width\" | \"min-width\") => {\n return Object.keys(MediaWidthsSpec).reduce((accumulator, key) => {\n const mediaWidth = MediaWidthsSpec[key as keyof MediaWidth];\n accumulator[\n key as keyof MediaType\n ] = `@media screen and (${type}: ${mediaWidth}px)`;\n\n return accumulator;\n }, {} as MediaType);\n};\n\n// =============================================================================\n// EXPORTS\n// =============================================================================\nexport const MediaQuery = {\n MaxWidth: getMediaQuerySpec(\"max-width\"),\n MinWidth: getMediaQuerySpec(\"min-width\"),\n};\n\nexport const MediaWidths = MediaWidthsSpec;\n","import React from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { MediaQuery } from \"../media/media\";\nimport { ContainerProps, ContainerType, DivRef } from \"./types\";\n\nconst Component = (props: ContainerProps, ref: DivRef): JSX.Element => {\n const {\n children,\n \"data-testid\": testId = \"container\",\n type = \"flex\",\n ...otherProps\n } = props;\n\n return (\n <StyledContainer\n ref={ref}\n data-testid={testId}\n type={type}\n {...otherProps}\n >\n {children}\n </StyledContainer>\n );\n};\n\n// =============================================================================\n// EXPORT\n// =============================================================================\nexport const Container = React.forwardRef(Component);\n\n// =============================================================================\n// STYLING\n// =============================================================================\ninterface StyleProps {\n type: ContainerType;\n}\n\nconst StyledContainer = styled.div<StyleProps>`\n flex-grow: 1;\n margin: 0 auto;\n position: relative;\n width: auto;\n\n /* Max width restrictions */\n max-width: 1344px;\n\n ${MediaQuery.MaxWidth.desktopM} {\n max-width: 1152px;\n }\n\n ${MediaQuery.MaxWidth.tablet} {\n max-width: 960px;\n }\n\n ${MediaQuery.MaxWidth.mobileL} {\n width: 100%;\n max-width: unset;\n }\n\n ${(props) => {\n switch (props.type) {\n case \"grid\":\n return css`\n column-gap: 2rem;\n display: grid;\n grid-template-columns: repeat(12, minmax(0, 1fr));\n height: auto;\n\n ${MediaQuery.MaxWidth.tablet} {\n column-gap: 1.5rem;\n grid-template-columns: repeat(8, minmax(0, 1fr));\n }\n\n ${MediaQuery.MaxWidth.mobileL} {\n column-gap: 1rem;\n grid-template-columns: repeat(4, minmax(0, 1fr));\n }\n `;\n case \"flex\":\n default:\n return css`\n display: flex;\n height: auto;\n `;\n }\n }}\n`;\n","import React from \"react\";\nimport styled from \"styled-components\";\nimport { DivRef, SectionProps } from \"./types\";\n\nconst Component = (props: SectionProps, ref: DivRef): JSX.Element => {\n const {\n children,\n \"data-testid\": testId = \"section\",\n ...otherProps\n } = props;\n\n return (\n <StyledSection ref={ref} data-testid={testId} {...otherProps}>\n {children}\n </StyledSection>\n );\n};\n\n// =============================================================================\n// EXPORT\n// =============================================================================\nexport const Section = React.forwardRef(Component);\n\n// =============================================================================\n// STYLING\n// =============================================================================\nconst StyledSection = styled.section`\n display: block;\n position: relative;\n padding: 0 1.5rem;\n\n // Extra enforcement\n padding-left: 1.5rem !important;\n padding-right: 1.5rem !important;\n`;\n","import React from \"react\";\nimport { Container } from \"./container\";\nimport { Section } from \"./section\";\nimport { ContentProps, DivRef } from \"./types\";\n\nconst Component = (props: ContentProps, ref: DivRef): JSX.Element => {\n const {\n children,\n \"data-testid\": testId = \"content\",\n className,\n type = \"flex\",\n ...otherProps\n } = props;\n\n return (\n <Section\n ref={ref}\n data-testid={testId}\n className={className}\n {...otherProps}\n >\n <Container\n data-testid={`${testId}-container`}\n type={type}\n data-id=\"container\"\n >\n {children}\n </Container>\n </Section>\n );\n};\n\n// =============================================================================\n// EXPORT\n// =============================================================================\nexport const Content = React.forwardRef(Component);\n","import { Container } from \"./container\";\nimport { Content } from \"./content\";\nimport { Section } from \"./section\";\n\nexport const Layout = {\n Section,\n Container,\n Content,\n};\n\nexport * from \"./types\";\n"],"names":["MediaWidths","mobileS","mobileM","mobileL","tablet","desktopM","desktopL","desktop4k","getMediaQuerySpec","type","Object","keys","MediaWidthsSpec","reduce","accumulator","key","mediaWidth","MediaQuery","Container","React","forwardRef","props","ref","children","testId","otherProps","_jsx","StyledContainer","styled","div","css","Section","StyledSection","section","Content","className","Layout"],"mappings":"wGAEO,MAAMA,EAA0B,CACnCC,QAAS,IACTC,QAAS,IACTC,QAAS,IACTC,OAAQ,KACRC,SAAU,KACVC,SAAU,KACVC,UAAW,MCHTC,EAAqBC,GAChBC,OAAOC,KAAKC,GAAiBC,QAAO,CAACC,EAAaC,KACrD,MAAMC,EAAaJ,EAAgBG,GAKnC,OAJAD,EACIC,GACA,sBAAsBN,MAASO,OAE5BF,IACR,IAMMG,EACCT,EAAkB,aCOnBU,GDNCV,EAAkB,aCMPW,EAAMC,YAvBb,CAACC,EAAuBC,KACtC,MAAMC,SACFA,EACA,cAAeC,EAAS,YAAWf,KACnCA,EAAO,UACJgB,GACHJ,EAEJ,OACIK,EAACC,GACGL,IAAKA,EACQ,cAAAE,EACbf,KAAMA,KACFgB,WAEHF,QAiBPI,EAAkBC,EAAOC,GAAe;;;;;;;;;MASxCZ,EAAoBZ;;;;MAIpBY,EAAoBb;;;;MAIpBa,EAAoBd;;;;;MAKnBkB,GAEU,SADDA,EAAMZ,KAECqB,CAAG;;;;;;sBAMJb,EAAoBb;;;;;sBAKpBa,EAAoBd;;;;kBAOnB2B,CAAG;;;;EC3DbC,EAAUZ,EAAMC,YAjBX,CAACC,EAAqBC,KACpC,MAAMC,SACFA,EACA,cAAeC,EAAS,aACrBC,GACHJ,EAEJ,OACIK,EAACM,EAAa,CAACV,IAAKA,EAAkB,cAAAE,KAAYC,EAAUF,SACvDA,OAaPS,EAAgBJ,EAAOK,OAAO;;;;;;;;ECSvBC,EAAUf,EAAMC,YA9BX,CAACC,EAAqBC,KACpC,MAAMC,SACFA,EACA,cAAeC,EAAS,UAASW,UACjCA,EAAS1B,KACTA,EAAO,UACJgB,GACHJ,EAEJ,OACIK,EAACK,EAAO,CACJT,IAAKA,EACQ,cAAAE,EACbW,UAAWA,KACPV,EAAUF,SAEdG,EAACR,EACgB,CAAA,cAAA,GAAGM,cAChBf,KAAMA,EAAI,UACF,YAEPc,SAAAA,SCtBJa,EAAS,CAClBL,UACAb,YACAgB"}
@@ -0,0 +1,7 @@
1
+ {
2
+ "name": "@lifesg/react-design-system/layout",
3
+ "private": true,
4
+ "main": "../cjs/index.js",
5
+ "module": "./index.js",
6
+ "types": "./index.d.ts"
7
+ }
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { SectionProps } from "./types";
3
+ export declare const Section: React.ForwardRefExoticComponent<SectionProps & React.RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ export interface CommonLayoutProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ children: React.ReactNode;
4
+ "data-testid"?: string | undefined;
5
+ }
6
+ export interface SectionProps extends CommonLayoutProps {
7
+ }
8
+ export declare type ContainerType = "flex" | "grid";
9
+ export interface ContainerProps extends CommonLayoutProps {
10
+ /** The type of display style. Values: "flex" | "grid" */
11
+ type?: ContainerType | undefined;
12
+ }
13
+ export interface ContentProps extends ContainerProps {
14
+ }
15
+ export declare type DivRef = React.Ref<HTMLDivElement>;
@@ -0,0 +1 @@
1
+ :root{--sgds-masthead-font-family:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--sgds-masthead-background-color:hsl(0, 0%, 94%);--sgds-masthead-text-color:hsl(0, 0%, 28%);--sgds-masthead-link-color:hsl(220, 100%, 47%);--sgds-masthead-link-hover-color:hsl(220, 100%, 37%);--sgds-masthead-tablet-padding-x:1.25rem;--sgds-masthead-tablet-font-size:0.75rem;--sgds-masthead-crest-color:rgb(239, 51, 32)}