@usecapsule/core-components 3.0.0 → 3.0.1-dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. package/css/capsule-core.css +83 -14
  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-0d0a0037.entry.js → p-127ac658.entry.js} +2 -2
  8. package/dist/capsule/{p-0d0a0037.entry.js.map → p-127ac658.entry.js.map} +1 -1
  9. package/dist/capsule/p-39584a7b.entry.js +2 -0
  10. package/dist/capsule/p-39584a7b.entry.js.map +1 -0
  11. package/dist/capsule/p-69756614.entry.js +10 -0
  12. package/dist/capsule/{p-d28b96ba.entry.js.map → p-69756614.entry.js.map} +1 -1
  13. package/dist/capsule/p-73398222.entry.js +2 -0
  14. package/dist/capsule/{p-fcead80b.entry.js.map → p-73398222.entry.js.map} +1 -1
  15. package/dist/capsule/p-8de15b15.entry.js +29 -0
  16. package/dist/capsule/p-8de15b15.entry.js.map +1 -0
  17. package/dist/capsule/p-97c33636.js +3 -0
  18. package/dist/capsule/p-97c33636.js.map +1 -0
  19. package/dist/capsule/p-f2393be6.js +2 -0
  20. package/dist/capsule/p-f2393be6.js.map +1 -0
  21. package/dist/capsule/p-f72482c3.entry.js +2 -0
  22. package/dist/capsule/{p-ad14a817.entry.js.map → p-f72482c3.entry.js.map} +1 -1
  23. package/dist/capsule/{p-fa078837.entry.js → p-fd26ce6e.entry.js} +2 -2
  24. package/dist/capsule/{p-fa078837.entry.js.map → p-fd26ce6e.entry.js.map} +1 -1
  25. package/dist/cjs/capsule.cjs.js +10 -10
  26. package/dist/cjs/capsule.cjs.js.map +1 -1
  27. package/dist/cjs/{constants-0869a780.js → constants-9b1b01bb.js} +3 -3
  28. package/dist/cjs/{constants-0869a780.js.map → constants-9b1b01bb.js.map} +1 -1
  29. package/dist/cjs/{cpsl-alert_29.cjs.entry.js → cpsl-alert_33.cjs.entry.js} +608 -95
  30. package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +1 -0
  31. package/dist/cjs/cpsl-animation.cjs.entry.js +2 -2
  32. package/dist/cjs/cpsl-col.cjs.entry.js +2 -2
  33. package/dist/cjs/cpsl-grid.cjs.entry.js +3 -3
  34. package/dist/cjs/cpsl-info-box.cjs.entry.js +3 -3
  35. package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -1
  36. package/dist/cjs/cpsl-modal-v2.cjs.entry.js +55 -0
  37. package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -0
  38. package/dist/cjs/cpsl-row.cjs.entry.js +2 -2
  39. package/dist/cjs/index-5293d431.js +1414 -0
  40. package/dist/cjs/index-5293d431.js.map +1 -0
  41. package/dist/cjs/index.cjs.js +16 -4
  42. package/dist/cjs/index.cjs.js.map +1 -1
  43. package/dist/cjs/loader.cjs.js +2 -2
  44. package/dist/collection/assets/icons/brush.svg +3 -0
  45. package/dist/collection/assets/icons/chevron-up.svg +2 -2
  46. package/dist/collection/assets/icons/close.svg +3 -4
  47. package/dist/collection/assets/icons/cube.svg +3 -0
  48. package/dist/collection/assets/icons/file.svg +3 -0
  49. package/dist/collection/assets/icons/image.svg +3 -0
  50. package/dist/collection/assets/icons/index.js +10 -1
  51. package/dist/collection/assets/icons/index.js.map +1 -1
  52. package/dist/collection/assets/icons/lightning-01.svg +3 -0
  53. package/dist/collection/assets/icons/lightning.svg +2 -2
  54. package/dist/collection/assets/icons/menu.svg +3 -0
  55. package/dist/collection/assets/icons/refresh.svg +3 -0
  56. package/dist/collection/assets/icons/stars.svg +4 -0
  57. package/dist/collection/assets/icons/x.svg +3 -0
  58. package/dist/collection/collection-manifest.json +7 -2
  59. package/dist/collection/components/cpsl-alert/cpsl-alert.js +2 -2
  60. package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
  61. package/dist/collection/components/cpsl-animation/cpsl-animation.js +1 -1
  62. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +20 -4
  63. package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
  64. package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
  65. package/dist/collection/components/cpsl-button/cpsl-button.css +113 -17
  66. package/dist/collection/components/cpsl-button/cpsl-button.js +63 -7
  67. package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
  68. package/dist/collection/components/cpsl-button-group/cpsl-button-group.css +1 -0
  69. package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
  70. package/dist/collection/components/cpsl-card/cpsl-card.css +1 -1
  71. package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
  72. package/dist/collection/components/cpsl-card/cpsl-card.js.map +1 -1
  73. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.css +2 -2
  74. package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
  75. package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +1 -1
  76. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
  77. package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
  78. package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
  79. package/dist/collection/components/cpsl-divider/cpsl-divider.css +1 -1
  80. package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
  81. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +84 -11
  82. package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
  83. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
  84. package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
  85. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.css +210 -0
  86. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +406 -0
  87. package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -0
  88. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +29 -0
  89. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +1 -0
  90. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +37 -0
  91. package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +1 -0
  92. package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
  93. package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
  94. package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -1
  95. package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
  96. package/dist/collection/components/cpsl-input/cpsl-input.css +7 -6
  97. package/dist/collection/components/cpsl-input/cpsl-input.js +3 -8
  98. package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
  99. package/dist/collection/components/cpsl-modal/cpsl-modal.css +4 -4
  100. package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -0
  101. package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
  102. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.css +91 -0
  103. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +224 -0
  104. package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -0
  105. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +29 -0
  106. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +1 -0
  107. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +37 -0
  108. package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +1 -0
  109. package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
  110. package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +1 -1
  111. package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
  112. package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
  113. package/dist/collection/components/cpsl-pill/cpsl-pill.css +1 -1
  114. package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
  115. package/dist/collection/components/cpsl-popover/cpsl-popover.css +98 -0
  116. package/dist/collection/components/cpsl-popover/cpsl-popover.js +470 -0
  117. package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -0
  118. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js +29 -0
  119. package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js.map +1 -0
  120. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js +37 -0
  121. package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js.map +1 -0
  122. package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +3 -3
  123. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +1 -1
  124. package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
  125. package/dist/collection/components/cpsl-radio/cpsl-radio.css +2 -2
  126. package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
  127. package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
  128. package/dist/collection/components/cpsl-select/cpsl-select.css +227 -0
  129. package/dist/collection/components/cpsl-select/cpsl-select.js +393 -0
  130. package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -0
  131. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js +29 -0
  132. package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js.map +1 -0
  133. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js +37 -0
  134. package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js.map +1 -0
  135. package/dist/collection/components/cpsl-select-item/cpsl-select-item.css +104 -0
  136. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +85 -0
  137. package/dist/collection/components/cpsl-select-item/cpsl-select-item.js.map +1 -0
  138. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js +29 -0
  139. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js.map +1 -0
  140. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js +37 -0
  141. package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js.map +1 -0
  142. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +3 -3
  143. package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
  144. package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
  145. package/dist/collection/components/cpsl-switch/cpsl-switch.css +4 -4
  146. package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
  147. package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
  148. package/dist/collection/components/cpsl-table/cpsl-table.css +25 -64
  149. package/dist/collection/components/cpsl-table/cpsl-table.js +1 -63
  150. package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
  151. package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +2 -2
  152. package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +1 -1
  153. package/dist/collection/components/cpsl-text/cpsl-text.css +4 -0
  154. package/dist/collection/components/cpsl-text/cpsl-text.js +5 -4
  155. package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
  156. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +1 -1
  157. package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
  158. package/dist/collection/constants.js +2 -2
  159. package/dist/collection/constants.js.map +1 -1
  160. package/dist/collection/index.js.map +1 -1
  161. package/dist/collection/interface.js.map +1 -1
  162. package/dist/collection/utils/theme/generateBorderRadii.js +4 -0
  163. package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
  164. package/dist/collection/utils/theme/generatePalette.js +11 -3
  165. package/dist/collection/utils/theme/generatePalette.js.map +1 -1
  166. package/dist/esm/capsule.js +11 -11
  167. package/dist/esm/capsule.js.map +1 -1
  168. package/dist/esm/{constants-6acf4ea8.js → constants-fce138fa.js} +3 -3
  169. package/dist/esm/{constants-6acf4ea8.js.map → constants-fce138fa.js.map} +1 -1
  170. package/dist/esm/{cpsl-alert_29.entry.js → cpsl-alert_33.entry.js} +605 -96
  171. package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
  172. package/dist/esm/cpsl-animation.entry.js +2 -2
  173. package/dist/esm/cpsl-col.entry.js +2 -2
  174. package/dist/esm/cpsl-grid.entry.js +3 -3
  175. package/dist/esm/cpsl-info-box.entry.js +3 -3
  176. package/dist/esm/cpsl-info-box.entry.js.map +1 -1
  177. package/dist/esm/cpsl-modal-v2.entry.js +51 -0
  178. package/dist/esm/cpsl-modal-v2.entry.js.map +1 -0
  179. package/dist/esm/cpsl-row.entry.js +2 -2
  180. package/dist/esm/index-97ed6ec1.js +1383 -0
  181. package/dist/esm/index-97ed6ec1.js.map +1 -0
  182. package/dist/esm/index.js +16 -4
  183. package/dist/esm/index.js.map +1 -1
  184. package/dist/esm/loader.js +3 -3
  185. package/dist/loader/cdn.js +1 -3
  186. package/dist/loader/index.cjs.js +1 -3
  187. package/dist/loader/index.es2017.js +1 -3
  188. package/dist/loader/index.js +1 -3
  189. package/dist/types/assets/icons/index.d.ts +9 -0
  190. package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +1 -0
  191. package/dist/types/components/cpsl-button/cpsl-button.d.ts +4 -1
  192. package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +10 -1
  193. package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +34 -0
  194. package/dist/types/components/cpsl-input/cpsl-input.d.ts +1 -1
  195. package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +17 -0
  196. package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +33 -0
  197. package/dist/types/components/cpsl-select/cpsl-select.d.ts +35 -0
  198. package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +8 -0
  199. package/dist/types/components/cpsl-table/cpsl-table.d.ts +0 -3
  200. package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
  201. package/dist/types/components.d.ts +580 -28
  202. package/dist/types/constants.d.ts +2 -2
  203. package/dist/types/index.d.ts +1 -1
  204. package/dist/types/interface.d.ts +44 -0
  205. package/dist/types/stencil-public-runtime.d.ts +3 -8
  206. package/package.json +2 -3
  207. package/dist/capsule/p-4d8e4d86.entry.js +0 -29
  208. package/dist/capsule/p-4d8e4d86.entry.js.map +0 -1
  209. package/dist/capsule/p-86e48e61.js +0 -3
  210. package/dist/capsule/p-86e48e61.js.map +0 -1
  211. package/dist/capsule/p-ad14a817.entry.js +0 -2
  212. package/dist/capsule/p-b6b38e73.js +0 -2
  213. package/dist/capsule/p-b6b38e73.js.map +0 -1
  214. package/dist/capsule/p-d28b96ba.entry.js +0 -10
  215. package/dist/capsule/p-fcead80b.entry.js +0 -2
  216. package/dist/cjs/cpsl-alert_29.cjs.entry.js.map +0 -1
  217. package/dist/cjs/index-5733071e.js +0 -2020
  218. package/dist/cjs/index-5733071e.js.map +0 -1
  219. package/dist/collection/components/cpsl-table/table-interface.js +0 -2
  220. package/dist/collection/components/cpsl-table/table-interface.js.map +0 -1
  221. package/dist/esm/cpsl-alert_29.entry.js.map +0 -1
  222. package/dist/esm/index-8fe9f35e.js +0 -1990
  223. package/dist/esm/index-8fe9f35e.js.map +0 -1
  224. package/dist/esm/polyfills/core-js.js +0 -11
  225. package/dist/esm/polyfills/dom.js +0 -79
  226. package/dist/esm/polyfills/es5-html-element.js +0 -1
  227. package/dist/esm/polyfills/index.js +0 -34
  228. package/dist/esm/polyfills/system.js +0 -6
  229. package/dist/types/components/cpsl-table/table-interface.d.ts +0 -19
