@govtechsg/sgds-web-component 3.0.0-rc.1 → 3.0.0-rc.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 (478) hide show
  1. package/README.md +5 -5
  2. package/base/button.js +1 -1
  3. package/base/form-control-element.d.ts +4 -11
  4. package/base/form-control-element.js +13 -23
  5. package/base/form-control-element.js.map +1 -1
  6. package/components/Accordion/accordion-item.js +1 -1
  7. package/components/Accordion/index.umd.js +7 -19
  8. package/components/Accordion/index.umd.js.map +1 -1
  9. package/components/Accordion/sgds-accordion-item.d.ts +3 -7
  10. package/components/Accordion/sgds-accordion-item.js +6 -18
  11. package/components/Accordion/sgds-accordion-item.js.map +1 -1
  12. package/components/ActionCard/index.umd.js +407 -329
  13. package/components/ActionCard/index.umd.js.map +1 -1
  14. package/components/Alert/alert.js +1 -1
  15. package/components/Alert/index.umd.js +553 -485
  16. package/components/Alert/index.umd.js.map +1 -1
  17. package/components/Alert/sgds-alert.d.ts +2 -2
  18. package/components/Alert/sgds-alert.js +6 -13
  19. package/components/Alert/sgds-alert.js.map +1 -1
  20. package/components/Badge/badge.js +1 -1
  21. package/components/Badge/index.umd.js +8 -9
  22. package/components/Badge/index.umd.js.map +1 -1
  23. package/components/Badge/sgds-badge.d.ts +4 -5
  24. package/components/Badge/sgds-badge.js +5 -6
  25. package/components/Badge/sgds-badge.js.map +1 -1
  26. package/components/Button/index.umd.js +8 -81
  27. package/components/Button/index.umd.js.map +1 -1
  28. package/components/Button/sgds-button.js +1 -1
  29. package/components/Button/sgds-button.js.map +1 -1
  30. package/components/Checkbox/checkbox.js +1 -1
  31. package/components/Checkbox/index.umd.js +541 -475
  32. package/components/Checkbox/index.umd.js.map +1 -1
  33. package/components/Checkbox/sgds-checkbox-group.d.ts +7 -1
  34. package/components/Checkbox/sgds-checkbox-group.js +15 -4
  35. package/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  36. package/components/Checkbox/sgds-checkbox.d.ts +30 -21
  37. package/components/Checkbox/sgds-checkbox.js +77 -60
  38. package/components/Checkbox/sgds-checkbox.js.map +1 -1
  39. package/components/ComboBox/index.umd.js +385 -216
  40. package/components/ComboBox/index.umd.js.map +1 -1
  41. package/components/Datepicker/datepicker-input.d.ts +4 -2
  42. package/components/Datepicker/datepicker-input.js +24 -7
  43. package/components/Datepicker/datepicker-input.js.map +1 -1
  44. package/components/Datepicker/index.umd.js +433 -244
  45. package/components/Datepicker/index.umd.js.map +1 -1
  46. package/components/Datepicker/sgds-datepicker.d.ts +1 -1
  47. package/components/Datepicker/sgds-datepicker.js.map +1 -1
  48. package/components/Drawer/index.umd.js +2 -2
  49. package/components/Drawer/index.umd.js.map +1 -1
  50. package/components/Dropdown/index.umd.js +8 -81
  51. package/components/Dropdown/index.umd.js.map +1 -1
  52. package/components/FileUpload/file-upload.js +1 -1
  53. package/components/FileUpload/index.umd.js +579 -272
  54. package/components/FileUpload/index.umd.js.map +1 -1
  55. package/components/FileUpload/sgds-file-upload.d.ts +42 -30
  56. package/components/FileUpload/sgds-file-upload.js +147 -103
  57. package/components/FileUpload/sgds-file-upload.js.map +1 -1
  58. package/components/Footer/footer-item.js +6 -0
  59. package/components/Footer/footer-item.js.map +1 -0
  60. package/components/Footer/footer.js +1 -1
  61. package/components/Footer/index.d.ts +2 -0
  62. package/components/Footer/index.js +2 -0
  63. package/components/Footer/index.js.map +1 -1
  64. package/components/Footer/index.umd.js +93 -94
  65. package/components/Footer/index.umd.js.map +1 -1
  66. package/components/Footer/sgds-footer-item.d.ts +13 -0
  67. package/components/Footer/sgds-footer-item.js +27 -0
  68. package/components/Footer/sgds-footer-item.js.map +1 -0
  69. package/components/Footer/sgds-footer.d.ts +9 -30
  70. package/components/Footer/sgds-footer.js +65 -90
  71. package/components/Footer/sgds-footer.js.map +1 -1
  72. package/components/Icon/icon.js +6 -0
  73. package/components/Icon/icon.js.map +1 -0
  74. package/components/Icon/index.d.ts +6 -0
  75. package/components/Icon/index.js +4 -0
  76. package/components/Icon/index.js.map +1 -0
  77. package/components/Icon/index.umd.js +4389 -0
  78. package/components/Icon/index.umd.js.map +1 -0
  79. package/components/Icon/sgds-icon.d.ts +21 -0
  80. package/components/Icon/sgds-icon.js +64 -0
  81. package/components/Icon/sgds-icon.js.map +1 -0
  82. package/components/IconButton/icon-button.js +1 -1
  83. package/components/IconButton/index.umd.js +6 -9
  84. package/components/IconButton/index.umd.js.map +1 -1
  85. package/components/IconButton/sgds-icon-button.d.ts +2 -2
  86. package/components/IconButton/sgds-icon-button.js +4 -9
  87. package/components/IconButton/sgds-icon-button.js.map +1 -1
  88. package/components/Input/index.umd.js +1734 -1376
  89. package/components/Input/index.umd.js.map +1 -1
  90. package/components/Input/sgds-input.d.ts +41 -21
  91. package/components/Input/sgds-input.js +103 -66
  92. package/components/Input/sgds-input.js.map +1 -1
  93. package/components/Modal/index.umd.js +2 -2
  94. package/components/Modal/index.umd.js.map +1 -1
  95. package/components/QuantityToggle/index.umd.js +894 -316
  96. package/components/QuantityToggle/index.umd.js.map +1 -1
  97. package/components/QuantityToggle/sgds-quantity-toggle.d.ts +42 -15
  98. package/components/QuantityToggle/sgds-quantity-toggle.js +129 -62
  99. package/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
  100. package/components/Radio/index.umd.js +516 -203
  101. package/components/Radio/index.umd.js.map +1 -1
  102. package/components/Radio/sgds-radio-group.d.ts +38 -27
  103. package/components/Radio/sgds-radio-group.js +100 -84
  104. package/components/Radio/sgds-radio-group.js.map +1 -1
  105. package/components/Radio/sgds-radio.js +1 -1
  106. package/components/Radio/sgds-radio.js.map +1 -1
  107. package/components/Stepper/index.umd.js +1 -0
  108. package/components/Stepper/index.umd.js.map +1 -1
  109. package/components/Stepper/sgds-stepper.d.ts +1 -0
  110. package/components/Stepper/sgds-stepper.js +1 -0
  111. package/components/Stepper/sgds-stepper.js.map +1 -1
  112. package/components/Switch/index.umd.js +21 -321
  113. package/components/Switch/index.umd.js.map +1 -1
  114. package/components/Switch/sgds-switch.js +1 -2
  115. package/components/Switch/sgds-switch.js.map +1 -1
  116. package/components/Textarea/index.umd.js +1554 -1336
  117. package/components/Textarea/index.umd.js.map +1 -1
  118. package/components/Textarea/sgds-textarea.d.ts +33 -22
  119. package/components/Textarea/sgds-textarea.js +78 -75
  120. package/components/Textarea/sgds-textarea.js.map +1 -1
  121. package/components/Textarea/textarea.js +1 -1
  122. package/components/Toast/index.umd.js +9 -21
  123. package/components/Toast/index.umd.js.map +1 -1
  124. package/components/Toast/sgds-toast.d.ts +2 -1
  125. package/components/Toast/sgds-toast.js +6 -18
  126. package/components/Toast/sgds-toast.js.map +1 -1
  127. package/components/Toast/toast.js +1 -1
  128. package/components/Tooltip/index.umd.js +14 -14
  129. package/components/Tooltip/index.umd.js.map +1 -1
  130. package/components/Tooltip/sgds-tooltip.d.ts +4 -7
  131. package/components/Tooltip/sgds-tooltip.js +14 -14
  132. package/components/Tooltip/sgds-tooltip.js.map +1 -1
  133. package/components/index.d.ts +1 -0
  134. package/components/index.js +1 -0
  135. package/components/index.js.map +1 -1
  136. package/components/index.umd.js +1318 -1124
  137. package/components/index.umd.js.map +1 -1
  138. package/icons/arrow-bar-down.svg +3 -0
  139. package/icons/arrow-bar-left.svg +3 -0
  140. package/icons/arrow-bar-right.svg +3 -0
  141. package/icons/arrow-bar-up.svg +3 -0
  142. package/icons/arrow-clockwise.svg +3 -0
  143. package/icons/arrow-down.svg +3 -0
  144. package/icons/arrow-left.svg +3 -0
  145. package/icons/arrow-repeat.svg +3 -0
  146. package/icons/arrow-right.svg +3 -0
  147. package/icons/arrow-up.svg +3 -0
  148. package/icons/bank-fill.svg +3 -0
  149. package/icons/bell-slash.svg +3 -0
  150. package/icons/bell.svg +3 -0
  151. package/icons/bi-funnel.svg +3 -0
  152. package/icons/bookmark-fill.svg +3 -0
  153. package/icons/bookmark.svg +3 -0
  154. package/icons/box-arrow-up-right.svg +3 -0
  155. package/icons/box-seam.svg +3 -0
  156. package/icons/building.svg +3 -0
  157. package/icons/calculator.svg +3 -0
  158. package/icons/calendar-check.svg +4 -0
  159. package/icons/calendar-x.svg +4 -0
  160. package/icons/calendar.svg +3 -0
  161. package/icons/camera.svg +3 -0
  162. package/icons/chat-left-text.svg +3 -0
  163. package/icons/check-circle-fill.svg +3 -0
  164. package/icons/check-circle.svg +3 -0
  165. package/icons/check.svg +3 -0
  166. package/icons/chevron-down.svg +3 -0
  167. package/icons/chevron-left.svg +3 -0
  168. package/icons/chevron-right.svg +3 -0
  169. package/icons/chevron-up .svg +3 -0
  170. package/icons/clock.svg +4 -0
  171. package/icons/cloud-check.svg +4 -0
  172. package/icons/cloud-download.svg +3 -0
  173. package/icons/cloud-upload.svg +3 -0
  174. package/icons/cloud.svg +3 -0
  175. package/icons/compass.svg +4 -0
  176. package/icons/cross.svg +3 -0
  177. package/icons/cursor-fill.svg +3 -0
  178. package/icons/cursor.svg +3 -0
  179. package/icons/dash-circle.svg +3 -0
  180. package/icons/dash-square.svg +3 -0
  181. package/icons/dash.svg +3 -0
  182. package/icons/download.svg +3 -0
  183. package/icons/exclamation-circle-fill.svg +3 -0
  184. package/icons/exclamation-circle.svg +4 -0
  185. package/icons/exclamation-triangle-fill.svg +3 -0
  186. package/icons/exclamation-triangle.svg +4 -0
  187. package/icons/exclamation.svg +4 -0
  188. package/icons/eye-fill.svg +3 -0
  189. package/icons/eye-slash-fill.svg +4 -0
  190. package/icons/eye-slash.svg +3 -0
  191. package/icons/eye.svg +3 -0
  192. package/icons/facebook.svg +3 -0
  193. package/icons/file-earmark-text.svg +3 -0
  194. package/icons/file-pdf.svg +4 -0
  195. package/icons/file-plus.svg +4 -0
  196. package/icons/file-text.svg +3 -0
  197. package/icons/file.svg +3 -0
  198. package/icons/files.svg +4 -0
  199. package/icons/folder-check.svg +4 -0
  200. package/icons/folder-minus.svg +4 -0
  201. package/icons/folder-plus.svg +4 -0
  202. package/icons/folder.svg +3 -0
  203. package/icons/gear.svg +3 -0
  204. package/icons/geo-alt.svg +4 -0
  205. package/icons/geo-fill.svg +4 -0
  206. package/icons/geo.svg +4 -0
  207. package/icons/google.svg +3 -0
  208. package/icons/grid-fill.svg +3 -0
  209. package/icons/hand-thumbs-down.svg +3 -0
  210. package/icons/hand-thumbs-up.svg +3 -0
  211. package/icons/hdd.svg +3 -0
  212. package/icons/house-door.svg +3 -0
  213. package/icons/house.svg +3 -0
  214. package/icons/image.svg +3 -0
  215. package/icons/inbox.svg +3 -0
  216. package/icons/info-circle-fill.svg +3 -0
  217. package/icons/info-circle.svg +4 -0
  218. package/icons/instagram.svg +3 -0
  219. package/icons/layers.svg +3 -0
  220. package/icons/layout-text-window-reverse.svg +3 -0
  221. package/icons/layout-text-window.svg +3 -0
  222. package/icons/layout.svg +3 -0
  223. package/icons/link.svg +3 -0
  224. package/icons/linkedin.svg +3 -0
  225. package/icons/list.svg +3 -0
  226. package/icons/lock-fill.svg +3 -0
  227. package/icons/lock.svg +3 -0
  228. package/icons/mail.svg +3 -0
  229. package/icons/map.svg +3 -0
  230. package/icons/paperclip.svg +3 -0
  231. package/icons/pencil.svg +3 -0
  232. package/icons/pending-circle.svg +3 -0
  233. package/icons/person-dash.svg +3 -0
  234. package/icons/person-plus.svg +3 -0
  235. package/icons/person-x.svg +3 -0
  236. package/icons/person.svg +3 -0
  237. package/icons/pin-map-fill.svg +3 -0
  238. package/icons/pin.svg +3 -0
  239. package/icons/placeholder.svg +3 -0
  240. package/icons/plus-circle.svg +3 -0
  241. package/icons/plus-square.svg +3 -0
  242. package/icons/plus.svg +3 -0
  243. package/icons/printer.svg +3 -0
  244. package/icons/question-circle.svg +4 -0
  245. package/icons/save.svg +3 -0
  246. package/icons/search.svg +3 -0
  247. package/icons/share.svg +3 -0
  248. package/icons/slash-circle.svg +3 -0
  249. package/icons/sliders.svg +3 -0
  250. package/icons/speedometer.svg +3 -0
  251. package/icons/star-fill.svg +3 -0
  252. package/icons/star.svg +3 -0
  253. package/icons/stoplights.svg +4 -0
  254. package/icons/telephone.svg +3 -0
  255. package/icons/three-dots-vertical.svg +3 -0
  256. package/icons/three-dots.svg +3 -0
  257. package/icons/toggle-off.svg +3 -0
  258. package/icons/toggle-on.svg +3 -0
  259. package/icons/trash.svg +3 -0
  260. package/icons/twitter-x.svg +3 -0
  261. package/icons/unlock.svg +3 -0
  262. package/icons/upload.svg +3 -0
  263. package/icons/window-dash.svg +4 -0
  264. package/icons/window-desktop.svg +4 -0
  265. package/icons/window-dock.svg +4 -0
  266. package/icons/window-fullscreen.svg +3 -0
  267. package/icons/window-plus.svg +4 -0
  268. package/icons/window-sidebar.svg +3 -0
  269. package/icons/window-split.svg +3 -0
  270. package/icons/window-stack.svg +3 -0
  271. package/icons/window-x.svg +4 -0
  272. package/icons/window.svg +3 -0
  273. package/icons/x-circle-fill.svg +3 -0
  274. package/icons/x-circle.svg +3 -0
  275. package/icons/youtube.svg +3 -0
  276. package/icons/zoom-in.svg +3 -0
  277. package/icons/zoom-out.svg +3 -0
  278. package/index.d.ts +1 -0
  279. package/index.js +1 -0
  280. package/index.js.map +1 -1
  281. package/index.umd.js +1338 -1119
  282. package/index.umd.js.map +1 -1
  283. package/internals/CloseButton/close-button.js +1 -1
  284. package/internals/CloseButton/sgds-close-button.js +1 -1
  285. package/internals/CloseButton/sgds-close-button.js.map +1 -1
  286. package/package.json +1 -1
  287. package/react/base/button.cjs.js +1 -1
  288. package/react/base/button.js +1 -1
  289. package/react/base/form-control-element.cjs.js +13 -23
  290. package/react/base/form-control-element.cjs.js.map +1 -1
  291. package/react/base/form-control-element.js +13 -23
  292. package/react/base/form-control-element.js.map +1 -1
  293. package/react/checkbox/index.cjs.js +2 -0
  294. package/react/checkbox/index.cjs.js.map +1 -1
  295. package/react/checkbox/index.d.ts +2 -0
  296. package/react/checkbox/index.js +2 -0
  297. package/react/checkbox/index.js.map +1 -1
  298. package/react/components/Accordion/accordion-item.cjs.js +1 -1
  299. package/react/components/Accordion/accordion-item.js +1 -1
  300. package/react/components/Accordion/sgds-accordion-item.cjs.js +6 -18
  301. package/react/components/Accordion/sgds-accordion-item.cjs.js.map +1 -1
  302. package/react/components/Accordion/sgds-accordion-item.js +6 -18
  303. package/react/components/Accordion/sgds-accordion-item.js.map +1 -1
  304. package/react/components/Alert/alert.cjs.js +1 -1
  305. package/react/components/Alert/alert.js +1 -1
  306. package/react/components/Alert/sgds-alert.cjs.js +5 -12
  307. package/react/components/Alert/sgds-alert.cjs.js.map +1 -1
  308. package/react/components/Alert/sgds-alert.js +6 -13
  309. package/react/components/Alert/sgds-alert.js.map +1 -1
  310. package/react/components/Badge/badge.cjs.js +1 -1
  311. package/react/components/Badge/badge.js +1 -1
  312. package/react/components/Badge/sgds-badge.cjs.js +5 -6
  313. package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
  314. package/react/components/Badge/sgds-badge.js +5 -6
  315. package/react/components/Badge/sgds-badge.js.map +1 -1
  316. package/react/components/Button/sgds-button.cjs.js +2 -2
  317. package/react/components/Button/sgds-button.cjs.js.map +1 -1
  318. package/react/components/Button/sgds-button.js +1 -1
  319. package/react/components/Button/sgds-button.js.map +1 -1
  320. package/react/components/Checkbox/checkbox.cjs.js +1 -1
  321. package/react/components/Checkbox/checkbox.js +1 -1
  322. package/react/components/Checkbox/sgds-checkbox-group.cjs.js +15 -4
  323. package/react/components/Checkbox/sgds-checkbox-group.cjs.js.map +1 -1
  324. package/react/components/Checkbox/sgds-checkbox-group.js +15 -4
  325. package/react/components/Checkbox/sgds-checkbox-group.js.map +1 -1
  326. package/react/components/Checkbox/sgds-checkbox.cjs.js +77 -60
  327. package/react/components/Checkbox/sgds-checkbox.cjs.js.map +1 -1
  328. package/react/components/Checkbox/sgds-checkbox.js +77 -60
  329. package/react/components/Checkbox/sgds-checkbox.js.map +1 -1
  330. package/react/components/Datepicker/datepicker-input.cjs.js +24 -7
  331. package/react/components/Datepicker/datepicker-input.cjs.js.map +1 -1
  332. package/react/components/Datepicker/datepicker-input.js +24 -7
  333. package/react/components/Datepicker/datepicker-input.js.map +1 -1
  334. package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
  335. package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
  336. package/react/components/FileUpload/file-upload.cjs.js +1 -1
  337. package/react/components/FileUpload/file-upload.js +1 -1
  338. package/react/components/FileUpload/sgds-file-upload.cjs.js +145 -101
  339. package/react/components/FileUpload/sgds-file-upload.cjs.js.map +1 -1
  340. package/react/components/FileUpload/sgds-file-upload.js +147 -103
  341. package/react/components/FileUpload/sgds-file-upload.js.map +1 -1
  342. package/react/components/Footer/footer-item.cjs.js +11 -0
  343. package/react/components/Footer/footer-item.cjs.js.map +1 -0
  344. package/react/components/Footer/footer-item.js +7 -0
  345. package/react/components/Footer/footer-item.js.map +1 -0
  346. package/react/components/Footer/footer.cjs.js +1 -1
  347. package/react/components/Footer/footer.js +1 -1
  348. package/react/components/Footer/sgds-footer-item.cjs.js +33 -0
  349. package/react/components/Footer/sgds-footer-item.cjs.js.map +1 -0
  350. package/react/components/Footer/sgds-footer-item.js +28 -0
  351. package/react/components/Footer/sgds-footer-item.js.map +1 -0
  352. package/react/components/Footer/sgds-footer.cjs.js +65 -90
  353. package/react/components/Footer/sgds-footer.cjs.js.map +1 -1
  354. package/react/components/Footer/sgds-footer.js +65 -90
  355. package/react/components/Footer/sgds-footer.js.map +1 -1
  356. package/react/components/Icon/icon.cjs.js +11 -0
  357. package/react/components/Icon/icon.cjs.js.map +1 -0
  358. package/react/components/Icon/icon.js +7 -0
  359. package/react/components/Icon/icon.js.map +1 -0
  360. package/react/components/Icon/sgds-icon.cjs.js +70 -0
  361. package/react/components/Icon/sgds-icon.cjs.js.map +1 -0
  362. package/react/components/Icon/sgds-icon.js +65 -0
  363. package/react/components/Icon/sgds-icon.js.map +1 -0
  364. package/react/components/IconButton/icon-button.cjs.js +1 -1
  365. package/react/components/IconButton/icon-button.js +1 -1
  366. package/react/components/IconButton/sgds-icon-button.cjs.js +4 -9
  367. package/react/components/IconButton/sgds-icon-button.cjs.js.map +1 -1
  368. package/react/components/IconButton/sgds-icon-button.js +4 -9
  369. package/react/components/IconButton/sgds-icon-button.js.map +1 -1
  370. package/react/components/Input/sgds-input.cjs.js +101 -64
  371. package/react/components/Input/sgds-input.cjs.js.map +1 -1
  372. package/react/components/Input/sgds-input.js +103 -66
  373. package/react/components/Input/sgds-input.js.map +1 -1
  374. package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js +128 -61
  375. package/react/components/QuantityToggle/sgds-quantity-toggle.cjs.js.map +1 -1
  376. package/react/components/QuantityToggle/sgds-quantity-toggle.js +129 -62
  377. package/react/components/QuantityToggle/sgds-quantity-toggle.js.map +1 -1
  378. package/react/components/Radio/sgds-radio-group.cjs.js +99 -83
  379. package/react/components/Radio/sgds-radio-group.cjs.js.map +1 -1
  380. package/react/components/Radio/sgds-radio-group.js +100 -84
  381. package/react/components/Radio/sgds-radio-group.js.map +1 -1
  382. package/react/components/Radio/sgds-radio.cjs.js +1 -1
  383. package/react/components/Radio/sgds-radio.cjs.js.map +1 -1
  384. package/react/components/Radio/sgds-radio.js +1 -1
  385. package/react/components/Radio/sgds-radio.js.map +1 -1
  386. package/react/components/Stepper/sgds-stepper.cjs.js +1 -0
  387. package/react/components/Stepper/sgds-stepper.cjs.js.map +1 -1
  388. package/react/components/Stepper/sgds-stepper.js +1 -0
  389. package/react/components/Stepper/sgds-stepper.js.map +1 -1
  390. package/react/components/Switch/sgds-switch.cjs.js +1 -2
  391. package/react/components/Switch/sgds-switch.cjs.js.map +1 -1
  392. package/react/components/Switch/sgds-switch.js +1 -2
  393. package/react/components/Switch/sgds-switch.js.map +1 -1
  394. package/react/components/Textarea/sgds-textarea.cjs.js +76 -73
  395. package/react/components/Textarea/sgds-textarea.cjs.js.map +1 -1
  396. package/react/components/Textarea/sgds-textarea.js +78 -75
  397. package/react/components/Textarea/sgds-textarea.js.map +1 -1
  398. package/react/components/Textarea/textarea.cjs.js +1 -1
  399. package/react/components/Textarea/textarea.js +1 -1
  400. package/react/components/Toast/sgds-toast.cjs.js +6 -18
  401. package/react/components/Toast/sgds-toast.cjs.js.map +1 -1
  402. package/react/components/Toast/sgds-toast.js +6 -18
  403. package/react/components/Toast/sgds-toast.js.map +1 -1
  404. package/react/components/Toast/toast.cjs.js +1 -1
  405. package/react/components/Toast/toast.js +1 -1
  406. package/react/components/Tooltip/sgds-tooltip.cjs.js +14 -14
  407. package/react/components/Tooltip/sgds-tooltip.cjs.js.map +1 -1
  408. package/react/components/Tooltip/sgds-tooltip.js +14 -14
  409. package/react/components/Tooltip/sgds-tooltip.js.map +1 -1
  410. package/react/footer-item/index.cjs.js +39 -0
  411. package/react/footer-item/index.cjs.js.map +1 -0
  412. package/react/footer-item/index.d.ts +3 -0
  413. package/react/footer-item/index.js +15 -0
  414. package/react/footer-item/index.js.map +1 -0
  415. package/react/icon/index.cjs.js +42 -0
  416. package/react/icon/index.cjs.js.map +1 -0
  417. package/react/icon/index.d.ts +6 -0
  418. package/react/icon/index.js +18 -0
  419. package/react/icon/index.js.map +1 -0
  420. package/react/index.cjs.js +64 -60
  421. package/react/index.cjs.js.map +1 -1
  422. package/react/index.d.ts +2 -0
  423. package/react/index.js +2 -0
  424. package/react/index.js.map +1 -1
  425. package/react/input/index.cjs.js +3 -1
  426. package/react/input/index.cjs.js.map +1 -1
  427. package/react/input/index.d.ts +2 -0
  428. package/react/input/index.js +3 -1
  429. package/react/input/index.js.map +1 -1
  430. package/react/internals/CloseButton/close-button.cjs.js +1 -1
  431. package/react/internals/CloseButton/close-button.js +1 -1
  432. package/react/internals/CloseButton/sgds-close-button.cjs.js +1 -1
  433. package/react/internals/CloseButton/sgds-close-button.cjs.js.map +1 -1
  434. package/react/internals/CloseButton/sgds-close-button.js +1 -1
  435. package/react/internals/CloseButton/sgds-close-button.js.map +1 -1
  436. package/react/styles/form-hint.cjs.js +1 -1
  437. package/react/styles/form-hint.js +1 -1
  438. package/react/styles/form-label.cjs.js +1 -1
  439. package/react/styles/form-label.js +1 -1
  440. package/react/utils/formSubmitController.cjs.js +64 -0
  441. package/react/utils/formSubmitController.cjs.js.map +1 -0
  442. package/react/utils/formSubmitController.js +60 -0
  443. package/react/utils/formSubmitController.js.map +1 -0
  444. package/react/utils/inputValidationController.cjs.js +130 -0
  445. package/react/utils/inputValidationController.cjs.js.map +1 -0
  446. package/react/utils/inputValidationController.js +126 -0
  447. package/react/utils/inputValidationController.js.map +1 -0
  448. package/react/utils/validatorMixin.cjs.js +108 -0
  449. package/react/utils/validatorMixin.cjs.js.map +1 -0
  450. package/react/utils/validatorMixin.js +104 -0
  451. package/react/utils/validatorMixin.js.map +1 -0
  452. package/styles/form-hint.js +1 -1
  453. package/styles/form-label.js +1 -1
  454. package/themes/day.css +1 -1
  455. package/themes/night.css +3 -2
  456. package/themes/root.css +1 -0
  457. package/utils/{form.d.ts → formSubmitController.d.ts} +10 -20
  458. package/utils/formSubmitController.js +59 -0
  459. package/utils/formSubmitController.js.map +1 -0
  460. package/utils/inputValidationController.d.ts +70 -0
  461. package/utils/inputValidationController.js +125 -0
  462. package/utils/inputValidationController.js.map +1 -0
  463. package/utils/validatorMixin.d.ts +24 -0
  464. package/utils/validatorMixin.js +103 -0
  465. package/utils/validatorMixin.js.map +1 -0
  466. package/base/form-check-element.d.ts +0 -50
  467. package/base/form-check-element.js +0 -169
  468. package/base/form-check-element.js.map +0 -1
  469. package/react/base/form-check-element.cjs.js +0 -175
  470. package/react/base/form-check-element.cjs.js.map +0 -1
  471. package/react/base/form-check-element.js +0 -170
  472. package/react/base/form-check-element.js.map +0 -1
  473. package/react/utils/form.cjs.js +0 -137
  474. package/react/utils/form.cjs.js.map +0 -1
  475. package/react/utils/form.js +0 -133
  476. package/react/utils/form.js.map +0 -1
  477. package/utils/form.js +0 -132
  478. package/utils/form.js.map +0 -1
@@ -4515,7 +4515,7 @@
4515
4515
  */
4516
4516
  const classMap = directive(ClassMapDirective);
4517
4517
 
4518
- var css_248z$12 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-heading);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}::slotted(a){color:var(--sgds-link);text-decoration:var(--sgds-link-decoration)}::slotted(a:hover){color:var(--sgds-link-hover-color)}::slotted(svg){vertical-align:middle}}`;
4518
+ var css_248z$13 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-heading);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}::slotted(a[target=_blank]):after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}::slotted(a){color:var(--sgds-link);text-decoration:var(--sgds-link-decoration)}::slotted(a:hover){color:var(--sgds-link-hover-color)}::slotted(svg){vertical-align:middle}}`;
4519
4519
 
4520
4520
  /**
4521
4521
  * @cssprop --sgds-{stateColor} - State colors in hexadecimal value
@@ -4533,9 +4533,9 @@
4533
4533
  return event;
4534
4534
  }
4535
4535
  }
4536
- SgdsElement.styles = [css_248z$12];
4536
+ SgdsElement.styles = [css_248z$13];
4537
4537
 
4538
- var css_248z$11 = css`:host([variant=border]) .accordion{border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted);border-radius:var(--sgds-border-radius-md)}`;
4538
+ var css_248z$12 = css`:host([variant=border]) .accordion{border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted);border-radius:var(--sgds-border-radius-md)}`;
4539
4539
 
4540
4540
  const VALID_KEYS = ["Enter", "ArrowUp", "ArrowLeft", "ArrowDown", "ArrowRight"];
4541
4541
  /**
@@ -4611,7 +4611,7 @@
4611
4611
  `;
4612
4612
  }
4613
4613
  }
4614
- SgdsAccordion.styles = [...SgdsElement.styles, css_248z$11];
4614
+ SgdsAccordion.styles = [...SgdsElement.styles, css_248z$12];
4615
4615
  __decorate([
4616
4616
  property({ type: Boolean, reflect: true })
4617
4617
  ], SgdsAccordion.prototype, "allowMultiple", void 0);
@@ -4754,7 +4754,7 @@
4754
4754
  };
4755
4755
  }
4756
4756
 
4757
- var css_248z$10 = css`:host([variant=border][last-of-type]) .accordion-item{border-bottom:none}:host([density=compact]) .accordion-btn{font-size:var(--sgds-font-size-2);line-height:var(--sgds-line-height-heading);padding:var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) .accordion-content{padding:var(--sgds-padding-xs) var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) slot[name=accordion-caret] svg,:host([density=compact]) slot[name=accordion-caret]::slotted(*){height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}.accordion-item{border-bottom:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted)}.accordion-btn{align-items:center;background-color:var(--sgds-default-bg-transparent);border:0;color:var(--sgds-default-color);display:flex;font-size:var(--sgds-font-size-3);gap:var(--sgds-gap-sm);line-height:var(--sgds-line-height-body);overflow-anchor:none;padding:var(--sgds-padding-lg) var(--sgds-padding-lg);text-align:left;width:100%}@media (prefers-reduced-motion:reduce){.accordion-btn,.accordion-btn:after{transition:none}}.accordion-btn:not(.collapsed){font-weight:var(--sgds-font-weight-semibold)}.accordion-btn:hover{background-color:var(--sgds-default-bg-translucent);z-index:2}.accordion-btn:focus,.accordion-btn:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0;z-index:3}.accordion-btn.disabled,.accordion-btn:disabled{cursor:not-allowed;opacity:var(--sgds-opacity-50)}slot[name=accordion-caret] svg,slot[name=accordion-caret]::slotted(*){color:var(--sgds-default-color-subtle);height:var(--sgds-icon-size-lg);margin-left:auto;transition:transform .2s ease-in-out;width:var(--sgds-icon-size-lg)}.accordion-btn:not(.collapsed) slot[name=accordion-caret] svg,.accordion-btn:not(.collapsed) slot[name=accordion-caret]::slotted(*){transform:rotate(-180deg)}.accordion-body{overflow:hidden;padding:0}.accordion-content{display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg) var(--sgds-padding-lg)}.hidden{display:none}`;
4757
+ var css_248z$11 = css`:host([variant=border][last-of-type]) .accordion-item{border-bottom:none}:host([density=compact]) .accordion-btn{font-size:var(--sgds-font-size-2);line-height:var(--sgds-line-height-heading);padding:var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) .content{padding:var(--sgds-padding-xs) var(--sgds-padding-sm) var(--sgds-padding-sm)}:host([density=compact]) slot[name=caret] svg,:host([density=compact]) slot[name=caret]::slotted(*){height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}.accordion-item{border-bottom:var(--sgds-border-width-1) solid var(--sgds-default-border-color-muted)}.accordion-btn{align-items:center;background-color:var(--sgds-default-bg-transparent);border:0;color:var(--sgds-default-color);display:flex;font-size:var(--sgds-font-size-3);gap:var(--sgds-gap-sm);line-height:var(--sgds-line-height-body);overflow-anchor:none;padding:var(--sgds-padding-lg) var(--sgds-padding-lg);text-align:left;width:100%}@media (prefers-reduced-motion:reduce){.accordion-btn,.accordion-btn:after{transition:none}}.accordion-btn:not(.collapsed){font-weight:var(--sgds-font-weight-semibold)}.accordion-btn:hover{background-color:var(--sgds-default-bg-translucent);z-index:2}.accordion-btn:focus,.accordion-btn:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0;z-index:3}.accordion-btn.disabled,.accordion-btn:disabled{cursor:not-allowed;opacity:var(--sgds-opacity-50)}slot[name=caret] svg,slot[name=caret]::slotted(*){color:var(--sgds-default-color-subtle);height:var(--sgds-icon-size-lg);margin-left:auto;transition:transform .2s ease-in-out;width:var(--sgds-icon-size-lg)}.accordion-btn:not(.collapsed) slot[name=caret] svg,.accordion-btn:not(.collapsed) slot[name=caret]::slotted(*){transform:rotate(-180deg)}.accordion-body{overflow:hidden;padding:0}.content{display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg) var(--sgds-padding-lg)}.hidden{display:none}`;
4758
4758
 
4759
4759
  /**
4760
4760
  *
@@ -4763,13 +4763,9 @@
4763
4763
  * @event sgds-hide - Emitted on hide.
4764
4764
  * @event sgds-after-hide - Emitted on hide after animation has completed.
4765
4765
  *
4766
- * @csspart base - The accordion-item base wrapper.
4767
- * @csspart header - The accordion-item button header.
4768
- * @csspart content - The accordion-item content.
4769
- *
4770
- * @slot accordion-header - The accordion-item button header slot.
4771
- * @slot accordion-content - The accordion-item content slot.
4772
- * @slot accordion-caret - The caret icon of accordion-item.
4766
+ * @slot header - The accordion-item button header slot.
4767
+ * @slot content - The accordion-item content slot.
4768
+ * @slot caret - The caret icon of accordion-item.
4773
4769
  *
4774
4770
  */
