@rededor/cura 1.0.0-alpha.1 → 1.0.0-alpha.3

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 (131) hide show
  1. package/dist/cjs/cura-accordion_9.cjs.entry.js +4 -4
  2. package/dist/cjs/cura-checkbox.cjs.entry.js +1 -1
  3. package/dist/cjs/cura-display.cjs.entry.js +1 -1
  4. package/dist/cjs/cura-dropdown-search-option-title.cjs.entry.js +1 -1
  5. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js +16 -8
  6. package/dist/cjs/cura-dropdown-search-option.cjs.entry.js.map +1 -1
  7. package/dist/cjs/cura-dropdown-search.cjs.entry.js +19 -11
  8. package/dist/cjs/cura-dropdown-search.cjs.entry.js.map +1 -1
  9. package/dist/cjs/cura-loader-bar.cjs.entry.js +46 -0
  10. package/dist/cjs/cura-loader-bar.cjs.entry.js.map +1 -0
  11. package/dist/cjs/cura-radio.cjs.entry.js +1 -1
  12. package/dist/cjs/cura-select_2.cjs.entry.js +4 -4
  13. package/dist/cjs/cura-switch.cjs.entry.js +1 -1
  14. package/dist/cjs/cura-toast.cjs.entry.js +106 -0
  15. package/dist/cjs/cura-toast.cjs.entry.js.map +1 -0
  16. package/dist/cjs/cura.cjs.js +1 -1
  17. package/dist/cjs/loader.cjs.js +1 -1
  18. package/dist/collection/collection-manifest.json +2 -0
  19. package/dist/collection/components/cura-toast/cura-toast.css +161 -0
  20. package/dist/collection/components/cura-toast/cura-toast.js +261 -0
  21. package/dist/collection/components/cura-toast/cura-toast.js.map +1 -0
  22. package/dist/collection/components/cura-toast/cura-toast.stories.js +149 -0
  23. package/dist/collection/components/cura-toast/cura-toast.stories.js.map +1 -0
  24. package/dist/collection/components/forms/cura-checkbox/cura-checkbox.js +1 -1
  25. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.css +4 -1
  26. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js +33 -7
  27. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.js.map +1 -1
  28. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js +10 -1
  29. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.js.map +1 -1
  30. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search-option-title/cura-dropdown-search-option-title.js +1 -1
  31. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.css +2 -2
  32. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js +36 -10
  33. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.js.map +1 -1
  34. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js +15 -3
  35. package/dist/collection/components/forms/cura-dropdown-search/cura-dropdown-search.stories.js.map +1 -1
  36. package/dist/collection/components/forms/cura-label/cura-label.js +1 -1
  37. package/dist/collection/components/forms/cura-radio/cura-radio.js +1 -1
  38. package/dist/collection/components/forms/cura-select/cura-select.js +3 -3
  39. package/dist/collection/components/forms/cura-select-options/cura-select-option.js +1 -1
  40. package/dist/collection/components/forms/cura-switch/cura-switch.js +1 -1
  41. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.css +21 -0
  42. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js +95 -0
  43. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.js.map +1 -0
  44. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.stories.js +54 -0
  45. package/dist/collection/components/loaders/cura-loader-bar/cura-loader-bar.stories.js.map +1 -0
  46. package/dist/collection/components/loaders/cura-loader-circle/cura-loader-circle.js +1 -1
  47. package/dist/collection/components/text/cura-display/cura-display.js +1 -1
  48. package/dist/collection/components/text/cura-heading/cura-heading.js +1 -1
  49. package/dist/collection/components/text/cura-paragraph/cura-paragraph.js +1 -1
  50. package/dist/components/cura-checkbox.js +1 -1
  51. package/dist/components/cura-display.js +1 -1
  52. package/dist/components/cura-dropdown-search-option-title.js +1 -1
  53. package/dist/components/cura-dropdown-search-option.js +17 -8
  54. package/dist/components/cura-dropdown-search-option.js.map +1 -1
  55. package/dist/components/cura-dropdown-search.js +20 -11
  56. package/dist/components/cura-dropdown-search.js.map +1 -1
  57. package/dist/components/cura-heading2.js +1 -1
  58. package/dist/components/cura-label2.js +1 -1
  59. package/dist/components/cura-loader-bar.d.ts +11 -0
  60. package/dist/components/cura-loader-bar.js +8 -0
  61. package/dist/components/cura-loader-bar.js.map +1 -0
  62. package/dist/components/cura-loader-bar2.js +64 -0
  63. package/dist/components/cura-loader-bar2.js.map +1 -0
  64. package/dist/components/cura-loader-circle2.js +1 -1
  65. package/dist/components/cura-paragraph2.js +1 -1
  66. package/dist/components/cura-radio.js +1 -1
  67. package/dist/components/cura-select-option2.js +1 -1
  68. package/dist/components/cura-select2.js +3 -3
  69. package/dist/components/cura-switch.js +1 -1
  70. package/dist/components/cura-toast.d.ts +11 -0
  71. package/dist/components/cura-toast.js +157 -0
  72. package/dist/components/cura-toast.js.map +1 -0
  73. package/dist/components/index.js +4 -0
  74. package/dist/components/index.js.map +1 -1
  75. package/dist/cura/cura.esm.js +1 -1
  76. package/dist/cura/cura.esm.js.map +1 -1
  77. package/dist/cura/p-039b3701.entry.js +2 -0
  78. package/dist/cura/p-039b3701.entry.js.map +1 -0
  79. package/dist/cura/p-29790bb5.entry.js +2 -0
  80. package/dist/cura/p-29790bb5.entry.js.map +1 -0
  81. package/dist/cura/{p-93389727.entry.js → p-45bc4f7c.entry.js} +2 -2
  82. package/dist/cura/p-4eaeb590.entry.js +2 -0
  83. package/dist/cura/p-4eaeb590.entry.js.map +1 -0
  84. package/dist/cura/{p-ba2e7222.entry.js → p-5fcfbf32.entry.js} +2 -2
  85. package/dist/cura/{p-3c39a9d8.entry.js → p-67e34464.entry.js} +2 -2
  86. package/dist/cura/{p-5466758a.entry.js → p-8433fec9.entry.js} +2 -2
  87. package/dist/cura/p-a5e53dd4.entry.js +2 -0
  88. package/dist/cura/{p-ced36448.entry.js.map → p-a5e53dd4.entry.js.map} +1 -1
  89. package/dist/cura/{p-578c74a4.entry.js → p-a9dad622.entry.js} +2 -2
  90. package/dist/cura/p-af2036a7.entry.js +2 -0
  91. package/dist/cura/p-b1148bb2.entry.js +2 -0
  92. package/dist/cura/p-b1148bb2.entry.js.map +1 -0
  93. package/dist/esm/cura-accordion_9.entry.js +4 -4
  94. package/dist/esm/cura-checkbox.entry.js +1 -1
  95. package/dist/esm/cura-display.entry.js +1 -1
  96. package/dist/esm/cura-dropdown-search-option-title.entry.js +1 -1
  97. package/dist/esm/cura-dropdown-search-option.entry.js +16 -8
  98. package/dist/esm/cura-dropdown-search-option.entry.js.map +1 -1
  99. package/dist/esm/cura-dropdown-search.entry.js +19 -11
  100. package/dist/esm/cura-dropdown-search.entry.js.map +1 -1
  101. package/dist/esm/cura-loader-bar.entry.js +42 -0
  102. package/dist/esm/cura-loader-bar.entry.js.map +1 -0
  103. package/dist/esm/cura-radio.entry.js +1 -1
  104. package/dist/esm/cura-select_2.entry.js +4 -4
  105. package/dist/esm/cura-switch.entry.js +1 -1
  106. package/dist/esm/cura-toast.entry.js +102 -0
  107. package/dist/esm/cura-toast.entry.js.map +1 -0
  108. package/dist/esm/cura.js +1 -1
  109. package/dist/esm/loader.js +1 -1
  110. package/dist/types/components/cura-toast/cura-toast.d.ts +26 -0
  111. package/dist/types/components/cura-toast/cura-toast.stories.d.ts +119 -0
  112. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.d.ts +4 -0
  113. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.stories.d.ts +11 -0
  114. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.d.ts +8 -0
  115. package/dist/types/components/forms/cura-dropdown-search/cura-dropdown-search.stories.d.ts +21 -2
  116. package/dist/types/components/loaders/cura-loader-bar/cura-loader-bar.d.ts +12 -0
  117. package/dist/types/components/loaders/cura-loader-bar/cura-loader-bar.stories.d.ts +39 -0
  118. package/dist/types/components.d.ts +76 -0
  119. package/package.json +2 -2
  120. package/dist/cura/p-251bd980.entry.js +0 -2
  121. package/dist/cura/p-251bd980.entry.js.map +0 -1
  122. package/dist/cura/p-61d20270.entry.js +0 -2
  123. package/dist/cura/p-b3a50bcf.entry.js +0 -2
  124. package/dist/cura/p-b3a50bcf.entry.js.map +0 -1
  125. package/dist/cura/p-ced36448.entry.js +0 -2
  126. /package/dist/cura/{p-93389727.entry.js.map → p-45bc4f7c.entry.js.map} +0 -0
  127. /package/dist/cura/{p-ba2e7222.entry.js.map → p-5fcfbf32.entry.js.map} +0 -0
  128. /package/dist/cura/{p-3c39a9d8.entry.js.map → p-67e34464.entry.js.map} +0 -0
  129. /package/dist/cura/{p-5466758a.entry.js.map → p-8433fec9.entry.js.map} +0 -0
  130. /package/dist/cura/{p-578c74a4.entry.js.map → p-a9dad622.entry.js.map} +0 -0
  131. /package/dist/cura/{p-61d20270.entry.js.map → p-af2036a7.entry.js.map} +0 -0
