@usecapsule/core-components 3.0.1 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/capsule-core.css +93 -24
- package/css/capsule-core.css.map +1 -1
- package/dist/capsule/capsule.esm.js +1 -1
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/index.esm.js +1 -1
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/p-397edab5.entry.js +2 -0
- package/dist/capsule/{p-ad14a817.entry.js.map → p-397edab5.entry.js.map} +1 -1
- package/dist/capsule/p-52d6ebee.entry.js +2 -0
- package/dist/capsule/{p-fcead80b.entry.js.map → p-52d6ebee.entry.js.map} +1 -1
- package/dist/capsule/p-5ed5e96c.entry.js +2 -0
- package/dist/capsule/p-5ed5e96c.entry.js.map +1 -0
- package/dist/capsule/p-6e71539d.js +3 -0
- package/dist/capsule/p-6e71539d.js.map +1 -0
- package/dist/capsule/p-6e900654.entry.js +29 -0
- package/dist/capsule/p-6e900654.entry.js.map +1 -0
- package/dist/capsule/{p-0d0a0037.entry.js → p-70f95c93.entry.js} +2 -2
- package/dist/capsule/{p-0d0a0037.entry.js.map → p-70f95c93.entry.js.map} +1 -1
- package/dist/capsule/p-86e6cba5.entry.js +10 -0
- package/dist/capsule/{p-d28b96ba.entry.js.map → p-86e6cba5.entry.js.map} +1 -1
- package/dist/capsule/p-f2393be6.js +2 -0
- package/dist/capsule/p-f2393be6.js.map +1 -0
- package/dist/capsule/{p-fa078837.entry.js → p-f9351426.entry.js} +2 -2
- package/dist/capsule/{p-fa078837.entry.js.map → p-f9351426.entry.js.map} +1 -1
- package/dist/cjs/capsule.cjs.js +10 -10
- package/dist/cjs/capsule.cjs.js.map +1 -1
- package/dist/cjs/{constants-0869a780.js → constants-9b1b01bb.js} +3 -3
- package/dist/cjs/{constants-0869a780.js.map → constants-9b1b01bb.js.map} +1 -1
- package/dist/cjs/{cpsl-alert_29.cjs.entry.js → cpsl-alert_33.cjs.entry.js} +663 -94
- package/dist/cjs/cpsl-alert_33.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js +2 -2
- package/dist/cjs/cpsl-col.cjs.entry.js +2 -2
- package/dist/cjs/cpsl-grid.cjs.entry.js +3 -3
- package/dist/cjs/cpsl-info-box.cjs.entry.js +3 -3
- package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-modal-v2.cjs.entry.js +55 -0
- package/dist/cjs/cpsl-modal-v2.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-row.cjs.entry.js +2 -2
- package/dist/cjs/index-85125285.js +1414 -0
- package/dist/cjs/index-85125285.js.map +1 -0
- package/dist/cjs/index.cjs.js +116 -107
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/assets/icons/chevron-up.svg +2 -2
- package/dist/collection/assets/icons/close.svg +3 -4
- package/dist/collection/assets/icons/cube.svg +3 -0
- package/dist/collection/assets/icons/farcaster-brand.svg +10 -0
- package/dist/collection/assets/icons/farcaster.svg +10 -0
- package/dist/collection/assets/icons/image.svg +3 -0
- package/dist/collection/assets/icons/index.js +9 -1
- package/dist/collection/assets/icons/index.js.map +1 -1
- package/dist/collection/assets/icons/menu.svg +3 -0
- package/dist/collection/assets/icons/refresh.svg +3 -0
- package/dist/collection/assets/icons/stars.svg +4 -0
- package/dist/collection/assets/icons/x.svg +3 -0
- package/dist/collection/collection-manifest.json +7 -2
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +2 -2
- package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -1
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +1 -1
- package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js +20 -4
- package/dist/collection/components/cpsl-app-bar/cpsl-app-bar.js.map +1 -1
- package/dist/collection/components/cpsl-avatar/cpsl-avatar.js +1 -1
- package/dist/collection/components/cpsl-button/cpsl-button.css +113 -17
- package/dist/collection/components/cpsl-button/cpsl-button.js +63 -7
- package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -1
- package/dist/collection/components/cpsl-button-group/cpsl-button-group.css +1 -0
- package/dist/collection/components/cpsl-button-group/cpsl-button-group.js +1 -1
- package/dist/collection/components/cpsl-card/cpsl-card.css +1 -1
- package/dist/collection/components/cpsl-card/cpsl-card.js +1 -1
- package/dist/collection/components/cpsl-card/cpsl-card.js.map +1 -1
- package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.css +2 -2
- package/dist/collection/components/cpsl-checkbox/cpsl-checkbox.js +1 -1
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +1 -1
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +2 -2
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -1
- package/dist/collection/components/cpsl-col/cpsl-col.js +1 -1
- package/dist/collection/components/cpsl-divider/cpsl-divider.css +1 -1
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +1 -1
- package/dist/collection/components/cpsl-drawer/cpsl-drawer.js +84 -11
- package/dist/collection/components/cpsl-drawer/cpsl-drawer.js.map +1 -1
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +1 -1
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.css +211 -0
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js +406 -0
- package/dist/collection/components/cpsl-file-upload/cpsl-file-upload.js.map +1 -0
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js +29 -0
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js +37 -0
- package/dist/collection/components/cpsl-file-upload/test/cpsl-file-upload.spec.js.map +1 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +2 -2
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +2 -2
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +1 -1
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +1 -1
- package/dist/collection/components/cpsl-input/cpsl-input.css +7 -6
- package/dist/collection/components/cpsl-input/cpsl-input.js +3 -8
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
- package/dist/collection/components/cpsl-modal/cpsl-modal.css +4 -4
- package/dist/collection/components/cpsl-modal/cpsl-modal.js +1 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -1
- package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.css +91 -0
- package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js +224 -0
- package/dist/collection/components/cpsl-modal-v2/cpsl-modal-v2.js.map +1 -0
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js +29 -0
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js +37 -0
- package/dist/collection/components/cpsl-modal-v2/test/cpsl-modal-v2.spec.js.map +1 -0
- package/dist/collection/components/cpsl-nav-button-group/cpsl-nav-button-group.js +1 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +1 -1
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +1 -1
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.css +4 -0
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.js +1 -1
- package/dist/collection/components/cpsl-pagination/cpsl-pagination.js.map +1 -1
- package/dist/collection/components/cpsl-pill/cpsl-pill.css +1 -1
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +1 -1
- package/dist/collection/components/cpsl-popover/cpsl-popover.css +98 -0
- package/dist/collection/components/cpsl-popover/cpsl-popover.js +511 -0
- package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -0
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js +29 -0
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js +37 -0
- package/dist/collection/components/cpsl-popover/test/cpsl-popover.spec.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +3 -3
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +1 -1
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +1 -1
- package/dist/collection/components/cpsl-radio/cpsl-radio.css +2 -2
- package/dist/collection/components/cpsl-radio/cpsl-radio.js +1 -1
- package/dist/collection/components/cpsl-row/cpsl-row.js +1 -1
- package/dist/collection/components/cpsl-select/cpsl-select.css +229 -0
- package/dist/collection/components/cpsl-select/cpsl-select.js +409 -0
- package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -0
- package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js +29 -0
- package/dist/collection/components/cpsl-select/test/cpsl-select.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js +37 -0
- package/dist/collection/components/cpsl-select/test/cpsl-select.spec.js.map +1 -0
- package/dist/collection/components/cpsl-select-item/cpsl-select-item.css +114 -0
- package/dist/collection/components/cpsl-select-item/cpsl-select-item.js +85 -0
- package/dist/collection/components/cpsl-select-item/cpsl-select-item.js.map +1 -0
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js +29 -0
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js +37 -0
- package/dist/collection/components/cpsl-select-item/test/cpsl-select-item.spec.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +3 -3
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +3 -3
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +2 -2
- package/dist/collection/components/cpsl-switch/cpsl-switch.css +4 -4
- package/dist/collection/components/cpsl-switch/cpsl-switch.js +1 -1
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +1 -1
- package/dist/collection/components/cpsl-table/cpsl-table.css +48 -60
- package/dist/collection/components/cpsl-table/cpsl-table.js +34 -58
- package/dist/collection/components/cpsl-table/cpsl-table.js.map +1 -1
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +2 -2
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +1 -1
- package/dist/collection/components/cpsl-text/cpsl-text.css +4 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js +5 -4
- package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -1
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +1 -1
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +2 -2
- package/dist/collection/constants.js +2 -2
- package/dist/collection/constants.js.map +1 -1
- package/dist/collection/interface.js.map +1 -1
- package/dist/collection/utils/theme/generateBorderRadii.js +40 -39
- package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -1
- package/dist/collection/utils/theme/generatePalette.js +11 -3
- package/dist/collection/utils/theme/generatePalette.js.map +1 -1
- package/dist/collection/utils/theme/generateTheme.js +2 -2
- package/dist/collection/utils/theme/generateTheme.js.map +1 -1
- package/dist/collection/utils/theme/utils.js +1 -0
- package/dist/collection/utils/theme/utils.js.map +1 -1
- package/dist/esm/capsule.js +11 -11
- package/dist/esm/capsule.js.map +1 -1
- package/dist/esm/{constants-6acf4ea8.js → constants-fce138fa.js} +3 -3
- package/dist/esm/{constants-6acf4ea8.js.map → constants-fce138fa.js.map} +1 -1
- package/dist/esm/{cpsl-alert_29.entry.js → cpsl-alert_33.entry.js} +660 -95
- package/dist/esm/cpsl-alert_33.entry.js.map +1 -0
- package/dist/esm/cpsl-animation.entry.js +2 -2
- package/dist/esm/cpsl-col.entry.js +2 -2
- package/dist/esm/cpsl-grid.entry.js +3 -3
- package/dist/esm/cpsl-info-box.entry.js +3 -3
- package/dist/esm/cpsl-info-box.entry.js.map +1 -1
- package/dist/esm/cpsl-modal-v2.entry.js +51 -0
- package/dist/esm/cpsl-modal-v2.entry.js.map +1 -0
- package/dist/esm/cpsl-row.entry.js +2 -2
- package/dist/esm/index-b9a060b3.js +1383 -0
- package/dist/esm/index-b9a060b3.js.map +1 -0
- package/dist/esm/index.js +116 -107
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/loader/cdn.js +1 -3
- package/dist/loader/index.cjs.js +1 -3
- package/dist/loader/index.es2017.js +1 -3
- package/dist/loader/index.js +1 -3
- package/dist/types/assets/icons/index.d.ts +8 -0
- package/dist/types/components/cpsl-app-bar/cpsl-app-bar.d.ts +1 -0
- package/dist/types/components/cpsl-button/cpsl-button.d.ts +4 -1
- package/dist/types/components/cpsl-drawer/cpsl-drawer.d.ts +10 -1
- package/dist/types/components/cpsl-file-upload/cpsl-file-upload.d.ts +34 -0
- package/dist/types/components/cpsl-input/cpsl-input.d.ts +1 -1
- package/dist/types/components/cpsl-modal-v2/cpsl-modal-v2.d.ts +17 -0
- package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +35 -0
- package/dist/types/components/cpsl-select/cpsl-select.d.ts +38 -0
- package/dist/types/components/cpsl-select-item/cpsl-select-item.d.ts +8 -0
- package/dist/types/components/cpsl-table/cpsl-table.d.ts +6 -3
- package/dist/types/components/cpsl-text/cpsl-text.d.ts +1 -1
- package/dist/types/components.d.ts +596 -28
- package/dist/types/constants.d.ts +2 -2
- package/dist/types/interface.d.ts +68 -1
- package/dist/types/stencil-public-runtime.d.ts +3 -8
- package/dist/types/utils/theme/generateBorderRadii.d.ts +1 -1
- package/dist/types/utils/theme/generateTheme.d.ts +1 -1
- package/dist/types/utils/theme/utils.d.ts +4 -1
- package/package.json +2 -2
- package/dist/capsule/p-107e1ff5.entry.js +0 -29
- package/dist/capsule/p-107e1ff5.entry.js.map +0 -1
- package/dist/capsule/p-86e48e61.js +0 -3
- package/dist/capsule/p-86e48e61.js.map +0 -1
- package/dist/capsule/p-ad14a817.entry.js +0 -2
- package/dist/capsule/p-b6b38e73.js +0 -2
- package/dist/capsule/p-b6b38e73.js.map +0 -1
- package/dist/capsule/p-d28b96ba.entry.js +0 -10
- package/dist/capsule/p-fcead80b.entry.js +0 -2
- package/dist/cjs/cpsl-alert_29.cjs.entry.js.map +0 -1
- package/dist/cjs/index-5733071e.js +0 -2020
- package/dist/cjs/index-5733071e.js.map +0 -1
- package/dist/collection/components/cpsl-table/table-interface.js +0 -2
- package/dist/collection/components/cpsl-table/table-interface.js.map +0 -1
- package/dist/esm/cpsl-alert_29.entry.js.map +0 -1
- package/dist/esm/index-8fe9f35e.js +0 -1990
- package/dist/esm/index-8fe9f35e.js.map +0 -1
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/components/cpsl-table/table-interface.d.ts +0 -19
@@ -0,0 +1,511 @@
|
|
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
|
+
var _a;
|
88
|
+
const anchorEl = (_a = this.anchorEl) !== null && _a !== void 0 ? _a : this.triggerEl;
|
89
|
+
if (Boolean(anchorEl)) {
|
90
|
+
const windowWidth = window.innerWidth;
|
91
|
+
const windowHeight = window.innerHeight;
|
92
|
+
const elWidth = this.el.clientWidth;
|
93
|
+
const elHeight = this.el.clientHeight;
|
94
|
+
const { top, left, height, width } = anchorEl.getBoundingClientRect();
|
95
|
+
switch (this.anchorOriginHorizontal) {
|
96
|
+
case 'left': {
|
97
|
+
this.positionX = left;
|
98
|
+
break;
|
99
|
+
}
|
100
|
+
case 'center': {
|
101
|
+
this.positionX = left + width / 2;
|
102
|
+
break;
|
103
|
+
}
|
104
|
+
case 'right': {
|
105
|
+
this.positionX = left + width;
|
106
|
+
break;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
switch (this.anchorOriginVertical) {
|
110
|
+
case 'top': {
|
111
|
+
this.positionY = top;
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
case 'center': {
|
115
|
+
this.positionY = top + height / 2;
|
116
|
+
break;
|
117
|
+
}
|
118
|
+
case 'bottom': {
|
119
|
+
this.positionY = top + height;
|
120
|
+
break;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
if (this.positionY < this.windowPadding) {
|
124
|
+
this.positionY = this.windowPadding;
|
125
|
+
}
|
126
|
+
if (this.positionY + elHeight > windowHeight - 16) {
|
127
|
+
this.positionY = windowHeight - this.windowPadding - elHeight;
|
128
|
+
}
|
129
|
+
if (this.positionX < this.windowPadding) {
|
130
|
+
this.positionX = this.windowPadding;
|
131
|
+
}
|
132
|
+
if (this.positionX + elWidth > windowWidth - 16) {
|
133
|
+
this.positionX = windowWidth - this.windowPadding - elWidth;
|
134
|
+
}
|
135
|
+
}
|
136
|
+
};
|
137
|
+
this.handleClickOutside = (event) => {
|
138
|
+
if (!this.triggerClicked && this.triggerEl.contains(event.target)) {
|
139
|
+
this.triggerClicked = true;
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
if (this.open && !this.el.contains(event.target)) {
|
143
|
+
event.preventDefault();
|
144
|
+
this.close();
|
145
|
+
}
|
146
|
+
};
|
147
|
+
this.present = () => {
|
148
|
+
if (!this.open && !this.disabled) {
|
149
|
+
this.open = true;
|
150
|
+
this.cpslOpen.emit();
|
151
|
+
this.setPosition();
|
152
|
+
}
|
153
|
+
};
|
154
|
+
this.close = () => {
|
155
|
+
this.open = false;
|
156
|
+
this.triggerClicked = false;
|
157
|
+
this.cpslClose.emit();
|
158
|
+
};
|
159
|
+
this.open = false;
|
160
|
+
this.positionX = undefined;
|
161
|
+
this.positionY = undefined;
|
162
|
+
this.anchorEl = undefined;
|
163
|
+
this.anchorOriginHorizontal = 'left';
|
164
|
+
this.anchorOriginVertical = 'bottom';
|
165
|
+
this.autoWidth = true;
|
166
|
+
this.disabled = undefined;
|
167
|
+
this.preventBlur = undefined;
|
168
|
+
this.transformOriginHorizontal = 'left';
|
169
|
+
this.transformOriginVertical = 'top';
|
170
|
+
this.triggerAction = 'click';
|
171
|
+
this.trigger = undefined;
|
172
|
+
this.windowPadding = 16;
|
173
|
+
}
|
174
|
+
closePopover() {
|
175
|
+
return __awaiter(this, void 0, void 0, function* () {
|
176
|
+
this.close();
|
177
|
+
});
|
178
|
+
}
|
179
|
+
onTriggerChange() {
|
180
|
+
this.configureTriggerInteraction();
|
181
|
+
}
|
182
|
+
onAnchorChange() {
|
183
|
+
this.setPosition();
|
184
|
+
}
|
185
|
+
onOpenChange() {
|
186
|
+
if (this.open) {
|
187
|
+
window.addEventListener('click', this.handleClickOutside);
|
188
|
+
window.addEventListener('scroll', () => this.setPosition(), true);
|
189
|
+
}
|
190
|
+
else {
|
191
|
+
window.removeEventListener('click', this.handleClickOutside);
|
192
|
+
window.addEventListener('scroll', () => this.setPosition());
|
193
|
+
}
|
194
|
+
}
|
195
|
+
componentDidLoad() {
|
196
|
+
this.configureTriggerInteraction();
|
197
|
+
}
|
198
|
+
get containerEl() {
|
199
|
+
var _a, _b;
|
200
|
+
return (_b = (_a = this.el) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.getElementById('container');
|
201
|
+
}
|
202
|
+
render() {
|
203
|
+
var _a;
|
204
|
+
return (h(Host, { key: 'bb9a38fb37e6588041f6b09e064cbe85d0dd46b1', class: {
|
205
|
+
'open': this.open,
|
206
|
+
'transform-h-left': this.transformOriginHorizontal === 'left',
|
207
|
+
'transform-h-center': this.transformOriginHorizontal === 'center',
|
208
|
+
'transform-h-right': this.transformOriginHorizontal === 'right',
|
209
|
+
'transform-v-top': this.transformOriginVertical === 'top',
|
210
|
+
'transform-v-center': this.transformOriginVertical === 'center',
|
211
|
+
'transform-v-bottom': this.transformOriginVertical === 'bottom',
|
212
|
+
}, 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: '99478330639eed6be6f7e5a960ebb2f485692cff', id: "container", class: { container: true, open: this.open } }, h("slot", { key: '2d15adf8c986698ce02858dfdca49047777e2c33' }))));
|
213
|
+
}
|
214
|
+
static get is() { return "cpsl-popover"; }
|
215
|
+
static get encapsulation() { return "shadow"; }
|
216
|
+
static get originalStyleUrls() {
|
217
|
+
return {
|
218
|
+
"$": ["cpsl-popover.scss"]
|
219
|
+
};
|
220
|
+
}
|
221
|
+
static get styleUrls() {
|
222
|
+
return {
|
223
|
+
"$": ["cpsl-popover.css"]
|
224
|
+
};
|
225
|
+
}
|
226
|
+
static get properties() {
|
227
|
+
return {
|
228
|
+
"anchorEl": {
|
229
|
+
"type": "unknown",
|
230
|
+
"mutable": false,
|
231
|
+
"complexType": {
|
232
|
+
"original": "HTMLElement",
|
233
|
+
"resolved": "HTMLElement",
|
234
|
+
"references": {
|
235
|
+
"HTMLElement": {
|
236
|
+
"location": "global",
|
237
|
+
"id": "global::HTMLElement"
|
238
|
+
}
|
239
|
+
}
|
240
|
+
},
|
241
|
+
"required": false,
|
242
|
+
"optional": true,
|
243
|
+
"docs": {
|
244
|
+
"tags": [],
|
245
|
+
"text": "ID for the element that the popover anchors to."
|
246
|
+
}
|
247
|
+
},
|
248
|
+
"anchorOriginHorizontal": {
|
249
|
+
"type": "string",
|
250
|
+
"mutable": false,
|
251
|
+
"complexType": {
|
252
|
+
"original": "'left' | 'center' | 'right'",
|
253
|
+
"resolved": "\"center\" | \"left\" | \"right\"",
|
254
|
+
"references": {}
|
255
|
+
},
|
256
|
+
"required": false,
|
257
|
+
"optional": true,
|
258
|
+
"docs": {
|
259
|
+
"tags": [],
|
260
|
+
"text": "Vertical anchor origin.\nOptions are: `\"left\"`, `\"center\"`, `\"right\"`.\nDefault is: `\"left\"`."
|
261
|
+
},
|
262
|
+
"attribute": "anchor-origin-horizontal",
|
263
|
+
"reflect": false,
|
264
|
+
"defaultValue": "'left'"
|
265
|
+
},
|
266
|
+
"anchorOriginVertical": {
|
267
|
+
"type": "string",
|
268
|
+
"mutable": false,
|
269
|
+
"complexType": {
|
270
|
+
"original": "'top' | 'center' | 'bottom'",
|
271
|
+
"resolved": "\"bottom\" | \"center\" | \"top\"",
|
272
|
+
"references": {}
|
273
|
+
},
|
274
|
+
"required": false,
|
275
|
+
"optional": true,
|
276
|
+
"docs": {
|
277
|
+
"tags": [],
|
278
|
+
"text": "Vertical anchor origin.\nOptions are: `\"top\"`, `\"center\"`, `\"bottom\"`.\nDefault is: `\"bottom\"`."
|
279
|
+
},
|
280
|
+
"attribute": "anchor-origin-vertical",
|
281
|
+
"reflect": false,
|
282
|
+
"defaultValue": "'bottom'"
|
283
|
+
},
|
284
|
+
"autoWidth": {
|
285
|
+
"type": "boolean",
|
286
|
+
"mutable": false,
|
287
|
+
"complexType": {
|
288
|
+
"original": "boolean",
|
289
|
+
"resolved": "boolean",
|
290
|
+
"references": {}
|
291
|
+
},
|
292
|
+
"required": false,
|
293
|
+
"optional": true,
|
294
|
+
"docs": {
|
295
|
+
"tags": [],
|
296
|
+
"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`"
|
297
|
+
},
|
298
|
+
"attribute": "auto-width",
|
299
|
+
"reflect": false,
|
300
|
+
"defaultValue": "true"
|
301
|
+
},
|
302
|
+
"disabled": {
|
303
|
+
"type": "boolean",
|
304
|
+
"mutable": false,
|
305
|
+
"complexType": {
|
306
|
+
"original": "boolean",
|
307
|
+
"resolved": "boolean",
|
308
|
+
"references": {}
|
309
|
+
},
|
310
|
+
"required": false,
|
311
|
+
"optional": false,
|
312
|
+
"docs": {
|
313
|
+
"tags": [],
|
314
|
+
"text": "Whether or not to disable to popover."
|
315
|
+
},
|
316
|
+
"attribute": "disabled",
|
317
|
+
"reflect": false
|
318
|
+
},
|
319
|
+
"preventBlur": {
|
320
|
+
"type": "boolean",
|
321
|
+
"mutable": false,
|
322
|
+
"complexType": {
|
323
|
+
"original": "boolean",
|
324
|
+
"resolved": "boolean",
|
325
|
+
"references": {}
|
326
|
+
},
|
327
|
+
"required": false,
|
328
|
+
"optional": false,
|
329
|
+
"docs": {
|
330
|
+
"tags": [],
|
331
|
+
"text": "Used internally to prevent select from blurring unintentionally."
|
332
|
+
},
|
333
|
+
"attribute": "prevent-blur",
|
334
|
+
"reflect": false
|
335
|
+
},
|
336
|
+
"transformOriginHorizontal": {
|
337
|
+
"type": "string",
|
338
|
+
"mutable": false,
|
339
|
+
"complexType": {
|
340
|
+
"original": "'left' | 'center' | 'right'",
|
341
|
+
"resolved": "\"center\" | \"left\" | \"right\"",
|
342
|
+
"references": {}
|
343
|
+
},
|
344
|
+
"required": false,
|
345
|
+
"optional": true,
|
346
|
+
"docs": {
|
347
|
+
"tags": [],
|
348
|
+
"text": "Vertical transformation origin.\nOptions are: `\"left\"`, `\"center\"`, `\"right\"`.\nDefault is: `\"left\"`."
|
349
|
+
},
|
350
|
+
"attribute": "transform-origin-horizontal",
|
351
|
+
"reflect": false,
|
352
|
+
"defaultValue": "'left'"
|
353
|
+
},
|
354
|
+
"transformOriginVertical": {
|
355
|
+
"type": "string",
|
356
|
+
"mutable": false,
|
357
|
+
"complexType": {
|
358
|
+
"original": "'top' | 'center' | 'bottom'",
|
359
|
+
"resolved": "\"bottom\" | \"center\" | \"top\"",
|
360
|
+
"references": {}
|
361
|
+
},
|
362
|
+
"required": false,
|
363
|
+
"optional": true,
|
364
|
+
"docs": {
|
365
|
+
"tags": [],
|
366
|
+
"text": "Vertical transformation origin.\nOptions are: `\"top\"`, `\"center\"`, `\"bottom\"`.\nDefault is: `\"bottom\"`."
|
367
|
+
},
|
368
|
+
"attribute": "transform-origin-vertical",
|
369
|
+
"reflect": false,
|
370
|
+
"defaultValue": "'top'"
|
371
|
+
},
|
372
|
+
"triggerAction": {
|
373
|
+
"type": "string",
|
374
|
+
"mutable": false,
|
375
|
+
"complexType": {
|
376
|
+
"original": "'click' | 'hover'",
|
377
|
+
"resolved": "\"click\" | \"hover\"",
|
378
|
+
"references": {}
|
379
|
+
},
|
380
|
+
"required": false,
|
381
|
+
"optional": false,
|
382
|
+
"docs": {
|
383
|
+
"tags": [],
|
384
|
+
"text": "Which trigger causes the popover to open.\nOptions are: `\"click\"`, `\"hover\"`.\nDefault is: `\"click\"`."
|
385
|
+
},
|
386
|
+
"attribute": "trigger-action",
|
387
|
+
"reflect": false,
|
388
|
+
"defaultValue": "'click'"
|
389
|
+
},
|
390
|
+
"trigger": {
|
391
|
+
"type": "string",
|
392
|
+
"mutable": false,
|
393
|
+
"complexType": {
|
394
|
+
"original": "string",
|
395
|
+
"resolved": "string",
|
396
|
+
"references": {}
|
397
|
+
},
|
398
|
+
"required": false,
|
399
|
+
"optional": false,
|
400
|
+
"docs": {
|
401
|
+
"tags": [],
|
402
|
+
"text": "ID for the element that triggers the popover to open."
|
403
|
+
},
|
404
|
+
"attribute": "trigger",
|
405
|
+
"reflect": false
|
406
|
+
},
|
407
|
+
"windowPadding": {
|
408
|
+
"type": "number",
|
409
|
+
"mutable": false,
|
410
|
+
"complexType": {
|
411
|
+
"original": "number",
|
412
|
+
"resolved": "number",
|
413
|
+
"references": {}
|
414
|
+
},
|
415
|
+
"required": false,
|
416
|
+
"optional": true,
|
417
|
+
"docs": {
|
418
|
+
"tags": [],
|
419
|
+
"text": "Padding from edge of window for the popover container."
|
420
|
+
},
|
421
|
+
"attribute": "window-padding",
|
422
|
+
"reflect": false,
|
423
|
+
"defaultValue": "16"
|
424
|
+
}
|
425
|
+
};
|
426
|
+
}
|
427
|
+
static get states() {
|
428
|
+
return {
|
429
|
+
"open": {},
|
430
|
+
"positionX": {},
|
431
|
+
"positionY": {}
|
432
|
+
};
|
433
|
+
}
|
434
|
+
static get events() {
|
435
|
+
return [{
|
436
|
+
"method": "cpslOpen",
|
437
|
+
"name": "cpslOpen",
|
438
|
+
"bubbles": true,
|
439
|
+
"cancelable": true,
|
440
|
+
"composed": true,
|
441
|
+
"docs": {
|
442
|
+
"tags": [],
|
443
|
+
"text": "Emitted when the popover opens."
|
444
|
+
},
|
445
|
+
"complexType": {
|
446
|
+
"original": "void",
|
447
|
+
"resolved": "void",
|
448
|
+
"references": {}
|
449
|
+
}
|
450
|
+
}, {
|
451
|
+
"method": "cpslClose",
|
452
|
+
"name": "cpslClose",
|
453
|
+
"bubbles": true,
|
454
|
+
"cancelable": true,
|
455
|
+
"composed": true,
|
456
|
+
"docs": {
|
457
|
+
"tags": [],
|
458
|
+
"text": "Emitted when the popover closes."
|
459
|
+
},
|
460
|
+
"complexType": {
|
461
|
+
"original": "void",
|
462
|
+
"resolved": "void",
|
463
|
+
"references": {}
|
464
|
+
}
|
465
|
+
}];
|
466
|
+
}
|
467
|
+
static get methods() {
|
468
|
+
return {
|
469
|
+
"closePopover": {
|
470
|
+
"complexType": {
|
471
|
+
"signature": "() => Promise<void>",
|
472
|
+
"parameters": [],
|
473
|
+
"references": {
|
474
|
+
"Promise": {
|
475
|
+
"location": "global",
|
476
|
+
"id": "global::Promise"
|
477
|
+
}
|
478
|
+
},
|
479
|
+
"return": "Promise<void>"
|
480
|
+
},
|
481
|
+
"docs": {
|
482
|
+
"text": "Call to close the popover manually.",
|
483
|
+
"tags": []
|
484
|
+
}
|
485
|
+
}
|
486
|
+
};
|
487
|
+
}
|
488
|
+
static get elementRef() { return "el"; }
|
489
|
+
static get watchers() {
|
490
|
+
return [{
|
491
|
+
"propName": "trigger",
|
492
|
+
"methodName": "onTriggerChange"
|
493
|
+
}, {
|
494
|
+
"propName": "triggerAction",
|
495
|
+
"methodName": "onTriggerChange"
|
496
|
+
}, {
|
497
|
+
"propName": "preventBlur",
|
498
|
+
"methodName": "onTriggerChange"
|
499
|
+
}, {
|
500
|
+
"propName": "anchorOriginHorizontal",
|
501
|
+
"methodName": "onAnchorChange"
|
502
|
+
}, {
|
503
|
+
"propName": "anchorOriginVertical",
|
504
|
+
"methodName": "onAnchorChange"
|
505
|
+
}, {
|
506
|
+
"propName": "open",
|
507
|
+
"methodName": "onOpenChange"
|
508
|
+
}];
|
509
|
+
}
|
510
|
+
}
|
511
|
+
//# 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;QAqHvB,gCAA2B,GAAG,GAAG,EAAE;YACzC,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,GAAG,IAAI,CAAC;YAEnE,IAAI,OAAO,CAAC,yBAAyB,CAAC,EAAE,CAAC;gBACv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I,CAAC,SAAS,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAA,IAAI,CAAC,SAAS,0CAAE,WAAW,IAAI,EAAE;YAEvI,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 } 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={{ 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
|
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
|
76
|
+
background: var(--step-previous-color);
|
77
77
|
}
|
78
78
|
|
79
79
|
.active {
|
80
|
-
background
|
80
|
+
background: var(--step-active-color);
|
81
81
|
flex: 2;
|
82
82
|
}
|
@@ -32,7 +32,7 @@ export class CpslQrCode {
|
|
32
32
|
qrCode.append(container);
|
33
33
|
}
|
34
34
|
render() {
|
35
|
-
return (h(Host, { key: '
|
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"; }
|