4775
4771
  class SgdsAccordionItem extends SgdsElement {
@@ -4864,7 +4860,6 @@
4864
4860
  render() {
4865
4861
  return html$1 `
4866
4862
  <div
4867
- part="base"
4868
4863
  class=${classMap({
4869
4864
  "accordion-item": true
4870
4865
  })}
@@ -4876,7 +4871,6 @@
4876
4871
  collapsed: !this.open
4877
4872
  })}
4878
4873
  ?disabled=${this.disabled}
4879
- part="header"
4880
4874
  role="button"
4881
4875
  aria-expanded=${this.open ? "true" : "false"}
4882
4876
  aria-disabled=${this.disabled ? "true" : "false"}
@@ -4885,8 +4879,8 @@
4885
4879
  @click=${this.handleSummaryClick}
4886
4880
  @keydown=${this.handleSummaryKeyDown}
4887
4881
  >
4888
- <slot name="accordion-header"></slot>
4889
- <slot name="accordion-caret">
4882
+ <slot name="header"></slot>
4883
+ <slot name="caret">
4890
4884
  <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
4891
4885
  <path
4892
4886
  fill-rule="evenodd"
@@ -4898,19 +4892,13 @@
4898
4892
  </slot>
4899
4893
  </button>
4900
4894
  <div class="accordion-body">
4901
- <slot
4902
- id="content"
4903
- name="accordion-content"
4904
- class="accordion-content"
4905
- role="region"
4906
- aria-labelledby="header"
4907
- ></slot>
4895
+ <slot id="content" name="content" class="content" role="region" aria-labelledby="header"></slot>
4908
4896
  </div>
4909
4897
  </div>
4910
4898
  `;
4911
4899
  }
4912
4900
  }
4913
- SgdsAccordionItem.styles = [...SgdsElement.styles, css_248z$10];
4901
+ SgdsAccordionItem.styles = [...SgdsElement.styles, css_248z$11];
4914
4902
  __decorate([
4915
4903
  query(".accordion-item")
4916
4904
  ], SgdsAccordionItem.prototype, "accordion", void 0);
@@ -5791,21 +5779,21 @@
5791
5779
  */
5792
5780
  const html = withStatic(html$1);
5793
5781
 
5794
- var css_248z$$ = css`.card{word-wrap:break-word;background-clip:border-box;background-color:var(--sgds-body-bg);border:var(--sgds-border-width) solid var(--sgds-border-color-translucent);border-radius:var(--sgds-border-radius);box-shadow:none;display:flex;flex-direction:column;height:auto;min-width:0;position:relative}.card,.card-body{color:var(--sgds-body-color)}.card-body{flex:1 1 auto;padding:var(--sgds-spacer-4)}.card-title{color:var(--sgds-body-color);margin-bottom:var(--sgds-spacer-2)}.card-subtitle,.card-text:last-child{margin-bottom:0}slot[name=card-image]::slotted(img){border-top-left-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width));border-top-right-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width))}slot[name=card-link]::slotted(*){font-weight:700}`;
5782
+ var css_248z$10 = css`.card{word-wrap:break-word;background-clip:border-box;background-color:var(--sgds-body-bg);border:var(--sgds-border-width) solid var(--sgds-border-color-translucent);border-radius:var(--sgds-border-radius);box-shadow:none;display:flex;flex-direction:column;height:auto;min-width:0;position:relative}.card,.card-body{color:var(--sgds-body-color)}.card-body{flex:1 1 auto;padding:var(--sgds-spacer-4)}.card-title{color:var(--sgds-body-color);margin-bottom:var(--sgds-spacer-2)}.card-subtitle,.card-text:last-child{margin-bottom:0}slot[name=card-image]::slotted(img){border-top-left-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width));border-top-right-radius:calc(var(--sgds-border-radius) - var(--sgds-border-width))}slot[name=card-link]::slotted(*){font-weight:700}`;
5795
5783
 
5796
- var css_248z$_ = css`.text-primary{color:var(--sgds-primary-rgb)!important}.text-secondary{color:var(--sgds-secondary-rgb)!important}.text-success{color:var(--sgds-success-rgb)!important}.text-info{color:var(--sgds-info-rgb)!important}.text-warning{color:var(--sgds-warning-rgb)!important}.text-danger{color:var(--sgds-danger-rgb)!important}.text-light{color:var(--sgds-light-rgb)!important}.text-dark{color:var(--sgds-dark-rgb)!important}.text-muted{color:var(--sgds-secondary-color)!important}`;
5784
+ var css_248z$$ = css`.text-primary{color:var(--sgds-primary-rgb)!important}.text-secondary{color:var(--sgds-secondary-rgb)!important}.text-success{color:var(--sgds-success-rgb)!important}.text-info{color:var(--sgds-info-rgb)!important}.text-warning{color:var(--sgds-warning-rgb)!important}.text-danger{color:var(--sgds-danger-rgb)!important}.text-light{color:var(--sgds-light-rgb)!important}.text-dark{color:var(--sgds-dark-rgb)!important}.text-muted{color:var(--sgds-secondary-color)!important}`;
5797
5785
 
5798
- var css_248z$Z = css`.bg-primary{background-color:var(--sgds-primary)!important}.bg-secondary{background-color:var(--sgds-secondary)!important}.bg-success{background-color:var(--sgds-success)!important}.bg-info{background-color:var(--sgds-info)!important}.bg-warning{background-color:var(--sgds-warning)!important}.bg-danger{background-color:var(--sgds-danger)!important}.bg-light{background-color:var(--sgds-light)!important}.bg-dark{background-color:var(--sgds-dark)!important}`;
5786
+ var css_248z$_ = css`.bg-primary{background-color:var(--sgds-primary)!important}.bg-secondary{background-color:var(--sgds-secondary)!important}.bg-success{background-color:var(--sgds-success)!important}.bg-info{background-color:var(--sgds-info)!important}.bg-warning{background-color:var(--sgds-warning)!important}.bg-danger{background-color:var(--sgds-danger)!important}.bg-light{background-color:var(--sgds-light)!important}.bg-dark{background-color:var(--sgds-dark)!important}`;
5799
5787
 
5800
- var css_248z$Y = css`.border-primary{border-color:var(--sgds-primary)!important}.border-secondary{border-color:var(--sgds-secondary)!important}.border-success{border-color:var(--sgds-success)!important}.border-info{border-color:var(--sgds-info)!important}.border-warning{border-color:var(--sgds-warning)!important}.border-danger{border-color:var(--sgds-danger)!important}.border-light{border-color:var(--sgds-light)!important}.border-dark{border-color:var(--sgds-dark)!important}`;
5788
+ var css_248z$Z = css`.border-primary{border-color:var(--sgds-primary)!important}.border-secondary{border-color:var(--sgds-secondary)!important}.border-success{border-color:var(--sgds-success)!important}.border-info{border-color:var(--sgds-info)!important}.border-warning{border-color:var(--sgds-warning)!important}.border-danger{border-color:var(--sgds-danger)!important}.border-light{border-color:var(--sgds-light)!important}.border-dark{border-color:var(--sgds-dark)!important}`;
5801
5789
 
5802
- var css_248z$X = css`.h1,.h2,.h3,.h4,.h5,.h6 ::slotted(h6),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),h1,h2,h3,h4,h5,h6{color:var(--sgds-heading-color);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}.h1,::slotted(h1),h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,::slotted(h1),h1{font-size:2.5rem}}.h2,::slotted(h2),h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,::slotted(h2),h2{font-size:2rem}}.h3,::slotted(h3),h3{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h3,::slotted(h3),h3{font-size:1.5rem}}.h4,::slotted(h4),h4{font-size:1.125rem}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{font-size:1rem}.h1,::slotted(h1),h1{line-height:1.2}.h2,::slotted(h2),h2{line-height:1.25}.h3,::slotted(h3),h3{line-height:1.33}.h4,::slotted(h4),h4{line-height:1.78}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{line-height:1.2}`;
5790
+ var css_248z$Y = css`.h1,.h2,.h3,.h4,.h5,.h6 ::slotted(h6),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),h1,h2,h3,h4,h5,h6{color:var(--sgds-heading-color);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}.h1,::slotted(h1),h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,::slotted(h1),h1{font-size:2.5rem}}.h2,::slotted(h2),h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,::slotted(h2),h2{font-size:2rem}}.h3,::slotted(h3),h3{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h3,::slotted(h3),h3{font-size:1.5rem}}.h4,::slotted(h4),h4{font-size:1.125rem}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{font-size:1rem}.h1,::slotted(h1),h1{line-height:1.2}.h2,::slotted(h2),h2{line-height:1.25}.h3,::slotted(h3),h3{line-height:1.33}.h4,::slotted(h4),h4{line-height:1.78}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{line-height:1.2}`;
5803
5791
 
5804
- var css_248z$W = css`p{margin-bottom:1.5rem;margin-top:0}`;
5792
+ var css_248z$X = css`p{margin-bottom:1.5rem;margin-top:0}`;
5805
5793
 
5806
5794
  class CardElement extends SgdsElement {
5807
5795
  }
5808
- CardElement.styles = [...SgdsElement.styles, css_248z$_, css_248z$Z, css_248z$Y, css_248z$X, css_248z$W, css_248z$$];
5796
+ CardElement.styles = [...SgdsElement.styles, css_248z$$, css_248z$_, css_248z$Z, css_248z$Y, css_248z$X, css_248z$10];
5809
5797
  __decorate([
5810
5798
  property()
5811
5799
  ], CardElement.prototype, "borderColor", void 0);
@@ -5833,6 +5821,56 @@
5833
5821
  */
5834
5822
  const ifDefined = (value) => value ?? nothing;
5835
5823
 
