@gov-design-system-ce/components 0.0.6 → 0.0.8

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 (566) hide show
  1. package/dist/cjs/Fragment-52846f79.js +7 -0
  2. package/dist/cjs/Fragment-52846f79.js.map +1 -0
  3. package/dist/cjs/{constants-5f6bbc50.js → constants-245999e7.js} +3 -2
  4. package/dist/cjs/constants-245999e7.js.map +1 -0
  5. package/dist/cjs/{constants-dc2ba6bd.js → constants-61f8be34.js} +3 -3
  6. package/dist/cjs/constants-61f8be34.js.map +1 -0
  7. package/dist/cjs/core.cjs.js +1 -1
  8. package/dist/cjs/gov-accordion-item.cjs.entry.js +2 -2
  9. package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-accordion.cjs.entry.js +2 -1
  11. package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-alert.cjs.entry.js +1 -1
  13. package/dist/cjs/gov-alert.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-app.cjs.entry.js +673 -165
  15. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-attachments_3.cjs.entry.js +1 -1
  17. package/dist/cjs/gov-attachments_3.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-backdrop.cjs.entry.js +4 -3
  19. package/dist/cjs/gov-backdrop.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-badge.cjs.entry.js +17 -17
  21. package/dist/cjs/gov-badge.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-breadcrumbs.cjs.entry.js +1 -1
  23. package/dist/cjs/gov-breadcrumbs.cjs.entry.js.map +1 -1
  24. package/dist/cjs/gov-button.cjs.entry.js +14 -3
  25. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  26. package/dist/cjs/gov-card.cjs.entry.js +1 -1
  27. package/dist/cjs/gov-card.cjs.entry.js.map +1 -1
  28. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +4 -0
  29. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  30. package/dist/cjs/gov-form-checkbox.cjs.entry.js +23 -7
  31. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  32. package/dist/cjs/gov-form-file.cjs.entry.js +7 -1
  33. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  34. package/dist/cjs/gov-form-input.cjs.entry.js +8 -2
  35. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  36. package/dist/cjs/gov-form-multi-select.cjs.entry.js +11 -3
  37. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  38. package/dist/cjs/gov-form-password-power.cjs.entry.js +28 -0
  39. package/dist/cjs/gov-form-password-power.cjs.entry.js.map +1 -0
  40. package/dist/cjs/gov-form-radio.cjs.entry.js +17 -1
  41. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  42. package/dist/cjs/gov-form-search.cjs.entry.js +1 -1
  43. package/dist/cjs/gov-form-search.cjs.entry.js.map +1 -1
  44. package/dist/cjs/gov-form-select.cjs.entry.js +3 -3
  45. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  46. package/dist/cjs/gov-form-switch.cjs.entry.js +23 -7
  47. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  48. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  49. package/dist/cjs/gov-modal.cjs.entry.js +19 -13
  50. package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
  51. package/dist/cjs/gov-pagination.cjs.entry.js +50 -16
  52. package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
  53. package/dist/cjs/gov-prompt.cjs.entry.js +12 -6
  54. package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
  55. package/dist/cjs/gov-side-nav-item.cjs.entry.js +1 -1
  56. package/dist/cjs/gov-side-nav-item.cjs.entry.js.map +1 -1
  57. package/dist/cjs/gov-spacer.cjs.entry.js +1 -1
  58. package/dist/cjs/gov-spacer.cjs.entry.js.map +1 -1
  59. package/dist/cjs/gov-statsbar-item.cjs.entry.js +1 -1
  60. package/dist/cjs/gov-statsbar.cjs.entry.js +2 -2
  61. package/dist/cjs/gov-statsbar.cjs.entry.js.map +1 -1
  62. package/dist/cjs/gov-tabs.cjs.entry.js +1 -1
  63. package/dist/cjs/gov-tabs.cjs.entry.js.map +1 -1
  64. package/dist/cjs/gov-tile.cjs.entry.js +3 -2
  65. package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
  66. package/dist/cjs/gov-tiles.cjs.entry.js +2 -1
  67. package/dist/cjs/gov-tiles.cjs.entry.js.map +1 -1
  68. package/dist/cjs/gov-toast.cjs.entry.js +1 -1
  69. package/dist/cjs/gov-toast.cjs.entry.js.map +1 -1
  70. package/dist/cjs/gov-wizzard-item.cjs.entry.js +1 -1
  71. package/dist/cjs/gov-wizzard-item.cjs.entry.js.map +1 -1
  72. package/dist/cjs/index-356717ae.js +4 -0
  73. package/dist/cjs/loader.cjs.js +1 -1
  74. package/dist/collection/collection-manifest.json +1 -0
  75. package/dist/collection/components/gov-accordion/gov-accordion-item.css +37 -5
  76. package/dist/collection/components/gov-accordion/gov-accordion-item.js +1 -1
  77. package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
  78. package/dist/collection/components/gov-accordion/gov-accordion.css +6 -0
  79. package/dist/collection/components/gov-accordion/gov-accordion.js +19 -0
  80. package/dist/collection/components/gov-accordion/gov-accordion.js.map +1 -1
  81. package/dist/collection/components/gov-alert/gov-alert.css +3 -0
  82. package/dist/collection/components/gov-alert/gov-alert.js +1 -1
  83. package/dist/collection/components/gov-alert/gov-alert.js.map +1 -1
  84. package/dist/collection/components/gov-app/gov-app.css +3 -0
  85. package/dist/collection/components/gov-attachments/gov-attachments-item.css +3 -0
  86. package/dist/collection/components/gov-attachments/gov-attachments-item.js +1 -1
  87. package/dist/collection/components/gov-attachments/gov-attachments-item.js.map +1 -1
  88. package/dist/collection/components/gov-attachments/gov-attachments.css +3 -0
  89. package/dist/collection/components/gov-backdrop/gov-backdrop.css +3 -0
  90. package/dist/collection/components/gov-backdrop/gov-backdrop.js +5 -4
  91. package/dist/collection/components/gov-backdrop/gov-backdrop.js.map +1 -1
  92. package/dist/collection/components/gov-badge/constants.js +4 -1
  93. package/dist/collection/components/gov-badge/constants.js.map +1 -1
  94. package/dist/collection/components/gov-badge/gov-badge.css +204 -96
  95. package/dist/collection/components/gov-badge/gov-badge.js +26 -47
  96. package/dist/collection/components/gov-badge/gov-badge.js.map +1 -1
  97. package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.css +3 -0
  98. package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.js +1 -1
  99. package/dist/collection/components/gov-breadcrumbs/gov-breadcrumbs.js.map +1 -1
  100. package/dist/collection/components/gov-button/constants.js +2 -1
  101. package/dist/collection/components/gov-button/constants.js.map +1 -1
  102. package/dist/collection/components/gov-button/gov-button.css +210 -131
  103. package/dist/collection/components/gov-button/gov-button.js +18 -7
  104. package/dist/collection/components/gov-button/gov-button.js.map +1 -1
  105. package/dist/collection/components/gov-card/gov-card.css +3 -0
  106. package/dist/collection/components/gov-card/gov-card.js +1 -1
  107. package/dist/collection/components/gov-card/gov-card.js.map +1 -1
  108. package/dist/collection/components/gov-container/gov-container.css +3 -0
  109. package/dist/collection/components/gov-cookiebar/gov-cookiebar.css +3 -0
  110. package/dist/collection/components/gov-empty/gov-empty.css +3 -0
  111. package/dist/collection/components/gov-error-code/gov-error-code.css +3 -0
  112. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.css +3 -0
  113. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +4 -0
  114. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  115. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.css +3 -0
  116. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +53 -19
  117. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  118. package/dist/collection/components/gov-form/control/gov-form-control.css +3 -0
  119. package/dist/collection/components/gov-form/file/gov-form-file.css +3 -0
  120. package/dist/collection/components/gov-form/file/gov-form-file.js +7 -1
  121. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  122. package/dist/collection/components/gov-form/group/gov-form-group.css +3 -0
  123. package/dist/collection/components/gov-form/input/gov-form-input.css +6 -3
  124. package/dist/collection/components/gov-form/input/gov-form-input.js +7 -1
  125. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  126. package/dist/collection/components/gov-form/label/gov-form-label.css +3 -0
  127. package/dist/collection/components/gov-form/message/gov-form-message.css +3 -0
  128. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.css +3 -3
  129. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +10 -2
  130. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  131. package/dist/collection/components/gov-form/password-power/constants.js +6 -0
  132. package/dist/collection/components/gov-form/password-power/constants.js.map +1 -0
  133. package/dist/collection/components/gov-form/password-power/gov-form-password-power.css +246 -0
  134. package/dist/collection/components/gov-form/password-power/gov-form-password-power.js +43 -0
  135. package/dist/collection/components/gov-form/password-power/gov-form-password-power.js.map +1 -0
  136. package/dist/collection/components/gov-form/radio/gov-form-radio.css +3 -0
  137. package/dist/collection/components/gov-form/radio/gov-form-radio.js +35 -1
  138. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  139. package/dist/collection/components/gov-form/search/gov-form-search.css +7 -0
  140. package/dist/collection/components/gov-form/select/gov-form-select.css +3 -3
  141. package/dist/collection/components/gov-form/select/gov-form-select.js +2 -2
  142. package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
  143. package/dist/collection/components/gov-form/switch/gov-form-switch.css +3 -0
  144. package/dist/collection/components/gov-form/switch/gov-form-switch.js +52 -18
  145. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  146. package/dist/collection/components/gov-grid/gov-grid-item.css +3 -0
  147. package/dist/collection/components/gov-grid/gov-grid.css +3 -0
  148. package/dist/collection/components/gov-icon/gov-icon.css +3 -0
  149. package/dist/collection/components/gov-icon/list.js +148 -5
  150. package/dist/collection/components/gov-icon/list.js.map +1 -1
  151. package/dist/collection/components/gov-layout/gov-layout-column.css +3 -0
  152. package/dist/collection/components/gov-layout/gov-layout.css +3 -0
  153. package/dist/collection/components/gov-loading/gov-loading.css +3 -0
  154. package/dist/collection/components/gov-message/gov-message.css +3 -0
  155. package/dist/collection/components/gov-modal/gov-modal.css +6 -3
  156. package/dist/collection/components/gov-modal/gov-modal.js +35 -22
  157. package/dist/collection/components/gov-modal/gov-modal.js.map +1 -1
  158. package/dist/collection/components/gov-nav/gov-nav-item.css +3 -0
  159. package/dist/collection/components/gov-nav/gov-nav.css +3 -0
  160. package/dist/collection/components/gov-pagination/gov-pagination.css +88 -39
  161. package/dist/collection/components/gov-pagination/gov-pagination.js +63 -29
  162. package/dist/collection/components/gov-pagination/gov-pagination.js.map +1 -1
  163. package/dist/collection/components/gov-promp/gov-prompt.css +6 -3
  164. package/dist/collection/components/gov-promp/gov-prompt.js +18 -5
  165. package/dist/collection/components/gov-promp/gov-prompt.js.map +1 -1
  166. package/dist/collection/components/gov-side-nav/gov-side-nav-item.css +3 -0
  167. package/dist/collection/components/gov-side-nav/gov-side-nav-item.js +1 -1
  168. package/dist/collection/components/gov-side-nav/gov-side-nav-item.js.map +1 -1
  169. package/dist/collection/components/gov-side-nav/gov-side-nav.css +3 -0
  170. package/dist/collection/components/gov-spacer/gov-spacer.css +3 -0
  171. package/dist/collection/components/gov-spacer/gov-spacer.js +3 -2
  172. package/dist/collection/components/gov-spacer/gov-spacer.js.map +1 -1
  173. package/dist/collection/components/gov-statsbar/constants.js +1 -1
  174. package/dist/collection/components/gov-statsbar/constants.js.map +1 -1
  175. package/dist/collection/components/gov-statsbar/gov-statsbar-item.css +3 -0
  176. package/dist/collection/components/gov-statsbar/gov-statsbar.css +3 -0
  177. package/dist/collection/components/gov-statsbar/gov-statsbar.js +2 -2
  178. package/dist/collection/components/gov-statsbar/gov-statsbar.js.map +1 -1
  179. package/dist/collection/components/gov-stepper/gov-stepper-item.css +3 -0
  180. package/dist/collection/components/gov-stepper/gov-stepper.css +3 -0
  181. package/dist/collection/components/gov-tabs/gov-tabs-item.css +3 -0
  182. package/dist/collection/components/gov-tabs/gov-tabs.css +3 -0
  183. package/dist/collection/components/gov-tabs/gov-tabs.js +1 -1
  184. package/dist/collection/components/gov-tabs/gov-tabs.js.map +1 -1
  185. package/dist/collection/components/gov-tile/constants.js +1 -0
  186. package/dist/collection/components/gov-tile/constants.js.map +1 -1
  187. package/dist/collection/components/gov-tile/gov-tile.css +11 -4
  188. package/dist/collection/components/gov-tile/gov-tile.js +3 -6
  189. package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
  190. package/dist/collection/components/gov-tiles/gov-tiles.css +6 -0
  191. package/dist/collection/components/gov-tiles/gov-tiles.js +19 -0
  192. package/dist/collection/components/gov-tiles/gov-tiles.js.map +1 -1
  193. package/dist/collection/components/gov-toast/gov-toast.css +3 -0
  194. package/dist/collection/components/gov-toast/gov-toast.js +1 -1
  195. package/dist/collection/components/gov-toast/gov-toast.js.map +1 -1
  196. package/dist/collection/components/gov-tooltip/gov-tooltip-content.css +3 -0
  197. package/dist/collection/components/gov-tooltip/gov-tooltip.css +3 -0
  198. package/dist/collection/components/gov-wizzard/gov-wizzard-item.css +3 -0
  199. package/dist/collection/components/gov-wizzard/gov-wizzard-item.js +1 -1
  200. package/dist/collection/components/gov-wizzard/gov-wizzard-item.js.map +1 -1
  201. package/dist/collection/components/gov-wizzard/gov-wizzard.css +3 -0
  202. package/dist/collection/pages/Accordion.js +97 -2
  203. package/dist/collection/pages/Accordion.js.map +1 -1
  204. package/dist/collection/pages/Badge.js +27 -0
  205. package/dist/collection/pages/Badge.js.map +1 -1
  206. package/dist/collection/pages/Button.js +440 -120
  207. package/dist/collection/pages/Button.js.map +1 -1
  208. package/dist/collection/pages/Error.js +1 -1
  209. package/dist/collection/pages/Error.js.map +1 -1
  210. package/dist/collection/pages/Forms.js +46 -29
  211. package/dist/collection/pages/Forms.js.map +1 -1
  212. package/dist/collection/pages/Pagination.js +12 -2
  213. package/dist/collection/pages/Pagination.js.map +1 -1
  214. package/dist/collection/pages/Stepper.js +6 -6
  215. package/dist/collection/pages/Stepper.js.map +1 -1
  216. package/dist/collection/pages/Tiles.js +39 -0
  217. package/dist/collection/pages/Tiles.js.map +1 -1
  218. package/dist/collection/pages/ToastMessage.js +1 -1
  219. package/dist/collection/pages/ToastMessage.js.map +1 -1
  220. package/dist/collection/pages/ToastMessageCountdown.js +1 -1
  221. package/dist/collection/pages/ToastMessageCountdown.js.map +1 -1
  222. package/dist/collection/pages/Wizzard.js +3 -3
  223. package/dist/collection/pages/Wizzard.js.map +1 -1
  224. package/dist/collection/utils/array.utils.js +2 -0
  225. package/dist/collection/utils/array.utils.js.map +1 -0
  226. package/dist/components/Fragment.js +5 -0
  227. package/dist/components/Fragment.js.map +1 -0
  228. package/dist/components/constants11.js +2 -2
  229. package/dist/components/constants11.js.map +1 -1
  230. package/dist/components/constants3.js +2 -1
  231. package/dist/components/constants3.js.map +1 -1
  232. package/dist/components/gov-accordion-item.js +2 -3
  233. package/dist/components/gov-accordion-item.js.map +1 -1
  234. package/dist/components/gov-accordion.js +3 -2
  235. package/dist/components/gov-accordion.js.map +1 -1
  236. package/dist/components/gov-alert.js +1 -2
  237. package/dist/components/gov-alert.js.map +1 -1
  238. package/dist/components/gov-app.js +673 -166
  239. package/dist/components/gov-app.js.map +1 -1
  240. package/dist/components/gov-attachments-item2.js +1 -2
  241. package/dist/components/gov-attachments-item2.js.map +1 -1
  242. package/dist/components/gov-attachments2.js +0 -1
  243. package/dist/components/gov-attachments2.js.map +1 -1
  244. package/dist/components/gov-backdrop2.js +5 -5
  245. package/dist/components/gov-backdrop2.js.map +1 -1
  246. package/dist/components/gov-badge2.js +16 -18
  247. package/dist/components/gov-badge2.js.map +1 -1
  248. package/dist/components/gov-breadcrumbs.js +1 -2
  249. package/dist/components/gov-breadcrumbs.js.map +1 -1
  250. package/dist/components/gov-button2.js +17 -7
  251. package/dist/components/gov-button2.js.map +1 -1
  252. package/dist/components/gov-card.js +1 -2
  253. package/dist/components/gov-card.js.map +1 -1
  254. package/dist/components/gov-container.js +0 -1
  255. package/dist/components/gov-container.js.map +1 -1
  256. package/dist/components/gov-cookiebar.js +0 -1
  257. package/dist/components/gov-cookiebar.js.map +1 -1
  258. package/dist/components/gov-empty.js +0 -1
  259. package/dist/components/gov-empty.js.map +1 -1
  260. package/dist/components/gov-error-code.js +0 -1
  261. package/dist/components/gov-error-code.js.map +1 -1
  262. package/dist/components/gov-form-autocomplete2.js +4 -1
  263. package/dist/components/gov-form-autocomplete2.js.map +1 -1
  264. package/dist/components/gov-form-checkbox.js +24 -8
  265. package/dist/components/gov-form-checkbox.js.map +1 -1
  266. package/dist/components/gov-form-control.js +0 -1
  267. package/dist/components/gov-form-control.js.map +1 -1
  268. package/dist/components/gov-form-file.js +7 -2
  269. package/dist/components/gov-form-file.js.map +1 -1
  270. package/dist/components/gov-form-group.js +0 -1
  271. package/dist/components/gov-form-group.js.map +1 -1
  272. package/dist/components/gov-form-input2.js +8 -3
  273. package/dist/components/gov-form-input2.js.map +1 -1
  274. package/dist/components/gov-form-label.js +0 -1
  275. package/dist/components/gov-form-label.js.map +1 -1
  276. package/dist/components/gov-form-message2.js +0 -1
  277. package/dist/components/gov-form-message2.js.map +1 -1
  278. package/dist/components/gov-form-multi-select.js +11 -4
  279. package/dist/components/gov-form-multi-select.js.map +1 -1
  280. package/dist/components/gov-form-password-power.d.ts +11 -0
  281. package/dist/components/gov-form-password-power.js +43 -0
  282. package/dist/components/gov-form-password-power.js.map +1 -0
  283. package/dist/components/gov-form-radio.js +18 -2
  284. package/dist/components/gov-form-radio.js.map +1 -1
  285. package/dist/components/gov-form-search.js +1 -2
  286. package/dist/components/gov-form-search.js.map +1 -1
  287. package/dist/components/gov-form-select2.js +3 -4
  288. package/dist/components/gov-form-select2.js.map +1 -1
  289. package/dist/components/gov-form-switch.js +24 -8
  290. package/dist/components/gov-form-switch.js.map +1 -1
  291. package/dist/components/gov-grid-item.js +0 -1
  292. package/dist/components/gov-grid-item.js.map +1 -1
  293. package/dist/components/gov-grid.js +0 -1
  294. package/dist/components/gov-grid.js.map +1 -1
  295. package/dist/components/gov-icon2.js +1 -2
  296. package/dist/components/gov-icon2.js.map +1 -1
  297. package/dist/components/gov-layout-column.js +0 -1
  298. package/dist/components/gov-layout-column.js.map +1 -1
  299. package/dist/components/gov-layout.js +0 -1
  300. package/dist/components/gov-layout.js.map +1 -1
  301. package/dist/components/gov-loading.js +0 -1
  302. package/dist/components/gov-loading.js.map +1 -1
  303. package/dist/components/gov-message.js +0 -1
  304. package/dist/components/gov-message.js.map +1 -1
  305. package/dist/components/gov-modal.js +20 -14
  306. package/dist/components/gov-modal.js.map +1 -1
  307. package/dist/components/gov-nav-item.js +0 -1
  308. package/dist/components/gov-nav-item.js.map +1 -1
  309. package/dist/components/gov-nav.js +0 -1
  310. package/dist/components/gov-nav.js.map +1 -1
  311. package/dist/components/gov-pagination.js +50 -17
  312. package/dist/components/gov-pagination.js.map +1 -1
  313. package/dist/components/gov-prompt.js +13 -7
  314. package/dist/components/gov-prompt.js.map +1 -1
  315. package/dist/components/gov-side-nav-item.js +1 -2
  316. package/dist/components/gov-side-nav-item.js.map +1 -1
  317. package/dist/components/gov-side-nav.js +0 -1
  318. package/dist/components/gov-side-nav.js.map +1 -1
  319. package/dist/components/gov-spacer.js +1 -2
  320. package/dist/components/gov-spacer.js.map +1 -1
  321. package/dist/components/gov-statsbar-item.js +0 -1
  322. package/dist/components/gov-statsbar-item.js.map +1 -1
  323. package/dist/components/gov-statsbar.js +2 -3
  324. package/dist/components/gov-statsbar.js.map +1 -1
  325. package/dist/components/gov-stepper-item.js +0 -1
  326. package/dist/components/gov-stepper-item.js.map +1 -1
  327. package/dist/components/gov-stepper.js +0 -1
  328. package/dist/components/gov-stepper.js.map +1 -1
  329. package/dist/components/gov-tabs-item.js +0 -1
  330. package/dist/components/gov-tabs-item.js.map +1 -1
  331. package/dist/components/gov-tabs.js +1 -2
  332. package/dist/components/gov-tabs.js.map +1 -1
  333. package/dist/components/gov-tile.js +3 -3
  334. package/dist/components/gov-tile.js.map +1 -1
  335. package/dist/components/gov-tiles.js +4 -3
  336. package/dist/components/gov-tiles.js.map +1 -1
  337. package/dist/components/gov-toast.js +1 -2
  338. package/dist/components/gov-toast.js.map +1 -1
  339. package/dist/components/gov-tooltip-content.js +0 -1
  340. package/dist/components/gov-tooltip-content.js.map +1 -1
  341. package/dist/components/gov-tooltip.js +0 -1
  342. package/dist/components/gov-tooltip.js.map +1 -1
  343. package/dist/components/gov-wizzard-item.js +1 -2
  344. package/dist/components/gov-wizzard-item.js.map +1 -1
  345. package/dist/components/gov-wizzard.js +0 -1
  346. package/dist/components/gov-wizzard.js.map +1 -1
  347. package/dist/components/index.d.ts +1 -0
  348. package/dist/components/index.js +1 -0
  349. package/dist/components/index.js.map +1 -1
  350. package/dist/core/core.css +1 -1
  351. package/dist/core/core.esm.js +1 -1
  352. package/dist/core/core.esm.js.map +1 -1
  353. package/dist/core/{p-e7dd2002.entry.js → p-00e1e600.entry.js} +2 -2
  354. package/dist/core/p-00e1e600.entry.js.map +1 -0
  355. package/dist/core/{p-ae3e2d60.entry.js → p-04fc18ab.entry.js} +2 -2
  356. package/dist/core/p-04fc18ab.entry.js.map +1 -0
  357. package/dist/core/p-0950ba85.entry.js +2 -0
  358. package/dist/core/p-0950ba85.entry.js.map +1 -0
  359. package/dist/core/{p-5fa41af9.js → p-1020a160.js} +1 -1
  360. package/dist/core/p-1020a160.js.map +1 -0
  361. package/dist/core/{p-9e6a41cc.entry.js → p-16608a87.entry.js} +2 -2
  362. package/dist/core/p-16608a87.entry.js.map +1 -0
  363. package/dist/core/{p-f5ee7634.entry.js → p-1bb5184f.entry.js} +2 -2
  364. package/dist/core/{p-f5ee7634.entry.js.map → p-1bb5184f.entry.js.map} +1 -1
  365. package/dist/core/p-1c06fb0b.entry.js +2 -0
  366. package/dist/core/p-1c06fb0b.entry.js.map +1 -0
  367. package/dist/core/p-1c1d0bbe.js +2 -0
  368. package/dist/core/p-1c1d0bbe.js.map +1 -0
  369. package/dist/core/{p-b48a3112.entry.js → p-4b375a4d.entry.js} +2 -2
  370. package/dist/core/{p-b48a3112.entry.js.map → p-4b375a4d.entry.js.map} +1 -1
  371. package/dist/core/p-5b4e3bdf.entry.js +2 -0
  372. package/dist/core/p-5b4e3bdf.entry.js.map +1 -0
  373. package/dist/core/p-613d8ed8.entry.js +2 -0
  374. package/dist/core/p-613d8ed8.entry.js.map +1 -0
  375. package/dist/core/{p-6d40721b.entry.js → p-63d2e8ec.entry.js} +2 -2
  376. package/dist/core/{p-6d40721b.entry.js.map → p-63d2e8ec.entry.js.map} +1 -1
  377. package/dist/core/{p-f5ffcb3d.entry.js → p-72b9e63a.entry.js} +2 -2
  378. package/dist/core/{p-5cecdaaf.entry.js → p-72f16a95.entry.js} +2 -2
  379. package/dist/core/p-7ac5f119.entry.js +2 -0
  380. package/dist/core/{p-63079b80.entry.js.map → p-7ac5f119.entry.js.map} +1 -1
  381. package/dist/core/{p-03d40bf4.entry.js → p-833ab414.entry.js} +2 -2
  382. package/dist/core/{p-03d40bf4.entry.js.map → p-833ab414.entry.js.map} +1 -1
  383. package/dist/core/{p-34360f92.entry.js → p-84fda9dd.entry.js} +2 -2
  384. package/dist/core/{p-34360f92.entry.js.map → p-84fda9dd.entry.js.map} +1 -1
  385. package/dist/core/p-851939ff.entry.js +2 -0
  386. package/dist/core/p-851939ff.entry.js.map +1 -0
  387. package/dist/core/p-8dacc8dc.entry.js +2 -0
  388. package/dist/core/p-8dacc8dc.entry.js.map +1 -0
  389. package/dist/core/p-8dbad4a2.entry.js +2 -0
  390. package/dist/core/p-8dbad4a2.entry.js.map +1 -0
  391. package/dist/core/p-902002e9.entry.js +2 -0
  392. package/dist/core/p-902002e9.entry.js.map +1 -0
  393. package/dist/core/p-95f21fbf.entry.js +2 -0
  394. package/dist/core/p-95f21fbf.entry.js.map +1 -0
  395. package/dist/core/p-99155ec0.entry.js +2 -0
  396. package/dist/core/p-99155ec0.entry.js.map +1 -0
  397. package/dist/core/{p-7591ecd4.entry.js → p-9ca0a11c.entry.js} +2 -2
  398. package/dist/core/{p-7591ecd4.entry.js.map → p-9ca0a11c.entry.js.map} +1 -1
  399. package/dist/core/p-9ceeba49.entry.js +2 -0
  400. package/dist/core/p-9ceeba49.entry.js.map +1 -0
  401. package/dist/core/{p-ec617f18.entry.js → p-9d30e79e.entry.js} +2 -2
  402. package/dist/core/{p-ec617f18.entry.js.map → p-9d30e79e.entry.js.map} +1 -1
  403. package/dist/core/{p-38fb2d42.entry.js → p-a36234bb.entry.js} +2 -2
  404. package/dist/core/p-a36234bb.entry.js.map +1 -0
  405. package/dist/core/p-ac33c5ef.entry.js +2 -0
  406. package/dist/core/p-ac33c5ef.entry.js.map +1 -0
  407. package/dist/core/p-b966062a.entry.js +2 -0
  408. package/dist/core/p-b966062a.entry.js.map +1 -0
  409. package/dist/core/{p-fc1581f9.entry.js → p-bd560ffc.entry.js} +2 -2
  410. package/dist/core/{p-fc1581f9.entry.js.map → p-bd560ffc.entry.js.map} +1 -1
  411. package/dist/core/{p-93facb4a.entry.js → p-c0430e75.entry.js} +2 -2
  412. package/dist/core/p-c0430e75.entry.js.map +1 -0
  413. package/dist/core/p-c9948e57.entry.js +2 -0
  414. package/dist/core/p-c9948e57.entry.js.map +1 -0
  415. package/dist/core/p-cd869237.js +2 -0
  416. package/dist/core/p-cd869237.js.map +1 -0
  417. package/dist/core/{p-9cc6ed83.entry.js → p-e57d250f.entry.js} +2 -2
  418. package/dist/core/p-e57d250f.entry.js.map +1 -0
  419. package/dist/core/p-ecdfb046.entry.js +2 -0
  420. package/dist/core/p-ecdfb046.entry.js.map +1 -0
  421. package/dist/core/p-fac1c202.entry.js +2 -0
  422. package/dist/core/p-fac1c202.entry.js.map +1 -0
  423. package/dist/custom-elements/index.d.ts +6 -0
  424. package/dist/custom-elements/index.js +1 -1
  425. package/dist/custom-elements/index.js.map +1 -1
  426. package/dist/esm/Fragment-8d8d54fb.js +5 -0
  427. package/dist/esm/Fragment-8d8d54fb.js.map +1 -0
  428. package/dist/esm/{constants-d550c816.js → constants-037c35bc.js} +3 -3
  429. package/dist/esm/constants-037c35bc.js.map +1 -0
  430. package/dist/esm/{constants-1a2146b2.js → constants-45f6db4c.js} +3 -2
  431. package/dist/esm/constants-45f6db4c.js.map +1 -0
  432. package/dist/esm/core.js +1 -1
  433. package/dist/esm/gov-accordion-item.entry.js +2 -2
  434. package/dist/esm/gov-accordion-item.entry.js.map +1 -1
  435. package/dist/esm/gov-accordion.entry.js +2 -1
  436. package/dist/esm/gov-accordion.entry.js.map +1 -1
  437. package/dist/esm/gov-alert.entry.js +1 -1
  438. package/dist/esm/gov-alert.entry.js.map +1 -1
  439. package/dist/esm/gov-app.entry.js +673 -165
  440. package/dist/esm/gov-app.entry.js.map +1 -1
  441. package/dist/esm/gov-attachments_3.entry.js +1 -1
  442. package/dist/esm/gov-attachments_3.entry.js.map +1 -1
  443. package/dist/esm/gov-backdrop.entry.js +5 -4
  444. package/dist/esm/gov-backdrop.entry.js.map +1 -1
  445. package/dist/esm/gov-badge.entry.js +17 -17
  446. package/dist/esm/gov-badge.entry.js.map +1 -1
  447. package/dist/esm/gov-breadcrumbs.entry.js +1 -1
  448. package/dist/esm/gov-breadcrumbs.entry.js.map +1 -1
  449. package/dist/esm/gov-button.entry.js +14 -3
  450. package/dist/esm/gov-button.entry.js.map +1 -1
  451. package/dist/esm/gov-card.entry.js +1 -1
  452. package/dist/esm/gov-card.entry.js.map +1 -1
  453. package/dist/esm/gov-form-autocomplete.entry.js +4 -0
  454. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  455. package/dist/esm/gov-form-checkbox.entry.js +23 -7
  456. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  457. package/dist/esm/gov-form-file.entry.js +7 -1
  458. package/dist/esm/gov-form-file.entry.js.map +1 -1
  459. package/dist/esm/gov-form-input.entry.js +8 -2
  460. package/dist/esm/gov-form-input.entry.js.map +1 -1
  461. package/dist/esm/gov-form-multi-select.entry.js +11 -3
  462. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  463. package/dist/esm/gov-form-password-power.entry.js +24 -0
  464. package/dist/esm/gov-form-password-power.entry.js.map +1 -0
  465. package/dist/esm/gov-form-radio.entry.js +17 -1
  466. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  467. package/dist/esm/gov-form-search.entry.js +1 -1
  468. package/dist/esm/gov-form-search.entry.js.map +1 -1
  469. package/dist/esm/gov-form-select.entry.js +3 -3
  470. package/dist/esm/gov-form-select.entry.js.map +1 -1
  471. package/dist/esm/gov-form-switch.entry.js +23 -7
  472. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  473. package/dist/esm/gov-icon.entry.js +1 -1
  474. package/dist/esm/gov-modal.entry.js +19 -13
  475. package/dist/esm/gov-modal.entry.js.map +1 -1
  476. package/dist/esm/gov-pagination.entry.js +50 -16
  477. package/dist/esm/gov-pagination.entry.js.map +1 -1
  478. package/dist/esm/gov-prompt.entry.js +12 -6
  479. package/dist/esm/gov-prompt.entry.js.map +1 -1
  480. package/dist/esm/gov-side-nav-item.entry.js +1 -1
  481. package/dist/esm/gov-side-nav-item.entry.js.map +1 -1
  482. package/dist/esm/gov-spacer.entry.js +1 -1
  483. package/dist/esm/gov-spacer.entry.js.map +1 -1
  484. package/dist/esm/gov-statsbar-item.entry.js +1 -1
  485. package/dist/esm/gov-statsbar.entry.js +2 -2
  486. package/dist/esm/gov-statsbar.entry.js.map +1 -1
  487. package/dist/esm/gov-tabs.entry.js +1 -1
  488. package/dist/esm/gov-tabs.entry.js.map +1 -1
  489. package/dist/esm/gov-tile.entry.js +3 -2
  490. package/dist/esm/gov-tile.entry.js.map +1 -1
  491. package/dist/esm/gov-tiles.entry.js +2 -1
  492. package/dist/esm/gov-tiles.entry.js.map +1 -1
  493. package/dist/esm/gov-toast.entry.js +1 -1
  494. package/dist/esm/gov-toast.entry.js.map +1 -1
  495. package/dist/esm/gov-wizzard-item.entry.js +1 -1
  496. package/dist/esm/gov-wizzard-item.entry.js.map +1 -1
  497. package/dist/esm/index-00e9a0d5.js +4 -0
  498. package/dist/esm/loader.js +1 -1
  499. package/dist/hydrate/index.js +946 -271
  500. package/dist/types/components/gov-accordion/gov-accordion.d.ts +4 -0
  501. package/dist/types/components/gov-badge/constants.d.ts +4 -2
  502. package/dist/types/components/gov-badge/gov-badge.d.ts +4 -9
  503. package/dist/types/components/gov-button/constants.d.ts +3 -2
  504. package/dist/types/components/gov-button/gov-button.d.ts +2 -0
  505. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +8 -3
  506. package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -0
  507. package/dist/types/components/gov-form/password-power/constants.d.ts +5 -0
  508. package/dist/types/components/gov-form/password-power/gov-form-password-power.d.ts +7 -0
  509. package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +5 -0
  510. package/dist/types/components/gov-form/switch/gov-form-switch.d.ts +8 -3
  511. package/dist/types/components/gov-modal/gov-modal.d.ts +3 -1
  512. package/dist/types/components/gov-pagination/gov-pagination.d.ts +7 -3
  513. package/dist/types/components/gov-promp/gov-prompt.d.ts +3 -1
  514. package/dist/types/components/gov-statsbar/constants.d.ts +2 -2
  515. package/dist/types/components/gov-tile/constants.d.ts +1 -0
  516. package/dist/types/components/gov-tile/gov-tile.d.ts +1 -2
  517. package/dist/types/components/gov-tiles/gov-tiles.d.ts +4 -0
  518. package/dist/types/components.d.ts +65 -14
  519. package/dist/types/utils/array.utils.d.ts +1 -0
  520. package/package.json +1 -1
  521. package/dist/cjs/constants-5f6bbc50.js.map +0 -1
  522. package/dist/cjs/constants-dc2ba6bd.js.map +0 -1
  523. package/dist/core/p-00182e76.entry.js +0 -2
  524. package/dist/core/p-00182e76.entry.js.map +0 -1
  525. package/dist/core/p-0278fcb3.entry.js +0 -2
  526. package/dist/core/p-0278fcb3.entry.js.map +0 -1
  527. package/dist/core/p-08f14c8b.entry.js +0 -2
  528. package/dist/core/p-08f14c8b.entry.js.map +0 -1
  529. package/dist/core/p-0a152bb7.entry.js +0 -2
  530. package/dist/core/p-0a152bb7.entry.js.map +0 -1
  531. package/dist/core/p-14f8f2fb.js +0 -2
  532. package/dist/core/p-14f8f2fb.js.map +0 -1
  533. package/dist/core/p-2128abe1.entry.js +0 -2
  534. package/dist/core/p-2128abe1.entry.js.map +0 -1
  535. package/dist/core/p-22722ff3.entry.js +0 -2
  536. package/dist/core/p-22722ff3.entry.js.map +0 -1
  537. package/dist/core/p-2419f4cd.entry.js +0 -2
  538. package/dist/core/p-2419f4cd.entry.js.map +0 -1
  539. package/dist/core/p-38fb2d42.entry.js.map +0 -1
  540. package/dist/core/p-4681cb3a.entry.js +0 -2
  541. package/dist/core/p-4681cb3a.entry.js.map +0 -1
  542. package/dist/core/p-469273be.entry.js +0 -2
  543. package/dist/core/p-469273be.entry.js.map +0 -1
  544. package/dist/core/p-5547dbb0.entry.js +0 -2
  545. package/dist/core/p-5547dbb0.entry.js.map +0 -1
  546. package/dist/core/p-5fa41af9.js.map +0 -1
  547. package/dist/core/p-63079b80.entry.js +0 -2
  548. package/dist/core/p-8965f84a.entry.js +0 -2
  549. package/dist/core/p-8965f84a.entry.js.map +0 -1
  550. package/dist/core/p-93facb4a.entry.js.map +0 -1
  551. package/dist/core/p-9cc6ed83.entry.js.map +0 -1
  552. package/dist/core/p-9e6a41cc.entry.js.map +0 -1
  553. package/dist/core/p-ad0cc981.entry.js +0 -2
  554. package/dist/core/p-ad0cc981.entry.js.map +0 -1
  555. package/dist/core/p-ae3e2d60.entry.js.map +0 -1
  556. package/dist/core/p-e52a042f.entry.js +0 -2
  557. package/dist/core/p-e52a042f.entry.js.map +0 -1
  558. package/dist/core/p-e7dd2002.entry.js.map +0 -1
  559. package/dist/core/p-f2dc8ce3.entry.js +0 -2
  560. package/dist/core/p-f2dc8ce3.entry.js.map +0 -1
  561. package/dist/core/p-fc91591d.entry.js +0 -2
  562. package/dist/core/p-fc91591d.entry.js.map +0 -1
  563. package/dist/esm/constants-1a2146b2.js.map +0 -1
  564. package/dist/esm/constants-d550c816.js.map +0 -1
  565. /package/dist/core/{p-f5ffcb3d.entry.js.map → p-72b9e63a.entry.js.map} +0 -0
  566. /package/dist/core/{p-5cecdaaf.entry.js.map → p-72f16a95.entry.js.map} +0 -0
