@usecapsule/core-components 3.2.0 → 3.3.1-dev.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (200) hide show
  1. package/css/capsule-core.css +25 -10
  2. package/css/capsule-core.css.map +1 -1
  3. package/dist/capsule/capsule.esm.js +1 -1
  4. package/dist/capsule/capsule.esm.js.map +1 -1
  5. package/dist/capsule/index.esm.js +1 -1
  6. package/dist/capsule/index.esm.js.map +1 -1
  7. package/dist/capsule/p-0e558c7f.entry.js +10 -0
  8. package/dist/capsule/{p-05cb769b.entry.js.map → p-0e558c7f.entry.js.map} +1 -1
  9. package/dist/capsule/{p-dc4591d5.entry.js → p-1bd11889.entry.js} +2 -2
  10. package/dist/capsule/p-1bd11889.entry.js.map +1 -0
  11. package/dist/capsule/p-32cdf894.entry.js +2 -0
  12. package/dist/capsule/p-32cdf894.entry.js.map +1 -0
  13. package/dist/capsule/p-3b042fd1.entry.js +2 -0
  14. package/dist/capsule/p-5965b15e.entry.js +2 -0
  15. package/dist/capsule/{p-c1aa1ffb.entry.js.map → p-5965b15e.entry.js.map} +1 -1
  16. package/dist/capsule/{p-742bda0b.entry.js → p-5d62e610.entry.js} +2 -2
  17. package/dist/capsule/p-60508b1e.entry.js +20 -0
  18. package/dist/capsule/p-60508b1e.entry.js.map +1 -0
  19. package/dist/cjs/capsule.cjs.js +1 -1
  20. package/dist/cjs/{cpsl-alert_33.cjs.entry.js → cpsl-alert_34.cjs.entry.js} +17025 -13458
  21. package/dist/cjs/cpsl-alert_34.cjs.entry.js.map +1 -0
  22. package/dist/cjs/cpsl-animation.cjs.entry.js +3 -2
  23. package/dist/cjs/cpsl-animation.cjs.entry.js.map +1 -1
  24. package/dist/cjs/cpsl-hero.cjs.entry.js +9 -6
  25. package/dist/cjs/cpsl-hero.cjs.entry.js.map +1 -1
  26. package/dist/cjs/cpsl-identicon.cjs.entry.js +1 -1
  27. package/dist/cjs/cpsl-info-box.cjs.entry.js +2 -2
  28. package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -1
  29. package/dist/cjs/cpsl-modal-v2.cjs.entry.js +1 -1
  30. package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -1
  31. package/dist/cjs/cpsl-row.cjs.entry.js +1 -1
  32. package/dist/cjs/index-65f57499.js +2 -2
  33. package/dist/cjs/index.cjs.js +40 -17
  34. package/dist/cjs/index.cjs.js.map +1 -1
  35. package/dist/cjs/loader.cjs.js +1 -1
  36. package/dist/collection/assets/icons/arrow-circle-broken-down-left.svg +3 -0
  37. package/dist/collection/assets/icons/bank.svg +3 -0
  38. package/dist/collection/assets/icons/credit-card.svg +3 -0
  39. package/dist/collection/assets/icons/dot.svg +3 -0
  40. package/dist/collection/assets/icons/download.svg +3 -0
  41. package/dist/collection/assets/icons/globe.svg +3 -0
  42. package/dist/collection/assets/icons/hero-alert-circle.svg +3 -0
  43. package/dist/collection/assets/icons/hero-checkmark-capsule.svg +11 -0
  44. package/dist/collection/assets/icons/hero-checkmark.svg +3 -0
  45. package/dist/collection/assets/icons/hero-external-connection.svg +71 -0
  46. package/dist/collection/assets/icons/index.js +21 -1
  47. package/dist/collection/assets/icons/index.js.map +1 -1
  48. package/dist/collection/assets/icons/link-external.svg +3 -0
  49. package/dist/collection/assets/icons/log-out.svg +3 -0
  50. package/dist/collection/assets/icons/moonpay-brand.svg +10 -0
  51. package/dist/collection/assets/icons/puzzle-piece.svg +3 -0
  52. package/dist/collection/assets/icons/qr-code-02.svg +3 -0
  53. package/dist/collection/assets/icons/qr-code.svg +3 -0
  54. package/dist/collection/assets/icons/refresh.svg +3 -3
  55. package/dist/collection/assets/icons/search.svg +3 -0
  56. package/dist/collection/assets/icons/send.svg +3 -0
  57. package/dist/collection/assets/icons/shield.svg +3 -0
  58. package/dist/collection/assets/icons/stripe-brand.svg +3 -0
  59. package/dist/collection/collection-manifest.json +2 -1
  60. package/dist/collection/components/cpsl-alert/cpsl-alert.js +3 -3
  61. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
  62. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +3 -3
  63. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
  64. package/dist/collection/components/{cpsl-modal/cpsl-modal.css → cpsl-auth-modal/cpsl-auth-modal.css} +33 -58
  65. package/dist/collection/components/{cpsl-modal/cpsl-modal.js → cpsl-auth-modal/cpsl-auth-modal.js} +13 -131
  66. package/dist/collection/components/cpsl-auth-modal/cpsl-auth-modal.js.map +1 -0
  67. package/dist/collection/components/cpsl-button/cpsl-button.css +89 -2
  68. package/dist/collection/components/cpsl-button/cpsl-button.js +6 -5
  69. package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
  70. package/dist/collection/components/cpsl-button/cpsl-button.stories.js.map +1 -1
  71. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +2 -2
  72. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js.map +1 -1
  73. package/dist/collection/components/cpsl-card/cpsl-card.css +5 -2
  74. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +3 -0
  75. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +11 -7
  76. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
  77. package/dist/collection/components/cpsl-divider/cpsl-divider.css +2 -1
  78. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +2 -2
  79. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
  80. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +2 -2
  81. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
  82. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +5 -10
  83. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -1
  84. package/dist/collection/components/cpsl-hero/cpsl-hero.css +136 -71
  85. package/dist/collection/components/cpsl-hero/cpsl-hero.js +63 -9
  86. package/dist/collection/components/cpsl-hero/cpsl-hero.js.map +1 -1
  87. package/dist/collection/components/cpsl-icon/cpsl-icon.css +8 -0
  88. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  89. package/dist/collection/components/cpsl-icon/cpsl-icon.js.map +1 -1
  90. package/dist/collection/components/cpsl-icon-group/cpsl-icon-group.css +97 -0
  91. package/dist/collection/components/cpsl-icon-group/cpsl-icon-group.js +121 -0
  92. package/dist/collection/components/cpsl-icon-group/cpsl-icon-group.js.map +1 -0
  93. package/dist/collection/components/cpsl-identicon/cpsl-identicon.js +1 -1
  94. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -2
  95. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  96. package/dist/collection/components/cpsl-input/cpsl-input.css +21 -2
  97. package/dist/collection/components/cpsl-input/cpsl-input.js +100 -28
  98. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  99. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +1 -1
  100. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -1
  101. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +2 -2
  102. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js.map +1 -1
  103. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  104. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +1 -1
  105. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
  106. package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
  107. package/dist/collection/components/cpsl-popover/cpsl-popover.css +2 -0
  108. package/dist/collection/components/cpsl-popover/cpsl-popover.js +12 -14
  109. package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -1
  110. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +12 -3
  111. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +28 -23
  112. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js.map +1 -1
  113. package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
  114. package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
  115. package/dist/collection/components/cpsl-select/cpsl-select.css +17 -0
  116. package/dist/collection/components/cpsl-select/cpsl-select.js +96 -6
  117. package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -1
  118. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +1 -1
  119. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js.map +1 -1
  120. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
  121. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +1 -1
  122. package/dist/collection/components/cpsl-spinner/cpsl-spinner.css +30 -8
  123. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +5 -7
  124. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js.map +1 -1
  125. package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
  126. package/dist/collection/components/cpsl-tab/cpsl-tab.css +24 -1
  127. package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
  128. package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +1 -1
  129. package/dist/collection/components/cpsl-table/cpsl-table.js +1 -9
  130. package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
  131. package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +1 -4
  132. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +2 -5
  133. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +1 -1
  134. package/dist/collection/components/cpsl-text/cpsl-text.css +19 -0
  135. package/dist/collection/components/cpsl-text/cpsl-text.js +5 -4
  136. package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
  137. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +3 -1
  138. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
  139. package/dist/collection/interface.js.map +1 -1
  140. package/dist/collection/utils/theme/generateBorderRadii.js +5 -4
  141. package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
  142. package/dist/collection/utils/theme/generateFont.js +1 -1
  143. package/dist/collection/utils/theme/generateFont.js.map +1 -1
  144. package/dist/collection/utils/theme/generatePalette.js +25 -9
  145. package/dist/collection/utils/theme/generatePalette.js.map +1 -1
  146. package/dist/collection/utils/theme/generateTheme.js +9 -3
  147. package/dist/collection/utils/theme/generateTheme.js.map +1 -1
  148. package/dist/collection/utils/theme/utils.js.map +1 -1
  149. package/dist/esm/capsule.js +1 -1
  150. package/dist/esm/{cpsl-alert_33.entry.js → cpsl-alert_34.entry.js} +17026 -13460
  151. package/dist/esm/cpsl-alert_34.entry.js.map +1 -0
  152. package/dist/esm/cpsl-animation.entry.js +2 -1
  153. package/dist/esm/cpsl-animation.entry.js.map +1 -1
  154. package/dist/esm/cpsl-hero.entry.js +10 -7
  155. package/dist/esm/cpsl-hero.entry.js.map +1 -1
  156. package/dist/esm/cpsl-identicon.entry.js +1 -1
  157. package/dist/esm/cpsl-info-box.entry.js +2 -2
  158. package/dist/esm/cpsl-info-box.entry.js.map +1 -1
  159. package/dist/esm/cpsl-modal-v2.entry.js +1 -1
  160. package/dist/esm/cpsl-modal-v2.entry.js.map +1 -1
  161. package/dist/esm/cpsl-row.entry.js +1 -1
  162. package/dist/esm/index-91db3414.js +2 -2
  163. package/dist/esm/index.js +40 -17
  164. package/dist/esm/index.js.map +1 -1
  165. package/dist/esm/loader.js +1 -1
  166. package/dist/types/assets/icons/index.d.ts +20 -0
  167. package/dist/types/components/{cpsl-modal/cpsl-modal.d.ts → cpsl-auth-modal/cpsl-auth-modal.d.ts} +3 -23
  168. package/dist/types/components/cpsl-button/cpsl-button.d.ts +2 -2
  169. package/dist/types/components/cpsl-hero/cpsl-hero.d.ts +18 -3
  170. package/dist/types/components/cpsl-icon-group/cpsl-icon-group.d.ts +20 -0
  171. package/dist/types/components/cpsl-input/cpsl-input.d.ts +13 -3
  172. package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +2 -2
  173. package/dist/types/components/cpsl-qr-code/cpsl-qr-code.d.ts +1 -0
  174. package/dist/types/components/cpsl-select/cpsl-select.d.ts +22 -1
  175. package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
  176. package/dist/types/components.d.ts +222 -146
  177. package/dist/types/interface.d.ts +13 -0
  178. package/dist/types/utils/theme/generateBorderRadii.d.ts +1 -1
  179. package/dist/types/utils/theme/generatePalette.d.ts +4 -2
  180. package/dist/types/utils/theme/generateTheme.d.ts +1 -1
  181. package/package.json +4 -3
  182. package/dist/capsule/p-0462f723.js +0 -2
  183. package/dist/capsule/p-0462f723.js.map +0 -1
  184. package/dist/capsule/p-05cb769b.entry.js +0 -10
  185. package/dist/capsule/p-0eea90f8.entry.js +0 -2
  186. package/dist/capsule/p-7233228e.entry.js +0 -29
  187. package/dist/capsule/p-7233228e.entry.js.map +0 -1
  188. package/dist/capsule/p-c1aa1ffb.entry.js +0 -2
  189. package/dist/capsule/p-d351f076.entry.js +0 -2
  190. package/dist/capsule/p-d351f076.entry.js.map +0 -1
  191. package/dist/capsule/p-dc4591d5.entry.js.map +0 -1
  192. package/dist/cjs/_commonjsHelpers-b3309d7b.js +0 -12
  193. package/dist/cjs/_commonjsHelpers-b3309d7b.js.map +0 -1
  194. package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +0 -1
  195. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +0 -1
  196. package/dist/esm/_commonjsHelpers-1789f0cf.js +0 -9
  197. package/dist/esm/_commonjsHelpers-1789f0cf.js.map +0 -1
  198. package/dist/esm/cpsl-alert_33.entry.js.map +0 -1
  199. /package/dist/capsule/{p-0eea90f8.entry.js.map → p-3b042fd1.entry.js.map} +0 -0
  200. /package/dist/capsule/{p-742bda0b.entry.js.map → p-5d62e610.entry.js.map} +0 -0
