wcs-core 7.2.2 → 7.4.0

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 (302) hide show
  1. package/README.md +11 -9
  2. package/design-tokens/dist/sncf-groupe-root-scoped.css +227 -227
  3. package/design-tokens/dist/sncf-groupe.css +227 -227
  4. package/design-tokens/dist/sncf-holding-root-scoped.css +227 -227
  5. package/design-tokens/dist/sncf-holding.css +227 -227
  6. package/design-tokens/dist/sncf-reseau-root-scoped.css +227 -227
  7. package/design-tokens/dist/sncf-reseau.css +227 -227
  8. package/design-tokens/dist/sncf-voyageurs-root-scoped.css +242 -242
  9. package/design-tokens/dist/sncf-voyageurs.css +242 -242
  10. package/dist/cjs/accessibility-5f681a74.js.map +1 -1
  11. package/dist/cjs/loader.cjs.js +1 -1
  12. package/dist/cjs/{popper-8d6e7fca.js → popper-1b61df21.js} +10 -17
  13. package/dist/cjs/popper-1b61df21.js.map +1 -0
  14. package/dist/cjs/wcs-accordion-panel.cjs.entry.js +1 -1
  15. package/dist/cjs/wcs-accordion-panel.cjs.entry.js.map +1 -1
  16. package/dist/cjs/wcs-accordion.cjs.entry.js +2 -1
  17. package/dist/cjs/wcs-accordion.cjs.entry.js.map +1 -1
  18. package/dist/cjs/wcs-breadcrumb.cjs.entry.js +1 -1
  19. package/dist/cjs/wcs-breadcrumb.cjs.entry.js.map +1 -1
  20. package/dist/cjs/wcs-checkbox.cjs.entry.js +3 -2
  21. package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
  22. package/dist/cjs/wcs-chip.cjs.entry.js +102 -0
  23. package/dist/cjs/wcs-chip.cjs.entry.js.map +1 -0
  24. package/dist/cjs/wcs-com-nav-item.cjs.entry.js +1 -1
  25. package/dist/cjs/wcs-com-nav-item.cjs.entry.js.map +1 -1
  26. package/dist/cjs/wcs-com-nav.cjs.entry.js +3 -3
  27. package/dist/cjs/wcs-com-nav.cjs.entry.js.map +1 -1
  28. package/dist/cjs/wcs-dropdown.cjs.entry.js +1 -1
  29. package/dist/cjs/wcs-error_3.cjs.entry.js +1 -1
  30. package/dist/cjs/wcs-error_3.cjs.entry.js.map +1 -1
  31. package/dist/cjs/wcs-galactic-menu.cjs.entry.js +1 -1
  32. package/dist/cjs/wcs-grid.cjs.entry.js +5 -4
  33. package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
  34. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +3 -2
  35. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js.map +1 -1
  36. package/dist/cjs/wcs-modal.cjs.entry.js +2 -2
  37. package/dist/cjs/wcs-modal.cjs.entry.js.map +1 -1
  38. package/dist/cjs/wcs-select_2.cjs.entry.js +59 -24
  39. package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
  40. package/dist/cjs/wcs-tabs.cjs.entry.js +1 -1
  41. package/dist/cjs/wcs-tooltip.cjs.entry.js +1 -1
  42. package/dist/cjs/wcs.cjs.js +1 -1
  43. package/dist/collection/collection-manifest.json +1 -0
  44. package/dist/collection/components/accordion/accordion.e2e.playwright.js +183 -0
  45. package/dist/collection/components/accordion/accordion.e2e.playwright.js.map +1 -0
  46. package/dist/collection/components/accordion/accordion.js +2 -1
  47. package/dist/collection/components/accordion/accordion.js.map +1 -1
  48. package/dist/collection/components/accordion-panel/accordion-panel.js +3 -3
  49. package/dist/collection/components/accordion-panel/accordion-panel.js.map +1 -1
  50. package/dist/collection/components/alert/alert.e2e.playwright.js +125 -0
  51. package/dist/collection/components/alert/alert.e2e.playwright.js.map +1 -0
  52. package/dist/collection/components/alert-drawer/alert-drawer.e2e.playwright.js +107 -0
  53. package/dist/collection/components/alert-drawer/alert-drawer.e2e.playwright.js.map +1 -0
  54. package/dist/collection/components/breadcrumb/breadcrumb.e2e.playwright.js +188 -0
  55. package/dist/collection/components/breadcrumb/breadcrumb.e2e.playwright.js.map +1 -0
  56. package/dist/collection/components/breadcrumb/breadcrumb.js +2 -2
  57. package/dist/collection/components/breadcrumb/breadcrumb.js.map +1 -1
  58. package/dist/collection/components/button/button.e2e.playwright.js +26 -0
  59. package/dist/collection/components/button/button.e2e.playwright.js.map +1 -0
  60. package/dist/collection/components/button/button.js +1 -1
  61. package/dist/collection/components/checkbox/checkbox.css +3 -0
  62. package/dist/collection/components/checkbox/checkbox.e2e.playwright.js +39 -0
  63. package/dist/collection/components/checkbox/checkbox.e2e.playwright.js.map +1 -0
  64. package/dist/collection/components/checkbox/checkbox.js +21 -2
  65. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  66. package/dist/collection/components/chip/chip-interface.js +2 -0
  67. package/dist/collection/components/chip/chip-interface.js.map +1 -0
  68. package/dist/collection/components/chip/chip.css +220 -0
  69. package/dist/collection/components/chip/chip.e2e.playwright.js +190 -0
  70. package/dist/collection/components/chip/chip.e2e.playwright.js.map +1 -0
  71. package/dist/collection/components/chip/chip.js +341 -0
  72. package/dist/collection/components/chip/chip.js.map +1 -0
  73. package/dist/collection/components/com-nav/com-nav.css +15 -0
  74. package/dist/collection/components/com-nav/{com-nav.e2e.js → com-nav.e2e.playwright.js} +60 -44
  75. package/dist/collection/components/com-nav/com-nav.e2e.playwright.js.map +1 -0
  76. package/dist/collection/components/com-nav/com-nav.js +3 -3
  77. package/dist/collection/components/com-nav/com-nav.js.map +1 -1
  78. package/dist/collection/components/com-nav-category/com-nav-category.js +1 -1
  79. package/dist/collection/components/com-nav-item/com-nav-item.css +2 -2
  80. package/dist/collection/components/com-nav-submenu/com-nav-submenu.js +1 -1
  81. package/dist/collection/components/counter/counter.e2e.playwright.js +187 -0
  82. package/dist/collection/components/counter/counter.e2e.playwright.js.map +1 -0
  83. package/dist/collection/components/counter/counter.js +1 -1
  84. package/dist/collection/components/dropdown/dropdown.e2e.playwright.js +320 -0
  85. package/dist/collection/components/dropdown/dropdown.e2e.playwright.js.map +1 -0
  86. package/dist/collection/components/dropdown/dropdown.js +1 -1
  87. package/dist/collection/components/editable-field/editable-field.e2e.playwright.js +156 -0
  88. package/dist/collection/components/editable-field/editable-field.e2e.playwright.js.map +1 -0
  89. package/dist/collection/components/form-field/form-field.e2e.playwright.js +104 -0
  90. package/dist/collection/components/form-field/form-field.e2e.playwright.js.map +1 -0
  91. package/dist/collection/components/galactic-menu/galactic-menu.js +1 -1
  92. package/dist/collection/components/grid/grid.e2e.playwright.js +153 -0
  93. package/dist/collection/components/grid/grid.e2e.playwright.js.map +1 -0
  94. package/dist/collection/components/grid/grid.js +6 -5
  95. package/dist/collection/components/grid/grid.js.map +1 -1
  96. package/dist/collection/components/grid-column/grid-column.js +1 -1
  97. package/dist/collection/components/grid-pagination/grid-pagination.js +1 -1
  98. package/dist/collection/components/header/header.js +1 -1
  99. package/dist/collection/components/horizontal-stepper/horizontal-step.js +2 -1
  100. package/dist/collection/components/horizontal-stepper/horizontal-step.js.map +1 -1
  101. package/dist/collection/components/horizontal-stepper/horizontal-stepper-interface.js.map +1 -1
  102. package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +5 -1
  103. package/dist/collection/components/horizontal-stepper/horizontal-stepper.js.map +1 -1
  104. package/dist/collection/components/icon/icon.js +1 -1
  105. package/dist/collection/components/input/input.e2e.playwright.js +157 -0
  106. package/dist/collection/components/input/input.e2e.playwright.js.map +1 -0
  107. package/dist/collection/components/input/input.js +2 -2
  108. package/dist/collection/components/label/label.css +4 -6
  109. package/dist/collection/components/label/label.js +1 -1
  110. package/dist/collection/components/mat-icon/mat-icon.js +1 -1
  111. package/dist/collection/components/modal/modal.css +4 -0
  112. package/dist/collection/components/modal/modal.e2e.playwright.js +35 -0
  113. package/dist/collection/components/modal/modal.e2e.playwright.js.map +1 -0
  114. package/dist/collection/components/modal/modal.js +2 -2
  115. package/dist/collection/components/modal/modal.js.map +1 -1
  116. package/dist/collection/components/native-select/native-select.js +1 -1
  117. package/dist/collection/components/nav/nav.js +1 -1
  118. package/dist/collection/components/progress-bar/progress-bar.js +1 -1
  119. package/dist/collection/components/progress-radial/progress-radial.js +1 -1
  120. package/dist/collection/components/radio/radio.js +1 -1
  121. package/dist/collection/components/radio-group/radio-group.e2e.playwright.js +231 -0
  122. package/dist/collection/components/radio-group/radio-group.e2e.playwright.js.map +1 -0
  123. package/dist/collection/components/radio-group/radio-group.js +1 -1
  124. package/dist/collection/components/select/select.e2e.playwright.js +1702 -0
  125. package/dist/collection/components/select/select.e2e.playwright.js.map +1 -0
  126. package/dist/collection/components/select/select.js +49 -20
  127. package/dist/collection/components/select/select.js.map +1 -1
  128. package/dist/collection/components/select-option/select-option.js +3 -3
  129. package/dist/collection/components/select-option/select-option.js.map +1 -1
  130. package/dist/collection/components/switch/switch.e2e.playwright.js +40 -0
  131. package/dist/collection/components/switch/switch.e2e.playwright.js.map +1 -0
  132. package/dist/collection/components/switch/switch.js +1 -1
  133. package/dist/collection/components/tabs/tabs.e2e.playwright.js +205 -0
  134. package/dist/collection/components/tabs/tabs.e2e.playwright.js.map +1 -0
  135. package/dist/collection/components/tabs/tabs.js +1 -1
  136. package/dist/collection/components/textarea/textarea.e2e.playwright.js +133 -0
  137. package/dist/collection/components/textarea/textarea.e2e.playwright.js.map +1 -0
  138. package/dist/collection/components/textarea/textarea.js +1 -1
  139. package/dist/collection/utils/accessibility.js +16 -0
  140. package/dist/collection/utils/accessibility.js.map +1 -1
  141. package/dist/collection/utils/playwright/test-expect.js +2 -0
  142. package/dist/collection/utils/playwright/test-expect.js.map +1 -0
  143. package/dist/collection/utils/playwright/test.js +16 -0
  144. package/dist/collection/utils/playwright/test.js.map +1 -0
  145. package/dist/esm/accessibility-069640cf.js.map +1 -1
  146. package/dist/esm/loader.js +1 -1
  147. package/dist/esm/{popper-e491c314.js → popper-ac238961.js} +10 -17
  148. package/dist/esm/popper-ac238961.js.map +1 -0
  149. package/dist/esm/wcs-accordion-panel.entry.js +1 -1
  150. package/dist/esm/wcs-accordion-panel.entry.js.map +1 -1
  151. package/dist/esm/wcs-accordion.entry.js +2 -1
  152. package/dist/esm/wcs-accordion.entry.js.map +1 -1
  153. package/dist/esm/wcs-breadcrumb.entry.js +1 -1
  154. package/dist/esm/wcs-breadcrumb.entry.js.map +1 -1
  155. package/dist/esm/wcs-checkbox.entry.js +3 -2
  156. package/dist/esm/wcs-checkbox.entry.js.map +1 -1
  157. package/dist/esm/wcs-chip.entry.js +98 -0
  158. package/dist/esm/wcs-chip.entry.js.map +1 -0
  159. package/dist/esm/wcs-com-nav-item.entry.js +1 -1
  160. package/dist/esm/wcs-com-nav-item.entry.js.map +1 -1
  161. package/dist/esm/wcs-com-nav.entry.js +3 -3
  162. package/dist/esm/wcs-com-nav.entry.js.map +1 -1
  163. package/dist/esm/wcs-dropdown.entry.js +1 -1
  164. package/dist/esm/wcs-error_3.entry.js +1 -1
  165. package/dist/esm/wcs-error_3.entry.js.map +1 -1
  166. package/dist/esm/wcs-galactic-menu.entry.js +1 -1
  167. package/dist/esm/wcs-grid.entry.js +5 -4
  168. package/dist/esm/wcs-grid.entry.js.map +1 -1
  169. package/dist/esm/wcs-horizontal-stepper.entry.js +3 -2
  170. package/dist/esm/wcs-horizontal-stepper.entry.js.map +1 -1
  171. package/dist/esm/wcs-modal.entry.js +2 -2
  172. package/dist/esm/wcs-modal.entry.js.map +1 -1
  173. package/dist/esm/wcs-select_2.entry.js +59 -24
  174. package/dist/esm/wcs-select_2.entry.js.map +1 -1
  175. package/dist/esm/wcs-tabs.entry.js +1 -1
  176. package/dist/esm/wcs-tooltip.entry.js +1 -1
  177. package/dist/esm/wcs.js +1 -1
  178. package/dist/types/components/accordion/accordion.e2e.playwright.d.ts +1 -0
  179. package/dist/types/components/accordion-panel/accordion-panel.d.ts +5 -0
  180. package/dist/types/components/alert/alert.e2e.playwright.d.ts +1 -0
  181. package/dist/types/components/alert-drawer/alert-drawer.e2e.playwright.d.ts +1 -0
  182. package/dist/types/components/breadcrumb/breadcrumb.e2e.playwright.d.ts +1 -0
  183. package/dist/types/components/button/button.e2e.playwright.d.ts +1 -0
  184. package/dist/types/components/checkbox/checkbox.d.ts +4 -0
  185. package/dist/types/components/checkbox/checkbox.e2e.playwright.d.ts +1 -0
  186. package/dist/types/components/chip/chip-interface.d.ts +4 -0
  187. package/dist/types/components/chip/chip.d.ts +132 -0
  188. package/dist/types/components/chip/chip.e2e.playwright.d.ts +1 -0
  189. package/dist/types/components/com-nav/com-nav.e2e.playwright.d.ts +1 -0
  190. package/dist/types/components/counter/counter.e2e.playwright.d.ts +1 -0
  191. package/dist/types/components/dropdown/dropdown.e2e.playwright.d.ts +1 -0
  192. package/dist/types/components/editable-field/editable-field.e2e.playwright.d.ts +1 -0
  193. package/dist/types/components/form-field/form-field.e2e.playwright.d.ts +1 -0
  194. package/dist/types/components/grid/grid.e2e.playwright.d.ts +1 -0
  195. package/dist/types/components/horizontal-stepper/horizontal-stepper-interface.d.ts +2 -0
  196. package/dist/types/components/horizontal-stepper/horizontal-stepper.d.ts +4 -0
  197. package/dist/types/components/input/input.e2e.playwright.d.ts +1 -0
  198. package/dist/types/components/modal/modal.e2e.playwright.d.ts +1 -0
  199. package/dist/types/components/radio-group/radio-group.e2e.playwright.d.ts +1 -0
  200. package/dist/types/components/select/select.d.ts +7 -1
  201. package/dist/types/components/select/select.e2e.playwright.d.ts +1 -0
  202. package/dist/types/components/switch/switch.e2e.playwright.d.ts +1 -0
  203. package/dist/types/components/tabs/tabs.e2e.playwright.d.ts +1 -0
  204. package/dist/types/components/textarea/textarea.e2e.playwright.d.ts +1 -0
  205. package/dist/types/components.d.ts +354 -0
  206. package/dist/types/utils/accessibility.d.ts +7 -0
  207. package/dist/types/utils/playwright/test-expect.d.ts +33 -0
  208. package/dist/types/utils/playwright/test.d.ts +7 -0
  209. package/dist/wcs/{p-8e9bd0f1.entry.js → p-0326f834.entry.js} +2 -2
  210. package/dist/wcs/{p-8e9bd0f1.entry.js.map → p-0326f834.entry.js.map} +1 -1
  211. package/dist/wcs/p-2221bf0c.entry.js +16 -0
  212. package/dist/wcs/p-2221bf0c.entry.js.map +1 -0
  213. package/dist/wcs/p-4ae08567.entry.js +2 -0
  214. package/dist/wcs/p-4ae08567.entry.js.map +1 -0
  215. package/dist/wcs/p-4e2d6227.entry.js +2 -0
  216. package/dist/wcs/p-4e2d6227.entry.js.map +1 -0
  217. package/dist/wcs/p-828b45b4.entry.js +2 -0
  218. package/dist/wcs/p-828b45b4.entry.js.map +1 -0
  219. package/dist/wcs/p-8332a7e3.entry.js +2 -0
  220. package/dist/wcs/p-8332a7e3.entry.js.map +1 -0
  221. package/dist/wcs/p-990698a7.entry.js +2 -0
  222. package/dist/wcs/p-990698a7.entry.js.map +1 -0
  223. package/dist/wcs/{p-ec383729.entry.js → p-9b76b8e6.entry.js} +2 -2
  224. package/dist/wcs/{p-ec383729.entry.js.map → p-9b76b8e6.entry.js.map} +1 -1
  225. package/dist/wcs/{p-1f593d06.entry.js → p-abd8d5a0.entry.js} +2 -2
  226. package/dist/wcs/{p-622f7403.entry.js → p-c6f8c45c.entry.js} +2 -2
  227. package/dist/wcs/{p-a94e685c.entry.js → p-db7ba599.entry.js} +2 -2
  228. package/dist/wcs/p-e1fb3625.js +2 -0
  229. package/dist/wcs/p-e1fb3625.js.map +1 -0
  230. package/dist/wcs/p-ed3b0709.entry.js +2 -0
  231. package/dist/wcs/p-ed3b0709.entry.js.map +1 -0
  232. package/dist/wcs/{p-6c6079ee.entry.js → p-f2eeb249.entry.js} +2 -2
  233. package/dist/wcs/{p-6c6079ee.entry.js.map → p-f2eeb249.entry.js.map} +1 -1
  234. package/dist/wcs/{p-a956dc84.entry.js → p-f2f7595e.entry.js} +2 -2
  235. package/dist/wcs/{p-a956dc84.entry.js.map → p-f2f7595e.entry.js.map} +1 -1
  236. package/dist/wcs/p-fb2751c2.js.map +1 -1
  237. package/dist/wcs/p-fbd68522.entry.js +2 -0
  238. package/dist/wcs/p-fbd68522.entry.js.map +1 -0
  239. package/dist/wcs/{p-8c2605fd.entry.js → p-fe303f58.entry.js} +2 -2
  240. package/dist/wcs/wcs.esm.js +1 -1
  241. package/dist/wcs/wcs.esm.js.map +1 -1
  242. package/package.json +18 -24
  243. package/dist/cjs/popper-8d6e7fca.js.map +0 -1
  244. package/dist/collection/components/alert/alert.e2e.js +0 -142
  245. package/dist/collection/components/alert/alert.e2e.js.map +0 -1
  246. package/dist/collection/components/alert-drawer/alert-drawer.e2e.js +0 -111
  247. package/dist/collection/components/alert-drawer/alert-drawer.e2e.js.map +0 -1
  248. package/dist/collection/components/breadcrumb/breadcrumb.e2e.js +0 -223
  249. package/dist/collection/components/breadcrumb/breadcrumb.e2e.js.map +0 -1
  250. package/dist/collection/components/button/button.e2e.js +0 -25
  251. package/dist/collection/components/button/button.e2e.js.map +0 -1
  252. package/dist/collection/components/checkbox/checkbox.e2e.js +0 -45
  253. package/dist/collection/components/checkbox/checkbox.e2e.js.map +0 -1
  254. package/dist/collection/components/com-nav/com-nav.e2e.js.map +0 -1
  255. package/dist/collection/components/counter/counter.e2e.js +0 -206
  256. package/dist/collection/components/counter/counter.e2e.js.map +0 -1
  257. package/dist/collection/components/dropdown/dropdown.e2e.js +0 -156
  258. package/dist/collection/components/dropdown/dropdown.e2e.js.map +0 -1
  259. package/dist/collection/components/editable-field/editable-field.e2e.js +0 -176
  260. package/dist/collection/components/editable-field/editable-field.e2e.js.map +0 -1
  261. package/dist/collection/components/form-field/form-field.e2e.js +0 -122
  262. package/dist/collection/components/form-field/form-field.e2e.js.map +0 -1
  263. package/dist/collection/components/grid/grid.e2e.js +0 -147
  264. package/dist/collection/components/grid/grid.e2e.js.map +0 -1
  265. package/dist/collection/components/input/input.e2e.js +0 -152
  266. package/dist/collection/components/input/input.e2e.js.map +0 -1
  267. package/dist/collection/components/modal/modal.e2e.js +0 -36
  268. package/dist/collection/components/modal/modal.e2e.js.map +0 -1
  269. package/dist/collection/components/radio-group/radio-group.e2e.js +0 -239
  270. package/dist/collection/components/radio-group/radio-group.e2e.js.map +0 -1
  271. package/dist/collection/components/select/select.e2e.js +0 -1081
  272. package/dist/collection/components/select/select.e2e.js.map +0 -1
  273. package/dist/collection/components/switch/switch.e2e.js +0 -45
  274. package/dist/collection/components/switch/switch.e2e.js.map +0 -1
  275. package/dist/collection/components/tabs/tabs.e2e.js +0 -207
  276. package/dist/collection/components/tabs/tabs.e2e.js.map +0 -1
  277. package/dist/collection/components/textarea/textarea.e2e.js +0 -132
  278. package/dist/collection/components/textarea/textarea.e2e.js.map +0 -1
  279. package/dist/collection/utils/tests.js +0 -23
  280. package/dist/collection/utils/tests.js.map +0 -1
  281. package/dist/esm/popper-e491c314.js.map +0 -1
  282. package/dist/types/utils/tests.d.ts +0 -4
  283. package/dist/wcs/p-02f31010.entry.js +0 -2
  284. package/dist/wcs/p-02f31010.entry.js.map +0 -1
  285. package/dist/wcs/p-0dd07842.entry.js +0 -2
  286. package/dist/wcs/p-0dd07842.entry.js.map +0 -1
  287. package/dist/wcs/p-0f864e86.js +0 -2
  288. package/dist/wcs/p-0f864e86.js.map +0 -1
  289. package/dist/wcs/p-1244daa0.entry.js +0 -2
  290. package/dist/wcs/p-1244daa0.entry.js.map +0 -1
  291. package/dist/wcs/p-1fbe0328.entry.js +0 -2
  292. package/dist/wcs/p-1fbe0328.entry.js.map +0 -1
  293. package/dist/wcs/p-4fb2d985.entry.js +0 -2
  294. package/dist/wcs/p-4fb2d985.entry.js.map +0 -1
  295. package/dist/wcs/p-b94a09b6.entry.js +0 -16
  296. package/dist/wcs/p-b94a09b6.entry.js.map +0 -1
  297. package/dist/wcs/p-fd187bce.entry.js +0 -2
  298. package/dist/wcs/p-fd187bce.entry.js.map +0 -1
  299. /package/dist/wcs/{p-1f593d06.entry.js.map → p-abd8d5a0.entry.js.map} +0 -0
  300. /package/dist/wcs/{p-622f7403.entry.js.map → p-c6f8c45c.entry.js.map} +0 -0
  301. /package/dist/wcs/{p-a94e685c.entry.js.map → p-db7ba599.entry.js.map} +0 -0
  302. /package/dist/wcs/{p-8c2605fd.entry.js.map → p-fe303f58.entry.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.e2e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AAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,wDAAwD,EAAE,KAAK,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE;QACjG,QAAQ;QACR,MAAM,aAAa,CAAC,IAAI,EAAE;;SAEzB,CAAC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAExC,OAAO;QACP,MAAM,KAAK,CAAC,QAAQ,CAAC,CAAC,EAAO,EAAE,EAAE,CAAC,EAAE,CAAC,KAAK,GAAG,eAAe,CAAC,CAAC;QAE9D,OAAO;QACP,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAC/D,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC,gBAAgB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { setWcsContent } from '../../utils/playwright/test';\nimport { test, E2EPage } from \"@stencil/playwright\";\n\nimport { expect } from \"@playwright/test\";\n\ntest.describe('Input component', () => {\n test('Should fire wcsInput event once when user typing one char', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const inputSpy = await page.spyOnEvent('wcsInput');\n const input = page.locator('wcs-input');\n\n // When\n await input.click();\n await input.press('B');\n await page.waitForChanges();\n\n // Then\n expect(inputSpy).toHaveReceivedEventTimes(1);\n });\n\n test('Should fire wcsInput event multiple times when user typing multiple chars', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const inputSpy = await page.spyOnEvent('wcsInput');\n const input = page.locator('wcs-input');\n\n // When\n await input.click();\n await input.press('B');\n await page.waitForChanges();\n await input.press('o');\n await page.waitForChanges();\n await input.press('n');\n await page.waitForChanges();\n await input.press('j');\n await page.waitForChanges();\n await input.press('o');\n await page.waitForChanges();\n await input.press('u');\n await page.waitForChanges();\n await input.press('r');\n await page.waitForChanges();\n\n // Then\n expect(inputSpy).toHaveReceivedEventTimes(7);\n });\n\n test('Should fire wcsChange event when user commit change with blur (tab)', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\"></wcs-input>\n <button>Focus</button>\n `);\n\n const changeSpy = await page.spyOnEvent('wcsChange');\n const input = page.locator('wcs-input');\n const button = page.locator('button');\n\n // When\n await input.click();\n await expect(input).toBeFocused();\n await input.press('B');\n await input.press('l');\n await input.press('u');\n await input.press('r');\n await button.focus();\n await page.waitForChanges();\n\n // Then\n expect(changeSpy).toHaveReceivedEventTimes(1);\n expect(changeSpy).toHaveReceivedEventDetail({ value: 'Blur' });\n });\n\n test('Should fire wcsChange event when user commit change with blur (click)', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\"></wcs-input>\n <button>Focus</button>\n `);\n\n const changeSpy = await page.spyOnEvent('wcsChange');\n const input = page.locator('wcs-input');\n const button = page.locator('button');\n\n // When\n await input.click();\n await input.press('B');\n await input.press('l');\n await input.press('u');\n await input.press('r');\n await button.focus();\n await page.waitForChanges();\n\n // Then\n expect(changeSpy).toHaveReceivedEventTimes(1);\n expect(changeSpy).toHaveReceivedEventDetail({ value: 'Blur' });\n });\n\n test('Should fire wcsChange event when user commit change with enter', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const changeSpy = await page.spyOnEvent('wcsChange');\n const input = page.locator('wcs-input');\n\n // When\n await input.click();\n await input.press('E');\n await input.press('n');\n await input.press('t');\n await input.press('e');\n await input.press('r');\n await input.press('Enter');\n await page.waitForChanges();\n\n // Then\n expect(changeSpy).toHaveReceivedEventTimes(1);\n expect(changeSpy).toHaveReceivedEventDetail({ value: 'Enter' });\n });\n\n test('Should not fire wcsChange event when value is programmatically set', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const changeSpy = await page.spyOnEvent('wcsChange');\n const input = page.locator('wcs-input');\n\n // When\n await input.evaluate((el: any) => el.value = 'Programmatically set value');\n await page.waitForChanges();\n\n // Then\n expect(changeSpy).toHaveReceivedEventTimes(0);\n });\n\n test('Should not fire wcsInput event when value is programmatically set', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const inputSpy = await page.spyOnEvent('wcsInput');\n const input = page.locator('wcs-input');\n\n // When\n await input.evaluate((el: any) => el.value = 'Programmatically set value');\n await page.waitForChanges();\n\n // Then\n expect(inputSpy).toHaveReceivedEventTimes(0);\n });\n\n test('Should have a default value when value attribute is set', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" value=\"Default value\" />\n `);\n\n const input = page.locator('wcs-input');\n\n // Then\n await expect(input).toHaveJSProperty('value', 'Default value');\n await expect(page.locator('wcs-input input')).toHaveJSProperty('value', 'Default value');\n });\n\n test('Should have a default value when value property is set', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input name=\"wcs-input-1\" />\n `);\n\n const input = page.locator('wcs-input');\n\n // When\n await input.evaluate((el: any) => el.value = 'Default value');\n\n // Then\n await expect(input).toHaveJSProperty('value', 'Default value');\n await expect(page.locator('wcs-input input')).toHaveJSProperty('value', 'Default value');\n });\n});\n"]}
