@govtechsg/sgds-web-component 0.0.10 → 0.0.12

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 (338) hide show
  1. package/README.md +102 -10
  2. package/base/card-element.d.ts +12 -0
  3. package/{lib/utils → base}/dropdown-element.d.ts +38 -37
  4. package/{lib/utils → base}/link-element.d.ts +8 -7
  5. package/{lib/utils → base}/sgds-element.d.ts +6 -5
  6. package/components/Accordion/index.d.ts +2 -0
  7. package/components/Accordion/sgds-accordion-item.d.ts +40 -0
  8. package/components/Accordion/sgds-accordion.d.ts +19 -0
  9. package/components/ActionCard/index.d.ts +1 -0
  10. package/{lib/Card → components/ActionCard}/sgds-action-card.d.ts +21 -20
  11. package/components/Alert/index.d.ts +1 -0
  12. package/components/Alert/sgds-alert.d.ts +37 -0
  13. package/components/Badge/index.d.ts +1 -0
  14. package/components/Badge/sgds-badge.d.ts +10 -0
  15. package/components/Breadcrumb/index.d.ts +2 -0
  16. package/components/Breadcrumb/sgds-breadcrumb-item.d.ts +10 -0
  17. package/components/Breadcrumb/sgds-breadcrumb.d.ts +12 -0
  18. package/components/Button/index.d.ts +1 -0
  19. package/{lib → components}/Button/sgds-button.d.ts +55 -48
  20. package/components/Checkbox/index.d.ts +1 -0
  21. package/{lib → components}/Checkbox/sgds-checkbox.d.ts +36 -36
  22. package/components/CloseButton/index.d.ts +1 -0
  23. package/components/CloseButton/sgds-closebutton.d.ts +9 -0
  24. package/components/Dropdown/index.d.ts +3 -0
  25. package/{lib → components}/Dropdown/sgds-dropdown-item.d.ts +8 -7
  26. package/{lib → components}/Dropdown/sgds-dropdown.d.ts +8 -7
  27. package/components/FileUpload/index.d.ts +1 -0
  28. package/components/FileUpload/sgds-fileupload.d.ts +22 -0
  29. package/components/Footer/index.d.ts +1 -0
  30. package/{lib → components}/Footer/sgds-footer.d.ts +27 -23
  31. package/components/Input/index.d.ts +1 -0
  32. package/{lib → components}/Input/sgds-input.d.ts +42 -42
  33. package/components/Mainnav/index.d.ts +3 -0
  34. package/components/Mainnav/sgds-mainnav-dropdown.d.ts +6 -0
  35. package/components/Mainnav/sgds-mainnav-item.d.ts +8 -0
  36. package/{lib → components}/Mainnav/sgds-mainnav.d.ts +26 -22
  37. package/components/Masthead/index.d.ts +1 -0
  38. package/{lib → components}/Masthead/sgds-masthead.d.ts +9 -12
  39. package/components/Modal/index.d.ts +1 -0
  40. package/{lib → components}/Modal/sgds-modal.d.ts +28 -28
  41. package/components/QuantityToggle/index.d.ts +1 -0
  42. package/{lib/QuantityToggle/sgds-quantitytoggle.d.ts → components/QuantityToggle/sgds-quantity-toggle.d.ts} +30 -30
  43. package/components/Radio/index.d.ts +2 -0
  44. package/{lib/Radio/sgds-radiogroup.d.ts → components/Radio/sgds-radio-group.d.ts} +41 -41
  45. package/{lib → components}/Radio/sgds-radio.d.ts +31 -31
  46. package/components/Sidenav/index.d.ts +3 -0
  47. package/{lib → components}/Sidenav/sgds-sidenav-item.d.ts +36 -28
  48. package/components/Sidenav/sgds-sidenav-link.d.ts +8 -0
  49. package/{lib → components}/Sidenav/sgds-sidenav.d.ts +10 -6
  50. package/components/Stepper/index.d.ts +1 -0
  51. package/components/Stepper/sgds-stepper.d.ts +17 -0
  52. package/components/Tab/index.d.ts +3 -0
  53. package/{lib → components}/Tab/sgds-tab.d.ts +27 -26
  54. package/{lib → components}/Tab/sgds-tabgroup.d.ts +48 -47
  55. package/{lib → components}/Tab/sgds-tabpanel.d.ts +26 -25
  56. package/components/Table/index.d.ts +1 -0
  57. package/components/Table/sgds-table.d.ts +26 -0
  58. package/components/Textarea/index.d.ts +1 -0
  59. package/{lib → components}/Textarea/sgds-textarea.d.ts +53 -53
  60. package/components/Toast/index.d.ts +1 -0
  61. package/components/Toast/sgds-toast.d.ts +22 -0
  62. package/components/Tooltip/index.d.ts +1 -0
  63. package/components/Tooltip/sgds-tooltip.d.ts +30 -0
  64. package/index.d.ts +23 -0
  65. package/index.js +11543 -0
  66. package/index.js.map +1 -0
  67. package/main.d.ts +24 -0
  68. package/package.json +23 -65
  69. package/react/accordion/index.d.ts +3 -0
  70. package/react/accordion-item/index.d.ts +8 -0
  71. package/react/action-card/index.d.ts +3 -0
  72. package/react/alert/index.d.ts +3 -0
  73. package/react/badge/index.d.ts +3 -0
  74. package/react/breadcrumb/index.d.ts +3 -0
  75. package/react/breadcrumb-item/index.d.ts +3 -0
  76. package/react/button/index.d.ts +6 -0
  77. package/react/checkbox/index.d.ts +3 -0
  78. package/react/cjs/index.js +12510 -0
  79. package/react/cjs/index.js.map +1 -0
  80. package/react/closebutton/index.d.ts +5 -0
  81. package/react/dropdown/index.d.ts +3 -0
  82. package/react/dropdown-item/index.d.ts +3 -0
  83. package/react/fileupload/index.d.ts +3 -0
  84. package/react/footer/index.d.ts +3 -0
  85. package/react/index.d.ts +34 -0
  86. package/react/index.js +12453 -0
  87. package/react/index.js.map +1 -0
  88. package/react/input/index.d.ts +3 -0
  89. package/react/mainnav/index.d.ts +3 -0
  90. package/react/mainnav-dropdown/index.d.ts +3 -0
  91. package/react/mainnav-item/index.d.ts +3 -0
  92. package/react/masthead/index.d.ts +3 -0
  93. package/react/modal/index.d.ts +3 -0
  94. package/react/package.json +10 -0
  95. package/react/quantity-toggle/index.d.ts +3 -0
  96. package/react/radio/index.d.ts +3 -0
  97. package/react/radio-group/index.d.ts +3 -0
  98. package/react/sidenav/index.d.ts +3 -0
  99. package/react/sidenav-item/index.d.ts +5 -0
  100. package/react/sidenav-link/index.d.ts +3 -0
  101. package/react/stepper/index.d.ts +3 -0
  102. package/react/tab/index.d.ts +3 -0
  103. package/react/tab-group/index.d.ts +3 -0
  104. package/react/tab-panel/index.d.ts +3 -0
  105. package/react/table/index.d.ts +3 -0
  106. package/react/textarea/index.d.ts +3 -0
  107. package/react/toast/index.d.ts +3 -0
  108. package/react/tooltip/index.d.ts +3 -0
  109. package/umd/index.js +11995 -0
  110. package/umd/index.js.map +1 -0
  111. package/{lib/utils → utils}/animate.d.ts +10 -10
  112. package/{lib/utils → utils}/animation-registry.d.ts +18 -18
  113. package/{lib/utils → utils}/breakpoints.d.ts +5 -5
  114. package/{lib/utils → utils}/defaultvalue.d.ts +2 -2
  115. package/{lib/utils → utils}/event.d.ts +2 -2
  116. package/{lib/utils → utils}/form.d.ts +38 -38
  117. package/{lib/utils → utils}/generateId.d.ts +1 -1
  118. package/{lib/utils → utils}/mergeDeep.d.ts +2 -2
  119. package/{lib/utils → utils}/modal.d.ts +12 -12
  120. package/{lib/utils → utils}/object.d.ts +2 -2
  121. package/{lib/utils → utils}/offset.d.ts +4 -4
  122. package/{lib/utils → utils}/scroll.d.ts +13 -13
  123. package/{lib/utils → utils}/slot.d.ts +22 -22
  124. package/{lib/utils → utils}/tabbable.d.ts +8 -8
  125. package/{lib/utils → utils}/watch.d.ts +14 -14
  126. package/.github/workflows/publish-latest.yml +0 -22
  127. package/.github/workflows/publish-pr.yml +0 -28
  128. package/.husky/commit-msg +0 -4
  129. package/.husky/prepare-commit-msg +0 -8
  130. package/.storybook/main.js +0 -16
  131. package/.storybook/preview-head.html +0 -11
  132. package/.storybook/preview.js +0 -9
  133. package/.vscode/settings.json +0 -7
  134. package/CONTRIBUTING.md +0 -56
  135. package/LICENSE +0 -20
  136. package/amplify.yml +0 -22
  137. package/commitlint.config.js +0 -1
  138. package/coverage/lcov-report/base.css +0 -224
  139. package/coverage/lcov-report/block-navigation.js +0 -87
  140. package/coverage/lcov-report/button-element.scss.html +0 -112
  141. package/coverage/lcov-report/button-element.ts.html +0 -145
  142. package/coverage/lcov-report/favicon.png +0 -0
  143. package/coverage/lcov-report/index.html +0 -116
  144. package/coverage/lcov-report/prettify.css +0 -1
  145. package/coverage/lcov-report/prettify.js +0 -2
  146. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  147. package/coverage/lcov-report/sorter.js +0 -196
  148. package/coverage/lcov.info +0 -32
  149. package/index.html +0 -430
  150. package/lib/Button/index.d.ts +0 -1
  151. package/lib/Button/index.js +0 -6634
  152. package/lib/Button/index.js.map +0 -1
  153. package/lib/Button/package.json +0 -7
  154. package/lib/Card/index.d.ts +0 -1
  155. package/lib/Card/index.js +0 -6150
  156. package/lib/Card/index.js.map +0 -1
  157. package/lib/Card/package.json +0 -7
  158. package/lib/Checkbox/index.d.ts +0 -1
  159. package/lib/Checkbox/index.js +0 -6366
  160. package/lib/Checkbox/index.js.map +0 -1
  161. package/lib/Checkbox/package.json +0 -7
  162. package/lib/Dropdown/index.d.ts +0 -3
  163. package/lib/Dropdown/index.js +0 -13502
  164. package/lib/Dropdown/index.js.map +0 -1
  165. package/lib/Dropdown/package.json +0 -7
  166. package/lib/Footer/index.d.ts +0 -2
  167. package/lib/Footer/index.js +0 -7168
  168. package/lib/Footer/index.js.map +0 -1
  169. package/lib/Footer/package.json +0 -7
  170. package/lib/Input/index.d.ts +0 -1
  171. package/lib/Input/index.js +0 -6656
  172. package/lib/Input/index.js.map +0 -1
  173. package/lib/Input/package.json +0 -7
  174. package/lib/Mainnav/index.d.ts +0 -4
  175. package/lib/Mainnav/index.js +0 -32546
  176. package/lib/Mainnav/index.js.map +0 -1
  177. package/lib/Mainnav/package.json +0 -7
  178. package/lib/Mainnav/sgds-mainnav-dropdown.d.ts +0 -5
  179. package/lib/Mainnav/sgds-mainnav-item.d.ts +0 -4
  180. package/lib/Masthead/index.d.ts +0 -1
  181. package/lib/Masthead/index.js +0 -7371
  182. package/lib/Masthead/index.js.map +0 -1
  183. package/lib/Masthead/package.json +0 -7
  184. package/lib/Modal/index.d.ts +0 -1
  185. package/lib/Modal/index.js +0 -6432
  186. package/lib/Modal/index.js.map +0 -1
  187. package/lib/Modal/package.json +0 -7
  188. package/lib/QuantityToggle/index.d.ts +0 -1
  189. package/lib/QuantityToggle/index.js +0 -7049
  190. package/lib/QuantityToggle/index.js.map +0 -1
  191. package/lib/QuantityToggle/package.json +0 -7
  192. package/lib/Radio/index.d.ts +0 -2
  193. package/lib/Radio/index.js +0 -12607
  194. package/lib/Radio/index.js.map +0 -1
  195. package/lib/Radio/package.json +0 -7
  196. package/lib/Sidenav/index.d.ts +0 -3
  197. package/lib/Sidenav/index.js +0 -18739
  198. package/lib/Sidenav/index.js.map +0 -1
  199. package/lib/Sidenav/package.json +0 -7
  200. package/lib/Sidenav/sgds-sidenav-link.d.ts +0 -4
  201. package/lib/Tab/index.d.ts +0 -3
  202. package/lib/Tab/index.js +0 -13557
  203. package/lib/Tab/index.js.map +0 -1
  204. package/lib/Tab/package.json +0 -7
  205. package/lib/Textarea/index.d.ts +0 -1
  206. package/lib/Textarea/index.js +0 -6696
  207. package/lib/Textarea/index.js.map +0 -1
  208. package/lib/Textarea/package.json +0 -7
  209. package/lib/index.d.ts +0 -16
  210. package/lib/index.js +0 -134580
  211. package/lib/index.js.map +0 -1
  212. package/lib/umd/index.js +0 -134587
  213. package/lib/umd/index.js.map +0 -1
  214. package/lib/utils/card-element.d.ts +0 -11
  215. package/mocks/dropdown.d.ts +0 -4
  216. package/mocks/dropdown.ts +0 -27
  217. package/mocks/link.d.ts +0 -3
  218. package/mocks/link.ts +0 -6
  219. package/rollup.config.js +0 -73
  220. package/rollup.test.config.js +0 -42
  221. package/scripts/buildUtils.js +0 -30
  222. package/scripts/frankBuild.js +0 -49
  223. package/src/Button/index.ts +0 -1
  224. package/src/Button/sgds-button.scss +0 -28
  225. package/src/Button/sgds-button.ts +0 -153
  226. package/src/Card/index.ts +0 -1
  227. package/src/Card/sgds-action-card.scss +0 -27
  228. package/src/Card/sgds-action-card.ts +0 -115
  229. package/src/Checkbox/index.ts +0 -1
  230. package/src/Checkbox/sgds-checkbox.scss +0 -4
  231. package/src/Checkbox/sgds-checkbox.ts +0 -149
  232. package/src/Dropdown/index.ts +0 -3
  233. package/src/Dropdown/sgds-dropdown-item.ts +0 -39
  234. package/src/Dropdown/sgds-dropdown.scss +0 -5
  235. package/src/Dropdown/sgds-dropdown.ts +0 -54
  236. package/src/Footer/index.ts +0 -3
  237. package/src/Footer/sgds-footer.scss +0 -5
  238. package/src/Footer/sgds-footer.ts +0 -121
  239. package/src/Input/index.ts +0 -1
  240. package/src/Input/sgds-input.scss +0 -20
  241. package/src/Input/sgds-input.ts +0 -178
  242. package/src/Mainnav/index.ts +0 -4
  243. package/src/Mainnav/sgds-mainnav-dropdown.scss +0 -13
  244. package/src/Mainnav/sgds-mainnav-dropdown.ts +0 -45
  245. package/src/Mainnav/sgds-mainnav-item.scss +0 -24
  246. package/src/Mainnav/sgds-mainnav-item.ts +0 -8
  247. package/src/Mainnav/sgds-mainnav.scss +0 -39
  248. package/src/Mainnav/sgds-mainnav.ts +0 -183
  249. package/src/Masthead/index.ts +0 -1
  250. package/src/Masthead/sgds-masthead.scss +0 -217
  251. package/src/Masthead/sgds-masthead.ts +0 -189
  252. package/src/Modal/index.ts +0 -1
  253. package/src/Modal/sgds-modal.scss +0 -128
  254. package/src/Modal/sgds-modal.ts +0 -309
  255. package/src/QuantityToggle/index.ts +0 -1
  256. package/src/QuantityToggle/sgds-quantitytoggle.scss +0 -10
  257. package/src/QuantityToggle/sgds-quantitytoggle.ts +0 -130
  258. package/src/Radio/index.ts +0 -2
  259. package/src/Radio/sgds-radio.scss +0 -5
  260. package/src/Radio/sgds-radio.ts +0 -120
  261. package/src/Radio/sgds-radiogroup.scss +0 -22
  262. package/src/Radio/sgds-radiogroup.ts +0 -221
  263. package/src/Sidenav/index.ts +0 -4
  264. package/src/Sidenav/sgds-sidenav-item.scss +0 -73
  265. package/src/Sidenav/sgds-sidenav-item.ts +0 -145
  266. package/src/Sidenav/sgds-sidenav-link.scss +0 -25
  267. package/src/Sidenav/sgds-sidenav-link.ts +0 -8
  268. package/src/Sidenav/sgds-sidenav.scss +0 -6
  269. package/src/Sidenav/sgds-sidenav.ts +0 -33
  270. package/src/Tab/index.ts +0 -3
  271. package/src/Tab/sgds-tab.scss +0 -84
  272. package/src/Tab/sgds-tab.ts +0 -87
  273. package/src/Tab/sgds-tabgroup.scss +0 -198
  274. package/src/Tab/sgds-tabgroup.ts +0 -295
  275. package/src/Tab/sgds-tabpanel.scss +0 -12
  276. package/src/Tab/sgds-tabpanel.ts +0 -55
  277. package/src/Textarea/index.ts +0 -1
  278. package/src/Textarea/sgds-textarea.scss +0 -23
  279. package/src/Textarea/sgds-textarea.ts +0 -201
  280. package/src/index.ts +0 -16
  281. package/src/utils/animate.ts +0 -69
  282. package/src/utils/animation-registry.ts +0 -71
  283. package/src/utils/base.scss +0 -14
  284. package/src/utils/breakpoints.ts +0 -5
  285. package/src/utils/card-element.ts +0 -42
  286. package/src/utils/components.style.scss +0 -531
  287. package/src/utils/defaultvalue.ts +0 -51
  288. package/src/utils/dropdown-element.ts +0 -244
  289. package/src/utils/event.ts +0 -13
  290. package/src/utils/form.ts +0 -183
  291. package/src/utils/generateId.ts +0 -4
  292. package/src/utils/link-element.ts +0 -34
  293. package/src/utils/mergeDeep.ts +0 -22
  294. package/src/utils/modal.ts +0 -64
  295. package/src/utils/object.ts +0 -2
  296. package/src/utils/offset.ts +0 -6
  297. package/src/utils/scroll.ts +0 -57
  298. package/src/utils/sgds-element.ts +0 -18
  299. package/src/utils/slot.ts +0 -102
  300. package/src/utils/tabbable.ts +0 -81
  301. package/src/utils/watch.ts +0 -62
  302. package/stories/ActionCard.stories.mdx +0 -199
  303. package/stories/Button.stories.mdx +0 -194
  304. package/stories/Checkbox.stories.mdx +0 -196
  305. package/stories/Dropdown.stories.mdx +0 -152
  306. package/stories/Footer.stories.mdx +0 -261
  307. package/stories/Input.stories.mdx +0 -236
  308. package/stories/MainNav.stories.mdx +0 -169
  309. package/stories/Masthead.stories.mdx +0 -112
  310. package/stories/Modal.stories.mdx +0 -103
  311. package/stories/QuantityToggle.stories.mdx +0 -97
  312. package/stories/Radio.stories.mdx +0 -262
  313. package/stories/Sample.stories.js +0 -29
  314. package/stories/Sample.stories.mdx +0 -33
  315. package/stories/SideNav.stories.mdx +0 -245
  316. package/stories/common.js +0 -185
  317. package/stories/textarea.stories.mdx +0 -253
  318. package/test/button.element.test.ts +0 -185
  319. package/test/checkbox.test.ts +0 -240
  320. package/test/dropdown.test.ts +0 -637
  321. package/test/footer.test.ts +0 -181
  322. package/test/generateId.test.ts +0 -18
  323. package/test/input.element.test.ts +0 -316
  324. package/test/link-element.test.ts +0 -38
  325. package/test/mainnav.test.ts +0 -313
  326. package/test/masthead.test.ts +0 -116
  327. package/test/modal.test.ts +0 -149
  328. package/test/quantitytoggle.test.ts +0 -76
  329. package/test/radio.test.ts +0 -310
  330. package/test/selectable-card.test.ts +0 -159
  331. package/test/sidenav.test.ts +0 -390
  332. package/test/tab.test.ts +0 -76
  333. package/test/textarea.test.ts +0 -126
  334. package/tsconfig.json +0 -26
  335. package/tsconfig.test.json +0 -24
  336. package/typings/scss.d.ts +0 -5
  337. package/web-dev-server.config.mjs +0 -7
  338. package/web-test-runner.config.mjs +0 -47