5824
+ var css_248z$W = css`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback{color:var(--sgds-form-danger-color);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-regular)}`;
5825
+
5826
+ var css_248z$V = css`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-1)}.form-text.disabled{opacity:var(--sgds-opacity-50)}`;
5827
+
5828
+ var css_248z$U = css`.form-label{color:var(--sgds-form-color);margin-bottom:0}.form-label.disabled{opacity:var(--sgds-opacity-50)}.form-check-label{color:var(--sgds-form-color)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`;
5829
+
5830
+ var css_248z$T = css`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-heading)}`;
5831
+
5832
+ class FormControlElement extends SgdsElement {
5833
+ constructor() {
5834
+ super(...arguments);
5835
+ /** The input's label */
5836
+ this.label = "";
5837
+ /** The input's hint text */
5838
+ this.hintText = "";
5839
+ /** Disables the input. */
5840
+ this.disabled = false;
5841
+ /** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
5842
+ this.invalid = false;
5843
+ this._controlId = genId("input");
5844
+ this._labelId = genId("label");
5845
+ }
5846
+ /** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
5847
+ setInvalid(bool) {
5848
+ this.invalid = bool;
5849
+ if (bool) {
5850
+ this.emit("sgds-invalid");
5851
+ }
5852
+ else {
5853
+ this.emit("sgds-valid");
5854
+ }
5855
+ }
5856
+ }
5857
+ FormControlElement.styles = [...SgdsElement.styles, css_248z$W, css_248z$V, css_248z$U, css_248z$T];
5858
+ __decorate([
5859
+ property({ reflect: true })
5860
+ ], FormControlElement.prototype, "label", void 0);
5861
+ __decorate([
5862
+ property({ reflect: true })
5863
+ ], FormControlElement.prototype, "hintText", void 0);
5864
+ __decorate([
5865
+ property({ reflect: true })
5866
+ ], FormControlElement.prototype, "name", void 0);
5867
+ __decorate([
5868
+ property({ type: Boolean, reflect: true })
5869
+ ], FormControlElement.prototype, "disabled", void 0);
5870
+ __decorate([
5871
+ property({ type: Boolean, reflect: true })
5872
+ ], FormControlElement.prototype, "invalid", void 0);
5873
+
5836
5874
  // @defaultValue decorator
5837
5875
  const defaultValue = (propertyName = "value") => (proto, key) => {
5838
5876
  const ctor = proto.constructor;
@@ -5853,294 +5891,227 @@
5853
5891
  };
5854
5892
  };
5855
5893
 
5856
- const reportValidityOverloads = new WeakMap();
5857
- class FormSubmitController {
5894
+ /**
5895
+ * SGDS custom form validation methods and behaviours
5896
+ */
5897
+ class InputValidationController {
5858
5898
  constructor(host, options) {
5859
5899
  (this.host = host).addController(this);
5860
- this.options = Object.assign({ form: (input) => {
5861
- return input.closest("form");
5862
- }, name: (input) => input.name, value: (input) => input.value, defaultValue: (input) => input.defaultValue, disabled: (input) => input.disabled, reportValidity: (input) => {
5863
- return typeof input.reportValidity === "function" ? input.reportValidity() : true;
5864
- }, setValue: (input, value) => {
5865
- input.value = value;
5866
- } }, options);
5867
- this.handleFormData = this.handleFormData.bind(this);
5868
- this.handleFormSubmit = this.handleFormSubmit.bind(this);
5869
- this.handleFormReset = this.handleFormReset.bind(this);
5870
- this.reportFormValidity = this.reportFormValidity.bind(this);
5900
+ this._internals = this.host.attachInternals();
5901
+ this.options = Object.assign({ setInvalid: (host, value) => {
5902
+ host.invalid = value;
5903
+ }, value: (host) => {
5904
+ return host.value;
5905
+ }, input: (host) => host.input }, options);
5871
5906
  }
5872
5907
  hostConnected() {
5873
- this.form = this.options.form(this.host);
5874
- if (this.form) {
5875
- this.form.addEventListener("formdata", this.handleFormData);
5876
- this.form.addEventListener("submit", this.handleFormSubmit);
5877
- this.form.addEventListener("reset", this.handleFormReset);
5878
- // Overload the form's reportValidity() method so it looks at Shoelace form controls
5879
- if (!reportValidityOverloads.has(this.form)) {
5880
- reportValidityOverloads.set(this.form, this.form.reportValidity);
5881
- this.form.reportValidity = () => this.reportFormValidity();
5882
- }
5883
- }
5908
+ this.host.addEventListener("invalid", e => this.handleInvalid(e));
5884
5909
  }
5885
5910
  hostDisconnected() {
5886
- if (this.form) {
5887
- this.form.removeEventListener("formdata", this.handleFormData);
5888
- this.form.removeEventListener("submit", this.handleFormSubmit);
5889
- this.form.removeEventListener("reset", this.handleFormReset);
5890
- // Remove the overload and restore the original method
5891
- if (reportValidityOverloads.has(this.form)) {
5892
- this.form.reportValidity = reportValidityOverloads.get(this.form);
5893
- reportValidityOverloads.delete(this.form);
5894
- }
5895
- this.form = undefined;
5896
- }
5911
+ this.host.removeEventListener("invalid", e => this.handleInvalid(e));
5897
5912
  }
5898
- handleFormData(event) {
5899
- const disabled = this.options.disabled(this.host);
5900
- const name = this.options.name(this.host);
5901
- const value = this.options.value(this.host);
5902
- if (!disabled && typeof name === "string" && typeof value !== "undefined") {
5903
- if (Array.isArray(value)) {
5904
- value.forEach(val => {
5905
- event.formData.append(name, val.toString());
5906
- });
5907
- }
5908
- else {
5909
- event.formData.append(name, value.toString());
5910
- }
5911
- }
5913
+ /**
5914
+ * Prevents the native browser error message pop up when reportValidity() called by
5915
+ * associated form or the component's reportValidity during constraint validation
5916
+ * Sets invalid reactive prop to true
5917
+ */
5918
+ handleInvalid(e) {
5919
+ e.preventDefault();
5920
+ this.options.setInvalid(this.host, true);
5912
5921
  }
5913
- handleFormSubmit(event) {
5914
- const disabled = this.options.disabled(this.host);
5915
- const reportValidity = this.options.reportValidity;
5916
- if (this.form && !this.form.noValidate && !disabled && !reportValidity(this.host)) {
5917
- event.preventDefault();
5918
- event.stopImmediatePropagation();
5919
- }
5920
- }
5921
- handleFormReset() {
5922
- this.options.setValue(this.host, this.options.defaultValue(this.host));
5923
- }
5924
- reportFormValidity() {
5925
- //
5926
- // Shoelace form controls work hard to act like regular form controls. They support the Constraint Validation API
5927
- // and its associated methods such as setCustomValidity() and reportValidity(). However, the HTMLFormElement also
5928
- // has a reportValidity() method that will trigger validation on all child controls. Since we're not yet using
5929
- // ElementInternals, we need to overload this method so it looks for any element with the reportValidity() method.
5930
- //
5931
- // We preserve the original method in a WeakMap, but we don't call it from the overload because that would trigger
5932
- // validations in an unexpected order. When the element disconnects, we revert to the original behavior. This won't
5933
- // be necessary once we can use ElementInternals.
5934
- //
5935
- // Note that we're also honoring the form's novalidate attribute.
5936
- //
5937
- if (this.form && !this.form.noValidate) {
5938
- // This seems sloppy, but checking all elements will cover native inputs, Shoelace inputs, and other custom
5939
- // elements that support the constraint validation API.
5940
- const elements = this.form.querySelectorAll("*");
5941
- for (const element of elements) {
5942
- if (typeof element.reportValidity === "function") {
5943
- if (!element.reportValidity()) {
5944
- return false;
5945
- }
5946
- }
5947
- }
5948
- }
5949
- return true;
5922
+ /**
5923
+ * Sets invalid to false when invoked and
5924
+ * Updates the ValidityState based on new value, but
5925
+ * does not update invalid reactive prop
5926
+ * @param e
5927
+ */
5928
+ handleInput(e) {
5929
+ const input = e.target;
5930
+ this.options.setInvalid(this.host, false);
5931
+ this.validateInput(input);
5950
5932
  }
5951
- doAction(type, invoker) {
5952
- if (this.form) {
5953
- const button = document.createElement("button");
5954
- button.type = type;
5955
- button.style.position = "absolute";
5956
- button.style.width = "0";
5957
- button.style.height = "0";
5958
- button.style.clipPath = "inset(50%)";
5959
- button.style.overflow = "hidden";
5960
- button.style.whiteSpace = "nowrap";
5961
- // Pass form attributes through to the temporary button
5962
- if (invoker) {
5963
- ["formaction", "formmethod", "formnovalidate", "formtarget"].forEach(attr => {
5964
- if (invoker.hasAttribute(attr)) {
5965
- button.setAttribute(attr, invoker.getAttribute(attr));
5966
- }
5967
- });
5968
- }
5969
- this.form.append(button);
5970
- button.click();
5971
- button.remove();
5972
- }
5933
+ /**
5934
+ * Validate the input's new value after onChange and
5935
+ * update invalid reactive prop
5936
+ * @param e
5937
+ */
5938
+ handleChange(e) {
5939
+ const input = e.target;
5940
+ this.validateInput(input);
5941
+ this.options.setInvalid(this.host, !this.checkValidity());
5973
5942
  }
5974
- /** Resets the form, restoring all the control to their default value */
5975
- reset(invoker) {
5976
- this.doAction("reset", invoker);
5943
+ get form() {
5944
+ return this._internals.form;
5977
5945
  }
5978
- /** Submits the form, triggering validation and form data injection. */
5979
- submit(invoker) {
5980
- // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
5981
- // native submit button into the form, "click" it, then remove it to simulate a standard form submission.
5982
- this.doAction("submit", invoker);
5946
+ get validity() {
5947
+ return this._internals.validity;
5983
5948
  }
5984
- }
5985
-
5986
- class FormCheckElement extends SgdsElement {
5987
- constructor() {
5988
- super(...arguments);
5989
- /**@internal */
5990
- this.formSubmitController = new FormSubmitController(this, {
5991
- value: (control) => (control.checked ? control.value : undefined),
5992
- defaultValue: (control) => control.defaultChecked,
5993
- setValue: (control, checked) => (control.checked = checked)
5994
- });
5995
- /** For aria-label when there is no appropriate text label visible */
5996
- this.ariaLabel = "checkbox";
5997
- /** Makes the checkbox a required field. */
5998
- this.required = false;
5999
- /** Draws the checkbox in a checked state. */
6000
- this.checked = false;
6001
- /** Disables the checkbox (so the user can't check / uncheck it). */
6002
- this.disabled = false;
6003
- /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
6004
- this.hasFeedback = false;
6005
- /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
6006
- this.defaultChecked = false;
6007
- /** Marks the checkbox input as invalid. Replace the pseudo :invalid selector for absent in custom elements */
6008
- this.invalid = false;
6009
- /** Marks the checkbox input as indeterminate , with indeterminate logo */
6010
- this.indeterminate = false;
5949
+ get validationMessage() {
5950
+ return this._internals.validationMessage;
6011
5951
  }
6012
- _handleInvalidChange() {
6013
- this.emit("sgds-validity-change", { detail: { invalid: this.invalid } });
5952
+ get willValidate() {
5953
+ return this._internals.willValidate;
6014
5954
  }
6015
- /** Simulates a click on the checkbox. */
6016
- click() {
6017
- this.input.click();
5955
+ /**
5956
+ * Checks the validity and updates the invalid reactive prop of form components
5957
+ */
5958
+ updateInvalidState() {
5959
+ this.options.setInvalid(this.host, !this.checkValidity());
6018
5960
  }
6019
- /** Sets focus on the checkbox. */
6020
- focus(options) {
6021
- this.input.focus(options);
5961
+ /**
5962
+ * Resets the ValidityState of the control
5963
+ */
5964
+ resetValidity() {
5965
+ return this._internals.setValidity({});
6022
5966
  }
6023
- /** Removes focus from the checkbox. */
6024
- blur() {
6025
- this.input.blur();
5967
+ /**
5968
+ * Reports the validity
5969
+ */
5970
+ checkValidity() {
5971
+ return this._internals.checkValidity();
6026
5972
  }
6027
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
5973
+ /**
5974
+ * Reports the validity with a error popup message
5975
+ */
6028
5976
  reportValidity() {
6029
- if (!this.input.reportValidity()) {
6030
- this.invalid = !this.input.checkValidity();
6031
- }
6032
- return this.input.reportValidity();
5977
+ return this._internals.reportValidity();
6033
5978
  }
6034
- _handleChange() {
6035
- if (this.indeterminate) {
6036
- this.indeterminate = !this.indeterminate;
6037
- }
6038
- this.checked = !this.checked;
6039
- this.value = this.input.value;
6040
- this.emit("sgds-change", { detail: { checked: this.checked, value: this.value } });
5979
+ /**
5980
+ * Sets the form control value into FormData,
5981
+ * making the value of control accessible via FormData
5982
+ */
5983
+ setFormValue() {
5984
+ const value = this.options.value(this.host);
5985
+ this._internals.setFormValue(value);
6041
5986
  }
6042
- _handleKeyDown(event) {
6043
- const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
6044
- if (event.key === "Enter" && !hasModifier) {
6045
- this.click();
5987
+ /**
5988
+ * Updates the ValidityState of the input in form component at current state
5989
+ */
5990
+ validateInput(input) {
5991
+ /** When the form control is disabled, its always valid */
5992
+ if (this.options.input(this.host).disabled) {
5993
+ return this._internals.setValidity({});
5994
+ }
5995
+ // get the validity of the internal <input>
5996
+ const validState = input.validity;
5997
+ // if the input is invalid, show the correct error
5998
+ if (!validState.valid) {
5999
+ // loop through the error reasons
6000
+ for (const state in validState) {
6001
+ // if there is an error and corresponding attribute holding
6002
+ // the message
6003
+ if (validState[state]) {
6004
+ this.validationError = state.toString();
6005
+ // set the validity error reason and the corresponding
6006
+ // message
6007
+ this._internals.setValidity({ [this.validationError]: true }, input.validationMessage, input);
6008
+ }
6009
+ }
6010
+ }
6011
+ else {
6012
+ this._internals.setValidity({});
6046
6013
  }
6047
- }
6048
- _handleInvalid(e) {
6049
- e.preventDefault();
6050
- this.invalid = true;
6051
- }
6052
- /** @internal */
6053
- handleDisabledChange() {
6054
- // Disabled form controls are always valid, so we need to recheck validity when the state changes
6055
- this.input.disabled = this.disabled;
6056
- this.invalid = !this.input.checkValidity();
6057
- }
6058
- /** @internal */
6059
- handleStateChange() {
6060
- this.invalid = !this.input.checkValidity();
6061
- }
6062
- render() {
6063
- return html$1 `
6064
- <div
6065
- class=${classMap({
6066
- "form-check": true
6067
- })}
6068
- >
6069
- <input
6070
- class=${classMap({
6071
- "form-check-input": true,
6072
- "is-invalid": this.hasFeedback && this.invalid,
6073
- md: this._size === "md"
6074
- })}
6075
- type="checkbox"
6076
- id=${this._inputId}
6077
- aria-invalid=${this.invalid ? "true" : "false"}
6078
- name=${ifDefined(this.name)}
6079
- value=${ifDefined(this.value)}
6080
- ?checked=${this.checked}
6081
- ?indeterminate=${this.indeterminate}
6082
- ?disabled=${this.disabled}
6083
- ?required=${this.required}
6084
- aria-disabled=${this.disabled ? "true" : "false"}
6085
- aria-checked=${this.checked ? "true" : "false"}
6086
- @change=${this._handleChange}
6087
- @keydown=${this._handleKeyDown}
6088
- @invalid=${(e) => this._handleInvalid(e)}
6089
- />
6090
- <label for="${this._inputId}" aria-label=${ifDefined(this.ariaLabel)} class="form-check-label"
6091
- ><slot></slot
6092
- ></label>
6093
- </div>
6094
- `;
6095
6014
  }
6096
6015
  }
6097
- __decorate([
6098
- query('input[type="checkbox"]')
6099
- ], FormCheckElement.prototype, "input", void 0);
6100
- __decorate([
6101
- property({ type: String, reflect: true })
6102
- ], FormCheckElement.prototype, "name", void 0);
6103
- __decorate([
6104
- property({ type: String, reflect: true })
6105
- ], FormCheckElement.prototype, "ariaLabel", void 0);
6106
- __decorate([
6107
- property({ type: String, reflect: true })
6108
- ], FormCheckElement.prototype, "value", void 0);
6109
- __decorate([
6110
- property({ type: Boolean, reflect: true })
6111
- ], FormCheckElement.prototype, "required", void 0);
6112
- __decorate([
6113
- property({ type: Boolean, reflect: true })
6114
- ], FormCheckElement.prototype, "checked", void 0);
6115
- __decorate([
6116
- property({ type: Boolean, reflect: true })
6117
- ], FormCheckElement.prototype, "disabled", void 0);
6118
- __decorate([
6119
- property({ type: Boolean, reflect: true })
6120
- ], FormCheckElement.prototype, "hasFeedback", void 0);
6121
- __decorate([
6122
- defaultValue("checked")
6123
- ], FormCheckElement.prototype, "defaultChecked", void 0);
6124
- __decorate([
6125
- property({ type: Boolean, reflect: true })
6126
- ], FormCheckElement.prototype, "invalid", void 0);
6127
- __decorate([
6128
- property({ type: Boolean, reflect: true })
6129
- ], FormCheckElement.prototype, "indeterminate", void 0);
6130
- __decorate([
6131
- watch("invalid", { waitUntilFirstUpdate: true })
6132
- ], FormCheckElement.prototype, "_handleInvalidChange", null);
6133
- __decorate([
6134
- property({ type: String })
6135
- ], FormCheckElement.prototype, "_size", void 0);
6136
- __decorate([
6137
- watch("disabled", { waitUntilFirstUpdate: true })
6138
- ], FormCheckElement.prototype, "handleDisabledChange", null);
6139
- __decorate([
6140
- watch("checked", { waitUntilFirstUpdate: true })
6141
- ], FormCheckElement.prototype, "handleStateChange", null);
6142
6016
 
6143
- var css_248z$V = css`input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input,.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md)}.form-check-input:focus,.form-check-input:focus-visible{box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path d="M14.347 3.979a.522.522 0 0 1 0 .739L7.043 12.02a.521.521 0 0 1-.738 0L2.653 8.369a.522.522 0 1 1 .739-.738l3.282 3.283 6.934-6.935a.52.52 0 0 1 .739 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}.form-check-input:indeterminate,.form-check-input[indeterminate]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
6017
+ /**
6018
+ * @summary The FormValidationMixin used by the form components
6019
+ * @param superClass
6020
+ * @returns
6021
+ */
6022
+ const SgdsFormValidatorMixin = (superClass) => {
6023
+ class ToBeValidatedElement extends superClass {
6024
+ constructor() {
6025
+ super(...arguments);
6026
+ this._isTouched = false;
6027
+ }
6028
+ connectedCallback() {
6029
+ super.connectedCallback();
6030
+ this.inputValidationController = new InputValidationController(this);
6031
+ }
6032
+ async firstUpdated(changedProperties) {
6033
+ super.firstUpdated(changedProperties);
6034
+ /* Either input or sgds-input. For example, quantity-toggle uses sgds-input */
6035
+ this.input =
6036
+ this.shadowRoot.querySelector("input") || (await this.sgdsInput) || this.shadowRoot.querySelector("textarea");
6037
+ this._mixinValidate(this.input);
6038
+ }
6039
+ /**
6040
+ * Native lifecycle of Form-Associated Custom Element Callbacks
6041
+ */
6042
+ formResetCallback() {
6043
+ if (this._mixinResetFormControl) {
6044
+ this._mixinResetFormControl();
6045
+ }
6046
+ else {
6047
+ this.value = this.defaultValue;
6048
+ this._mixinResetValidity(this.input);
6049
+ }
6050
+ this._mixinSetFormValue();
6051
+ }
6052
+ /**
6053
+ *
6054
+ * Methods use by classes using this mixin
6055
+ */
6056
+ /**
6057
+ * OnChange of form component
6058
+ * 1. Make value of control accessible via FormData
6059
+ * 2. Run change handler
6060
+ */
6061
+ _mixinHandleChange(e) {
6062
+ this._mixinSetFormValue();
6063
+ this.inputValidationController.handleChange(e);
6064
+ }
6065
+ /**
6066
+ * OnChange of form component
6067
+ * 1. Make value of control accessible via FormData
6068
+ * 2. Run input handler
6069
+ */
6070
+ _mixinHandleInputChange(e) {
6071
+ this._mixinSetFormValue();
6072
+ this.inputValidationController.handleInput(e);
6073
+ }
6074
+ /**
6075
+ * During form resetting,
6076
+ * 1. ValidityState is reset
6077
+ * 2. invalid reactive prop is updated after the reset
6078
+ * 3. Revalidates the ValidityState (but do not update invalid prop)
6079
+ * to prepare for the next validity check
6080
+ * 4. Reset touched state to false for a pristine form
6081
+ */
6082
+ _mixinResetValidity(input) {
6083
+ this.inputValidationController.resetValidity();
6084
+ this.inputValidationController.updateInvalidState();
6085
+ this.inputValidationController.validateInput(input);
6086
+ this._isTouched ? (this._isTouched = false) : null;
6087
+ }
6088
+ _mixinValidate(input) {
6089
+ this.inputValidationController.validateInput(input);
6090
+ }
6091
+ _mixinSetFormValue() {
6092
+ this.inputValidationController.setFormValue();
6093
+ }
6094
+ _mixinCheckValidity() {
6095
+ return this.inputValidationController.checkValidity();
6096
+ }
6097
+ _mixinReportValidity() {
6098
+ return this.inputValidationController.reportValidity();
6099
+ }
6100
+ _mixinGetValidity() {
6101
+ return this.inputValidationController.validity;
6102
+ }
6103
+ _mixinGetValidationMessage() {
6104
+ return this.inputValidationController.validationMessage;
6105
+ }
6106
+ }
6107
+ ToBeValidatedElement.formAssociated = true;
6108
+ __decorate([
6109
+ queryAsync("sgds-input")
6110
+ ], ToBeValidatedElement.prototype, "sgdsInput", void 0);
6111
+ return ToBeValidatedElement;
6112
+ };
6113
+
6114
+ var css_248z$S = css`input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input,.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md)}.form-check-input:focus,.form-check-input:focus-visible{box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path d="M14.347 3.979a.522.522 0 0 1 0 .739L7.043 12.02a.521.521 0 0 1-.738 0L2.653 8.369a.522.522 0 1 1 .739-.738l3.282 3.283 6.934-6.935a.52.52 0 0 1 .739 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}.form-check-input:indeterminate,.form-check-input[indeterminate]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="16" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M2.5 8a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}.form-check-input:indeterminate.is-invalid,.form-check-input[indeterminate].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
6144
6115
 
6145
6116
  /**
6146
6117
  * @summary Checkbox component is used when you require users to select multiple items from a list.
@@ -6148,36 +6119,29 @@
6148
6119
  * @slot default - The label of checkbox.
6149
6120
  *
6150
6121
  * @event sgds-change - Emitted when the checked state changes.
6122
+ * @event sgds-blur - Emitted when input is not in focus.
6123
+ * @event sgds-focus - Emitted when input is in focus.
6151
6124
  * @event sgds-validity-change - Emitted when the invalid state changes. This event is used by sgds-checkbox-group to check the invalid state change of its children
6152
6125
  */
6153
- class SgdsCheckbox extends SgdsElement {
6126
+ class SgdsCheckbox extends SgdsFormValidatorMixin(FormControlElement) {
6154
6127
  constructor() {
6155
6128
  super(...arguments);
6156
- /**@internal */
6157
- this.formSubmitController = new FormSubmitController(this, {
6158
- value: (control) => (control.checked ? control.value : undefined),
6159
- defaultValue: (control) => control.defaultChecked,
6160
- setValue: (control, checked) => (control.checked = checked)
6161
- });
6162
- /** Makes the checkbox a required field. */
6163
- this.required = false;
6164
6129
  /** Draws the checkbox in a checked state. */
6165
6130
  this.checked = false;
6166
- /** Disables the checkbox (so the user can't check / uncheck it). */
6167
- this.disabled = false;
6168
6131
  /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
6169
6132
  this.hasFeedback = false;
6170
6133
  /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
6171
6134
  this.defaultChecked = false;
6172
- /** Marks the checkbox input as invalid. Replace the pseudo :invalid selector for absent in custom elements */
6173
- this.invalid = false;
6174
6135
  /** Marks the checkbox input as indeterminate , with indeterminate logo */
6175
6136
  this.indeterminate = false;
6176
- /** @internal For Id/For pair of the HTML form control and label. */
6177
- this._inputId = genId("checkbox");
6137
+ /** Makes the checkbox a required field. */
6138
+ this.required = false;
6139
+ this._isTouched = false;
6178
6140
  }
6179
6141
  _handleInvalidChange() {
6180
- this.emit("sgds-validity-change", { detail: { invalid: this.invalid } });
6142
+ this.emit("sgds-validity-change", {
6143
+ detail: { invalid: this.invalid, validationMessage: this.input.validationMessage }
6144
+ });
6181
6145
  }
6182
6146
  /** Simulates a click on the checkbox. */
6183
6147
  click() {
@@ -6191,19 +6155,13 @@
6191
6155
  blur() {
6192
6156
  this.input.blur();
6193
6157
  }
6194
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
6195
- reportValidity() {
6196
- if (!this.input.reportValidity()) {
6197
- this.invalid = !this.input.checkValidity();
6198
- }
6199
- return this.input.reportValidity();
6200
- }
6201
- _handleChange() {
6158
+ _handleChange(e) {
6202
6159
  if (this.indeterminate) {
6203
6160
  this.indeterminate = !this.indeterminate;
6204
6161
  }
6205
6162
  this.checked = !this.checked;
6206
6163
  this.value = this.input.value;
6164
+ super._mixinHandleChange(e);
6207
6165
  this.emit("sgds-change", { detail: { checked: this.checked, value: this.value } });
6208
6166
  }
6209
6167
  _handleKeyDown(event) {
@@ -6212,6 +6170,13 @@
6212
6170
  this.click();
6213
6171
  }
6214
6172
  }
6173
+ _handleBlur() {
6174
+ this._isTouched = true;
6175
+ this.emit("sgds-blur");
6176
+ }
6177
+ _handleFocus() {
6178
+ this.emit("sgds-focus");
6179
+ }
6215
6180
  _handleInvalid(e) {
6216
6181
  e.preventDefault();
6217
6182
  this.invalid = true;
@@ -6219,12 +6184,43 @@
6219
6184
  /** @internal */
6220
6185
  _handleDisabledChange() {
6221
6186
  // Disabled form controls are always valid, so we need to recheck validity when the state changes
6222
- this.input.disabled = this.disabled;
6223
- this.invalid = !this.input.checkValidity();
6187
+ this.setInvalid(false);
6224
6188
  }
6225
- /** @internal */
6226
- _handleStateChange() {
6227
- this.invalid = !this.input.checkValidity();
6189
+ _handleIsTouched() {
6190
+ if (this._isTouched) {
6191
+ this.invalid = !this.input.checkValidity();
6192
+ }
6193
+ }
6194
+ _mixinResetFormControl() {
6195
+ this._isTouched = false;
6196
+ this.checked = this.input.checked = this.defaultChecked;
6197
+ this.input.dispatchEvent(new InputEvent("reset"));
6198
+ this._mixinResetValidity(this.input);
6199
+ }
6200
+ /**
6201
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
6202
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
6203
+ */
6204
+ reportValidity() {
6205
+ return this._mixinReportValidity();
6206
+ }
6207
+ /**
6208
+ * Checks for validity without any native error popup message
6209
+ */
6210
+ checkValidity() {
6211
+ return this._mixinCheckValidity();
6212
+ }
6213
+ /**
6214
+ * Returns the ValidityState object
6215
+ */
6216
+ get validity() {
6217
+ return this._mixinGetValidity();
6218
+ }
6219
+ /**
6220
+ * Returns the validation message based on the ValidityState
6221
+ */
6222
+ get validationMessage() {
6223
+ return this._mixinGetValidationMessage();
6228
6224
  }
6229
6225
  render() {
6230
6226
  return html$1 `
@@ -6236,45 +6232,35 @@
6236
6232
  "is-invalid": this.hasFeedback && this.invalid
6237
6233
  })}
6238
6234
  type="checkbox"
6239
- id=${this._inputId}
6235
+ id=${this._controlId}
6240
6236
  aria-invalid=${this.invalid ? "true" : "false"}
6241
6237
  name=${ifDefined(this.name)}
6242
- value=${ifDefined(this.value)}
6243
- ?checked=${this.checked}
6244
6238
  ?indeterminate=${this.indeterminate}
6245
- ?disabled=${this.disabled}
6246
6239
  ?required=${this.required}
6247
6240
  aria-disabled=${this.disabled ? "true" : "false"}
6248
6241
  aria-checked=${this.checked ? "true" : "false"}
6249
- @change=${this._handleChange}
6242
+ @change=${(e) => this._handleChange(e)}
6250
6243
  @keydown=${this._handleKeyDown}
6251
6244
  @invalid=${(e) => this._handleInvalid(e)}
6245
+ .checked=${live(this.checked)}
6246
+ .disabled=${this.disabled}
6247
+ .required=${this.required}
6248
+ @blur=${this._handleBlur}
6249
+ @focus=${this._handleFocus}
6252
6250
  />
6253
6251
  </div>
6254
- <label for="${this._inputId}" class="form-check-label"><slot></slot></label>
6252
+ <label for="${this._controlId}" class="form-check-label" id="${this._labelId}"><slot></slot></label>
6255
6253
  </div>
6256
6254
  `;
6257
6255
  }
6258
6256
  }
6259
- SgdsCheckbox.styles = [...FormCheckElement.styles, css_248z$V];
6260
- __decorate([
6261
- query('input[type="checkbox"]')
6262
- ], SgdsCheckbox.prototype, "input", void 0);
6263
- __decorate([
6264
- property({ type: String, reflect: true })
6265
- ], SgdsCheckbox.prototype, "name", void 0);
6257
+ SgdsCheckbox.styles = [...FormControlElement.styles, css_248z$S];
6266
6258
  __decorate([
6267
6259
  property({ type: String, reflect: true })
6268
6260
  ], SgdsCheckbox.prototype, "value", void 0);
6269
- __decorate([
6270
- property({ type: Boolean, reflect: true })
6271
- ], SgdsCheckbox.prototype, "required", void 0);
6272
6261
  __decorate([
6273
6262
  property({ type: Boolean, reflect: true })
6274
6263
  ], SgdsCheckbox.prototype, "checked", void 0);
6275
- __decorate([
6276
- property({ type: Boolean, reflect: true })
6277
- ], SgdsCheckbox.prototype, "disabled", void 0);
6278
6264
  __decorate([
6279
6265
  property({ type: Boolean, reflect: true })
6280
6266
  ], SgdsCheckbox.prototype, "hasFeedback", void 0);
@@ -6283,10 +6269,13 @@
6283
6269
  ], SgdsCheckbox.prototype, "defaultChecked", void 0);
6284
6270
  __decorate([
6285
6271
  property({ type: Boolean, reflect: true })
6286
- ], SgdsCheckbox.prototype, "invalid", void 0);
6272
+ ], SgdsCheckbox.prototype, "indeterminate", void 0);
6287
6273
  __decorate([
6288
6274
  property({ type: Boolean, reflect: true })
6289
- ], SgdsCheckbox.prototype, "indeterminate", void 0);
6275
+ ], SgdsCheckbox.prototype, "required", void 0);
6276
+ __decorate([
6277
+ state()
6278
+ ], SgdsCheckbox.prototype, "_isTouched", void 0);
6290
6279
  __decorate([
6291
6280
  watch("invalid", { waitUntilFirstUpdate: true })
6292
6281
  ], SgdsCheckbox.prototype, "_handleInvalidChange", null);
@@ -6294,12 +6283,10 @@
6294
6283
  watch("disabled", { waitUntilFirstUpdate: true })
6295
6284
  ], SgdsCheckbox.prototype, "_handleDisabledChange", null);
6296
6285
  __decorate([
6297
- watch("checked", { waitUntilFirstUpdate: true })
6298
- ], SgdsCheckbox.prototype, "_handleStateChange", null);
6299
-
6300
- var css_248z$U = css`:host{outline:0}input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:50%;height:var(--sgds-form-height-sm);width:var(--sgds-form-height-sm)}.form-check-input:not([disabled]):not(.is-invalid):not([aria-checked=true]):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-check-input:focus,.form-check-input:focus-visible{border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg width="8" height="8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 4a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-default-border-color-transparent)}.form-check-input:not([disabled]):not(.is-invalid):checked:focus-visible,.form-check-input:not([disabled]):not(.is-invalid):checked:hover,.form-check-input:not([disabled]):not(.is-invalid)[checked]:focus-visible,.form-check-input:not([disabled]):not(.is-invalid)[checked]:hover{background-color:var(--sgds-form-primary-bg-emphasis)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input:not([disabled]).is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
6286
+ watch("_isTouched", { waitUntilFirstUpdate: true })
6287
+ ], SgdsCheckbox.prototype, "_handleIsTouched", null);
6301
6288
 
6302
- var css_248z$T = css`.form-label{margin-bottom:0}.form-check-label,.form-label{color:var(--sgds-form-color)}.form-check-input:disabled~.form-check-label,.form-check-input[disabled]~.form-check-label{cursor:not-allowed}`;
6289
+ var css_248z$R = css`:host{outline:0}input{margin:0}.form-check{display:flex;gap:var(--sgds-form-gap-md);padding:var(--sgds-form-padding-inline-sm) 0}.form-check-input-container{height:var(--sgds-form-height-sm);width:var(--sgds-form-width-xs)}.form-check-input{appearance:none;background-color:var(--sgds-form-bg);background-image:var(--sgds-radio-bg-image);background-position:50%;background-repeat:no-repeat;background-size:auto;border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:50%;height:var(--sgds-form-height-sm);width:var(--sgds-form-height-sm)}.form-check-input:not([disabled]):not(.is-invalid):not([aria-checked=true]):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-check-input:focus,.form-check-input:focus-visible{border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-check-input:checked,.form-check-input[checked]{--sgds-radio-bg-image:url('data:image/svg+xml;charset=utf-8,<svg width="8" height="8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 4a4 4 0 1 1 8 0 4 4 0 0 1-8 0Z" fill="%23fff"/></svg>');background-color:var(--sgds-form-primary-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-default-border-color-transparent)}.form-check-input:not([disabled]):not(.is-invalid):checked:focus-visible,.form-check-input:not([disabled]):not(.is-invalid):checked:hover,.form-check-input:not([disabled]):not(.is-invalid)[checked]:focus-visible,.form-check-input:not([disabled]):not(.is-invalid)[checked]:hover{background-color:var(--sgds-form-primary-bg-emphasis)}:host([disabled]) .form-check{cursor:not-allowed;opacity:var(--sgds-opacity-50)}.form-check-input:not([disabled]).is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-check-input:checked.is-invalid,.form-check-input[checked].is-invalid{background-color:var(--sgds-form-danger-bg)}`;
6303
6290
 
6304
6291
  /**
6305
6292
  * @summary Radio allows the user to select one option from a set while seeing all available options.
@@ -6385,7 +6372,7 @@
6385
6372
  `;
6386
6373
  }
6387
6374
  }
6388
- SgdsRadio.styles = [...SgdsElement.styles, css_248z$T, css_248z$U];
6375
+ SgdsRadio.styles = [...SgdsElement.styles, css_248z$U, css_248z$R];
6389
6376
  __decorate([
6390
6377
  property({ type: Boolean, reflect: true })
6391
6378
  ], SgdsRadio.prototype, "checked", void 0);
@@ -6408,7 +6395,7 @@
6408
6395
  watch("disabled", { waitUntilFirstUpdate: true })
6409
6396
  ], SgdsRadio.prototype, "handleDisabledChange", null);
6410
6397
 
6411
- var css_248z$S = css`.sgds.card[variant*=card-action]{transition-duration:.3s;transition-property:box-shadow,border-color;transition-timing-function:ease-in-out}.card-body{display:flex;flex-direction:column;gap:var(--sgds-spacer-3)}slot[name=icon]::slotted(*){margin-right:1rem}.sgds.card[variant*=card-action].is-active,.sgds.card[variant*=card-action]:hover{border-color:transparent;box-shadow:var(--sgds-box-shadow),inset 0 0 0 2.1px var(--sgds-link)}.sgds.card[variant*=card-action] .card-subtitle{align-items:center;display:flex;justify-content:space-between}.sgds.card[variant*=card-action] .card-title{color:var(--sgds-body-color);margin-bottom:0}`;
6398
+ var css_248z$Q = css`.sgds.card[variant*=card-action]{transition-duration:.3s;transition-property:box-shadow,border-color;transition-timing-function:ease-in-out}.card-body{display:flex;flex-direction:column;gap:var(--sgds-spacer-3)}slot[name=icon]::slotted(*){margin-right:1rem}.sgds.card[variant*=card-action].is-active,.sgds.card[variant*=card-action]:hover{border-color:transparent;box-shadow:var(--sgds-box-shadow),inset 0 0 0 2.1px var(--sgds-link)}.sgds.card[variant*=card-action] .card-subtitle{align-items:center;display:flex;justify-content:space-between}.sgds.card[variant*=card-action] .card-title{color:var(--sgds-body-color);margin-bottom:0}`;
6412
6399
 
6413
6400
  /**
6414
6401
  * @summary Action Card are cards with built in checkbox or radio components. The ref of input is extended to the Card's body.
@@ -6522,7 +6509,7 @@
6522
6509
  `;
6523
6510
  }
6524
6511
  }
6525
- SgdsActionCard.styles = [...CardElement.styles, css_248z$S];
6512
+ SgdsActionCard.styles = [...CardElement.styles, css_248z$Q];
6526
6513
  __decorate([
6527
6514
  property({ reflect: true })
6528
6515
  ], SgdsActionCard.prototype, "name", void 0);
@@ -6548,7 +6535,7 @@
6548
6535
  watch("disabled")
6549
6536
  ], SgdsActionCard.prototype, "handleDisabledChange", null);
6550
6537
 
6551
- var css_248z$R = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{background-color:var(--sgds-default-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;height:var(--sgds-dimension-32);padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close:before{background-color:currentColor;border-radius:var(--sgds-border-radius);box-sizing:content-box;color:var(--sgds-default-color);content:"";height:var(--sgds-icon-size-lg);left:50%;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--sgds-icon-size-lg)}.btn-close-light:before{color:var(--sgds-default-color-on-dark)}.btn-close-dark:before{color:var(--sgds-default-color-on-light)}.btn-close:hover{background-color:var(--sgds-default-bg-translucent)}.btn-close:focus,.btn-close:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn-close-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-close.btn-close-sm:before{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}`;
6538
+ var css_248z$P = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{background-color:var(--sgds-default-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;height:var(--sgds-dimension-32);padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close:before{background-color:currentColor;border-radius:var(--sgds-border-radius);box-sizing:content-box;color:var(--sgds-default-color);content:"";height:var(--sgds-icon-size-md);left:50%;mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'%3E%3Cpath d='M5.614 5.614a.75.75 0 0 1 1.06 0l5.304 5.303 5.303-5.303a.75.75 0 0 1 1.06 1.06l-5.302 5.304 5.303 5.303a.75.75 0 0 1-1.06 1.06l-5.304-5.302-5.303 5.303a.75.75 0 0 1-1.061-1.06l5.303-5.304-5.303-5.303a.75.75 0 0 1 0-1.061Z'/%3E%3C/svg%3E");mask-position:center;-webkit-mask-position:center;mask-repeat:no-repeat;-webkit-mask-repeat:no-repeat;position:absolute;top:50%;transform:translate(-50%,-50%);width:var(--sgds-icon-size-md)}.btn-close-light:before{color:var(--sgds-default-color-on-dark)}.btn-close-dark:before{color:var(--sgds-default-color-on-light)}.btn-close:hover{background-color:var(--sgds-default-bg-translucent)}.btn-close:focus,.btn-close:focus-visible{background-color:var(--sgds-default-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn-close-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-close.btn-close-sm:before{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}`;
6552
6539
 
6553
6540
  /**
6554
6541
  * @summary Close button for closing actions. Used in Modal, Drawer, Alert and Toast.
@@ -6567,37 +6554,164 @@
6567
6554
  return;
6568
6555
  };
6569
6556
  }
6570
- _handleClick() {
6571
- this.removeEventListener("click", this._clickHandler);
6572
- this.addEventListener("click", this._clickHandler);
6557
+ _handleClick() {
6558
+ this.removeEventListener("click", this._clickHandler);
6559
+ this.addEventListener("click", this._clickHandler);
6560
+ }
6561
+ render() {
6562
+ return html$1 `
6563
+ <button
6564
+ class=${classMap({
6565
+ "btn-close": true,
6566
+ [`btn-close-${this.size}`]: this.size,
6567
+ "btn-close-light": this.variant === "light",
6568
+ "btn-close-dark": this.variant === "dark"
6569
+ })}
6570
+ aria-label=${ifDefined(this.ariaLabel)}
6571
+ @click=${this._handleClick}
6572
+ ></button>
6573
+ `;
6574
+ }
6575
+ }
6576
+ SgdsCloseButton.styles = [...SgdsElement.styles, css_248z$P];
6577
+ __decorate([
6578
+ property({ type: String })
6579
+ ], SgdsCloseButton.prototype, "ariaLabel", void 0);
6580
+ __decorate([
6581
+ property({ type: String, reflect: true })
6582
+ ], SgdsCloseButton.prototype, "size", void 0);
6583
+ __decorate([
6584
+ property({ type: String, reflect: true })
6585
+ ], SgdsCloseButton.prototype, "variant", void 0);
6586
+
6587
+ /**
6588
+ * @license
6589
+ * Copyright 2017 Google LLC
6590
+ * SPDX-License-Identifier: BSD-3-Clause
6591
+ */
6592
+ const HTML_RESULT = 1;
6593
+ class UnsafeHTMLDirective extends Directive {
6594
+ constructor(partInfo) {
6595
+ super(partInfo);
6596
+ this._value = nothing;
6597
+ if (partInfo.type !== PartType.CHILD) {
6598
+ throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
6599
+ }
6600
+ }
6601
+ render(value) {
6602
+ if (value === nothing || value == null) {
6603
+ this._templateResult = undefined;
6604
+ return (this._value = value);
6605
+ }
6606
+ if (value === noChange) {
6607
+ return value;
6608
+ }
6609
+ if (typeof value != 'string') {
6610
+ throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
6611
+ }
6612
+ if (value === this._value) {
6613
+ return this._templateResult;
6614
+ }
6615
+ this._value = value;
6616
+ const strings = [value];
6617
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6618
+ strings.raw = strings;
6619
+ // WARNING: impersonating a TemplateResult like this is extremely
6620
+ // dangerous. Third-party directives should not do this.
6621
+ return (this._templateResult = {
6622
+ // Cast to a known set of integers that satisfy ResultType so that we
6623
+ // don't have to export ResultType and possibly encourage this pattern.
6624
+ // This property needs to remain unminified.
6625
+ ['_$litType$']: this.constructor
6626
+ .resultType,
6627
+ strings,
6628
+ values: [],
6629
+ });
6630
+ }
6631
+ }
6632
+ UnsafeHTMLDirective.directiveName = 'unsafeHTML';
6633
+ UnsafeHTMLDirective.resultType = HTML_RESULT;
6634
+
6635
+ /**
6636
+ * @license
6637
+ * Copyright 2017 Google LLC
6638
+ * SPDX-License-Identifier: BSD-3-Clause
6639
+ */
6640
+ const SVG_RESULT = 2;
6641
+ class UnsafeSVGDirective extends UnsafeHTMLDirective {
6642
+ }
6643
+ UnsafeSVGDirective.directiveName = 'unsafeSVG';
6644
+ UnsafeSVGDirective.resultType = SVG_RESULT;
6645
+ /**
6646
+ * Renders the result as SVG, rather than text.
6647
+ *
6648
+ * The values `undefined`, `null`, and `nothing`, will all result in no content
6649
+ * (empty string) being rendered.
6650
+ *
6651
+ * Note, this is unsafe to use with any user-provided input that hasn't been
6652
+ * sanitized or escaped, as it may lead to cross-site-scripting
6653
+ * vulnerabilities.
6654
+ */
6655
+ const unsafeSVG = directive(UnsafeSVGDirective);
6656
+
6657
+ var css_248z$O = css`:host([size=sm]) svg{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}:host([size=md]) svg{height:var(--sgds-icon-size-md);width:var(--sgds-icon-size-md)}:host([size=xl]) svg{height:var(--sgds-icon-size-xl);width:var(--sgds-icon-size-xl)}:host([size="2-xl"]) svg{height:var(--sgds-icon-size-2-xl);width:var(--sgds-icon-size-2-xl)}:host([size="3-xl"]) svg{height:var(--sgds-icon-size-3-xl);width:var(--sgds-icon-size-3-xl)}svg{display:block;height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}`;
6658
+
6659
+ /**
6660
+ * @summary Icons offer a form of visual shorthand that we are all familiar with. They can label, inform and aid navigation quickly and effectively in minimal space. Icons must first and foremost communicate meaning. By default, the icon component renders icons form SgdsIcon library set
6661
+ *
6662
+ * @event sgds-blur - Emitted when the button is blurred.
6663
+ * @event sgds-focus - Emitted when the button is focused.
6664
+ */
6665
+ class SgdsIcon extends SgdsElement {
6666
+ constructor() {
6667
+ super(...arguments);
6668
+ /** Specifies a small, medium or large icon, the size is medium by default. */
6669
+ this.size = "lg";
6670
+ /** @internal */
6671
+ this._svgContent = null;
6672
+ }
6673
+ async firstUpdated() {
6674
+ if (this.name) {
6675
+ this.loadSvg(this.name);
6676
+ }
6677
+ }
6678
+ updated() {
6679
+ this.style.display = this._svgContent ? "flex" : "none";
6680
+ }
6681
+ async loadSvg(name) {
6682
+ if (name) {
6683
+ // Dynamically import the SVG if not cached
6684
+ try {
6685
+ //TODO: This path is too specific to our repo, it won't work for users
6686
+ const response = await fetch(`/src/icons/${name}.svg`);
6687
+ if (response.ok) {
6688
+ const svgContent = await response.text();
6689
+ // Render the SVG
6690
+ // this.renderSvg(svgContent);
6691
+ this._svgContent = svgContent;
6692
+ }
6693
+ }
6694
+ catch (error) {
6695
+ console.error(`Error loading SVG: ${name}`, error);
6696
+ }
6697
+ }
6573
6698
  }
6574
6699
  render() {
6575
- return html$1 `
6576
- <button
6577
- class=${classMap({
6578
- "btn-close": true,
6579
- [`btn-close-${this.size}`]: this.size,
6580
- "btn-close-light": this.variant === "light",
6581
- "btn-close-dark": this.variant === "dark"
6582
- })}
6583
- aria-label=${ifDefined(this.ariaLabel)}
6584
- @click=${this._handleClick}
6585
- ></button>
6586
- `;
6700
+ return html `${unsafeSVG(this._svgContent)}`;
6587
6701
  }
6588
6702
  }
6589
- SgdsCloseButton.styles = [css_248z$R];
6590
- __decorate([
6591
- property({ type: String })
6592
- ], SgdsCloseButton.prototype, "ariaLabel", void 0);
6703
+ SgdsIcon.styles = [...SgdsElement.styles, css_248z$O];
6593
6704
  __decorate([
6594
6705
  property({ type: String, reflect: true })
6595
- ], SgdsCloseButton.prototype, "size", void 0);
6706
+ ], SgdsIcon.prototype, "name", void 0);
6596
6707
  __decorate([
6597
6708
  property({ type: String, reflect: true })
6598
- ], SgdsCloseButton.prototype, "variant", void 0);
6709
+ ], SgdsIcon.prototype, "size", void 0);
6710
+ __decorate([
6711
+ state()
6712
+ ], SgdsIcon.prototype, "_svgContent", void 0);
6599
6713
 
6600
- var css_248z$Q = css`:host{--sgds-alert-bg:var(--sgds-primary-bg);--sgds-alert-color:var(--sgds-default-color-on-dark);--sgds-alert-border-radius:var(--sgds-border-radius-md)}:host([variant=success]){--sgds-alert-bg:var(--sgds-success-bg)}:host([variant=warning]){--sgds-alert-bg:var(--sgds-warning-bg)}:host([variant=danger]){--sgds-alert-bg:var(--sgds-danger-bg)}:host([variant=neutral]){--sgds-alert-bg:var(--sgds-neutral-bg)}:host([outlined]){--sgds-alert-color:var(--sgds-default-color-on-light)}:host([variant=info][outlined]){--sgds-alert-bg:var(--sgds-primary-bg-subtle);--sgds-alert-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-alert-bg:var(--sgds-success-bg-subtle);--sgds-alert-border-color:var(--sgds-success-border-color-subtle)}:host([variant=warning][outlined]){--sgds-alert-bg:var(--sgds-warning-bg-subtle);--sgds-alert-border-color:var(--sgds-warning-border-color-subtle)}:host([variant=danger][outlined]){--sgds-alert-bg:var(--sgds-danger-bg-subtle);--sgds-alert-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-alert-bg:var(--sgds-neutral-bg-subtle);--sgds-alert-border-color:var(--sgds-neutral-border-color-subtle)}slot[name=icon]{display:flex}slot[name=icon].d-none{display:none}slot[name=icon]::slotted(*){height:var(--sgds-icon-size-lg);width:var(--sgds-icon-size-lg)}.alert{background-color:var(--sgds-alert-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-alert-border-radius);color:var(--sgds-alert-color);display:flex;flex-direction:row;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-lg)}.alert.outlined{border:var(--sgds-border-width-1) solid var(--sgds-alert-border-color)}.alert-content{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;gap:var(--sgds-gap-2-xs);justify-content:center;padding-right:var(--sgds-padding-2-xl)}.alert-title{font-weight:var(--sgds-font-weight-semibold)}`;
6714
+ var css_248z$N = css`:host{--sgds-alert-bg:var(--sgds-primary-bg);--sgds-alert-color:var(--sgds-default-color-on-dark);--sgds-alert-border-radius:var(--sgds-border-radius-md)}:host([variant=success]){--sgds-alert-bg:var(--sgds-success-bg)}:host([variant=warning]){--sgds-alert-bg:var(--sgds-warning-bg)}:host([variant=danger]){--sgds-alert-bg:var(--sgds-danger-bg)}:host([variant=neutral]){--sgds-alert-bg:var(--sgds-neutral-bg)}:host([outlined]){--sgds-alert-color:var(--sgds-default-color-on-light)}:host([variant=info][outlined]){--sgds-alert-bg:var(--sgds-primary-bg-subtle);--sgds-alert-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-alert-bg:var(--sgds-success-bg-subtle);--sgds-alert-border-color:var(--sgds-success-border-color-subtle)}:host([variant=warning][outlined]){--sgds-alert-bg:var(--sgds-warning-bg-subtle);--sgds-alert-border-color:var(--sgds-warning-border-color-subtle)}:host([variant=danger][outlined]){--sgds-alert-bg:var(--sgds-danger-bg-subtle);--sgds-alert-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-alert-bg:var(--sgds-neutral-bg-subtle);--sgds-alert-border-color:var(--sgds-neutral-border-color-subtle)}slot[name=icon]::slotted(*){color:var(--sgds-alert-color)}.alert{background-color:var(--sgds-alert-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-alert-border-radius);color:var(--sgds-alert-color);display:flex;flex-direction:row;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-lg)}.alert.outlined{border:var(--sgds-border-width-1) solid var(--sgds-alert-border-color)}.alert-content{align-items:flex-start;display:flex;flex:1 0 0;flex-direction:column;gap:var(--sgds-gap-2-xs);justify-content:center;padding-right:var(--sgds-padding-2-xl)}.alert-title{font-weight:var(--sgds-font-weight-semibold)}`;
6601
6715
 
6602
6716
  /**
6603
6717
  * @summary Alerts provide short, timely, and relevant information for your users. It can be a simple text message or customised HTML content with paragraphs, headings and links.
@@ -6624,7 +6738,8 @@
6624
6738
  /**@internal */
6625
6739
  static get scopedElements() {
6626
6740
  return {
6627
- "sgds-close-button": SgdsCloseButton
6741
+ "sgds-close-button": SgdsCloseButton,
6742
+ "sgds-icon": SgdsIcon
6628
6743
  };
6629
6744
  }
6630
6745
  /** Closes the alert */
@@ -6635,14 +6750,8 @@
6635
6750
  _handleShowChange() {
6636
6751
  this.show ? this.emit("sgds-show") : this.emit("sgds-hide");
6637
6752
  }
6638
- firstUpdated() {
6639
- var _a;
6640
- if (this._iconNodes.length === 0) {
6641
- return (_a = this.shadowRoot.querySelector("slot[name='icon']")) === null || _a === void 0 ? void 0 : _a.classList.add("d-none");
6642
- }
6643
- }
6644
6753
  render() {
6645
- return this.show
6754
+ return (this.dismissible && this.show) || !this.dismissible
6646
6755
  ? html `
6647
6756
  <div
6648
6757
  class="${classMap({
@@ -6671,7 +6780,7 @@
6671
6780
  : nothing;
6672
6781
  }
6673
6782
  }
6674
- SgdsAlert.styles = [...SgdsElement.styles, css_248z$Q];
6783
+ SgdsAlert.styles = [...SgdsElement.styles, css_248z$N];
6675
6784
  __decorate([
6676
6785
  property({ type: Boolean, reflect: true })
6677
6786
  ], SgdsAlert.prototype, "show", void 0);
@@ -6690,13 +6799,10 @@
6690
6799
  __decorate([
6691
6800
  watch("show")
6692
6801
  ], SgdsAlert.prototype, "_handleShowChange", null);
6693
- __decorate([
6694
- queryAssignedNodes({ slot: "icon", flatten: true })
6695
- ], SgdsAlert.prototype, "_iconNodes", void 0);
6696
6802
 
6697
- var css_248z$P = css`:host{cursor:pointer;display:inline-block}.alert-link,.alert-link:hover{color:var(--sgds-alert-color);text-decoration-line:underline}.alert-link:focus,.alert-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}`;
6803
+ var css_248z$M = css`:host{cursor:pointer;display:inline-block}.alert-link,.alert-link:hover{color:var(--sgds-alert-color);text-decoration-line:underline}.alert-link:focus,.alert-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}`;
6698
6804
 
6699
- var css_248z$O = css`a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}`;
6805
+ var css_248z$L = css`a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;margin:0 .125rem;-webkit-mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');mask-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-box-arrow-up-right"><path fill-rule="evenodd" d="M8.636 3.5a.5.5 0 0 0-.5-.5H1.5A1.5 1.5 0 0 0 0 4.5v10A1.5 1.5 0 0 0 1.5 16h10a1.5 1.5 0 0 0 1.5-1.5V7.864a.5.5 0 0 0-1 0V14.5a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h6.636a.5.5 0 0 0 .5-.5z"/><path fill-rule="evenodd" d="M16 .5a.5.5 0 0 0-.5-.5h-5a.5.5 0 0 0 0 1h3.793L6.146 9.146a.5.5 0 1 0 .708.708L15 1.707V5.5a.5.5 0 0 0 1 0v-5z"/></svg>');-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;mask-size:73%;-webkit-mask-size:73%;padding:0 .45em}`;
6700
6806
 
6701
6807
  /**
6702
6808
  * @summary Alert link are used within the alert's message that is passed into the default slot of `<sgds-alert>`
@@ -6710,7 +6816,7 @@
6710
6816
  `;
6711
6817
  }
6712
6818
  }
6713
- SgdsAlertLink.styles = [...SgdsElement.styles, css_248z$O, css_248z$P];
6819
+ SgdsAlertLink.styles = [...SgdsElement.styles, css_248z$L, css_248z$M];
6714
6820
  __decorate([
6715
6821
  property({ type: String, reflect: true })
6716
6822
  ], SgdsAlertLink.prototype, "href", void 0);
@@ -6718,14 +6824,13 @@
6718
6824
  property()
6719
6825
  ], SgdsAlertLink.prototype, "target", void 0);
6720
6826
 
