@gov-design-system-ce/components 0.0.10 → 0.0.11

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 (214) hide show
  1. package/dist/cjs/gov-button.cjs.entry.js +0 -2
  2. package/dist/cjs/gov-button.cjs.entry.js.map +1 -1
  3. package/dist/cjs/gov-form-autocomplete.cjs.entry.js +0 -4
  4. package/dist/cjs/gov-form-autocomplete.cjs.entry.js.map +1 -1
  5. package/dist/cjs/gov-form-checkbox.cjs.entry.js +0 -3
  6. package/dist/cjs/gov-form-checkbox.cjs.entry.js.map +1 -1
  7. package/dist/cjs/gov-form-file.cjs.entry.js +0 -3
  8. package/dist/cjs/gov-form-file.cjs.entry.js.map +1 -1
  9. package/dist/cjs/gov-form-input.cjs.entry.js +0 -4
  10. package/dist/cjs/gov-form-input.cjs.entry.js.map +1 -1
  11. package/dist/cjs/gov-form-multi-select.cjs.entry.js +0 -4
  12. package/dist/cjs/gov-form-multi-select.cjs.entry.js.map +1 -1
  13. package/dist/cjs/gov-form-radio.cjs.entry.js +0 -3
  14. package/dist/cjs/gov-form-radio.cjs.entry.js.map +1 -1
  15. package/dist/cjs/gov-form-switch.cjs.entry.js +0 -2
  16. package/dist/cjs/gov-form-switch.cjs.entry.js.map +1 -1
  17. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  18. package/dist/cjs/gov-pagination.cjs.entry.js +0 -2
  19. package/dist/cjs/gov-pagination.cjs.entry.js.map +1 -1
  20. package/dist/cjs/gov-tooltip.cjs.entry.js +2 -2
  21. package/dist/cjs/gov-tooltip.cjs.entry.js.map +1 -1
  22. package/dist/collection/components/gov-button/gov-button.js +0 -2
  23. package/dist/collection/components/gov-button/gov-button.js.map +1 -1
  24. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js +0 -4
  25. package/dist/collection/components/gov-form/autocomplete/gov-form-autocomplete.js.map +1 -1
  26. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js +0 -3
  27. package/dist/collection/components/gov-form/checkbox/gov-form-checkbox.js.map +1 -1
  28. package/dist/collection/components/gov-form/file/gov-form-file.js +0 -3
  29. package/dist/collection/components/gov-form/file/gov-form-file.js.map +1 -1
  30. package/dist/collection/components/gov-form/input/gov-form-input.js +0 -4
  31. package/dist/collection/components/gov-form/input/gov-form-input.js.map +1 -1
  32. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js +0 -4
  33. package/dist/collection/components/gov-form/multiselect/gov-form-multi-select.js.map +1 -1
  34. package/dist/collection/components/gov-form/radio/gov-form-radio.js +0 -3
  35. package/dist/collection/components/gov-form/radio/gov-form-radio.js.map +1 -1
  36. package/dist/collection/components/gov-form/switch/gov-form-switch.js +0 -2
  37. package/dist/collection/components/gov-form/switch/gov-form-switch.js.map +1 -1
  38. package/dist/collection/components/gov-pagination/gov-pagination.js +0 -2
  39. package/dist/collection/components/gov-pagination/gov-pagination.js.map +1 -1
  40. package/dist/collection/components/gov-tooltip/gov-tooltip.js +2 -2
  41. package/dist/collection/components/gov-tooltip/gov-tooltip.js.map +1 -1
  42. package/dist/components/gov-accordion-item.js +0 -1
  43. package/dist/components/gov-accordion-item.js.map +1 -1
  44. package/dist/components/gov-accordion.js +0 -1
  45. package/dist/components/gov-accordion.js.map +1 -1
  46. package/dist/components/gov-alert.js +0 -1
  47. package/dist/components/gov-alert.js.map +1 -1
  48. package/dist/components/gov-app.js +0 -1
  49. package/dist/components/gov-app.js.map +1 -1
  50. package/dist/components/gov-attachments-item2.js +0 -1
  51. package/dist/components/gov-attachments-item2.js.map +1 -1
  52. package/dist/components/gov-attachments2.js +0 -1
  53. package/dist/components/gov-attachments2.js.map +1 -1
  54. package/dist/components/gov-backdrop2.js +0 -1
  55. package/dist/components/gov-backdrop2.js.map +1 -1
  56. package/dist/components/gov-badge2.js +0 -1
  57. package/dist/components/gov-badge2.js.map +1 -1
  58. package/dist/components/gov-breadcrumbs.js +0 -1
  59. package/dist/components/gov-breadcrumbs.js.map +1 -1
  60. package/dist/components/gov-button2.js +0 -3
  61. package/dist/components/gov-button2.js.map +1 -1
  62. package/dist/components/gov-card.js +0 -1
  63. package/dist/components/gov-card.js.map +1 -1
  64. package/dist/components/gov-container.js +0 -1
  65. package/dist/components/gov-container.js.map +1 -1
  66. package/dist/components/gov-cookiebar.js +0 -1
  67. package/dist/components/gov-cookiebar.js.map +1 -1
  68. package/dist/components/gov-empty.js +0 -1
  69. package/dist/components/gov-empty.js.map +1 -1
  70. package/dist/components/gov-error-code.js +0 -1
  71. package/dist/components/gov-error-code.js.map +1 -1
  72. package/dist/components/gov-form-autocomplete2.js +0 -5
  73. package/dist/components/gov-form-autocomplete2.js.map +1 -1
  74. package/dist/components/gov-form-checkbox.js +0 -4
  75. package/dist/components/gov-form-checkbox.js.map +1 -1
  76. package/dist/components/gov-form-control.js +0 -1
  77. package/dist/components/gov-form-control.js.map +1 -1
  78. package/dist/components/gov-form-file.js +0 -4
  79. package/dist/components/gov-form-file.js.map +1 -1
  80. package/dist/components/gov-form-group.js +0 -1
  81. package/dist/components/gov-form-group.js.map +1 -1
  82. package/dist/components/gov-form-input2.js +0 -5
  83. package/dist/components/gov-form-input2.js.map +1 -1
  84. package/dist/components/gov-form-label.js +0 -1
  85. package/dist/components/gov-form-label.js.map +1 -1
  86. package/dist/components/gov-form-message2.js +0 -1
  87. package/dist/components/gov-form-message2.js.map +1 -1
  88. package/dist/components/gov-form-multi-select.js +0 -5
  89. package/dist/components/gov-form-multi-select.js.map +1 -1
  90. package/dist/components/gov-form-password-power.js +0 -1
  91. package/dist/components/gov-form-password-power.js.map +1 -1
  92. package/dist/components/gov-form-radio.js +0 -4
  93. package/dist/components/gov-form-radio.js.map +1 -1
  94. package/dist/components/gov-form-search.js +0 -1
  95. package/dist/components/gov-form-search.js.map +1 -1
  96. package/dist/components/gov-form-select2.js +0 -1
  97. package/dist/components/gov-form-select2.js.map +1 -1
  98. package/dist/components/gov-form-switch.js +0 -3
  99. package/dist/components/gov-form-switch.js.map +1 -1
  100. package/dist/components/gov-grid-item.js +0 -1
  101. package/dist/components/gov-grid-item.js.map +1 -1
  102. package/dist/components/gov-grid.js +0 -1
  103. package/dist/components/gov-grid.js.map +1 -1
  104. package/dist/components/gov-icon2.js +1 -2
  105. package/dist/components/gov-icon2.js.map +1 -1
  106. package/dist/components/gov-layout-column.js +0 -1
  107. package/dist/components/gov-layout-column.js.map +1 -1
  108. package/dist/components/gov-layout.js +0 -1
  109. package/dist/components/gov-layout.js.map +1 -1
  110. package/dist/components/gov-loading.js +0 -1
  111. package/dist/components/gov-loading.js.map +1 -1
  112. package/dist/components/gov-message.js +0 -1
  113. package/dist/components/gov-message.js.map +1 -1
  114. package/dist/components/gov-modal.js +0 -1
  115. package/dist/components/gov-modal.js.map +1 -1
  116. package/dist/components/gov-nav-item.js +0 -1
  117. package/dist/components/gov-nav-item.js.map +1 -1
  118. package/dist/components/gov-nav.js +0 -1
  119. package/dist/components/gov-nav.js.map +1 -1
  120. package/dist/components/gov-pagination.js +0 -3
  121. package/dist/components/gov-pagination.js.map +1 -1
  122. package/dist/components/gov-prompt.js +0 -1
  123. package/dist/components/gov-prompt.js.map +1 -1
  124. package/dist/components/gov-side-nav-item.js +0 -1
  125. package/dist/components/gov-side-nav-item.js.map +1 -1
  126. package/dist/components/gov-side-nav.js +0 -1
  127. package/dist/components/gov-side-nav.js.map +1 -1
  128. package/dist/components/gov-spacer.js +0 -1
  129. package/dist/components/gov-spacer.js.map +1 -1
  130. package/dist/components/gov-statsbar-item.js +0 -1
  131. package/dist/components/gov-statsbar-item.js.map +1 -1
  132. package/dist/components/gov-statsbar.js +0 -1
  133. package/dist/components/gov-statsbar.js.map +1 -1
  134. package/dist/components/gov-stepper-item.js +0 -1
  135. package/dist/components/gov-stepper-item.js.map +1 -1
  136. package/dist/components/gov-stepper.js +0 -1
  137. package/dist/components/gov-stepper.js.map +1 -1
  138. package/dist/components/gov-tabs-item.js +0 -1
  139. package/dist/components/gov-tabs-item.js.map +1 -1
  140. package/dist/components/gov-tabs.js +0 -1
  141. package/dist/components/gov-tabs.js.map +1 -1
  142. package/dist/components/gov-tile.js +0 -1
  143. package/dist/components/gov-tile.js.map +1 -1
  144. package/dist/components/gov-tiles.js +0 -1
  145. package/dist/components/gov-tiles.js.map +1 -1
  146. package/dist/components/gov-toast.js +0 -1
  147. package/dist/components/gov-toast.js.map +1 -1
  148. package/dist/components/gov-tooltip-content.js +0 -1
  149. package/dist/components/gov-tooltip-content.js.map +1 -1
  150. package/dist/components/gov-tooltip.js +2 -3
  151. package/dist/components/gov-tooltip.js.map +1 -1
  152. package/dist/components/gov-wizzard-item.js +0 -1
  153. package/dist/components/gov-wizzard-item.js.map +1 -1
  154. package/dist/components/gov-wizzard.js +0 -1
  155. package/dist/components/gov-wizzard.js.map +1 -1
  156. package/dist/core/core.esm.js +1 -1
  157. package/dist/core/{p-9ceeba49.entry.js → p-4e12d6e3.entry.js} +2 -2
  158. package/dist/core/p-4e12d6e3.entry.js.map +1 -0
  159. package/dist/core/{p-6b928a53.entry.js → p-64d6997b.entry.js} +2 -2
  160. package/dist/core/p-64d6997b.entry.js.map +1 -0
  161. package/dist/core/{p-cc37a226.entry.js → p-882621a0.entry.js} +2 -2
  162. package/dist/core/p-882621a0.entry.js.map +1 -0
  163. package/dist/core/{p-04fc18ab.entry.js → p-ae3e2d60.entry.js} +2 -2
  164. package/dist/core/p-ae3e2d60.entry.js.map +1 -0
  165. package/dist/core/{p-9c844f4d.entry.js → p-b37ca132.entry.js} +2 -2
  166. package/dist/core/p-b37ca132.entry.js.map +1 -0
  167. package/dist/core/{p-bba09987.entry.js → p-cec15cf8.entry.js} +2 -2
  168. package/dist/core/p-cec15cf8.entry.js.map +1 -0
  169. package/dist/core/{p-f759342e.entry.js → p-d2d8998d.entry.js} +2 -2
  170. package/dist/core/p-d2d8998d.entry.js.map +1 -0
  171. package/dist/core/{p-6fd0c41d.entry.js → p-db88f249.entry.js} +2 -2
  172. package/dist/core/{p-6b69dbd3.entry.js → p-e3484849.entry.js} +2 -2
  173. package/dist/core/p-e3484849.entry.js.map +1 -0
  174. package/dist/core/{p-851939ff.entry.js → p-e86bffd0.entry.js} +2 -2
  175. package/dist/core/p-e86bffd0.entry.js.map +1 -0
  176. package/dist/core/{p-44dc2ef4.entry.js → p-fc61fd31.entry.js} +2 -2
  177. package/dist/core/p-fc61fd31.entry.js.map +1 -0
  178. package/dist/custom-elements/index.js +1 -1
  179. package/dist/custom-elements/index.js.map +1 -1
  180. package/dist/esm/gov-button.entry.js +0 -2
  181. package/dist/esm/gov-button.entry.js.map +1 -1
  182. package/dist/esm/gov-form-autocomplete.entry.js +0 -4
  183. package/dist/esm/gov-form-autocomplete.entry.js.map +1 -1
  184. package/dist/esm/gov-form-checkbox.entry.js +0 -3
  185. package/dist/esm/gov-form-checkbox.entry.js.map +1 -1
  186. package/dist/esm/gov-form-file.entry.js +0 -3
  187. package/dist/esm/gov-form-file.entry.js.map +1 -1
  188. package/dist/esm/gov-form-input.entry.js +0 -4
  189. package/dist/esm/gov-form-input.entry.js.map +1 -1
  190. package/dist/esm/gov-form-multi-select.entry.js +0 -4
  191. package/dist/esm/gov-form-multi-select.entry.js.map +1 -1
  192. package/dist/esm/gov-form-radio.entry.js +0 -3
  193. package/dist/esm/gov-form-radio.entry.js.map +1 -1
  194. package/dist/esm/gov-form-switch.entry.js +0 -2
  195. package/dist/esm/gov-form-switch.entry.js.map +1 -1
  196. package/dist/esm/gov-icon.entry.js +1 -1
  197. package/dist/esm/gov-pagination.entry.js +0 -2
  198. package/dist/esm/gov-pagination.entry.js.map +1 -1
  199. package/dist/esm/gov-tooltip.entry.js +2 -2
  200. package/dist/esm/gov-tooltip.entry.js.map +1 -1
  201. package/dist/hydrate/index.js +2 -29
  202. package/dist/types/components/gov-tooltip/gov-tooltip.d.ts +1 -1
  203. package/package.json +1 -1
  204. package/dist/core/p-04fc18ab.entry.js.map +0 -1
  205. package/dist/core/p-44dc2ef4.entry.js.map +0 -1
  206. package/dist/core/p-6b69dbd3.entry.js.map +0 -1
  207. package/dist/core/p-6b928a53.entry.js.map +0 -1
  208. package/dist/core/p-851939ff.entry.js.map +0 -1
  209. package/dist/core/p-9c844f4d.entry.js.map +0 -1
  210. package/dist/core/p-9ceeba49.entry.js.map +0 -1
  211. package/dist/core/p-bba09987.entry.js.map +0 -1
  212. package/dist/core/p-cc37a226.entry.js.map +0 -1
  213. package/dist/core/p-f759342e.entry.js.map +0 -1
  214. /package/dist/core/{p-6fd0c41d.entry.js.map → p-db88f249.entry.js.map} +0 -0
@@ -14985,12 +14985,10 @@ class GovButton {
14985
14985
  }
14986
14986
  onFocusHandler(e) {
14987
14987
  e.stopPropagation();
14988
- e.preventDefault();
14989
14988
  this.govFocus.emit(e);
14990
14989
  }
14991
14990
  onBlurHandler(e) {
14992
14991
  e.stopPropagation();
14993
- e.preventDefault();
14994
14992
  this.govBlur.emit(e);
14995
14993
  }
