@rededor/cura 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/dist/cjs/{app-globals-4d07f363.js → app-globals-f33ceef8.js} +32 -1
  2. package/dist/cjs/app-globals-f33ceef8.js.map +1 -0
  3. package/dist/cjs/cura-accordion_12.cjs.entry.js +39 -38
  4. package/dist/cjs/cura-accordion_12.cjs.entry.js.map +1 -1
  5. package/dist/cjs/cura-alert.cjs.entry.js +3 -2
  6. package/dist/cjs/cura-alert.cjs.entry.js.map +1 -1
  7. package/dist/cjs/cura-avatar.cjs.entry.js +1 -1
  8. package/dist/cjs/cura-badge-distance.cjs.entry.js +1 -1
  9. package/dist/cjs/cura-badge-number.cjs.entry.js +2 -2
  10. package/dist/cjs/cura-badge-number.cjs.entry.js.map +1 -1
  11. package/dist/cjs/cura-button-outline.cjs.entry.js +1 -1
  12. package/dist/cjs/cura-button-select.cjs.entry.js +17 -9
  13. package/dist/cjs/cura-button-select.cjs.entry.js.map +1 -1
  14. package/dist/cjs/cura-button-transparent.cjs.entry.js +1 -1
  15. package/dist/cjs/cura-calendar.cjs.entry.js +2 -2
  16. package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
  17. package/dist/cjs/cura-card.cjs.entry.js +1 -1
  18. package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
  19. package/dist/cjs/cura-display.cjs.entry.js +1 -1
  20. package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +1 -1
  21. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +2 -2
  22. package/dist/cjs/cura-dropdown-search.cjs.entry.js +21 -11
  23. package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
  24. package/dist/cjs/cura-icons-view.cjs.entry.js +3 -3
  25. package/dist/cjs/cura-input-date.cjs.entry.js +45 -45
  26. package/dist/cjs/cura-input-date.cjs.entry.js.map +1 -1
  27. package/dist/cjs/cura-loader-bar.cjs.entry.js +1 -1
  28. package/dist/cjs/cura-radio.cjs.entry.js +1 -1
  29. package/dist/cjs/cura-switch.cjs.entry.js +1 -1
  30. package/dist/cjs/cura-toast.cjs.entry.js +1 -1
  31. package/dist/cjs/cura-tooltip.cjs.entry.js +232 -0
  32. package/dist/cjs/cura-tooltip.cjs.entry.js.map +1 -0
  33. package/dist/cjs/cura.cjs.js +2 -2
  34. package/dist/cjs/loader.cjs.js +2 -2
  35. package/dist/collection/api/theme-presets/theme-presets.js +2 -0
  36. package/dist/collection/api/theme-presets/theme-presets.js.map +1 -1
  37. package/dist/collection/api/theme-presets/theme-richet.js +32 -0
  38. package/dist/collection/api/theme-presets/theme-richet.js.map +1 -0
  39. package/dist/collection/collection-manifest.json +1 -0
  40. package/dist/collection/components/accordion/cura-accordion/cura-accordion.css +0 -6
  41. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js +41 -43
  42. package/dist/collection/components/accordion/cura-accordion/cura-accordion.js.map +1 -1
  43. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js +54 -36
  44. package/dist/collection/components/accordion/cura-accordion/cura-accordion.stories.js.map +1 -1
  45. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.css +61 -60
  46. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js +41 -23
  47. package/dist/collection/components/accordion/cura-accordion-item/cura-accordion-item.js.map +1 -1
  48. package/dist/collection/components/badges/cura-badge-distance/cura-badge-distance.js +1 -1
  49. package/dist/collection/components/badges/cura-badge-number/cura-badge-number.css +0 -2
  50. package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js +1 -1
  51. package/dist/collection/components/badges/cura-badge-number/cura-badge-number.js.map +1 -1
  52. package/dist/collection/components/buttons/cura-button/cura-button.js +1 -1
  53. package/dist/collection/components/buttons/cura-button-outline/cura-button-outline.js +1 -1
  54. package/dist/collection/components/buttons/cura-button-select/cura-button-select.css +36 -2
  55. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js +39 -11
  56. package/dist/collection/components/buttons/cura-button-select/cura-button-select.js.map +1 -1
  57. package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js +18 -7
  58. package/dist/collection/components/buttons/cura-button-select/cura-button-select.stories.js.map +1 -1
  59. package/dist/collection/components/buttons/cura-button-transparent/cura-button-transparent.js +1 -1
  60. package/dist/collection/components/cura-alert/cura-alert.css +25 -11
  61. package/dist/collection/components/cura-alert/cura-alert.js +2 -1
  62. package/dist/collection/components/cura-alert/cura-alert.js.map +1 -1
  63. package/dist/collection/components/cura-avatar/cura-avatar.js +1 -1
  64. package/dist/collection/components/cura-calendar/cura-calendar.css +1 -0
  65. package/dist/collection/components/cura-calendar/cura-calendar.js +1 -1
  66. package/dist/collection/components/cura-card/cura-card.js +1 -1
  67. package/dist/collection/components/cura-icon/cura-icon.js +1 -1
  68. package/dist/collection/components/cura-icons-view/cura-icons-view.js +3 -3
  69. package/dist/collection/components/cura-page-template/cura-page-template.js +1 -1
  70. package/dist/collection/components/cura-toast/cura-toast.js +1 -1
  71. package/dist/collection/components/cura-tooltip/cura-tooltip.css +159 -0
  72. package/dist/collection/components/cura-tooltip/cura-tooltip.js +397 -0
  73. package/dist/collection/components/cura-tooltip/cura-tooltip.js.map +1 -0
  74. package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js +137 -0
  75. package/dist/collection/components/cura-tooltip/cura-tooltip.stories.js.map +1 -0
  76. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
  77. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +2 -2
  78. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
  79. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +1 -1
  80. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +20 -10
  81. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
  82. package/dist/collection/components/forms/cura-input-date/cura-input-date.css +15 -0
  83. package/dist/collection/components/forms/cura-input-date/cura-input-date.js +69 -68
  84. package/dist/collection/components/forms/cura-input-date/cura-input-date.js.map +1 -1
  85. package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js +29 -10
  86. package/dist/collection/components/forms/cura-input-date/cura-input-date.stories.js.map +1 -1
  87. package/dist/collection/components/forms/cura-input-text/cura-input-text.js +1 -1
  88. package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
  89. package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
  90. package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
  91. package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
  92. package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
  93. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +1 -1
  94. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
  95. package/dist/collection/components/text/cura-display/cura-display.js +1 -1
  96. package/dist/collection/components/text/cura-heading/cura-heading.css +5 -1
  97. package/dist/collection/components/text/cura-heading/cura-heading.js +7 -6
  98. package/dist/collection/components/text/cura-heading/cura-heading.js.map +1 -1
  99. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
  100. package/dist/components/cura-accordion-item.js +19 -12
  101. package/dist/components/cura-accordion-item.js.map +1 -1
  102. package/dist/components/cura-accordion.js +14 -15
  103. package/dist/components/cura-accordion.js.map +1 -1
  104. package/dist/components/cura-alert.js +3 -2
  105. package/dist/components/cura-alert.js.map +1 -1
  106. package/dist/components/cura-avatar.js +1 -1
  107. package/dist/components/cura-badge-distance.js +1 -1
  108. package/dist/components/cura-badge-number2.js +2 -2
  109. package/dist/components/cura-badge-number2.js.map +1 -1
  110. package/dist/components/cura-button-outline.js +1 -1
  111. package/dist/components/cura-button-select.js +18 -9
  112. package/dist/components/cura-button-select.js.map +1 -1
  113. package/dist/components/cura-button-transparent2.js +1 -1
  114. package/dist/components/cura-button.js +1 -1
  115. package/dist/components/cura-calendar2.js +2 -2
  116. package/dist/components/cura-calendar2.js.map +1 -1
  117. package/dist/components/cura-card.js +1 -1
  118. package/dist/components/cura-checkbox.js +1 -1
  119. package/dist/components/cura-display.js +1 -1
  120. package/dist/components/cura-dropdown-search-option-title.js +1 -1
  121. package/dist/components/cura-dropdown-search-option.js +2 -2
  122. package/dist/components/cura-dropdown-search.js +21 -11
  123. package/dist/components/cura-dropdown-search.js.map +1 -1
  124. package/dist/components/cura-heading2.js +8 -7
  125. package/dist/components/cura-heading2.js.map +1 -1
  126. package/dist/components/cura-icon2.js +1 -1
  127. package/dist/components/cura-icons-view.js +3 -3
  128. package/dist/components/cura-input-date.js +54 -57
  129. package/dist/components/cura-input-date.js.map +1 -1
  130. package/dist/components/cura-label2.js +1 -1
  131. package/dist/components/cura-loader-bar2.js +1 -1
  132. package/dist/components/cura-loader-circle2.js +1 -1
  133. package/dist/components/cura-page-template.js +1 -1
  134. package/dist/components/cura-paragraph2.js +1 -1
  135. package/dist/components/cura-radio.js +1 -1
  136. package/dist/components/cura-select-option2.js +1 -1
  137. package/dist/components/cura-select2.js +3 -3
  138. package/dist/components/cura-switch.js +1 -1
  139. package/dist/components/cura-toast.js +1 -1
  140. package/dist/components/cura-tooltip.d.ts +11 -0
  141. package/dist/components/cura-tooltip.js +291 -0
  142. package/dist/components/cura-tooltip.js.map +1 -0
  143. package/dist/components/index.js +33 -0
  144. package/dist/components/index.js.map +1 -1
  145. package/dist/cura/cura.esm.js +1 -1
  146. package/dist/cura/cura.esm.js.map +1 -1
  147. package/dist/cura/{p-116a1cd6.entry.js → p-01e301d4.entry.js} +2 -2
  148. package/dist/cura/{p-c6508bd7.entry.js → p-022b22b6.entry.js} +2 -2
  149. package/dist/cura/p-0308cf6b.entry.js +2 -0
  150. package/dist/cura/p-0308cf6b.entry.js.map +1 -0
  151. package/dist/cura/p-22e921d9.entry.js +2 -0
  152. package/dist/cura/p-22e921d9.entry.js.map +1 -0
  153. package/dist/cura/p-2b9eadc7.entry.js +2 -0
  154. package/dist/cura/p-2b9eadc7.entry.js.map +1 -0
  155. package/dist/cura/{p-b2d5db22.entry.js → p-2c0f5497.entry.js} +2 -2
  156. package/dist/cura/p-5bb8302c.entry.js +2 -0
  157. package/dist/cura/p-5bb8302c.entry.js.map +1 -0
  158. package/dist/cura/{p-fcbf4311.entry.js → p-639c1b67.entry.js} +2 -2
  159. package/dist/cura/{p-2956f120.entry.js → p-7853ab16.entry.js} +2 -2
  160. package/dist/cura/{p-2956f120.entry.js.map → p-7853ab16.entry.js.map} +1 -1
  161. package/dist/cura/{p-41c3d47d.entry.js → p-81c66f2b.entry.js} +2 -2
  162. package/dist/cura/p-82b99090.js +2 -0
  163. package/dist/cura/p-82b99090.js.map +1 -0
  164. package/dist/cura/p-93525d68.entry.js +2 -0
  165. package/dist/cura/p-93525d68.entry.js.map +1 -0
  166. package/dist/cura/p-9991f7db.entry.js +2 -0
  167. package/dist/cura/p-9e3d26fe.entry.js +2 -0
  168. package/dist/cura/p-9e3d26fe.entry.js.map +1 -0
  169. package/dist/cura/{p-dcd2e5bb.entry.js → p-a7ecea4a.entry.js} +2 -2
  170. package/dist/cura/{p-33772510.entry.js → p-b0451cb3.entry.js} +2 -2
  171. package/dist/cura/{p-8f3db0fe.entry.js → p-b883e098.entry.js} +2 -2
  172. package/dist/cura/{p-907b3d12.entry.js → p-bfb5e9e1.entry.js} +2 -2
  173. package/dist/cura/{p-e5023e34.entry.js → p-c444e692.entry.js} +2 -2
  174. package/dist/cura/{p-fdce91a7.entry.js → p-d635501a.entry.js} +2 -2
  175. package/dist/cura/{p-fd083399.entry.js → p-df851816.entry.js} +2 -2
  176. package/dist/cura/{p-44e3325a.entry.js → p-e3d3bc3d.entry.js} +2 -2
  177. package/dist/cura/p-eda28278.entry.js +2 -0
  178. package/dist/cura/p-eda28278.entry.js.map +1 -0
  179. package/dist/esm/{app-globals-6ca7103d.js → app-globals-e54ee4c3.js} +32 -1
  180. package/dist/esm/app-globals-e54ee4c3.js.map +1 -0
  181. package/dist/esm/cura-accordion_12.entry.js +39 -38
  182. package/dist/esm/cura-accordion_12.entry.js.map +1 -1
  183. package/dist/esm/cura-alert.entry.js +3 -2
  184. package/dist/esm/cura-alert.entry.js.map +1 -1
  185. package/dist/esm/cura-avatar.entry.js +1 -1
  186. package/dist/esm/cura-badge-distance.entry.js +1 -1
  187. package/dist/esm/cura-badge-number.entry.js +2 -2
  188. package/dist/esm/cura-badge-number.entry.js.map +1 -1
  189. package/dist/esm/cura-button-outline.entry.js +1 -1
  190. package/dist/esm/cura-button-select.entry.js +17 -9
  191. package/dist/esm/cura-button-select.entry.js.map +1 -1
  192. package/dist/esm/cura-button-transparent.entry.js +1 -1
  193. package/dist/esm/cura-calendar.entry.js +2 -2
  194. package/dist/esm/cura-calendar.entry.js.map +1 -1
  195. package/dist/esm/cura-card.entry.js +1 -1
  196. package/dist/esm/cura-checkbox.entry.js +1 -1
  197. package/dist/esm/cura-display.entry.js +1 -1
  198. package/dist/esm/cura-dropdown-search-option-title.entry.js +1 -1
  199. package/dist/esm/cura-dropdown-search-option.entry.js +2 -2
  200. package/dist/esm/cura-dropdown-search.entry.js +21 -11
  201. package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
  202. package/dist/esm/cura-icons-view.entry.js +3 -3
  203. package/dist/esm/cura-input-date.entry.js +45 -45
  204. package/dist/esm/cura-input-date.entry.js.map +1 -1
  205. package/dist/esm/cura-loader-bar.entry.js +1 -1
  206. package/dist/esm/cura-radio.entry.js +1 -1
  207. package/dist/esm/cura-switch.entry.js +1 -1
  208. package/dist/esm/cura-toast.entry.js +1 -1
  209. package/dist/esm/cura-tooltip.entry.js +228 -0
  210. package/dist/esm/cura-tooltip.entry.js.map +1 -0
  211. package/dist/esm/cura.js +2 -2
  212. package/dist/esm/loader.js +2 -2
  213. package/dist/types/api/theme-presets/theme-presets.d.ts +43 -0
  214. package/dist/types/api/theme-presets/theme-richet.d.ts +43 -0
  215. package/dist/types/components/accordion/cura-accordion/cura-accordion.d.ts +7 -3
  216. package/dist/types/components/accordion/cura-accordion/cura-accordion.stories.d.ts +38 -16
  217. package/dist/types/components/accordion/cura-accordion-item/cura-accordion-item.d.ts +8 -3
  218. package/dist/types/components/buttons/cura-button-select/cura-button-select.d.ts +2 -0
  219. package/dist/types/components/buttons/cura-button-select/cura-button-select.stories.d.ts +14 -0
  220. package/dist/types/components/cura-tooltip/cura-tooltip.d.ts +25 -0
  221. package/dist/types/components/cura-tooltip/cura-tooltip.stories.d.ts +119 -0
  222. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +1 -0
  223. package/dist/types/components/forms/cura-input-date/cura-input-date.d.ts +19 -19
  224. package/dist/types/components/text/cura-heading/cura-heading.d.ts +1 -0
  225. package/dist/types/components.d.ts +75 -10
  226. package/package.json +2 -2
  227. package/dist/cjs/app-globals-4d07f363.js.map +0 -1
  228. package/dist/cura/p-0b7a7306.js +0 -2
  229. package/dist/cura/p-0b7a7306.js.map +0 -1
  230. package/dist/cura/p-2d267d23.entry.js +0 -2
  231. package/dist/cura/p-2d267d23.entry.js.map +0 -1
  232. package/dist/cura/p-4e14c01c.entry.js +0 -2
  233. package/dist/cura/p-b43b69f3.entry.js +0 -2
  234. package/dist/cura/p-b43b69f3.entry.js.map +0 -1
  235. package/dist/cura/p-be10b681.entry.js +0 -2
  236. package/dist/cura/p-be10b681.entry.js.map +0 -1
  237. package/dist/cura/p-cda24a1e.entry.js +0 -2
  238. package/dist/cura/p-cda24a1e.entry.js.map +0 -1
  239. package/dist/cura/p-e8bc6381.entry.js +0 -2
  240. package/dist/cura/p-e8bc6381.entry.js.map +0 -1
  241. package/dist/cura/p-ed97cf3c.entry.js +0 -2
  242. package/dist/cura/p-ed97cf3c.entry.js.map +0 -1
  243. package/dist/esm/app-globals-6ca7103d.js.map +0 -1
  244. /package/dist/cura/{p-116a1cd6.entry.js.map → p-01e301d4.entry.js.map} +0 -0
  245. /package/dist/cura/{p-c6508bd7.entry.js.map → p-022b22b6.entry.js.map} +0 -0
  246. /package/dist/cura/{p-b2d5db22.entry.js.map → p-2c0f5497.entry.js.map} +0 -0
  247. /package/dist/cura/{p-fcbf4311.entry.js.map → p-639c1b67.entry.js.map} +0 -0
  248. /package/dist/cura/{p-41c3d47d.entry.js.map → p-81c66f2b.entry.js.map} +0 -0
  249. /package/dist/cura/{p-4e14c01c.entry.js.map → p-9991f7db.entry.js.map} +0 -0
  250. /package/dist/cura/{p-dcd2e5bb.entry.js.map → p-a7ecea4a.entry.js.map} +0 -0
  251. /package/dist/cura/{p-33772510.entry.js.map → p-b0451cb3.entry.js.map} +0 -0
  252. /package/dist/cura/{p-8f3db0fe.entry.js.map → p-b883e098.entry.js.map} +0 -0
  253. /package/dist/cura/{p-907b3d12.entry.js.map → p-bfb5e9e1.entry.js.map} +0 -0
  254. /package/dist/cura/{p-e5023e34.entry.js.map → p-c444e692.entry.js.map} +0 -0
  255. /package/dist/cura/{p-fdce91a7.entry.js.map → p-d635501a.entry.js.map} +0 -0
  256. /package/dist/cura/{p-fd083399.entry.js.map → p-df851816.entry.js.map} +0 -0
  257. /package/dist/cura/{p-44e3325a.entry.js.map → p-e3d3bc3d.entry.js.map} +0 -0