@@ -300,7 +300,7 @@ const CuraHeading = class {
300
300
  return tags[`${this.level}`] || tags['default'];
301
301
  }
302
302
  render() {
303
- return (index.h(index.Host, { key: '456cd35fd9ad4389ceb13d3b89d05f70e2423068', style: this.hostCSSProperties() }, this.getHeadingTag()));
303
+ return (index.h(index.Host, { key: '55016d81f72ce0b506a7e2f2fbca3aa92448d581', style: this.hostCSSProperties() }, this.getHeadingTag()));
304
304
  }
305
305
  get host() { return index.getElement(this); }
306
306
  static get watchers() { return {
@@ -407,7 +407,7 @@ const CuraLabel = class {
407
407
  };
408
408
  }
409
409
  render() {
410
- return (index.h(index.Host, { key: '42662869e7cc4cd7cc8ff29ef37209514eaea0ac', style: this.hostCSSProperties() }, index.h("p", { key: 'cf6be4faf13ab24e0ae65edea48b528763072a7b', style: this.styles, class: this.getClasses() }, index.h("slot", { key: '45ee41cdc15f0c73672e4b3047df4508dbb870e3' }))));
410
+ return (index.h(index.Host, { key: '34d418859c8067e879a089240d36b58f5e91c8fc', style: this.hostCSSProperties() }, index.h("p", { key: '4a28171e079f80d8e61ebe840b858d65dd6d62c3', style: this.styles, class: this.getClasses() }, index.h("slot", { key: '0796484498caddf7935ff3458e13cfab47759a4b' }))));
411
411
  }
412
412
  get host() { return index.getElement(this); }
413
413
  static get watchers() { return {
@@ -441,7 +441,7 @@ const CuraLoaderCircle = class {
441
441
  };
442
442
  }
443
443
  render() {
444
- return (index.h(index.Host, { key: '8b2b73c6aefffd1a4350618ed52038a414cebb48', style: this.getStyles() }, index.h("svg", { key: '4478c39440bc66adcb3bcf1d947ae12cd5c3c721', viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '3c01be9c541a634c504a2b8f72296426b8cebe28' }, index.h("circle", { key: '153102890325235a989b91badcadd00f852ccc3e', cx: "8", cy: "8", r: "7", stroke: "url(#paint0_linear_13485_11488)", "stroke-width": "2" }), index.h("path", { key: '5fd7be471c351a46154fa96b459a99be297dfb5e', d: "M1 8C1 4.13401 4.11877 1 7.96596 1C9.53445 1 10.9819 1.52093 12.1462 2.4C12.8959 2.96601 13.5282 3.68049 14 4.5", "stroke-width": "2" })), index.h("defs", { key: '89ce06231240879c222d93fc4efc44d963bbd167' }, index.h("linearGradient", { key: '0999b93ff91ef7d31b9bfc70cfb08190838197e9', id: "paint0_linear_13485_11488", x1: "15.7", y1: "4.5", x2: "4.15", y2: "11.5", gradientUnits: "userSpaceOnUse" }, index.h("stop", { key: 'd7adf5104e03f40f4c757d218c0fc786e9f8ef2c' }), index.h("stop", { key: '8aaddbffb82d660aa8d62b2147efb74409218f41', offset: "1" }))))));
444
+ return (index.h(index.Host, { key: 'dd0c9e5b82f8f3b41511d31333af00e46435e9db', style: this.getStyles() }, index.h("svg", { key: '2a6a1edab6501c7788bebed93bbc87143d10fbaf', viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, index.h("g", { key: '8dd113e23ffc4f5df091738a878eee76e030c904' }, index.h("circle", { key: 'a6e06aad2260ffb8cec65aed59ef8f09459765a1', cx: "8", cy: "8", r: "7", stroke: "url(#paint0_linear_13485_11488)", "stroke-width": "2" }), index.h("path", { key: '88ac6f03cac1030593e06e6062d8d9947474aa62', d: "M1 8C1 4.13401 4.11877 1 7.96596 1C9.53445 1 10.9819 1.52093 12.1462 2.4C12.8959 2.96601 13.5282 3.68049 14 4.5", "stroke-width": "2" })), index.h("defs", { key: '6bae1e73907f3f8a17560ef055290c4ac41959e7' }, index.h("linearGradient", { key: 'c2510effd844984927f4b32fbb7f770ebcb09a3c', id: "paint0_linear_13485_11488", x1: "15.7", y1: "4.5", x2: "4.15", y2: "11.5", gradientUnits: "userSpaceOnUse" }, index.h("stop", { key: '477e90e9eadf1385a8b897917886e1fe352c41d0' }), index.h("stop", { key: '135e22c3a11916fa1ce4bc5870774ecf37512e6f', offset: "1" }))))));
445
445
  }
446
446
  };
447
447
  CuraLoaderCircle.style = CuraLoaderCircleStyle0;
@@ -521,7 +521,7 @@ const CuraParagraph = class {
521
521
  };
522
522
  }
523
523
  render() {
524
- return (index.h(index.Host, { key: '5b219ac846a02c36df1db1ff5be6f0c5c833c2c1', style: this.hostCSSProperties() }, index.h("p", { key: 'e53f25d18b0b5d54548879872c0f234d3782b4f0', style: this.styles, class: this.setsizeClass() }, index.h("slot", { key: 'be875e98ec8c19682f972d0e4bb0bb07e9ee4224' }))));
524
+ return (index.h(index.Host, { key: '2c9903f885ae8346efdbb1569264fc078aee9224', style: this.hostCSSProperties() }, index.h("p", { key: '287c656408d2e9876497f70784ae7ce166417272', style: this.styles, class: this.setsizeClass() }, index.h("slot", { key: 'dde5f8d46c384a76605c1ef33b73c8f442c7a48b' }))));
525
525
  }
526
526
  get host() { return index.getElement(this); }
