@gov-design-system-ce/components 0.0.16 → 0.0.18

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 (280) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/gov-accordion-item.cjs.entry.js +5 -1
  3. package/dist/cjs/gov-accordion-item.cjs.entry.js.map +1 -1
  4. package/dist/cjs/gov-accordion.cjs.entry.js +5 -1
  5. package/dist/cjs/gov-accordion.cjs.entry.js.map +1 -1
  6. package/dist/cjs/gov-app.cjs.entry.js +11 -8
  7. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  8. package/dist/cjs/gov-backdrop.cjs.entry.js +0 -4
  9. package/dist/cjs/gov-backdrop.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-button.cjs.entry.js +28 -14
  11. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +33 -14
  13. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-form-checkbox.cjs.entry.js +25 -18
  15. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-form-file.cjs.entry.js +57 -27
  17. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-form-input.cjs.entry.js +21 -5
  19. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-form-multi-select.cjs.entry.js +30 -19
  21. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-form-radio.cjs.entry.js +23 -16
  23. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  24. package/dist/cjs/gov-form-select.cjs.entry.js +27 -15
  25. package/dist/cjs/gov-form-select.cjs.entry.js.map +1 -1
  26. package/dist/cjs/gov-form-switch.cjs.entry.js +23 -16
  27. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  28. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  29. package/dist/cjs/gov-loading.cjs.entry.js +1 -1
  30. package/dist/cjs/gov-loading.cjs.entry.js.map +1 -1
  31. package/dist/cjs/gov-modal.cjs.entry.js +1 -1
  32. package/dist/cjs/gov-modal.cjs.entry.js.map +1 -1
  33. package/dist/cjs/gov-pagination.cjs.entry.js +18 -10
  34. package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
  35. package/dist/cjs/gov-prompt.cjs.entry.js +8 -8
  36. package/dist/cjs/gov-prompt.cjs.entry.js.map +1 -1
  37. package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
  38. package/dist/cjs/loader.cjs.js +1 -1
  39. package/dist/collection/components/gov-accordion/gov-accordion-item.js +9 -5
  40. package/dist/collection/components/gov-accordion/gov-accordion-item.js.map +1 -1
  41. package/dist/collection/components/gov-accordion/gov-accordion.js +9 -5
  42. package/dist/collection/components/gov-accordion/gov-accordion.js.map +1 -1
  43. package/dist/collection/components/gov-accordion/gov-accordion.types.js +2 -0
  44. package/dist/collection/components/gov-accordion/gov-accordion.types.js.map +1 -0
  45. package/dist/collection/components/gov-backdrop/gov-backdrop.js +0 -22
  46. package/dist/collection/components/gov-backdrop/gov-backdrop.js.map +1 -1
  47. package/dist/collection/components/gov-button/gov-button.css +2 -2
  48. package/dist/collection/components/gov-button/gov-button.js +54 -37
  49. package/dist/collection/components/gov-button/gov-button.js.map +1 -1
  50. package/dist/collection/components/gov-button/gov-button.types.js +2 -0
  51. package/dist/collection/components/gov-button/gov-button.types.js.map +1 -0
  52. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +60 -38
  53. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  54. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.types.js.map +1 -1
  55. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +60 -39
  56. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  57. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.types.js +2 -0
  58. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.types.js.map +1 -0
  59. package/dist/collection/components/gov-form/file/gov-form-file.js +129 -59
  60. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  61. package/dist/collection/components/gov-form/file/gov-form-file.types.js.map +1 -1
  62. package/dist/collection/components/gov-form/input/gov-form-input.js +42 -22
  63. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  64. package/dist/collection/components/gov-form/input/gov-form-input.types.js +2 -0
  65. package/dist/collection/components/gov-form/input/gov-form-input.types.js.map +1 -0
  66. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +53 -40
  67. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  68. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.types.js +2 -0
  69. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.types.js.map +1 -0
  70. package/dist/collection/components/gov-form/radio/gov-form-radio.js +57 -36
  71. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  72. package/dist/collection/components/gov-form/radio/gov-form-radio.types.js +2 -0
  73. package/dist/collection/components/gov-form/radio/gov-form-radio.types.js.map +1 -0
  74. package/dist/collection/components/gov-form/select/gov-form-select.js +56 -37
  75. package/dist/collection/components/gov-form/select/gov-form-select.js.map +1 -1
  76. package/dist/collection/components/gov-form/select/gov-form-select.types.js +2 -0
  77. package/dist/collection/components/gov-form/select/gov-form-select.types.js.map +1 -0
  78. package/dist/collection/components/gov-form/switch/gov-form-switch.js +57 -36
  79. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  80. package/dist/collection/components/gov-form/switch/gov-form-switch.types.js +2 -0
  81. package/dist/collection/components/gov-form/switch/gov-form-switch.types.js.map +1 -0
  82. package/dist/collection/components/gov-loading/loading/gov-loading.js +1 -1
  83. package/dist/collection/components/gov-loading/loading/gov-loading.js.map +1 -1
  84. package/dist/collection/components/gov-modal/gov-modal.js +1 -1
  85. package/dist/collection/components/gov-modal/gov-modal.js.map +1 -1
  86. package/dist/collection/components/gov-pagination/gov-pagination.js +16 -13
  87. package/dist/collection/components/gov-pagination/gov-pagination.js.map +1 -1
  88. package/dist/collection/components/gov-pagination/gov-pagination.types.js +2 -0
  89. package/dist/collection/components/gov-pagination/gov-pagination.types.js.map +1 -0
  90. package/dist/collection/components/gov-promp/gov-prompt.js +18 -18
  91. package/dist/collection/components/gov-promp/gov-prompt.js.map +1 -1
  92. package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
  93. package/dist/collection/pages/Forms.js +3 -0
  94. package/dist/collection/pages/Forms.js.map +1 -1
  95. package/dist/collection/pages/Pagination.js +8 -8
  96. package/dist/collection/pages/Pagination.js.map +1 -1
  97. package/dist/collection/types/event.types.js +2 -0
  98. package/dist/collection/types/event.types.js.map +1 -0
  99. package/dist/collection/utils/array.utils.js +6 -1
  100. package/dist/collection/utils/array.utils.js.map +1 -1
  101. package/dist/components/gov-accordion-item.js +5 -1
  102. package/dist/components/gov-accordion-item.js.map +1 -1
  103. package/dist/components/gov-accordion.js +5 -1
  104. package/dist/components/gov-accordion.js.map +1 -1
  105. package/dist/components/gov-app.js +11 -8
  106. package/dist/components/gov-app.js.map +1 -1
  107. package/dist/components/gov-backdrop2.js +0 -5
  108. package/dist/components/gov-backdrop2.js.map +1 -1
  109. package/dist/components/gov-button2.js +28 -14
  110. package/dist/components/gov-button2.js.map +1 -1
  111. package/dist/components/gov-form-autocomplete2.js +33 -14
  112. package/dist/components/gov-form-autocomplete2.js.map +1 -1
  113. package/dist/components/gov-form-checkbox.js +27 -20
  114. package/dist/components/gov-form-checkbox.js.map +1 -1
  115. package/dist/components/gov-form-file.js +59 -27
  116. package/dist/components/gov-form-file.js.map +1 -1
  117. package/dist/components/gov-form-input2.js +22 -6
  118. package/dist/components/gov-form-input2.js.map +1 -1
  119. package/dist/components/gov-form-multi-select.js +30 -19
  120. package/dist/components/gov-form-multi-select.js.map +1 -1
  121. package/dist/components/gov-form-radio.js +25 -18
  122. package/dist/components/gov-form-radio.js.map +1 -1
  123. package/dist/components/gov-form-select2.js +28 -16
  124. package/dist/components/gov-form-select2.js.map +1 -1
  125. package/dist/components/gov-form-switch.js +25 -18
  126. package/dist/components/gov-form-switch.js.map +1 -1
  127. package/dist/components/gov-icon2.js +1 -1
  128. package/dist/components/gov-loading.js +1 -1
  129. package/dist/components/gov-loading.js.map +1 -1
  130. package/dist/components/gov-modal.js +1 -1
  131. package/dist/components/gov-modal.js.map +1 -1
  132. package/dist/components/gov-pagination.js +18 -10
  133. package/dist/components/gov-pagination.js.map +1 -1
  134. package/dist/components/gov-prompt.js +8 -8
  135. package/dist/components/gov-prompt.js.map +1 -1
  136. package/dist/components/gov-tile.js.map +1 -1
  137. package/dist/core/core.esm.js +1 -1
  138. package/dist/core/core.esm.js.map +1 -1
  139. package/dist/core/p-26260897.entry.js +2 -0
  140. package/dist/core/p-26260897.entry.js.map +1 -0
  141. package/dist/core/{p-30b162df.entry.js → p-354c6a6d.entry.js} +2 -2
  142. package/dist/core/p-354c6a6d.entry.js.map +1 -0
  143. package/dist/core/{p-e6b8c610.entry.js → p-3a50ac4c.entry.js} +2 -2
  144. package/dist/core/p-3a50ac4c.entry.js.map +1 -0
  145. package/dist/core/p-52f2f67c.entry.js +2 -0
  146. package/dist/core/p-52f2f67c.entry.js.map +1 -0
  147. package/dist/core/{p-e3141382.entry.js → p-5e5e925d.entry.js} +2 -2
  148. package/dist/core/p-5e5e925d.entry.js.map +1 -0
  149. package/dist/core/p-67006730.entry.js.map +1 -1
  150. package/dist/core/p-724921e7.entry.js +2 -0
  151. package/dist/core/p-724921e7.entry.js.map +1 -0
  152. package/dist/core/{p-d2f6053f.entry.js → p-8b2a6f87.entry.js} +2 -2
  153. package/dist/core/p-8b2a6f87.entry.js.map +1 -0
  154. package/dist/core/{p-9bdce72b.entry.js → p-8feb8960.entry.js} +2 -2
  155. package/dist/core/p-8feb8960.entry.js.map +1 -0
  156. package/dist/core/{p-f027a1a1.entry.js → p-a37ef1b2.entry.js} +2 -2
  157. package/dist/core/{p-bce96aac.entry.js → p-b2d1dd2a.entry.js} +2 -2
  158. package/dist/core/p-b2d1dd2a.entry.js.map +1 -0
  159. package/dist/core/{p-131c50d1.entry.js → p-b9b80796.entry.js} +2 -2
  160. package/dist/core/p-b9b80796.entry.js.map +1 -0
  161. package/dist/core/{p-b7587525.entry.js → p-bb3afae6.entry.js} +2 -2
  162. package/dist/core/p-bb3afae6.entry.js.map +1 -0
  163. package/dist/core/{p-c91928ed.entry.js → p-be799dfa.entry.js} +2 -2
  164. package/dist/core/p-be799dfa.entry.js.map +1 -0
  165. package/dist/core/{p-2426fa82.entry.js → p-c970a479.entry.js} +2 -2
  166. package/dist/core/p-c970a479.entry.js.map +1 -0
  167. package/dist/core/{p-471c0863.entry.js → p-cba27477.entry.js} +2 -2
  168. package/dist/core/p-cba27477.entry.js.map +1 -0
  169. package/dist/core/{p-93edcce2.entry.js → p-d79d0f7a.entry.js} +2 -2
  170. package/dist/core/p-d79d0f7a.entry.js.map +1 -0
  171. package/dist/core/{p-c836f7cd.entry.js → p-e51baf04.entry.js} +2 -2
  172. package/dist/core/p-e51baf04.entry.js.map +1 -0
  173. package/dist/core/{p-0272ffa0.entry.js → p-f73d482b.entry.js} +2 -2
  174. package/dist/core/p-f73d482b.entry.js.map +1 -0
  175. package/dist/custom-elements/index.js +1 -1
  176. package/dist/custom-elements/index.js.map +1 -1
  177. package/dist/esm/core.js +1 -1
  178. package/dist/esm/gov-accordion-item.entry.js +5 -1
  179. package/dist/esm/gov-accordion-item.entry.js.map +1 -1
  180. package/dist/esm/gov-accordion.entry.js +5 -1
  181. package/dist/esm/gov-accordion.entry.js.map +1 -1
  182. package/dist/esm/gov-app.entry.js +11 -8
  183. package/dist/esm/gov-app.entry.js.map +1 -1
  184. package/dist/esm/gov-backdrop.entry.js +0 -4
  185. package/dist/esm/gov-backdrop.entry.js.map +1 -1
  186. package/dist/esm/gov-button.entry.js +28 -14
  187. package/dist/esm/gov-button.entry.js.map +1 -1
  188. package/dist/esm/gov-form-autocomplete.entry.js +33 -14
  189. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  190. package/dist/esm/gov-form-checkbox.entry.js +25 -18
  191. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  192. package/dist/esm/gov-form-file.entry.js +57 -27
  193. package/dist/esm/gov-form-file.entry.js.map +1 -1
  194. package/dist/esm/gov-form-input.entry.js +21 -5
  195. package/dist/esm/gov-form-input.entry.js.map +1 -1
  196. package/dist/esm/gov-form-multi-select.entry.js +30 -19
  197. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  198. package/dist/esm/gov-form-radio.entry.js +23 -16
  199. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  200. package/dist/esm/gov-form-select.entry.js +27 -15
  201. package/dist/esm/gov-form-select.entry.js.map +1 -1
  202. package/dist/esm/gov-form-switch.entry.js +23 -16
  203. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  204. package/dist/esm/gov-icon.entry.js +1 -1
  205. package/dist/esm/gov-loading.entry.js +1 -1
  206. package/dist/esm/gov-loading.entry.js.map +1 -1
  207. package/dist/esm/gov-modal.entry.js +1 -1
  208. package/dist/esm/gov-modal.entry.js.map +1 -1
  209. package/dist/esm/gov-pagination.entry.js +18 -10
  210. package/dist/esm/gov-pagination.entry.js.map +1 -1
  211. package/dist/esm/gov-prompt.entry.js +8 -8
  212. package/dist/esm/gov-prompt.entry.js.map +1 -1
  213. package/dist/esm/gov-tile.entry.js.map +1 -1
  214. package/dist/esm/loader.js +1 -1
  215. package/dist/hydrate/index.js +326 -187
  216. package/dist/stencil.config.js +1 -1
  217. package/dist/stencil.config.js.map +1 -1
  218. package/dist/types/components/gov-accordion/gov-accordion-item.d.ts +2 -2
  219. package/dist/types/components/gov-accordion/gov-accordion.d.ts +2 -2
  220. package/dist/types/components/gov-accordion/gov-accordion.types.d.ts +9 -0
  221. package/dist/types/components/gov-backdrop/gov-backdrop.d.ts +0 -4
  222. package/dist/types/components/gov-button/gov-button.d.ts +6 -5
  223. package/dist/types/components/gov-button/gov-button.types.d.ts +4 -0
  224. package/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.d.ts +8 -8
  225. package/dist/types/components/gov-form/autocomplete/gov-form-autocomplete.types.d.ts +6 -0
  226. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +11 -8
  227. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.types.d.ts +5 -0
  228. package/dist/types/components/gov-form/file/gov-form-file.d.ts +16 -8
  229. package/dist/types/components/gov-form/file/gov-form-file.types.d.ts +5 -0
  230. package/dist/types/components/gov-form/input/gov-form-input.d.ts +6 -5
  231. package/dist/types/components/gov-form/input/gov-form-input.types.d.ts +4 -0
  232. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.d.ts +6 -6
  233. package/dist/types/components/gov-form/multiselect/gov-form-multi-select.types.d.ts +8 -0
  234. package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +10 -7
  235. package/dist/types/components/gov-form/radio/gov-form-radio.types.d.ts +5 -0
  236. package/dist/types/components/gov-form/select/gov-form-select.d.ts +7 -6
  237. package/dist/types/components/gov-form/select/gov-form-select.types.d.ts +4 -0
  238. package/dist/types/components/gov-form/switch/gov-form-switch.d.ts +10 -7
  239. package/dist/types/components/gov-form/switch/gov-form-switch.types.d.ts +5 -0
  240. package/dist/types/components/gov-pagination/gov-pagination.d.ts +2 -1
  241. package/dist/types/components/gov-pagination/gov-pagination.types.d.ts +5 -0
  242. package/dist/types/components.d.ts +69 -54
  243. package/dist/types/types/event.types.d.ts +4 -0
  244. package/package.json +1 -1
  245. package/dist/collection/components/gov-accordion/gov-accordion-item.d.js +0 -2
  246. package/dist/collection/components/gov-accordion/gov-accordion-item.d.js.map +0 -1
  247. package/dist/collection/components/gov-form/checkbox/interfaces.js +0 -2
  248. package/dist/collection/components/gov-form/checkbox/interfaces.js.map +0 -1
  249. package/dist/collection/components/gov-form/multiselect/interfaces.js +0 -2
  250. package/dist/collection/components/gov-form/multiselect/interfaces.js.map +0 -1
  251. package/dist/collection/components/gov-form/radio/interfaces.js +0 -2
  252. package/dist/collection/components/gov-form/radio/interfaces.js.map +0 -1
  253. package/dist/collection/components/gov-form/switch/interfaces.js +0 -2
  254. package/dist/collection/components/gov-form/switch/interfaces.js.map +0 -1
  255. package/dist/core/p-0272ffa0.entry.js.map +0 -1
  256. package/dist/core/p-131c50d1.entry.js.map +0 -1
  257. package/dist/core/p-2426fa82.entry.js.map +0 -1
  258. package/dist/core/p-30b162df.entry.js.map +0 -1
  259. package/dist/core/p-337fb136.entry.js +0 -2
  260. package/dist/core/p-337fb136.entry.js.map +0 -1
  261. package/dist/core/p-402c2751.entry.js +0 -2
  262. package/dist/core/p-402c2751.entry.js.map +0 -1
  263. package/dist/core/p-405fc50f.entry.js +0 -2
  264. package/dist/core/p-405fc50f.entry.js.map +0 -1
  265. package/dist/core/p-471c0863.entry.js.map +0 -1
  266. package/dist/core/p-93edcce2.entry.js.map +0 -1
  267. package/dist/core/p-9bdce72b.entry.js.map +0 -1
  268. package/dist/core/p-b7587525.entry.js.map +0 -1
  269. package/dist/core/p-bce96aac.entry.js.map +0 -1
  270. package/dist/core/p-c836f7cd.entry.js.map +0 -1
  271. package/dist/core/p-c91928ed.entry.js.map +0 -1
  272. package/dist/core/p-d2f6053f.entry.js.map +0 -1
  273. package/dist/core/p-e3141382.entry.js.map +0 -1
  274. package/dist/core/p-e6b8c610.entry.js.map +0 -1
  275. package/dist/types/components/gov-accordion/gov-accordion-item.d.d.ts +0 -4
  276. package/dist/types/components/gov-form/checkbox/interfaces.d.ts +0 -4
  277. package/dist/types/components/gov-form/multiselect/interfaces.d.ts +0 -4
  278. package/dist/types/components/gov-form/radio/interfaces.d.ts +0 -4
  279. package/dist/types/components/gov-form/switch/interfaces.d.ts +0 -4
  280. /package/dist/core/{p-f027a1a1.entry.js.map → p-a37ef1b2.entry.js.map} +0 -0
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gov-form-multi-select.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gov-form-multi-select.types.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/multiselect/gov-form-multi-select.types.ts"],"names":[],"mappings":"","sourcesContent":["import { GovBaseEvent } from \"../../../types/event.types\"\n\nexport interface GovFormMultiSelectItem {\n\tname: string\n\tvalue: string\n}\n\nexport interface FormMultiselectEvent extends GovBaseEvent {\n\tvalue: GovFormMultiSelectItem[]\n}\n"]}
@@ -22,23 +22,14 @@ export class GovFormRadio {
22
22
  this.invalid = undefined;
23
23
  this.wcagDescribedBy = undefined;
24
24
  this.wcagLabelledBy = undefined;
25
- this.isChecked = undefined;
26
25
  this.radioId = createID('GovRadio');
27
26
  this.h = govHost(this.host);
28
27
  this.f = govForm(this.h);
29
28
  }
