@rededor/cura 0.5.2 → 0.5.4

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 (283) hide show
  1. package/dist/assets/icons/iconset-default-list.ts +1 -1
  2. package/dist/assets/icons/iconset-default-tmp.svg +4 -0
  3. package/dist/assets/icons/iconset-default.svg +1 -1
  4. package/dist/cjs/cura-accordion_8.cjs.entry.js +10 -17
  5. package/dist/cjs/cura-accordion_8.cjs.entry.js.map +1 -1
  6. package/dist/cjs/cura-alert.cjs.entry.js +67 -0
  7. package/dist/cjs/cura-alert.cjs.entry.js.map +1 -0
  8. package/dist/cjs/cura-button-outline.cjs.entry.js +1 -1
  9. package/dist/cjs/cura-button-select.cjs.entry.js +97 -0
  10. package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -0
  11. package/dist/cjs/cura-button-transparent.cjs.entry.js +1 -1
  12. package/dist/cjs/cura-checkbox.cjs.entry.js +145 -0
  13. package/dist/cjs/cura-checkbox.cjs.entry.js.map +1 -0
  14. package/dist/cjs/cura-display.cjs.entry.js +1 -1
  15. package/dist/cjs/cura-forms.definitions-11be2ebd.js +20 -0
  16. package/dist/cjs/cura-forms.definitions-11be2ebd.js.map +1 -0
  17. package/dist/cjs/cura-icon.definitions-b73b0178.js +21 -0
  18. package/dist/cjs/cura-icon.definitions-b73b0178.js.map +1 -0
  19. package/dist/cjs/cura-icons-view.cjs.entry.js +13 -6
  20. package/dist/cjs/cura-icons-view.cjs.entry.js.map +1 -1
  21. package/dist/cjs/cura-input-text.cjs.entry.js +3907 -0
  22. package/dist/cjs/cura-input-text.cjs.entry.js.map +1 -0
  23. package/dist/cjs/cura-label.cjs.entry.js +1 -1
  24. package/dist/cjs/cura-radio.cjs.entry.js +115 -0
  25. package/dist/cjs/cura-radio.cjs.entry.js.map +1 -0
  26. package/dist/cjs/cura-switch.cjs.entry.js +90 -0
  27. package/dist/cjs/cura-switch.cjs.entry.js.map +1 -0
  28. package/dist/cjs/cura.cjs.js +2 -2
  29. package/dist/cjs/{index-404d93e9.js → index-7616f620.js} +35 -1
  30. package/dist/cjs/index-7616f620.js.map +1 -0
  31. package/dist/cjs/loader.cjs.js +2 -2
  32. package/dist/collection/assets/icons/iconset-default-list.js +1 -1
  33. package/dist/collection/assets/icons/iconset-default-list.js.map +1 -1
  34. package/dist/collection/assets/icons/iconset-default-tmp.svg +4 -0
  35. package/dist/collection/assets/icons/iconset-default.svg +1 -1
  36. package/dist/collection/assets-raw/icons/default/swap.svg +3 -0
  37. package/dist/collection/collection-manifest.json +6 -0
  38. package/dist/collection/components/buttons/cura-button/cura-button.css +4 -0
  39. package/dist/collection/components/buttons/cura-button/cura-button.stories.js +2 -2
  40. package/dist/collection/components/buttons/cura-button/cura-button.stories.js.map +1 -1
  41. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.css +4 -0
  42. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js +2 -2
  43. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.stories.js.map +1 -1
  44. package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +139 -0
  45. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +263 -0
  46. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -0
  47. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.css +4 -0
  48. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js +2 -2
  49. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.stories.js.map +1 -1
  50. package/dist/collection/components/cura-alert/cura-alert.css +30 -0
  51. package/dist/collection/components/cura-alert/cura-alert.js +167 -0
  52. package/dist/collection/components/cura-alert/cura-alert.js.map +1 -0
  53. package/dist/collection/components/cura-alert/cura-alert.stories.js +95 -0
  54. package/dist/collection/components/cura-alert/cura-alert.stories.js.map +1 -0
  55. package/dist/collection/components/cura-icon/cura-icon.definitions.js +15 -0
  56. package/dist/collection/components/cura-icon/cura-icon.definitions.js.map +1 -0
  57. package/dist/collection/components/cura-icon/cura-icon.js +9 -16
  58. package/dist/collection/components/cura-icon/cura-icon.js.map +1 -1
  59. package/dist/collection/components/cura-icon/cura-icon.stories.js +7 -6
  60. package/dist/collection/components/cura-icon/cura-icon.stories.js.map +1 -1
  61. package/dist/collection/components/cura-icons-view/cura-icons-view.css +16 -17
  62. package/dist/collection/components/cura-icons-view/cura-icons-view.js +10 -3
  63. package/dist/collection/components/cura-icons-view/cura-icons-view.js.map +1 -1
  64. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.css +163 -0
  65. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +432 -0
  66. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js.map +1 -0
  67. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js +196 -0
  68. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.stories.js.map +1 -0
  69. package/dist/collection/components/forms/cura-forms.definitions.js +15 -0
  70. package/dist/collection/components/forms/cura-forms.definitions.js.map +1 -0
  71. package/dist/collection/components/forms/cura-input-text/cura-input-text.css +326 -0
  72. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +655 -0
  73. package/dist/collection/components/forms/cura-input-text/cura-input-text.js.map +1 -0
  74. package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js +224 -0
  75. package/dist/collection/components/forms/cura-input-text/cura-input-text.stories.js.map +1 -0
  76. package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js +46 -0
  77. package/dist/collection/components/forms/cura-input-text/mask-presets/input-mask-presets.js.map +1 -0
  78. package/dist/collection/components/forms/cura-radio/cura-radio.css +146 -0
  79. package/dist/collection/components/forms/cura-radio/cura-radio.js +366 -0
  80. package/dist/collection/components/forms/cura-radio/cura-radio.js.map +1 -0
  81. package/dist/collection/components/forms/cura-radio/cura-radio.stories.js +175 -0
  82. package/dist/collection/components/forms/cura-radio/cura-radio.stories.js.map +1 -0
  83. package/dist/collection/components/forms/cura-switch/cura-switch.css +100 -0
  84. package/dist/collection/components/forms/cura-switch/cura-switch.js +267 -0
  85. package/dist/collection/components/forms/cura-switch/cura-switch.js.map +1 -0
  86. package/dist/collection/components/forms/cura-switch/cura-switch.stories.js +137 -0
  87. package/dist/collection/components/forms/cura-switch/cura-switch.stories.js.map +1 -0
  88. package/dist/components/cura-alert.d.ts +11 -0
  89. package/dist/components/cura-alert.js +105 -0
  90. package/dist/components/cura-alert.js.map +1 -0
  91. package/dist/components/cura-button-select.d.ts +11 -0
  92. package/dist/components/cura-button-select.js +127 -0
  93. package/dist/components/cura-button-select.js.map +1 -0
  94. package/dist/components/cura-checkbox.d.ts +11 -0
  95. package/dist/components/cura-checkbox.js +193 -0
  96. package/dist/components/cura-checkbox.js.map +1 -0
  97. package/dist/components/cura-forms.definitions.js +18 -0
  98. package/dist/components/cura-forms.definitions.js.map +1 -0
  99. package/dist/components/cura-heading.js +1 -100
  100. package/dist/components/cura-heading.js.map +1 -1
  101. package/dist/components/cura-heading2.js +104 -0
  102. package/dist/components/cura-heading2.js.map +1 -0
  103. package/dist/components/cura-icon2.js +24 -17
  104. package/dist/components/cura-icon2.js.map +1 -1
  105. package/dist/components/cura-icons-view.js +31 -7
  106. package/dist/components/cura-icons-view.js.map +1 -1
  107. package/dist/components/cura-input-text.d.ts +11 -0
  108. package/dist/components/cura-input-text.js +3961 -0
  109. package/dist/components/cura-input-text.js.map +1 -0
  110. package/dist/components/cura-label.js +1 -84
  111. package/dist/components/cura-label.js.map +1 -1
  112. package/dist/components/cura-label2.js +88 -0
  113. package/dist/components/cura-label2.js.map +1 -0
  114. package/dist/components/cura-paragraph.js +1 -82
  115. package/dist/components/cura-paragraph.js.map +1 -1
  116. package/dist/components/cura-paragraph2.js +86 -0
  117. package/dist/components/cura-paragraph2.js.map +1 -0
  118. package/dist/components/cura-radio.d.ts +11 -0
  119. package/dist/components/cura-radio.js +155 -0
  120. package/dist/components/cura-radio.js.map +1 -0
  121. package/dist/components/cura-switch.d.ts +11 -0
  122. package/dist/components/cura-switch.js +120 -0
  123. package/dist/components/cura-switch.js.map +1 -0
  124. package/dist/components/index.js +12 -0
  125. package/dist/components/index.js.map +1 -1
  126. package/dist/cura/cura.esm.js +1 -1
  127. package/dist/cura/cura.esm.js.map +1 -1
  128. package/dist/cura/cura.js +1 -1
  129. package/dist/cura/p-1228e771.entry.js +2 -0
  130. package/dist/cura/p-1228e771.entry.js.map +1 -0
  131. package/dist/cura/p-2d42ccf4.entry.js +2 -0
  132. package/dist/cura/p-2d42ccf4.entry.js.map +1 -0
  133. package/dist/cura/p-3688570d.js +2 -0
  134. package/dist/cura/p-3688570d.js.map +1 -0
  135. package/dist/cura/p-36a83bc7.system.js +3 -0
  136. package/dist/cura/p-36a83bc7.system.js.map +1 -0
  137. package/dist/cura/p-3f3355f3.system.entry.js +2 -0
  138. package/dist/cura/p-3f3355f3.system.entry.js.map +1 -0
  139. package/dist/cura/p-3f5de5e2.entry.js +2 -0
  140. package/dist/cura/p-3f5de5e2.entry.js.map +1 -0
  141. package/dist/cura/p-4db87e8d.system.entry.js +2 -0
  142. package/dist/cura/p-4db87e8d.system.entry.js.map +1 -0
  143. package/dist/cura/p-51e00a16.entry.js +2 -0
  144. package/dist/cura/p-51e00a16.entry.js.map +1 -0
  145. package/dist/cura/{p-0c79c54e.entry.js → p-72a9ed55.entry.js} +2 -2
  146. package/dist/cura/{p-7c8f3c77.system.entry.js → p-75b2e4d1.system.entry.js} +2 -2
  147. package/dist/cura/{p-03047b3e.entry.js → p-880917c1.entry.js} +2 -2
  148. package/dist/cura/p-8d959fb2.entry.js +2 -0
  149. package/dist/cura/p-8d959fb2.entry.js.map +1 -0
  150. package/dist/cura/{p-d47b9cfe.system.entry.js → p-9471c93e.system.entry.js} +2 -2
  151. package/dist/cura/p-98014544.entry.js +2 -0
  152. package/dist/cura/p-98014544.entry.js.map +1 -0
  153. package/dist/cura/{p-223924fb.system.entry.js → p-98352c92.system.entry.js} +2 -2
  154. package/dist/cura/p-a32889a4.system.js +2 -0
  155. package/dist/cura/p-a32889a4.system.js.map +1 -0
  156. package/dist/cura/p-ab8c9a8f.system.entry.js +2 -0
  157. package/dist/cura/p-ab8c9a8f.system.entry.js.map +1 -0
  158. package/dist/cura/{p-91b0f78e.entry.js → p-ad194144.entry.js} +2 -2
  159. package/dist/cura/p-b0e13882.system.entry.js +2 -0
  160. package/dist/cura/p-b0e13882.system.entry.js.map +1 -0
  161. package/dist/cura/p-ba66d7be.js +3 -0
  162. package/dist/cura/{p-c0c00396.system.js.map → p-ba66d7be.js.map} +1 -1
  163. package/dist/cura/p-bb3f9d05.entry.js +2 -0
  164. package/dist/cura/p-bb3f9d05.entry.js.map +1 -0
  165. package/dist/cura/p-c791725b.js +2 -0
  166. package/dist/cura/p-c791725b.js.map +1 -0
  167. package/dist/cura/p-cb4e2a0c.system.entry.js +2 -0
  168. package/dist/cura/p-cb4e2a0c.system.entry.js.map +1 -0
  169. package/dist/cura/p-d3f9c888.system.js +2 -0
  170. package/dist/cura/p-d3f9c888.system.js.map +1 -0
  171. package/dist/cura/{p-ca054b07.system.entry.js → p-e5e259fd.system.entry.js} +2 -2
  172. package/dist/cura/{p-49813052.entry.js → p-edeffbfc.entry.js} +2 -2
  173. package/dist/cura/p-f51705c2.system.entry.js +2 -0
  174. package/dist/cura/p-f51705c2.system.entry.js.map +1 -0
  175. package/dist/cura/p-f89f2ecc.system.entry.js +2 -0
  176. package/dist/cura/p-f89f2ecc.system.entry.js.map +1 -0
  177. package/dist/cura/p-fc4ba4ce.system.js +2 -0
  178. package/dist/cura/p-fc4ba4ce.system.js.map +1 -0
  179. package/dist/cura/p-fef52079.entry.js +2 -0
  180. package/dist/cura/p-fef52079.entry.js.map +1 -0
  181. package/dist/cura/p-ffd41520.system.entry.js +2 -0
  182. package/dist/cura/p-ffd41520.system.entry.js.map +1 -0
  183. package/dist/esm/cura-accordion_8.entry.js +10 -17
  184. package/dist/esm/cura-accordion_8.entry.js.map +1 -1
  185. package/dist/esm/cura-alert.entry.js +63 -0
  186. package/dist/esm/cura-alert.entry.js.map +1 -0
  187. package/dist/esm/cura-button-outline.entry.js +1 -1
  188. package/dist/esm/cura-button-select.entry.js +93 -0
  189. package/dist/esm/cura-button-select.entry.js.map +1 -0
  190. package/dist/esm/cura-button-transparent.entry.js +1 -1
  191. package/dist/esm/cura-checkbox.entry.js +141 -0
  192. package/dist/esm/cura-checkbox.entry.js.map +1 -0
  193. package/dist/esm/cura-display.entry.js +1 -1
  194. package/dist/esm/cura-forms.definitions-0f774253.js +18 -0
  195. package/dist/esm/cura-forms.definitions-0f774253.js.map +1 -0
  196. package/dist/esm/cura-icon.definitions-a63d1862.js +18 -0
  197. package/dist/esm/cura-icon.definitions-a63d1862.js.map +1 -0
  198. package/dist/esm/cura-icons-view.entry.js +13 -6
  199. package/dist/esm/cura-icons-view.entry.js.map +1 -1
  200. package/dist/esm/cura-input-text.entry.js +3903 -0
  201. package/dist/esm/cura-input-text.entry.js.map +1 -0
  202. package/dist/esm/cura-label.entry.js +1 -1
  203. package/dist/esm/cura-radio.entry.js +111 -0
  204. package/dist/esm/cura-radio.entry.js.map +1 -0
  205. package/dist/esm/cura-switch.entry.js +86 -0
  206. package/dist/esm/cura-switch.entry.js.map +1 -0
  207. package/dist/esm/cura.js +3 -3
  208. package/dist/esm/{index-d99da69e.js → index-81f1a268.js} +35 -2
  209. package/dist/{esm-es5/index-d99da69e.js.map → esm/index-81f1a268.js.map} +1 -1
  210. package/dist/esm/loader.js +3 -3
  211. package/dist/esm-es5/cura-accordion_8.entry.js +1 -1
  212. package/dist/esm-es5/cura-accordion_8.entry.js.map +1 -1
  213. package/dist/esm-es5/cura-alert.entry.js +2 -0
  214. package/dist/esm-es5/cura-alert.entry.js.map +1 -0
  215. package/dist/esm-es5/cura-button-outline.entry.js +1 -1
  216. package/dist/esm-es5/cura-button-select.entry.js +2 -0
  217. package/dist/esm-es5/cura-button-select.entry.js.map +1 -0
  218. package/dist/esm-es5/cura-button-transparent.entry.js +1 -1
  219. package/dist/esm-es5/cura-checkbox.entry.js +2 -0
  220. package/dist/esm-es5/cura-checkbox.entry.js.map +1 -0
  221. package/dist/esm-es5/cura-display.entry.js +1 -1
  222. package/dist/esm-es5/cura-forms.definitions-0f774253.js +2 -0
  223. package/dist/esm-es5/cura-forms.definitions-0f774253.js.map +1 -0
  224. package/dist/esm-es5/cura-icon.definitions-a63d1862.js +2 -0
  225. package/dist/esm-es5/cura-icon.definitions-a63d1862.js.map +1 -0
  226. package/dist/esm-es5/cura-icons-view.entry.js +1 -1
  227. package/dist/esm-es5/cura-icons-view.entry.js.map +1 -1
  228. package/dist/esm-es5/cura-input-text.entry.js +2 -0
  229. package/dist/esm-es5/cura-input-text.entry.js.map +1 -0
  230. package/dist/esm-es5/cura-label.entry.js +1 -1
  231. package/dist/esm-es5/cura-radio.entry.js +2 -0
  232. package/dist/esm-es5/cura-radio.entry.js.map +1 -0
  233. package/dist/esm-es5/cura-switch.entry.js +2 -0
  234. package/dist/esm-es5/cura-switch.entry.js.map +1 -0
  235. package/dist/esm-es5/cura.js +1 -1
  236. package/dist/esm-es5/cura.js.map +1 -1
  237. package/dist/esm-es5/index-81f1a268.js +3 -0
  238. package/dist/esm-es5/index-81f1a268.js.map +1 -0
  239. package/dist/esm-es5/loader.js +1 -1
  240. package/dist/esm-es5/loader.js.map +1 -1
  241. package/dist/types/components/buttons/cura-button/cura-button.d.ts +1 -1
  242. package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +51 -0
  243. package/dist/types/components/cura-alert/cura-alert.d.ts +16 -0
  244. package/dist/types/components/cura-alert/cura-alert.stories.d.ts +79 -0
  245. package/dist/types/components/cura-icon/cura-icon.d.ts +0 -42
  246. package/dist/types/components/cura-icon/cura-icon.definitions.d.ts +47 -0
  247. package/dist/types/components/cura-icons-view/cura-icons-view.d.ts +2 -1
  248. package/dist/types/components/forms/cura-checkbox/cura-checkbox.d.ts +100 -0
  249. package/dist/types/components/forms/cura-checkbox/cura-checkbox.stories.d.ts +199 -0
  250. package/dist/types/components/forms/cura-forms.definitions.d.ts +14 -0
  251. package/dist/types/components/forms/cura-input-text/cura-input-text.d.ts +138 -0
  252. package/dist/types/components/forms/cura-input-text/cura-input-text.stories.d.ts +224 -0
  253. package/dist/types/components/forms/cura-input-text/mask-presets/input-mask-presets.d.ts +5 -0
  254. package/dist/types/components/forms/cura-radio/cura-radio.d.ts +81 -0
  255. package/dist/types/components/forms/cura-radio/cura-radio.stories.d.ts +180 -0
  256. package/dist/types/components/forms/cura-switch/cura-switch.d.ts +62 -0
  257. package/dist/types/components/forms/cura-switch/cura-switch.stories.d.ts +135 -0
  258. package/dist/types/components.d.ts +602 -0
  259. package/package.json +5 -4
  260. package/dist/cjs/index-404d93e9.js.map +0 -1
  261. package/dist/cura/p-46d20db3.js +0 -3
  262. package/dist/cura/p-46d20db3.js.map +0 -1
  263. package/dist/cura/p-4bdbcdf0.system.entry.js +0 -2
  264. package/dist/cura/p-4bdbcdf0.system.entry.js.map +0 -1
  265. package/dist/cura/p-8b18b5f7.system.js +0 -2
  266. package/dist/cura/p-8b18b5f7.system.js.map +0 -1
  267. package/dist/cura/p-a0395f90.entry.js +0 -2
  268. package/dist/cura/p-a0395f90.entry.js.map +0 -1
  269. package/dist/cura/p-a7ef255f.entry.js +0 -2
  270. package/dist/cura/p-a7ef255f.entry.js.map +0 -1
  271. package/dist/cura/p-c0c00396.system.js +0 -3
  272. package/dist/cura/p-fc77814b.system.entry.js +0 -2
  273. package/dist/cura/p-fc77814b.system.entry.js.map +0 -1
  274. package/dist/esm/index-d99da69e.js.map +0 -1
  275. package/dist/esm-es5/index-d99da69e.js +0 -3
  276. /package/dist/cura/{p-0c79c54e.entry.js.map → p-72a9ed55.entry.js.map} +0 -0
  277. /package/dist/cura/{p-7c8f3c77.system.entry.js.map → p-75b2e4d1.system.entry.js.map} +0 -0
  278. /package/dist/cura/{p-03047b3e.entry.js.map → p-880917c1.entry.js.map} +0 -0
  279. /package/dist/cura/{p-d47b9cfe.system.entry.js.map → p-9471c93e.system.entry.js.map} +0 -0
  280. /package/dist/cura/{p-223924fb.system.entry.js.map → p-98352c92.system.entry.js.map} +0 -0
  281. /package/dist/cura/{p-91b0f78e.entry.js.map → p-ad194144.entry.js.map} +0 -0
  282. /package/dist/cura/{p-ca054b07.system.entry.js.map → p-e5e259fd.system.entry.js.map} +0 -0
  283. /package/dist/cura/{p-49813052.entry.js.map → p-edeffbfc.entry.js.map} +0 -0