14996
14994
  /**
@@ -15397,7 +15395,6 @@ class GovFormAutocomplete {
15397
15395
  this.doSearch();
15398
15396
  }
15399
15397
  e.stopPropagation();
15400
- e.preventDefault();
15401
15398
  this.govFocus.emit(e);
15402
15399
  }
15403
15400
  onBlurHandler(e) {
@@ -15405,13 +15402,11 @@ class GovFormAutocomplete {
15405
15402
  setTimeout(() => (this.list = []), 200);
15406
15403
  this.arrowCounter = -1;
15407
15404
  e.stopPropagation();
15408
- e.preventDefault();
15409
15405
  this.govBlur.emit(e);
15410
15406
  }
15411
15407
  onInputHandler(e) {
15412
15408
  this.value = e.target.value;
15413
15409
  e.stopPropagation();
15414
- e.preventDefault();
15415
15410
  this.govInput.emit(e);
15416
15411
  this.doSearch();
15417
15412
  }
@@ -15434,7 +15429,6 @@ class GovFormAutocomplete {
15434
15429
  onKeyUpHandler(e) {
15435
15430
  const event = e.detail;
15436
15431
  e.stopPropagation();
15437
- e.preventDefault();
15438
15432
  if (event.keyCode === 38)
15439
15433
  this.onArrowUp();
15440
15434
  else if (event.keyCode === 40)
@@ -15712,12 +15706,10 @@ class GovFormCheckbox {
15712
15706
  }
15713
15707
  onFocusHandler(e) {
15714
15708
  e.stopPropagation();
15715
- e.preventDefault();
15716
15709
  this.govFocus.emit(e);
15717
15710
  }
15718
15711
  onBlurHandler(e) {
15719
15712
  e.stopPropagation();
15720
- e.preventDefault();
15721
15713
  this.govBlur.emit(e);
15722
15714
  }
15723
15715
  onClickHandler(e) {
@@ -15726,7 +15718,6 @@ class GovFormCheckbox {
15726
15718
  onChangeHandler(e) {
15727
15719
  this.isChecked = e.target.checked;
15728
15720
  e.stopPropagation();
15729
- e.preventDefault();
15730
15721
  this.govChange.emit({
15731
15722
  checked: this.isChecked,
15732
15723
  value: this.value,
@@ -16011,17 +16002,14 @@ class GovFormFile {
16011
16002
  }
16012
16003
  onFocusHandler(e) {
16013
16004
  e.stopPropagation();
16014
- e.preventDefault();
16015
16005
  this.govFocus.emit(e);
16016
16006
  }
16017
16007
  onBlurHandler(e) {
16018
16008
  e.stopPropagation();
16019
- e.preventDefault();
16020
16009
  this.govBlur.emit(e);
16021
16010
  }
16022
16011
  onChangeHandler(e) {
16023
16012
  e.stopPropagation();
16024
- e.preventDefault();
16025
16013
  }
16026
16014
  /**
16027
16015
  * Validate the WCAG attributes of the component
@@ -16170,25 +16158,21 @@ class GovFormInput {
16170
16158
  }
16171
16159
  onFocusHandler(e) {
16172
16160
  e.stopPropagation();
16173
- e.preventDefault();
16174
16161
  this.focused = true;
16175
16162
  this.govFocus.emit(e);
16176
16163
  }
16177
16164
  onBlurHandler(e) {
16178
16165
  e.stopPropagation();
16179
- e.preventDefault();
16180
16166
  this.focused = false;
16181
16167
  this.govBlur.emit(e);
16182
16168
  }
16183
16169
  onKeyUpHandler(e) {
16184
16170
  e.stopPropagation();
16185
- e.preventDefault();
16186
16171
  this.govKeyUp.emit(e);
16187
16172
  }
16188
16173
  onInputHandler(e) {
16189
16174
  this.value = e.target.value;
16190
16175
  e.stopPropagation();
16191
- e.preventDefault();
16192
16176
  this.govInput.emit(e);
16193
16177
  }
16194
16178
  /**
@@ -16459,25 +16443,21 @@ class GovFormMultiSelect {
16459
16443
  }
16460
16444
  onFocusHandler(e) {
16461
16445
  e.stopPropagation();
16462
- e.preventDefault();
16463
16446
  this.focused = true;
16464
16447
  this.govFocus.emit(e);
16465
16448
  }
16466
16449
  onBlurHandler(e) {
16467
16450
  e.stopPropagation();
16468
16451
  e.stopPropagation();
16469
- e.preventDefault();
16470
16452
  this.focused = false;
16471
16453
  this.govBlur.emit(e);
16472
16454
  }
16473
16455
  onInputHandler(e) {
16474
16456
  this.value = e.target.value;
16475
16457
  e.stopPropagation();
16476
- e.preventDefault();
16477
16458
  }
16478
16459
  onSelectHandler(e) {
16479
16460
  e.stopPropagation();
16480
- e.preventDefault();
16481
16461
  const value = e.detail;
16482
16462
  this.selectOption(value);
16483
16463
  this.value = '';
@@ -16640,18 +16620,15 @@ class GovFormRadio {
16640
16620
  }
16641
16621
  onFocusHandler(e) {
16642
16622
  e.stopPropagation();
16643
- e.preventDefault();
16644
16623
  this.govFocus.emit(e);
16645
16624
  }
16646
16625
  onBlurHandler(e) {
16647
16626
  e.stopPropagation();
16648
- e.preventDefault();
16649
16627
  this.govBlur.emit(e);
16650
16628
  }
16651
16629
  onChangeHandler(e) {
16652
16630
  this.isChecked = e.target.checked;
16653
16631
  e.stopPropagation();
16654
- e.preventDefault();
16655
16632
  this.govChange.emit({
16656
16633
  checked: this.isChecked,
16657
16634
  value: this.value,
@@ -16911,12 +16888,10 @@ class GovFormSwitch {
16911
16888
  }
16912
16889
  onFocusHandler(e) {
16913
16890
  e.stopPropagation();
16914
- e.preventDefault();
16915
16891
  this.govFocus.emit(e);
16916
16892
  }
16917
16893
  onBlurHandler(e) {
16918
16894
  e.stopPropagation();
16919
- e.preventDefault();
16920
16895
  this.govBlur.emit(e);
16921
16896
  }
16922
16897
  onChangeHandler(e) {
@@ -17618,13 +17593,11 @@ class GovPagination {
17618
17593
  }
17619
17594
  onClickHandler(e, page) {
17620
17595
  e.stopPropagation();
17621
- e.preventDefault();
17622
17596
  this.recalculatePagination(page);
17623
17597
  this.govPage.emit(Object.assign({}, this.pagination));
17624
17598
  }
17625
17599
  onSelectHandler(e) {
17626
17600
  e.stopPropagation();
17627
- e.preventDefault();
17628
17601
  const target = e.target;
17629
17602
  const page = parseInt(target.value);
17630
17603
  this.resetSelectValue();
@@ -18786,7 +18759,7 @@ class GovTooltip {
18786
18759
  this.hideTooltip();
18787
18760
  });
18788
18761
  }
18789
- verifiyPositionSpace() {
18762
+ verifyPositionSpace() {
18790
18763
  // @TODO Improve positioning of broken lines
18791
18764
  const offset = 12;
18792
18765
  const windowWidth = window.innerWidth;
@@ -18832,7 +18805,7 @@ class GovTooltip {
18832
18805
  }
18833
18806
  showTooltip() {
18834
18807
  if (this.content) {
18835
- this.verifiyPositionSpace();
18808
+ this.verifyPositionSpace();
18836
18809
  this.content.setAttribute('is-visible', 'true');
18837
18810
  }
18838
18811
  }
@@ -35,7 +35,7 @@ export declare class GovTooltip {
35
35
  componentWillLoad(): void;
36
36
  private createContentWrapper;
37
37
  private registerListeners;
38
- private verifiyPositionSpace;
38
+ private verifyPositionSpace;
39
39
  private showTooltip;
40
40
  private hideTooltip;
41
41
  render(): any;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name" : "@gov-design-system-ce/components",
3
3
  "description" : "This package includes Gov Design System Web Components and related utilities.",
4
4
  "author": "Zdeněk Vítek",
5
- "version" : "0.0.10",
5
+ "version" : "0.0.11",
6
6
  "license" : "EUPL v1.2 Licensed",
7
7
  "main" : "./dist/index.cjs.js",
8
8
  "module" : "./dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/autocomplete/gov-form-autocomplete.scss?tag=gov-form-autocomplete","../../../packages/core/src/components/gov-form/autocomplete/gov-form-autocomplete.tsx"],"names":["govFormAutocompleteCss","GovFormAutocomplete","[object Object]","hostRef","this","templateResolver","item","nameKey","listBoxId","createID","newValue","validateProp","FormAutocompleteVariants","FormAutocompleteClass","root","FormAutocompleteSizes","arrowCounter","list","length","Number","isInteger","minlength","String","value","processing","searchCallback","then","response","catch","finally","validateVariant","variant","validateSize","size","h","Host","class","placeholder","name","disabled","readonly","autocomplete","required","invalid","role","maxlength","on-gov-input","throttle","onInputHandler","bind","on-gov-keyup","onKeyUpHandler","on-gov-focus","onFocusHandler","on-gov-blur","onBlurHandler","wcagAutocomplete","wcagDescribedBy","wcagLabelledBy","wcagOwns","join","wcagExpanded","focused","ref","el","inputRef","slot","id","map","index","isSelected","innerHTML","aria-posinset","tabindex","aria-setsize","onClick","onSelectHandler","aria-selected","toBoolAttr","e","doSearch","stopPropagation","preventDefault","govFocus","emit","setTimeout","govBlur","target","govInput","selected","has","govSelect","event","detail","keyCode","onArrowUp","onArrowDown","options","focus","clearValue","callback"],"mappings":"iVAAA,MAAMA,EAAyB,khDCclBC,EAAmB,MAM/BC,YAAAC,6JAFQC,KAAAC,iBAAiFC,GAAQA,EAAKF,KAAKG,oBAU3D,qFAgBZ,iBAID,yCASE,uHAqBA,uJAmCf,yBACG,YACkB,GA9F1CH,KAAKI,UAAYC,EAAS,cAiG3BP,gBAAgBQ,GACfC,EAAaC,EAA0BF,EAAUG,EAAsBC,MAIxEZ,aAAaQ,GACZC,EAAaI,EAAuBL,EAAUG,EAAsBC,MAG7DZ,YACP,GAAIE,KAAKY,aAAe,EAAG,CAC1BZ,KAAKY,aAAeZ,KAAKY,aAAe,GAIlCd,cACP,GAAIE,KAAKY,aAAeZ,KAAKa,KAAKC,OAAS,EAAG,CAC7Cd,KAAKY,aAAeZ,KAAKY,aAAe,GAIlCd,WACP,GAAIiB,OAAOC,UAAUhB,KAAKiB,YAAcC,OAAOlB,KAAKmB,OAAOL,QAAUd,KAAKiB,WAAajB,KAAKiB,UAAW,CACtGjB,KAAKa,KAAO,GACZb,KAAKY,cAAgB,EACrBZ,KAAKoB,WAAa,MAClB,OAED,GAAIpB,KAAKqB,eAAgB,CACxBrB,KAA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iBACF,GAAIU,EAAME,UAAY,GAAI1F,KAAK2F,iBAC1B,GAAIH,EAAME,UAAY,GAAI1F,KAAK4F,mBAC/B,GAAIJ,EAAME,UAAY,GAAI1F,KAAKwE,kBAOrC1E,eAAe+F,GACd,OAAO7F,KAAK6D,SAASiC,MAAMD,GAO5B/F,mBACCE,KAAKmB,MAAQ,GACbnB,KAAK6D,SAAS1C,MAAQ,SAEhBnB,KAAK6D,SAASkC,aAOrBjG,wBAAwBkG,GACvBhG,KAAKqB,eAAiB2E,EAQvBlG,0BAA0BkG,GACzBhG,KAAKC,iBAAmB+F","sourcesContent":["$class: \".gov-form-autocomplete\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@include typography($font-size-s);\n\t\t@extend %reset-ul;\n\t\tposition: absolute;\n\t\ttop: 100%;\n\t\tright: 0;\n\t\tleft: 0;\n\t\tz-index: 5;\n\t\tmax-height: rem-calc(225);\n\t\tmargin-top: rem-calc(8);\n\t\tborder: $form-autocomplete-border;\n\t\tborder-radius: $border-radius;\n\t\tbackground: $form-autocomplete-bg;\n\t\toverflow-x: hidden;\n\t\toverflow-y: auto;\n\t\toverscroll-behavior: none;\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tpadding: rem-calc(12 8);\n\t\tcursor: pointer;\n\t}\n\n\t// STATES\n\t&__list:empty {\n\t\tdisplay: none;\n\t}\n\n\t// HOVERS\n\t&__item {\n\t\t@include parameter(\"aria-selected\") {\n\t\t\tbackground: $form-autocomplete-item-select-bg;\n\t\t}\n\t\t@include hover() {\n\t\t\tbackground: $form-autocomplete-item-hover-bg;\n\t\t}\n\t}\n}\n","import { Component, Element, Host, h, Prop, Watch, Event, EventEmitter, State, Method } from '@stencil/core'\nimport { SizesType } from './constants'\nimport { createID } from '../../../utils/string.utils'\nimport { FormAutocompleteClass, FormAutocompleteVariants, VariantType, FormAutocompleteSizes } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { has, throttle } from '../../../utils/utils'\nimport { GovFormAutocompleteItem } from './gov-form-autocomplete.types'\nimport { toBoolAttr } from '../../../helpers/Dom/template'\nimport { Nullable } from '../../../types/interfaces'\n\n@Component({\n\ttag: 'gov-form-autocomplete',\n\tstyleUrl: 'gov-form-autocomplete.scss',\n})\nexport class GovFormAutocomplete {\n\tprivate inputRef?: HTMLGovFormInputElement\n\tprivate readonly listBoxId: string\n\tprivate searchCallback: (value: string) => Promise<GovFormAutocompleteItem[]>\n\tprivate templateResolver: (item: GovFormAutocompleteItem, selected: boolean) => string = item => item[this.nameKey]\n\n\tconstructor() {\n\t\tthis.listBoxId = createID('GovListBox')\n\t}\n\n\t@Element() host: HTMLGovFormInputElement\n\t/**\n\t * Value of input\n\t */\n\t@Prop({ reflect: true, mutable: true }) value = ''\n\t/**\n\t * Custom input identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Style variation of the form input.\n\t */\n\t@Prop() readonly variant?: VariantType\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: SizesType = 'm'\n\t/**\n\t * Main key name in the object\n\t */\n\t@Prop() readonly nameKey: string = 'name'\n\t/**\n\t * Name of the input.\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 input 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 * Text that appears in the form control when it has no value set\n\t */\n\t@Prop() readonly placeholder: string\n\t/**\n\t * The value is not editable\n\t */\n\t@Prop() readonly readonly: 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 * Minimum length (number of characters) of value\n\t */\n\t@Prop() readonly minlength: number = 2\n\t/**\n\t * Maximum length (number of characters) of value\n\t */\n\t@Prop() readonly maxlength: number\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 * Same as original parameter\n\t * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-owns\n\t */\n\t@Prop({ attribute: 'wcag-owns' }) readonly wcagOwns: string\n\t/**\n\t * Emitted when the input has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the input loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-input' }) govInput: EventEmitter<InputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-select' }) govSelect: EventEmitter<GovFormAutocompleteItem>\n\t@State() focused: boolean\n\t@State() processing = false\n\t@State() arrowCounter = -1\n\t@State() list: GovFormAutocompleteItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormAutocompleteVariants, newValue, FormAutocompleteClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormAutocompleteSizes, newValue, FormAutocompleteClass.root)\n\t}\n\n\tprivate onArrowUp() {\n\t\tif (this.arrowCounter > 0) {\n\t\t\tthis.arrowCounter = this.arrowCounter - 1\n\t\t}\n\t}\n\n\tprivate onArrowDown() {\n\t\tif (this.arrowCounter < this.list.length - 1) {\n\t\t\tthis.arrowCounter = this.arrowCounter + 1\n\t\t}\n\t}\n\n\tprivate doSearch() {\n\t\tif (Number.isInteger(this.minlength) && String(this.value).length <= this.minlength && this.minlength) {\n\t\t\tthis.list = []\n\t\t\tthis.arrowCounter = -1\n\t\t\tthis.processing = false\n\t\t\treturn\n\t\t}\n\t\tif (this.searchCallback) {\n\t\t\tthis.processing = true\n\t\t\tthis.searchCallback(this.value)\n\t\t\t\t.then(response => (this.list = response))\n\t\t\t\t.catch(() => (this.list = []))\n\t\t\t\t.finally(() => {\n\t\t\t\t\tthis.arrowCounter = -1\n\t\t\t\t\tthis.processing = false\n\t\t\t\t})\n\t\t}\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={FormAutocompleteClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<gov-form-input\n\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\tname={this.name}\n\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\treadonly={this.readonly}\n\t\t\t\t\tautocomplete={false}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\trequired={this.required}\n\t\t\t\t\tinvalid={this.invalid}\n\t\t\t\t\trole={'searchbox'}\n\t\t\t\t\tvalue={this.value}\n\t\t\t\t\tminlength={this.minlength}\n\t\t\t\t\tmaxlength={this.maxlength}\n\t\t\t\t\ton-gov-input={throttle(this.onInputHandler.bind(this), 200)}\n\t\t\t\t\ton-gov-keyup={this.onKeyUpHandler.bind(this)}\n\t\t\t\t\ton-gov-focus={this.onFocusHandler.bind(this)}\n\t\t\t\t\ton-gov-blur={this.onBlurHandler.bind(this)}\n\t\t\t\t\twcagAutocomplete={'list'}\n\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\twcagOwns={[this.listBoxId, this.wcagOwns].join(' ')}\n\t\t\t\t\twcagExpanded={this.list.length && this.focused}\n\t\t\t\t\tref={el => (this.inputRef = el as HTMLGovFormInputElement)}\n\t\t\t\t>\n\t\t\t\t\t<slot slot=\"right-icon\" name=\"right-icon\" />\n\t\t\t\t</gov-form-input>\n\t\t\t\t<ul class={FormAutocompleteClass.list} role={'listbox'} id={this.listBoxId}>\n\t\t\t\t\t{this.list.map((item, index) => {\n\t\t\t\t\t\tconst isSelected = this.arrowCounter === index\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\tclass={FormAutocompleteClass.item}\n\t\t\t\t\t\t\t\tinnerHTML={this.templateResolver(item, isSelected)}\n\t\t\t\t\t\t\t\trole={'option'}\n\t\t\t\t\t\t\t\taria-posinset={index}\n\t\t\t\t\t\t\t\ttabindex={isSelected ? 0 : -1}\n\t\t\t\t\t\t\t\taria-setsize={this.list.length}\n\t\t\t\t\t\t\t\tonClick={() => this.onSelectHandler(index)}\n\t\t\t\t\t\t\t\taria-selected={toBoolAttr(isSelected)}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\tthis.focused = true\n\t\tthis.arrowCounter = -1\n\t\tif ((this.value || this.minlength === 0) && this.searchCallback) {\n\t\t\tthis.doSearch()\n\t\t}\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {\n\t\tthis.focused = false\n\t\tsetTimeout(() => (this.list = []), 200)\n\t\tthis.arrowCounter = -1\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onInputHandler(e: InputEvent) {\n\t\tthis.value = (e.target as HTMLGovFormInputElement).value\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govInput.emit(e)\n\t\tthis.doSearch()\n\t}\n\n\tprivate onSelectHandler(index = -1) {\n\t\tlet selected: Nullable<GovFormAutocompleteItem> = null\n\t\tif (index > -1) {\n\t\t\tselected = this.list[index]\n\t\t} else if (has(this.arrowCounter, this.list)) {\n\t\t\tselected = this.list[this.arrowCounter]\n\t\t}\n\t\tif (selected) {\n\t\t\tthis.govSelect.emit(selected)\n\t\t\tthis.list = []\n\t\t\tif (has(this.nameKey, selected) && typeof selected[this.nameKey] === 'string') {\n\t\t\t\tthis.value = selected[this.nameKey]\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate onKeyUpHandler(e: CustomEvent) {\n\t\tconst event = e.detail as KeyboardEvent\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tif (event.keyCode === 38) this.onArrowUp()\n\t\telse if (event.keyCode === 40) this.onArrowDown()\n\t\telse if (event.keyCode === 13) this.onSelectHandler()\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.inputRef.focus(options)\n\t}\n\n\t/**\n\t * Clears whisperer value\n\t */\n\t@Method()\n\tasync clearValue(): Promise<void> {\n\t\tthis.value = ''\n\t\tthis.inputRef.value = ''\n\n\t\tawait this.inputRef.clearValue()\n\t}\n\n\t/**\n\t * Set a custom asynchronous function for the whisperer\n\t */\n\t@Method()\n\tasync setSearchCallback(callback: (value: string) => Promise<any>) {\n\t\tthis.searchCallback = callback\n\t}\n\n\t/**\n\t * Setting a custom whisper result template\n\t * @param callback\n\t */\n\t@Method()\n\tasync setTemplateResolver(callback: (item: GovFormAutocompleteItem) => string) {\n\t\tthis.templateResolver = callback\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/switch/gov-form-switch.scss?tag=gov-form-switch","../../../packages/core/src/components/gov-form/switch/gov-form-switch.tsx"],"names":["govFormSwitchCss","GovFormSwitch","[object Object]","hostRef","this","checkboxId","createID","h","govHost","host","f","govForm","newValue","isChecked","govChange","emit","checked","value","validateProp","FormSwitchSizes","FormSwitchClass","root","passAttrToControl","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","wrapCheckbox","children","noLabel","Host","class","classes","is-checked","size","invalid","toBoolAttrIfDefined","holder","Fragment","input","id","type","name","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","aria-checked","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","disabled","indicator","e","stopPropagation","preventDefault","govFocus","govBlur","target","validateWcagRef","validateWcagLabelFor"],"mappings":"+hBAAA,MAAMA,EAAmB,iiUCmBZC,EAAa,MAMzBC,YAAAC,2JAe6D,mBAIR,oBAKhB,4DAaS,2IApC7CC,KAAKC,WAAaC,EAAS,eAE3BF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,GAkEvBL,mBAAmBU,GAClBR,KAAKS,UAAYD,EACjBR,KAAKU,UAAUC,KAAK,CACnBC,QAASZ,KAAKS,UACdI,MAAOb,KAAKa,QAKdf,aAAaU,GACZM,EAAaC,EAAiBP,EAAUQ,EAAgBC,MAGzDnB,oBACCE,KAAKS,UAAYT,KAAKY,QAEtBZ,KAAKM,EAAEY,kBAAkB,OAAQ,UAGlCpB,2BACCE,KAAKM,EAAEa,gBAAgB,aAAcnB,KAAKoB,YAAcpB,KAAKC,YAC7DD,KAAKM,EAAEa,gBAAgB,WAAYE,OAAOrB,KAAKsB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACNxB,KAAKyB,gBAIb3B,SACC,MAAMW,UAAEA,GAAcT,KACtB,MAAM0B,EAAgBC,IACrB,GAAI3B,KAAK4B,QAAS,CACjB,OACCzB,EAAA,QAAA,KACEwB,GAIJ,OAAOA,GAGR,OACCxB,EAAC0B,EAAI,CAACC,MAAO9B,KAAKG,EAAE4B,QAAQf,EAAgBC,MAAKe,aAAcvB,EAAWwB,KA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B,KAAKC,WAAYD,KAAKyD,eAAgBzC,EAAgBC","sourcesContent":["/*\n * Switch\n */\n\n$class: \".gov-form-switch\";\n$indicator-ratio: calc(5 / 3);\n\n#{$class} {\n\tposition: relative;\n\tdisplay: flex;\n\t&__holder {\n\t\tdisplay: inline-flex;\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tleft: 0;\n\t\tz-index: 1;\n\t\tmargin: 0;\n\t\tappearance: none;\n\t}\n\t.gov-form-label__label {\n\t\tposition: relative;\n\t\tz-index: 1;\n\t\tmargin-bottom: 0;\n\t\tcolor: $form-switch-color;\n\t}\n\t&__indicator {\n\t\tposition: relative;\n\t\tflex: 0 0 auto;\n\t\tborder: $form-switch-indicator-border;\n\t\tbackground-color: $form-switch-indicator-bg;\n\t\ttransition: $t linear background-color;\n\t\t&::before {\n\t\t\t@include pseudo();\n\t\t\tborder-radius: 50%;\n\t\t\tbackground-color: $form-switch-indicator-circle-bg;\n\t\t\ttransition: $t linear left;\n\t\t\tbox-shadow: $form-switch-indicator-circle-box-shadow;\n\t\t}\n\t}\n\n\t// STATES\n\t// focus\n\t&__input:focus-visible ~ &__indicator {\n\t\toutline: $outline;\n\t}\n\t// checked\n\t&__input:checked + &__indicator {\n\t\tborder-color: $form-switch-indicator-bg-checked;\n\t\tbackground-color: $form-switch-indicator-bg-checked;\n\t}\n\n\t// disabled\n\t@include parameter(\"disabled\") {\n\t\tpointer-events: none;\n\t\t.gov-form-label__label {\n\t\t\tcolor: $form-state-color-disabled;\n\t\t}\n\t\t#{$class} {\n\t\t\t&__indicator {\n\t\t\t\t&::before {\n\t\t\t\t\tbackground: $form-state-bg-input-disabled;\n\t\t\t\t}\n\t\t\t}\n\t\t\t&__input:checked + #{$class}__indicator {\n\t\t\t\tborder-color: $form-state-bg-disabled;\n\t\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t\t}\n\t\t}\n\t}\n\n\t// invalid\n\t@include parameter(\"invalid\") {\n\t\t.gov-form-label__label {\n\t\t\tcolor: $form-state-color-error;\n\t\t}\n\t\t#{$class} {\n\t\t\t&__indicator {\n\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t}\n\t\t\t&__input:checked + #{$class}__indicator {\n\t\t\t\tbackground-color: $form-state-color-error;\n\t\t\t}\n\t\t}\n\t}\n\n\t// sizes\n\t@each $size, $definitions in $form-switch-sizes {\n\t\t$indicator-width: calc(get(\"indicator-height\", $definitions) * $indicator-ratio);\n\t\t$indicator-height: get(\"indicator-height\", $definitions);\n\t\t$border-offset: calc(get(\"toggle-offset\", $definitions) - rem-calc(1));\n\n\t\t&[size=\"#{$size}\"] {\n\t\t\t.gov-form-label__label {\n\t\t\t\t@include typography($size);\n\t\t\t\tmargin-bottom: 0;\n\t\t\t\tmargin-left: calc(($indicator-width + get(\"gap\", $definitions)) * -1);\n\t\t\t\tpadding-top: calc(($indicator-height - (var(--gov-text-#{$size}-font-size) * 1.5)) / 2);\n\t\t\t\tpadding-left: calc($indicator-width + get(\"gap\", $definitions));\n\t\t\t}\n\t\t\t#{$class} {\n\t\t\t\t&__holder {\n\t\t\t\t\tgap: get(\"gap\", $definitions);\n\t\t\t\t}\n\t\t\t\t&__indicator {\n\t\t\t\t\tdisplay: block;\n\t\t\t\t\twidth: $indicator-width;\n\t\t\t\t\theight: $indicator-height;\n\t\t\t\t\tborder-radius: calc($indicator-height * 0.5);\n\t\t\t\t\t&::before {\n\t\t\t\t\t\ttop: $border-offset;\n\t\t\t\t\t\tleft: $border-offset;\n\t\t\t\t\t\twidth: calc($indicator-height - (2 * get(\"toggle-offset\", $definitions)));\n\t\t\t\t\t\theight: calc($indicator-height - (2 * get(\"toggle-offset\", $definitions)));\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// STATES\n\t\t\t\t&__input[aria-checked] + #{$class}__indicator {\n\t\t\t\t\t&::before {\n\t\t\t\t\t\tleft: calc($indicator-width - $indicator-height + $border-offset);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, State, Event, EventEmitter, Element, Watch, Method } from \"@stencil/core\"\nimport { createID } from \"../../../utils/string.utils\"\nimport { validateProp } from \"../../../helpers/Validate/props\"\nimport { FormSwitchClass, FormSwitchSizes, FormSwitchSizesType } from \"./constants\"\nimport { toBoolAttrIfDefined } from \"../../../helpers/Dom/template\"\nimport { validateWcagLabelFor, validateWcagRef } from \"../../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../../helpers/Dom/win\"\nimport { delay } from \"../../../utils/utils\"\nimport { GovForm } from \"../../../helpers/Dom/form.types\"\nimport { govHost } from \"../../../helpers/Dom/template\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport { GovFormSwitchChangeEvent } from \"./interfaces\"\nimport Fragment from \"../../../helpers/Fragment\"\n\n@Component({\n\ttag: \"gov-form-switch\",\n\tstyleUrl: \"gov-form-switch.scss\",\n})\nexport class GovFormSwitch {\n\tprivate readonly 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}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel('identifier', this.identifier || this.checkboxId)\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={this.h.classes(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"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.scss?tag=gov-form-checkbox","../../../packages/core/src/components/gov-form/checkbox/gov-form-checkbox.tsx"],"names":["govFormCheckboxCss","GovFormCheckbox","[object Object]","hostRef","this","checkboxId","createID","h","govHost","host","f","govForm","newValue","isChecked","govChange","emit","checked","value","validateProp","FormCheckboxSizes","FormCheckboxClass","root","passAttrToControl","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","wrapCheckbox","children","noLabel","Host","class","is-checked","size","invalid","toBoolAttrIfDefined","Fragment","id","type","name","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","aria-checked","toBoolAttr","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","disabled","check","e","stopPropagation","preventDefault","govFocus","govBlur","target","validateWcagRef","validateWcagLabelFor"],"mappings":"siBAAA,MAAMA,EAAqB,2qPCmBdC,EAAe,MAM3BC,YAAAC,2JAeqD,oBAKhB,4DAaW,2CAQa,mHAxC5DC,KAAKC,WAAaC,EAAS,eAE3BF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,GAkEvBL,mBAAmBU,GAClBR,KAAKS,UAAYD,EACjBR,KAAKU,UAAUC,KAAK,CACnBC,QAASZ,KAAKS,UACdI,MAAOb,KAAKa,QAKdf,aAAaU,GACZM,EAAaC,EAAmBP,EAAUQ,EAAkBC,MAG7DnB,oBACCE,KAAKS,UAAYT,KAAKY,QAEtBZ,KAAKM,EAAEY,kBAAkB,OAAQ,YAGlCpB,2BACCE,KAAKM,EAAEa,gBAAgB,aAAcnB,KAAKoB,YAAcpB,KAAKC,YAC7DD,KAAKM,EAAEa,gBAAgB,WAAYE,OAAOrB,KAAKsB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACNxB,KAAKyB,gBAIb3B,SACC,MAAMW,UAAEA,GAAcT,KACtB,MAAM0B,EAAgBC,IACrB,GAAI3B,KAAK4B,QAAS,CACjB,OACCzB,EAAA,QAAA,KACEwB,GAIJ,OAAOA,GAGR,OACCxB,EAAC0B,EAAI,CAACC,MAAOd,EAAkBC,KAAIc,aAActB,EAAWuB,KAAMhC,KAAKgC,KAAMC,QAASC,EAAoBlC,KAAKiC,UAC7GP,EACAvB,EAACgC,EAAQ,KACRhC,EAAA,QAAA,CACCiC,GAAIpC,KAAKoB,YAAcpB,KAAKC,WAC5BoC,KAAK,WACLxB,MAAOb,KAAKa,MACZyB,KAAMtC,KAAKsC,KACX1B,QAASZ,KAAKS,UACd8B,QAASvC,KAAKwC,eAAeC,KAAKzC,MAClC0C,SAAU1C,KAAK2C,gBAAgBF,KAAKzC,MACpC4C,QAAS5C,KAAK6C,eAAeJ,KAAKzC,MAClC8C,OAAQ9C,KAAK+C,cAAcN,KAAKzC,MAChCsB,SAAUtB,KAAKsB,SAAQ0B,eACTC,EAAWjD,KAAKS,WAAUyC,gBACzBhB,EAAoBlC,KAAKsB,UAAS6B,eACnCjB,EAAoBlC,KAAKiC,SAAQmB,mBAC7BpD,KAAKqD,gBAAeC,kBACrBtD,KAAKuD,eAAcC,gBACrBtB,EAAoBlC,KAAKyD,YAEzCtD,EAAA,OAAA,KACCA,EAAA,OAAA,CAAMmC,KAAK,UACXnC,EAAA,WAAA,CAAU2B,MAAOd,EAAkB0C,MAAOpB,KAAK,iBAQ7CxC,eAAe6D,GACtBA,EAAEC,kBACFD,EAAEE,iBACF7D,KAAK8D,SAASnD,KAAKgD,GAGZ7D,cAAc6D,GACrBA,EAAEC,kBACFD,EAAEE,iBACF7D,KAAK+D,QAAQpD,KAAKgD,GAGX7D,eAAe6D,GACtBA,EAAEC,kBAGK9D,gBAAgB6D,GACvB3D,KAAKS,UAAakD,EAAEK,OAA4BpD,QAChD+C,EAAEC,kBACFD,EAAEE,iBACF7D,KAAKU,UAAUC,KAAK,CACnBC,QAASZ,KAAKS,UACdI,MAAOb,KAAKa,QAQdf,qBACCmE,EAAgBjE,KAAKqD,gBAAiB,oBAAqBrC,EAAkBC,MAC7EgD,EAAgBjE,KAAKuD,eAAgB,mBAAoBvC,EAAkBC,MAC3EiD,EAAqBlE,KAAKoB,YAAcpB,KAAKC,WAAYD,KAAKuD,eAAgBvC,EAAkBC","sourcesContent":["/*\n * Checkbox\n */\n\n@import \"../checkbox/gov-form-checkbox-core.scss\";\n$class: \".gov-form-checkbox\";\n\n#{$class} {\n\t@extend %form-checkbox-core;\n\tinput + span {\n\t\t&::before {\n\t\t\tborder-radius: $border-radius;\n\t\t}\n\t}\n\t&__check {\n\t\tposition: absolute;\n\t\tcolor: $form-checkbox-check-color;\n\t\topacity: 0;\n\t\ttransition: $t linear opacity;\n\t}\n\n\t// STATES\n\tinput:checked + span::before {\n\t\tbackground: $form-checkbox-indicator-bg;\n\t}\n\tinput:checked + span &__check {\n\t\topacity: 1;\n\t}\n\t@include parameter(\"invalid\") {\n\t\tinput:checked + span::before {\n\t\t\tbackground: $form-state-color-error;\n\t\t}\n\t}\n\t@include parameter(\"disabled\") {\n\t\tinput:checked + span::before {\n\t\t\tborder-color: $form-state-bg-disabled;\n\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $form-checkbox-core-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__check {\n\t\t\t\t\ttop: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n\t\t\t\t\tleft: calc((get(\"indicator-size\", $definitions) - get(\"check-size\", $definitions)) / 2);\n\t\t\t\t\twidth: get(\"check-size\", $definitions);\n\t\t\t\t\theight: get(\"check-size\", $definitions);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","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 { FormCheckboxClass, FormCheckboxSizes, FormCheckboxSizesType } 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, toBoolAttr } from \"../../../helpers/Dom/template\"\nimport { GovHost } from \"../../../helpers/Dom/template.types\"\nimport { govForm } from \"../../../helpers/Dom/form\"\nimport { GovFormCheckboxChangeEvent } from \"./interfaces\"\nimport Fragment from \"../../../helpers/Fragment\"\n\n@Component({\n\ttag: \"gov-form-checkbox\",\n\tstyleUrl: \"gov-form-checkbox.scss\",\n})\nexport class GovFormCheckbox {\n\tprivate readonly 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: HTMLGovFormCheckboxElement\n\t/**\n\t * Value of checkbox\n\t */\n\t@Prop() readonly value: string\n\t/**\n\t * Checkbox 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 checkbox component disabled.\n\t * This prevents users from being able to interact with the checkbox, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Name of the checkbox.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Checkbox's size.\n\t */\n\t@Prop() readonly size?: FormCheckboxSizesType = \"m\"\n\t/**\n\t * Custom checkbox identifier.\n\t */\n\t@Prop({ attribute: \"identifier\" }) readonly identifier: 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 * 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 checkbox has focus.\n\t */\n\t@Event({ eventName: \"gov-focus\" }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the checkbox loses focus.\n\t */\n\t@Event({ eventName: \"gov-blur\" }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the checkbox change value.\n\t */\n\t@Event({ eventName: \"gov-change\" }) govChange: EventEmitter<GovFormCheckboxChangeEvent>\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(FormCheckboxSizes, newValue, FormCheckboxClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.isChecked = this.checked\n\n\t\tthis.f.passAttrToControl(\"type\", \"checkbox\")\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.f.passAttrToLabel('identifier', this.identifier || this.checkboxId)\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={FormCheckboxClass.root} is-checked={isChecked} size={this.size} invalid={toBoolAttrIfDefined(this.invalid)}>\n\t\t\t\t{wrapCheckbox(\n\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tid={this.identifier || this.checkboxId}\n\t\t\t\t\t\t\ttype=\"checkbox\"\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tchecked={this.isChecked}\n\t\t\t\t\t\t\tonClick={this.onClickHandler.bind(this)}\n\t\t\t\t\t\t\tonChange={this.onChangeHandler.bind(this)}\n\t\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\taria-checked={toBoolAttr(this.isChecked)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t<slot name=\"label\" />\n\t\t\t\t\t\t\t<gov-icon class={FormCheckboxClass.check} name=\"check-lg\"></gov-icon>\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</Fragment>\n\t\t\t\t)}\n\t\t\t</Host>\n\t\t)\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 onClickHandler(e: PointerEvent) {\n\t\te.stopPropagation()\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\", FormCheckboxClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, \"wcag-labelled-by\", FormCheckboxClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.checkboxId, this.wcagLabelledBy, FormCheckboxClass.root)\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/input/gov-form-input.scss?tag=gov-form-input","../../../packages/core/src/components/gov-form/input/gov-form-input.tsx"],"names":["govFormInputCss","Tags","GovFormInput","[object Object]","hostRef","this","h","govHost","host","inputId","createID","f","govForm","newValue","validateProp","FormInputVariants","FormInputClass","root","FormInputSizes","validateVariant","variant","validateSize","size","passAttrToControl","multiline","TEXTAREA","INPUT","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","Tag","Host","class","type","hasSlot","name","success","invalid","slot","inputType","disabled","id","identifier","onFocus","onFocusHandler","bind","onInput","onInputHandler","onBlur","onBlurHandler","onKeyUp","onKeyUpHandler","ref","el","inputRef","placeholder","value","readonly","toBoolAttrIfDefined","autocomplete","toOnOffAttrIfDefined","autocorrect","minlength","maxlength","rows","cols","role","aria-required","aria-invalid","aria-disabled","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-owns","wcagOwns","aria-expanded","wcagExpanded","aria-autocomplete","wcagAutocomplete","e","stopPropagation","preventDefault","focused","govFocus","emit","govBlur","govKeyUp","target","govInput","options","focus","validateWcagRef","validateWcagLabelFor"],"mappings":"ygBAAA,MAAMA,EAAkB,mxTCaxB,IAAKC,GAAL,SAAKA,GACJA,EAAA,SAAA,QACAA,EAAA,YAAA,YAFD,CAAKA,IAAAA,EAAI,WASIC,EAAY,MAMxBC,YAAAC,kQA0B6C,uGAqBR,6NAsCG,0NApFvCC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,QAAUC,EAAS,YACxBL,KAAKM,EAAIC,EAAQL,EAAQF,KAAKG,OAmI/BL,gBAAgBU,GACfC,EAAaC,EAAmBF,EAAUG,EAAeC,MAI1Dd,aAAaU,GACZC,EAAaI,EAAgBL,EAAUG,EAAeC,MAGvDd,oBACCE,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BAAqB1D,EAAeC,MAC1E8E,EAAgB1F,KAAKuE,eAAgB,mBAAoB5D,EAAeC,MACxE8E,EAAgB1F,KAAKyE,SAAU,YAAa9D,EAAeC,MAC3D+E,EAAqB3F,KAAKwC,YAAcxC,KAAKI,QAASJ,KAAKuE,eAAgB5D,EAAeC","sourcesContent":["/*\n * Input\n */\n\n@import \"../input/gov-form-input-core.scss\";\n$class: \".gov-form-input\";\n\n#{$class} {\n\t@extend %form-input-core;\n\n\t// STATES\n\t@include parameter(\"invalid\") {\n\t\t*[slot=\"right-icon\"]:not(.icon-validation):not(.icon-arrow) {\n\t\t\tdisplay: none;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t&[type=\"reset\"] {\n\t\tinput {\n\t\t\tborder-width: 0;\n\t\t\t&:focus {\n\t\t\t\toutline: none;\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, Host, h, Prop, Watch, Event, EventEmitter, State, Method } from '@stencil/core'\nimport { GovHost } from '../../../helpers/Dom/template.types'\nimport { FormInputSizes, FormInputSizesType, InputType, Type } from './constants'\nimport { createID } from '../../../utils/string.utils'\nimport { govHost, toBoolAttrIfDefined, toOnOffAttrIfDefined } from '../../../helpers/Dom/template'\nimport { FormInputClass, FormInputVariants, FormInputVariantType } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { delay } from '../../../utils/utils'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { GovForm } from '../../../helpers/Dom/form.types'\nimport { govForm } from '../../../helpers/Dom/form'\n\nenum Tags {\n\tINPUT = 'input',\n\tTEXTAREA = 'textarea',\n}\n\n@Component({\n\ttag: 'gov-form-input',\n\tstyleUrl: 'gov-form-input.scss',\n})\nexport class GovFormInput {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly inputId: string\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.inputId = createID('GovInput')\n\t\tthis.f = govForm(govHost(this.host))\n\t}\n\n\t@Element() host: HTMLGovFormInputElement\n\t/**\n\t * Value of input\n\t */\n\t@Prop({ reflect: true, mutable: true }) value: string\n\t/**\n\t * Custom input identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Style variation of the form input.\n\t */\n\t@Prop() readonly variant?: FormInputVariantType\n\t/**\n\t * Indicates the entered value of child form element does conform to the format expected by the application.\n\t */\n\t@Prop() readonly success: boolean\n\t/**\n\t * Input’s size.\n\t */\n\t@Prop() readonly size?: FormInputSizesType = 'm'\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Generates a texarea for the possibility of multiple lines\n\t */\n\t@Prop() readonly multiline: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-rows\n\t */\n\t@Prop() readonly rows: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-cols\n\t */\n\t@Prop() readonly cols: number\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 input 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 * Text that appears in the form control when it has no value set\n\t */\n\t@Prop() readonly placeholder: string\n\t/**\n\t * The value is not editable\n\t */\n\t@Prop() readonly readonly: boolean\n\t/**\n\t * Minimum length (number of characters) of value\n\t */\n\t@Prop() readonly minlength: number\n\t/**\n\t * Maximum length (number of characters) of value\n\t */\n\t@Prop() readonly maxlength: number\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocomplete\n\t */\n\t@Prop() readonly autocomplete: boolean\n\t/**\n\t * Same as original parameter https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#attr-autocorrect\n\t */\n\t@Prop() readonly autocorrect: boolean\n\t/**\n\t * Defineds the visual style of input\n\t */\n\t@Prop() readonly type?: Type\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n\t */\n\t@Prop() readonly inputType: InputType = 'text'\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/input_role\n\t */\n\t@Prop() readonly role: 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 * 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 * Indicates whether inputting text could trigger display of one or more predictions of the user's intended value.\n\t */\n\t@Prop({ attribute: 'wcag-autocomplete' }) readonly wcagAutocomplete: string\n\t/**\n\t * Attribute is set on an element to indicate if a control is expanded or collapsed\n\t */\n\t@Prop({ attribute: 'wcag-expanded' }) readonly wcagExpanded: boolean\n\t/**\n\t * Emitted when the input has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the input loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-input' }) govInput: EventEmitter<InputEvent>\n\t/**\n\t * Emitted when the input change value.\n\t */\n\t@Event({ eventName: 'gov-keyup' }) govKeyUp: EventEmitter<KeyboardEvent>\n\t@State() focused: boolean\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormInputVariants, newValue, FormInputClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormInputSizes, newValue, FormInputClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\n\t\tthis.f.passAttrToControl('type', this.multiline ? Tags.TEXTAREA : Tags.INPUT)\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\tconst Tag = this.multiline ? Tags.TEXTAREA : Tags.INPUT\n\n\t\treturn (\n\t\t\t<Host class={FormInputClass.root} size={this.size} variant={this.variant} type={this.type}>\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{this.h.hasSlot('left-icon') && <slot name=\"left-icon\" />}\n\n\t\t\t\t\t{this.h.hasSlot('right-icon') && !(this.success || this.invalid) && <slot name=\"right-icon\" />}\n\n\t\t\t\t\t{this.success && !this.multiline && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"check-lg\"></gov-icon>}\n\t\t\t\t\t{this.invalid && !this.multiline && <gov-icon slot=\"right-icon\" class=\"icon-validation\" name=\"exclamation-lg\"></gov-icon>}\n\t\t\t\t\t<Tag\n\t\t\t\t\t\ttype={this.inputType}\n\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\tid={this.identifier || this.inputId}\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\tonFocus={this.onFocusHandler.bind(this)}\n\t\t\t\t\t\tonInput={this.onInputHandler.bind(this)}\n\t\t\t\t\t\tonBlur={this.onBlurHandler.bind(this)}\n\t\t\t\t\t\tonKeyUp={this.onKeyUpHandler.bind(this)}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\treadonly={toBoolAttrIfDefined(this.readonly)}\n\t\t\t\t\t\tautocomplete={toOnOffAttrIfDefined(this.autocomplete)}\n\t\t\t\t\t\tautocorrect={toOnOffAttrIfDefined(this.autocorrect)}\n\t\t\t\t\t\tminlength={this.minlength}\n\t\t\t\t\t\tmaxlength={this.maxlength}\n\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\trows={this.rows}\n\t\t\t\t\t\tcols={this.cols}\n\t\t\t\t\t\trole={this.role}\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-disabled={toBoolAttrIfDefined(this.disabled)}\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\taria-expanded={toBoolAttrIfDefined(this.wcagExpanded)}\n\t\t\t\t\t\taria-autocomplete={this.wcagAutocomplete}\n\t\t\t\t\t/>\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\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.focused = true\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.focused = false\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onKeyUpHandler(e: KeyboardEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govKeyUp.emit(e)\n\t}\n\n\tprivate onInputHandler(e: InputEvent) {\n\t\tthis.value = (e.target as HTMLInputElement).value\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.govInput.emit(e)\n\t}\n\n\t/**\n\t * Returns the current state of the component\n\t */\n\t@Method()\n\tasync setFocus(options?: FocusOptions): Promise<void> {\n\t\treturn this.inputRef.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 * Clears input value\n\t */\n\t@Method()\n\tasync clearValue(): Promise<void> {\n\t\tthis.value = ''\n\t\tthis.inputRef.value = ''\n\t}\n\n\t/**\n\t * Returns an instance of the native html input element\n\t */\n\t@Method()\n\tasync getInstance(): 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', FormInputClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormInputClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormInputClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.inputId, this.wcagLabelledBy, FormInputClass.root)\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.scss?tag=gov-form-multi-select","../../../packages/core/src/components/gov-form/multiselect/gov-form-multi-select.tsx"],"names":["govFormMultiSelectCss","GovFormMultiSelect","[object Object]","hostRef","this","selectId","createID","listId","newValue","validateProp","FormMultiselectVariants","FormMultiSelectClass","root","FormMultiselectSizes","govChange","emit","validateVariant","variant","validateSize","size","Array","from","selectRef","querySelectorAll","filter","option","disabled","selected","map","name","textContent","value","autocompleteRef","addEventListener","onSelectHandler","bind","onInputHandler","onFocusHandler","onBlurHandler","setSearchCallback","Promise","resolve","data","getAvailableOptions","String","length","removeDiacritics","toLowerCase","indexOf","then","selectedOptions","findIndex","querySelector","newOption","index","getOptionIndex","getOptionElement","removeOption","splice","initAutocomplete","delay","forEach","selectOption","canValidateWcagOnRender","validateWcag","h","Host","class","wrap","identifier","required","invalid","placeholder","ref","el","minlength","wcagDescribedBy","wcagLabelledBy","wcagOwns","slot","hidden","aria-hidden","multiple","aria-disabled","toBoolAttrIfDefined","aria-required","aria-invalid","aria-describedby","aria-labelledby","aria-owns","role","id","list","item","wcagLabel","type","on-gov-click","onTagRemove","e","stopPropagation","preventDefault","focused","govFocus","govBlur","target","detail","clearValue","focus","options","validateWcagRef","validateWcagLabelFor"],"mappings":"sZAAA,MAAMA,EAAwB,gwXCejBC,EAAkB,MAO9BC,YAAAC,+MAqBmD,sCASd,2MAoCgB,GAjEpDC,KAAKC,SAAWC,EAAS,aACzBF,KAAKG,OAASD,EAAS,gBAmExBJ,gBAAgBM,GACfC,EAAaC,EAAyBF,EAAUG,EAAqBC,MAItEV,aAAaM,GACZC,EAAaI,EAAsBL,EAAUG,EAAqBC,MAInEV,WAAWM,GACVJ,KAAKU,UAAUC,KAAKP,GAGrBN,oBACCE,KAAKY,gBAAgBZ,KAAKa,SAC1Bb,KAAKc,aAAad,KAAKe,MAGhBjB,sBACP,OAAOkB,MAAMC,KAAKjB,KAAKkB,UAAUC,iBAAiB,WAChDC,QAAQC,KAAgCA,EAAOC,UAAYD,EAAOE,YAClEC,KAAKH,IAAyB,CAAQI,KAAMJ,EAAOK,YAAaC,MAAON,EAAOM,UAGzE7B,mBACPE,KAAK4B,gBAAgBC,iBAAiB,aAAc7B,KAAK8B,gBAAgBC,KAAK/B,OAC9EA,KAAK4B,gBAAgBC,iBAAiB,YAAa7B,KAAKgC,eAAeD,KAAK/B,OAC5EA,KAAK4B,gBAAgBC,iBAAiB,YAAa7B,KAAKiC,eAAeF,KAAK/B,OAC5EA,KAAK4B,gBAAgBC,iBAAiB,WAAY7B,KAAKkC,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CwC,EAAA,WAAA,CAAUpC,KAAK,eAUf3B,eAAegG,GACtBA,EAAEC,kBACFD,EAAEE,iBACFhG,KAAKiG,QAAU,KACfjG,KAAKkG,SAASvF,KAAKmF,GAGZhG,cAAcgG,GAAgBA,EAAEC,kBACvCD,EAAEC,kBACFD,EAAEE,iBACFhG,KAAKiG,QAAU,MACfjG,KAAKmG,QAAQxF,KAAKmF,GAGXhG,eAAegG,GACtB9F,KAAK2B,MAASmE,EAAEM,OAA6BzE,MAC7CmE,EAAEC,kBACFD,EAAEE,iBAGKlG,gBAAgBgG,GACvBA,EAAEC,kBACFD,EAAEE,iBACF,MAAMrE,EAAQmE,EAAEO,OAChBrG,KAAK0D,aAAa/B,GAClB3B,KAAK2B,MAAQ,GACb3B,KAAK4B,gBAAgB0E,aACrBtG,KAAK4B,gBAAgB2E,QAGdzG,YAAYuD,GACnBrD,KAAKqD,aAAaA,GAOnBvD,eAAe0G,GACd,OAAOxG,KAAKkB,UAAUqF,MAAMC,GAO7B1G,eAAe6B,GACd3B,KAAK2B,MAAQA,EAOd7B,oBACC,OAAOE,KAAKkB,UAObpB,qBACC2G,EAAgBzG,KAAKwE,gBAAiB,oBAAqBjE,EAAqBC,MAChFiG,EAAgBzG,KAAKyE,eAAgB,mBAAoBlE,EAAqBC,MAC9EiG,EAAgBzG,KAAK0E,SAAU,YAAanE,EAAqBC,MACjEkG,EAAqB1G,KAAKiE,YAAcjE,KAAKC,SAAUD,KAAKyE,eAAgBlE,EAAqBC","sourcesContent":["/*\n * Multiselect\n */\n\n@import \"../select/gov-form-select-core.scss\";\n$class: \".gov-form-multi-select\";\n\n#{$class} {\n\t@extend %form-select-core;\n\tflex-wrap: wrap;\n\t&__wrap {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\twidth: 100%;\n\t}\n\t&__list {\n\t\t@extend %reset-ul;\n\t\t@include typography($font-size-xs);\n\t\tdisplay: flex;\n\t\tgap: rem-calc(8);\n\t\tflex-wrap: wrap;\n\t}\n\t&__list > &__item {\n\t\t@extend %reset-ul-li;\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tflex: 0 0 auto;\n\t\talign-items: center;\n\t\tpadding: rem-calc(0 0 0 8);\n\t\tbackground: $form-multiselect-bg;\n\t\ttransition: $t linear background-color;\n\t}\n}\n","import { Component, Element, h, State, Prop, Event, EventEmitter, Watch, Host, Method } from '@stencil/core'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { FormMultiselectSizesType, FormMultiselectVariants, FormMultiselectVariantType, FormMultiSelectClass, FormMultiselectSizes } from './constants'\nimport { validateProp } from '../../../helpers/Validate/props'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { createID, removeDiacritics } from '../../../utils/string.utils'\nimport { delay } from '../../../utils/utils'\nimport { Nullable } from '../../../types/interfaces'\nimport { GovFormMultiSelectItem } from './interfaces'\n\n@Component({\n\ttag: 'gov-form-multi-select',\n\tstyleUrl: 'gov-form-multi-select.scss',\n})\nexport class GovFormMultiSelect {\n\tprivate selectRef?: HTMLSelectElement\n\tprivate autocompleteRef?: HTMLGovFormAutocompleteElement\n\n\tprivate readonly selectId: string\n\tprivate readonly listId: string\n\n\tconstructor() {\n\t\tthis.selectId = createID('GovSelect')\n\t\tthis.listId = createID('GovMultiList')\n\t}\n\n\t@Element() host: HTMLGovFormSelectElement\n\t/**\n\t * Custom select identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Custom select placeholder.\n\t */\n\t@Prop({ attribute: 'placeholder' }) readonly placeholder: string\n\t/**\n\t * Style variation of the form select.\n\t */\n\t@Prop() readonly variant?: FormMultiselectVariantType\n\t/**\n\t * Select’s size.\n\t */\n\t@Prop() readonly size?: FormMultiselectSizesType = '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 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<GovFormMultiSelectItem[]>\n\t@State() focused: boolean\n\t@State() value: string\n\t@State() selectedOptions: GovFormMultiSelectItem[] = []\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(FormMultiselectVariants, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(FormMultiselectSizes, newValue, FormMultiSelectClass.root)\n\t}\n\n\t@Watch('selectedOptions')\n\temitChange(newValue: GovFormMultiSelectItem[]) {\n\t\tthis.govChange.emit(newValue)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t}\n\n\tprivate getAvailableOptions(): GovFormMultiSelectItem[] {\n\t\treturn Array.from(this.selectRef.querySelectorAll('option'))\n\t\t\t.filter((option: HTMLOptionElement) => !(option.disabled || option.selected))\n\t\t\t.map((option: HTMLOptionElement) => ({ name: option.textContent, value: option.value }))\n\t}\n\n\tprivate initAutocomplete() {\n\t\tthis.autocompleteRef.addEventListener('gov-select', this.onSelectHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-input', this.onInputHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-focus', this.onFocusHandler.bind(this))\n\t\tthis.autocompleteRef.addEventListener('gov-blur', this.onBlurHandler.bind(this))\n\t\tthis.autocompleteRef\n\t\t\t.setSearchCallback(value => {\n\t\t\t\treturn new Promise(resolve => {\n\t\t\t\t\tconst data = this.getAvailableOptions()\n\t\t\t\t\tif (String(value).length === 0) {\n\t\t\t\t\t\treturn resolve(data)\n\t\t\t\t\t}\n\t\t\t\t\tresolve(\n\t\t\t\t\t\tdata.filter(({ name }) => {\n\t\t\t\t\t\t\tif (!name) return false\n\t\t\t\t\t\t\treturn removeDiacritics(name).toLowerCase().indexOf(removeDiacritics(value).toLowerCase()) > -1\n\t\t\t\t\t\t})\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t})\n\t\t\t.then()\n\t}\n\n\tprivate getOptionIndex(value: GovFormMultiSelectItem): number {\n\t\treturn this.selectedOptions.findIndex(option => option.value === value.value && option.name === value.name)\n\t}\n\n\tprivate getOptionElement(value: GovFormMultiSelectItem): Nullable<HTMLOptionElement> {\n\t\treturn this.selectRef.querySelector('option[value=\"' + value.value + '\"]') as HTMLOptionElement\n\t}\n\n\tprivate selectOption(newOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(newOption)\n\t\tif (index === -1) {\n\t\t\tthis.selectedOptions = [...this.selectedOptions, newOption]\n\t\t\tconst option = this.getOptionElement(newOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = true\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeOption(removeOption: GovFormMultiSelectItem) {\n\t\tconst index = this.getOptionIndex(removeOption)\n\t\tif (index !== -1) {\n\t\t\tthis.selectedOptions.splice(index, 1)\n\t\t\tthis.selectedOptions = [...this.selectedOptions]\n\t\t\tconst option = this.getOptionElement(removeOption)\n\t\t\tif (option) {\n\t\t\t\toption.selected = false\n\t\t\t}\n\t\t}\n\t}\n\n\tasync componentDidRender() {\n\t\tthis.initAutocomplete()\n\t\tawait delay(0)\n\t\tthis.selectRef.querySelectorAll('option').forEach((option: HTMLOptionElement) => {\n\t\t\tif (option.selected) {\n\t\t\t\tthis.selectOption({\n\t\t\t\t\tname: option.textContent,\n\t\t\t\t\tvalue: option.value,\n\t\t\t\t})\n\t\t\t}\n\t\t})\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={FormMultiSelectClass.root} size={this.size} variant={this.variant}>\n\t\t\t\t<div class={FormMultiSelectClass.wrap}>\n\t\t\t\t\t<div class=\"element\">\n\t\t\t\t\t\t<gov-form-autocomplete\n\t\t\t\t\t\t\tvalue={this.value}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tidentifier={this.identifier || this.selectId}\n\t\t\t\t\t\t\trequired={false}\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\t\t\tinvalid={this.invalid}\n\t\t\t\t\t\t\tplaceholder={this.placeholder}\n\t\t\t\t\t\t\tref={el => (this.autocompleteRef = el as HTMLGovFormAutocompleteElement)}\n\t\t\t\t\t\t\tminlength={0}\n\t\t\t\t\t\t\twcagDescribedBy={this.wcagDescribedBy}\n\t\t\t\t\t\t\twcagLabelledBy={this.wcagLabelledBy}\n\t\t\t\t\t\t\twcagOwns={this.listId}\n\t\t\t\t\t\t/>\n\t\t\t\t\t\t<gov-icon slot=\"right-icon\" class=\"icon-arrow\" name=\"chevron-down\"></gov-icon>\n\t\t\t\t\t\t<select\n\t\t\t\t\t\t\thidden\n\t\t\t\t\t\t\taria-hidden={true}\n\t\t\t\t\t\t\tmultiple\n\t\t\t\t\t\t\trequired={this.required}\n\t\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\t\tdisabled={this.disabled}\n\t\t\t\t\t\t\tref={el => (this.selectRef = el as HTMLSelectElement)}\n\t\t\t\t\t\t\taria-disabled={toBoolAttrIfDefined(this.disabled)}\n\t\t\t\t\t\t\taria-required={toBoolAttrIfDefined(this.required)}\n\t\t\t\t\t\t\taria-invalid={toBoolAttrIfDefined(this.invalid)}\n\t\t\t\t\t\t\taria-describedby={this.wcagDescribedBy}\n\t\t\t\t\t\t\taria-labelledby={this.wcagLabelledBy}\n\t\t\t\t\t\t\taria-owns={this.wcagOwns}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<slot></slot>\n\t\t\t\t\t\t</select>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t\t<ul role=\"listbox\" id={this.listId} class={FormMultiSelectClass.list}>\n\t\t\t\t\t{this.selectedOptions.map(option => {\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<li class={FormMultiSelectClass.item} role=\"option\">\n\t\t\t\t\t\t\t\t{option.name}\n\t\t\t\t\t\t\t\t<gov-button\n\t\t\t\t\t\t\t\t\twcagLabel={'Odebrat vybranou položku ' + option.name}\n\t\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\t\ttype=\"base\"\n\t\t\t\t\t\t\t\t\tsize=\"s\"\n\t\t\t\t\t\t\t\t\ton-gov-click={() => this.onTagRemove(option)}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<gov-icon name=\"x-lg\"></gov-icon>\n\t\t\t\t\t\t\t\t</gov-button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t)\n\t\t\t\t\t})}\n\t\t\t\t</ul>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onFocusHandler(e: FocusEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.focused = true\n\t\tthis.govFocus.emit(e)\n\t}\n\n\tprivate onBlurHandler(e: FocusEvent) {e.stopPropagation()\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.focused = false\n\t\tthis.govBlur.emit(e)\n\t}\n\n\tprivate onInputHandler(e: Event) {\n\t\tthis.value = (e.target as HTMLSelectElement).value\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent) {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tconst value = e.detail as GovFormMultiSelectItem\n\t\tthis.selectOption(value)\n\t\tthis.value = ''\n\t\tthis.autocompleteRef.clearValue()\n\t\tthis.autocompleteRef.focus()\n\t}\n\n\tprivate onTagRemove(removeOption: GovFormMultiSelectItem) {\n\t\tthis.removeOption(removeOption)\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.wcagDescribedBy, 'wcag-described-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormMultiSelectClass.root)\n\t\tvalidateWcagRef(this.wcagOwns, 'wcag-owns', FormMultiSelectClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.selectId, this.wcagLabelledBy, FormMultiSelectClass.root)\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.scss?tag=gov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"names":["govTooltipCss","GovTooltip","[object Object]","hostRef","undefined","this","h","govHost","host","tooltipId","createID","newValue","validateProp","TooltipVariant","TooltipClass","root","TooltipSize","TooltipPosition","validateVariant","variant","validateSize","size","validatePosition","position","createContentWrapper","registerListeners","hasContentInside","querySelector","TooltipContentClass","content","document","createElement","innerHTML","message","appendChild","setAttribute","_a","identifier","addEventListener","e","preventDefault","showTooltip","hideTooltip","offset","windowWidth","window","innerWidth","trigger","getBoundingClientRect","trgWidth","offsetWidth","triggerPos","left","documentElement","scrollLeft","top","scrollTop","tltWidth","LEFT","TOP","style","width","transform","RIGHT","right","verifiyPositionSpace","Host","class","classes","tabindex","aria-describedby"],"mappings":"gUAAA,MAAMA,EAAgB,u/CCoBTC,EAAU,MAKtBC,YAAAC,0BASgD,oBAIN,kBAIF,qBAILC,8CAQmBA,UA5BrDC,KAAKC,EAAIC,EAAQF,KAAKG,MACtBH,KAAKI,UAAYC,EAAS,cA8B3BR,gBAAgBS,GACfC,EAAaC,EAAgBF,EAAUG,EAAaC,MAIrDb,aAAaS,GACZC,EAAaI,EAAaL,EAAUG,EAAaC,MAIlDb,iBAAiBS,GAChBC,EAAaK,EAAiBN,EAAUG,EAAaC,MAGtDb,oBACCG,KAAKa,gBAAgBb,KAAKc,SAC1Bd,KAAKe,aAAaf,KAAKgB,MACvBhB,KAAKiB,iBAAiBjB,KAAKkB,UAE3BlB,KAAKmB,uBACLnB,KAAKoB,oBAGEvB,6BACP,MAAMwB,EAAmBrB,KAAKG,KAAKmB,cAAcC,EAAoBb,MACrE,GAAIW,EAAkB,CACrBrB,KAAKwB,QAAUH,MACT,CACNrB,KAAKwB,QAAUC,SAASC,cAAcH,EAAoBb,MAC1DV,KAAKwB,QAAQG,UAAY3B,KAAK4B,QAC9B5B,KAAKG,KAAK0B,YAAY7B,K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C,KAAOT,EAAS,KACjEtC,KAAKwB,QAAQ+B,MAAME,UAAY,YAE1B,CAEN,GAAIL,EAAW,EAAIN,EAAWC,KAAM,CACnC/C,KAAKwB,QAAQ+B,MAAMR,KAAO,MAC1B/C,KAAKwB,QAAQ+B,MAAMC,MAAQhB,OAAOC,WAAaK,EAAWC,KAAOT,EAAS,KAC1EtC,KAAKwB,QAAQ+B,MAAME,UAAY,YAG3B,GAAIL,EAAW,EAAIb,GAAeO,EAAWC,KAAOK,GAAW,CACnEpD,KAAKwB,QAAQ+B,MAAMI,MAAQ,MAC3B3D,KAAKwB,QAAQ+B,MAAMR,KAAO,OAC1B/C,KAAKwB,QAAQ+B,MAAMC,MAAQZ,EAAWE,EAAWC,KAAOT,EAAS,KACjEtC,KAAKwB,QAAQ+B,MAAME,UAAY,SAK1B5D,cACP,GAAIG,KAAKwB,QAAS,CACjBxB,KAAK4D,uBACL5D,KAAKwB,QAAQM,aAAa,aAAc,SAIlCjC,cACP,GAAIG,KAAKwB,QAAS,CACjBxB,KAAKwB,QAAQM,aAAa,aAAc,UAI1CjC,eACC,OACCI,EAAC4D,EAAI,CACJC,MAAO9D,KAAKC,EAAE8D,QAAQtD,EAAaC,MACnCQ,SAAUlB,KAAKkB,SACfF,KAAMhB,KAAKgB,KACXgD,SAAU,EAACC,oBACOlC,EAAA/B,KAAKgC,cAAU,MAAAD,SAAA,EAAAA,EAAI/B,KAAKI,UAC1CU,QAASd,KAAKc,SAEdb,EAAA,OAAA,OASHJ,aACCG,KAAKoC,cAONvC,aACCG,KAAKqC","sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t// VARIANTS\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\twidth: rem-calc(16);\n\t\theight: rem-calc(16);\n\t\tborder-bottom: 0;\n\t\tcolor: inherit;\n\t}\n\t@each $variant, $definitions in $tooltip-content-variants {\n\t\t&[variant=\"#{$variant}\"] {\n\t\t\t--#{$prefix}tooltip-content-bg-color: #{get(\"bg-color\", $definitions)};\n\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color\", $definitions)};\n\n\t\t\t// STATES\n\t\t\t@include parameter(\"inverse\") {\n\t\t\t\t--#{$prefix}tooltip-content-bg-color: #{color(\"neutral.white\")};\n\t\t\t\t--#{$prefix}tooltip-content-text-color: #{get(\"text-color-inverse\", $definitions)};\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Element, h, Host, Method, Prop, Watch } from '@stencil/core'\nimport { validateProp } from '../../helpers/Validate/props'\nimport {\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipVariant,\n\tTooltipVariantType,\n} from './constants'\nimport { createID } from '../../utils/string.utils'\nimport { govHost } from '../../helpers/Dom/template'\nimport { GovHost } from '../../helpers/Dom/template.types'\n\n@Component({\n\ttag: 'gov-tooltip',\n\tstyleUrl: 'gov-tooltip.scss',\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate content: HTMLGovTooltipContentElement\n\tprivate readonly tooltipId\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID('GovTooltip')\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly variant?: TooltipVariantType = 'primary'\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = 'm'\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop() position: TooltipPositionType = 'right'\n\t/**\n\t * Information contained in the tolltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({ attribute: 'identifier' }) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({ attribute: 'icon' }) readonly icon: boolean = undefined\n\n\t@Watch('variant')\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TooltipVariant, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('size')\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch('position')\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tconst hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\tif (hasContentInside) {\n\t\t\tthis.content = hasContentInside\n\t\t} else {\n\t\t\tthis.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tthis.content.innerHTML = this.message\n\t\t\tthis.host.appendChild(this.content)\n\t\t}\n\n\t\tthis.content.setAttribute('id', this.identifier ?? this.tooltipId)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener('focus', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('blur', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseenter', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener('mouseleave', e => {\n\t\t\te.preventDefault()\n\t\t\tthis.hideTooltip()\n\t\t})\n\t}\n\n\tprivate verifiyPositionSpace() {\n\t\t// @TODO Improve positioning of broken lines\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\t\tconst tltWidth = this.content.offsetWidth\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tif (offset + triggerPos.left < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else if (this.position === TooltipPosition.RIGHT) {\n\t\t\tif (windowWidth - (triggerPos.left + trgWidth) < tltWidth) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t} else {\n\t\t\t// doesn't fit from the left\n\t\t\tif (tltWidth / 2 > triggerPos.left) {\n\t\t\t\tthis.content.style.left = '0px'\n\t\t\t\tthis.content.style.width = window.innerWidth - triggerPos.left - offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t\t// doesn't fit from the right\n\t\t\telse if (tltWidth / 2 > windowWidth - (triggerPos.left + tltWidth)) {\n\t\t\t\tthis.content.style.right = '0px'\n\t\t\t\tthis.content.style.left = 'auto'\n\t\t\t\tthis.content.style.width = trgWidth + triggerPos.left + offset + 'px'\n\t\t\t\tthis.content.style.transform = 'none'\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.verifiyPositionSpace()\n\t\t\tthis.content.setAttribute('is-visible', 'true')\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.content.setAttribute('is-visible', 'false')\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}\n\t\t\t\tsize={this.size}\n\t\t\t\ttabindex={0}\n\t\t\t\taria-describedby={this.identifier ?? this.tooltipId}\n\t\t\t\tvariant={this.variant}\n\t\t\t>\n\t\t\t\t<slot />\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hidding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.hideTooltip()\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-pagination/constants.ts","../../../packages/core/src/components/gov-pagination/pagination.ts","../../../packages/core/src/utils/array.utils.ts","../../../packages/core/src/components/gov-pagination/gov-pagination.scss?tag=gov-pagination","../../../packages/core/src/components/gov-pagination/gov-pagination.tsx"],"names":["PaginationSizes","pick","Sizes","PaginationVariants","Variants","PaginationTypes","PaginationClass","root","list","item","itemArrow","itemMore","itemSelect","inner","arrow","paginate","totalItems","currentPage","pageSize","maxPages","totalPages","Math","ceil","startPage","endPage","maxPagesBeforeCurrentPage","floor","maxPagesAfterCurrentPage","startIndex","endIndex","min","pages","Array","from","keys","map","i","createArrayRange","to","slice","govPaginationCss","GovPagination","[object Object]","hostRef","this","h","govHost","host","pageSelectId","createID","newValue","validateProp","recalculatePagination","current","validateSize","size","validateVariant","variant","canValidateWcagOnRender","delay","validateWcag","pagination","total","originalClass","page","link","String","replace","undefined","spreadSelectRef","getInstance","then","el","value","pageResolver","content","isDisabled","ariaCurrent","toBoolAttrIfDefined","href","prepareLinkUrl","type","disabled","on-gov-click","e","onClickHandler","wcag-label","wcagPageLabel","wcag-current","class","Host","classes","aria-label","wcagLabel","aria-labelledby","wcagLabelledBy","prepareClasses","name","id","hidden","wcagSelectLabel","wcag-labelled-by","on-gov-change","onSelectHandler","bind","selected","Fragment","isActivePageClass","ref","stopPropagation","preventDefault","govPage","emit","Object","assign","target","parseInt","resetSelectValue","isNaN","window","location","validateWcagProp","validateWcagLabel"],"mappings":"wbAKO,MAAMA,EAAkBC,EAAKC,EAAO,CAAC,KAAM,OAG3C,MAAMC,EAAqBF,EAAKG,EAAU,CAAC,UAAW,cAG7D,IAAYC,GAAZ,SAAYA,GACXA,EAAA,UAAA,SACAA,EAAA,UAAA,UAFD,CAAYA,IAAAA,EAAe,KAMpB,MAAMC,EAAkB,CAC9BC,KAAM,iBACNC,KAAM,uBACNC,KAAM,uBACNC,UAAW,8BACXC,SAAU,6BACVC,WAAY,+BACZC,MAAO,wBACPC,MAAO,kCCbQC,EAASC,EAAoBC,EAAc,EAAGC,EAAW,GAAIC,EAAW,IAEvF,MAAMC,EAAaC,KAAKC,KAAKN,EAAaE,GAG1C,GAAID,EAAc,EAAG,CACpBA,EAAc,OACR,GAAIA,EAAcG,EAAY,CACpCH,EAAcG,EAGf,IAAIG,EAAmBC,EACvB,GAAIJ,GAAcD,EAAU,CAE3BI,EAAY,EACZC,EAAUJ,MACJ,CAEN,MAAMK,EAA4BJ,KAAKK,MAAMP,EAAW,GACxD,MAAMQ,EAA2BN,KAAKC,KAAKH,EAAW,GAAK,EAC3D,GAAIF,GAAeQ,EAA2B,CAE7CF,EAAY,EACZC,EAAUL,OACJ,GAAIF,EAAcU,GAA4BP,EAAY,CAEhEG,EAAYH,EAAaD,EAAW,EACpCK,EAAUJ,MACJ,CAENG,EAAYN,EAAcQ,EAC1BD,EAAUP,EAAcU,GAK1B,MAAMC,GAAcX,EAAc,GAAKC,EACvC,MAAMW,EAAWR,KAAKS,IAAIF,EAAaV,EAAW,EAAGF,EAAa,GAGlE,MAAMe,EAAQC,MAAMC,KAAKD,MAAMR,EAAU,EAAID,GAAWW,QAAQC,KAAIC,GAAKb,EAAYa,IAGrF,MAAO,CACNpB,WAAYA,EACZC,YAAaA,EACbC,SAAUA,EACVE,WAAYA,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C,WAAawB,KAAKiB,WAAW5C,YAAc2B,KAAKiB,WAAWzC,YAAc,EACzFyB,EAAA,WAAA,CAAU4C,MAAOnF,EAAgBQ,MAAOmF,KAAK,8BAS5CvD,eAAe0C,EAAgBpB,GACtCoB,EAAEyB,kBACFzB,EAAE0B,iBACFlE,KAAKQ,sBAAsBY,GAC3BpB,KAAKmE,QAAQC,KAAIC,OAAAC,OAAA,GAAMtE,KAAKiB,aAGrBnB,gBAAgB0C,GACvBA,EAAEyB,kBACFzB,EAAE0B,iBACF,MAAMK,EAAS/B,EAAE+B,OACjB,MAAMnD,EAAOoD,SAASD,EAAO1C,OAC7B7B,KAAKyE,mBACL,GAAIC,MAAMtD,KAAU,MAAO,CAC1BpB,KAAKQ,sBAAsBY,GAC3B,GAAIpB,KAAKqB,KAAM,CACdsD,OAAOC,SAASzC,KAAOnC,KAAKoC,eAAehB,OACrC,CACNpB,KAAKmE,QAAQC,KAAIC,OAAAC,OAAA,GAAMtE,KAAKiB,eAS/BnB,qBACC+E,EAAiB7E,KAAK2C,cAAe,kBAAmBjF,EAAgBC,MACxEmH,EAAkB9E,KAAKiD,UAAWjD,KAAKmD,eAAgBzF,EAAgBC,MACvE,GAAIqC,KAAKqC,OAAS,SAAU,CAC3BwC,EAAiB7E,KAAKwD,gBAAiB,oBAAqB9F,EAAgBC","sourcesContent":["import { Sizes } from '../../core/constants/sizes'\nimport { Variants } from '../../core/constants/variants'\nimport { pick } from '../../utils/utils'\nimport { ValueOf } from '../../types/interfaces'\n\nexport const PaginationSizes = pick(Sizes, ['_S', '_M'])\nexport type PaginationSizeType = `${ValueOf<typeof PaginationSizes>}`\n\nexport const PaginationVariants = pick(Variants, ['PRIMARY', 'SECONDARY'])\nexport type PaginationVariantType = `${ValueOf<typeof PaginationVariants>}`\n\nexport enum PaginationTypes {\n\tBUTTON = 'button',\n\tSELECT = 'select',\n}\nexport type PaginationType = `${ValueOf<typeof PaginationTypes>}`\n\nexport const PaginationClass = {\n\troot: 'gov-pagination',\n\tlist: 'gov-pagination__list',\n\titem: 'gov-pagination__item',\n\titemArrow: 'gov-pagination__item--arrow',\n\titemMore: 'gov-pagination__item--more',\n\titemSelect: 'gov-pagination__item--select',\n\tinner: 'gov-pagination__inner',\n\tarrow: 'gov-pagination__arrow',\n}\n","export interface Pagination {\n\ttotalItems: number\n\tcurrentPage: number\n\tpageSize: number\n\ttotalPages: number\n\tstartPage: number\n\tendPage: number\n\tstartIndex: number\n\tendIndex: number\n\tpages: number[]\n}\n\nexport function paginate(totalItems: number, currentPage = 1, pageSize = 10, maxPages = 10): Pagination {\n\t// calculate total pages\n\tconst totalPages = Math.ceil(totalItems / pageSize)\n\n\t// ensure current page isn't out of range\n\tif (currentPage < 1) {\n\t\tcurrentPage = 1\n\t} else if (currentPage > totalPages) {\n\t\tcurrentPage = totalPages\n\t}\n\n\tlet startPage: number, endPage: number\n\tif (totalPages <= maxPages) {\n\t\t// total pages less than max so show all pages\n\t\tstartPage = 1\n\t\tendPage = totalPages\n\t} else {\n\t\t// total pages more than max so calculate start and end pages\n\t\tconst maxPagesBeforeCurrentPage = Math.floor(maxPages / 2)\n\t\tconst maxPagesAfterCurrentPage = Math.ceil(maxPages / 2) - 1\n\t\tif (currentPage <= maxPagesBeforeCurrentPage) {\n\t\t\t// current page near the start\n\t\t\tstartPage = 1\n\t\t\tendPage = maxPages\n\t\t} else if (currentPage + maxPagesAfterCurrentPage >= totalPages) {\n\t\t\t// current page near the end\n\t\t\tstartPage = totalPages - maxPages + 1\n\t\t\tendPage = totalPages\n\t\t} else {\n\t\t\t// current page somewhere in the middle\n\t\t\tstartPage = currentPage - maxPagesBeforeCurrentPage\n\t\t\tendPage = currentPage + maxPagesAfterCurrentPage\n\t\t}\n\t}\n\n\t// calculate start and end item indexes\n\tconst startIndex = (currentPage - 1) * pageSize\n\tconst endIndex = Math.min(startIndex + pageSize - 1, totalItems - 1)\n\n\t// create an array of pages to ng-repeat in the pager control\n\tconst pages = Array.from(Array(endPage + 1 - startPage).keys()).map(i => startPage + i)\n\n\t// return object with all pager properties required by the view\n\treturn {\n\t\ttotalItems: totalItems,\n\t\tcurrentPage: currentPage,\n\t\tpageSize: pageSize,\n\t\ttotalPages: totalPages,\n\t\tstartPage: startPage,\n\t\tendPage: endPage,\n\t\tstartIndex: startIndex,\n\t\tendIndex: endIndex,\n\t\tpages: pages,\n\t}\n}\n","export const createArrayRange = (from: number, to: number): number[] => [...Array(to + 1).keys()].slice(from);\n","/*\n * Pagination\n */\n\n$class: \".gov-pagination\";\n\n#{$class} {\n\t@include base();\n\t&__list {\n\t\t@extend %reset-ul;\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tflex-wrap: wrap;\n\t\tfont-weight: bold;\n\t\ttext-align: center;\n\t}\n\t&__list &__item {\n\t\t@extend %reset-ul-li;\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\tmargin: 0;\n\t\tpadding: rem-calc(2);\n\t\tborder-radius: $border-radius;\n\t\toverflow: hidden;\n\t\t&--arrow {\n\t\t\tdisplay: flex;\n\t\t}\n\t\t&--select {\n\t\t\tz-index: 1;\n\t\t\tdisplay: flex;\n\t\t\toverflow: visible;\n\t\t\tpadding: rem-calc(0 16);\n\t\t}\n\t}\n\t&__arrow {\n\t\tmargin: 0;\n\t}\n\t&__item--more {\n\t\t.gov-form-select {\n\t\t\tselect {\n\t\t\t\tborder: none;\n\t\t\t\tpadding-right: rem-calc(12) !important;\n\t\t\t}\n\t\t\t.gov-icon {\n\t\t\t\tdisplay: none;\n\t\t\t}\n\t\t}\n\t}\n\t&__inner {\n\t\tdisplay: flex;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\talign-self: stretch;\n\t\twidth: 100%;\n\t\ttext-decoration: none;\n\t\t// Use hover styles from gov-button to active page button\n\t\t&[wcag-current=\"true\"] {\n\t\t\t@each $variant, $types in $button-variants {\n\t\t\t\t@each $type, $definitions in $types {\n\t\t\t\t\t&[type=\"#{$type}\"][variant=\"#{$variant}\"] {\n\t\t\t\t\t\t.element {\n\t\t\t\t\t\t\tbackground-color: deep-map-get($button-variants, $variant, $type, \"hover-bg\");\n\t\t\t\t\t\t\tcolor: deep-map-get($button-variants, $variant, $type, \"hover-color\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $pagination-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\t#{$class} {\n\t\t\t\t&__inner {\n\t\t\t\t\t@include typography(get(\"font\", $definitions));\n\t\t\t\t\tfont-weight: inherit;\n\t\t\t\t\t.element {\n\t\t\t\t\t\tmin-width: get(\"button-size\", $definitions);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import Fragment from \"../../helpers/Fragment\"\nimport { Component, Element, Event, EventEmitter, h, Host, Method, Prop, State, Watch } from \"@stencil/core\"\nimport { validateProp } from \"../../helpers/Validate/props\"\nimport {\n\tPaginationClass,\n\tPaginationSizeType,\n\tPaginationSizes,\n\tPaginationVariantType,\n\tPaginationType,\n\tPaginationTypes,\n\tPaginationVariants,\n} from \"./constants\"\nimport { govHost, prepareClasses } from \"../../helpers/Dom/template\"\nimport { paginate, Pagination } from \"./pagination\"\nimport { toBoolAttrIfDefined } from \"../../helpers/Dom/template\"\nimport { validateWcagLabel, validateWcagProp } from \"../../helpers/Validate/wcag\"\nimport { canValidateWcagOnRender } from \"../../helpers/Dom/win\"\nimport { delay } from \"../../utils/utils\"\nimport { createID } from \"../../utils/string.utils\"\nimport { GovHost } from \"../../helpers/Dom/template.types\"\nimport {createArrayRange } from \"../../utils/array.utils\"\n\n@Component({\n\ttag: \"gov-pagination\",\n\tstyleUrl: \"gov-pagination.scss\",\n})\nexport class GovPagination {\n\tprivate h: GovHost\n\tprivate readonly pageSelectId: string\n\n\tprivate spreadSelectRef?: HTMLGovFormSelectElement\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.pageSelectId = createID(\"GovPageSelect\")\n\t}\n\n\t@Element() readonly host: HTMLGovPaginationElement\n\t/**\n\t * Pagination type\n\t */\n\t@Prop() readonly type: PaginationType = \"button\"\n\t/**\n\t * Currently displayed page\n\t */\n\t@Prop() readonly current: number = 1\n\t/**\n\t * Total count of entries\n\t */\n\t@Prop() readonly total: number\n\t/**\n\t * Set on active page\n\t */\n\t@Prop() readonly inverse: boolean\n\t/**\n\t * Pagination's size\n\t */\n\t@Prop() readonly size?: PaginationSizeType = \"m\"\n\t/**\n\t * Style variation of the pagination.\n\t */\n\t@Prop() readonly variant?: PaginationVariantType = \"primary\"\n\t/**\n\t * Maximum number of entries per page\n\t */\n\t@Prop({ attribute: \"page-size\" }) readonly pageSize: number = 10\n\t/**\n\t * Maximum pages displayed for selection\n\t */\n\t@Prop({ attribute: \"max-pages\" }) readonly maxPages: number = 5\n\t/**\n\t * Setting a link to redirect to a given page.\n\t * The {PAGE} wildcard can be used in the link to replace the page number.\n\t * Note that in the case of paging through a link, it is always necessary to send to the component the current page where the user is.\n\t */\n\t@Prop() readonly link: string\n\t/**\n\t * Adds accessible label for the pagination that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: \"wcag-label\" }) readonly wcagLabel: string\n\t/**\n\t * Indicates the id of a component that labels the pagination.\n\t */\n\t@Prop({ attribute: \"wcag-labelled-by\" }) readonly wcagLabelledBy: string\n\t/**\n\t * Adds accessible label for the page select\n\t */\n\t@Prop({ attribute: \"wcag-select-label\" }) readonly wcagSelectLabel: string = \"Vybrat stranu\"\n\t/**\n\t * Adds accessible label for the page item\n\t */\n\t@Prop({ attribute: \"wcag-page-label\" }) readonly wcagPageLabel: string = \"Strana\"\n\t/**\n\t * Event called when changing the page with the current setting of the whole paging\n\t */\n\t@Event({ eventName: \"gov-page\" }) govPage: EventEmitter<Pagination>\n\n\t@State() pagination: Pagination\n\n\t@Watch(\"type\")\n\tvalidateType(newValue: string): void {\n\t\tvalidateProp(PaginationTypes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(PaginationSizes, newValue, PaginationClass.root)\n\t}\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(PaginationVariants, newValue, PaginationClass.root)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.recalculatePagination(this.current)\n\t\tthis.validateSize(this.size)\n\t\tthis.validateVariant(this.variant)\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\tprivate recalculatePagination(currentPage: number) {\n\t\tthis.pagination = paginate(this.total, currentPage, this.pageSize, this.maxPages)\n\t}\n\n\tprivate isActivePageClass(originalClass: string, page: number) {\n\t\tif (this.pagination.currentPage === page) {\n\t\t\treturn originalClass + \" is-active\"\n\t\t} else {\n\t\t\treturn originalClass\n\t\t}\n\t}\n\n\tprivate prepareLinkUrl(page: number) {\n\t\tif (this.link) {\n\t\t\treturn String(this.link).replace(\"{PAGE}\", String(page))\n\t\t}\n\t\treturn undefined\n\t}\n\n\tprivate resetSelectValue() {\n\t\tif (this.spreadSelectRef) {\n\t\t\tthis.spreadSelectRef.getInstance()\n\t\t\t\t.then((el: HTMLSelectElement) => {\n\t\t\t\t\tel.value = '...'\n\t\t\t\t})\n\t\t}\n\t}\n\n\trender() {\n\t\tconst pageResolver = (page: number, content: any) => {\n\t\t\tconst isDisabled = page === -1\n\t\t\tconst ariaCurrent = toBoolAttrIfDefined(this.pagination.currentPage === page ? true : undefined)\n\t\t\treturn (\n\t\t\t\t<gov-button\n\t\t\t\t\thref={this.prepareLinkUrl(page)}\n\t\t\t\t\tvariant={this.variant}\n\t\t\t\t\tsize={this.size}\n\t\t\t\t\ttype=\"base\"\n\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\ton-gov-click={(e) => this.onClickHandler(e, page)}\n\t\t\t\t\twcag-label={page > -1 ? this.wcagPageLabel + \" \" + page : undefined}\n\t\t\t\t\twcag-current={ariaCurrent}\n\t\t\t\t\tclass={PaginationClass.inner}>\n\t\t\t\t\t{content}\n\t\t\t\t</gov-button>\n\t\t\t)\n\t\t}\n\t\treturn (\n\t\t\t<Host class={this.h.classes(PaginationClass.root)} type={this.type} variant={this.variant} size={this.size}>\n\t\t\t\t<nav aria-label={this.wcagLabel} aria-labelledby={this.wcagLabelledBy}>\n\t\t\t\t\t<ul class={PaginationClass.list}>\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.currentPage > 1 ? 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.startPage < this.pagination.currentPage ? this.pagination.currentPage - 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-left\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t{this.type == \"select\" ? (\n\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemSelect])}>\n\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={this.pagination.currentPage === page}>\n\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<Fragment>\n\t\t\t\t\t\t\t\t{this.pagination.pages.map(page => (\n\t\t\t\t\t\t\t\t\t<li class={this.isActivePageClass(PaginationClass.item, page)}>{pageResolver(page, page)}</li>\n\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemMore])}>\n\t\t\t\t\t\t\t\t\t<span class={PaginationClass.inner}>\n\t\t\t\t\t\t\t\t\t\t<span id={this.pageSelectId} hidden>\n\t\t\t\t\t\t\t\t\t\t\t{this.wcagSelectLabel}\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t<gov-form-select\n\t\t\t\t\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\t\t\t\t\twcag-labelled-by={this.pageSelectId}\n\t\t\t\t\t\t\t\t\t\t\tref={el => (this.spreadSelectRef = el as HTMLGovFormSelectElement)}\n\t\t\t\t\t\t\t\t\t\t\ton-gov-change={this.onSelectHandler.bind(this)}>\n\t\t\t\t\t\t\t\t\t\t\t<option selected hidden>...</option>\n\t\t\t\t\t\t\t\t\t\t\t{createArrayRange(1, this.pagination.totalPages).map(page => (\n\t\t\t\t\t\t\t\t\t\t\t\t<option value={page} selected={false}>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{page}\n\t\t\t\t\t\t\t\t\t\t\t\t</option>\n\t\t\t\t\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-select>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t</Fragment>\n\t\t\t\t\t\t)}\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.currentPage + 1 : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\n\t\t\t\t\t\t<li class={prepareClasses([PaginationClass.item, PaginationClass.itemArrow])}>\n\t\t\t\t\t\t\t{pageResolver(\n\t\t\t\t\t\t\t\tthis.pagination.totalPages > this.pagination.currentPage ? this.pagination.totalPages : -1,\n\t\t\t\t\t\t\t\t<gov-icon class={PaginationClass.arrow} name=\"chevron-double-right\"></gov-icon>,\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</li>\n\t\t\t\t\t</ul>\n\t\t\t\t</nav>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onClickHandler(e: CustomEvent, page: number): void {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tthis.recalculatePagination(page)\n\t\tthis.govPage.emit({ ...this.pagination })\n\t}\n\n\tprivate onSelectHandler(e: CustomEvent): void {\n\t\te.stopPropagation()\n\t\te.preventDefault()\n\t\tconst target = e.target as HTMLSelectElement\n\t\tconst page = parseInt(target.value)\n\t\tthis.resetSelectValue()\n\t\tif (isNaN(page) === false) {\n\t\t\tthis.recalculatePagination(page)\n\t\t\tif (this.link) {\n\t\t\t\twindow.location.href = this.prepareLinkUrl(page)\n\t\t\t} else {\n\t\t\t\tthis.govPage.emit({ ...this.pagination })\n\t\t\t}\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\tvalidateWcagProp(this.wcagPageLabel, \"wcag-page-label\", PaginationClass.root)\n\t\tvalidateWcagLabel(this.wcagLabel, this.wcagLabelledBy, PaginationClass.root)\n\t\tif (this.type === \"select\") {\n\t\t\tvalidateWcagProp(this.wcagSelectLabel, \"wcag-select-label\", PaginationClass.root)\n\t\t}\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/file/constants.ts","../../../packages/core/src/utils/file.utils.ts","../../../packages/core/src/components/gov-form/file/gov-form-file.scss?tag=gov-form-file","../../../packages/core/src/components/gov-form/file/gov-form-file.tsx"],"names":["FormFileClass","root","area","label","input","list","item","attachments","formatBytes","bytes","units","l","n","parseInt","toFixed","fileAcceptValidation","file","accept","length","replace","split","filter","RegExp","test","type","fileSizeValidation","maxSize","fileSize","Math","round","size","govFormFileCss","GovFormFile","[object Object]","hostRef","this","fileId","createID","h","govHost","host","f","govForm","highlight","areaRef","classList","add","unhighlight","remove","inputRef","addEventListener","e","preventDefault","stopPropagation","files","target","validateFiles","expanded","events","inEvents","outEvents","map","eventName","preventDefaults","bind","forEach","handleDrop","dataTransfer","Array","from","isFile","find","name","isSizeValid","maxFileSize","isAcceptValid","newFile","id","acceptValid","sizeValid","govAddFile","emit","govFiles","passAttrToControl","passAttrToLabel","String","required","canValidateWcagOnRender","delay","validateWcag","registerListeners","Host","class","classes","invalid","toBoolAttrIfDefined","ref","el","identifier","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","disabled","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","hasSlot","displayAttachments","wcagAttachmentsLabel","wcag-label","wcag-remove-labelled-by","on-gov-remove","onRemoveFileHandler","wcagRemoveLabel","slot","variant","errorAccept","errorSize","index","findIndex","removeFile","splice","govRemovFile","govFocus","govBlur","validateWcagRef","validateWcagLabelFor"],"mappings":"8cAAO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AcC,MACvEoI,EAAqBlG,KAAK+D,YAAc/D,KAAKC,OAAQD,KAAK4E,eAAgB/G,EAAcC","sourcesContent":["export const FormFileClass = {\n\troot: 'gov-form-file',\n\tarea: 'gov-form-file__area',\n\tlabel: 'gov-form-file__label',\n\tinput: 'gov-form-file__input',\n\tlist: 'gov-form-file__list',\n\titem: 'gov-form-file__item',\n\tattachments: 'gov-form-file__attachments',\n}\n","export function formatBytes(bytes: any): string {\n\tconst units = ['bytes', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB']\n\tlet l = 0,\n\t\tn = parseInt(bytes, 10) || 0\n\n\twhile (n >= 1024 && ++l) {\n\t\tn = n / 1024\n\t}\n\n\treturn n.toFixed(n < 10 && l > 0 ? 1 : 0) + ' ' + units[l]\n}\n\nexport function fileAcceptValidation(file: File, accept: string): boolean {\n\tif (typeof accept === 'string' && accept.length) {\n\t\treturn (\n\t\t\taccept\n\t\t\t\t.replace(/\\s/g, '')\n\t\t\t\t.split(',')\n\t\t\t\t.filter(accept => {\n\t\t\t\t\treturn new RegExp(accept.replace('*', '.*')).test(file.type)\n\t\t\t\t}).length > 0\n\t\t)\n\t} else {\n\t\treturn true\n\t}\n}\n\nexport function fileSizeValidation(file: File, maxSize: number): boolean {\n\tconst fileSize = Math.round(file.size / 1024)\n\treturn fileSize <= maxSize\n}\n","/*\n * File\n */\n\n$class: \".gov-form-file\";\n\n#{$class} {\n\t@include base();\n\t&__label .gov-form-label__label {\n\t\t@include reset-last-margin();\n\t}\n\t&__input {\n\t\tposition: absolute;\n\t\ttop: 0;\n\t\tright: 0;\n\t\tbottom: 0;\n\t\tleft: 0;\n\t\twidth: 100%;\n\t\theight: 100%;\n\t\topacity: 0.0001;\n\t\tcursor: pointer;\n\t}\n\t&__attachments {\n\t\tmargin-top: rem-calc(16 0 0);\n\t}\n\t&__item {\n\t\tdisplay: flex;\n\t\tgap: rem-calc(16);\n\t\talign-items: center;\n\t}\n\n\t// STATES\n\t@include parameter(\"disabled\") {\n\t\t#{$class} {\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\tpointer-events: none;\n\t\t\t\t* {\n\t\t\t\t\tcolor: $form-file-disabled-color;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@include parameter(\"expanded\") {\n\t\t#{$class} {\n\t\t\t&__area {\n\t\t\t\tposition: relative;\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(32) rem-calc(22) rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t\ttransition: background-color $t ease-in-out;\n\t\t\t\twill-change: background-color;\n\t\t\t\t&.highlight {\n\t\t\t\t\tbackground-color: color(\"primary.200\");\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t&__label .gov-form-label__label {\n\t\t\t\twidth: 100%;\n\t\t\t\tpadding: rem-calc(22);\n\t\t\t\tborder: $form-file-border;\n\t\t\t\ttext-align: center;\n\t\t\t}\n\t\t\t&__attachments {\n\t\t\t\tmargin: rem-calc(24 0 0);\n\t\t\t}\n\t\t}\n\n\t\t// STATES\n\t\t@include parameter(\"invalid\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tborder-color: $form-state-color-error;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// MQ\n\t@include mq($from: sm) {\n\t\t@include parameter(\"expanded\") {\n\t\t\t#{$class} {\n\t\t\t\t&__label .gov-form-label__label {\n\t\t\t\t\tpadding: rem-calc(32);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n","import { Component, Host, h, Prop, Event, EventEmitter, Element, Method, State } from '@stencil/core'\nimport { createID } from '../../../utils/string.utils'\nimport { FormFileClass } from './constants'\nimport { toBoolAttrIfDefined } from '../../../helpers/Dom/template'\nimport { validateWcagLabelFor, validateWcagRef } from '../../../helpers/Validate/wcag'\nimport { canValidateWcagOnRender } from '../../../helpers/Dom/win'\nimport { fileAcceptValidation, fileSizeValidation, formatBytes } from '../../../utils/file.utils'\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 { GovFormFileItem } from './gov-form-file.types'\n\n@Component({\n\ttag: 'gov-form-file',\n\tstyleUrl: 'gov-form-file.scss',\n})\nexport class GovFormFile {\n\tprivate f: GovForm\n\tprivate h: GovHost\n\n\tprivate areaRef?: HTMLDivElement\n\tprivate inputRef?: HTMLInputElement\n\tprivate readonly fileId: string\n\n\tconstructor() {\n\t\tthis.fileId = createID('GovInputFile')\n\n\t\tthis.h = govHost(this.host)\n\t\tthis.f = govForm(this.h)\n\t}\n\n\t@Element() host: HTMLGovFormFileElement\n\t/**\n\t * Expands the file input to fill 100% of the container width.\n\t */\n\t@Prop() readonly expanded: 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 File component disabled.\n\t * This prevents users from being able to interact with the File, and conveys its inactive state to assistive technologies.\n\t */\n\t@Prop() readonly disabled: boolean\n\t/**\n\t * Show list of attachments\n\t */\n\t@Prop({ attribute: 'display-attachments' }) readonly displayAttachments: boolean = true\n\t/**\n\t * Name of the input.\n\t */\n\t@Prop() readonly name: string\n\t/**\n\t * Same as original parameter\n\t * @link https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/accept\n\t */\n\t@Prop() readonly accept: string\n\t/**\n\t * Maximum embedded file size\n\t */\n\t@Prop({ attribute: 'max-file-size' }) readonly maxFileSize: number = -1\n\t/**\n\t * Custom File 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 * Error message when the maximum file size is exceeded\n\t */\n\t@Prop({ attribute: 'error-size' }) readonly errorSize: string = 'Soubor je větší než povolená velikost {FILE_SIZE}'\n\t/**\n\t * Insert unsupported file error message\n\t */\n\t@Prop({ attribute: 'error-accept' }) readonly errorAccept: string = 'Soubor tohoto typu není povolen'\n\t/**\n\t * Description of the list of attachments\n\t */\n\t@Prop({ attribute: 'attachments-label' }) readonly attachmentsLabel: string = 'Přílohy'\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 * Adds accessible label for the remove button that is only shown for screen readers.\n\t */\n\t@Prop({ attribute: 'wcag-remove-label' }) readonly wcagRemoveLabel: string = 'Odebrat soubor {FILE_NAME}'\n\t/**\n\t * Adds accessible label for the list of attachments.\n\t */\n\t@Prop({ attribute: 'wcag-attachments-label' }) readonly wcagAttachmentsLabel: string = 'Přílohy'\n\t/**\n\t * Emitted when the File has focus.\n\t */\n\t@Event({ eventName: 'gov-focus' }) govFocus: EventEmitter<FocusEvent>\n\t/**\n\t * Emitted when the File loses focus.\n\t */\n\t@Event({ eventName: 'gov-blur' }) govBlur: EventEmitter<FocusEvent>\n\t/**\n\t * Called when the list of inserted files is changed\n\t */\n\t@Event({ eventName: 'gov-files' }) govFiles: EventEmitter<GovFormFileItem[]>\n\t/**\n\t * Called when a new file is added\n\t */\n\t@Event({ eventName: 'gov-add-file' }) govAddFile: EventEmitter<GovFormFileItem>\n\t/**\n\t * Called when a file is removed from the list\n\t */\n\t@Event({ eventName: 'gov-remove-file' }) govRemovFile: EventEmitter<GovFormFileItem>\n\n\t@State() files: GovFormFileItem[] = []\n\n\tprivate registerListeners() {\n\t\tfunction highlight() {\n\t\t\tthis.areaRef.classList.add('highlight')\n\t\t}\n\t\tfunction unhighlight() {\n\t\t\tthis.areaRef.classList.remove('highlight')\n\t\t}\n\n\t\tthis.inputRef.addEventListener(\n\t\t\t'change',\n\t\t\te => {\n\t\t\t\te.preventDefault()\n\t\t\t\te.stopPropagation()\n\t\t\t\tconst files = (e.target as HTMLInputElement).files\n\t\t\t\tthis.validateFiles(files)\n\t\t\t},\n\t\t\tfalse\n\t\t)\n\t\t//this.inputRef.addEventListener('focus')\n\n\t\tif (this.expanded) {\n\t\t\tconst events = ['dragover', 'dragleave']\n\t\t\tconst inEvents = ['dragenter', 'dragover', 'mouseenter']\n\t\t\tconst outEvents = ['dragleave', 'drop', 'mouseleave']\n\n\t\t\tevents.map(eventName => this.inputRef.addEventListener(eventName, this.preventDefaults.bind(this), false))\n\t\t\tinEvents.map(eventName => this.inputRef.addEventListener(eventName, highlight.bind(this), false))\n\t\t\toutEvents.forEach(eventName => this.inputRef.addEventListener(eventName, unhighlight.bind(this), false))\n\n\t\t\tthis.areaRef.addEventListener('drop', this.handleDrop.bind(this), false)\n\t\t}\n\t}\n\n\tpreventDefaults(e) {\n\t\te.preventDefault()\n\t\te.stopPropagation()\n\t}\n\n\thandleDrop(e: DragEvent) {\n\t\tconst dataTransfer = e.dataTransfer\n\t\tthis.validateFiles(dataTransfer.files)\n\t}\n\n\tprivate validateFiles(files: FileList) {\n\t\tArray.from(files).map(file => {\n\t\t\tconst isFile = this.files.find(item => item.file.name === file.name && item.file.size === file.size) || null\n\t\t\tif (isFile === null) {\n\t\t\t\tconst isSizeValid = typeof this.maxFileSize === 'number' && this.maxFileSize > 0 ? fileSizeValidation(file, this.maxFileSize) : true\n\t\t\t\tconst isAcceptValid = fileAcceptValidation(file, this.accept)\n\t\t\t\tconst newFile = {\n\t\t\t\t\tid: createID('GovFormFile'),\n\t\t\t\t\tfile,\n\t\t\t\t\tacceptValid: isAcceptValid,\n\t\t\t\t\tsizeValid: isSizeValid,\n\t\t\t\t}\n\t\t\t\tthis.files = [...this.files, newFile]\n\t\t\t\tthis.govAddFile.emit(newFile)\n\t\t\t}\n\t\t})\n\n\t\tthis.govFiles.emit(this.files)\n\t}\n\n\tcomponentWillLoad() {\n\t\tthis.f.passAttrToControl('type', 'File')\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\n\t\tthis.registerListeners()\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host class={this.h.classes([FormFileClass.root])} invalid={toBoolAttrIfDefined(this.invalid)} expanded={toBoolAttrIfDefined(this.expanded)}>\n\t\t\t\t<div class={FormFileClass.area} ref={el => (this.areaRef = el as HTMLDivElement)}>\n\t\t\t\t\t<slot />\n\t\t\t\t\t<input\n\t\t\t\t\t\tclass={FormFileClass.input}\n\t\t\t\t\t\tref={el => (this.inputRef = el as HTMLInputElement)}\n\t\t\t\t\t\tid={this.identifier || this.fileId}\n\t\t\t\t\t\ttype=\"file\"\n\t\t\t\t\t\tname={this.name}\n\t\t\t\t\t\taccept={this.accept}\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\tdisabled={this.disabled}\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</div>\n\n\t\t\t\t{this.h.hasSlot('attachments') ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<slot name={'attachments'} />\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\n\t\t\t\t{this.files.length && this.displayAttachments ? (\n\t\t\t\t\t<div class={FormFileClass.attachments}>\n\t\t\t\t\t\t<gov-attachments label={this.wcagAttachmentsLabel} wcag-label={this.wcagAttachmentsLabel}>\n\t\t\t\t\t\t\t{this.files.map(item => (\n\t\t\t\t\t\t\t\t<gov-attachments-item wcag-remove-labelled-by={item.id} on-gov-remove={() => this.onRemoveFileHandler(item)}>\n\t\t\t\t\t\t\t\t\t<span class={'sr-only'} id={item.id}>\n\t\t\t\t\t\t\t\t\t\t{this.wcagRemoveLabel.replace('{FILE_NAME}', item.file.name)}\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t{item.file.name}\n\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{item.acceptValid === false ? this.errorAccept : null}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t{item.sizeValid === false ? (\n\t\t\t\t\t\t\t\t\t\t<gov-form-message slot=\"message\" variant=\"error\">\n\t\t\t\t\t\t\t\t\t\t\t<gov-icon slot=\"icon\" name=\"exclamation-triangle-fill\"></gov-icon>\n\t\t\t\t\t\t\t\t\t\t\t{this.errorSize.replace('{FILE_SIZE}', formatBytes(this.maxFileSize * 1024))}\n\t\t\t\t\t\t\t\t\t\t</gov-form-message>\n\t\t\t\t\t\t\t\t\t) : null}\n\t\t\t\t\t\t\t\t\t<span slot=\"info\">({formatBytes(item.file.size)})</span>\n\t\t\t\t\t\t\t\t</gov-attachments-item>\n\t\t\t\t\t\t\t))}\n\t\t\t\t\t\t</gov-attachments>\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</Host>\n\t\t)\n\t}\n\n\tprivate onRemoveFileHandler(file: GovFormFileItem) {\n\t\tconst index = this.files.findIndex(item => item.id === file.id)\n\t\tif (index !== -1) {\n\t\t\tconst files = this.files\n\t\t\tconst removeFile = this.files[index]\n\t\t\tfiles.splice(index, 1)\n\t\t\tthis.files = [...files]\n\t\t\tthis.govRemovFile.emit(removeFile)\n\t\t\tthis.govFiles.emit(this.files)\n\t\t}\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\te.stopPropagation()\n\t\te.preventDefault()\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', FormFileClass.root)\n\t\tvalidateWcagRef(this.wcagLabelledBy, 'wcag-labelled-by', FormFileClass.root)\n\t\tvalidateWcagLabelFor(this.identifier || this.fileId, this.wcagLabelledBy, FormFileClass.root)\n\t}\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../packages/core/src/components/gov-form/radio/gov-form-radio.scss?tag=gov-form-radio","../../../packages/core/src/components/gov-form/radio/gov-form-radio.tsx"],"names":["govFormRadioCss","GovFormRadio","[object Object]","hostRef","this","radioId","createID","h","govHost","host","f","govForm","newValue","isChecked","govChange","emit","checked","value","validateProp","FormRadioSizes","FormRadioClass","root","passAttrToControl","passAttrToLabel","identifier","String","required","canValidateWcagOnRender","delay","validateWcag","wrapCheckbox","children","noLabel","Host","class","is-checked","size","invalid","toBoolAttrIfDefined","holder","Fragment","input","id","type","name","onClick","onClickHandler","bind","onChange","onChangeHandler","onFocus","onFocusHandler","onBlur","onBlurHandler","aria-checked","aria-required","aria-invalid","aria-describedby","wcagDescribedBy","aria-labelledby","wcagLabelledBy","aria-disabled","disabled","e","stopPropagation","preventDefault","govFocus","govBlur","target","validateWcagRef","validateWcagLabelFor"],"mappings":"oiBAAA,MAAMA,EAAkB,oxOCmBXC,EAAY,MAMxBC,YAAAC,2JAe6D,mBAIR,oBAKhB,4DAaQ,2IApC5CC,KAAKC,QAAUC,EAAS,YAExBF,KAAKG,EAAIC,EAAQJ,KAAKK,MACtBL,KAAKM,EAAIC,EAAQP,KAAKG,GAkEvBL,mBAAmBU,GAClBR,KAAKS,UAAYD,EACjBR,KAAKU,UAAUC,KAAK,CACnBC,QAASZ,KAAKS,UACdI,MAAOb,KAAKa,QAKdf,aAAaU,GACZM,EAAaC,EAAgBP,EAAUQ,EAAeC,MAGvDnB,oBACCE,KAAKS,UAAYT,KAAKY,QAEtBZ,KAAKM,EAAEY,kBAAkB,OAAQ,SAGlCpB,2BACCE,KAAKM,EAAEa,gBAAgB,aAAcnB,KAAKoB,YAAcpB,KAAKC,SAC7DD,KAAKM,EAAEa,gBAAgB,WAAYE,OAAOrB,KAAKsB,WAC/C,GAAIC,IAA2B,OACxBC,EAAM,WACNxB,KAAKyB,gBAIb3B,SACC,MAAMW,UAAEA,GAAcT,KACtB,MAAM0B,EAAgBC,IACrB,GAAI3B,KAAK4B,QAAS,CACjB,OACCzB,EAAA,QAAA,KACEwB,GAIJ,OAAOA,GAGR,OACCxB,EAAC0B,EAAI,CAACC,MAAOd,EAAeC,KAAIc,aAActB,EAAWuB,KAAMhC,KAAKgC,KAAMC,QAASC,EAAoBlC,KAAKiC,UAC3G9B,EAAA,MAAA,CAAK2B,MAAOd,EAAemB,QACzBT,EACAvB,EAACiC,EAAQ,KACRjC,EAAA,QAAA,CACC2B,MAAOd,EAAeqB,MACtBC,GAAItC,KAAKoB,YAAcpB,KAAKC,QAC5BsC,KAAK,QACL1B,MAAOb,KAAKa,MACZ2B,KAAMxC,KAAKwC,KACX5B,QAASZ,KAAKS,UACdgC,QAASzC,KAAK0C,eAAeC,KAAK3C,MAClC4C,SAAU5C,KAAK6C,gBAAgBF,KAAK3C,MACpC8C,QAAS9C,KAAK+C,eAAeJ,KAAK3C,MAClCgD,OAAQhD,KAAKiD,cAAcN,KAAK3C,MAChCsB,SAAUtB,KAAKsB,SAAQ4B,eACTlD,KAAKS,UAAS0C,gBACbjB,EAAoBlC,KAAKsB,UAAS8B,eACnClB,EAAoBlC,KAAKiC,SAAQoB,mBAC7BrD,KAAKsD,gBAAeC,kBACrBvD,KAAKwD,eAAcC,gBACrBvB,EAAoBlC,KAAK0D,YAEzCvD,EAAA,OAAA,KACCA,EAAA,OAAA,CAAMqC,KAAK,eASV1C,eAAe6D,GACtBA,EAAEC,kBAGK9D,eAAe6D,GACtBA,EAAEC,kBACFD,EAAEE,iBACF7D,KAAK8D,SAASnD,KAAKgD,GAGZ7D,cAAc6D,GACrBA,EAAEC,kBACFD,EAAEE,iBACF7D,KAAK+D,QAAQpD,KAAKgD,GAGX7D,gBAAgB6D,GACvB3D,KAAKS,UAAakD,EAAEK,OAA4BpD,QAChD+C,EAAEC,kBACFD,EAAEE,iBACF7D,KAAKU,UAAUC,KAAK,CACnBC,QAASZ,KAAKS,UACdI,MAAOb,KAAKa,QAQdf,qBACCmE,EAAgBjE,KAAKsD,gBAAiB,oBAAqBtC,EAAeC,MAC1EgD,EAAgBjE,KAAKwD,eAAgB,mBAAoBxC,EAAeC,MACxEiD,EAAqBlE,KAAKoB,YAAcpB,KAAKC,QAASD,KAAKwD,eAAgBxC,EAAeC","sourcesContent":["/*\n * Radio\n */\n\n@import \"../checkbox/gov-form-checkbox-core.scss\";\n$class: \".gov-form-radio\";\n\n#{$class} {\n\t@extend %form-checkbox-core;\n\tinput + span {\n\t\t&::before {\n\t\t\tborder-radius: 50%;\n\t\t}\n\t\t&::after {\n\t\t\t@include pseudo();\n\t\t\tborder-radius: 50%;\n\t\t\tbackground: $form-radio-indicator-bg;\n\t\t\topacity: 0;\n\t\t\ttransition: $t linear opacity;\n\t\t}\n\t}\n\n\t// STATES\n\tinput:checked + span::after {\n\t\topacity: 1;\n\t}\n\t@include parameter(\"invalid\") {\n\t\tinput + span::after {\n\t\t\tbackground: $form-state-color-error;\n\t\t}\n\t}\n\t@include parameter(\"disabled\") {\n\t\tinput:checked + span::after {\n\t\t\tbackground-color: $form-state-bg-disabled;\n\t\t}\n\t}\n\n\t// VARIANTS\n\t@each $size, $definitions in $form-checkbox-core-sizes {\n\t\t&[size=\"#{$size}\"] {\n\t\t\tinput + span::after {\n\t\t\t\ttop: calc((get(\"indicator-size\", $definitions) - get(\"dot-size\", $definitions)) / 2);\n\t\t\t\tleft: calc((get(\"indicator-size\", $definitions) - get(\"dot-size\", $definitions)) / 2);\n\t\t\t\twidth: get(\"dot-size\", $definitions);\n\t\t\t\theight: get(\"dot-size\", $definitions);\n\t\t\t}\n\t\t}\n\t}\n}\n","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\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"]}