@@ -1,8 +0,0 @@
1
-
2
- import { customElement } from "lit/decorators.js";
3
- import styles from "./sgds-mainnav-item.scss";
4
- import LinkElement from "../utils/link-element";
5
- @customElement("sgds-mainnav-item")
6
- export class SgdsMainnavItem extends LinkElement {
7
- static styles = styles;
8
- }
@@ -1,39 +0,0 @@
1
- @import "../utils/base.scss";
2
- @import "~@govtechsg/sgds/sass/navbar";
3
- @import "~@govtechsg/sgds/sass/transitions";
4
- @import "~@govtechsg/sgds/sass/offcanvas";
5
- .navbar-nav {
6
- display: flex;
7
- align-self: center;
8
- gap: 1rem;
9
- padding-left: 1rem;
10
- padding-right: 1rem;
11
- height: 100%;
12
- width: 100%;
13
- }
14
-
15
- .navbar-toggler {
16
- border: none;
17
- }
18
- .navbar-toggler:focus {
19
- box-shadow: none;
20
- }
21
-
22
- slot[name="non-collapsible"] {
23
- display: flex;
24
- gap: 1rem;
25
- align-items: center;
26
- }
27
-
28
- .slot-end {
29
- display: flex;
30
- margin-left: auto;
31
- align-items: stretch;
32
- gap: 1rem;
33
-
34
- }
35
-
36
- // there is no wildcard selector for element tag names in css :/
37
- .slot-end::slotted(:not([name$="-mainnav-item"])){
38
- align-self: center;
39
- }
@@ -1,183 +0,0 @@
1
- import { html, PropertyValueMap } from "lit";
2
- import { customElement, property, queryAssignedElements, state } from "lit/decorators.js";
3
- import styles from "./sgds-mainnav.scss";
4
- import { Collapse, Offcanvas } from "bootstrap";
5
- import { ref, createRef, Ref } from "lit/directives/ref.js";
6
- import genId from "../utils/generateId";
7
- import SgdsElement from "../utils/sgds-element";
8
- import {
9
- SM_BREAKPOINT,
10
- MD_BREAKPOINT,
11
- LG_BREAKPOINT,
12
- XL_BREAKPOINT,
13
- XXL_BREAKPOINT,
14
- } from "../utils/breakpoints";
15
- import { classMap } from "lit/directives/class-map.js";
16
-
17
- export type MainnavExpandSize =
18
- | "sm"
19
- | "md"
20
- | "lg"
21
- | "xl"
22
- | "xxl"
23
- | "always"
24
- | "never";
25
-
26
- const SIZES = {
27
- sm: SM_BREAKPOINT,
28
- md: MD_BREAKPOINT,
29
- lg: LG_BREAKPOINT,
30
- xl: XL_BREAKPOINT,
31
- XXL: XXL_BREAKPOINT,
32
- never: Infinity,
33
- always: -1,
34
- };
35
- @customElement("sgds-mainnav")
36
- export class SgdsMainnav extends SgdsElement {
37
- static styles = styles;
38
-
39
- constructor() {
40
- super();
41
- window.addEventListener("resize", () => {
42
- const newBreakpointReachedValue =
43
- window.innerWidth < SIZES[this.expand.toString()];
44
- if (newBreakpointReachedValue !== this.breakpointReached) {
45
- this.requestUpdate();
46
- }
47
- });
48
- }
49
-
50
- private myCollapse: Ref<HTMLElement> = createRef();
51
- private bsCollapse: Collapse = null;
52
- // TODO: stylings and slots are incomplete for offcanvas mode
53
- private myOffcanvas: Ref<HTMLElement> = createRef();
54
- private bsOffcanvas: Offcanvas = null;
55
-
56
- private _onClickButton() {
57
- if (this.mode === "offcanvas") {
58
- return this.bsOffcanvas.toggle();
59
- }
60
- this.bsCollapse.toggle();
61
- }
62
-
63
- @property({ type: String })
64
- brandHref = "";
65
-
66
- @property({ type: String })
67
- collapseId = genId("mainnav", "collapse");
68
-
69
- @property()
70
- expand: MainnavExpandSize = "lg";
71
-
72
- @property({ type: String })
73
- mode: "offcanvas" | "default" = "default";
74
-
75
- @state()
76
- breakpointReached: Boolean = false;
77
-
78
- @state()
79
- expanded: Boolean = false;
80
-
81
- firstUpdated() {
82
-
83
- if (this.mode === "default") {
84
- this.bsCollapse = new Collapse(this.myCollapse.value, {
85
- toggle: false,
86
- });
87
- this.myCollapse.value.addEventListener("show.bs.collapse", () => {
88
- this.expanded = true;
89
- });
90
- this.myCollapse.value.addEventListener("shown.bs.collapse", () => {
91
- this.expanded = true;
92
- });
93
- this.myCollapse.value.addEventListener("hide.bs.collapse", () => {
94
- this.expanded = false;
95
- });
96
- this.myCollapse.value.addEventListener("hidden.bs.collapse", () => {
97
- this.expanded = false;
98
- });
99
- }
100
-
101
- if (this.mode === "offcanvas") {
102
- this.bsOffcanvas = new Offcanvas(this.myOffcanvas.value);
103
- //add esc keyboard event for bsOffcanvas
104
- this.addEventListener("keydown", (ev) => {
105
- if (ev.key === "Escape") {
106
- this.bsOffcanvas.hide();
107
- }
108
- });
109
- }
110
-
111
- }
112
- // assigning name attribute to elements added in slot="end", to use wildcard css selector to assign styles only to *-mainnav-item
113
- _handleSlotChange(e: Event){
114
- const childElements = (e.target as HTMLSlotElement).assignedElements({flatten: true})
115
- childElements.forEach(e => e.setAttribute('name', e.tagName.toLowerCase()))
116
- }
117
-
118
- render() {
119
- this.breakpointReached = window.innerWidth < SIZES[this.expand.toString()];
120
- const collapseClass = "collapse navbar-collapse order-4";
121
- const offcanvasClass = "offcanvas offcanvas-start order-4";
122
- return html`
123
- <nav
124
- class="sgds navbar navbar-light
125
- ${this._expandClass()}"
126
- >
127
- <a class="navbar-brand me-auto order-1" href=${this.brandHref}>
128
- <slot name="brand"></slot>
129
- </a>
130
- <slot
131
- name="non-collapsible"
132
- class="${this.breakpointReached ? "order-2" : "order-5"}"
133
- ></slot>
134
- <button
135
- class="navbar-toggler order-3"
136
- type="button"
137
- @click=${() => this._onClickButton()}
138
- aria-controls="${this.collapseId}"
139
- aria-expanded="${this.expanded}"
140
- aria-label="Toggle navigation"
141
- >
142
- <svg
143
- xmlns="http://www.w3.org/2000/svg"
144
- width="30"
145
- height="30"
146
- fill="currentColor"
147
- class="bi bi-list"
148
- viewBox="0 0 16 16"
149
- >
150
- <path
151
- fill-rule="evenodd"
152
- d="M2.5 12a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm0-4a.5.5 0 0 1 .5-.5h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5z"
153
- />
154
- </svg>
155
- </button>
156
- <div
157
- class=${this.mode === "default" ? collapseClass : offcanvasClass}
158
- ${this.mode === "default"
159
- ? ref(this.myCollapse)
160
- : ref(this.myOffcanvas)}
161
- id=${this.collapseId}
162
- >
163
- <ul class="navbar-nav">
164
- <slot></slot>
165
- <slot name="end" class=${classMap({"slot-end": !this.breakpointReached})} @slotchange=${this._handleSlotChange}></slot>
166
- </ul>
167
- </div>
168
- </nav>
169
- `;
170
- }
171
- _expandClass() {
172
- switch (this.expand) {
173
- case "always":
174
- return "navbar-expand";
175
- case "never":
176
- break;
177
- default:
178
- return `navbar-expand-${this.expand}`;
179
- }
180
- }
181
- }
182
-
183
- export default SgdsMainnav;
@@ -1 +0,0 @@
1
- export {SgdsMasthead} from './sgds-masthead';
@@ -1,217 +0,0 @@
1
- @import "../utils/base.scss";
2
- @import "~@govtechsg/sgds/sass/containers";
3
- @import "~@govtechsg/sgds/sass/grid";
4
-
5
- :host{
6
- --masthead-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
7
- --masthead-text-color: hsl(0, 0%, 28%);
8
- --masthead-link-color: hsl(222, 63%, 50%);
9
- --masthead-link-color-hover: hsl(221, 64%, 55%);
10
- --masthead-mobile-font-size: 0.6875rem;
11
- --masthead-mobile-padding-x: 0.75rem;
12
- --masthead-fluid-padding-x: 0.75rem;
13
- --masthead-crest-color: rgb(239, 51, 32);
14
-
15
- }
16
-
17
- .sgds-masthead{
18
- font-size: 0.875rem;
19
- background-color: hsl(0, 0%, 94%);
20
- font-family: var(--masthead-font-family);
21
- color: var(--masthead-text-color);
22
- @media screen and (max-width: 1023px){
23
- font-size: var(--masthead-mobile-font-size);
24
- .col,.row{
25
- padding-left:0;
26
- padding-right: 0;
27
- }
28
- .row{
29
- margin-right:0;
30
- margin-left:0;
31
- }
32
- }
33
- }
34
-
35
- .sg-crest {
36
- width: 1.25rem;
37
- height: 1.75rem;
38
- path{
39
- fill: var(--masthead-crest-color);
40
- }
41
- }
42
-
43
- .masthead-layout{
44
- display: flex;
45
- align-items: center;
46
- gap: 0.25rem;
47
- }
48
-
49
-
50
-
51
- .sgds-masthead-identify-icon {
52
- width: 12px;
53
- height: 21px;
54
- display: block;
55
- transform: rotate(180deg);
56
- user-select: none;
57
- transition: all 0.3s ease-in-out 0s;
58
- align-self: center;
59
- &.show{
60
- transform: rotate(0deg);
61
- }
62
- }
63
-
64
- .sgds-masthead-button {
65
- display: flex;
66
- color: var(--masthead-link-color);
67
- align-items: center;
68
- cursor: pointer;
69
- &-text{
70
- text-decoration: underline;
71
- &:hover{
72
- color: var(--masthead-link-color-hover);
73
- }
74
- }
75
- }
76
-
77
- .sgds-masthead-content{
78
- padding-top: 2.5rem;
79
- padding-bottom: 3rem;
80
- display: none;
81
- @media screen and (max-width: 1023px) {
82
- padding-top: 1rem;
83
- padding-bottom: 2rem;
84
- }
85
- .content-grid {
86
- display: grid;
87
- grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
88
- gap: 10rem;
89
- @media screen and (max-width: 1023px){
90
- grid-template-columns: 1fr;
91
- gap: 1.5rem;
92
- .banner-icon-inline {
93
- width: 0.6rem;
94
- height: 0.6rem;
95
- margin-bottom: 0.1875rem;
96
-
97
- }
98
- }
99
- .icon{
100
- margin-top: -0.1em;
101
-
102
- }
103
- }
104
-
105
-
106
- .wrapper {
107
- display: flex;
108
- gap: 1rem;
109
- font-size: 1rem;
110
- @media screen and (max-width: 1023px){
111
- font-size: var(--masthead-mobile-font-size);
112
- gap: 0.5rem;
113
- }
114
- .content {
115
- .title {
116
- font-weight: 600;
117
- margin-bottom: 0.5rem;
118
- @media screen and (max-width: 1023px) {
119
- margin-bottom: 0.25rem;
120
- }
121
- }
122
- article{
123
- line-height: 1.5rem;
124
- @media screen and (max-width: 1023px) {
125
- line-height: 1.2rem;
126
- }
127
- }
128
- }
129
- .banner-icon{
130
- width: 1.125rem;
131
- path{
132
- fill: var(--masthead-text-color);
133
- }
134
-
135
- @media screen and (max-width: 1023px) {
136
- width: 0.75rem;
137
- }
138
- svg{
139
- line-height: 1.5rem;
140
- @media screen and (max-width: 1023px) {
141
- width: 1.25rem;
142
- }
143
- }
144
- }
145
- .banner-icon-inline{
146
- path{
147
- fill: var(--masthead-text-color);
148
- }
149
- @media screen and (max-width: 1023px){
150
- width: 0.6rem;
151
- height: 0.6rem;
152
- margin-bottom: 0.1875rem;
153
- }
154
- }
155
-
156
- }
157
-
158
- &.show{
159
- display: block;
160
- }
161
- }
162
-
163
- a[target="_blank"]{
164
- text-decoration: none;
165
- &::after{
166
- content: none;
167
- }
168
- }
169
-
170
-
171
- a.trusted-websites-link{
172
- display: inline-flex;
173
- align-items: center;
174
- color: var(--masthead-link-color);
175
- margin-left: 0.125rem;
176
- svg{
177
- margin-left: 0.125rem;
178
- fill: var(--masthead-link-color);
179
- }
180
- &:hover{
181
- color: var(--masthead-link-color-hover);
182
- svg{
183
- fill: var(--masthead-link-color-hover);
184
- }
185
- }
186
- }
187
-
188
- @media screen and (max-width: 1023px){
189
- .trusted-websites-icon{
190
- width:0.75rem;
191
- }
192
- }
193
-
194
- .sgds-masthead{
195
- > .container{
196
- @media screen and (max-width: 1023px){
197
- padding-left: var(--masthead-mobile-padding-x);
198
- padding-right: var(--masthead-mobile-padding-x);
199
- }
200
- }
201
- > .container-fluid{
202
- padding-left: var(--masthead-fluid-padding-x);
203
- padding-right: var(--masthead-fluid-padding-x);
204
- @media screen and (max-width: 1023px){
205
- padding-left: var(--masthead-mobile-padding-x);
206
- padding-right: var(--masthead-mobile-padding-x);
207
- }
208
- }
209
-
210
- &:not([fluid]){
211
- @media screen and (max-width: 1023px){
212
- .container{
213
- margin: 0;
214
- }
215
- }
216
- }
217
- }
@@ -1,189 +0,0 @@
1
- import { html } from "lit";
2
- import { customElement, property, state } from "lit/decorators.js";
3
- import styles from "./sgds-masthead.scss";
4
- import SgdsElement from "../utils/sgds-element";
5
-
6
- /**
7
- * @property fluid - Include this attribute for full width container
8
- */
9
-
10
- @customElement("sgds-masthead")
11
- export class SgdsMasthead extends SgdsElement {
12
- static styles = styles;
13
-
14
- @property({ type: Boolean, reflect: true })
15
- fluid: boolean = false;
16
-
17
- @state()
18
- toggleVisibility = false;
19
-
20
- private _toggleVisibility() {
21
- this.toggleVisibility = !this.toggleVisibility;
22
- }
23
-
24
- render() {
25
- return html`
26
- <div
27
- id="sgds-masthead"
28
- class="sgds-masthead"
29
- aria-label="A Singapore Government Agency Website"
30
- >
31
- <div class="${this.fluid ? "container-fluid" : "container"}">
32
- <div class="row">
33
- <div class="col">
34
- <div class="masthead-layout">
35
- <svg
36
- version="1.1"
37
- xmlns="http://www.w3.org/2000/svg"
38
- width="32"
39
- height="32"
40
- viewBox="0 0 32 32"
41
- class="sg-crest"
42
- >
43
- <title>sg-crest</title>
44
- <path
45
- d="M5.896 11.185c0 0-0.949 1.341 0.294 3.075 0 0 0.196-0.883 2.159-0.883h2.356c2.225 0 3.893-2.126 2.846-4.319 0 0 1.57 0.164 2.095-0.818 0.523-0.981-0.033-1.374-0.818-1.374h-3.959c0 0.704-1.341 0.802-1.341 0h-2.225c0 0-1.669 0-1.701 1.407 0 0 0.377-0.229 0.752-0.261v0.375c0 0-0.458 0.082-0.671 0.197-0.212 0.114-0.523 0.425-0.228 1.227 0.294 0.801 0.409 1.079 0.409 1.079s0.475-0.41 1.244-0.41h0.9c1.602 0 1.308 1.554-0.295 1.554s-1.815-0.85-1.815-0.85z"
46
- ></path>
47
- <path
48
- d="M14.255 9.566c0 0 0.54 0.033 0.932-0.31 0 0 3.55 2.765-1.717 8.326-5.268 5.562-1.195 9.162-1.195 9.162s-0.948 0.915-0.409 2.699c0 0-2.191-1.237-3.867-3.338-2.422-3.036-3.902-7.681 2.749-11.386 0 0 4.389-2.208 3.506-5.153z"
49
- ></path>
50
- <path
51
- d="M8.829 6.343c0 0 0.709-1.265 2.355-1.265 1.298 0 1.594-0.666 1.594-0.666s0.566-1.079 3.424-1.079c2.619 0 4.384 0.873 5.812 2.039 0 0-3.85-2.388-7.645 0.971h-5.54z"
52
- ></path>
53
- <path
54
- d="M24.839 14.348c-0.109-3.948-3.163-8.179-9.728-7.939 6.413-5.431 17.537 6.695 8.375 13.066 0 0 1.533-2.186 1.353-5.126z"
55
- ></path>
56
- <path
57
- d="M16.093 6.845c8.005-0.24 10.863 9.357 5.693 13.676l-5.191 2.509c0 0-0.676-2.181 1.833-4.734 2.509-2.551 4.929-7.328-2.006-10.469 0 0 0.131-0.654-0.327-0.981z"
58
- ></path>
59
- <path
60
- d="M15.678 9.004c0 0 0.393-0.371 0.524-0.676 5.954 2.486 5.017 6.697 1.461 10.23-2.181 2.246-1.505 4.668-1.505 4.668s-2.66 1.657-3.577 3.097c0 0-3.852-3.28 1.483-8.724 5.235-5.344 1.614-8.594 1.614-8.594z"
61
- ></path>
62
- </svg>
63
- <span>A Singapore Government Agency Website</span>
64
- <div
65
- class="sgds-masthead-button"
66
- id="sgds-masthead-identify"
67
- role="button"
68
- aria-expanded="${this.toggleVisibility}"
69
- aria-controls="sgds-masthead-content"
70
- @click=${() => this._toggleVisibility()}
71
- >
72
- <span class="sgds-masthead-button-text"
73
- >How to identify</span
74
- >
75
- <svg
76
- xmlns="http://www.w3.org/2000/svg"
77
- width="20"
78
- height="20"
79
- viewBox="0 0 20 20"
80
- fill="none"
81
- class="sgds-masthead-identify-icon ${!this.toggleVisibility ? null : "show"}"
82
- >
83
- <path
84
- d="M8.65188 6.85L8.64813 6.84625L10.0031 5.49125L17.0744 12.5625L15.7194 13.9175L10.0075 8.20562L4.2875 13.9256L2.9325 12.5706L8.6525 6.85062L8.65188 6.85Z"
85
- fill="#2F60CE"
86
- ></path>
87
- </svg>
88
- </div>
89
- </div>
90
- </div>
91
- </div>
92
- </div>
93
-
94
- <div id="sgds-masthead-content" class="container sgds-masthead-content ${this.toggleVisibility ? "show" : null }">
95
- <div class="row">
96
- <div class="col">
97
- <div class="content-grid">
98
- <div class="wrapper">
99
- <div class="icon">
100
- <svg
101
- xmlns="http://www.w3.org/2000/svg"
102
- width="17"
103
- height="17"
104
- viewBox="0 0 17 17"
105
- fill="none"
106
- class="banner-icon"
107
- >
108
- <path
109
- d="M0.166016 5.6665V9.00067H0.999349V13.9998H0.166016V16.4998H0.999349H3.49935H5.16602H7.66601H9.33268H11.8327H13.4993L15.9993 16.5007V16.4998H16.8327V13.9998H15.9993V9.00067H16.8327V5.6665L8.49935 0.666504L0.166016 5.6665ZM3.49935 13.9998V9.00067H5.16602V13.9998H3.49935ZM7.66601 13.9998V9.00067H9.33268V13.9998H7.66601ZM13.4993 13.9998H11.8327V9.00067H13.4993V13.9998ZM10.166 5.6665C10.166 6.58651 9.41935 7.33317 8.49935 7.33317C7.57935 7.33317 6.83268 6.58651 6.83268 5.6665C6.83268 4.7465 7.57935 3.99984 8.49935 3.99984C9.41935 3.99984 10.166 4.7465 10.166 5.6665Z"
110
- fill="#242425"
111
- ></path>
112
- </svg>
113
- </div>
114
- <div class="content">
115
- <div class="title">
116
- Official website links end with .gov.sg
117
- </div>
118
- <article>
119
- Government agencies communicate via .gov.sg websites (e.g.
120
- go.gov.sg/open).<a
121
- href="https://www.gov.sg/trusted-sites#govsites"
122
- class="trusted-websites-link"
123
- rel="noreferrer"
124
- target="_blank"
125
- >Trusted websites<svg
126
- version="1.1"
127
- xmlns="http://www.w3.org/2000/svg"
128
- width="18"
129
- height="18"
130
- viewBox="0 0 32 32"
131
- class="trusted-websites-icon"
132
- >
133
- <title>Trusted websites</title>
134
- <path
135
- d="M18.667 4v2.667h4c0.186-0.020 0.374-0.020 0.56 0l-2.667 2.667-6.973 6.987 1.88 1.88 9.733-9.667c0.092 0.257 0.137 0.528 0.133 0.8v4h2.667v-9.333h-9.333z"
136
- ></path>
137
- <path
138
- d="M22.667 25.333h-16v-16h8v-2.667h-8c-1.473 0-2.667 1.194-2.667 2.667v16c0 1.473 1.194 2.667 2.667 2.667h16c1.473 0 2.667-1.194 2.667-2.667v-8h-2.667v8z"
139
- ></path></svg
140
- ></a>
141
- </article>
142
- </div>
143
- </div>
144
- <div class="wrapper">
145
- <div class="icon">
146
- <svg
147
- xmlns="http://www.w3.org/2000/svg"
148
- width="15"
149
- height="18"
150
- viewBox="0 0 15 18"
151
- fill="none"
152
- class="banner-icon"
153
- >
154
- <path
155
- d="M14.1663 9.00008C14.1663 8.08091 13.4188 7.33342 12.4997 7.33342H11.6663V4.83342C11.6663 2.53591 9.79717 0.666748 7.49967 0.666748C5.20217 0.666748 3.33301 2.53591 3.33301 4.83342V7.33342H2.49967C1.58051 7.33342 0.833008 8.08091 0.833008 9.00008V15.6667C0.833008 16.5859 1.58051 17.3334 2.49967 17.3334H12.4997C13.4188 17.3334 14.1663 16.5859 14.1663 15.6667V9.00008ZM4.99967 4.83342C4.99967 3.45508 6.12134 2.33341 7.49967 2.33341C8.87801 2.33341 9.99967 3.45508 9.99967 4.83342V7.33342H4.99967V4.83342Z"
156
- fill="#242425"
157
- ></path>
158
- </svg>
159
- </div>
160
- <div class="content">
161
- <div class="title">Secure websites use HTTPS</div>
162
- <article>
163
- Look for a<b> lock </b>(<svg
164
- xmlns="http://www.w3.org/2000/svg"
165
- width="15"
166
- height="18"
167
- viewBox="0 0 15 18"
168
- fill="none"
169
- class="banner-icon-inline"
170
- >
171
- <path
172
- d="M14.1663 9.00008C14.1663 8.08091 13.4188 7.33342 12.4997 7.33342H11.6663V4.83342C11.6663 2.53591 9.79717 0.666748 7.49967 0.666748C5.20217 0.666748 3.33301 2.53591 3.33301 4.83342V7.33342H2.49967C1.58051 7.33342 0.833008 8.08091 0.833008 9.00008V15.6667C0.833008 16.5859 1.58051 17.3334 2.49967 17.3334H12.4997C13.4188 17.3334 14.1663 16.5859 14.1663 15.6667V9.00008ZM4.99967 4.83342C4.99967 3.45508 6.12134 2.33341 7.49967 2.33341C8.87801 2.33341 9.99967 3.45508 9.99967 4.83342V7.33342H4.99967V4.83342Z"
173
- fill="#242425"
174
- ></path></svg
175
- >) or https:// as an added precaution. Share sensitive
176
- information only on official, secure websites.
177
- </article>
178
- </div>
179
- </div>
180
- </div>
181
- </div>
182
- </div>
183
- </div>
184
- </div>
185
- `;
186
- }
187
- }
188
-
189
- export default SgdsMasthead;
@@ -1 +0,0 @@
1
- export { SgdsModal } from "./sgds-modal";