@@ -0,0 +1,655 @@
1
+ import { Host, h } from '@stencil/core';
2
+ import IMask from 'imask';
3
+ import { maskOptions } from './mask-presets/input-mask-presets';
4
+ export class CuraInputText {
5
+ constructor() {
6
+ this.mode = 'default';
7
+ this.status = 'default';
8
+ this.size = 'medium';
9
+ this.type = 'text';
10
+ this.label = '';
11
+ this.placeholder = null;
12
+ this.value = undefined;
13
+ this.iconName = '';
14
+ this.helperText = undefined;
15
+ this.disabled = false;
16
+ this.required = false;
17
+ this.maskPreset = undefined;
18
+ this.maskRegex = undefined;
19
+ this.maskAdvanced = undefined;
20
+ this.maxlength = undefined;
21
+ this.readOnly = false;
22
+ this.isLoading = false;
23
+ this.isHovered = false;
24
+ this.isFocused = false;
25
+ this.styles = {};
26
+ this.clearIcon = true;
27
+ }
28
+ connectedCallback() {
29
+ this.styles['--primary-base'] = window.CuraAPI.theme.colors.getColor(`primary-base`);
30
+ this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);
31
+ this.styles['--neutral-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);
32
+ this.styles['--neutral-black'] = window.CuraAPI.theme.colors.getColor(`neutral-black`);
33
+ this.styles['--neutral-medium'] = window.CuraAPI.theme.colors.getColor(`neutral-medium`);
34
+ this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
35
+ this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor(`neutral-dark`);
36
+ this.styles['--success-dark'] = window.CuraAPI.theme.colors.getColor(`success-dark`);
37
+ this.styles['--success-darker'] = window.CuraAPI.theme.colors.getColor(`success-darker`);
38
+ this.styles['--success-lighter'] = window.CuraAPI.theme.colors.getColor(`success-lighter`);
39
+ this.styles['--error-lighter'] = window.CuraAPI.theme.colors.getColor(`error-lighter`);
40
+ this.styles['--error-dark'] = window.CuraAPI.theme.colors.getColor(`error-dark`);
41
+ this.styles['--error-darker'] = window.CuraAPI.theme.colors.getColor(`error-darker`);
42
+ this.styles['--error-base'] = window.CuraAPI.theme.colors.getColor(`error-base`);
43
+ this.styles['--info-base'] = window.CuraAPI.theme.colors.getColor(`info-base`);
44
+ this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
45
+ this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
46
+ this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();
47
+ this.weights = window.CuraAPI.theme.fonts.getWeights();
48
+ this.styles['--font-weight-medium'] = this.weights.medium;
49
+ this.styles['--font-weight-bold'] = this.weights.bold;
50
+ this.styles['--font-weight-regular'] = this.weights.regular;
51
+ }
52
+ getClasses() {
53
+ return {
54
+ [this.size.toLowerCase()]: this.mode === 'default',
55
+ disabled: this.disabled,
56
+ isLoading: this.isLoading,
57
+ isFocused: this.isFocused && !this.disabled && !this.readOnly && !this.isLoading,
58
+ isHovered: this.isHovered,
59
+ isSuccess: this.status === 'success',
60
+ isError: this.status === 'error',
61
+ transparent: this.mode === 'transparent',
62
+ };
63
+ }
64
+ getLabelColor() {
65
+ if (!!this.disabled) {
66
+ return 'neutral-medium';
67
+ }
68
+ else if (this.isLoading && this.mode === 'transparent' && !this.isHovered) {
69
+ return 'neutral-dark';
70
+ }
71
+ else if (((this.isFocused || this.isHovered || this.status === 'success' || this.status === 'error') && !this.readOnly) || this.isHovered) {
72
+ return 'neutral-black';
73
+ }
74
+ else {
75
+ return 'neutral-dark';
76
+ }
77
+ }
78
+ renderIcon() {
79
+ if ((!this.iconName && this.status === 'default') || (this.mode === 'transparent' && this.isLoading) || (this.mode === 'transparent' && this.status === 'default')) {
80
+ return;
81
+ }
82
+ const iconSizeDefaultMode = this.size === 'large' ? 20 : 16;
83
+ const baseIconSize = this.mode === 'transparent' ? 20 : iconSizeDefaultMode;
84
+ const iconMap = {
85
+ loading: { name: this.iconName, color: 'primary-base' },
86
+ success: { name: 'checkCircle', color: 'success-dark' },
87
+ error: { name: 'alertCircle', color: 'error-dark' },
88
+ default: { name: this.iconName, color: 'neutral-dark' },
89
+ };
90
+ const iconConfig = iconMap[this.isLoading ? 'loading' : this.status || 'default'];
91
+ return (h("div", { class: 'feedback-icon', style: this.styles }, h("cura-icon", { name: iconConfig.name, iconset: 'default', size: baseIconSize, color: iconConfig.color })));
92
+ }
93
+ renderHelperText() {
94
+ const isError = this.status === 'error';
95
+ const isSuccess = this.status === 'success';
96
+ const isDefault = this.status === 'default';
97
+ const helperTextSize = this.size === 'large' ? 'small' : 'xsmall';
98
+ const helperTextWeight = this.mode === 'transparent' ? 'bold' : 'regular';
99
+ const colorText = (() => {
100
+ if (this.disabled)
101
+ return 'neutral-medium';
102
+ if (this.isLoading)
103
+ return 'primary-base';
104
+ if (this.isFocused || this.isHovered)
105
+ return 'neutral-black';
106
+ return 'neutral-dark';
107
+ })();
108
+ return (h("div", { style: this.styles, class: 'helper-text' }, isDefault && (h("cura-label", { size: helperTextSize, color: colorText, weight: helperTextWeight }, h("slot", null))), isError && (h("cura-label", { size: helperTextSize, lineHeight: 'xsmall', color: 'error-dark', weight: helperTextWeight }, h("slot", null))), isSuccess && (h("cura-label", { size: helperTextSize, color: 'success-dark', weight: helperTextWeight }, h("slot", null)))));
109
+ }
110
+ componentDidLoad() {
111
+ this.initializeMask();
112
+ }
113
+ handleMouseEnter() {
114
+ this.isHovered = true;
115
+ }
116
+ handleMouseLeave() {
117
+ this.isHovered = false;
118
+ }
119
+ handleMaskUpdate() {
120
+ if (!!this.maskedInput) {
121
+ this.maskedInput.updateValue();
122
+ }
123
+ }
124
+ handleClearInput() {
125
+ this.handleMaskUpdate();
126
+ this.value = '';
127
+ this.inputRef.value = '';
128
+ this.handleMaskUpdate();
129
+ }
130
+ handleInputFocus() {
131
+ this.handleMaskUpdate();
132
+ this.isFocused = true;
133
+ }
134
+ handleInputBlur() {
135
+ this.handleMaskUpdate();
136
+ setTimeout(() => {
137
+ this.isFocused = false;
138
+ }, 150);
139
+ }
140
+ handleMaskPresetChange() {
141
+ this.initializeMask();
142
+ }
143
+ handleMaskRegexChange() {
144
+ this.initializeMask();
145
+ }
146
+ handlemaskAdvancedChange() {
147
+ this.initializeMask();
148
+ }
149
+ handleValueChange(newValue) {
150
+ if (this.maskedInput && this.maskedInput.value !== newValue) {
151
+ this.maskedInput.value = newValue;
152
+ }
153
+ }
154
+ initializeMask() {
155
+ if (this.maskedInput) {
156
+ this.maskedInput.destroy();
157
+ }
158
+ if (!!this.maskRegex) {
159
+ if (typeof this.maskRegex === 'string') {
160
+ const cleanedRegexString = this.maskRegex.replace(/^\/|\/[gimsuy]*$/g, '');
161
+ const flags = (this.maskRegex.match(/\/[gimsuy]*$/g) || [''])[0].slice(1);
162
+ this.maskedInput = IMask(this.inputRef, { mask: new RegExp(cleanedRegexString, flags) });
163
+ this.handleMaskUpdate();
164
+ }
165
+ else {
166
+ this.maskedInput = IMask(this.inputRef, { mask: this.maskRegex });
167
+ this.handleMaskUpdate();
168
+ }
169
+ }
170
+ else if (!!this.maskPreset) {
171
+ const options = maskOptions[this.maskPreset];
172
+ if (!options) {
173
+ console.error(`Mask preset "${this.maskPreset}" not found.`);
174
+ return;
175
+ }
176
+ this.maskedInput = IMask(this.inputRef, options);
177
+ if (options === Date) {
178
+ if (this.value) {
179
+ this.maskedInput.typedValue = this.value;
180
+ }
181
+ }
182
+ else if (options === Number) {
183
+ if (this.value) {
184
+ this.maskedInput.typedValue = this.value;
185
+ }
186
+ }
187
+ else {
188
+ this.maskedInput.value = this.value || '';
189
+ }
190
+ }
191
+ else if (!!this.maskAdvanced) {
192
+ try {
193
+ if (this.maskAdvanced.constructor === Object) {
194
+ this.maskedInput = IMask(this.inputRef, this.maskAdvanced);
195
+ }
196
+ else if (typeof this.maskAdvanced === 'string') {
197
+ this.maskedInput = IMask(this.inputRef, JSON.parse(this.maskAdvanced));
198
+ }
199
+ }
200
+ catch (error) {
201
+ console.error('Erro ao definir a maskAdvanced:', error);
202
+ }
203
+ }
204
+ this.handleMaskUpdate();
205
+ }
206
+ handleInputChange(event) {
207
+ const inputValue = event.target.value;
208
+ if (this.type === 'number') {
209
+ const numericValue = parseFloat(inputValue);
210
+ if (!isNaN(numericValue)) {
211
+ this.value = numericValue;
212
+ this.valueChange.emit(numericValue);
213
+ }
214
+ else {
215
+ console.error('Invalid input:', inputValue);
216
+ }
217
+ }
218
+ if (this.maskedInput) {
219
+ if (this.maskedInput.mask instanceof Date || this.maskedInput.mask === Number) {
220
+ this.maskedInput.typedValue = inputValue;
221
+ this.value = this.maskedInput.typedValue;
222
+ }
223
+ else {
224
+ this.maskedInput.value = inputValue;
225
+ this.value = this.maskedInput.value;
226
+ }
227
+ }
228
+ this.value = inputValue;
229
+ this.valueChange.emit(this.value);
230
+ }
231
+ handleKeyDown(event) {
232
+ this.handleMaskUpdate();
233
+ this.type === 'number' ? this.handleBlockInvalidNumber(event) : undefined;
234
+ }
235
+ handleBlockInvalidNumber(e) {
236
+ return ['e', 'E', '+', '-'].includes(e.key) && e.preventDefault();
237
+ }
238
+ render() {
239
+ return (h(Host, null, h("div", { style: this.styles, onMouseEnter: () => this.handleMouseEnter(), onMouseLeave: () => this.handleMouseLeave(), class: Object.assign({ 'cura-input-group': true }, this.getClasses()) }, h("div", { class: 'input-wrapper' }, this.label && (h("cura-label", { class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getLabelColor() }, this.label, " ", this.required && h("span", { class: 'required' }, "* "))), h("div", { class: 'cura-input-field', style: this.styles }, this.renderIcon(), h("input", { type: this.type, autocomplete: 'off', "aria-autocomplete": 'none', "aria-required": this.required ? 'true' : 'false', "aria-disabled": this.disabled ? 'true' : 'false', "aria-invalid": this.status === 'error' ? 'true' : 'false', "aria-readonly": this.readOnly ? 'true' : 'false', onKeyDown: event => this.handleKeyDown(event), onBlur: this.handleInputBlur.bind(this), onFocus: this.handleInputFocus.bind(this), onInput: event => this.handleInputChange(event), class: this.getClasses(), style: this.styles, placeholder: this.placeholder, disabled: this.disabled || this.isLoading, required: this.required, readonly: this.readOnly, maxlength: this.maxlength, value: this.value, ref: ref => (this.inputRef = ref) }), !!this.clearIcon && !this.readOnly && !this.isLoading && !this.disabled && this.value && this.isFocused && (h("cura-icon", { size: this.size === 'large' ? 20 : 16, color: 'primary-base', name: 'closeCircle', iconset: 'default', class: 'clear-button', onClick: () => this.handleClearInput() })), this.isLoading && h("cura-loader-circle", { size: this.size === 'large' ? 'medium' : 'small', color: 'primary-base' })), this.renderHelperText()))));
240
+ }
241
+ static get is() { return "cura-input-text"; }
242
+ static get encapsulation() { return "shadow"; }
243
+ static get originalStyleUrls() {
244
+ return {
245
+ "$": ["cura-input-text.scss"]
246
+ };
247
+ }
248
+ static get styleUrls() {
249
+ return {
250
+ "$": ["cura-input-text.css"]
251
+ };
252
+ }
253
+ static get properties() {
254
+ return {
255
+ "mode": {
256
+ "type": "string",
257
+ "mutable": true,
258
+ "complexType": {
259
+ "original": "'default' | 'transparent'",
260
+ "resolved": "\"default\" | \"transparent\"",
261
+ "references": {}
262
+ },
263
+ "required": false,
264
+ "optional": false,
265
+ "docs": {
266
+ "tags": [],
267
+ "text": "Mode of the input: 'default' or 'transparent' (default: 'default')"
268
+ },
269
+ "attribute": "mode",
270
+ "reflect": true,
271
+ "defaultValue": "'default'"
272
+ },
273
+ "status": {
274
+ "type": "string",
275
+ "mutable": true,
276
+ "complexType": {
277
+ "original": "'error' | 'success' | 'default'",
278
+ "resolved": "\"default\" | \"error\" | \"success\"",
279
+ "references": {}
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "Indicates input status(default: default)"
286
+ },
287
+ "attribute": "status",
288
+ "reflect": true,
289
+ "defaultValue": "'default'"
290
+ },
291
+ "size": {
292
+ "type": "string",
293
+ "mutable": true,
294
+ "complexType": {
295
+ "original": "'small' | 'medium' | 'large'",
296
+ "resolved": "\"large\" | \"medium\" | \"small\"",
297
+ "references": {}
298
+ },
299
+ "required": false,
300
+ "optional": false,
301
+ "docs": {
302
+ "tags": [],
303
+ "text": "Size of the input mode default: 'small', 'medium', or 'large' (default: 'medium')"
304
+ },
305
+ "attribute": "size",
306
+ "reflect": true,
307
+ "defaultValue": "'medium'"
308
+ },
309
+ "type": {
310
+ "type": "string",
311
+ "mutable": false,
312
+ "complexType": {
313
+ "original": "'text' | 'number'",
314
+ "resolved": "\"number\" | \"text\"",
315
+ "references": {}
316
+ },
317
+ "required": false,
318
+ "optional": false,
319
+ "docs": {
320
+ "tags": [],
321
+ "text": "Type of the input: 'text', 'number' (default: 'text')"
322
+ },
323
+ "attribute": "type",
324
+ "reflect": true,
325
+ "defaultValue": "'text'"
326
+ },
327
+ "label": {
328
+ "type": "string",
329
+ "mutable": false,
330
+ "complexType": {
331
+ "original": "string",
332
+ "resolved": "string",
333
+ "references": {}
334
+ },
335
+ "required": false,
336
+ "optional": false,
337
+ "docs": {
338
+ "tags": [],
339
+ "text": "Label text for the input"
340
+ },
341
+ "attribute": "label",
342
+ "reflect": true,
343
+ "defaultValue": "''"
344
+ },
345
+ "placeholder": {
346
+ "type": "string",
347
+ "mutable": false,
348
+ "complexType": {
349
+ "original": "string | null",
350
+ "resolved": "string",
351
+ "references": {}
352
+ },
353
+ "required": false,
354
+ "optional": true,
355
+ "docs": {
356
+ "tags": [],
357
+ "text": "Placeholder text for the input"
358
+ },
359
+ "attribute": "placeholder",
360
+ "reflect": true,
361
+ "defaultValue": "null"
362
+ },
363
+ "value": {
364
+ "type": "any",
365
+ "mutable": true,
366
+ "complexType": {
367
+ "original": "string | number",
368
+ "resolved": "number | string",
369
+ "references": {}
370
+ },
371
+ "required": false,
372
+ "optional": false,
373
+ "docs": {
374
+ "tags": [],
375
+ "text": "Value of the input field"
376
+ },
377
+ "attribute": "value",
378
+ "reflect": false
379
+ },
380
+ "iconName": {
381
+ "type": "string",
382
+ "mutable": true,
383
+ "complexType": {
384
+ "original": "string",
385
+ "resolved": "string",
386
+ "references": {}
387
+ },
388
+ "required": false,
389
+ "optional": true,
390
+ "docs": {
391
+ "tags": [],
392
+ "text": "Whether to display a cura icon (default: null)"
393
+ },
394
+ "attribute": "icon-name",
395
+ "reflect": true,
396
+ "defaultValue": "''"
397
+ },
398
+ "helperText": {
399
+ "type": "string",
400
+ "mutable": true,
401
+ "complexType": {
402
+ "original": "string",
403
+ "resolved": "string",
404
+ "references": {}
405
+ },
406
+ "required": false,
407
+ "optional": true,
408
+ "docs": {
409
+ "tags": [],
410
+ "text": "Helper text displayed below the input"
411
+ },
412
+ "attribute": "helper-text",
413
+ "reflect": true
414
+ },
415
+ "disabled": {
416
+ "type": "boolean",
417
+ "mutable": false,
418
+ "complexType": {
419
+ "original": "boolean",
420
+ "resolved": "boolean",
421
+ "references": {}
422
+ },
423
+ "required": false,
424
+ "optional": true,
425
+ "docs": {
426
+ "tags": [],
427
+ "text": "Whether the input is disabled (default: false)"
428
+ },
429
+ "attribute": "disabled",
430
+ "reflect": true,
431
+ "defaultValue": "false"
432
+ },
433
+ "required": {
434
+ "type": "boolean",
435
+ "mutable": false,
436
+ "complexType": {
437
+ "original": "boolean",
438
+ "resolved": "boolean",
439
+ "references": {}
440
+ },
441
+ "required": false,
442
+ "optional": true,
443
+ "docs": {
444
+ "tags": [],
445
+ "text": "Whether the input is required (default: false)"
446
+ },
447
+ "attribute": "required",
448
+ "reflect": true,
449
+ "defaultValue": "false"
450
+ },
451
+ "maskPreset": {
452
+ "type": "any",
453
+ "mutable": false,
454
+ "complexType": {
455
+ "original": "MaskPreset",
456
+ "resolved": "number | string",
457
+ "references": {
458
+ "MaskPreset": {
459
+ "location": "local",
460
+ "path": "/Users/fellipesoares/Code/cura/packages/component-lib/src/components/forms/cura-input-text/cura-input-text.tsx"
461
+ }
462
+ }
463
+ },
464
+ "required": false,
465
+ "optional": true,
466
+ "docs": {
467
+ "tags": [{
468
+ "name": "see",
469
+ "text": " : https://imask.js.org/"
470
+ }],
471
+ "text": "Mask preset for input formatting: 'cpf', 'cnpj', 'phone', 'date', etc. Uses IMask library."
472
+ },
473
+ "attribute": "mask-preset",
474
+ "reflect": false
475
+ },
476
+ "maskRegex": {
477
+ "type": "string",
478
+ "mutable": true,
479
+ "complexType": {
480
+ "original": "MaskedRegExp['mask'] | string | null",
481
+ "resolved": "RegExp | string",
482
+ "references": {
483
+ "MaskedRegExp": {
484
+ "location": "import",
485
+ "path": "imask"
486
+ }
487
+ }
488
+ },
489
+ "required": false,
490
+ "optional": true,
491
+ "docs": {
492
+ "tags": [{
493
+ "name": "see",
494
+ "text": " : https://imask.js.org/"
495
+ }],
496
+ "text": "Regular expression for custom input masking. Uses IMask library."
497
+ },
498
+ "attribute": "mask-regex",
499
+ "reflect": true
500
+ },
501
+ "maskAdvanced": {
502
+ "type": "string",
503
+ "mutable": true,
504
+ "complexType": {
505
+ "original": "FactoryArg | string | null",
506
+ "resolved": "string | RegExp | Masked<any> | FactoryOpts | DateConstructor | NumberConstructor | ((value: string, masked: Masked<any>) => boolean) | DynamicMaskType",
507
+ "references": {
508
+ "FactoryArg": {
509
+ "location": "import",
510
+ "path": "imask"
511
+ }
512
+ }
513
+ },
514
+ "required": false,
515
+ "optional": true,
516
+ "docs": {
517
+ "tags": [{
518
+ "name": "see",
519
+ "text": " : https://imask.js.org/"
520
+ }],
521
+ "text": "Advanced mask object to be used with IMask library"
522
+ },
523
+ "attribute": "mask-advanced",
524
+ "reflect": true
525
+ },
526
+ "maxlength": {
527
+ "type": "number",
528
+ "mutable": true,
529
+ "complexType": {
530
+ "original": "number | undefined",
531
+ "resolved": "number",
532
+ "references": {}
533
+ },
534
+ "required": false,
535
+ "optional": true,
536
+ "docs": {
537
+ "tags": [],
538
+ "text": "Maximum length of the input value (default: undefined)"
539
+ },
540
+ "attribute": "maxlength",
541
+ "reflect": true
542
+ },
543
+ "readOnly": {
544
+ "type": "boolean",
545
+ "mutable": false,
546
+ "complexType": {
547
+ "original": "boolean",
548
+ "resolved": "boolean",
549
+ "references": {}
550
+ },
551
+ "required": false,
552
+ "optional": true,
553
+ "docs": {
554
+ "tags": [],
555
+ "text": "Whether the input is read-only (default: false)"
556
+ },
557
+ "attribute": "read-only",
558
+ "reflect": true,
559
+ "defaultValue": "false"
560
+ },
561
+ "isLoading": {
562
+ "type": "boolean",
563
+ "mutable": true,
564
+ "complexType": {
565
+ "original": "boolean",
566
+ "resolved": "boolean",
567
+ "references": {}
568
+ },
569
+ "required": false,
570
+ "optional": true,
571
+ "docs": {
572
+ "tags": [],
573
+ "text": "Whether the input is in loading state (default: false)"
574
+ },
575
+ "attribute": "is-loading",
576
+ "reflect": true,
577
+ "defaultValue": "false"
578
+ },
579
+ "clearIcon": {
580
+ "type": "boolean",
581
+ "mutable": true,
582
+ "complexType": {
583
+ "original": "boolean",
584
+ "resolved": "boolean",
585
+ "references": {}
586
+ },
587
+ "required": false,
588
+ "optional": true,
589
+ "docs": {
590
+ "tags": [],
591
+ "text": "Icon button name for the clear button (default: 'closeCircle')"
592
+ },
593
+ "attribute": "clear-icon",
594
+ "reflect": true,
595
+ "defaultValue": "true"
596
+ }
597
+ };
598
+ }
599
+ static get states() {
600
+ return {
601
+ "isHovered": {},
602
+ "isFocused": {},
603
+ "styles": {}
604
+ };
605
+ }
606
+ static get events() {
607
+ return [{
608
+ "method": "valueChange",
609
+ "name": "valueChange",
610
+ "bubbles": true,
611
+ "cancelable": true,
612
+ "composed": true,
613
+ "docs": {
614
+ "tags": [{
615
+ "name": "type",
616
+ "text": "{EventEmitter<string | number>}"
617
+ }],
618
+ "text": "Emitted when the value of the input changes"
619
+ },
620
+ "complexType": {
621
+ "original": "string | number",
622
+ "resolved": "number | string",
623
+ "references": {}
624
+ }
625
+ }];
626
+ }
627
+ static get watchers() {
628
+ return [{
629
+ "propName": "styles",
630
+ "methodName": "connectedCallback"
631
+ }, {
632
+ "propName": "size",
633
+ "methodName": "getClasses"
634
+ }, {
635
+ "propName": "status",
636
+ "methodName": "renderIcon"
637
+ }, {
638
+ "propName": "mode",
639
+ "methodName": "renderIcon"
640
+ }, {
641
+ "propName": "maskPreset",
642
+ "methodName": "handleMaskPresetChange"
643
+ }, {
644
+ "propName": "maskRegex",
645
+ "methodName": "handleMaskRegexChange"
646
+ }, {
647
+ "propName": "maskAdvanced",
648
+ "methodName": "handlemaskAdvancedChange"
649
+ }, {
650
+ "propName": "value",
651
+ "methodName": "handleValueChange"
652
+ }];
653
+ }
654
+ }
655
+ //# sourceMappingURL=cura-input-text.js.map