@gov-design-system-ce/components 0.0.7 → 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 (256) 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/core.cjs.js +1 -1
  4. package/dist/cjs/gov-app.cjs.entry.js +15 -6
  5. package/dist/cjs/gov-app.cjs.entry.js.map +1 -1
  6. package/dist/cjs/gov-button.cjs.entry.js +12 -1
  7. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  8. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +4 -0
  9. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  10. package/dist/cjs/gov-form-checkbox.cjs.entry.js +23 -7
  11. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  12. package/dist/cjs/gov-form-file.cjs.entry.js +7 -1
  13. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  14. package/dist/cjs/gov-form-input.cjs.entry.js +6 -0
  15. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  16. package/dist/cjs/gov-form-multi-select.cjs.entry.js +8 -0
  17. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  18. package/dist/cjs/gov-form-radio.cjs.entry.js +17 -1
  19. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-form-search.cjs.entry.js +1 -1
  21. package/dist/cjs/gov-form-search.cjs.entry.js.map +1 -1
  22. package/dist/cjs/gov-form-switch.cjs.entry.js +23 -7
  23. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  24. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  25. package/dist/cjs/gov-pagination.cjs.entry.js +3 -4
  26. package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
  27. package/dist/cjs/gov-tile.cjs.entry.js +3 -2
  28. package/dist/cjs/gov-tile.cjs.entry.js.map +1 -1
  29. package/dist/cjs/loader.cjs.js +1 -1
  30. package/dist/collection/components/gov-button/gov-button.js +12 -1
  31. package/dist/collection/components/gov-button/gov-button.js.map +1 -1
  32. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +4 -0
  33. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  34. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +53 -19
  35. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  36. package/dist/collection/components/gov-form/file/gov-form-file.js +7 -1
  37. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  38. package/dist/collection/components/gov-form/input/gov-form-input.js +6 -0
  39. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  40. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +8 -0
  41. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  42. package/dist/collection/components/gov-form/radio/gov-form-radio.js +35 -1
  43. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  44. package/dist/collection/components/gov-form/search/gov-form-search.css +4 -0
  45. package/dist/collection/components/gov-form/switch/gov-form-switch.js +52 -18
  46. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  47. package/dist/collection/components/gov-pagination/gov-pagination.css +1 -0
  48. package/dist/collection/components/gov-tile/constants.js +1 -0
  49. package/dist/collection/components/gov-tile/constants.js.map +1 -1
  50. package/dist/collection/components/gov-tile/gov-tile.css +7 -3
  51. package/dist/collection/components/gov-tile/gov-tile.js +3 -6
  52. package/dist/collection/components/gov-tile/gov-tile.js.map +1 -1
  53. package/dist/collection/pages/Forms.js +15 -6
  54. package/dist/collection/pages/Forms.js.map +1 -1
  55. package/dist/components/Fragment.js +5 -0
  56. package/dist/components/Fragment.js.map +1 -0
  57. package/dist/components/gov-accordion-item.js +0 -1
  58. package/dist/components/gov-accordion-item.js.map +1 -1
  59. package/dist/components/gov-accordion.js +0 -1
  60. package/dist/components/gov-accordion.js.map +1 -1
  61. package/dist/components/gov-alert.js +0 -1
  62. package/dist/components/gov-alert.js.map +1 -1
  63. package/dist/components/gov-app.js +15 -7
  64. package/dist/components/gov-app.js.map +1 -1
  65. package/dist/components/gov-attachments-item2.js +0 -1
  66. package/dist/components/gov-attachments-item2.js.map +1 -1
  67. package/dist/components/gov-attachments2.js +0 -1
  68. package/dist/components/gov-attachments2.js.map +1 -1
  69. package/dist/components/gov-backdrop2.js +0 -1
  70. package/dist/components/gov-backdrop2.js.map +1 -1
  71. package/dist/components/gov-badge2.js +0 -1
  72. package/dist/components/gov-badge2.js.map +1 -1
  73. package/dist/components/gov-breadcrumbs.js +0 -1
  74. package/dist/components/gov-breadcrumbs.js.map +1 -1
  75. package/dist/components/gov-button2.js +12 -2
  76. package/dist/components/gov-button2.js.map +1 -1
  77. package/dist/components/gov-card.js +0 -1
  78. package/dist/components/gov-card.js.map +1 -1
  79. package/dist/components/gov-container.js +0 -1
  80. package/dist/components/gov-container.js.map +1 -1
  81. package/dist/components/gov-cookiebar.js +0 -1
  82. package/dist/components/gov-cookiebar.js.map +1 -1
  83. package/dist/components/gov-empty.js +0 -1
  84. package/dist/components/gov-empty.js.map +1 -1
  85. package/dist/components/gov-error-code.js +0 -1
  86. package/dist/components/gov-error-code.js.map +1 -1
  87. package/dist/components/gov-form-autocomplete2.js +4 -1
  88. package/dist/components/gov-form-autocomplete2.js.map +1 -1
  89. package/dist/components/gov-form-checkbox.js +24 -8
  90. package/dist/components/gov-form-checkbox.js.map +1 -1
  91. package/dist/components/gov-form-control.js +0 -1
  92. package/dist/components/gov-form-control.js.map +1 -1
  93. package/dist/components/gov-form-file.js +7 -2
  94. package/dist/components/gov-form-file.js.map +1 -1
  95. package/dist/components/gov-form-group.js +0 -1
  96. package/dist/components/gov-form-group.js.map +1 -1
  97. package/dist/components/gov-form-input2.js +6 -1
  98. package/dist/components/gov-form-input2.js.map +1 -1
  99. package/dist/components/gov-form-label.js +0 -1
  100. package/dist/components/gov-form-label.js.map +1 -1
  101. package/dist/components/gov-form-message2.js +0 -1
  102. package/dist/components/gov-form-message2.js.map +1 -1
  103. package/dist/components/gov-form-multi-select.js +8 -1
  104. package/dist/components/gov-form-multi-select.js.map +1 -1
  105. package/dist/components/gov-form-password-power.js +0 -1
  106. package/dist/components/gov-form-password-power.js.map +1 -1
  107. package/dist/components/gov-form-radio.js +18 -2
  108. package/dist/components/gov-form-radio.js.map +1 -1
  109. package/dist/components/gov-form-search.js +1 -2
  110. package/dist/components/gov-form-search.js.map +1 -1
  111. package/dist/components/gov-form-select2.js +0 -1
  112. package/dist/components/gov-form-select2.js.map +1 -1
  113. package/dist/components/gov-form-switch.js +24 -8
  114. package/dist/components/gov-form-switch.js.map +1 -1
  115. package/dist/components/gov-grid-item.js +0 -1
  116. package/dist/components/gov-grid-item.js.map +1 -1
  117. package/dist/components/gov-grid.js +0 -1
  118. package/dist/components/gov-grid.js.map +1 -1
  119. package/dist/components/gov-icon2.js +1 -2
  120. package/dist/components/gov-icon2.js.map +1 -1
  121. package/dist/components/gov-layout-column.js +0 -1
  122. package/dist/components/gov-layout-column.js.map +1 -1
  123. package/dist/components/gov-layout.js +0 -1
  124. package/dist/components/gov-layout.js.map +1 -1
  125. package/dist/components/gov-loading.js +0 -1
  126. package/dist/components/gov-loading.js.map +1 -1
  127. package/dist/components/gov-message.js +0 -1
  128. package/dist/components/gov-message.js.map +1 -1
  129. package/dist/components/gov-modal.js +0 -1
  130. package/dist/components/gov-modal.js.map +1 -1
  131. package/dist/components/gov-nav-item.js +0 -1
  132. package/dist/components/gov-nav-item.js.map +1 -1
  133. package/dist/components/gov-nav.js +0 -1
  134. package/dist/components/gov-nav.js.map +1 -1
  135. package/dist/components/gov-pagination.js +2 -4
  136. package/dist/components/gov-pagination.js.map +1 -1
  137. package/dist/components/gov-prompt.js +0 -1
  138. package/dist/components/gov-prompt.js.map +1 -1
  139. package/dist/components/gov-side-nav-item.js +0 -1
  140. package/dist/components/gov-side-nav-item.js.map +1 -1
  141. package/dist/components/gov-side-nav.js +0 -1
  142. package/dist/components/gov-side-nav.js.map +1 -1
  143. package/dist/components/gov-spacer.js +0 -1
  144. package/dist/components/gov-spacer.js.map +1 -1
  145. package/dist/components/gov-statsbar-item.js +0 -1
  146. package/dist/components/gov-statsbar-item.js.map +1 -1
  147. package/dist/components/gov-statsbar.js +0 -1
  148. package/dist/components/gov-statsbar.js.map +1 -1
  149. package/dist/components/gov-stepper-item.js +0 -1
  150. package/dist/components/gov-stepper-item.js.map +1 -1
  151. package/dist/components/gov-stepper.js +0 -1
  152. package/dist/components/gov-stepper.js.map +1 -1
  153. package/dist/components/gov-tabs-item.js +0 -1
  154. package/dist/components/gov-tabs-item.js.map +1 -1
  155. package/dist/components/gov-tabs.js +0 -1
  156. package/dist/components/gov-tabs.js.map +1 -1
  157. package/dist/components/gov-tile.js +3 -3
  158. package/dist/components/gov-tile.js.map +1 -1
  159. package/dist/components/gov-tiles.js +0 -1
  160. package/dist/components/gov-tiles.js.map +1 -1
  161. package/dist/components/gov-toast.js +0 -1
  162. package/dist/components/gov-toast.js.map +1 -1
  163. package/dist/components/gov-tooltip-content.js +0 -1
  164. package/dist/components/gov-tooltip-content.js.map +1 -1
  165. package/dist/components/gov-tooltip.js +0 -1
  166. package/dist/components/gov-tooltip.js.map +1 -1
  167. package/dist/components/gov-wizzard-item.js +0 -1
  168. package/dist/components/gov-wizzard-item.js.map +1 -1
  169. package/dist/components/gov-wizzard.js +0 -1
  170. package/dist/components/gov-wizzard.js.map +1 -1
  171. package/dist/core/core.css +1 -1
  172. package/dist/core/core.esm.js +1 -1
  173. package/dist/core/core.esm.js.map +1 -1
  174. package/dist/core/{p-ae3e2d60.entry.js → p-04fc18ab.entry.js} +2 -2
  175. package/dist/core/p-04fc18ab.entry.js.map +1 -0
  176. package/dist/core/{p-1cc7b8d3.entry.js → p-1c06fb0b.entry.js} +2 -2
  177. package/dist/core/p-1c06fb0b.entry.js.map +1 -0
  178. package/dist/core/p-1c1d0bbe.js +2 -0
  179. package/dist/core/p-1c1d0bbe.js.map +1 -0
  180. package/dist/core/{p-e9c94ef7.entry.js → p-72b9e63a.entry.js} +2 -2
  181. package/dist/core/{p-165fe5f4.entry.js → p-851939ff.entry.js} +2 -2
  182. package/dist/core/p-851939ff.entry.js.map +1 -0
  183. package/dist/core/p-8dbad4a2.entry.js +2 -0
  184. package/dist/core/p-8dbad4a2.entry.js.map +1 -0
  185. package/dist/core/p-902002e9.entry.js +2 -0
  186. package/dist/core/p-902002e9.entry.js.map +1 -0
  187. package/dist/core/{p-a0c491a6.entry.js → p-95f21fbf.entry.js} +2 -2
  188. package/dist/core/{p-a0c491a6.entry.js.map → p-95f21fbf.entry.js.map} +1 -1
  189. package/dist/core/p-9ceeba49.entry.js +2 -0
  190. package/dist/core/{p-86a3c0d5.entry.js.map → p-9ceeba49.entry.js.map} +1 -1
  191. package/dist/core/{p-ec617f18.entry.js → p-9d30e79e.entry.js} +2 -2
  192. package/dist/core/{p-ec617f18.entry.js.map → p-9d30e79e.entry.js.map} +1 -1
  193. package/dist/core/{p-692eb701.entry.js → p-a36234bb.entry.js} +2 -2
  194. package/dist/core/p-a36234bb.entry.js.map +1 -0
  195. package/dist/core/p-ac33c5ef.entry.js +2 -0
  196. package/dist/core/p-ac33c5ef.entry.js.map +1 -0
  197. package/dist/core/{p-da2b921e.entry.js → p-c0430e75.entry.js} +2 -2
  198. package/dist/core/p-c0430e75.entry.js.map +1 -0
  199. package/dist/core/p-ecdfb046.entry.js +2 -0
  200. package/dist/core/p-ecdfb046.entry.js.map +1 -0
  201. package/dist/custom-elements/index.js +1 -1
  202. package/dist/custom-elements/index.js.map +1 -1
  203. package/dist/esm/Fragment-8d8d54fb.js +5 -0
  204. package/dist/esm/Fragment-8d8d54fb.js.map +1 -0
  205. package/dist/esm/core.js +1 -1
  206. package/dist/esm/gov-app.entry.js +15 -6
  207. package/dist/esm/gov-app.entry.js.map +1 -1
  208. package/dist/esm/gov-button.entry.js +12 -1
  209. package/dist/esm/gov-button.entry.js.map +1 -1
  210. package/dist/esm/gov-form-autocomplete.entry.js +4 -0
  211. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  212. package/dist/esm/gov-form-checkbox.entry.js +23 -7
  213. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  214. package/dist/esm/gov-form-file.entry.js +7 -1
  215. package/dist/esm/gov-form-file.entry.js.map +1 -1
  216. package/dist/esm/gov-form-input.entry.js +6 -0
  217. package/dist/esm/gov-form-input.entry.js.map +1 -1
  218. package/dist/esm/gov-form-multi-select.entry.js +8 -0
  219. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  220. package/dist/esm/gov-form-radio.entry.js +17 -1
  221. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  222. package/dist/esm/gov-form-search.entry.js +1 -1
  223. package/dist/esm/gov-form-search.entry.js.map +1 -1
  224. package/dist/esm/gov-form-switch.entry.js +23 -7
  225. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  226. package/dist/esm/gov-icon.entry.js +1 -1
  227. package/dist/esm/gov-pagination.entry.js +2 -3
  228. package/dist/esm/gov-pagination.entry.js.map +1 -1
  229. package/dist/esm/gov-tile.entry.js +3 -2
  230. package/dist/esm/gov-tile.entry.js.map +1 -1
  231. package/dist/esm/loader.js +1 -1
  232. package/dist/hydrate/index.js +121 -29
  233. package/dist/types/components/gov-button/gov-button.d.ts +2 -0
  234. package/dist/types/components/gov-form/checkbox/gov-form-checkbox.d.ts +8 -3
  235. package/dist/types/components/gov-form/file/gov-form-file.d.ts +1 -0
  236. package/dist/types/components/gov-form/radio/gov-form-radio.d.ts +5 -0
  237. package/dist/types/components/gov-form/switch/gov-form-switch.d.ts +8 -3
  238. package/dist/types/components/gov-tile/constants.d.ts +1 -0
  239. package/dist/types/components/gov-tile/gov-tile.d.ts +1 -2
  240. package/dist/types/components.d.ts +26 -4
  241. package/package.json +1 -1
  242. package/dist/core/p-165fe5f4.entry.js.map +0 -1
  243. package/dist/core/p-1cc7b8d3.entry.js.map +0 -1
  244. package/dist/core/p-22722ff3.entry.js +0 -2
  245. package/dist/core/p-22722ff3.entry.js.map +0 -1
  246. package/dist/core/p-54f367db.entry.js +0 -2
  247. package/dist/core/p-54f367db.entry.js.map +0 -1
  248. package/dist/core/p-692eb701.entry.js.map +0 -1
  249. package/dist/core/p-86a3c0d5.entry.js +0 -2
  250. package/dist/core/p-8965f84a.entry.js +0 -2
  251. package/dist/core/p-8965f84a.entry.js.map +0 -1
  252. package/dist/core/p-a0dd0a95.entry.js +0 -2
  253. package/dist/core/p-a0dd0a95.entry.js.map +0 -1
  254. package/dist/core/p-ae3e2d60.entry.js.map +0 -1
  255. package/dist/core/p-da2b921e.entry.js.map +0 -1
  256. /package/dist/core/{p-e9c94ef7.entry.js.map → p-72b9e63a.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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Ae,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, 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,EA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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"]}
@@ -230,6 +230,10 @@
230
230
  }