30
- updateCheckedState(newValue) {
31
- this.isChecked = newValue;
32
- this.govChange.emit({
33
- checked: this.isChecked,
34
- value: this.value,
35
- });
36
- }
37
29
  validateSize(newValue) {
38
30
  validateProp(FormRadioSizes, newValue, FormRadioClass.root);
39
31
  }
40
32
  componentWillLoad() {
41
- this.isChecked = this.checked;
42
33
  this.f.passAttrToControl('type', 'radio');
43
34
  }
44
35
  async componentDidRender() {
@@ -50,34 +41,51 @@ export class GovFormRadio {
50
41
  }
51
42
  }
52
43
  render() {
53
- const { isChecked } = this;
54
44
  const wrapCheckbox = (children) => {
55
45
  if (this.noLabel) {
56
46
  return (h("label", null, children));
57
47
  }
58
48
  return children;
59
49
  };
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" })))))));
50
+ return (h(Host, { class: FormRadioClass.root, checked: this.checked, 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.checked, onClick: this.onClickHandler.bind(this), onChange: this.onChangeHandler.bind(this), onFocus: this.onFocusHandler.bind(this), onBlur: this.onBlurHandler.bind(this), ref: el => (this.inputRef = el), required: this.required, "aria-checked": this.checked, "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" })))))));
61
51
  }