6721
- var css_248z$N = css`:host{--sgds-badge-bg:var(--sgds-primary-bg);--sgds-badge-color:var(--sgds-default-color-on-dark);--sgds-badge-border-radius:var(--sgds-border-radius-sm);display:inline-flex}:host([variant=success]){--sgds-badge-bg:var(--sgds-success-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=danger]){--sgds-badge-bg:var(--sgds-danger-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=warning]){--sgds-badge-bg:var(--sgds-warning-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=neutral]){--sgds-badge-bg:var(--sgds-neutral-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=info][outlined]){--sgds-badge-bg:var(--sgds-primary-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-badge-bg:var(--sgds-success-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-success-border-color-subtle)}:host([variant=danger][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=warning][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-badge-bg:var(--sgds-neutral-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-neutral-border-color-subtle)}.badge{align-items:center;background-color:var(--sgds-badge-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-badge-border-radius);color:var(--sgds-badge-color);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24);justify-content:center;min-width:var(---sgds-dimension-24);padding:0 var(--sgds-padding-2-xs)}.badge.outlined{border:var(--sgds-border-width-1) solid var(--sgds-badge-border-color)}.badge-label{padding:0 var(--sgds-padding-2-xs)}.badge-dismissible{padding-right:0}.badge-dimissible sgds-close-button{--sgds-close-btn-border-radius:var(--sgds-badge-border-radius)}slot[name=leftIcon]::slotted(*){font-size:var(--sgds-icon-size-sm)}slot::slotted(*){font-size:14px;font-weight:400}`;
6827
+ var css_248z$K = css`:host{--sgds-badge-bg:var(--sgds-primary-bg);--sgds-badge-color:var(--sgds-default-color-on-dark);--sgds-badge-border-radius:var(--sgds-border-radius-sm);display:inline-flex}:host([variant=success]){--sgds-badge-bg:var(--sgds-success-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=danger]){--sgds-badge-bg:var(--sgds-danger-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=warning]){--sgds-badge-bg:var(--sgds-warning-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=neutral]){--sgds-badge-bg:var(--sgds-neutral-bg);--sgds-badge-color:var(--sgds-default-color-on-dark)}:host([variant=info][outlined]){--sgds-badge-bg:var(--sgds-primary-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-primary-border-color-subtle)}:host([variant=success][outlined]){--sgds-badge-bg:var(--sgds-success-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-success-border-color-subtle)}:host([variant=danger][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-danger-border-color-subtle)}:host([variant=warning][outlined]){--sgds-badge-bg:var(--sgds-danger-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-warning-border-color-subtle)}:host([variant=neutral][outlined]){--sgds-badge-bg:var(--sgds-neutral-bg-subtle);--sgds-badge-color:var(--sgds-default-color-on-light);--sgds-badge-border-color:var(--sgds-neutral-border-color-subtle)}.badge{align-items:center;background-color:var(--sgds-badge-bg);border:var(--sgds-border-width-1) solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-badge-border-radius);color:var(--sgds-badge-color);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24);justify-content:center;min-width:var(---sgds-dimension-24);padding:0 var(--sgds-padding-2-xs)}.badge.outlined{border:var(--sgds-border-width-1) solid var(--sgds-badge-border-color)}.badge-label{padding:0 var(--sgds-padding-2-xs)}.badge-dismissible{padding-right:0}.badge-dimissible sgds-close-button{--sgds-close-btn-border-radius:var(--sgds-badge-border-radius)}slot[name=icon]::slotted(*){color:var(--sgds-badge-color)}slot::slotted(*){font-size:14px;font-weight:400}`;
6722
6828
 
6723
6829
  /**
6724
6830
  * @summary Badges can be used to highlight important bits of information such as labels, notifications & status.
6725
6831
  *
6726
6832
  * @slot default - slot for badge
6727
- * @slot leftIcon - The slot for icon to the left of the badge text
6728
- * @slot rightIcon - The slot for icon to the right of the badge text
6833
+ * @slot icon - The slot for icon to the left of the badge text
6729
6834
  *
6730
6835
  * @event sgds-show - Emitted when the badge appears.
6731
6836
  * @event sgds-hide - Emitted after the badge closes.
@@ -6733,13 +6838,13 @@
6733
6838
  class SgdsBadge extends ScopedElementsMixin(SgdsElement) {
6734
6839
  constructor() {
6735
6840
  super(...arguments);
6736
- /** Controls the appearance of the alert */
6841
+ /** Controls the appearance of the dismissible badge. This prop only applies when dismissible is true */
6737
6842
  this.show = false;
6738
- /** One or more button variant combinations buttons may be one of a variety of visual variants such as: `primary`, `info`, `success`, `danger`, `warning`, 'neutral' */
6843
+ /** One or more button variant combinations buttons may be one of a variety of visual variants such as: `info`, `success`, `danger`, `warning`, 'neutral' */
6739
6844
  this.variant = "info";
6740
6845
  /** Manually set the outlined state to false */
6741
6846
  this.outlined = false;
6742
- /** Manually set the dismissable state of the button to `false` */
6847
+ /** Manually set the dismissible state of the button to `false` */
6743
6848
  this.dismissible = false;
6744
6849
  }
6745
6850
  /**@internal */
@@ -6769,7 +6874,7 @@
6769
6874
  "
6770
6875
  aria-hidden=${this.show ? "false" : "true"}
6771
6876
  >
6772
- ${!this.dismissible ? html$1 `<slot name="leftIcon"></slot>` : nothing}
6877
+ ${!this.dismissible ? html$1 `<slot name="icon"></slot>` : nothing}
6773
6878
  <span class="badge-label">
6774
6879
  <slot></slot>
6775
6880
  </span>
@@ -6787,7 +6892,7 @@
6787
6892
  : nothing;
6788
6893
  }
6789
6894
  }
6790
- SgdsBadge.styles = [...SgdsElement.styles, css_248z$N];
6895
+ SgdsBadge.styles = [...SgdsElement.styles, css_248z$K];
6791
6896
  __decorate([
6792
6897
  property({ type: Boolean, reflect: true })
6793
6898
  ], SgdsBadge.prototype, "show", void 0);
@@ -6804,7 +6909,7 @@
6804
6909
  watch("show")
6805
6910
  ], SgdsBadge.prototype, "_handleShowChange", null);
6806
6911
 
6807
- var css_248z$M = css`.breadcrumb{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:var(--sgds-spacer-0) var(--sgds-spacer-0)}`;
6912
+ var css_248z$J = css`.breadcrumb{display:flex;flex-wrap:wrap;list-style:none;margin:0;padding:var(--sgds-spacer-0) var(--sgds-spacer-0)}`;
6808
6913
 
6809
6914
  /**
6810
6915
  * @summary Breadcrumbs help users to navigate and understand where they are on the current website or service.
@@ -6867,7 +6972,7 @@
6867
6972
  `;
6868
6973
  }
6869
6974
  }
6870
- SgdsBreadcrumb.styles = [...SgdsElement.styles, css_248z$M];
6975
+ SgdsBreadcrumb.styles = [...SgdsElement.styles, css_248z$J];
6871
6976
  __decorate([
6872
6977
  property({ type: String })
6873
6978
  ], SgdsBreadcrumb.prototype, "ariaLabel", void 0);
@@ -6878,7 +6983,7 @@
6878
6983
  query('slot[name="separator"]')
6879
6984
  ], SgdsBreadcrumb.prototype, "separatorSlot", void 0);
6880
6985
 
6881
- var css_248z$L = css`:host{font-size:var(--sgds-body-font-size)}slot[name=separator]::slotted(*){color:var(--sgds-body-color);padding-left:var(--sgds-spacer-3);padding-right:var(--sgds-spacer-3)}:host(:last-of-type) .breadcrumb-item__separator{display:none}.breadcrumb-item.active{color:var(--sgds-body-color)}`;
6986
+ var css_248z$I = css`:host{font-size:var(--sgds-body-font-size)}slot[name=separator]::slotted(*){color:var(--sgds-body-color);padding-left:var(--sgds-spacer-3);padding-right:var(--sgds-spacer-3)}:host(:last-of-type) .breadcrumb-item__separator{display:none}.breadcrumb-item.active{color:var(--sgds-body-color)}`;
6882
6987
 
6883
6988
  /**
6884
6989
  * @summary Breadcrumb Item are navigational links used in Breadcrumb component
@@ -6922,7 +7027,7 @@
6922
7027
  `;
6923
7028
  }
6924
7029
  }
6925
- SgdsBreadcrumbItem.styles = [...SgdsElement.styles, css_248z$O, css_248z$L];
7030
+ SgdsBreadcrumbItem.styles = [...SgdsElement.styles, css_248z$L, css_248z$I];
6926
7031
  __decorate([
6927
7032
  property({ type: String, reflect: true })
6928
7033
  ], SgdsBreadcrumbItem.prototype, "href", void 0);
@@ -6933,7 +7038,7 @@
6933
7038
  property()
6934
7039
  ], SgdsBreadcrumbItem.prototype, "rel", void 0);
6935
7040
 
6936
- var css_248z$K = css`:host{--sgds-btn-font-weight:var(--sgds-font-weight-regular);--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-hover-bg:var(--sgds-primary-bg-emphasis);--sgds-btn-border-radius:var(--sgds-border-radius-md)}:host([variant=primary]){--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-color:var(--sgds-default-color-on-dark)}:host([variant=outline]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color);--sgds-btn-border-width:var(--sgds-border-width-1);--sgds-btn-border-color:var(--sgds-primary-border-color)}:host([variant=ghost]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color)}:host([variant=danger]){--sgds-btn-bg:var(--sgds-danger-bg);--sgds-btn-hover-bg:var(--sgds-danger-bg-emphasis);--sgds-btn-color:var(--sgds-default-color-on-dark)}.btn{align-items:center;background-color:var(--sgds-btn-bg);border:1px solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-btn-border-radius);color:var(--sgds-default-color-on-dark);cursor:pointer;display:inline-flex;font-size:var(--sgds-font-size-2);font-weight:var(--sgds-btn-font-weight);gap:var(--sgds-gap-2-xs);height:var(--sgds-dimension-48);justify-content:center;line-height:var(--sgds-line-height-md);min-width:var(--sgds-dimension-96);padding:0 var(--sgds-padding-lg);text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;user-select:none;vertical-align:middle}.btn-ghost,.btn-outline,.btn-primary{color:var(--sgds-btn-color)}.btn-outline{border:var(--sgds-btn-border-width) solid var(--sgds-btn-border-color)}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn.active,.btn:hover{background-color:var(--sgds-btn-hover-bg)}.btn:focus,.btn:focus-visible{background-color:var(--sgds-btn-hover-bg);border-color:transparent;box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn.disabled,.btn:disabled{color:var(--sgds-btn-color);opacity:var(--sgds-opacity-50);pointer-events:none}.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:var(--sgds-dimension-112);padding:0 var(--sgds-padding-xl)}.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:var(--sgds-dimension-80);padding:0 var(--sgds-padding-md)}`;
7041
+ var css_248z$H = css`:host{--sgds-btn-font-weight:var(--sgds-font-weight-regular);--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-hover-bg:var(--sgds-primary-bg-emphasis);--sgds-btn-border-radius:var(--sgds-border-radius-md)}:host([variant=primary]){--sgds-btn-bg:var(--sgds-primary-bg);--sgds-btn-color:var(--sgds-default-color-on-dark)}:host([variant=outline]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color);--sgds-btn-border-width:var(--sgds-border-width-1);--sgds-btn-border-color:var(--sgds-primary-border-color)}:host([variant=ghost]){--sgds-btn-bg:var(--sgds-default-bg-transparent);--sgds-btn-hover-bg:var(--sgds-primary-bg-translucent);--sgds-btn-color:var(--sgds-primary-color)}:host([variant=danger]){--sgds-btn-bg:var(--sgds-danger-bg);--sgds-btn-hover-bg:var(--sgds-danger-bg-emphasis);--sgds-btn-color:var(--sgds-default-color-on-dark)}.btn{align-items:center;background-color:var(--sgds-btn-bg);border:1px solid var(--sgds-default-border-color-transparent);border-radius:var(--sgds-btn-border-radius);color:var(--sgds-default-color-on-dark);cursor:pointer;display:inline-flex;font-size:var(--sgds-font-size-2);font-weight:var(--sgds-btn-font-weight);gap:var(--sgds-gap-2-xs);height:var(--sgds-dimension-48);justify-content:center;line-height:var(--sgds-line-height-md);min-width:var(--sgds-dimension-96);padding:0 var(--sgds-padding-lg);text-align:center;text-decoration:none;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;user-select:none;vertical-align:middle}.btn-ghost,.btn-outline,.btn-primary{color:var(--sgds-btn-color)}.btn-outline{border:var(--sgds-btn-border-width) solid var(--sgds-btn-border-color)}@media (prefers-reduced-motion:reduce){.btn{transition:none}}.btn.active,.btn:hover{background-color:var(--sgds-btn-hover-bg)}.btn:focus,.btn:focus-visible{background-color:var(--sgds-btn-hover-bg);border-color:transparent;box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn.disabled,.btn:disabled{color:var(--sgds-btn-color);opacity:var(--sgds-opacity-50);pointer-events:none}.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:var(--sgds-dimension-112);padding:0 var(--sgds-padding-xl)}.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:var(--sgds-dimension-80);padding:0 var(--sgds-padding-md)}.btn slot::slotted(*){color:var(--sgds-btn-color)}`;
6937
7042
 
6938
7043
  class ButtonElement extends SgdsElement {
6939
7044
  constructor() {
@@ -6975,7 +7080,7 @@
6975
7080
  }
6976
7081
  }
6977
7082
  }
6978
- ButtonElement.styles = [...SgdsElement.styles, css_248z$K];
7083
+ ButtonElement.styles = [...SgdsElement.styles, css_248z$H];
6979
7084
  __decorate([
6980
7085
  query(".btn")
6981
7086
  ], ButtonElement.prototype, "button", void 0);
@@ -7004,7 +7109,64 @@
7004
7109
  property({ type: String })
7005
7110
  ], ButtonElement.prototype, "ariaLabel", void 0);
7006
7111
 
7007
- var css_248z$J = css`:host{display:inline-flex}.btn.full-width,:host([fullWidth]){max-width:var(--sgds-dimension-320);width:100%}.btn.full-width.has-left-icon{justify-content:flex-start}.btn.full-width.has-right-icon{justify-content:space-between}.btn.full-width.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}`;
7112
+ /**
7113
+ * A controller to help with form submission
7114
+ */
7115
+ class FormSubmitController {
7116
+ constructor(host, options) {
7117
+ (this.host = host).addController(this);
7118
+ this.options = Object.assign({ form: (input) => {
7119
+ return input.closest("form");
7120
+ } }, options);
7121
+ }
7122
+ hostConnected() {
7123
+ this.form = this.options.form(this.host);
7124
+ }
7125
+ hostDisconnected() {
7126
+ if (this.form) {
7127
+ this.form = undefined;
7128
+ }
7129
+ }
7130
+ /**
7131
+ * Creates a temporary native HTML button that can participate in form and invoke form submits and reset
7132
+ * Button is removed once action is performed
7133
+ */
7134
+ doAction(type, invoker) {
7135
+ if (this.form) {
7136
+ const button = document.createElement("button");
7137
+ button.type = type;
7138
+ button.style.position = "absolute";
7139
+ button.style.width = "0";
7140
+ button.style.height = "0";
7141
+ button.style.clipPath = "inset(50%)";
7142
+ button.style.overflow = "hidden";
7143
+ button.style.whiteSpace = "nowrap";
7144
+ // Pass form attributes through to the temporary button
7145
+ if (invoker) {
7146
+ ["formaction", "formmethod", "formnovalidate", "formtarget"].forEach(attr => {
7147
+ if (invoker.hasAttribute(attr)) {
7148
+ button.setAttribute(attr, invoker.getAttribute(attr));
7149
+ }
7150
+ });
7151
+ }
7152
+ this.form.append(button);
7153
+ button.click();
7154
+ button.remove();
7155
+ }
7156
+ }
7157
+ /** Resets the form, restoring all the control to their default value */
7158
+ reset(invoker) {
7159
+ this.doAction("reset", invoker);
7160
+ }
7161
+ /** Submits the form, triggering validation and form data injection. */
7162
+ submit(invoker) {
7163
+ // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a
7164
+ // native submit button into the form, "click" it, then remove it to simulate a standard form submission.
7165
+ this.doAction("submit", invoker);
7166
+ }
7167
+ }
7168
+
7169
+ var css_248z$G = css`:host{display:inline-flex}.btn.full-width,:host([fullWidth]){max-width:var(--sgds-dimension-320);width:100%}.btn.full-width.has-left-icon{justify-content:flex-start}.btn.full-width.has-right-icon{justify-content:space-between}.btn.full-width.has-left-icon.has-right-icon{justify-content:center}.btn span{padding:0 var(--sgds-padding-2-xs)}`;
7008
7170
 
7009
7171
  /**
7010
7172
  * @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
@@ -7108,7 +7270,7 @@
7108
7270
  `;
7109
7271
  }
7110
7272
  }
7111
- SgdsButton.styles = [...ButtonElement.styles, css_248z$O, css_248z$J];
7273
+ SgdsButton.styles = [...ButtonElement.styles, css_248z$L, css_248z$G];
7112
7274
  __decorate([
7113
7275
  state()
7114
7276
  ], SgdsButton.prototype, "_hasLeftIcon", void 0);
@@ -7137,7 +7299,7 @@
7137
7299
  property({ type: Boolean, reflect: true })
7138
7300
  ], SgdsButton.prototype, "fullWidth", void 0);
7139
7301
 
7140
- var css_248z$I = css`::slotted(.stretched-link):before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:1}`;
7302
+ var css_248z$F = css`::slotted(.stretched-link):before{bottom:0;content:"";left:0;position:absolute;right:0;top:0;z-index:1}`;
7141
7303
 
7142
7304
  /**
7143
7305
  * @summary Cards can be used for headers and footers, a wide variety of content, contain contextual background colors and images.
@@ -7200,21 +7362,22 @@
7200
7362
  `;
7201
7363
  }
7202
7364
  }
7203
- SgdsCard.styles = [...CardElement.styles, css_248z$I];
7365
+ SgdsCard.styles = [...CardElement.styles, css_248z$F];
7204
7366
  __decorate([
7205
7367
  property({ type: Boolean })
7206
7368
  ], SgdsCard.prototype, "stretchedLink", void 0);
7207
7369
 
7208
- var css_248z$H = css`.invalid-feedback-container{display:flex;gap:var(--sgds-form-gap-sm)}.invalid-feedback{color:var(--sgds-form-danger-color);font-size:var(--sgds-font-size-1);font-weight:var(--sgds-font-weight-regular)}`;
7209
-
7210
- var css_248z$G = css`:host{--sgds-checkbox-group-gap:var(--sgds-spacer-2)}fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.label-hint-container .form-label{color:var(--sgds-form-color);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular)}.checkbox-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}`;
7211
-
7212
- var css_248z$F = css`.form-text{color:var(--sgds-form-color-subtle);font-size:var(--sgds-font-size-1)}`;
7370
+ var css_248z$E = css`:host{--sgds-checkbox-group-gap:var(--sgds-spacer-2)}fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.label-hint-container .form-label{color:var(--sgds-form-color);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular)}.checkbox-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}`;
7213
7371
 
7372
+ /**
7373
+ * @summary CheckboxGroup is the container that group multiple checkboxes under a single question field.
7374
+ * It handles the display of validation feedback of its checkboxes children.
7375
+ *
7376
+ * @slot default - Pass in `sgds-checkbox` into the default slot
7377
+ */
7214
7378
  class SgdsCheckboxGroup extends SgdsElement {
7215
7379
  constructor() {
7216
7380
  super();
7217
- /**@internal */
7218
7381
  this.hasInvalidCheckbox = false;
7219
7382
  /** The checkbox group's label */
7220
7383
  this.label = "";
@@ -7226,6 +7389,7 @@
7226
7389
  this.hintText = "";
7227
7390
  this.addEventListener("sgds-validity-change", (e) => {
7228
7391
  this.hasInvalidCheckbox = e.detail.invalid;
7392
+ this.validationMessage = e.detail.validationMessage;
7229
7393
  });
7230
7394
  }
7231
7395
  _checkInvalidState() {
@@ -7253,7 +7417,7 @@
7253
7417
  ${this._renderHintText()}
7254
7418
  </div>
7255
7419
  <div class="checkbox-container">
7256
- <slot name="checkbox"></slot>
7420
+ <slot></slot>
7257
7421
  </div>
7258
7422
  ${this.hasInvalidCheckbox && this.hasFeedback
7259
7423
  ? html$1 `
@@ -7264,7 +7428,9 @@
7264
7428
  fill="#B90000"
7265
7429
  />
7266
7430
  </svg>
7267
- <div id="checkbox-feedback" tabindex="0" class="invalid-feedback">${this.invalidFeedback}</div>
7431
+ <div id="checkbox-feedback" tabindex="0" class="invalid-feedback">
7432
+ ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}
7433
+ </div>
7268
7434
  </div>
7269
7435
  `
7270
7436
  : nothing}
@@ -7272,13 +7438,16 @@
7272
7438
  `;
7273
7439
  }
7274
7440
  }
7275
- SgdsCheckboxGroup.styles = [...SgdsElement.styles, css_248z$H, css_248z$T, css_248z$G, css_248z$F];
7441
+ SgdsCheckboxGroup.styles = [...SgdsElement.styles, css_248z$W, css_248z$U, css_248z$E, css_248z$V];
7276
7442
  __decorate([
7277
- queryAssignedElements({ slot: "checkbox", flatten: true })
7443
+ queryAssignedElements({ flatten: true })
7278
7444
  ], SgdsCheckboxGroup.prototype, "checkboxes", void 0);
7279
7445
  __decorate([
7280
7446
  state()
7281
7447
  ], SgdsCheckboxGroup.prototype, "hasInvalidCheckbox", void 0);
7448
+ __decorate([
7449
+ state()
7450
+ ], SgdsCheckboxGroup.prototype, "validationMessage", void 0);
7282
7451
  __decorate([
7283
7452
  property({ reflect: true })
7284
7453
  ], SgdsCheckboxGroup.prototype, "label", void 0);
@@ -10903,200 +11072,76 @@
10903
11072
  ?disabled=${this.disabled}
10904
11073
  aria-disabled=${this.disabled ? "true" : "false"}
10905
11074
  target=${this.target}
10906
- >
10907
- <slot></slot>
10908
- </a>
10909
- `;
10910
- }
10911
- }
10912
- __decorate([
10913
- property({ type: Boolean })
10914
- ], LinkElement.prototype, "active", void 0);
10915
- __decorate([
10916
- property({ type: String })
10917
- ], LinkElement.prototype, "href", void 0);
10918
- __decorate([
10919
- property({ type: Boolean, reflect: true })
10920
- ], LinkElement.prototype, "disabled", void 0);
10921
- __decorate([
10922
- property({ type: String, reflect: true })
10923
- ], LinkElement.prototype, "target", void 0);
10924
-
10925
- var css_248z$E = css`.input-group.has-validation>.dropdown-toggle:nth-last-child(n+4),.input-group.has-validation>:nth-last-child(n+3):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),.input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),.input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating){border-bottom-right-radius:0;border-top-right-radius:0}.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.dropdown,.dropdown-center{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle:after{border-bottom:0;border-left:.3em solid transparent;border-right:.3em solid transparent;border-top:.3em solid;content:"";display:inline-block;margin-left:.255em;vertical-align:.255em}.dropdown-toggle:empty:after{margin-left:0}.dropdown-divider{--sgds-dropdown-divider-bg:var(--sgds-border-color-translucent);--sgds-dropdown-divider-margin-y:0.5rem;border-top:1px solid var(--sgds-dropdown-divider-bg);height:0;margin:var(--sgds-dropdown-divider-margin-y) 0;opacity:1;overflow:hidden}.dropdown-item{--sgds-dropdown-item-active-color:#fff;--sgds-dropdown-item-active-bg:var(--sgds-info);--sgds-dropdown-item-disabled-color:var(--sgds-gray-500);background-color:var(--sgds-default-bg-transparent);clear:both;color:var(--sgds-default-color);display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg);text-align:inherit;text-decoration:none;white-space:nowrap}.dropdown-item:hover{background-color:var(--sgds-default-bg-translucent-subtle)}.dropdown-item:focus,.dropdown-item:focus-visible{background-color:var(--sgds-default-bg-translucent-subtle);box-shadow:inset var(--sgds-form-box-shadow-focus);outline:0}.dropdown-item.active,.dropdown-item:active{background-color:var(--sgds-primary-bg-translucent);color:var(--sgds-primary-color);text-decoration:none}.dropdown-item.disabled,.dropdown-item:disabled{opacity:var(--sgds-opacity-50);pointer-events:none}.dropdown-item-label{align-items:center;display:flex;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-2-xs) 0}.active-icon{margin-left:auto}.dropdown-header{--sgds-dropdown-header-color:#5d5d5d;--sgds-dropdown-header-padding-x:1rem;--sgds-dropdown-header-padding-y:0.5rem;color:var(--sgds-dropdown-header-color);display:block;font-size:.875rem;margin-bottom:0;padding:var(--sgds-dropdown-header-padding-y) var(--sgds-dropdown-header-padding-x);white-space:nowrap}.sgds.dropdown .dropdown-toggle{align-items:center;gap:.5rem;justify-content:space-between}.sgds.dropdown .dropdown-toggle:after{content:none}.sgds.dropdown-menu li a.dropdown-item{padding:1rem}.sgds.dropdown-menu li a.dropdown-item.active,.sgds.dropdown-menu li a.dropdown-item:hover{background-color:#0950df;color:#fff}.btn-group>.btn.dropdown-toggle-split:first-child,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.dropdown-toggle-split:after{margin-left:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-left:.375rem;padding-right:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-left-radius:0;border-bottom-right-radius:0}.sgds.navbar .nav-item a.nav-link.dropdown-toggle{gap:.75rem}.sgds.navbar .nav-item a.nav-link.dropdown-toggle.show{border-bottom:.125rem solid #9182e8;color:#9182e8}`;
10926
-
10927
- /**
10928
- * @summary `SgdsDropdownItem` are navigation links built with `HTMLAnchorElement`. It should be used in the default slot of `SgdsDropdown`
10929
- */
10930
- class SgdsDropdownItem extends LinkElement {
10931
- connectedCallback() {
10932
- super.connectedCallback();
10933
- this.addEventListener("keydown", (e) => {
10934
- if (e.key === "Enter") {
10935
- this.anchor.click();
10936
- }
10937
- });
10938
- }
10939
- render() {
10940
- return html$1 `
10941
- <div>
10942
- <a
10943
- href="${this.href}"
10944
- class="dropdown-item ${classMap({
10945
- disabled: this.disabled,
10946
- active: this.active
10947
- })}"
10948
- ?disabled=${this.disabled}
10949
- aria-disabled=${this.disabled ? "true" : "false"}
10950
- role="menuitem"
10951
- tabindex=${this.disabled ? "-1" : "0"}
10952
- target=${this.target}
10953
- >
10954
- <div class="dropdown-item-label">
10955
- <slot></slot>
10956
- ${this.active
10957
- ? html$1 `<div class="active-icon">
10958
- <svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14" fill="none">
10959
- <path
10960
- d="M17.7701 0.968446C17.843 1.04113 17.9008 1.12748 17.9402 1.22255C17.9797 1.31762 18 1.41953 18 1.52246C18 1.62539 17.9797 1.7273 17.9402 1.82237C17.9008 1.91744 17.843 2.00379 17.7701 2.07647L6.81504 13.0315C6.74235 13.1044 6.656 13.1622 6.56094 13.2017C6.46587 13.2411 6.36395 13.2614 6.26103 13.2614C6.1581 13.2614 6.05619 13.2411 5.96112 13.2017C5.86605 13.1622 5.7797 13.1044 5.70701 13.0315L0.22948 7.55401C0.0825462 7.40707 0 7.20779 0 6.99999C0 6.7922 0.0825462 6.59291 0.22948 6.44598C0.376413 6.29905 0.575698 6.2165 0.783493 6.2165C0.991289 6.2165 1.19057 6.29905 1.33751 6.44598L6.26103 11.3711L16.6621 0.968446C16.7348 0.895574 16.8211 0.837758 16.9162 0.79831C17.0113 0.758862 17.1132 0.738556 17.2161 0.738556C17.319 0.738556 17.4209 0.758862 17.516 0.79831C17.6111 0.837758 17.6974 0.895574 17.7701 0.968446Z"
10961
- fill="#5A42C0"
10962
- />
10963
- </svg>
10964
- </div>`
10965
- : nothing}
10966
- </div>
10967
- </a>
10968
- </div>
10969
- `;
10970
- }
10971
- }
10972
- SgdsDropdownItem.styles = [css_248z$E];
10973
- __decorate([
10974
- query("a")
10975
- ], SgdsDropdownItem.prototype, "anchor", void 0);
10976
-
10977
- /**
10978
- * @license
10979
- * Copyright 2017 Google LLC
10980
- * SPDX-License-Identifier: BSD-3-Clause
10981
- */
10982
- const HTML_RESULT = 1;
10983
- class UnsafeHTMLDirective extends Directive {
10984
- constructor(partInfo) {
10985
- super(partInfo);
10986
- this._value = nothing;
10987
- if (partInfo.type !== PartType.CHILD) {
10988
- throw new Error(`${this.constructor.directiveName}() can only be used in child bindings`);
10989
- }
10990
- }
10991
- render(value) {
10992
- if (value === nothing || value == null) {
10993
- this._templateResult = undefined;
10994
- return (this._value = value);
10995
- }
10996
- if (value === noChange) {
10997
- return value;
10998
- }
10999
- if (typeof value != 'string') {
11000
- throw new Error(`${this.constructor.directiveName}() called with a non-string value`);
11001
- }
11002
- if (value === this._value) {
11003
- return this._templateResult;
11004
- }
11005
- this._value = value;
11006
- const strings = [value];
11007
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11008
- strings.raw = strings;
11009
- // WARNING: impersonating a TemplateResult like this is extremely
11010
- // dangerous. Third-party directives should not do this.
11011
- return (this._templateResult = {
11012
- // Cast to a known set of integers that satisfy ResultType so that we
11013
- // don't have to export ResultType and possibly encourage this pattern.
11014
- // This property needs to remain unminified.
11015
- ['_$litType$']: this.constructor
11016
- .resultType,
11017
- strings,
11018
- values: [],
11019
- });
11020
- }
11021
- }
11022
- UnsafeHTMLDirective.directiveName = 'unsafeHTML';
11023
- UnsafeHTMLDirective.resultType = HTML_RESULT;
11024
-
11025
- /**
11026
- * @license
11027
- * Copyright 2017 Google LLC
11028
- * SPDX-License-Identifier: BSD-3-Clause
11029
- */
11030
- const SVG_RESULT = 2;
11031
- class UnsafeSVGDirective extends UnsafeHTMLDirective {
11032
- }
11033
- UnsafeSVGDirective.directiveName = 'unsafeSVG';
11034
- UnsafeSVGDirective.resultType = SVG_RESULT;
11035
- /**
11036
- * Renders the result as SVG, rather than text.
11037
- *
11038
- * The values `undefined`, `null`, and `nothing`, will all result in no content
11039
- * (empty string) being rendered.
11040
- *
11041
- * Note, this is unsafe to use with any user-provided input that hasn't been
11042
- * sanitized or escaped, as it may lead to cross-site-scripting
11043
- * vulnerabilities.
11044
- */
11045
- const unsafeSVG = directive(UnsafeSVGDirective);
11046
-
11047
- var css_248z$D = css`.form-control::placeholder{color:var(--sgds-form-color-subtle);font-family:var(--sgds-font-family-brand);font-weight:var(--sgds-font-weight-light);line-height:var(--sgds-line-height-heading)}`;
11048
-
11049
- class FormControlElement extends SgdsElement {
11050
- constructor() {
11051
- super(...arguments);
11052
- /** The input's label */
11053
- this.label = "";
11054
- /** The input's hint text */
11055
- this.hintText = "";
11056
- /** Disables the input. */
11057
- this.disabled = false;
11058
- /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
11059
- this.hasFeedback = false;
11060
- /**Feedback text for error state when validated */
11061
- this.invalidFeedback = "";
11062
- /** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
11063
- this.invalid = false;
11064
- /** Makes the input a required field. */
11065
- this.required = false;
11066
- this.labelId = genId("label");
11075
+ >
11076
+ <slot></slot>
11077
+ </a>
11078
+ `;
11067
11079
  }
11068
11080
  }
11069
- FormControlElement.styles = [...SgdsElement.styles, css_248z$H, css_248z$F, css_248z$T, css_248z$D];
11070
- __decorate([
11071
- property({ reflect: true })
11072
- ], FormControlElement.prototype, "label", void 0);
11073
- __decorate([
11074
- property({ reflect: true })
11075
- ], FormControlElement.prototype, "hintText", void 0);
11076
- __decorate([
11077
- property({ reflect: true })
11078
- ], FormControlElement.prototype, "name", void 0);
11079
- __decorate([
11080
- property({ type: Boolean, reflect: true })
11081
- ], FormControlElement.prototype, "disabled", void 0);
11082
11081
  __decorate([
11083
- property()
11084
- ], FormControlElement.prototype, "min", void 0);
11082
+ property({ type: Boolean })
11083
+ ], LinkElement.prototype, "active", void 0);
11085
11084
  __decorate([
11086
- property()
11087
- ], FormControlElement.prototype, "max", void 0);
11085
+ property({ type: String })
11086
+ ], LinkElement.prototype, "href", void 0);
11088
11087
  __decorate([
11089
11088
  property({ type: Boolean, reflect: true })
11090
- ], FormControlElement.prototype, "hasFeedback", void 0);
11089
+ ], LinkElement.prototype, "disabled", void 0);
11091
11090
  __decorate([
11092
11091
  property({ type: String, reflect: true })
11093
- ], FormControlElement.prototype, "invalidFeedback", void 0);
11094
- __decorate([
11095
- property({ type: Boolean, reflect: true })
11096
- ], FormControlElement.prototype, "invalid", void 0);
11092
+ ], LinkElement.prototype, "target", void 0);
11093
+
11094
+ var css_248z$D = css`.input-group.has-validation>.dropdown-toggle:nth-last-child(n+4),.input-group.has-validation>:nth-last-child(n+3):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating),.input-group:not(.has-validation)>.dropdown-toggle:nth-last-child(n+3),.input-group:not(.has-validation)>:not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating){border-bottom-right-radius:0;border-top-right-radius:0}.input-group>:not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback){border-bottom-left-radius:0;border-top-left-radius:0;margin-left:-1px}.dropdown,.dropdown-center{position:relative}.dropdown-toggle{white-space:nowrap}.dropdown-toggle:after{border-bottom:0;border-left:.3em solid transparent;border-right:.3em solid transparent;border-top:.3em solid;content:"";display:inline-block;margin-left:.255em;vertical-align:.255em}.dropdown-toggle:empty:after{margin-left:0}.dropdown-divider{--sgds-dropdown-divider-bg:var(--sgds-border-color-translucent);--sgds-dropdown-divider-margin-y:0.5rem;border-top:1px solid var(--sgds-dropdown-divider-bg);height:0;margin:var(--sgds-dropdown-divider-margin-y) 0;opacity:1;overflow:hidden}.dropdown-item{--sgds-dropdown-item-active-color:#fff;--sgds-dropdown-item-active-bg:var(--sgds-info);--sgds-dropdown-item-disabled-color:var(--sgds-gray-500);background-color:var(--sgds-default-bg-transparent);clear:both;color:var(--sgds-default-color);display:block;padding:var(--sgds-padding-xs) var(--sgds-padding-lg);text-align:inherit;text-decoration:none;white-space:nowrap}.dropdown-item:hover{background-color:var(--sgds-default-bg-translucent-subtle)}.dropdown-item:focus,.dropdown-item:focus-visible{background-color:var(--sgds-default-bg-translucent-subtle);box-shadow:inset var(--sgds-form-box-shadow-focus);outline:0}.dropdown-item.active,.dropdown-item:active{background-color:var(--sgds-primary-bg-translucent);color:var(--sgds-primary-color);text-decoration:none}.dropdown-item.disabled,.dropdown-item:disabled{opacity:var(--sgds-opacity-50);pointer-events:none}.dropdown-item-label{align-items:center;display:flex;gap:var(--sgds-gap-sm);padding:var(--sgds-padding-2-xs) 0}.active-icon{margin-left:auto}.dropdown-header{--sgds-dropdown-header-color:#5d5d5d;--sgds-dropdown-header-padding-x:1rem;--sgds-dropdown-header-padding-y:0.5rem;color:var(--sgds-dropdown-header-color);display:block;font-size:.875rem;margin-bottom:0;padding:var(--sgds-dropdown-header-padding-y) var(--sgds-dropdown-header-padding-x);white-space:nowrap}.sgds.dropdown .dropdown-toggle{align-items:center;gap:.5rem;justify-content:space-between}.sgds.dropdown .dropdown-toggle:after{content:none}.sgds.dropdown-menu li a.dropdown-item{padding:1rem}.sgds.dropdown-menu li a.dropdown-item.active,.sgds.dropdown-menu li a.dropdown-item:hover{background-color:#0950df;color:#fff}.btn-group>.btn.dropdown-toggle-split:first-child,.btn-group>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-right-radius:0;border-top-right-radius:0}.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.dropdown-toggle-split:after{margin-left:0}.btn-group-sm>.btn+.dropdown-toggle-split,.btn-sm+.dropdown-toggle-split{padding-left:.375rem;padding-right:.375rem}.btn-group-lg>.btn+.dropdown-toggle-split,.btn-lg+.dropdown-toggle-split{padding-left:.75rem;padding-right:.75rem}.btn-group-vertical>.btn:not(:last-child):not(.dropdown-toggle){border-bottom-left-radius:0;border-bottom-right-radius:0}.sgds.navbar .nav-item a.nav-link.dropdown-toggle{gap:.75rem}.sgds.navbar .nav-item a.nav-link.dropdown-toggle.show{border-bottom:.125rem solid #9182e8;color:#9182e8}`;
11095
+
11096
+ /**
11097
+ * @summary `SgdsDropdownItem` are navigation links built with `HTMLAnchorElement`. It should be used in the default slot of `SgdsDropdown`
11098
+ */
11099
+ class SgdsDropdownItem extends LinkElement {
11100
+ connectedCallback() {
11101
+ super.connectedCallback();
11102
+ this.addEventListener("keydown", (e) => {
11103
+ if (e.key === "Enter") {
11104
+ this.anchor.click();
11105
+ }
11106
+ });
11107
+ }
11108
+ render() {
11109
+ return html$1 `
11110
+ <div>
11111
+ <a
11112
+ href="${this.href}"
11113
+ class="dropdown-item ${classMap({
11114
+ disabled: this.disabled,
11115
+ active: this.active
11116
+ })}"
11117
+ ?disabled=${this.disabled}
11118
+ aria-disabled=${this.disabled ? "true" : "false"}
11119
+ role="menuitem"
11120
+ tabindex=${this.disabled ? "-1" : "0"}
11121
+ target=${this.target}
11122
+ >
11123
+ <div class="dropdown-item-label">
11124
+ <slot></slot>
11125
+ ${this.active
11126
+ ? html$1 `<div class="active-icon">
11127
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14" fill="none">
11128
+ <path
11129
+ d="M17.7701 0.968446C17.843 1.04113 17.9008 1.12748 17.9402 1.22255C17.9797 1.31762 18 1.41953 18 1.52246C18 1.62539 17.9797 1.7273 17.9402 1.82237C17.9008 1.91744 17.843 2.00379 17.7701 2.07647L6.81504 13.0315C6.74235 13.1044 6.656 13.1622 6.56094 13.2017C6.46587 13.2411 6.36395 13.2614 6.26103 13.2614C6.1581 13.2614 6.05619 13.2411 5.96112 13.2017C5.86605 13.1622 5.7797 13.1044 5.70701 13.0315L0.22948 7.55401C0.0825462 7.40707 0 7.20779 0 6.99999C0 6.7922 0.0825462 6.59291 0.22948 6.44598C0.376413 6.29905 0.575698 6.2165 0.783493 6.2165C0.991289 6.2165 1.19057 6.29905 1.33751 6.44598L6.26103 11.3711L16.6621 0.968446C16.7348 0.895574 16.8211 0.837758 16.9162 0.79831C17.0113 0.758862 17.1132 0.738556 17.2161 0.738556C17.319 0.738556 17.4209 0.758862 17.516 0.79831C17.6111 0.837758 17.6974 0.895574 17.7701 0.968446Z"
11130
+ fill="#5A42C0"
11131
+ />
11132
+ </svg>
11133
+ </div>`
11134
+ : nothing}
11135
+ </div>
11136
+ </a>
11137
+ </div>
11138
+ `;
11139
+ }
11140
+ }
11141
+ SgdsDropdownItem.styles = [css_248z$D];
11097
11142
  __decorate([
11098
- property({ type: Boolean, reflect: true })
11099
- ], FormControlElement.prototype, "required", void 0);
11143
+ query("a")
11144
+ ], SgdsDropdownItem.prototype, "anchor", void 0);
11100
11145
 