@@ -0,0 +1,470 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try {
5
+ step(generator.next(value));
6
+ }
7
+ catch (e) {
8
+ reject(e);
9
+ } }
10
+ function rejected(value) { try {
11
+ step(generator["throw"](value));
12
+ }
13
+ catch (e) {
14
+ reject(e);
15
+ } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ import { Host, h } from "@stencil/core";
21
+ export class CpslPopover {
22
+ constructor() {
23
+ this.triggerClicked = false;
24
+ this.configureTriggerInteraction = () => {
25
+ const { trigger, triggerAction, destroyTriggerInteraction } = this;
26
+ if (Boolean(destroyTriggerInteraction)) {
27
+ destroyTriggerInteraction();
28
+ }
29
+ if (trigger === undefined) {
30
+ return;
31
+ }
32
+ this.triggerEl = document.getElementById(trigger);
33
+ if (!Boolean(this.triggerEl)) {
34
+ console.error(`A trigger element with the ID "${trigger}" was not found in the DOM.`, this.el);
35
+ return;
36
+ }
37
+ let triggerCallbacks = [];
38
+ switch (triggerAction) {
39
+ case 'hover':
40
+ triggerCallbacks = [
41
+ {
42
+ eventName: 'mouseenter',
43
+ callback: () => __awaiter(this, void 0, void 0, function* () {
44
+ this.present();
45
+ }),
46
+ },
47
+ {
48
+ eventName: 'mouseleave',
49
+ callback: () => {
50
+ if (!this.containerEl.matches(':hover')) {
51
+ this.close();
52
+ }
53
+ else {
54
+ this.containerEl.addEventListener('mouseleave', () => {
55
+ this.close();
56
+ });
57
+ }
58
+ },
59
+ },
60
+ {
61
+ eventName: 'click',
62
+ callback: (ev) => ev.stopPropagation(),
63
+ },
64
+ ];
65
+ break;
66
+ case 'click':
67
+ default:
68
+ triggerCallbacks = [
69
+ {
70
+ eventName: 'mousedown',
71
+ callback: e => {
72
+ if (this.preventBlur) {
73
+ e.preventDefault();
74
+ }
75
+ this.present();
76
+ },
77
+ },
78
+ ];
79
+ break;
80
+ }
81
+ triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.addEventListener(eventName, callback));
82
+ this.destroyTriggerInteraction = () => {
83
+ triggerCallbacks.forEach(({ eventName, callback }) => this.triggerEl.removeEventListener(eventName, callback));
84
+ };
85
+ };
86
+ this.setPosition = () => {
87
+ if (Boolean(this.triggerEl)) {
88
+ const windowWidth = window.innerWidth;
89
+ const windowHeight = window.innerHeight;
90
+ const elWidth = this.el.clientWidth;
91
+ const elHeight = this.el.clientHeight;
92
+ const { top, left, height, width } = this.triggerEl.getBoundingClientRect();
93
+ switch (this.anchorOriginHorizontal) {
94
+ case 'left': {
95
+ this.positionX = left;
96
+ break;
97
+ }
98
+ case 'center': {
99
+ this.positionX = left + width / 2;
100
+ break;
101
+ }
102
+ case 'right': {
103
+ this.positionX = left + width;
104
+ break;
105
+ }
106
+ }
107
+ switch (this.anchorOriginVertical) {
108
+ case 'top': {
109
+ this.positionY = top;
110
+ break;
111
+ }
112
+ case 'center': {
113
+ this.positionY = top + height / 2;
114
+ break;
115
+ }
116
+ case 'bottom': {
117
+ this.positionY = top + height;
118
+ break;
119
+ }
120
+ }
121
+ if (this.positionY < this.windowPadding) {
122
+ this.positionY = this.windowPadding;
123
+ }
124
+ if (this.positionY + elHeight > windowHeight - 16) {
125
+ this.positionY = windowHeight - this.windowPadding - elHeight;
126
+ }
127
+ if (this.positionX < this.windowPadding) {
128
+ this.positionX = this.windowPadding;
129
+ }
130
+ if (this.positionX + elWidth > windowWidth - 16) {
131
+ this.positionX = windowWidth - this.windowPadding - elWidth;
132
+ }
133
+ }
134
+ };
135
+ this.handleClickOutside = (event) => {
136
+ if (!this.triggerClicked && this.triggerEl.contains(event.target)) {
137
+ this.triggerClicked = true;
138
+ return;
139
+ }
140
+ if (this.open && !this.el.contains(event.target)) {
141
+ event.preventDefault();
142
+ this.close();
143
+ }
144
+ };
145
+ this.present = () => {
146
+ if (!this.open) {
147
+ this.open = true;
148
+ this.cpslOpen.emit();
149
+ this.setPosition();
150
+ }
151
+ };
152
+ this.close = () => {
153
+ this.open = false;
154
+ this.triggerClicked = false;
155
+ this.cpslClose.emit();
156
+ };
157
+ this.open = false;
158
+ this.positionX = undefined;
159
+ this.positionY = undefined;
160
+ this.anchorOriginHorizontal = 'left';
161
+ this.anchorOriginVertical = 'bottom';
162
+ this.autoWidth = true;
163
+ this.preventBlur = undefined;
164
+ this.transformOriginHorizontal = 'left';
165
+ this.transformOriginVertical = 'top';
166
+ this.triggerAction = 'click';
167
+ this.trigger = undefined;
168
+ this.windowPadding = 16;
169
+ }
170
+ closePopover() {
171
+ return __awaiter(this, void 0, void 0, function* () {
172
+ this.close();
173
+ });
174
+ }
175
+ onTriggerChange() {
176
+ this.configureTriggerInteraction();
177
+ }
178
+ onAnchorChange() {
179
+ this.setPosition();
180
+ }
181
+ onOpenChange() {
182
+ if (this.open) {
183
+ window.addEventListener('click', this.handleClickOutside);
184
+ window.addEventListener('scroll', () => this.setPosition());
185
+ }
186
+ else {
187
+ window.removeEventListener('click', this.handleClickOutside);
188
+ window.addEventListener('scroll', () => this.setPosition());
189
+ }
190
+ }
191
+ componentDidLoad() {
192
+ this.configureTriggerInteraction();
193
+ }
194
+ get containerEl() {
195
+ var _a, _b;
196
+ return (_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById('container');
197
+ }
198
+ render() {
199
+ var _a;
200
+ return (h(Host, { key: '2c1f03932520d63cc98ddd3496125bf08104e1ba', class: {
201
+ 'open': this.open,
202
+ 'transform-h-left': this.transformOriginHorizontal === 'left',
203
+ 'transform-h-center': this.transformOriginHorizontal === 'center',
204
+ 'transform-h-right': this.transformOriginHorizontal === 'right',
205
+ 'transform-v-top': this.transformOriginVertical === 'top',
206
+ 'transform-v-center': this.transformOriginVertical === 'center',
207
+ 'transform-v-bottom': this.transformOriginVertical === 'bottom',
208
+ }, style: { top: `${this.positionY}px`, left: `${this.positionX}px`, width: this.autoWidth ? 'auto' : `${(_a = this.triggerEl) === null || _a === void 0 ? void 0 : _a.clientWidth}px` } }, h("div", { key: '97a28f240533a7a1d4e1200769086e13666a94e4', id: "container", class: { container: true, open: this.open } }, h("slot", { key: 'efacb33d8dae9abef32fdc9a7b1047384cc0cd38' }))));
209
+ }
210
+ static get is() { return "cpsl-popover"; }
211
+ static get encapsulation() { return "shadow"; }
212
+ static get originalStyleUrls() {
213
+ return {
214
+ "$": ["cpsl-popover.scss"]
215
+ };
216
+ }
217
+ static get styleUrls() {
218
+ return {
219
+ "$": ["cpsl-popover.css"]
220
+ };
221
+ }
222
+ static get properties() {
223
+ return {
224
+ "anchorOriginHorizontal": {
225
+ "type": "string",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "'left' | 'center' | 'right'",
229
+ "resolved": "\"center\" | \"left\" | \"right\"",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": true,
234
+ "docs": {
235
+ "tags": [],
236
+ "text": "Vertical anchor origin.\nOptions are: `\"left\"`, `\"center\"`, `\"right\"`.\nDefault is: `\"left\"`."
237
+ },
238
+ "attribute": "anchor-origin-horizontal",
239
+ "reflect": false,
240
+ "defaultValue": "'left'"
241
+ },
242
+ "anchorOriginVertical": {
243
+ "type": "string",
244
+ "mutable": false,
245
+ "complexType": {
246
+ "original": "'top' | 'center' | 'bottom'",
247
+ "resolved": "\"bottom\" | \"center\" | \"top\"",
248
+ "references": {}
249
+ },
250
+ "required": false,
251
+ "optional": true,
252
+ "docs": {
253
+ "tags": [],
254
+ "text": "Vertical anchor origin.\nOptions are: `\"top\"`, `\"center\"`, `\"bottom\"`.\nDefault is: `\"bottom\"`."
255
+ },
256
+ "attribute": "anchor-origin-vertical",
257
+ "reflect": false,
258
+ "defaultValue": "'bottom'"
259
+ },
260
+ "autoWidth": {
261
+ "type": "boolean",
262
+ "mutable": false,
263
+ "complexType": {
264
+ "original": "boolean",
265
+ "resolved": "boolean",
266
+ "references": {}
267
+ },
268
+ "required": false,
269
+ "optional": true,
270
+ "docs": {
271
+ "tags": [],
272
+ "text": "If `true` the container will use the width of the content, else it will be set to the width of the trigger.\nDefault is `true`"
273
+ },
274
+ "attribute": "auto-width",
275
+ "reflect": false,
276
+ "defaultValue": "true"
277
+ },
278
+ "preventBlur": {
279
+ "type": "boolean",
280
+ "mutable": false,
281
+ "complexType": {
282
+ "original": "boolean",
283
+ "resolved": "boolean",
284
+ "references": {}
285
+ },
286
+ "required": false,
287
+ "optional": false,
288
+ "docs": {
289
+ "tags": [],
290
+ "text": "Used internally to prevent select from blurring unintentionally."
291
+ },
292
+ "attribute": "prevent-blur",
293
+ "reflect": false
294
+ },
295
+ "transformOriginHorizontal": {
296
+ "type": "string",
297
+ "mutable": false,
298
+ "complexType": {
299
+ "original": "'left' | 'center' | 'right'",
300
+ "resolved": "\"center\" | \"left\" | \"right\"",
301
+ "references": {}
302
+ },
303
+ "required": false,
304
+ "optional": true,
305
+ "docs": {
306
+ "tags": [],
307
+ "text": "Vertical transformation origin.\nOptions are: `\"left\"`, `\"center\"`, `\"right\"`.\nDefault is: `\"left\"`."
308
+ },
309
+ "attribute": "transform-origin-horizontal",
310
+ "reflect": false,
311
+ "defaultValue": "'left'"
312
+ },
313
+ "transformOriginVertical": {
314
+ "type": "string",
315
+ "mutable": false,
316
+ "complexType": {
317
+ "original": "'top' | 'center' | 'bottom'",
318
+ "resolved": "\"bottom\" | \"center\" | \"top\"",
319
+ "references": {}
320
+ },
321
+ "required": false,
322
+ "optional": true,
323
+ "docs": {
324
+ "tags": [],
325
+ "text": "Vertical transformation origin.\nOptions are: `\"top\"`, `\"center\"`, `\"bottom\"`.\nDefault is: `\"bottom\"`."
326
+ },
327
+ "attribute": "transform-origin-vertical",
328
+ "reflect": false,
329
+ "defaultValue": "'top'"
330
+ },
331
+ "triggerAction": {
332
+ "type": "string",
333
+ "mutable": false,
334
+ "complexType": {
335
+ "original": "'click' | 'hover'",
336
+ "resolved": "\"click\" | \"hover\"",
337
+ "references": {}
338
+ },
339
+ "required": false,
340
+ "optional": false,
341
+ "docs": {
342
+ "tags": [],
343
+ "text": "Which trigger causes the popover to open.\nOptions are: `\"click\"`, `\"hover\"`.\nDefault is: `\"click\"`."
344
+ },
345
+ "attribute": "trigger-action",
346
+ "reflect": false,
347
+ "defaultValue": "'click'"
348
+ },
349
+ "trigger": {
350
+ "type": "string",
351
+ "mutable": false,
352
+ "complexType": {
353
+ "original": "string",
354
+ "resolved": "string",
355
+ "references": {}
356
+ },
357
+ "required": false,
358
+ "optional": false,
359
+ "docs": {
360
+ "tags": [],
361
+ "text": "ID for the element that triggers the popover to open."
362
+ },
363
+ "attribute": "trigger",
364
+ "reflect": false
365
+ },
366
+ "windowPadding": {
367
+ "type": "number",
368
+ "mutable": false,
369
+ "complexType": {
370
+ "original": "number",
371
+ "resolved": "number",
372
+ "references": {}
373
+ },
374
+ "required": false,
375
+ "optional": true,
376
+ "docs": {
377
+ "tags": [],
378
+ "text": "Padding from edge of window for the popover container."
379
+ },
380
+ "attribute": "window-padding",
381
+ "reflect": false,
382
+ "defaultValue": "16"
383
+ }
384
+ };
385
+ }
386
+ static get states() {
387
+ return {
388
+ "open": {},
389
+ "positionX": {},
390
+ "positionY": {}
391
+ };
392
+ }
393
+ static get events() {
394
+ return [{
395
+ "method": "cpslOpen",
396
+ "name": "cpslOpen",
397
+ "bubbles": true,
398
+ "cancelable": true,
399
+ "composed": true,
400
+ "docs": {
401
+ "tags": [],
402
+ "text": "Emitted when the popover opens."
403
+ },
404
+ "complexType": {
405
+ "original": "void",
406
+ "resolved": "void",
407
+ "references": {}
408
+ }
409
+ }, {
410
+ "method": "cpslClose",
411
+ "name": "cpslClose",
412
+ "bubbles": true,
413
+ "cancelable": true,
414
+ "composed": true,
415
+ "docs": {
416
+ "tags": [],
417
+ "text": "Emitted when the popover closes."
418
+ },
419
+ "complexType": {
420
+ "original": "void",
421
+ "resolved": "void",
422
+ "references": {}
423
+ }
424
+ }];
425
+ }
426
+ static get methods() {
427
+ return {
428
+ "closePopover": {
429
+ "complexType": {
430
+ "signature": "() => Promise<void>",
431
+ "parameters": [],
432
+ "references": {
433
+ "Promise": {
434
+ "location": "global",
435
+ "id": "global::Promise"
436
+ }
437
+ },
438
+ "return": "Promise<void>"
439
+ },
440
+ "docs": {
441
+ "text": "Call to close the popover manually.",
442
+ "tags": []
443
+ }
444
+ }
445
+ };
446
+ }
447
+ static get elementRef() { return "el"; }
448
+ static get watchers() {
449
+ return [{
450
+ "propName": "trigger",
451
+ "methodName": "onTriggerChange"
452
+ }, {
453
+ "propName": "triggerAction",
454
+ "methodName": "onTriggerChange"
455
+ }, {
456
+ "propName": "preventBlur",
457
+ "methodName": "onTriggerChange"
458
+ }, {
459
+ "propName": "anchorOriginHorizontal",
460
+ "methodName": "onAnchorChange"
461
+ }, {
462
+ "propName": "anchorOriginVertical",
463
+ "methodName": "onAnchorChange"
464
+ }, {
465
+ "propName": "open",
466
+ "methodName": "onOpenChange"
467
+ }];
468
+ }
469
+ }
470
+ //# sourceMappingURL=cpsl-popover.js.map
@@ -0,0 +1 @@
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;QA2GvB,gCAA2B,GAAG,GAAG,EAAE;YACzC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;YAEnE,IAAI,OAAO,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBACvC,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,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC7B,OAAO,CAAC,KAAK,CAAC,kCA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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 * 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 * 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());\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 if (Boolean(this.triggerEl)) {\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 } = this.triggerEl.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) {\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.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"]}
@@ -0,0 +1,29 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try {
5
+ step(generator.next(value));
6
+ }
7
+ catch (e) {
8
+ reject(e);
9
+ } }
10
+ function rejected(value) { try {
11
+ step(generator["throw"](value));
12
+ }
13
+ catch (e) {
14
+ reject(e);
15
+ } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ import { newE2EPage } from "@stencil/core/testing";
21
+ describe('cpsl-popover', () => {
22
+ it('renders', () => __awaiter(void 0, void 0, void 0, function* () {
23
+ const page = yield newE2EPage();
24
+ yield page.setContent('<cpsl-popover></cpsl-popover>');
25
+ const element = yield page.find('cpsl-popover');
26
+ expect(element).toHaveClass('hydrated');
27
+ }));
28
+ });
29
+ //# sourceMappingURL=cpsl-popover.e2e.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpsl-popover.e2e.js","sourceRoot":"","sources":["../../../../../src/components/cpsl-popover/test/cpsl-popover.e2e.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,UAAU,EAAE,CAAC;QAChC,MAAM,IAAI,CAAC,UAAU,CAAC,+BAA+B,CAAC,CAAC;QAEvD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC1C,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newE2EPage } from '@stencil/core/testing';\n\ndescribe('cpsl-popover', () => {\n it('renders', async () => {\n const page = await newE2EPage();\n await page.setContent('<cpsl-popover></cpsl-popover>');\n\n const element = await page.find('cpsl-popover');\n expect(element).toHaveClass('hydrated');\n });\n});\n"]}
@@ -0,0 +1,37 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try {
5
+ step(generator.next(value));
6
+ }
7
+ catch (e) {
8
+ reject(e);
9
+ } }
10
+ function rejected(value) { try {
11
+ step(generator["throw"](value));
12
+ }
13
+ catch (e) {
14
+ reject(e);
15
+ } }
16
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
17
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
18
+ });
19
+ };
20
+ import { newSpecPage } from "@stencil/core/testing";
21
+ import { CpslPopover } from "../cpsl-popover";
22
+ describe('cpsl-popover', () => {
23
+ it('renders', () => __awaiter(void 0, void 0, void 0, function* () {
24
+ const page = yield newSpecPage({
25
+ components: [CpslPopover],
26
+ html: `<cpsl-popover></cpsl-popover>`,
27
+ });
28
+ expect(page.root).toEqualHtml(`
29
+ <cpsl-popover>
30
+ <mock:shadow-root>
31
+ <slot></slot>
32
+ </mock:shadow-root>
33
+ </cpsl-popover>
34
+ `);
35
+ }));
36
+ });
37
+ //# sourceMappingURL=cpsl-popover.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cpsl-popover.spec.js","sourceRoot":"","sources":["../../../../../src/components/cpsl-popover/test/cpsl-popover.spec.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,EAAE,CAAC,SAAS,EAAE,GAAS,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,WAAW,CAAC;YAC7B,UAAU,EAAE,CAAC,WAAW,CAAC;YACzB,IAAI,EAAE,+BAA+B;SACtC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,WAAW,CAAC;;;;;;KAM7B,CAAC,CAAC;IACL,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { newSpecPage } from '@stencil/core/testing';\nimport { CpslPopover } from '../cpsl-popover';\n\ndescribe('cpsl-popover', () => {\n it('renders', async () => {\n const page = await newSpecPage({\n components: [CpslPopover],\n html: `<cpsl-popover></cpsl-popover>`,\n });\n expect(page.root).toEqualHtml(`\n <cpsl-popover>\n <mock:shadow-root>\n <slot></slot>\n </mock:shadow-root>\n </cpsl-popover>\n `);\n });\n});\n"]}
@@ -65,7 +65,7 @@
65
65
  }
