wcs-core 3.0.0 → 4.0.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 (334) hide show
  1. package/README.md +7 -0
  2. package/dist/cjs/{grid-pagination-ff65e0ff.js → grid-pagination-4b55c908.js} +1 -2
  3. package/dist/cjs/grid-pagination-4b55c908.js.map +1 -0
  4. package/dist/cjs/{helpers-11518d4f.js → helpers-4a14051a.js} +41 -1
  5. package/dist/cjs/helpers-4a14051a.js.map +1 -0
  6. package/dist/cjs/loader.cjs.js +1 -1
  7. package/dist/cjs/wcs-action-bar.cjs.entry.js.map +1 -1
  8. package/dist/cjs/wcs-app.cjs.entry.js +0 -1
  9. package/dist/cjs/wcs-app.cjs.entry.js.map +1 -1
  10. package/dist/cjs/wcs-button.cjs.entry.js +17 -3
  11. package/dist/cjs/wcs-button.cjs.entry.js.map +1 -1
  12. package/dist/cjs/wcs-checkbox.cjs.entry.js +0 -1
  13. package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
  14. package/dist/cjs/wcs-com-nav-category.cjs.entry.js +1 -1
  15. package/dist/cjs/wcs-com-nav-category.cjs.entry.js.map +1 -1
  16. package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +1 -1
  17. package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js.map +1 -1
  18. package/dist/cjs/wcs-com-nav.cjs.entry.js.map +1 -1
  19. package/dist/cjs/wcs-counter.cjs.entry.js +130 -0
  20. package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -0
  21. package/dist/cjs/wcs-dropdown-item.cjs.entry.js +1 -1
  22. package/dist/cjs/wcs-dropdown.cjs.entry.js +1 -1
  23. package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
  24. package/dist/cjs/wcs-editable-field.cjs.entry.js +16 -3
  25. package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
  26. package/dist/cjs/wcs-error_2.cjs.entry.js +1 -1
  27. package/dist/cjs/wcs-error_2.cjs.entry.js.map +1 -1
  28. package/dist/cjs/wcs-field.cjs.entry.js.map +1 -1
  29. package/dist/cjs/wcs-footer.cjs.entry.js.map +1 -1
  30. package/dist/cjs/wcs-galactic-menu.cjs.entry.js +1 -1
  31. package/dist/cjs/wcs-galactic-menu.cjs.entry.js.map +1 -1
  32. package/dist/cjs/wcs-galactic.cjs.entry.js +0 -1
  33. package/dist/cjs/wcs-galactic.cjs.entry.js.map +1 -1
  34. package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
  35. package/dist/cjs/wcs-grid-pagination.cjs.entry.js +1 -1
  36. package/dist/cjs/wcs-grid.cjs.entry.js +1 -1
  37. package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
  38. package/dist/cjs/wcs-header.cjs.entry.js.map +1 -1
  39. package/dist/cjs/wcs-hint.cjs.entry.js +3 -3
  40. package/dist/cjs/wcs-hint.cjs.entry.js.map +1 -1
  41. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +0 -1
  42. package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js.map +1 -1
  43. package/dist/cjs/wcs-input.cjs.entry.js +14 -4
  44. package/dist/cjs/wcs-input.cjs.entry.js.map +1 -1
  45. package/dist/cjs/wcs-native-select.cjs.entry.js +102 -0
  46. package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -0
  47. package/dist/cjs/wcs-nav-item.cjs.entry.js +1 -1
  48. package/dist/cjs/wcs-radio-group.cjs.entry.js.map +1 -1
  49. package/dist/cjs/wcs-radio.cjs.entry.js +3 -3
  50. package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
  51. package/dist/cjs/wcs-select_2.cjs.entry.js +229 -72
  52. package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
  53. package/dist/cjs/wcs-switch.cjs.entry.js +0 -1
  54. package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
  55. package/dist/cjs/wcs-tab.cjs.entry.js.map +1 -1
  56. package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
  57. package/dist/cjs/wcs-textarea.cjs.entry.js +5 -3
  58. package/dist/cjs/wcs-textarea.cjs.entry.js.map +1 -1
  59. package/dist/cjs/wcs-tooltip.cjs.entry.js.map +1 -1
  60. package/dist/cjs/wcs.cjs.js +1 -1
  61. package/dist/collection/collection-manifest.json +2 -0
  62. package/dist/collection/components/action-bar/action-bar.js.map +1 -1
  63. package/dist/collection/components/app/app.js +0 -1
  64. package/dist/collection/components/app/app.js.map +1 -1
  65. package/dist/collection/components/button/button-interface.js +5 -1
  66. package/dist/collection/components/button/button-interface.js.map +1 -1
  67. package/dist/collection/components/button/button.css +28 -20
  68. package/dist/collection/components/button/button.js +54 -5
  69. package/dist/collection/components/button/button.js.map +1 -1
  70. package/dist/collection/components/checkbox/checkbox.js +0 -1
  71. package/dist/collection/components/checkbox/checkbox.js.map +1 -1
  72. package/dist/collection/components/com-nav/com-nav.js.map +1 -1
  73. package/dist/collection/components/com-nav-category/com-nav-category.js.map +1 -1
  74. package/dist/collection/components/com-nav-submenu/com-nav-submenu.js.map +1 -1
  75. package/dist/collection/components/counter/counter-interface.js +6 -0
  76. package/dist/collection/components/counter/counter-interface.js.map +1 -0
  77. package/dist/collection/components/counter/counter.css +93 -0
  78. package/dist/collection/components/counter/counter.js +293 -0
  79. package/dist/collection/components/counter/counter.js.map +1 -0
  80. package/dist/collection/components/dropdown/dropdown.js +1 -1
  81. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  82. package/dist/collection/components/editable-field/editable-field-interface.js +5 -1
  83. package/dist/collection/components/editable-field/editable-field-interface.js.map +1 -1
  84. package/dist/collection/components/editable-field/editable-field.css +21 -6
  85. package/dist/collection/components/editable-field/editable-field.js +33 -2
  86. package/dist/collection/components/editable-field/editable-field.js.map +1 -1
  87. package/dist/collection/components/field/field.js +4 -0
  88. package/dist/collection/components/field/field.js.map +1 -1
  89. package/dist/collection/components/footer/footer.js +5 -0
  90. package/dist/collection/components/footer/footer.js.map +1 -1
  91. package/dist/collection/components/form-field/form-field.js +1 -1
  92. package/dist/collection/components/form-field/form-field.js.map +1 -1
  93. package/dist/collection/components/galactic/galactic.js +0 -1
  94. package/dist/collection/components/galactic/galactic.js.map +1 -1
  95. package/dist/collection/components/galactic-menu/galactic-menu.js.map +1 -1
  96. package/dist/collection/components/grid/grid.js.map +1 -1
  97. package/dist/collection/components/grid-column/grid-column.js.map +1 -1
  98. package/dist/collection/components/grid-pagination/grid-pagination.js +0 -1
  99. package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
  100. package/dist/collection/components/header/header.js +5 -0
  101. package/dist/collection/components/header/header.js.map +1 -1
  102. package/dist/collection/components/hint/hint.js +2 -2
  103. package/dist/collection/components/hint/hint.js.map +1 -1
  104. package/dist/collection/components/horizontal-stepper/horizontal-stepper.js +0 -2
  105. package/dist/collection/components/horizontal-stepper/horizontal-stepper.js.map +1 -1
  106. package/dist/collection/components/input/input-interface.js +5 -1
  107. package/dist/collection/components/input/input-interface.js.map +1 -1
  108. package/dist/collection/components/input/input.css +21 -4
  109. package/dist/collection/components/input/input.js +30 -19
  110. package/dist/collection/components/input/input.js.map +1 -1
  111. package/dist/collection/components/native-select/native-select.component.js +153 -0
  112. package/dist/collection/components/native-select/native-select.component.js.map +1 -0
  113. package/dist/collection/components/native-select/native-select.css +78 -0
  114. package/dist/collection/components/radio/radio.component.js +1 -1
  115. package/dist/collection/components/radio/radio.component.js.map +1 -1
  116. package/dist/collection/components/radio/radio.css +15 -4
  117. package/dist/collection/components/radio-group/radio-group.js.map +1 -1
  118. package/dist/collection/components/select/select-interface.js +5 -1
  119. package/dist/collection/components/select/select-interface.js.map +1 -1
  120. package/dist/collection/components/select/select.css +41 -37
  121. package/dist/collection/components/select/select.js +233 -68
  122. package/dist/collection/components/select/select.js.map +1 -1
  123. package/dist/collection/components/select-option/select-option.css +3 -0
  124. package/dist/collection/components/select-option/select-option.js +25 -3
  125. package/dist/collection/components/select-option/select-option.js.map +1 -1
  126. package/dist/collection/components/switch/switch.js +0 -1
  127. package/dist/collection/components/switch/switch.js.map +1 -1
  128. package/dist/collection/components/tab/tab.js.map +1 -1
  129. package/dist/collection/components/tabs/tabs.js.map +1 -1
  130. package/dist/collection/components/textarea/textarea.css +3 -1
  131. package/dist/collection/components/textarea/textarea.js +23 -1
  132. package/dist/collection/components/textarea/textarea.js.map +1 -1
  133. package/dist/collection/components/tooltip/tooltip.js.map +1 -1
  134. package/dist/collection/index.js +3 -0
  135. package/dist/collection/index.js.map +1 -0
  136. package/dist/collection/shared-types.js +2 -0
  137. package/dist/collection/shared-types.js.map +1 -0
  138. package/dist/collection/utils/helpers.js +30 -0
  139. package/dist/collection/utils/helpers.js.map +1 -1
  140. package/dist/esm/{grid-pagination-62f9fbbc.js → grid-pagination-41354861.js} +2 -3
  141. package/dist/esm/grid-pagination-41354861.js.map +1 -0
  142. package/dist/esm/{helpers-e9b73aad.js → helpers-1f7170dd.js} +32 -2
  143. package/dist/esm/helpers-1f7170dd.js.map +1 -0
  144. package/dist/esm/loader.js +1 -1
  145. package/dist/esm/wcs-action-bar.entry.js.map +1 -1
  146. package/dist/esm/wcs-app.entry.js +1 -2
  147. package/dist/esm/wcs-app.entry.js.map +1 -1
  148. package/dist/esm/wcs-button.entry.js +17 -3
  149. package/dist/esm/wcs-button.entry.js.map +1 -1
  150. package/dist/esm/wcs-checkbox.entry.js +1 -2
  151. package/dist/esm/wcs-checkbox.entry.js.map +1 -1
  152. package/dist/esm/wcs-com-nav-category.entry.js +1 -1
  153. package/dist/esm/wcs-com-nav-category.entry.js.map +1 -1
  154. package/dist/esm/wcs-com-nav-submenu.entry.js +1 -1
  155. package/dist/esm/wcs-com-nav-submenu.entry.js.map +1 -1
  156. package/dist/esm/wcs-com-nav.entry.js.map +1 -1
  157. package/dist/esm/wcs-counter.entry.js +126 -0
  158. package/dist/esm/wcs-counter.entry.js.map +1 -0
  159. package/dist/esm/wcs-dropdown-item.entry.js +1 -1
  160. package/dist/esm/wcs-dropdown.entry.js +1 -1
  161. package/dist/esm/wcs-dropdown.entry.js.map +1 -1
  162. package/dist/esm/wcs-editable-field.entry.js +16 -3
  163. package/dist/esm/wcs-editable-field.entry.js.map +1 -1
  164. package/dist/esm/wcs-error_2.entry.js +1 -1
  165. package/dist/esm/wcs-error_2.entry.js.map +1 -1
  166. package/dist/esm/wcs-field.entry.js.map +1 -1
  167. package/dist/esm/wcs-footer.entry.js.map +1 -1
  168. package/dist/esm/wcs-galactic-menu.entry.js +1 -1
  169. package/dist/esm/wcs-galactic-menu.entry.js.map +1 -1
  170. package/dist/esm/wcs-galactic.entry.js +1 -2
  171. package/dist/esm/wcs-galactic.entry.js.map +1 -1
  172. package/dist/esm/wcs-grid-column.entry.js.map +1 -1
  173. package/dist/esm/wcs-grid-pagination.entry.js +1 -1
  174. package/dist/esm/wcs-grid.entry.js +1 -1
  175. package/dist/esm/wcs-grid.entry.js.map +1 -1
  176. package/dist/esm/wcs-header.entry.js.map +1 -1
  177. package/dist/esm/wcs-hint.entry.js +3 -3
  178. package/dist/esm/wcs-hint.entry.js.map +1 -1
  179. package/dist/esm/wcs-horizontal-stepper.entry.js +0 -1
  180. package/dist/esm/wcs-horizontal-stepper.entry.js.map +1 -1
  181. package/dist/esm/wcs-input.entry.js +14 -4
  182. package/dist/esm/wcs-input.entry.js.map +1 -1
  183. package/dist/esm/wcs-native-select.entry.js +98 -0
  184. package/dist/esm/wcs-native-select.entry.js.map +1 -0
  185. package/dist/esm/wcs-nav-item.entry.js +1 -1
  186. package/dist/esm/wcs-radio-group.entry.js.map +1 -1
  187. package/dist/esm/wcs-radio.entry.js +3 -3
  188. package/dist/esm/wcs-radio.entry.js.map +1 -1
  189. package/dist/esm/wcs-select_2.entry.js +229 -72
  190. package/dist/esm/wcs-select_2.entry.js.map +1 -1
  191. package/dist/esm/wcs-switch.entry.js +1 -2
  192. package/dist/esm/wcs-switch.entry.js.map +1 -1
  193. package/dist/esm/wcs-tab.entry.js.map +1 -1
  194. package/dist/esm/wcs-tabs.entry.js.map +1 -1
  195. package/dist/esm/wcs-textarea.entry.js +5 -3
  196. package/dist/esm/wcs-textarea.entry.js.map +1 -1
  197. package/dist/esm/wcs-tooltip.entry.js.map +1 -1
  198. package/dist/esm/wcs.js +1 -1
  199. package/dist/types/components/action-bar/action-bar.d.ts +2 -2
  200. package/dist/types/components/app/app.d.ts +0 -1
  201. package/dist/types/components/button/button-interface.d.ts +5 -1
  202. package/dist/types/components/button/button.d.ts +16 -7
  203. package/dist/types/components/checkbox/checkbox.d.ts +0 -1
  204. package/dist/types/components/com-nav/com-nav.d.ts +4 -4
  205. package/dist/types/components/com-nav-category/com-nav-category.d.ts +2 -2
  206. package/dist/types/components/com-nav-submenu/com-nav-submenu.d.ts +2 -2
  207. package/dist/types/components/counter/counter-interface.d.ts +7 -0
  208. package/dist/types/components/counter/counter.d.ts +67 -0
  209. package/dist/types/components/dropdown/dropdown.d.ts +2 -2
  210. package/dist/types/components/editable-field/editable-field-interface.d.ts +4 -0
  211. package/dist/types/components/editable-field/editable-field.d.ts +10 -13
  212. package/dist/types/components/field/field.d.ts +4 -0
  213. package/dist/types/components/footer/footer.d.ts +5 -0
  214. package/dist/types/components/form-field/form-field.d.ts +4 -4
  215. package/dist/types/components/galactic/galactic.d.ts +0 -1
  216. package/dist/types/components/galactic-menu/galactic-menu.d.ts +2 -2
  217. package/dist/types/components/grid/grid.d.ts +4 -4
  218. package/dist/types/components/grid-column/grid-column.d.ts +1 -1
  219. package/dist/types/components/grid-pagination/grid-pagination.d.ts +0 -1
  220. package/dist/types/components/header/header.d.ts +5 -0
  221. package/dist/types/components/hint/hint.d.ts +4 -1
  222. package/dist/types/components/horizontal-stepper/horizontal-stepper.d.ts +2 -4
  223. package/dist/types/components/input/input-interface.d.ts +4 -0
  224. package/dist/types/components/input/input.d.ts +8 -8
  225. package/dist/types/components/native-select/native-select.component.d.ts +56 -0
  226. package/dist/types/components/radio/radio.component.d.ts +1 -1
  227. package/dist/types/components/radio-group/radio-group.d.ts +1 -1
  228. package/dist/types/components/select/select-interface.d.ts +4 -0
  229. package/dist/types/components/select/select.d.ts +32 -20
  230. package/dist/types/components/select-option/select-option.d.ts +9 -3
  231. package/dist/types/components/switch/switch.d.ts +0 -1
  232. package/dist/types/components/tabs/tabs.d.ts +3 -3
  233. package/dist/types/components/textarea/textarea.d.ts +10 -2
  234. package/dist/types/components/tooltip/tooltip.d.ts +1 -2
  235. package/dist/types/components.d.ts +242 -22
  236. package/dist/types/index.d.ts +2 -0
  237. package/dist/types/shared-types.d.ts +10 -0
  238. package/dist/types/utils/helpers.d.ts +10 -0
  239. package/dist/wcs/p-029eb12a.entry.js +2 -0
  240. package/dist/wcs/p-029eb12a.entry.js.map +1 -0
  241. package/dist/wcs/p-069555a1.entry.js.map +1 -1
  242. package/dist/wcs/p-07b8cd36.entry.js.map +1 -1
  243. package/dist/wcs/p-12ac2547.js +2 -0
  244. package/dist/wcs/p-12ac2547.js.map +1 -0
  245. package/dist/wcs/p-1e43122f.entry.js.map +1 -1
  246. package/dist/wcs/p-26c4c983.entry.js +2 -0
  247. package/dist/wcs/p-26c4c983.entry.js.map +1 -0
  248. package/dist/wcs/p-26e7de5c.entry.js +16 -0
  249. package/dist/wcs/p-26e7de5c.entry.js.map +1 -0
  250. package/dist/wcs/p-31a8d23f.entry.js +2 -0
  251. package/dist/wcs/{p-d11c66d4.entry.js.map → p-31a8d23f.entry.js.map} +1 -1
  252. package/dist/wcs/p-463667c9.entry.js +2 -0
  253. package/dist/wcs/p-475ac7c5.js +2 -0
  254. package/dist/wcs/p-475ac7c5.js.map +1 -0
  255. package/dist/wcs/p-47d8ece5.entry.js.map +1 -1
  256. package/dist/wcs/p-4a9f8e94.entry.js.map +1 -1
  257. package/dist/wcs/p-4b2d8a6d.entry.js +2 -0
  258. package/dist/wcs/p-4b2d8a6d.entry.js.map +1 -0
  259. package/dist/wcs/{p-c7b42bae.entry.js → p-4b4d53e2.entry.js} +2 -2
  260. package/dist/wcs/p-50dce764.entry.js.map +1 -1
  261. package/dist/wcs/{p-8762cf93.entry.js → p-554ca93c.entry.js} +2 -2
  262. package/dist/wcs/p-627bbb6a.entry.js.map +1 -1
  263. package/dist/wcs/p-64dd7356.entry.js.map +1 -1
  264. package/dist/wcs/p-6acbf38a.entry.js +2 -0
  265. package/dist/wcs/{p-7d7472e2.entry.js.map → p-6acbf38a.entry.js.map} +1 -1
  266. package/dist/wcs/{p-6f921d57.entry.js → p-732b2faa.entry.js} +2 -2
  267. package/dist/wcs/p-732b2faa.entry.js.map +1 -0
  268. package/dist/wcs/{p-587fea23.entry.js → p-966a241e.entry.js} +2 -2
  269. package/dist/wcs/p-966a241e.entry.js.map +1 -0
  270. package/dist/wcs/p-9ecdeaf9.entry.js +2 -0
  271. package/dist/wcs/p-9ecdeaf9.entry.js.map +1 -0
  272. package/dist/wcs/p-a24fa4f4.entry.js +2 -0
  273. package/dist/wcs/p-a24fa4f4.entry.js.map +1 -0
  274. package/dist/wcs/p-a5cd4c07.entry.js +2 -0
  275. package/dist/wcs/{p-8bb19e58.entry.js.map → p-a5cd4c07.entry.js.map} +1 -1
  276. package/dist/wcs/p-b229a91c.entry.js +2 -0
  277. package/dist/wcs/p-b229a91c.entry.js.map +1 -0
  278. package/dist/wcs/{p-d998e112.entry.js → p-b6cd196d.entry.js} +2 -2
  279. package/dist/wcs/{p-d998e112.entry.js.map → p-b6cd196d.entry.js.map} +1 -1
  280. package/dist/wcs/p-b856f2f6.entry.js +2 -0
  281. package/dist/wcs/p-b856f2f6.entry.js.map +1 -0
  282. package/dist/wcs/{p-274232e6.entry.js → p-bcb8b731.entry.js} +2 -2
  283. package/dist/wcs/p-bcb8b731.entry.js.map +1 -0
  284. package/dist/wcs/p-d2da0c9f.entry.js +2 -0
  285. package/dist/wcs/p-d2da0c9f.entry.js.map +1 -0
  286. package/dist/wcs/p-d3f1cafe.entry.js.map +1 -1
  287. package/dist/wcs/p-d6b3f742.entry.js +2 -0
  288. package/dist/wcs/p-d6b3f742.entry.js.map +1 -0
  289. package/dist/wcs/p-ee453b6e.entry.js +2 -0
  290. package/dist/wcs/p-ee453b6e.entry.js.map +1 -0
  291. package/dist/wcs/p-f386bb8b.entry.js.map +1 -1
  292. package/dist/wcs/{p-e4dcd310.entry.js → p-f82e7a61.entry.js} +2 -2
  293. package/dist/wcs/{p-e4dcd310.entry.js.map → p-f82e7a61.entry.js.map} +1 -1
  294. package/dist/wcs/p-fc3f5b53.entry.js.map +1 -1
  295. package/dist/wcs/wcs.css +1 -1
  296. package/dist/wcs/wcs.esm.js +1 -1
  297. package/dist/wcs/wcs.esm.js.map +1 -1
  298. package/package.json +17 -12
  299. package/dist/cjs/grid-pagination-ff65e0ff.js.map +0 -1
  300. package/dist/cjs/helpers-11518d4f.js.map +0 -1
  301. package/dist/esm/grid-pagination-62f9fbbc.js.map +0 -1
  302. package/dist/esm/helpers-e9b73aad.js.map +0 -1
  303. package/dist/wcs/p-111ae1af.entry.js +0 -2
  304. package/dist/wcs/p-111ae1af.entry.js.map +0 -1
  305. package/dist/wcs/p-14e04d5e.entry.js +0 -2
  306. package/dist/wcs/p-14e04d5e.entry.js.map +0 -1
  307. package/dist/wcs/p-274232e6.entry.js.map +0 -1
  308. package/dist/wcs/p-2920b759.entry.js +0 -16
  309. package/dist/wcs/p-2920b759.entry.js.map +0 -1
  310. package/dist/wcs/p-3e370f48.entry.js +0 -2
  311. package/dist/wcs/p-49e66081.entry.js +0 -2
  312. package/dist/wcs/p-49e66081.entry.js.map +0 -1
  313. package/dist/wcs/p-504fb24e.entry.js +0 -2
  314. package/dist/wcs/p-504fb24e.entry.js.map +0 -1
  315. package/dist/wcs/p-5140269d.entry.js +0 -2
  316. package/dist/wcs/p-5140269d.entry.js.map +0 -1
  317. package/dist/wcs/p-587fea23.entry.js.map +0 -1
  318. package/dist/wcs/p-62db1219.js +0 -2
  319. package/dist/wcs/p-62db1219.js.map +0 -1
  320. package/dist/wcs/p-6f921d57.entry.js.map +0 -1
  321. package/dist/wcs/p-7d7472e2.entry.js +0 -2
  322. package/dist/wcs/p-89b3550b.entry.js +0 -2
  323. package/dist/wcs/p-89b3550b.entry.js.map +0 -1
  324. package/dist/wcs/p-8bb19e58.entry.js +0 -2
  325. package/dist/wcs/p-9157466f.entry.js +0 -2
  326. package/dist/wcs/p-9157466f.entry.js.map +0 -1
  327. package/dist/wcs/p-d11c66d4.entry.js +0 -2
  328. package/dist/wcs/p-d218509e.entry.js +0 -2
  329. package/dist/wcs/p-d218509e.entry.js.map +0 -1
  330. package/dist/wcs/p-dc57a5f7.js +0 -2
  331. package/dist/wcs/p-dc57a5f7.js.map +0 -1
  332. /package/dist/wcs/{p-3e370f48.entry.js.map → p-463667c9.entry.js.map} +0 -0
  333. /package/dist/wcs/{p-c7b42bae.entry.js.map → p-4b4d53e2.entry.js.map} +0 -0
  334. /package/dist/wcs/{p-8762cf93.entry.js.map → p-554ca93c.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-dc4d96d4.js';
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-dc4d96d4.js';
2
2
 
3
3
  const switchCss = ":host{--wcs-switch-background-color-initial:var(--wcs-text-light);--wcs-switch-background-color-final:var(--wcs-primary);--wcs-switch-bullet-color-initial:var(--wcs-switch-background-color-final);--wcs-switch-bullet-color-final:var(--wcs-switch-background-color-initial);--wcs-switch-text-color:var(--wcs-text-medium);display:flex}:host([disabled]){--wcs-switch-text-color:var(--wcs-text-disabled)}:host([disabled]) .wcs-container{cursor:not-allowed}.wcs-container{position:relative;display:flex;margin-bottom:0}:host input:focus-visible+.wcs-checkmark{outline:2px dashed var(--wcs-primary);outline-offset:4px;border-radius:0.75rem}:host([label-alignment=top]) .wcs-container{align-items:start}:host([label-alignment=center]) .wcs-container{align-items:center}:host([label-alignment=bottom]) .wcs-container{align-items:flex-end}.wcs-container input{position:absolute;opacity:0;height:0;width:0}.text{color:var(--wcs-switch-text-color);margin-left:6px;font-weight:500;line-height:1.375}.wcs-container:not([aria-disabled]) input:checked~.text{--wcs-switch-text-color:var(--wcs-primary)}.wcs-checkmark::before{position:absolute;transition:all 0.15s ease-out}.wcs-checkmark::before{bottom:0.3125rem;left:0.3125rem;width:0.875rem;height:0.875rem;content:\"\";border-radius:50%;background-color:var(--wcs-switch-bullet-color-initial)}:host([disabled]:not([checked])) .wcs-checkmark::before{background-color:var(--wcs-text-disabled)}:host([disabled]:not([checked])) .wcs-checkmark{background-color:var(--wcs-light)}:host([disabled][checked]) .wcs-checkmark::before{background-color:var(--wcs-white)}:host([disabled][checked]) .wcs-checkmark{background-color:var(--wcs-text-disabled)}.wcs-checkmark{top:0;right:0;bottom:0;left:0;width:3rem;height:1.5rem;border-radius:0.75rem;background-color:var(--wcs-switch-background-color-initial)}.wcs-container:not([aria-disabled]){cursor:pointer}.wcs-container:hover:not([aria-disabled]){--wcs-switch-text-color:var(--wcs-primary)}input:not([disabled]):checked+.wcs-checkmark::before,.wcs-container:hover input:not([disabled])+.wcs-checkmark::before,.wcs-container:focus input:not([disabled])+.wcs-checkmark::before{background-color:var(--wcs-switch-bullet-color-final)}input:checked+.wcs-checkmark::before{transform:translateX(24px)}input:not([disabled]):checked+.wcs-checkmark,.wcs-container:hover input:not([disabled])+.wcs-checkmark,.wcs-container:focus input:not([disabled])+.wcs-checkmark{background-color:var(--wcs-switch-background-color-final)}";
4
4
 
@@ -21,7 +21,6 @@ const Switch = class {
21
21
  render() {
22
22
  return (h(Host, null, h("label", { htmlFor: this.name, class: "wcs-container", "aria-disabled": this.disabled }, h("input", { onChange: (evt) => this.toggleChange(evt), checked: this.checked, class: "wcs-switch", type: "checkbox", name: this.name, disabled: this.disabled, id: this.name }), h("span", { class: "wcs-checkmark" }), h("span", { class: "text" }, h("slot", null)))));
23
23
  }
24
- get el() { return getElement(this); }
25
24
  };
26
25
  let switchIds = 0;
27
26
  Switch.style = switchCss;
@@ -1 +1 @@
1
- {"file":"wcs-switch.entry.js","mappings":";;AAAA,MAAM,SAAS,GAAG,w7EAAw7E;;MCQ77E,MAAM;;;;IACP,aAAQ,GAAG,cAAc,SAAS,EAAE,EAAE,CAAC;gBAIhC,IAAI,CAAC,QAAQ;mBAKK,KAAK;0BAUwB,QAAQ;oBAK1C,KAAK;;EAEjC,YAAY,CAAC,MAAa;IACtB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,OAAO,EAAE,IAAI,CAAC,OAAO;KACxB,CAAC,CAAC;GACN;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,aAAO,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC,eAAe,mBAAgB,IAAI,CAAC,QAAQ,IACzE,aAAO,QAAQ,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EACzC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAC,YAAY,EAClB,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,IAAI,CAAC,IAAI,GACZ,EACR,YAAM,KAAK,EAAC,eAAe,GAAQ,EACnC,YAAM,KAAK,EAAC,MAAM,IACd,eAAO,CACJ,CACH,CACL,EACT;GACL;;;AAGL,IAAI,SAAS,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/switch/switch.scss?tag=wcs-switch&encapsulation=shadow","./src/components/switch/switch.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-switch-background-color-initial: var(--wcs-text-light);\n --wcs-switch-background-color-final: var(--wcs-primary);\n\n --wcs-switch-bullet-color-initial: var(--wcs-switch-background-color-final);\n --wcs-switch-bullet-color-final: var(--wcs-switch-background-color-initial);\n\n --wcs-switch-text-color: var(--wcs-text-medium);\n\n display: flex;\n}\n\n:host([disabled]) {\n --wcs-switch-text-color: var(--wcs-text-disabled);\n\n .wcs-container {\n cursor: not-allowed;\n }\n}\n\n/* Customize the label (the wcs-container) */\n.wcs-container {\n position: relative;\n display: flex;\n margin-bottom: 0;\n}\n\n:host {\n input:focus-visible + .wcs-checkmark {\n @include focus-outline($border-radius: 0.75rem);\n }\n}\n\n/* Let the user choose the alignment of the checkbox with the label text */\n:host([label-alignment=\"top\"]) {\n .wcs-container {\n align-items: start;\n }\n}\n\n:host([label-alignment=\"center\"]) {\n .wcs-container {\n align-items: center;\n }\n}\n\n:host([label-alignment=\"bottom\"]) {\n .wcs-container {\n align-items: flex-end;\n }\n}\n\n/* Hide the browser's default switch */\n.wcs-container input {\n position: absolute;\n opacity: 0;\n height: 0;\n width: 0;\n}\n\n.text {\n color: var(--wcs-switch-text-color);\n margin-left: 6px;\n font-weight: 500;\n line-height: 1.375;\n}\n\n.wcs-container:not([aria-disabled]) input:checked ~ .text {\n --wcs-switch-text-color: var(--wcs-primary);\n}\n\n.wcs-checkmark::before {\n position: absolute;\n transition: all .15s ease-out;\n}\n\n.wcs-checkmark::before {\n bottom: 0.3125rem;\n left: 0.3125rem;\n width: 0.875rem;\n height: 0.875rem;\n content: \"\";\n border-radius: 50%;\n background-color: var(--wcs-switch-bullet-color-initial);\n}\n\n:host([disabled]:not([checked])) {\n .wcs-checkmark::before {\n background-color: var(--wcs-text-disabled);\n }\n\n .wcs-checkmark {\n background-color: var(--wcs-light);\n }\n}\n\n:host([disabled][checked]) {\n .wcs-checkmark::before {\n background-color: var(--wcs-white);\n }\n\n .wcs-checkmark {\n background-color: var(--wcs-text-disabled);\n }\n}\n\n.wcs-checkmark {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 3rem;\n height: 1.5rem;\n border-radius: 0.75rem;\n background-color: var(--wcs-switch-background-color-initial);\n}\n\n.wcs-container:not([aria-disabled]) {\n cursor: pointer;\n}\n\n.wcs-container:hover:not([aria-disabled]) {\n --wcs-switch-text-color: var(--wcs-primary);\n}\n\n/* When the switch is checked, change the bullet to grey */\ninput:not([disabled]):checked + .wcs-checkmark::before,\n.wcs-container:hover input:not([disabled]) + .wcs-checkmark::before,\n.wcs-container:focus input:not([disabled]) + .wcs-checkmark::before {\n background-color: var(--wcs-switch-bullet-color-final);\n}\n\n/* Switch transition */\ninput:checked + .wcs-checkmark::before {\n transform: translateX(24px);\n}\n\n/* When the switch is checked, change background to blue */\ninput:not([disabled]):checked + .wcs-checkmark,\n.wcs-container:hover input:not([disabled]) + .wcs-checkmark,\n.wcs-container:focus input:not([disabled]) + .wcs-checkmark {\n background-color: var(--wcs-switch-background-color-final);\n}\n","import { Component, ComponentInterface, Element, Event, EventEmitter, h, Host, Prop } from '@stencil/core';\nimport { SwitchChangeEventDetail, SwitchLabelAlignment } from './switch-interface';\n\n@Component({\n tag: 'wcs-switch',\n styleUrl: 'switch.scss',\n shadow: true\n})\nexport class Switch implements ComponentInterface {\n private switchId = `wcs-switch-${switchIds++}`;\n\n @Element() el: HTMLElement;\n\n @Prop() name = this.switchId;\n\n /**\n * If `true`, the switch is selected.\n */\n @Prop({reflect: true}) checked = false;\n\n /**\n * Emitted when the checked property has changed.\n */\n @Event() wcsChange!: EventEmitter<SwitchChangeEventDetail>;\n\n /**\n * Specifie the alignment of the switch with the label content\n */\n @Prop({reflect: true}) labelAlignment: SwitchLabelAlignment = 'center';\n\n /**\n * Specify wether the switch is disabled or not.\n */\n @Prop() disabled: boolean = false;\n\n toggleChange(_event: Event) {\n this.checked = !this.checked;\n this.wcsChange.emit({\n checked: this.checked\n });\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.name} class=\"wcs-container\" aria-disabled={this.disabled}>\n <input onChange={(evt) => this.toggleChange(evt)}\n checked={this.checked}\n class=\"wcs-switch\"\n type=\"checkbox\"\n name={this.name}\n disabled={this.disabled}\n id={this.name}>\n </input>\n <span class=\"wcs-checkmark\"></span>\n <span class=\"text\">\n <slot/>\n </span>\n </label>\n </Host>\n );\n }\n}\n\nlet switchIds = 0;\n"],"version":3}
1
+ {"file":"wcs-switch.entry.js","mappings":";;AAAA,MAAM,SAAS,GAAG,w7EAAw7E;;MCQ77E,MAAM;;;;IACP,aAAQ,GAAG,cAAc,SAAS,EAAE,EAAE,CAAC;gBAEhC,IAAI,CAAC,QAAQ;mBAKK,KAAK;0BAUwB,QAAQ;oBAK1C,KAAK;;EAEjC,YAAY,CAAC,MAAa;IACtB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7B,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,OAAO,EAAE,IAAI,CAAC,OAAO;KACxB,CAAC,CAAC;GACN;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,aAAO,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAC,eAAe,mBAAgB,IAAI,CAAC,QAAQ,IACzE,aAAO,QAAQ,EAAE,CAAC,GAAG,KAAK,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EACzC,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAC,YAAY,EAClB,IAAI,EAAC,UAAU,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,EAAE,EAAE,IAAI,CAAC,IAAI,GACZ,EACR,YAAM,KAAK,EAAC,eAAe,GAAQ,EACnC,YAAM,KAAK,EAAC,MAAM,IACd,eAAO,CACJ,CACH,CACL,EACT;GACL;;AAGL,IAAI,SAAS,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/switch/switch.scss?tag=wcs-switch&encapsulation=shadow","./src/components/switch/switch.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-switch-background-color-initial: var(--wcs-text-light);\n --wcs-switch-background-color-final: var(--wcs-primary);\n\n --wcs-switch-bullet-color-initial: var(--wcs-switch-background-color-final);\n --wcs-switch-bullet-color-final: var(--wcs-switch-background-color-initial);\n\n --wcs-switch-text-color: var(--wcs-text-medium);\n\n display: flex;\n}\n\n:host([disabled]) {\n --wcs-switch-text-color: var(--wcs-text-disabled);\n\n .wcs-container {\n cursor: not-allowed;\n }\n}\n\n/* Customize the label (the wcs-container) */\n.wcs-container {\n position: relative;\n display: flex;\n margin-bottom: 0;\n}\n\n:host {\n input:focus-visible + .wcs-checkmark {\n @include focus-outline($border-radius: 0.75rem);\n }\n}\n\n/* Let the user choose the alignment of the checkbox with the label text */\n:host([label-alignment=\"top\"]) {\n .wcs-container {\n align-items: start;\n }\n}\n\n:host([label-alignment=\"center\"]) {\n .wcs-container {\n align-items: center;\n }\n}\n\n:host([label-alignment=\"bottom\"]) {\n .wcs-container {\n align-items: flex-end;\n }\n}\n\n/* Hide the browser's default switch */\n.wcs-container input {\n position: absolute;\n opacity: 0;\n height: 0;\n width: 0;\n}\n\n.text {\n color: var(--wcs-switch-text-color);\n margin-left: 6px;\n font-weight: 500;\n line-height: 1.375;\n}\n\n.wcs-container:not([aria-disabled]) input:checked ~ .text {\n --wcs-switch-text-color: var(--wcs-primary);\n}\n\n.wcs-checkmark::before {\n position: absolute;\n transition: all .15s ease-out;\n}\n\n.wcs-checkmark::before {\n bottom: 0.3125rem;\n left: 0.3125rem;\n width: 0.875rem;\n height: 0.875rem;\n content: \"\";\n border-radius: 50%;\n background-color: var(--wcs-switch-bullet-color-initial);\n}\n\n:host([disabled]:not([checked])) {\n .wcs-checkmark::before {\n background-color: var(--wcs-text-disabled);\n }\n\n .wcs-checkmark {\n background-color: var(--wcs-light);\n }\n}\n\n:host([disabled][checked]) {\n .wcs-checkmark::before {\n background-color: var(--wcs-white);\n }\n\n .wcs-checkmark {\n background-color: var(--wcs-text-disabled);\n }\n}\n\n.wcs-checkmark {\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n width: 3rem;\n height: 1.5rem;\n border-radius: 0.75rem;\n background-color: var(--wcs-switch-background-color-initial);\n}\n\n.wcs-container:not([aria-disabled]) {\n cursor: pointer;\n}\n\n.wcs-container:hover:not([aria-disabled]) {\n --wcs-switch-text-color: var(--wcs-primary);\n}\n\n/* When the switch is checked, change the bullet to grey */\ninput:not([disabled]):checked + .wcs-checkmark::before,\n.wcs-container:hover input:not([disabled]) + .wcs-checkmark::before,\n.wcs-container:focus input:not([disabled]) + .wcs-checkmark::before {\n background-color: var(--wcs-switch-bullet-color-final);\n}\n\n/* Switch transition */\ninput:checked + .wcs-checkmark::before {\n transform: translateX(24px);\n}\n\n/* When the switch is checked, change background to blue */\ninput:not([disabled]):checked + .wcs-checkmark,\n.wcs-container:hover input:not([disabled]) + .wcs-checkmark,\n.wcs-container:focus input:not([disabled]) + .wcs-checkmark {\n background-color: var(--wcs-switch-background-color-final);\n}\n","import { Component, ComponentInterface, Event, EventEmitter, h, Host, Prop } from '@stencil/core';\nimport { SwitchChangeEventDetail, SwitchLabelAlignment } from './switch-interface';\n\n@Component({\n tag: 'wcs-switch',\n styleUrl: 'switch.scss',\n shadow: true\n})\nexport class Switch implements ComponentInterface {\n private switchId = `wcs-switch-${switchIds++}`;\n\n @Prop() name = this.switchId;\n\n /**\n * If `true`, the switch is selected.\n */\n @Prop({reflect: true}) checked = false;\n\n /**\n * Emitted when the checked property has changed.\n */\n @Event() wcsChange!: EventEmitter<SwitchChangeEventDetail>;\n\n /**\n * Specifie the alignment of the switch with the label content\n */\n @Prop({reflect: true}) labelAlignment: SwitchLabelAlignment = 'center';\n\n /**\n * Specify wether the switch is disabled or not.\n */\n @Prop() disabled: boolean = false;\n\n toggleChange(_event: Event) {\n this.checked = !this.checked;\n this.wcsChange.emit({\n checked: this.checked\n });\n }\n\n render() {\n return (\n <Host>\n <label htmlFor={this.name} class=\"wcs-container\" aria-disabled={this.disabled}>\n <input onChange={(evt) => this.toggleChange(evt)}\n checked={this.checked}\n class=\"wcs-switch\"\n type=\"checkbox\"\n name={this.name}\n disabled={this.disabled}\n id={this.name}>\n </input>\n <span class=\"wcs-checkmark\"></span>\n <span class=\"text\">\n <slot/>\n </span>\n </label>\n </Host>\n );\n }\n}\n\nlet switchIds = 0;\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"wcs-tab.entry.js","mappings":";;MAUa,GAAG;;;;;;;EAkBZ,gBAAgB;IACZ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;GACzB;EAED,MAAM;IACF,QACI,EAAC,IAAI,IAAC,IAAI,EAAC,SAAS,IAChB,eAAa,CACV,EACT;GACL;;;;;","names":[],"sources":["./src/components/tab/tab.tsx"],"sourcesContent":["import { Component, Prop, h, Host, Event, EventEmitter } from '@stencil/core';\n\n/**\n * Tab content component.\n * Use this component to specify the content of a component.\n */\n@Component({\n tag: 'wcs-tab',\n shadow: true,\n})\nexport class Tab {\n /**\n * The header you want to be displayed for this tab.\n */\n @Prop({ reflect: true })\n header: string;\n\n @Prop() itemKey: any;\n\n // TODO: See if there is a solution that doesn't pollute the API.\n /**\n * Do not use, meant for internal use only.\n * @inner\n * @ignore\n */\n @Event()\n tabLoaded!: EventEmitter<void>;\n\n componentDidLoad() {\n this.tabLoaded.emit();\n }\n\n render() {\n return (\n <Host slot=\"wcs-tab\">\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"wcs-tab.entry.js","mappings":";;MAUa,GAAG;;;;;;;EAiBZ,gBAAgB;IACZ,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;GACzB;EAED,MAAM;IACF,QACI,EAAC,IAAI,IAAC,IAAI,EAAC,SAAS,IAChB,eAAa,CACV,EACT;GACL;;;;;","names":[],"sources":["./src/components/tab/tab.tsx"],"sourcesContent":["import { Component, Prop, h, Host, Event, EventEmitter } from '@stencil/core';\n\n/**\n * Tab content component.\n * Use this component to specify the content of a component.\n */\n@Component({\n tag: 'wcs-tab',\n shadow: true,\n})\nexport class Tab {\n /**\n * The header you want to be displayed for this tab.\n */\n @Prop({ reflect: true }) header: string;\n\n @Prop() itemKey: any;\n\n // TODO: See if there is a solution that doesn't pollute the API.\n /**\n * Do not use, meant for internal use only.\n * @inner\n * @ignore\n */\n @Event()\n tabLoaded!: EventEmitter<void>;\n\n componentDidLoad() {\n this.tabLoaded.emit();\n }\n\n render() {\n return (\n <Host slot=\"wcs-tab\">\n <slot></slot>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1 +1 @@
1
- {"file":"wcs-tabs.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,sjCAAsjC;;MCiCzjC,IAAI;;;;iBAIoC,OAAO;yBAMxB,CAAC;;uBAQF,KAAK;;mBAYP,EAAE;iCAEE,CAAC;;EAGlC,oBAAoB,CAAC,QAAgB;IACjC,IAAI,CAAC,qBAAqB,GAAG,QAAQ,CAAC;GACzC;EAGD,qBAAqB,CAAC,QAAa;IAC/B,IAAI,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC;GACnD;EAEO,mBAAmB;IACvB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC;MACjD,QAAQ,EAAE,IAAI,CAAC,qBAAqB;MACpC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO;KAC7D,CAAC,CAAC;GACN;EAEO,gCAAgC,CAAC,QAAa;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MACvC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;MACzB,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE;QAC1B,IAAI,CAAC,qBAAqB,GAAG,CAAC,CAAC;OAClC;KACJ;GACJ;EAGD,WAAW;IACP,IAAI,CAAC,cAAc,EAAE,CAAC;GACzB;EAED,gBAAgB;IACZ,IAAI,CAAC,+BAA+B,EAAE,CAAC;I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9B;SAAM;MACH,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC7B;GACJ;EAEO,mBAAmB;IACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAqB,EAAE,GAAW;MACjD,IAAI,GAAG,KAAK,IAAI,CAAC,qBAAqB,EAAE;QACpC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;OAC9C;WAAM;QACH,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;OAC/C;KACJ,CAAC,CAAC;GACN;EAEO,kBAAkB;IACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAqB,KAAK,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;GAC5F;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,WAAK,KAAK,EAAC,kBAAkB,IACxB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,KAC1B,WAAK,KAAK,EAAE,iBAAiB,IAAI,IAAI,CAAC,qBAAqB,KAAK,GAAG,GAAG,QAAQ,GAAG,EAAE,CAAC,EAC/E,OAAO,EAAE,MAAM,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,EACpD,SAAS,EAAE,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,EAAE,IAAI,CAAC,qBAAqB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAEtD,gBAAO,MAAM,CAAQ,CACnB,CACT,CACC,EACN,WAAK,KAAK,EAAC,UAAU,IACjB,YAAM,IAAI,EAAC,SAAS,GAAE,CACpB,CACH,EACT;GACL;;;;;;;;;;;","names":[],"sources":["./src/components/tabs/tabs.scss?tag=wcs-tabs&encapsulation=shadow","./src/components/tabs/tabs.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-tabs-padding-bottom: 16px;\n}\n\n:host([align=start]) .wcs-tabs-headers {\n justify-content: start;\n}\n\n:host([align=end]) .wcs-tabs-headers {\n justify-content: end;\n}\n\n:host([align=center]) .wcs-tabs-headers {\n justify-content: center;\n}\n\n.wcs-tabs-headers {\n padding-top: 4px;\n overflow-x: auto;\n display: flex;\n position: relative;\n}\n\n:host([gutter]) {\n .wcs-tabs-headers {\n border-bottom: var(--wcs-tabs-headers-border-bottom);\n }\n}\n\n.wcs-tab-header {\n padding: 8px 24px 16px 0;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n outline: none;\n\n span {\n text-align: center;\n color: var(--wcs-text-disabled);\n font-size: 1rem;\n font-weight: 400;\n }\n\n\n &:focus,\n &:hover {\n span {\n color: var(--wcs-primary);\n }\n }\n\n &:focus-visible > span {\n @include focus-outline;\n }\n}\n\n\n.active {\n span {\n font-weight: 500;\n color: var(--wcs-primary);\n position: relative;\n }\n\n span::after {\n position: absolute;\n bottom: calc(var(--wcs-tabs-padding-bottom) * -1);\n left: 0;\n width: 100%;\n height: 0.3125rem;\n content: \"\";\n background-color: var(--wcs-primary);\n border-radius: 3px;\n }\n}\n","import {\n Component,\n Prop,\n Element,\n State,\n ComponentInterface,\n Event,\n EventEmitter,\n Watch,\n h,\n Host,\n Listen\n} from '@stencil/core';\n\nimport { WcsTabsAlignment, WcsTabChangeEvent } from './tabs-interface';\n\n/**\n * Tabs component to switch between tab content.\n * Use in conjuction with `wcs-tab`.\n *\n * @example\n * ```html\n * <wcs-tabs>\n * <wcs-tab header=\"One\">The content !</wcs-tab>\n * <wcs-tab header=\"Two\">More content !</wcs-tab>\n * </wcs-tabs>\n * ```\n */\n@Component({\n tag: 'wcs-tabs',\n styleUrl: 'tabs.scss',\n shadow: true,\n})\nexport class Tabs implements ComponentInterface {\n /**\n * Tab headers alignment.\n */\n @Prop({reflect: true}) align: WcsTabsAlignment = 'start';\n\n /**\n * Current selected tab index.\n * Starts at 0.\n */\n @Prop() selectedIndex: number = 0;\n\n @Prop() selectedKey: any;\n\n /**\n * Whether to skip rendering the tabpanel with the content of the selected tab. Use this prop if you plan to\n * separately render the tab content.\n */\n @Prop() headersOnly: boolean = false;\n /** Determines if tabs header should have a border at the bottom */\n @Prop() gutter: boolean;\n\n /**\n *\n * Emitted when the selected tab change.\n */\n @Event() tabChange!: EventEmitter<WcsTabChangeEvent>;\n\n @Element() el!: HTMLWcsTabsElement;\n\n @State() headers: string[] = [];\n\n @State() currentActiveTabIndex = 0;\n\n @Watch('selectedIndex')\n selectedIndexChanged(newValue: number) {\n this.currentActiveTabIndex = newValue;\n }\n\n @Watch('selectedKey')\n selectedTabkeyChanged(newValue: any) {\n this.updateCurrentActiveIndexByTabKey(newValue);\n }\n\n private emitActiveTabChange() {\n this.tabChange.emit({\n tabName: this.headers[this.currentActiveTabIndex],\n tabIndex: this.currentActiveTabIndex,\n selectedKey: this.tabs[this.currentActiveTabIndex].itemKey\n });\n }\n\n private updateCurrentActiveIndexByTabKey(newValue: any) {\n for (let i = 0; i < this.tabs.length; i++) {\n const tab = this.tabs[i];\n if (tab.itemKey === newValue) {\n this.currentActiveTabIndex = i;\n }\n }\n }\n\n @Listen('tabLoaded')\n onTabLoaded() {\n this.refreshHeaders();\n }\n\n componentDidLoad() {\n this.putTabsInCorrectDivIfTheyAreNot();\n this.refreshHeaders();\n if (this.selectedIndex) {\n this.currentActiveTabIndex = this.selectedIndex;\n }\n if (this.selectedKey) {\n this.updateCurrentActiveIndexByTabKey(this.selectedKey);\n }\n }\n\n // XXX: Firefox < 63\n private putTabsInCorrectDivIfTheyAreNot() {\n const tabDiv = this.el.shadowRoot.querySelector('.wcs-tabs');\n if (tabDiv.querySelector('slot') === null) {\n Array.from(this.el.querySelectorAll('wcs-tab'))\n .filter(node => node.parentNode !== tabDiv)\n .forEach(tab => {\n if (tab.parentElement.isEqualNode(this.el)) {\n this.el.removeChild(tab);\n tabDiv.appendChild(tab);\n }\n });\n }\n }\n\n handleKeyDown(ev: KeyboardEvent, tabIndex: number) {\n const target = ev.target as HTMLDivElement;\n switch (ev.key) {\n case ' ':\n case 'Enter': {\n this.currentActiveTabIndex = tabIndex;\n this.emitActiveTabChange();\n ev.preventDefault();\n break;\n }\n case 'ArrowLeft': {\n if (target.previousElementSibling?.classList.contains('wcs-tab-header')) {\n (target.previousElementSibling as HTMLDivElement).focus();\n ev.preventDefault();\n }\n break;\n }\n case 'ArrowRight': {\n if (target.nextElementSibling?.classList.contains('wcs-tab-header')) {\n (target.nextElementSibling as HTMLDivElement).focus();\n ev.preventDefault();\n }\n break;\n }\n }\n }\n\n private refreshHeaders() {\n this.headers = [];\n this.tabs\n .forEach(x => {\n this.headers.push(x.getAttribute('header'));\n });\n }\n\n private get tabs() {\n const tabsEl = this.el.shadowRoot.querySelector('.wcs-tabs');\n // FIXME: problem with this selector being too greedy in ff < 63\n const tabs = this.el.shadowRoot.querySelectorAll('.wcs-tabs > wcs-tab');\n\n return tabs.length !== 0\n ? tabs\n : tabsEl?.querySelector('slot')\n ? tabsEl?.querySelector('slot')?.assignedElements() as unknown as NodeListOf<HTMLWcsTabElement>\n : [];\n }\n\n private selectTabAndEmitChangeEvent(index: number) {\n this.currentActiveTabIndex = index;\n this.emitActiveTabChange()\n }\n\n componentWillUpdate() {\n if (!this.headersOnly) {\n this.updateTabVisibility();\n } else {\n this.hideAllTabsContent();\n }\n }\n\n private updateTabVisibility() {\n this.tabs.forEach((el: HTMLWcsTabElement, idx: number) => {\n if (idx !== this.currentActiveTabIndex) {\n el.setAttribute('style', 'display: none;');\n } else {\n el.setAttribute('style', 'display: block;');\n }\n });\n }\n\n private hideAllTabsContent() {\n this.tabs.forEach((el: HTMLWcsTabElement) => el.setAttribute('style', 'display: none;'));\n }\n\n render() {\n return (\n <Host>\n <div class=\"wcs-tabs-headers\">\n {this.headers.map((header, idx) =>\n <div class={'wcs-tab-header ' + (this.currentActiveTabIndex === idx ? 'active' : '')}\n onClick={() => this.selectTabAndEmitChangeEvent(idx)}\n onKeyDown={evt => this.handleKeyDown(evt, idx)}\n tabIndex={this.currentActiveTabIndex === idx ? 0 : -1}\n >\n <span>{header}</span>\n </div>\n )}\n </div>\n <div class=\"wcs-tabs\">\n <slot name=\"wcs-tab\"/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"wcs-tabs.entry.js","mappings":";;AAAA,MAAM,OAAO,GAAG,sjCAAsjC;;MCiCzjC,IAAI;;;;iBAIoC,OAAO;yBAMxB,CAAC;;uBAQF,KAAK;;mBAYC,EAAE;iCAEE,CAAC;;EAG1C,oBAAoB,CAAC,QAAgB;IACjC,IAAI,CAAC,qBAAqB,GAAG,QAAQ,CAAC;GACzC;EAGD,qBAAqB,CAAC,QAAa;IAC/B,IAAI,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC;GACnD;EAEO,mBAAmB;IACvB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;MAChB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC;MACjD,QAAQ,EAAE,IAAI,CAAC,qBAAqB;MACpC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,OAAO;KAC7D,CAAC,CAAC;GACN;EAEO,gCAAgC,CAAC,QAAa;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;MACvC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;MACzB,IAAI,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE;QAC1B,IAAI,CAAC,qBAAqB,GAAG,CAAC,CAAC;OAClC;KACJ;GACJ;EAGD,WAAW;IACP,IAAI,CAAC,cAAc,EAAE,CAAC;GACzB;EAED,gBAAgB;IACZ,IAAI,CAAC,+BAA+B,EAAE,CAAC;IACvC,IAAI,CAAC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AAI,CAAC,kBAAkB,EAAE,CAAC;KAC7B;GACJ;EAEO,mBAAmB;IACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAqB,EAAE,GAAW;MACjD,IAAI,GAAG,KAAK,IAAI,CAAC,qBAAqB,EAAE;QACpC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;OAC9C;WAAM;QACH,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAC;OAC/C;KACJ,CAAC,CAAC;GACN;EAEO,kBAAkB;IACtB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,EAAqB,KAAK,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC;GAC5F;EAED,MAAM;IACF,QACI,EAAC,IAAI,QACD,WAAK,KAAK,EAAC,kBAAkB,IACxB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,KAC1B,WAAK,KAAK,EAAE,iBAAiB,IAAI,IAAI,CAAC,qBAAqB,KAAK,GAAG,GAAG,QAAQ,GAAG,EAAE,CAAC,EAC/E,OAAO,EAAE,MAAM,IAAI,CAAC,2BAA2B,CAAC,GAAG,CAAC,EACpD,SAAS,EAAE,GAAG,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,EAC9C,QAAQ,EAAE,IAAI,CAAC,qBAAqB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,IAEtD,gBAAO,MAAM,CAAQ,CACnB,CACT,CACC,EACN,WAAK,KAAK,EAAC,UAAU,IACjB,YAAM,IAAI,EAAC,SAAS,GAAE,CACpB,CACH,EACT;GACL;;;;;;;;;;;","names":[],"sources":["./src/components/tabs/tabs.scss?tag=wcs-tabs&encapsulation=shadow","./src/components/tabs/tabs.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-tabs-padding-bottom: 16px;\n}\n\n:host([align=start]) .wcs-tabs-headers {\n justify-content: start;\n}\n\n:host([align=end]) .wcs-tabs-headers {\n justify-content: end;\n}\n\n:host([align=center]) .wcs-tabs-headers {\n justify-content: center;\n}\n\n.wcs-tabs-headers {\n padding-top: 4px;\n overflow-x: auto;\n display: flex;\n position: relative;\n}\n\n:host([gutter]) {\n .wcs-tabs-headers {\n border-bottom: var(--wcs-tabs-headers-border-bottom);\n }\n}\n\n.wcs-tab-header {\n padding: 8px 24px 16px 0;\n display: flex;\n flex-shrink: 0;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n outline: none;\n\n span {\n text-align: center;\n color: var(--wcs-text-disabled);\n font-size: 1rem;\n font-weight: 400;\n }\n\n\n &:focus,\n &:hover {\n span {\n color: var(--wcs-primary);\n }\n }\n\n &:focus-visible > span {\n @include focus-outline;\n }\n}\n\n\n.active {\n span {\n font-weight: 500;\n color: var(--wcs-primary);\n position: relative;\n }\n\n span::after {\n position: absolute;\n bottom: calc(var(--wcs-tabs-padding-bottom) * -1);\n left: 0;\n width: 100%;\n height: 0.3125rem;\n content: \"\";\n background-color: var(--wcs-primary);\n border-radius: 3px;\n }\n}\n","import {\n Component,\n Prop,\n Element,\n State,\n ComponentInterface,\n Event,\n EventEmitter,\n Watch,\n h,\n Host,\n Listen\n} from '@stencil/core';\n\nimport { WcsTabsAlignment, WcsTabChangeEvent } from './tabs-interface';\n\n/**\n * Tabs component to switch between tab content.\n * Use in conjuction with `wcs-tab`.\n *\n * @example\n * ```html\n * <wcs-tabs>\n * <wcs-tab header=\"One\">The content !</wcs-tab>\n * <wcs-tab header=\"Two\">More content !</wcs-tab>\n * </wcs-tabs>\n * ```\n */\n@Component({\n tag: 'wcs-tabs',\n styleUrl: 'tabs.scss',\n shadow: true,\n})\nexport class Tabs implements ComponentInterface {\n /**\n * Tab headers alignment.\n */\n @Prop({reflect: true}) align: WcsTabsAlignment = 'start';\n\n /**\n * Current selected tab index.\n * Starts at 0.\n */\n @Prop() selectedIndex: number = 0;\n\n @Prop() selectedKey: any;\n\n /**\n * Whether to skip rendering the tabpanel with the content of the selected tab. Use this prop if you plan to\n * separately render the tab content.\n */\n @Prop() headersOnly: boolean = false;\n /** Determines if tabs header should have a border at the bottom */\n @Prop() gutter: boolean;\n\n /**\n *\n * Emitted when the selected tab change.\n */\n @Event() tabChange!: EventEmitter<WcsTabChangeEvent>;\n\n @Element() private el!: HTMLWcsTabsElement;\n\n @State() private headers: string[] = [];\n\n @State() private currentActiveTabIndex = 0;\n\n @Watch('selectedIndex')\n selectedIndexChanged(newValue: number) {\n this.currentActiveTabIndex = newValue;\n }\n\n @Watch('selectedKey')\n selectedTabkeyChanged(newValue: any) {\n this.updateCurrentActiveIndexByTabKey(newValue);\n }\n\n private emitActiveTabChange() {\n this.tabChange.emit({\n tabName: this.headers[this.currentActiveTabIndex],\n tabIndex: this.currentActiveTabIndex,\n selectedKey: this.tabs[this.currentActiveTabIndex].itemKey\n });\n }\n\n private updateCurrentActiveIndexByTabKey(newValue: any) {\n for (let i = 0; i < this.tabs.length; i++) {\n const tab = this.tabs[i];\n if (tab.itemKey === newValue) {\n this.currentActiveTabIndex = i;\n }\n }\n }\n\n @Listen('tabLoaded')\n onTabLoaded() {\n this.refreshHeaders();\n }\n\n componentDidLoad() {\n this.putTabsInCorrectDivIfTheyAreNot();\n this.refreshHeaders();\n if (this.selectedIndex) {\n this.currentActiveTabIndex = this.selectedIndex;\n }\n if (this.selectedKey) {\n this.updateCurrentActiveIndexByTabKey(this.selectedKey);\n }\n }\n\n // XXX: Firefox < 63\n private putTabsInCorrectDivIfTheyAreNot() {\n const tabDiv = this.el.shadowRoot.querySelector('.wcs-tabs');\n if (tabDiv.querySelector('slot') === null) {\n Array.from(this.el.querySelectorAll('wcs-tab'))\n .filter(node => node.parentNode !== tabDiv)\n .forEach(tab => {\n if (tab.parentElement.isEqualNode(this.el)) {\n this.el.removeChild(tab);\n tabDiv.appendChild(tab);\n }\n });\n }\n }\n\n handleKeyDown(ev: KeyboardEvent, tabIndex: number) {\n const target = ev.target as HTMLDivElement;\n switch (ev.key) {\n case ' ':\n case 'Enter': {\n this.currentActiveTabIndex = tabIndex;\n this.emitActiveTabChange();\n ev.preventDefault();\n break;\n }\n case 'ArrowLeft': {\n if (target.previousElementSibling?.classList.contains('wcs-tab-header')) {\n (target.previousElementSibling as HTMLDivElement).focus();\n ev.preventDefault();\n }\n break;\n }\n case 'ArrowRight': {\n if (target.nextElementSibling?.classList.contains('wcs-tab-header')) {\n (target.nextElementSibling as HTMLDivElement).focus();\n ev.preventDefault();\n }\n break;\n }\n }\n }\n\n private refreshHeaders() {\n this.headers = [];\n this.tabs\n .forEach(x => {\n this.headers.push(x.getAttribute('header'));\n });\n }\n\n private get tabs() {\n const tabsEl = this.el.shadowRoot.querySelector('.wcs-tabs');\n // FIXME: problem with this selector being too greedy in ff < 63\n const tabs = this.el.shadowRoot.querySelectorAll('.wcs-tabs > wcs-tab');\n\n return tabs.length !== 0\n ? tabs\n : tabsEl?.querySelector('slot')\n ? tabsEl?.querySelector('slot')?.assignedElements() as unknown as NodeListOf<HTMLWcsTabElement>\n : [];\n }\n\n private selectTabAndEmitChangeEvent(index: number) {\n this.currentActiveTabIndex = index;\n this.emitActiveTabChange()\n }\n\n componentWillUpdate() {\n if (!this.headersOnly) {\n this.updateTabVisibility();\n } else {\n this.hideAllTabsContent();\n }\n }\n\n private updateTabVisibility() {\n this.tabs.forEach((el: HTMLWcsTabElement, idx: number) => {\n if (idx !== this.currentActiveTabIndex) {\n el.setAttribute('style', 'display: none;');\n } else {\n el.setAttribute('style', 'display: block;');\n }\n });\n }\n\n private hideAllTabsContent() {\n this.tabs.forEach((el: HTMLWcsTabElement) => el.setAttribute('style', 'display: none;'));\n }\n\n render() {\n return (\n <Host>\n <div class=\"wcs-tabs-headers\">\n {this.headers.map((header, idx) =>\n <div class={'wcs-tab-header ' + (this.currentActiveTabIndex === idx ? 'active' : '')}\n onClick={() => this.selectTabAndEmitChangeEvent(idx)}\n onKeyDown={evt => this.handleKeyDown(evt, idx)}\n tabIndex={this.currentActiveTabIndex === idx ? 0 : -1}\n >\n <span>{header}</span>\n </div>\n )}\n </div>\n <div class=\"wcs-tabs\">\n <slot name=\"wcs-tab\"/>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, a as readTask, h, H as Host, g as getElement } from './index-dc4d96d4.js';
2
- import { g as debounceEvent, h as inheritAttributes, r as raf, j as findItemLabel } from './helpers-e9b73aad.js';
2
+ import { j as debounceEvent, k as inheritAttributes, r as raf, l as findItemLabel } from './helpers-1f7170dd.js';
3
3
 
4
- const textareaCss = ":host{--wcs-textarea-icon-color:var(--wcs-text-medium);--wcs-internal-textarea-border-radius-left:var(--wcs-textarea-border-radius-left, var(--wcs-border-radius));--wcs-internal-textarea-border-radius-right:var(--wcs-textarea-border-radius-right, var(--wcs-border-radius));--wcs-internal-textarea-border-width:2px;display:flex;flex-direction:row;width:100%;border-radius:var(--wcs-internal-textarea-border-radius-left) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-left);background-color:var(--wcs-light);border:var(--wcs-internal-textarea-border-width) solid var(--wcs-light);background-clip:padding-box}:host ::placeholder{font-weight:400;font-style:italic}:host textarea{overflow:auto;flex:1;width:100%;box-sizing:border-box;min-height:24px;background-color:transparent;font-family:var(--wcs-font-sans-serif);color:var(--wcs-primary);font-weight:var(--wcs-font-weight-form-value) !important;border:none;padding:calc(var(--wcs-padding) / 2 - var(--wcs-internal-textarea-border-width) / 2) calc(var(--wcs-padding) - var(--wcs-internal-textarea-border-width));font-size:1rem;line-height:1.5}:host textarea:focus{box-shadow:none;outline:0}:host wcs-mat-icon{position:relative;margin-top:7px;margin-left:8px;margin-right:-8px}:host([disabled]) textarea{color:var(--wcs-text-disabled);cursor:not-allowed}:host([state=error]){border-color:var(--wcs-red) !important}:host(:focus-within){border:dashed var(--wcs-internal-textarea-border-width) var(--wcs-primary)}:host(:focus-within) wcs-mat-icon{color:var(--wcs-primary)}";
4
+ const textareaCss = ":host{--wcs-textarea-icon-color:var(--wcs-text-medium);--wcs-internal-textarea-border-radius-left:var(--wcs-textarea-border-radius-left, var(--wcs-border-radius));--wcs-internal-textarea-border-radius-right:var(--wcs-textarea-border-radius-right, var(--wcs-border-radius));--wcs-internal-textarea-border-width:2px;--wcs-textarea-max-height:unset;display:flex;flex-direction:row;width:100%;border-radius:var(--wcs-internal-textarea-border-radius-left) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-left);background-color:var(--wcs-light);border:var(--wcs-internal-textarea-border-width) solid var(--wcs-light);background-clip:padding-box}:host ::placeholder{font-weight:400;font-style:italic}:host textarea{overflow:auto;flex:1;width:100%;box-sizing:border-box;min-height:var(--wcs-size-m);max-height:var(--wcs-textarea-max-height);background-color:transparent;font-family:var(--wcs-font-sans-serif);color:var(--wcs-primary);font-weight:var(--wcs-font-weight-form-value) !important;border:none;padding:calc(var(--wcs-padding) / 2 - var(--wcs-internal-textarea-border-width) / 2) calc(var(--wcs-padding) - var(--wcs-internal-textarea-border-width));font-size:1rem;line-height:1.5}:host textarea:focus{box-shadow:none;outline:0}:host wcs-mat-icon{position:relative;margin-top:7px;margin-left:8px;margin-right:-8px}:host([disabled]) textarea{color:var(--wcs-text-disabled);cursor:not-allowed}:host([state=error]){border-color:var(--wcs-red) !important}:host(:focus-within){border:dashed var(--wcs-internal-textarea-border-width) var(--wcs-primary)}:host(:focus-within) wcs-mat-icon{color:var(--wcs-primary)}";
5
5
 
6
6
  const Textarea = class {
7
7
  constructor(hostRef) {
@@ -59,6 +59,7 @@ const Textarea = class {
59
59
  this.wrap = undefined;
60
60
  this.autoGrow = false;
61
61
  this.value = '';
62
+ this.resize = undefined;
62
63
  }
63
64
  debounceChanged() {
64
65
  this.wcsChange = debounceEvent(this.wcsChange, this.debounce);
@@ -171,7 +172,8 @@ const Textarea = class {
171
172
  if (label) {
172
173
  label.id = labelId;
173
174
  }
174
- return (h(Host, { "aria-disabled": this.disabled ? 'true' : null }, this.icon ? (h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null, h("textarea", Object.assign({ class: "native-textarea", "aria-labelledby": label ? labelId : null, ref: el => this.nativeInput = el, autoCapitalize: this.autocapitalize, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, disabled: this.disabled, maxLength: this.maxlength, minLength: this.minlength, name: this.name, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, cols: this.cols, rows: this.rows, wrap: this.wrap, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown }, this.inheritedAttributes), value)));
175
+ const style = Object.assign({}, (this.resize && { 'resize': this.resize }));
176
+ return (h(Host, { "aria-disabled": this.disabled ? 'true' : null }, this.icon ? (h("wcs-mat-icon", { icon: this.icon, size: "m" })) : null, h("textarea", Object.assign({ class: "native-textarea", "aria-labelledby": label ? labelId : null, ref: el => this.nativeInput = el, autoCapitalize: this.autocapitalize, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, disabled: this.disabled, maxLength: this.maxlength, minLength: this.minlength, name: this.name, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, cols: this.cols, rows: this.rows, wrap: this.wrap, onInput: this.onInput, onBlur: this.onBlur, onFocus: this.onFocus, onKeyDown: this.onKeyDown, style: style }, this.inheritedAttributes), value)));
175
177
  }
176
178
  get el() { return getElement(this); }
177
179
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"wcs-textarea.entry.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,4kDAA4kD;;MC0BnlD,QAAQ;;;;;;;IAET,YAAO,GAAG,gBAAgB,WAAW,EAAE,EAAE,CAAC;IAC1C,qBAAgB,GAAG,KAAK,CAAC;IACzB,wBAA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AAI,IAAI,EAC7E,8BACI,KAAK,EAAC,iBAAiB,qBACN,KAAK,GAAG,OAAO,GAAG,IAAI,EACvC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,EAChC,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,IACrB,IAAI,CAAC,mBAAmB,GAEnC,KAAK,CACG,CACF,EACT;GACL;;;;;;;AAGL,IAAI,WAAW,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/textarea/textarea.scss?tag=wcs-textarea&encapsulation=shadow","./src/components/textarea/textarea.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-textarea-icon-color: var(--wcs-text-medium);\n --wcs-internal-textarea-border-radius-left: var(--wcs-textarea-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-textarea-border-radius-right: var(--wcs-textarea-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-textarea-border-width: 2px;\n display: flex;\n flex-direction: row;\n width: 100%;\n border-radius: var(--wcs-internal-textarea-border-radius-left) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-textarea-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n textarea {\n overflow: auto;\n flex: 1;\n width: 100%;\n box-sizing: border-box;\n min-height: 24px;\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n // On divise --wcs-internal-input-border-width par deux car la valeur du padding est appliquée en haut et en bas\n padding: calc(calc(var(--wcs-padding) / 2) - calc(var(--wcs-internal-textarea-border-width) / 2)) calc(var(--wcs-padding) - var(--wcs-internal-textarea-border-width));\n font-size: 1rem;\n line-height: 1.5;\n }\n\n textarea:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-top: 7px;\n margin-left: 8px;\n margin-right: -8px;\n }\n}\n\n:host([disabled]) {\n textarea {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-textarea-border-width) var(--wcs-primary);\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Component,\n ComponentInterface,\n Method,\n Prop,\n State,\n Watch,\n h,\n Host,\n EventEmitter,\n Element,\n Event,\n Build,\n readTask\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAttributes, raf } from '../../utils/helpers';\nimport { TextareaChangeEventDetail } from './textarea-interface';\n\n/**\n * Mainly inspired from Ionic Textarea Component\n */\n@Component({\n tag: 'wcs-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n})\nexport class Textarea implements ComponentInterface {\n private nativeInput?: HTMLTextAreaElement;\n private inputId = `wcs-textarea-${textareaIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @Element() el!: HTMLElement;\n\n @State() hasFocus = false;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalize = 'none';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop({mutable: true}) clearOnEdit = false;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the textarea.\n */\n @Prop() disabled = false;\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an initial state but you can set it to 'error' state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * The visible width of the text control, in average character widths. If it is specified, it must be a positive integer.\n */\n @Prop() cols?: number;\n\n /**\n * The number of visible text lines for the control.\n */\n @Prop() rows?: number;\n\n /**\n * Indicates how the control wraps text.\n */\n @Prop() wrap?: 'hard' | 'soft' | 'off';\n\n /**\n * If `true`, the element height will increase based on the value.\n */\n @Prop() autoGrow = false;\n\n /**\n * The value of the textarea.\n */\n @Prop({mutable: true}) value?: string | null = '';\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n const nativeInput = this.nativeInput;\n const value = this.getValue();\n if (nativeInput && nativeInput.value !== value) {\n nativeInput.value = value;\n }\n this.runAutoGrow();\n this.wcsChange.emit({value});\n }\n\n /**\n * Emitted when the input value has changed.\n */\n @Event() wcsChange!: EventEmitter<TextareaChangeEventDetail>;\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['title']);\n }\n\n componentDidLoad() {\n raf(() => this.runAutoGrow());\n }\n\n private runAutoGrow() {\n const nativeInput = this.nativeInput;\n if (nativeInput && this.autoGrow) {\n readTask(() => {\n nativeInput.style.height = 'auto';\n nativeInput.style.height = nativeInput.scrollHeight + 'px';\n });\n }\n }\n\n /**\n * This method make the textarea automatically adopt the size of the content without a scroll bar\n */\n @Method()\n async fitContent() {\n raf(() => this.runAutoGrow());\n }\n\n /**\n * Sets focus on the native `textarea` in `wcs-textarea`. Use this method instead of the global\n * `textarea.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `textarea` in `wcs-textarea`. Use this method instead of the global\n * `textarea.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<textarea>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLTextAreaElement> {\n // tslint:disable-next-line:no-non-null-assertion\n return Promise.resolve(this.nativeInput!);\n }\n\n /**\n * Check if we need to clear the text input if clearOnEdit is enabled\n */\n private checkClearOnEdit() {\n if (!this.clearOnEdit) {\n return;\n }\n\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.value = '';\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n\n private focusChange() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (this.clearOnEdit && !this.hasFocus && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue() !== '';\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private onInput = (ev: Event) => {\n if (this.nativeInput) {\n this.value = this.nativeInput.value;\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChange();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChange();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onKeyDown = () => {\n this.checkClearOnEdit();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <textarea\n class=\"native-textarea\"\n aria-labelledby={label ? labelId : null}\n ref={el => this.nativeInput = el}\n autoCapitalize={this.autocapitalize}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n disabled={this.disabled}\n maxLength={this.maxlength}\n minLength={this.minlength}\n name={this.name}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n cols={this.cols}\n rows={this.rows}\n wrap={this.wrap}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeyDown}\n {...this.inheritedAttributes}\n >\n {value}\n </textarea>\n </Host>\n );\n }\n}\n\nlet textareaIds = 0;\n"],"version":3}
1
+ {"file":"wcs-textarea.entry.js","mappings":";;;AAAA,MAAM,WAAW,GAAG,mqDAAmqD;;MC6B1qD,QAAQ;;;;;;;IAET,YAAO,GAAG,gBAAgB,WAAW,EAAE,EAAE,CAAC;IAC1C,qBAAgB,GAAG,KAAK,CAAC;IACzB,wBAAmB,GAAy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C,IAAI,CAAC,IAAI,IAAI,oBAAc,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAC,GAAG,GAAgB,IAAI,IAAI,EAC7E,8BACI,KAAK,EAAC,iBAAiB,qBACN,KAAK,GAAG,OAAO,GAAG,IAAI,EACvC,GAAG,EAAE,EAAE,IAAI,IAAI,CAAC,WAAW,GAAG,EAAE,EAChC,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE,EACnC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,KAAK,EAAE,KAAK,IACR,IAAI,CAAC,mBAAmB,GAEnC,KAAK,CACG,CACF,EACT;GACL;;;;;;;AAGL,IAAI,WAAW,GAAG,CAAC,CAAC;;;;;","names":[],"sources":["./src/components/textarea/textarea.scss?tag=wcs-textarea&encapsulation=shadow","./src/components/textarea/textarea.tsx"],"sourcesContent":["@import '../../style/focus-outline.scss';\n\n:host {\n --wcs-textarea-icon-color: var(--wcs-text-medium);\n --wcs-internal-textarea-border-radius-left: var(--wcs-textarea-border-radius-left, var(--wcs-border-radius));\n --wcs-internal-textarea-border-radius-right: var(--wcs-textarea-border-radius-right, var(--wcs-border-radius));\n --wcs-internal-textarea-border-width: 2px;\n --wcs-textarea-max-height: unset;\n display: flex;\n flex-direction: row;\n width: 100%;\n border-radius: var(--wcs-internal-textarea-border-radius-left) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-right) var(--wcs-internal-textarea-border-radius-left);\n background-color: var(--wcs-light);\n border: var(--wcs-internal-textarea-border-width) solid var(--wcs-light);\n background-clip: padding-box;\n\n ::placeholder {\n font-weight: 400;\n font-style: italic;\n }\n\n textarea {\n overflow: auto;\n flex: 1;\n width: 100%;\n box-sizing: border-box;\n min-height: var(--wcs-size-m);\n max-height: var(--wcs-textarea-max-height);\n background-color: transparent;\n font-family: var(--wcs-font-sans-serif);\n color: var(--wcs-primary);\n font-weight: var(--wcs-font-weight-form-value) !important;\n border: none;\n // On divise --wcs-internal-input-border-width par deux car la valeur du padding est appliquée en haut et en bas\n padding: calc(calc(var(--wcs-padding) / 2) - calc(var(--wcs-internal-textarea-border-width) / 2)) calc(var(--wcs-padding) - var(--wcs-internal-textarea-border-width));\n font-size: 1rem;\n line-height: 1.5;\n }\n\n textarea:focus {\n box-shadow: none;\n outline: 0;\n }\n\n wcs-mat-icon {\n position: relative;\n margin-top: 7px;\n margin-left: 8px;\n margin-right: -8px;\n }\n}\n\n:host([disabled]) {\n textarea {\n color: var(--wcs-text-disabled);\n cursor: not-allowed;\n }\n}\n\n:host([state=error]) {\n border-color: var(--wcs-red) !important;\n}\n\n:host(:focus-within) {\n border: dashed var(--wcs-internal-textarea-border-width) var(--wcs-primary);\n\n wcs-mat-icon {\n color: var(--wcs-primary);\n }\n}\n","import {\n Component,\n ComponentInterface,\n Method,\n Prop,\n State,\n Watch,\n h,\n Host,\n EventEmitter,\n Element,\n Event,\n Build,\n readTask\n} from '@stencil/core';\nimport { debounceEvent, findItemLabel, inheritAttributes, raf } from '../../utils/helpers';\nimport { TextareaChangeEventDetail } from './textarea-interface';\n\n/**\n * Mainly inspired from Ionic Textarea Component\n *\n * @cssprop --wcs-textarea-max-height - Max height of the text area component\n *\n */\n@Component({\n tag: 'wcs-textarea',\n styleUrl: 'textarea.scss',\n shadow: true,\n})\nexport class Textarea implements ComponentInterface {\n private nativeInput?: HTMLTextAreaElement;\n private inputId = `wcs-textarea-${textareaIds++}`;\n private didBlurAfterEdit = false;\n private inheritedAttributes: { [k: string]: any } = {};\n\n /**\n * This is required for a WebKit bug which requires us to\n * blur and focus an input to properly focus the input in\n * an item with delegatesFocus. It will no longer be needed\n * with iOS 14.\n *\n * @internal\n */\n @Prop() fireFocusEvents = true;\n\n @Element() private el!: HTMLElement;\n\n @State() private hasFocus = false;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalize = 'none';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop({mutable: true}) clearOnEdit = false;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `wcsChange` event after each keystroke. This also impacts form bindings such as `ngModel` or `v-model`.\n */\n @Prop() debounce = 0;\n\n @Watch('debounce')\n protected debounceChanged() {\n this.wcsChange = debounceEvent(this.wcsChange, this.debounce);\n }\n\n /**\n * If `true`, the user cannot interact with the textarea.\n */\n @Prop() disabled = false;\n\n /**\n * Name of the material icon to add to the input\n */\n @Prop() icon: string;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?: 'none' | 'text' | 'tel' | 'url' | 'email' | 'numeric' | 'decimal' | 'search';\n\n /**\n * A hint to the browser for which enter key to display.\n * Possible values: `\"enter\"`, `\"done\"`, `\"go\"`, `\"next\"`,\n * `\"previous\"`, `\"search\"`, and `\"send\"`.\n */\n @Prop() enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop() readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Specifies the state of the input. By default the input is in an initial state but you can set it to 'error' state if the data given by the user is not valid.\n */\n @Prop({reflect: true}) state: 'initial' | 'error' = 'initial';\n\n /**\n * The visible width of the text control, in average character widths. If it is specified, it must be a positive integer.\n */\n @Prop() cols?: number;\n\n /**\n * The number of visible text lines for the control.\n */\n @Prop() rows?: number;\n\n /**\n * Indicates how the control wraps text.\n */\n @Prop() wrap?: 'hard' | 'soft' | 'off';\n\n /**\n * If `true`, the element height will increase based on the value.\n */\n @Prop() autoGrow = false;\n\n /**\n * The value of the textarea.\n */\n @Prop({mutable: true}) value?: string | null = '';\n\n /**\n * Indicates how the textarea should be resizable.\n * Possible values 'both' | 'none' | 'vertical' | 'horizontal'\n */\n @Prop({reflect: true}) resize?: 'both' | 'none' | 'vertical' | 'horizontal';\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n const nativeInput = this.nativeInput;\n const value = this.getValue();\n if (nativeInput && nativeInput.value !== value) {\n nativeInput.value = value;\n }\n this.runAutoGrow();\n this.wcsChange.emit({value});\n }\n\n /**\n * Emitted when the input value has changed.\n */\n @Event() wcsChange!: EventEmitter<TextareaChangeEventDetail>;\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() wcsInput!: EventEmitter<KeyboardEvent>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() wcsBlur!: EventEmitter<FocusEvent>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() wcsFocus!: EventEmitter<FocusEvent>;\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidLoad', {\n detail: this.el\n }));\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(new CustomEvent('wcsInputDidUnload', {\n detail: this.el\n }));\n }\n }\n\n componentWillLoad() {\n this.inheritedAttributes = inheritAttributes(this.el, ['title']);\n }\n\n componentDidLoad() {\n raf(() => this.runAutoGrow());\n }\n\n private runAutoGrow() {\n const nativeInput = this.nativeInput;\n if (nativeInput && this.autoGrow) {\n readTask(() => {\n nativeInput.style.height = 'auto';\n nativeInput.style.height = nativeInput.scrollHeight + 'px';\n });\n }\n }\n\n /**\n * This method make the textarea automatically adopt the size of the content without a scroll bar\n */\n @Method()\n async fitContent() {\n raf(() => this.runAutoGrow());\n }\n\n /**\n * Sets focus on the native `textarea` in `wcs-textarea`. Use this method instead of the global\n * `textarea.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n }\n }\n\n /**\n * Sets blur on the native `textarea` in `wcs-textarea`. Use this method instead of the global\n * `textarea.blur()`.\n * @internal\n */\n @Method()\n async setBlur() {\n if (this.nativeInput) {\n this.nativeInput.blur();\n }\n }\n\n /**\n * Returns the native `<textarea>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLTextAreaElement> {\n // tslint:disable-next-line:no-non-null-assertion\n return Promise.resolve(this.nativeInput!);\n }\n\n /**\n * Check if we need to clear the text input if clearOnEdit is enabled\n */\n private checkClearOnEdit() {\n if (!this.clearOnEdit) {\n return;\n }\n\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.value = '';\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n\n private focusChange() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (this.clearOnEdit && !this.hasFocus && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue() !== '';\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private onInput = (ev: Event) => {\n if (this.nativeInput) {\n this.value = this.nativeInput.value;\n }\n this.wcsInput.emit(ev as KeyboardEvent);\n }\n\n private onFocus = (ev: FocusEvent) => {\n this.hasFocus = true;\n this.focusChange();\n\n if (this.fireFocusEvents) {\n this.wcsFocus.emit(ev);\n }\n }\n\n private onBlur = (ev: FocusEvent) => {\n this.hasFocus = false;\n this.focusChange();\n\n if (this.fireFocusEvents) {\n this.wcsBlur.emit(ev);\n }\n }\n\n private onKeyDown = () => {\n this.checkClearOnEdit();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const label = findItemLabel(this.el);\n if (label) {\n label.id = labelId;\n }\n const style = {\n ...(this.resize && {'resize': this.resize})\n }\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n >\n {this.icon ? (<wcs-mat-icon icon={this.icon} size=\"m\"></wcs-mat-icon>) : null}\n <textarea\n class=\"native-textarea\"\n aria-labelledby={label ? labelId : null}\n ref={el => this.nativeInput = el}\n autoCapitalize={this.autocapitalize}\n autoFocus={this.autofocus}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n disabled={this.disabled}\n maxLength={this.maxlength}\n minLength={this.minlength}\n name={this.name}\n placeholder={this.placeholder || ''}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n cols={this.cols}\n rows={this.rows}\n wrap={this.wrap}\n onInput={this.onInput}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n onKeyDown={this.onKeyDown}\n style={style}\n {...this.inheritedAttributes}\n >\n {value}\n </textarea>\n </Host>\n );\n }\n}\n\nlet textareaIds = 0;\n"],"version":3}