11101
11146
  var css_248z$C = css`:host{--sgds-spinner-bg:var(--sgds-primary-bg);display:inline-flex}:host([variant=neutral]){--sgds-spinner-bg:var(--sgds-neutral-color-emphasis)}.spinner-wrapper{align-items:center;display:flex;flex-direction:column;gap:var(--sgds-gap-2-xs)}.spinner{animation:spinner .75s linear infinite;border-radius:50%;border-right:.25em solid var(--sgds-alternate-bg);border:.25em solid var(--sgds-alternate-bg);border-right-color:var(--sgds-spinner-bg);color:var(--sgds-spinner-color);display:inline-flex;height:var(--sgds-dimension-32);width:var(--sgds-dimension-32)}.spinner-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.spinner-lg{height:var(--sgds-dimension-48);width:var(--sgds-dimension-48)}.spinner-label{font-size:var(--sgds-font-size-1)}@media (prefers-reduced-motion:reduce){.spinner{animation-duration:1.5s}}
11102
11147
 
@@ -11130,7 +11175,7 @@
11130
11175
  `;
11131
11176
  }
11132
11177
  }
11133
- SgdsSpinner.styles = [...SgdsElement.styles, css_248z$_, css_248z$C];
11178
+ SgdsSpinner.styles = [...SgdsElement.styles, css_248z$$, css_248z$C];
11134
11179
  __decorate([
11135
11180
  property({ type: String, reflect: true })
11136
11181
  ], SgdsSpinner.prototype, "variant", void 0);
@@ -11150,14 +11195,13 @@
11150
11195
  * @event sgds-input - Emitted when the control receives input and its value changes.
11151
11196
  * @event sgds-focus - Emitted when input is in focus.
11152
11197
  * @event sgds-blur - Emitted when input is not in focus.
11198
+ * @event sgds-invalid - Emitted when input is invalid
11199
+ * @event sgds-valid - Emitted when input is valid
11153
11200
  *
11154
11201
  */
11155
- class SgdsInput extends FormControlElement {
11202
+ class SgdsInput extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
11156
11203
  constructor() {
11157
11204
  super(...arguments);
11158
- /**@internal */
11159
- this.formSubmitController = new FormSubmitController(this);
11160
- /** The type of input which works the same as HTMLInputElement */
11161
11205
  this.type = "text";
11162
11206
  /** The input's placeholder text. */
11163
11207
  this.placeholder = "placeholder";
@@ -11165,16 +11209,17 @@
11165
11209
  this.autofocus = false;
11166
11210
  /** Makes the input readonly. */
11167
11211
  this.readonly = false;
11168
- /**The input's value attribute. */
11169
- this.value = "";
11170
11212
  /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
11171
11213
  this.defaultValue = "";
11172
11214
  /** Marks the component as valid. */
11173
11215
  this.valid = false;
11174
11216
  /** Marks the component as loading. */
11175
11217
  this.loading = false;
11176
- /**@internal */
11177
- this.inputId = genId("input", this.type);
11218
+ /** Makes the input a required field. */
11219
+ this.required = false;
11220
+ /**The input's value attribute. */
11221
+ this.value = "";
11222
+ this._isTouched = false;
11178
11223
  }
11179
11224
  /**@internal */
11180
11225
  static get scopedElements() {
@@ -11190,60 +11235,79 @@
11190
11235
  blur() {
11191
11236
  this.input.blur();
11192
11237
  }
11193
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
11194
- reportValidity() {
11195
- return this.input.reportValidity();
11196
- }
11197
- /** Sets a custom validation message. Pass an empty string to restore validity */
11198
- setCustomValidity(err) {
11199
- return this.input.setCustomValidity(err);
11200
- }
11201
11238
  /** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
11202
11239
  setInvalid(bool) {
11203
11240
  this.invalid = bool;
11241
+ if (bool) {
11242
+ this.emit("sgds-invalid");
11243
+ }
11244
+ else {
11245
+ this.emit("sgds-valid");
11246
+ }
11204
11247
  }
11205
- _handleClick() {
11206
- this.focus();
11248
+ /**
11249
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
11250
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
11251
+ */
11252
+ reportValidity() {
11253
+ return this._mixinReportValidity();
11207
11254
  }
11208
- _handleChange(event) {
11209
- this.value = this.input.value;
11210
- this.emit(event);
11255
+ /**
11256
+ * Checks for validity without any native error popup message
11257
+ */
11258
+ checkValidity() {
11259
+ return this._mixinCheckValidity();
11260
+ }
11261
+ /**
11262
+ * Returns the ValidityState object
11263
+ */
11264
+ get validity() {
11265
+ return this._mixinGetValidity();
11266
+ }
11267
+ /**
11268
+ * Returns the validation message based on the ValidityState
11269
+ */
11270
+ get validationMessage() {
11271
+ return this._mixinGetValidationMessage();
11211
11272
  }
11212
11273
  _handleFocus() {
11213
11274
  this.emit("sgds-focus");
11214
11275
  }
11215
11276
  _handleBlur() {
11277
+ this._isTouched = true;
11216
11278
  this.emit("sgds-blur");
11217
11279
  }
11218
- _handleKeyDown(event) {
11219
- const hasModifier = event.metaKey || event.ctrlKey || event.shiftKey || event.altKey;
11220
- // Pressing enter when focused on an input should submit the form like a native input, but we wait a tick before
11221
- // submitting to allow users to cancel the keydown event if they need to
11222
- if (event.key === "Enter" && !hasModifier) {
11223
- setTimeout(() => {
11224
- // Prevent submission when enter is click on a submission in an Input Method Editor with isComposing
11225
- if (!event.defaultPrevented && !event.isComposing) {
11226
- this.formSubmitController.submit();
11227
- }
11228
- });
11280
+ _handleClick() {
11281
+ this.focus();
11282
+ }
11283
+ _handleChange(e) {
11284
+ this.value = this.input.value;
11285
+ this.emit("sgds-change");
11286
+ super._mixinHandleChange(e);
11287
+ }
11288
+ _handleInputChange(e) {
11289
+ this.value = this.input.value;
11290
+ this.emit("sgds-input");
11291
+ super._mixinHandleInputChange(e);
11292
+ }
11293
+ /** @internal */
11294
+ _handleIsTouched() {
11295
+ if (this._isTouched) {
11296
+ this.setInvalid(!this._mixinCheckValidity());
11229
11297
  }
11230
11298
  }
11231
11299
  _handleDisabledChange() {
11232
11300
  // Disabled form controls are always valid, so we need to recheck validity when the state changes
11233
- this.input.disabled = this.disabled;
11234
- this.invalid = !this.input.checkValidity();
11235
- }
11236
- _handleValueChange() {
11237
- this.invalid = !this.input.checkValidity();
11301
+ this.setInvalid(false);
11238
11302
  }
11239
11303
  _renderInput() {
11304
+ const wantFeedbackStyle = this.hasFeedback === "both" || this.hasFeedback === "style";
11240
11305
  return html `
11241
11306
  <div
11242
11307
  class="form-control-group ${classMap({
11243
11308
  disabled: this.disabled,
11244
11309
  readonly: this.readonly,
11245
- "is-invalid": this.invalid && this.hasFeedback,
11246
- "quantity-toggle": this.classList.contains("quantity-toggle")
11310
+ "is-invalid": this.invalid && wantFeedbackStyle
11247
11311
  })}"
11248
11312
  @click=${this._handleClick}
11249
11313
  >
@@ -11252,7 +11316,7 @@
11252
11316
  <input
11253
11317
  class="form-control"
11254
11318
  type=${this.type}
11255
- id=${this.inputId}
11319
+ id=${this._controlId}
11256
11320
  name=${ifDefined(this.name)}
11257
11321
  placeholder=${ifDefined(this.placeholder)}
11258
11322
  aria-invalid=${this.invalid ? "true" : "false"}
@@ -11267,15 +11331,14 @@
11267
11331
  min=${ifDefined(this.min)}
11268
11332
  max=${ifDefined(this.max)}
11269
11333
  step=${ifDefined(this.step)}
11270
- @input=${() => this._handleChange("sgds-input")}
11271
- @change=${() => this._handleChange("sgds-change")}
11272
- @keydown=${this._handleKeyDown}
11334
+ @input=${(e) => this._handleInputChange(e)}
11335
+ @change=${(e) => this._handleChange(e)}
11273
11336
  @invalid=${() => this.setInvalid(true)}
11274
11337
  @focus=${this._handleFocus}
11275
11338
  @blur=${this._handleBlur}
11276
- aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this.inputId}-invalid` : undefined)}
11277
- aria-labelledby="${this.labelId} ${this.inputId}Help ${this.invalid && this.hasFeedback
11278
- ? `${this.inputId}-invalid`
11339
+ aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}
11340
+ aria-labelledby="${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback
11341
+ ? `${this._controlId}-invalid`
11279
11342
  : ""}"
11280
11343
  />
11281
11344
  ${this.loading ? html `<sgds-spinner size="sm"></sgds-spinner>` : nothing}
@@ -11292,7 +11355,8 @@
11292
11355
  `;
11293
11356
  }
11294
11357
  _renderFeedback() {
11295
- return this.invalid && this.hasFeedback
11358
+ const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
11359
+ return this.invalid && wantFeedbackText
11296
11360
  ? html ` <div class="invalid-feedback-container">
11297
11361
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
11298
11362
  <path
@@ -11300,15 +11364,17 @@
11300
11364
  fill="#B90000"
11301
11365
  />
11302
11366
  </svg>
11303
- <div id="${this.inputId}-invalid" class="invalid-feedback">${this.invalidFeedback}</div>
11367
+ <div id="${this._controlId}-invalid" class="invalid-feedback">
11368
+ ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
11369
+ </div>
11304
11370
  </div>`
11305
11371
  : html `${this._renderHintText()}`;
11306
11372
  }
11307
11373
  _renderLabel() {
11308
11374
  const labelTemplate = html `
11309
11375
  <label
11310
- for=${this.inputId}
11311
- id=${this.labelId}
11376
+ for=${this._controlId}
11377
+ id=${this._labelId}
11312
11378
  class=${classMap({
11313
11379
  "form-label": true,
11314
11380
  required: this.required
@@ -11319,7 +11385,7 @@
11319
11385
  return this.label && labelTemplate;
11320
11386
  }
11321
11387
  _renderHintText() {
11322
- const hintTextTemplate = html ` <div id="${this.inputId}Help" class="form-text">${this.hintText}</div> `;
11388
+ const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
11323
11389
  return this.hintText && hintTextTemplate;
11324
11390
  }
11325
11391
  render() {
@@ -11334,10 +11400,7 @@
11334
11400
  `;
11335
11401
  }
11336
11402
  }
11337
- SgdsInput.styles = [...FormControlElement.styles, css_248z$B];
11338
- __decorate([
11339
- query("input.form-control")
11340
- ], SgdsInput.prototype, "input", void 0);
11403
+ SgdsInput.styles = [...FormControlElement.styles, css_248z$T, css_248z$B];
11341
11404
  __decorate([
11342
11405
  property({ reflect: true })
11343
11406
  ], SgdsInput.prototype, "type", void 0);
@@ -11356,6 +11419,12 @@
11356
11419
  __decorate([
11357
11420
  property({ type: Number, reflect: true })
11358
11421
  ], SgdsInput.prototype, "maxlength", void 0);
11422
+ __decorate([
11423
+ property()
11424
+ ], SgdsInput.prototype, "min", void 0);
11425
+ __decorate([
11426
+ property()
11427
+ ], SgdsInput.prototype, "max", void 0);
11359
11428
  __decorate([
11360
11429
  property({ type: String, reflect: true })
11361
11430
  ], SgdsInput.prototype, "placeholder", void 0);
@@ -11372,8 +11441,11 @@
11372
11441
  property()
11373
11442
  ], SgdsInput.prototype, "step", void 0);
11374
11443
  __decorate([
11375
- property({ reflect: true })
11376
- ], SgdsInput.prototype, "value", void 0);
11444
+ property({ type: String, reflect: true })
11445
+ ], SgdsInput.prototype, "hasFeedback", void 0);
11446
+ __decorate([
11447
+ property({ type: String, reflect: true })
11448
+ ], SgdsInput.prototype, "invalidFeedback", void 0);
11377
11449
  __decorate([
11378
11450
  defaultValue()
11379
11451
  ], SgdsInput.prototype, "defaultValue", void 0);
@@ -11383,12 +11455,21 @@
11383
11455
  __decorate([
11384
11456
  property({ type: Boolean, reflect: true })
11385
11457
  ], SgdsInput.prototype, "loading", void 0);
11458
+ __decorate([
11459
+ property({ type: Boolean, reflect: true })
11460
+ ], SgdsInput.prototype, "required", void 0);
11461
+ __decorate([
11462
+ property({ reflect: true })
11463
+ ], SgdsInput.prototype, "value", void 0);
11464
+ __decorate([
11465
+ state()
11466
+ ], SgdsInput.prototype, "_isTouched", void 0);
11467
+ __decorate([
11468
+ watch("_isTouched", { waitUntilFirstUpdate: true })
11469
+ ], SgdsInput.prototype, "_handleIsTouched", null);
11386
11470
  __decorate([
11387
11471
  watch("disabled", { waitUntilFirstUpdate: true })
11388
11472
  ], SgdsInput.prototype, "_handleDisabledChange", null);
11389
- __decorate([
11390
- watch("value", { waitUntilFirstUpdate: true })
11391
- ], SgdsInput.prototype, "_handleValueChange", null);
11392
11473
 
11393
11474
  var css_248z$A = css`.sgds.combobox .form-control-icon{align-items:center;display:flex;font-size:1rem;height:3rem;justify-content:center;position:absolute;width:3rem;z-index:4}.sgds.combobox{align-items:stretch;display:flex;flex-wrap:wrap;justify-content:flex-end;position:relative;width:-webkit-fill-available;width:-moz-available}.sgds.combobox .dropdown-toggle{width:100%}.sgds.combobox>.dropdown-menu{min-width:100%}.form-control-icon{bottom:0}`;
11394
11475
 
@@ -11516,7 +11597,7 @@
11516
11597
  `;
11517
11598
  }
11518
11599
  }
11519
- SgdsComboBox.styles = [...DropdownListElement.styles, css_248z$A, css_248z$E, css_248z$z];
11600
+ SgdsComboBox.styles = [...DropdownListElement.styles, css_248z$A, css_248z$D, css_248z$z];
11520
11601
  __decorate([
11521
11602
  property({ reflect: true })
11522
11603
  ], SgdsComboBox.prototype, "label", void 0);
@@ -21561,15 +21642,28 @@
21561
21642
  }
21562
21643
  };
21563
21644
  this.type = "text";
21564
- this.hasFeedback = true;
21565
- this._handleValueChange = () => null;
21645
+ this.hasFeedback = "both";
21646
+ // this._handleChange = () => null;
21647
+ // this._handleInputChange = () => null
21648
+ }
21649
+ // connectedCallback(): void {
21650
+ // super.connectedCallback();
21651
+ // this.addEventListener("sgds-change", this._validateInput);
21652
+ // }
21653
+ async _handleChange(e) {
21654
+ this.value = this.input.value;
21655
+ this.emit("sgds-change");
21656
+ super._mixinHandleChange(e);
21657
+ await this._validateInput();
21566
21658
  }
21567
- connectedCallback() {
21568
- super.connectedCallback();
21569
- this.addEventListener("sgds-change", this._validateInput);
21659
+ /** @internal */
21660
+ _handleIsTouched() {
21661
+ if (this._isTouched && this.required) {
21662
+ this.invalid = true;
21663
+ }
21570
21664
  }
21571
- async firstUpdated(changes) {
21572
- super.firstUpdated(changes);
21665
+ async firstUpdated(changedProperties) {
21666
+ super.firstUpdated(changedProperties);
21573
21667
  this._applyInputMask(this.dateFormat);
21574
21668
  }
21575
21669
  async _applyInputMask(dateFormat) {
@@ -21666,6 +21760,9 @@
21666
21760
  __decorate([
21667
21761
  queryAsync("input")
21668
21762
  ], DatepickerInput.prototype, "shadowInput", void 0);
21763
+ __decorate([
21764
+ watch("_isTouched", { waitUntilFirstUpdate: true })
21765
+ ], DatepickerInput.prototype, "_handleIsTouched", null);
21669
21766
 
21670
21767
  var css_248z$v = css`:host{--datepicker-theme-color:var(--sgds-primary);--datepicker-hover-bg:var(--sgds-primary-100);--datepicker-bg:#fff;--datepicker-close-btn-bg:var(--datepicker-theme-color);--datepicker-close-btn-hover-bg:var(--sgds-primary-700);--datepicker-close-btn-color:#fff;--datepicker-selected-date-bg:var(--sgds-primary);--datepicker-selected-date-color:#fff}.datepicker{background-color:var(--datepicker-bg);border-color:var(--sgds-border-color);font-size:1rem;max-width:24rem;width:24rem}div{display:flex}button{align-self:self-start}sgds-datepicker-input{--input-border-radius:var(--sgds-border-radius,0.3125rem) 0 0 var(--sgds-border-radius,0.3125rem);flex:1;margin-right:0}sgds-button[variant=outlined]{--btn-color:var(--sgds-dark);--btn-bg:var(--sgds-white);--btn-border-color:var(--sgds-dark);--btn-hover-bg:var(--sgds-dark);--btn-hover-color:var(--sgds-white)}.calendar-btn{--btn-border-color:var(--sgds-border-color);--btn-border-radius:0}.reset-btn{--btn-bg:var(--datepicker-close-btn-bg);--btn-color:var(--datepicker-close-btn-color);--btn-border-radius:0}.reset-btn:hover{--btn-hover-bg:var(--datepicker-close-btn-hover-bg)}`;
21671
21768
 
@@ -22057,7 +22154,7 @@
22057
22154
  `;
22058
22155
  }
22059
22156
  }
22060
- SgdsDatepicker.styles = [...DropdownElement.styles, css_248z$E, css_248z$z, css_248z$v];
22157
+ SgdsDatepicker.styles = [...DropdownElement.styles, css_248z$D, css_248z$z, css_248z$v];
22061
22158
  /**@internal */
22062
22159
  SgdsDatepicker.formAssociated = true;
22063
22160
  __decorate([
@@ -22717,7 +22814,7 @@
22717
22814
  `;
22718
22815
  }
22719
22816
  }
22720
- SgdsDropdown.styles = [...DropdownListElement.styles, css_248z$E, css_248z$z];
22817
+ SgdsDropdown.styles = [...DropdownListElement.styles, css_248z$D, css_248z$z];
22721
22818
  __decorate([
22722
22819
  property({ type: String })
22723
22820
  ], SgdsDropdown.prototype, "togglerId", void 0);
@@ -22740,58 +22837,72 @@
22740
22837
  queryAsync("sgds-button")
22741
22838
  ], SgdsDropdown.prototype, "dropdownRef", void 0);
22742
22839
 
22743
- var css_248z$s = css`:host{--file-upload-left-icon-color:var(--sgds-success);--file-upload-remove-icon-color:var(--sgds-body-color);--file-upload-remove-icon-hover-color: }.fileupload-list-item{display:flex;gap:var(--sgds-spacer-2)}.fileupload-list-item span:not(:first-of-type){cursor:pointer}.fileupload-list-item span:first-of-type svg{color:var(--file-upload-left-icon-color)}.fileupload-list-item span:last-of-type svg{color:var(--file-upload-remove-icon-color)}.fileupload-list-item span:last-of-type svg:hover{color:var(--file-upload-remove-icon-hover-color)}.file-upload-label{align-items:center;display:flex;gap:var(--sgds-spacer-2)}ul{margin:0;padding:0}.sgds.fileupload-list{display:flex;flex-direction:column;gap:var(--sgds-spacer-3);list-style-type:none}.sgds.fileupload-list .fileupload-list-item .filename{color:var(--sgds-link);text-decoration:underline;text-underline-offset:.25rem}input{display:none}label,sgds-button{cursor:pointer}.fileupload-container{display:flex;flex-direction:column;gap:var(--sgds-spacer-3)}`;
22744
-
22745
- var css_248z$r = css`svg{vertical-align:middle}`;
22840
+ var css_248z$s = css`:host{--file-upload-left-icon-color:var(--sgds-success);--file-upload-remove-icon-color:var(--sgds-body-color);--file-upload-remove-icon-hover-color: }.file-upload{display:flex;flex-direction:column;gap:var(--sgds-form-gap-2-xl)}.file-upload-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.file-upload-list{display:flex;flex-direction:column;gap:var(--sgds-form-gap-xl);list-style-type:none}.file-upload-list-item{align-items:center;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color-muted);border-radius:var(--sgds-form-border-radius-md);display:flex;gap:var(--sgds-form-gap-lg);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x)}.file-upload-list-item span:not(:first-of-type){cursor:pointer}.file-upload-list-item span:first-of-type svg{color:var(--file-upload-left-icon-color)}.file-upload-list-item span:last-of-type svg{color:var(--file-upload-remove-icon-color)}.file-upload-list-item span:last-of-type svg:hover{color:var(--file-upload-remove-icon-hover-color)}ul{margin:0;padding:0}input{display:none}label,sgds-button{cursor:pointer}sgds-close-button{margin-left:auto}`;
22746
22841
 
22747
22842
  /**
22748
22843
  * @summary Allows users to upload files of various sizes and formats
22749
22844
  * @slot default - Label for file upload button
22750
22845
  *
22751
- * @event sgds-files-selected - Emitted when files are selected for uploading
22752
- *
22753
- * @cssproperty --file-upload-file-icon-color - Left icon color
22754
- * @cssproperty --file-upload-remove-icon-color - Remove icon color
22755
- * @cssproperty --file-upload-remove-icon-hover-color - Remove icon hover color
22846
+ * @event sgds-files-selected - Emitted when files are selected for uploading. Access the selected files with event.target.detail
22756
22847
  */
