@beeq/core 1.7.0 → 1.8.0-beta.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 (285) hide show
  1. package/dist/beeq/beeq.esm.js +1 -1
  2. package/dist/beeq/beeq.esm.js.map +1 -1
  3. package/dist/beeq/{p-a062b9c4.entry.js → p-235328ee.entry.js} +2 -2
  4. package/dist/beeq/{p-c88ca7e9.entry.js → p-255fcbe4.entry.js} +2 -2
  5. package/dist/beeq/{p-5402707e.entry.js → p-268dc1e3.entry.js} +2 -2
  6. package/dist/beeq/p-38d4bd8a.js +6 -0
  7. package/dist/beeq/p-38d4bd8a.js.map +1 -0
  8. package/dist/beeq/{p-7691bdfc.entry.js → p-3aa41d80.entry.js} +2 -2
  9. package/dist/beeq/{p-6b824dba.entry.js → p-3b2ce34b.entry.js} +2 -2
  10. package/dist/beeq/p-3fd0d92d.js.map +1 -1
  11. package/dist/beeq/{p-a2157e4d.entry.js → p-41bac721.entry.js} +2 -2
  12. package/dist/beeq/{p-d9a3844f.entry.js → p-4739f5c3.entry.js} +2 -2
  13. package/dist/beeq/{p-889e6317.entry.js → p-4ba2bec7.entry.js} +2 -2
  14. package/dist/beeq/{p-d4ca1283.entry.js → p-52577f3a.entry.js} +2 -2
  15. package/dist/beeq/{p-2e8e7e37.entry.js → p-571b40ff.entry.js} +2 -2
  16. package/dist/beeq/{p-fbb780c2.entry.js → p-606c080c.entry.js} +2 -2
  17. package/dist/beeq/{p-21a51ee0.entry.js → p-633319f3.entry.js} +2 -2
  18. package/dist/beeq/p-63ad9702.entry.js +6 -0
  19. package/dist/beeq/p-63ad9702.entry.js.map +1 -0
  20. package/dist/beeq/{p-8b870d05.entry.js → p-6e026fad.entry.js} +2 -2
  21. package/dist/beeq/p-76e714c6.js +7 -0
  22. package/dist/beeq/p-76e714c6.js.map +1 -0
  23. package/dist/beeq/{p-4291b23f.entry.js → p-79b7547b.entry.js} +2 -2
  24. package/dist/beeq/{p-a453d36c.entry.js → p-7f23cde7.entry.js} +2 -2
  25. package/dist/beeq/{p-4f8ce653.entry.js → p-8059836c.entry.js} +2 -2
  26. package/dist/beeq/p-8b7c7049.entry.js +6 -0
  27. package/dist/beeq/p-8b7c7049.entry.js.map +1 -0
  28. package/dist/beeq/{p-64835973.entry.js → p-90c5851d.entry.js} +2 -2
  29. package/dist/beeq/{p-3711298a.entry.js → p-94d62f1b.entry.js} +2 -2
  30. package/dist/beeq/{p-61c97bdc.entry.js → p-96d7f361.entry.js} +2 -2
  31. package/dist/beeq/{p-cec068b9.entry.js → p-9acfedb8.entry.js} +2 -2
  32. package/dist/beeq/p-9acfedb8.entry.js.map +1 -0
  33. package/dist/beeq/p-9c6c6646.entry.js +6 -0
  34. package/dist/beeq/p-9c6c6646.entry.js.map +1 -0
  35. package/dist/beeq/{p-a9ca89e7.entry.js → p-9cd26e8d.entry.js} +2 -2
  36. package/dist/beeq/{p-bcf6e585.entry.js → p-9f40249f.entry.js} +2 -2
  37. package/dist/beeq/{p-9c3030c7.entry.js → p-a006be9e.entry.js} +2 -2
  38. package/dist/beeq/{p-b2c55a62.entry.js → p-a7b0fd0b.entry.js} +2 -2
  39. package/dist/beeq/p-a8cb8989.entry.js +6 -0
  40. package/dist/beeq/p-a8cb8989.entry.js.map +1 -0
  41. package/dist/beeq/{p-c3e33045.entry.js → p-ae8ffb81.entry.js} +2 -2
  42. package/dist/beeq/p-af062402.js +6 -0
  43. package/dist/beeq/p-af062402.js.map +1 -0
  44. package/dist/beeq/{p-39f3d9d2.entry.js → p-b7281046.entry.js} +2 -2
  45. package/dist/beeq/{p-d62cad31.entry.js → p-b90c6de9.entry.js} +2 -2
  46. package/dist/beeq/{p-aae41e31.entry.js → p-b9544567.entry.js} +2 -2
  47. package/dist/beeq/p-b9544567.entry.js.map +1 -0
  48. package/dist/beeq/{p-f7d3f428.entry.js → p-be664fb0.entry.js} +2 -2
  49. package/dist/beeq/{p-819acf02.entry.js → p-c9c942e6.entry.js} +2 -2
  50. package/dist/beeq/{p-ec4a6d10.entry.js → p-d2bbae3b.entry.js} +2 -2
  51. package/dist/beeq/p-d2bbae3b.entry.js.map +1 -0
  52. package/dist/beeq/{p-bcc85103.entry.js → p-ddb23180.entry.js} +2 -2
  53. package/dist/beeq/{p-67367b7d.entry.js → p-e6382462.entry.js} +2 -2
  54. package/dist/beeq/{p-554d0f45.entry.js → p-eab59153.entry.js} +2 -2
  55. package/dist/beeq/{p-02202605.entry.js → p-eddb77c7.entry.js} +2 -2
  56. package/dist/cjs/app-globals-b11284b9.js.map +1 -1
  57. package/dist/cjs/beeq.cjs.js +2 -2
  58. package/dist/cjs/bq-accordion-group.cjs.entry.js +1 -1
  59. package/dist/cjs/bq-accordion.cjs.entry.js +1 -1
  60. package/dist/cjs/bq-alert.cjs.entry.js +1 -1
  61. package/dist/cjs/bq-avatar.cjs.entry.js +1 -1
  62. package/dist/cjs/bq-badge.cjs.entry.js +1 -1
  63. package/dist/cjs/bq-breadcrumb-item.cjs.entry.js +1 -1
  64. package/dist/cjs/bq-breadcrumb.cjs.entry.js +1 -1
  65. package/dist/cjs/bq-button_2.cjs.entry.js +23 -19
  66. package/dist/cjs/bq-button_2.cjs.entry.js.map +1 -1
  67. package/dist/cjs/bq-card.cjs.entry.js +1 -1
  68. package/dist/cjs/bq-checkbox.cjs.entry.js +56 -5
  69. package/dist/cjs/bq-checkbox.cjs.entry.js.map +1 -1
  70. package/dist/cjs/bq-date-picker.cjs.entry.js +1 -1
  71. package/dist/cjs/bq-dialog.cjs.entry.js +2 -2
  72. package/dist/cjs/bq-divider.cjs.entry.js +1 -1
  73. package/dist/cjs/bq-drawer.cjs.entry.js +6 -6
  74. package/dist/cjs/bq-drawer.cjs.entry.js.map +1 -1
  75. package/dist/cjs/bq-dropdown_2.cjs.entry.js +2 -2
  76. package/dist/cjs/bq-empty-state.cjs.entry.js +1 -1
  77. package/dist/cjs/bq-input.cjs.entry.js +41 -14
  78. package/dist/cjs/bq-input.cjs.entry.js.map +1 -1
  79. package/dist/cjs/bq-notification.cjs.entry.js +1 -1
  80. package/dist/cjs/bq-option-group.cjs.entry.js +1 -1
  81. package/dist/cjs/bq-option-list_2.cjs.entry.js +4 -4
  82. package/dist/cjs/bq-option.cjs.entry.js +1 -1
  83. package/dist/cjs/bq-page-title.cjs.entry.js +1 -1
  84. package/dist/cjs/bq-progress.cjs.entry.js +1 -1
  85. package/dist/cjs/bq-radio-group.cjs.entry.js +1 -1
  86. package/dist/cjs/bq-radio.cjs.entry.js +1 -1
  87. package/dist/cjs/bq-select.cjs.entry.js +74 -26
  88. package/dist/cjs/bq-select.cjs.entry.js.map +1 -1
  89. package/dist/cjs/bq-side-menu-item.cjs.entry.js +1 -1
  90. package/dist/cjs/bq-side-menu.cjs.entry.js +1 -1
  91. package/dist/cjs/bq-slider.cjs.entry.js +1 -1
  92. package/dist/cjs/bq-spinner.cjs.entry.js +1 -1
  93. package/dist/cjs/bq-status.cjs.entry.js +1 -1
  94. package/dist/cjs/bq-step-item.cjs.entry.js +1 -1
  95. package/dist/cjs/bq-steps.cjs.entry.js +1 -1
  96. package/dist/cjs/bq-switch.cjs.entry.js +1 -1
  97. package/dist/cjs/bq-tab-group.cjs.entry.js +31 -15
  98. package/dist/cjs/bq-tab-group.cjs.entry.js.map +1 -1
  99. package/dist/cjs/bq-tab.cjs.entry.js +13 -7
  100. package/dist/cjs/bq-tab.cjs.entry.js.map +1 -1
  101. package/dist/cjs/bq-tab.types-a8b320b0.js +15 -0
  102. package/dist/cjs/bq-tab.types-a8b320b0.js.map +1 -0
  103. package/dist/cjs/bq-textarea.cjs.entry.js +4 -4
  104. package/dist/cjs/bq-toast.cjs.entry.js +2 -2
  105. package/dist/cjs/bq-tooltip.cjs.entry.js +3 -3
  106. package/dist/cjs/{index-a09d1c08.js → index-e4c116b6.js} +12 -9
  107. package/dist/cjs/index-e4c116b6.js.map +1 -0
  108. package/dist/cjs/{index-76b0999c.js → index-e6d59dbb.js} +30 -2
  109. package/dist/cjs/index-e6d59dbb.js.map +1 -0
  110. package/dist/cjs/loader.cjs.js +2 -2
  111. package/dist/collection/components/checkbox/bq-checkbox.js +67 -3
  112. package/dist/collection/components/checkbox/bq-checkbox.js.map +1 -1
  113. package/dist/collection/components/dialog/scss/bq-dialog.css +1 -1
  114. package/dist/collection/components/drawer/bq-drawer.js +7 -5
  115. package/dist/collection/components/drawer/bq-drawer.js.map +1 -1
  116. package/dist/collection/components/drawer/scss/bq-drawer.css +1 -1
  117. package/dist/collection/components/icon/helper/request.js +23 -19
  118. package/dist/collection/components/icon/helper/request.js.map +1 -1
  119. package/dist/collection/components/input/bq-input.js +34 -13
  120. package/dist/collection/components/input/bq-input.js.map +1 -1
  121. package/dist/collection/components/select/bq-select.js +68 -26
  122. package/dist/collection/components/select/bq-select.js.map +1 -1
  123. package/dist/collection/components/select/scss/bq-select.css +1 -1
  124. package/dist/collection/components/tab/bq-tab.js +62 -4
  125. package/dist/collection/components/tab/bq-tab.js.map +1 -1
  126. package/dist/collection/components/tab/bq-tab.types.js +2 -0
  127. package/dist/collection/components/tab/bq-tab.types.js.map +1 -1
  128. package/dist/collection/components/tab/scss/bq-tab.css +1 -1
  129. package/dist/collection/components/tab-group/bq-tab-group.js +81 -14
  130. package/dist/collection/components/tab-group/bq-tab-group.js.map +1 -1
  131. package/dist/collection/components/tab-group/scss/bq-tab-group.css +1 -1
  132. package/dist/collection/components/tag/bq-tag.js +3 -3
  133. package/dist/collection/components/textarea/bq-textarea.js +3 -3
  134. package/dist/collection/components/toast/bq-toast.js +1 -1
  135. package/dist/collection/components/tooltip/bq-tooltip.js +1 -1
  136. package/dist/components/bq-checkbox.js +53 -6
  137. package/dist/components/bq-checkbox.js.map +1 -1
  138. package/dist/components/bq-dialog.js +1 -1
  139. package/dist/components/bq-drawer.js +5 -5
  140. package/dist/components/bq-drawer.js.map +1 -1
  141. package/dist/components/bq-icon2.js +23 -19
  142. package/dist/components/bq-icon2.js.map +1 -1
  143. package/dist/components/bq-input.js +35 -13
  144. package/dist/components/bq-input.js.map +1 -1
  145. package/dist/components/bq-select.js +68 -25
  146. package/dist/components/bq-select.js.map +1 -1
  147. package/dist/components/bq-tab-group.js +36 -16
  148. package/dist/components/bq-tab-group.js.map +1 -1
  149. package/dist/components/bq-tab.js +17 -7
  150. package/dist/components/bq-tab.js.map +1 -1
  151. package/dist/components/bq-tab.types.js +3 -1
  152. package/dist/components/bq-tab.types.js.map +1 -1
  153. package/dist/components/bq-tag2.js +3 -3
  154. package/dist/components/bq-textarea.js +3 -3
  155. package/dist/components/bq-toast.js +1 -1
  156. package/dist/components/bq-tooltip2.js +1 -1
  157. package/dist/components/index2.js +11 -8
  158. package/dist/components/index2.js.map +1 -1
  159. package/dist/esm/app-globals-de5a646b.js.map +1 -1
  160. package/dist/esm/beeq.js +3 -3
  161. package/dist/esm/bq-accordion-group.entry.js +1 -1
  162. package/dist/esm/bq-accordion.entry.js +1 -1
  163. package/dist/esm/bq-alert.entry.js +1 -1
  164. package/dist/esm/bq-avatar.entry.js +1 -1
  165. package/dist/esm/bq-badge.entry.js +1 -1
  166. package/dist/esm/bq-breadcrumb-item.entry.js +1 -1
  167. package/dist/esm/bq-breadcrumb.entry.js +1 -1
  168. package/dist/esm/bq-button_2.entry.js +23 -19
  169. package/dist/esm/bq-button_2.entry.js.map +1 -1
  170. package/dist/esm/bq-card.entry.js +1 -1
  171. package/dist/esm/bq-checkbox.entry.js +56 -5
  172. package/dist/esm/bq-checkbox.entry.js.map +1 -1
  173. package/dist/esm/bq-date-picker.entry.js +1 -1
  174. package/dist/esm/bq-dialog.entry.js +2 -2
  175. package/dist/esm/bq-divider.entry.js +1 -1
  176. package/dist/esm/bq-drawer.entry.js +6 -6
  177. package/dist/esm/bq-drawer.entry.js.map +1 -1
  178. package/dist/esm/bq-dropdown_2.entry.js +2 -2
  179. package/dist/esm/bq-empty-state.entry.js +1 -1
  180. package/dist/esm/bq-input.entry.js +41 -14
  181. package/dist/esm/bq-input.entry.js.map +1 -1
  182. package/dist/esm/bq-notification.entry.js +1 -1
  183. package/dist/esm/bq-option-group.entry.js +1 -1
  184. package/dist/esm/bq-option-list_2.entry.js +4 -4
  185. package/dist/esm/bq-option.entry.js +1 -1
  186. package/dist/esm/bq-page-title.entry.js +1 -1
  187. package/dist/esm/bq-progress.entry.js +1 -1
  188. package/dist/esm/bq-radio-group.entry.js +1 -1
  189. package/dist/esm/bq-radio.entry.js +1 -1
  190. package/dist/esm/bq-select.entry.js +74 -26
  191. package/dist/esm/bq-select.entry.js.map +1 -1
  192. package/dist/esm/bq-side-menu-item.entry.js +1 -1
  193. package/dist/esm/bq-side-menu.entry.js +1 -1
  194. package/dist/esm/bq-slider.entry.js +1 -1
  195. package/dist/esm/bq-spinner.entry.js +1 -1
  196. package/dist/esm/bq-status.entry.js +1 -1
  197. package/dist/esm/bq-step-item.entry.js +1 -1
  198. package/dist/esm/bq-steps.entry.js +1 -1
  199. package/dist/esm/bq-switch.entry.js +1 -1
  200. package/dist/esm/bq-tab-group.entry.js +31 -15
  201. package/dist/esm/bq-tab-group.entry.js.map +1 -1
  202. package/dist/esm/bq-tab.entry.js +13 -7
  203. package/dist/esm/bq-tab.entry.js.map +1 -1
  204. package/dist/esm/bq-tab.types-36e2666e.js +11 -0
  205. package/dist/esm/bq-tab.types-36e2666e.js.map +1 -0
  206. package/dist/esm/bq-textarea.entry.js +4 -4
  207. package/dist/esm/bq-toast.entry.js +2 -2
  208. package/dist/esm/bq-tooltip.entry.js +3 -3
  209. package/dist/esm/{index-138f308e.js → index-136429a6.js} +12 -9
  210. package/dist/esm/index-136429a6.js.map +1 -0
  211. package/dist/esm/{index-7eed7a88.js → index-efc1c2ef.js} +30 -2
  212. package/dist/esm/index-efc1c2ef.js.map +1 -0
  213. package/dist/esm/loader.js +3 -3
  214. package/dist/hydrate/index.js +294 -105
  215. package/dist/hydrate/index.mjs +294 -105
  216. package/dist/stencil.config.js +1 -4
  217. package/dist/stencil.config.js.map +1 -1
  218. package/dist/types/components/checkbox/bq-checkbox.d.ts +9 -0
  219. package/dist/types/components/drawer/bq-drawer.d.ts +3 -1
  220. package/dist/types/components/input/bq-input.d.ts +4 -1
  221. package/dist/types/components/select/bq-select.d.ts +18 -0
  222. package/dist/types/components/tab/bq-tab.d.ts +5 -1
  223. package/dist/types/components/tab/bq-tab.types.d.ts +4 -0
  224. package/dist/types/components/tab-group/bq-tab-group.d.ts +5 -1
  225. package/dist/types/components.d.ts +42 -2
  226. package/package.json +24 -24
  227. package/dist/beeq/p-0f528ec6.js +0 -6
  228. package/dist/beeq/p-0f528ec6.js.map +0 -1
  229. package/dist/beeq/p-1d3f236b.entry.js +0 -6
  230. package/dist/beeq/p-1d3f236b.entry.js.map +0 -1
  231. package/dist/beeq/p-3a1f06e1.entry.js +0 -6
  232. package/dist/beeq/p-3a1f06e1.entry.js.map +0 -1
  233. package/dist/beeq/p-463a17cf.js +0 -7
  234. package/dist/beeq/p-463a17cf.js.map +0 -1
  235. package/dist/beeq/p-48b27aef.entry.js +0 -6
  236. package/dist/beeq/p-48b27aef.entry.js.map +0 -1
  237. package/dist/beeq/p-68fdea6a.js +0 -6
  238. package/dist/beeq/p-68fdea6a.js.map +0 -1
  239. package/dist/beeq/p-7567ae06.entry.js +0 -6
  240. package/dist/beeq/p-7567ae06.entry.js.map +0 -1
  241. package/dist/beeq/p-aae41e31.entry.js.map +0 -1
  242. package/dist/beeq/p-cec068b9.entry.js.map +0 -1
  243. package/dist/beeq/p-ec4a6d10.entry.js.map +0 -1
  244. package/dist/cjs/bq-tab.types-9fe0234a.js +0 -11
  245. package/dist/cjs/bq-tab.types-9fe0234a.js.map +0 -1
  246. package/dist/cjs/index-76b0999c.js.map +0 -1
  247. package/dist/cjs/index-a09d1c08.js.map +0 -1
  248. package/dist/esm/bq-tab.types-f64aa67d.js +0 -9
  249. package/dist/esm/bq-tab.types-f64aa67d.js.map +0 -1
  250. package/dist/esm/index-138f308e.js.map +0 -1
  251. package/dist/esm/index-7eed7a88.js.map +0 -1
  252. /package/dist/beeq/{p-a062b9c4.entry.js.map → p-235328ee.entry.js.map} +0 -0
  253. /package/dist/beeq/{p-c88ca7e9.entry.js.map → p-255fcbe4.entry.js.map} +0 -0
  254. /package/dist/beeq/{p-5402707e.entry.js.map → p-268dc1e3.entry.js.map} +0 -0
  255. /package/dist/beeq/{p-7691bdfc.entry.js.map → p-3aa41d80.entry.js.map} +0 -0
  256. /package/dist/beeq/{p-6b824dba.entry.js.map → p-3b2ce34b.entry.js.map} +0 -0
  257. /package/dist/beeq/{p-a2157e4d.entry.js.map → p-41bac721.entry.js.map} +0 -0
  258. /package/dist/beeq/{p-d9a3844f.entry.js.map → p-4739f5c3.entry.js.map} +0 -0
  259. /package/dist/beeq/{p-889e6317.entry.js.map → p-4ba2bec7.entry.js.map} +0 -0
  260. /package/dist/beeq/{p-d4ca1283.entry.js.map → p-52577f3a.entry.js.map} +0 -0
  261. /package/dist/beeq/{p-2e8e7e37.entry.js.map → p-571b40ff.entry.js.map} +0 -0
  262. /package/dist/beeq/{p-fbb780c2.entry.js.map → p-606c080c.entry.js.map} +0 -0
  263. /package/dist/beeq/{p-21a51ee0.entry.js.map → p-633319f3.entry.js.map} +0 -0
  264. /package/dist/beeq/{p-8b870d05.entry.js.map → p-6e026fad.entry.js.map} +0 -0
  265. /package/dist/beeq/{p-4291b23f.entry.js.map → p-79b7547b.entry.js.map} +0 -0
  266. /package/dist/beeq/{p-a453d36c.entry.js.map → p-7f23cde7.entry.js.map} +0 -0
  267. /package/dist/beeq/{p-4f8ce653.entry.js.map → p-8059836c.entry.js.map} +0 -0
  268. /package/dist/beeq/{p-64835973.entry.js.map → p-90c5851d.entry.js.map} +0 -0
  269. /package/dist/beeq/{p-3711298a.entry.js.map → p-94d62f1b.entry.js.map} +0 -0
  270. /package/dist/beeq/{p-61c97bdc.entry.js.map → p-96d7f361.entry.js.map} +0 -0
  271. /package/dist/beeq/{p-a9ca89e7.entry.js.map → p-9cd26e8d.entry.js.map} +0 -0
  272. /package/dist/beeq/{p-bcf6e585.entry.js.map → p-9f40249f.entry.js.map} +0 -0
  273. /package/dist/beeq/{p-9c3030c7.entry.js.map → p-a006be9e.entry.js.map} +0 -0
  274. /package/dist/beeq/{p-b2c55a62.entry.js.map → p-a7b0fd0b.entry.js.map} +0 -0
  275. /package/dist/beeq/{p-c3e33045.entry.js.map → p-ae8ffb81.entry.js.map} +0 -0
  276. /package/dist/beeq/{p-39f3d9d2.entry.js.map → p-b7281046.entry.js.map} +0 -0
  277. /package/dist/beeq/{p-d62cad31.entry.js.map → p-b90c6de9.entry.js.map} +0 -0
  278. /package/dist/beeq/{p-f7d3f428.entry.js.map → p-be664fb0.entry.js.map} +0 -0
  279. /package/dist/beeq/{p-819acf02.entry.js.map → p-c9c942e6.entry.js.map} +0 -0
  280. /package/dist/beeq/{p-bcc85103.entry.js.map → p-ddb23180.entry.js.map} +0 -0
  281. /package/dist/beeq/{p-67367b7d.entry.js.map → p-e6382462.entry.js.map} +0 -0
  282. /package/dist/beeq/{p-554d0f45.entry.js.map → p-eab59153.entry.js.map} +0 -0
  283. /package/dist/beeq/{p-02202605.entry.js.map → p-eddb77c7.entry.js.map} +0 -0
  284. /package/dist/types/{home/runner/work/BEEQ/BEEQ → Users/dramos/PROJECTs/ENDAVA/BEEQ-Design-System}/packages/beeq/.stencil/packages/beeq/stencil.config.d.ts +0 -0
  285. /package/dist/types/{home/runner/work/BEEQ/BEEQ → Users/dramos/PROJECTs/ENDAVA/BEEQ-Design-System}/packages/beeq/.stencil/tailwind.config.d.ts +0 -0