@@ -43,7 +43,7 @@ const CuraCard = class {
43
43
  return classes;
44
44
  }
45
45
  render() {
46
- return (index.h(index.Host, { key: 'db1a13cfe3bb925300e65641e1d45fade5a03f52', role: this.href ? 'link' : 'div' }, this.href ? (index.h("a", { class: this.getClasses(), target: this.target, style: this.styles, href: this.href }, index.h("slot", null))) : (index.h("div", { class: this.getClasses(), style: this.styles }, index.h("slot", null)))));
46
+ return (index.h(index.Host, { key: '72140d7ae467677c7acbdb3ff45fa84c9fe60fce', role: this.href ? 'link' : 'div' }, this.href ? (index.h("a", { class: this.getClasses(), target: this.target, style: this.styles, href: this.href }, index.h("slot", null))) : (index.h("div", { class: this.getClasses(), style: this.styles }, index.h("slot", null)))));
47
47
  }
48
48
  };
49
49
  CuraCard.style = CuraCardStyle0;
@@ -164,7 +164,7 @@ const CuraCheckbox = class {
164
164
  return index.h("cura-icon", { class: "icon", name: iconName, size: iconSize, color: iconColor });
165
165
  }
166
166
  render() {
167
- return (index.h(index.Host, { key: 'a346ec6f3d5a982471ac922982af7f9dbee14865' }, index.h("div", { key: '5786471ce3a9c1e116411f14b22d8bc5d7d39dce', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, index.h("div", { key: '18d6646e969d7f78acba9deab9eb644de2df7011', class: "info" }, index.h("div", { key: 'fa29dbdfcd215a83aff824cb5d23d15b8f93313f', class: "label-wrapper" }, index.h("cura-label", { key: 'db7c96cc88553166b78e70f0c773fde12d54fc40', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '408383422b9cdf45fe7cbfb51f7ea06ae3d1a260', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '4af49958c61ddc4e79b719ff03179e6003eee93c', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: '649bbc456157e103eb55c199857158d37c8b7b16' }))), index.h("div", { key: 'b0abfc17ee08f13ad82e4c22ea8f90d980893274', class: 'checkbox', tabIndex: this.ontabindex }, index.h("input", { key: 'fba5fbe2853e340cc30ffe8d663f62b874cd1877', type: "checkbox", name: this.name, value: this.value, disabled: this.disabled, required: this.required, checked: this.checked, indeterminate: this.indeterminate }), this.getIcon()))));
167
+ return (index.h(index.Host, { key: '00334ec058edf0849cf30c65d2f9e2e2e051de96' }, index.h("div", { key: 'd7c7857afa27a033f0642369717eb3be406f9f27', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, index.h("div", { key: 'aed0ec8155b2a5c0e3000b416afd6c5455c55f0e', class: "info" }, index.h("div", { key: 'd90166401c6946c508d2cace62976c2e7374689f', class: "label-wrapper" }, index.h("cura-label", { key: '7c0c5cc650db37f09127050333f49c5f4b4c7dc6', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '3c1cd2dcad221f4d93bde959ca33273270f0fe45', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '3fd01d993596f36da00b3acfeef02f2a28340eae', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: '2c106bd163a1b330a18061c0e99eb21c911d7da9' }))), index.h("div", { key: '2286927b31856a224049693295caa9e037695749', class: 'checkbox', tabIndex: this.ontabindex }, index.h("input", { key: '9bb8a436f1500d046a9b57972307cf5feff183d3', type: "checkbox", name: this.name, value: this.value, disabled: this.disabled, required: this.required, checked: this.checked, indeterminate: this.indeterminate }), this.getIcon()))));
168
168
  }
169
169
  static get formAssociated() { return true; }
170
170
  get host() { return index.getElement(this); }
@@ -69,7 +69,7 @@ const CuraDisplay = class {
69
69
  return tags[`${this.level}`] || tags['default'];
70
70
  }
71
71
  render() {
72
- return (index.h(index.Host, { key: 'b7f2ed980b7cedd3c9fbd60f14bf8785bb5c26cb', style: this.hostCSSProperties() }, this.getHeadingTag()));
72
+ return (index.h(index.Host, { key: 'bf5c1121ffd1debb9b5763acdde1c7244b4afcc3', style: this.hostCSSProperties() }, this.getHeadingTag()));
73
73
  }
74
74
  get host() { return index.getElement(this); }
75
75
  static get watchers() { return {
@@ -12,7 +12,7 @@ const CuraDropdownSearchOptionTitle = class {
12
12
  index.registerInstance(this, hostRef);
13
13
  }
14
14
  render() {
15
- return (index.h(index.Host, { key: '5a6afd8afb971845aeef19cd4ea6fe7586a1fb4e', slot: "dropdown-search-option" }, index.h("cura-label", { key: '00f5bc78178b6b549eaee21f28dcdb28b539099b', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, index.h("slot", { key: '0d858d26544542c8c05686a879a44366318e86ce' }))));
15
+ return (index.h(index.Host, { key: 'e4929a8c5c1c1f11b3e51dc088b2dd506e1bdfa0', slot: "dropdown-search-option" }, index.h("cura-label", { key: '5bb5406c11a39a6a587737cf99eb1d2deb2ea0da', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, index.h("slot", { key: 'c781e560b512d5362370e9855551b3e088ffbec1' }))));
16
16
  }
17
17
  };
18
18
  CuraDropdownSearchOptionTitle.style = CuraDropdownSearchOptionTitleStyle0;
@@ -46,12 +46,12 @@ const CuraDropdownSearchOption = class {
46
46
  }
47
47
  }
48
48
  render() {
49
- return (index.h(index.Host, { key: '3f02c7eb0d499c858c2145a7f63b0d935debaa2e', slot: "dropdown-search-option" }, index.h("div", { key: '5f9bfdaa8687e3784b7615b05fca16661847df62', style: this.styles, class: {
49
+ return (index.h(index.Host, { key: 'a084adaf6f89be71c8d5dc141705e7a71af353bb', slot: "dropdown-search-option" }, index.h("div", { key: '58ac361d8f16fdab8ef07d3be3f9c12a8c4b85ef', style: this.styles, class: {
50
50
  "option-container": true,
51
51
  hovered: this.selectable ? this.hovered : false,
52
52
  selected: this.selected,
53
53
  disabled: !this.selectable
54
- } }, index.h("div", { key: '4786ae6abd65c3232f854e2322d8b7b9093d332b', class: "content-container" }, index.h("div", { key: '5a29f12c98477cb970af13706b95b2f76a45c938', class: "option-info", onClick: (e) => this.handleOptionClick(e) }, index.h("slot", { key: '199564385ab97d313235891c55eeff808de24857', name: "image" }), index.h("cura-heading", { key: 'bfdf99dae80d99bafa1bd30808986ce315cafd5f', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, index.h("slot", { key: '711d9843b8196400071b50a50d395d4775bec1f0' }))), index.h("slot", { key: '1487aac2527eba3511f9653a0d2986aac95e2bad', name: "action" })))));
54
+ } }, index.h("div", { key: '0a7f959582b45df5c30fbbd225fccfc93aa937f4', class: "content-container" }, index.h("div", { key: '74b8a9626430847bf9dfb32d5188303427d2fd28', class: "option-info", onClick: (e) => this.handleOptionClick(e) }, index.h("slot", { key: '1dba6e28939841569f290c9fb18d3b7595bac06a', name: "image" }), index.h("cura-heading", { key: 'f7722edfd7ab87f7d9bacf475d988a1e80af41ef', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, index.h("slot", { key: 'db0385e5e3d2c450ba9a96d75e7913d2fe913d98' }))), index.h("slot", { key: '734b467cfce5ce114b06a10e3a153723da7ad41d', name: "action" })))));
55
55
  }
56
56
  get hostElement() { return index.getElement(this); }
57
57
  static get watchers() { return {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-e6d728ec.js');
6
6
 
7
- const curaDropdownSearchCss = ":host{display:block;width:100%;box-sizing:border-box}.dropdown{display:flex;position:relative;flex-direction:column;width:inherit}.dropdown .dropdown-search-list{z-index:1000}.dropdown-input-search{width:100%;display:flex;justify-content:center;align-items:center;background:transparent}.dropdown-input-search.dropdown-open ::part(cura-input-field){border-radius:4px 4px 0px 0px}.dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:none}.dropdown-input-search.dropdown-open cura-input-text ::slotted([slot=helperText]){display:none}.dropdown-search-list{position:absolute;top:calc(100% - 8px);width:100%;max-height:var(--dropdown-max-height);padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));border-radius:0px 0px 4px 4px;border-top:0 var(--neutral-light);border-right:2px solid var(--neutral-light);border-bottom:2px solid var(--neutral-light);border-left:2px solid var(--neutral-light);background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;display:none}.dropdown-search-list.visible{display:block}.dropdown-search-list-input-search{width:inherit;display:flex;justify-content:center;align-items:center;padding:16px 8px;border-bottom:2px solid var(--info-base);background-color:var(--neutral-purewhite)}.dropdown-search-list-input-search cura-input-text{width:inherit}.dropdown-search-list-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile{position:fixed;top:1%;left:0;right:0;width:100%;z-index:10000}.dropdown-mobile .dropdown-input-search{display:flex;gap:4px;padding:12px 8px;background-color:var(--neutral-purewhite);border-bottom:2px solid var(--info-base);z-index:10000}.dropdown-mobile .dropdown-input-search cura-button-transparent{display:flex}.dropdown-mobile .dropdown-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile .dropdown-input-search.dropdown-open{display:flex}.dropdown-mobile .dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:block}.dropdown-mobile .dropdown-search-list{position:static;width:100%;height:100%;max-height:none;padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:none;border:none;background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;z-index:10000}";
7
+ const curaDropdownSearchCss = ":host{display:block;width:100%;box-sizing:border-box}.dropdown{display:flex;position:relative;flex-direction:column;width:inherit}.dropdown .dropdown-search-list{z-index:1000}.dropdown-input-search{width:100%;display:flex;justify-content:center;align-items:center;background:transparent}.dropdown-input-search.dropdown-open ::part(cura-input-field){border-radius:4px 4px 0px 0px}.dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:none}.dropdown-input-search.dropdown-open cura-input-text ::slotted([slot=helperText]){display:none}.dropdown-search-list{position:absolute;top:calc(100% - 8px);width:100%;max-height:var(--dropdown-max-height);padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));border-radius:0px 0px 4px 4px;border-top:0 var(--neutral-light);border-right:2px solid var(--neutral-light);border-bottom:2px solid var(--neutral-light);border-left:2px solid var(--neutral-light);background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;display:none}.dropdown-search-list.visible{display:block}.dropdown-search-list-input-search{width:inherit;display:flex;justify-content:center;align-items:center;padding:16px 8px;border-bottom:2px solid var(--info-base);background-color:var(--neutral-purewhite)}.dropdown-search-list-input-search cura-input-text{width:inherit}.dropdown-search-list-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile{position:fixed;top:1%;left:0;right:0;width:100%;z-index:10000}.dropdown-mobile .dropdown-input-search{display:flex;gap:4px;padding:12px 8px;background-color:var(--neutral-purewhite);border-bottom:2px solid var(--info-base);z-index:10000}.dropdown-mobile .dropdown-input-search cura-button-transparent{display:flex}.dropdown-mobile .dropdown-input-search.error{background-color:var(--error-lighter);border-bottom:2px solid var(--error-dark)}.dropdown-mobile .dropdown-input-search.dropdown-open{display:flex}.dropdown-mobile .dropdown-input-search.dropdown-open ::slotted([slot=helperText]){display:block}.dropdown-mobile .dropdown-search-list{position:static;width:100%;height:calc(100vh - var(--dynamic-input-search-height, 0));max-height:none;padding:12px 12px;margin:0;box-sizing:border-box;box-shadow:none;border:none;background-color:var(--neutral-purewhite);list-style:none;overflow-y:auto;z-index:10000}";
8
8
  const CuraDropdownSearchStyle0 = curaDropdownSearchCss;
9
9
 
10
10
  const CuraDropdownSearch = class {
@@ -18,18 +18,20 @@ const CuraDropdownSearch = class {
18
18
  var _a;
19
19
  const isKeyboardOpen = window.innerHeight < window.screen.height * 0.8;
20
20
  const dropdown = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.dropdown-mobile');
21
- if (isKeyboardOpen) {
22
- dropdown.style.position = 'absolute';
23
- dropdown.style.bottom = `${window.screen.height - window.innerHeight}px`;
24
- }
25
- else {
26
- dropdown.style.position = 'fixed';
27
- dropdown.style.bottom = '0';
21
+ if (dropdown) {
22
+ if (isKeyboardOpen) {
23
+ dropdown.style.position = 'absolute';
24
+ dropdown.style.bottom = `${window.screen.height - window.innerHeight}px`;
25
+ }
26
+ else {
27
+ dropdown.style.position = 'fixed';
28
+ dropdown.style.bottom = '0';
29
+ }
28
30
  }
29
31
  window.scroll({
30
32
  top: 0,
31
33
  left: 0,
32
- behavior: "smooth",
34
+ behavior: 'smooth',
33
35
  });
34
36
  });
35
37
  };
@@ -117,6 +119,7 @@ const CuraDropdownSearch = class {
117
119
  componentDidRender() {
118
120
  if (this.isDropdownOpen && this.isMobile) {
119
121
  this.showOverlay();
122
+ this.getDropdownSearchListHeight();
120
123
  }
121
124
  else {
122
125
  this.removeOverlay();
@@ -236,11 +239,18 @@ const CuraDropdownSearch = class {
236
239
  handleOnFocus() {
237
240
  this.isDropdownOpen = true;
238
241
  }
242
+ getDropdownSearchListHeight() {
243
+ var _a;
244
+ const dropdownInputSearchElement = (_a = this.host.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('.dropdown-input-search');
245
+ if (dropdownInputSearchElement) {
246
+ this.host.style.setProperty('--dynamic-input-search-height', `${dropdownInputSearchElement.offsetHeight}px`);
247
+ }
248
+ }
239
249
  render() {
240
250
  const isMobileDropdown = this.isMobile && this.isDropdownOpen;
241
- return (index.h(index.Host, { key: 'a4defbdfabd6cff5db81d35b43580009256abfa8', style: this.hostCSSProperties(), class: "dropdown-overlay" }, index.h("div", { key: '0c8db33b0fb93ef7ccb234ea6b61bd63851d4460', class: `dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`, style: this.styles }, index.h("div", { key: '47430e63175189b9969f83254b1e92c40f7e0063', class: this.getClasses() }, this.isMobile && this.isDropdownOpen && (index.h("cura-button-transparent", { key: '932450ba13c8b47ea20fb83e963073243a7f71b7', fontColor: "dark", onClick: () => (this.isMobile = false), iconName: "arrowLeft", size: "medium", iconOnly: true, color: "primary" })), index.h("cura-input-text", { key: 'af9b7356b90d30a16b142a9249072867b4b79182', disabled: this.disabled, label: this.label, part: "cura-input-field", mode: isMobileDropdown ? 'transparent' : 'default', required: this.required, hideErrorIcon: this.status === 'error', iconName: this.iconName || 'search', value: this.value, status: this.status, onValueChange: e => this.onValueChange(e.target.value), onInput: e => this.handleInputChange(e), onFocus: () => this.handleOnFocus(), onClick: () => (window.innerWidth < 768 ? (this.isMobile = true) : null), onBlur: () => {
251
+ return (index.h(index.Host, { key: '36a0df3dfbe9f164ccb41541fb5373b0e94c86bd', style: this.hostCSSProperties(), class: "dropdown-overlay" }, index.h("div", { key: 'e17cf1eec89b0346f49f497ffc6e5ea272fcd3eb', class: `dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`, style: this.styles }, index.h("div", { key: 'eb33cc0c6abd4792cb18a4e55eaed913e4f75761', class: this.getClasses() }, this.isMobile && this.isDropdownOpen && (index.h("cura-button-transparent", { key: 'd837a3a15a89a9bd14260a32e3e218a3f53a18b1', fontColor: "dark", onClick: () => (this.isMobile = false), iconName: "arrowLeft", size: "medium", iconOnly: true, color: "primary" })), index.h("cura-input-text", { key: 'c8a02959ee1d637fde64fbcd8be238b7562f0790', disabled: this.disabled, label: this.label, part: "cura-input-field", mode: isMobileDropdown ? 'transparent' : 'default', required: this.required, hideErrorIcon: this.status === 'error', iconName: this.iconName || 'search', value: this.value, status: this.status, onValueChange: e => this.onValueChange(e.target.value), onInput: e => this.handleInputChange(e), onFocus: () => this.handleOnFocus(), onClick: () => (window.innerWidth < 768 ? (this.isMobile = true) : null), onBlur: () => {
242
252
  this.handleOnBlur();
243
- }, placeholder: this.placeholder, size: this.size, onKeyDown: this.handleKeyDown }, index.h("slot", { key: '87db405a858148aee63f7338ebcde28afc64c768', name: "helperText" }))), index.h("div", { key: '90f39c78512853a0c430f5947705b494093ba8e3', id: "dropdown-search-list", class: this.getDropdownClasses() }, index.h("slot", { key: 'decb45f75adfd4af1f1102778c39d8f4e4a94bfa', name: "dropdown-search-option", onSlotchange: this.handleSlotChange })))));
253
+ }, placeholder: this.placeholder, size: this.size, onKeyDown: this.handleKeyDown }, index.h("slot", { key: '9cc22d4cf269fee171456169b787be54a814189e', name: "helperText" }))), index.h("div", { key: '4a9ce1710312984d2af67ac3a04df504183caaf6', id: "dropdown-search-list", class: this.getDropdownClasses() }, index.h("slot", { key: 'afdeb4b938c3d6767e440f4b32316c45b2a5e86f', name: "dropdown-search-option", onSlotchange: this.handleSlotChange })))));
244
254
  }
245
255
  get host() { return index.getElement(this); }
246
256
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"cura-dropdown-search.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,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AM,EACnB,aAAa,EAAE,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAe,CAAC,EAChE,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACvC,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,EACnC,OAAO,EAAE,OAAO,MAAM,CAAC,UAAU,GAAG,GAAG,IAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,IAAI,CAAC,EACxE,MAAM,EAAE;gBACN,IAAI,CAAC,YAAY,EAAE,CAAC;aACrB,EACD,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,aAAa,IAE7BA,mEAAM,IAAI,EAAC,YAAY,GAAQ,CACf,CACd,EACNA,kEAAK,EAAE,EAAC,sBAAsB,EAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAC7DA,mEAAM,IAAI,EAAC,wBAAwB,EAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAS,CAC5E,CACF,CACD,EACP;KACH;;;;;;;;;;","names":["h","Host"],"sources":["src/components/forms/cura-dropdown-search/cura-dropdown-search.scss?tag=cura-dropdown-search&encapsulation=shadow","src/components/forms/cura-dropdown-search/cura-dropdown-search.tsx"],"sourcesContent":["@import '../../../scss/mixins/shadows.scss';\n\n:host {\n display: block;\n width: 100%;\n box-sizing: border-box;\n}\n\n.dropdown {\n display: flex;\n position: relative;\n\n flex-direction: column;\n width: inherit;\n\n .dropdown-search-list {\n z-index: 1000;\n }\n\n &-input-search {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background: transparent;\n\n\n &.dropdown-open {\n ::part(cura-input-field) {\n border-radius: 4px 4px 0px 0px;\n }\n ::slotted([slot='helperText']) {\n display: none;\n }\n\n cura-input-text {\n ::slotted([slot='helperText']) {\n display: none;\n }\n }\n }\n }\n\n &-search-list {\n position: absolute;\n top: calc(100% - 8px);\n width: 100%;\n max-height: var(--dropdown-max-height);\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n @include shadow-level3(--neutral-black-shadow);\n border-radius: 0px 0px 4px 4px;\n border-top: 0 var(--neutral-light);\n border-right: 2px solid var(--neutral-light);\n border-bottom: 2px solid var(--neutral-light);\n border-left: 2px solid var(--neutral-light);\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n display: none;\n\n &.visible {\n display: block;\n }\n\n &-input-search {\n width: inherit;\n\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px 8px;\n border-bottom: 2px solid var(--info-base);\n background-color: var(--neutral-purewhite);\n\n cura-input-text {\n width: inherit;\n }\n\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n }\n }\n\n &-mobile {\n position: fixed;\n top: 1%;\n left: 0;\n right: 0;\n width: 100%;\n\n z-index: 10000;\n .dropdown-input-search {\n display: flex;\n gap: 4px;\n padding: 12px 8px;\n background-color: var(--neutral-purewhite);\n border-bottom: 2px solid var(--info-base);\n z-index: 10000;\n cura-button-transparent {\n display: flex;\n }\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n &.dropdown-open {\n display: flex;\n\n ::slotted([slot='helperText']) {\n display: block;\n }\n }\n }\n .dropdown-search-list {\n position: static;\n width: 100%;\n height: 100%;\n max-height: none;\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n box-shadow: none;\n border: none;\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n z-index: 10000;\n }\n }\n}\n","import { Component, Host, Prop, State, Event, EventEmitter, Element, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search',\n styleUrl: 'cura-dropdown-search.scss',\n shadow: true,\n})\nexport class CuraDropdownSearch {\n /**\n * Size of the dropdown search mode default: 'small', 'medium', or 'large' (default: 'large')\n */\n @Prop({ reflect: true, mutable: true }) size: 'small' | 'medium' | 'large' = 'large';\n\n /**\n * Define the status of the dropdown search.\n */\n @Prop({ reflect: true }) status: 'error' | 'default' = 'default';\n\n /**\n * Whether the select component is disabled.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The name of the dropdown search component.\n */\n @Prop({ reflect: true }) name: string;\n\n /**\n * Indicates if the dropdown search is required.\n */\n @Prop({ reflect: true, mutable: true }) required: boolean = false;\n\n /**\n * Indicates if the dropdown search is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * The value of the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n /**\n * The placeholder text for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) placeholder: string = '';\n\n /**\n * The label for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) label: string = '';\n\n /**\n * Custom icon name. Default: search.\n */\n @Prop({ reflect: true }) iconName = 'search';\n\n /**\n * CSS max-height property for dropdown item.\n * Default to 630px\n */\n @Prop({ reflect: true }) dropdownMaxHeight = '630px';\n\n /**\n * Reference to the host element.\n */\n @Element() host: HTMLElement;\n\n /**\n * Indicates if the overlay is visible.\n */\n @State() overlayVisible: boolean = false;\n\n /**\n * Event emitted when the value changes.\n */\n @Event() valueChanged: EventEmitter<string>;\n\n /**\n * Indicates if the dropdown is open.\n */\n @State() isDropdownOpen: boolean = false;\n\n /**\n * Styles for the component.\n\n */\n @State() styles = {};\n\n /**\n * Indicates if the component is being viewed on a mobile device.\n */\n @State() isMobile: boolean = window.innerWidth < 768;\n\n /**\n * The mode of the dropdown search.\n */\n @State() mode: 'default' | 'transparent' = 'default';\n\n @Event() onselect: EventEmitter;\n\n @State() inputTextRef!: HTMLCuraInputTextElement;\n\n /**\n * Indicates if the input is on blur.\n */\n @State() isOnBlurInput: boolean = true;\n\n /**\n * The index of the currently hovered option.\n */\n @State() hoveredIndex: number = -1;\n\n /**\n * The options for the dropdown search.\n * @type {HTMLCuraDropdownSearchOptionElement[]}\n */\n\n weights;\n\n private overlayElement: HTMLDivElement | null = null;\n\n @State() options: HTMLCuraDropdownSearchOptionElement[] = [];\n\n\n private adjustInputPosition = () => {\n window.visualViewport.addEventListener('resize', () => {\n\n const isKeyboardOpen = window.innerHeight < window.screen.height * 0.8;\n const dropdown = this.host.shadowRoot?.querySelector('.dropdown-mobile') as HTMLInputElement;\n\n if (isKeyboardOpen) {\n dropdown.style.position = 'absolute';\n dropdown.style.bottom = `${window.screen.height - window.innerHeight}px`;\n } else {\n dropdown.style.position = 'fixed';\n dropdown.style.bottom = '0';\n }\n\n window.scroll({\n top: 0,\n left: 0,\n behavior: \"smooth\",\n });\n });\n };\n\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--info-base'] = window.CuraAPI.theme.colors.getColor('info-base');\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor('neutral-purewhite');\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor('neutral-light');\n this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor('neutral-dark');\n this.styles['--neutral-black-shadow'] = window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16);\n this.styles['--error-dark'] = window.CuraAPI.theme.colors.getColor('error-dark');\n this.styles['--error-lighter'] = window.CuraAPI.theme.colors.getColor('error-lighter');\n this.styles['--breakpoints'] = window.CuraAPI.theme.breakpoints.get();\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n\n\n }\n\n @Watch('value')\n onValueChange(newValue: string) {\n this.updateSelectedOption(newValue);\n this.valueChanged.emit(newValue);\n }\n\n componentWillLoad() {\n this.updateSelectedOption(this.value);\n }\n\n componentDidRender() {\n if (this.isDropdownOpen && this.isMobile) {\n this.showOverlay();\n } else {\n this.removeOverlay();\n }\n }\n componentDidLoad() {\n window.addEventListener('resize', this.handleResize);\n window.addEventListener('resize', this.adjustInputPosition);\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n window.removeEventListener('resize', this.adjustInputPosition);\n\n }\n\n private showOverlay() {\n if (!this.overlayElement) {\n this.overlayElement = document.createElement('div');\n this.overlayElement.className = 'dropdown-overlay';\n this.overlayElement.style.position = 'fixed';\n this.overlayElement.style.top = '0';\n this.overlayElement.style.left = '0';\n this.overlayElement.style.width = '100%';\n this.overlayElement.style.height = '100%';\n this.overlayElement.style.zIndex = '9999';\n this.overlayElement.style.backgroundColor = 'white';\n document.body.appendChild(this.overlayElement);\n }\n }\n\n private removeOverlay() {\n if (this.overlayElement && this.overlayElement.parentNode === document.body) {\n document.body.removeChild(this.overlayElement);\n this.overlayElement = null;\n }\n }\n\n private handleSlotChange = () => {\n this.options = Array.from(this.host.querySelectorAll('cura-dropdown-search-option'));\n this.addClickListenersToOptions();\n this.updateHoveredIndex();\n };\n\n private addClickListenersToOptions() {\n this.options.forEach((option, index) => {\n option.addEventListener('optionSelected', () => this.onSelectedOption(index));\n });\n }\n\n private updateSelectedOption(value: string) {\n const selectedOptionIndex = this.options.findIndex(option => option.getAttribute('value') === value);\n this.hoveredIndex = selectedOptionIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.updateOptionAttribute('selected', this.hoveredIndex);\n\n this.scrollIntoView();\n this.adjustInputPosition();\n\n }\n\n private handleInputChange = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.value = input.value;\n this.onValueChange(this.value);\n // this.valueChanged.emit(this.value);\n };\n\n private onSelectedOption(index: number) {\n const selectedOption = this.options[index];\n if (selectedOption.selectable) {\n const selectedValue = selectedOption.getAttribute('value') || selectedOption.textContent;\n\n this.value = selectedValue || '';\n this.updateSelectedOption(this.value);\n\n this.isDropdownOpen = false;\n this.isOnBlurInput = true;\n this.removeOverlay();\n }\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.moveHighlight(1);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.moveHighlight(-1);\n } else if (event.key === 'Enter') {\n event.preventDefault();\n if (this.hoveredIndex > -1) {\n this.handleOnBlur();\n this.onSelectedOption(this.hoveredIndex);\n }\n }\n };\n\n private moveHighlight(direction: number) {\n const visibleOptions = this.options;\n const newIndex = (this.hoveredIndex + direction + visibleOptions.length) % visibleOptions.length;\n this.hoveredIndex = newIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.scrollIntoView();\n }\n\n private updateOptionAttribute(attribute: string, indexToUpdate: number) {\n this.options.forEach((option, index) => {\n (option as any)[attribute] = index === indexToUpdate;\n });\n }\n\n private updateHoveredIndex() {\n const visibleOptions = this.options;\n const currentValue = this.value;\n this.hoveredIndex = visibleOptions.findIndex(option => option.getAttribute('value') === currentValue);\n }\n\n private scrollIntoView() {\n const container = this.host.shadowRoot?.querySelector('.dropdown-search-list');\n const hoveredOption = this.options[this.hoveredIndex];\n\n if (container && hoveredOption) {\n const optionRect = hoveredOption.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n\n if (optionRect.bottom > containerRect.bottom) {\n container.scrollTop += optionRect.bottom - containerRect.bottom;\n }\n\n if (optionRect.top < containerRect.top) {\n container.scrollTop -= containerRect.top - optionRect.top;\n }\n }\n }\n\n private handleResize = () => {\n this.isMobile = window.innerWidth < 768;\n if (this.isDropdownOpen) {\n if (this.isMobile) {\n this.showOverlay();\n } else {\n this.removeOverlay();\n }\n }\n };\n\n handleOnBlur() {\n if (this.isOnBlurInput === true) {\n setTimeout(() => {\n this.isDropdownOpen = false;\n this.removeOverlay();\n }, 200);\n }\n }\n getClasses() {\n return {\n 'dropdown-input-search': true,\n 'dropdown-open': this.isDropdownOpen,\n 'disabled': this.disabled,\n [this.status]: true,\n };\n }\n\n getDropdownClasses() {\n return {\n 'dropdown-search-list': true,\n 'visible': this.options.length && this.isDropdownOpen ? true : false,\n };\n }\n\n hostCSSProperties() {\n return {\n '--dropdown-max-height': this.dropdownMaxHeight,\n };\n }\n\n handleOnFocus() {\n this.isDropdownOpen = true;\n }\n\n\n render() {\n const isMobileDropdown = this.isMobile && this.isDropdownOpen;\n return (\n <Host style={this.hostCSSProperties()} class=\"dropdown-overlay\">\n <div class={`dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`} style={this.styles}>\n <div class={this.getClasses()}>\n {this.isMobile && this.isDropdownOpen && (\n <cura-button-transparent\n fontColor=\"dark\"\n onClick={() => (this.isMobile = false)}\n iconName=\"arrowLeft\"\n size=\"medium\"\n iconOnly\n color=\"primary\"\n ></cura-button-transparent>\n )}\n <cura-input-text\n disabled={this.disabled}\n label={this.label}\n part=\"cura-input-field\"\n mode={isMobileDropdown ? 'transparent' : 'default'}\n required={this.required}\n hideErrorIcon={this.status === 'error'}\n iconName={this.iconName || 'search'}\n value={this.value}\n status={this.status}\n onValueChange={e => this.onValueChange(e.target.value as string)}\n onInput={e => this.handleInputChange(e)}\n onFocus={() => this.handleOnFocus()}\n onClick={() => (window.innerWidth < 768 ? (this.isMobile = true) : null)}\n onBlur={() => {\n this.handleOnBlur();\n }}\n placeholder={this.placeholder}\n size={this.size}\n onKeyDown={this.handleKeyDown}\n >\n <slot name=\"helperText\"></slot>\n </cura-input-text>\n </div>\n <div id=\"dropdown-search-list\" class={this.getDropdownClasses()}>\n <slot name=\"dropdown-search-option\" onSlotchange={this.handleSlotChange}></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cura-dropdown-search.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,qBAAqB,GAAG,q4EAAq4E,CAAC;AACp6E,iCAAe,qBAAqB;;MCMvB,kBAAkB;;;;;QAmHrB,mBAAc,GAA0B,IAAI,CAAC;QAI7C,wBAAmB,GAAG;YAC5B,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,QAAQ,EAAE;;gBAC/C,MAAM,cAAc,GAAG,MA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C,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ,EACnC,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,aAAa,EAAE,CAAC,IAAI,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAe,CAAC,EAChE,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACvC,OAAO,EAAE,MAAM,IAAI,CAAC,aAAa,EAAE,EACnC,OAAO,EAAE,OAAO,MAAM,CAAC,UAAU,GAAG,GAAG,IAAI,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,IAAI,CAAC,EACxE,MAAM,EAAE;gBACN,IAAI,CAAC,YAAY,EAAE,CAAC;aACrB,EACD,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,aAAa,IAE7BA,mEAAM,IAAI,EAAC,YAAY,GAAQ,CACf,CACd,EACNA,kEAAK,EAAE,EAAC,sBAAsB,EAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAC7DA,mEAAM,IAAI,EAAC,wBAAwB,EAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAS,CAC5E,CACF,CACD,EACP;KACH;;;;;;;;;;","names":["h","Host"],"sources":["src/components/forms/cura-dropdown-search/cura-dropdown-search.scss?tag=cura-dropdown-search&encapsulation=shadow","src/components/forms/cura-dropdown-search/cura-dropdown-search.tsx"],"sourcesContent":["@import '../../../scss/mixins/shadows.scss';\n\n:host {\n display: block;\n width: 100%;\n box-sizing: border-box;\n}\n\n.dropdown {\n display: flex;\n position: relative;\n\n flex-direction: column;\n width: inherit;\n\n .dropdown-search-list {\n z-index: 1000;\n }\n\n &-input-search {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n background: transparent;\n\n\n &.dropdown-open {\n ::part(cura-input-field) {\n border-radius: 4px 4px 0px 0px;\n }\n ::slotted([slot='helperText']) {\n display: none;\n }\n\n cura-input-text {\n ::slotted([slot='helperText']) {\n display: none;\n }\n }\n }\n }\n\n &-search-list {\n position: absolute;\n top: calc(100% - 8px);\n width: 100%;\n max-height: var(--dropdown-max-height);\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n @include shadow-level3(--neutral-black-shadow);\n border-radius: 0px 0px 4px 4px;\n border-top: 0 var(--neutral-light);\n border-right: 2px solid var(--neutral-light);\n border-bottom: 2px solid var(--neutral-light);\n border-left: 2px solid var(--neutral-light);\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n display: none;\n\n &.visible {\n display: block;\n }\n\n &-input-search {\n width: inherit;\n\n display: flex;\n justify-content: center;\n align-items: center;\n padding: 16px 8px;\n border-bottom: 2px solid var(--info-base);\n background-color: var(--neutral-purewhite);\n\n cura-input-text {\n width: inherit;\n }\n\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n }\n }\n\n &-mobile {\n position: fixed;\n top: 1%;\n left: 0;\n right: 0;\n width: 100%;\n\n z-index: 10000;\n .dropdown-input-search {\n display: flex;\n gap: 4px;\n padding: 12px 8px;\n background-color: var(--neutral-purewhite);\n border-bottom: 2px solid var(--info-base);\n z-index: 10000;\n cura-button-transparent {\n display: flex;\n }\n &.error {\n background-color: var(--error-lighter);\n border-bottom: 2px solid var(--error-dark);\n }\n &.dropdown-open {\n display: flex;\n\n ::slotted([slot='helperText']) {\n display: block;\n }\n }\n }\n .dropdown-search-list {\n position: static;\n width: 100%;\n height: calc(100vh - var(--dynamic-input-search-height, 0));\n max-height: none;\n padding: 12px 12px;\n margin: 0;\n box-sizing: border-box;\n box-shadow: none;\n border: none;\n background-color: var(--neutral-purewhite);\n list-style: none;\n overflow-y: auto;\n z-index: 10000;\n }\n }\n}\n","import { Component, Host, Prop, State, Event, EventEmitter, Element, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search',\n styleUrl: 'cura-dropdown-search.scss',\n shadow: true,\n})\nexport class CuraDropdownSearch {\n /**\n * Size of the dropdown search mode default: 'small', 'medium', or 'large' (default: 'large')\n */\n @Prop({ reflect: true, mutable: true }) size: 'small' | 'medium' | 'large' = 'large';\n\n /**\n * Define the status of the dropdown search.\n */\n @Prop({ reflect: true }) status: 'error' | 'default' = 'default';\n\n /**\n * Whether the select component is disabled.\n * Reflects as an attribute in the DOM.\n */\n @Prop({ reflect: true }) disabled: boolean = false;\n\n /**\n * The name of the dropdown search component.\n */\n @Prop({ reflect: true }) name: string;\n\n /**\n * Indicates if the dropdown search is required.\n */\n @Prop({ reflect: true, mutable: true }) required: boolean = false;\n\n /**\n * Indicates if the dropdown search is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * The value of the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) value: string = '';\n\n /**\n * The placeholder text for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) placeholder: string = '';\n\n /**\n * The label for the dropdown search.\n */\n @Prop({ reflect: true, mutable: true }) label: string = '';\n\n /**\n * Custom icon name. Default: search.\n */\n @Prop({ reflect: true }) iconName = 'search';\n\n /**\n * CSS max-height property for dropdown item.\n * Default to 630px\n */\n @Prop({ reflect: true }) dropdownMaxHeight = '630px';\n\n /**\n * Reference to the host element.\n */\n @Element() host: HTMLElement;\n\n /**\n * Indicates if the overlay is visible.\n */\n @State() overlayVisible: boolean = false;\n\n /**\n * Event emitted when the value changes.\n */\n @Event() valueChanged: EventEmitter<string>;\n\n /**\n * Indicates if the dropdown is open.\n */\n @State() isDropdownOpen: boolean = false;\n\n /**\n * Styles for the component.\n\n */\n @State() styles = {};\n\n /**\n * Indicates if the component is being viewed on a mobile device.\n */\n @State() isMobile: boolean = window.innerWidth < 768;\n\n /**\n * The mode of the dropdown search.\n */\n @State() mode: 'default' | 'transparent' = 'default';\n\n @Event() onselect: EventEmitter;\n\n @State() inputTextRef!: HTMLCuraInputTextElement;\n\n /**\n * Indicates if the input is on blur.\n */\n @State() isOnBlurInput: boolean = true;\n\n /**\n * The index of the currently hovered option.\n */\n @State() hoveredIndex: number = -1;\n\n /**\n * The options for the dropdown search.\n * @type {HTMLCuraDropdownSearchOptionElement[]}\n */\n\n weights;\n\n private overlayElement: HTMLDivElement | null = null;\n\n @State() options: HTMLCuraDropdownSearchOptionElement[] = [];\n\n private adjustInputPosition = () => {\n window.visualViewport.addEventListener('resize', () => {\n const isKeyboardOpen = window.innerHeight < window.screen.height * 0.8;\n const dropdown = this.host.shadowRoot?.querySelector('.dropdown-mobile') as HTMLInputElement;\n\n if (dropdown) {\n if (isKeyboardOpen) {\n dropdown.style.position = 'absolute';\n dropdown.style.bottom = `${window.screen.height - window.innerHeight}px`;\n } else {\n dropdown.style.position = 'fixed';\n dropdown.style.bottom = '0';\n }\n }\n\n window.scroll({\n top: 0,\n left: 0,\n behavior: 'smooth',\n });\n });\n };\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--info-base'] = window.CuraAPI.theme.colors.getColor('info-base');\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor('neutral-purewhite');\n this.styles['--neutral-light'] = window.CuraAPI.theme.colors.getColor('neutral-light');\n this.styles['--neutral-dark'] = window.CuraAPI.theme.colors.getColor('neutral-dark');\n this.styles['--neutral-black-shadow'] = window.CuraAPI.theme.colors.getColor(`neutral-black`, 0.16);\n this.styles['--error-dark'] = window.CuraAPI.theme.colors.getColor('error-dark');\n this.styles['--error-lighter'] = window.CuraAPI.theme.colors.getColor('error-lighter');\n this.styles['--breakpoints'] = window.CuraAPI.theme.breakpoints.get();\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-medium'] = this.weights.medium;\n }\n\n @Watch('value')\n onValueChange(newValue: string) {\n this.updateSelectedOption(newValue);\n this.valueChanged.emit(newValue);\n }\n\n componentWillLoad() {\n this.updateSelectedOption(this.value);\n }\n\n componentDidRender() {\n if (this.isDropdownOpen && this.isMobile) {\n this.showOverlay();\n this.getDropdownSearchListHeight();\n } else {\n this.removeOverlay();\n }\n }\n componentDidLoad() {\n window.addEventListener('resize', this.handleResize);\n window.addEventListener('resize', this.adjustInputPosition);\n }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\n window.removeEventListener('resize', this.adjustInputPosition);\n }\n\n private showOverlay() {\n if (!this.overlayElement) {\n this.overlayElement = document.createElement('div');\n this.overlayElement.className = 'dropdown-overlay';\n this.overlayElement.style.position = 'fixed';\n this.overlayElement.style.top = '0';\n this.overlayElement.style.left = '0';\n this.overlayElement.style.width = '100%';\n this.overlayElement.style.height = '100%';\n this.overlayElement.style.zIndex = '9999';\n this.overlayElement.style.backgroundColor = 'white';\n document.body.appendChild(this.overlayElement);\n }\n }\n\n private removeOverlay() {\n if (this.overlayElement && this.overlayElement.parentNode === document.body) {\n document.body.removeChild(this.overlayElement);\n this.overlayElement = null;\n }\n }\n\n private handleSlotChange = () => {\n this.options = Array.from(this.host.querySelectorAll('cura-dropdown-search-option'));\n this.addClickListenersToOptions();\n this.updateHoveredIndex();\n };\n\n private addClickListenersToOptions() {\n this.options.forEach((option, index) => {\n option.addEventListener('optionSelected', () => this.onSelectedOption(index));\n });\n }\n\n private updateSelectedOption(value: string) {\n const selectedOptionIndex = this.options.findIndex(option => option.getAttribute('value') === value);\n this.hoveredIndex = selectedOptionIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.updateOptionAttribute('selected', this.hoveredIndex);\n\n this.scrollIntoView();\n this.adjustInputPosition();\n }\n\n private handleInputChange = (event: Event) => {\n const input = event.target as HTMLInputElement;\n this.value = input.value;\n this.onValueChange(this.value);\n // this.valueChanged.emit(this.value);\n };\n\n private onSelectedOption(index: number) {\n const selectedOption = this.options[index];\n if (selectedOption.selectable) {\n const selectedValue = selectedOption.getAttribute('value') || selectedOption.textContent;\n\n this.value = selectedValue || '';\n this.updateSelectedOption(this.value);\n\n this.isDropdownOpen = false;\n this.isOnBlurInput = true;\n this.removeOverlay();\n }\n }\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.moveHighlight(1);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.moveHighlight(-1);\n } else if (event.key === 'Enter') {\n event.preventDefault();\n if (this.hoveredIndex > -1) {\n this.handleOnBlur();\n this.onSelectedOption(this.hoveredIndex);\n }\n }\n };\n\n private moveHighlight(direction: number) {\n const visibleOptions = this.options;\n const newIndex = (this.hoveredIndex + direction + visibleOptions.length) % visibleOptions.length;\n this.hoveredIndex = newIndex;\n this.updateOptionAttribute('hovered', this.hoveredIndex);\n this.scrollIntoView();\n }\n\n private updateOptionAttribute(attribute: string, indexToUpdate: number) {\n this.options.forEach((option, index) => {\n (option as any)[attribute] = index === indexToUpdate;\n });\n }\n\n private updateHoveredIndex() {\n const visibleOptions = this.options;\n const currentValue = this.value;\n this.hoveredIndex = visibleOptions.findIndex(option => option.getAttribute('value') === currentValue);\n }\n\n private scrollIntoView() {\n const container = this.host.shadowRoot?.querySelector('.dropdown-search-list');\n const hoveredOption = this.options[this.hoveredIndex];\n\n if (container && hoveredOption) {\n const optionRect = hoveredOption.getBoundingClientRect();\n const containerRect = container.getBoundingClientRect();\n\n if (optionRect.bottom > containerRect.bottom) {\n container.scrollTop += optionRect.bottom - containerRect.bottom;\n }\n\n if (optionRect.top < containerRect.top) {\n container.scrollTop -= containerRect.top - optionRect.top;\n }\n }\n }\n\n private handleResize = () => {\n this.isMobile = window.innerWidth < 768;\n if (this.isDropdownOpen) {\n if (this.isMobile) {\n this.showOverlay();\n } else {\n this.removeOverlay();\n }\n }\n };\n\n handleOnBlur() {\n if (this.isOnBlurInput === true) {\n setTimeout(() => {\n this.isDropdownOpen = false;\n this.removeOverlay();\n }, 200);\n }\n }\n getClasses() {\n return {\n 'dropdown-input-search': true,\n 'dropdown-open': this.isDropdownOpen,\n 'disabled': this.disabled,\n [this.status]: true,\n };\n }\n\n getDropdownClasses() {\n return {\n 'dropdown-search-list': true,\n 'visible': this.options.length && this.isDropdownOpen ? true : false,\n };\n }\n\n hostCSSProperties() {\n return {\n '--dropdown-max-height': this.dropdownMaxHeight,\n };\n }\n\n handleOnFocus() {\n this.isDropdownOpen = true;\n }\n\n getDropdownSearchListHeight() {\n const dropdownInputSearchElement = this.host.shadowRoot?.querySelector('.dropdown-input-search') as HTMLInputElement;\n if (dropdownInputSearchElement) {\n this.host.style.setProperty('--dynamic-input-search-height', `${dropdownInputSearchElement.offsetHeight}px`);\n }\n }\n\n render() {\n const isMobileDropdown = this.isMobile && this.isDropdownOpen;\n return (\n <Host style={this.hostCSSProperties()} class=\"dropdown-overlay\">\n <div class={`dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`} style={this.styles}>\n <div class={this.getClasses()}>\n {this.isMobile && this.isDropdownOpen && (\n <cura-button-transparent\n fontColor=\"dark\"\n onClick={() => (this.isMobile = false)}\n iconName=\"arrowLeft\"\n size=\"medium\"\n iconOnly\n color=\"primary\"\n ></cura-button-transparent>\n )}\n <cura-input-text\n disabled={this.disabled}\n label={this.label}\n part=\"cura-input-field\"\n mode={isMobileDropdown ? 'transparent' : 'default'}\n required={this.required}\n hideErrorIcon={this.status === 'error'}\n iconName={this.iconName || 'search'}\n value={this.value}\n status={this.status}\n onValueChange={e => this.onValueChange(e.target.value as string)}\n onInput={e => this.handleInputChange(e)}\n onFocus={() => this.handleOnFocus()}\n onClick={() => (window.innerWidth < 768 ? (this.isMobile = true) : null)}\n onBlur={() => {\n this.handleOnBlur();\n }}\n placeholder={this.placeholder}\n size={this.size}\n onKeyDown={this.handleKeyDown}\n >\n <slot name=\"helperText\"></slot>\n </cura-input-text>\n </div>\n <div id=\"dropdown-search-list\" class={this.getDropdownClasses()}>\n <slot name=\"dropdown-search-option\" onSlotchange={this.handleSlotChange}></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -24,9 +24,9 @@ const CuraIconsView = class {
24
24
  this.sizes.unshift(this.sizes.pop());
25
25
  }
26
26
  render() {
27
- return (index.h(index.Host, { key: '578795eda26d68314425907d7d4b0716eae31677' }, index.h("div", { key: '1cabf7e4ad314bbcb93d86c4ad22e5d8d69e2f81', class: "iconDetail" }, index.h("cura-heading", { key: '154ada215d4a13b674870c7b3ac85cb2b2c96873', size: "small", "margin-block": "0 24px" }, "Icon: ", index.h("b", { key: '84b323f4f81831142ccb51109a2bcbbe8748c8e9' }, this.selected)), index.h("div", { key: '71ee5a42938cc43014e4b306460ab03ed03a8d2d', class: "iconSizes" }, this.sizes.map(size => size === 'micro' && !curaIcon_definitions.microIcons.includes(this.selected) ? '' :
28
- index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size }), index.h("span", null, size)))), index.h("div", { key: 'f0ce668720e9897ea8abcd4c105fed555d0537dc', class: "iconSizes invert" }, this.sizes.map(size => size === 'micro' && !curaIcon_definitions.microIcons.includes(this.selected) ? '' :
29
- index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), index.h("span", null, size))))), index.h("div", { key: '2c2a0f8f18eff3da6b4379e9549683f4daf2755d', class: "icons" }, iconsetdefaulticons.map(icon => index.h("div", { class: { icon: true, selected: icon === this.selected }, onClick: () => this.setSelected(icon) }, index.h("cura-icon", { name: icon, size: "32", color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }), index.h("cura-label", { size: "xsmall", weight: icon === this.selected ? 'bold' : 'regular', color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }, icon), !curaIcon_definitions.microIcons.includes(icon) ? '' :
27
+ return (index.h(index.Host, { key: '8852f24d59f30c812ac2e05be38bba10bccb1fd8' }, index.h("div", { key: '6b88398ca80b05a62681d7b6834d5d0f59d790fa', class: "iconDetail" }, index.h("cura-heading", { key: '5b3cab1aa26adc1b1b09dc3f3f5c0bd2ac394f89', size: "small", "margin-block": "0 24px" }, "Icon: ", index.h("b", { key: 'eb974ce78dd33e56cd2c6118c6c399f029660547' }, this.selected)), index.h("div", { key: '46d600bbf0903861f5c982b0e73c4757447d0324', class: "iconSizes" }, this.sizes.map(size => size === 'micro' && !curaIcon_definitions.microIcons.includes(this.selected) ? '' :
28
+ index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size }), index.h("span", null, size)))), index.h("div", { key: '973355e41f1a10405c8224461625215aedabe0e3', class: "iconSizes invert" }, this.sizes.map(size => size === 'micro' && !curaIcon_definitions.microIcons.includes(this.selected) ? '' :
29
+ index.h("div", { class: "size" }, index.h("cura-icon", { name: this.selected, size: size, color: "neutral-white" }), index.h("span", null, size))))), index.h("div", { key: 'acd2b60eb99238893fc97aa177e96f43a3c54bd1', class: "icons" }, iconsetdefaulticons.map(icon => index.h("div", { class: { icon: true, selected: icon === this.selected }, onClick: () => this.setSelected(icon) }, index.h("cura-icon", { name: icon, size: "32", color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }), index.h("cura-label", { size: "xsmall", weight: icon === this.selected ? 'bold' : 'regular', color: icon === this.selected ? 'accent-dark' : 'neutral-dark' }, icon), !curaIcon_definitions.microIcons.includes(icon) ? '' :
30
30
  index.h("cura-paragraph", { color: 'success-dark', size: "xsmall", "margin-block": "0px", "line-height": '100%' }, "MICRO"))))));
31
31
  }
32
32
  };
@@ -5,13 +5,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-e6d728ec.js');
6
6
  const index$1 = require('./index-6dc29195.js');
7
7
 
8
- const curaInputDateCss = ":host{display:block}.container{display:flex;flex-direction:column}.container .calendar{padding:0px calc(var(--base-spacing) * 3px);margin-top:-8px;border-radius:0px 0px 4px 4px;border-top:0px;border-right:2px solid #D4D4D4;border-bottom:2px solid #D4D4D4;border-left:2px solid #D4D4D4;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16))}";
8
+ const curaInputDateCss = ":host{display:block}.container{display:flex;flex-direction:column;position:relative}.container .calendar{padding:0px calc(var(--base-spacing) * 3px);margin-top:-8px;border-radius:0px 0px 4px 4px;border-top:0px;border-right:2px solid #D4D4D4;border-bottom:2px solid #D4D4D4;border-left:2px solid #D4D4D4;box-shadow:0px 4px 8px 0px var(--neutral-black-shadow, rgba(38, 38, 38, 0.16));position:absolute;top:100%;z-index:10;display:none;opacity:0;pointer-events:none}.container .calendar.visible{box-sizing:border-box;display:block;opacity:1;pointer-events:auto;width:100%;background-color:#fff}";
9
9
  const CuraInputDateStyle0 = curaInputDateCss;
10
10
 
11
11
  const CuraInputDate = class {
12
12
  constructor(hostRef) {
13
13
  index.registerInstance(this, hostRef);
14
14
  this.dateChange = index.createEvent(this, "dateChange", 7);
15
+ this.statusInputChange = index.createEvent(this, "statusInputChange", 7);
15
16
  this.label = '';
16
17
  this.status = 'default';
17
18
  this.size = 'medium';
@@ -26,17 +27,28 @@ const CuraInputDate = class {
26
27
  this.isCalendarVisible = false;
27
28
  this.dates = [];
28
29
  this.value = '';
30
+ this.dateSettings = {
31
+ placeholder: null,
32
+ mask: 'date',
33
+ mode: 'single',
34
+ };
29
35
  }
30
36
  connectedCallback() {
31
- const weights = window.CuraAPI.theme.fonts.getWeights();
32
- this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();
33
- this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);
34
- this.styles['--neutral-lighter'] = window.CuraAPI.theme.colors.getColor(`neutral-lighter`);
35
- this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);
36
- this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();
37
- this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();
38
- this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();
39
- this.styles['--font-weight-regular'] = weights.regular;
37
+ const { fonts, colors, spacing } = window.CuraAPI.theme;
38
+ const weights = fonts.getWeights();
39
+ this.styles = {
40
+ '--base-spacing': spacing.getSpacing(),
41
+ '--neutral-purewhite': colors.getColor('neutral-purewhite'),
42
+ '--neutral-lighter': colors.getColor('neutral-lighter'),
43
+ '--neutral-base': colors.getColor('neutral-base'),
44
+ '--font-size': fonts.getSize(),
45
+ '--font-color': fonts.getColor(),
46
+ '--font-family': fonts.getFamily(),
47
+ '--font-weight-regular': weights.regular,
48
+ };
49
+ }
50
+ componentWillLoad() {
51
+ this.updateDateSettings();
40
52
  }
41
53
  /**
42
54
  * Callback for form association
@@ -44,33 +56,21 @@ const CuraInputDate = class {
44
56
  formAssociatedCallback(form) {
45
57
  form.ariaLabel = this.label;
46
58
  }
47
- /**
48
- * Formats the placeholder based on the enableRangeDates flag
49
- *
50
- * @returns {string} A string representing the placeholder format,
51
- * either for a date range ('dd/mm/yyyy - dd/mm/yyyy') or a single date ('dd/mm/yyyy')
52
- */
53
- setPlaceholder() {
54
- if (this.placeholder) {
55
- return this.placeholder;
59
+ updateDateSettings() {
60
+ const newSettings = this.getDateSettings(this.enableRangeDates);
61
+ if (this.shouldUpdateDateSettings(newSettings)) {
62
+ this.dateSettings = newSettings;
56
63
  }
57
- return this.enableRangeDates ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa';
58
64
  }
59
- /**
60
- * Sets the mask type based on the enableRangeDates flag
61
- *
62
- * @returns {string} The mask type, either 'dateRange' or 'date'
63
- */
64
- setMask() {
65
- return this.enableRangeDates ? 'dateRange' : 'date';
65
+ getDateSettings(isRange) {
66
+ return {
67
+ placeholder: this.placeholder || (isRange ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa'),
68
+ mask: isRange ? 'dateRange' : 'date',
69
+ mode: isRange ? 'range' : 'single',
70
+ };
66
71
  }
67
- /**
68
- * Sets the mode type based on the enableRangeDates flag
69
- *
70
- * @returns {'range' | 'single'}
71
- */
72
- setMode() {
73
- return this.enableRangeDates ? 'range' : 'single';
72
+ shouldUpdateDateSettings(newSettings) {
73
+ return this.dateSettings.placeholder !== newSettings.placeholder || this.dateSettings.mask !== newSettings.mask || this.dateSettings.mode !== newSettings.mode;
74
74
  }
75
75
  handleClick(ev) {
76
76
  if (this.el.contains(ev.target)) {
@@ -99,8 +99,7 @@ const CuraInputDate = class {
99
99
  this.dateChange.emit(this.value);
100
100
  }
101
101
  else {
102
- this.status = 'error';
103
- this.dates = [];
102
+ this.resetDates();
104
103
  }
105
104
  }
106
105
  else if (simpleDateRegex.test(inputValue)) {
@@ -113,8 +112,7 @@ const CuraInputDate = class {
113
112
  this.dateChange.emit(this.value);
114
113
  }
115
114
  else {
116
- this.status = 'error';
117
- this.dates = [];
115
+ this.resetDates();
118
116
  }
119
117
  }
120
118
  else {
@@ -127,6 +125,7 @@ const CuraInputDate = class {
127
125
  this.status = 'default';
128
126
  this.value = '';
129
127
  this.dateChange.emit(this.value);
128
+ this.statusInputChange.emit(this.status);
130
129
  }
131
130
  }
132
131
  isDateValid(date) {
@@ -148,9 +147,14 @@ const CuraInputDate = class {
148
147
  const year = date.getFullYear();
149
148
  return `${day}/${month}/${year}`;
150
149
  }
150
+ resetDates() {
151
+ this.status = 'error';
152
+ this.dates = [];
153
+ this.statusInputChange.emit(this.status);
154
+ }
151
155
  renderCalendarOrHelperText() {
152
156
  if (this.isCalendarVisible) {
153
- return (index.h("div", { class: "calendar" }, index.h("cura-calendar", { customDates: this.dates, mode: this.setMode(), width: "100%", embedded: false, floating: false, disableFutureDates: this.disableFutureDates, disablePassDates: this.disablePassDates, onOnchangeday: e => {
157
+ return (index.h("div", { class: "calendar visible" }, index.h("cura-calendar", { customDates: this.dates, mode: this.dateSettings.mode, width: "100%", maxWidth: "400px", embedded: false, floating: false, disableFutureDates: this.disableFutureDates, disablePassDates: this.disablePassDates, onOnchangeday: e => {
154
158
  const days = e.detail.days;
155
159
  if (days.length === 1) {
156
160
  this.value = this.parseDateToString(days[0]);
@@ -169,16 +173,12 @@ const CuraInputDate = class {
169
173
  }
170
174
  }
171
175
  render() {
172
- return (index.h(index.Host, { key: '8bf7141427b370ea271d2f589c26060111862f79' }, index.h("div", { key: '5c955bf76f93912512bbf18887db5305e6772faa', class: "container", style: this.styles }, index.h("cura-input-text", { key: 'a8c3ff65ca54123d0f7612f61e06e44275047961', label: this.label, name: this.name, status: this.status, value: this.value, onFocus: () => this.showCalendar(), size: this.size, iconName: this.iconName, placeholder: this.setPlaceholder(), "mask-preset": this.setMask(), "enable-selection-mode": true, onKeyUp: event => this.handleInputDates(event), autocomplete: "off", onValueChange: event => this.handleChangeDates(event) }, this.renderCalendarOrHelperText()))));
176
+ return (index.h(index.Host, { key: 'a85d8edd29146ca4068bb0fb5f718a5b6426638e' }, index.h("div", { key: '99a69b37f9370bdf242d0dc698f707f28cf0325a', class: "container", style: this.styles }, index.h("cura-input-text", { key: '5f5450f7390792c1188e17f48a9d04f4339fc156', label: this.label, name: this.name, status: this.status, value: this.value, onFocus: () => this.showCalendar(), size: this.size, "icon-name": this.iconName, placeholder: this.dateSettings.placeholder, "mask-preset": this.dateSettings.mask, "enable-selection-mode": true, onKeyUp: event => this.handleInputDates(event), autocomplete: "off", onValueChange: event => this.handleChangeDates(event) }, this.renderCalendarOrHelperText()))));
173
177
  }
174
178
  static get formAssociated() { return true; }
175
179
  get el() { return index.getElement(this); }
176
180
  static get watchers() { return {
177
- "enableRangeDates": ["setPlaceholder", "setMask", "setMode"],
178
- "disableFutureDates": ["isDateValid", "renderCalendarOrHelperText"],
179
- "disablePassDates": ["isDateValid"],
180
- "dates": ["renderCalendarOrHelperText"],
181
- "isCalendarVisible": ["renderCalendarOrHelperText"]
181
+ "enableRangeDates": ["updateDateSettings"]
182
182
  }; }
183
183
  };
184
184
  CuraInputDate.style = CuraInputDateStyle0;
@@ -1 +1 @@
1
- {"file":"cura-input-date.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,gBAAgB,GAAG,8WAA8W,CAAC;AACxY,4BAAe,gBAAgB;;MCSlB,aAAa;;;;qB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,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE,iBACrB,IAAI,CAAC,OAAO,EAAE,2BACJ,IAAI,EAC3B,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAC9C,YAAY,EAAC,KAAK,EAClB,aAAa,EAAE,KAAK,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAEpD,IAAI,CAAC,0BAA0B,EAAE,CAClB,CACd,CACD,EACP;KACH;;;;;;;;;;;;;;;","names":["isBefore","isAfter","h","Host"],"sources":["src/components/forms/cura-input-date/cura-input-date.scss?tag=cura-input-date&encapsulation=shadow","src/components/forms/cura-input-date/cura-input-date.tsx"],"sourcesContent":["@import '../../../../src/scss/mixins/shadows.scss';\n@import '../../../../src/scss/mixins/spacing.scss';\n\n:host {\n display: block;\n}\n\n.container{\n display: flex;\n flex-direction: column;\n\n .calendar{\n padding: #{$spacing-none} #{$spacing-xxxs};\n margin-top: -8px;\n border-radius: 0px 0px 4px 4px;\n border-top: 0px;\n border-right: 2px solid #D4D4D4;\n border-bottom:2px solid #D4D4D4;\n border-left: 2px solid #D4D4D4;\n @include shadow-level3(--neutral-black-shadow);\n }\n}\n","import { Component, Element, Host, Listen, Prop, State, Watch, h, Event, EventEmitter } from '@stencil/core';\nimport { CuraInputTextCustomEvent } from '../../../components';\nimport { isAfter, isBefore } from 'date-fns';\n\n@Component({\n tag: 'cura-input-date',\n styleUrl: 'cura-input-date.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraInputDate {\n @Element() el: HTMLElement;\n\n /**\n * Label text for the input date\n */\n @Prop({ reflect: true }) label?: string = '';\n\n /**\n * Indicates input status (default: default)\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n\n /**\n * Size of the input mode default: 'small', 'medium', or 'large' (default: 'medium')\n */\n @Prop({ reflect: true, mutable: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Name text for the input date\n */\n @Prop({ reflect: true }) name?: string = '';\n\n /**\n * Helper text displayed below the input\n */\n @Prop({ reflect: true, mutable: true }) helperText?: string;\n\n /**\n * Enables the date range selection mode, allowing users to select a period of dates\n */\n @Prop({ reflect: true, mutable: true }) enableRangeDates: boolean;\n\n /**\n * Controls whether future dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true, mutable: true }) disableFutureDates: boolean;\n\n /**\n * Controls whether past dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true, mutable: true }) disablePassDates: boolean;\n\n /**\n * Whether to display a cura icon (default: null)\n */\n @Prop({ reflect: true, mutable: true }) iconName?: string = '';\n\n /**\n * Placeholder text for the input\n */\n @Prop({ reflect: true }) placeholder?: string | null = null;\n\n /**\n * Emitted when the value of the input changes\n * @type {EventEmitter<string>}\n */\n @Event() dateChange: EventEmitter<string>;\n\n @State() styles = {};\n\n @State() isCalendarVisible: boolean = false;\n\n @State() dates: Date[] = [];\n\n @State() value?: string = '';\n\n connectedCallback() {\n const weights = window.CuraAPI.theme.fonts.getWeights();\n this.styles['--base-spacing'] = window.CuraAPI.theme.spacing.getSpacing();\n this.styles['--neutral-purewhite'] = window.CuraAPI.theme.colors.getColor(`neutral-purewhite`);\n this.styles['--neutral-lighter'] = window.CuraAPI.theme.colors.getColor(`neutral-lighter`);\n this.styles['--neutral-base'] = window.CuraAPI.theme.colors.getColor(`neutral-base`);\n this.styles['--font-size'] = window.CuraAPI.theme.fonts.getSize();\n this.styles['--font-color'] = window.CuraAPI.theme.fonts.getColor();\n this.styles['--font-family'] = window.CuraAPI.theme.fonts.getFamily();\n this.styles['--font-weight-regular'] = weights.regular;\n }\n\n /**\n * Callback for form association\n */\n formAssociatedCallback(form: { ariaLabel: string }) {\n form.ariaLabel = this.label;\n }\n\n /**\n * Formats the placeholder based on the enableRangeDates flag\n *\n * @returns {string} A string representing the placeholder format,\n * either for a date range ('dd/mm/yyyy - dd/mm/yyyy') or a single date ('dd/mm/yyyy')\n */\n @Watch('enableRangeDates')\n setPlaceholder(): string {\n if (this.placeholder) {\n return this.placeholder;\n }\n return this.enableRangeDates ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa';\n }\n\n /**\n * Sets the mask type based on the enableRangeDates flag\n *\n * @returns {string} The mask type, either 'dateRange' or 'date'\n */\n @Watch('enableRangeDates')\n setMask(): string {\n return this.enableRangeDates ? 'dateRange' : 'date';\n }\n\n /**\n * Sets the mode type based on the enableRangeDates flag\n *\n * @returns {'range' | 'single'}\n */\n @Watch('enableRangeDates')\n setMode(): 'range' | 'single' {\n return this.enableRangeDates ? 'range' : 'single';\n }\n\n @Listen('click', { target: 'window' })\n handleClick(ev: { target: Node }) {\n if (this.el.contains(ev.target)) {\n return;\n }\n this.hideCalendar();\n }\n\n hideCalendar() {\n this.isCalendarVisible = false;\n }\n\n showCalendar() {\n this.isCalendarVisible = true;\n }\n\n handleInputDates(event: any) {\n const inputValue = event.target.value;\n\n const dateRangeRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})\\s*-\\s*(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n const simpleDateRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n\n if (dateRangeRegex.test(inputValue)) {\n const matches = inputValue.match(dateRangeRegex);\n const startDate = this.parseStringToDate(matches[1]);\n const endDate = this.parseStringToDate(matches[2]);\n if (this.isDateValid(startDate) && this.isDateValid(endDate)) {\n this.status = 'default';\n this.dates = [startDate, endDate];\n this.value = `${this.parseDateToString(startDate)} - ${this.parseDateToString(endDate)}`;\n this.dateChange.emit(this.value);\n } else {\n this.status = 'error';\n this.dates = [];\n }\n } else if (simpleDateRegex.test(inputValue)) {\n const matches = inputValue.match(simpleDateRegex);\n const singleDate = this.parseStringToDate(matches[1]);\n if (this.isDateValid(singleDate)) {\n this.status = 'default';\n this.dates = [singleDate];\n this.value = this.parseDateToString(singleDate);\n this.dateChange.emit(this.value);\n } else {\n this.status = 'error';\n this.dates = [];\n }\n } else {\n this.dates = [];\n }\n }\n\n handleChangeDates(event: CuraInputTextCustomEvent<string | number>) {\n if (event.detail === '') {\n this.dates = [];\n this.status = 'default';\n this.value = '';\n this.dateChange.emit(this.value);\n }\n }\n\n @Watch('disableFutureDates')\n @Watch('disablePassDates')\n isDateValid(date: Date) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n\n if (this.disablePassDates) return !isBefore(date, today);\n if (this.disableFutureDates) return !isAfter(date, today);\n return true;\n }\n\n parseStringToDate(dateString: string): Date {\n const [day, month, year] = dateString.split('/').map(Number);\n return new Date(year, month - 1, day);\n }\n\n parseDateToString(date: Date): string {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const year = date.getFullYear();\n\n return `${day}/${month}/${year}`;\n }\n\n @Watch('dates')\n @Watch('isCalendarVisible')\n @Watch('disableFutureDates')\n renderCalendarOrHelperText() {\n if (this.isCalendarVisible) {\n return (\n <div class=\"calendar\">\n <cura-calendar\n customDates={this.dates}\n mode={this.setMode()}\n width=\"100%\"\n embedded={false}\n floating={false}\n disableFutureDates={this.disableFutureDates}\n disablePassDates={this.disablePassDates}\n onOnchangeday={e => {\n const days = e.detail.days;\n if (days.length === 1) {\n this.value = this.parseDateToString(days[0]);\n } else if (days.length > 0) {\n this.value = `${this.parseDateToString(days[0])} - ${this.parseDateToString(days[days.length - 1])}`;\n } else {\n this.value = '';\n }\n this.dateChange.emit(this.value);\n }}\n />\n </div>\n );\n } else {\n return this.helperText;\n }\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\" style={this.styles}>\n <cura-input-text\n label={this.label}\n name={this.name}\n status={this.status}\n value={this.value}\n onFocus={() => this.showCalendar()}\n size={this.size}\n iconName={this.iconName}\n placeholder={this.setPlaceholder()}\n mask-preset={this.setMask()}\n enable-selection-mode={true}\n onKeyUp={event => this.handleInputDates(event)}\n autocomplete=\"off\"\n onValueChange={event => this.handleChangeDates(event)}\n >\n {this.renderCalendarOrHelperText()}\n </cura-input-text>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cura-input-date.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,gBAAgB,GAAG,ilBAAilB,CAAC;AAC3mB,4BAAe,gBAAgB;;MCSlB,aAAa;;;;;qBAMkB,EAAE;sBAKsC,SAAS;oBAK7B,QAAQ;oBAK7B,EAAE;;;;;wBAyBE,EAAE;2BAKQ,IAAI;sBAczC,EAAE;iCAEkB,KAAK;qBAElB,EAAE;qBAED,EAAE;4BAEJ;YACtB,WAAW,EAAE,IAAI;YACjB,IAAI,EAAE,MAAM;YACZ,IAAI,EAAE,QAAQ;SACf;;IAED,iBAAiB;QACf,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QACxD,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QAEnC,IAAI,CAAC,MAAM,GAAG;YACZ,gBAAgB,EAAE,OAAO,CAAC,UAAU,EAAE;YACtC,qBAAqB,EAAE,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC;YAC3D,mBAAmB,EAAE,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YACvD,gBAAgB,EAAE,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAC;YACjD,aAAa,EAAE,KAAK,CAAC,OAAO,EAAE;YAC9B,cAAc,EAAE,KAAK,CAAC,QAAQ,EAAE;YAChC,eAAe,EAAE,KAAK,CAAC,SAAS,EAAE;YAClC,uBAAuB,EAAE,OAAO,CAAC,OAAO;SACzC,CAAC;KACH;IAED,iBAAiB;QACf,IAAI,CAAC,kBAAkB,EAAE,CAAC;KAC3B;;;;IAKD,sBAAsB,CAAC,IAA2B;QAChD,IAAI,CAAC,SAAS,GAAG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AAC,EAAE,CAAC;qBACtG;yBAAM;wBACL,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;qBACjB;oBACD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;iBAClC,GACD,CACE,EACN;SACH;aAAM;YACL,OAAO,IAAI,CAAC,UAAU,CAAC;SACxB;KACF;IAED,MAAM;QACJ,QACEA,QAACC,UAAI,uDACHD,kEAAK,KAAK,EAAC,WAAW,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IACvCA,8EACE,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,EAAE,EAClC,IAAI,EAAE,IAAI,CAAC,IAAI,eACJ,IAAI,CAAC,QAAQ,EACxB,WAAW,EAAE,IAAI,CAAC,YAAY,CAAC,WAAW,iBAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,2BACZ,IAAI,EAC3B,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,EAC9C,YAAY,EAAC,KAAK,EAClB,aAAa,EAAE,KAAK,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAEpD,IAAI,CAAC,0BAA0B,EAAE,CAClB,CACd,CACD,EACP;KACH;;;;;;;;;;;","names":["isBefore","isAfter","h","Host"],"sources":["src/components/forms/cura-input-date/cura-input-date.scss?tag=cura-input-date&encapsulation=shadow","src/components/forms/cura-input-date/cura-input-date.tsx"],"sourcesContent":["@import '../../../../src/scss/mixins/shadows.scss';\n@import '../../../../src/scss/mixins/spacing.scss';\n\n:host {\n display: block;\n}\n\n.container{\n display: flex;\n flex-direction: column;\n position: relative;\n\n .calendar{\n padding: #{$spacing-none} #{$spacing-xxxs};\n margin-top: -8px;\n border-radius: 0px 0px 4px 4px;\n border-top: 0px;\n border-right: 2px solid #D4D4D4;\n border-bottom:2px solid #D4D4D4;\n border-left: 2px solid #D4D4D4;\n @include shadow-level3(--neutral-black-shadow);\n position: absolute;\n top: 100%; \n z-index: 10; \n display: none; \n opacity: 0;\n pointer-events: none; \n }\n\n .calendar.visible {\n box-sizing: border-box;\n display: block;\n opacity: 1;\n pointer-events: auto; \n width: 100%;\n background-color: #fff;\n }\n}\n","import { Component, Element, Host, Listen, Prop, State, Watch, h, Event, EventEmitter } from '@stencil/core';\nimport { CuraInputTextCustomEvent } from '../../../components';\nimport { isAfter, isBefore } from 'date-fns';\n\n@Component({\n tag: 'cura-input-date',\n styleUrl: 'cura-input-date.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class CuraInputDate {\n @Element() el: HTMLElement;\n\n /**\n * Label text for the input date\n */\n @Prop({ reflect: true }) label?: string = '';\n\n /**\n * Indicates input status (default: default)\n */\n @Prop({ reflect: true, mutable: true }) status: 'error' | 'success' | 'default' = 'default';\n\n /**\n * Size of the input mode default: 'small', 'medium', or 'large' (default: 'medium')\n */\n @Prop({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';\n\n /**\n * Name text for the input date\n */\n @Prop({ reflect: true }) name?: string = '';\n\n /**\n * Helper text displayed below the input\n */\n @Prop({ reflect: true }) helperText?: string;\n\n /**\n * Enables the date range selection mode, allowing users to select a period of dates\n */\n @Prop({ reflect: true }) enableRangeDates: boolean;\n\n /**\n * Controls whether future dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true }) disableFutureDates: boolean;\n\n /**\n * Controls whether past dates (dates before the current date) should be disabled\n */\n @Prop({ reflect: true }) disablePassDates: boolean;\n\n /**\n * Whether to display a cura icon (default: null)\n */\n @Prop({ reflect: true }) iconName?: string = '';\n\n /**\n * Placeholder text for the input\n */\n @Prop({ reflect: true }) placeholder?: string | null = null;\n\n /**\n * Emitted when the value of the input changes\n * @type {EventEmitter<string>}\n */\n @Event() dateChange: EventEmitter<string>;\n\n /**\n * Emitted when the value of the status changes\n * @type {EventEmitter<string>}\n */\n @Event() statusInputChange: EventEmitter<string>;\n\n @State() styles = {};\n\n @State() isCalendarVisible: boolean = false;\n\n @State() dates: Date[] = [];\n\n @State() value?: string = '';\n\n @State() dateSettings = {\n placeholder: null,\n mask: 'date',\n mode: 'single',\n };\n\n connectedCallback() {\n const { fonts, colors, spacing } = window.CuraAPI.theme;\n const weights = fonts.getWeights();\n\n this.styles = {\n '--base-spacing': spacing.getSpacing(),\n '--neutral-purewhite': colors.getColor('neutral-purewhite'),\n '--neutral-lighter': colors.getColor('neutral-lighter'),\n '--neutral-base': colors.getColor('neutral-base'),\n '--font-size': fonts.getSize(),\n '--font-color': fonts.getColor(),\n '--font-family': fonts.getFamily(),\n '--font-weight-regular': weights.regular,\n };\n }\n\n componentWillLoad() {\n this.updateDateSettings();\n }\n\n /**\n * Callback for form association\n */\n formAssociatedCallback(form: { ariaLabel: string }) {\n form.ariaLabel = this.label;\n }\n\n @Watch('enableRangeDates')\n updateDateSettings() {\n const newSettings = this.getDateSettings(this.enableRangeDates);\n\n if (this.shouldUpdateDateSettings(newSettings)) {\n this.dateSettings = newSettings;\n }\n }\n\n getDateSettings(isRange: boolean) {\n return {\n placeholder: this.placeholder || (isRange ? 'dd/mm/aaaa - dd/mm/aaaa' : 'dd/mm/aaaa'),\n mask: isRange ? 'dateRange' : 'date',\n mode: isRange ? 'range' : 'single',\n };\n }\n\n shouldUpdateDateSettings(newSettings: any) {\n return this.dateSettings.placeholder !== newSettings.placeholder || this.dateSettings.mask !== newSettings.mask || this.dateSettings.mode !== newSettings.mode;\n }\n\n @Listen('click', { target: 'window' })\n handleClick(ev: { target: Node }) {\n if (this.el.contains(ev.target)) {\n return;\n }\n this.hideCalendar();\n }\n\n hideCalendar() {\n this.isCalendarVisible = false;\n }\n\n showCalendar() {\n this.isCalendarVisible = true;\n }\n\n handleInputDates(event: any) {\n const inputValue = event.target.value;\n\n const dateRangeRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})\\s*-\\s*(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n const simpleDateRegex = /^(\\d{2}\\/\\d{2}\\/\\d{4})$/;\n\n if (dateRangeRegex.test(inputValue)) {\n const matches = inputValue.match(dateRangeRegex);\n const startDate = this.parseStringToDate(matches[1]);\n const endDate = this.parseStringToDate(matches[2]);\n if (this.isDateValid(startDate) && this.isDateValid(endDate)) {\n this.status = 'default';\n this.dates = [startDate, endDate];\n this.value = `${this.parseDateToString(startDate)} - ${this.parseDateToString(endDate)}`;\n this.dateChange.emit(this.value);\n } else {\n this.resetDates();\n }\n } else if (simpleDateRegex.test(inputValue)) {\n const matches = inputValue.match(simpleDateRegex);\n const singleDate = this.parseStringToDate(matches[1]);\n if (this.isDateValid(singleDate)) {\n this.status = 'default';\n this.dates = [singleDate];\n this.value = this.parseDateToString(singleDate);\n this.dateChange.emit(this.value);\n } else {\n this.resetDates();\n }\n } else {\n this.dates = [];\n }\n }\n\n handleChangeDates(event: CuraInputTextCustomEvent<string | number>) {\n if (event.detail === '') {\n this.dates = [];\n this.status = 'default';\n this.value = '';\n this.dateChange.emit(this.value);\n this.statusInputChange.emit(this.status);\n }\n }\n\n isDateValid(date: Date) {\n const today = new Date();\n today.setHours(0, 0, 0, 0);\n\n if (this.disablePassDates) return !isBefore(date, today);\n if (this.disableFutureDates) return !isAfter(date, today);\n return true;\n }\n\n parseStringToDate(dateString: string): Date {\n const [day, month, year] = dateString.split('/').map(Number);\n return new Date(year, month - 1, day);\n }\n\n parseDateToString(date: Date): string {\n const day = String(date.getDate()).padStart(2, '0');\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const year = date.getFullYear();\n\n return `${day}/${month}/${year}`;\n }\n\n resetDates() {\n this.status = 'error';\n this.dates = [];\n this.statusInputChange.emit(this.status);\n }\n\n renderCalendarOrHelperText() {\n if (this.isCalendarVisible) {\n return (\n <div class=\"calendar visible\">\n <cura-calendar\n customDates={this.dates}\n mode={this.dateSettings.mode as 'single' | 'range'}\n width=\"100%\"\n maxWidth=\"400px\"\n embedded={false}\n floating={false}\n disableFutureDates={this.disableFutureDates}\n disablePassDates={this.disablePassDates}\n onOnchangeday={e => {\n const days = e.detail.days;\n if (days.length === 1) {\n this.value = this.parseDateToString(days[0]);\n } else if (days.length > 0) {\n this.value = `${this.parseDateToString(days[0])} - ${this.parseDateToString(days[days.length - 1])}`;\n } else {\n this.value = '';\n }\n this.dateChange.emit(this.value);\n }}\n />\n </div>\n );\n } else {\n return this.helperText;\n }\n }\n\n render() {\n return (\n <Host>\n <div class=\"container\" style={this.styles}>\n <cura-input-text\n label={this.label}\n name={this.name}\n status={this.status}\n value={this.value}\n onFocus={() => this.showCalendar()}\n size={this.size}\n icon-name={this.iconName}\n placeholder={this.dateSettings.placeholder}\n mask-preset={this.dateSettings.mask}\n enable-selection-mode={true}\n onKeyUp={event => this.handleInputDates(event)}\n autocomplete=\"off\"\n onValueChange={event => this.handleChangeDates(event)}\n >\n {this.renderCalendarOrHelperText()}\n </cura-input-text>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -25,7 +25,7 @@ const CuraLoaderBar = class {
25
25
  this.setProgress();
26
26
  }
27
27
  render() {
28
- return (index.h(index.Host, { key: 'c98e1e2e370b5fadc87eb960d030324e36acd250' }, index.h("div", { key: '39dac6c361361e840305e15d6bf4ff09cfa3380e', id: "progress-bar", class: "progress-bar", style: this.styles }, index.h("span", { key: 'b501bd4846993c62a246a5891b9650faaca89c32', class: "progress-bar-fill" }))));
28
+ return (index.h(index.Host, { key: 'af0397ee6a031081a84200da4863752ccbf937ce' }, index.h("div", { key: '5e054c2b571053bdb58b415a6ca642a8bc0385f3', id: "progress-bar", class: "progress-bar", style: this.styles }, index.h("span", { key: '2463789bf8737e13b6b5a49a1af4e51ce1637176', class: "progress-bar-fill" }))));
29
29
  }
30
30
  setColor() {
31
31
  this.styles = Object.assign(Object.assign({}, this.styles), { '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2), '--color-base': window.CuraAPI.theme.colors.getColor(this.color) });
@@ -137,7 +137,7 @@ const CuraRadio = class {
137
137
  return statusColors[this.status][type];
138
138
  }
139
139
  render() {
140
- return (index.h(index.Host, { key: '015424d6821feeef090b0e064cf35eb39100f918' }, index.h("div", { key: '85b54a48eb2c75dd98df83f7ac7557162b036300', class: this.getClasses(), style: this.styles }, index.h("div", { key: '84f0b0a8f5e2698fc5fcc6941b6a8b369629d6c0', class: "info" }, index.h("div", { key: '94194138a25b71c7a6cd1b8c191662ebcbd16b71', class: "label-wrapper" }, index.h("cura-label", { key: 'cd5af14f2c174bf6a2e2715f32c3f97ed42dd05e', class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '237bc98ab60ab07e917dcd99b1874bf6fd400ec6', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '88a3014b55f420ed7744090f1e54927f7f6ec767', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: 'b505727b192c807344f328c73c44f88b72314cb3' }))), index.h("input", { key: '6f324f596f24328d0829e1013bf78545dda17e4b', 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 }))));
140
+ return (index.h(index.Host, { key: 'a0d89eeaf13690af56498ab584c22082b071b851' }, index.h("div", { key: '17a7ffae366d1942cdf8daccb0693434468040f8', class: this.getClasses(), style: this.styles }, index.h("div", { key: '2a03b1cc6eb6c26227bff90ec40f1f739e543613', class: "info" }, index.h("div", { key: '63a3f9a9f99504fc5f0e824a6398d502c2d7bec7', class: "label-wrapper" }, index.h("cura-label", { key: 'cddaf7347318cba1cd480352cde13321b44cc244', class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: 'b2f5f549427841feb97ba43e26930e62e7d8f432', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '7d32540fd194b86224189d2ba3da8da4cae9d2a9', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: 'c4e8fa9a1fb18040da0038aa5ea7e6bcb0ee17bc' }))), index.h("input", { key: 'eaebe407c25af0bc72df251451a652fc6376ef9a', 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 }))));
141
141
  }
142
142
  static get formAssociated() { return true; }
143
143
  get host() { return index.getElement(this); }
@@ -109,7 +109,7 @@ const CuraSwitch = class {
109
109
  return classes;
110
110
  }
111
111
  render() {
112
- return (index.h(index.Host, { key: '6bbc037348270c69bfac13e7466c6fd19f4dc427' }, index.h("div", { key: '11ada01c69ff91815ba1b1f76a6e6b448e88a361', class: this.getClasses(), style: this.styles }, index.h("div", { key: '34992d3d6fbf3ca7782fa4502e297d508656c34c', class: "info" }, index.h("cura-label", { key: '0e6a178f1f74526962d588b1fad3024920bcf815', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, class: "label", weight: "bold", size: this.size === 'large' ? 'medium' : 'xsmall', lineHeight: "125%", color: this.assignColor('neutral-white', 'neutral-black') }, this.label), index.h("cura-label", { key: '33e7c6d7aaabd9007b0a41fb966b41b0fd947bc8', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, index.h("slot", { key: '66dd525702f7d53c8167cfd2aa25552d1bd79837' }))), index.h("div", { key: 'a3828f2e511a7e23ad5d0e04319637e1aa256c96', onClick: this.toggleSwitch, class: "control" }, index.h("div", { key: 'afc664ab5563591ef201eee1ca0d33a48075ad04', class: `track ${this.size.toLowerCase()}` }, index.h("div", { key: 'e6b7f3b67e78421283426ce1c7679cbbf8f77f5e', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
112
+ return (index.h(index.Host, { key: '019642743001393249cba0ac937b861a0b309af3' }, index.h("div", { key: '32d6358af066b24b60fb2967891b0eda03027a25', class: this.getClasses(), style: this.styles }, index.h("div", { key: 'c29681689cbf04ee89afa793dd84f1a3c1198fb7', class: "info" }, index.h("cura-label", { key: '0865c7e0c45843769046039981382e4f7a9cf8cf', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, class: "label", weight: "bold", size: this.size === 'large' ? 'medium' : 'xsmall', lineHeight: "125%", color: this.assignColor('neutral-white', 'neutral-black') }, this.label), index.h("cura-label", { key: 'b1fff87c188c2a1f306630a692c254dcacc5b03b', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, index.h("slot", { key: '553757a5022374bd10af67f4a0c449511203e2e6' }))), index.h("div", { key: 'a8babf17cdd9c8bb95225fce8501015859122ec6', onClick: this.toggleSwitch, class: "control" }, index.h("div", { key: '4828791117512af2526ed94b5981a0dab04b3e5c', class: `track ${this.size.toLowerCase()}` }, index.h("div", { key: '30a712271bcee777e9a3c79d04a2038db5b84869', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
113
113
  }
114
114
  static get formAssociated() { return true; }
115
115
  static get watchers() { return {
@@ -31,7 +31,7 @@ const CuraToast = class {
31
31
  this.setStyle();
32
32
  }
33
33
  render() {
34
- return (index.h(index.Host, { key: 'b875e88d00075a71d6052563a45849f0b3124f13' }, index.h("div", { key: 'e766c7a687ec1f9ad943dc4e2ebb87c100da5b71', class: this.getClasses(), style: this.styles }, index.h("cura-icon", { key: '9379419d8403c5c7b14182bb136cd3375f8aa09a', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), index.h("div", { key: '38f2a177984d826209d6fbdc9ad3036ef02a1825', class: "content" }, index.h("cura-heading", { key: 'a4fd1cce18d6208daa527b8da5687b47fbb59968', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), index.h("cura-paragraph", { key: 'fb803bbcbe47f1d2eca897ca5679d71294fe59ab', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, index.h("slot", { key: '9ea56d9f87a423b109945cd4cf4078347a9fc1e9' })), index.h("slot", { key: '045b4ae11997260832288428df6672be6e918730', name: "actions" })), this.closeButton && index.h("cura-icon", { key: 'e326bb7786f60c95bed9d910e46f47bb4273bb7b', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && index.h("cura-loader-bar", { key: 'bf1d59681ac35d79fe240777e5d5424ee2b4a4e7', color: `${this.type}-base`, progress: this.progress }))));
34
+ return (index.h(index.Host, { key: 'eb867953a8c56ae385b1226686cbe1b1e9df4318' }, index.h("div", { key: 'c901632a6fb414c981b5c149fdd7081306ae1130', class: this.getClasses(), style: this.styles }, index.h("cura-icon", { key: '98c9a49501c71ee60c6ae1d783bba11d5bdce999', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), index.h("div", { key: '19b2e0bd0d816e94f3b9d1f113f4b833e770cee3', class: "content" }, index.h("cura-heading", { key: '17ed67e5b531b45b94f8dbc7d65675f7a57308f9', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), index.h("cura-paragraph", { key: 'dd90e612d924dff9b3e9896dc29cef2541ae51af', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, index.h("slot", { key: '33cd9c1dd10ae6d3ebd857fab5c70ca7151f8a1b' })), index.h("slot", { key: '12d18bd482b957cdc5ee7a4fab20bdffe6bc647d', name: "actions" })), this.closeButton && index.h("cura-icon", { key: '3a83cdd43c6c11587013111c29673f916509b165', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && index.h("cura-loader-bar", { key: '13ec00fd7146119e9eab81ed6d52b1020d1eb1e8', color: `${this.type}-base`, progress: this.progress }))));
35
35
  }
36
36
  componentDidLoad() {
37
37
  this.openContainer();