22757
- class SgdsFileUpload extends ScopedElementsMixin(SgdsElement) {
22848
+ class SgdsFileUpload extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
22758
22849
  constructor() {
22759
22850
  super(...arguments);
22760
- /** The button's variant. */
22761
- this.variant = "primary";
22762
- //** Disable the fileuploader button */
22763
- this.disabled = false;
22764
22851
  /** Allows multiple files to be listed for uploading */
22765
22852
  this.multiple = false;
22766
22853
  /** Specify the acceptable file type */
22767
22854
  this.accept = "";
22768
- /** Customize the check icon with SVG */
22769
- this.checkedIcon = "";
22770
- /** Customize the cancel icon with SVG */
22771
- this.cancelIcon = "";
22772
- /** The input's hint text below the label */
22773
- this.hintText = "";
22774
- /** @internal */
22855
+ // /** Customize the check icon with SVG */
22856
+ // @property({ type: String }) checkedIcon = "";
22857
+ /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
22858
+ this.hasFeedback = false;
22859
+ /** Makes the input as a required field. */
22860
+ this.required = false;
22775
22861
  this.selectedFiles = [];
22776
- // Create a ref to the input element
22777
- /** @internal */
22778
22862
  this.inputRef = createRef();
22779
- /**@internal */
22780
- this.inputId = genId("input", "file");
22781
22863
  }
22782
22864
  /**@internal */
22783
22865
  static get scopedElements() {
22784
22866
  return {
22785
- "sgds-button": SgdsButton
22867
+ "sgds-button": SgdsButton,
22868
+ "sgds-close-button": SgdsCloseButton
22786
22869
  };
22787
22870
  }
22871
+ /**
22872
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
22873
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
22874
+ */
22875
+ reportValidity() {
22876
+ return this._mixinReportValidity();
22877
+ }
22878
+ /**
22879
+ * Checks for validity without any native error popup message
22880
+ */
22881
+ checkValidity() {
22882
+ return this._mixinCheckValidity();
22883
+ }
22884
+ /**
22885
+ * Returns the ValidityState object
22886
+ */
22887
+ get validity() {
22888
+ return this._mixinGetValidity();
22889
+ }
22890
+ /**
22891
+ * Returns the validation message based on the ValidityState
22892
+ */
22893
+ get validationMessage() {
22894
+ return this._mixinGetValidationMessage();
22895
+ }
22896
+ /**
22897
+ * Returns files selected for upload
22898
+ */
22899
+ get files() {
22900
+ return this.selectedFiles;
22901
+ }
22788
22902
  _setFileList(files) {
22789
- this.files = files;
22790
- this.emit("sgds-files-selected");
22791
- //Possible to pass in the files
22903
+ this.emit("sgds-files-selected", { detail: files });
22792
22904
  }
22793
- /** @internal */
22794
- handleClick(event) {
22905
+ _handleClick(event) {
22795
22906
  event.preventDefault();
22796
22907
  if (!this.disabled) {
22797
22908
  // Get a reference to the input element using the inputRef
@@ -22800,8 +22911,7 @@
22800
22911
  inputElement.click();
22801
22912
  }
22802
22913
  }
22803
- /** @internal */
22804
- handleInputChange(event) {
22914
+ _handleChange(event) {
22805
22915
  const inputElement = event.target;
22806
22916
  const files = inputElement.files;
22807
22917
  if (files.length > 0) {
@@ -22810,6 +22920,7 @@
22810
22920
  // Trigger a re-render of the component to update the list of selected files
22811
22921
  this._setFileList(files);
22812
22922
  this.requestUpdate();
22923
+ super._mixinHandleChange(event);
22813
22924
  }
22814
22925
  _removeFileHandler(index) {
22815
22926
  const inputElement = this.inputRef.value;
@@ -22826,19 +22937,56 @@
22826
22937
  this.selectedFiles = Array.from(fileBuffer.files);
22827
22938
  // Trigger a re-render of the component to update the list of selected files
22828
22939
  this.requestUpdate();
22940
+ this._mixinValidate(this.input);
22941
+ }
22942
+ _clearAllFiles() {
22943
+ const inputElement = this.inputRef.value;
22944
+ const fileBuffer = new DataTransfer();
22945
+ inputElement.files = fileBuffer.files;
22946
+ this._setFileList(fileBuffer.files);
22947
+ this.selectedFiles = Array.from(fileBuffer.files);
22948
+ }
22949
+ /**
22950
+ * fileupload requries a custom _mixinResetFormControl for clearing files
22951
+ */
22952
+ _mixinResetFormControl() {
22953
+ this._clearAllFiles();
22954
+ this._mixinResetValidity(this.input);
22955
+ }
22956
+ _handleDisabledChange() {
22957
+ // Disabled form controls are always valid, so we need to recheck validity when the state changes
22958
+ this.setInvalid(false);
22959
+ }
22960
+ _renderLabel() {
22961
+ const labelTemplate = html$1 `
22962
+ <label for=${this._controlId} id=${this._labelId} class="form-label"> ${this.label} </label>
22963
+ `;
22964
+ return this.label && labelTemplate;
22829
22965
  }
22830
22966
  _renderHintText() {
22831
- const hintTextTemplate = html$1 ` <small id="${this.inputId}Help" class="form-text">${this.hintText}</small> `;
22967
+ const hintTextTemplate = html$1 ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
22832
22968
  return this.hintText && hintTextTemplate;
22833
22969
  }
22834
- _sanitizeVariant(variant) {
22835
- return variant.replace("outline-", "");
22970
+ _renderFeedback() {
22971
+ return html$1 `
22972
+ <div class="invalid-feedback-container">
22973
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
22974
+ <path
22975
+ d="M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10ZM10 6.25C9.49805 6.25 9.10584 6.68339 9.15578 7.18285L9.48461 10.4711C9.51109 10.7359 9.7339 10.9375 10 10.9375C10.2661 10.9375 10.4889 10.7359 10.5154 10.4711L10.8442 7.18285C10.8942 6.68339 10.5019 6.25 10 6.25ZM10.0014 11.875C9.48368 11.875 9.06394 12.2947 9.06394 12.8125C9.06394 13.3303 9.48368 13.75 10.0014 13.75C10.5192 13.75 10.9389 13.3303 10.9389 12.8125C10.9389 12.2947 10.5192 11.875 10.0014 11.875Z"
22976
+ fill="#B90000"
22977
+ />
22978
+ </svg>
22979
+ <div id="${this._controlId}-invalid" class="invalid-feedback">
22980
+ ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
22981
+ </div>
22982
+ </div>
22983
+ `;
22836
22984
  }
22837
22985
  render() {
22838
- const getCheckedIcon = (checkedIcon) => {
22839
- if (checkedIcon) {
22840
- return html$1 `${unsafeSVG(checkedIcon)}`;
22841
- }
22986
+ const getCheckedIcon = () => {
22987
+ // if (checkedIcon) {
22988
+ // return html`${unsafeSVG(checkedIcon)}`;
22989
+ // }
22842
22990
  return html$1 ` <svg
22843
22991
  xmlns="http://www.w3.org/2000/svg"
22844
22992
  width="16"
@@ -22850,67 +22998,62 @@
22850
22998
  <path
22851
22999
  d="M12.736 3.97a.733.733 0 0 1 1.047 0c.286.289.29.756.01 1.05L7.88 12.01a.733.733 0 0 1-1.065.02L3.217 8.384a.757.757 0 0 1 0-1.06.733.733 0 0 1 1.047 0l3.052 3.093 5.4-6.425a.247.247 0 0 1 .02-.022Z"
22852
23000
  />
22853
- </svg>`;
22854
- };
22855
- const getCancelIcon = (cancelIcon) => {
22856
- if (cancelIcon) {
22857
- return html$1 `${unsafeSVG(cancelIcon)}`;
22858
- }
22859
- return html$1 `<svg
22860
- xmlns="http://www.w3.org/2000/svg"
22861
- width="16"
22862
- height="16"
22863
- fill="currentColor"
22864
- class="bi bi-x-circle"
22865
- viewBox="0 0 16 16"
22866
- >
22867
- <path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z" />
22868
- <path
22869
- d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"
22870
- />
22871
23001
  </svg>`;
22872
23002
  };
22873
23003
  const listItems = this.selectedFiles.map((file, index) => html$1 `
22874
- <li key=${index} class="fileupload-list-item">
22875
- <span>${getCheckedIcon(this.checkedIcon)}</span>
23004
+ <li key=${index} class="file-upload-list-item">
23005
+ <span>${getCheckedIcon()}</span>
22876
23006
  <span class="filename">${file.name}</span>
22877
- <span @click=${() => this._removeFileHandler(index)}>${getCancelIcon(this.cancelIcon)}</span>
23007
+ <sgds-close-button
23008
+ aria-label="remove the file"
23009
+ @click=${() => this._removeFileHandler(index)}
23010
+ ></sgds-close-button>
22878
23011
  </li>
22879
23012
  `);
22880
23013
  return html$1 `
22881
- <input
22882
- ${ref(this.inputRef)}
22883
- type="file"
22884
- @change=${this.handleInputChange}
22885
- ?multiple=${this.multiple}
22886
- accept=${this.accept}
22887
- id=${this.inputId}
22888
- />
22889
- <div class="fileupload-container">
22890
- <sgds-button
22891
- size=${this.size}
22892
- variant=${this._sanitizeVariant(this.variant)}
22893
- ?outlined=${this.variant.includes("outline")}
23014
+ <div class="file-upload">
23015
+ <input
23016
+ ${ref(this.inputRef)}
23017
+ type="file"
23018
+ @change=${this._handleChange}
23019
+ ?multiple=${this.multiple}
23020
+ accept=${this.accept}
23021
+ id=${this._controlId}
23022
+ ?required=${this.required}
22894
23023
  ?disabled=${this.disabled}
22895
- @click=${this.handleClick}
22896
- >
22897
- <label for=${this.inputId} class="file-upload-label"><slot></slot></label>
22898
- </sgds-button>
22899
- ${this._renderHintText()}
22900
- <ul class="sgds fileupload-list">
23024
+ />
23025
+ <div class="file-upload-container">
23026
+ ${this._renderLabel()}
23027
+ <sgds-button variant="outline" ?disabled=${this.disabled} @click=${this._handleClick}>
23028
+ <label for=${this._controlId}><slot></slot></label>
23029
+ <svg
23030
+ slot="rightIcon"
23031
+ xmlns="http://www.w3.org/2000/svg"
23032
+ width="24"
23033
+ height="24"
23034
+ viewBox="0 0 24 24"
23035
+ fill="none"
23036
+ >
23037
+ <path
23038
+ d="M3.5625 14.1943C3.71168 14.1943 3.85476 14.2535 3.96025 14.359C4.06574 14.4645 4.125 14.6076 4.125 14.7568V17.5693C4.125 17.8677 4.24353 18.1538 4.4545 18.3648C4.66548 18.5758 4.95163 18.6943 5.25 18.6943H18.75C19.0484 18.6943 19.3345 18.5758 19.5455 18.3648C19.7565 18.1538 19.875 17.8677 19.875 17.5693V14.7568C19.875 14.6076 19.9343 14.4645 20.0398 14.359C20.1452 14.2535 20.2883 14.1943 20.4375 14.1943C20.5867 14.1943 20.7298 14.2535 20.8352 14.359C20.9407 14.4645 21 14.6076 21 14.7568V17.5693C21 18.166 20.7629 18.7383 20.341 19.1603C19.919 19.5822 19.3467 19.8193 18.75 19.8193H5.25C4.65326 19.8193 4.08097 19.5822 3.65901 19.1603C3.23705 18.7383 3 18.166 3 17.5693V14.7568C3 14.6076 3.05926 14.4645 3.16475 14.359C3.27024 14.2535 3.41332 14.1943 3.5625 14.1943Z"
23039
+ fill="currentColor"
23040
+ />
23041
+ <path
23042
+ d="M11.6018 4.34604C11.654 4.29366 11.7161 4.2521 11.7844 4.22374C11.8528 4.19538 11.926 4.18079 12 4.18079C12.074 4.18079 12.1473 4.19538 12.2156 4.22374C12.2839 4.2521 12.346 4.29366 12.3983 4.34604L15.7733 7.72104C15.8789 7.82666 15.9382 7.96992 15.9382 8.11929C15.9382 8.26866 15.8789 8.41192 15.7733 8.51754C15.6676 8.62316 15.5244 8.6825 15.375 8.6825C15.2256 8.6825 15.0824 8.62316 14.9768 8.51754L12.5625 6.10217V15.9943C12.5625 16.1435 12.5032 16.2866 12.3978 16.392C12.2923 16.4975 12.1492 16.5568 12 16.5568C11.8508 16.5568 11.7077 16.4975 11.6023 16.392C11.4968 16.2866 11.4375 16.1435 11.4375 15.9943V6.10217L9.02326 8.51754C8.97096 8.56984 8.90887 8.61133 8.84054 8.63963C8.77221 8.66793 8.69897 8.6825 8.62501 8.6825C8.55105 8.6825 8.47781 8.66793 8.40948 8.63963C8.34114 8.61133 8.27906 8.56984 8.22676 8.51754C8.17446 8.46524 8.13297 8.40316 8.10467 8.33482C8.07636 8.26649 8.0618 8.19325 8.0618 8.11929C8.0618 8.04533 8.07636 7.97209 8.10467 7.90376C8.13297 7.83543 8.17446 7.77334 8.22676 7.72104L11.6018 4.34604Z"
23043
+ fill="currentColor"
23044
+ />
23045
+ </svg>
23046
+ </sgds-button>
23047
+ ${this.hasFeedback && this.invalid ? this._renderFeedback() : this._renderHintText()}
23048
+ </div>
23049
+ <ul class="file-upload-list">
22901
23050
  ${listItems}
22902
23051
  </ul>
22903
23052
  </div>
22904
23053
  `;
22905
23054
  }
22906
23055
  }
22907
- SgdsFileUpload.styles = [...SgdsElement.styles, css_248z$r, css_248z$F, css_248z$s];
22908
- __decorate([
22909
- property({ reflect: true })
22910
- ], SgdsFileUpload.prototype, "variant", void 0);
22911
- __decorate([
22912
- property({ type: Boolean, reflect: true })
22913
- ], SgdsFileUpload.prototype, "disabled", void 0);
23056
+ SgdsFileUpload.styles = [...FormControlElement.styles, css_248z$s];
22914
23057
  __decorate([
22915
23058
  property({ type: Boolean, reflect: true })
22916
23059
  ], SgdsFileUpload.prototype, "multiple", void 0);
@@ -22918,60 +23061,39 @@
22918
23061
  property({ type: String, reflect: true })
22919
23062
  ], SgdsFileUpload.prototype, "accept", void 0);
22920
23063
  __decorate([
22921
- property({ reflect: true })
22922
- ], SgdsFileUpload.prototype, "size", void 0);
22923
- __decorate([
22924
- property({ type: String })
22925
- ], SgdsFileUpload.prototype, "checkedIcon", void 0);
22926
- __decorate([
22927
- property({ type: String })
22928
- ], SgdsFileUpload.prototype, "cancelIcon", void 0);
23064
+ property({ type: Boolean, reflect: true })
23065
+ ], SgdsFileUpload.prototype, "hasFeedback", void 0);
22929
23066
  __decorate([
22930
- property({ reflect: true })
22931
- ], SgdsFileUpload.prototype, "hintText", void 0);
23067
+ property({ type: String, reflect: true })
23068
+ ], SgdsFileUpload.prototype, "invalidFeedback", void 0);
22932
23069
  __decorate([
22933
- property({ type: Object, state: true })
22934
- ], SgdsFileUpload.prototype, "files", void 0);
23070
+ property({ type: Boolean, reflect: true })
23071
+ ], SgdsFileUpload.prototype, "required", void 0);
22935
23072
  __decorate([
22936
- property({ type: Array })
23073
+ state()
22937
23074
  ], SgdsFileUpload.prototype, "selectedFiles", void 0);
23075
+ __decorate([
23076
+ watch("disabled", { waitUntilFirstUpdate: true })
23077
+ ], SgdsFileUpload.prototype, "_handleDisabledChange", null);
22938
23078
 
22939
- var css_248z$q = css`*,:after,:before{box-sizing:border-box}.sgds.footer .footer-header .title{color:var(--sgds-heading-color);font-size:calc(1.275rem + .3vw);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}@media (min-width:1200px){.sgds.footer .footer-header .title{font-size:1.5rem}}.sgds.footer .footer-header .title{line-height:1.33}.container-fluid{margin-left:auto;margin-right:auto;padding-left:var(--sgds-gutter-x,1.5rem);padding-right:var(--sgds-gutter-x,1.5rem);width:100%}.row{--sgds-gutter-x:1.5rem;--sgds-gutter-y:0;display:flex;flex-wrap:wrap;margin-left:calc(var(--sgds-gutter-x)*-.5);margin-right:calc(var(--sgds-gutter-x)*-.5);margin-top:calc(var(--sgds-gutter-y)*-1)}.row>*{flex-shrink:0;margin-top:var(--sgds-gutter-y);max-width:100%;padding-left:calc(var(--sgds-gutter-x)*.5);padding-right:calc(var(--sgds-gutter-x)*.5);width:100%}.col{flex:1 0 0%}@media (min-width:768px){.col-md-4{flex:0 0 auto;width:33.33333333%}}@media (min-width:1400px){.col-xxl-2{flex:0 0 auto;width:16.66666667%}}.sgds.footer .footer-contact-links ul,.sgds.footer .footer-items ul,.sgds.footer .footer-mandatory-links ul{margin:0;padding:0}.sgds.footer .footer-contact-links ul li,.sgds.footer .footer-items ul li,.sgds.footer .footer-mandatory-links ul li{font-size:1rem;line-height:1.5;list-style-type:none}.sgds.footer .footer-contact-links ul li+li,.sgds.footer .footer-items ul li+li,.sgds.footer .footer-mandatory-links ul li+li{margin-top:1rem}.sgds.footer .footer-contact-links ul li a,.sgds.footer .footer-items ul li a,.sgds.footer .footer-mandatory-links ul li a{color:#d0d5dd;text-decoration:none}.sgds.footer,.sgds.footer .footer-contact-links ul li a:hover,.sgds.footer .footer-items ul li a:hover,.sgds.footer .footer-mandatory-links ul li a:hover{color:#f7f7f7}.sgds.footer{height:auto}.sgds.footer .footer-top{background-color:#111;padding:3rem 0 1.5rem}.sgds.footer .footer-header{margin-bottom:1.5rem}.sgds.footer .footer-header .title{margin-bottom:1rem}.sgds.footer .footer-header .description{color:#d0d5dd}@media (max-width:575.98px){.sgds.footer .footer-items>div[class*=col]+div[class*=col]{margin-top:2rem}}.sgds.footer .footer-items .title{font-weight:700}.sgds.footer .footer-items .links{margin-top:1rem}.sgds.footer .footer-contact-links{margin-top:2rem}@media (min-width:992px){.sgds.footer .footer-contact-links ul li{display:inline-block}.sgds.footer .footer-contact-links ul li+li{margin-left:1rem}}.sgds.footer .footer-bottom{background-color:#111;padding:1.5rem 0}@media (min-width:992px){.sgds.footer .footer-mandatory-links ul li{display:inline-block}.sgds.footer .footer-mandatory-links ul li+li{margin-left:1rem}}@media (max-width:991.98px){.sgds.footer .footer-copyrights{margin-top:1rem}}.d-flex{display:flex!important}.text-end{text-align:right!important}@media (min-width:992px){.justify-content-lg-end{justify-content:flex-end!important}}`;
23079
+ var css_248z$r = css`.footer{container:footer/inline-size;height:auto}.footer-top{background-color:var(--sgds-default-bg-emphasis);border-bottom:var(--sgds-border-width-1) solid var(--sgds-default-border-color);gap:var(--sgds-gap-md);padding:var(--sgds-padding-xl) var(--sgds-padding-2-xl)}.footer-header,.footer-top{display:flex;flex-direction:column}.footer-header{gap:var(--sgds-gap-xs);margin:var(--sgds-margin-3-xs) 0}slot[name=title]::slotted(*){--sgds-header-color:var(--sgds-default-color-inverse);--sgds-font-size-6:var(--sgds-font-size-5);--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-line-height-heading:var(--sgds-line-height-body);color:var(--sgds-header-color,--sgds-default-color-inverse);font-size:var(--sgds-font-size-6,--sgds-font-size-5);font-weight:var(--sgds-font-weight-bold);letter-spacing:var(--sgds-letter-spacing-tight);line-height:var(--sgds-line-height-heading,--sgds-line-height-body);margin-bottom:var(--sgds-margin-2-xs,--sgds-margin-none);margin-top:var(--sgds-margin-none)}slot[name=description]::slotted(*){--sgds-font-size-2:var(--sgds-font-size-3);--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-default-color-muted);font-size:var(--sgds-font-size-2,--sgds-font-size-3);margin-bottom:var(--sgds-paragraph-spacing-xl,--sgds-margin-none);margin-top:var(--sgds-margin-none)}.footer-items{display:grid;gap:var(--sgds-gap-md) var(--sgds-gap-lg);grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}.footer ul{margin:0;padding:0}.footer ul li{list-style-type:none}.footer-mandatory-links ul li a{color:var(--sgds-default-color-muted);text-decoration:none}.footer-mandatory-links ul li a:focus,.footer-mandatory-links ul li a:hover{color:var(--sgds-default-color-inverse)}.footer-mandatory-links ul li a:focus,.footer-mandatory-links ul li a:focus-visible{box-shadow:var(--sgds-box-shadow-focus);outline:0}.footer-bottom{background-color:var(--sgds-default-bg-emphasis);display:flex;flex-direction:column;gap:var(--sgds-gap-md);padding:var(--sgds-padding-xl) var(--sgds-padding-2-xl)}.social-media{display:flex;gap:var(--sgds-gap-sm)}slot[name=social-media]::slotted(a){--sgds-link-color:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));--sgds-body-color:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));color:var(--sgds-body-color,--sgds-link-color);display:inline-flex}slot[name=social-media]::slotted(a:hover){--sgds-link-color-emphasis:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));color:var(--sgds-link-color-emphasis)}slot[name=social-media]::slotted(a:focus),slot[name=social-media]::slotted(a:focus-visible){--sgds-link-color-emphasis:light-dark(var(--sgds-gray-000),var(--sgds-gray-900));box-shadow:var(--sgds-box-shadow-focus);color:var(--sgds-link-color-emphasis);outline:0}.footer-mandatory-links{display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xl) var(--sgds-gap-lg);justify-content:space-between}.footer-mandatory-links ul{display:flex;flex-wrap:wrap;gap:var(--sgds-gap-xs) var(--sgds-gap-xl)}.footer-copyrights{color:var(--sgds-default-color-muted)}@container footer (max-width: 711px){.footer-bottom,.footer-top{padding:var(--sgds-padding-lg)}.footer-top{gap:var(--sgds-gap-lg)}.footer-mandatory-links,.footer-mandatory-links ul{flex-direction:column}}`;
22940
23080
 
22941
23081
  /**
22942
23082
  * @summary The footer contains supporting information for your service at the bottom of your website. All .gov.sg digital services shall contain a Global Footer Bar across all pages. The Global Footer Bar should include the name of the digital service, contact information, a privacy statement and the terms of use.
22943
23083
  *
22944
- * @csspart footer-top - The component's footer-top section container.
22945
- * @csspart footer-bottom - The component's footer-bottom section container.
23084
+ * @slot title - The slot for title
23085
+ * @slot description - The slot for description
23086
+ * @slot items - The slot for the list of footer items
23087
+ * @slot social-media - The slot for the list of social media with icons
22946
23088
  *
22947
- * @cssproperty footer-top - The component's footer-top section container.
22948
- * @cssproperty footer-bottom - The component's footer-bottom section container.
22949
23089
  */
22950
23090
  class SgdsFooter extends SgdsElement {
22951
23091
  constructor() {
22952
23092
  super(...arguments);
22953
- /**
22954
- * Sets title of SgdsFooter
22955
- */
22956
- this.title = "";
22957
- /**
22958
- * Sets description of SgdsFooter
22959
- */
22960
- this.description = "";
22961
23093
  /**
22962
23094
  * Sets copyrightLiner of SgdsFooter
22963
23095
  */
22964
23096
  this.copyrightLiner = "Government of Singapore";
22965
- /**
22966
- * Array of type
22967
- *
22968
- * `interface ColumnLinks { title: string; links : Links[] } interface Links { href: string; label: string; }`
22969
- */
22970
- this.links = [];
22971
- /**
22972
- * String date for last updated date
22973
- */
22974
- this.lastUpdatedDate = "";
22975
23097
  /**
22976
23098
  * href link for contacts
22977
23099
  */
@@ -22980,6 +23102,10 @@
22980
23102
  * href link for feedback
22981
23103
  */
22982
23104
  this.feedbackHref = "#";
23105
+ /**
23106
+ * href link for faq
23107
+ */
23108
+ this.faqHref = "#";
22983
23109
  /**
22984
23110
  * href link for privacy statement
22985
23111
  */
@@ -22989,94 +23115,83 @@
22989
23115
  */
22990
23116
  this.termsOfUseHref = "#";
22991
23117
  }
23118
+ firstUpdated() {
23119
+ const socialMediaSlot = this.shadowRoot.querySelector("slot[name='social-media']");
23120
+ const footerTitleSlot = this.shadowRoot.querySelector("slot[name='title']");
23121
+ const footerDescriptionSlot = this.shadowRoot.querySelector("slot[name='description']");
23122
+ const footerItemsSlot = this.shadowRoot.querySelector("slot[name='items']");
23123
+ const socialMediaChildNodes = socialMediaSlot.assignedNodes({ flatten: true });
23124
+ const footerTitleChildNodes = footerTitleSlot.assignedNodes({ flatten: true });
23125
+ const footerDescriptionChildNodes = footerDescriptionSlot.assignedNodes({ flatten: true });
23126
+ const footerItemsChildNodes = footerItemsSlot.assignedNodes({ flatten: true });
23127
+ if (socialMediaChildNodes.length === 0) {
23128
+ const socialMediaContainer = this.shadowRoot.querySelector(".social-media");
23129
+ socialMediaContainer.style.display = "none";
23130
+ }
23131
+ if (footerTitleChildNodes.length === 0 && footerDescriptionChildNodes.length === 0) {
23132
+ const footerHeaderContainer = this.shadowRoot.querySelector(".footer-header");
23133
+ footerHeaderContainer.style.display = "none";
23134
+ }
23135
+ if (footerItemsChildNodes.length === 0) {
23136
+ const footerItemsContainer = this.shadowRoot.querySelector(".footer-items");
23137
+ footerItemsContainer.style.display = "none";
23138
+ }
23139
+ if (footerTitleChildNodes.length === 0 &&
23140
+ footerDescriptionChildNodes.length === 0 &&
23141
+ footerItemsChildNodes.length === 0) {
23142
+ const footerTopContainer = this.shadowRoot.querySelector(".footer-top");
23143
+ footerTopContainer.style.display = "none";
23144
+ }
23145
+ }
22992
23146
  render() {
22993
- // if description is defined
22994
- const hasDescription = html$1 ` <div class="description">${this.description}</div>`;
22995
23147
  return html$1 `
22996
- <footer class="sgds footer">
22997
- <section class="footer-top" part="footer-top">
22998
- <div class="container-fluid">
22999
- <div class="row footer-header">
23000
- <div class="col col-lg-6 col-md-12">
23001
- <div class="title">${this.title ? this.title : "Footer title"}</div>
23002
- ${this.description ? hasDescription : undefined}
23003
- </div>
23004
- </div>
23005
- <div class="row footer-items">
23006
- ${this.links.map((item) => html$1 `
23007
- <div class="col-xxl-2 col-md-4 mb-3">
23008
- <div class="title">${item.title}</div>
23009
- <ul class="links">
23010
- ${item.links.map((link) => html$1 ` <li><a href=${link.href}>${link.label}</a></li> `)}
23011
- </ul>
23012
- </div>
23013
- `)}
23014
- </div>
23015
- <div class="row footer-contact-links">
23016
- <div class="col">
23017
- <div class="d-flex justify-content-lg-end">
23018
- <ul>
23019
- <li><a href=${this.contactHref}>Contact</a></li>
23020
- <li><a href=${this.feedbackHref}>Feedback</a></li>
23021
- </ul>
23022
- </div>
23023
- </div>
23024
- </div>
23148
+ <footer class="footer">
23149
+ <section class="footer-top">
23150
+ <div class="footer-header">
23151
+ <slot name="title"></slot>
23152
+ <slot name="description"></slot>
23153
+ </div>
23154
+ <div class="footer-items">
23155
+ <slot name="items"></slot>
23025
23156
  </div>
23026
23157
  </section>
23027
- <section class="footer-bottom" part="footer-bottom">
23028
- <div class="container-fluid">
23029
- <div class="row footer-mandatory-links">
23030
- <div class="col">
23031
- <ul>
23032
- <li>
23033
- <a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer"
23034
- >Report Vulnerability</a
23035
- >
23036
- </li>
23037
- <li><a href=${this.privacyHref}>Privacy Statement</a></li>
23038
- <li><a href=${this.termsOfUseHref}>Terms of use</a></li>
23039
- </ul>
23040
- </div>
23041
- </div>
23042
- <div class="row footer-copyrights">
23043
- <div class="col">
23044
- <div class="d-flex justify-content-lg-end text-end">
23045
- © ${new Date().getFullYear()} ${this.copyrightLiner}<br />
23046
- Last Updated ${this.lastUpdatedDate}
23047
- </div>
23048
- </div>
23049
- </div>
23158
+ <section class="footer-bottom">
23159
+ <div class="social-media">
23160
+ <slot name="social-media"></slot>
23161
+ </div>
23162
+ <div class="footer-mandatory-links">
23163
+ <ul>
23164
+ <li><a href=${this.contactHref}>Contact</a></li>
23165
+ <li><a href=${this.feedbackHref}>Feedback</a></li>
23166
+ <li><a href=${this.faqHref}>FAQ</a></li>
23167
+ <li>
23168
+ <a href="https://tech.gov.sg/report_vulnerability" target="_blank" rel="noopener noreferrer">
23169
+ Report Vulnerability
23170
+ </a>
23171
+ </li>
23172
+ <li><a href=${this.privacyHref}>Privacy Statement</a></li>
23173
+ <li><a href=${this.termsOfUseHref}>Terms of use</a></li>
23174
+ </ul>
23175
+ <div class="footer-copyrights">© ${new Date().getFullYear()}, ${this.copyrightLiner}</div>
23050
23176
  </div>
23051
23177
  </section>
23052
23178
  </footer>
23053
23179
  `;
23054
23180
  }
23055
23181
  }
23056
- SgdsFooter.styles = [...SgdsElement.styles, css_248z$q];
23057
- __decorate([
23058
- property({ type: String })
23059
- ], SgdsFooter.prototype, "title", void 0);
23060
- __decorate([
23061
- property({ type: String })
23062
- ], SgdsFooter.prototype, "description", void 0);
23182
+ SgdsFooter.styles = [...SgdsElement.styles, css_248z$r];
23063
23183
  __decorate([
23064
23184
  property({ type: String })
23065
23185
  ], SgdsFooter.prototype, "copyrightLiner", void 0);
23066
- __decorate([
23067
- property({
23068
- type: Array
23069
- })
23070
- ], SgdsFooter.prototype, "links", void 0);
23071
- __decorate([
23072
- property({ type: String })
23073
- ], SgdsFooter.prototype, "lastUpdatedDate", void 0);
23074
23186
  __decorate([
23075
23187
  property({ type: String })
23076
23188
  ], SgdsFooter.prototype, "contactHref", void 0);
23077
23189
  __decorate([
23078
23190
  property({ type: String })
23079
23191
  ], SgdsFooter.prototype, "feedbackHref", void 0);
23192
+ __decorate([
23193
+ property({ type: String })
23194
+ ], SgdsFooter.prototype, "faqHref", void 0);
23080
23195
  __decorate([
23081
23196
  property({ type: String })
23082
23197
  ], SgdsFooter.prototype, "privacyHref", void 0);
@@ -23084,11 +23199,13 @@
23084
23199
  property({ type: String })
23085
23200
  ], SgdsFooter.prototype, "termsOfUseHref", void 0);
23086
23201
 
23087
- var css_248z$p = css`.btn.btn-icon{display:flex;height:var(--sgds-dimension-48,56px);min-width:unset;padding:0;width:var(--sgds-dimension-48,56px)}.btn.btn-icon.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:unset;padding:0;width:var(--sgds-dimension-56)}.btn.btn-icon.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:unset;padding:0;width:var(--sgds-dimension-40)}.btn>svg{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-lg>svg{height:var(--sgds-dimension-32);width:var(--sgds-dimension-32)}.btn-sm>svg{height:var(--sgds-dimension-20);width:var(--sgds-dimension-20)}`;
23202
+ var css_248z$q = css`.btn.btn-icon{display:flex;height:var(--sgds-dimension-48,56px);min-width:unset;padding:0;width:var(--sgds-dimension-48,56px)}.btn.btn-icon.btn-lg{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-56);min-width:unset;padding:0;width:var(--sgds-dimension-56)}.btn.btn-icon.btn-sm{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-40);min-width:unset;padding:0;width:var(--sgds-dimension-40)}`;
23088
23203
 
23089
23204
  /**
23090
23205
  * @summary An icon button is a user interface element that combines an icon and a button, serving as a clickable or tabbable component.
23091
23206
  *
23207
+ * @slot default - The slot for sgds-icon
23208
+ *
23092
23209
  * @event sgds-blur - Emitted when the button is blurred.
23093
23210
  * @event sgds-focus - Emitted when the button is focused.
23094
23211
  */
@@ -23105,7 +23222,7 @@
23105
23222
  [`btn-${this.size}`]: this.size
23106
23223
  })}"
23107
23224
  ?disabled=${ifDefined(isLink ? undefined : this.disabled)}
23108
- type="button"
23225
+ type=${ifDefined(isLink ? undefined : "button")}
23109
23226
  href=${ifDefined(isLink ? this.href : undefined)}
23110
23227
  target=${ifDefined(isLink ? this.target : undefined)}
23111
23228
  download=${ifDefined(isLink ? this.download : undefined)}
@@ -23118,19 +23235,14 @@
23118
23235
  @blur=${this._handleBlur}
23119
23236
  aria-label=${ifDefined(this.ariaLabel)}
23120
23237
  >
23121
- <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
23122
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3 12C3 11.8295 3.06773 11.666 3.18828 11.5455C3.30883 11.4249 3.47233 11.3572 3.64282 11.3572H18.8043L14.7584 7.31258C14.6377 7.19187 14.5699 7.02817 14.5699 6.85746C14.5699 6.68676 14.6377 6.52305 14.7584 6.40235C14.8791 6.28165 15.0428 6.21384 15.2135 6.21384C15.3842 6.21384 15.5479 6.28165 15.6686 6.40235L20.8111 11.5449C20.871 11.6046 20.9185 11.6755 20.9509 11.7536C20.9833 11.8317 21 11.9154 21 12C21 12.0845 20.9833 12.1683 20.9509 12.2464C20.9185 12.3245 20.871 12.3954 20.8111 12.4551L15.6686 17.5976C15.5479 17.7183 15.3842 17.7861 15.2135 17.7861C15.0428 17.7861 14.8791 17.7183 14.7584 17.5976C14.6377 17.4769 14.5699 17.3132 14.5699 17.1425C14.5699 16.9718 14.6377 16.8081 14.7584 16.6874L18.8043 12.6428H3.64282C3.47233 12.6428 3.30883 12.5751 3.18828 12.4545C3.06773 12.334 3 12.1705 3 12Z" fill="currentColor"/>
23123
- </svg>
23238
+ <slot></slot>
23124
23239
  </${tag}>
23125
23240
  `;
23126
23241
  }
23127
23242
  }
23128
- SgdsIconButton.styles = [...ButtonElement.styles, css_248z$p];
23129
- __decorate([
23130
- property({ type: String, reflect: true })
23131
- ], SgdsIconButton.prototype, "name", void 0);
23243
+ SgdsIconButton.styles = [...ButtonElement.styles, css_248z$q];
23132
23244
 
23133
- var css_248z$o = css`slot{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot::slotted(*){align-items:center;display:flex;gap:var(--sgds-gap-xs)}.sm{font-size:var(--sgds-font-size-1)}.lg{font-size:var(--sgds-font-size-3)}`;
23245
+ var css_248z$p = css`slot{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot::slotted(*){align-items:center;display:flex;gap:var(--sgds-gap-xs)}.sm{font-size:var(--sgds-font-size-1)}.lg{font-size:var(--sgds-font-size-3)}`;
23134
23246
 
23135
23247
  /**
23136
23248
  * @summary A IconList can be used to display content related to the same topic. Each list item begins an icon.
@@ -23153,7 +23265,7 @@
23153
23265
  `;
23154
23266
  }
23155
23267
  }
23156
- SgdsIconList.styles = [...SgdsElement.styles, css_248z$o];
23268
+ SgdsIconList.styles = [...SgdsElement.styles, css_248z$p];
23157
23269
  __decorate([
23158
23270
  property({ type: String, reflect: true })
23159
23271
  ], SgdsIconList.prototype, "role", void 0);
@@ -23161,7 +23273,7 @@
23161
23273
  property({ type: String, reflect: true })
23162
23274
  ], SgdsIconList.prototype, "size", void 0);
23163
23275
 
23164
- var css_248z$n = css`a.nav-link{align-items:center;color:var(--sgds-primary-color);cursor:pointer;display:inline-flex;flex-shrink:0;gap:var(--sgds-gap-xs);height:var(--sgds-dimension-24);justify-content:center;text-decoration:none}a.nav-link:hover{color:var(--sgds-primary-color-emphasis)}a.nav-link:focus,a.nav-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);color:var(--sgds-primary-color-emphasis);outline:0}a.nav-link.disabled,a.nav-link[disabled]{cursor:not-allowed;opacity:var(--sgds-opacity-50)}:host([variant=danger]) a.nav-link{color:var(--sgds-danger-color)}:host([variant=danger]) a.nav-link:focus,:host([variant=danger]) a.nav-link:focus-visible,:host([variant=danger]) a.nav-link:hover{color:var(--sgds-danger-color-emphasis)}:host([size=lg]) a.nav-link{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-32)}:host([size=sm]) a.nav-link{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-20)}`;
23276
+ var css_248z$o = css`a.nav-link{align-items:center;color:var(--sgds-primary-color);cursor:pointer;display:inline-flex;flex-shrink:0;gap:var(--sgds-gap-xs);height:var(--sgds-dimension-24);justify-content:center;text-decoration:none}a.nav-link:hover{color:var(--sgds-primary-color-emphasis)}a.nav-link:focus,a.nav-link:focus-visible{box-shadow:var(--sgds-box-shadow-focus);color:var(--sgds-primary-color-emphasis);outline:0}a.nav-link.disabled,a.nav-link[disabled]{cursor:not-allowed;opacity:var(--sgds-opacity-50)}:host([variant=danger]) a.nav-link{color:var(--sgds-danger-color)}:host([variant=danger]) a.nav-link:focus,:host([variant=danger]) a.nav-link:focus-visible,:host([variant=danger]) a.nav-link:hover{color:var(--sgds-danger-color-emphasis)}:host([size=lg]) a.nav-link{font-size:var(--sgds-font-size-3);height:var(--sgds-dimension-32)}:host([size=sm]) a.nav-link{font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-20)}`;
23165
23277
 