@@ -20,7 +20,7 @@ export class CpslNavButtonGroup {
20
20
  item.setAttribute('full-width', 'true');
21
21
  this.selectItem();
22
22
  });
23
- if (Boolean((_a = this.otherSlots) === null || _a === void 0 ? void 0 : _a.length)) {
23
+ if ((_a = this.otherSlots) === null || _a === void 0 ? void 0 : _a.length) {
24
24
  console.error('cpsl-button is the only valid child of cpsl-nav-button-group');
25
25
  this.otherSlots.forEach(item => item.remove());
26
26
  }
@@ -32,7 +32,7 @@ export class CpslNavButtonGroup {
32
32
  return this.el.querySelectorAll('&> *:not(cpsl-button)');
33
33
  }
34
34
  render() {
35
- return (h(Host, { key: 'b9d10d5d01a10dc63887d524468096b3741b1df8' }, h("slot", { key: 'b27f6cdf9b85fff82445dba96732e9644a3d597b' })));
35
+ return (h(Host, { key: '9bd4edd8429e52b060d64fc5cf707c3ee3c26dd4' }, h("slot", { key: 'c035504b8795331c35de8bacab0b252ad4facc0d' })));
36
36
  }
37
37
  static get is() { return "cpsl-nav-button-group"; }
38
38
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"cpsl-nav-button-group.js","sourceRoot":"","sources":["../../../../src/components/cpsl-nav-button-group/cpsl-nav-button-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOzE,MAAM,OAAO,kBAAkB;;;;IAS7B,UAAU;QACR,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB;;QACjB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;QAEH,IAAI,OAAO,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,MAAM,CAAC,EAAE,CAAC;YACrC,OAAO,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;YAC9E,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Element, Prop, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cpsl-nav-button-group',\n styleUrl: 'cpsl-nav-button-group.scss',\n shadow: true,\n})\nexport class CpslNavButtonGroup {\n @Element() el!: HTMLCpslNavButtonGroupElement;\n\n /**\n * The id of the selected button.\n */\n @Prop() selectedId?: string;\n\n @Watch('selectedId')\n selectItem() {\n this.buttonSlots.forEach(item => {\n if (item.id === this.selectedId) {\n item.classList.add('selected');\n } else {\n item.classList.remove('selected');\n }\n });\n }\n\n componentWillRender() {\n this.buttonSlots.forEach(item => {\n item.setAttribute('variant', 'primary');\n item.setAttribute('full-width', 'true');\n this.selectItem();\n });\n\n if (Boolean(this.otherSlots?.length)) {\n console.error('cpsl-button is the only valid child of cpsl-nav-button-group');\n this.otherSlots.forEach(item => item.remove());\n }\n }\n\n private get buttonSlots() {\n return this.el.querySelectorAll('cpsl-button');\n }\n\n private get otherSlots() {\n return this.el.querySelectorAll('&> *:not(cpsl-button)');\n }\n render() {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cpsl-nav-button-group.js","sourceRoot":"","sources":["../../../../src/components/cpsl-nav-button-group/cpsl-nav-button-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAOzE,MAAM,OAAO,kBAAkB;;;;IAS7B,UAAU;QACR,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE,CAAC;gBAChC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACjC,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,mBAAmB;;QACjB,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YAC9B,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;YACxC,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC,CAAC,CAAC;QAEH,IAAI,MAAA,IAAI,CAAC,UAAU,0CAAE,MAAM,EAAE,CAAC;YAC5B,OAAO,CAAC,KAAK,CAAC,8DAA8D,CAAC,CAAC;YAC9E,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC;IAED,IAAY,UAAU;QACpB,OAAO,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,uBAAuB,CAAC,CAAC;IAC3D,CAAC;IACD,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Element, Prop, Watch, h } from '@stencil/core';\n\n@Component({\n tag: 'cpsl-nav-button-group',\n styleUrl: 'cpsl-nav-button-group.scss',\n shadow: true,\n})\nexport class CpslNavButtonGroup {\n @Element() el!: HTMLCpslNavButtonGroupElement;\n\n /**\n * The id of the selected button.\n */\n @Prop() selectedId?: string;\n\n @Watch('selectedId')\n selectItem() {\n this.buttonSlots.forEach(item => {\n if (item.id === this.selectedId) {\n item.classList.add('selected');\n } else {\n item.classList.remove('selected');\n }\n });\n }\n\n componentWillRender() {\n this.buttonSlots.forEach(item => {\n item.setAttribute('variant', 'primary');\n item.setAttribute('full-width', 'true');\n this.selectItem();\n });\n\n if (this.otherSlots?.length) {\n console.error('cpsl-button is the only valid child of cpsl-nav-button-group');\n this.otherSlots.forEach(item => item.remove());\n }\n }\n\n private get buttonSlots() {\n return this.el.querySelectorAll('cpsl-button');\n }\n\n private get otherSlots() {\n return this.el.querySelectorAll('&> *:not(cpsl-button)');\n }\n render() {\n return (\n <Host>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
@@ -28,7 +28,7 @@ export class CpslOverlay {
28
28
  }
29
29
  }
30
30
  render() {
31
- return (h(Host, { key: 'c8eac44811db97343f9bfa769800cd2fc6528617', style: Boolean(this.zIndexOverride) ? { zIndex: `${this.zIndexOverride}` } : {} }, h("slot", { key: '2224cfed49cb4577b2d1939e53657ec5b8c85856' })));
31
+ return (h(Host, { key: 'c3a05ed63108fbe8354b5cd3bb1c08d02cf39a60', style: this.zIndexOverride ? { zIndex: `${this.zIndexOverride}` } : {} }, h("slot", { key: '6b57f3341e2f11611cbd1fe44fb3088c8e3a434a' })));
32
32
  }
33
33
  static get is() { return "cpsl-overlay"; }
34
34
  static get encapsulation() { return "shadow"; }
@@ -1 +1 @@
1
- {"version":3,"file":"cpsl-overlay.js","sourceRoot":"","sources":["../../../../src/components/cpsl-overlay/cpsl-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,OAAO,WAAW;;uCAOqB,GAAG;sCAMJ,GAAG;;;;IAa7C,YAAY;QACV,IAAI,CAAC,IAAI;YACP,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YACvH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;QAExH,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,oFAAoF;YACpF,UAAU,CAAC,GAAG,EAAE;gBACd,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;YACnD,CAAC,EAAE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,gBAAgB;QACd,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;YACtH,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACrD,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;YACnF,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, h, Element, Watch } from '@stencil/core';\nimport gsap from 'gsap';\n\n@Component({\n tag: 'cpsl-overlay',\n styleUrl: 'cpsl-overlay.scss',\n shadow: true,\n})\nexport class CpslOverlay {\n @Element() el!: HTMLCpslOverlayElement;\n\n /**\n * Duration in seconds of the fade out animation.\n * Default is .5.\n */\n @Prop() enterTransitionDuration?: number = 0.5;\n\n /**\n * Duration in seconds of the fade out animation.\n * Default is .5.\n */\n @Prop() exitTransitionDuration?: number = 0.5;\n\n /**\n * Whether or not to show the overlay.\n */\n @Prop() open: boolean;\n\n /**\n * Override z-index.\n */\n @Prop() zIndexOverride?: number;\n\n @Watch('open')\n toggleHeight() {\n this.open\n ? gsap.timeline({ defaults: { duration: this.enterTransitionDuration } }).to(this.el, { display: 'block', opacity: 1 })\n : gsap.timeline({ defaults: { duration: this.exitTransitionDuration } }).to(this.el, { display: 'none', opacity: 0 });\n\n if (this.open) {\n document.documentElement.style.overflow = 'hidden';\n } else {\n // Setting a timeout here to prevent modal from shifting when the scroll bar appears\n setTimeout(() => {\n document.documentElement.style.overflow = 'auto';\n }, this.exitTransitionDuration * 1000);\n }\n }\n\n componentDidLoad() {\n if (this.open) {\n gsap.timeline({ defaults: { duration: this.enterTransitionDuration } }).to(this.el, { display: 'block', opacity: 1 });\n document.documentElement.style.overflow = 'hidden';\n }\n }\n\n render() {\n return (\n <Host style={Boolean(this.zIndexOverride) ? { zIndex: `${this.zIndexOverride}` } : {}}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cpsl-overlay.js","sourceRoot":"","sources":["../../../../src/components/cpsl-overlay/cpsl-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,MAAM,OAAO,WAAW;;uCAOqB,GAAG;sCAMJ,GAAG;;;;IAa7C,YAAY;QACV,IAAI,CAAC,IAAI;YACP,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;YACvH,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;QAExH,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,oFAAoF;YACpF,UAAU,CAAC,GAAG,EAAE;gBACd,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,MAAM,CAAC;YACnD,CAAC,EAAE,IAAI,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,gBAAgB;QACd,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,uBAAuB,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC;YACtH,QAAQ,CAAC,eAAe,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACrD,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,qDAAC,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE;YAC1E,8DAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, h, Element, Watch } from '@stencil/core';\nimport gsap from 'gsap';\n\n@Component({\n tag: 'cpsl-overlay',\n styleUrl: 'cpsl-overlay.scss',\n shadow: true,\n})\nexport class CpslOverlay {\n @Element() el!: HTMLCpslOverlayElement;\n\n /**\n * Duration in seconds of the fade out animation.\n * Default is .5.\n */\n @Prop() enterTransitionDuration?: number = 0.5;\n\n /**\n * Duration in seconds of the fade out animation.\n * Default is .5.\n */\n @Prop() exitTransitionDuration?: number = 0.5;\n\n /**\n * Whether or not to show the overlay.\n */\n @Prop() open: boolean;\n\n /**\n * Override z-index.\n */\n @Prop() zIndexOverride?: number;\n\n @Watch('open')\n toggleHeight() {\n this.open\n ? gsap.timeline({ defaults: { duration: this.enterTransitionDuration } }).to(this.el, { display: 'block', opacity: 1 })\n : gsap.timeline({ defaults: { duration: this.exitTransitionDuration } }).to(this.el, { display: 'none', opacity: 0 });\n\n if (this.open) {\n document.documentElement.style.overflow = 'hidden';\n } else {\n // Setting a timeout here to prevent modal from shifting when the scroll bar appears\n setTimeout(() => {\n document.documentElement.style.overflow = 'auto';\n }, this.exitTransitionDuration * 1000);\n }\n }\n\n componentDidLoad() {\n if (this.open) {\n gsap.timeline({ defaults: { duration: this.enterTransitionDuration } }).to(this.el, { display: 'block', opacity: 1 });\n document.documentElement.style.overflow = 'hidden';\n }\n }\n\n render() {\n return (\n <Host style={this.zIndexOverride ? { zIndex: `${this.zIndexOverride}` } : {}}>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
@@ -71,7 +71,7 @@ export class CpslPagination {
71
71
  filteredPages.push(this.totalPages - 1);
72
72
  }
73
73
  }
74
- return (h(Host, { key: 'eba12366b85a2dd993d0fd42818e0f554bf668a2' }, h("cpsl-button-group", { key: 'c3558fe7307148dc511d4e182a4acdc97505f097', selectedId: `${this.currentPage}` }, h("cpsl-button", { key: 'da83c5c93894ba987db7223c474748b1f799739a', class: "arrow-button", onClick: this.handlePrevClick }, h("cpsl-icon", { key: '6584bf060a9b2c9c62877833852d7a2da4e3dd99', class: { 'icon': true, 'start-icon': true }, icon: "arrowNarrow" })), filteredPages.map(page => (h("cpsl-button", { key: page, variant: "secondary", fullWidth: true, id: `${page}`, onClick: this.handlePageClick(page) }, h("cpsl-text", { variant: "bodyS" }, page + 1)))), h("cpsl-button", { key: 'c39747f5464ca621788c075a8d75a8293c6889f1', class: "arrow-button", onClick: this.handleNextClick }, h("cpsl-icon", { key: '6cf1ab917fa25442534e105e27d9a883697d7a72', class: "icon", icon: "arrowNarrow" })))));
74
+ return (h(Host, { key: '89d002fff30667f081dcb91e3380b3d452860bf9' }, h("cpsl-button-group", { key: '169546258dbb7bcf29f4914f77e677f1addcc400', selectedId: `${this.currentPage}` }, h("cpsl-button", { key: 'fb523b4e254412493b0f7c86be13a05eed38efff', class: "arrow-button", onClick: this.handlePrevClick }, h("cpsl-icon", { key: 'c455f7f3b349e6c43ec5f5da3a2b76630bb1c73f', class: { 'icon': true, 'start-icon': true }, icon: "arrowNarrow" })), filteredPages.map(page => (h("cpsl-button", { key: page, variant: "secondary", fullWidth: true, id: `${page}`, onClick: this.handlePageClick(page) }, h("cpsl-text", { variant: "bodyS" }, page + 1)))), h("cpsl-button", { key: '52c54082f971199a7a5a231f11a2fb3f063c2b9e', class: "arrow-button", onClick: this.handleNextClick }, h("cpsl-icon", { key: '300954f69d40f4077bdc1e77f46d66c99f7c7ac0', class: "icon", icon: "arrowNarrow" })))));
75
75
  }
76
76
  static get is() { return "cpsl-pagination"; }
77
77
  static get encapsulation() { return "shadow"; }
@@ -4,7 +4,7 @@ export class CpslPill {
4
4
  this.text = undefined;
5
5
  }
6
6
  render() {
7
- return (h(Host, { key: '3ae506c7d53a529397d0b6e6c54c52501cff2561' }, h("div", { key: '0e3eebbb2a622e62c1bcd83c3d5fab24e31b9f3f', class: "pill-container" }, h("span", { key: 'e4277fc6af1abffa05e6037d68fa2ac8f998b51b' }, this.text))));
7
+ return (h(Host, { key: 'db0f2db5e1ae046fb4498c5fa2974f56d461ca46' }, h("div", { key: 'a1f1fb791f0b228073008c2f864574f5d4cb47db', class: "pill-container" }, h("span", { key: 'd64c09db81a3c7f4ded1559fbc8351204cd71bb5' }, this.text))));
8
8
  }
9
9
  static get is() { return "cpsl-pill"; }
10
10
  static get encapsulation() { return "shadow"; }
@@ -66,10 +66,12 @@
66
66
 
67
67
  .container {
68
68
  visibility: hidden;
69
+ height: 0px;
69
70
  }
70
71
 
71
72
  .open {
72
73
  visibility: visible;
74
+ height: auto;
73
75
  z-index: 10006;
74
76
  }
75
77
 
@@ -23,14 +23,14 @@ export class CpslPopover {
23
23
  this.triggerClicked = false;
24
24
  this.configureTriggerInteraction = () => {
25
25
  const { trigger, triggerAction, destroyTriggerInteraction } = this;
26
- if (Boolean(destroyTriggerInteraction)) {
26
+ if (destroyTriggerInteraction) {
27
27
  destroyTriggerInteraction();
28
28
  }
29
29
  if (trigger === undefined) {
30
30
  return;
31
31
  }
32
32
  this.triggerEl = document.getElementById(trigger);
33
- if (!Boolean(this.triggerEl)) {
33
+ if (!this.triggerEl) {
34
34
  console.error(`A trigger element with the ID "${trigger}" was not found in the DOM.`, this.el);
35
35
  return;
36
36
  }
@@ -91,7 +91,7 @@ export class CpslPopover {
91
91
  this.setPosition = () => {
92
92
  var _a;
93
93
  const anchorEl = (_a = this.anchorEl) !== null && _a !== void 0 ? _a : this.triggerEl;
94
- if (Boolean(anchorEl)) {
94
+ if (anchorEl) {
95
95
  const windowWidth = window.innerWidth;
96
96
  const windowHeight = window.innerHeight;
97
97
  const elWidth = this.el.clientWidth;
@@ -194,10 +194,12 @@ export class CpslPopover {
194
194
  if (this.open) {
195
195
  window.addEventListener('click', this.handleClickOutside);
196
196
  window.addEventListener('scroll', () => this.setPosition(), true);
197
+ window.addEventListener('resize', () => this.setPosition(), true);
197
198
  }
198
199
  else {
199
200
  window.removeEventListener('click', this.handleClickOutside);
200
- window.addEventListener('scroll', () => this.setPosition());
201
+ window.removeEventListener('scroll', () => this.setPosition(), true);
202
+ window.removeEventListener('resize', () => this.setPosition(), true);
201
203
  }
202
204
  }
203
205
  componentDidLoad() {
@@ -209,7 +211,7 @@ export class CpslPopover {
209
211
  }
210
212
  render() {
211
213
  var _a;
212
- return (h(Host, { key: '6e949ffef54dfbc76c739243e222e58ea93db103', class: {
214
+ return (h(Host, { key: '338d4a705c7bcd6a5ac6e1db38d7c077b8125dcb', class: {
213
215
  'open': this.open,
214
216
  'transform-h-left': this.transformOriginHorizontal === 'left',
215
217
  'transform-h-center': this.transformOriginHorizontal === 'center',
@@ -217,11 +219,7 @@ export class CpslPopover {
217
219
  'transform-v-top': this.transformOriginVertical === 'top',
218
220
  'transform-v-center': this.transformOriginVertical === 'center',
219
221
  'transform-v-bottom': this.transformOriginVertical === 'bottom',
220
- }, style: {
221
- top: `${this.positionY}px`,
222
- left: `${this.positionX}px`,
223
- width: this.autoWidth ? 'auto' : `${(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.clientWidth}px`,
224
- } }, h("div", { key: '4cb74feb1ddb1157deb138c22b4ebd6fe423f163', id: "container", class: { container: true, open: this.open } }, h("slot", { key: '498c0f9f4e7770ec4b8bd3a4d50be843e0b9445c' }))));
222
+ }, style: { top: `${this.positionY}px`, left: `${this.positionX}px`, width: !this.open ? '0px' : this.autoWidth ? 'auto' : `${(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.clientWidth}px` } }, h("div", { key: 'dcd6ed99f039f905fe72850ff7943a7d8afc8335', id: "container", class: { container: true, open: this.open } }, h("slot", { key: '39e0e5f281f261e1828f82f30ead2728a10f92ac' }))));
225
223
  }
226
224
  static get is() { return "cpsl-popover"; }
227
225
  static get encapsulation() { return "shadow"; }
@@ -455,8 +453,8 @@ export class CpslPopover {
455
453
  "text": "Emitted when the popover opens."
456
454
  },
457
455
  "complexType": {
458
- "original": "any",
459
- "resolved": "any",
456
+ "original": "void",
457
+ "resolved": "void",
460
458
  "references": {}
461
459
  }
462
460
  }, {
@@ -470,8 +468,8 @@ export class CpslPopover {
470
468
  "text": "Emitted when the popover closes."
471
469
  },
472
470
  "complexType": {
473
- "original": "any",
474
- "resolved": "any",
471
+ "original": "void",
472
+ "resolved": "void",
475
473
  "references": {}
476
474
  }
477
475
  }];
@@ -1 +1 @@
1
- {"version":3,"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qDACH,KAAK,EAAE;gBACL,MAAM,EAAE,IAAI,CAAC,IAAI;gBACjB,kBAAkB,EAAE,IAAI,CAAC,yBAAyB,KAAK,MAAM;gBAC7D,oBAAoB,EAAE,IAAI,CAAC,yBAAyB,KAAK,QAAQ;gBACjE,mBAAmB,EAAE,IAAI,CAAC,yBAAyB,KAAK,OAAO;gBAC/D,iBAAiB,EAAE,IAAI,CAAC,uBAAuB,KAAK,KAAK;gBACzD,oBAAoB,EAAE,IAAI,CAAC,uBAAuB,KAAK,QAAQ;gBAC/D,oBAAoB,EAAE,IAAI,CAAC,uBAAuB,KAAK,QAAQ;aAChE,EACD,KAAK,EAAE;gBACL,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI;gBAC1B,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI;gBAC3B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,WAAW,IAAI;aACpE;YAED,4DAAK,EAAE,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;gBAC7D,8DAAa,CACT,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, State, Watch, Element, h, Method, Event, EventEmitter } from '@stencil/core';\nimport { InteractionCallback } from '../../interface';\n\n@Component({\n tag: 'cpsl-popover',\n styleUrl: 'cpsl-popover.scss',\n shadow: true,\n})\nexport class CpslPopover {\n private triggerEl?: HTMLElement | null;\n private destroyTriggerInteraction?: () => void;\n\n @Element() el!: HTMLCpslPopoverElement;\n\n @State() open = false;\n private triggerClicked = false;\n @State() positionX?: number;\n @State() positionY?: number;\n\n /**\n * ID for the element that the popover anchors to.\n */\n @Prop() anchorEl?: HTMLElement;\n\n /**\n * Vertical anchor origin.\n * Options are: `\"left\"`, `\"center\"`, `\"right\"`.\n * Default is: `\"left\"`.\n */\n @Prop() anchorOriginHorizontal?: 'left' | 'center' | 'right' = 'left';\n\n /**\n * Vertical anchor origin.\n * Options are: `\"top\"`, `\"center\"`, `\"bottom\"`.\n * Default is: `\"bottom\"`.\n */\n @Prop() anchorOriginVertical?: 'top' | 'center' | 'bottom' = 'bottom';\n\n /**\n * If `true` the container will use the width of the content, else it will be set to the width of the trigger.\n * Default is `true`\n */\n // eslint-disable-next-line @stencil-community/ban-default-true\n @Prop() autoWidth?: boolean = true;\n\n /**\n * Whether or not to disable to popover.\n */\n @Prop() disabled: boolean;\n\n /**\n * Used internally to prevent select from blurring unintentionally.\n */\n @Prop() preventBlur: boolean;\n\n /**\n * Vertical transformation origin.\n * Options are: `\"left\"`, `\"center\"`, `\"right\"`.\n * Default is: `\"left\"`.\n */\n @Prop() transformOriginHorizontal?: 'left' | 'center' | 'right' = 'left';\n\n /**\n * Vertical transformation origin.\n * Options are: `\"top\"`, `\"center\"`, `\"bottom\"`.\n * Default is: `\"bottom\"`.\n */\n @Prop() transformOriginVertical?: 'top' | 'center' | 'bottom' = 'top';\n\n /**\n * Which trigger causes the popover to open.\n * Options are: `\"click\"`, `\"hover\"`.\n * Default is: `\"click\"`.\n */\n @Prop() triggerAction: 'click' | 'hover' = 'click';\n\n /**\n * ID for the element that triggers the popover to open.\n */\n @Prop() trigger: string;\n\n /**\n * Padding from edge of window for the popover container.\n */\n @Prop() windowPadding?: number = 16;\n\n /**\n * Emitted when the popover opens.\n */\n @Event() cpslOpen!: EventEmitter;\n\n /**\n * Emitted when the popover closes.\n */\n @Event() cpslClose!: EventEmitter;\n\n /**\n * Call to close the popover manually.\n */\n @Method()\n async closePopover() {\n this.close();\n }\n\n @Watch('trigger')\n @Watch('triggerAction')\n @Watch('preventBlur')\n onTriggerChange() {\n this.configureTriggerInteraction();\n }\n\n @Watch('anchorOriginHorizontal')\n @Watch('anchorOriginVertical')\n onAnchorChange() {\n this.setPosition();\n }\n\n @Watch('open')\n onOpenChange() {\n if (this.open) {\n window.addEventListener('click', this.handleClickOutside);\n window.addEventListener('scroll', () => this.setPosition(), true);\n } else {\n window.removeEventListener('click', this.handleClickOutside);\n window.addEventListener('scroll', () => this.setPosition());\n }\n }\n\n componentDidLoad() {\n this.configureTriggerInteraction();\n }\n\n private configureTriggerInteraction = () => {\n const { trigger, triggerAction, destroyTriggerInteraction } = this;\n\n if (Boolean(destroyTriggerInteraction)) {\n destroyTriggerInteraction();\n }\n\n if (trigger === undefined) {\n return;\n }\n\n this.triggerEl = document.getElementById(trigger);\n if (!Boolean(this.triggerEl)) {\n console.error(`A trigger element with the ID \"${trigger}\" was not found in the DOM.`, this.el);\n return;\n }\n\n let triggerCallbacks: InteractionCallback[] = [];\n /**\n * Based upon the kind of trigger interaction\n * the user wants, we setup the correct event\n * listeners.\n */\n switch (triggerAction) {\n case 'hover':\n triggerCallbacks = [\n {\n eventName: 'mouseenter',\n callback: async () => {\n this.present();\n },\n },\n {\n eventName: 'mouseleave',\n callback: () => {\n if (!this.containerEl.matches(':hover')) {\n this.close();\n } else {\n this.containerEl.addEventListener('mouseleave', () => {\n this.close();\n });\n }\n },\n },\n {\n eventName: 'click',\n callback: (ev: Event) => ev.stopPropagation(),\n },\n ];\n\n break;\n case 'click':\n default:\n triggerCallbacks = [\n {\n eventName: 'mousedown',\n callback: e => {\n if (this.preventBlur) {\n e.preventDefault();\n }\n this.present();\n },\n },\n ];\n break;\n }\n\n triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.addEventListener(eventName, callback));\n\n this.destroyTriggerInteraction = () => {\n triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.removeEventListener(eventName, callback));\n };\n };\n\n private setPosition = () => {\n const anchorEl = this.anchorEl ?? this.triggerEl;\n if (Boolean(anchorEl)) {\n const windowWidth = window.innerWidth;\n const windowHeight = window.innerHeight;\n const elWidth = this.el.clientWidth;\n const elHeight = this.el.clientHeight;\n const { top, left, height, width } = anchorEl.getBoundingClientRect();\n\n switch (this.anchorOriginHorizontal) {\n case 'left': {\n this.positionX = left;\n break;\n }\n case 'center': {\n this.positionX = left + width / 2;\n break;\n }\n case 'right': {\n this.positionX = left + width;\n break;\n }\n }\n\n switch (this.anchorOriginVertical) {\n case 'top': {\n this.positionY = top;\n break;\n }\n case 'center': {\n this.positionY = top + height / 2;\n break;\n }\n case 'bottom': {\n this.positionY = top + height;\n break;\n }\n }\n\n if (this.positionY < this.windowPadding) {\n this.positionY = this.windowPadding;\n }\n if (this.positionY + elHeight > windowHeight - 16) {\n this.positionY = windowHeight - this.windowPadding - elHeight;\n }\n\n if (this.positionX < this.windowPadding) {\n this.positionX = this.windowPadding;\n }\n if (this.positionX + elWidth > windowWidth - 16) {\n this.positionX = windowWidth - this.windowPadding - elWidth;\n }\n }\n };\n\n private handleClickOutside = (event: MouseEvent) => {\n if (!this.triggerClicked && this.triggerEl.contains(event.target as Node)) {\n this.triggerClicked = true;\n return;\n }\n if (this.open && !this.el.contains(event.target as Node)) {\n event.preventDefault();\n this.close();\n }\n };\n\n private present = () => {\n if (!this.open && !this.disabled) {\n this.open = true;\n this.cpslOpen.emit();\n this.setPosition();\n }\n };\n\n private close = () => {\n this.open = false;\n this.triggerClicked = false;\n this.cpslClose.emit();\n };\n\n get containerEl() {\n return this.el?.shadowRoot?.getElementById('container');\n }\n\n render() {\n return (\n <Host\n class={{\n 'open': this.open,\n 'transform-h-left': this.transformOriginHorizontal === 'left',\n 'transform-h-center': this.transformOriginHorizontal === 'center',\n 'transform-h-right': this.transformOriginHorizontal === 'right',\n 'transform-v-top': this.transformOriginVertical === 'top',\n 'transform-v-center': this.transformOriginVertical === 'center',\n 'transform-v-bottom': this.transformOriginVertical === 'bottom',\n }}\n style={{\n top: `${this.positionY}px`,\n left: `${this.positionX}px`,\n width: this.autoWidth ? 'auto' : `${this.triggerEl?.clientWidth}px`,\n }}\n >\n <div id=\"container\" class={{ container: true, open: this.open }}>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cpsl-popover.js","sourceRoot":"","sources":["../../../../src/components/cpsl-popover/cpsl-popover.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAgB,MAAM,eAAe,CAAC;AAQ7G,MAAM,OAAO,WAAW;;QAOd,mBAAc,GAAG,KAAK,CAAC;QAuHvB,gCAA2B,GAAG,GAAG,EAAE;YACzC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;YAEnE,IAAI,yBAAyB,EAAE,CAAC;gBAC9B,yBAAyB,EAAE,CAAC;YAC9B,CAAC;YAED,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;gBAC1B,OAAO;YACT,CAAC;YAED,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;YAClD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;gBACpB,OAAO,CAAC,KAAK,CAAC,kCAAkC,OAAO,6BAA6B,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC;gBAC/F,OAAO;YACT,CAAC;YAED,IAAI,gBAAgB,GAA0B,EAAE,CAAC;YACjD;;;;eAIG;YACH,QAAQ,aAAa,EAAE,CAAC;gBACtB,KAAK,OAAO;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AE5J,4DAAK,EAAE,EAAC,WAAW,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE;gBAC7D,8DAAa,CACT,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, Prop, State, Watch, Element, h, Method, Event, EventEmitter } from '@stencil/core';\nimport { InteractionCallback } from '../../interface';\n\n@Component({\n tag: 'cpsl-popover',\n styleUrl: 'cpsl-popover.scss',\n shadow: true,\n})\nexport class CpslPopover {\n private triggerEl?: HTMLElement | null;\n private destroyTriggerInteraction?: () => void;\n\n @Element() el!: HTMLCpslPopoverElement;\n\n @State() open = false;\n private triggerClicked = false;\n @State() positionX?: number;\n @State() positionY?: number;\n\n /**\n * ID for the element that the popover anchors to.\n */\n @Prop() anchorEl?: HTMLElement;\n\n /**\n * Vertical anchor origin.\n * Options are: `\"left\"`, `\"center\"`, `\"right\"`.\n * Default is: `\"left\"`.\n */\n @Prop() anchorOriginHorizontal?: 'left' | 'center' | 'right' = 'left';\n\n /**\n * Vertical anchor origin.\n * Options are: `\"top\"`, `\"center\"`, `\"bottom\"`.\n * Default is: `\"bottom\"`.\n */\n @Prop() anchorOriginVertical?: 'top' | 'center' | 'bottom' = 'bottom';\n\n /**\n * If `true` the container will use the width of the content, else it will be set to the width of the trigger.\n * Default is `true`\n */\n // eslint-disable-next-line @stencil-community/ban-default-true\n @Prop() autoWidth?: boolean = true;\n\n /**\n * Whether or not to disable to popover.\n */\n @Prop() disabled: boolean;\n\n /**\n * Used internally to prevent select from blurring unintentionally.\n */\n @Prop() preventBlur: boolean;\n\n /**\n * Vertical transformation origin.\n * Options are: `\"left\"`, `\"center\"`, `\"right\"`.\n * Default is: `\"left\"`.\n */\n @Prop() transformOriginHorizontal?: 'left' | 'center' | 'right' = 'left';\n\n /**\n * Vertical transformation origin.\n * Options are: `\"top\"`, `\"center\"`, `\"bottom\"`.\n * Default is: `\"bottom\"`.\n */\n @Prop() transformOriginVertical?: 'top' | 'center' | 'bottom' = 'top';\n\n /**\n * Which trigger causes the popover to open.\n * Options are: `\"click\"`, `\"hover\"`.\n * Default is: `\"click\"`.\n */\n @Prop() triggerAction: 'click' | 'hover' = 'click';\n\n /**\n * ID for the element that triggers the popover to open.\n */\n @Prop() trigger: string;\n\n /**\n * Padding from edge of window for the popover container.\n */\n @Prop() windowPadding?: number = 16;\n\n /**\n * Emitted when the popover opens.\n */\n @Event() cpslOpen!: EventEmitter<void>;\n\n /**\n * Emitted when the popover closes.\n */\n @Event() cpslClose!: EventEmitter<void>;\n\n /**\n * Call to close the popover manually.\n */\n @Method()\n async closePopover() {\n this.close();\n }\n\n @Watch('trigger')\n @Watch('triggerAction')\n @Watch('preventBlur')\n onTriggerChange() {\n this.configureTriggerInteraction();\n }\n\n @Watch('anchorOriginHorizontal')\n @Watch('anchorOriginVertical')\n onAnchorChange() {\n this.setPosition();\n }\n\n @Watch('open')\n onOpenChange() {\n if (this.open) {\n window.addEventListener('click', this.handleClickOutside);\n window.addEventListener('scroll', () => this.setPosition(), true);\n window.addEventListener('resize', () => this.setPosition(), true);\n } else {\n window.removeEventListener('click', this.handleClickOutside);\n window.removeEventListener('scroll', () => this.setPosition(), true);\n window.removeEventListener('resize', () => this.setPosition(), true);\n }\n }\n\n componentDidLoad() {\n this.configureTriggerInteraction();\n }\n\n private configureTriggerInteraction = () => {\n const { trigger, triggerAction, destroyTriggerInteraction } = this;\n\n if (destroyTriggerInteraction) {\n destroyTriggerInteraction();\n }\n\n if (trigger === undefined) {\n return;\n }\n\n this.triggerEl = document.getElementById(trigger);\n if (!this.triggerEl) {\n console.error(`A trigger element with the ID \"${trigger}\" was not found in the DOM.`, this.el);\n return;\n }\n\n let triggerCallbacks: InteractionCallback[] = [];\n /**\n * Based upon the kind of trigger interaction\n * the user wants, we setup the correct event\n * listeners.\n */\n switch (triggerAction) {\n case 'hover':\n triggerCallbacks = [\n {\n eventName: 'mouseenter',\n callback: async () => {\n this.present();\n },\n },\n {\n eventName: 'mouseleave',\n callback: () => {\n if (!this.containerEl.matches(':hover')) {\n this.close();\n } else {\n this.containerEl.addEventListener('mouseleave', () => {\n this.close();\n });\n }\n },\n },\n {\n eventName: 'click',\n callback: (ev: Event) => ev.stopPropagation(),\n },\n ];\n\n break;\n case 'click':\n default:\n triggerCallbacks = [\n {\n eventName: 'mousedown',\n callback: e => {\n if (this.preventBlur) {\n e.preventDefault();\n }\n this.present();\n },\n },\n ];\n break;\n }\n\n triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.addEventListener(eventName, callback));\n\n this.destroyTriggerInteraction = () => {\n triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.removeEventListener(eventName, callback));\n };\n };\n\n private setPosition = () => {\n const anchorEl = this.anchorEl ?? this.triggerEl;\n if (anchorEl) {\n const windowWidth = window.innerWidth;\n const windowHeight = window.innerHeight;\n const elWidth = this.el.clientWidth;\n const elHeight = this.el.clientHeight;\n const { top, left, height, width } = anchorEl.getBoundingClientRect();\n\n switch (this.anchorOriginHorizontal) {\n case 'left': {\n this.positionX = left;\n break;\n }\n case 'center': {\n this.positionX = left + width / 2;\n break;\n }\n case 'right': {\n this.positionX = left + width;\n break;\n }\n }\n\n switch (this.anchorOriginVertical) {\n case 'top': {\n this.positionY = top;\n break;\n }\n case 'center': {\n this.positionY = top + height / 2;\n break;\n }\n case 'bottom': {\n this.positionY = top + height;\n break;\n }\n }\n\n if (this.positionY < this.windowPadding) {\n this.positionY = this.windowPadding;\n }\n if (this.positionY + elHeight > windowHeight - 16) {\n this.positionY = windowHeight - this.windowPadding - elHeight;\n }\n\n if (this.positionX < this.windowPadding) {\n this.positionX = this.windowPadding;\n }\n if (this.positionX + elWidth > windowWidth - 16) {\n this.positionX = windowWidth - this.windowPadding - elWidth;\n }\n }\n };\n\n private handleClickOutside = (event: MouseEvent) => {\n if (!this.triggerClicked && this.triggerEl.contains(event.target as Node)) {\n this.triggerClicked = true;\n return;\n }\n if (this.open && !this.el.contains(event.target as Node)) {\n event.preventDefault();\n this.close();\n }\n };\n\n private present = () => {\n if (!this.open && !this.disabled) {\n this.open = true;\n this.cpslOpen.emit();\n this.setPosition();\n }\n };\n\n private close = () => {\n this.open = false;\n this.triggerClicked = false;\n this.cpslClose.emit();\n };\n\n get containerEl() {\n return this.el?.shadowRoot?.getElementById('container');\n }\n\n render() {\n return (\n <Host\n class={{\n 'open': this.open,\n 'transform-h-left': this.transformOriginHorizontal === 'left',\n 'transform-h-center': this.transformOriginHorizontal === 'center',\n 'transform-h-right': this.transformOriginHorizontal === 'right',\n 'transform-v-top': this.transformOriginVertical === 'top',\n 'transform-v-center': this.transformOriginVertical === 'center',\n 'transform-v-bottom': this.transformOriginVertical === 'bottom',\n }}\n style={{ top: `${this.positionY}px`, left: `${this.positionX}px`, width: !this.open ? '0px' : this.autoWidth ? 'auto' : `${this.triggerEl?.clientWidth}px` }}\n >\n <div id=\"container\" class={{ container: true, open: this.open }}>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -58,8 +58,12 @@
58
58
  --qr-background-color: var(--cpsl-color-qr-background);
59
59
  --qr-border-color: var(--cpsl-color-qr-border);
60
60
  --qr-border-radius: var(--cpsl-border-radius-qr-code);
61
- --qr-border-width: 1px;
62
- --qr-box-shadow: 0px 1px 2px var(--cpsl-color-alpha-black-10);
61
+ --qr-border-width: 0px;
62
+ --qr-box-shadow: 0px 0px 20px 0px rgba(0, 0, 0, 0.06);
63
+ --qr-padding-top: 12px;
64
+ --qr-padding-end: 12px;
65
+ --qr-padding-bottom: 12px;
66
+ --qr-padding-start: 12px;
63
67
  display: inline-block;
64
68
  }
65
69
 
@@ -70,7 +74,7 @@
70
74
  padding-inline-end: var(--qr-padding-end);
71
75
  padding-top: var(--qr-padding-top);
72
76
  padding-bottom: var(--qr-padding-bottom);
73
- display: flex;
77
+ box-sizing: border-box;
74
78
  color: var(--qr-color);
75
79
  border-style: solid;
76
80
  border-width: var(--qr-border-width);
@@ -78,4 +82,9 @@
78
82
  border-radius: var(--qr-border-radius);
79
83
  background: var(--qr-background-color);
80
84
  box-shadow: var(--qr-box-shadow);
85
+ }
86
+
87
+ .qr-code {
88
+ width: 100%;
89
+ height: 100%;
81
90
  }
@@ -1,38 +1,43 @@
1
1
  import { Host, h } from "@stencil/core";
2
- import QRCodeStyling from "qr-code-styling";
2
+ import QrCodeWithLogo from "qrcode-with-logos";
3
3
  export class CpslQrCode {
4
4
  constructor() {
5
5
  this.url = undefined;
6
6
  this.imageSrc = undefined;
7
- this.size = 250;
7
+ this.size = 286;
8
8
  }
9
9
  componentDidLoad() {
10
- const container = this.el.shadowRoot.getElementById('qr-container');
11
- container.innerHTML = '';
12
- const qrCode = new QRCodeStyling({
13
- type: 'svg',
14
- data: this.url,
15
- image: this.imageSrc,
16
- height: this.size,
17
- width: this.size,
18
- qrOptions: { errorCorrectionLevel: 'L' },
19
- backgroundOptions: {
20
- color: 'transparent',
21
- },
10
+ new QrCodeWithLogo({
11
+ content: this.url,
12
+ width: 1000,
13
+ image: this.imgEl,
14
+ logo: this.imageSrc
15
+ ? {
16
+ src: this.imageSrc,
17
+ borderRadius: 16,
18
+ }
19
+ : '',
22
20
  dotsOptions: {
23
- type: 'dots',
24
- color: 'currentColor',
21
+ type: 'dot',
22
+ },
23
+ cornersOptions: {
24
+ type: 'rounded',
25
+ radius: {
26
+ inner: 8,
27
+ outer: 32,
28
+ },
25
29
  },
26
- cornersSquareOptions: { type: 'extra-rounded' },
27
- cornersDotOptions: { type: 'dot' },
28
- imageOptions: {
29
- crossOrigin: 'anonymous',
30
+ nodeQrCodeOptions: {
31
+ margin: 0,
32
+ errorCorrectionLevel: 'M',
30
33
  },
31
34
  });
32
- qrCode.append(container);
35
+ }
36
+ get imgEl() {
37
+ return this.el.shadowRoot.getElementById('qr-code');
33
38
  }
34
39
  render() {
35
- return (h(Host, { key: '95d0a5a4e2cab2a3487895e16255c78a9df322c1' }, h("div", { key: 'd63c1985e90491be78e24945c6bdb9aae44c8f7d', id: "qr-container", class: "qr-container" })));
40
+ return (h(Host, { key: '29a0c108792b0c2640c63846baa5ad20f4098a24' }, h("div", { key: 'e4568804cd28026a4c5507b85a0646327e8353b7', id: "qr-container", class: "qr-container", style: { width: `${this.size}px`, height: `${this.size}px` } }, h("img", { key: 'eb86fd0c8262bfba16177c954c1725cdbab6e69d', id: "qr-code", class: "qr-code" }))));
36
41
  }
37
42
  static get is() { return "cpsl-qr-code"; }
38
43
  static get encapsulation() { return "shadow"; }
@@ -98,7 +103,7 @@ export class CpslQrCode {
98
103
  },
99
104
  "attribute": "size",
100
105
  "reflect": false,
101
- "defaultValue": "250"
106
+ "defaultValue": "286"
102
107
  }
103
108
  };
104
109
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cpsl-qr-code.js","sourceRoot":"","sources":["../../../../src/components/cpsl-qr-code/cpsl-qr-code.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAO5C,MAAM,OAAO,UAAU;;;;oBAiBG,GAAG;;IAE3B,gBAAgB;QACd,MAAM,SAAS,GAAG,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QAEpE,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC;QAEzB,MAAM,MAAM,GAAG,IAAI,aAAa,CAAC;YAC/B,IAAI,EAAE,KAAK;YACX,IAAI,EAAE,IAAI,CAAC,GAAG;YACd,KAAK,EAAE,IAAI,CAAC,QAAQ;YACpB,MAAM,EAAE,IAAI,CAAC,IAAI;YACjB,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,SAAS,EAAE,EAAE,oBAAoB,EAAE,GAAG,EAAE;YACxC,iBAAiB,EAAE;gBACjB,KAAK,EAAE,aAAa;aACrB;YACD,WAAW,EAAE;gBACX,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE,cAAc;aACtB;YACD,oBAAoB,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;YAC/C,iBAAiB,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE;YAClC,YAAY,EAAE;gBACZ,WAAW,EAAE,WAAW;aACzB;SACF,CAAC,CAAC;QAEH,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DACE,EAAE,EAAC,cAAc,EACjB,KAAK,EAAC,cAAc,GAEpB,CACG,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Element, Prop } from '@stencil/core';\nimport QRCodeStyling from 'qr-code-styling';\n\n@Component({\n tag: 'cpsl-qr-code',\n styleUrl: 'cpsl-qr-code.scss',\n shadow: true,\n})\nexport class CpslQrCode {\n @Element() el!: HTMLCpslQrCodeElement;\n\n /**\n * URL for the QR code to link to.\n */\n @Prop() url: string;\n\n /**\n * Source for the center image of the QR code.\n */\n @Prop() imageSrc?: string;\n\n /**\n * Size of the QR code in pixels.\n * Default is 250.\n */\n @Prop() size?: number = 250;\n\n componentDidLoad() {\n const container = this.el.shadowRoot.getElementById('qr-container');\n\n container.innerHTML = '';\n\n const qrCode = new QRCodeStyling({\n type: 'svg',\n data: this.url,\n image: this.imageSrc,\n height: this.size,\n width: this.size,\n qrOptions: { errorCorrectionLevel: 'L' },\n backgroundOptions: {\n color: 'transparent',\n },\n dotsOptions: {\n type: 'dots',\n color: 'currentColor',\n },\n cornersSquareOptions: { type: 'extra-rounded' },\n cornersDotOptions: { type: 'dot' },\n imageOptions: {\n crossOrigin: 'anonymous',\n },\n });\n\n qrCode.append(container);\n }\n\n render() {\n return (\n <Host>\n <div\n id=\"qr-container\"\n class=\"qr-container\"\n // style={{ height: `${this.size - 10 ?? 240}px`, width: `${this.size - 10 ?? 240}px` }}\n />\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"cpsl-qr-code.js","sourceRoot":"","sources":["../../../../src/components/cpsl-qr-code/cpsl-qr-code.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAO/C,MAAM,OAAO,UAAU;;;;oBAiBG,GAAG;;IAE3B,gBAAgB;QACd,IAAI,cAAc,CAAC;YACjB,OAAO,EAAE,IAAI,CAAC,GAAG;YACjB,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,QAAQ;gBACjB,CAAC,CAAC;oBACE,GAAG,EAAE,IAAI,CAAC,QAAQ;oBAClB,YAAY,EAAE,EAAE;iBACjB;gBACH,CAAC,CAAC,EAAE;YACN,WAAW,EAAE;gBACX,IAAI,EAAE,KAAK;aACZ;YACD,cAAc,EAAE;gBACd,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE;oBACN,KAAK,EAAE,CAAC;oBACR,KAAK,EAAE,EAAE;iBACV;aACF;YACD,iBAAiB,EAAE;gBACjB,MAAM,EAAE,CAAC;gBACT,oBAAoB,EAAE,GAAG;aAC1B;SACF,CAAC,CAAC;IACL,CAAC;IAED,IAAY,KAAK;QACf,OAAO,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,cAAc,CAAC,SAAS,CAAqB,CAAC;IAC1E,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI;YACH,4DAAK,EAAE,EAAC,cAAc,EAAC,KAAK,EAAC,cAAc,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE;gBACtG,4DAAK,EAAE,EAAC,SAAS,EAAC,KAAK,EAAC,SAAS,GAAG,CAChC,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Element, Prop } from '@stencil/core';\nimport QrCodeWithLogo from 'qrcode-with-logos';\n\n@Component({\n tag: 'cpsl-qr-code',\n styleUrl: 'cpsl-qr-code.scss',\n shadow: true,\n})\nexport class CpslQrCode {\n @Element() el!: HTMLCpslQrCodeElement;\n\n /**\n * URL for the QR code to link to.\n */\n @Prop() url: string;\n\n /**\n * Source for the center image of the QR code.\n */\n @Prop() imageSrc?: string;\n\n /**\n * Size of the QR code in pixels.\n * Default is 250.\n */\n @Prop() size?: number = 286;\n\n componentDidLoad() {\n new QrCodeWithLogo({\n content: this.url,\n width: 1000,\n image: this.imgEl,\n logo: this.imageSrc\n ? {\n src: this.imageSrc,\n borderRadius: 16,\n }\n : '',\n dotsOptions: {\n type: 'dot',\n },\n cornersOptions: {\n type: 'rounded',\n radius: {\n inner: 8,\n outer: 32,\n },\n },\n nodeQrCodeOptions: {\n margin: 0,\n errorCorrectionLevel: 'M',\n },\n });\n }\n\n private get imgEl(): HTMLImageElement {\n return this.el.shadowRoot.getElementById('qr-code') as HTMLImageElement;\n }\n\n render() {\n return (\n <Host>\n <div id=\"qr-container\" class=\"qr-container\" style={{ width: `${this.size}px`, height: `${this.size}px` }}>\n <img id=\"qr-code\" class=\"qr-code\" />\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -9,7 +9,7 @@ export class CpslRadio {
9
9
  this.checked = undefined;
10
10
  }
11
11
  render() {
12
- return (h(Host, { key: '96a55091ded8f5437089b71617066f2312c8e496' }, h("input", { key: '0aed505c49051a99fbfc90225fd057cc0a1f525e', type: "radio", checked: this.checked }), h("span", { key: 'f44d22c6ac7152ca0760f17d810e4b3fe12ff78f', onClick: this.handleRadioClick, class: { container: true, checked: this.checked } })));
12
+ return (h(Host, { key: '2e2c99a0aaff88bc8c70b41eedc3b808c7c347ae' }, h("input", { key: '19522b1db8b3a6392689be69b747711179187e0a', type: "radio", checked: this.checked }), h("span", { key: '360fd7451b7bf0429b03748dcd8fb9bac30b0e43', onClick: this.handleRadioClick, class: { container: true, checked: this.checked } })));
13
13
  }
14
14
  static get is() { return "cpsl-radio"; }
15
15
  static get encapsulation() { return "shadow"; }
@@ -1,7 +1,7 @@
1
1
  import { Host, h } from "@stencil/core";
2
2
  export class CpslRow {
3
3
  render() {
4
- return (h(Host, { key: '63ac746920b1acf41ea6083e67dd61c9b1f480f1' }, h("slot", { key: '35cf9026a0009abf96f990114afec3d509c81063' })));
4
+ return (h(Host, { key: '7d5564c003a58e6a530361c0a7a6ee026746c322' }, h("slot", { key: 'b493ac66dc1709116a6ac1507eeed82fbb8305bd' })));
5
5
  }
6
6
  static get is() { return "cpsl-row"; }
7
7
  static get encapsulation() { return "shadow"; }
@@ -83,6 +83,8 @@
83
83
  --helper-text-icon-size: 16px;
84
84
  --helper-text-font-size: var(--cpsl-font-size-body-xs);
85
85
  --helper-text-margin-top: 0px;
86
+ --icon-height: 24px;
87
+ --icon-width: 24px;
86
88
  display: flex;
87
89
  flex-direction: column;
88
90
  gap: 4px;
@@ -190,11 +192,16 @@ input.disabled {
190
192
  .selected-container-content {
191
193
  flex: 1;
192
194
  }
195
+ .selected-container-content.hidden {
196
+ display: none;
197
+ }
193
198
 
194
199
  .chevron {
195
200
  transition: transform 0.3s ease;
196
201
  transform: rotate(180deg);
197
202
  --icon-color: var(--cpsl-color-text-disabled);
203
+ --height: var(--icon-height);
204
+ --width: var(--icon-width);
198
205
  }
199
206
  .chevron.open {
200
207
  transform: rotate(0deg);
@@ -226,4 +233,14 @@ input.disabled {
226
233
  .dropdown-inner {
227
234
  overflow: auto;
228
235
  scrollbar-width: thin;
236
+ }
237
+ .dropdown-inner ::slotted(cpsl-input) {
238
+ padding: 8px;
239
+ }
240
+
241
+ .search-container {
242
+ position: sticky;
243
+ top: 0px;
244
+ padding: 8px;
245
+ background-color: var(--cpsl-color-select-surface-default);
229
246
  }
@@ -28,7 +28,7 @@ export class CpslSelect {
28
28
  item.setAttribute('selected', 'false');
29
29
  }
30
30
  });
31
- if (!Boolean(this.selectedValue)) {
31
+ if (!this.selectedValue) {
32
32
  this.hasSelectedItem = false;
33
33
  }
34
34
  };
@@ -48,6 +48,8 @@ export class CpslSelect {
48
48
  this.hasFocus = false;
49
49
  this.popoverOpen = false;
50
50
  this.hasSelectedItem = false;
51
+ this.anchorElId = undefined;
52
+ this.autoWidth = false;
51
53
  this.disabled = false;
52
54
  this.dropdownMaxHeight = undefined;
53
55
  this.errorText = undefined;
@@ -60,6 +62,8 @@ export class CpslSelect {
60
62
  this.selectedValue = undefined;
61
63
  this.showFormattedSelectedItem = undefined;
62
64
  this.showOptionalLabel = false;
65
+ this.showSearch = false;
66
+ this.searchPlaceholder = undefined;
63
67
  }
64
68
  onValueChange() {
65
69
  this.popoverEl.closePopover();
@@ -78,14 +82,15 @@ export class CpslSelect {
78
82
  }
79
83
  componentDidLoad() {
80
84
  this.popoverEl = this.el.shadowRoot.querySelector(`cpsl-popover`);
81
- this.anchorEl = this.el.shadowRoot.getElementById('select-container');
85
+ this.anchorEl = this.anchorElId ? document.getElementById(this.anchorElId) : this.el.shadowRoot.getElementById('select-container');
82
86
  this.selectItem();
83
87
  }
84
88
  render() {
85
- var _a, _b, _c, _d;
86
- return (h(Host, { key: '9c23dd95815c6d29eb5212084fcc311f93e57267', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (h("label", { key: '130663a00456e3e5bfa04002563bdd028094ba00', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: '05b090f1bb9857913e33cd34b5a6d506834b0cca', id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { key: 'cbf9d5764d4f2d1c3052ad88913a6d3b2e818015', name: "selected-item" }), h("div", { key: '3319b3aa5316e63430c6d4cc4d3d4ecd70585650', class: "selected-container-content", id: "selected-container-content" }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { key: '28dff14553ba27719041fc3097b3a48e9ff186e5', class: { 'selected-text': true, 'placeholder': !Boolean(this.selectedValue) } }, !Boolean(this.selectedValue)
87
- ? ((_a = this.placeholder) !== null && _a !== void 0 ? _a : 'Select')
88
- : ((_c = (_b = this.formatValue) === null || _b === void 0 ? void 0 : _b.call(this, this.selectedValue)) !== null && _c !== void 0 ? _c : this.selectedValue)))), h("cpsl-icon", { key: '632319f9681e4f1c7700c92af8c2739f5d32553e', class: { 'chevron': true, 'open': this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: "chevronUp" }), h("input", { key: '72b317986e3b0c331edac92d3ab56d101624984d', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" })), (this.errorText || this.helperText) && (h("div", { key: 'ee9231bf262b822f61e168bd6f6f9d07d083fe2e', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: '9483445ed8c6e4e18c408e68e6a2aac602f9510f' }, (_d = this.errorText) !== null && _d !== void 0 ? _d : this.helperText))), h("cpsl-popover", { key: 'b6f9b73041dfb1f8795858e7c34551ce126c7b56', autoWidth: false, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: 'ab43501553973078936c80f1af92b34beb4d1d4a', class: "dropdown" }, h("div", { key: '76a0edc77e408927b7ccd987e292b0e4b9498582', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: '087e283b2cd807455a4732e8d67799add3362089', name: "items" }))))));
89
+ var _a, _b, _c, _d, _e;
90
+ return (h(Host, { key: '72be0f8b2d2eb537dc174bdc74aafa9b3c5a80e6', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (h("label", { key: '95a25acd1fad10b5ce01be175f5469468dbe5cdb', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? h("span", { class: "optional-label" }, "(optional)") : '')), h("div", { key: '1f19b97f0d973264a9fa4c814b43095249496431', id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && h("slot", { key: '325527b35284e3058551175b2c392be1557a1a5e', name: "selected-item" }), h("div", { key: '4da5f55d383ee4725f81bd6d9d174c9231d74f1a', class: { 'selected-container-content': true, 'hidden': this.showFormattedSelectedItem }, id: "selected-container-content", style: {} }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (h("cpsl-text", { key: 'bc83e992888ae73bc863d96ef11d2b849a6f60f8', class: { 'selected-text': true, 'placeholder': !this.selectedValue } }, !this.selectedValue ? ((_a = this.placeholder) !== null && _a !== void 0 ? _a : 'Select') : ((_c = (_b = this.formatValue) === null || _b === void 0 ? void 0 : _b.call(this, this.selectedValue)) !== null && _c !== void 0 ? _c : this.selectedValue)))), h("cpsl-icon", { key: 'f96b40c6101c561b1e7cc605f157697209dd1e59', class: { 'chevron': true, 'open': this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: "chevronUp" }), h("input", { key: '8f660d9215da0960eb4ca37292fd4c400b65de77', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" })), (this.errorText || this.helperText) && (h("div", { key: '26eacb913e1d727ada026ef75a9d7d96478bae9b', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("span", { key: '3ec7937586e52f0858c2e4595596349d8ae4a57d' }, (_d = this.errorText) !== null && _d !== void 0 ? _d : this.helperText))), h("cpsl-popover", { key: '746e0d3b68f1f550c44cdb00f1a846209b34957d', part: "popover", autoWidth: this.autoWidth, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, h("div", { key: 'c1ec487ab2857c0613f3748123d25da32793a008', part: "dropdown", class: "dropdown" }, this.showSearch && (h("div", { key: '342450b93fa5b20d7663c8390ed006921e77b9d4', class: "search-container" }, h("cpsl-input", { key: 'a72472c811025a6d60e4c9bebe37fe7b56707f5d', onClick: e => e.stopPropagation(), placeholder: (_e = this.searchPlaceholder) !== null && _e !== void 0 ? _e : 'Search', value: "", onCpslInput: e => {
91
+ e.stopPropagation();
92
+ this.cpslSearchChange.emit(e.detail.value);
93
+ } }))), h("div", { key: 'c6977cc371d4fb6fce0162d983c53a15dce89590', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, h("slot", { key: 'b867d8f557e56105b7a5c7a5f84d26ef3fd25ac5', name: "items" }))))));
89
94
  }
90
95
  static get is() { return "cpsl-select"; }
91
96
  static get encapsulation() { return "shadow"; }
@@ -101,6 +106,41 @@ export class CpslSelect {
101
106
  }
102
107
  static get properties() {
103
108
  return {
109
+ "anchorElId": {
110
+ "type": "string",
111
+ "mutable": false,
112
+ "complexType": {
113
+ "original": "string",
114
+ "resolved": "string",
115
+ "references": {}
116
+ },
117
+ "required": false,
118
+ "optional": true,
119
+ "docs": {
120
+ "tags": [],
121
+ "text": "ID of element to anchor popover to."
122
+ },
123
+ "attribute": "anchor-el-id",
124
+ "reflect": false
125
+ },
126
+ "autoWidth": {
127
+ "type": "boolean",
128
+ "mutable": false,
129
+ "complexType": {
130
+ "original": "boolean",
131
+ "resolved": "boolean",
132
+ "references": {}
133
+ },
134
+ "required": false,
135
+ "optional": true,
136
+ "docs": {
137
+ "tags": [],
138
+ "text": "If `true` the popover container will use the width of the content, else it will be set to the width of the trigger.\nDefault is `false`"
139
+ },
140
+ "attribute": "auto-width",
141
+ "reflect": false,
142
+ "defaultValue": "false"
143
+ },
104
144
  "disabled": {
105
145
  "type": "boolean",
106
146
  "mutable": false,
@@ -306,6 +346,41 @@ export class CpslSelect {
306
346
  "attribute": "show-optional-label",
307
347
  "reflect": false,
308
348
  "defaultValue": "false"
349
+ },
350
+ "showSearch": {
351
+ "type": "boolean",
352
+ "mutable": false,
353
+ "complexType": {
354
+ "original": "boolean",
355
+ "resolved": "boolean",
356
+ "references": {}
357
+ },
358
+ "required": false,
359
+ "optional": false,
360
+ "docs": {
361
+ "tags": [],
362
+ "text": "If `true`, the dropdown will contain a search field."
363
+ },
364
+ "attribute": "show-search",
365
+ "reflect": false,
366
+ "defaultValue": "false"
367
+ },
368
+ "searchPlaceholder": {
369
+ "type": "string",
370
+ "mutable": false,
371
+ "complexType": {
372
+ "original": "string",
373
+ "resolved": "string",
374
+ "references": {}
375
+ },
376
+ "required": false,
377
+ "optional": true,
378
+ "docs": {
379
+ "tags": [],
380
+ "text": "Placeholder for the search field."
381
+ },
382
+ "attribute": "search-placeholder",
383
+ "reflect": false
309
384
  }
310
385
  };
311
386
  }
@@ -373,6 +448,21 @@ export class CpslSelect {
373
448
  "resolved": "string",
374
449
  "references": {}
375
450
  }
451
+ }, {
452
+ "method": "cpslSearchChange",
453
+ "name": "cpslSearchChange",
454
+ "bubbles": true,
455
+ "cancelable": true,
456
+ "composed": true,
457
+ "docs": {
458
+ "tags": [],
459
+ "text": "Emitted when the search value changes."
460
+ },
461
+ "complexType": {
462
+ "original": "string",
463
+ "resolved": "string",
464
+ "references": {}
465
+ }
376
466
  }];
377
467
  }
378
468
  static get elementRef() { return "el"; }