@usecapsule/core-components 3.6.0-dev.0 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capsule/capsule.esm.js +1 -1
- package/dist/capsule/{p-12d4ab85.entry.js → p-dbb8a80b.entry.js} +2 -2
- package/dist/capsule/p-dbb8a80b.entry.js.map +1 -0
- package/dist/cjs/cpsl-alert_34.cjs.entry.js +32 -11
- package/dist/cjs/cpsl-alert_34.cjs.entry.js.map +1 -1
- package/dist/collection/components/cpsl-popover/cpsl-popover.css +7 -6
- package/dist/collection/components/cpsl-popover/cpsl-popover.js +29 -8
- package/dist/collection/components/cpsl-popover/cpsl-popover.js.map +1 -1
- package/dist/collection/components/cpsl-select/cpsl-select.js +2 -2
- package/dist/collection/components/cpsl-select/cpsl-select.js.map +1 -1
- package/dist/esm/cpsl-alert_34.entry.js +32 -11
- package/dist/esm/cpsl-alert_34.entry.js.map +1 -1
- package/dist/types/components/cpsl-popover/cpsl-popover.d.ts +3 -1
- package/package.json +3 -2
- package/dist/capsule/p-12d4ab85.entry.js.map +0 -1
@@ -16581,7 +16581,7 @@ const CpslPill = class {
|
|
16581
16581
|
};
|
16582
16582
|
CpslPill.style = CpslPillStyle0;
|
16583
16583
|
|
16584
|
-
const cpslPopoverCss = ":host{position:fixed;display:block;z-index:-1;overflow:auto}:host(.open){z-index:10006}.container{visibility:hidden;height:0px}.open{visibility:visible;height:auto;z-index:10006}:host(.transform-h-left){
|
16584
|
+
const cpslPopoverCss = ":host{position:fixed;display:block;z-index:-1;overflow:auto;transform:var(--th, ) var(--tv, )}:host(.open){z-index:10006}.container{visibility:hidden;height:0px}.open{visibility:visible;height:auto;z-index:10006}:host(.transform-h-left){--th:translateX(0)}:host(.transform-h-center){--th:translateX(-50%)}:host(.transform-h-right){--th:translateX(-100%)}:host(.transform-v-top){--tv:translateY(0)}:host(.transform-v-center){--tv:translateY(-50%)}:host(.transform-v-bottom){--tv:translateY(-100%)}";
|
16585
16585
|
const CpslPopoverStyle0 = cpslPopoverCss;
|
16586
16586
|
|
16587
16587
|
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
@@ -16608,7 +16608,8 @@ const CpslPopover = class {
|
|
16608
16608
|
index.registerInstance(this, hostRef);
|
16609
16609
|
this.cpslOpen = index.createEvent(this, "cpslOpen", 7);
|
16610
16610
|
this.cpslClose = index.createEvent(this, "cpslClose", 7);
|
16611
|
-
this.
|
16611
|
+
this.startedInside = false;
|
16612
|
+
this.startedWhenMounted = false;
|
16612
16613
|
this.configureTriggerInteraction = () => {
|
16613
16614
|
const { trigger, triggerAction, destroyTriggerInteraction } = this;
|
16614
16615
|
if (destroyTriggerInteraction) {
|
@@ -16668,6 +16669,15 @@ const CpslPopover = class {
|
|
16668
16669
|
this.present();
|
16669
16670
|
},
|
16670
16671
|
},
|
16672
|
+
{
|
16673
|
+
eventName: 'touchstart',
|
16674
|
+
callback: e => {
|
16675
|
+
if (this.preventBlur) {
|
16676
|
+
e.preventDefault();
|
16677
|
+
}
|
16678
|
+
this.present();
|
16679
|
+
},
|
16680
|
+
},
|
16671
16681
|
];
|
16672
16682
|
break;
|
16673
16683
|
}
|
@@ -16727,12 +16737,19 @@ const CpslPopover = class {
|
|
16727
16737
|
}
|
16728
16738
|
}
|
16729
16739
|
};
|
16740
|
+
this.validateEventStart = event => {
|
16741
|
+
this.startedWhenMounted = !!this.triggerEl;
|
16742
|
+
this.startedInside = this.triggerEl.contains(event.target);
|
16743
|
+
this.present();
|
16744
|
+
};
|
16730
16745
|
this.handleClickOutside = (event) => {
|
16731
|
-
if
|
16732
|
-
|
16746
|
+
// Do nothing if `mousedown` or `touchstart` started inside ref element
|
16747
|
+
if (this.startedInside || !this.startedWhenMounted)
|
16733
16748
|
return;
|
16734
|
-
|
16735
|
-
if (this.
|
16749
|
+
// Do nothing if clicking ref's element or descendent elements
|
16750
|
+
if (!this.triggerEl || this.triggerEl.contains(event.target))
|
16751
|
+
return;
|
16752
|
+
if (this.open) {
|
16736
16753
|
event.preventDefault();
|
16737
16754
|
this.close();
|
16738
16755
|
}
|
@@ -16749,7 +16766,7 @@ const CpslPopover = class {
|
|
16749
16766
|
};
|
16750
16767
|
this.close = () => {
|
16751
16768
|
this.open = false;
|
16752
|
-
this.
|
16769
|
+
this.startedInside = false;
|
16753
16770
|
this.cpslClose.emit();
|
16754
16771
|
};
|
16755
16772
|
this.open = false;
|
@@ -16783,11 +16800,15 @@ const CpslPopover = class {
|
|
16783
16800
|
}
|
16784
16801
|
onOpenChange() {
|
16785
16802
|
if (this.open) {
|
16803
|
+
window.addEventListener('mousedown', this.validateEventStart);
|
16804
|
+
window.addEventListener('touchstart', this.validateEventStart);
|
16786
16805
|
window.addEventListener('click', this.handleClickOutside);
|
16787
16806
|
window.addEventListener('scroll', () => this.setPosition(), true);
|
16788
16807
|
window.addEventListener('resize', () => this.setPosition(), true);
|
16789
16808
|
}
|
16790
16809
|
else {
|
16810
|
+
window.removeEventListener('mousedown', this.validateEventStart);
|
16811
|
+
window.removeEventListener('touchstart', this.validateEventStart);
|
16791
16812
|
window.removeEventListener('click', this.handleClickOutside);
|
16792
16813
|
window.removeEventListener('scroll', () => this.setPosition(), true);
|
16793
16814
|
window.removeEventListener('resize', () => this.setPosition(), true);
|
@@ -16802,7 +16823,7 @@ const CpslPopover = class {
|
|
16802
16823
|
}
|
16803
16824
|
render() {
|
16804
16825
|
var _a;
|
16805
|
-
return (index.h(index.Host, { key: '
|
16826
|
+
return (index.h(index.Host, { key: '18d133c7b3b9130f4119aa1502fc22a0edba0adf', class: {
|
16806
16827
|
'open': this.open,
|
16807
16828
|
'transform-h-left': this.transformOriginHorizontal === 'left',
|
16808
16829
|
'transform-h-center': this.transformOriginHorizontal === 'center',
|
@@ -16810,7 +16831,7 @@ const CpslPopover = class {
|
|
16810
16831
|
'transform-v-top': this.transformOriginVertical === 'top',
|
16811
16832
|
'transform-v-center': this.transformOriginVertical === 'center',
|
16812
16833
|
'transform-v-bottom': this.transformOriginVertical === 'bottom',
|
16813
|
-
}, 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` } }, index.h("div", { key: '
|
16834
|
+
}, 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` } }, index.h("div", { key: '0c86d612a066ac39a37c0291ab96e518f6e2cd32', id: "container", class: { container: true, open: this.open } }, index.h("slot", { key: '616112bb261563452b94256d3f7a8ed563e1cf65' }))));
|
16814
16835
|
}
|
16815
16836
|
get el() { return index.getElement(this); }
|
16816
16837
|
static get watchers() { return {
|
@@ -21077,10 +21098,10 @@ const CpslSelect = class {
|
|
21077
21098
|
}
|
21078
21099
|
render() {
|
21079
21100
|
var _a, _b, _c, _d, _e;
|
21080
|
-
return (index.h(index.Host, { key: '07196d4cfb2df16bc25e70eca2e70c075ec192d9', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (index.h("label", { key: '0d5f157c22dcbe6cb804f95c86fccf09be5f2db1', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? index.h("span", { class: "optional-label" }, "(optional)") : '')), index.h("div", { key: 'f1717a5a7acf3834b1fabbe960c0951a8bef0156', part: "select-container", id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && index.h("slot", { key: 'c4031550e20504d14d091a36af499e09f948399c', name: "selected-item" }), index.h("div", { key: 'f46cdd6d89995c29730c5143b8b094a551db095e', class: { 'selected-container-content': true, 'hidden': this.hasSelectedItem && this.showFormattedSelectedItem }, id: "selected-container-content", style: {} }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (index.h("cpsl-text", { key: 'cfa104452575ee2075436fbd2d03e4ec8b7744ea', 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)))), index.h("cpsl-icon", { key: '3f573b3bd0d083e36a32661bfbefdeebf0c1c1e3', part: "icon", class: { 'chevron': true, 'open': !this.noIconAnimation && this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: this.icon }), index.h("input", { key: 'c8160d5dd425d1d34420699040226d7a5fa96788', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" })
|
21101
|
+
return (index.h(index.Host, { key: '07196d4cfb2df16bc25e70eca2e70c075ec192d9', id: this.id, class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.selectedValue) } }, this.label && (index.h("label", { key: '0d5f157c22dcbe6cb804f95c86fccf09be5f2db1', class: "label", htmlFor: this.inputId }, this.label, this.required ? '*' : ' ', !this.required && this.showOptionalLabel ? index.h("span", { class: "optional-label" }, "(optional)") : '')), index.h("div", { key: 'f1717a5a7acf3834b1fabbe960c0951a8bef0156', part: "select-container", id: "select-container", class: { 'select-container': true, 'error-container': Boolean(this.errorText) }, onMouseDown: this.handleClick }, this.hasSelectedItem && this.showFormattedSelectedItem && index.h("slot", { key: 'c4031550e20504d14d091a36af499e09f948399c', name: "selected-item" }), index.h("div", { key: 'f46cdd6d89995c29730c5143b8b094a551db095e', class: { 'selected-container-content': true, 'hidden': this.hasSelectedItem && this.showFormattedSelectedItem }, id: "selected-container-content", style: {} }, (!this.hasSelectedItem || !this.showFormattedSelectedItem) && (index.h("cpsl-text", { key: 'cfa104452575ee2075436fbd2d03e4ec8b7744ea', 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)))), index.h("cpsl-icon", { key: '3f573b3bd0d083e36a32661bfbefdeebf0c1c1e3', part: "icon", class: { 'chevron': true, 'open': !this.noIconAnimation && this.popoverOpen, 'has-value': Boolean(this.selectedValue) }, icon: this.icon }), index.h("input", { key: 'c8160d5dd425d1d34420699040226d7a5fa96788', id: this.inputId, disabled: this.disabled, class: { disabled: this.disabled }, value: this.selectedValue, onFocus: this.onFocus, onBlur: this.onBlur, onKeyPress: this.handleEnterPress, inputmode: "none" }), index.h("cpsl-popover", { key: '67c237d3559c8b1c87668017adb494394f8892f7', part: "popover", autoWidth: this.autoWidth, trigger: this.id, preventBlur: this.hasFocus, disabled: this.disabled, anchorEl: this.anchorEl }, index.h("div", { key: 'e7d06e0286caba81b827880f93b9f3fd0562c920', part: "dropdown", class: "dropdown" }, this.showSearch && (index.h("div", { key: '6b90fb7f145061e255b7a5fefe9135939da451cd', class: "search-container" }, index.h("cpsl-input", { key: 'de22c0f8e4e54b53ba2d01735d9f3b5b701de49e', onClick: e => e.stopPropagation(), placeholder: (_d = this.searchPlaceholder) !== null && _d !== void 0 ? _d : 'Search', value: "", onCpslInput: e => {
|
21081
21102
|
e.stopPropagation();
|
21082
21103
|
this.cpslSearchChange.emit(e.detail.value);
|
21083
|
-
} }))), index.h("div", { key: '
|
21104
|
+
} }))), index.h("div", { key: '53640295e97e86c68978cb5269c13a2f87a89bd0', class: "dropdown-inner", style: { maxHeight: `${this.dropdownMaxHeight}px` } }, index.h("slot", { key: 'e338a82fe28a6e9cfc035f238964252652aae6e0', name: "items" }))))), (this.errorText || this.helperText) && (index.h("div", { key: '9dc72e327dda99f54959ea6656c5eb23d3f38b51', class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, index.h("span", { key: '19e164fa3fa038f6423d98b79d161c6161bc7160' }, (_e = this.errorText) !== null && _e !== void 0 ? _e : this.helperText)))));
|
21084
21105
|
}
|
21085
21106
|
get el() { return index.getElement(this); }
|
21086
21107
|
static get watchers() { return {
|