@@ -9,9 +9,11 @@ import { delay } from '../../../utils/utils';
9
9
  import { govHost } from '../../../helpers/Dom/template';
10
10
  import { govForm } from '../../../helpers/Dom/form';
11
11
  import { FormLabelClass } from '../label/constants';
12
+ import Fragment from "../../../helpers/Fragment";
12
13
  export class GovFormRadio {
13
14
  constructor() {
14
15
  this.value = undefined;
16
+ this.noLabel = false;
15
17
  this.checked = false;
16
18
  this.required = false;
17
19
  this.disabled = undefined;
@@ -49,17 +51,31 @@ export class GovFormRadio {
49
51
  }
50
52
  render() {
51
53
  const { isChecked } = this;
52
- return (h(Host, { class: FormRadioClass.root, "is-checked": isChecked, size: this.size, invalid: toBoolAttrIfDefined(this.invalid) }, h("div", { class: FormRadioClass.holder }, h("input", { class: FormRadioClass.input, id: this.identifier || this.radioId, type: "radio", value: this.value, name: this.name, checked: this.isChecked, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, "aria-checked": this.isChecked, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) }), h("span", null, h("slot", { name: "label" })))));
54
+ const wrapCheckbox = (children) => {
55
+ if (this.noLabel) {
56
+ return (h("label", null, children));
57
+ }
58
+ return children;
59
+ };
60
+ return (h(Host, { class: FormRadioClass.root, "is-checked": isChecked, size: this.size, invalid: toBoolAttrIfDefined(this.invalid) }, h("div", { class: FormRadioClass.holder }, wrapCheckbox(h(Fragment, null, h("input", { class: FormRadioClass.input, id: this.identifier || this.radioId, type: "radio", value: this.value, name: this.name, checked: this.isChecked, onClick: this.onClickHandler.bind(this), onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, "aria-checked": this.isChecked, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) }), h("span", null, h("slot", { name: "label" }), "\u00A0"))))));
61
+ }
62
+ onClickHandler(e) {
63
+ e.stopPropagation();
53
64
  }