@@ -4,37 +4,41 @@
4
4
  */
5
5
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
6
6
  import { g as getBasePath } from './assetsPath.js';
7
+ import { i as isNil } from './isNil.js';
7
8
  import { i as isString } from './isString.js';
8
9
  import { g as getColorCSSVariable } from './cssVariables.js';
9
- import { i as isNil } from './isNil.js';
10
10
 
11
11
  /* -------------------------------------------------------------------------- */
12
12
  const requests = new Map();
13
13
  const fetchSvg = async (url, sanitize) => {
14
- let req;
15
- if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {
16
- const rsp = await fetch(url);
17
- if (rsp.ok) {
18
- return rsp.text().then((svgContent) => {
19
- if (svgContent && sanitize !== false)
20
- svgContent = validateContent(svgContent);
21
- iconContent.set(url, svgContent || '');
22
- });
14
+ if (typeof fetch === 'undefined' || typeof document === 'undefined')
15
+ return;
16
+ if (requests.has(url))
17
+ return requests.get(url);
18
+ try {
19
+ const response = await fetch(url);
20
+ if (!response.ok) {
21
+ iconContent.set(url, '');
22
+ return;
23
23
  }
24
+ let svgContent = (await response.text()) || '';
25
+ if (svgContent && sanitize !== false)
26
+ svgContent = validateContent(svgContent);
27
+ iconContent.set(url, svgContent);
28
+ }
29
+ catch (error) {
30
+ console.error(`[BqIcon] Failed to fetch SVG from ${url}:`, error);
24
31
  iconContent.set(url, '');
25
- // cache for the same requests
26
- requests.set(url, req);
27
- return req;
28
32
  }
29
- iconContent.set(url, '');
30
- return Promise.resolve();
31
33
  };
32
34
  const iconContent = new Map();
33
35
  const getSvgContent = async (url, sanitize) => {
34
- // see if we already have a request for this SVG file
35
- const req = await requests.get(url);
36
- if (!req)
37
- return fetchSvg(url, sanitize);
36
+ let req = requests.get(url);
37
+ // NOTE: if the request does not exists we will cache it
38
+ if (isNil(req)) {
39
+ req = fetchSvg(url, sanitize);
40
+ requests.set(url, req);
41
+ }
38
42
  return req;
39
43
  };
40
44
  const validateContent = (svgContent) => {
@@ -1 +1 @@
1
- {"file":"bq-icon2.js","mappings":";;;;;;;;;;AAAA;AAMA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,GAAW,EAAE,QAAiB;IACpD,IAAI,GAAqB,CAAC;IAE1B,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,EAAE;QACnE,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,C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AI,CACV;sHACgH,CACjH,CAAC;;;QAGF,MAAM,OAAO,GAAG,SAAS,CAAC;QAC1B,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC;;;QAGtE,MAAM,YAAY,GAAG,cAAc,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;;;QAG7D,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,YAAY,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACzB;;;;IAaD,iBAAiB;QACf,IAAI,CAAC,iBAAiB,EAAE,CAAC;;QAGzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC;KACpD;;;;IAwCD,MAAM;;QACJ,MAAM,MAAM,GAAG;YACb,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1E,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SAC1D,CAAC;QAEF,QACE,EAAC,IAAI,qDAAC,KAAK,EAAE,MAAM,IACjB,0EACc,MAAA,IAAI,CAAC,KAAK,mCAAI,GAAG,IAAI,CAAC,IAAI,OAAO,EAC7C,KAAK,EAAC,8EAA8E,EACpF,SAAS,EAAE,IAAI,CAAC,WAAW,EAC3B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,KAAK,GACV,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["../../packages/beeq/src/components/icon/helper/request.ts","../../packages/beeq/src/components/icon/scss/bq-icon.scss?tag=bq-icon&encapsulation=shadow","../../packages/beeq/src/components/icon/bq-icon.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Icon request helper */\n/* -------------------------------------------------------------------------- */\n\nimport { isString } from '../../../shared/utils';\n\nconst requests = new Map<string, Promise<unknown>>();\n\nconst fetchSvg = async (url: string, sanitize: boolean): Promise<unknown> => {\n let req: Promise<unknown>;\n\n if (typeof fetch !== 'undefined' && typeof document !== 'undefined') {\n const rsp = await fetch(url);\n if (rsp.ok) {\n return rsp.text().then((svgContent) => {\n if (svgContent && sanitize !== false) svgContent = validateContent(svgContent);\n iconContent.set(url, svgContent || '');\n });\n }\n iconContent.set(url, '');\n // cache for the same requests\n requests.set(url, req);\n return req;\n }\n\n iconContent.set(url, '');\n return Promise.resolve();\n};\n\nexport const iconContent = new Map<string, string>();\n\nexport const getSvgContent = async (url: string, sanitize: boolean) => {\n // see if we already have a request for this SVG file\n const req = await requests.get(url);\n if (!req) return fetchSvg(url, sanitize);\n\n return req;\n};\n\nexport const validateContent = (svgContent: string): string => {\n const svgTag = 'svg';\n const iconCssClass = 'bq-icon__svg';\n\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== svgTag) {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === svgTag) {\n // keep other CSS classes (if there's any) and add the `bq-icon__svg` CSS class\n const othersCssClasses = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', `${othersCssClasses} ${iconCssClass}`.trim());\n // set the shadow DOM part for the SVG element\n svgElm.setAttribute('part', svgTag);\n\n // remove height and width attribute, if for some reason they are still present in the SVG tag\n svgElm.removeAttribute('height');\n svgElm.removeAttribute('width');\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) return div.innerHTML;\n }\n\n return '';\n};\n\nexport const isValid = (elm: HTMLElement): boolean => {\n if (elm.nodeType === Node.ELEMENT_NODE) {\n if (elm.nodeName.toLowerCase() === 'script') return false;\n\n for (const attribute of Array.from(elm.attributes)) {\n const value = attribute.value;\n if (isString(value) && value.toLowerCase().startsWith('on')) {\n return false;\n }\n }\n\n for (const childNode of Array.from(elm.children) as HTMLElement[]) {\n if (!isValid(childNode)) return false;\n }\n }\n return true;\n};\n","/* -------------------------------------------------------------------------- */\n/* Icon styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-icon.variables';\n\n:host {\n @apply inline-block;\n}\n\n/**\n * This class is added on packages/beeq/src/components/icon/helper/request.ts\n * See lines 42 and 58 for details.\n */\n.bq-icon__svg {\n @apply scale-x-[--bq-icon--direction];\n}\n","import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\n\nimport { TIconWeight } from './bq-icon.types';\nimport { getSvgContent, iconContent } from './helper/request';\nimport { getBasePath, getColorCSSVariable, isNil } from '../../shared/utils';\n\n/**\n * Icons are simplified images that graphically explain the meaning of an object on the screen.\n *\n * @part base - The component's internal wrapper that holds the icon SVG content.\n * @part svg - The `<svg>` tag element inside the component.\n */\n@Component({\n assetsDirs: ['svg'],\n tag: 'bq-icon',\n styleUrl: './scss/bq-icon.scss',\n shadow: true,\n})\nexport class BqIcon {\n // Own Properties\n // ====================\n\n // Reference to host HTML element\n // ===================================\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private _svgContent: string;\n\n // Public Property API\n // ========================\n\n /** Label for the icon, used for accessibility */\n @Prop({ reflect: true }) label?: string;\n\n /** Set the stroke color of the SVG. The value should be a valid value of the palette color */\n @Prop({ reflect: true }) color?: string;\n\n /** Icon name to load. Please check all available icons [here](https://phosphoricons.com/) */\n @Prop({ reflect: true }) name!: string;\n\n /** Set the size of the SVG */\n @Prop({ reflect: true }) size?: string | number = 24;\n\n /** Set the source of the SVG. If the source is set, the name property will be ignored */\n @Prop({ reflect: true }) src?: string;\n\n /** @deprecated It set the icon weight/style */\n @Prop({ reflect: true }) weight?: TIconWeight = undefined;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('color')\n @Watch('name')\n @Watch('size')\n handlePropsChange() {\n this.loadIcon(this.name);\n }\n\n /**\n * !TO BE REMOVED: Delete this `@Watch()` once the deprecated `weight` property is removed\n * We need to maintain retro-compatibility until the next major release\n */\n @Watch('weight')\n handleWeightChange() {\n if (this.name.includes(this.weight)) return;\n\n console.warn(\n `❗️ [bq-icon]: the 'weight' property is deprecated, you should add the weight to the icon name.\\n\n For example, '<bq-icon name=\"bell-fill\"></bq-icon>' instead of '<bq-icon name=\"bell\" weight=\"fill\"></bq-icon>'`,\n );\n // Check if the icon is weighted. An icon is considered weighted if its weight is not 'regular' and ENV_SVG_PATH is not set.\n // Eg: if the weight is 'bold' and ENV_SVG_PATH is not set, isWeightedIcon will be true.\n const REGULAR = 'regular';\n const isWeightedIcon = !isNil(this.weight) && this.weight !== REGULAR;\n // If the icon is weighted, append the weight to the icon name. Otherwise, append nothing.\n // Eg: if isWeightedIcon is true and the weight is 'bold', weightSuffix will be '-bold'.\n const weightSuffix = isWeightedIcon ? `-${this.weight}` : '';\n // Construct the icon name by appending the weight suffix (if any) and the file extension.\n // Eg: if the name is 'my-icon' and weightSuffix is '-bold', iconName will be 'my-icon-bold.svg'.\n const iconName = `${this.name}${weightSuffix}`;\n this.loadIcon(iconName);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler to be called when the SVG has loaded */\n @Event() svgLoaded: EventEmitter;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n connectedCallback() {\n this.handlePropsChange();\n\n // !TO BE REMOVED: Delete this once the deprecated `weight` property is removed\n if (!isNil(this.weight)) this.handleWeightChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private getIconSource = (name: string) => {\n if (!this.name && !this.src) return;\n // Return the src if it is set\n if (this.src) return this.src;\n\n const SVG_EXTENSION = '.svg';\n const iconFileName = `${name}${SVG_EXTENSION}`;\n\n return getBasePath(iconFileName);\n };\n\n private loadIcon = (name: string) => {\n const url = this.getIconSource(name);\n getSvgContent(url, true).then(() => {\n this._svgContent = iconContent.get(url);\n this.svgLoaded.emit(this._svgContent);\n });\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const styles = {\n ...(this.color && { '--bq-icon--color': getColorCSSVariable(this.color) }),\n ...(this.size && { '--bq-icon--size': `${this.size}px` }),\n };\n\n return (\n <Host style={styles}>\n <div\n aria-label={this.label ?? `${this.name} icon`}\n class=\"flex text-[color:--bq-icon--color] bs-[--bq-icon--size] is-[--bq-icon--size]\"\n innerHTML={this._svgContent}\n part=\"base\"\n role=\"img\"\n />\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"bq-icon2.js","mappings":";;;;;;;;;;AAAA;AAMA,MAAM,QAAQ,GAAG,IAAI,GAAG,EAA4B,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,GAAW,EAAE,QAAiB;IACpD,IAAI,OAAO,KAAK,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAE5E,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAEhD,IAAI;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;YAChB,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACzB,OAAO;SACR;QAED,IAAI,UAAU,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;QAE/C,IAAI,UAAU,IAAI,QAA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,MAAM,YAAY,GAAG,cAAc,GAAG,IAAI,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC;;;QAG7D,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,YAAY,EAAE,CAAC;QAC/C,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;KACzB;;;;IAaD,iBAAiB;QACf,IAAI,CAAC,iBAAiB,EAAE,CAAC;;QAGzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC;KACpD;;;;IAwCD,MAAM;;QACJ,MAAM,MAAM,GAAG;YACb,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,kBAAkB,EAAE,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1E,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;SAC1D,CAAC;QAEF,QACE,EAAC,IAAI,qDAAC,KAAK,EAAE,MAAM,IACjB,0EACc,MAAA,IAAI,CAAC,KAAK,mCAAI,GAAG,IAAI,CAAC,IAAI,OAAO,EAC7C,KAAK,EAAC,8EAA8E,EACpF,SAAS,EAAE,IAAI,CAAC,WAAW,EAC3B,IAAI,EAAC,MAAM,EACX,IAAI,EAAC,KAAK,GACV,CACG,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["../../packages/beeq/src/components/icon/helper/request.ts","../../packages/beeq/src/components/icon/scss/bq-icon.scss?tag=bq-icon&encapsulation=shadow","../../packages/beeq/src/components/icon/bq-icon.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Icon request helper */\n/* -------------------------------------------------------------------------- */\n\nimport { isNil, isString } from '../../../shared/utils';\n\nconst requests = new Map<string, Promise<unknown>>();\n\nconst fetchSvg = async (url: string, sanitize: boolean): Promise<unknown> => {\n if (typeof fetch === 'undefined' || typeof document === 'undefined') return;\n\n if (requests.has(url)) return requests.get(url);\n\n try {\n const response = await fetch(url);\n\n if (!response.ok) {\n iconContent.set(url, '');\n return;\n }\n\n let svgContent = (await response.text()) || '';\n\n if (svgContent && sanitize !== false) svgContent = validateContent(svgContent);\n\n iconContent.set(url, svgContent);\n } catch (error) {\n console.error(`[BqIcon] Failed to fetch SVG from ${url}:`, error);\n iconContent.set(url, '');\n }\n};\n\nexport const iconContent = new Map<string, string>();\n\nexport const getSvgContent = async (url: string, sanitize: boolean) => {\n let req = requests.get(url);\n\n // NOTE: if the request does not exists we will cache it\n if (isNil(req)) {\n req = fetchSvg(url, sanitize);\n requests.set(url, req);\n }\n return req;\n};\n\nexport const validateContent = (svgContent: string): string => {\n const svgTag = 'svg';\n const iconCssClass = 'bq-icon__svg';\n\n const div = document.createElement('div');\n div.innerHTML = svgContent;\n\n for (let i = div.childNodes.length - 1; i >= 0; i--) {\n if (div.childNodes[i].nodeName.toLowerCase() !== svgTag) {\n div.removeChild(div.childNodes[i]);\n }\n }\n\n // must only have 1 root element\n const svgElm = div.firstElementChild;\n if (svgElm && svgElm.nodeName.toLowerCase() === svgTag) {\n // keep other CSS classes (if there's any) and add the `bq-icon__svg` CSS class\n const othersCssClasses = svgElm.getAttribute('class') || '';\n svgElm.setAttribute('class', `${othersCssClasses} ${iconCssClass}`.trim());\n // set the shadow DOM part for the SVG element\n svgElm.setAttribute('part', svgTag);\n\n // remove height and width attribute, if for some reason they are still present in the SVG tag\n svgElm.removeAttribute('height');\n svgElm.removeAttribute('width');\n\n // root element must be an svg\n // lets double check we've got valid elements\n // do not allow scripts\n if (isValid(svgElm as HTMLElement)) return div.innerHTML;\n }\n\n return '';\n};\n\nexport const isValid = (elm: HTMLElement): boolean => {\n if (elm.nodeType === Node.ELEMENT_NODE) {\n if (elm.nodeName.toLowerCase() === 'script') return false;\n\n for (const attribute of Array.from(elm.attributes)) {\n const value = attribute.value;\n if (isString(value) && value.toLowerCase().startsWith('on')) {\n return false;\n }\n }\n\n for (const childNode of Array.from(elm.children) as HTMLElement[]) {\n if (!isValid(childNode)) return false;\n }\n }\n return true;\n};\n","/* -------------------------------------------------------------------------- */\n/* Icon styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-icon.variables';\n\n:host {\n @apply inline-block;\n}\n\n/**\n * This class is added on packages/beeq/src/components/icon/helper/request.ts\n * See lines 42 and 58 for details.\n */\n.bq-icon__svg {\n @apply scale-x-[--bq-icon--direction];\n}\n","import { Component, Event, EventEmitter, h, Host, Prop, State, Watch } from '@stencil/core';\n\nimport { TIconWeight } from './bq-icon.types';\nimport { getSvgContent, iconContent } from './helper/request';\nimport { getBasePath, getColorCSSVariable, isNil } from '../../shared/utils';\n\n/**\n * Icons are simplified images that graphically explain the meaning of an object on the screen.\n *\n * @part base - The component's internal wrapper that holds the icon SVG content.\n * @part svg - The `<svg>` tag element inside the component.\n */\n@Component({\n assetsDirs: ['svg'],\n tag: 'bq-icon',\n styleUrl: './scss/bq-icon.scss',\n shadow: true,\n})\nexport class BqIcon {\n // Own Properties\n // ====================\n\n // Reference to host HTML element\n // ===================================\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() private _svgContent: string;\n\n // Public Property API\n // ========================\n\n /** Label for the icon, used for accessibility */\n @Prop({ reflect: true }) label?: string;\n\n /** Set the stroke color of the SVG. The value should be a valid value of the palette color */\n @Prop({ reflect: true }) color?: string;\n\n /** Icon name to load. Please check all available icons [here](https://phosphoricons.com/) */\n @Prop({ reflect: true }) name!: string;\n\n /** Set the size of the SVG */\n @Prop({ reflect: true }) size?: string | number = 24;\n\n /** Set the source of the SVG. If the source is set, the name property will be ignored */\n @Prop({ reflect: true }) src?: string;\n\n /** @deprecated It set the icon weight/style */\n @Prop({ reflect: true }) weight?: TIconWeight = undefined;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('color')\n @Watch('name')\n @Watch('size')\n handlePropsChange() {\n this.loadIcon(this.name);\n }\n\n /**\n * !TO BE REMOVED: Delete this `@Watch()` once the deprecated `weight` property is removed\n * We need to maintain retro-compatibility until the next major release\n */\n @Watch('weight')\n handleWeightChange() {\n if (this.name.includes(this.weight)) return;\n\n console.warn(\n `❗️ [bq-icon]: the 'weight' property is deprecated, you should add the weight to the icon name.\\n\n For example, '<bq-icon name=\"bell-fill\"></bq-icon>' instead of '<bq-icon name=\"bell\" weight=\"fill\"></bq-icon>'`,\n );\n // Check if the icon is weighted. An icon is considered weighted if its weight is not 'regular' and ENV_SVG_PATH is not set.\n // Eg: if the weight is 'bold' and ENV_SVG_PATH is not set, isWeightedIcon will be true.\n const REGULAR = 'regular';\n const isWeightedIcon = !isNil(this.weight) && this.weight !== REGULAR;\n // If the icon is weighted, append the weight to the icon name. Otherwise, append nothing.\n // Eg: if isWeightedIcon is true and the weight is 'bold', weightSuffix will be '-bold'.\n const weightSuffix = isWeightedIcon ? `-${this.weight}` : '';\n // Construct the icon name by appending the weight suffix (if any) and the file extension.\n // Eg: if the name is 'my-icon' and weightSuffix is '-bold', iconName will be 'my-icon-bold.svg'.\n const iconName = `${this.name}${weightSuffix}`;\n this.loadIcon(iconName);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler to be called when the SVG has loaded */\n @Event() svgLoaded: EventEmitter;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n connectedCallback() {\n this.handlePropsChange();\n\n // !TO BE REMOVED: Delete this once the deprecated `weight` property is removed\n if (!isNil(this.weight)) this.handleWeightChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private getIconSource = (name: string) => {\n if (!this.name && !this.src) return;\n // Return the src if it is set\n if (this.src) return this.src;\n\n const SVG_EXTENSION = '.svg';\n const iconFileName = `${name}${SVG_EXTENSION}`;\n\n return getBasePath(iconFileName);\n };\n\n private loadIcon = (name: string) => {\n const url = this.getIconSource(name);\n getSvgContent(url, true).then(() => {\n this._svgContent = iconContent.get(url);\n this.svgLoaded.emit(this._svgContent);\n });\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n const styles = {\n ...(this.color && { '--bq-icon--color': getColorCSSVariable(this.color) }),\n ...(this.size && { '--bq-icon--size': `${this.size}px` }),\n };\n\n return (\n <Host style={styles}>\n <div\n aria-label={this.label ?? `${this.name} icon`}\n class=\"flex text-[color:--bq-icon--color] bs-[--bq-icon--size] is-[--bq-icon--size]\"\n innerHTML={this._svgContent}\n part=\"base\"\n role=\"img\"\n />\n </Host>\n );\n }\n}\n"],"version":3}
@@ -7,6 +7,7 @@ import './assetsPath.js';
7
7
  import { d as debounce } from './debounce.js';
8
8
  import { i as isDefined } from './isDefined.js';
9
9
  import { i as isHTMLElement } from './isHTMLElement.js';
10
+ import { i as isNil } from './isNil.js';
10
11
  import { b as hasSlotContent } from './slot.js';
11
12
  import { d as defineCustomElement$3 } from './bq-button2.js';
12
13
  import { d as defineCustomElement$2 } from './bq-icon2.js';
@@ -24,6 +25,7 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
24
25
  this.bqClear = createEvent(this, "bqClear", 7);
25
26
  this.bqFocus = createEvent(this, "bqFocus", 7);
26
27
  this.bqInput = createEvent(this, "bqInput", 7);
28
+ this.internals = this.attachInternals();
27
29
  this.fallbackInputId = 'input';
28
30
  // Listeners
29
31
  // ==============
@@ -55,6 +57,7 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
55
57
  if (!isHTMLElement(ev.target, 'input'))
56
58
  return;
57
59
  this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;
60
+ this.internals.setFormValue(`${this.value}`);
58
61
  this.debounceBqInput = debounce(() => {
59
62
  this.bqInput.emit({ value: this.value, el: this.el });
60
63
  }, this.debounceTime);
@@ -66,18 +69,29 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
66
69
  if (!isHTMLElement(ev.target, 'input'))
67
70
  return;
68
71
  this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;
72
+ this.internals.setFormValue(`${this.value}`);
69
73
  this.bqChange.emit({ value: this.value, el: this.el });
70
74
  };
71
- this.handleClearClick = (ev) => {
75
+ this.handleClear = () => {
72
76
  if (this.disabled)
73
77
  return;
74
- this.inputElem.value = '';
75
- this.value = this.inputElem.value;
76
- this.bqClear.emit(this.el);
77
- this.bqInput.emit({ value: this.value, el: this.el });
78
- this.bqChange.emit({ value: this.value, el: this.el });
79
- this.inputElem.focus();
78
+ const { inputElem, internals } = this;
79
+ // Clear input element value
80
+ inputElem.value = '';
81
+ this.value = inputElem.value;
82
+ // Update associated form control value
83
+ internals.setFormValue(undefined);
84
+ };
85
+ this.handleClearClick = (ev) => {
80
86
  ev.stopPropagation();
87
+ this.handleClear();
88
+ const { bqClear, bqChange, bqInput, el, inputElem } = this;
89
+ // Emit events
90
+ bqClear.emit(el);
91
+ bqInput.emit({ value: this.value, el });
92
+ bqChange.emit({ value: this.value, el });
93
+ // Refocus input element
94
+ inputElem.focus();
81
95
  };
82
96
  this.handleLabelSlotChange = () => {
83
97
  this.hasLabel = hasSlotContent(this.labelElem);
@@ -125,41 +139,49 @@ const BqInput$1 = /*@__PURE__*/ proxyCustomElement(class BqInput extends HTMLEle
125
139
  handleValueChange() {
126
140
  if (Array.isArray(this.value)) {
127
141
  this.hasValue = this.value.some((val) => val.length > 0);
142
+ this.internals.setFormValue(this.value.join(','));
128
143
  return;
129
144
  }
130
145
  this.hasValue = isDefined(this.value);
146
+ this.internals.setFormValue(`${this.value}`);
131
147
  }
132
148
  // Component lifecycle events
133
149
  // Ordered by their natural call order
134
150
  // =====================================
135
- componentDidLoad() {
151
+ componentWillLoad() {
136
152
  this.handleValueChange();
137
153
  }
154
+ formResetCallback() {
155
+ if (isNil(this.value))
156
+ return;
157
+ this.handleClear();
158
+ }
138
159
  // render() function
139
160
  // Always the last one in the class.
140
161
  // ===================================
141
162
  render() {
142
- return (h("div", { key: '1ae2deecd4fa19bd61218aa9d19f904484920f41', class: "bq-input", part: "base" }, h("label", { key: '9de5803ed7c8d8a8a891f9e18956ea35c826c8f4', class: { 'bq-input--label': true, '!hidden': !this.hasLabel }, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '7f0c67232346e6f3b4406a85dc32f8cff07bf92f', name: "label", onSlotchange: this.handleLabelSlotChange })), h("div", { key: '81fc67ce7d417e3bd058b002084b5d4caf4d34b3', class: {
163
+ return (h("div", { key: 'c9d184b8abfbaebda3478f7b8892c7d2bf024fdc', class: "bq-input", part: "base" }, h("label", { key: 'a938804cb78f78b65c1c2139d90fd98e5edecb52', class: { 'bq-input--label': true, '!hidden': !this.hasLabel }, htmlFor: this.name || this.fallbackInputId, ref: (labelElem) => (this.labelElem = labelElem), part: "label" }, h("slot", { key: '37c407ab1b0399be8371629431d839f138f751df', name: "label", onSlotchange: this.handleLabelSlotChange })), h("div", { key: '130305745ed36bbe2d1012508f3ae2653b6794b2', class: {
143
164
  'bq-input--control': true,
144
165
  [`validation-${this.validationStatus}`]: true,
145
166
  disabled: this.disabled,
146
- }, part: "control" }, h("span", { key: '21bfb1ba4c4696c903d89912a9792a516229065e', class: { 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: '6c1e6fadf86ac71e4625a76ef4db47145f7f0536', name: "prefix", onSlotchange: this.handlePrefixSlotChange })), h("input", { key: '2a9f590bebc2e4ee3c499f9b886fbb8e93c5dd4e', id: this.name || this.fallbackInputId, class: "bq-input--control__input", "aria-disabled": this.disabled ? 'true' : 'false', autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, disabled: this.disabled, form: this.form, inputMode: this.inputmode, max: this.max, maxLength: this.maxlength, min: this.min, minLength: this.minlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, ref: (inputElem) => (this.inputElem = inputElem), readOnly: this.readonly, required: this.required, step: this.step, type: this.type, value: this.value, part: "input",
167
+ }, part: "control" }, h("span", { key: '59c8d5f28373cae3741f4420da1fbc4744869806', class: { 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }, ref: (spanElem) => (this.prefixElem = spanElem), part: "prefix" }, h("slot", { key: '4f6a705b9a4e7deb46e334c11c6b242b091afec6', name: "prefix", onSlotchange: this.handlePrefixSlotChange })), h("input", { key: '6c238b5c2329d3f77dd4cb8a0aac9ffbfc937aad', id: this.name || this.fallbackInputId, class: "bq-input--control__input", "aria-disabled": this.disabled ? 'true' : 'false', autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, disabled: this.disabled, form: this.form, inputMode: this.inputmode, max: this.max, maxLength: this.maxlength, min: this.min, minLength: this.minlength, name: this.name, pattern: this.pattern, placeholder: this.placeholder, ref: (inputElem) => (this.inputElem = inputElem), readOnly: this.readonly, required: this.required, step: this.step, type: this.type, value: this.value, part: "input",
147
168
  // Events
148
169
  onBlur: this.handleBlur, onChange: this.handleChange, onFocus: this.handleFocus, onInput: this.handleInput }), this.hasValue && !this.disabled && !this.disableClear && (
149
170
  // The clear button will be visible as long as the input has a value
150
171
  // and the parent group is hovered or has focus-within
151
- h("bq-button", { key: 'bf70483fba3d6702235ef13cc233264d54e2ee56', class: "bq-input--control__clear ms-[--bq-input--gap] hidden", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button" }, h("slot", { key: 'c373c061079d75103a196ad5e02abc5d1b6b6419', name: "clear-icon" }, h("bq-icon", { key: 'd95569e369733dd13595fbe1e48ae52dea01f86f', name: "x-circle", class: "flex" })))), h("span", { key: 'ef24c4e495c264be6568fcd69eb26bdb8759cd45', class: { 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }, ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: '387273312fe4b196a2ab360af65a625761396a74', name: "suffix", onSlotchange: this.handleSuffixSlotChange }))), h("div", { key: '1d053fcabb1ea861b787af8a6e859592d04a1ed7', class: {
172
+ h("bq-button", { key: 'bae89f316a8c7cfb04d1bcff8df6e418c93fa838', class: "bq-input--control__clear ms-[--bq-input--gap] hidden", appearance: "text", "aria-label": this.clearButtonLabel, size: "small", onBqClick: this.handleClearClick, part: "clear-btn", exportparts: "button" }, h("slot", { key: 'd00287e78d20d2fdcbac8aa89a3bb30c40c6b8f1', name: "clear-icon" }, h("bq-icon", { key: '9be1f57ece6cea670a5c7adc76fb70feb66663c5', name: "x-circle", class: "flex" })))), h("span", { key: '93421c6d1e061e2a19315d1d8aadbcc2a01f19c3', class: { 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }, ref: (spanElem) => (this.suffixElem = spanElem), part: "suffix" }, h("slot", { key: 'ccb589bdc3b227467885d728c82f3fcedacb1695', name: "suffix", onSlotchange: this.handleSuffixSlotChange }))), h("div", { key: 'b0374c936b4e3839ed936ade23ad59aa3c69cf9a', class: {
152
173
  [`bq-input--helper-text validation-${this.validationStatus}`]: true,
153
174
  '!hidden': !this.hasHelperText,
154
- }, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: '71c49f2521db11b80a1c0dc8ae4466411a732ea6', name: "helper-text", onSlotchange: this.handleHelperTextSlotChange }))));
175
+ }, ref: (divElem) => (this.helperTextElem = divElem), part: "helper-text" }, h("slot", { key: 'a0a8c8d546efa959d6126e96ddf97a702263026f', name: "helper-text", onSlotchange: this.handleHelperTextSlotChange }))));
155
176
  }
156
177
  static get delegatesFocus() { return true; }
178
+ static get formAssociated() { return true; }
157
179
  get el() { return this; }
158
180
  static get watchers() { return {
159
181
  "value": ["handleValueChange"]
160
182
  }; }
161
183
  static get style() { return BqInputStyle0; }
162
- }, [17, "bq-input", {
184
+ }, [81, "bq-input", {
163
185
  "autocapitalize": [513],
164
186
  "autocomplete": [513],
165
187
  "autocorrect": [513],
@@ -1 +1 @@
1
- {"file":"bq-input.js","mappings":";;;;;;;;;;;;;AAAA,MAAM,UAAU,GAAG,0p5BAA0p5B,CAAC;AAC9q5B,sBAAe,UAAU;;MCsBZA,SAAO;;;;;;;;;;QAWV,oBAAe,GAAG,OAAO,CAAC;;;;;;;;;;;;;QAoM1B,eAAU,GAAG;YACnB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC3B,CAAC;QAEM,gBAAW,GAAG;YACpB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC5B,CAAC;QAEM,gBAAW,GAAG,CAAC,EAAS;;YAC9B,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,MAAA,IAAI,CAAC,eAAe,0CAAE,MAAM,EAAE,CAAC;YAE/B,IAAI,CAAC,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;gBAAE,OAAO;YAC/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,KAAK,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;YAEhF,IAAI,CAAC,eAAe,GAAG,QAAQ,CAAC;gBAC9B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC;aACvD,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;YACtB,IAAI,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AAE,CAAC,OAAO,MAAM,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,EACjD,IAAI,EAAC,aAAa,IAElB,6DAAM,IAAI,EAAC,aAAa,EAAC,YAAY,EAAE,IAAI,CAAC,0BAA0B,GAAI,CACtE,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["BqInput"],"sources":["../../packages/beeq/src/components/input/scss/bq-input.scss?tag=bq-input&encapsulation=shadow","../../packages/beeq/src/components/input/bq-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Input styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-input.variables';\n\n:host {\n @apply block is-full;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Label and Helper text */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--label {\n @apply flex flex-grow items-center m-be-[--bq-input--label-margin-bottom];\n @apply text-[length:--bq-input--label-text-size] text-[color:--bq-input--label-text-color];\n}\n\n.bq-input--helper-text {\n @apply text-[length:--bq-input--helper-text-size] text-[color:--bq-input--helper-text-color] m-bs-[--bq-input--helper-margin-top];\n}\n\n.bq-input--helper-text.validation-error {\n @apply text-text-danger;\n}\n\n.bq-input--helper-text.validation-success {\n @apply text-text-success;\n}\n\n.bq-input--helper-text.validation-warning {\n @apply text-text-warning;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input group control */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control {\n @apply flex items-center transition-[border-color,box-shadow] is-full;\n // Border\n @apply rounded-[--bq-input--border-radius] border-[length:--bq-input--border-width] border-[color:--bq-input--border-color];\n // Padding\n @apply pe-[--bq-input--padding-end] ps-[--bq-input--padding-start] p-b-[--bq-input--paddingY];\n // Text\n @apply text-[length:--bq-input--text-size] text-[color:--bq-input--text-color] placeholder:text-[color:--bq-input--text-placeholder-color];\n // Hover\n @apply [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-brand;\n\n border-style: var(--bq-input--border-style);\n\n // Focus\n &:not(.disabled):focus-within {\n --bq-ring-width: 1px;\n --bq-ring-offset-width: 0;\n --bq-ring-color-focus: var(--bq-input--border-color-focus);\n\n @apply focus border-[color:--bq-input--border-color-focus];\n }\n\n // Enable clear button whenever the input group control is hovered or has focus\n &:not(.disabled):hover,\n &:not(.disabled):focus-within {\n .bq-input--control__clear {\n @apply inline-block;\n }\n }\n}\n\n.bq-input--control.disabled {\n @apply cursor-not-allowed opacity-60;\n}\n\n/* ------------------------------- Validation ------------------------------- */\n\n.bq-input--control.validation-error {\n @apply border-stroke-danger [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-danger;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.danger);\n\n @apply border-active-stroke-danger;\n }\n}\n\n.bq-input--control.validation-success {\n @apply border-stroke-success [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-success;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.success);\n\n @apply border-active-stroke-success;\n }\n}\n\n.bq-input--control.validation-warning {\n @apply border-stroke-warning [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-warning;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.warning);\n\n @apply border-active-stroke-warning;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* Native HTML Input */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__input {\n @apply flex-auto cursor-[inherit] appearance-none bg-[inherit] font-[inherit] text-[length:inherit] text-[color:inherit];\n @apply border-none min-bs-[--bq-input--icon-size] min-is-0 m-b-0 m-i-0 p-b-0 p-i-0 focus:outline-none focus-visible:outline-none;\n\n box-shadow: none;\n font-weight: inherit;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Clear button */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__clear::part(button) {\n // Since the clear button is inside the input group control,\n // we need to reset the focus ring styles\n --bq-ring-width: initial;\n --bq-ring-offset-width: initial;\n --bq-ring-color-focus: initial;\n\n @apply rounded-xs border-none bs-auto p-b-0 p-i-0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Prefix and suffix */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__prefix,\n.bq-input--control__suffix {\n @apply pointer-events-none flex items-center text-[color:--bq-input--text-color];\n}\n\n.bq-input--control__prefix {\n @apply me-[--bq-input--gap];\n}\n\n.bq-input--control__suffix {\n @apply ms-[--bq-input--gap];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Slotted and internal icons */\n/* -------------------------------------------------------------------------- */\n\nbq-icon,\n::slotted(bq-icon) {\n --bq-icon--size: var(--bq-input--icon-size) !important;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Hide webkit clear button */\n/* -------------------------------------------------------------------------- */\n\n/* Remove clear controls from search input */\n\n.bq-input--control__input::-moz-search-cancel {\n @apply hidden appearance-none;\n}\n\n.bq-input--control__input::-webkit-search-decoration,\n.bq-input--control__input::-webkit-search-cancel-button,\n.bq-input--control__input::-webkit-search-results-button,\n.bq-input--control__input::-webkit-search-results-decoration {\n @apply hidden appearance-none;\n}\n\n/* Remove native control extra padding from input date and datetime */\n\n.bq-input--control__input::-webkit-datetime-edit-fields-wrapper,\n.bq-input--control__input::-webkit-datetime-edit,\n.bq-input--control__input::-webkit-datetime-edit-year-field,\n.bq-input--control__input::-webkit-datetime-edit-month-field,\n.bq-input--control__input::-webkit-datetime-edit-day-field,\n.bq-input--control__input::-webkit-datetime-edit-hour-field,\n.bq-input--control__input::-webkit-datetime-edit-minute-field,\n.bq-input--control__input::-webkit-datetime-edit-second-field,\n.bq-input--control__input::-webkit-datetime-edit-millisecond-field,\n.bq-input--control__input::-webkit-datetime-edit-meridiem-field {\n @apply p-b-0 p-i-0;\n}\n","import { Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\n\nimport { TInputType, TInputValidation, TInputValue } from './bq-input.types';\nimport { debounce, hasSlotContent, isDefined, isHTMLElement, TDebounce } from '../../shared/utils';\n\n/**\n * @part base - The component's base wrapper.\n * @part button - The native HTML button used under the hood in the clear button.\n * @part clear-btn - The clear button.\n * @part control - The input control wrapper.\n * @part helper-text - The helper text slot container.\n * @part label - The label slot container.\n * @part input - The native HTML input element used under the hood.\n * @part prefix - The prefix slot container.\n * @part suffix - The suffix slot container.\n */\n@Component({\n tag: 'bq-input',\n styleUrl: './scss/bq-input.scss',\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqInput {\n // Own Properties\n // ====================\n\n private helperTextElem?: HTMLElement;\n private inputElem?: HTMLInputElement;\n private labelElem?: HTMLElement;\n private prefixElem?: HTMLElement;\n private suffixElem?: HTMLElement;\n\n private debounceBqInput: TDebounce<void>;\n private fallbackInputId = 'input';\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqInputElement;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() hasHelperText = false;\n @State() hasLabel = false;\n @State() hasPrefix = false;\n @State() hasSuffix = false;\n @State() hasValue = false;\n\n // Public Property API\n // ========================\n\n /**\n * Controls whether or not the input field should be capitalized and how.\n * Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize\n */\n @Prop({ reflect: true }) autocapitalize: string = 'off';\n\n /**\n * Specifies whether or not the input field should have autocomplete enabled.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n */\n @Prop({ reflect: true }) autocomplete: string = 'off';\n\n /**\n * Controls whether or not the input field should have autocorrect enabled.\n * Possible values are 'on' and 'off'.\n */\n @Prop({ reflect: true }) autocorrect: 'on' | 'off' = 'off';\n\n /** If true, the input will be focused on component render */\n @Prop({ reflect: true }) autofocus: boolean;\n\n /** The clear button aria label */\n @Prop({ reflect: true }) clearButtonLabel? = 'Clear value';\n\n /**\n * The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes.\n * A value of 0 means no debouncing will occur.\n */\n @Prop({ reflect: true, mutable: true }) debounceTime? = 0;\n\n /**\n * Indicates whether the input is disabled or not.\n * If `true`, the input is disabled and cannot be interacted with.\n */\n @Prop({ mutable: true }) disabled?: boolean = false;\n\n /** If true, the clear button won't be displayed */\n @Prop({ reflect: true }) disableClear? = false;\n\n /** The ID of the form that the input field belongs to. */\n @Prop({ reflect: true }) form?: string;\n\n /**\n * The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field.\n * This allows a browser to display an appropriate virtual keyboard while editing.\n * Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.\n */\n @Prop() inputmode?: string;\n\n /**\n * The maximum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) max?: number | string;\n\n /** The maximum number of characters that the input field can accept. */\n @Prop({ reflect: true }) maxlength: number;\n\n /**\n * The minimum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) min?: number | string;\n\n /** The minimum number of characters that the input field can accept. */\n @Prop({ reflect: true }) minlength: number;\n\n /** The input field name. */\n @Prop({ reflect: true }) name!: string;\n\n /**\n * Specifies a regular expression the form control's value should match.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern\n */\n @Prop({ reflect: true }) pattern?: string;\n\n /** The input placeholder text value */\n @Prop({ reflect: true }) placeholder?: string;\n\n /** If true, the input field cannot be modified. */\n @Prop({ reflect: true }) readonly?: boolean;\n\n /** Indicates whether or not the input field is required to be filled out before submitting the form. */\n @Prop({ reflect: true }) required?: boolean;\n\n /**\n * A number that specifies the granularity that the value must adhere to.\n * Valid for date, month, week, time, datetime-local, number, and range.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @Prop({ reflect: true }) step: number | 'any';\n\n /**\n * The type attribute specifies the type of input field to display.\n * Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n */\n @Prop({ reflect: true }) type: TInputType = 'text';\n\n /**\n * The validation status of the input.\n *\n * @remarks\n * This property is used to indicate the validation status of the input. It can be set to one of the following values:\n * - `'none'`: No validation status is set.\n * - `'error'`: The input has a validation error.\n * - `'warning'`: The input has a validation warning.\n * - `'success'`: The input has passed validation.\n */\n @Prop({ reflect: true }) validationStatus: TInputValidation = 'none';\n\n /** The input value, it can be used to reset the input to a previous value */\n @Prop({ reflect: true, mutable: true }) value: TInputValue;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('value')\n handleValueChange() {\n if (Array.isArray(this.value)) {\n this.hasValue = this.value.some((val) => val.length > 0);\n return;\n }\n\n this.hasValue = isDefined(this.value);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler emitted when the input loses focus */\n @Event() bqBlur!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value has changed and the input loses focus.\n * This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.\n */\n @Event() bqChange!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n /** Callback handler emitted when the input value has been cleared */\n @Event() bqClear!: EventEmitter<HTMLBqInputElement>;\n\n /** Callback handler emitted when the input has received focus */\n @Event() bqFocus!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value changes.\n * This handler is called whenever the user types or pastes text into the input field.\n */\n @Event() bqInput!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentDidLoad() {\n this.handleValueChange();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n if (this.disabled) return;\n\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n if (this.disabled) return;\n\n this.bqFocus.emit(this.el);\n };\n\n private handleInput = (ev: Event) => {\n if (this.disabled) return;\n\n this.debounceBqInput?.cancel();\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n\n this.debounceBqInput = debounce(() => {\n this.bqInput.emit({ value: this.value, el: this.el });\n }, this.debounceTime);\n this.debounceBqInput();\n };\n\n private handleChange = (ev: Event) => {\n if (this.disabled) return;\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n\n this.bqChange.emit({ value: this.value, el: this.el });\n };\n\n private handleClearClick = (ev: CustomEvent) => {\n if (this.disabled) return;\n\n this.inputElem.value = '';\n this.value = this.inputElem.value;\n\n this.bqClear.emit(this.el);\n this.bqInput.emit({ value: this.value, el: this.el });\n this.bqChange.emit({ value: this.value, el: this.el });\n this.inputElem.focus();\n\n ev.stopPropagation();\n };\n\n private handleLabelSlotChange = () => {\n this.hasLabel = hasSlotContent(this.labelElem);\n };\n\n private handlePrefixSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem);\n };\n\n private handleSuffixSlotChange = () => {\n this.hasSuffix = hasSlotContent(this.suffixElem);\n };\n\n private handleHelperTextSlotChange = () => {\n this.hasHelperText = hasSlotContent(this.helperTextElem);\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-input\" part=\"base\">\n {/* Label */}\n <label\n class={{ 'bq-input--label': true, '!hidden': !this.hasLabel }}\n htmlFor={this.name || this.fallbackInputId}\n ref={(labelElem) => (this.labelElem = labelElem)}\n part=\"label\"\n >\n <slot name=\"label\" onSlotchange={this.handleLabelSlotChange} />\n </label>\n {/* Input control group */}\n <div\n class={{\n 'bq-input--control': true,\n [`validation-${this.validationStatus}`]: true,\n disabled: this.disabled,\n }}\n part=\"control\"\n >\n {/* Prefix */}\n <span\n class={{ 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }}\n ref={(spanElem) => (this.prefixElem = spanElem)}\n part=\"prefix\"\n >\n <slot name=\"prefix\" onSlotchange={this.handlePrefixSlotChange} />\n </span>\n {/* HTML Input */}\n <input\n id={this.name || this.fallbackInputId}\n class=\"bq-input--control__input\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n disabled={this.disabled}\n form={this.form}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxlength}\n min={this.min}\n minLength={this.minlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n ref={(inputElem) => (this.inputElem = inputElem)}\n readOnly={this.readonly}\n required={this.required}\n step={this.step}\n type={this.type}\n value={this.value}\n part=\"input\"\n // Events\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onInput={this.handleInput}\n />\n {/* Clear Button */}\n {this.hasValue && !this.disabled && !this.disableClear && (\n // The clear button will be visible as long as the input has a value\n // and the parent group is hovered or has focus-within\n <bq-button\n class=\"bq-input--control__clear ms-[--bq-input--gap] hidden\"\n appearance=\"text\"\n aria-label={this.clearButtonLabel}\n size=\"small\"\n onBqClick={this.handleClearClick}\n part=\"clear-btn\"\n exportparts=\"button\"\n >\n <slot name=\"clear-icon\">\n <bq-icon name=\"x-circle\" class=\"flex\" />\n </slot>\n </bq-button>\n )}\n {/* Suffix */}\n <span\n class={{ 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }}\n ref={(spanElem) => (this.suffixElem = spanElem)}\n part=\"suffix\"\n >\n <slot name=\"suffix\" onSlotchange={this.handleSuffixSlotChange} />\n </span>\n </div>\n {/* Helper text */}\n <div\n class={{\n [`bq-input--helper-text validation-${this.validationStatus}`]: true,\n '!hidden': !this.hasHelperText,\n }}\n ref={(divElem) => (this.helperTextElem = divElem)}\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,WAAW,EAChB,WAAW,EAAC,QAAQ,IAEpB,6DAAM,IAAI,EAAC,YAAY,IACrB,gEAAS,IAAI,EAAC,UAAU,EAAC,KAAK,EAAC,MAAM,GAAG,CACnC,CACG,CACb,EAED,6DACE,KAAK,EAAE,EAAE,2BAA2B,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EACxE,GAAG,EAAE,CAAC,QAAQ,MAAM,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC,EAC/C,IAAI,EAAC,QAAQ,IAEb,6DAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,sBAAsB,GAAI,CAC5D,CACH,EAEN,4DACE,KAAK,EAAE;gBACL,CAAC,oCAAoC,IAAI,CAAC,gBAAgB,EAAE,GAAG,IAAI;gBACnE,SAAS,EAAE,CAAC,IAAI,CAAC,aAAa;aAC/B,EACD,GAAG,EAAE,CAAC,OAAO,MAAM,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,EACjD,IAAI,EAAC,aAAa,IAElB,6DAAM,IAAI,EAAC,aAAa,EAAC,YAAY,EAAE,IAAI,CAAC,0BAA0B,GAAI,CACtE,CACF,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["BqInput"],"sources":["../../packages/beeq/src/components/input/scss/bq-input.scss?tag=bq-input&encapsulation=shadow","../../packages/beeq/src/components/input/bq-input.tsx"],"sourcesContent":["/* -------------------------------------------------------------------------- */\n/* Input styles */\n/* -------------------------------------------------------------------------- */\n\n@import './bq-input.variables';\n\n:host {\n @apply block is-full;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Label and Helper text */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--label {\n @apply flex flex-grow items-center m-be-[--bq-input--label-margin-bottom];\n @apply text-[length:--bq-input--label-text-size] text-[color:--bq-input--label-text-color];\n}\n\n.bq-input--helper-text {\n @apply text-[length:--bq-input--helper-text-size] text-[color:--bq-input--helper-text-color] m-bs-[--bq-input--helper-margin-top];\n}\n\n.bq-input--helper-text.validation-error {\n @apply text-text-danger;\n}\n\n.bq-input--helper-text.validation-success {\n @apply text-text-success;\n}\n\n.bq-input--helper-text.validation-warning {\n @apply text-text-warning;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Input group control */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control {\n @apply flex items-center transition-[border-color,box-shadow] is-full;\n // Border\n @apply rounded-[--bq-input--border-radius] border-[length:--bq-input--border-width] border-[color:--bq-input--border-color];\n // Padding\n @apply pe-[--bq-input--padding-end] ps-[--bq-input--padding-start] p-b-[--bq-input--paddingY];\n // Text\n @apply text-[length:--bq-input--text-size] text-[color:--bq-input--text-color] placeholder:text-[color:--bq-input--text-placeholder-color];\n // Hover\n @apply [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-brand;\n\n border-style: var(--bq-input--border-style);\n\n // Focus\n &:not(.disabled):focus-within {\n --bq-ring-width: 1px;\n --bq-ring-offset-width: 0;\n --bq-ring-color-focus: var(--bq-input--border-color-focus);\n\n @apply focus border-[color:--bq-input--border-color-focus];\n }\n\n // Enable clear button whenever the input group control is hovered or has focus\n &:not(.disabled):hover,\n &:not(.disabled):focus-within {\n .bq-input--control__clear {\n @apply inline-block;\n }\n }\n}\n\n.bq-input--control.disabled {\n @apply cursor-not-allowed opacity-60;\n}\n\n/* ------------------------------- Validation ------------------------------- */\n\n.bq-input--control.validation-error {\n @apply border-stroke-danger [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-danger;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.danger);\n\n @apply border-active-stroke-danger;\n }\n}\n\n.bq-input--control.validation-success {\n @apply border-stroke-success [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-success;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.success);\n\n @apply border-active-stroke-success;\n }\n}\n\n.bq-input--control.validation-warning {\n @apply border-stroke-warning [&:not(.disabled):not(:focus-within)]:hover:border-hover-stroke-warning;\n\n &:not(.disabled):focus-within {\n --bq-ring-color-focus: theme(colors.stroke.warning);\n\n @apply border-active-stroke-warning;\n }\n}\n\n/* -------------------------------------------------------------------------- */\n/* Native HTML Input */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__input {\n @apply flex-auto cursor-[inherit] appearance-none bg-[inherit] font-[inherit] text-[length:inherit] text-[color:inherit];\n @apply border-none min-bs-[--bq-input--icon-size] min-is-0 m-b-0 m-i-0 p-b-0 p-i-0 focus:outline-none focus-visible:outline-none;\n\n box-shadow: none;\n font-weight: inherit;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Clear button */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__clear::part(button) {\n // Since the clear button is inside the input group control,\n // we need to reset the focus ring styles\n --bq-ring-width: initial;\n --bq-ring-offset-width: initial;\n --bq-ring-color-focus: initial;\n\n @apply rounded-xs border-none bs-auto p-b-0 p-i-0;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Prefix and suffix */\n/* -------------------------------------------------------------------------- */\n\n.bq-input--control__prefix,\n.bq-input--control__suffix {\n @apply pointer-events-none flex items-center text-[color:--bq-input--text-color];\n}\n\n.bq-input--control__prefix {\n @apply me-[--bq-input--gap];\n}\n\n.bq-input--control__suffix {\n @apply ms-[--bq-input--gap];\n}\n\n/* -------------------------------------------------------------------------- */\n/* Slotted and internal icons */\n/* -------------------------------------------------------------------------- */\n\nbq-icon,\n::slotted(bq-icon) {\n --bq-icon--size: var(--bq-input--icon-size) !important;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Hide webkit clear button */\n/* -------------------------------------------------------------------------- */\n\n/* Remove clear controls from search input */\n\n.bq-input--control__input::-moz-search-cancel {\n @apply hidden appearance-none;\n}\n\n.bq-input--control__input::-webkit-search-decoration,\n.bq-input--control__input::-webkit-search-cancel-button,\n.bq-input--control__input::-webkit-search-results-button,\n.bq-input--control__input::-webkit-search-results-decoration {\n @apply hidden appearance-none;\n}\n\n/* Remove native control extra padding from input date and datetime */\n\n.bq-input--control__input::-webkit-datetime-edit-fields-wrapper,\n.bq-input--control__input::-webkit-datetime-edit,\n.bq-input--control__input::-webkit-datetime-edit-year-field,\n.bq-input--control__input::-webkit-datetime-edit-month-field,\n.bq-input--control__input::-webkit-datetime-edit-day-field,\n.bq-input--control__input::-webkit-datetime-edit-hour-field,\n.bq-input--control__input::-webkit-datetime-edit-minute-field,\n.bq-input--control__input::-webkit-datetime-edit-second-field,\n.bq-input--control__input::-webkit-datetime-edit-millisecond-field,\n.bq-input--control__input::-webkit-datetime-edit-meridiem-field {\n @apply p-b-0 p-i-0;\n}\n","import { AttachInternals, Component, Element, Event, EventEmitter, h, Prop, State, Watch } from '@stencil/core';\n\nimport { TInputType, TInputValidation, TInputValue } from './bq-input.types';\nimport { debounce, hasSlotContent, isDefined, isHTMLElement, isNil, TDebounce } from '../../shared/utils';\n\n/**\n * @part base - The component's base wrapper.\n * @part button - The native HTML button used under the hood in the clear button.\n * @part clear-btn - The clear button.\n * @part control - The input control wrapper.\n * @part helper-text - The helper text slot container.\n * @part label - The label slot container.\n * @part input - The native HTML input element used under the hood.\n * @part prefix - The prefix slot container.\n * @part suffix - The suffix slot container.\n */\n@Component({\n tag: 'bq-input',\n styleUrl: './scss/bq-input.scss',\n formAssociated: true,\n shadow: {\n delegatesFocus: true,\n },\n})\nexport class BqInput {\n // Own Properties\n // ====================\n\n private helperTextElem?: HTMLElement;\n private inputElem?: HTMLInputElement;\n private labelElem?: HTMLElement;\n private prefixElem?: HTMLElement;\n private suffixElem?: HTMLElement;\n\n private debounceBqInput: TDebounce<void>;\n private fallbackInputId = 'input';\n\n // Reference to host HTML element\n // ===================================\n\n @Element() el!: HTMLBqInputElement;\n @AttachInternals() internals!: ElementInternals;\n\n // State() variables\n // Inlined decorator, alphabetical order\n // =======================================\n\n @State() hasHelperText = false;\n @State() hasLabel = false;\n @State() hasPrefix = false;\n @State() hasSuffix = false;\n @State() hasValue = false;\n\n // Public Property API\n // ========================\n\n /**\n * Controls whether or not the input field should be capitalized and how.\n * Possible values are 'off', 'none', 'on', 'sentences', 'words', and 'characters'.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/autocapitalize\n */\n @Prop({ reflect: true }) autocapitalize: string = 'off';\n\n /**\n * Specifies whether or not the input field should have autocomplete enabled.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values\n */\n @Prop({ reflect: true }) autocomplete: string = 'off';\n\n /**\n * Controls whether or not the input field should have autocorrect enabled.\n * Possible values are 'on' and 'off'.\n */\n @Prop({ reflect: true }) autocorrect: 'on' | 'off' = 'off';\n\n /** If true, the input will be focused on component render */\n @Prop({ reflect: true }) autofocus: boolean;\n\n /** The clear button aria label */\n @Prop({ reflect: true }) clearButtonLabel? = 'Clear value';\n\n /**\n * The amount of time, in milliseconds, to wait before emitting the `bqInput` event after the input value changes.\n * A value of 0 means no debouncing will occur.\n */\n @Prop({ reflect: true, mutable: true }) debounceTime? = 0;\n\n /**\n * Indicates whether the input is disabled or not.\n * If `true`, the input is disabled and cannot be interacted with.\n */\n @Prop({ mutable: true }) disabled?: boolean = false;\n\n /** If true, the clear button won't be displayed */\n @Prop({ reflect: true }) disableClear? = false;\n\n /** The ID of the form that the input field belongs to. */\n @Prop({ reflect: true }) form?: string;\n\n /**\n * The inputmode attribute specifies what kind of input mechanism would be most helpful for users entering content into the input field.\n * This allows a browser to display an appropriate virtual keyboard while editing.\n * Possible values are 'none', 'text', 'decimal', 'numeric', 'tel', 'search', 'email', 'url', and 'date'.\n */\n @Prop() inputmode?: string;\n\n /**\n * The maximum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) max?: number | string;\n\n /** The maximum number of characters that the input field can accept. */\n @Prop({ reflect: true }) maxlength: number;\n\n /**\n * The minimum value that the input field can accept.\n * Only applies to date and number input types.\n */\n @Prop({ reflect: true }) min?: number | string;\n\n /** The minimum number of characters that the input field can accept. */\n @Prop({ reflect: true }) minlength: number;\n\n /** The input field name. */\n @Prop({ reflect: true }) name!: string;\n\n /**\n * Specifies a regular expression the form control's value should match.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/pattern\n */\n @Prop({ reflect: true }) pattern?: string;\n\n /** The input placeholder text value */\n @Prop({ reflect: true }) placeholder?: string;\n\n /** If true, the input field cannot be modified. */\n @Prop({ reflect: true }) readonly?: boolean;\n\n /** Indicates whether or not the input field is required to be filled out before submitting the form. */\n @Prop({ reflect: true }) required?: boolean;\n\n /**\n * A number that specifies the granularity that the value must adhere to.\n * Valid for date, month, week, time, datetime-local, number, and range.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#step\n */\n @Prop({ reflect: true }) step: number | 'any';\n\n /**\n * The type attribute specifies the type of input field to display.\n * Possible values are 'text', 'password', 'email', 'number', 'tel', 'search', 'url', and more.\n * See: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#input_types\n */\n @Prop({ reflect: true }) type: TInputType = 'text';\n\n /**\n * The validation status of the input.\n *\n * @remarks\n * This property is used to indicate the validation status of the input. It can be set to one of the following values:\n * - `'none'`: No validation status is set.\n * - `'error'`: The input has a validation error.\n * - `'warning'`: The input has a validation warning.\n * - `'success'`: The input has passed validation.\n */\n @Prop({ reflect: true }) validationStatus: TInputValidation = 'none';\n\n /** The input value, it can be used to reset the input to a previous value */\n @Prop({ reflect: true, mutable: true }) value: TInputValue;\n\n // Prop lifecycle events\n // =======================\n\n @Watch('value')\n handleValueChange() {\n if (Array.isArray(this.value)) {\n this.hasValue = this.value.some((val) => val.length > 0);\n this.internals.setFormValue(this.value.join(','));\n return;\n }\n\n this.hasValue = isDefined(this.value);\n this.internals.setFormValue(`${this.value}`);\n }\n\n // Events section\n // Requires JSDocs for public API documentation\n // ==============================================\n\n /** Callback handler emitted when the input loses focus */\n @Event() bqBlur!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value has changed and the input loses focus.\n * This handler is called whenever the user finishes typing or pasting text into the input field and then clicks outside of the input field.\n */\n @Event() bqChange!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n /** Callback handler emitted when the input value has been cleared */\n @Event() bqClear!: EventEmitter<HTMLBqInputElement>;\n\n /** Callback handler emitted when the input has received focus */\n @Event() bqFocus!: EventEmitter<HTMLBqInputElement>;\n\n /**\n * Callback handler emitted when the input value changes.\n * This handler is called whenever the user types or pastes text into the input field.\n */\n @Event() bqInput!: EventEmitter<{ value: string | number | string[]; el: HTMLBqInputElement }>;\n\n // Component lifecycle events\n // Ordered by their natural call order\n // =====================================\n\n componentWillLoad() {\n this.handleValueChange();\n }\n\n formResetCallback() {\n if (isNil(this.value)) return;\n\n this.handleClear();\n }\n\n // Listeners\n // ==============\n\n // Public methods API\n // These methods are exposed on the host element.\n // Always use two lines.\n // Public Methods must be async.\n // Requires JSDocs for public API documentation.\n // ===============================================\n\n // Local methods\n // Internal business logic.\n // These methods cannot be called from the host element.\n // =======================================================\n\n private handleBlur = () => {\n if (this.disabled) return;\n\n this.bqBlur.emit(this.el);\n };\n\n private handleFocus = () => {\n if (this.disabled) return;\n\n this.bqFocus.emit(this.el);\n };\n\n private handleInput = (ev: Event) => {\n if (this.disabled) return;\n\n this.debounceBqInput?.cancel();\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n this.internals.setFormValue(`${this.value}`);\n\n this.debounceBqInput = debounce(() => {\n this.bqInput.emit({ value: this.value, el: this.el });\n }, this.debounceTime);\n this.debounceBqInput();\n };\n\n private handleChange = (ev: Event) => {\n if (this.disabled) return;\n\n if (!isHTMLElement(ev.target, 'input')) return;\n this.value = this.type === 'number' ? Number(ev.target.value) : ev.target.value;\n this.internals.setFormValue(`${this.value}`);\n\n this.bqChange.emit({ value: this.value, el: this.el });\n };\n\n private handleClear = () => {\n if (this.disabled) return;\n\n const { inputElem, internals } = this;\n\n // Clear input element value\n inputElem.value = '';\n this.value = inputElem.value;\n\n // Update associated form control value\n internals.setFormValue(undefined);\n };\n\n private handleClearClick = (ev: CustomEvent) => {\n ev.stopPropagation();\n this.handleClear();\n\n const { bqClear, bqChange, bqInput, el, inputElem } = this;\n // Emit events\n bqClear.emit(el);\n bqInput.emit({ value: this.value, el });\n bqChange.emit({ value: this.value, el });\n // Refocus input element\n inputElem.focus();\n };\n\n private handleLabelSlotChange = () => {\n this.hasLabel = hasSlotContent(this.labelElem);\n };\n\n private handlePrefixSlotChange = () => {\n this.hasPrefix = hasSlotContent(this.prefixElem);\n };\n\n private handleSuffixSlotChange = () => {\n this.hasSuffix = hasSlotContent(this.suffixElem);\n };\n\n private handleHelperTextSlotChange = () => {\n this.hasHelperText = hasSlotContent(this.helperTextElem);\n };\n\n // render() function\n // Always the last one in the class.\n // ===================================\n\n render() {\n return (\n <div class=\"bq-input\" part=\"base\">\n {/* Label */}\n <label\n class={{ 'bq-input--label': true, '!hidden': !this.hasLabel }}\n htmlFor={this.name || this.fallbackInputId}\n ref={(labelElem) => (this.labelElem = labelElem)}\n part=\"label\"\n >\n <slot name=\"label\" onSlotchange={this.handleLabelSlotChange} />\n </label>\n {/* Input control group */}\n <div\n class={{\n 'bq-input--control': true,\n [`validation-${this.validationStatus}`]: true,\n disabled: this.disabled,\n }}\n part=\"control\"\n >\n {/* Prefix */}\n <span\n class={{ 'bq-input--control__prefix': true, '!hidden': !this.hasPrefix }}\n ref={(spanElem) => (this.prefixElem = spanElem)}\n part=\"prefix\"\n >\n <slot name=\"prefix\" onSlotchange={this.handlePrefixSlotChange} />\n </span>\n {/* HTML Input */}\n <input\n id={this.name || this.fallbackInputId}\n class=\"bq-input--control__input\"\n aria-disabled={this.disabled ? 'true' : 'false'}\n autoCapitalize={this.autocapitalize}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n disabled={this.disabled}\n form={this.form}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxlength}\n min={this.min}\n minLength={this.minlength}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n ref={(inputElem) => (this.inputElem = inputElem)}\n readOnly={this.readonly}\n required={this.required}\n step={this.step}\n type={this.type}\n value={this.value}\n part=\"input\"\n // Events\n onBlur={this.handleBlur}\n onChange={this.handleChange}\n onFocus={this.handleFocus}\n onInput={this.handleInput}\n />\n {/* Clear Button */}\n {this.hasValue && !this.disabled && !this.disableClear && (\n // The clear button will be visible as long as the input has a value\n // and the parent group is hovered or has focus-within\n <bq-button\n class=\"bq-input--control__clear ms-[--bq-input--gap] hidden\"\n appearance=\"text\"\n aria-label={this.clearButtonLabel}\n size=\"small\"\n onBqClick={this.handleClearClick}\n part=\"clear-btn\"\n exportparts=\"button\"\n >\n <slot name=\"clear-icon\">\n <bq-icon name=\"x-circle\" class=\"flex\" />\n </slot>\n </bq-button>\n )}\n {/* Suffix */}\n <span\n class={{ 'bq-input--control__suffix': true, '!hidden': !this.hasSuffix }}\n ref={(spanElem) => (this.suffixElem = spanElem)}\n part=\"suffix\"\n >\n <slot name=\"suffix\" onSlotchange={this.handleSuffixSlotChange} />\n </span>\n </div>\n {/* Helper text */}\n <div\n class={{\n [`bq-input--helper-text validation-${this.validationStatus}`]: true,\n '!hidden': !this.hasHelperText,\n }}\n ref={(divElem) => (this.helperTextElem = divElem)}\n part=\"helper-text\"\n >\n <slot name=\"helper-text\" onSlotchange={this.handleHelperTextSlotChange} />\n </div>\n </div>\n );\n }\n}\n"],"version":3}