62
52
  onClickHandler(e) {
63
53
  e.stopPropagation();
64
54
  }
65
55
  onFocusHandler(e) {
66
56
  e.stopPropagation();
67
- this.govFocus.emit(e);
57
+ this.govFocus.emit({
58
+ component: FormRadioClass.root,
59
+ value: this.value,
60
+ checked: this.checked,
61
+ originalEvent: e,
62
+ });
68
63
  }
69
64
  onBlurHandler(e) {
70
65
  e.stopPropagation();
71
- this.govBlur.emit(e);
66
+ this.govBlur.emit({
67
+ component: FormRadioClass.root,
68
+ value: this.value,
69
+ checked: this.checked,
70
+ originalEvent: e,
71
+ });
72
72
  }
73
73
  onChangeHandler(e) {
74
- this.isChecked = e.target.checked;
74
+ this.checked = e.target.checked;
75
75
  e.stopPropagation();
76
76
  this.govChange.emit({
77
- checked: this.isChecked,
77
+ component: FormRadioClass.root,
78
78
  value: this.value,
79
+ checked: this.checked,
80
+ originalEvent: e,
79
81
  });
80
82
  }
83
+ /**
84
+ * Returns the reference of the native element
85
+ */
86
+ async getRef() {
87
+ return this.inputRef;
88
+ }
81
89
  /**
82
90
  * Validate the WCAG attributes of the component
83
91
  */