231
231
  .gov-form-search__input input {
232
232
  height: auto;
233
+ border-width: 0;
234
+ }
235
+ .gov-form-search__input input:focus {
236
+ outline: none;
233
237
  }
234
238
  .gov-form-search__button {
235
239
  flex: 0 0 auto;
@@ -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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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 { 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,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,+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;AAEnD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,QAAQ,MAAM,2BAA2B,CAAA;AAMhD,MAAM,OAAO,aAAa;EAMzB;;mBAe6D,KAAK;mBAIb,KAAK;oBAKrB,KAAK;;;gBAaI,GAAG;;;;;;IApChD,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA;IAEzC,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAA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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"]}
@@ -233,6 +233,7 @@
233
233
  justify-content: center;
234
234
  align-items: center;
235
235
  margin: 0;
236
+ padding: 0.125rem;
236
237
  border-radius: var(--gov-border-radius, 0.1875rem);
237
238
  overflow: hidden;
238
239
  }
@@ -5,5 +5,6 @@ export const TileClass = {
5
5
  title: 'gov-tile__title',
6
6
  link: 'gov-tile__link',
7
7
  content: 'gov-tile__content',
8
+ heading: 'gov-tile__heading',
8
9
  };
9
10
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tile/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;EACxB,IAAI,EAAE,UAAU;EAChB,IAAI,EAAE,gBAAgB;EACtB,KAAK,EAAE,iBAAiB;EACxB,KAAK,EAAE,iBAAiB;EACxB,IAAI,EAAE,gBAAgB;EACtB,OAAO,EAAE,mBAAmB;CAC5B,CAAA","sourcesContent":["export const TileClass = {\n\troot: 'gov-tile',\n\ticon: 'gov-tile__icon',\n\tarrow: 'gov-tile__arrow',\n\ttitle: 'gov-tile__title',\n\tlink: 'gov-tile__link',\n\tcontent: 'gov-tile__content',\n}\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tile/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG;EACxB,IAAI,EAAE,UAAU;EAChB,IAAI,EAAE,gBAAgB;EACtB,KAAK,EAAE,iBAAiB;EACxB,KAAK,EAAE,iBAAiB;EACxB,IAAI,EAAE,gBAAgB;EACtB,OAAO,EAAE,mBAAmB;EAC5B,OAAO,EAAE,mBAAmB;CAC5B,CAAA","sourcesContent":["export const TileClass = {\n\troot: 'gov-tile',\n\ticon: 'gov-tile__icon',\n\tarrow: 'gov-tile__arrow',\n\ttitle: 'gov-tile__title',\n\tlink: 'gov-tile__link',\n\tcontent: 'gov-tile__content',\n\theading: 'gov-tile__heading',\n}\n"]}
@@ -1,4 +1,4 @@
1
- .gov-tile__link::before {
1
+ .gov-tile__heading::before {
2
2
  content: "";
3
3
  position: absolute;
4
4
  top: 0;
@@ -235,7 +235,7 @@
235
235
  letter-spacing: var(--gov-text-xl-letter-spacing);
236
236
  margin: 0 0 0.5rem;
237
237
  }
238
- .gov-tile__link {
238
+ .gov-tile__heading {
239
239
  display: flex;
240
240
  gap: 0.5rem;
241
241
  justify-content: space-between;
@@ -259,11 +259,15 @@
259
259
  position: relative;
260
260
  z-index: 1;
261
261
  }
262
+ .gov-tile__link {
263
+ display: block;
264
+ text-decoration: none;
265
+ }
262
266
  @media not all and (pointer: coarse) {
263
267
  .gov-tile[href]:hover {
264
268
  background: var(--gov-tile-hover-bg, var(--gov-color-primary-200));
265
269
  }
266
- .gov-tile[href]:hover .gov-tile__link {
270
+ .gov-tile[href]:hover .gov-tile__heading {
267
271
  color: var(--gov-tile-main-color, var(--gov-color-primary));
268
272
  }
269
273
  }
@@ -19,7 +19,7 @@ export class GovTile {
19
19
  }
20
20
  render() {
21
21
  // tag type
22
- return (h(Host, { class: this.h.classes(TileClass.root), promotion: this.promotion }, this.h.hasSlot('icon') && (h("div", { class: TileClass.icon }, h("slot", { name: "icon" }))), h("h3", { class: TileClass.title }, this.href ? (h("a", { href: this.href, class: TileClass.link }, this.name, h("gov-icon", { class: TileClass.arrow, name: "chevron-right" }))) : (h("span", null, this.name))), h("div", { class: TileClass.content }, h("slot", null))));
22
+ return (h(Host, { class: this.h.classes(TileClass.root), promotion: this.promotion }, this.href ? (h("a", { href: this.href, class: TileClass.link }, this.h.hasSlot('icon') && (h("div", { class: TileClass.icon }, h("slot", { name: "icon" }))), h("h3", { class: TileClass.title }, h("span", { class: TileClass.heading }, this.name, h("gov-icon", { class: TileClass.arrow, name: "chevron-right" }))), h("div", { class: TileClass.content }, h("slot", null)))) : (h("span", null, this.h.hasSlot('icon') && (h("div", { class: TileClass.icon }, h("slot", { name: "icon" }))), h("h3", { class: TileClass.title }, h("span", null, this.name)), h("div", { class: TileClass.content }, h("slot", null))))));
23
23
  }
24
24
  static get is() { return "gov-tile"; }
25
25
  static get originalStyleUrls() {
@@ -63,11 +63,8 @@ export class GovTile {
63
63
  "required": false,
64
64
  "optional": false,
65
65
  "docs": {
66
- "tags": [{
67
- "name": "link",
68
- "text": "https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href"
69
- }],
70
- "text": "Same as original parameter"
66
+ "tags": [],
67
+ "text": "Link on whole tile"
71
68
  },
72
69
  "attribute": "href",
73
70
  "reflect": false
@@ -1 +1 @@
1
- {"version":3,"file":"gov-tile.js","sourceRoot":"","sources":["../../../../../../src/components/gov-tile/gov-tile.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { TileClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tile',\n\tstyleUrl: 'gov-tile.scss',\n})\nexport class GovTile {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTileElement\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a#attr-href\n\t */\n\t@Prop() readonly href: string\n\t/**\n\t * Item name\n\t */\n\t@Prop() readonly name: string\n\n\t@Watch('name')\n\tvalidateName(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${TileClass.root}]: Parameter title is required.`)\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateName(this.name)\n\t}\n\n\trender() {\n\t\t// tag type\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TileClass.root)} promotion={this.promotion}>\n\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t</div>\n\t\t\t\t)}\n\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t{this.href ? (\n\t\t\t\t\t\t<a href={this.href} class={TileClass.link}>\n\t\t\t\t\t\t\t{this.name}\n\t\t\t\t\t\t\t<gov-icon class={TileClass.arrow} name=\"chevron-right\"></gov-icon>\n\t\t\t\t\t\t</a>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span>{this.name}</span>\n\t\t\t\t\t)}\n\t\t\t\t</h3>\n\t\t\t\t<div class={TileClass.content}>\n\t\t\t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KAAK;QACzB,YAAM,KAAK,EAAE,SAAS,CAAC,OAAO;UAC5B,IAAI,CAAC,IAAI;UACV,gBAAU,KAAK,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAC,eAAe,GAAY,CAC5D,CACH;MACL,WAAK,KAAK,EAAE,SAAS,CAAC,OAAO;QAC5B,eAAQ,CACH,CACH,CACJ,CAAC,CAAC,CAAC,CACH;MACE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAC1B,WAAK,KAAK,EAAE,SAAS,CAAC,IAAI;QACzB,YAAM,IAAI,EAAC,MAAM,GAAG,CACf,CACN;MACD,UAAI,KAAK,EAAE,SAAS,CAAC,KAAK;QACxB,gBAAO,IAAI,CAAC,IAAI,CAAQ,CACrB;MACL,WAAK,KAAK,EAAE,SAAS,CAAC,OAAO;QAC5B,eAAQ,CACH,CACA,CACP,CAEK,CACP,CAAA;EACF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACD","sourcesContent":["import { Component, Element, h, Host, Prop, Watch } from '@stencil/core'\nimport { govErrorLog } from '../../helpers/Log/gov.log'\nimport { TileClass } from './constants'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tile',\n\tstyleUrl: 'gov-tile.scss',\n})\nexport class GovTile {\n\tprivate h: GovHost\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t}\n\n\t@Element() host: HTMLGovTileElement\n\t/**\n\t * Style variation of the card.\n\t */\n\t@Prop() readonly promotion: boolean = false\n\t/**\n\t * Link on whole tile\n\t */\n\t@Prop() readonly href: string\n\t/**\n\t * Item name\n\t */\n\t@Prop() readonly name: string\n\n\t@Watch('name')\n\tvalidateName(newValue: string): void {\n\t\tif (!newValue) {\n\t\t\tgovErrorLog(`[${TileClass.root}]: Parameter title is required.`)\n\t\t}\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateName(this.name)\n\t}\n\n\trender() {\n\t\t// tag type\n\t\treturn (\n\t\t\t<Host class={this.h.classes(TileClass.root)} promotion={this.promotion}>\n\t\t\t\t{this.href ? (\n\t\t\t\t\t<a href={this.href} class={TileClass.link}>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t<span class={TileClass.heading}>\n\t\t\t\t\t\t\t\t{this.name}\n\t\t\t\t\t\t\t\t<gov-icon class={TileClass.arrow} name=\"chevron-right\"></gov-icon>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</a>\n\t\t\t\t) : (\n\t\t\t\t\t<span>\n\t\t\t\t\t\t{this.h.hasSlot('icon') && (\n\t\t\t\t\t\t\t<div class={TileClass.icon}>\n\t\t\t\t\t\t\t\t<slot name=\"icon\" />\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t<h3 class={TileClass.title}>\n\t\t\t\t\t\t\t\t<span>{this.name}</span>\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<div class={TileClass.content}>\n\t\t\t\t\t\t\t<slot />\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</span>\n\t\t\t\t)}\n\n\t\t\t</Host>\n\t\t)\n\t}\n}\n"]}
@@ -79,15 +79,24 @@ class FormsPage extends HTMLElement {
79
79
  <option value="i" selected>Value I</option>
80
80
  </gov-form-multi-select>
81
81
  <br>
82
+ <gov-form-checkbox name="test-me-c" value="me" checked no-label></gov-form-checkbox>
83
+ <br>
84
+ <gov-form-radio name="superRadio2" value="me1" no-label></gov-form-radio>
85
+ <gov-form-radio name="superRadio2" value="me2" checked no-label></gov-form-radio>
86
+ <br>
87
+ <gov-form-switch name="test-me" value="me2" checked no-label></gov-form-switch>
88
+ <br>
82
89
  <gov-form-checkbox name="test-me-c" value="me" checked>
83
90
  <gov-form-label slot="label">Souhlasím</gov-form-label>
84
91
  </gov-form-checkbox>
85
92
  <br>
86
- <gov-form-radio name="test1" value="me1">
93
+ <gov-form-radio name="superRadio" value="me1">
94
+ <gov-form-label slot="label">Souhlasím</gov-form-label>
95
+ </gov-form-radio>
96
+ <gov-form-radio name="superRadio" value="me2" checked>
87
97
  <gov-form-label slot="label">Souhlasím</gov-form-label>
88
98
  </gov-form-radio>
89
99
  <br>
90
- // TODO: Nepropisuje se ID inputu do labelu
91
100
  <gov-form-switch name="test-me" value="me2" checked>
92
101
  <gov-form-label slot="label">Souhlasím</gov-form-label>
93
102
  </gov-form-switch>
@@ -106,7 +115,7 @@ class FormsPage extends HTMLElement {
106
115
  <gov-form-control size="m">
107
116
  <gov-form-group>
108
117
  <gov-form-search name="test-me-c" value="me" checked>
109
- <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte" type="reset"></gov-form-input>
118
+ <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte"></gov-form-input>
110
119
  <gov-button slot="button" variant="primary" size="s">
111
120
  <gov-icon slot="left-icon" name="search"></gov-icon>
112
121
  </gov-button>
@@ -117,7 +126,7 @@ class FormsPage extends HTMLElement {
117
126
  <gov-form-control size="l">
118
127
  <gov-form-group>
119
128
  <gov-form-search name="test-me-c" value="me" checked>
120
- <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte" type="reset"></gov-form-input>
129
+ <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte"></gov-form-input>
121
130
  <gov-button slot="button" variant="primary" size="m">
122
131
  Hledat
123
132
  </gov-button>
@@ -128,7 +137,7 @@ class FormsPage extends HTMLElement {
128
137
  <gov-form-control size="xl">
129
138
  <gov-form-group>
130
139
  <gov-form-search name="test-me-c" value="me" checked variant="secondary">
131
- <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte" type="reset"></gov-form-input>
140
+ <gov-form-input slot="input" id="kapr" name="test-me" placeholder="Co hledáte"></gov-form-input>
132
141
  <gov-button slot="button" variant="secondary" size="l">
133
142
  Hledat
134
143
  </gov-button>
@@ -905,7 +914,6 @@ class FormsPage extends HTMLElement {
905
914
  <gov-form-label size="s" slot="top">Label of input</gov-form-label>
906
915
  <gov-form-group>
907
916
  <gov-form-input id="kapr" name="test-me" placeholder="Placeholder">
908
- <gov-icon slot="right-icon" name="info"></gov-icon>
909
917
  </gov-form-input>
910
918
  </gov-form-group>
911
919
  </gov-form-control>
@@ -1048,6 +1056,7 @@ class FormsPage extends HTMLElement {
1048
1056
  </gov-form-switch>
1049
1057
  </gov-form-group>
1050
1058
  </gov-form-control>
1059
+
1051
1060
  <gov-form-control size="l">
1052
1061
  <gov-form-group>
1053
1062
  <gov-form-switch name="test-me" value="me" checked>