54
65
  onFocusHandler(e) {
66
+ e.stopPropagation();
67
+ e.preventDefault();
55
68
  this.govFocus.emit(e);
56
69
  }
57
70
  onBlurHandler(e) {
71
+ e.stopPropagation();
72
+ e.preventDefault();
58
73
  this.govBlur.emit(e);
59
74
  }
60
75
  onChangeHandler(e) {
61
76
  this.isChecked = e.target.checked;
62
77
  e.stopPropagation();
78
+ e.preventDefault();
63
79
  this.govChange.emit({
64
80
  checked: this.isChecked,
65
81
  value: this.value,
@@ -103,6 +119,24 @@ export class GovFormRadio {
103
119
  "attribute": "value",
104
120
  "reflect": false
105
121
  },
122
+ "noLabel": {
123
+ "type": "boolean",
124
+ "mutable": false,
125
+ "complexType": {
126
+ "original": "boolean",
127
+ "resolved": "boolean",
128
+ "references": {}
129
+ },
130
+ "required": false,
131
+ "optional": false,
132
+ "docs": {
133
+ "tags": [],
134
+ "text": "When you can't use the form label."
135
+ },
136
+ "attribute": "no-label",
137
+ "reflect": false,
138
+ "defaultValue": "false"
139
+ },
106
140
  "checked": {
107
141
  "type": "boolean",
108
142
  "mutable": false,
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-radio.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/radio/gov-form-radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAOnD,MAAM,OAAO,YAAY;EAMxB;;mBAeqD,KAAK;oBAKrB,KAAK;;;gBAaG,GAAG;;;;;;IAhC/C,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAA;IAEnC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;GACxB;EA6DD,kBAAkB,CAAC,QAAiB;IACnC,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAA;IACzB,IAAI,CAA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AAO,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA;EAChG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Host, h, Prop, State, Event, EventEmitter, Element, Watch, Method } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { FormRadioClass, FormRadioSizes, FormRadioSizesType } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { FormLabelClass } from '../label/constants'\nimport { GovFormRadioChangeEvent } from './interfaces'\n\n@Component({\n\ttag: 'gov-form-radio',\n\tstyleUrl: 'gov-form-radio.scss',\n})\nexport class GovFormRadio {\n\tprivate h: GovHost\n\tprivate f: GovForm\n\n\tprivate readonly radioId: string\n\n\tconstructor() {\n\t\tthis.radioId = createID('GovRadio')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormRadioElement\n\t/**\n\t * Value of radio\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * Radio default state\n\t */\n\t@Prop({ reflect: true }) readonly checked: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the radio component disabled.\n\t * This prevents users from being able to interact with the radio, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the radio.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Radio's size.\n\t */\n\t@Prop() readonly size?: FormRadioSizesType = 'm'\n\t/**\n\t * Custom radio identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the radio has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the radio loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the radio change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovFormRadioChangeEvent>\n\n\t@State() isChecked: boolean\n\n\t@Watch('checked')\n\tupdateCheckedState(newValue: boolean): void {\n\t\tthis.isChecked = newValue\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormRadioSizes, newValue, FormRadioClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.isChecked = this.checked\n\n\t\tthis.f.passAttrToControl('type', 'radio')\n\t\tthis.h.passChildAttr(FormLabelClass.root, 'identifier', this.identifier || this.radioId)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { isChecked } = this\n\n\t\treturn (\n\t\t\t<Host class={FormRadioClass.root} is-checked={isChecked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormRadioClass.holder}>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormRadioClass.input}\n\t\t\t\t\t\tid={this.identifier || this.radioId}\n\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tchecked={this.isChecked}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\taria-checked={this.isChecked}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<slot name=\"label\" />\n\t\t\t\t\t</span>\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.isChecked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormRadioClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormRadioClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.radioId, this.wcagLabelledBy, FormRadioClass.root)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-radio.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/radio/gov-form-radio.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AACnE,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAEvD,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAMhD,MAAM,OAAO,YA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Host, h, Prop, State, Event, EventEmitter, Element, Watch, Method } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { FormRadioClass, FormRadioSizes, FormRadioSizesType } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { FormLabelClass } from '../label/constants'\nimport { GovFormRadioChangeEvent } from './interfaces'\nimport Fragment from \"../../../helpers/Fragment\"\n\n@Component({\n\ttag: 'gov-form-radio',\n\tstyleUrl: 'gov-form-radio.scss',\n})\nexport class GovFormRadio {\n\tprivate h: GovHost\n\tprivate f: GovForm\n\n\tprivate readonly radioId: string\n\n\tconstructor() {\n\t\tthis.radioId = createID('GovRadio')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormRadioElement\n\t/**\n\t * Value of radio\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Radio default state\n\t */\n\t@Prop({ reflect: true }) readonly checked: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the radio component disabled.\n\t * This prevents users from being able to interact with the radio, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the radio.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Radio's size.\n\t */\n\t@Prop() readonly size?: FormRadioSizesType = 'm'\n\t/**\n\t * Custom radio identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the radio has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the radio loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the radio change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovFormRadioChangeEvent>\n\n\t@State() isChecked: boolean\n\n\t@Watch('checked')\n\tupdateCheckedState(newValue: boolean): void {\n\t\tthis.isChecked = newValue\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormRadioSizes, newValue, FormRadioClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.isChecked = this.checked\n\n\t\tthis.f.passAttrToControl('type', 'radio')\n\t\tthis.h.passChildAttr(FormLabelClass.root, 'identifier', this.identifier || this.radioId)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { isChecked } = this\n\t\tconst wrapCheckbox = (children) => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn (\n\t\t\t\t\t<label>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</label>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={FormRadioClass.root} is-checked={isChecked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormRadioClass.holder}>\n\t\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass={FormRadioClass.input}\n\t\t\t\t\t\t\t\tid={this.identifier || this.radioId}\n\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\t\tchecked={this.isChecked}\n\t\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\t\taria-checked={this.isChecked}\n\t\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t<slot name=\"label\" />&nbsp;\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: PointerEvent) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.isChecked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormRadioClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormRadioClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.radioId, this.wcagLabelledBy, FormRadioClass.root)\n\t}\n}\n"]}
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */
@@ -227,6 +230,10 @@
227
230
  }
228
231
  .gov-form-search__input input {
229
232
  height: auto;
233
+ border-width: 0;
234
+ }
235
+ .gov-form-search__input input:focus {
236
+ outline: none;
230
237
  }
231
238
  .gov-form-search__button {
232
239
  flex: 0 0 auto;
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */
@@ -317,9 +320,6 @@
317
320
  [invalid="1"].gov-form-select *[slot=right-icon] {
318
321
  color: var(--gov-form-state-color-error, var(--gov-color-error));
319
322
  }
320
- [invalid=""].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow), [invalid=true i].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow), [invalid="1"].gov-form-select *[slot=right-icon]:not(.icon-validation):not(.icon-arrow) {
321
- display: none;
322
- }
323
323
  [success=""].gov-form-select *[slot=right-icon], [success=true i].gov-form-select *[slot=right-icon], [success="1"].gov-form-select *[slot=right-icon] {
324
324
  color: var(--gov-form-state-color-success, var(--gov-color-success));
325
325
  }
@@ -50,7 +50,7 @@ export class GovFormSelect {
50
50
  }
51
51
  }
52
52
  render() {
53
- return (h(Host, { class: FormSelectClass.root, size: this.size, variant: this.variant }, this.h.hasSlot('prefix') && h("slot", { name: "prefix" }), h("span", { class: "element" }, h("gov-icon", { slot: "right-icon", name: "arrow-down" }), h("select", { id: this.identifier || this.selectId, onFocus: this.onFocusHandler.bind(this), onChange: this.onChangeHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el), "aria-disabled": toBoolAttrIfDefined(this.disabled), "aria-activedescendant": this.wcagActiveDescendant, "aria-controls": this.wcagControls, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-owns": this.wcagOwns }, h("slot", null))), this.h.hasSlot('sufix') && h("slot", { name: "sufix" })));
53
+ return (h(Host, { class: FormSelectClass.root, size: this.size, variant: this.variant }, this.h.hasSlot('prefix') && h("slot", { name: "prefix" }), h("span", { class: "element" }, h("gov-icon", { slot: "right-icon", name: "chevron-down" }), h("select", { id: this.identifier || this.selectId, onFocus: this.onFocusHandler.bind(this), onChange: this.onChangeHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, name: this.name, disabled: this.disabled, ref: el => (this.selectRef = el), "aria-disabled": toBoolAttrIfDefined(this.disabled), "aria-activedescendant": this.wcagActiveDescendant, "aria-controls": this.wcagControls, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-owns": this.wcagOwns }, h("slot", null))), this.h.hasSlot('sufix') && h("slot", { name: "sufix" })));
54
54
  }
55
55
  onFocusHandler(e) {
56
56
  this.focused = true;
@@ -63,7 +63,7 @@ export class GovFormSelect {
63
63
  onChangeHandler(e) {
64
64
  this.value = e.target.value;
65
65
  e.stopPropagation();
66
- this.govChange.emit(e);
66
+ this.govChange.emit(e.target);
67
67
  }
68
68
  /**
69
69
  * Returns the current state of the component
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-select.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/select/gov-form-select.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAgB,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE5G,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAA;AAC5E,OAAO,EAAuB,kBAAkB,EAAyB,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAC9H,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AACtF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAMnD,MAAM,OAAO,aAAa;EAOzB;;;;gBAsB8C,GAAG;;oBASZ,KAAK;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, State, Prop, Event, EventEmitter, Watch, Host, Method } from '@stencil/core'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { toBoolAttrIfDefined, govHost } from '../../../helpers/Dom/template'\nimport { FormSelectSizesType, FormSelectVariants, FormSelectVariantType, FormSelectClass, FormSelectSizes } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { createID } from '../../../utils/string.utils'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govForm } from '../../../helpers/Dom/form'\n\n@Component({\n\ttag: 'gov-form-select',\n\tstyleUrl: 'gov-form-select.scss',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\n\tprivate readonly selectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.f = govForm(govHost(this.host))\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of select\n\t */\n\t@Prop({ reflect: true, mutable: true }) value: string\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormSelectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormSelectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a related component’s visually focused element.\n\t */\n\t@Prop({ attribute: 'wcag-active-descendant' }) readonly wcagActiveDescendant: string\n\t/**\n\t * Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component.\n\t */\n\t@Prop({ attribute: 'wcag-controls' }) readonly wcagControls: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-owns' }) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter\n\t@State() focused: boolean\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormSelectVariants, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSelectSizes, newValue, FormSelectClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.host.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.value === this.value) {\n\t\t\t\toption.setAttribute('selected', 'true')\n\t\t\t}\n\t\t})\n\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t<gov-icon slot=\"right-icon\" name=\"arrow-down\"></gov-icon>\n\t\t\t\t\t<select\n\t\t\t\t\t\tid={this.identifier || this.selectId}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\taria-activedescendant={this.wcagActiveDescendant}\n\t\t\t\t\t\taria-controls={this.wcagControls}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</select>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.govChange.emit(e)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getInstance(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormSelectClass.root)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-select.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/select/gov-form-select.tsx"],"names":[],"mappings":"A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KAAK,CAAA;EACnB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,WAAW;IAChB,OAAO,IAAI,CAAC,SAAS,CAAA;EACtB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,eAAe,CAAC,IAAI,CAAC,oBAAoB,EAAE,wBAAwB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAC1F,eAAe,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IACzE,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAChF,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IACjE,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;EAClG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, State, Prop, Event, EventEmitter, Watch, Host, Method } from '@stencil/core'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { toBoolAttrIfDefined, govHost } from '../../../helpers/Dom/template'\nimport { FormSelectSizesType, FormSelectVariants, FormSelectVariantType, FormSelectClass, FormSelectSizes } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { createID } from '../../../utils/string.utils'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govForm } from '../../../helpers/Dom/form'\n\n@Component({\n\ttag: 'gov-form-select',\n\tstyleUrl: 'gov-form-select.scss',\n})\nexport class GovFormSelect {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\tprivate selectRef?: HTMLSelectElement\n\n\tprivate readonly selectId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.f = govForm(govHost(this.host))\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Value of select\n\t */\n\t@Prop({ reflect: true, mutable: true }) value: string\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormSelectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormSelectSizesType = 'm'\n\t/**\n\t * Name of the select.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the select component disabled.\n\t * This prevents users from being able to interact with the select, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a related component’s visually focused element.\n\t */\n\t@Prop({ attribute: 'wcag-active-descendant' }) readonly wcagActiveDescendant: string\n\t/**\n\t * Use this prop to add an aria-controls attribute. Use the attribute to indicate the id of a component controlled by this component.\n\t */\n\t@Prop({ attribute: 'wcag-controls' }) readonly wcagControls: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-owns' }) readonly wcagOwns: string\n\t/**\n\t * Emitted when the select has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter\n\t@State() focused: boolean\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormSelectVariants, newValue, FormSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSelectSizes, newValue, FormSelectClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.host.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.value === this.value) {\n\t\t\t\toption.setAttribute('selected', 'true')\n\t\t\t}\n\t\t})\n\n\t\tthis.f.passAttrToControl('type', 'select')\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t{this.h.hasSlot('prefix') && <slot name=\"prefix\"></slot>}\n\t\t\t\t<span class=\"element\">\n\t\t\t\t\t<gov-icon slot=\"right-icon\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t<select\n\t\t\t\t\t\tid={this.identifier || this.selectId}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\taria-activedescendant={this.wcagActiveDescendant}\n\t\t\t\t\t\taria-controls={this.wcagControls}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t>\n\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t</select>\n\t\t\t\t</span>\n\t\t\t\t{this.h.hasSlot('sufix') && <slot name=\"sufix\"></slot>}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\tthis.govChange.emit(e.target)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.selectRef.focus(options)\n\t}\n\n\t/**\n\t * Sets the ordered value of the element\n\t */\n\t@Method()\n\tasync setValue(value: string): Promise<void> {\n\t\tthis.value = value\n\t}\n\n\t/**\n\t * Returns an instance of the native html select element\n\t */\n\t@Method()\n\tasync getInstance(): Promise<HTMLSelectElement> {\n\t\treturn this.selectRef\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormSelectClass.root)\n\t}\n}\n"]}
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */
@@ -1,27 +1,30 @@
1
- import { Host, h } from '@stencil/core';
2
- import { createID } from '../../../utils/string.utils';
3
- import { validateProp } from '../../../helpers/Validate/props';
4
- import { FormSwitchClass, FormSwitchSizes } from './constants';
5
- import { toBoolAttrIfDefined } from '../../../helpers/Dom/template';
6
- import { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag';
7
- import { canValidateWcagOnRender } from '../../../helpers/Dom/win';
8
- import { delay } from '../../../utils/utils';
9
- import { govHost } from '../../../helpers/Dom/template';
10
- import { govForm } from '../../../helpers/Dom/form';
1
+ import { Host, h } from "@stencil/core";
2
+ import { createID } from "../../../utils/string.utils";
3
+ import { validateProp } from "../../../helpers/Validate/props";
4
+ import { FormSwitchClass, FormSwitchSizes } from "./constants";
5
+ import { toBoolAttrIfDefined } from "../../../helpers/Dom/template";
6
+ import { validateWcagLabelFor, validateWcagRef } from "../../../helpers/Validate/wcag";
7
+ import { canValidateWcagOnRender } from "../../../helpers/Dom/win";
8
+ import { delay } from "../../../utils/utils";
9
+ import { govHost } from "../../../helpers/Dom/template";
10
+ import { govForm } from "../../../helpers/Dom/form";
11
+ import { FormLabelClass } from "../label/constants";
12
+ import Fragment from "../../../helpers/Fragment";
11
13
  export class GovFormSwitch {
12
14
  constructor() {
13
15
  this.value = undefined;
16
+ this.noLabel = false;
14
17
  this.checked = false;
15
18
  this.required = false;
16
19
  this.disabled = undefined;
17
20
  this.name = undefined;
18
- this.size = 'm';
21
+ this.size = "m";
19
22
  this.identifier = undefined;
20
23
  this.invalid = undefined;
21
24
  this.wcagDescribedBy = undefined;
22
25
  this.wcagLabelledBy = undefined;
23
26
  this.isChecked = undefined;
24
- this.checkboxId = createID('GovCheckbox');
27
+ this.checkboxId = createID("GovCheckbox");
25
28
  this.h = govHost(this.host);
26
29
  this.f = govForm(this.h);
27
30
  }
@@ -37,8 +40,8 @@ export class GovFormSwitch {
37
40
  }
38
41
  componentWillLoad() {
39
42
  this.isChecked = this.checked;
40
- this.f.passAttrToControl('type', 'switch');
41
- this.h.passChildAttr(FormSwitchClass.root, 'identifier', this.identifier || this.checkboxId);
43
+ this.f.passAttrToControl("type", "switch");
44
+ this.h.passChildAttr(FormLabelClass.root, "identifier", this.identifier || this.checkboxId);
42
45
  }
43
46
  async componentDidRender() {
44
47
  if (canValidateWcagOnRender()) {
@@ -48,12 +51,25 @@ export class GovFormSwitch {
48
51
  }
49
52
  render() {
50
53
  const { isChecked } = this;
51
- return (h(Host, { class: FormSwitchClass.root, "is-checked": isChecked, size: this.size, invalid: toBoolAttrIfDefined(this.invalid) }, h("div", { class: FormSwitchClass.holder }, h("input", { class: FormSwitchClass.input, id: this.identifier || this.checkboxId, type: "checkbox", value: this.value, name: this.name, checked: this.isChecked, onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, "aria-checked": this.isChecked, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) }), h("span", { class: FormSwitchClass.indicator }), h("slot", { name: "label" }))));
54
+ const wrapCheckbox = (children) => {
55
+ if (this.noLabel) {
56
+ return (h("label", null, children));
57
+ }
58
+ return children;
59
+ };
60
+ return (h(Host, { class: FormSwitchClass.root, "is-checked": isChecked, size: this.size, invalid: toBoolAttrIfDefined(this.invalid) }, h("div", { class: FormSwitchClass.holder }, wrapCheckbox(h(Fragment, null, h("input", { class: FormSwitchClass.input, id: this.identifier || this.checkboxId, type: "checkbox", value: this.value, name: this.name, checked: this.isChecked, onClick: this.onClickHandler.bind(this), onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), required: this.required, "aria-checked": this.isChecked, "aria-required": toBoolAttrIfDefined(this.required), "aria-invalid": toBoolAttrIfDefined(this.invalid), "aria-describedby": this.wcagDescribedBy, "aria-labelledby": this.wcagLabelledBy, "aria-disabled": toBoolAttrIfDefined(this.disabled) }), h("span", { class: FormSwitchClass.indicator }), h("slot", { name: "label" }))))));
61
+ }
62
+ onClickHandler(e) {
63
+ e.stopPropagation();
52
64
  }
53
65
  onFocusHandler(e) {
66
+ e.stopPropagation();
67
+ e.preventDefault();
54
68
  this.govFocus.emit(e);
55
69
  }
56
70
  onBlurHandler(e) {
71
+ e.stopPropagation();
72
+ e.preventDefault();
57
73
  this.govBlur.emit(e);
58
74
  }
59
75
  onChangeHandler(e) {
@@ -68,8 +84,8 @@ export class GovFormSwitch {
68
84
  * Validate the WCAG attributes of the component
69
85
  */
70
86
  async validateWcag() {
71
- validateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSwitchClass.root);
72
- validateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormSwitchClass.root);
87
+ validateWcagRef(this.wcagDescribedBy, "wcag-described-by", FormSwitchClass.root);
88
+ validateWcagRef(this.wcagLabelledBy, "wcag-labelled-by", FormSwitchClass.root);
73
89
  validateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormSwitchClass.root);
74
90
  }
75
91
  static get is() { return "gov-form-switch"; }
@@ -102,6 +118,24 @@ export class GovFormSwitch {
102
118
  "attribute": "value",
103
119
  "reflect": false
104
120
  },
121
+ "noLabel": {
122
+ "type": "boolean",
123
+ "mutable": false,
124
+ "complexType": {
125
+ "original": "boolean",
126
+ "resolved": "boolean",
127
+ "references": {}
128
+ },
129
+ "required": false,
130
+ "optional": false,
131
+ "docs": {
132
+ "tags": [],
133
+ "text": "When you can't use the form label."
134
+ },
135
+ "attribute": "no-label",
136
+ "reflect": false,
137
+ "defaultValue": "false"
138
+ },
105
139
  "checked": {
106
140
  "type": "boolean",
107
141
  "mutable": false,
@@ -193,7 +227,7 @@ export class GovFormSwitch {
193
227
  },
194
228
  "attribute": "size",
195
229
  "reflect": false,
196
- "defaultValue": "'m'"
230
+ "defaultValue": "\"m\""
197
231
  },
198
232
  "identifier": {
199
233
  "type": "string",
@@ -1 +1 @@
1
- {"version":3,"file":"gov-form-switch.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/switch/gov-form-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAgB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAuB,MAAM,aAAa,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,+B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Aa;IACnC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;EACtB,CAAC;EAEO,aAAa,CAAC,CAAa;IAClC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;EACrB,CAAC;EAEO,eAAe,CAAC,CAAQ;IAC/B,IAAI,CAAC,SAAS,GAAI,CAAC,CAAC,MAA2B,CAAC,OAAO,CAAA;IACvD,CAAC,CAAC,eAAe,EAAE,CAAA;IACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MACnB,OAAO,EAAE,IAAI,CAAC,SAAS;MACvB,KAAK,EAAE,IAAI,CAAC,KAAK;KACjB,CAAC,CAAA;EACH,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAChF,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAC9E,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;EACpG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Host, h, Prop, State, Event, EventEmitter, Element, Watch, Method } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { FormSwitchClass, FormSwitchSizes, FormSwitchSizesType } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { delay } from '../../../utils/utils'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govHost } from '../../../helpers/Dom/template'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { govForm } from '../../../helpers/Dom/form'\nimport { GovFormSwitchChangeEvent } from './interfaces'\n\n@Component({\n\ttag: 'gov-form-switch',\n\tstyleUrl: 'gov-form-switch.scss',\n})\nexport class GovFormSwitch {\n\tprivate h: GovHost\n\tprivate f: GovForm\n\n\tprivate readonly checkboxId: string\n\n\tconstructor() {\n\t\tthis.checkboxId = createID('GovCheckbox')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSwitchElement\n\t/**\n\t * Value of switch\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * Switch default state\n\t */\n\t@Prop({ reflect: true }) readonly checked: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the switch component disabled.\n\t * This prevents users from being able to interact with the switch, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the switch.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Switch's size.\n\t */\n\t@Prop() readonly size?: FormSwitchSizesType = 'm'\n\t/**\n\t * Custom switch identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: 'wcag-described-by' }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: 'wcag-labelled-by' }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the switch has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the switch loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the switch change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<GovFormSwitchChangeEvent>\n\n\t@State() isChecked: boolean\n\n\t@Watch('checked')\n\tupdateCheckedState(newValue: boolean): void {\n\t\tthis.isChecked = newValue\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSwitchSizes, newValue, FormSwitchClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.isChecked = this.checked\n\n\t\tthis.f.passAttrToControl('type', 'switch')\n\t\tthis.h.passChildAttr(FormSwitchClass.root, 'identifier', this.identifier || this.checkboxId)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { isChecked } = this\n\n\t\treturn (\n\t\t\t<Host class={FormSwitchClass.root} is-checked={isChecked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormSwitchClass.holder}>\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormSwitchClass.input}\n\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tchecked={this.isChecked}\n\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\taria-checked={this.isChecked}\n\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t/>\n\t\t\t\t\t<span class={FormSwitchClass.indicator}></span>\n\t\t\t\t\t<slot name=\"label\"></slot>\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.isChecked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSwitchClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormSwitchClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormSwitchClass.root)\n\t}\n}\n"]}
1
+ {"version":3,"file":"gov-form-switch.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/switch/gov-form-switch.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,S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E,CAAA;IACnB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MACnB,OAAO,EAAE,IAAI,CAAC,SAAS;MACvB,KAAK,EAAE,IAAI,CAAC,KAAK;KACjB,CAAC,CAAA;EACH,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAChF,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;IAC9E,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,EAAE,eAAe,CAAC,IAAI,CAAC,CAAA;EACpG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Host, h, Prop, State, Event, EventEmitter, Element, Watch, Method } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormSwitchClass, FormSwitchSizes, FormSwitchSizesType } from \"./constants\"\nimport { toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { govHost } from \"../../../helpers/Dom/template\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport { GovFormSwitchChangeEvent } from \"./interfaces\"\nimport { FormLabelClass } from \"../label/constants\"\nimport Fragment from \"../../../helpers/Fragment\"\n\n@Component({\n\ttag: \"gov-form-switch\",\n\tstyleUrl: \"gov-form-switch.scss\",\n})\nexport class GovFormSwitch {\n\tprivate h: GovHost\n\tprivate f: GovForm\n\n\tprivate readonly checkboxId: string\n\n\tconstructor() {\n\t\tthis.checkboxId = createID(\"GovCheckbox\")\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormSwitchElement\n\t/**\n\t * Value of switch\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * When you can't use the form label.\n\t */\n\t@Prop({ attribute: \"no-label\" }) readonly noLabel: boolean = false\n\t/**\n\t * Switch default state\n\t */\n\t@Prop({ reflect: true }) readonly checked: boolean = false\n\t/**\n\t * Set whether the input is required or not. Please note that this is necessary for accessible inputs when the user is required to fill them.\n\t * When using this property you need to also set “novalidate” attribute to your form element to prevent browser from displaying its own validation errors.\n\t */\n\t@Prop() readonly required: boolean = false\n\t/**\n\t * Makes the switch component disabled.\n\t * This prevents users from being able to interact with the switch, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the switch.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Switch's size.\n\t */\n\t@Prop() readonly size?: FormSwitchSizesType = \"m\"\n\t/**\n\t * Custom switch identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: string\n\t/**\n\t * Indicates the entered value does not conform to the format expected by the application.\n\t */\n\t@Prop() readonly invalid: boolean\n\t/**\n\t * Indicates the id of a component that describes the input.\n\t */\n\t@Prop({ attribute: \"wcag-described-by\" }) readonly wcagDescribedBy: string\n\t/**\n\t * Indicates the id of a component that labels the input.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Emitted when the switch has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the switch loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the switch change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<GovFormSwitchChangeEvent>\n\n\t@State() isChecked: boolean\n\n\t@Watch(\"checked\")\n\tupdateCheckedState(newValue: boolean): void {\n\t\tthis.isChecked = newValue\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormSwitchSizes, newValue, FormSwitchClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.isChecked = this.checked\n\n\t\tthis.f.passAttrToControl(\"type\", \"switch\")\n\t\tthis.h.passChildAttr(FormLabelClass.root, \"identifier\", this.identifier || this.checkboxId)\n\t}\n\n\tasync componentDidRender() {\n\t\tif (canValidateWcagOnRender()) {\n\t\t\tawait delay(500)\n\t\t\tawait this.validateWcag()\n\t\t}\n\t}\n\n\trender() {\n\t\tconst { isChecked } = this\n\t\tconst wrapCheckbox = (children) => {\n\t\t\tif (this.noLabel) {\n\t\t\t\treturn (\n\t\t\t\t\t<label>\n\t\t\t\t\t\t{children}\n\t\t\t\t\t</label>\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn children\n\t\t}\n\n\t\treturn (\n\t\t\t<Host class={FormSwitchClass.root} is-checked={isChecked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t<div class={FormSwitchClass.holder}>\n\t\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\tclass={FormSwitchClass.input}\n\t\t\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\t\tchecked={this.isChecked}\n\t\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\t\taria-checked={this.isChecked}\n\t\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<span class={FormSwitchClass.indicator}></span>\n\t\t\t\t\t\t\t<slot name=\"label\"></slot>\n\t\t\t\t\t\t</Fragment>,\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: Event) {\n\t\te.stopPropagation()\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.isChecked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tchecked: this.isChecked,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\t/**\n\t * Validate the WCAG attributes of the component\n\t */\n\t@Method()\n\tasync validateWcag(): Promise<void> {\n\t\tvalidateWcagRef(this.wcagDescribedBy, \"wcag-described-by\", FormSwitchClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormSwitchClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormSwitchClass.root)\n\t}\n}\n"]}
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */
@@ -148,6 +148,9 @@
148
148
  /*
149
149
  - Variables - Form multiselect
150
150
  */
151
+ /*
152
+ - Variables - Form password power
153
+ */
151
154
  /*
152
155
  - Variables - Form checkbox & radio
153
156
  */