527
527
  static get watchers() { return {
@@ -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: '9f96ab8f12502dc777ee00d02d8306ecd3ce9776' }, index.h("div", { key: '4a782c31e4d97df0c7cc1d60a3c83125d01d31f6', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, index.h("div", { key: 'c2de03821506646ffbe84cd7106ab91c1cdeba55', class: "info" }, index.h("div", { key: '9a8985036acf8770541b69e35ff449572a6afb0e', class: "label-wrapper" }, index.h("cura-label", { key: 'a128e382aa3f25c849fbe488f3820aa9b3cdb775', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '84e4817990f7499f047af339ce1ed9efc0ed060c', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '33527a9347eb8971d869b7e5ec492c3a7057b123', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: 'cda5d0d9eca328fd20663f941a41325eb1ad0e29' }))), index.h("div", { key: '588b04e6c9c74daf8406d0cca1e50bd39d1703c9', class: 'checkbox', tabIndex: this.ontabindex }, index.h("input", { key: '209fee01eb3051602e5a9633de4fdea59d986a53', 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: 'b74eebdbcaed952fa2157c3cbb3a84ce92bb9e6c' }, index.h("div", { key: 'e18e4e5aa12a3e298db65399ebf002aa991100f2', class: this.getClasses(), style: this.styles, onClick: this.handleClick }, index.h("div", { key: 'fdbcf3ec4b12bf9c6d80cded5ce9d17c4f5e2a39', class: "info" }, index.h("div", { key: 'cbe76b43956bed00ab638b953a44d941ffb748d5', class: "label-wrapper" }, index.h("cura-label", { key: '259c5e5e63a6d36ed15845899eaf8c76b2b50273', class: "label", weight: 'bold', size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '42d8b2777d4790bd8f83a7ddc939c6ab584b5cf0', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: 'bcafaacf64c8967f78a3e9b7ecfe6d1412517ea3', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: 'c9cc9e74cc9048ead8375a158253491e1aae4dfe' }))), index.h("div", { key: 'e63ba7ef796c9d46cf4729facf1be985b8174028', class: 'checkbox', tabIndex: this.ontabindex }, index.h("input", { key: '2e7e2e302e577f26d8022fe4a0108f0e6727450f', 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); }
@@ -60,7 +60,7 @@ const CuraDisplay = class {
60
60
  return tags[`${this.level}`] || tags['default'];
61
61
  }
62
62
  render() {
63
- return (index.h(index.Host, { key: 'd81f995e2da8e19498b2839319033cc5d93db1ea', style: this.hostCSSProperties() }, this.getHeadingTag()));
63
+ return (index.h(index.Host, { key: '89df8c001192a7526e6976d9b43099562d65809d', style: this.hostCSSProperties() }, this.getHeadingTag()));
64
64
  }
65
65
  get host() { return index.getElement(this); }
66
66
  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: '6e2312e0bf01db89fe6c85fbe525c02ed2dff7ec', slot: "dropdown-search-option" }, index.h("cura-label", { key: '551017409617799c76a6119b4e61596a4188f5ad', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, index.h("slot", { key: '4e0b3b588dec8603df342358840bc0a2d8ab3c4c' }))));
15
+ return (index.h(index.Host, { key: 'd27a47a6d61497f488c449188b2c6036529350cc', slot: "dropdown-search-option" }, index.h("cura-label", { key: 'ba63e9fce7392087551ccc7fb46a83cffa6785c9', color: "neutral-dark", size: "xsmall", lineHeight: "16px", marginBlock: "0" }, index.h("slot", { key: 'f14d41a3ed995f6f9a946e7d96e5c0b0208310ad' }))));
16
16
  }
17
17
  };
18
18
  CuraDropdownSearchOptionTitle.style = CuraDropdownSearchOptionTitleStyle0;
@@ -4,20 +4,27 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-98e7ba54.js');
6
6
 
7
- const curaDropdownSearchOptionCss = ":host{display:block;box-sizing:border-box;width:100%}ul{list-style:none;width:100%;margin:0;padding:0}li{width:100%;display:flex;align-items:center;align-content:center;justify-content:center;gap:8px;padding:8px 4px;flex-direction:row;background-color:var(--neutral-purewhite);border-bottom:1px solid var(--neutral-light);box-sizing:border-box;cursor:pointer}li.hovered{background-color:var(--neutral-white)}li cura-heading{width:100%;margin-block:0px}li ::slotted(div[slot=image]){min-width:32px;display:flex;justify-content:center;align-items:center}li ::slotted(div[slot=action]){display:flex;justify-content:end}li.selected{background-color:var(--primary-lighter)}li:hover{background-color:var(--neutral-white)}";
7
+ const curaDropdownSearchOptionCss = ":host{display:block;box-sizing:border-box;width:100%}ul{list-style:none;width:100%;margin:0;padding:0}li{width:100%;display:flex;align-items:center;align-content:center;justify-content:center;gap:8px;padding:8px 4px;flex-direction:row;background-color:var(--neutral-purewhite);border-bottom:1px solid var(--neutral-light);box-sizing:border-box;cursor:pointer}li.disabled{cursor:default}li.hovered{background-color:var(--neutral-white)}li cura-heading{width:100%;margin-block:0px}li ::slotted(div[slot=image]){min-width:32px;display:flex;justify-content:center;align-items:center}li ::slotted(div[slot=action]){display:flex;justify-content:end}li.selected{background-color:var(--primary-lighter)}li:hover:not(.disabled){background-color:var(--neutral-white)}";
8
8
  const CuraDropdownSearchOptionStyle0 = curaDropdownSearchOptionCss;
9
9
 
10
10
  const CuraDropdownSearchOption = class {
11
11
  constructor(hostRef) {
12
12
  index.registerInstance(this, hostRef);
13
13
  this.optionSelected = index.createEvent(this, "optionSelected", 7);
14
- this.handleOptionClick = () => {
15
- this.selected = !this.selected;
16
- this.optionSelected.emit(this.value);
17
- this.updateIconColor();
14
+ this.handleOptionClick = (e) => {
15
+ if (this.selectable) {
16
+ this.selected = !this.selected;
17
+ this.optionSelected.emit(this.value);
18
+ this.updateIconColor();
19
+ }
20
+ else {
21
+ e.preventDefault();
22
+ e.stopImmediatePropagation();
23
+ }
18
24
  };
19
25
  this.value = undefined;
20
26
  this.selected = false;
27
+ this.selectable = true;
21
28
  this.hovered = false;
22
29
  this.styles = {};
23
30
  }
@@ -38,10 +45,11 @@ const CuraDropdownSearchOption = class {
38
45
  }
39
46
  }
40
47
  render() {
41
- return (index.h(index.Host, { key: 'd045683759a6be8de6ba6e1e7c3ffb3c7e64c928', style: this.styles, slot: "dropdown-search-option" }, index.h("ul", { key: '6fe79f291239629e214bcda850891413c307e120' }, index.h("li", { key: 'b62dcc68f2c14da18894fbcdd5e68d5a417ce053', onClick: this.handleOptionClick, value: this.value, class: {
42
- hovered: this.hovered,
48
+ return (index.h(index.Host, { key: 'aa4b585c3f67a74d1371430200ad309f74015af6', style: this.styles, slot: "dropdown-search-option" }, index.h("ul", { key: '5413964e5e10e68e4ff2ac30f68f6e22cff6dcc1' }, index.h("li", { key: '3aab9b7d5e3904e57a7310addc4b15a51453d31d', onClick: (e) => this.handleOptionClick(e), value: this.value, class: {
49
+ hovered: this.selectable ? this.hovered : false,
43
50
  selected: this.selected,
44
- } }, index.h("slot", { key: '8883c51c5789d57b8a6b4567f5faeaacd5d52bff', name: "image" }), index.h("cura-heading", { key: 'f701d19b2e707a78be62d3df5a768bf83959ecaa', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, index.h("slot", { key: 'ffe7d83f45a1757df017061a71b950cc50ce52d5' })), index.h("slot", { key: '4d0f901f5b5e1b7c8ebe5e1148118a2645c6eddd', name: "action" })))));
51
+ disabled: !this.selectable
52
+ } }, index.h("slot", { key: '030c06f2e9bcfd0169b8d94c8976cd4b1e25b834', name: "image" }), index.h("cura-heading", { key: 'f5bd16d815a853a41d98aac09517359a5e1b432d', size: "xsmall", lineHeight: "16px", marginBlock: "0px", weight: "bold", color: "neutral-black" }, index.h("slot", { key: '878d1db64dc98c57530adf947cbc216ac1ce1be0' })), index.h("slot", { key: '81c92fcb864bc8f2324cc353574123705fc386a8', name: "action" })))));
45
53
  }
46
54
  get hostElement() { return index.getElement(this); }
47
55
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"cura-dropdown-search-option.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,2BAA2B,GAAG,6sBAA6sB,CAAC;AAClvB,uCAAe,2BAA2B;;MCM7B,wBAAwB;;;;QAmC3B,sBAAiB,GAAG;YAC1B,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrC,IAAI,CAAC,eAAe,EAAE,CAAC;SACxB,CAAC;;wBA9B0D,KAAK;uBAKN,KAAK;sBAE9C,EAAE;;IAWpB,iBAAiB;QACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/F,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QACvF,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;QACvF,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;KAChG;IAQD,gBAAgB;QACd,IAAI,CAAC,eAAe,EAAE,CAAC;KACxB;IAGO,eAAe;QACrB,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,0BAA0B,CAAC,CAAC;QAC/E,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,GAAG,SAAS,GAAG,cAAc,CAAC,CAAC;SAC/E;KACF;IAED,MAAM;QACJ,QACEA,QAACC,UAAI,qDAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAC,wBAAwB,IACrDD,mEACEA,iEACE,OAAO,EAAE,IAAI,CAAC,iBAAiB,EAC/B,KAAK,EAAE,IAAI,CAAC,KAAK,EACjB,KAAK,EAAE;gBACL,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,IAEDA,mEAAM,IAAI,EAAC,OAAO,GAAQ,EAC1BA,2EAAc,IAAI,EAAC,QAAQ,EAAC,UAAU,EAAC,MAAM,EAAC,WAAW,EAAC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,KAAK,EAAC,eAAe,IACjGA,oEAAa,CACA,EACfA,mEAAM,IAAI,EAAC,QAAQ,GAAQ,CACxB,CACF,CACA,EACP;KACH;;;;;;;;;;","names":["h","Host"],"sources":["src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.scss?tag=cura-dropdown-search-option&encapsulation=shadow","src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.tsx"],"sourcesContent":[":host {\n display: block;\n box-sizing: border-box;\n width: 100%;\n}\n\nul {\n list-style: none;\n width: 100%;\n margin: 0;\n padding: 0;\n}\nli {\n width: 100%;\n display: flex;\n align-items: center;\n align-content: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 4px;\n flex-direction: row;\n background-color: var(--neutral-purewhite);\n border-bottom: 1px solid var(--neutral-light);\n box-sizing: border-box;\n cursor: pointer;\n\n &.hovered {\n background-color: var(--neutral-white);\n }\n\n cura-heading {\n width: 100%;\n margin-block: 0px;\n }\n\n ::slotted(div[slot='image']) {\n min-width: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n ::slotted(div[slot='action']) {\n display: flex;\n justify-content: end;\n }\n\n &.selected {\n background-color: var(--primary-lighter);\n }\n\n &:hover {\n background-color: var(--neutral-white);\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search-option',\n styleUrl: 'cura-dropdown-search-option.scss',\n shadow: true,\n})\nexport class CuraDropdownSearchOption {\n /**\n * The value of the dropdown search option.\n */\n @Prop({ reflect: true }) value: string;\n\n /**\n * Indicates if the dropdown search option is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * Indicates if the dropdown search option is hovered.\n */\n @Prop({ reflect: true, mutable: true }) hovered: boolean = false;\n\n @State() styles = {};\n\n /**\n * Event emitted when the option is selected.\n */\n @Event() optionSelected: EventEmitter<string>;\n\n @Element() hostElement: HTMLElement;\n\n weights;\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\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-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);\n this.styles['--primary-lighter'] = window.CuraAPI.theme.colors.getColor(`primary-lighter`, 50);\n }\n\n private handleOptionClick = () => {\n this.selected = !this.selected;\n this.optionSelected.emit(this.value);\n this.updateIconColor();\n };\n\n componentDidLoad() {\n this.updateIconColor();\n }\n\n @Watch('selected')\n private updateIconColor() {\n const iconElement = this.hostElement.querySelector('[slot=\"image\"] cura-icon');\n if (iconElement) {\n iconElement.setAttribute('color', this.selected ? 'primary' : 'neutral-dark');\n }\n }\n\n render() {\n return (\n <Host style={this.styles} slot=\"dropdown-search-option\">\n <ul>\n <li\n onClick={this.handleOptionClick}\n value={this.value}\n class={{\n hovered: this.hovered,\n selected: this.selected,\n }}\n >\n <slot name=\"image\"></slot>\n <cura-heading size=\"xsmall\" lineHeight=\"16px\" marginBlock=\"0px\" weight=\"bold\" color=\"neutral-black\">\n <slot></slot>\n </cura-heading>\n <slot name=\"action\"></slot>\n </li>\n </ul>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"cura-dropdown-search-option.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,2BAA2B,GAAG,uvBAAuvB,CAAC;AAC5xB,uCAAe,2BAA2B;;MCM7B,wBAAwB;;;;QAwC3B,sBAAiB,GAAG,CAAC,CAAQ;YACnC,IAAI,IAAI,CAAC,UAAU,EAAE;gBACnB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC;gBAC/B,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACrC,IAAI,CAAC,eAAe,EAAE,CAAC;aACxB;iBAAM;gBACL,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,CAAC,CAAC,wBAAwB,EAAE,CAAC;aAC9B;SACF,CAAC;;wBAxC0D,KAAK;0BAKlB,IAAI;uBAKQ,KAAK;sBAE9C,EAAE;;IAWpB,iBAAiB;QACf,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QAC/F,IAA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AM,EAAC,KAAK,EAAC,eAAe,IACjGA,oEAAa,CACA,EACfA,mEAAM,IAAI,EAAC,QAAQ,GAAQ,CACxB,CACF,CACA,EACP;KACH;;;;;;;;;;","names":["h","Host"],"sources":["src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.scss?tag=cura-dropdown-search-option&encapsulation=shadow","src/components/forms/cura-dropdown-search/cura-dropdown-search-option/cura-dropdown-search-option.tsx"],"sourcesContent":[":host {\n display: block;\n box-sizing: border-box;\n width: 100%;\n}\n\nul {\n list-style: none;\n width: 100%;\n margin: 0;\n padding: 0;\n}\nli {\n width: 100%;\n display: flex;\n align-items: center;\n align-content: center;\n justify-content: center;\n gap: 8px;\n padding: 8px 4px;\n flex-direction: row;\n background-color: var(--neutral-purewhite);\n border-bottom: 1px solid var(--neutral-light);\n box-sizing: border-box;\n cursor: pointer;\n\n &.disabled {\n cursor: default;\n }\n\n &.hovered {\n background-color: var(--neutral-white);\n }\n\n cura-heading {\n width: 100%;\n margin-block: 0px;\n }\n\n ::slotted(div[slot='image']) {\n min-width: 32px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n ::slotted(div[slot='action']) {\n display: flex;\n justify-content: end;\n }\n\n &.selected {\n background-color: var(--primary-lighter);\n }\n\n &:hover:not(.disabled) {\n background-color: var(--neutral-white);\n }\n}\n","import { Component, Element, Event, EventEmitter, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-dropdown-search-option',\n styleUrl: 'cura-dropdown-search-option.scss',\n shadow: true,\n})\nexport class CuraDropdownSearchOption {\n /**\n * The value of the dropdown search option.\n */\n @Prop({ reflect: true }) value: string;\n\n /**\n * Indicates if the dropdown search option is selected.\n */\n @Prop({ reflect: true, mutable: true }) selected: boolean = false;\n\n /**\n * Indicates if the dropdown search is selectable.\n */\n @Prop({ reflect: true }) selectable: boolean = true;\n\n /**\n * Indicates if the dropdown search option is hovered.\n */\n @Prop({ reflect: true, mutable: true }) hovered: boolean = false;\n\n @State() styles = {};\n\n /**\n * Event emitted when the option is selected.\n */\n @Event() optionSelected: EventEmitter<string>;\n\n @Element() hostElement: HTMLElement;\n\n weights;\n\n connectedCallback() {\n this.weights = window.CuraAPI.theme.fonts.getWeights();\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-white'] = window.CuraAPI.theme.colors.getColor(`neutral-white`);\n this.styles['--primary-lighter'] = window.CuraAPI.theme.colors.getColor(`primary-lighter`, 50);\n }\n\n private handleOptionClick = (e: Event) => {\n if (this.selectable) {\n this.selected = !this.selected;\n this.optionSelected.emit(this.value);\n this.updateIconColor();\n } else {\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n };\n\n componentDidLoad() {\n this.updateIconColor();\n }\n\n @Watch('selected')\n private updateIconColor() {\n const iconElement = this.hostElement.querySelector('[slot=\"image\"] cura-icon');\n if (iconElement) {\n iconElement.setAttribute('color', this.selected ? 'primary' : 'neutral-dark');\n }\n }\n\n render() {\n return (\n <Host style={this.styles} slot=\"dropdown-search-option\">\n <ul>\n <li\n onClick={(e) => this.handleOptionClick(e)}\n value={this.value}\n class={{\n hovered: this.selectable ? this.hovered : false,\n selected: this.selected,\n disabled: !this.selectable\n }}\n >\n <slot name=\"image\"></slot>\n <cura-heading size=\"xsmall\" lineHeight=\"16px\" marginBlock=\"0px\" weight=\"bold\" color=\"neutral-black\">\n <slot></slot>\n </cura-heading>\n <slot name=\"action\"></slot>\n </li>\n </ul>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const index = require('./index-98e7ba54.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-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:630px;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:absolute;top:0;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-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:0;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}";
8
8
  const CuraDropdownSearchStyle0 = curaDropdownSearchCss;
9
9
 
10
10
  const CuraDropdownSearch = class {
@@ -22,7 +22,7 @@ const CuraDropdownSearch = class {
22
22
  const input = event.target;
23
23
  this.value = input.value;
24
24
  this.onValueChange(this.value);
25
- this.valueChanged.emit(this.value);
25
+ // this.valueChanged.emit(this.value);
26
26
  };
27
27
  this.handleKeyDown = (event) => {
28
28
  if (event.key === 'ArrowDown') {
@@ -60,6 +60,7 @@ const CuraDropdownSearch = class {
60
60
  this.placeholder = '';
61
61
  this.label = '';
62
62
  this.iconName = 'search';
63
+ this.dropdownMaxHeight = '630px';
63
64
  this.overlayVisible = false;
64
65
  this.isDropdownOpen = false;
65
66
  this.styles = {};
@@ -86,12 +87,12 @@ const CuraDropdownSearch = class {
86
87
  }
87
88
  onValueChange(newValue) {
88
89
  this.updateSelectedOption(newValue);
90
+ this.valueChanged.emit(this.value);
89
91
  }
90
92
  componentWillLoad() {
91
93
  this.updateSelectedOption(this.value);
92
94
  }
93
95
  componentDidRender() {
94
- console.log(this.options);
95
96
  if (this.isDropdownOpen && this.isMobile) {
96
97
  this.showOverlay();
97
98
  }
@@ -139,12 +140,14 @@ const CuraDropdownSearch = class {
139
140
  }
140
141
  onSelectedOption(index) {
141
142
  const selectedOption = this.options[index];
142
- const selectedValue = selectedOption.getAttribute('value') || selectedOption.textContent;
143
- this.value = selectedValue || '';
144
- this.updateSelectedOption(this.value);
145
- this.isDropdownOpen = false;
146
- this.isOnBlurInput = true;
147
- this.removeOverlay();
143
+ if (selectedOption.selectable) {
144
+ const selectedValue = selectedOption.getAttribute('value') || selectedOption.textContent;
145
+ this.value = selectedValue || '';
146
+ this.updateSelectedOption(this.value);
147
+ this.isDropdownOpen = false;
148
+ this.isOnBlurInput = true;
149
+ this.removeOverlay();
150
+ }
148
151
  }
149
152
  moveHighlight(direction) {
150
153
  const visibleOptions = this.options;
@@ -199,11 +202,16 @@ const CuraDropdownSearch = class {
199
202
  'visible': this.options.length && this.isDropdownOpen ? true : false
200
203
  };
201
204
  }
205
+ hostCSSProperties() {
206
+ return {
207
+ '--dropdown-max-height': this.dropdownMaxHeight,
208
+ };
209
+ }
202
210
  render() {
203
211
  const isMobileDropdown = this.isMobile && this.isDropdownOpen;
204
- return (index.h(index.Host, { key: 'a1bac8740f5fb4b1504e3818f893ae9939366a2f', style: this.styles, class: "dropdown-overlay" }, index.h("div", { key: '972cfac99c258a01a5ceacec4ca325e1445b4194', class: `dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`, style: this.styles }, index.h("div", { key: '7433e2335ad6639d608ca23c3b25e2ecfaf4a7d2', class: this.getClasses() }, this.isMobile && this.isDropdownOpen && (index.h("cura-button-transparent", { key: 'f9ca9af935b0c752ce27f65bfe34b9679dbd079b', fontColor: "dark", onClick: () => (this.isMobile = false), iconName: "arrowLeft", size: "medium", iconOnly: true, color: "primary" })), index.h("cura-input-text", { key: 'b75f08b2c5d6e1e68bea7e8c162bf0481eec4218', 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.isDropdownOpen = true), onClick: () => (window.innerWidth < 768 ? (this.isMobile = true) : null), onBlur: () => {
212
+ return (index.h(index.Host, { key: '993da099b8256bfb9ee7b3ebabd4860e9019d097', style: this.hostCSSProperties(), class: "dropdown-overlay" }, index.h("div", { key: '883246cc7a1020ba83a4eda4fb1f6483519314cf', class: `dropdown ${isMobileDropdown ? 'dropdown-mobile' : ''}`, style: this.styles }, index.h("div", { key: '5189508f35c5fc62883820a8c378bce8a3e67b7d', class: this.getClasses() }, this.isMobile && this.isDropdownOpen && (index.h("cura-button-transparent", { key: 'cbedd224556935a715380168c1be22d3127e920c', fontColor: "dark", onClick: () => (this.isMobile = false), iconName: "arrowLeft", size: "medium", iconOnly: true, color: "primary" })), index.h("cura-input-text", { key: 'a8dd2fe42d5bc64683ba56e7bad6b6d08ce92fca', 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.isDropdownOpen = true), onClick: () => (window.innerWidth < 768 ? (this.isMobile = true) : null), onBlur: () => {
205
213
  this.handleOnBlur();
206
- }, placeholder: this.placeholder, size: "large", onKeyDown: this.handleKeyDown }, index.h("slot", { key: 'c46ff9544d7cacd7a28291b0dcee51d1e9c4f7c7', name: "helperText" }))), index.h("div", { key: 'c6cbeffbcc00e83c4bbd51947640ae9602097563', id: "dropdown-search-list", class: this.getDropdownClasses() }, index.h("slot", { key: '735d3178c6bc3879ed96ee90e3147f083f8ac634', name: "dropdown-search-option", onSlotchange: this.handleSlotChange })))));
214
+ }, placeholder: this.placeholder, size: "large", onKeyDown: this.handleKeyDown }, index.h("slot", { key: '9991e5cfd78b73b9b2da92ae217fad3ae109a2c9', name: "helperText" }))), index.h("div", { key: '664abccc90e95b83aa3192282453d199ae2a0c5f', id: "dropdown-search-list", class: this.getDropdownClasses() }, index.h("slot", { key: '2eca99c0ec684020000edc46ebbc5f8097e78200', name: "dropdown-search-option", onSlotchange: this.handleSlotChange })))));
207
215
  }
208
216
  get host() { return index.getElement(this); }
209
217
  static get watchers() { return {
@@ -1 +1 @@
1
- {"file":"cura-dropdown-search.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,qBAAqB,GAAG,sxEAAsxE,CAAC;AACrzE,iCAAe,qBAAqB;;MCMvB,kBAAkB;;;;;QAkGrB,mBAAc,GAA0B,IAAI,CAAC;QAkE7C,qBAAgB,GAAG;YACzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACrF,IAAI,CAAC,0BAA0B,EAAE,CAAC;YAClC,IAAI,CAAC,kBAAkB,EAAE,CAAC;SAC3B,CAAC;QAiBM,sBAAiB,GAAG,CAAC,KAAY;YACvC,MAAM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EAAE,CAAC;aACrB,EACD,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,IAAI,EAAC,OAAO,EACZ,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 &-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: 630px;\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: absolute;\n top: 0;\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 * Define the status of the dropdown search.\n */\n @Prop({ reflect: true }) status: 'error' | 'default' = 'default';\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 * 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 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 }\n\n componentWillLoad() {\n this.updateSelectedOption(this.value);\n }\n\n componentDidRender() {\n console.log(this.options);\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 }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\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('click', () => 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 }\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 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 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 [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 render() {\n const isMobileDropdown = this.isMobile && this.isDropdownOpen;\n return (\n <Host style={this.styles} 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 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.isDropdownOpen = true)}\n onClick={() => (window.innerWidth < 768 ? (this.isMobile = true) : null)}\n onBlur={() => {\n this.handleOnBlur();\n }}\n placeholder={this.placeholder}\n size=\"large\"\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,wyEAAwyE,CAAC;AACv0E,iCAAe,qBAAqB;;MCMvB,kBAAkB;;;;;QAwGrB,mBAAc,GAA0B,IAAI,CAAC;QAkE7C,qBAAgB,GAAG;YACzB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,6BAA6B,CAAC,CAAC,CAAC;YACrF,I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,EACvC,OAAO,EAAE,OAAO,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,EAC3C,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,EAAC,OAAO,EACZ,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 &-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: 0;\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 * Define the status of the dropdown search.\n */\n @Prop({ reflect: true }) status: 'error' | 'default' = 'default';\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 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(this.value);\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 }\n\n disconnectedCallback() {\n window.removeEventListener('resize', this.handleResize);\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('click', () => 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 }\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 [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 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 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.isDropdownOpen = true)}\n onClick={() => (window.innerWidth < 768 ? (this.isMobile = true) : null)}\n onBlur={() => {\n this.handleOnBlur();\n }}\n placeholder={this.placeholder}\n size=\"large\"\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}
@@ -0,0 +1,46 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-98e7ba54.js');
6
+
7
+ const curaLoaderBarCss = ":host{display:block}:host .progress-bar{position:absolute;left:0;bottom:0;width:100%;height:4px;background-color:var(--neutral-base)}:host .progress-bar span{position:absolute;left:0;bottom:0;width:var(--bar-width);height:100%;border-radius:0 2px 2px 0;background-color:var(--color-base);transition:width 0.2s linear}";
8
+ const CuraLoaderBarStyle0 = curaLoaderBarCss;
9
+
10
+ const CuraLoaderBar = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.color = 'primary-base';
14
+ this.progress = 0;
15
+ this.styles = {};
16
+ }
17
+ handleChangeColor() {
18
+ this.setColor();
19
+ }
20
+ handleProgress() {
21
+ this.setProgress();
22
+ }
23
+ connectedCallback() {
24
+ this.setColor();
25
+ this.setProgress();
26
+ }
27
+ render() {
28
+ return (index.h(index.Host, { key: 'fbd3b560f2c5bc00e729300e3f2afa09690cabc8' }, index.h("div", { key: '0a728618223b33796b63768a543580b5d30e0115', id: "progress-bar", class: "progress-bar", style: this.styles }, index.h("span", { key: '06230a2ddf4bea3bef96a09814f3e0da9dde31a3', class: "progress-bar-fill" }))));
29
+ }
30
+ setColor() {
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) });
32
+ }
33
+ setProgress() {
34
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--bar-width': `${this.progress}%` });
35
+ }
36
+ get host() { return index.getElement(this); }
37
+ static get watchers() { return {
38
+ "color": ["handleChangeColor"],
39
+ "progress": ["handleProgress"]
40
+ }; }
41
+ };
42
+ CuraLoaderBar.style = CuraLoaderBarStyle0;
43
+
44
+ exports.cura_loader_bar = CuraLoaderBar;
45
+
46
+ //# sourceMappingURL=cura-loader-bar.cjs.entry.js.map
@@ -0,0 +1 @@
1
+ {"file":"cura-loader-bar.entry.cjs.js","mappings":";;;;;;AAAA,MAAM,gBAAgB,GAAG,+TAA+T,CAAC;AACzV,4BAAe,gBAAgB;;MCMlB,aAAa;;;qBAGR,cAAc;wBACX,CAAC;sBAEF,EAAE;;IAGpB,iBAAiB;QACf,IAAI,CAAC,QAAQ,EAAE,CAAC;KACjB;IAGD,cAAc;QACZ,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;IAED,iBAAiB;QACf,IAAI,CAAC,QAAQ,EAAE,CAAC;QAChB,IAAI,CAAC,WAAW,EAAE,CAAC;KACpB;IAED,MAAM;QACJ,QACEA,QAACC,UAAI,uDACHD,kEAAK,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,cAAc,EAAC,KAAK,EAAE,IAAI,CAAC,MAAM,IAC5DA,mEAAM,KAAK,EAAC,mBAAmB,GAAQ,CACnC,CACD,EACP;KACH;IAED,QAAQ;QACN,IAAI,CAAC,MAAM,mCACN,IAAI,CAAC,MAAM,KACd,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,EAC3E,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GACjE,CAAA;KACF;IAED,WAAW;QACT,IAAI,CAAC,MAAM,mCACN,IAAI,CAAC,MAAM,KACd,aAAa,EAAE,GAAG,IAAI,CAAC,QAAQ,GAAG,GACnC,CAAA;KACF;;;;;;;;;;;","names":["h","Host"],"sources":["src/components/loaders/cura-loader-bar/cura-loader-bar.scss?tag=cura-loader-bar&encapsulation=shadow","src/components/loaders/cura-loader-bar/cura-loader-bar.tsx"],"sourcesContent":[":host {\n display: block;\n\n .progress-bar {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n height: 4px;\n background-color: var(--neutral-base);\n\n span {\n position: absolute;\n left: 0;\n bottom: 0;\n width: var(--bar-width);\n height: 100%;\n border-radius: 0 2px 2px 0;\n background-color: var(--color-base);\n transition: width 0.2s linear;\n }\n }\n}\n","import { Component, Element, Host, Prop, State, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cura-loader-bar',\n styleUrl: 'cura-loader-bar.scss',\n shadow: true,\n})\nexport class CuraLoaderBar {\n @Element() host: HTMLElement;\n\n @Prop() color = 'primary-base';\n @Prop() progress = 0;\n\n @State() styles = {};\n\n @Watch('color')\n handleChangeColor() {\n this.setColor();\n }\n\n @Watch('progress')\n handleProgress() {\n this.setProgress();\n }\n\n connectedCallback() {\n this.setColor();\n this.setProgress();\n }\n \n render() {\n return (\n <Host>\n <div id=\"progress-bar\" class=\"progress-bar\" style={this.styles}>\n <span class=\"progress-bar-fill\"></span>\n </div>\n </Host>\n );\n }\n\n setColor() {\n this.styles = {\n ...this.styles,\n '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2),\n '--color-base': window.CuraAPI.theme.colors.getColor(this.color),\n }\n }\n\n setProgress() {\n this.styles = {\n ...this.styles,\n '--bar-width': `${this.progress}%`,\n }\n }\n}\n"],"version":3}
@@ -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: '8f28f0ad3ec32f97cd39f5c574f7c779b326c3c0' }, index.h("div", { key: 'd94d37293c9165c13e082bbc7f78e7b35606147d', class: this.getClasses(), style: this.styles }, index.h("div", { key: 'fd743a9a24a22e59d0f9066d65dbe3c5b21c57b7', class: "info" }, index.h("div", { key: '080b345ff308b6cb0fbf1913aa6a1c872e3c325c', class: "label-wrapper" }, index.h("cura-label", { key: '9c0f0d376470b12273a359c65a91954cfa96b1a9', class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: '117eaafe86a8c2f6b190a7cefaaf2d882d658940', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: '162ba073fc2722b4f1c2a3e8cfa42ae1940b4c99', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: '453713a040379257a9be7c9cd327ffbd8ad3affb' }))), index.h("input", { key: '19ad607763975886902d6e88fd44bf3e1da75c8a', 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: 'cd50b6a8c2b43e7ddfc44c2a2d634118e8c8180c' }, index.h("div", { key: '0ab58b0b1e0561cfbe5801167873d3f1f6b8b48d', class: this.getClasses(), style: this.styles }, index.h("div", { key: '24399f088f99dd08696b8421140c64765b7ae82f', class: "info" }, index.h("div", { key: '5fa201595808fd9aede224943fd37cfe8972b51e', class: "label-wrapper" }, index.h("cura-label", { key: '58f5d8d6f176a1519458c30fbbf0f11bc11b72c1', class: "label", size: this.size === 'large' ? 'medium' : 'xsmall', color: this.assignColor('label') }, this.label), this.required && index.h("cura-paragraph", { key: 'ce96f49de0925ca3739640acadd25bb8d9fbbd26', lineHeight: '0%', marginBlock: '0', color: "error-base" }, "* ")), index.h("cura-label", { key: 'b2188df747035a27bae0ad5206ac48ef31320268', color: this.assignColor('message'), size: "xsmall", class: "message" }, index.h("slot", { key: '215226214804fe80e0b049224a590411ddd1f01e' }))), index.h("input", { key: 'd3fc5b35a27e44f9d8e5f5ab9f9c348ef7bc8bb9', 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); }
@@ -259,13 +259,13 @@ const CuraSelect = class {
259
259
  return (index.h("cura-icon", { class: 'feedback-icon', name: icon, iconset: 'default', size: this.size === 'large' ? 20 : 16, color: this.getColor('icon'), style: this.styles }));
260
260
  }
261
261
  render() {
262
- return (index.h(index.Host, { key: '25024f752db0a0189ece93612e54a43b47668efd', style: this.styles }, index.h("div", { key: 'eae2f00129bb2d82fa1586ce7f6e2e4bb71b20de', class: this.getClasses(), tabIndex: 0, ref: (el) => (this.selectRef = el), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onKeyDown: this.handleKeyDown, onClick: this.handleClick }, this.label && (index.h("cura-label", { key: '0ac1eb8e18c97432a2c46e35dc04fce4d2dc640a', class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && index.h("span", { key: '09e8e758d595c641afbb7729847bc6e123ecd869', class: 'required' }, "* "))), index.h("div", { key: '2248ebad1ab820689635db06db8725d39118b04b', class: {
262
+ return (index.h(index.Host, { key: '35fd5d99705c940578485552a50bcec54efe036e', style: this.styles }, index.h("div", { key: '1903a7b03e32215678670a2d7d8b49643cc2086b', class: this.getClasses(), tabIndex: 0, ref: (el) => (this.selectRef = el), onMouseEnter: () => (this.isHovered = true), onMouseLeave: () => (this.isHovered = false), onKeyDown: this.handleKeyDown, onClick: this.handleClick }, this.label && (index.h("cura-label", { key: '99aeba22f4b6204d936b6a9dcf6affa29e9411a8', class: 'label', weight: 'bold', size: this.size === 'large' ? 'small' : 'xsmall', color: this.getColor('label') }, this.label, " ", this.required && index.h("span", { key: '7e335f6fdb0ee6d9e987fba8ec245006f02761b5', class: 'required' }, "* "))), index.h("div", { key: 'c9ba61c15951f6689724025778fe8a933ab5b9bd', class: {
263
263
  'cura-input-field': true,
264
264
  'open': this.isOpen
265
- } }, this.renderIcon(), index.h("input", { key: 'ea3909b76182006256055be075a446a8cb2813af', tabIndex: 0, type: "text", autocomplete: 'off', onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value }), index.h("cura-icon", { key: '13a28271273b9a96e39cb62ca91e6769ea33ee43', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: 'default' })), index.h("cura-label", { key: 'fb1802d14cf6099e0ddf71f0623c1f0ffba6747c', class: "helper-text", size: 'xsmall', color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, index.h("slot", { key: '2c257fd28f5c560dd66fe9f73c2fb3c165174efa' })), this.isOpen && (index.h("div", { key: '36dbd0fa457f7d1ec9c771dafc7491a821267812', class: {
265
+ } }, this.renderIcon(), index.h("input", { key: '0c1369e661fc6e34c8bf75f5ef4b977e749dc0b5', tabIndex: 0, type: "text", autocomplete: 'off', onFocus: () => (this.isFocused = true), onBlur: () => (this.isFocused = false), "aria-required": String(this.required), "aria-disabled": String(this.disabled), "aria-invalid": String(this.status === 'error'), onInput: this.handleInputChange, style: this.styles, placeholder: this.placeholder, disabled: this.disabled, required: this.required, value: this.value }), index.h("cura-icon", { key: '95b5105660bcfc0c1562955449a1fc737048e8c2', name: this.isOpen ? 'up' : 'down', class: "up-down-icon", color: this.disabled ? 'neutral-dark' : 'primary-base', size: 16, iconset: 'default' })), index.h("cura-label", { key: 'b5565e686989fe0c1e62f6c01fef52b2829bf4f5', class: "helper-text", size: 'xsmall', color: this.getColor('text'), weight: this.mode === 'transparent' ? 'bold' : 'regular' }, index.h("slot", { key: '4a265609d8742b7e736920d54525cb2405785ea6' })), this.isOpen && (index.h("div", { key: '8f0609c7c2e709506ea4bdeeebdb1aae8abde1df', class: {
266
266
  'menu': true,
267
267
  'open': this.isOpen
268
- } }, index.h("slot", { key: 'f8d751989092e50820cb7b71903eef743f672a6b', name: 'option' }))))));
268
+ } }, index.h("slot", { key: 'b6f84b885909ea1a9213cb3d590a02d736320228', name: 'option' }))))));
269
269
  }
270
270
  static get formAssociated() { return true; }
271
271
  get host() { return index.getElement(this); }
@@ -310,7 +310,7 @@ const CuraSelectOption = class {
310
310
  };
311
311
  }
312
312
  render() {
313
- return (index.h(index.Host, { key: '9eb6b609efeb50130efd27c20bc7a42441687ce7', slot: "option" }, index.h("div", { key: 'f72ff1ec9f5b5a579152b09e7a02496be5ab944b', class: this.getClasses(), style: this.styles }, index.h("cura-label", { key: '0b45ade14ca8ad351a696ec6bad4349eadec38f1', color: `${this.selected ? 'primary-base' : 'neutral-black'}`, size: this.getSize('label'), "margin-block": "0" }, index.h("slot", { key: '2015c43b9b1686fdef5f0369a91ce376327e5d7f' })), this.selected && index.h("cura-icon", { key: '9ee481f8ee3e586bd629559e90acf30976711059', name: 'check', size: this.getSize('icon'), color: "primary-base" }))));
313
+ return (index.h(index.Host, { key: '231c03411af0a5639358ff232e4a81287a8571f0', slot: "option" }, index.h("div", { key: 'b5baa8f7c4a4e863b96ffda1454a8c339d4b2656', class: this.getClasses(), style: this.styles }, index.h("cura-label", { key: '36d3381260263303242c443004f7e201c2683d4e', color: `${this.selected ? 'primary-base' : 'neutral-black'}`, size: this.getSize('label'), "margin-block": "0" }, index.h("slot", { key: 'cc72fed8c51592c8fd076d091272879c7572a181' })), this.selected && index.h("cura-icon", { key: 'e118108f84d49b3d6574a143f09b2c43d43d11a8', name: 'check', size: this.getSize('icon'), color: "primary-base" }))));
314
314
  }
315
315
  get host() { return index.getElement(this); }
316
316
  static get watchers() { return {
@@ -109,7 +109,7 @@ const CuraSwitch = class {
109
109
  return classes;
110
110
  }
111
111
  render() {
112
- return (index.h(index.Host, { key: 'e0040434db080b1ccdb12a1389ca028f5c02f66a' }, index.h("div", { key: '6008f7aef47e0519e965c2be573dc1eacc001b6c', class: this.getClasses(), style: this.styles }, index.h("div", { key: 'a954404dce1c7eafd79cb3236e8761a3dc29f86e', class: "info" }, index.h("cura-label", { key: '6ff5cc1f26abad0f173c4e1330aaae43357b7737', 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: 'b82e4cb25ef94481642e1d5a2180eb4e12b8eff8', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, index.h("slot", { key: '243e906253614d9ce837e0c598b259ad7c87afb4' }))), index.h("div", { key: '36d0165722a6fae98ca829a5a2e89edef3694ff2', onClick: this.toggleSwitch, class: "control" }, index.h("div", { key: 'f9c0c7cbc84b655e37e7e8df1c2293c1260445ca', class: `track ${this.size.toLowerCase()}` }, index.h("div", { key: 'e5ca4006ad41a6cbf8d62ca612b52ef26fb7255f', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
112
+ return (index.h(index.Host, { key: '2ccbfc3c5aae5ec8be3f879541b7cbcf203b62a9' }, index.h("div", { key: '2acacb0bab31f8736155dc764a6e3d57508f7a48', class: this.getClasses(), style: this.styles }, index.h("div", { key: '16c7cfedbd029d4e481cb2c3268690d594962ff3', class: "info" }, index.h("cura-label", { key: '24ed0fd9a9c0ebacc52407319b16a202f2defc96', 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: '4a84fb18a2fd43c623cb9aa9e9573482a22f6372', style: { textAlign: this.position === 'right' ? 'right' : 'left' }, color: this.assignColor('primary-lighter', 'neutral-dark'), size: "xsmall", class: "message" }, index.h("slot", { key: '0ec0427dee691d224daa58db943c07d906d08dd0' }))), index.h("div", { key: '5b4a04200b4880474b693e605ba3e8671a3bd980', onClick: this.toggleSwitch, class: "control" }, index.h("div", { key: '2e3e764a87d57edc520f9d56b980d80d455d8d74', class: `track ${this.size.toLowerCase()}` }, index.h("div", { key: '36b9da57ea3b95e419d7bb0b5ad4f24d7acd1b63', class: `thumb ${this.size.toLowerCase()}`, tabIndex: this.ontabindex }))))));
113
113
  }
114
114
  static get formAssociated() { return true; }
115
115
  static get watchers() { return {
@@ -0,0 +1,106 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-98e7ba54.js');
6
+
7
+ const curaToastCss = ":host{display:block;box-sizing:border-box}:host .container{position:fixed;display:flex;box-sizing:border-box;min-width:328px;height:fit-content;padding:16px;border:1px solid var(--color-base);border-radius:12px;background-color:var(--neutral-purewhite);overflow:hidden;box-shadow:0px 8px 16px 0px var(--neutral-black-shadow-4, rgba(38, 38, 38, 0.12))}:host .container.loader{padding:16px 16px 20px}:host .container.top{top:24px}:host .container.top.center{top:-100%;left:50%;transform:translateX(-50%);opacity:0;transition:opacity 0.5s ease-in-out, top 0.5s ease-in-out}:host .container.top.center.active{top:24px;opacity:1}:host .container.bottom{bottom:24px}:host .container.bottom.center{bottom:-100%;left:50%;transform:translateX(-50%);opacity:0;transition:opacity 0.5s ease-in-out, bottom 0.5s ease-in-out}:host .container.bottom.center.active{bottom:24px;opacity:1}:host .container.left{left:-100%;opacity:0;transition:opacity 0.5s ease-in-out, left 0.5s ease-in-out}@media (max-width: 768px){:host .container.left{right:unset;left:50%;transform:translateX(-50%)}}:host .container.left.active{left:24px;opacity:1}:host .container.right{right:-100%;opacity:0;transition:opacity 0.5s ease-in-out, right 0.5s ease-in-out}@media (max-width: 768px){:host .container.right{right:unset;left:50%;transform:translateX(-50%)}}:host .container.right.active{right:24px;opacity:1}:host .container .content{flex:1 1 0;display:flex;flex-direction:column;gap:4px}:host .container .default-icon{margin-right:12px}:host .container .close-icon{margin-left:12px;cursor:pointer}";
8
+ const CuraToastStyle0 = curaToastCss;
9
+
10
+ const CuraToast = class {
11
+ constructor(hostRef) {
12
+ index.registerInstance(this, hostRef);
13
+ this.close = index.createEvent(this, "close", 7);
14
+ this.handleClose = () => {
15
+ this.close.emit();
16
+ this.closeContainer();
17
+ };
18
+ this.type = 'info';
19
+ this.position = 'top-right';
20
+ this.icon = undefined;
21
+ this.label = undefined;
22
+ this.closeButton = true;
23
+ this.loader = true;
24
+ this.autoCloseDelay = 10000;
25
+ this.styles = {};
26
+ this.progress = 0;
27
+ }
28
+ handleChangeType() {
29
+ this.setStyle();
30
+ }
31
+ connectedCallback() {
32
+ this.setStyle();
33
+ }
34
+ render() {
35
+ return (index.h(index.Host, { key: '8a49bdd99528c7b50b1b8a0de6ee0d985ffd5a11' }, index.h("div", { key: '6e560327e729ecb9fc9e6c081cc4d3b1131f892c', class: this.getClasses(), style: this.styles }, index.h("cura-icon", { key: '25efc30bc808e9f04be780ddf5bdc7edc3e56725', class: "default-icon", name: this.getNameIcon(), size: 16, color: `${this.type}-dark` }), index.h("div", { key: 'b1cbab08ae6845f8f544d4497b786fdfae645b72', class: "content" }, index.h("cura-heading", { key: '6d64c4fc8c43862f8fc5dba886b34a904a81208d', level: 4, size: "xsmall", color: `${this.type}-dark`, weight: "bold", "margin-block": "0" }, this.label), index.h("cura-paragraph", { key: 'fa990a332ca8caf8b110b643b39c44a17bb8de67', color: `${this.type}-darker`, size: "xsmall", marginBlock: "0", lineHeight: "133.33%" }, index.h("slot", { key: 'ec9ab2abe06b0d67ea71725abe3a02aca1a736c6' })), index.h("slot", { key: 'dc08874d1145bb7e62cac9081014d17ad0095f53', name: "actions" })), this.closeButton && index.h("cura-icon", { key: '3f22011909ed7074962a2ccec8ffe05bb9b01feb', class: "close-icon", name: "close", size: 16, color: "error-dark", onClick: this.handleClose }), this.loader && !!this.autoCloseDelay && index.h("cura-loader-bar", { key: '2e4168859d19170702a690bed3a20d28029cf7dc', color: `${this.type}-base`, progress: this.progress }))));
36
+ }
37
+ componentDidLoad() {
38
+ this.openContainer();
39
+ this.startAnimation();
40
+ }
41
+ setStyle() {
42
+ this.styles = Object.assign(Object.assign({}, this.styles), { '--neutral-purewhite': window.CuraAPI.theme.colors.getColor(`neutral-purewhite`), '--neutral-base': window.CuraAPI.theme.colors.getColor(`neutral-base`, 0.2), '--primary-base': window.CuraAPI.theme.colors.getColor(`primary-base`), '--color-base': window.CuraAPI.theme.colors.getColor(`${this.type}-base`) });
43
+ }
44
+ getClasses() {
45
+ const [firstPosition, secondPosition] = this.position.split('-');
46
+ const classes = {};
47
+ classes['container'] = true;
48
+ classes[firstPosition] = true;
49
+ classes[secondPosition] = true;
50
+ if (this.loader) {
51
+ classes['loader'] = true;
52
+ }
53
+ return classes;
54
+ }
55
+ getNameIcon() {
56
+ const iconMapping = {
57
+ info: 'infoCircle',
58
+ success: 'checkCircle',
59
+ warning: 'alertCircle',
60
+ error: 'alertTriangle',
61
+ };
62
+ return this.icon ? this.icon : iconMapping[this.type];
63
+ }
64
+ openContainer() {
65
+ this.container = this.host.shadowRoot.querySelector('.container');
66
+ this.container.classList.add('active');
67
+ }
68
+ closeContainer() {
69
+ this.container.classList.remove('active');
70
+ setTimeout(() => {
71
+ this.host.remove();
72
+ }, 500);
73
+ }
74
+ startAnimation() {
75
+ if (!!this.autoCloseDelay) {
76
+ if (this.loader) {
77
+ this.progress = 0;
78
+ let intervalId = setInterval(() => {
79
+ if (this.progress >= 100) {
80
+ clearInterval(intervalId);
81
+ this.closeContainer();
82
+ }
83
+ else {
84
+ this.progress++;
85
+ }
86
+ }, this.autoCloseDelay / 100);
87
+ }
88
+ else {
89
+ let intervalId = setInterval(() => {
90
+ clearInterval(intervalId);
91
+ this.closeContainer();
92
+ }, this.autoCloseDelay);
93
+ }
94
+ }
95
+ }
96
+ get host() { return index.getElement(this); }
97
+ static get watchers() { return {
98
+ "type": ["handleChangeType"],
99
+ "position": ["handleChangeType"]
100
+ }; }
101
+ };
102
+ CuraToast.style = CuraToastStyle0;
103
+
104
+ exports.cura_toast = CuraToast;
105
+
106
+ //# sourceMappingURL=cura-toast.cjs.entry.js.map