@@ -136,7 +144,7 @@ export class GovFormRadio {
136
144
  },
137
145
  "checked": {
138
146
  "type": "boolean",
139
- "mutable": false,
147
+ "mutable": true,
140
148
  "complexType": {
141
149
  "original": "boolean",
142
150
  "resolved": "boolean",
@@ -297,11 +305,6 @@ export class GovFormRadio {
297
305
  }
298
306
  };
299
307
  }
300
- static get states() {
301
- return {
302
- "isChecked": {}
303
- };
304
- }
305
308
  static get events() {
306
309
  return [{
307
310
  "method": "govFocus",
@@ -314,11 +317,12 @@ export class GovFormRadio {
314
317
  "text": "Emitted when the radio has focus."
315
318
  },
316
319
  "complexType": {
317
- "original": "FocusEvent",
318
- "resolved": "FocusEvent",
320
+ "original": "FormRadioEvent",
321
+ "resolved": "FormRadioEvent",
319
322
  "references": {
320
- "FocusEvent": {
321
- "location": "global"
323
+ "FormRadioEvent": {
324
+ "location": "import",
325
+ "path": "./gov-form-radio.types"
322
326
  }
323
327
  }
324
328
  }
@@ -333,11 +337,12 @@ export class GovFormRadio {
333
337
  "text": "Emitted when the radio loses focus."
334
338
  },
335
339
  "complexType": {
336
- "original": "FocusEvent",
337
- "resolved": "FocusEvent",
340
+ "original": "FormRadioEvent",
341
+ "resolved": "FormRadioEvent",
338
342
  "references": {
339
- "FocusEvent": {
340
- "location": "global"
343
+ "FormRadioEvent": {
344
+ "location": "import",
345
+ "path": "./gov-form-radio.types"
341
346
  }
342
347
  }
343
348
  }
@@ -352,12 +357,12 @@ export class GovFormRadio {
352
357
  "text": "Emitted when the radio change value."
353
358
  },
354
359
  "complexType": {
355
- "original": "GovFormRadioChangeEvent",
356
- "resolved": "GovFormRadioChangeEvent",
360
+ "original": "FormRadioEvent",
361
+ "resolved": "FormRadioEvent",
357
362
  "references": {
358
- "GovFormRadioChangeEvent": {
363
+ "FormRadioEvent": {
359
364
  "location": "import",
360
- "path": "./interfaces"
365
+ "path": "./gov-form-radio.types"
361
366
  }
362
367
  }
363
368
  }
@@ -365,6 +370,25 @@ export class GovFormRadio {
365
370
  }
366
371
  static get methods() {
367
372
  return {
373
+ "getRef": {
374
+ "complexType": {
375
+ "signature": "() => Promise<HTMLInputElement>",
376
+ "parameters": [],
377
+ "references": {
378
+ "Promise": {
379
+ "location": "global"
380
+ },
381
+ "HTMLInputElement": {
382
+ "location": "global"
383
+ }
384
+ },
385
+ "return": "Promise<HTMLInputElement>"
386
+ },
387
+ "docs": {
388
+ "text": "Returns the reference of the native element",
389
+ "tags": []
390
+ }
391
+ },
368
392
  "validateWcag": {
369
393
  "complexType": {
370
394
  "signature": "() => Promise<void>",
@@ -386,9 +410,6 @@ export class GovFormRadio {
386
410
  static get elementRef() { return "host"; }
387
411
  static get watchers() {
388
412
  return [{
389
- "propName": "checked",
390
- "methodName": "updateCheckedState"
391
- }, {
392
413
  "propName": "size",
393
414
  "methodName": "validateSize"
394
415
  }];
@@ -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,EA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,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 { 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 readonly 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}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel('identifier', this.identifier || this.radioId)\n\t\tthis.f.passAttrToLabel('required', String(this.required))\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\" />\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\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\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,EAAgB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACrG,OAAO,EAAE,QAAQ,EAAE,MAAM,6BA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;EACH,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,MAAM;IACX,OAAO,IAAI,CAAC,QAAQ,CAAA;EACrB,CAAC;EAED;;KAEG;EAEH,KAAK,CAAC,YAAY;IACjB,eAAe,CAAC,IAAI,CAAC,eAAe,EAAE,mBAAmB,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA;IAC/E,eAAe,CAAC,IAAI,CAAC,cAAc,EAAE,kBAAkB,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA;IAC7E,oBAAoB,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,cAAc,EAAE,cAAc,CAAC,IAAI,CAAC,CAAA;EAChG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Host, h, Prop, 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 Fragment from \"../../../helpers/Fragment\"\nimport { FormRadioEvent } from \"./gov-form-radio.types\"\n\n@Component({\n\ttag: 'gov-form-radio',\n\tstyleUrl: 'gov-form-radio.scss',\n})\nexport class GovFormRadio {\n\tprivate readonly h: GovHost\n\tprivate f: GovForm\n\tprivate inputRef?: HTMLInputElement\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, mutable: true }) checked = 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<FormRadioEvent>\n\t/**\n\t * Emitted when the radio loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FormRadioEvent>\n\t/**\n\t * Emitted when the radio change value.\n\t */\n\t@Event({ eventName: 'gov-change' }) govChange: EventEmitter<FormRadioEvent>\n\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.f.passAttrToControl('type', 'radio')\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel('identifier', this.identifier || this.radioId)\n\t\tthis.f.passAttrToLabel('required', String(this.required))\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 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} checked={this.checked} 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.checked}\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\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\t\taria-checked={this.checked}\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\" />\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\tthis.govFocus.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\tprivate onChangeHandler(e: Event) {\n\t\tthis.checked = (e.target as HTMLInputElement).checked\n\t\te.stopPropagation()\n\t\tthis.govChange.emit({\n\t\t\tcomponent: FormRadioClass.root,\n\t\t\tvalue: this.value,\n\t\t\tchecked: this.checked,\n\t\t\toriginalEvent: e,\n\t\t})\n\t}\n\n\t/**\n\t * Returns the reference of the native element\n\t */\n\t@Method()\n\tasync getRef(): Promise<HTMLInputElement> {\n\t\treturn this.inputRef\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"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gov-form-radio.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gov-form-radio.types.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/radio/gov-form-radio.types.ts"],"names":[],"mappings":"","sourcesContent":["import { GovBaseEvent } from \"../../../types/event.types\"\n\nexport interface FormRadioEvent extends GovBaseEvent {\n\tchecked: boolean,\n\tvalue: string\n}\n"]}
@@ -1,18 +1,18 @@
1
- import { h, Host } from '@stencil/core';
2
- import { toBoolAttrIfDefined, govHost } from '../../../helpers/Dom/template';
3
- import { FormSelectVariants, FormSelectClass, FormSelectSizes } from './constants';
4
- import { validateProp } from '../../../helpers/Validate/props';
5
- import { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag';
6
- import { canValidateWcagOnRender } from '../../../helpers/Dom/win';
7
- import { createID } from '../../../utils/string.utils';
8
- import { delay } from '../../../utils/utils';
9
- import { govForm } from '../../../helpers/Dom/form';
1
+ import { h, Host } from "@stencil/core";
2
+ import { toBoolAttrIfDefined, govHost } from "../../../helpers/Dom/template";
3
+ import { FormSelectVariants, FormSelectClass, FormSelectSizes, } from "./constants";
4
+ import { validateProp } from "../../../helpers/Validate/props";
5
+ import { validateWcagLabelFor, validateWcagRef } from "../../../helpers/Validate/wcag";
6
+ import { canValidateWcagOnRender } from "../../../helpers/Dom/win";
7
+ import { createID } from "../../../utils/string.utils";
8
+ import { delay } from "../../../utils/utils";
9
+ import { govForm } from "../../../helpers/Dom/form";
10
10
  export class GovFormSelect {
11
11
  constructor() {
12
12
  this.value = undefined;
13
13
  this.identifier = undefined;
14
14
  this.variant = undefined;
15
- this.size = 'm';
15
+ this.size = "m";
16
16
  this.name = undefined;
17
17
  this.required = false;
18
18
  this.disabled = undefined;
@@ -24,7 +24,7 @@ export class GovFormSelect {
24
24
  this.wcagOwns = undefined;
25
25
  this.focused = undefined;
26
26
  this.h = govHost(this.host);
27
- this.selectId = createID('GovSelect');
27
+ this.selectId = createID("GovSelect");
28
28
  this.f = govForm(govHost(this.host));
29
29
  }
30
30
  validateVariant(newValue) {
@@ -36,13 +36,13 @@ export class GovFormSelect {
36
36
  componentWillLoad() {
37
37
  this.validateVariant(this.variant);
38
38
  this.validateSize(this.size);
39
- this.host.querySelectorAll('option').forEach((option) => {
39
+ this.host.querySelectorAll("option").forEach((option) => {
40
40
  if (option.value === this.value) {
41
- option.setAttribute('selected', 'true');
41
+ option.setAttribute("selected", "true");
42
42
  }
43
43
  });
44
- this.f.passAttrToControl('type', 'select');
45
- this.f.passAttrToLabel('required', String(this.required));
44
+ this.f.passAttrToControl("type", "select");
45
+ this.f.passAttrToLabel("required", String(this.required));
46
46
  }
47
47
  async componentDidRender() {
48
48
  if (canValidateWcagOnRender()) {
@@ -51,20 +51,32 @@ export class GovFormSelect {
51
51
  }
52
52
  }
53
53
  render() {
54
- 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
+ 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" })));
55
55
  }
56
56
  onFocusHandler(e) {
57
57
  this.focused = true;
58
- this.govFocus.emit(e);
58
+ this.govFocus.emit({
59
+ component: FormSelectClass.root,
60
+ originalEvent: e,
61
+ value: this.value,
62
+ });
59
63
  }
60
64
  onBlurHandler(e) {
61
65
  this.focused = false;
62
- this.govBlur.emit(e);
66
+ this.govBlur.emit({
67
+ component: FormSelectClass.root,
68
+ originalEvent: e,
69
+ value: this.value,
70
+ });
63
71
  }
64
72
  onChangeHandler(e) {
65
73
  this.value = e.target.value;
66
74
  e.stopPropagation();
67
- this.govChange.emit(e.target);
75
+ this.govChange.emit({
76
+ component: FormSelectClass.root,
77
+ originalEvent: e,
78
+ value: this.value,
79
+ });
68
80
  }
69
81
  /**
70
82
  * Returns the current state of the component
@@ -81,17 +93,17 @@ export class GovFormSelect {
81
93
  /**
82
94
  * Returns an instance of the native html select element
83
95
  */
84
- async getInstance() {
96
+ async getRef() {
85
97
  return this.selectRef;
86
98
  }
87
99
  /**
88
100
  * Validate the WCAG attributes of the component
89
101
  */
90
102
  async validateWcag() {
91
- validateWcagRef(this.wcagActiveDescendant, 'wcag-active-descendant', FormSelectClass.root);
92
- validateWcagRef(this.wcagControls, 'wcag-controls', FormSelectClass.root);
93
- validateWcagRef(this.wcagDescribedBy, 'wcag-described-by', FormSelectClass.root);
94
- validateWcagRef(this.wcagOwns, 'wcag-owns', FormSelectClass.root);
103
+ validateWcagRef(this.wcagActiveDescendant, "wcag-active-descendant", FormSelectClass.root);
104
+ validateWcagRef(this.wcagControls, "wcag-controls", FormSelectClass.root);
105
+ validateWcagRef(this.wcagDescribedBy, "wcag-described-by", FormSelectClass.root);
106
+ validateWcagRef(this.wcagOwns, "wcag-owns", FormSelectClass.root);
95
107
  validateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormSelectClass.root);
96
108
  }
97
109
  static get is() { return "gov-form-select"; }
@@ -184,7 +196,7 @@ export class GovFormSelect {
184
196
  },
185
197
  "attribute": "size",
186
198
  "reflect": false,
187
- "defaultValue": "'m'"
199
+ "defaultValue": "\"m\""
188
200
  },
189
201
  "name": {
190
202
  "type": "string",
@@ -359,11 +371,12 @@ export class GovFormSelect {
359
371
  "text": "Emitted when the select has focus."
360
372
  },
361
373
  "complexType": {
362
- "original": "FocusEvent",
363
- "resolved": "FocusEvent",
374
+ "original": "FormSelectEvent",
375
+ "resolved": "FormSelectEvent",
364
376
  "references": {
365
- "FocusEvent": {
366
- "location": "global"
377
+ "FormSelectEvent": {
378
+ "location": "import",
379
+ "path": "./gov-form-select.types"
367
380
  }
368
381
  }
369
382
  }
@@ -378,11 +391,12 @@ export class GovFormSelect {
378
391
  "text": "Emitted when the select loses focus."
379
392
  },
380
393
  "complexType": {
381
- "original": "FocusEvent",
382
- "resolved": "FocusEvent",
394
+ "original": "FormSelectEvent",
395
+ "resolved": "FormSelectEvent",
383
396
  "references": {
384
- "FocusEvent": {
385
- "location": "global"
397
+ "FormSelectEvent": {
398
+ "location": "import",
399
+ "path": "./gov-form-select.types"
386
400
  }
387
401
  }
388
402
  }
@@ -397,9 +411,14 @@ export class GovFormSelect {
397
411
  "text": "Emitted when the select change value."
398
412
  },
399
413
  "complexType": {
400
- "original": "any",
401
- "resolved": "any",
402
- "references": {}
414
+ "original": "FormSelectEvent",
415
+ "resolved": "FormSelectEvent",
416
+ "references": {
417
+ "FormSelectEvent": {
418
+ "location": "import",
419
+ "path": "./gov-form-select.types"
420
+ }
421
+ }
403
422
  }
404
423
  }];
405
424
  }
@@ -446,7 +465,7 @@ export class GovFormSelect {
446
465
  "tags": []
447
466
  }
448
467
  },
449
- "getInstance": {
468
+ "getRef": {
450
469
  "complexType": {
451
470
  "signature": "() => Promise<HTMLSelectElement>",
452
471
  "parameters": [],
@@ -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;AA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,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\tthis.f.passAttrToLabel('required', String(this.required))\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"]}
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,EAEN,kBAAkB,EAElB,eAAe,EACf,eAAe,GACf,MAAM,aAAa,CAAA;AACpB,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;AAOnD,MAAM,OAAO,aAAa;EAOzB;;;;gBAsB8C,GAAG;;oBASZ,KAAK;;;;;;;;;IA9BzC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAA;IACrC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;GACpC;EAwED,eAAe,CAAC,QAAgB;IAC/B,YAAY,CAA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Ae,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 {\n\tFormSelectSizesType,\n\tFormSelectVariants,\n\tFormSelectVariantType,\n\tFormSelectClass,\n\tFormSelectSizes,\n} 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\"\nimport { FormSelectEvent } from \"./gov-form-select.types\"\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<FormSelectEvent>\n\t/**\n\t * Emitted when the select loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FormSelectEvent>\n\t/**\n\t * Emitted when the select change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<FormSelectEvent>\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\tthis.f.passAttrToLabel(\"required\", String(this.required))\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({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tthis.govBlur.emit({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\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({\n\t\t\tcomponent: FormSelectClass.root,\n\t\t\toriginalEvent: e,\n\t\t\tvalue: this.value,\n\t\t})\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 getRef(): 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"]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=gov-form-select.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gov-form-select.types.js","sourceRoot":"","sources":["../../../../../../../src/components/gov-form/select/gov-form-select.types.ts"],"names":[],"mappings":"","sourcesContent":["import { GovBaseEvent } from \"../../../types/event.types\"\n\nexport interface FormSelectEvent extends GovBaseEvent {\n\tvalue: string\n}\n"]}