@@ -250,7 +250,7 @@ export class Input {
250
250
  "mutable": false,
251
251
  "complexType": {
252
252
  "original": "AutocompleteTypes",
253
- "resolved": "\"name\" | \"on\" | \"off\" | \"honorific-prefix\" | \"given-name\" | \"additional-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\"",
253
+ "resolved": "\"on\" | \"off\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"additional-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\"",
254
254
  "references": {
255
255
  "AutocompleteTypes": {
256
256
  "location": "import",
@@ -917,7 +917,7 @@ export class Input {
917
917
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
918
918
  "parameters": [{
919
919
  "name": "attr",
920
- "type": "\"role\" | `aria-${string}`",
920
+ "type": "`aria-${string}` | \"role\"",
921
921
  "docs": ""
922
922
  }, {
923
923
  "name": "value",
@@ -13,12 +13,10 @@
13
13
  }
14
14
 
15
15
  label {
16
- display: inline-block;
16
+ display: inline-flex;
17
+ align-items: center;
18
+ gap: var(--wcs-label-gap);
19
+ line-height: 0;
17
20
  color: var(--wcs-label-color);
18
21
  font-weight: var(--wcs-label-font-weight);
19
- }
20
- label ::slotted(wcs-mat-icon) {
21
- display: inline;
22
- vertical-align: middle;
23
- margin-left: var(--wcs-label-gap);
24
22
  }
@@ -71,7 +71,7 @@ export class Label {
71
71
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
72
72
  "parameters": [{
73
73
  "name": "attr",
74
- "type": "\"role\" | `aria-${string}`",
74
+ "type": "`aria-${string}` | \"role\"",
75
75
  "docs": ""
76
76
  }, {
77
77
  "name": "value",
@@ -115,7 +115,7 @@ export class MatIcon {
115
115
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
116
116
  "parameters": [{
117
117
  "name": "attr",
118
- "type": "\"role\" | `aria-${string}`",
118
+ "type": "`aria-${string}` | \"role\"",
119
119
  "docs": ""
120
120
  }, {
121
121
  "name": "value",
@@ -43,6 +43,10 @@ wcs-modal[without-backdrop] .wcs-modal-container {
43
43
  border: solid var(--wcs-modal-border-width) var(--wcs-modal-border-color);
44
44
  }
45
45
 
46
+ wcs-modal[hide-actions] .wcs-modal-actions {
47
+ display: none;
48
+ }
49
+
46
50
  /**
47
51
  Modal window
48
52
  */
@@ -0,0 +1,35 @@
1
+ import { setWcsContent } from "../../utils/playwright/test";
2
+ import { test } from "@stencil/playwright";
3
+ import { expect } from "@playwright/test";
4
+ test.describe('modal', () => {
5
+ test('should trap the focus inside', async ({ page }) => {
6
+ // Given
7
+ await setWcsContent(page, `
8
+ <wcs-modal show-close-button>
9
+ <wcs-input id="first-input" type="text"></wcs-input>
10
+ <wcs-button id="last-button" disabled class="wcs-primary" type="button">Envoyer</wcs-button>
11
+ </wcs-modal>
12
+ `); // Modal is opened by default in this test
13
+ const modal = page.locator('wcs-modal');
14
+ await modal.evaluate((el) => el.show = true);
15
+ const showCloseButton = page.locator('wcs-modal .wcs-modal-header wcs-button');
16
+ const input = page.locator('wcs-modal wcs-input');
17
+ const button = page.locator('wcs-modal wcs-button#last-button');
18
+ // When / Then
19
+ // Focus should be on close button initially
20
+ await expect(showCloseButton).toBeFocused();
21
+ await page.keyboard.press('Tab');
22
+ await expect(input).toBeFocused();
23
+ await page.keyboard.press('Tab');
24
+ // Focus should cycle back to close button since the button is disabled
25
+ await expect(showCloseButton).toBeFocused();
26
+ await page.keyboard.press('Tab'); // input receives the focus
27
+ await expect(input).toBeFocused();
28
+ // Enable the button and wait for focus trap to update
29
+ await button.evaluate((el) => el.disabled = false);
30
+ await page.waitForTimeout(300); // Wait for focus trap to recalculate focusable elements
31
+ await page.keyboard.press('Tab');
32
+ await expect(button).toBeFocused();
33
+ });
34
+ });
35
+ //# sourceMappingURL=modal.e2e.playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"modal.e2e.playwright.js","sourceRoot":"","sources":["../../../src/components/modal/modal.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAW,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACxB,IAAI,CAAC,8BAA8B,EAAE,KAAK,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE;QACvE,QAAQ;QACR,MAAM,aAAa,CAAC,IAAI,EAAE;;;;;SAKzB,CAAC,CAAC,CAAC,0CAA0C;QAE9C,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,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from '../../utils/playwright/test';\nimport { test, E2EPage } from \"@stencil/playwright\";\n\nimport { expect } from \"@playwright/test\";\n\ntest.describe('modal', () => {\n test('should trap the focus inside', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-modal show-close-button>\n <wcs-input id=\"first-input\" type=\"text\"></wcs-input>\n <wcs-button id=\"last-button\" disabled class=\"wcs-primary\" type=\"button\">Envoyer</wcs-button>\n </wcs-modal>\n `); // Modal is opened by default in this test\n\n const modal = page.locator('wcs-modal');\n await modal.evaluate((el: any) => el.show = true);\n\n const showCloseButton = page.locator('wcs-modal .wcs-modal-header wcs-button');\n const input = page.locator('wcs-modal wcs-input');\n const button = page.locator('wcs-modal wcs-button#last-button');\n\n // When / Then\n // Focus should be on close button initially\n await expect(showCloseButton).toBeFocused();\n\n await page.keyboard.press('Tab');\n await expect(input).toBeFocused();\n\n await page.keyboard.press('Tab');\n // Focus should cycle back to close button since the button is disabled\n await expect(showCloseButton).toBeFocused();\n\n await page.keyboard.press('Tab'); // input receives the focus\n await expect(input).toBeFocused();\n\n // Enable the button and wait for focus trap to update\n await button.evaluate((el: any) => el.disabled = false);\n await page.waitForTimeout(300); // Wait for focus trap to recalculate focusable elements\n\n await page.keyboard.press('Tab');\n await expect(button).toBeFocused();\n });\n});\n"]}
@@ -169,7 +169,7 @@ export class Modal {
169
169
  }
170
170
  render() {
171
171
  const modalTitleId = `wcs-modal-title-${this.modalId}`;
172
- return (h(Host, { key: 'e609fe2024b73cab0bed97c0d3b7012d8deba893' }, h("div", Object.assign({ key: '23007c4ad4971263f7fd99d0e594216cd112f6ea', class: "wcs-modal-container", "data-size": this.size, "aria-modal": "true", role: "dialog", "aria-labelledby": modalTitleId, ref: (el) => (this.nativeDivDialog = el) }, this.inheritedAttributes), h("div", { key: 'bc3e2ead8e3e73da31882c5e87cde2780d9ef2f9', class: "wcs-modal-header" }, h("h1", { key: '87561fc92b0990d00e06463afc111e9bdeab6f20', id: modalTitleId }, h("slot", { key: 'dbf6d932257e7a264206ddf7caea8a80e4b2b069', name: "header" })), this.showCloseButton && (h("wcs-button", { key: '97036ea40d111c5ac737b1e3f789571cd524cb2d', shape: "round", mode: "clear", id: "wcs-modal-close-button", "aria-label": this.closeButtonAriaLabel, onClick: ($event) => this.onCloseButtonClick($event) }, h("wcs-mat-icon", { key: '24d6b531e788c2760c66804df96037714c9f854b', icon: "close" })))), h("div", { key: '34d9ddf3c4527395864a238f329d7b499eb9791b', class: "wcs-modal-content" }, h("slot", { key: '5bbd76fc7de9bc6f5aaec7257e7c73995d3e1447', onSlotchange: () => this.handleSlotContentChange() })), !this.hideActions && (h("div", { key: '0c082f533dd77e73721b3bcf29a6f3d3baac65b3', class: "wcs-modal-actions" }, h("slot", { key: '56bfb65b4784492747eda2f5eb87b29dc7704db3', name: "actions" }))))));
172
+ return (h(Host, { key: 'e609fe2024b73cab0bed97c0d3b7012d8deba893' }, h("div", Object.assign({ key: '23007c4ad4971263f7fd99d0e594216cd112f6ea', class: "wcs-modal-container", "data-size": this.size, "aria-modal": "true", role: "dialog", "aria-labelledby": modalTitleId, ref: (el) => (this.nativeDivDialog = el) }, this.inheritedAttributes), h("div", { key: 'bc3e2ead8e3e73da31882c5e87cde2780d9ef2f9', class: "wcs-modal-header" }, h("h1", { key: '87561fc92b0990d00e06463afc111e9bdeab6f20', id: modalTitleId }, h("slot", { key: 'dbf6d932257e7a264206ddf7caea8a80e4b2b069', name: "header" })), this.showCloseButton && (h("wcs-button", { key: '97036ea40d111c5ac737b1e3f789571cd524cb2d', shape: "round", mode: "clear", id: "wcs-modal-close-button", "aria-label": this.closeButtonAriaLabel, onClick: ($event) => this.onCloseButtonClick($event) }, h("wcs-mat-icon", { key: '24d6b531e788c2760c66804df96037714c9f854b', icon: "close" })))), h("div", { key: '34d9ddf3c4527395864a238f329d7b499eb9791b', class: "wcs-modal-content" }, h("slot", { key: '5bbd76fc7de9bc6f5aaec7257e7c73995d3e1447', onSlotchange: () => this.handleSlotContentChange() })), h("div", { key: '7c332e9d1c1b19b65fabb6f52bc14ab0ed9f4803', class: "wcs-modal-actions" }, h("slot", { key: '4c44f2337893ba9e8c852a1b8b16beab9da87e4e', name: "actions" })))));
173
173
  }
174
174
  static get is() { return "wcs-modal"; }
175
175
  static get originalStyleUrls() {
@@ -384,7 +384,7 @@ export class Modal {
384
384
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
385
385
  "parameters": [{
386
386
  "name": "attr",
387
- "type": "\"role\" | `aria-${string}`",
387
+ "type": "`aria-${string}` | \"role\"",
388
388
  "docs": ""
389
389
  }, {
390
390
  "name": "value",
@@ -1 +1 @@
1
- {"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EAEJ,KAAK,EAAE,MAAM,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG/G,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,MAAM,OAAO,KAAK;;QAGN,wBAAmB,GAAyB,EAAE,CAAC;QAmEvD;;;WAGG;QACK,YAAO,GAAW,QAAQ,EAAE,CAAC;QAIrC;;;;;WAKG;QACK,+BAA0B,GAAY,KAAK,CAAC;QACpD;;;;;;;WAOG;QACK,wBAAmB,GAAY,KAAK,CAAC;+BArFK,KAAK;oBAKD,KAAK;+BAWT,KAAK;oCAMhB,QAAQ;oBAMrB,GAAG;2BAKiB,KAAK;;qCAkBV,SAAS;gCASG,KAAK;;IA2B1D,iBAAiB;QACb,IAAI,CAA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BAE7B,4DAAK,KAAK,EAAC,kBAAkB;oBACzB,2DAAI,EAAE,EAAE,YAAY;wBAChB,6DAAM,IAAI,EAAC,QAAQ,GAAQ,CAC1B;oBACJ,IAAI,CAAC,eAAe,IAAI,CACrB,mEAAY,KAAK,EAAC,OAAO,EACb,IAAI,EAAC,OAAO,EACZ,EAAE,EAAC,wBAAwB,gBACf,IAAI,CAAC,oBAAoB,EACrC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;wBAC5D,qEAAc,IAAI,EAAC,OAAO,GAAgB,CACjC,CAAC,CAGhB;gBACN,4DAAK,KAAK,EAAC,mBAAmB;oBAC1B,6DAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAS,CAC/D;gBACL,CAAC,IAAI,CAAC,WAAW,IAAI,CAClB,4DAAK,KAAK,EAAC,mBAAmB;oBAC1B,6DAAM,IAAI,EAAC,SAAS,GAAQ,CAC1B,CAAC,CAET,CACH,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import {\n Element,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n ComponentInterface,\n Watch, Method\n} from '@stencil/core';\nimport { ModalSize } from './modal-interface';\nimport { isElementFocused, isFocusable } from \"../../utils/accessibility\";\nimport { inheritAriaAttributes, inheritAttributes, isTabKey, setOrRemoveAttribute } from \"../../utils/helpers\";\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst MODAL_INHERITED_ATTRS = [];\n\n/**\n * The modal component (also named dialog or popup) is an interface element that appears on top of the page content.\n * Use it to show a message, a confirmation dialog, or any other content like forms.\n *\n * ## Accessibility guidelines 💡\n * > - Modal element has `role=\"dialog\"` and `aria-modal=\"true\"`\n * > - Keyboard navigation is trapped inside the modal\n * > - It is mandatory to set the `modal-trigger-controls-id` to the id of the element that opens the dialog, in order\n * > to focus it upon dialog dismissal.\n * > - On modal opening, the default behaviour is to focus the first focusable element. If you want to change the initial \n * > behaviour, you have to use `modal-element-id-to-focus-on-opening` attribute to set the id of the inner modal element you \n * > want to focus. You will see a story as example below\n * > - The modal can be closed at any time by pressing the Escape key.\n * >\n * > - More info : https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/\n *\n * @cssprop --wcs-modal-max-height - Max height of the main container\n * @cssprop --wcs-modal-overflow-y - Overflow-y of the content\n *\n * @cssprop --wcs-modal-backdrop-color - Backdrop color of the modal\n * @cssprop --wcs-modal-max-height - Max height of the main container\n * @cssprop --wcs-modal-background-color - Background color of the modal\n * @cssprop --wcs-modal-border-radius - Border radius of the modal\n * @cssprop --wcs-modal-padding - Padding inside the modal\n * @cssprop --wcs-modal-border-width - Border width of the modal\n * @cssprop --wcs-modal-border-color - Border color of the modal\n * @cssprop --wcs-modal-title-margin-bottom - Margin bottom of the modal title\n * @cssprop --wcs-modal-title-font-size - Font size of the modal title\n * @cssprop --wcs-modal-title-font-weight - Font weight of the modal title\n * @cssprop --wcs-modal-title-line-height - Line height of the modal title\n * @cssprop --wcs-modal-actions-margin-top - Margin top of the modal actions\n * @cssprop --wcs-modal-width-s - Width of the modal for size small\n * @cssprop --wcs-modal-width-m - Width of the modal for size medium\n * @cssprop --wcs-modal-width-l - Width of the modal for size large\n * @cssprop --wcs-modal-width-xl - Width of the modal for size extra large\n * \n * @slot <no-name> Main container slot\n * @slot header Header container slot (for title)\n * @slot actions Actions container slot (for buttons)\n */\n@Component({\n tag: 'wcs-modal',\n styleUrl: 'modal.scss',\n shadow: false,\n})\nexport class Modal implements ComponentInterface, MutableAriaAttribute {\n @Element() private el: HTMLElement;\n private nativeDivDialog!: HTMLDivElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * Specifies whether the component should display a backdrop on the entire page\n */\n @Prop({reflect: true}) withoutBackdrop: boolean = false;\n\n /**\n * Displays the modal\n */\n @Prop({reflect: true, mutable: true}) show: boolean = false;\n\n /**\n * Triggered when the user leaves the dialog with the closing button.\n */\n @Event() wcsDialogClosed: EventEmitter<void>;\n\n /**\n * Specifies whether the component should display a close button.\n * if false, it won't close the modal when the escape key is pressed.\n */\n @Prop({reflect: true}) showCloseButton: boolean = false;\n\n /**\n * Specifies the aria-label present on the close button when the modal is opened. \n * Only use when `showCloseButton` is `true`.\n */\n @Prop() closeButtonAriaLabel: string = 'Fermer';\n\n /**\n * There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the\n * size best suited for the content and screen size displaying the modal. Remember to test responsiveness.\n */\n @Prop() size: ModalSize = 'm';\n\n /**\n * Specifies whether the component should hide the actions slot or not\n */\n @Prop({reflect: true}) hideActions: boolean = false;\n\n /**\n * Specifies which element id controls the modal\n * @private\n */\n @Prop() modalTriggerControlsId: string;\n /**\n * The ID of the element to automatically focus when the modal opens.\n * \n * If this property is not set and `disableAutoFocus` is false, the modal will\n * automatically focus the first focusable element within its content.\n * This follows accessibility best practices by ensuring keyboard navigation\n * starts from a logical point when the modal opens.\n * \n * @example\n * <wcs-modal initial-focus-element=\"cancel-button\"></wcs-modal>\n */\n @Prop() initialFocusElementId?: string = undefined;\n\n /**\n * Disables automatic focus behavior when the modal opens.\n * \n * When set to true, the modal will not automatically focus any element upon opening.\n * Use this property with caution, as managing focus is important for accessibility.\n * Consider providing an alternative focus management strategy if disabling the default behavior.\n */\n @Prop({ reflect: true }) disableAutoFocus: boolean = false;\n\n /**\n * Give an unique id\n * @private\n */\n private modalId: number = modalIds++;\n\n private firstFocusableElement: HTMLElement;\n private lastFocusableElement: HTMLElement;\n /**\n * This attribute is used to determine whether the show attribute has changed since the last rendering. \n * This allows us to call the focus method on the first element of the modal when the show attribute changes to true. \n * This call is made in the componentDidRender method\n * @private\n */\n private showAttributeChangedMarker: boolean = false;\n /**\n * This attribute is used to determine if the modal has been closed for the first time since its last activation.\n * It is set to 'true' when the modal is first closed, and will be reset to 'false' when the modal is shown again.\n * This state is important for accessibility reasons in order to focus the modal trigger element (like the button \n * which controls the modal)\n *\n * @private\n */\n private hasBeenClosedBefore: boolean = false;\n\n componentWillLoad(): Promise<void> | void {\n if (!this.modalTriggerControlsId) {\n console.warn('wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly');\n }\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, MODAL_INHERITED_ATTRS),\n };\n }\n\n componentDidLoad() {\n this.updateFocusableElements();\n }\n\n componentDidRender() {\n this.updateFocusableElements();\n if (this.showAttributeChangedMarker) {\n this.showAttributeChangedMarker = false;\n \n if(this.disableAutoFocus) {\n return;\n }\n \n if(!this.initialFocusElementId) {\n this.firstFocusableElement?.focus();\n } else {\n const modalElementToFocusOnOpening = document.getElementById(this.initialFocusElementId);\n if(!modalElementToFocusOnOpening) {\n console.warn(`wcs-modal: Unable to focus element - ID '${this.initialFocusElementId}' not found in DOM`);\n }\n \n modalElementToFocusOnOpening?.focus();\n }\n }\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeDivDialog, attr, value);\n }\n \n @Watch(\"show\")\n onShowChange() {\n if(this.show) {\n this.hasBeenClosedBefore = false;\n this.showAttributeChangedMarker = true;\n } else {\n // if we already made actions when the modal was firstly closed, we do nothing\n if(this.hasBeenClosedBefore) {\n return;\n }\n \n this.hasBeenClosedBefore = true;\n\n if(this.modalTriggerControlsId) {\n const modalTriggerControlsHtmlElement = document.getElementById(this.modalTriggerControlsId);\n if(!modalTriggerControlsHtmlElement) {\n console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`);\n }\n modalTriggerControlsHtmlElement?.focus();\n }\n }\n }\n\n private updateFocusableElements() {\n const focusableElements = Array.from(this.el.querySelectorAll('*'))\n .filter(element => isFocusable(element));\n\n this.firstFocusableElement = focusableElements.length > 0 && focusableElements[0] as HTMLElement;\n this.lastFocusableElement = focusableElements.length > 0 && focusableElements[focusableElements.length - 1] as HTMLElement;\n }\n \n private close() {\n // If the modal isn't shown, we don't do anything\n if (this.show) {\n this.show = false;\n this.wcsDialogClosed.emit();\n }\n }\n\n @Listen('keydown', {target: 'document'})\n onKeyDown(event: KeyboardEvent) {\n if (this.show && this.showCloseButton && event.key === 'Escape') {\n this.close();\n }\n\n if (this.show) {\n if (isTabKey(event)) {\n this.updateFocusableElements(); // XXX: maybe a performance issue\n const firstElement = this.firstFocusableElement;\n const lastElement = this.lastFocusableElement;\n\n if (event.shiftKey && isElementFocused(firstElement)) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && isElementFocused(lastElement)) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n }\n\n private onCloseButtonClick(_: MouseEvent) {\n this.close();\n }\n\n private handleSlotContentChange() {\n this.updateFocusableElements();\n }\n\n render() {\n const modalTitleId = `wcs-modal-title-${this.modalId}`;\n return (\n <Host>\n <div class=\"wcs-modal-container\"\n data-size={this.size}\n aria-modal=\"true\"\n role={\"dialog\"}\n aria-labelledby={modalTitleId}\n ref={(el) => (this.nativeDivDialog = el)}\n {...this.inheritedAttributes}\n >\n <div class=\"wcs-modal-header\">\n <h1 id={modalTitleId}>\n <slot name=\"header\"></slot>\n </h1>\n {this.showCloseButton && (\n <wcs-button shape=\"round\" \n mode=\"clear\" \n id=\"wcs-modal-close-button\"\n aria-label={this.closeButtonAriaLabel}\n onClick={($event) => this.onCloseButtonClick($event)}>\n <wcs-mat-icon icon=\"close\"></wcs-mat-icon>\n </wcs-button>)\n }\n\n </div>\n <div class=\"wcs-modal-content\">\n <slot onSlotchange={() => this.handleSlotContentChange()}></slot>\n </div>\n {!this.hideActions && (\n <div class=\"wcs-modal-actions\">\n <slot name=\"actions\"></slot>\n </div>)\n }\n </div>\n </Host>\n );\n }\n}\n\nlet modalIds = 0;\n"]}
1
+ {"version":3,"file":"modal.js","sourceRoot":"","sources":["../../../src/components/modal/modal.tsx"],"names":[],"mappings":"AAAA,OAAO,EACH,OAAO,EACP,SAAS,EACT,KAAK,EAEL,CAAC,EACD,IAAI,EACJ,MAAM,EACN,IAAI,EAEJ,KAAK,EAAE,MAAM,EAChB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAG/G,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,MAAM,OAAO,KAAK;;QAGN,wBAAmB,GAAyB,EAAE,CAAC;QAmEvD;;;WAGG;QACK,YAAO,GAAW,QAAQ,EAAE,CAAC;QAIrC;;;;;WAKG;QACK,+BAA0B,GAAY,KAAK,CAAC;QACpD;;;;;;;WAOG;QACK,wBAAmB,GAAY,KAAK,CAAC;+BArFK,KAAK;oBAKD,KAAK;+BAWT,KAAK;oCAMhB,QAAQ;oBAMrB,GAAG;2BAKiB,KAAK;;qCAkBV,SAAS;gCASG,KAAK;;IA2B1D,iBAAiB;QACb,IAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC/B,OAAO,CAAC,IAAI,CAAC,8GAA8G,CAAC,CAAC;QACjI,CAAC;QAED,IAAI,CAAC,mBAAmB,mCACjB,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,G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,OAAO,EACb,IAAI,EAAC,OAAO,EACZ,EAAE,EAAC,wBAAwB,gBACf,IAAI,CAAC,oBAAoB,EACrC,OAAO,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC;wBAC5D,qEAAc,IAAI,EAAC,OAAO,GAAgB,CACjC,CAAC,CAGhB;gBACN,4DAAK,KAAK,EAAC,mBAAmB;oBAC1B,6DAAM,YAAY,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,uBAAuB,EAAE,GAAS,CAC/D;gBACN,4DAAK,KAAK,EAAC,mBAAmB;oBAC1B,6DAAM,IAAI,EAAC,SAAS,GAAQ,CAC1B,CACJ,CACH,CACV,CAAC;IACN,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACJ;AAED,IAAI,QAAQ,GAAG,CAAC,CAAC","sourcesContent":["import {\n Element,\n Component,\n Event,\n EventEmitter,\n h,\n Host,\n Listen,\n Prop,\n ComponentInterface,\n Watch, Method\n} from '@stencil/core';\nimport { ModalSize } from './modal-interface';\nimport { isElementFocused, isFocusable } from \"../../utils/accessibility\";\nimport { inheritAriaAttributes, inheritAttributes, isTabKey, setOrRemoveAttribute } from \"../../utils/helpers\";\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\nconst MODAL_INHERITED_ATTRS = [];\n\n/**\n * The modal component (also named dialog or popup) is an interface element that appears on top of the page content.\n * Use it to show a message, a confirmation dialog, or any other content like forms.\n *\n * ## Accessibility guidelines 💡\n * > - Modal element has `role=\"dialog\"` and `aria-modal=\"true\"`\n * > - Keyboard navigation is trapped inside the modal\n * > - It is mandatory to set the `modal-trigger-controls-id` to the id of the element that opens the dialog, in order\n * > to focus it upon dialog dismissal.\n * > - On modal opening, the default behaviour is to focus the first focusable element. If you want to change the initial \n * > behaviour, you have to use `modal-element-id-to-focus-on-opening` attribute to set the id of the inner modal element you \n * > want to focus. You will see a story as example below\n * > - The modal can be closed at any time by pressing the Escape key.\n * >\n * > - More info : https://www.w3.org/WAI/ARIA/apg/patterns/dialog-modal/\n *\n * @cssprop --wcs-modal-max-height - Max height of the main container\n * @cssprop --wcs-modal-overflow-y - Overflow-y of the content\n *\n * @cssprop --wcs-modal-backdrop-color - Backdrop color of the modal\n * @cssprop --wcs-modal-max-height - Max height of the main container\n * @cssprop --wcs-modal-background-color - Background color of the modal\n * @cssprop --wcs-modal-border-radius - Border radius of the modal\n * @cssprop --wcs-modal-padding - Padding inside the modal\n * @cssprop --wcs-modal-border-width - Border width of the modal\n * @cssprop --wcs-modal-border-color - Border color of the modal\n * @cssprop --wcs-modal-title-margin-bottom - Margin bottom of the modal title\n * @cssprop --wcs-modal-title-font-size - Font size of the modal title\n * @cssprop --wcs-modal-title-font-weight - Font weight of the modal title\n * @cssprop --wcs-modal-title-line-height - Line height of the modal title\n * @cssprop --wcs-modal-actions-margin-top - Margin top of the modal actions\n * @cssprop --wcs-modal-width-s - Width of the modal for size small\n * @cssprop --wcs-modal-width-m - Width of the modal for size medium\n * @cssprop --wcs-modal-width-l - Width of the modal for size large\n * @cssprop --wcs-modal-width-xl - Width of the modal for size extra large\n * \n * @slot <no-name> Main container slot\n * @slot header Header container slot (for title)\n * @slot actions Actions container slot (for buttons)\n */\n@Component({\n tag: 'wcs-modal',\n styleUrl: 'modal.scss',\n shadow: false,\n})\nexport class Modal implements ComponentInterface, MutableAriaAttribute {\n @Element() private el: HTMLElement;\n private nativeDivDialog!: HTMLDivElement;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * Specifies whether the component should display a backdrop on the entire page\n */\n @Prop({reflect: true}) withoutBackdrop: boolean = false;\n\n /**\n * Displays the modal\n */\n @Prop({reflect: true, mutable: true}) show: boolean = false;\n\n /**\n * Triggered when the user leaves the dialog with the closing button.\n */\n @Event() wcsDialogClosed: EventEmitter<void>;\n\n /**\n * Specifies whether the component should display a close button.\n * if false, it won't close the modal when the escape key is pressed.\n */\n @Prop({reflect: true}) showCloseButton: boolean = false;\n\n /**\n * Specifies the aria-label present on the close button when the modal is opened. \n * Only use when `showCloseButton` is `true`.\n */\n @Prop() closeButtonAriaLabel: string = 'Fermer';\n\n /**\n * There are multiple sizes for modals. The default size is medium (m), however other sizes are available. Select the\n * size best suited for the content and screen size displaying the modal. Remember to test responsiveness.\n */\n @Prop() size: ModalSize = 'm';\n\n /**\n * Specifies whether the component should hide the actions slot or not\n */\n @Prop({reflect: true}) hideActions: boolean = false;\n\n /**\n * Specifies which element id controls the modal\n * @private\n */\n @Prop() modalTriggerControlsId: string;\n /**\n * The ID of the element to automatically focus when the modal opens.\n * \n * If this property is not set and `disableAutoFocus` is false, the modal will\n * automatically focus the first focusable element within its content.\n * This follows accessibility best practices by ensuring keyboard navigation\n * starts from a logical point when the modal opens.\n * \n * @example\n * <wcs-modal initial-focus-element=\"cancel-button\"></wcs-modal>\n */\n @Prop() initialFocusElementId?: string = undefined;\n\n /**\n * Disables automatic focus behavior when the modal opens.\n * \n * When set to true, the modal will not automatically focus any element upon opening.\n * Use this property with caution, as managing focus is important for accessibility.\n * Consider providing an alternative focus management strategy if disabling the default behavior.\n */\n @Prop({ reflect: true }) disableAutoFocus: boolean = false;\n\n /**\n * Give an unique id\n * @private\n */\n private modalId: number = modalIds++;\n\n private firstFocusableElement: HTMLElement;\n private lastFocusableElement: HTMLElement;\n /**\n * This attribute is used to determine whether the show attribute has changed since the last rendering. \n * This allows us to call the focus method on the first element of the modal when the show attribute changes to true. \n * This call is made in the componentDidRender method\n * @private\n */\n private showAttributeChangedMarker: boolean = false;\n /**\n * This attribute is used to determine if the modal has been closed for the first time since its last activation.\n * It is set to 'true' when the modal is first closed, and will be reset to 'false' when the modal is shown again.\n * This state is important for accessibility reasons in order to focus the modal trigger element (like the button \n * which controls the modal)\n *\n * @private\n */\n private hasBeenClosedBefore: boolean = false;\n\n componentWillLoad(): Promise<void> | void {\n if (!this.modalTriggerControlsId) {\n console.warn('wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly');\n }\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, MODAL_INHERITED_ATTRS),\n };\n }\n\n componentDidLoad() {\n this.updateFocusableElements();\n }\n\n componentDidRender() {\n this.updateFocusableElements();\n if (this.showAttributeChangedMarker) {\n this.showAttributeChangedMarker = false;\n \n if(this.disableAutoFocus) {\n return;\n }\n \n if(!this.initialFocusElementId) {\n this.firstFocusableElement?.focus();\n } else {\n const modalElementToFocusOnOpening = document.getElementById(this.initialFocusElementId);\n if(!modalElementToFocusOnOpening) {\n console.warn(`wcs-modal: Unable to focus element - ID '${this.initialFocusElementId}' not found in DOM`);\n }\n \n modalElementToFocusOnOpening?.focus();\n }\n }\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeDivDialog, attr, value);\n }\n \n @Watch(\"show\")\n onShowChange() {\n if(this.show) {\n this.hasBeenClosedBefore = false;\n this.showAttributeChangedMarker = true;\n } else {\n // if we already made actions when the modal was firstly closed, we do nothing\n if(this.hasBeenClosedBefore) {\n return;\n }\n \n this.hasBeenClosedBefore = true;\n\n if(this.modalTriggerControlsId) {\n const modalTriggerControlsHtmlElement = document.getElementById(this.modalTriggerControlsId);\n if(!modalTriggerControlsHtmlElement) {\n console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`);\n }\n modalTriggerControlsHtmlElement?.focus();\n }\n }\n }\n\n private updateFocusableElements() {\n const focusableElements = Array.from(this.el.querySelectorAll('*'))\n .filter(element => isFocusable(element));\n\n this.firstFocusableElement = focusableElements.length > 0 && focusableElements[0] as HTMLElement;\n this.lastFocusableElement = focusableElements.length > 0 && focusableElements[focusableElements.length - 1] as HTMLElement;\n }\n \n private close() {\n // If the modal isn't shown, we don't do anything\n if (this.show) {\n this.show = false;\n this.wcsDialogClosed.emit();\n }\n }\n\n @Listen('keydown', {target: 'document'})\n onKeyDown(event: KeyboardEvent) {\n if (this.show && this.showCloseButton && event.key === 'Escape') {\n this.close();\n }\n\n if (this.show) {\n if (isTabKey(event)) {\n this.updateFocusableElements(); // XXX: maybe a performance issue\n const firstElement = this.firstFocusableElement;\n const lastElement = this.lastFocusableElement;\n\n if (event.shiftKey && isElementFocused(firstElement)) {\n event.preventDefault();\n lastElement.focus();\n } else if (!event.shiftKey && isElementFocused(lastElement)) {\n event.preventDefault();\n firstElement.focus();\n }\n }\n }\n }\n\n private onCloseButtonClick(_: MouseEvent) {\n this.close();\n }\n\n private handleSlotContentChange() {\n this.updateFocusableElements();\n }\n\n render() {\n const modalTitleId = `wcs-modal-title-${this.modalId}`;\n return (\n <Host>\n <div class=\"wcs-modal-container\"\n data-size={this.size}\n aria-modal=\"true\"\n role={\"dialog\"}\n aria-labelledby={modalTitleId}\n ref={(el) => (this.nativeDivDialog = el)}\n {...this.inheritedAttributes}\n >\n <div class=\"wcs-modal-header\">\n <h1 id={modalTitleId}>\n <slot name=\"header\"></slot>\n </h1>\n {this.showCloseButton && (\n <wcs-button shape=\"round\" \n mode=\"clear\" \n id=\"wcs-modal-close-button\"\n aria-label={this.closeButtonAriaLabel}\n onClick={($event) => this.onCloseButtonClick($event)}>\n <wcs-mat-icon icon=\"close\"></wcs-mat-icon>\n </wcs-button>)\n }\n\n </div>\n <div class=\"wcs-modal-content\">\n <slot onSlotchange={() => this.handleSlotContentChange()}></slot>\n </div>\n <div class=\"wcs-modal-actions\">\n <slot name=\"actions\"></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n\nlet modalIds = 0;\n"]}
@@ -263,7 +263,7 @@ export class NativeSelect {
263
263
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
264
264
  "parameters": [{
265
265
  "name": "attr",
266
- "type": "\"role\" | `aria-${string}`",
266
+ "type": "`aria-${string}` | \"role\"",
267
267
  "docs": ""
268
268
  }, {
269
269
  "name": "value",
@@ -42,7 +42,7 @@ export class Nav {
42
42
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
43
43
  "parameters": [{
44
44
  "name": "attr",
45
- "type": "\"role\" | `aria-${string}`",
45
+ "type": "`aria-${string}` | \"role\"",
46
46
  "docs": ""
47
47
  }, {
48
48
  "name": "value",
@@ -153,7 +153,7 @@ export class ProgressBar {
153
153
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
154
154
  "parameters": [{
155
155
  "name": "attr",
156
- "type": "\"role\" | `aria-${string}`",
156
+ "type": "`aria-${string}` | \"role\"",
157
157
  "docs": ""
158
158
  }, {
159
159
  "name": "value",
@@ -137,7 +137,7 @@ export class ProgressRadial {
137
137
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
138
138
  "parameters": [{
139
139
  "name": "attr",
140
- "type": "\"role\" | `aria-${string}`",
140
+ "type": "`aria-${string}` | \"role\"",
141
141
  "docs": ""
142
142
  }, {
143
143
  "name": "value",
@@ -370,7 +370,7 @@ export class Radio {
370
370
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
371
371
  "parameters": [{
372
372
  "name": "attr",
373
- "type": "\"role\" | `aria-${string}`",
373
+ "type": "`aria-${string}` | \"role\"",
374
374
  "docs": ""
375
375
  }, {
376
376
  "name": "value",
@@ -0,0 +1,231 @@
1
+ import { setWcsContent } from "../../utils/playwright/test";
2
+ import { test } from "@stencil/playwright";
3
+ import { expect } from "@playwright/test";
4
+ test.describe('Radio Group', () => {
5
+ test('should navigate to the first not disabled radio when pressing tab key', async ({ page }) => {
6
+ // Given
7
+ await setWcsContent(page, `
8
+ <wcs-input></wcs-input>
9
+ <wcs-radio-group>
10
+ <wcs-radio disabled id="radio-1" value="1"></wcs-radio>
11
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
12
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
13
+ </wcs-radio-group>
14
+ `);
15
+ const firstTabbableItem = page.locator('wcs-input');
16
+ await firstTabbableItem.focus();
17
+ const secondRadio = page.locator('#radio-2');
18
+ // When
19
+ await page.keyboard.press('Tab');
20
+ // Then
21
+ await expect(secondRadio).toBeFocused();
22
+ });
23
+ test('should not make unselected radios focusable when a radio is clicked', async ({ page }) => {
24
+ // Given
25
+ await setWcsContent(page, `
26
+ <wcs-input></wcs-input>
27
+ <wcs-radio-group>
28
+ <wcs-radio disabled id="radio-1" value="1"></wcs-radio>
29
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
30
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
31
+ </wcs-radio-group>
32
+ `);
33
+ const input = page.locator('wcs-input');
34
+ const radio3 = page.locator('#radio-3');
35
+ // When
36
+ await radio3.click();
37
+ await input.focus();
38
+ // Then
39
+ await page.keyboard.press('Tab');
40
+ await expect(radio3).toBeFocused();
41
+ });
42
+ test('should checked the first radio when pressing space key', async ({ page }) => {
43
+ // Given
44
+ await setWcsContent(page, `
45
+ <wcs-input></wcs-input>
46
+ <wcs-radio-group>
47
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
48
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
49
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
50
+ </wcs-radio-group>
51
+ `);
52
+ const firstTabbableItem = page.locator('wcs-input');
53
+ await firstTabbableItem.focus();
54
+ const firstRadio = page.locator('#radio-1');
55
+ await page.keyboard.press('Tab');
56
+ // When
57
+ await page.keyboard.press('Space');
58
+ // Then
59
+ await expect(firstRadio).toBeFocused(); // Ensure focus is on the first radio
60
+ const firstRadioNativeInput = page.locator('#radio-1 input');
61
+ await expect(firstRadioNativeInput).toHaveAttribute('aria-checked', 'true');
62
+ });
63
+ test('should navigate to the checked radio when pressing tab key', async ({ page }) => {
64
+ // Given
65
+ await setWcsContent(page, `
66
+ <wcs-input></wcs-input>
67
+ <wcs-radio-group value="3">
68
+ <wcs-radio disabled id="radio-1" value="1"></wcs-radio>
69
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
70
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
71
+ </wcs-radio-group>
72
+ `);
73
+ const firstTabbableItem = page.locator('wcs-input');
74
+ await firstTabbableItem.focus();
75
+ const thirdRadio = page.locator('#radio-3');
76
+ // When
77
+ await page.keyboard.press('Tab');
78
+ // Then
79
+ await expect(thirdRadio).toBeFocused();
80
+ });
81
+ test.describe('When pressing arrow down key', () => {
82
+ test('should checked the next radio not disabled when we are on the first radio and next radio is here', async ({ page }) => {
83
+ // Given
84
+ await setWcsContent(page, `
85
+ <wcs-radio-group>
86
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
87
+ <wcs-radio disabled id="radio-2" value="2"></wcs-radio>
88
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
89
+ </wcs-radio-group>
90
+ `);
91
+ const firstRadio = page.locator('#radio-1');
92
+ await firstRadio.focus();
93
+ const thirdRadioNativeInput = page.locator('#radio-3 input');
94
+ const thirdRadio = page.locator('#radio-3');
95
+ // When
96
+ await page.keyboard.press('ArrowDown');
97
+ // Then
98
+ await expect(thirdRadio).toBeFocused(); // Ensure focus is on the third radio
99
+ await expect(thirdRadioNativeInput).toHaveAttribute('aria-checked', 'true');
100
+ });
101
+ test('should checked the first not disabled radio when we are on the last radio', async ({ page }) => {
102
+ // Given
103
+ await setWcsContent(page, `
104
+ <wcs-radio-group>
105
+ <wcs-radio disabled id="radio-1" value="1"></wcs-radio>
106
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
107
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
108
+ </wcs-radio-group>
109
+ `);
110
+ const lastRadio = page.locator('#radio-3');
111
+ // Click to select, then focus explicitly for WebKit compatibility
112
+ await lastRadio.click();
113
+ await lastRadio.focus();
114
+ await expect(lastRadio).toBeFocused();
115
+ const secondRadio = page.locator('#radio-2');
116
+ const secondRadioNativeInputInput = page.locator('#radio-2 input');
117
+ // When
118
+ await page.keyboard.press('ArrowDown');
119
+ // Then
120
+ await expect(secondRadio).toBeFocused(); // Ensure focus is on the second radio
121
+ await expect(secondRadioNativeInputInput).toHaveAttribute('aria-checked', 'true');
122
+ });
123
+ });
124
+ test.describe('Events handling', () => {
125
+ test('should fire wcsRadioClick when we click on an unchecked radio', async ({ page }) => {
126
+ // Given
127
+ await setWcsContent(page, `
128
+ <wcs-radio-group>
129
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
130
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
131
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
132
+ </wcs-radio-group>
133
+ `);
134
+ const radioClickSpy = await page.spyOnEvent('wcsRadioClick');
135
+ const radio2 = page.locator('#radio-2');
136
+ // When
137
+ await radio2.click();
138
+ await page.waitForChanges();
139
+ // Then
140
+ expect(radioClickSpy).toHaveReceivedEventTimes(1);
141
+ });
142
+ test('should fire wcsChange when we click or move to an unchecked radio', async ({ page }) => {
143
+ // Given
144
+ await setWcsContent(page, `
145
+ <wcs-radio-group>
146
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
147
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
148
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
149
+ </wcs-radio-group>
150
+ `);
151
+ const changeSpy = await page.spyOnEvent('wcsChange');
152
+ const radio2 = page.locator('#radio-2');
153
+ // When: Clicking on an unchecked radio
154
+ await radio2.click();
155
+ await page.waitForChanges();
156
+ // Then
157
+ expect(changeSpy).toHaveReceivedEventTimes(1);
158
+ // When: Moving focus to another unchecked radio with keyboard
159
+ await radio2.focus();
160
+ await page.keyboard.press('ArrowDown'); // Move to the next radio
161
+ await page.waitForChanges();
162
+ // Then
163
+ const radio3 = page.locator('#radio-3');
164
+ await expect(radio3).toBeFocused(); // Ensure focus is on the third radio (next radio after radio2)
165
+ expect(changeSpy).toHaveReceivedEventTimes(2);
166
+ });
167
+ test('should fire wcsBlur and wcsFocus from the radios', async ({ page }) => {
168
+ // Given
169
+ await setWcsContent(page, `
170
+ <wcs-radio-group>
171
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
172
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
173
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
174
+ </wcs-radio-group>
175
+ `);
176
+ const blurSpy = await page.spyOnEvent('wcsBlur');
177
+ const focusSpy = await page.spyOnEvent('wcsFocus');
178
+ const radio = page.locator('#radio-1');
179
+ // When: Focusing on the first radio
180
+ await radio.focus();
181
+ await page.waitForChanges();
182
+ // Then: Expect wcsFocus to be fired
183
+ expect(focusSpy).toHaveReceivedEventTimes(1);
184
+ // When: Moving to the next radio
185
+ await page.keyboard.press('ArrowDown');
186
+ await page.waitForChanges();
187
+ // When: Moving focus to another radio
188
+ await page.keyboard.press('Tab');
189
+ // Then
190
+ expect(blurSpy).toHaveReceivedEvent();
191
+ expect(focusSpy).toHaveReceivedEventTimes(2);
192
+ });
193
+ });
194
+ test.describe('When pressing arrow up key', () => {
195
+ test('should checked the previous radio when we are on the last radio and previous radio is here', async ({ page }) => {
196
+ // Given
197
+ await setWcsContent(page, `
198
+ <wcs-radio-group>
199
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
200
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
201
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
202
+ </wcs-radio-group>
203
+ `);
204
+ const lastRadio = page.locator('#radio-3');
205
+ await lastRadio.focus();
206
+ // When
207
+ await page.keyboard.press('ArrowUp');
208
+ // Then
209
+ const secondRadioInput = page.locator('#radio-2 input');
210
+ await expect(secondRadioInput).toHaveAttribute('aria-checked', 'true');
211
+ });
212
+ test('should checked the last radio when we are on the first radio', async ({ page }) => {
213
+ // Given
214
+ await setWcsContent(page, `
215
+ <wcs-radio-group>
216
+ <wcs-radio id="radio-1" value="1"></wcs-radio>
217
+ <wcs-radio id="radio-2" value="2"></wcs-radio>
218
+ <wcs-radio id="radio-3" value="3"></wcs-radio>
219
+ </wcs-radio-group>
220
+ `);
221
+ const firstRadio = page.locator('#radio-1');
222
+ await firstRadio.focus();
223
+ // When
224
+ await page.keyboard.press('ArrowUp');
225
+ // Then
226
+ const lastRadioInput = page.locator('#radio-3 input');
227
+ await expect(lastRadioInput).toHaveAttribute('aria-checked', 'true');
228
+ });
229
+ });
230
+ });
231
+ //# sourceMappingURL=radio-group.e2e.playwright.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"radio-group.e2e.playwright.js","sourceRoot":"","sources":["../../../src/components/radio-group/radio-group.e2e.playwright.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAW,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,IAAI,CAAC,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,uEAAuE,EAAE,KAAK,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE;QAChH,QAAQ;QACR,MAAM,aAAa,CAAC,IAAI,EAAE;;;;;;;SAOzB,CAAC,CAAC;QAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACpD,MAAM,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAChC,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;QAE7C,OAAO;QACP,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAEjC,OAAO;QACP,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,CAAC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AM,gBAAgB,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YACxD,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,8DAA8D,EAAE,KAAK,EAAE,EAAE,IAAI,EAAqB,EAAE,EAAE;YACvG,QAAQ;YACR,MAAM,aAAa,CAAC,IAAI,EAAE;;;;;;aAMzB,CAAC,CAAC;YAEH,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;YAC5C,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;YAEzB,OAAO;YACP,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;YAErC,OAAO;YACP,MAAM,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;YACtD,MAAM,MAAM,CAAC,cAAc,CAAC,CAAC,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC","sourcesContent":["import { setWcsContent } from '../../utils/playwright/test';\nimport { test, E2EPage } from \"@stencil/playwright\";\n\nimport { expect } from \"@playwright/test\";\n\ntest.describe('Radio Group', () => {\n test('should navigate to the first not disabled radio when pressing tab key', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input></wcs-input>\n <wcs-radio-group>\n <wcs-radio disabled id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const firstTabbableItem = page.locator('wcs-input');\n await firstTabbableItem.focus();\n const secondRadio = page.locator('#radio-2');\n\n // When\n await page.keyboard.press('Tab');\n\n // Then\n await expect(secondRadio).toBeFocused();\n });\n\n test('should not make unselected radios focusable when a radio is clicked', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input></wcs-input>\n <wcs-radio-group>\n <wcs-radio disabled id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const input = page.locator('wcs-input');\n const radio3 = page.locator('#radio-3');\n\n // When\n await radio3.click();\n await input.focus();\n\n // Then\n await page.keyboard.press('Tab');\n await expect(radio3).toBeFocused();\n });\n\n test('should checked the first radio when pressing space key', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input></wcs-input>\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const firstTabbableItem = page.locator('wcs-input');\n await firstTabbableItem.focus();\n const firstRadio = page.locator('#radio-1');\n await page.keyboard.press('Tab');\n\n // When\n await page.keyboard.press('Space');\n\n // Then\n await expect(firstRadio).toBeFocused(); // Ensure focus is on the first radio\n const firstRadioNativeInput = page.locator('#radio-1 input');\n await expect(firstRadioNativeInput).toHaveAttribute('aria-checked', 'true');\n });\n\n test('should navigate to the checked radio when pressing tab key', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-input></wcs-input>\n <wcs-radio-group value=\"3\">\n <wcs-radio disabled id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const firstTabbableItem = page.locator('wcs-input');\n await firstTabbableItem.focus();\n const thirdRadio = page.locator('#radio-3');\n\n // When\n await page.keyboard.press('Tab');\n\n // Then\n await expect(thirdRadio).toBeFocused();\n });\n\n test.describe('When pressing arrow down key', () => {\n test('should checked the next radio not disabled when we are on the first radio and next radio is here', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio disabled id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const firstRadio = page.locator('#radio-1');\n await firstRadio.focus();\n const thirdRadioNativeInput = page.locator('#radio-3 input');\n const thirdRadio = page.locator('#radio-3');\n\n // When\n await page.keyboard.press('ArrowDown');\n\n // Then\n await expect(thirdRadio).toBeFocused(); // Ensure focus is on the third radio\n await expect(thirdRadioNativeInput).toHaveAttribute('aria-checked', 'true');\n });\n\n test('should checked the first not disabled radio when we are on the last radio', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio disabled id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const lastRadio = page.locator('#radio-3');\n // Click to select, then focus explicitly for WebKit compatibility\n await lastRadio.click();\n await lastRadio.focus();\n await expect(lastRadio).toBeFocused();\n const secondRadio = page.locator('#radio-2');\n const secondRadioNativeInputInput = page.locator('#radio-2 input');\n\n // When\n await page.keyboard.press('ArrowDown');\n\n // Then\n await expect(secondRadio).toBeFocused(); // Ensure focus is on the second radio\n await expect(secondRadioNativeInputInput).toHaveAttribute('aria-checked', 'true');\n });\n });\n\n test.describe('Events handling', () => {\n test('should fire wcsRadioClick when we click on an unchecked radio', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const radioClickSpy = await page.spyOnEvent('wcsRadioClick');\n\n const radio2 = page.locator('#radio-2');\n\n // When\n await radio2.click();\n await page.waitForChanges();\n\n // Then\n expect(radioClickSpy).toHaveReceivedEventTimes(1);\n });\n\n test('should fire wcsChange when we click or move to an unchecked radio', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const changeSpy = await page.spyOnEvent('wcsChange');\n\n const radio2 = page.locator('#radio-2');\n\n // When: Clicking on an unchecked radio\n await radio2.click();\n await page.waitForChanges();\n\n // Then\n expect(changeSpy).toHaveReceivedEventTimes(1);\n\n // When: Moving focus to another unchecked radio with keyboard\n await radio2.focus();\n await page.keyboard.press('ArrowDown'); // Move to the next radio\n await page.waitForChanges();\n\n // Then\n const radio3 = page.locator('#radio-3');\n await expect(radio3).toBeFocused(); // Ensure focus is on the third radio (next radio after radio2)\n expect(changeSpy).toHaveReceivedEventTimes(2);\n });\n\n test('should fire wcsBlur and wcsFocus from the radios', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const blurSpy = await page.spyOnEvent('wcsBlur');\n const focusSpy = await page.spyOnEvent('wcsFocus');\n\n const radio = page.locator('#radio-1');\n\n // When: Focusing on the first radio\n await radio.focus();\n await page.waitForChanges();\n\n // Then: Expect wcsFocus to be fired\n expect(focusSpy).toHaveReceivedEventTimes(1);\n\n // When: Moving to the next radio\n await page.keyboard.press('ArrowDown');\n await page.waitForChanges();\n\n // When: Moving focus to another radio\n await page.keyboard.press('Tab');\n\n // Then\n expect(blurSpy).toHaveReceivedEvent();\n expect(focusSpy).toHaveReceivedEventTimes(2);\n });\n });\n\n test.describe('When pressing arrow up key', () => {\n test('should checked the previous radio when we are on the last radio and previous radio is here', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const lastRadio = page.locator('#radio-3');\n await lastRadio.focus();\n\n // When\n await page.keyboard.press('ArrowUp');\n\n // Then\n const secondRadioInput = page.locator('#radio-2 input');\n await expect(secondRadioInput).toHaveAttribute('aria-checked', 'true');\n });\n\n test('should checked the last radio when we are on the first radio', async ({ page }: { page: E2EPage }) => {\n // Given\n await setWcsContent(page, `\n <wcs-radio-group>\n <wcs-radio id=\"radio-1\" value=\"1\"></wcs-radio>\n <wcs-radio id=\"radio-2\" value=\"2\"></wcs-radio>\n <wcs-radio id=\"radio-3\" value=\"3\"></wcs-radio>\n </wcs-radio-group>\n `);\n\n const firstRadio = page.locator('#radio-1');\n await firstRadio.focus();\n\n // When\n await page.keyboard.press('ArrowUp');\n\n // Then\n const lastRadioInput = page.locator('#radio-3 input');\n await expect(lastRadioInput).toHaveAttribute('aria-checked', 'true');\n });\n });\n});\n"]}
@@ -211,7 +211,7 @@ export class RadioGroup {
211
211
  "signature": "(attr: AriaAttributeName, value: string | null | undefined) => Promise<void>",
212
212
  "parameters": [{
213
213
  "name": "attr",
214
- "type": "\"role\" | `aria-${string}`",
214
+ "type": "`aria-${string}` | \"role\"",
215
215
  "docs": ""
216
216
  }, {
217
217
  "name": "value",