23166
23278
  /**
23167
23279
  * @summary Link allows users to click and navigate their way from page to page
@@ -23225,7 +23337,7 @@
23225
23337
  `;
23226
23338
  }
23227
23339
  }
23228
- SgdsLink.styles = [...LinkElement.styles, css_248z$n];
23340
+ SgdsLink.styles = [...LinkElement.styles, css_248z$o];
23229
23341
  __decorate([
23230
23342
  property({ type: String, reflect: true })
23231
23343
  ], SgdsLink.prototype, "size", void 0);
@@ -23239,7 +23351,7 @@
23239
23351
  const XL_BREAKPOINT = 1200;
23240
23352
  const XXL_BREAKPOINT = 1400;
23241
23353
 
23242
- var css_248z$m = css`:host{--mainnav-bg:transparent;--mainnav-padding-x:var(--sgds-spacer-5);--mainnav-padding-y:var(--sgds-spacer-0);--mainnav-mobile-padding-x:var(--sgds-spacer-2);--mainnav-mobile-padding-y:var(--sgds-spacer-0);--mainnav-border-bottom-width:1px;--mainnav-border-bottom-color:var(--sgds-gray-400);--mainnav-theme-color:var(--sgds-primary)}.navbar{align-items:stretch;background-color:var(--mainnav-bg);border-bottom:var(--mainnav-border-bottom-width) solid var(--mainnav-border-bottom-color);display:flex;flex-wrap:wrap;justify-content:space-between;min-height:80px;padding:var(--mainnav-padding-y) var(--mainnav-padding-x);position:relative;@media (max-width:768px){padding:var(--mainnav-mobile-padding-y) var(--mainnav-mobile-padding-x)}}.navbar-brand{align-items:center;display:flex;font-size:1.25rem;margin-right:var(--sgds-spacer-4);padding-bottom:.125rem;padding-top:.125rem;text-decoration:none;white-space:nowrap}.navbar-brand,.navbar-brand:focus,.navbar-brand:hover{color:rgba(var(--sgds-emphasis-color-rgb),.9)}.navbar-nav{display:flex;flex-direction:column;gap:var(--sgds-spacer-4);height:100%;list-style:none;margin-bottom:0;margin-top:0;padding-left:0;padding-right:var(--sgds-spacer-4);width:100%}.navbar-collapse{align-items:center;flex-basis:100%;flex-grow:1}.navbar-toggler{background-color:transparent;border:none;cursor:pointer;font-size:1.25rem;line-height:1;padding:var(--sgds-spacer-1) .75rem}@media (prefers-reduced-motion:reduce){.navbar-toggler{transition:none}}.navbar-toggler:hover{text-decoration:none}.navbar-toggler:focus{box-shadow:none;outline:0;text-decoration:none}.navbar-toggler-icon{background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16"><path fill-rule="evenodd" 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"/></svg>');background-position:50%;background-repeat:no-repeat;background-size:100%;display:inline-block;height:1.5em;vertical-align:middle;width:1.5em}.navbar-nav-scroll{max-height:75vh;overflow-y:auto;padding-right:.5rem}@media (min-width:576px){.navbar-expand-sm{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (min-width:768px){.navbar-expand-md{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (min-width:992px){.navbar-expand-lg{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (min-width:1200px){.navbar-expand-xl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav .nav-link{padding-left:var(--mainnav-nav-link-padding-x);padding-right:var(--mainnav-nav-link-padding-x)}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}@media (min-width:1400px){.navbar-expand-xxl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xxl .navbar-nav{flex-direction:row}.navbar-expand-xxl .navbar-nav-scroll{overflow:visible}.navbar-expand-xxl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xxl .navbar-toggler{display:none}}.navbar-expand{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.order-first{order:-1!important}.order-1{order:1!important}.order-2{order:2!important}.order-last{order:6!important}slot[name=non-collapsible]{align-items:center}.slot-end,slot[name=non-collapsible]{display:flex;gap:var(--sgds-spacer-4);margin-left:auto}.slot-end{align-items:stretch}.slot-end::slotted(:not([name$=-mainnav-item]):not([name$=-mainnav-dropdown])){align-self:center}`;
23354
+ var css_248z$n = css`:host{--mainnav-bg:transparent;--mainnav-padding-x:var(--sgds-spacer-5);--mainnav-padding-y:var(--sgds-spacer-0);--mainnav-mobile-padding-x:var(--sgds-spacer-2);--mainnav-mobile-padding-y:var(--sgds-spacer-0);--mainnav-border-bottom-width:1px;--mainnav-border-bottom-color:var(--sgds-gray-400);--mainnav-theme-color:var(--sgds-primary)}.navbar{align-items:stretch;background-color:var(--mainnav-bg);border-bottom:var(--mainnav-border-bottom-width) solid var(--mainnav-border-bottom-color);display:flex;flex-wrap:wrap;justify-content:space-between;min-height:80px;padding:var(--mainnav-padding-y) var(--mainnav-padding-x);position:relative;@media (max-width:768px){padding:var(--mainnav-mobile-padding-y) var(--mainnav-mobile-padding-x)}}.navbar-brand{align-items:center;display:flex;font-size:1.25rem;margin-right:var(--sgds-spacer-4);padding-bottom:.125rem;padding-top:.125rem;text-decoration:none;white-space:nowrap}.navbar-brand,.navbar-brand:focus,.navbar-brand:hover{color:rgba(var(--sgds-emphasis-color-rgb),.9)}.navbar-nav{display:flex;flex-direction:column;gap:var(--sgds-spacer-4);height:100%;list-style:none;margin-bottom:0;margin-top:0;padding-left:0;padding-right:var(--sgds-spacer-4);width:100%}.navbar-collapse{align-items:center;flex-basis:100%;flex-grow:1}.navbar-toggler{background-color:transparent;border:none;cursor:pointer;font-size:1.25rem;line-height:1;padding:var(--sgds-spacer-1) .75rem}@media (prefers-reduced-motion:reduce){.navbar-toggler{transition:none}}.navbar-toggler:hover{text-decoration:none}.navbar-toggler:focus{box-shadow:none;outline:0;text-decoration:none}.navbar-toggler-icon{background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="30" height="30" fill="currentColor" class="bi bi-list" viewBox="0 0 16 16"><path fill-rule="evenodd" 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"/></svg>');background-position:50%;background-repeat:no-repeat;background-size:100%;display:inline-block;height:1.5em;vertical-align:middle;width:1.5em}.navbar-nav-scroll{max-height:75vh;overflow-y:auto;padding-right:.5rem}@media (min-width:576px){.navbar-expand-sm{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-sm .navbar-nav{flex-direction:row}.navbar-expand-sm .navbar-nav-scroll{overflow:visible}.navbar-expand-sm .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-sm .navbar-toggler{display:none}}@media (min-width:768px){.navbar-expand-md{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-md .navbar-nav{flex-direction:row}.navbar-expand-md .navbar-nav-scroll{overflow:visible}.navbar-expand-md .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-md .navbar-toggler{display:none}}@media (min-width:992px){.navbar-expand-lg{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-lg .navbar-nav{flex-direction:row}.navbar-expand-lg .navbar-nav-scroll{overflow:visible}.navbar-expand-lg .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-lg .navbar-toggler{display:none}}@media (min-width:1200px){.navbar-expand-xl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xl .navbar-nav .nav-link{padding-left:var(--mainnav-nav-link-padding-x);padding-right:var(--mainnav-nav-link-padding-x)}.navbar-expand-xl .navbar-nav-scroll{overflow:visible}.navbar-expand-xl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xl .navbar-toggler{display:none}}@media (min-width:1400px){.navbar-expand-xxl{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand-xxl .navbar-nav{flex-direction:row}.navbar-expand-xxl .navbar-nav-scroll{overflow:visible}.navbar-expand-xxl .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand-xxl .navbar-toggler{display:none}}.navbar-expand{flex-wrap:nowrap;justify-content:flex-start}.navbar-expand .navbar-nav{flex-direction:row}.navbar-expand .navbar-nav-scroll{overflow:visible}.navbar-expand .navbar-collapse{display:flex!important;flex-basis:auto}.navbar-expand .navbar-toggler{display:none}.order-first{order:-1!important}.order-1{order:1!important}.order-2{order:2!important}.order-last{order:6!important}slot[name=non-collapsible]{align-items:center}.slot-end,slot[name=non-collapsible]{display:flex;gap:var(--sgds-spacer-4);margin-left:auto}.slot-end{align-items:stretch}.slot-end::slotted(:not([name$=-mainnav-item]):not([name$=-mainnav-dropdown])){align-self:center}`;
23243
23355
 
23244
23356
  const SIZES = {
23245
23357
  sm: SM_BREAKPOINT,
@@ -23415,7 +23527,7 @@
23415
23527
  }
23416
23528
  }
23417
23529
  }
23418
- SgdsMainnav.styles = [...SgdsElement.styles, css_248z$m];
23530
+ SgdsMainnav.styles = [...SgdsElement.styles, css_248z$n];
23419
23531
  __decorate([
23420
23532
  query(".navbar-toggler")
23421
23533
  ], SgdsMainnav.prototype, "header", void 0);
@@ -23452,7 +23564,7 @@
23452
23564
  options: { duration: 200, easing: "ease-in-out" }
23453
23565
  });
23454
23566
 
23455
- var css_248z$l = css`.dropdown-menu{background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:0 0 5px 5px;box-shadow:0 .5rem 1rem rgba(0,0,0,.15);margin-top:0}.nav-link.show{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}.sgds.dropdown.nav-item{height:100%}a.nav-link{align-items:center;border-bottom:.125rem solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--mainnav-disabled-opacity);pointer-events:none}`;
23567
+ var css_248z$m = css`.dropdown-menu{background-color:#fff;border:1px solid rgba(0,0,0,.1);border-radius:0 0 5px 5px;box-shadow:0 .5rem 1rem rgba(0,0,0,.15);margin-top:0}.nav-link.show{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}.sgds.dropdown.nav-item{height:100%}a.nav-link{align-items:center;border-bottom:.125rem solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--mainnav-disabled-opacity);pointer-events:none}`;
23456
23568
 
23457
23569
  /**
23458
23570
  * @slot default - The menu items. Pass in sgds-dropdown-item as the menu items
@@ -23515,7 +23627,7 @@
23515
23627
  `;
23516
23628
  }
23517
23629
  }
23518
- SgdsMainnavDropdown.styles = [...DropdownListElement.styles, css_248z$E, css_248z$z, css_248z$l];
23630
+ SgdsMainnavDropdown.styles = [...DropdownListElement.styles, css_248z$D, css_248z$z, css_248z$m];
23519
23631
  __decorate([
23520
23632
  queryAsync("a")
23521
23633
  ], SgdsMainnavDropdown.prototype, "dropdownRef", void 0);
@@ -23526,7 +23638,7 @@
23526
23638
  property({ type: Boolean })
23527
23639
  ], SgdsMainnavDropdown.prototype, "active", void 0);
23528
23640
 
23529
- var css_248z$k = css`:host{--mainnav-item-border-bottom-width:0.125rem}li{height:100%}a.nav-link{align-items:center;border-bottom:var(--mainnav-item-border-bottom-width) solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--sgds-disabled-opacity);pointer-events:none}`;
23641
+ var css_248z$l = css`:host{--mainnav-item-border-bottom-width:0.125rem}li{height:100%}a.nav-link{align-items:center;border-bottom:var(--mainnav-item-border-bottom-width) solid transparent;color:var(--sgds-body-color);cursor:pointer;display:flex;min-height:100%;padding:0;text-decoration:none;&.active,&:hover{border-color:var(--mainnav-theme-color);color:var(--mainnav-theme-color)}&:focus-visible{box-shadow:0 0 0 .25rem rgba(89,66,219,.25);outline:0}}.nav-link.disabled{cursor:default;opacity:var(--sgds-disabled-opacity);pointer-events:none}`;
23530
23642
 
23531
23643
  /**
23532
23644
  * @slot default - slot for SgdsMainnavItem element.
@@ -23534,9 +23646,11 @@
23534
23646
  * */
23535
23647
  class SgdsMainnavItem extends LinkElement {
23536
23648
  }
23537
- SgdsMainnavItem.styles = [...LinkElement.styles, css_248z$k];
23649
+ SgdsMainnavItem.styles = [...LinkElement.styles, css_248z$l];
23538
23650
 
23539
- var css_248z$j = css`:host{--masthead-max-width:1440px;--masthead-padding-x:2rem}b{font-weight:bolder}[role=button]{cursor:pointer}a{color:#0049dc}a:hover{color:#0022b9}.sgds-masthead{color:light-dark(#252525,#eaeaea);font-family:Inter,system-ui,sans-serif;font-size:.875rem;line-height:1.25rem}.banner{background-color:light-dark(#eaeaea,#252525)}.container{margin-left:auto;margin-right:auto;max-width:var(--masthead-max-width);padding:.25rem var(--masthead-padding-x);width:100%}.sg-crest{flex-shrink:0;height:20px;width:20px}.sg-crest path{fill:#db0000}.masthead-layout{display:flex;gap:.25rem}.masthead-text-layout{align-items:center;display:flex;flex-wrap:wrap;gap:0 .75rem}.sgds-masthead-identify-icon{align-self:center;display:block;height:20px;transform:rotate(180deg);transition:transform .3s ease-in-out 0s;user-select:none;width:20px}.sgds-masthead-identify-icon.show{transform:rotate(0deg)}.sgds-masthead-button{align-items:center;color:light-dark(#0049dc,#7fb5ff);cursor:pointer;display:flex;gap:4px}.sgds-masthead-button:hover{color:light-dark(#0022b9,#5592ff)}.panel{background-color:light-dark(hsla(0,0%,5%,.05),hsla(0,0%,100%,.1))}.sgds-masthead .sgds-masthead-content{display:none;padding-bottom:1rem;padding-top:1rem}.sgds-masthead .sgds-masthead-content.show{display:block}.content-grid{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.icon{margin-top:-.1em}.wrapper{display:flex;gap:.5rem}.content{display:flex;flex-direction:column;gap:.25rem}.content .title{font-weight:600}.content article{color:light-dark(#595959,#b2b2b2)}.banner-icon,.banner-icon-inline{height:20px;width:20px}.banner-icon path,.banner-icon-inline path{fill:light-dark(#0e0e0e,#fff)}a.trusted-websites-link{color:light-dark(#0049dc,#7fb5ff);text-decoration:underline;width:fit-content}a.trusted-websites-link:hover{color:light-dark(#0022b9,#5592ff)}@media screen and (max-width:768px){.container{--masthead-padding-x:1rem}.sgds-masthead-content .content-grid{gap:1rem;grid-template-columns:1fr}}`;
23651
+ var css_248z$k = css`:host{--masthead-max-width:1440px;--masthead-padding-x:2rem}b{font-weight:bolder}[role=button]{cursor:pointer}a{color:#0049dc}a:hover{color:#0022b9}.sgds-masthead{color:light-dark(#252525,#eaeaea);font-family:Inter,system-ui,sans-serif;font-size:.875rem;line-height:1.25rem}.banner{background-color:light-dark(#eaeaea,#252525)}.container{margin-left:auto;margin-right:auto;max-width:var(--masthead-max-width);padding:.25rem var(--masthead-padding-x);width:100%}.sg-crest{flex-shrink:0;height:20px;width:20px}.sg-crest path{fill:#db0000}.masthead-layout{display:flex;gap:.25rem}.masthead-text-layout{align-items:center;display:flex;flex-wrap:wrap;gap:0 .75rem}.sgds-masthead-identify-icon{align-self:center;display:block;height:20px;transform:rotate(180deg);transition:transform .3s ease-in-out 0s;user-select:none;width:20px}.sgds-masthead-identify-icon.show{transform:rotate(0deg)}.sgds-masthead-button{align-items:center;color:light-dark(#0049dc,#7fb5ff);cursor:pointer;display:flex;gap:4px}.sgds-masthead-button:hover{color:light-dark(#0022b9,#5592ff)}.panel{background-color:light-dark(hsla(0,0%,5%,.05),hsla(0,0%,100%,.1))}.sgds-masthead .sgds-masthead-content{display:none;padding-bottom:1rem;padding-top:1rem}.sgds-masthead .sgds-masthead-content.show{display:block}.content-grid{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.icon{margin-top:-.1em}.wrapper{display:flex;gap:.5rem}.content{display:flex;flex-direction:column;gap:.25rem}.content .title{font-weight:600}.content article{color:light-dark(#595959,#b2b2b2)}.banner-icon,.banner-icon-inline{height:20px;width:20px}.banner-icon path,.banner-icon-inline path{fill:light-dark(#0e0e0e,#fff)}a.trusted-websites-link{color:light-dark(#0049dc,#7fb5ff);text-decoration:underline;width:fit-content}a.trusted-websites-link:hover{color:light-dark(#0022b9,#5592ff)}@media screen and (max-width:768px){.container{--masthead-padding-x:1rem}.sgds-masthead-content .content-grid{gap:1rem;grid-template-columns:1fr}}`;
23652
+
23653
+ var css_248z$j = css`svg{vertical-align:middle}`;
23540
23654
 
23541
23655
  /**
23542
23656
  * @summary All .gov.sg digital services shall adopt The Official Government Banner for every page in the digital service and be placed at the top of the page.
@@ -23709,7 +23823,7 @@
23709
23823
  `;
23710
23824
  }
23711
23825
  }
23712
- SgdsMasthead.styles = [...SgdsElement.styles, css_248z$r, css_248z$O, css_248z$j];
23826
+ SgdsMasthead.styles = [...SgdsElement.styles, css_248z$j, css_248z$L, css_248z$k];
23713
23827
  __decorate([
23714
23828
  state()
23715
23829
  ], SgdsMasthead.prototype, "toggleVisibility", void 0);
@@ -24083,7 +24197,7 @@
24083
24197
  `;
24084
24198
  }
24085
24199
  }
24086
- SgdsModal.styles = [...SgdsElement.styles, css_248z$X, css_248z$r, css_248z$i];
24200
+ SgdsModal.styles = [...SgdsElement.styles, css_248z$Y, css_248z$j, css_248z$i];
24087
24201
  __decorate([
24088
24202
  query(".modal")
24089
24203
  ], SgdsModal.prototype, "dialog", void 0);
@@ -24669,45 +24783,82 @@
24669
24783
  /**
24670
24784
  * @summary The quantity toggle component is used to increase or decrease an incremental venue, best used when the user needs to enter or adjust the quantity of a selected item.
24671
24785
  *
24672
- * @csspart base - The base wrapper of the quantity toggle component.
24673
- * @csspart button - The plus and minus button of quantity toggle
24674
- *
24675
24786
  * @event sgds-change - Emitted when an alteration to the control's value is committed by the user.
24676
24787
  * @event sgds-input - Emitted when the control receives input and its value changes.
24677
24788
  *
24678
24789
  */
24679
- class SgdsQuantityToggle extends FormControlElement {
24790
+ class SgdsQuantityToggle extends SgdsFormValidatorMixin(ScopedElementsMixin(FormControlElement)) {
24680
24791
  constructor() {
24681
24792
  super(...arguments);
24682
- /** @internal */
24683
- this.formSubmitController = new FormSubmitController(this);
24684
24793
  /** Controls the size of the quantity toggle */
24685
24794
  this.size = "md";
24686
24795
  /** The input's value. Set to 0 by default */
24687
24796
  this.value = 0;
24688
- /** Disables the entire quantity toggle */
24689
- this.disabled = false;
24690
- /** The quantity toggle's button variants */
24691
- this.iconButtonVariant = "ghost";
24797
+ // /** The quantity toggle's button variants */
24798
+ // @property({ type: String }) iconButtonVariant = "ghost";
24692
24799
  /** Controls the incremental / decremental value of the input */
24693
24800
  this.step = 1;
24694
24801
  /** Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
24695
24802
  this.defaultValue = 0;
24696
- /** @internal The id forwarded to input element */
24697
- this.inputId = genId("quantity-toggle", "input");
24698
24803
  }
24699
24804
  /** @internal */
24700
24805
  static get scopedElements() {
24701
24806
  return {
24702
24807
  "sgds-input": SgdsInput,
24703
- "sgds-icon-button": SgdsIconButton
24808
+ "sgds-icon-button": SgdsIconButton,
24809
+ "sgds-icon": SgdsIcon
24704
24810
  };
24705
24811
  }
24706
- _handleChange() {
24707
- if (parseInt(this.input.value) < this.step || this.input.value === "") {
24708
- this.input.value = "0";
24812
+ /**
24813
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
24814
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
24815
+ */
24816
+ reportValidity() {
24817
+ return this._mixinReportValidity();
24818
+ }
24819
+ /**
24820
+ * Checks for validity without any native error popup message
24821
+ */
24822
+ checkValidity() {
24823
+ return this._mixinCheckValidity();
24824
+ }
24825
+ /**
24826
+ * Returns the ValidityState object
24827
+ */
24828
+ get validity() {
24829
+ return this._mixinGetValidity();
24830
+ }
24831
+ /**
24832
+ * Returns the validation message based on the ValidityState
24833
+ */
24834
+ get validationMessage() {
24835
+ return this._mixinGetValidationMessage();
24836
+ }
24837
+ async _handleChange() {
24838
+ const sgdsInput = await this._sgdsInput;
24839
+ if (parseInt(sgdsInput.value) < this.step || sgdsInput.value === "") {
24840
+ sgdsInput.value = "0";
24841
+ }
24842
+ this.value = parseInt(sgdsInput.value);
24843
+ this._mixinSetFormValue();
24844
+ this._mixinValidate(sgdsInput.input);
24845
+ this.invalid = !this._mixinReportValidity();
24846
+ }
24847
+ async _handleInputChange() {
24848
+ const sgdsInput = await this._sgdsInput;
24849
+ this.invalid = false;
24850
+ if (parseInt(sgdsInput.value) < this.step || sgdsInput.value === "") {
24851
+ sgdsInput.value = "0";
24709
24852
  }
24710
- this.value = parseInt(this.input.value);
24853
+ this.value = parseInt(sgdsInput.value);
24854
+ this._mixinSetFormValue();
24855
+ this._mixinValidate(sgdsInput.input);
24856
+ }
24857
+ async _mixinResetFormControl() {
24858
+ const sgdsInput = await this._sgdsInput;
24859
+ this.value = this.defaultValue;
24860
+ sgdsInput.input.value = this.value.toString();
24861
+ this._mixinResetValidity(sgdsInput.input);
24711
24862
  }
24712
24863
  _handleKeyDown(event) {
24713
24864
  const allowedKeys = [
@@ -24724,6 +24875,12 @@
24724
24875
  event.preventDefault();
24725
24876
  }
24726
24877
  }
24878
+ _handleInvalid() {
24879
+ this.invalid = true;
24880
+ }
24881
+ _handleValid() {
24882
+ this.invalid = false;
24883
+ }
24727
24884
  /** Simulates a click on the plus button */
24728
24885
  plus() {
24729
24886
  this.plusBtn.click();
@@ -24732,23 +24889,41 @@
24732
24889
  minus() {
24733
24890
  this.minusBtn.click();
24734
24891
  }
24735
- _onPlus(event) {
24892
+ async _onPlus(event) {
24893
+ const sgdsInput = await this._sgdsInput;
24736
24894
  event.preventDefault();
24737
24895
  event.stopPropagation();
24738
- this.value = parseInt(this.input.value) + parseInt(this.input.step);
24896
+ this.value = parseInt(sgdsInput.value) + parseInt(sgdsInput.step.toString());
24897
+ this._validateOnClick(sgdsInput.input);
24739
24898
  }
24740
- _onMinus(event) {
24899
+ async _onMinus(event) {
24900
+ const sgdsInput = await this._sgdsInput;
24741
24901
  event.preventDefault();
24742
24902
  event.stopPropagation();
24743
24903
  if (this.value < this.step) {
24744
24904
  this.value = 0;
24745
24905
  }
24746
24906
  else {
24747
- this.value = parseInt(this.input.value) - parseInt(this.input.step);
24907
+ this.value = parseInt(sgdsInput.value) - parseInt(sgdsInput.step.toString());
24748
24908
  }
24909
+ this._validateOnClick(sgdsInput.input);
24910
+ }
24911
+ /**
24912
+ * Validates the input on button clicks of the toggle.
24913
+ * Input is validated every time the button is click to update the invalid state
24914
+ * to indiciate the validity of quantity toggle
24915
+ * @param input native HTMLInputElement
24916
+ */
24917
+ async _validateOnClick(input) {
24918
+ const sgdsInput = await this._sgdsInput;
24919
+ await sgdsInput.updateComplete;
24920
+ this._mixinSetFormValue();
24921
+ this._mixinValidate(input);
24922
+ this.invalid = !this._mixinReportValidity();
24749
24923
  }
24750
24924
  _renderFeedback() {
24751
- return this.invalid && this.hasFeedback
24925
+ const wantFeedbackText = this.hasFeedback === "both" || this.hasFeedback === "text";
24926
+ return this.invalid && wantFeedbackText
24752
24927
  ? html ` <div class="invalid-feedback-container">
24753
24928
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
24754
24929
  <path
@@ -24756,17 +24931,20 @@
24756
24931
  fill="#B90000"
24757
24932
  />
24758
24933
  </svg>
24759
- <div id="${this.inputId}-invalid" class="invalid-feedback">${this.invalidFeedback}</div>
24934
+ <div id="${this._controlId}-invalid" class="invalid-feedback">
24935
+ ${this.invalidFeedback ? this.invalidFeedback : this.validationMessage}
24936
+ </div>
24760
24937
  </div>`
24761
24938
  : html `${this._renderHintText()}`;
24762
24939
  }
24763
24940
  _renderLabel() {
24764
24941
  const labelTemplate = html `
24765
24942
  <label
24766
- for=${this.inputId}
24767
- id=${this.labelId}
24943
+ for=${this._controlId}
24944
+ id=${this._labelId}
24768
24945
  class=${classMap({
24769
- "form-label": true
24946
+ "form-label": true,
24947
+ disabled: this.disabled
24770
24948
  })}
24771
24949
  >${this.label}</label
24772
24950
  >
@@ -24774,30 +24952,22 @@
24774
24952
  return this.label && labelTemplate;
24775
24953
  }
24776
24954
  _renderHintText() {
24777
- const hintTextTemplate = html ` <div id="${this.inputId}Help" class="form-text">${this.hintText}</div> `;
24955
+ const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
24778
24956
  return this.hintText && hintTextTemplate;
24779
24957
  }
24780
24958
  render() {
24781
24959
  return html `
24782
24960
  <div class="form-control-container">
24783
24961
  ${this._renderLabel()}
24784
- <div
24785
- part="base"
24786
- class="${classMap({
24787
- disabled: this.disabled,
24788
- "input-group": true,
24789
- [`input-group-${this.size}`]: this.size
24790
- })}"
24791
- variant="quantity-toggle"
24792
- size=${this.size}
24793
- >
24962
+ <div class="input-group">
24794
24963
  <sgds-icon-button
24795
- variant=${this.iconButtonVariant}
24964
+ variant="ghost"
24796
24965
  ariaLabel=${`decrease by ${this.step}`}
24797
- part="button"
24798
24966
  ?disabled=${this.disabled || (this.min !== undefined ? this.value <= this.min : this.value < 1)}
24799
24967
  @click=${this._onMinus}
24800
- ></sgds-icon-button>
24968
+ >
24969
+ <sgds-icon name="dash"></sgds-icon>
24970
+ </sgds-icon-button>
24801
24971
  <sgds-input
24802
24972
  type="number"
24803
24973
  class="quantity-toggle"
@@ -24805,21 +24975,24 @@
24805
24975
  step=${ifDefined(this.step)}
24806
24976
  min=${ifDefined(this.min)}
24807
24977
  max=${ifDefined(this.max)}
24808
- .value=${live(this.value.toString())}
24809
- @sgds-change=${() => this._handleChange()}
24810
- @sgds-input=${() => this._handleChange()}
24978
+ .value=${live(this.value)}
24979
+ @sgds-change=${this._handleChange}
24980
+ @sgds-input=${this._handleInputChange}
24981
+ @sgds-invalid=${this._handleInvalid}
24982
+ @sgds-valid=${this._handleValid}
24811
24983
  @keydown=${this._handleKeyDown}
24812
24984
  ?disabled=${this.disabled}
24985
+ id=${this._controlId}
24813
24986
  ?invalid=${this.invalid}
24814
- id=${this.inputId}
24987
+ hasFeedback=${ifDefined(this.hasFeedback !== "text" ? "style" : undefined)}
24815
24988
  ></sgds-input>
24816
24989
  <sgds-icon-button
24817
- variant=${this.iconButtonVariant}
24990
+ variant="ghost"
24818
24991
  ariaLabel=${`increase by ${this.step}`}
24819
- part="button"
24820
24992
  @click=${this._onPlus}
24821
24993
  ?disabled=${this.disabled || (this.max !== undefined && this.max && this.value >= this.max)}
24822
- ></sgds-icon-button>
24994
+ ><sgds-icon name="plus"></sgds-icon>
24995
+ </sgds-icon-button>
24823
24996
  </div>
24824
24997
  <div id="announcer" role="region" aria-live="assertive" class="visually-hidden">${this.value}</div>
24825
24998
  ${this._renderFeedback()}
@@ -24827,10 +25000,7 @@
24827
25000
  `;
24828
25001
  }
24829
25002
  }
24830
- SgdsQuantityToggle.styles = [...FormControlElement.styles, css_248z$r, css_248z$f];
24831
- __decorate([
24832
- query("sgds-input")
24833
- ], SgdsQuantityToggle.prototype, "input", void 0);
25003
+ SgdsQuantityToggle.styles = [...FormControlElement.styles, css_248z$T, css_248z$j, css_248z$f];
24834
25004
  __decorate([
24835
25005
  query("sgds-icon-button[ariaLabel^='increase by']")
24836
25006
  ], SgdsQuantityToggle.prototype, "plusBtn", void 0);
@@ -24843,18 +25013,27 @@
24843
25013
  __decorate([
24844
25014
  property({ type: Number, reflect: true })
24845
25015
  ], SgdsQuantityToggle.prototype, "value", void 0);
24846
- __decorate([
24847
- property({ type: Boolean, reflect: true })
24848
- ], SgdsQuantityToggle.prototype, "disabled", void 0);
24849
- __decorate([
24850
- property({ type: String })
24851
- ], SgdsQuantityToggle.prototype, "iconButtonVariant", void 0);
24852
25016
  __decorate([
24853
25017
  property({ type: Number })
24854
25018
  ], SgdsQuantityToggle.prototype, "step", void 0);
25019
+ __decorate([
25020
+ property()
25021
+ ], SgdsQuantityToggle.prototype, "min", void 0);
25022
+ __decorate([
25023
+ property()
25024
+ ], SgdsQuantityToggle.prototype, "max", void 0);
25025
+ __decorate([
25026
+ property({ type: String, reflect: true })
25027
+ ], SgdsQuantityToggle.prototype, "hasFeedback", void 0);
25028
+ __decorate([
25029
+ property({ type: String, reflect: true })
25030
+ ], SgdsQuantityToggle.prototype, "invalidFeedback", void 0);
24855
25031
  __decorate([
24856
25032
  defaultValue()
24857
25033
  ], SgdsQuantityToggle.prototype, "defaultValue", void 0);
25034
+ __decorate([
25035
+ queryAsync("sgds-input")
25036
+ ], SgdsQuantityToggle.prototype, "_sgdsInput", void 0);
24858
25037
 
24859
25038
  var css_248z$e = css`fieldset{border:0;gap:var(--sgds-form-gap-md);margin:0;min-width:0;padding:0}.label-hint-container,fieldset{display:flex;flex-direction:column}.label-hint-container{gap:var(--sgds-form-gap-sm)}.radio-group-validation-input{display:none}.radio-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}`;
24860
25039
 
@@ -24867,43 +25046,46 @@
24867
25046
  *
24868
25047
  *
24869
25048
  */
24870
- class SgdsRadioGroup extends SgdsElement {
25049
+ class SgdsRadioGroup extends SgdsFormValidatorMixin(FormControlElement) {
24871
25050
  constructor() {
24872
25051
  super(...arguments);
24873
25052
  /**@internal */
24874
- this.formSubmitController = new FormSubmitController(this, {
24875
- defaultValue: (control) => control.defaultValue
24876
- });
24877
- /**@internal */
24878
25053
  this.defaultValue = "";
24879
- /**@internal */
24880
- this.customErrorMessage = "";
24881
- /** The radio group's label */
24882
- this.label = "";
24883
- /** This will be true when the control is in an invalid state. */
24884
- this.invalid = false;
24885
25054
  /** The selected value of the control. */
24886
25055
  this.value = "";
24887
- /** The name assigned to the radio controls. */
24888
- this.name = "option";
24889
- /** Ensures a child radio is checked before allowing the containing form to submit. */
24890
- this.required = false;
24891
25056
  /**Feedback text for error state when validated */
24892
25057
  this.invalidFeedback = "";
24893
25058
  /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
24894
25059
  this.hasFeedback = false;
24895
- /** The radio group's hint text */
24896
- this.hintText = "";
25060
+ /** Makes the input as a required field. */
25061
+ this.required = false;
25062
+ this._isTouched = false;
24897
25063
  }
24898
25064
  _handleValueChange() {
24899
25065
  this.emit("sgds-change", { detail: { value: this.value } });
24900
25066
  this._updateCheckedRadio();
24901
25067
  }
25068
+ _handleInvalidChange() {
25069
+ this._radios.forEach(r => (r.invalid = this.invalid));
25070
+ }
25071
+ /**
25072
+ * radio requries a custom _mixinResetFormControl as the update of input value
25073
+ * requires to fire a reset event manually
25074
+ * */
25075
+ _mixinResetFormControl() {
25076
+ this.value = this.input.value = this.defaultValue;
25077
+ this._updateInputValue("reset");
25078
+ this._mixinResetValidity(this.input);
25079
+ }
24902
25080
  connectedCallback() {
24903
25081
  super.connectedCallback();
24904
25082
  this.defaultValue = this.value;
25083
+ this.addEventListener("sgds-blur", () => {
25084
+ this._isTouched = true;
25085
+ });
24905
25086
  }
24906
- firstUpdated() {
25087
+ firstUpdated(changedProperties) {
25088
+ super.firstUpdated(changedProperties);
24907
25089
  const radios = this._radios;
24908
25090
  radios.forEach((item, index) => {
24909
25091
  if (radios.length > 1) {
@@ -24919,33 +25101,9 @@
24919
25101
  }
24920
25102
  }
24921
25103
  });
24922
- }
24923
- /** Gets and return the ValidityState object. */
24924
- get validity() {
24925
- const hasMissingData = !((this.value && this.required) || !this.required);
24926
- const hasCustomError = this.customErrorMessage !== "";
24927
- return {
24928
- badInput: false,
24929
- customError: hasCustomError,
24930
- patternMismatch: false,
24931
- rangeOverflow: false,
24932
- rangeUnderflow: false,
24933
- stepMismatch: false,
24934
- tooLong: false,
24935
- tooShort: false,
24936
- typeMismatch: false,
24937
- valid: hasMissingData ? false : true,
24938
- valueMissing: !hasMissingData
24939
- };
24940
- }
24941
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
24942
- reportValidity() {
24943
- const validity = this.validity;
24944
- this.invalid = !validity.valid;
24945
- if (!validity.valid) {
24946
- this._showNativeErrorMessage();
25104
+ if (this.value) {
25105
+ this._updateInputValue("change");
24947
25106
  }
24948
- return !this.invalid;
24949
25107
  }
24950
25108
  _handleRadioClick(event) {
24951
25109
  event.preventDefault();
@@ -24954,11 +25112,20 @@
24954
25112
  return;
24955
25113
  }
24956
25114
  this.value = target.value;
25115
+ this._updateInputValue();
24957
25116
  const radios = this._radios;
24958
25117
  radios.forEach(radio => {
24959
25118
  return (radio.checked = radio === target);
24960
25119
  });
24961
25120
  }
25121
+ /**
25122
+ * when input value is set programatically, need to manually dispatch a change event
25123
+ * In order to prevent race conditions and ensure sequence of events, set input's value here instead of binding to value prop of input
25124
+ */
25125
+ _updateInputValue(eventName = "change") {
25126
+ this.input.value = this.value;
25127
+ this.input.dispatchEvent(new InputEvent(eventName));
25128
+ }
24962
25129
  _handleKeyDown(event) {
24963
25130
  var _a;
24964
25131
  if (!["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", " "].includes(event.key)) {
@@ -24980,6 +25147,7 @@
24980
25147
  radio.tabIndex = -1;
24981
25148
  });
24982
25149
  this.value = radios[index].value;
25150
+ this._updateInputValue();
24983
25151
  radios[index].checked = true;
24984
25152
  radios[index].tabIndex = 0;
24985
25153
  // preventDefault at the end to allow Tab
@@ -24988,29 +25156,61 @@
24988
25156
  _handleSlotChange() {
24989
25157
  const radios = this._radios;
24990
25158
  radios.forEach(radio => (radio.checked = radio.value === this.value));
25159
+ this._disabledChildRadios();
24991
25160
  if (!radios.some(radio => radio.checked)) {
24992
25161
  if (radios[0])
24993
25162
  radios[0].tabIndex = 0;
24994
25163
  }
24995
25164
  }
24996
- _handleInvalid(e) {
24997
- e.preventDefault();
24998
- this.invalid = true;
24999
- this._radios.forEach(radio => (radio.invalid = true));
25000
- }
25001
- _showNativeErrorMessage() {
25002
- this.input.reportValidity();
25003
- }
25004
25165
  _updateCheckedRadio() {
25005
25166
  const radios = this._radios;
25006
25167
  radios.forEach(radio => (radio.checked = radio.value === this.value));
25007
- this.invalid = !this.validity.valid;
25008
- this._radios.forEach(radio => (radio.invalid = this.invalid));
25009
25168
  }
25010
25169
  _renderHintText() {
25011
- const hintTextTemplate = html$1 ` <div class="form-text">${this.hintText}</div> `;
25170
+ const hintTextTemplate = html$1 ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
25012
25171
  return this.hintText && hintTextTemplate;
25013
25172
  }
25173
+ /**
25174
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
25175
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
25176
+ */
25177
+ reportValidity() {
25178
+ return this._mixinReportValidity();
25179
+ }
25180
+ /**
25181
+ * Checks for validity without any native error popup message
25182
+ */
25183
+ checkValidity() {
25184
+ return this._mixinCheckValidity();
25185
+ }
25186
+ /**
25187
+ * Returns the ValidityState object
25188
+ */
25189
+ get validity() {
25190
+ return this._mixinGetValidity();
25191
+ }
25192
+ /**
25193
+ * Returns the validation message based on the ValidityState
25194
+ */
25195
+ get validationMessage() {
25196
+ return this._mixinGetValidationMessage();
25197
+ }
25198
+ _handleIsTouched() {
25199
+ if (this._isTouched) {
25200
+ this.invalid = !this.input.checkValidity();
25201
+ }
25202
+ }
25203
+ _handleDisabledChange() {
25204
+ // Disabled form controls are always valid, so we need to recheck validity when the state changes
25205
+ this.setInvalid(false);
25206
+ this._disabledChildRadios();
25207
+ }
25208
+ _disabledChildRadios() {
25209
+ if (this.disabled) {
25210
+ const radios = this._radios;
25211
+ radios.forEach(radio => (radio.disabled = this.disabled));
25212
+ }
25213
+ }
25014
25214
  render() {
25015
25215
  const defaultSlot = html$1 `
25016
25216
  <slot
@@ -25042,7 +25242,8 @@
25042
25242
  })}"
25043
25243
  ?required=${this.required}
25044
25244
  tabindex="-1"
25045
- @invalid=${(e) => this._handleInvalid(e)}
25245
+ @change=${(e) => super._mixinHandleChange(e)}
25246
+ .value=${live(this.value)}
25046
25247
  />
25047
25248
  ${this.invalid && this.hasFeedback
25048
25249
  ? html$1 `
@@ -25053,7 +25254,9 @@
25053
25254
  fill="#B90000"
25054
25255
  />
25055
25256
  </svg>
25056
- <div id="radio-group-feedback" tabindex="0" class="invalid-feedback">${this.invalidFeedback}</div>
25257
+ <div id="radio-group-feedback" tabindex="0" class="invalid-feedback">
25258
+ ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
25259
+ </div>
25057
25260
  </div>
25058
25261
  `
25059
25262
  : nothing}
@@ -25061,34 +25264,16 @@
25061
25264
  `;
25062
25265
  }
25063
25266
  }
25064
- SgdsRadioGroup.styles = [...SgdsElement.styles, css_248z$H, css_248z$T, css_248z$e, css_248z$F];
25267
+ SgdsRadioGroup.styles = [...FormControlElement.styles, css_248z$e];
25065
25268
  __decorate([
25066
25269
  query("slot:not([name])")
25067
25270
  ], SgdsRadioGroup.prototype, "defaultSlot", void 0);
25068
- __decorate([
25069
- query(".radio-group-validation-input")
25070
- ], SgdsRadioGroup.prototype, "input", void 0);
25071
25271
  __decorate([
25072
25272
  state()
25073
25273
  ], SgdsRadioGroup.prototype, "defaultValue", void 0);
25074
- __decorate([
25075
- state()
25076
- ], SgdsRadioGroup.prototype, "customErrorMessage", void 0);
25077
- __decorate([
25078
- property({ reflect: true })
25079
- ], SgdsRadioGroup.prototype, "label", void 0);
25080
- __decorate([
25081
- property({ type: Boolean, reflect: true })
25082
- ], SgdsRadioGroup.prototype, "invalid", void 0);
25083
25274
  __decorate([
25084
25275
  property({ reflect: true })
25085
25276
  ], SgdsRadioGroup.prototype, "value", void 0);
25086
- __decorate([
25087
- property({ reflect: true })
25088
- ], SgdsRadioGroup.prototype, "name", void 0);
25089
- __decorate([
25090
- property({ type: Boolean, reflect: true })
25091
- ], SgdsRadioGroup.prototype, "required", void 0);
25092
25277
  __decorate([
25093
25278
  property({ type: String, reflect: true })
25094
25279
  ], SgdsRadioGroup.prototype, "invalidFeedback", void 0);
@@ -25096,14 +25281,26 @@
25096
25281
  property({ type: Boolean, reflect: true })
25097
25282
  ], SgdsRadioGroup.prototype, "hasFeedback", void 0);
25098
25283
  __decorate([
25099
- property({ reflect: true })
25100
- ], SgdsRadioGroup.prototype, "hintText", void 0);
25284
+ property({ type: Boolean, reflect: true })
25285
+ ], SgdsRadioGroup.prototype, "required", void 0);
25101
25286
  __decorate([
25102
25287
  watch("value", { waitUntilFirstUpdate: true })
25103
25288
  ], SgdsRadioGroup.prototype, "_handleValueChange", null);
25289
+ __decorate([
25290
+ watch("invalid", { waitUntilFirstUpdate: true })
25291
+ ], SgdsRadioGroup.prototype, "_handleInvalidChange", null);
25292
+ __decorate([
25293
+ state()
25294
+ ], SgdsRadioGroup.prototype, "_isTouched", void 0);
25104
25295
  __decorate([
25105
25296
  queryAssignedElements()
25106
25297
  ], SgdsRadioGroup.prototype, "_radios", void 0);
25298
+ __decorate([
25299
+ watch("_isTouched", { waitUntilFirstUpdate: true })
25300
+ ], SgdsRadioGroup.prototype, "_handleIsTouched", null);
25301
+ __decorate([
25302
+ watch("disabled", { waitUntilFirstUpdate: true })
25303
+ ], SgdsRadioGroup.prototype, "_handleDisabledChange", null);
25107
25304
 
25108
25305
  var css_248z$d = css`:host{--sidenav-theme-color:var(--sgds-primary);--sidenav-sticky-top:0rem}div{display:flex;flex-direction:column;gap:1rem;list-style:none;margin:0;padding-left:0}.sticky{height:calc(100vh - var(--sidenav-sticky-top));overflow-y:auto;position:sticky;top:var(--sidenav-sticky-top)}`;
25109
25306
 
@@ -25517,6 +25714,7 @@
25517
25714
  constructor() {
25518
25715
  super(...arguments);
25519
25716
  /** The metadata of stepper, type `IStepMetaData`, that consist of `stepHeader: string` and `component:unknown`. `stepHeader` is the name of the step and `component` is the content that should appear at the each step. `component` is set to `unknown` to allow users to pass in their desired component based on the framework of choice. e.g. pass in your own react/angular/vue component or it can also be a text content.
25717
+ * It is required to populate this array to properly render the stepper.
25520
25718
  */
25521
25719
  this.steps = [];
25522
25720
  /** The current state of active step. Defaults to 0 */
@@ -25717,7 +25915,7 @@
25717
25915
  `;
25718
25916
  }
