wcs-core 7.0.0 → 7.1.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 (442) hide show
  1. package/design-tokens/dist/sncf-holding-root-scoped.css +589 -0
  2. package/design-tokens/dist/sncf-holding.css +13 -0
  3. package/design-tokens/dist/sncf-holding.json +54 -0
  4. package/design-tokens/dist/sncf-reseau-root-scoped.css +652 -0
  5. package/design-tokens/dist/sncf-reseau.css +10 -0
  6. package/design-tokens/dist/sncf-reseau.json +54 -0
  7. package/design-tokens/dist/sncf-voyageurs-root-scoped.css +550 -0
  8. package/design-tokens/dist/sncf-voyageurs.css +13 -0
  9. package/design-tokens/dist/sncf-voyageurs.json +54 -0
  10. package/dist/cjs/{com-nav-utils-9f6c99b8.js → com-nav-utils-ff4f0bef.js} +2 -2
  11. package/dist/cjs/{com-nav-utils-9f6c99b8.js.map → com-nav-utils-ff4f0bef.js.map} +1 -1
  12. package/dist/cjs/control-component-interface-d9b68f28.js +43 -0
  13. package/dist/cjs/control-component-interface-d9b68f28.js.map +1 -0
  14. package/dist/cjs/{grid-pagination-2c752b22.js → grid-pagination-e4f29c78.js} +3 -3
  15. package/dist/cjs/{grid-pagination-2c752b22.js.map → grid-pagination-e4f29c78.js.map} +1 -1
  16. package/dist/cjs/{helpers-871f5a3d.js → helpers-2f1a8ddc.js} +44 -1
  17. package/dist/cjs/helpers-2f1a8ddc.js.map +1 -0
  18. package/dist/cjs/{keyboard-event-d2c81ce0.js → keyboard-event-40ecdc27.js} +2 -2
  19. package/dist/cjs/{keyboard-event-d2c81ce0.js.map → keyboard-event-40ecdc27.js.map} +1 -1
  20. package/dist/cjs/loader.cjs.js +1 -1
  21. package/dist/cjs/wcs-accordion-panel.cjs.entry.js +1 -1
  22. package/dist/cjs/wcs-action-bar.cjs.entry.js +1 -1
  23. package/dist/cjs/wcs-action-bar.cjs.entry.js.map +1 -1
  24. package/dist/cjs/wcs-badge.cjs.entry.js +1 -1
  25. package/dist/cjs/wcs-badge.cjs.entry.js.map +1 -1
  26. package/dist/cjs/wcs-breadcrumb.cjs.entry.js +1 -1
  27. package/dist/cjs/wcs-button_2.cjs.entry.js +3 -3
  28. package/dist/cjs/wcs-button_2.cjs.entry.js.map +1 -1
  29. package/dist/cjs/wcs-checkbox.cjs.entry.js +6 -2
  30. package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
  31. package/dist/cjs/wcs-com-nav-category.cjs.entry.js +2 -2
  32. package/dist/cjs/wcs-com-nav-item.cjs.entry.js +1 -1
  33. package/dist/cjs/wcs-com-nav-item.cjs.entry.js.map +1 -1
  34. package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +2 -2
  35. package/dist/cjs/wcs-com-nav.cjs.entry.js +2 -2
  36. package/dist/cjs/wcs-counter.cjs.entry.js +13 -5
  37. package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -1
  38. package/dist/cjs/wcs-dropdown-item.cjs.entry.js +1 -1
  39. package/dist/cjs/wcs-dropdown.cjs.entry.js +3 -3
  40. package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
  41. package/dist/cjs/wcs-editable-field.cjs.entry.js +81 -55
  42. package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
  43. package/dist/cjs/wcs-error_3.cjs.entry.js +209 -0
  44. package/dist/cjs/wcs-error_3.cjs.entry.js.map +1 -0
  45. package/dist/cjs/wcs-field-content.cjs.entry.js +1 -1
  46. package/dist/cjs/wcs-field-label.cjs.entry.js +1 -1
  47. package/dist/cjs/wcs-field.cjs.entry.js +1 -1
  48. package/dist/cjs/wcs-footer.cjs.entry.js +1 -1
  49. package/dist/cjs/wcs-footer.cjs.entry.js.map +1 -1
  50. package/dist/cjs/wcs-galactic-menu.cjs.entry.js +4 -4
  51. package/dist/cjs/wcs-galactic-menu.cjs.entry.js.map +1 -1
  52. package/dist/cjs/wcs-galactic.cjs.entry.js +1 -1
  53. package/dist/cjs/wcs-grid-column.cjs.entry.js +2 -2
  54. package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
  55. package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js +1 -1
  56. package/dist/cjs/wcs-grid-pagination.cjs.entry.js +2 -2
  57. package/dist/cjs/wcs-grid.cjs.entry.js +6 -6
  58. package/dist/cjs/wcs-header.cjs.entry.js +2 -2
  59. package/dist/cjs/wcs-hint.cjs.entry.js +1 -1
  60. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +1 -1
  61. package/dist/cjs/wcs-icon.cjs.entry.js +2 -2
  62. package/dist/cjs/wcs-input.cjs.entry.js +5 -3
  63. package/dist/cjs/wcs-input.cjs.entry.js.map +1 -1
  64. package/dist/cjs/wcs-list-item-properties.cjs.entry.js +1 -1
  65. package/dist/cjs/wcs-list-item-property.cjs.entry.js +1 -1
  66. package/dist/cjs/wcs-list-item.cjs.entry.js +1 -1
  67. package/dist/cjs/wcs-list-item.cjs.entry.js.map +1 -1
  68. package/dist/cjs/wcs-mat-icon.cjs.entry.js +2 -2
  69. package/dist/cjs/wcs-modal.cjs.entry.js +17 -3
  70. package/dist/cjs/wcs-modal.cjs.entry.js.map +1 -1
  71. package/dist/cjs/wcs-native-select.cjs.entry.js +1 -1
  72. package/dist/cjs/wcs-nav-item.cjs.entry.js +3 -3
  73. package/dist/cjs/wcs-nav-item.cjs.entry.js.map +1 -1
  74. package/dist/cjs/wcs-nav.cjs.entry.js +2 -2
  75. package/dist/cjs/wcs-progress-bar.cjs.entry.js +3 -3
  76. package/dist/cjs/wcs-progress-radial.cjs.entry.js +3 -3
  77. package/dist/cjs/wcs-radio-group.cjs.entry.js +5 -2
  78. package/dist/cjs/wcs-radio-group.cjs.entry.js.map +1 -1
  79. package/dist/cjs/wcs-radio.cjs.entry.js +2 -2
  80. package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
  81. package/dist/cjs/wcs-select_2.cjs.entry.js +8 -7
  82. package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
  83. package/dist/cjs/wcs-skeleton-circle.cjs.entry.js +1 -1
  84. package/dist/cjs/wcs-skeleton-rectangle.cjs.entry.js +1 -1
  85. package/dist/cjs/wcs-skeleton-text.cjs.entry.js +1 -1
  86. package/dist/cjs/wcs-switch.cjs.entry.js +6 -2
  87. package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
  88. package/dist/cjs/wcs-tab.cjs.entry.js +1 -1
  89. package/dist/cjs/wcs-tabs.cjs.entry.js +2 -2
  90. package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
  91. package/dist/cjs/wcs-textarea.cjs.entry.js +2 -2
  92. package/dist/cjs/wcs-textarea.cjs.entry.js.map +1 -1
  93. package/dist/cjs/wcs-tooltip.cjs.entry.js +8 -4
  94. package/dist/cjs/wcs-tooltip.cjs.entry.js.map +1 -1
  95. package/dist/cjs/wcs.cjs.js +1 -1
  96. package/dist/collection/components/action-bar/action-bar.js +2 -2
  97. package/dist/collection/components/action-bar/action-bar.js.map +1 -1
  98. package/dist/collection/components/badge/badge.css +1 -0
  99. package/dist/collection/components/button/button.js +2 -2
  100. package/dist/collection/components/button/button.js.map +1 -1
  101. package/dist/collection/components/checkbox/checkbox.js +22 -1
  102. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  103. package/dist/collection/components/com-nav-item/com-nav-item.css +2 -1
  104. package/dist/collection/components/counter/counter.css +3 -0
  105. package/dist/collection/components/counter/counter.js +13 -5
  106. package/dist/collection/components/counter/counter.js.map +1 -1
  107. package/dist/collection/components/dropdown/dropdown.js +2 -2
  108. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  109. package/dist/collection/components/editable-field/editable-field.css +31 -10
  110. package/dist/collection/components/editable-field/editable-field.e2e.js +176 -0
  111. package/dist/collection/components/editable-field/editable-field.e2e.js.map +1 -0
  112. package/dist/collection/components/editable-field/editable-field.js +83 -57
  113. package/dist/collection/components/editable-field/editable-field.js.map +1 -1
  114. package/dist/collection/components/error/error.js +1 -1
  115. package/dist/collection/components/field/field.js +1 -1
  116. package/dist/collection/components/field-content/field-content.js +1 -1
  117. package/dist/collection/components/field-label/field-label.js +1 -1
  118. package/dist/collection/components/footer/footer.js +1 -1
  119. package/dist/collection/components/footer/footer.js.map +1 -1
  120. package/dist/collection/components/form-field/form-field.css +39 -12
  121. package/dist/collection/components/form-field/form-field.e2e.js +122 -0
  122. package/dist/collection/components/form-field/form-field.e2e.js.map +1 -0
  123. package/dist/collection/components/form-field/form-field.js +29 -12
  124. package/dist/collection/components/form-field/form-field.js.map +1 -1
  125. package/dist/collection/components/galactic/galactic.js +1 -1
  126. package/dist/collection/components/galactic-menu/galactic-menu.css +1 -0
  127. package/dist/collection/components/galactic-menu/galactic-menu.js +2 -2
  128. package/dist/collection/components/grid/grid.js +3 -3
  129. package/dist/collection/components/grid-column/grid-column.js +2 -2
  130. package/dist/collection/components/grid-column/grid-column.js.map +1 -1
  131. package/dist/collection/components/grid-custom-cell/grid-custom-cell.js +1 -1
  132. package/dist/collection/components/grid-pagination/grid-pagination.js +1 -1
  133. package/dist/collection/components/header/header.js +1 -1
  134. package/dist/collection/components/hint/hint.js +1 -1
  135. package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +1 -1
  136. package/dist/collection/components/icon/icon.js +1 -1
  137. package/dist/collection/components/input/input.css +10 -1
  138. package/dist/collection/components/input/input.js +42 -3
  139. package/dist/collection/components/input/input.js.map +1 -1
  140. package/dist/collection/components/label/label.js +1 -1
  141. package/dist/collection/components/list-item/list-item.js +7 -2
  142. package/dist/collection/components/list-item/list-item.js.map +1 -1
  143. package/dist/collection/components/list-item-properties/list-item-properties.js +1 -1
  144. package/dist/collection/components/list-item-property/list-item-property.js +1 -1
  145. package/dist/collection/components/mat-icon/mat-icon.js +1 -1
  146. package/dist/collection/components/modal/modal.js +58 -2
  147. package/dist/collection/components/modal/modal.js.map +1 -1
  148. package/dist/collection/components/native-select/native-select.js +1 -1
  149. package/dist/collection/components/nav/nav.js +1 -1
  150. package/dist/collection/components/nav-item/nav-item.css +24 -6
  151. package/dist/collection/components/nav-item/nav-item.js +1 -1
  152. package/dist/collection/components/progress-bar/progress-bar.js +2 -2
  153. package/dist/collection/components/progress-radial/progress-radial.js +2 -2
  154. package/dist/collection/components/radio/radio.js +2 -2
  155. package/dist/collection/components/radio/radio.js.map +1 -1
  156. package/dist/collection/components/radio-group/radio-group.js +39 -2
  157. package/dist/collection/components/radio-group/radio-group.js.map +1 -1
  158. package/dist/collection/components/select/select.js +22 -3
  159. package/dist/collection/components/select/select.js.map +1 -1
  160. package/dist/collection/components/select-option/select-option.js +2 -2
  161. package/dist/collection/components/skeleton-circle/skeleton-circle.js +1 -1
  162. package/dist/collection/components/skeleton-rectangle/skeleton-rectangle.js +1 -1
  163. package/dist/collection/components/skeleton-text/skeleton-text.js +1 -1
  164. package/dist/collection/components/spinner/spinner.js +1 -1
  165. package/dist/collection/components/switch/switch.js +23 -2
  166. package/dist/collection/components/switch/switch.js.map +1 -1
  167. package/dist/collection/components/tab/tab.js +1 -1
  168. package/dist/collection/components/tabs/tabs.js +2 -2
  169. package/dist/collection/components/tabs/tabs.js.map +1 -1
  170. package/dist/collection/components/textarea/textarea.js +3 -3
  171. package/dist/collection/components/textarea/textarea.js.map +1 -1
  172. package/dist/collection/components/tooltip/tooltip.js +10 -8
  173. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  174. package/dist/collection/utils/control-component-interface.js +37 -0
  175. package/dist/collection/utils/control-component-interface.js.map +1 -0
  176. package/dist/collection/utils/helpers.js +40 -0
  177. package/dist/collection/utils/helpers.js.map +1 -1
  178. package/dist/esm/{com-nav-utils-1366c701.js → com-nav-utils-ee7bf77c.js} +2 -2
  179. package/dist/esm/{com-nav-utils-1366c701.js.map → com-nav-utils-ee7bf77c.js.map} +1 -1
  180. package/dist/esm/control-component-interface-9f09e520.js +40 -0
  181. package/dist/esm/control-component-interface-9f09e520.js.map +1 -0
  182. package/dist/esm/{grid-pagination-421689be.js → grid-pagination-976a86e9.js} +3 -3
  183. package/dist/esm/{grid-pagination-421689be.js.map → grid-pagination-976a86e9.js.map} +1 -1
  184. package/dist/esm/{helpers-f137ec8d.js → helpers-ece6a2d3.js} +42 -2
  185. package/dist/esm/helpers-ece6a2d3.js.map +1 -0
  186. package/dist/esm/{keyboard-event-bdea408a.js → keyboard-event-26b65ae5.js} +2 -2
  187. package/dist/esm/{keyboard-event-bdea408a.js.map → keyboard-event-26b65ae5.js.map} +1 -1
  188. package/dist/esm/loader.js +1 -1
  189. package/dist/esm/wcs-accordion-panel.entry.js +1 -1
  190. package/dist/esm/wcs-action-bar.entry.js +1 -1
  191. package/dist/esm/wcs-action-bar.entry.js.map +1 -1
  192. package/dist/esm/wcs-badge.entry.js +1 -1
  193. package/dist/esm/wcs-badge.entry.js.map +1 -1
  194. package/dist/esm/wcs-breadcrumb.entry.js +1 -1
  195. package/dist/esm/wcs-button_2.entry.js +3 -3
  196. package/dist/esm/wcs-button_2.entry.js.map +1 -1
  197. package/dist/esm/wcs-checkbox.entry.js +6 -2
  198. package/dist/esm/wcs-checkbox.entry.js.map +1 -1
  199. package/dist/esm/wcs-com-nav-category.entry.js +2 -2
  200. package/dist/esm/wcs-com-nav-item.entry.js +1 -1
  201. package/dist/esm/wcs-com-nav-item.entry.js.map +1 -1
  202. package/dist/esm/wcs-com-nav-submenu.entry.js +2 -2
  203. package/dist/esm/wcs-com-nav.entry.js +2 -2
  204. package/dist/esm/wcs-counter.entry.js +13 -5
  205. package/dist/esm/wcs-counter.entry.js.map +1 -1
  206. package/dist/esm/wcs-dropdown-item.entry.js +1 -1
  207. package/dist/esm/wcs-dropdown.entry.js +3 -3
  208. package/dist/esm/wcs-dropdown.entry.js.map +1 -1
  209. package/dist/esm/wcs-editable-field.entry.js +81 -55
  210. package/dist/esm/wcs-editable-field.entry.js.map +1 -1
  211. package/dist/esm/wcs-error_3.entry.js +203 -0
  212. package/dist/esm/wcs-error_3.entry.js.map +1 -0
  213. package/dist/esm/wcs-field-content.entry.js +1 -1
  214. package/dist/esm/wcs-field-label.entry.js +1 -1
  215. package/dist/esm/wcs-field.entry.js +1 -1
  216. package/dist/esm/wcs-footer.entry.js +1 -1
  217. package/dist/esm/wcs-footer.entry.js.map +1 -1
  218. package/dist/esm/wcs-galactic-menu.entry.js +4 -4
  219. package/dist/esm/wcs-galactic-menu.entry.js.map +1 -1
  220. package/dist/esm/wcs-galactic.entry.js +1 -1
  221. package/dist/esm/wcs-grid-column.entry.js +2 -2
  222. package/dist/esm/wcs-grid-column.entry.js.map +1 -1
  223. package/dist/esm/wcs-grid-custom-cell.entry.js +1 -1
  224. package/dist/esm/wcs-grid-pagination.entry.js +2 -2
  225. package/dist/esm/wcs-grid.entry.js +6 -6
  226. package/dist/esm/wcs-header.entry.js +2 -2
  227. package/dist/esm/wcs-hint.entry.js +1 -1
  228. package/dist/esm/wcs-horizontal-stepper.entry.js +1 -1
  229. package/dist/esm/wcs-icon.entry.js +2 -2
  230. package/dist/esm/wcs-input.entry.js +5 -3
  231. package/dist/esm/wcs-input.entry.js.map +1 -1
  232. package/dist/esm/wcs-list-item-properties.entry.js +1 -1
  233. package/dist/esm/wcs-list-item-property.entry.js +1 -1
  234. package/dist/esm/wcs-list-item.entry.js +1 -1
  235. package/dist/esm/wcs-list-item.entry.js.map +1 -1
  236. package/dist/esm/wcs-mat-icon.entry.js +2 -2
  237. package/dist/esm/wcs-modal.entry.js +17 -3
  238. package/dist/esm/wcs-modal.entry.js.map +1 -1
  239. package/dist/esm/wcs-native-select.entry.js +1 -1
  240. package/dist/esm/wcs-nav-item.entry.js +3 -3
  241. package/dist/esm/wcs-nav-item.entry.js.map +1 -1
  242. package/dist/esm/wcs-nav.entry.js +2 -2
  243. package/dist/esm/wcs-progress-bar.entry.js +3 -3
  244. package/dist/esm/wcs-progress-radial.entry.js +3 -3
  245. package/dist/esm/wcs-radio-group.entry.js +5 -2
  246. package/dist/esm/wcs-radio-group.entry.js.map +1 -1
  247. package/dist/esm/wcs-radio.entry.js +2 -2
  248. package/dist/esm/wcs-radio.entry.js.map +1 -1
  249. package/dist/esm/wcs-select_2.entry.js +8 -7
  250. package/dist/esm/wcs-select_2.entry.js.map +1 -1
  251. package/dist/esm/wcs-skeleton-circle.entry.js +1 -1
  252. package/dist/esm/wcs-skeleton-rectangle.entry.js +1 -1
  253. package/dist/esm/wcs-skeleton-text.entry.js +1 -1
  254. package/dist/esm/wcs-switch.entry.js +6 -2
  255. package/dist/esm/wcs-switch.entry.js.map +1 -1
  256. package/dist/esm/wcs-tab.entry.js +1 -1
  257. package/dist/esm/wcs-tabs.entry.js +2 -2
  258. package/dist/esm/wcs-tabs.entry.js.map +1 -1
  259. package/dist/esm/wcs-textarea.entry.js +2 -2
  260. package/dist/esm/wcs-textarea.entry.js.map +1 -1
  261. package/dist/esm/wcs-tooltip.entry.js +8 -4
  262. package/dist/esm/wcs-tooltip.entry.js.map +1 -1
  263. package/dist/esm/wcs.js +1 -1
  264. package/dist/types/components/checkbox/checkbox.d.ts +3 -1
  265. package/dist/types/components/counter/counter.d.ts +6 -0
  266. package/dist/types/components/editable-field/editable-field.d.ts +23 -9
  267. package/dist/types/components/input/input.d.ts +3 -0
  268. package/dist/types/components/list-item/list-item.d.ts +5 -0
  269. package/dist/types/components/modal/modal.d.ts +23 -0
  270. package/dist/types/components/radio-group/radio-group.d.ts +3 -1
  271. package/dist/types/components/select/select.d.ts +4 -0
  272. package/dist/types/components/switch/switch.d.ts +3 -1
  273. package/dist/types/components/tooltip/tooltip.d.ts +3 -5
  274. package/dist/types/components.d.ts +87 -16
  275. package/dist/types/utils/control-component-interface.d.ts +22 -0
  276. package/dist/types/utils/helpers.d.ts +21 -0
  277. package/dist/wcs/p-0017d766.js +2 -0
  278. package/dist/wcs/{p-45a6934d.entry.js → p-0ffdfc10.entry.js} +2 -2
  279. package/dist/wcs/{p-9f23c49e.entry.js → p-13090618.entry.js} +2 -2
  280. package/dist/wcs/{p-8f0e093f.entry.js → p-13e50077.entry.js} +2 -2
  281. package/dist/wcs/p-1438530e.entry.js +2 -0
  282. package/dist/wcs/p-1438530e.entry.js.map +1 -0
  283. package/dist/wcs/{p-2305f257.entry.js → p-16dd21cf.entry.js} +2 -2
  284. package/dist/wcs/{p-85a5bbb7.entry.js → p-206c01d5.entry.js} +2 -2
  285. package/dist/wcs/{p-85a5bbb7.entry.js.map → p-206c01d5.entry.js.map} +1 -1
  286. package/dist/wcs/{p-09d0a296.entry.js → p-21b964cd.entry.js} +3 -3
  287. package/dist/wcs/p-21b964cd.entry.js.map +1 -0
  288. package/dist/wcs/p-21d2f06f.entry.js +2 -0
  289. package/dist/wcs/p-21d2f06f.entry.js.map +1 -0
  290. package/dist/wcs/{p-2add4d4d.entry.js → p-258855a1.entry.js} +2 -2
  291. package/dist/wcs/{p-2c9e20c1.entry.js → p-294732f7.entry.js} +2 -2
  292. package/dist/wcs/{p-15ff9f93.entry.js → p-29f5b974.entry.js} +2 -2
  293. package/dist/wcs/{p-1ab0d13b.entry.js → p-2adf00be.entry.js} +2 -2
  294. package/dist/wcs/p-2adf00be.entry.js.map +1 -0
  295. package/dist/wcs/p-37800935.entry.js +2 -0
  296. package/dist/wcs/{p-76f07dbd.entry.js → p-388e6d75.entry.js} +2 -2
  297. package/dist/wcs/{p-8bd1b9ce.entry.js → p-43d70995.entry.js} +2 -2
  298. package/dist/wcs/{p-9553d60e.entry.js → p-4661290b.entry.js} +2 -2
  299. package/dist/wcs/{p-9553d60e.entry.js.map → p-4661290b.entry.js.map} +1 -1
  300. package/dist/wcs/{p-d2a4f609.entry.js → p-4dc52a25.entry.js} +2 -2
  301. package/dist/wcs/{p-25b96cde.entry.js → p-50523b53.entry.js} +2 -2
  302. package/dist/wcs/p-50523b53.entry.js.map +1 -0
  303. package/dist/wcs/p-52d77e1f.js +2 -0
  304. package/dist/wcs/p-52d77e1f.js.map +1 -0
  305. package/dist/wcs/p-5974be61.entry.js +2 -0
  306. package/dist/wcs/p-5974be61.entry.js.map +1 -0
  307. package/dist/wcs/{p-0fa370d7.entry.js → p-5bf73e05.entry.js} +3 -3
  308. package/dist/wcs/{p-0fa370d7.entry.js.map → p-5bf73e05.entry.js.map} +1 -1
  309. package/dist/wcs/{p-e19308cf.entry.js → p-5d5f50ed.entry.js} +2 -2
  310. package/dist/wcs/{p-94ff8939.entry.js → p-5de993d7.entry.js} +2 -2
  311. package/dist/wcs/p-5de993d7.entry.js.map +1 -0
  312. package/dist/wcs/{p-a788b5bd.entry.js → p-619e1110.entry.js} +2 -2
  313. package/dist/wcs/{p-9e03b379.entry.js → p-694724a2.entry.js} +2 -2
  314. package/dist/wcs/{p-f8d2be83.entry.js → p-6b06d2e7.entry.js} +2 -2
  315. package/dist/wcs/p-6f5d570a.entry.js +2 -0
  316. package/dist/wcs/p-6f5d570a.entry.js.map +1 -0
  317. package/dist/wcs/p-71db0ed5.entry.js +2 -0
  318. package/dist/wcs/{p-209145de.entry.js → p-76c92e22.entry.js} +2 -2
  319. package/dist/wcs/{p-f06aa79d.entry.js → p-796e690d.entry.js} +2 -2
  320. package/dist/wcs/{p-f06aa79d.entry.js.map → p-796e690d.entry.js.map} +1 -1
  321. package/dist/wcs/{p-97cbbcfc.entry.js → p-7d665a7e.entry.js} +2 -2
  322. package/dist/wcs/p-89b8c724.js +2 -0
  323. package/dist/wcs/{p-412b0021.js → p-8fcceaf1.js} +2 -2
  324. package/dist/wcs/p-9243a323.entry.js +2 -0
  325. package/dist/wcs/p-9243a323.entry.js.map +1 -0
  326. package/dist/wcs/p-94aa269f.entry.js +2 -0
  327. package/dist/wcs/p-94aa269f.entry.js.map +1 -0
  328. package/dist/wcs/{p-87b69cac.entry.js → p-9554196c.entry.js} +2 -2
  329. package/dist/wcs/{p-80a23f9c.entry.js → p-96bff8fe.entry.js} +2 -2
  330. package/dist/wcs/{p-80a23f9c.entry.js.map → p-96bff8fe.entry.js.map} +1 -1
  331. package/dist/wcs/{p-fa507e06.entry.js → p-9ad23e83.entry.js} +2 -2
  332. package/dist/wcs/{p-5ea2aba5.entry.js → p-9c012aae.entry.js} +2 -2
  333. package/dist/wcs/p-9dc3f9a5.entry.js +2 -0
  334. package/dist/wcs/p-9dc3f9a5.entry.js.map +1 -0
  335. package/dist/wcs/p-9eb66fa9.entry.js +2 -0
  336. package/dist/wcs/p-a7468a3a.js +2 -0
  337. package/dist/wcs/p-a7468a3a.js.map +1 -0
  338. package/dist/wcs/{p-4982f96c.entry.js → p-a7891233.entry.js} +2 -2
  339. package/dist/wcs/p-b2080509.entry.js +2 -0
  340. package/dist/wcs/{p-806315e6.entry.js.map → p-b2080509.entry.js.map} +1 -1
  341. package/dist/wcs/p-b96f4921.entry.js +2 -0
  342. package/dist/wcs/p-b96f4921.entry.js.map +1 -0
  343. package/dist/wcs/{p-276b8125.entry.js → p-c2d35aa6.entry.js} +3 -3
  344. package/dist/wcs/{p-276b8125.entry.js.map → p-c2d35aa6.entry.js.map} +1 -1
  345. package/dist/wcs/p-c752b85a.entry.js +2 -0
  346. package/dist/wcs/{p-b0f8190f.entry.js → p-d895ffb4.entry.js} +2 -2
  347. package/dist/wcs/{p-1e5aa960.entry.js → p-d9525519.entry.js} +2 -2
  348. package/dist/wcs/p-d9525519.entry.js.map +1 -0
  349. package/dist/wcs/{p-db81b74f.entry.js → p-da4636fa.entry.js} +2 -2
  350. package/dist/wcs/p-da4636fa.entry.js.map +1 -0
  351. package/dist/wcs/p-dd60a6db.entry.js +2 -0
  352. package/dist/wcs/p-dd60a6db.entry.js.map +1 -0
  353. package/dist/wcs/p-dddcd685.entry.js +2 -0
  354. package/dist/wcs/p-dddcd685.entry.js.map +1 -0
  355. package/dist/wcs/p-e36b2ad1.entry.js +2 -0
  356. package/dist/wcs/p-f87636f6.entry.js +2 -0
  357. package/dist/wcs/p-f87636f6.entry.js.map +1 -0
  358. package/dist/wcs/p-fc115de4.entry.js +2 -0
  359. package/dist/wcs/wcs.esm.js +1 -1
  360. package/dist/wcs/wcs.esm.js.map +1 -1
  361. package/package.json +1 -1
  362. package/dist/cjs/helpers-871f5a3d.js.map +0 -1
  363. package/dist/cjs/wcs-error_2.cjs.entry.js +0 -168
  364. package/dist/cjs/wcs-error_2.cjs.entry.js.map +0 -1
  365. package/dist/cjs/wcs-label.cjs.entry.js +0 -33
  366. package/dist/cjs/wcs-label.cjs.entry.js.map +0 -1
  367. package/dist/esm/helpers-f137ec8d.js.map +0 -1
  368. package/dist/esm/wcs-error_2.entry.js +0 -163
  369. package/dist/esm/wcs-error_2.entry.js.map +0 -1
  370. package/dist/esm/wcs-label.entry.js +0 -29
  371. package/dist/esm/wcs-label.entry.js.map +0 -1
  372. package/dist/wcs/p-08e86d69.entry.js +0 -2
  373. package/dist/wcs/p-08e86d69.entry.js.map +0 -1
  374. package/dist/wcs/p-09d0a296.entry.js.map +0 -1
  375. package/dist/wcs/p-0fdaec9e.entry.js +0 -2
  376. package/dist/wcs/p-0fdaec9e.entry.js.map +0 -1
  377. package/dist/wcs/p-19c77b5c.entry.js +0 -2
  378. package/dist/wcs/p-1ab0d13b.entry.js.map +0 -1
  379. package/dist/wcs/p-1e5aa960.entry.js.map +0 -1
  380. package/dist/wcs/p-25b96cde.entry.js.map +0 -1
  381. package/dist/wcs/p-400a71d7.entry.js +0 -2
  382. package/dist/wcs/p-4ca7c59f.entry.js +0 -2
  383. package/dist/wcs/p-4ca7c59f.entry.js.map +0 -1
  384. package/dist/wcs/p-4d6d1d14.js +0 -2
  385. package/dist/wcs/p-52cd0abb.entry.js +0 -2
  386. package/dist/wcs/p-52cd0abb.entry.js.map +0 -1
  387. package/dist/wcs/p-5f517eb5.entry.js +0 -2
  388. package/dist/wcs/p-806315e6.entry.js +0 -2
  389. package/dist/wcs/p-8780a429.entry.js +0 -2
  390. package/dist/wcs/p-8780a429.entry.js.map +0 -1
  391. package/dist/wcs/p-94ff8939.entry.js.map +0 -1
  392. package/dist/wcs/p-985c4cf2.entry.js +0 -2
  393. package/dist/wcs/p-985c4cf2.entry.js.map +0 -1
  394. package/dist/wcs/p-a3aece7a.js +0 -2
  395. package/dist/wcs/p-a3aece7a.js.map +0 -1
  396. package/dist/wcs/p-a66a4289.entry.js +0 -2
  397. package/dist/wcs/p-bf31245c.entry.js +0 -2
  398. package/dist/wcs/p-bf31245c.entry.js.map +0 -1
  399. package/dist/wcs/p-cd592a00.entry.js +0 -2
  400. package/dist/wcs/p-cd592a00.entry.js.map +0 -1
  401. package/dist/wcs/p-d42831b2.entry.js +0 -2
  402. package/dist/wcs/p-d42831b2.entry.js.map +0 -1
  403. package/dist/wcs/p-d7acbf01.js +0 -2
  404. package/dist/wcs/p-db81b74f.entry.js.map +0 -1
  405. package/dist/wcs/p-dbbf0980.entry.js +0 -2
  406. package/dist/wcs/p-dbbf0980.entry.js.map +0 -1
  407. package/dist/wcs/p-e64d7437.entry.js +0 -2
  408. package/dist/wcs/p-e86575d3.entry.js +0 -2
  409. package/dist/wcs/p-e86575d3.entry.js.map +0 -1
  410. package/dist/wcs/p-f264d46f.entry.js +0 -2
  411. package/dist/wcs/p-fd9e731d.entry.js +0 -2
  412. package/dist/wcs/p-fd9e731d.entry.js.map +0 -1
  413. /package/dist/wcs/{p-d7acbf01.js.map → p-0017d766.js.map} +0 -0
  414. /package/dist/wcs/{p-45a6934d.entry.js.map → p-0ffdfc10.entry.js.map} +0 -0
  415. /package/dist/wcs/{p-9f23c49e.entry.js.map → p-13090618.entry.js.map} +0 -0
  416. /package/dist/wcs/{p-8f0e093f.entry.js.map → p-13e50077.entry.js.map} +0 -0
  417. /package/dist/wcs/{p-2305f257.entry.js.map → p-16dd21cf.entry.js.map} +0 -0
  418. /package/dist/wcs/{p-2add4d4d.entry.js.map → p-258855a1.entry.js.map} +0 -0
  419. /package/dist/wcs/{p-2c9e20c1.entry.js.map → p-294732f7.entry.js.map} +0 -0
  420. /package/dist/wcs/{p-15ff9f93.entry.js.map → p-29f5b974.entry.js.map} +0 -0
  421. /package/dist/wcs/{p-e64d7437.entry.js.map → p-37800935.entry.js.map} +0 -0
  422. /package/dist/wcs/{p-76f07dbd.entry.js.map → p-388e6d75.entry.js.map} +0 -0
  423. /package/dist/wcs/{p-8bd1b9ce.entry.js.map → p-43d70995.entry.js.map} +0 -0
  424. /package/dist/wcs/{p-d2a4f609.entry.js.map → p-4dc52a25.entry.js.map} +0 -0
  425. /package/dist/wcs/{p-e19308cf.entry.js.map → p-5d5f50ed.entry.js.map} +0 -0
  426. /package/dist/wcs/{p-a788b5bd.entry.js.map → p-619e1110.entry.js.map} +0 -0
  427. /package/dist/wcs/{p-9e03b379.entry.js.map → p-694724a2.entry.js.map} +0 -0
  428. /package/dist/wcs/{p-f8d2be83.entry.js.map → p-6b06d2e7.entry.js.map} +0 -0
  429. /package/dist/wcs/{p-5f517eb5.entry.js.map → p-71db0ed5.entry.js.map} +0 -0
  430. /package/dist/wcs/{p-209145de.entry.js.map → p-76c92e22.entry.js.map} +0 -0
  431. /package/dist/wcs/{p-97cbbcfc.entry.js.map → p-7d665a7e.entry.js.map} +0 -0
  432. /package/dist/wcs/{p-4d6d1d14.js.map → p-89b8c724.js.map} +0 -0
  433. /package/dist/wcs/{p-412b0021.js.map → p-8fcceaf1.js.map} +0 -0
  434. /package/dist/wcs/{p-87b69cac.entry.js.map → p-9554196c.entry.js.map} +0 -0
  435. /package/dist/wcs/{p-fa507e06.entry.js.map → p-9ad23e83.entry.js.map} +0 -0
  436. /package/dist/wcs/{p-5ea2aba5.entry.js.map → p-9c012aae.entry.js.map} +0 -0
  437. /package/dist/wcs/{p-19c77b5c.entry.js.map → p-9eb66fa9.entry.js.map} +0 -0
  438. /package/dist/wcs/{p-4982f96c.entry.js.map → p-a7891233.entry.js.map} +0 -0
  439. /package/dist/wcs/{p-400a71d7.entry.js.map → p-c752b85a.entry.js.map} +0 -0
  440. /package/dist/wcs/{p-b0f8190f.entry.js.map → p-d895ffb4.entry.js.map} +0 -0
  441. /package/dist/wcs/{p-f264d46f.entry.js.map → p-e36b2ad1.entry.js.map} +0 -0
  442. /package/dist/wcs/{p-a66a4289.entry.js.map → p-fc115de4.entry.js.map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G,EACzDA,mEAAM,IAAI,EAAC,QAAQ,GAAE,CACnB,EAEF,OAAO,IAAIA,kBAAM,IAAI,EAAC,OAAO,GAAE,IAAI,EAAE,EAEzCA,mEAAM,IAAI,EAAC,UAAU,GAAE,CACpB,EACT;KACL;IAEO,qBAAqB;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC3B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAChC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC9C;;;;;;;;;;;","names":["h","Host","isMutableAriaAttribute"],"sources":["src/components/error/error.scss?tag=wcs-error&encapsulation=shadow","src/components/error/error.tsx","src/components/form-field/form-field.scss?tag=wcs-form-field&encapsulation=shadow","src/components/form-field/form-field.tsx"],"sourcesContent":[":host {\n --wcs-error-color: var(--wcs-semantic-color-text-critical);\n --wcs-error-font-size: var(--wcs-semantic-font-size-caption-2);\n --wcs-error-font-weight: var(--wcs-semantic-font-weight-book);\n\n color: var(--wcs-error-color);\n font-size: var(--wcs-error-font-size);\n font-weight: var(--wcs-error-font-weight);\n}\n","import { Component, ComponentInterface, h, Host } from '@stencil/core';\n\n/**\n * The `wcs-error` should always be wrapped in a `wcs-form-field`.\n * It is used to display a red message under the field indicating an incorrect user input.\n * \n * ## Accessibility guidelines 💡\n * - Provide a relevant error message to inform the users what they should change to make the field valid\n * - Always add the error icon, to ensure the visual indication of the error state other than the color\n * - `aria-description` will be automatically added to the field for screen readers\n * - `aria-invalid=\"true\"` will be automatically added to the field for screen readers\n * \n * @cssprop --wcs-error-color - Color of the text\n * @cssprop --wcs-error-font-size - Font size\n * @cssprop --wcs-error-font-weight - Font weight\n */\n@Component({\n tag: 'wcs-error',\n styleUrl: 'error.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface {\n render() {\n return (\n <Host aria-live=\"polite\" aria-atomic=\"true\" slot=\"error\">\n <slot />\n </Host>\n );\n }\n}\n",":host {\n --wcs-form-field-gap: var(--wcs-semantic-spacing-small);\n\n --wcs-form-field-prefix-suffix-border-radius: var(--wcs-semantic-border-radius-base);\n\n --wcs-form-field-prefix-icon-color: var(--wcs-semantic-color-foreground-primary);\n --wcs-form-field-prefix-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-form-field-prefix-placeholder-color: var(--wcs-semantic-color-text-inverse);\n\n // Prefixed select\n ::slotted([slot=prefix]) {\n --wcs-select-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-select-placeholder-color: var(--wcs-semantic-color-text-inverse);\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-default);\n --wcs-select-control-arrow-color: var(--wcs-form-field-prefix-icon-color);\n --wcs-select-control-border-radius: var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);\n --wcs-select-control-border-width-default: 0;\n --wcs-select-control-border-style-focus: dashed;\n --wcs-select-control-border-color-focus: var(--wcs-semantic-color-border-focus-base);\n\n --wcs-native-select-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-native-select-placeholder-color: var(--wcs-semantic-color-text-inverse);\n --wcs-native-select-arrow-color: var(--wcs-form-field-prefix-icon-color);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-default);\n --wcs-native-select-border-width: 0;\n --wcs-native-select-border-color-focus: var(--wcs-semantic-color-border-focus-base);\n --wcs-native-select-border-style-focus: dashed;\n --wcs-native-select-border-radius: var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);\n --wcs-native-select-option-color: var(--wcs-semantic-color-text-inverse);\n }\n\n ::slotted([slot=prefix][disabled]),\n ::slotted([slot=prefix]:disabled),\n ::slotted([slot=prefix][aria-disabled=true]),\n ::slotted([slot=prefix][data-disabled]) {\n --wcs-semantic-color-background-control-disabled: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-semantic-color-text-disabled: var(--wcs-semantic-color-foreground-disabled);\n\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-select-value-color: var(--wcs-semantic-color-text-disabled);\n --wcs-select-placeholder-color: var(--wcs-semantic-color-text-disabled);\n\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-native-select-placeholder-color: var(--wcs-semantic-color-text-disabled);\n --wcs-native-select-value-color: var(--wcs-semantic-color-text-disabled);\n }\n\n ::slotted([slot=prefix]:hover:not([disabled]):not([data-disabled])) {\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-hover);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-hover);\n }\n\n ::slotted([slot=prefix]:active:not([disabled]):not([data-disabled])) {\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-press);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-press);\n }\n // endregion\n\n display: flex;\n flex-direction: column;\n gap: var(--wcs-form-field-gap);\n}\n\n.input-container {\n display: flex;\n}\n\n::slotted(wcs-select:not([slot=prefix])) {\n width: 100%;\n}\n\n::slotted(wcs-native-select:not([slot=prefix])) {\n width: 100%;\n}\n\n// Make input square on left side if there is a prefix\n:host(.has-prefix) {\n ::slotted(wcs-input) {\n --wcs-input-border-radius-left: 0;\n }\n}\n\n// Make input square on right side if there is a suffix\n:host(.has-suffix) {\n ::slotted(wcs-input) {\n --wcs-input-border-radius-right: 0;\n }\n}\n\n::slotted([slot=suffix]) {\n // Make button square on left side\n --wcs-button-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;\n\n // Make select square on left side\n --wcs-select-control-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0 ;\n\n // Make native select square on left side\n --wcs-native-select-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;\n}\n","import { Component, ComponentInterface, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { isMutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\n/**\n * Form field component wraps the native input element and add some more functionality on top of it.\n *\n * You can use the `wcs-form-field` to wrap any of these components :\n * - `wcs-input`\n * - `wcs-textarea`\n * - `wcs-radio-group`\n * - `wcs-switch`\n * - `wcs-checkbox`\n * - `wcs-native-select`\n * - `wcs-select`\n * - `wcs-counter`\n *\n * For non-supported slotted component, you can use the `required` attribute on the wrapped component to tell the\n * form-field that it is required. It will add a red star after the label of the form field.\n * \n * ## Accessibility guidelines 💡\n * - Each form control should be identified with a unique `wcs-label`\n * - Don't forget to add form validation to make sure the data is correctly formatted\n * - If the `wcs-label` is required, the form control must have the `required` HTML attribute and vice-versa (this is normally automatically set)\n * - The form should not be submittable if at least one required form control is not filled\n * - Hints are optional and should only be used to add extra information\n * - Additional aria attributes put on `<wcs-form-field>` won't inherit onto the native component : you must use the `setAriaAttribute` method.\n * \n * @slot label - Automatically filled when a `wcs-label` is provided\n * @slot <no-name> - The main slot containing the wrapped component\n * @slot prefix - (Optional) Display a component as prefix. See \"Prefix Suffix Group\" story for more info.\n * @slot suffix - (Optional) Display a component as suffix. See \"Prefix Suffix Group\" story for more info.\n * @slot error - Automatically filled when a `wcs-error` is provided\n * @slot messages - Automatically filled when a `wcs-hint` is provided\n *\n * @cssprop --wcs-form-field-gap - Defines the spacing between the label, input control, and hint messages.\n * @cssprop --wcs-form-field-prefix-suffix-border-radius - Sets the border radius for both prefix and suffix elements.\n * \n * @cssprop --wcs-form-field-prefix-background-color-default - Background color default for prefix elements\n * @cssprop --wcs-form-field-prefix-background-color-disabled - Background color for prefix elements when disabled\n * @cssprop --wcs-form-field-prefix-background-color-hover - Background color for prefix elements when hovered\n * @cssprop --wcs-form-field-prefix-border-color-default - Defines the default border color for prefix\n * @cssprop --wcs-form-field-prefix-border-color-focus - Sets the border color for prefix elements when focused.\n * @cssprop --wcs-form-field-prefix-border-color-disabled - Determines the border color for prefix elements when disabled.\n * \n * @cssprop --wcs-form-field-prefix-icon-color - Specifies the color of icons within prefix elements.\n * @cssprop --wcs-form-field-prefix-value-color - Sets the color of values within prefix elements.\n * @cssprop --wcs-form-field-prefix-placeholder-color - Defines the placeholder text color within prefix elements.\n * @cssprop --wcs-form-field-prefix-color-disabled - Determines the text color for prefix elements when disabled.\n */\n@Component({\n tag: 'wcs-form-field',\n styleUrl: 'form-field.scss',\n shadow: true,\n})\nexport class FormField implements ComponentInterface {\n @Element() private el!: HTMLWcsFormFieldElement;\n\n /**\n * Specifies whether the form field is in an error state. Displays the field border in red and the message contained in the wcs-error component\n */\n @Prop({mutable: true, reflect: true}) isError = false;\n\n @State() private hasPrefix = false;\n @State() private hasSuffix = false;\n @State() private spiedElement: Element;\n\n private observer: MutationObserver;\n\n componentWillLoad() {\n this.hasSuffix = this.el.querySelector('wcs-button') !== null;\n this.hasPrefix = this.el.querySelector('wcs-select') !== null;\n }\n\n componentDidLoad() {\n this.initSpiedElement();\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n\n @Watch('isError')\n // @ts-ignore\n private isErrorChange(newValue: boolean) {\n this.updateErrorStateOnInput(newValue);\n this.updateAriaAttributes();\n }\n\n private updateErrorStateOnInput(newValue: boolean) {\n if (this.spiedElementIsOfType('wcs-input', 'wcs-textarea')) {\n if (newValue) {\n this.spiedElement.setAttribute('state', 'error');\n } else {\n this.spiedElement.setAttribute('state', 'initial');\n }\n }\n }\n\n /**\n * This function return true if the form field contains an element with tagName matches a value of the types param\n * @param types\n * @private\n */\n private spiedElementIsOfType(...types: string[]): boolean {\n for (const type of types) {\n if (this.spiedElement?.tagName === type.toUpperCase()) return true;\n }\n return false\n }\n\n\n private addRequiredMarkerToLabel() {\n // TODO: deprecate this in favor of the 'required' component attribute\n const label = this.el.querySelector('wcs-label');\n this.observer = new MutationObserver(mutations => {\n const requiredAttMutation = mutations.filter(m => m.attributeName === 'required')[0];\n if (requiredAttMutation) {\n this.updateLabelRequiredFlag(this.spiedElement?.hasAttribute('required'), label);\n }\n });\n if (this.spiedElement) {\n this.observer.observe(this.spiedElement, {attributes: true});\n }\n\n const isRequired = this.spiedElement?.hasAttribute('required');\n this.updateLabelRequiredFlag(isRequired, label);\n }\n\n\n private initSpiedElement() {\n const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-native-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox', 'wcs-native-select', 'wcs-counter'];\n\n this.spiedElement = (this.el.shadowRoot.querySelector('slot:not([name])') as HTMLSlotElement)\n ?.assignedElements()\n .filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];\n\n // If the component is used in another web component\n if (this.spiedElement?.tagName === 'SLOT') {\n this.spiedElement = ((this.spiedElement as HTMLSlotElement)\n .assignedElements()\n .filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]) as HTMLElement;\n }\n\n if (!this.spiedElement) {\n // tslint:disable-next-line:no-console\n console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');\n return;\n }\n }\n \n private updateAriaAttributes(): void {\n if(isMutableAriaAttribute(this.spiedElement)) {\n this.spiedElement.setAriaAttribute('aria-label', this.label);\n\n // Sur les autres DS, généralement seul l'erreur est affichée et pas avec la description\n if(this.isError) {\n if(this.error) this.spiedElement.setAriaAttribute('aria-description', this.error);\n this.spiedElement.setAriaAttribute('aria-invalid', 'true');\n } else {\n if(this.description) this.spiedElement.setAriaAttribute('aria-description', this.description);\n this.spiedElement.setAriaAttribute('aria-invalid', 'false');\n }\n }\n }\n \n private get label() {\n return this.el.querySelector('wcs-label')?.textContent;\n }\n \n private get description() {\n return this.el.querySelector('wcs-hint')?.textContent;\n }\n \n private get error() {\n return this.el.querySelector('wcs-error')?.textContent;\n }\n\n private updateLabelRequiredFlag(isRequired: boolean, label: Element) {\n if (isRequired && label) {\n label.setAttribute('required', 'true');\n } else if (!isRequired && label) {\n label.removeAttribute('required');\n }\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n }\n\n render() {\n let classes = '';\n const isError = this.isError;\n\n if (this.hasSuffix) {\n classes += ' has-suffix';\n }\n if (this.hasPrefix) {\n classes += ' has-prefix';\n }\n return (\n <Host class={classes}>\n <slot name=\"label\"/>\n <div class=\"input-container\">\n <slot name=\"prefix\"/>\n <slot onSlotchange={() => this.onFormInputSlotChange()}/>\n <slot name=\"suffix\"/>\n </div>\n {\n isError ? (<slot name=\"error\"/>) : ''\n }\n <slot name=\"messages\"/>\n </Host>\n );\n }\n\n private onFormInputSlotChange() {\n this.initSpiedElement();\n this.updateAriaAttributes()\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n}\n"],"version":3}
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- const index = require('./index-6f0140d8.js');
6
- const helpers = require('./helpers-871f5a3d.js');
7
-
8
- const labelCss = ":host{--wcs-label-font-weight:var(--wcs-semantic-font-weight-book);--wcs-label-color:var(--wcs-semantic-color-text-primary);--wcs-label-required-marker-color:var(--wcs-semantic-color-text-critical);--wcs-label-gap:var(--wcs-semantic-spacing-small);font-weight:var(--wcs-label-font-weight)}:host([required])>label::after{font-weight:var(--wcs-label-font-weight);color:var(--wcs-label-required-marker-color);content:\" *\"}label{display:inline-block;color:var(--wcs-label-color);font-weight:var(--wcs-label-font-weight)}label ::slotted(wcs-mat-icon){display:inline;vertical-align:middle;margin-left:var(--wcs-label-gap)}";
9
- const WcsLabelStyle0 = labelCss;
10
-
11
- const LABEL_INHERITED_ATTRS = ['title'];
12
- const Label = class {
13
- constructor(hostRef) {
14
- index.registerInstance(this, hostRef);
15
- this.inheritedAttributes = {};
16
- this.required = false;
17
- }
18
- componentWillLoad() {
19
- this.inheritedAttributes = Object.assign(Object.assign({}, helpers.inheritAriaAttributes(this.el)), helpers.inheritAttributes(this.el, LABEL_INHERITED_ATTRS));
20
- }
21
- async setAriaAttribute(attr, value) {
22
- helpers.setOrRemoveAttribute(this.nativeLabel, attr, value);
23
- }
24
- render() {
25
- return (index.h(index.Host, { key: '112bfe1eddc6da7b457bf183c83a07a60de0ca00', slot: "label" }, index.h("label", Object.assign({ key: '0d32dfcc8b4f024f986d7770a52402ae024c8862', ref: (el) => this.nativeLabel = el }, this.inheritedAttributes), index.h("slot", { key: '74c93cbd04d6744c2427f4810d510f05faa2bbfc' }))));
26
- }
27
- get el() { return index.getElement(this); }
28
- };
29
- Label.style = WcsLabelStyle0;
30
-
31
- exports.wcs_label = Label;
32
-
33
- //# sourceMappingURL=wcs-label.cjs.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"wcs-label.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,QAAQ,GAAG,4mBAA4mB,CAAC;AAC9nB,uBAAe,QAAQ;;ACGvB,MAAM,qBAAqB,GAAG,CAAC,OAAO,CAAC,CAAC;MAsB3B,KAAK;;;QAGN,wBAAmB,GAAyB,EAAE,CAAC;wBAMnB,KAAK;;IAEzC,iBAAiB;QACb,IAAI,CAAC,mBAAmB,mCACjBA,6BAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,GAC9BC,yBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC,CACvD,CAAC;KACL;IAGD,MAAM,gBAAgB,CAAC,IAAuB,EAAE,KAAgC;QAC5EC,4BAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KACvD;IAED,MAAM;QACF,QACIC,QAACC,UAAI,qDAAC,IAAI,EAAC,OAAO,IACdD,kFAAO,GAAG,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,WAAW,GAAG,EAAE,IAAM,IAAI,CAAC,mBAAmB,GACnEA,oEAAQ,CACJ,CACL,EACT;KACL;;;;;;;","names":["inheritAriaAttributes","inheritAttributes","setOrRemoveAttribute","h","Host"],"sources":["src/components/label/label.scss?tag=wcs-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":[":host {\n --wcs-label-font-weight: var(--wcs-semantic-font-weight-book);\n --wcs-label-color: var(--wcs-semantic-color-text-primary);\n --wcs-label-required-marker-color: var(--wcs-semantic-color-text-critical);\n\n --wcs-label-gap: var(--wcs-semantic-spacing-small);\n\n font-weight: var(--wcs-label-font-weight);\n}\n\n:host([required]) > label::after {\n font-weight: var(--wcs-label-font-weight);\n color: var(--wcs-label-required-marker-color);\n content: ' *';\n}\n\nlabel {\n display: inline-block;\n color: var(--wcs-label-color);\n font-weight: var(--wcs-label-font-weight);\n\n // Add margin before tooltip icon\n ::slotted(wcs-mat-icon) {\n display: inline;\n vertical-align: middle;\n margin-left: var(--wcs-label-gap);\n }\n}\n","import { Component, ComponentInterface, h, Host, Method, Prop, Element } from '@stencil/core';\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\nimport { inheritAriaAttributes, inheritAttributes, setOrRemoveAttribute } from \"../../utils/helpers\";\n\nconst LABEL_INHERITED_ATTRS = ['title'];\n\n/**\n * The `wcs-label` should always be wrapped in a `wcs-form-field`.\n * It is used to caption a form control component.\n *\n * ## Accessibility guidelines 💡\n * - Use concise name for the label. If you want to describe more your form control, add a `wcs-hint`\n * - Use the required flag only as an indication to inform users that the form control is required\n * \n * @cssprop --wcs-label-color - Color of the text\n * @cssprop --wcs-label-font-weight - Font weight of the text\n * \n * @cssprop --wcs-label-required-marker-color - Color of the required marker\n * \n * @cssprop --wcs-label-gap - Gap between text and required marker\n */\n@Component({\n tag: 'wcs-label',\n styleUrl: 'label.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface, MutableAriaAttribute {\n @Element() private el!: HTMLElement;\n private nativeLabel?: HTMLLabelElement;\n private inheritedAttributes: { [k: string]: any } = {};\n \n /**\n * If `true`, marks the label with a red star.\n * Automatically added if the wrapped component inside the `wcs-form-field` already has the `required` attribute. \n */\n @Prop({ reflect: true }) required = false;\n\n componentWillLoad() {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, LABEL_INHERITED_ATTRS),\n };\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeLabel, attr, value);\n }\n\n render() {\n return (\n <Host slot=\"label\">\n <label ref={(el) => this.nativeLabel = el} {...this.inheritedAttributes}>\n <slot />\n </label>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1 +0,0 @@
1
- {"file":"helpers-f137ec8d.js","mappings":"SAEgB,SAAS,CAAC,OAAY;IAClC,OAAO,aAAa,IAAI,OAAO;WACxB,cAAc,IAAI,OAAO,CAAC;AACrC,CAAC;SAEe,YAAY,CAAC,EAAe;IACxC,OAAO,CAAC,CAAC,EAAE,CAAC,UAAU,IAAI,CAAC,CAAE,EAAU,CAAC,YAAY,CAAC;AACzD,CAAC;MAEY,aAAa,GAAG,CAAC,KAAmB,EAAE,IAAY;IAC3D,MAAM,QAAQ,GAAI,KAAa,CAAC,SAAS,IAAI,KAAK,CAAC;IACnD,OAAO;QACH,SAAS,EAAE,KAAK;QAChB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC;KACrC,CAAC;AACtB,EAAE;AAEK,MAAM,QAAQ,GAAG,CAAC,IAA8B,EAAE,IAAI,GAAG,CAAC;IAC7D,IAAI,KAAU,CAAC;IACf,OAAO,CAAC,GAAG,IAAW;QAClB,YAAY,CAAC,KAAK,CAAC,CAAC;QACpB,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;KAC3C,CAAC;AACN,CAAC,CAAC;AAEF;;;;;;;;;;MAUa,iBAAiB,GAAG,CAAC,EAAe,EAAE,aAAuB,EAAE;IACxE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AI,IAAI,CAAC;AACjF;;;;","names":[],"sources":["src/utils/helpers.ts"],"sourcesContent":["import { EventEmitter } from '@stencil/core';\n\nexport function isElement(element: any): element is Element {\n return 'clientWidth' in element\n && 'clientHeight' in element;\n}\n\nexport function hasShadowDom(el: HTMLElement) {\n return !!el.shadowRoot && !!(el as any).attachShadow;\n}\n\nexport const debounceEvent = (event: EventEmitter, wait: number): EventEmitter => {\n const original = (event as any)._original || event;\n return {\n _original: event,\n emit: debounce(original.emit.bind(original), wait)\n } as EventEmitter;\n};\n\nexport const debounce = (func: (...args: any[]) => void, wait = 0) => {\n let timer: any;\n return (...args: any[]): any => {\n clearTimeout(timer);\n timer = setTimeout(func, wait, ...args);\n };\n};\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `wcs-input` should inherit\n * the `title` attribute that developers set directly on `wcs-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n */\nexport const inheritAttributes = (el: HTMLElement, attributes: string[] = []) => {\n const attributeObject: { [k: string]: any } = {};\n\n attributes.forEach(attr => {\n if (el.hasAttribute(attr)) {\n const value = el.getAttribute(attr);\n if (value !== null) {\n attributeObject[attr] = el.getAttribute(attr);\n }\n el.removeAttribute(attr);\n }\n });\n\n return attributeObject;\n}\n\n/**\n * List of available ARIA attributes + `role`.\n * Removed deprecated attributes.\n * https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes\n */\nconst ariaAttributes = [\n 'role',\n 'aria-activedescendant',\n 'aria-atomic',\n 'aria-autocomplete',\n 'aria-braillelabel',\n 'aria-brailleroledescription',\n 'aria-busy',\n 'aria-checked',\n 'aria-colcount',\n 'aria-colindex',\n 'aria-colindextext',\n 'aria-colspan',\n 'aria-controls',\n 'aria-current',\n 'aria-describedby',\n 'aria-description',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-flowto',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-level',\n 'aria-live',\n 'aria-multiline',\n 'aria-multiselectable',\n 'aria-orientation',\n 'aria-owns',\n 'aria-placeholder',\n 'aria-posinset',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-relevant',\n 'aria-required',\n 'aria-roledescription',\n 'aria-rowcount',\n 'aria-rowindex',\n 'aria-rowindextext',\n 'aria-rowspan',\n 'aria-selected',\n 'aria-setsize',\n 'aria-sort',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n];\n\n/**\n * Returns an array of aria attributes that should be copied from\n * the shadow host element to a target within the light DOM.\n * @param el The element that the attributes should be copied from.\n * @param ignoreList The list of aria-attributes to ignore reflecting and removing from the host.\n * Use this in instances where we manually specify aria attributes on the `<Host>` element.\n */\nexport const inheritAriaAttributes = (el: HTMLElement, ignoreList?: string[]) => {\n let attributesToInherit = ariaAttributes;\n if (ignoreList && ignoreList.length > 0) {\n attributesToInherit = attributesToInherit.filter((attr) => !ignoreList.includes(attr));\n }\n return inheritAttributes(el, attributesToInherit);\n};\n\n/**\n * Dynamically add or remove an attribute on the element.\n * If the value of the attribute is null or undefined, the attribute is removed.\n *\n * @param el - The HTMLElement\n * @param attr - The attribute to be added or removed\n * @param value - The value of the attribute\n */\nexport function setOrRemoveAttribute(el: HTMLElement, attr: string, value: string | null | undefined) {\n if (el) {\n if (value === undefined || value === null) {\n el.removeAttribute(attr);\n } else {\n el.setAttribute(attr, value);\n }\n }\n}\n\nexport const findItemLabel = (componentEl: HTMLElement): HTMLWcsLabelElement | null => {\n const itemEl = componentEl.closest('wcs-form-field');\n if (itemEl) {\n return itemEl.querySelector('wcs-label');\n }\n return null;\n};\n\n/**\n * Given two lists of items, this function will return the items that were removed, kept, and added compared to the source list.\n * @param sourceList - The source list of items\n * @param newList - The target list of items\n * @param compareFn - The function to compare the items\n */\nexport const compareLists: <T>(sourceList: T[], newList: T[], compareFn: (v1: T, v2: T) => boolean) => {\n removed: T[];\n kept: T[];\n added: T[]\n} = <T>(sourceList: T[], newList: T[], compareFn: (v1: T, v2: T) => boolean) => {\n const removed = sourceList.filter(val => !newList.some(newVal => compareFn(val, newVal)));\n const kept = sourceList.filter(val => newList.some(newVal => compareFn(val, newVal)));\n const added = newList.filter(val => !sourceList.some(sourceVal => compareFn(val, sourceVal)));\n\n return { removed, kept, added };\n};\n\n\ndeclare const __zone_symbol__requestAnimationFrame: any;\n\n/**\n * Patched version of requestAnimationFrame that avoids ngzone\n * Use only when you know ngzone should not run\n */\nexport const raf = (h: any) => {\n if (typeof __zone_symbol__requestAnimationFrame === 'function') {\n return __zone_symbol__requestAnimationFrame(h);\n }\n if (typeof requestAnimationFrame === 'function') {\n return requestAnimationFrame(h);\n }\n return setTimeout(h);\n};\n\n/**\n * Return true if the mouseEvent click is inside the given HTML element\n */\nexport const clickInsideElement = (event: MouseEvent, element: HTMLElement): boolean => {\n return event.x >= element.getBoundingClientRect().x && event.x <= element.getBoundingClientRect().x + element.getBoundingClientRect().width\n && event.y >= element.getBoundingClientRect().y && event.y <= element.getBoundingClientRect().y + element.getBoundingClientRect().height;\n}\n\n\nexport const clickTargetIsElementOrChildren = (mouseEvent: MouseEvent, element: HTMLElement) => {\n return mouseEvent.target instanceof Node\n && element.contains(mouseEvent.target);\n}\n\nexport function generateUniqueId(componentName: string): string {\n return componentName + \"-\" + Math.random().toString(36);\n}\n\nexport function isKeyup(evt: KeyboardEvent) {\n return evt.code === 'ArrowUp';\n}\n\nexport function isKeydown(evt: KeyboardEvent) {\n return evt.code === 'ArrowDown';\n}\n\nexport function isEscapeKey(evt: KeyboardEvent) {\n return evt.code === 'Escape';\n}\n\nexport function isSpaceKey(evt: KeyboardEvent) {\n return evt.code === 'Space';\n}\n\nexport function isEnterKey(evt: KeyboardEvent) {\n return evt.key === 'Enter';\n}\n\nexport function isHomeKey(evt: KeyboardEvent) {\n return evt.code === 'Home';\n}\n\nexport function isEndKey(evt: KeyboardEvent) {\n return evt.code === 'End';\n}\n\nexport function isUpArrowKey(evt: KeyboardEvent) {\n return evt.key === 'ArrowUp';\n}\n\nexport function isDownArrowKey(evt: KeyboardEvent) {\n return evt.key === 'ArrowDown';\n}\n\nexport function isLeftArrowKey(evt: KeyboardEvent) {\n return evt.key === 'ArrowLeft';\n}\n\nexport function isRightArrowKey(evt: KeyboardEvent) {\n return evt.key === 'ArrowRight';\n}\n\nexport function isPageDownKey(evt: KeyboardEvent) {\n return evt.key === 'PageDown';\n}\n\nexport function isPageUpKey(evt: KeyboardEvent) {\n return evt.key === 'PageUp';\n}\n\nexport function isTabKey(evt: KeyboardEvent) {\n return evt.key === 'Tab';\n}\n\nexport function isCtrlA(evt: KeyboardEvent) {\n return evt.key === 'a' && evt.ctrlKey;\n}\n\nexport function getCssRootPropertyValue(name: string): string | null {\n return window.getComputedStyle(document.body).getPropertyValue(name) || null;\n}\n"],"version":3}
@@ -1,163 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-d9de61ce.js';
2
- import { i as isMutableAriaAttribute } from './mutable-aria-attribute-e225edc1.js';
3
-
4
- const errorCss = ":host{--wcs-error-color:var(--wcs-semantic-color-text-critical);--wcs-error-font-size:var(--wcs-semantic-font-size-caption-2);--wcs-error-font-weight:var(--wcs-semantic-font-weight-book);color:var(--wcs-error-color);font-size:var(--wcs-error-font-size);font-weight:var(--wcs-error-font-weight)}";
5
- const WcsErrorStyle0 = errorCss;
6
-
7
- const Label = class {
8
- constructor(hostRef) {
9
- registerInstance(this, hostRef);
10
- }
11
- render() {
12
- return (h(Host, { key: '2257210c2e97d6c4dc04a87fa05121e203b79619', "aria-live": "polite", "aria-atomic": "true", slot: "error" }, h("slot", { key: 'fc76b174cb85991bb4cd899b72605b171f8165e6' })));
13
- }
14
- };
15
- Label.style = WcsErrorStyle0;
16
-
17
- const formFieldCss = ":host{--wcs-form-field-gap:var(--wcs-semantic-spacing-small);--wcs-form-field-prefix-suffix-border-radius:var(--wcs-semantic-border-radius-base);--wcs-form-field-prefix-icon-color:var(--wcs-semantic-color-foreground-primary);--wcs-form-field-prefix-value-color:var(--wcs-semantic-color-text-inverse);--wcs-form-field-prefix-placeholder-color:var(--wcs-semantic-color-text-inverse);display:flex;flex-direction:column;gap:var(--wcs-form-field-gap)}:host ::slotted([slot=prefix]){--wcs-select-value-color:var(--wcs-semantic-color-text-inverse);--wcs-select-placeholder-color:var(--wcs-semantic-color-text-inverse);--wcs-select-control-background-color:var(--wcs-semantic-color-background-action-primary-default);--wcs-select-control-arrow-color:var(--wcs-form-field-prefix-icon-color);--wcs-select-control-border-radius:var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);--wcs-select-control-border-width-default:0;--wcs-select-control-border-style-focus:dashed;--wcs-select-control-border-color-focus:var(--wcs-semantic-color-border-focus-base);--wcs-native-select-value-color:var(--wcs-semantic-color-text-inverse);--wcs-native-select-placeholder-color:var(--wcs-semantic-color-text-inverse);--wcs-native-select-arrow-color:var(--wcs-form-field-prefix-icon-color);--wcs-native-select-background-color:var(--wcs-semantic-color-background-action-primary-default);--wcs-native-select-border-width:0;--wcs-native-select-border-color-focus:var(--wcs-semantic-color-border-focus-base);--wcs-native-select-border-style-focus:dashed;--wcs-native-select-border-radius:var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);--wcs-native-select-option-color:var(--wcs-semantic-color-text-inverse)}:host ::slotted([slot=prefix][disabled]),:host ::slotted([slot=prefix]:disabled),:host ::slotted([slot=prefix][aria-disabled=true]),:host ::slotted([slot=prefix][data-disabled]){--wcs-semantic-color-background-control-disabled:var(--wcs-semantic-color-background-action-primary-disabled);--wcs-semantic-color-text-disabled:var(--wcs-semantic-color-foreground-disabled);--wcs-select-control-background-color:var(--wcs-semantic-color-background-action-primary-disabled);--wcs-select-value-color:var(--wcs-semantic-color-text-disabled);--wcs-select-placeholder-color:var(--wcs-semantic-color-text-disabled);--wcs-native-select-background-color:var(--wcs-semantic-color-background-action-primary-disabled);--wcs-native-select-placeholder-color:var(--wcs-semantic-color-text-disabled);--wcs-native-select-value-color:var(--wcs-semantic-color-text-disabled)}:host ::slotted([slot=prefix]:hover:not([disabled]):not([data-disabled])){--wcs-select-control-background-color:var(--wcs-semantic-color-background-action-primary-hover);--wcs-native-select-background-color:var(--wcs-semantic-color-background-action-primary-hover)}:host ::slotted([slot=prefix]:active:not([disabled]):not([data-disabled])){--wcs-select-control-background-color:var(--wcs-semantic-color-background-action-primary-press);--wcs-native-select-background-color:var(--wcs-semantic-color-background-action-primary-press)}.input-container{display:flex}::slotted(wcs-select:not([slot=prefix])){width:100%}::slotted(wcs-native-select:not([slot=prefix])){width:100%}:host(.has-prefix) ::slotted(wcs-input){--wcs-input-border-radius-left:0}:host(.has-suffix) ::slotted(wcs-input){--wcs-input-border-radius-right:0}::slotted([slot=suffix]){--wcs-button-border-radius:0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;--wcs-select-control-border-radius:0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;--wcs-native-select-border-radius:0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0}";
18
- const WcsFormFieldStyle0 = formFieldCss;
19
-
20
- const FormField = class {
21
- constructor(hostRef) {
22
- registerInstance(this, hostRef);
23
- this.isError = false;
24
- this.hasPrefix = false;
25
- this.hasSuffix = false;
26
- this.spiedElement = undefined;
27
- }
28
- componentWillLoad() {
29
- this.hasSuffix = this.el.querySelector('wcs-button') !== null;
30
- this.hasPrefix = this.el.querySelector('wcs-select') !== null;
31
- }
32
- componentDidLoad() {
33
- this.initSpiedElement();
34
- this.addRequiredMarkerToLabel();
35
- this.updateErrorStateOnInput(this.isError);
36
- }
37
- isErrorChange(newValue) {
38
- this.updateErrorStateOnInput(newValue);
39
- this.updateAriaAttributes();
40
- }
41
- updateErrorStateOnInput(newValue) {
42
- if (this.spiedElementIsOfType('wcs-input', 'wcs-textarea')) {
43
- if (newValue) {
44
- this.spiedElement.setAttribute('state', 'error');
45
- }
46
- else {
47
- this.spiedElement.setAttribute('state', 'initial');
48
- }
49
- }
50
- }
51
- /**
52
- * This function return true if the form field contains an element with tagName matches a value of the types param
53
- * @param types
54
- * @private
55
- */
56
- spiedElementIsOfType(...types) {
57
- var _a;
58
- for (const type of types) {
59
- if (((_a = this.spiedElement) === null || _a === void 0 ? void 0 : _a.tagName) === type.toUpperCase())
60
- return true;
61
- }
62
- return false;
63
- }
64
- addRequiredMarkerToLabel() {
65
- var _a;
66
- // TODO: deprecate this in favor of the 'required' component attribute
67
- const label = this.el.querySelector('wcs-label');
68
- this.observer = new MutationObserver(mutations => {
69
- var _a;
70
- const requiredAttMutation = mutations.filter(m => m.attributeName === 'required')[0];
71
- if (requiredAttMutation) {
72
- this.updateLabelRequiredFlag((_a = this.spiedElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('required'), label);
73
- }
74
- });
75
- if (this.spiedElement) {
76
- this.observer.observe(this.spiedElement, { attributes: true });
77
- }
78
- const isRequired = (_a = this.spiedElement) === null || _a === void 0 ? void 0 : _a.hasAttribute('required');
79
- this.updateLabelRequiredFlag(isRequired, label);
80
- }
81
- initSpiedElement() {
82
- var _a, _b;
83
- const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-native-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox', 'wcs-native-select', 'wcs-counter'];
84
- this.spiedElement = (_a = this.el.shadowRoot.querySelector('slot:not([name])')) === null || _a === void 0 ? void 0 : _a.assignedElements().filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];
85
- // If the component is used in another web component
86
- if (((_b = this.spiedElement) === null || _b === void 0 ? void 0 : _b.tagName) === 'SLOT') {
87
- this.spiedElement = (this.spiedElement
88
- .assignedElements()
89
- .filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]);
90
- }
91
- if (!this.spiedElement) {
92
- // tslint:disable-next-line:no-console
93
- console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');
94
- return;
95
- }
96
- }
97
- updateAriaAttributes() {
98
- if (isMutableAriaAttribute(this.spiedElement)) {
99
- this.spiedElement.setAriaAttribute('aria-label', this.label);
100
- // Sur les autres DS, généralement seul l'erreur est affichée et pas avec la description
101
- if (this.isError) {
102
- if (this.error)
103
- this.spiedElement.setAriaAttribute('aria-description', this.error);
104
- this.spiedElement.setAriaAttribute('aria-invalid', 'true');
105
- }
106
- else {
107
- if (this.description)
108
- this.spiedElement.setAriaAttribute('aria-description', this.description);
109
- this.spiedElement.setAriaAttribute('aria-invalid', 'false');
110
- }
111
- }
112
- }
113
- get label() {
114
- var _a;
115
- return (_a = this.el.querySelector('wcs-label')) === null || _a === void 0 ? void 0 : _a.textContent;
116
- }
117
- get description() {
118
- var _a;
119
- return (_a = this.el.querySelector('wcs-hint')) === null || _a === void 0 ? void 0 : _a.textContent;
120
- }
121
- get error() {
122
- var _a;
123
- return (_a = this.el.querySelector('wcs-error')) === null || _a === void 0 ? void 0 : _a.textContent;
124
- }
125
- updateLabelRequiredFlag(isRequired, label) {
126
- if (isRequired && label) {
127
- label.setAttribute('required', 'true');
128
- }
129
- else if (!isRequired && label) {
130
- label.removeAttribute('required');
131
- }
132
- }
133
- disconnectedCallback() {
134
- var _a;
135
- (_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
136
- }
137
- render() {
138
- let classes = '';
139
- const isError = this.isError;
140
- if (this.hasSuffix) {
141
- classes += ' has-suffix';
142
- }
143
- if (this.hasPrefix) {
144
- classes += ' has-prefix';
145
- }
146
- return (h(Host, { key: 'c9f7040c27e964d32f5d39befad34fd2500ad89b', class: classes }, h("slot", { key: '580960c53f66356e3e8a67436603f3d5d0828409', name: "label" }), h("div", { key: '9f942bf24140c7c3718d4e56b5c356e4471c246b', class: "input-container" }, h("slot", { key: '03ac6862d220be32e3c62d6fa6b49d745f77f1f8', name: "prefix" }), h("slot", { key: '476c0419a0269dde5d3b89b025f475c54fa7a1f4', onSlotchange: () => this.onFormInputSlotChange() }), h("slot", { key: '63e76f50c004442ad27dbdf87c59fdb574a24352', name: "suffix" })), isError ? (h("slot", { name: "error" })) : '', h("slot", { key: 'd6dd0c622edbaf25c38844f62e46efefb462d616', name: "messages" })));
147
- }
148
- onFormInputSlotChange() {
149
- this.initSpiedElement();
150
- this.updateAriaAttributes();
151
- this.addRequiredMarkerToLabel();
152
- this.updateErrorStateOnInput(this.isError);
153
- }
154
- get el() { return getElement(this); }
155
- static get watchers() { return {
156
- "isError": ["isErrorChange"]
157
- }; }
158
- };
159
- FormField.style = WcsFormFieldStyle0;
160
-
161
- export { Label as wcs_error, FormField as wcs_form_field };
162
-
163
- //# sourceMappingURL=wcs-error_2.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"wcs-error.wcs-form-field.entry.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,wSAAwS,CAAC;AAC1T,uBAAe,QAAQ;;MCoBV,KAAK;;;;IACd,MAAM;QACF,QACI,EAAC,IAAI,kEAAW,QAAQ,iBAAa,MAAM,EAAC,IAAI,EAAC,OAAO,IACpD,8DAAQ,CACL,EACT;KACL;;;;AC5BL,MAAM,YAAY,GAAG,qzHAAqzH,CAAC;AAC30H,2BAAe,YAAY;;MCqDd,SAAS;;;uBAM8B,KAAK;yBAExB,KAAK;yBACL,KAAK;;;IAKlC,iBAAiB;QACb,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAAY,CAAC,KAAK,IAAI,CAAC;QAC9D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,YAA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SAC1C;aAAM,IAAI,CAAC,UAAU,IAAI,KAAK,EAAE;YAC7B,KAAK,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC;SACrC;KACJ;IAED,oBAAoB;;QAChB,MAAA,IAAI,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAC;KAC/B;IAED,MAAM;QACF,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAE7B,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,OAAO,IAAI,aAAa,CAAC;SAC5B;QACD,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,OAAO,IAAI,aAAa,CAAC;SAC5B;QACD,QACI,EAAC,IAAI,qDAAC,KAAK,EAAE,OAAO,IAChB,6DAAM,IAAI,EAAC,OAAO,GAAE,EACpB,4DAAK,KAAK,EAAC,iBAAiB,IACxB,6DAAM,IAAI,EAAC,QAAQ,GAAE,EACrB,6DAAM,YAAY,EAAE,MAAM,IAAI,CAAC,qBAAqB,EAAE,GAAG,EACzD,6DAAM,IAAI,EAAC,QAAQ,GAAE,CACnB,EAEF,OAAO,IAAI,YAAM,IAAI,EAAC,OAAO,GAAE,IAAI,EAAE,EAEzC,6DAAM,IAAI,EAAC,UAAU,GAAE,CACpB,EACT;KACL;IAEO,qBAAqB;QACzB,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC3B,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAChC,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAC9C;;;;;;;;;;","names":[],"sources":["src/components/error/error.scss?tag=wcs-error&encapsulation=shadow","src/components/error/error.tsx","src/components/form-field/form-field.scss?tag=wcs-form-field&encapsulation=shadow","src/components/form-field/form-field.tsx"],"sourcesContent":[":host {\n --wcs-error-color: var(--wcs-semantic-color-text-critical);\n --wcs-error-font-size: var(--wcs-semantic-font-size-caption-2);\n --wcs-error-font-weight: var(--wcs-semantic-font-weight-book);\n\n color: var(--wcs-error-color);\n font-size: var(--wcs-error-font-size);\n font-weight: var(--wcs-error-font-weight);\n}\n","import { Component, ComponentInterface, h, Host } from '@stencil/core';\n\n/**\n * The `wcs-error` should always be wrapped in a `wcs-form-field`.\n * It is used to display a red message under the field indicating an incorrect user input.\n * \n * ## Accessibility guidelines 💡\n * - Provide a relevant error message to inform the users what they should change to make the field valid\n * - Always add the error icon, to ensure the visual indication of the error state other than the color\n * - `aria-description` will be automatically added to the field for screen readers\n * - `aria-invalid=\"true\"` will be automatically added to the field for screen readers\n * \n * @cssprop --wcs-error-color - Color of the text\n * @cssprop --wcs-error-font-size - Font size\n * @cssprop --wcs-error-font-weight - Font weight\n */\n@Component({\n tag: 'wcs-error',\n styleUrl: 'error.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface {\n render() {\n return (\n <Host aria-live=\"polite\" aria-atomic=\"true\" slot=\"error\">\n <slot />\n </Host>\n );\n }\n}\n",":host {\n --wcs-form-field-gap: var(--wcs-semantic-spacing-small);\n\n --wcs-form-field-prefix-suffix-border-radius: var(--wcs-semantic-border-radius-base);\n\n --wcs-form-field-prefix-icon-color: var(--wcs-semantic-color-foreground-primary);\n --wcs-form-field-prefix-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-form-field-prefix-placeholder-color: var(--wcs-semantic-color-text-inverse);\n\n // Prefixed select\n ::slotted([slot=prefix]) {\n --wcs-select-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-select-placeholder-color: var(--wcs-semantic-color-text-inverse);\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-default);\n --wcs-select-control-arrow-color: var(--wcs-form-field-prefix-icon-color);\n --wcs-select-control-border-radius: var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);\n --wcs-select-control-border-width-default: 0;\n --wcs-select-control-border-style-focus: dashed;\n --wcs-select-control-border-color-focus: var(--wcs-semantic-color-border-focus-base);\n\n --wcs-native-select-value-color: var(--wcs-semantic-color-text-inverse);\n --wcs-native-select-placeholder-color: var(--wcs-semantic-color-text-inverse);\n --wcs-native-select-arrow-color: var(--wcs-form-field-prefix-icon-color);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-default);\n --wcs-native-select-border-width: 0;\n --wcs-native-select-border-color-focus: var(--wcs-semantic-color-border-focus-base);\n --wcs-native-select-border-style-focus: dashed;\n --wcs-native-select-border-radius: var(--wcs-form-field-prefix-suffix-border-radius) 0 0 var(--wcs-form-field-prefix-suffix-border-radius);\n --wcs-native-select-option-color: var(--wcs-semantic-color-text-inverse);\n }\n\n ::slotted([slot=prefix][disabled]),\n ::slotted([slot=prefix]:disabled),\n ::slotted([slot=prefix][aria-disabled=true]),\n ::slotted([slot=prefix][data-disabled]) {\n --wcs-semantic-color-background-control-disabled: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-semantic-color-text-disabled: var(--wcs-semantic-color-foreground-disabled);\n\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-select-value-color: var(--wcs-semantic-color-text-disabled);\n --wcs-select-placeholder-color: var(--wcs-semantic-color-text-disabled);\n\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-disabled);\n --wcs-native-select-placeholder-color: var(--wcs-semantic-color-text-disabled);\n --wcs-native-select-value-color: var(--wcs-semantic-color-text-disabled);\n }\n\n ::slotted([slot=prefix]:hover:not([disabled]):not([data-disabled])) {\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-hover);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-hover);\n }\n\n ::slotted([slot=prefix]:active:not([disabled]):not([data-disabled])) {\n --wcs-select-control-background-color: var(--wcs-semantic-color-background-action-primary-press);\n --wcs-native-select-background-color: var(--wcs-semantic-color-background-action-primary-press);\n }\n // endregion\n\n display: flex;\n flex-direction: column;\n gap: var(--wcs-form-field-gap);\n}\n\n.input-container {\n display: flex;\n}\n\n::slotted(wcs-select:not([slot=prefix])) {\n width: 100%;\n}\n\n::slotted(wcs-native-select:not([slot=prefix])) {\n width: 100%;\n}\n\n// Make input square on left side if there is a prefix\n:host(.has-prefix) {\n ::slotted(wcs-input) {\n --wcs-input-border-radius-left: 0;\n }\n}\n\n// Make input square on right side if there is a suffix\n:host(.has-suffix) {\n ::slotted(wcs-input) {\n --wcs-input-border-radius-right: 0;\n }\n}\n\n::slotted([slot=suffix]) {\n // Make button square on left side\n --wcs-button-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;\n\n // Make select square on left side\n --wcs-select-control-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0 ;\n\n // Make native select square on left side\n --wcs-native-select-border-radius: 0 var(--wcs-form-field-prefix-suffix-border-radius) var(--wcs-form-field-prefix-suffix-border-radius) 0;\n}\n","import { Component, ComponentInterface, Element, h, Host, Prop, State, Watch } from '@stencil/core';\nimport { isMutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\n\n/**\n * Form field component wraps the native input element and add some more functionality on top of it.\n *\n * You can use the `wcs-form-field` to wrap any of these components :\n * - `wcs-input`\n * - `wcs-textarea`\n * - `wcs-radio-group`\n * - `wcs-switch`\n * - `wcs-checkbox`\n * - `wcs-native-select`\n * - `wcs-select`\n * - `wcs-counter`\n *\n * For non-supported slotted component, you can use the `required` attribute on the wrapped component to tell the\n * form-field that it is required. It will add a red star after the label of the form field.\n * \n * ## Accessibility guidelines 💡\n * - Each form control should be identified with a unique `wcs-label`\n * - Don't forget to add form validation to make sure the data is correctly formatted\n * - If the `wcs-label` is required, the form control must have the `required` HTML attribute and vice-versa (this is normally automatically set)\n * - The form should not be submittable if at least one required form control is not filled\n * - Hints are optional and should only be used to add extra information\n * - Additional aria attributes put on `<wcs-form-field>` won't inherit onto the native component : you must use the `setAriaAttribute` method.\n * \n * @slot label - Automatically filled when a `wcs-label` is provided\n * @slot <no-name> - The main slot containing the wrapped component\n * @slot prefix - (Optional) Display a component as prefix. See \"Prefix Suffix Group\" story for more info.\n * @slot suffix - (Optional) Display a component as suffix. See \"Prefix Suffix Group\" story for more info.\n * @slot error - Automatically filled when a `wcs-error` is provided\n * @slot messages - Automatically filled when a `wcs-hint` is provided\n *\n * @cssprop --wcs-form-field-gap - Defines the spacing between the label, input control, and hint messages.\n * @cssprop --wcs-form-field-prefix-suffix-border-radius - Sets the border radius for both prefix and suffix elements.\n * \n * @cssprop --wcs-form-field-prefix-background-color-default - Background color default for prefix elements\n * @cssprop --wcs-form-field-prefix-background-color-disabled - Background color for prefix elements when disabled\n * @cssprop --wcs-form-field-prefix-background-color-hover - Background color for prefix elements when hovered\n * @cssprop --wcs-form-field-prefix-border-color-default - Defines the default border color for prefix\n * @cssprop --wcs-form-field-prefix-border-color-focus - Sets the border color for prefix elements when focused.\n * @cssprop --wcs-form-field-prefix-border-color-disabled - Determines the border color for prefix elements when disabled.\n * \n * @cssprop --wcs-form-field-prefix-icon-color - Specifies the color of icons within prefix elements.\n * @cssprop --wcs-form-field-prefix-value-color - Sets the color of values within prefix elements.\n * @cssprop --wcs-form-field-prefix-placeholder-color - Defines the placeholder text color within prefix elements.\n * @cssprop --wcs-form-field-prefix-color-disabled - Determines the text color for prefix elements when disabled.\n */\n@Component({\n tag: 'wcs-form-field',\n styleUrl: 'form-field.scss',\n shadow: true,\n})\nexport class FormField implements ComponentInterface {\n @Element() private el!: HTMLWcsFormFieldElement;\n\n /**\n * Specifies whether the form field is in an error state. Displays the field border in red and the message contained in the wcs-error component\n */\n @Prop({mutable: true, reflect: true}) isError = false;\n\n @State() private hasPrefix = false;\n @State() private hasSuffix = false;\n @State() private spiedElement: Element;\n\n private observer: MutationObserver;\n\n componentWillLoad() {\n this.hasSuffix = this.el.querySelector('wcs-button') !== null;\n this.hasPrefix = this.el.querySelector('wcs-select') !== null;\n }\n\n componentDidLoad() {\n this.initSpiedElement();\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n\n @Watch('isError')\n // @ts-ignore\n private isErrorChange(newValue: boolean) {\n this.updateErrorStateOnInput(newValue);\n this.updateAriaAttributes();\n }\n\n private updateErrorStateOnInput(newValue: boolean) {\n if (this.spiedElementIsOfType('wcs-input', 'wcs-textarea')) {\n if (newValue) {\n this.spiedElement.setAttribute('state', 'error');\n } else {\n this.spiedElement.setAttribute('state', 'initial');\n }\n }\n }\n\n /**\n * This function return true if the form field contains an element with tagName matches a value of the types param\n * @param types\n * @private\n */\n private spiedElementIsOfType(...types: string[]): boolean {\n for (const type of types) {\n if (this.spiedElement?.tagName === type.toUpperCase()) return true;\n }\n return false\n }\n\n\n private addRequiredMarkerToLabel() {\n // TODO: deprecate this in favor of the 'required' component attribute\n const label = this.el.querySelector('wcs-label');\n this.observer = new MutationObserver(mutations => {\n const requiredAttMutation = mutations.filter(m => m.attributeName === 'required')[0];\n if (requiredAttMutation) {\n this.updateLabelRequiredFlag(this.spiedElement?.hasAttribute('required'), label);\n }\n });\n if (this.spiedElement) {\n this.observer.observe(this.spiedElement, {attributes: true});\n }\n\n const isRequired = this.spiedElement?.hasAttribute('required');\n this.updateLabelRequiredFlag(isRequired, label);\n }\n\n\n private initSpiedElement() {\n const SUPPORTED_COMPONENTS = ['wcs-input', 'wcs-select', 'wcs-native-select', 'wcs-textarea', 'wcs-radio-group', 'wcs-switch', 'wcs-checkbox', 'wcs-native-select', 'wcs-counter'];\n\n this.spiedElement = (this.el.shadowRoot.querySelector('slot:not([name])') as HTMLSlotElement)\n ?.assignedElements()\n .filter(n => [...SUPPORTED_COMPONENTS, 'SLOT'].map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0];\n\n // If the component is used in another web component\n if (this.spiedElement?.tagName === 'SLOT') {\n this.spiedElement = ((this.spiedElement as HTMLSlotElement)\n .assignedElements()\n .filter(n => SUPPORTED_COMPONENTS.map(x => x.toUpperCase()).indexOf(n.nodeName) !== -1)[0]) as HTMLElement;\n }\n\n if (!this.spiedElement) {\n // tslint:disable-next-line:no-console\n console.warn('Form-field component support only ' + SUPPORTED_COMPONENTS.toString() + '. Some features may not work with the provided component.');\n return;\n }\n }\n \n private updateAriaAttributes(): void {\n if(isMutableAriaAttribute(this.spiedElement)) {\n this.spiedElement.setAriaAttribute('aria-label', this.label);\n\n // Sur les autres DS, généralement seul l'erreur est affichée et pas avec la description\n if(this.isError) {\n if(this.error) this.spiedElement.setAriaAttribute('aria-description', this.error);\n this.spiedElement.setAriaAttribute('aria-invalid', 'true');\n } else {\n if(this.description) this.spiedElement.setAriaAttribute('aria-description', this.description);\n this.spiedElement.setAriaAttribute('aria-invalid', 'false');\n }\n }\n }\n \n private get label() {\n return this.el.querySelector('wcs-label')?.textContent;\n }\n \n private get description() {\n return this.el.querySelector('wcs-hint')?.textContent;\n }\n \n private get error() {\n return this.el.querySelector('wcs-error')?.textContent;\n }\n\n private updateLabelRequiredFlag(isRequired: boolean, label: Element) {\n if (isRequired && label) {\n label.setAttribute('required', 'true');\n } else if (!isRequired && label) {\n label.removeAttribute('required');\n }\n }\n\n disconnectedCallback() {\n this.observer?.disconnect();\n }\n\n render() {\n let classes = '';\n const isError = this.isError;\n\n if (this.hasSuffix) {\n classes += ' has-suffix';\n }\n if (this.hasPrefix) {\n classes += ' has-prefix';\n }\n return (\n <Host class={classes}>\n <slot name=\"label\"/>\n <div class=\"input-container\">\n <slot name=\"prefix\"/>\n <slot onSlotchange={() => this.onFormInputSlotChange()}/>\n <slot name=\"suffix\"/>\n </div>\n {\n isError ? (<slot name=\"error\"/>) : ''\n }\n <slot name=\"messages\"/>\n </Host>\n );\n }\n\n private onFormInputSlotChange() {\n this.initSpiedElement();\n this.updateAriaAttributes()\n this.addRequiredMarkerToLabel();\n this.updateErrorStateOnInput(this.isError);\n }\n}\n"],"version":3}
@@ -1,29 +0,0 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-d9de61ce.js';
2
- import { i as inheritAriaAttributes, a as inheritAttributes, s as setOrRemoveAttribute } from './helpers-f137ec8d.js';
3
-
4
- const labelCss = ":host{--wcs-label-font-weight:var(--wcs-semantic-font-weight-book);--wcs-label-color:var(--wcs-semantic-color-text-primary);--wcs-label-required-marker-color:var(--wcs-semantic-color-text-critical);--wcs-label-gap:var(--wcs-semantic-spacing-small);font-weight:var(--wcs-label-font-weight)}:host([required])>label::after{font-weight:var(--wcs-label-font-weight);color:var(--wcs-label-required-marker-color);content:\" *\"}label{display:inline-block;color:var(--wcs-label-color);font-weight:var(--wcs-label-font-weight)}label ::slotted(wcs-mat-icon){display:inline;vertical-align:middle;margin-left:var(--wcs-label-gap)}";
5
- const WcsLabelStyle0 = labelCss;
6
-
7
- const LABEL_INHERITED_ATTRS = ['title'];
8
- const Label = class {
9
- constructor(hostRef) {
10
- registerInstance(this, hostRef);
11
- this.inheritedAttributes = {};
12
- this.required = false;
13
- }
14
- componentWillLoad() {
15
- this.inheritedAttributes = Object.assign(Object.assign({}, inheritAriaAttributes(this.el)), inheritAttributes(this.el, LABEL_INHERITED_ATTRS));
16
- }
17
- async setAriaAttribute(attr, value) {
18
- setOrRemoveAttribute(this.nativeLabel, attr, value);
19
- }
20
- render() {
21
- return (h(Host, { key: '112bfe1eddc6da7b457bf183c83a07a60de0ca00', slot: "label" }, h("label", Object.assign({ key: '0d32dfcc8b4f024f986d7770a52402ae024c8862', ref: (el) => this.nativeLabel = el }, this.inheritedAttributes), h("slot", { key: '74c93cbd04d6744c2427f4810d510f05faa2bbfc' }))));
22
- }
23
- get el() { return getElement(this); }
24
- };
25
- Label.style = WcsLabelStyle0;
26
-
27
- export { Label as wcs_label };
28
-
29
- //# sourceMappingURL=wcs-label.entry.js.map
@@ -1 +0,0 @@
1
- {"file":"wcs-label.entry.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,4mBAA4mB,CAAC;AAC9nB,uBAAe,QAAQ;;ACGvB,MAAM,qBAAqB,GAAG,CAAC,OAAO,CAAC,CAAC;MAsB3B,KAAK;;;QAGN,wBAAmB,GAAyB,EAAE,CAAC;wBAMnB,KAAK;;IAEzC,iBAAiB;QACb,IAAI,CAAC,mBAAmB,mCACjB,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC,GAC9B,iBAAiB,CAAC,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC,CACvD,CAAC;KACL;IAGD,MAAM,gBAAgB,CAAC,IAAuB,EAAE,KAAgC;QAC5E,oBAAoB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;KACvD;IAED,MAAM;QACF,QACI,EAAC,IAAI,qDAAC,IAAI,EAAC,OAAO,IACd,4EAAO,GAAG,EAAE,CAAC,EAAE,KAAK,IAAI,CAAC,WAAW,GAAG,EAAE,IAAM,IAAI,CAAC,mBAAmB,GACnE,8DAAQ,CACJ,CACL,EACT;KACL;;;;;;;","names":[],"sources":["src/components/label/label.scss?tag=wcs-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":[":host {\n --wcs-label-font-weight: var(--wcs-semantic-font-weight-book);\n --wcs-label-color: var(--wcs-semantic-color-text-primary);\n --wcs-label-required-marker-color: var(--wcs-semantic-color-text-critical);\n\n --wcs-label-gap: var(--wcs-semantic-spacing-small);\n\n font-weight: var(--wcs-label-font-weight);\n}\n\n:host([required]) > label::after {\n font-weight: var(--wcs-label-font-weight);\n color: var(--wcs-label-required-marker-color);\n content: ' *';\n}\n\nlabel {\n display: inline-block;\n color: var(--wcs-label-color);\n font-weight: var(--wcs-label-font-weight);\n\n // Add margin before tooltip icon\n ::slotted(wcs-mat-icon) {\n display: inline;\n vertical-align: middle;\n margin-left: var(--wcs-label-gap);\n }\n}\n","import { Component, ComponentInterface, h, Host, Method, Prop, Element } from '@stencil/core';\nimport { AriaAttributeName, MutableAriaAttribute } from \"../../utils/mutable-aria-attribute\";\nimport { inheritAriaAttributes, inheritAttributes, setOrRemoveAttribute } from \"../../utils/helpers\";\n\nconst LABEL_INHERITED_ATTRS = ['title'];\n\n/**\n * The `wcs-label` should always be wrapped in a `wcs-form-field`.\n * It is used to caption a form control component.\n *\n * ## Accessibility guidelines 💡\n * - Use concise name for the label. If you want to describe more your form control, add a `wcs-hint`\n * - Use the required flag only as an indication to inform users that the form control is required\n * \n * @cssprop --wcs-label-color - Color of the text\n * @cssprop --wcs-label-font-weight - Font weight of the text\n * \n * @cssprop --wcs-label-required-marker-color - Color of the required marker\n * \n * @cssprop --wcs-label-gap - Gap between text and required marker\n */\n@Component({\n tag: 'wcs-label',\n styleUrl: 'label.scss',\n shadow: true,\n})\nexport class Label implements ComponentInterface, MutableAriaAttribute {\n @Element() private el!: HTMLElement;\n private nativeLabel?: HTMLLabelElement;\n private inheritedAttributes: { [k: string]: any } = {};\n \n /**\n * If `true`, marks the label with a red star.\n * Automatically added if the wrapped component inside the `wcs-form-field` already has the `required` attribute. \n */\n @Prop({ reflect: true }) required = false;\n\n componentWillLoad() {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.el),\n ...inheritAttributes(this.el, LABEL_INHERITED_ATTRS),\n };\n }\n\n @Method()\n async setAriaAttribute(attr: AriaAttributeName, value: string | null | undefined) {\n setOrRemoveAttribute(this.nativeLabel, attr, value);\n }\n\n render() {\n return (\n <Host slot=\"label\">\n <label ref={(el) => this.nativeLabel = el} {...this.inheritedAttributes}>\n <slot />\n </label>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,2 +0,0 @@
1
- import{r as a,c as t,h as s,H as o,g as e}from"./p-32e583ea.js";import{i,a as c}from"./p-fb2751c2.js";import{i as d,a as l,s as r,n}from"./p-a3aece7a.js";const h="wcs-modal{--wcs-modal-backdrop-color:var(--wcs-semantic-color-background-backdrop);--wcs-modal-max-height:80%;--wcs-modal-background-color:var(--wcs-semantic-color-background-surface-primary);--wcs-modal-border-radius:var(--wcs-semantic-border-radius-base);--wcs-modal-padding:calc(3 * var(--wcs-semantic-spacing-base));--wcs-modal-border-width:var(--wcs-semantic-border-width-default);--wcs-modal-border-color:var(--wcs-semantic-color-border-secondary);--wcs-modal-title-margin-bottom:var(--wcs-semantic-spacing-large);--wcs-modal-title-font-size:var(--wcs-semantic-font-size-heading-4);--wcs-modal-title-font-weight:var(--wcs-semantic-font-weight-heavy);--wcs-modal-title-line-height:var(--wcs-semantic-font-line-height-medium);--wcs-modal-actions-margin-top:var(--wcs-semantic-spacing-large);--wcs-modal-width-s:288px;--wcs-modal-width-m:480px;--wcs-modal-width-l:864px;--wcs-modal-width-xl:1200px;z-index:999;position:fixed;top:0;bottom:0;left:0;right:0;display:none;background:var(--wcs-modal-backdrop-color)}wcs-modal[show]{display:flex;height:100vh;width:100vw;align-items:center;justify-content:center}wcs-modal[without-backdrop]{background-color:unset}wcs-modal[without-backdrop] .wcs-modal-container{border:solid var(--wcs-modal-border-width) var(--wcs-modal-border-color)}.wcs-modal-container{max-height:var(--wcs-modal-max-height, 80%);background-color:var(--wcs-modal-background-color);display:grid;grid-template-columns:100%;grid-template-rows:auto 1fr auto;box-sizing:border-box;pointer-events:auto;background-clip:padding-box;border-radius:var(--wcs-modal-border-radius);z-index:20000;padding:var(--wcs-modal-padding)}.wcs-modal-container[data-size=s]{width:var(--wcs-modal-width-s)}.wcs-modal-container[data-size=m]{width:var(--wcs-modal-width-m)}.wcs-modal-container[data-size=l]{width:var(--wcs-modal-width-l)}.wcs-modal-container[data-size=xl]{width:var(--wcs-modal-width-xl)}.wcs-modal-header{margin-bottom:var(--wcs-modal-title-margin-bottom);display:flex;align-items:center;justify-content:space-between}.wcs-modal-header h1{font-size:var(--wcs-modal-title-font-size);font-weight:var(--wcs-modal-title-font-weight);line-height:var(--wcs-modal-title-line-height);margin:0}.wcs-modal-content{overflow-y:var(--wcs-modal-overflow-y, auto)}.wcs-modal-actions{margin-top:var(--wcs-modal-actions-margin-top);display:flex;justify-content:flex-end}";const m=h;const w=[];const f=class{constructor(s){a(this,s);this.wcsDialogClosed=t(this,"wcsDialogClosed",7);this.inheritedAttributes={};this.modalId=b++;this.showAttributeChangedMarker=false;this.hasBeenClosedBefore=false;this.withoutBackdrop=false;this.show=false;this.showCloseButton=false;this.closeButtonAriaLabel="Fermer";this.size="m";this.hideActions=false;this.modalTriggerControlsId=undefined}componentWillLoad(){if(!this.modalTriggerControlsId){console.warn("wcs-modal: You must provide the modal-trigger-controls-id attribute to the modal to make it to work properly")}this.inheritedAttributes=Object.assign(Object.assign({},d(this.el)),l(this.el,w))}componentDidLoad(){this.updateFocusableElements()}componentDidRender(){var a;this.updateFocusableElements();if(this.showAttributeChangedMarker){this.showAttributeChangedMarker=false;(a=this.firstFocusableElement)===null||a===void 0?void 0:a.focus()}}async setAriaAttribute(a,t){r(this.nativeDivDialog,a,t)}onShowChange(){if(this.show){this.hasBeenClosedBefore=false;this.showAttributeChangedMarker=true}else{if(this.hasBeenClosedBefore){return}this.hasBeenClosedBefore=true;if(this.modalTriggerControlsId){const a=document.getElementById(this.modalTriggerControlsId);if(!a){console.warn(`wcs-modal: Element with id '${this.modalTriggerControlsId}' could not be found`)}a===null||a===void 0?void 0:a.focus()}}}updateFocusableElements(){const a=Array.from(this.el.querySelectorAll("*")).filter((a=>i(a)));this.firstFocusableElement=a.length>0&&a[0];this.lastFocusableElement=a.length>0&&a[a.length-1]}close(){if(this.show){this.show=false;this.wcsDialogClosed.emit()}}onKeyDown(a){if(this.show&&this.showCloseButton&&a.key==="Escape"){this.close()}if(this.show){if(n(a)){this.updateFocusableElements();const t=this.firstFocusableElement;const s=this.lastFocusableElement;if(a.shiftKey&&c(t)){a.preventDefault();s.focus()}else if(!a.shiftKey&&c(s)){a.preventDefault();t.focus()}}}}onCloseButtonClick(a){this.close()}handleSlotContentChange(){this.updateFocusableElements()}render(){const a=`wcs-modal-title-${this.modalId}`;return s(o,{key:"788a5cedac43a4d1852b4023f8600db0042845f0"},s("div",Object.assign({key:"c55ba8369740a1ec9b818c0107500f93510aded1",class:"wcs-modal-container","data-size":this.size,"aria-modal":true,role:"dialog","aria-labelledby":a,ref:a=>this.nativeDivDialog=a},this.inheritedAttributes),s("div",{key:"6f869f59b47b274c5dc0e0e759681fff626be7c1",class:"wcs-modal-header"},s("h1",{key:"572be535d3479f26678cb54fd4937563021bfac5",id:a},s("slot",{key:"f159aa7451f735f9e0f43c8005c64eab5dee00f5",name:"header"})),this.showCloseButton&&s("wcs-button",{key:"d39b4182b6e5e1b41b6664cfccac9f1022ad9d8f",shape:"round",mode:"clear",id:"wcs-modal-close-button","aria-label":this.closeButtonAriaLabel,onClick:a=>this.onCloseButtonClick(a)},s("wcs-mat-icon",{key:"83a8991df30b15f89485d4445d2e4d01f937e321",icon:"close"}))),s("div",{key:"fe83c50300c4a591ae36f9902fba434138c24beb",class:"wcs-modal-content"},s("slot",{key:"5b18bfc38086089afcf0f4c60094ef5be0b603b7",onSlotchange:()=>this.handleSlotContentChange()})),!this.hideActions&&s("div",{key:"0d3814339cb5c072c3fa6566c2114d8402977b47",class:"wcs-modal-actions"},s("slot",{key:"de8e11419a0507da6338040d6506abeee851aef5",name:"actions"}))))}get el(){return e(this)}static get watchers(){return{show:["onShowChange"]}}};let b=0;f.style=m;export{f as wcs_modal};
2
- //# sourceMappingURL=p-08e86d69.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["modalCss","WcsModalStyle0","MODAL_INHERITED_ATTRS","Modal","this","inheritedAttributes","modalId","modalIds","showAttributeChangedMarker","hasBeenClosedBefore","componentWillLoad","modalTriggerControlsId","console","warn","Object","assign","inheritAriaAttributes","el","inheritAttributes","componentDidLoad","updateFocusableElements","componentDidRender","_a","firstFocusableElement","focus","setAriaAttribute","attr","value","setOrRemoveAttribute","nativeDivDialog","onShowChange","show","modalTriggerControlsHtmlElement","document","getElementById","focusableElements","Array","from","querySelectorAll","filter","element","isFocusable","length","lastFocusableElement","close","wcsDialogClosed","emit","onKeyDown","event","showCloseButton","key","isTabKey","firstElement","lastElement","shiftKey","isElementFocused","preventDefault","onCloseButtonClick","_","handleSlotContentChange","render","modalTitleId","h","Host","class","size","role","ref","id","name","shape","mode","closeButtonAriaLabel","onClick","$event","icon","onSlotchange","hideActions"],"sources":["src/components/modal/modal.scss?tag=wcs-modal","src/components/modal/modal.tsx"],"sourcesContent":["wcs-modal {\n --wcs-modal-backdrop-color: var(--wcs-semantic-color-background-backdrop);\n --wcs-modal-max-height: 80%;\n --wcs-modal-background-color: var(--wcs-semantic-color-background-surface-primary);\n --wcs-modal-border-radius: var(--wcs-semantic-border-radius-base);\n --wcs-modal-padding: calc(3 * var(--wcs-semantic-spacing-base));\n --wcs-modal-border-width: var(--wcs-semantic-border-width-default);\n --wcs-modal-border-color: var(--wcs-semantic-color-border-secondary);\n --wcs-modal-title-margin-bottom: var(--wcs-semantic-spacing-large);\n --wcs-modal-title-font-size: var(--wcs-semantic-font-size-heading-4);\n --wcs-modal-title-font-weight: var(--wcs-semantic-font-weight-heavy);\n --wcs-modal-title-line-height: var(--wcs-semantic-font-line-height-medium);\n --wcs-modal-actions-margin-top: var(--wcs-semantic-spacing-large);\n\n // Specific component level tokens\n --wcs-modal-width-s: 288px;\n --wcs-modal-width-m: 480px;\n --wcs-modal-width-l: 864px;\n --wcs-modal-width-xl: 1200px;\n\n z-index: 999;\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n display: none;\n background: var(--wcs-modal-backdrop-color);\n}\n\nwcs-modal[show] {\n display: flex;\n height: 100vh;\n width: 100vw;\n align-items: center;\n justify-content: center;\n}\n\n/**\nBackdrop\n */\nwcs-modal[without-backdrop] {\n background-color: unset;\n\n .wcs-modal-container {\n border: solid var(--wcs-modal-border-width) var(--wcs-modal-border-color);\n }\n}\n\n/**\nModal window\n */\n.wcs-modal-container {\n max-height: var(--wcs-modal-max-height, 80%);\n background-color: var(--wcs-modal-background-color);\n display: grid;\n grid-template-columns: 100%;\n grid-template-rows: auto 1fr auto;\n box-sizing: border-box;\n pointer-events: auto;\n background-clip: padding-box;\n border-radius: var(--wcs-modal-border-radius);\n z-index: 20000;\n padding: var(--wcs-modal-padding);\n}\n\n.wcs-modal-container[data-size=s] {\n width: var(--wcs-modal-width-s);\n}\n\n.wcs-modal-container[data-size=m] {\n width: var(--wcs-modal-width-m);\n}\n\n.wcs-modal-container[data-size=l] {\n width: var(--wcs-modal-width-l);\n}\n\n.wcs-modal-container[data-size=xl] {\n width: var(--wcs-modal-width-xl);\n}\n\n.wcs-modal-header {\n /* h1 for semantic but h3 for style */\n h1 {\n font-size: var(--wcs-modal-title-font-size);\n font-weight: var(--wcs-modal-title-font-weight);\n line-height: var(--wcs-modal-title-line-height);\n margin: 0;\n }\n\n margin-bottom: var(--wcs-modal-title-margin-bottom);\n display: flex;\n align-items: center;\n justify-content: space-between;\n}\n\n.wcs-modal-content {\n overflow-y: var(--wcs-modal-overflow-y, auto);\n}\n\n.wcs-modal-actions {\n margin-top: var(--wcs-modal-actions-margin-top);\n display: flex;\n justify-content: flex-end;\n}\n","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 * > - 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 /**\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 this.firstFocusableElement?.focus();\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"],"mappings":"0JAAA,MAAMA,EAAW,6zEACjB,MAAAC,EAAeD,ECgBf,MAAME,EAAwB,G,MA4CjBC,EAAK,M,0EAGNC,KAAAC,oBAA4C,GAkD5CD,KAAAE,QAAkBC,IAUlBH,KAAAI,2BAAsC,MAStCJ,KAAAK,oBAA+B,M,qBAhEW,M,UAKI,M,qBAWJ,M,0BAMX,S,UAMb,I,iBAKoB,M,sCAiC9C,iBAAAC,GACI,IAAKN,KAAKO,uBAAwB,CAC9BC,QAAQC,KAAK,+G,CAGjBT,KAAKC,oBAAmBS,OAAAC,OAAAD,OAAAC,OAAA,GACjBC,EAAsBZ,KAAKa,KAC3BC,EAAkBd,KAAKa,GAAIf,G,CAItC,gBAAAiB,GACIf,KAAKgB,yB,CAGT,kBAAAC,G,MACIjB,KAAKgB,0BACL,GAAIhB,KAAKI,2BAA4B,CACjCJ,KAAKI,2BAA6B,OAClCc,EAAAlB,KAAKmB,yBAAqB,MAAAD,SAAA,SAAAA,EAAEE,O,EAKpC,sBAAMC,CAAiBC,EAAyBC,GAC5CC,EAAqBxB,KAAKyB,gBAAiBH,EAAMC,E,CAIrD,YAAAG,GACI,GAAG1B,KAAK2B,KAAM,CACV3B,KAAKK,oBAAsB,MAC3BL,KAAKI,2BAA6B,I,KAC/B,CAEH,GAAGJ,KAAKK,oBAAqB,CACzB,M,CAGJL,KAAKK,oBAAsB,KAE3B,GAAGL,KAAKO,uBAAwB,CAC5B,MAAMqB,EAAkCC,SAASC,eAAe9B,KAAKO,wBACrE,IA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