66
66
 
67
67
  .step {
68
- background-color: var(--step-next-color);
68
+ background: var(--step-next-color);
69
69
  border-radius: var(--step-border-radius, calc(var(--step-height) * 2));
70
70
  height: var(--step-height);
71
71
  flex: 1;
@@ -73,10 +73,10 @@
73
73
  }
74
74
 
75
75
  .previous {
76
- background-color: var(--step-previous-color);
76
+ background: var(--step-previous-color);
77
77
  }
78
78
 
79
79
  .active {
80
- background-color: var(--step-active-color);
80
+ background: var(--step-active-color);
81
81
  flex: 2;
82
82
  }
@@ -76,6 +76,6 @@
76
76
  border-width: var(--qr-border-width);
77
77
  border-color: var(--qr-border-color);
78
78
  border-radius: var(--qr-border-radius);
79
- background-color: var(--qr-background-color);
79
+ background: var(--qr-background-color);
80
80
  box-shadow: var(--qr-box-shadow);
81
81
  }
@@ -32,7 +32,7 @@ export class CpslQrCode {
32
32
  qrCode.append(container);
33
33
  }
34
34
  render() {
35
- return (h(Host, { key: '249236c83c51fa7b3bf66c74a3e122f945288313' }, h("div", { key: 'cd899dac84d029d89648572584ffddae0c98ab37', id: "qr-container", class: "qr-container" })));
35
+ return (h(Host, { key: '68a11eb026f62f795a769b4bb5b91509bda57c55' }, h("div", { key: 'da47238221fed966d47e50471af27d0eaa407e2a', id: "qr-container", class: "qr-container" })));
36
36
  }
