@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
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, H as Host, g as getElement } from './index-d99da69e.js';
1
+ import { r as registerInstance, h, H as Host, g as getElement } from './index-81f1a268.js';
2
2
 
3
3
  const curaLabelCss = ":host{display:block;font-size:var(--font-size-base)}:host p{font-family:var(--font-family);font-size:1.143em;font-weight:var(--font-weight-medium);color:var(--color-body);line-height:var(--line-height);margin-block:var(--margin-block);letter-spacing:0.32px}:host p.bold-weight,:host p ::slotted(b),:host p ::slotted(strong),:host p ::slotted(u){font-weight:var(--font-weight-bold)}:host p.large{font-size:1.357em;line-height:calc(var(--line-height) - 4%);letter-spacing:0px}:host p.small{font-size:1em;line-height:calc(var(--line-height) - 4%);letter-spacing:0.56px}:host p.xsmall{font-size:0.857em;line-height:calc(var(--line-height) - 17%);letter-spacing:0.72px}:host ::slotted(a){font-weight:var(--font-weight-bold);color:var(--color-link);text-underline-offset:10%}:host ::slotted(u){text-underline-offset:10%}:host ::slotted(abbr){color:var(--color-link);-webkit-text-decoration:underline dashed 1px var(--color-link);text-decoration:underline dashed 1px var(--color-link);text-underline-offset:10%;cursor:default}";
4
4
 