25719
25917
  }
25720
- SgdsSwitch.styles = [...FormCheckElement.styles, css_248z$T, css_248z$8];
25918
+ SgdsSwitch.styles = [...SgdsElement.styles, css_248z$U, css_248z$8];
25721
25919
  __decorate([
25722
25920
  property({ reflect: true, type: String })
25723
25921
  ], SgdsSwitch.prototype, "size", void 0);
@@ -26382,7 +26580,7 @@
26382
26580
  state()
26383
26581
  ], SgdsTable.prototype, "originalTableData", void 0);
26384
26582
 
26385
- var css_248z$3 = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus);outline:0}.form-control.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control:disabled{background-color:var(--sgds-form-bg-muted)}.textarea-resize-none{resize:none}.textarea-resize-vertical{resize:vertical}.textarea-resize-auto{height:auto;overflow-y:hidden;resize:none}.textarea-info-container{display:flex;justify-content:space-between}.word-count{margin-left:auto}`;
26583
+ var css_248z$3 = css`.form-control-container{display:flex;flex-direction:column;gap:var(--sgds-form-gap-md)}.form-control-container.disabled{opacity:var(--sgds-opacity-50)}textarea{font-family:inherit;font-size:inherit;line-height:inherit;margin:0;resize:vertical}.form-control{appearance:none;background-clip:padding-box;background-color:var(--sgds-form-bg);border:var(--sgds-form-border-width-default) solid var(--sgds-form-border-color);border-radius:var(--sgds-form-border-radius-md);color:var(--sgds-form-color);min-height:var(--sgds-dimension-136);outline:0;padding:var(--sgds-form-padding-y) var(--sgds-form-padding-x);transition:border-color .15s ease-in-out,box-shadow .15s ease-in-out;width:100%}.form-control[readonly]{border-color:var(--sgds-form-border-color-muted)}@media (prefers-reduced-motion:reduce){.form-control{transition:none}}.form-control:not([disabled]):not(.is-invalid):hover{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis)}.form-control:not([disabled]):not(.is-invalid):focus,.form-control:not([disabled]):not(.is-invalid):focus-visible{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-border-color-emphasis);box-shadow:var(--sgds-form-box-shadow-focus)}.form-control.is-invalid{border:var(--sgds-form-border-width-thick) solid var(--sgds-form-danger-border-color)}.form-control:disabled{background-color:var(--sgds-form-bg-muted)}.textarea-resize-none{resize:none}.textarea-resize-vertical{resize:vertical}.textarea-resize-auto{height:auto;overflow-y:hidden;resize:none}.textarea-info-container{display:flex;justify-content:space-between}.word-count{margin-left:auto}`;
26386
26584
 
26387
26585
  /**
26388
26586
  * @summary Text areas allow for the collection of input longer than a single line.
@@ -26392,13 +26590,9 @@
26392
26590
  * @event sgds-focus - Emitted when textarea is in focus.
26393
26591
  * @event sgds-blur - Emitted when textarea loses focus.
26394
26592
  */
26395
- class SgdsTextarea extends SgdsElement {
26593
+ class SgdsTextarea extends SgdsFormValidatorMixin(FormControlElement) {
26396
26594
  constructor() {
26397
26595
  super(...arguments);
26398
- /**@internal */
26399
- this.formSubmitController = new FormSubmitController(this);
26400
- /**The textarea's label */
26401
- this.label = "label";
26402
26596
  /**The textarea's value attribute. */
26403
26597
  this.value = "";
26404
26598
  /**Enables spell checking on the textarea */
@@ -26407,14 +26601,10 @@
26407
26601
  this.rows = 4;
26408
26602
  /**The textarea's placeholder text. */
26409
26603
  this.placeholder = "Placeholder";
26410
- /**Feedback text for error state when validated */
26604
+ /** Custom feedback text for error state when validated */
26411
26605
  this.invalidFeedback = "";
26412
26606
  /**Autofocus the textarea */
26413
26607
  this.autofocus = false;
26414
- /**Disables the textarea. */
26415
- this.disabled = false;
26416
- /**Makes the textarea a required field. */
26417
- this.required = false;
26418
26608
  /** Makes the textarea readonly. */
26419
26609
  this.readonly = false;
26420
26610
  /** Controls how the textarea can be resized. */
@@ -26423,32 +26613,44 @@
26423
26613
  this.defaultValue = "";
26424
26614
  /** Allows invalidFeedback, invalid and valid styles to be visible with the input */
26425
26615
  this.hasFeedback = false;
26426
- /** Marks the component as invalid. Replace the pseudo :invalid selector for absent in custom elements */
26427
- this.invalid = false;
26616
+ /** Makes the textarea as a required field. */
26617
+ this.required = false;
26428
26618
  /** The textarea's hint text */
26429
26619
  this.hintText = "";
26430
- /** @internal The textarea's unique id */
26431
- this.textareaId = genId("textarea", "input");
26432
- }
26433
- connectedCallback() {
26434
- super.connectedCallback();
26435
- this.resizeObserver = new ResizeObserver(() => this._setTextareaHeight());
26436
- this.updateComplete.then(() => {
26437
- this._setTextareaHeight();
26438
- this.resizeObserver.observe(this.textarea);
26439
- });
26440
- }
26441
- disconnectedCallback() {
26442
- super.disconnectedCallback();
26443
- this.resizeObserver.unobserve(this.textarea);
26620
+ this._isTouched = false;
26444
26621
  }
26445
26622
  /** Sets focus on the textarea. */
26446
26623
  focus(options) {
26447
26624
  this.textarea.focus(options);
26448
26625
  }
26449
- /** Checks for validity and shows the browser's validation message if the control is invalid. */
26626
+ /** Sets blur on the textarea. */
26627
+ blur() {
26628
+ this.textarea.blur();
26629
+ }
26630
+ /**
26631
+ * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
26632
+ * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
26633
+ */
26450
26634
  reportValidity() {
26451
- return this.textarea.reportValidity();
26635
+ return this._mixinReportValidity();
26636
+ }
26637
+ /**
26638
+ * Checks for validity without any native error popup message
26639
+ */
26640
+ checkValidity() {
26641
+ return this._mixinCheckValidity();
26642
+ }
26643
+ /**
26644
+ * Returns the ValidityState object
26645
+ */
26646
+ get validity() {
26647
+ return this._mixinGetValidity();
26648
+ }
26649
+ /**
26650
+ * Returns the validation message based on the ValidityState
26651
+ */
26652
+ get validationMessage() {
26653
+ return this._mixinGetValidationMessage();
26452
26654
  }
26453
26655
  /** Selects all the text in the textarea. */
26454
26656
  select() {
@@ -26458,14 +26660,21 @@
26458
26660
  e.preventDefault();
26459
26661
  this.invalid = true;
26460
26662
  }
26461
- _handleChange(event) {
26462
- this.value = this.textarea.value;
26463
- this.emit(event);
26663
+ _handleChange(e) {
26664
+ this.value = this.input.value;
26665
+ this.emit("sgds-change");
26666
+ super._mixinHandleChange(e);
26667
+ }
26668
+ _handleInputChange(e) {
26669
+ this.value = this.input.value;
26670
+ this.emit("sgds-input");
26671
+ super._mixinHandleInputChange(e);
26464
26672
  }
26465
26673
  _handleFocus() {
26466
26674
  this.emit("sgds-focus");
26467
26675
  }
26468
- handleBlur() {
26676
+ _handleBlur() {
26677
+ this._isTouched = true;
26469
26678
  this.emit("sgds-blur");
26470
26679
  }
26471
26680
  /** @internal */
@@ -26482,23 +26691,26 @@
26482
26691
  }
26483
26692
  }
26484
26693
  /** @internal */
26694
+ _handleIsTouched() {
26695
+ if (this._isTouched) {
26696
+ this.invalid = !this.textarea.checkValidity();
26697
+ }
26698
+ }
26699
+ /** @internal */
26485
26700
  _handleDisabledChange() {
26486
26701
  // Disabled form controls are always valid, so we need to recheck validity when the state changes
26487
- this.textarea.disabled = this.disabled;
26488
- this.invalid = !this.textarea.checkValidity();
26702
+ this.setInvalid(false);
26489
26703
  }
26490
26704
  /** @internal */
26491
26705
  _handleValueChange() {
26492
- this.invalid = !this.textarea.checkValidity();
26493
26706
  this.updateComplete.then(() => this._setTextareaHeight());
26494
26707
  }
26495
26708
  _renderHintText() {
26496
- const hintTextTemplate = html ` <div id="${this.textareaId}Help" class="form-text">${this.hintText}</div> `;
26709
+ const hintTextTemplate = html ` <div id="${this._controlId}Help" class="form-text">${this.hintText}</div> `;
26497
26710
  return this.hintText && hintTextTemplate;
26498
26711
  }
26499
- render() {
26500
- // if maxlength is defined
26501
- const wordCount = html `
26712
+ _wordCount() {
26713
+ return html `
26502
26714
  <div
26503
26715
  class="form-text word-count ${classMap({
26504
26716
  "invalid-feedback": this.invalid && this.hasFeedback
@@ -26507,13 +26719,15 @@
26507
26719
  ${this.value.length}/${this.maxlength}
26508
26720
  </div>
26509
26721
  `;
26722
+ }
26723
+ render() {
26510
26724
  return html `
26511
26725
  <div
26512
26726
  class="form-control-container ${classMap({
26513
26727
  disabled: this.disabled
26514
26728
  })}"
26515
26729
  >
26516
- <label for=${this.textareaId} class="form-label">${this.label}</label>
26730
+ <label for=${this._controlId} class="form-label">${this.label}</label>
26517
26731
  <textarea
26518
26732
  class=${classMap({
26519
26733
  "form-control": true,
@@ -26522,7 +26736,7 @@
26522
26736
  "textarea-resize-vertical": this.resize === "vertical",
26523
26737
  "textarea-resize-auto": this.resize === "auto"
26524
26738
  })}
26525
- id=${this.textareaId}
26739
+ id=${this._controlId}
26526
26740
  name=${ifDefined(this.name)}
26527
26741
  rows=${ifDefined(this.rows)}
26528
26742
  placeholder=${ifDefined(this.placeholder)}
@@ -26537,13 +26751,12 @@
26537
26751
  ?autofocus=${this.autofocus}
26538
26752
  autocorrect=${ifDefined(this.autocorrect)}
26539
26753
  inputmode=${ifDefined(this.inputmode)}
26540
- @input=${() => this._handleChange("sgds-input")}
26541
- @change=${() => this._handleChange("sgds-change")}
26754
+ @input=${(e) => this._handleInputChange(e)}
26755
+ @change=${(e) => this._handleChange(e)}
26542
26756
  @invalid=${(e) => this._handleInvalid(e)}
26543
26757
  @focus=${this._handleFocus}
26544
- @blur=${this.handleBlur}
26545
- >
26546
- </textarea>
26758
+ @blur=${this._handleBlur}
26759
+ ></textarea>
26547
26760
  <div class="textarea-info-container">
26548
26761
  ${this.invalid && this.hasFeedback
26549
26762
  ? html `
@@ -26554,30 +26767,22 @@
26554
26767
  fill="#B90000"
26555
26768
  />
26556
26769
  </svg>
26557
- <div id="${this.textareaId}-invalid" class="invalid-feedback">${this.invalidFeedback}</div>
26770
+ <div id="${this._controlId}-invalid" class="invalid-feedback">
26771
+ ${this.invalidFeedback ? this.invalidFeedback : this.input.validationMessage}
26772
+ </div>
26558
26773
  </div>
26559
26774
  `
26560
26775
  : html `${this._renderHintText()}`}
26561
- ${this.maxlength > 0 ? wordCount : undefined}
26776
+ ${this.maxlength > 0 ? this._wordCount() : nothing}
26562
26777
  </div>
26563
26778
  </div>
26564
26779
  `;
26565
26780
  }
26566
26781
  }
26567
- SgdsTextarea.styles = [
26568
- ...SgdsElement.styles,
26569
- css_248z$F,
26570
- css_248z$T,
26571
- css_248z$H,
26572
- css_248z$D,
26573
- css_248z$3
26574
- ];
26782
+ SgdsTextarea.styles = [...FormControlElement.styles, css_248z$3];
26575
26783
  __decorate([
26576
26784
  query("textarea.form-control")
26577
26785
  ], SgdsTextarea.prototype, "textarea", void 0);
26578
- __decorate([
26579
- property({ type: String, reflect: true })
26580
- ], SgdsTextarea.prototype, "label", void 0);
26581
26786
  __decorate([
26582
26787
  property({ type: String, reflect: true })
26583
26788
  ], SgdsTextarea.prototype, "name", void 0);
@@ -26605,12 +26810,6 @@
26605
26810
  __decorate([
26606
26811
  property({ type: Boolean, reflect: true })
26607
26812
  ], SgdsTextarea.prototype, "autofocus", void 0);
26608
- __decorate([
26609
- property({ type: Boolean, reflect: true })
26610
- ], SgdsTextarea.prototype, "disabled", void 0);
26611
- __decorate([
26612
- property({ type: Boolean, reflect: true })
26613
- ], SgdsTextarea.prototype, "required", void 0);
26614
26813
  __decorate([
26615
26814
  property({ type: Boolean, reflect: true })
26616
26815
  ], SgdsTextarea.prototype, "readonly", void 0);
@@ -26631,13 +26830,19 @@
26631
26830
  ], SgdsTextarea.prototype, "hasFeedback", void 0);
26632
26831
  __decorate([
26633
26832
  property({ type: Boolean, reflect: true })
26634
- ], SgdsTextarea.prototype, "invalid", void 0);
26833
+ ], SgdsTextarea.prototype, "required", void 0);
26635
26834
  __decorate([
26636
26835
  property({ reflect: true })
26637
26836
  ], SgdsTextarea.prototype, "hintText", void 0);
26837
+ __decorate([
26838
+ state()
26839
+ ], SgdsTextarea.prototype, "_isTouched", void 0);
26638
26840
  __decorate([
26639
26841
  watch("rows", { waitUntilFirstUpdate: true })
26640
26842
  ], SgdsTextarea.prototype, "_handleRowsChange", null);
26843
+ __decorate([
26844
+ watch("_isTouched", { waitUntilFirstUpdate: true })
26845
+ ], SgdsTextarea.prototype, "_handleIsTouched", null);
26641
26846
  __decorate([
26642
26847
  watch("disabled", { waitUntilFirstUpdate: true })
26643
26848
  ], SgdsTextarea.prototype, "_handleDisabledChange", null);
@@ -26645,13 +26850,14 @@
26645
26850
  watch("value", { waitUntilFirstUpdate: true })
26646
26851
  ], SgdsTextarea.prototype, "_handleValueChange", null);
26647
26852
 
26648
- var css_248z$2 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}.toast{--toast-border-color:var(--sgds-gray-800);--toast-header-color:light-dark(var(--sgds-gray-800),var(--sgds-gray-200));--toast-header-icon-color:var(--sgds-body-color);align-items:flex-start;background-clip:padding-box;background-color:var(--sgds-neutral-bg-inverse);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 8px 16px 0 rgba(0,0,0,.14);color:var(--sgds-subtitle-color);display:flex;flex-direction:row;gap:var(--sgds-gap-xs);max-width:var(--sgds-dimension-480);min-width:var(--sgds-dimension-320);padding:var(--sgds-padding-md) var(--sgds-padding-md);pointer-events:auto;width:320px}.toast-content{word-wrap:break-word;color:var(--sgds-gray-600);gap:var(--sgds-gap-sm)}.toast-body,.toast-content{display:flex;flex-direction:column}.toast-action{word-wrap:break-word;color:var(--sgds-primary-color)}.toast-header strong{margin-right:auto;word-break:break-all}.close-btn{margin-left:auto}.d-none{display:none}`;
26853
+ var css_248z$2 = css`:host{--sgds-toast-border-radius:var(--sgds-border-radius-md)}:host([variant=info]) slot[name=icon]::slotted(*){color:var(--sgds-primary-color)}:host([variant=success]) slot[name=icon]::slotted(*){color:var(--sgds-success-color)}:host([variant=danger]) slot[name=icon]::slotted(*){color:var(--sgds-danger-color)}:host([variant=warning]) slot[name=icon]::slotted(*){color:var(--sgds-warning-color)}.toast{align-items:flex-start;background-clip:padding-box;background-color:var(--sgds-neutral-bg-inverse);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 8px 16px 0 rgba(0,0,0,.14);display:flex;flex-direction:row;gap:var(--sgds-gap-xs);max-width:var(--sgds-dimension-480);min-width:var(--sgds-dimension-320);padding:var(--sgds-padding-md);pointer-events:auto;width:320px}.toast-content{word-wrap:break-word;gap:var(--sgds-gap-sm)}.toast-body,.toast-content{display:flex;flex-direction:column}.toast-body strong{line-height:var(--sgds-line-height-min)}.toast-body span{color:var(--sgds-default-color-subtle)}.toast-action{word-wrap:break-word;color:var(--sgds-primary-color)}.toast-header strong{margin-right:auto;word-break:break-all}.close-btn{margin-left:auto}.d-none{display:none}`;
26649
26854
 
26650
26855
  /**
26651
26856
  * @summary Toast allows you to convey quick messaging notifications to the user.
26652
26857
  *
26653
26858
  * @slot default - The content to pass into toast's body
26654
26859
  * @slot action - The content to pass into toast's action
26860
+ * @slot icon - The icon in toast
26655
26861
  *
26656
26862
  *
26657
26863
  * @event sgds-show - Emitted on show.
@@ -26677,7 +26883,7 @@
26677
26883
  /**The variant styles of toast */
26678
26884
  this.variant = "info";
26679
26885
  /** Controls whether or not the Toast is dismissible */
26680
- this.dismissable = false;
26886
+ this.dismissible = false;
26681
26887
  }
26682
26888
  /**@internal */
26683
26889
  static get scopedElements() {
@@ -26750,28 +26956,15 @@
26750
26956
  aria-live="assertive"
26751
26957
  aria-atomic="true"
26752
26958
  >
26753
- <i>
26754
- <svg
26755
- xmlns="http://www.w3.org/2000/svg"
26756
- width="16"
26757
- height="16"
26758
- fill="currentColor"
26759
- class="bi bi-airplane"
26760
- viewBox="0 0 16 16"
26761
- >
26762
- <path
26763
- d="M6.428 1.151C6.708.591 7.213 0 8 0s1.292.592 1.572 1.151C9.861 1.73 10 2.431 10 3v3.691l5.17 2.585a1.5 1.5 0 0 1 .83 1.342V12a.5.5 0 0 1-.582.493l-5.507-.918-.375 2.253 1.318 1.318A.5.5 0 0 1 10.5 16h-5a.5.5 0 0 1-.354-.854l1.319-1.318-.376-2.253-5.507.918A.5.5 0 0 1 0 12v-1.382a1.5 1.5 0 0 1 .83-1.342L6 6.691V3c0-.568.14-1.271.428-1.849Zm.894.448C7.111 2.02 7 2.569 7 3v4a.5.5 0 0 1-.276.447l-5.448 2.724a.5.5 0 0 0-.276.447v.792l5.418-.903a.5.5 0 0 1 .575.41l.5 3a.5.5 0 0 1-.14.437L6.708 15h2.586l-.647-.646a.5.5 0 0 1-.14-.436l.5-3a.5.5 0 0 1 .576-.411L15 11.41v-.792a.5.5 0 0 0-.276-.447L9.276 7.447A.5.5 0 0 1 9 7V3c0-.432-.11-.979-.322-1.401C8.458 1.159 8.213 1 8 1c-.213 0-.458.158-.678.599Z"
26764
- ></path>
26765
- </svg>
26766
- </i>
26959
+ <slot name="icon"></slot>
26767
26960
  <div class="toast-content">
26768
26961
  <div class="toast-body">
26769
26962
  <strong>${this.title}</strong>
26770
- <slot></slot>
26963
+ <span><slot></slot></span>
26771
26964
  </div>
26772
26965
  <slot class="toast-action" name="action"></slot>
26773
26966
  </div>
26774
- ${this.dismissable
26967
+ ${this.dismissible
26775
26968
  ? html$1 `<sgds-close-button
26776
26969
  class="close-btn"
26777
26970
  ariaLabel="close toast"
@@ -26806,7 +26999,7 @@
26806
26999
  ], SgdsToast.prototype, "variant", void 0);
26807
27000
  __decorate([
26808
27001
  property({ type: Boolean, reflect: true })
26809
- ], SgdsToast.prototype, "dismissable", void 0);
27002
+ ], SgdsToast.prototype, "dismissible", void 0);
26810
27003
  __decorate([
26811
27004
  watch("show", { waitUntilFirstUpdate: true })
26812
27005
  ], SgdsToast.prototype, "handleShowChange", null);
@@ -27754,8 +27947,8 @@
27754
27947
  class SgdsTooltip extends SgdsElement {
27755
27948
  constructor() {
27756
27949
  super(...arguments);
27757
- this.myTooltip = createRef();
27758
- this.bsTooltip = null;
27950
+ this._myTooltip = createRef();
27951
+ this._bsTooltip = null;
27759
27952
  /** The tooltip's content. Content has to be textual */
27760
27953
  this.content = "";
27761
27954
  /** The placement of tooltip relative to its target */
@@ -27765,7 +27958,7 @@
27765
27958
  }
27766
27959
  _handleSlotChange() {
27767
27960
  // For a11y purpose
27768
- this.tooltipTargetElements.forEach(el => el.setAttribute("data-sgds-tooltip", this.content));
27961
+ this._tooltipTargetElements.forEach(el => el.setAttribute("data-sgds-tooltip", this.content));
27769
27962
  }
27770
27963
  _handleClickOutOfElement(e, self) {
27771
27964
  if (!e.composedPath().includes(self)) {
@@ -27784,7 +27977,7 @@
27784
27977
  document.removeEventListener("click", (event) => this._handleClickOutOfElement(event, this));
27785
27978
  document.removeEventListener("touchstart", (event) => this._handleClickOutOfElement(event, this));
27786
27979
  }
27787
- initializeTooltip() {
27980
+ _initializeTooltip() {
27788
27981
  this.tooltipConfig = {
27789
27982
  popperConfig: (defaultConfig) => {
27790
27983
  this.popperConfig = defaultConfig;
@@ -27804,34 +27997,34 @@
27804
27997
  html: true,
27805
27998
  container: this.shadowRoot.querySelector("div") // tooltip to appear inside the shadow root of sgds-tooltip instead of anywhere in the DOM, so that scoped styles can apply
27806
27999
  };
27807
- this.bsTooltip = new Tooltip(this.myTooltip.value, this.tooltipConfig);
28000
+ this._bsTooltip = new Tooltip(this._myTooltip.value, this.tooltipConfig);
27808
28001
  }
27809
28002
  firstUpdated() {
27810
- this.initializeTooltip();
27811
- this.myTooltip.value.addEventListener("show.bs.tooltip", () => {
28003
+ this._initializeTooltip();
28004
+ this._myTooltip.value.addEventListener("show.bs.tooltip", () => {
27812
28005
  this.emit("sgds-show");
27813
28006
  });
27814
- this.myTooltip.value.addEventListener("shown.bs.tooltip", () => {
28007
+ this._myTooltip.value.addEventListener("shown.bs.tooltip", () => {
27815
28008
  this.emit("sgds-after-show");
27816
28009
  });
27817
- this.myTooltip.value.addEventListener("hide.bs.tooltip", () => {
28010
+ this._myTooltip.value.addEventListener("hide.bs.tooltip", () => {
27818
28011
  this.emit("sgds-hide");
27819
28012
  });
27820
- this.myTooltip.value.addEventListener("hidden.bs.tooltip", () => {
28013
+ this._myTooltip.value.addEventListener("hidden.bs.tooltip", () => {
27821
28014
  this.emit("sgds-after-hide");
27822
28015
  });
27823
28016
  }
27824
28017
  /** Hides the Tooltip */
27825
28018
  hide() {
27826
- this.bsTooltip.hide();
28019
+ this._bsTooltip.hide();
27827
28020
  }
27828
28021
  /** Shows the Tooltip */
27829
28022
  show() {
27830
- this.bsTooltip.show();
28023
+ this._bsTooltip.show();
27831
28024
  }
27832
28025
  render() {
27833
28026
  return html$1 `
27834
- <div ${ref(this.myTooltip)}>
28027
+ <div ${ref(this._myTooltip)}>
27835
28028
  <slot @slotchange=${this._handleSlotChange}></slot>
27836
28029
  </div>
27837
28030
  `;
@@ -27852,7 +28045,7 @@
27852
28045
  ], SgdsTooltip.prototype, "popperConfig", void 0);
27853
28046
  __decorate([
27854
28047
  queryAssignedElements()
27855
- ], SgdsTooltip.prototype, "tooltipTargetElements", void 0);
28048
+ ], SgdsTooltip.prototype, "_tooltipTargetElements", void 0);
27856
28049
 
27857
28050
  exports.SgdsAccordion = SgdsAccordion;
27858
28051
  exports.SgdsAccordionItem = SgdsAccordionItem;
@@ -27874,6 +28067,7 @@
27874
28067
  exports.SgdsDropdownItem = SgdsDropdownItem;
27875
28068
  exports.SgdsFileUpload = SgdsFileUpload;
27876
28069
  exports.SgdsFooter = SgdsFooter;
28070
+ exports.SgdsIcon = SgdsIcon;
27877
28071
  exports.SgdsIconButton = SgdsIconButton;
27878
28072
  exports.SgdsIconList = SgdsIconList;
27879
28073
  exports.SgdsInput = SgdsInput;