37
37
  static get is() { return "cpsl-qr-code"; }
38
38
  static get encapsulation() { return "shadow"; }
@@ -86,12 +86,12 @@ span.container {
86
86
  height: 100%;
87
87
  border-radius: var(--container-border-radius);
88
88
  border: var(--container-border-width-default) solid;
89
- background-color: var(--container-background-color-default);
89
+ background: var(--container-background-color-default);
90
90
  border-color: var(--container-border-color-default);
91
91
  transition: all 0.15s ease-in-out;
92
92
  }
93
93
  span.container.checked {
94
- background-color: var(--container-background-color-checked);
94
+ background: var(--container-background-color-checked);
95
95
  border-color: var(--container-border-color-checked);
96
96
  border-width: var(--container-border-width-checked);
97
97
  }
@@ -9,7 +9,7 @@ export class CpslRadio {
9
9
  this.checked = undefined;
10
10
  }
11
11
  render() {
12
- return (h(Host, { key: '9c027812c817ec008e28b66fb74ca35e407f2572' }, h("input", { key: 'da445cfc2c18da5852cd21d54daf14897d3bc13a', type: "radio", checked: this.checked }), h("span", { key: '2f432d7c3a6f33ea7581a8c62dd84078de1904d1', onClick: this.handleRadioClick, class: { container: true, checked: this.checked } })));
12
+ return (h(Host, { key: '43659e8ba43bfe8a53578d357d2ab9a3c3bcbd96' }, h("input", { key: 'dc9c9328be5a09b00b4e02b74934ffa02312441d', type: "radio", checked: this.checked }), h("span", { key: '87436a09ace01394e860786950a916efb26a9bb7', 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: '4a88600c071a5ec733e3480e94037c2936effacd' }, h("slot", { key: '6ed654883b1acd711843480702821efba06cec96' })));
4
+ return (h(Host, { key: 'a227664834127c3580926c34abdc7aacdbd9ffd6' }, h("slot", { key: '61010658365df7a30f0e3b05f45436da5acf6720' })));
5
5
  }
6
6
  static get is() { return "cpsl-row"; }
7
7
  static get encapsulation() { return "shadow"; }