@@ -0,0 +1,111 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-81f1a268.js';
2
+ import { f as formsSizes } from './cura-forms.definitions-0f774253.js';
3
+
4
+ const curaRadioCss = "@charset \"UTF-8\";:host{display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;-webkit-box-sizing:border-box;box-sizing:border-box;}:host .container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row-reverse;flex-direction:row-reverse;gap:var(--gap)}:host .position.container{-ms-flex-direction:row;flex-direction:row}:host .position .label-wrapper{-ms-flex-pack:end;justify-content:end}:host .position .message{text-align:right}:host .position .label{-ms-flex-order:1;order:1}:host .info{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}:host .label-wrapper{display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:start;-ms-flex-align:center;align-items:center;gap:5px}:host .control{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;cursor:pointer;position:relative}:host .radio{margin:0;appearance:none;-webkit-appearance:none;-moz-appearance:none;border-radius:50%;border:2px solid var(--primary-base-neutral-medium);background:var(--neutral-purewhite);-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transition:border-color 0.3s;transition:border-color 0.3s;position:relative;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;cursor:pointer;width:var(--size);height:var(--size);-ms-flex:0 0 var(--size);flex:0 0 var(--size)}:host .radio::after{content:\"\";background:var(--color-base-light);border-radius:50%;opacity:0;-webkit-transition:opacity 0.3s;transition:opacity 0.3s;width:var(--size-after);height:var(--size-after)}:host .radio:focus{border-color:var(--info-base) !important}:host .success .radio{border-color:var(--success-base);background:var(--success-lighter)}:host .success .radio:hover{border-color:var(--success-base) !important}:host .success.checked .radio{border-color:var(--success-base)}:host .success.checked .radio::after{background:var(--success-base)}:host .success.checked .radio:hover{background:var(--success-lighter) !important;border-color:var(--success-base) !important}:host .success.checked .radio:hover::after{background:var(--success-base) !important}:host .error .radio{border-color:var(--error-base);background:var(--error-lighter)}:host .error .radio:hover{border-color:var(--error-base) !important}:host .error.checked .radio{border-color:var(--error-base)}:host .error.checked .radio::after{background:var(--error-base)}:host .error.checked .radio:hover{background:var(--error-lighter) !important;border-color:var(--error-base) !important}:host .error.checked .radio:hover::after{background:var(--error-base) !important}:host .checked .radio::after{opacity:1;background:var(--color-base)}:host .checked .radio{border-color:var(--color-dark)}:host .checked .radio:hover{border-color:var(--color-light) !important}:host .checked .radio:hover::after{background:var(--color-light)}:host .disabled .radio{background:var(--primary-base-neutral-white);border-color:var(--primary-darker-neutral-base);cursor:not-allowed}:host .disabled .radio::after{background:var(--neutral-lighter)}:host .disabled.checked .radio{border-color:var(--primary-base-neutral-base) !important;background:var(--primary-darker-neutral-white) !important}:host .disabled.checked .radio::after{background:var(--primary-base-neutral-base) !important}:host :not(.disabled):not(.checked) .radio:hover{border-color:var(--primary-base-neutral-dark)}";
5
+
6
+ const CuraRadio = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.onchange = createEvent(this, "onchange", 7);
10
+ this.sizes = {
11
+ "large": { size: 20 },
12
+ "medium": { size: 14 },
13
+ "small": { size: 10 },
14
+ };
15
+ this.isDarkbackground = () => this.background === 'dark';
16
+ this.handleClick = () => {
17
+ if (this.disabled)
18
+ return;
19
+ this.checked = !this.checked;
20
+ this.onchange.emit({ value: this.value, checked: this.checked });
21
+ };
22
+ this.checked = false;
23
+ this.status = 'default';
24
+ this.disabled = false;
25
+ this.required = false;
26
+ this.label = '';
27
+ this.ontabindex = undefined;
28
+ this.position = 'left';
29
+ this.value = '';
30
+ this.name = '';
31
+ this.background = 'light';
32
+ this.size = 'medium';
33
+ this.color = 'accent';
34
+ this.styles = {};
35
+ }
36
+ sizeHandler() {
37
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--size-after': `${this.sizes[this.size].size}px`, '--size': `${formsSizes[this.size].size}px`, '--gap': `${formsSizes[this.size].gap}px` });
38
+ }
39
+ setColors() {
40
+ const colors = [
41
+ { name: '--info-base', background: 'info-base' },
42
+ { name: '--color-light', background: `${this.color}-light` },
43
+ { name: '--color-base', background: `${this.color}-base` },
44
+ { name: '--color-dark', background: `${this.color}-dark` },
45
+ { name: '--neutral-purewhite', background: 'neutral-purewhite' },
46
+ { name: '--success-lighter', background: 'success-lighter' },
47
+ { name: '--success-base', background: 'success-base' },
48
+ { name: '--error-lighter', background: 'error-lighter' },
49
+ { name: '--error-base', background: 'error-base' },
50
+ { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },
51
+ { name: '--primary-base-neutral-white', background: this.isDarkbackground() ? 'primary-base' : 'neutral-white' },
52
+ { name: '--primary-darker-neutral-white', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-white' },
53
+ { name: '--primary-darker-neutral-base', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-base' },
54
+ { name: '--primary-base-neutral-base', background: this.isDarkbackground() ? 'primary-base' : 'neutral-base' },
55
+ { name: '--primary-base-neutral-dark', background: this.isDarkbackground() ? 'primary-base' : 'neutral-dark' },
56
+ { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },
57
+ { name: '--success-base-dark', background: this.isDarkbackground() ? 'success-base' : 'success-dark' },
58
+ { name: '--error-base-dark', background: this.isDarkbackground() ? 'error-base' : 'error-dark' },
59
+ ];
60
+ colors.forEach(color => {
61
+ this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background);
62
+ });
63
+ this.styles = Object.assign({}, this.styles);
64
+ }
65
+ connectedCallback() {
66
+ this.sizeHandler();
67
+ this.setColors();
68
+ }
69
+ getClasses() {
70
+ const classes = {};
71
+ classes['container'] = true;
72
+ classes['checked'] = this.checked;
73
+ classes['disabled'] = this.disabled;
74
+ classes['position'] = this.position === 'right';
75
+ classes[this.status] = true;
76
+ return classes;
77
+ }
78
+ assignColor(type) {
79
+ if (this.disabled)
80
+ return this.isDarkbackground() ? 'primary-darker' : 'neutral-medium';
81
+ const statusColors = {
82
+ success: {
83
+ label: this.isDarkbackground() ? 'success-lighter' : 'success-darker',
84
+ message: this.isDarkbackground() ? 'success-base' : 'success-dark'
85
+ },
86
+ error: {
87
+ label: this.isDarkbackground() ? 'error-lighter' : 'neutral-darker',
88
+ message: this.isDarkbackground() ? 'error-base' : 'error-dark'
89
+ },
90
+ default: {
91
+ label: this.isDarkbackground() ? 'neutral-white' : 'neutral-black',
92
+ message: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark'
93
+ }
94
+ };
95
+ return statusColors[this.status][type];
96
+ }
97
+ render() {
98
+ return (h(Host, null, h("div", { class: this.getClasses(), style: this.styles }, h("div", { class: "info" }, h("div", { class: "label-wrapper" }, h("cura-label", { class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && h("cura-paragraph", { lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), h("cura-label", { color: this.assignColor('message'), size: "xsmall", class: "message" }, h("slot", null))), h("input", { type: "radio", class: `radio ${this.size.toLocaleLowerCase()}`, name: this.name, value: this.value, required: this.required, tabIndex: this.ontabindex, disabled: this.disabled, checked: this.checked, onClick: this.handleClick }))));
99
+ }
100
+ get host() { return getElement(this); }
101
+ static get watchers() { return {
102
+ "size": ["sizeHandler"],
103
+ "color": ["setColors"],
104
+ "background": ["setColors", "assignColor"]
105
+ }; }
106
+ };
107
+ CuraRadio.style = curaRadioCss;
108
+
109
+ export { CuraRadio as cura_radio };
110
+
111
+ //# sourceMappingURL=cura-radio.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"cura-radio.entry.js","mappings":";;;AAAA,MAAM,YAAY,GAAG,i5GAAi5G;;MCQz5G,SAAS;;;;IA6DpB,UAAK,GAAG;MACN,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;MACrB,QAAQ,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;MACtB,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;KACtB,CAAC;IAGF,qBAAgB,GAAG,MAAM,IAAI,CAAC,UAAU,KAAK,MAAM,CAAC;IAmDpD,gBAAW,GAAG;MACZ,IAAI,IAAI,CAAC,QAAQ;QAAE,OAAO;MAE1B,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;MAC7B,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OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC;GACxC;EAED,MAAM;IACJ,QACE,EAAC,IAAI,QACH,WAAK,KAAK,EAAE,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,IAC/C,WAAK,KAAK,EAAC,MAAM,IACf,WAAK,KAAK,EAAC,eAAe,IACxB,kBACE,KAAK,EAAC,OAAO,EACb,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO,GAAG,QAAQ,GAAG,QAAQ,EACjD,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAC/B,IAAI,CAAC,KAAK,CACA,EACZ,IAAI,CAAC,QAAQ,IAAI,sBAAgB,UAAU,EAAC,IAAI,EAAC,WAAW,EAAC,GAAG,EAAC,KAAK,EAAC,YAAY,SAAqB,CACrG,EACN,kBACE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,EAClC,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,SAAS,IACf,eAAa,CACF,CACT,EACN,aACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,EAC/C,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,IAAI,CAAC,UAAU,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,WAAW,GACzB,CACE,CACD,EACP;GACH;;;;;;;;;;;;","names":[],"sources":["./src/components/forms/cura-radio/cura-radio.scss?tag=cura-radio&encapsulation=shadow","./src/components/forms/cura-radio/cura-radio.tsx"],"sourcesContent":["\n\n:host {\n display: block;\n width: fit-content;\n box-sizing: border-box;\n\n.container {\n display: flex;\n align-items: center;\n flex-direction: row-reverse;\n gap: var(--gap);\n}\n\n.position {\n\n &.container {\n flex-direction: row;\n }\n\n .label-wrapper {\n justify-content: end;\n }\n\n .message {\n text-align: right;\n }\n\n .label {\n order:1\n }\n\n}\n\n.info {\n display: flex;\n flex-direction: column;\n}\n\n.label-wrapper {\n display: flex;\n justify-content: start;\n align-items: center;\n gap: 5px;\n}\n\n\n.control {\n width: fit-content;\n cursor: pointer;\n position: relative;\n}\n\n\n.radio {\n margin: 0;\n appearance: none;\n -webkit-appearance: none;\n -moz-appearance: none;\n border-radius: 50%;\n border: 2px solid var(--primary-base-neutral-medium);\n background: var(--neutral-purewhite);\n box-sizing: border-box;\n transition: border-color 0.3s;\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n width: var(--size);\n height: var(--size);\n flex: 0 0 var(--size);\n\n &::after {\n content: '';\n background: var(--color-base-light);\n border-radius: 50%;\n opacity: 0;\n transition: opacity 0.3s;\n width: var(--size-after);\n height: var(--size-after);\n }\n\n &:focus {\n border-color: var(--info-base) !important;\n }\n\n}\n\n\n/* Estado Success */\n.success .radio {\n border-color: var(--success-base);\n background: var(--success-lighter);\n\n &:hover{\n border-color: var(--success-base) !important;\n }\n}\n\n.success.checked .radio {\n border-color: var(--success-base);\n\n &::after {\n background: var(--success-base);\n }\n\n &:hover {\n background: var(--success-lighter) !important;\n border-color: var(--success-base) !important;\n\n &::after {\n background: var(--success-base) !important;\n }\n }\n}\n\n\n/* Estado Error */\n.error .radio {\n border-color: var(--error-base);\n background: var(--error-lighter);\n\n &:hover{\n border-color: var(--error-base) !important;\n }\n}\n\n.error.checked .radio {\n border-color: var(--error-base);\n\n &::after {\n background: var(--error-base);\n }\n\n &:hover {\n background: var(--error-lighter) !important;\n border-color: var(--error-base) !important;\n\n &::after {\n background: var(--error-base) !important;\n }\n }\n}\n\n\n/* Estado checked */\n.checked .radio::after {\n opacity: 1;\n background: var(--color-base);\n}\n\n.checked .radio {\n border-color: var(--color-dark) ;\n}\n\n.checked .radio:hover {\n border-color: var(--color-light) !important;\n}\n\n.checked .radio:hover::after {\n background: var(--color-light);\n}\n\n/* Estado disabled */\n.disabled .radio {\n background: var(--primary-base-neutral-white);\n border-color: var(--primary-darker-neutral-base) ;\n cursor: not-allowed;\n}\n\n.disabled .radio::after {\n background: var(--neutral-lighter);\n}\n\n.disabled.checked .radio {\n border-color: var(--primary-base-neutral-base) !important;\n background: var(--primary-darker-neutral-white) !important;\n}\n\n.disabled.checked .radio::after {\n background: var(--primary-base-neutral-base) !important;\n}\n\n\n/* Estado hover para não disabled e não checked */\n:not(.disabled):not(.checked) .radio:hover {\n border-color: var(--primary-base-neutral-dark);\n}\n\n\n}\n","import { Component, Prop, Event, Element, h, Host, Watch, EventEmitter, State } from '@stencil/core';\nimport { formsSizes } from '../cura-forms.definitions';\n\n@Component({\n tag: 'cura-radio',\n styleUrl: 'cura-radio.scss',\n shadow: true,\n})\nexport class CuraRadio {\n /**\n * Reflects the checked state of the radio button.\n * Mutable property allowing state change.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false;\n /**\n * Status of the radio button.\n * Can be 'error', 'success', or 'default'.\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n /**\n * Reflects the disabled state of the radio button.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * Reflects the required state of the radio button.\n */\n @Prop({ reflect: true }) required: boolean = false;\n /**\n * Text label associated with the radio button.\n */\n @Prop({ reflect: true }) label: string = '';\n /**\n * Specifies the tabindex of the radio button.\n */\n @Prop({ reflect: true }) ontabindex: number;\n /**\n * Position of the label relative to the radio button.\n * Can be 'left' or 'right'.\n */\n @Prop({ reflect: true }) position: \"left\" | \"right\" = 'left';\n /**\n * Value associated with the radio button.\n */\n @Prop({ reflect: true }) value: string = '';\n /**\n * Name attribute of the radio button.\n */\n @Prop({ reflect: true }) name: string = '';\n /**\n * Background theme of the radio button.\n * Can be 'dark' or 'light'.\n */\n @Prop() background: 'dark' | 'light' = 'light';\n /**\n * Size of the radio button.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop() size: 'small' | 'medium' | 'large' = 'medium';\n /**\n * Color theme of the radio button.\n */\n @Prop() color = 'accent';\n\n @State() styles = {}\n\n @Element() host: HTMLElement;\n\n @Event() onchange: EventEmitter<{ value: string, checked: boolean }>;\n\n sizes = {\n \"large\": { size: 20 },\n \"medium\": { size: 14 },\n \"small\": { size: 10 },\n };\n\n\n isDarkbackground = () => this.background === 'dark';\n\n\n @Watch('size')\n sizeHandler() {\n this.styles = {\n ...this.styles,\n '--size-after': `${this.sizes[this.size].size}px`,\n '--size': `${formsSizes[this.size].size}px`,\n '--gap': `${formsSizes[this.size].gap}px`\n };\n }\n\n\n @Watch('color')\n @Watch('background')\n setColors() {\n\n const colors = [\n { name: '--info-base', background: 'info-base' },\n { name: '--color-light', background: `${this.color}-light` },\n { name: '--color-base', background: `${this.color}-base` },\n { name: '--color-dark', background: `${this.color}-dark` },\n { name: '--neutral-purewhite', background: 'neutral-purewhite' },\n { name: '--success-lighter', background: 'success-lighter' },\n { name: '--success-base', background: 'success-base' },\n { name: '--error-lighter', background: 'error-lighter' },\n { name: '--error-base', background: 'error-base' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--primary-base-neutral-white', background: this.isDarkbackground() ? 'primary-base' : 'neutral-white' },\n { name: '--primary-darker-neutral-white', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-white' },\n { name: '--primary-darker-neutral-base', background: this.isDarkbackground() ? 'primary-darker' : 'neutral-base' },\n { name: '--primary-base-neutral-base', background: this.isDarkbackground() ? 'primary-base' : 'neutral-base' },\n { name: '--primary-base-neutral-dark', background: this.isDarkbackground() ? 'primary-base' : 'neutral-dark' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--success-base-dark', background: this.isDarkbackground() ? 'success-base' : 'success-dark' },\n { name: '--error-base-dark', background: this.isDarkbackground() ? 'error-base' : 'error-dark' },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background);\n });\n this.styles = { ...this.styles };\n\n }\n\n connectedCallback() {\n this.sizeHandler()\n this.setColors();\n }\n\n handleClick = () => {\n if (this.disabled) return;\n\n this.checked = !this.checked;\n this.onchange.emit({ value: this.value, checked: this.checked });\n };\n\n getClasses() {\n const classes = {};\n classes['container'] = true;\n classes['checked'] = this.checked;\n classes['disabled'] = this.disabled;\n classes['position'] = this.position === 'right';\n classes[this.status] = true;\n\n return classes;\n }\n\n @Watch('background')\n assignColor(type: 'label' | 'message',) {\n if (this.disabled) return this.isDarkbackground() ? 'primary-darker' : 'neutral-medium';\n\n const statusColors = {\n success: {\n label: this.isDarkbackground() ? 'success-lighter' : 'success-darker',\n message: this.isDarkbackground() ? 'success-base' : 'success-dark'\n },\n error: {\n label: this.isDarkbackground() ? 'error-lighter' : 'neutral-darker',\n message: this.isDarkbackground() ? 'error-base' : 'error-dark'\n },\n default: {\n label: this.isDarkbackground() ? 'neutral-white' : 'neutral-black',\n message: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark'\n }\n };\n\n return statusColors[this.status][type];\n }\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <div class=\"info\">\n <div class=\"label-wrapper\">\n <cura-label\n class=\"label\"\n size={this.size === 'large' ? 'medium' : 'xsmall'}\n color={this.assignColor('label')}>\n {this.label}\n </cura-label>\n {this.required && <cura-paragraph lineHeight='0%' marginBlock='0' color=\"error-base\" >* </cura-paragraph>}\n </div>\n <cura-label\n color={this.assignColor('message')}\n size=\"xsmall\"\n class=\"message\">\n <slot></slot>\n </cura-label>\n </div>\n <input\n type=\"radio\"\n class={`radio ${this.size.toLocaleLowerCase()}`}\n name={this.name}\n value={this.value}\n required={this.required}\n tabIndex={this.ontabindex}\n disabled={this.disabled}\n checked={this.checked}\n onClick={this.handleClick}\n />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -0,0 +1,86 @@
1
+ import { r as registerInstance, c as createEvent, h, H as Host } from './index-81f1a268.js';
2
+ import { f as formsSizes } from './cura-forms.definitions-0f774253.js';
3
+
4
+ const curaSwitchCss = "@charset \"UTF-8\";:host{display:block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;-webkit-box-sizing:border-box;box-sizing:border-box}.container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row-reverse;flex-direction:row-reverse;gap:var(--gap)}.position.container{-ms-flex-direction:row;flex-direction:row}.position .label{text-align:right}.position .message{text-align:right}.control{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.track{background:var(--neutral-base-black-40);border-radius:16px;-webkit-transition:background-color 0.3s;transition:background-color 0.3s;-ms-flex-align:start;align-items:flex-start;-ms-flex-negative:0;flex-shrink:0;-webkit-box-sizing:border-box;box-sizing:border-box;width:var(--size-track);height:var(--size)}.thumb{background-color:var(--neutral-white-purewhite);border:2px solid var(--neutral-medium);border-radius:50%;position:absolute;-webkit-transition:outline 0.3s, -webkit-transform 0.3s;transition:outline 0.3s, -webkit-transform 0.3s;transition:transform 0.3s, outline 0.3s;transition:transform 0.3s, outline 0.3s, -webkit-transform 0.3s;display:inline-block;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-sizing:border-box;box-sizing:border-box;width:var(--size);height:var(--size)}.checked .thumb{border-color:var(--color-dark-light);background:var(--color-lighter);-webkit-transform:translateX(var(--size));transform:translateX(var(--size))}.checked .thumb:hover{background:var(--neutral-white-purewhite) !important}.checked .track{background:var(--color-base-lighter-50)}.disabled .track{background:var(--primary-base-neutral-black-20)}.disabled .thumb{background:var(--neutral-lighter) !important;border-color:var(--primary-dark-neutral-base);cursor:not-allowed}.disabled.checked .track{background:var(--primary-base-neutral-black-20)}.disabled .thumb:hover{background:var(--neutral-lighter) !important;border-color:var(--primary-dark-neutral-base) !important}:not(.disabled):not(.checked) .thumb:hover{border-color:var(--color-dark-light);background:var(--color-lighter)}:not(.disabled) .thumb:focus{border-color:var(--info-base) !important;z-index:1}";
5
+
6
+ const CuraSwitch = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.onchange = createEvent(this, "onchange", 7);
10
+ this.sizes = {
11
+ "large": { size: 64 },
12
+ "medium": { size: 48 },
13
+ "small": { size: 40 },
14
+ };
15
+ this.isDarkbackground = () => this.background === 'dark';
16
+ this.toggleSwitch = () => {
17
+ if (this.disabled)
18
+ return null;
19
+ this.checked = !this.checked;
20
+ this.onchange.emit({ checked: this.checked });
21
+ };
22
+ this.checked = false;
23
+ this.disabled = false;
24
+ this.label = '';
25
+ this.ontabindex = 0;
26
+ this.position = 'left';
27
+ this.size = 'medium';
28
+ this.background = 'light';
29
+ this.color = 'accent';
30
+ this.styles = {};
31
+ }
32
+ sizeHandler() {
33
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--size-track': `${this.sizes[this.size].size}px`, '--size': `${formsSizes[this.size].size}px`, '--gap': `${formsSizes[this.size].gap}px` });
34
+ }
35
+ setColors() {
36
+ const colors = [
37
+ { name: '--info-base', background: 'info-base' },
38
+ { name: '--neutral-medium', background: 'neutral-medium' },
39
+ { name: '--color-lighter', background: `${this.color}-lighter` },
40
+ { name: '--color-base-lighter-50', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'lighter'}`, opacity: 0.5 },
41
+ { name: '--color-base-light', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'light'}` },
42
+ { name: '--color-dark-light', background: `${this.color}-${this.isDarkbackground() ? 'dark' : 'light'}` },
43
+ { name: '--primary-lighter-neutral-dark', background: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark' },
44
+ { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },
45
+ { name: '--neutral-white-purewhite', background: `neutral-${this.isDarkbackground() ? 'white' : 'purewhite'}` },
46
+ { name: '--primary-base-neutral-black-20', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-black'}`, opacity: 0.2 },
47
+ { name: '--neutral-base-black-40', background: `neutral-${this.isDarkbackground() ? 'base' : 'black'}`, opacity: 0.4 },
48
+ { name: '--primary-dark-neutral-base', background: `${this.isDarkbackground() ? 'primary-dark' : 'neutral-base'}` },
49
+ { name: '--neutral-lighter', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-lighter'}` },
50
+ ];
51
+ colors.forEach(color => {
52
+ this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background, color === null || color === void 0 ? void 0 : color.opacity);
53
+ });
54
+ this.styles = Object.assign({}, this.styles);
55
+ }
56
+ connectedCallback() {
57
+ this.sizeHandler();
58
+ this.setColors();
59
+ }
60
+ assignColor(colorDark, colorLight) {
61
+ if (this.disabled)
62
+ return this.isDarkbackground() ? 'primary-base' : 'neutral-medium';
63
+ return this.isDarkbackground() ? colorDark : colorLight;
64
+ }
65
+ getClasses() {
66
+ const classes = {};
67
+ classes['container'] = true;
68
+ classes['checked'] = this.checked;
69
+ classes['disabled'] = this.disabled;
70
+ classes['position'] = this.position === 'right';
71
+ return classes;
72
+ }
73
+ render() {
74
+ return (h(Host, null, h("div", { class: this.getClasses(), style: this.styles }, h("div", { class: "info" }, h("cura-label", { class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', lineHeight: "125%", color: this.assignColor('neutral-white', 'neutral-black') }, this.label), h("cura-label", { color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, h("slot", null))), h("div", { onClick: this.toggleSwitch, class: "control" }, h("div", { class: `track ${this.size.toLowerCase()}` }, h("div", { class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
75
+ }
76
+ static get watchers() { return {
77
+ "size": ["sizeHandler"],
78
+ "color": ["setColors"],
79
+ "background": ["setColors"]
80
+ }; }
81
+ };
82
+ CuraSwitch.style = curaSwitchCss;
83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AE,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,IAC/C,WAAK,KAAK,EAAC,MAAM,IACf,kBAAY,KAAK,EAAC,OAAO,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,KAAK,OAAO,GAAG,QAAQ,GAAG,QAAQ,EACjD,UAAU,EAAC,MAAM,EACjB,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,eAAe,CAAC,IACxD,IAAI,CAAC,KAAK,CACA,EACb,kBACE,KAAK,EAAE,IAAI,CAAC,WAAW,CAAC,iBAAiB,EAAE,cAAc,CAAC,EAC1D,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,SAAS,IACf,eAAa,CACF,CACT,EAEN,WAAK,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,EAAC,SAAS,IAC9C,WAAK,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAC5C,WAAK,KAAK,EAAE,SAAS,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,UAAU,GAAQ,CAC7E,CACF,CACF,CACD,EACP;GACH;;;;;;;;;;;","names":[],"sources":["./src/components/forms/cura-switch/cura-switch.scss?tag=cura-switch&encapsulation=shadow","./src/components/forms/cura-switch/cura-switch.tsx"],"sourcesContent":[":host {\n display: block;\n width: fit-content;\n box-sizing: border-box;\n}\n\n.container {\n display: flex;\n align-items: center;\n flex-direction: row-reverse;\n gap: var(--gap);\n}\n\n.position {\n\n &.container {\n flex-direction: row;\n }\n\n .label {\n text-align: right;\n }\n\n .message {\n text-align: right;\n }\n}\n\n.control {\n width: fit-content;\n}\n\n/* Estilos para o controle de switch */\n.track {\n background: var(--neutral-base-black-40);\n border-radius: 16px;\n transition: background-color 0.3s;\n align-items: flex-start;\n flex-shrink: 0;\n box-sizing: border-box;\n width: var(--size-track);\n height: var(--size);\n}\n\n.thumb {\n background-color: var(--neutral-white-purewhite);\n border: 2px solid var(--neutral-medium);\n border-radius: 50%;\n position: absolute;\n transition: transform 0.3s, outline 0.3s;\n display: inline-block;\n cursor: pointer;\n user-select: none;\n box-sizing: border-box;\n width: var(--size);\n height: var(--size);\n}\n\n/* Estado \"checked\" */\n.checked .thumb {\n border-color: var(--color-dark-light);\n background: var(--color-lighter);\n transform: translateX(var(--size));\n}\n\n.checked .thumb:hover {\n background: var(--neutral-white-purewhite) !important;\n}\n\n.checked .track {\n background: var(--color-base-lighter-50);\n}\n\n/* Estado \"disabled\" */\n\n.disabled .track {\n background: var(--primary-base-neutral-black-20);\n\n}\n\n.disabled .thumb {\n background: var(--neutral-lighter) !important;\n border-color: var(--primary-dark-neutral-base);\n cursor: not-allowed;\n\n}\n\n.disabled.checked .track {\n background: var(--primary-base-neutral-black-20);\n}\n\n.disabled .thumb:hover {\n background: var(--neutral-lighter) !important;\n border-color: var(--primary-dark-neutral-base) !important;\n}\n\n/* Estado hover para não disabled e não checked */\n:not(.disabled):not(.checked) .thumb:hover {\n border-color: var(--color-dark-light);\n background: var(--color-lighter);\n}\n\n/* Estado hover para não disabled */\n:not(.disabled) .thumb:focus {\n border-color: var(--info-base) !important;\n z-index: 1;\n}\n","import { Component, Prop, Event, h, Host, Watch, EventEmitter, State } from '@stencil/core';\nimport { formsSizes } from '../cura-forms.definitions';\n\n@Component({\n tag: 'cura-switch',\n styleUrl: 'cura-switch.scss',\n shadow: true,\n})\n\nexport class CuraSwitch {\n /**\n * Indicates whether the switch is checked or not.\n */\n @Prop({ reflect: true, mutable: true }) checked: boolean = false;\n /**\n * Indicates whether the switch is disabled or not.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n /**\n * The label text to display next to the switch.\n */\n @Prop({ reflect: true }) label: string = '';\n /**\n * Tab index for the switch element.\n * Reflects as an HTML attribute.\n */\n @Prop({ reflect: true }) ontabindex: number = 0;\n /**\n * Position of the label relative to the switch.\n * Can be 'left' or 'right'.\n */\n @Prop({ reflect: true }) position: \"left\" | \"right\" = 'left';\n /**\n * Size of the switch.\n * Can be 'small', 'medium', or 'large'.\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n /**\n * Background style of the switch.\n * Can be 'dark' or 'light'.\n */\n @Prop() background: 'dark' | 'light' = 'light';\n /**\n * Accent color of the switch.\n */\n @Prop() color = 'accent';\n\n @State() styles = {};\n\n @Event({ eventName: 'onchange', composed: true, cancelable: true, bubbles: true }) onchange: EventEmitter<{ checked: boolean }>;\n\n sizes = {\n \"large\": { size: 64 },\n \"medium\": { size: 48 },\n \"small\": { size: 40 },\n };\n\n\n isDarkbackground = () => this.background === 'dark';\n\n @Watch('size')\n sizeHandler() {\n this.styles = {\n ...this.styles,\n '--size-track': `${this.sizes[this.size].size}px`,\n '--size': `${formsSizes[this.size].size}px`,\n '--gap': `${formsSizes[this.size].gap}px`\n };\n }\n\n @Watch('color')\n @Watch('background')\n setColors() {\n const colors = [\n { name: '--info-base', background: 'info-base' },\n { name: '--neutral-medium', background: 'neutral-medium' },\n { name: '--color-lighter', background: `${this.color}-lighter` },\n { name: '--color-base-lighter-50', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'lighter'}`, opacity: 0.5 },\n { name: '--color-base-light', background: `${this.color}-${this.isDarkbackground() ? 'base' : 'light'}` },\n { name: '--color-dark-light', background: `${this.color}-${this.isDarkbackground() ? 'dark' : 'light'}` },\n { name: '--primary-lighter-neutral-dark', background: this.isDarkbackground() ? 'primary-lighter' : 'neutral-dark' },\n { name: '--primary-base-neutral-medium', background: this.isDarkbackground() ? 'primary-base' : 'neutral-medium' },\n { name: '--neutral-white-purewhite', background: `neutral-${this.isDarkbackground() ? 'white' : 'purewhite'}` },\n { name: '--primary-base-neutral-black-20', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-black'}`, opacity: 0.2 },\n { name: '--neutral-base-black-40', background: `neutral-${this.isDarkbackground() ? 'base' : 'black'}`, opacity: 0.4 },\n { name: '--primary-dark-neutral-base', background: `${this.isDarkbackground() ? 'primary-dark' : 'neutral-base'}` },\n { name: '--neutral-lighter', background: `${this.isDarkbackground() ? 'primary-base' : 'neutral-lighter'}` },\n ];\n\n colors.forEach(color => {\n this.styles[color.name] = window.CuraAPI.theme.colors.getColor(color.background, color?.opacity);\n });\n this.styles = { ...this.styles };\n\n }\n\n connectedCallback() {\n this.sizeHandler()\n this.setColors();\n }\n\n toggleSwitch = () => {\n if (this.disabled) return null;\n\n this.checked = !this.checked;\n this.onchange.emit({ checked: this.checked })\n };\n\n assignColor(colorDark: string, colorLight: string) {\n if (this.disabled) return this.isDarkbackground() ? 'primary-base' : 'neutral-medium';\n return this.isDarkbackground() ? colorDark : colorLight\n }\n\n getClasses() {\n const classes = {};\n classes['container'] = true;\n classes['checked'] = this.checked;\n classes['disabled'] = this.disabled;\n classes['position'] = this.position === 'right';\n\n return classes;\n }\n\n\n render() {\n return (\n <Host>\n <div class={this.getClasses()} style={this.styles}>\n <div class=\"info\">\n <cura-label class=\"label\"\n size={this.size === 'large' ? 'medium' : 'xsmall'}\n lineHeight=\"125%\"\n color={this.assignColor('neutral-white', 'neutral-black')}>\n {this.label}\n </cura-label>\n <cura-label\n color={this.assignColor('primary-lighter', 'neutral-dark')}\n size=\"xsmall\"\n class=\"message\">\n <slot></slot>\n </cura-label>\n </div>\n\n <div onClick={this.toggleSwitch} class=\"control\">\n <div class={`track ${this.size.toLowerCase()}`}>\n <div class={`thumb ${this.size.toLowerCase()}`} tabIndex={this.ontabindex}></div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
package/dist/esm/cura.js CHANGED
@@ -1,5 +1,5 @@
1
- import { p as plt, w as win, a as promiseResolve, b as bootstrapLazy } from './index-d99da69e.js';
2
- export { s as setNonce } from './index-d99da69e.js';
1
+ import { p as plt, w as win, a as promiseResolve, b as bootstrapLazy } from './index-81f1a268.js';
2
+ export { s as setNonce } from './index-81f1a268.js';
3
3
  import { g as globalScripts } from './app-globals-29001758.js';
4
4
 
5
5
  /*
@@ -25,7 +25,7 @@ const patchBrowser = () => {
25
25
 
26
26
  patchBrowser().then(options => {
27
27
  globalScripts();
28
- return bootstrapLazy([["cura-accordion_8",[[1,"cura-button",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}],[1,"cura-accordion-item",{"label":[513],"iconSize":[514,"icon-size"],"openIcon":[513,"open-icon"],"closeIcon":[513,"close-icon"],"iconColor":[513,"icon-color"],"iconActiveColor":[513,"icon-active-color"],"colorMode":[1,"color-mode"],"opened":[1540],"styles":[32]}],[1,"cura-accordion",{"color":[513],"activeColor":[513,"active-color"],"colorMode":[513,"color-mode"],"iconSize":[514,"icon-size"],"openIcon":[513,"open-icon"],"closeIcon":[513,"close-icon"],"iconColor":[513,"icon-color"],"iconActiveColor":[513,"icon-active-color"],"behavior":[513],"styles":[32]}],[1,"cura-heading",{"level":[514],"size":[513],"weight":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}],[1,"cura-page-template",{"contentwidth":[513]}],[1,"cura-paragraph",{"size":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}],[1,"cura-loader-circle",{"size":[513],"color":[513]}],[1,"cura-icon",{"name":[513],"color":[1],"size":[8],"iconset":[513],"disabled":[4]}]]],["cura-button-outline",[[1,"cura-button-outline",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}]]],["cura-button-transparent",[[1,"cura-button-transparent",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}]]],["cura-icons-view",[[1,"cura-icons-view",{"selected":[32]}]]],["cura-display",[[1,"cura-display",{"level":[514],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}]]],["cura-label",[[1,"cura-label",{"size":[513],"weight":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}]]]], options);
28
+ return bootstrapLazy([["cura-accordion_8",[[1,"cura-button",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}],[1,"cura-accordion-item",{"label":[513],"iconSize":[514,"icon-size"],"openIcon":[513,"open-icon"],"closeIcon":[513,"close-icon"],"iconColor":[513,"icon-color"],"iconActiveColor":[513,"icon-active-color"],"colorMode":[1,"color-mode"],"opened":[1540],"styles":[32]}],[1,"cura-accordion",{"color":[513],"activeColor":[513,"active-color"],"colorMode":[513,"color-mode"],"iconSize":[514,"icon-size"],"openIcon":[513,"open-icon"],"closeIcon":[513,"close-icon"],"iconColor":[513,"icon-color"],"iconActiveColor":[513,"icon-active-color"],"behavior":[513],"styles":[32]}],[1,"cura-page-template",{"contentwidth":[513]}],[1,"cura-heading",{"level":[514],"size":[513],"weight":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}],[1,"cura-loader-circle",{"size":[513],"color":[513]}],[1,"cura-paragraph",{"size":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}],[1,"cura-icon",{"name":[513],"color":[1],"size":[8],"iconset":[513],"disabled":[4]}]]],["cura-icons-view",[[1,"cura-icons-view",{"selected":[32]}]]],["cura-alert",[[1,"cura-alert",{"type":[1],"floating":[516],"label":[513],"closeable":[516],"styles":[32]}]]],["cura-checkbox",[[1,"cura-checkbox",{"checked":[1540],"indeterminate":[1540],"status":[1537],"disabled":[516],"required":[516],"label":[513],"ontabindex":[514],"position":[513],"value":[513],"name":[513],"size":[513],"background":[1],"iconColor":[1,"icon-color"],"color":[1],"styles":[32]}]]],["cura-input-text",[[1,"cura-input-text",{"mode":[1537],"status":[1537],"size":[1537],"type":[513],"label":[513],"placeholder":[513],"value":[1032],"iconName":[1537,"icon-name"],"helperText":[1537,"helper-text"],"disabled":[516],"required":[516],"maskPreset":[8,"mask-preset"],"maskRegex":[1537,"mask-regex"],"maskAdvanced":[1537,"mask-advanced"],"maxlength":[1538],"readOnly":[516,"read-only"],"isLoading":[1540,"is-loading"],"clearIcon":[1540,"clear-icon"],"isHovered":[32],"isFocused":[32],"styles":[32]}]]],["cura-button-outline",[[1,"cura-button-outline",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}]]],["cura-button-transparent",[[1,"cura-button-transparent",{"size":[513],"disabled":[516],"isLoading":[516,"is-loading"],"iconName":[513,"icon-name"],"iconset":[513],"iconPosition":[513,"icon-position"],"iconOnly":[516,"icon-only"],"href":[513],"target":[513],"color":[1],"fontColor":[513,"font-color"],"textAlign":[513,"text-align"],"styles":[32]}]]],["cura-radio",[[1,"cura-radio",{"checked":[1540],"status":[1537],"disabled":[516],"required":[516],"label":[513],"ontabindex":[514],"position":[513],"value":[513],"name":[513],"background":[1],"size":[1],"color":[1],"styles":[32]}]]],["cura-button-select",[[1,"cura-button-select",{"size":[513],"disabled":[516],"selected":[516],"iconPosition":[513,"icon-position"],"color":[1],"background":[1],"fontcolor":[1],"hovered":[32],"styles":[32]}]]],["cura-switch",[[1,"cura-switch",{"checked":[1540],"disabled":[516],"label":[513],"ontabindex":[514],"position":[513],"size":[513],"background":[1],"color":[1],"styles":[32]}]]],["cura-display",[[1,"cura-display",{"level":[514],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}]]],["cura-label",[[1,"cura-label",{"size":[513],"weight":[513],"spotColor":[513,"spot-color"],"color":[1],"marginBlock":[513,"margin-block"],"lineHeight":[513,"line-height"],"styles":[32]}]]]], options);
29
29
  });
30
30
 
31
31
  //# sourceMappingURL=cura.js.map
@@ -427,6 +427,19 @@ const parsePropertyValue = (propValue, propType) => {
427
427
  return propValue;
428
428
  };
429
429
  const getElement = (ref) => (getHostRef(ref).$hostElement$ );
430
+ const createEvent = (ref, name, flags) => {
431
+ const elm = getElement(ref);
432
+ return {
433
+ emit: (detail) => {
434
+ return emitEvent(elm, name, {
435
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
436
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
437
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
438
+ detail,
439
+ });
440
+ },
441
+ };
442
+ };
430
443
  /**
431
444
  * Helper function to create & dispatch a custom Event on a provided target
432
445
  * @param elm the target of the Event
@@ -581,6 +594,12 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
581
594
  }
582
595
  }
583
596
  }
597
+ else if (memberName === 'ref') {
598
+ // minifier will clean this up
599
+ if (newValue) {
600
+ newValue(elm);
601
+ }
602
+ }
584
603
  else if ((!isProp ) &&
585
604
  memberName[0] === 'o' &&
586
605
  memberName[1] === 'n') {
@@ -876,6 +895,7 @@ const removeVnodes = (vnodes, startIdx, endIdx) => {
876
895
  const vnode = vnodes[index];
877
896
  if (vnode) {
878
897
  const elm = vnode.$elm$;
898
+ nullifyVNodeRefs(vnode);
879
899
  if (elm) {
880
900
  {
881
901
  // we're removing this element
@@ -1334,6 +1354,19 @@ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1334
1354
  }
1335
1355
  return slotNameAttr === '';
1336
1356
  };
1357
+ /**
1358
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
1359
+ * calling them with `null`. This signals that the DOM element corresponding to
1360
+ * the VDom node has been removed from the DOM.
1361
+ *
1362
+ * @param vNode a virtual DOM node
1363
+ */
1364
+ const nullifyVNodeRefs = (vNode) => {
1365
+ {
1366
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1367
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1368
+ }
1369
+ };
1337
1370
  /**
1338
1371
  * The main entry point for Stencil's virtual DOM-based rendering engine
1339
1372
  *
@@ -2211,6 +2244,6 @@ const flush = () => {
2211
2244
  const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2212
2245
  const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2213
2246
 
2214
- export { CSS as C, Host as H, promiseResolve as a, bootstrapLazy as b, getElement as g, h, plt as p, registerInstance as r, setNonce as s, win as w };
2247
+ export { CSS as C, Host as H, promiseResolve as a, bootstrapLazy as b, createEvent as c, getElement as g, h, plt as p, registerInstance as r, setNonce as s, win as w };
2215
2248
 
2216
- //# sourceMappingURL=index-d99da69e.js.map
2249
+ //# sourceMappingURL=index-81f1a268.js.map