@usecapsule/core-components 2.0.7 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/capsule/capsule.esm.js +1 -1
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/{p-d0b8e7cb.entry.js → p-2ce99420.entry.js} +5 -5
- package/dist/capsule/p-2ce99420.entry.js.map +1 -0
- package/dist/cjs/capsule.cjs.js +1 -1
- package/dist/cjs/cpsl-alert_18.cjs.entry.js +40 -7
- package/dist/cjs/cpsl-alert_18.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +51 -8
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -1
- package/dist/collection/components/cpsl-input/cpsl-input.js +33 -1
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -1
- package/dist/esm/capsule.js +1 -1
- package/dist/esm/cpsl-alert_18.entry.js +40 -7
- package/dist/esm/cpsl-alert_18.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cpsl-dropdown/cpsl-dropdown.d.ts +2 -1
- package/dist/types/components/cpsl-input/cpsl-input.d.ts +2 -0
- package/dist/types/components.d.ts +14 -1
- package/package.json +2 -2
- package/dist/capsule/p-d0b8e7cb.entry.js.map +0 -1
package/dist/cjs/capsule.cjs.js
CHANGED
@@ -19,7 +19,7 @@ const patchBrowser = () => {
|
|
19
19
|
|
20
20
|
patchBrowser().then(async (options) => {
|
21
21
|
await appGlobals.globalScripts();
|
22
|
-
return index.bootstrapLazy([["cpsl-animation.cjs",[[1,"cpsl-animation",{"src":[1],"replayAnimation":[64]}]]],["cpsl-col.cjs",[[1,"cpsl-col",{"offset":[1],"offsetXs":[1,"offset-xs"],"offsetSm":[1,"offset-sm"],"offsetMd":[1,"offset-md"],"offsetLg":[1,"offset-lg"],"offsetXl":[1,"offset-xl"],"pull":[1],"pullXs":[1,"pull-xs"],"pullSm":[1,"pull-sm"],"pullMd":[1,"pull-md"],"pullLg":[1,"pull-lg"],"pullXl":[1,"pull-xl"],"push":[1],"pushXs":[1,"push-xs"],"pushSm":[1,"push-sm"],"pushMd":[1,"push-md"],"pushLg":[1,"push-lg"],"pushXl":[1,"push-xl"],"size":[1],"sizeXs":[1,"size-xs"],"sizeSm":[1,"size-sm"],"sizeMd":[1,"size-md"],"sizeLg":[1,"size-lg"],"sizeXl":[1,"size-xl"]},[[9,"resize","onResize"]]]]],["cpsl-grid.cjs",[[1,"cpsl-grid",{"fixed":[4]}]]],["cpsl-info-box.cjs",[[1,"cpsl-info-box"]]],["cpsl-row.cjs",[[1,"cpsl-row"]]],["cpsl-alert_18.cjs",[[1,"cpsl-code-input",{"code":[1025],"errorText":[1,"error-text"],"helperText":[1,"helper-text"],"length":[2],"type":[1]}],[1,"cpsl-input",{"autocapitalize":[1],"autocomplete":[1],"autocorrect":[1],"noAutoDisable":[4,"no-auto-disable"],"autofocus":[4],"disabled":[4],"enterkeyhint":[1],"errorText":[1,"error-text"],"helperText":[1,"helper-text"],"inputmode":[1],"label":[1],"max":[8],"maxlength":[2],"min":[8],"minlength":[2],"multiple":[4],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[4],"required":[4],"spellcheck":[4],"startIconSrc":[1,"start-icon-src"],"startIcon":[1,"start-icon"],"step":[1],"type":[1],"value":[1025],"hasFocus":[32]},null,{"disabled":["handleDisable"]}],[1,"cpsl-modal",{"enterTransitionDuration":[2,"enter-transition-duration"],"exitTransitionDuration":[2,"exit-transition-duration"],"footerExpanded":[4,"footer-expanded"],"footerTransitionDuration":[2,"footer-transition-duration"],"noOverlay":[4,"no-overlay"],"open":[4],"hasFooter":[32]},null,{"footerExpanded":["toggleHeight"],"open":["toggleModal"]}],[1,"cpsl-slide-button",{"disabled":[4],"endIcon":[1,"end-icon"],"endText":[1,"end-text"],"startIcon":[1,"start-icon"],"startText":[1,"start-text"]}],[1,"cpsl-tile-button",{"src":[1],"icon":[1]}],[1,"cpsl-alert",{"type":[1],"icon":[1]}],[1,"cpsl-button",{"disabled":[516],"variant":[513]}],[1,"cpsl-divider"],[1,"cpsl-dropdown",{"width":[1],"hasCpslSearch":[4,"has-cpsl-search"],"items":[16],"
|
22
|
+
return index.bootstrapLazy([["cpsl-animation.cjs",[[1,"cpsl-animation",{"src":[1],"replayAnimation":[64]}]]],["cpsl-col.cjs",[[1,"cpsl-col",{"offset":[1],"offsetXs":[1,"offset-xs"],"offsetSm":[1,"offset-sm"],"offsetMd":[1,"offset-md"],"offsetLg":[1,"offset-lg"],"offsetXl":[1,"offset-xl"],"pull":[1],"pullXs":[1,"pull-xs"],"pullSm":[1,"pull-sm"],"pullMd":[1,"pull-md"],"pullLg":[1,"pull-lg"],"pullXl":[1,"pull-xl"],"push":[1],"pushXs":[1,"push-xs"],"pushSm":[1,"push-sm"],"pushMd":[1,"push-md"],"pushLg":[1,"push-lg"],"pushXl":[1,"push-xl"],"size":[1],"sizeXs":[1,"size-xs"],"sizeSm":[1,"size-sm"],"sizeMd":[1,"size-md"],"sizeLg":[1,"size-lg"],"sizeXl":[1,"size-xl"]},[[9,"resize","onResize"]]]]],["cpsl-grid.cjs",[[1,"cpsl-grid",{"fixed":[4]}]]],["cpsl-info-box.cjs",[[1,"cpsl-info-box"]]],["cpsl-row.cjs",[[1,"cpsl-row"]]],["cpsl-alert_18.cjs",[[1,"cpsl-code-input",{"code":[1025],"errorText":[1,"error-text"],"helperText":[1,"helper-text"],"length":[2],"type":[1]}],[1,"cpsl-input",{"autocapitalize":[1],"autocomplete":[1],"autocorrect":[1],"noAutoDisable":[4,"no-auto-disable"],"autofocus":[4],"disabled":[4],"enterkeyhint":[1],"errorText":[1,"error-text"],"helperText":[1,"helper-text"],"inputmode":[1],"label":[1],"max":[8],"maxlength":[2],"min":[8],"minlength":[2],"multiple":[4],"name":[1],"pattern":[1],"placeholder":[1],"readonly":[4],"required":[4],"spellcheck":[4],"startIconSrc":[1,"start-icon-src"],"startIcon":[1,"start-icon"],"step":[1],"type":[1],"value":[1025],"hasFocus":[32]},null,{"disabled":["handleDisable"]}],[1,"cpsl-modal",{"enterTransitionDuration":[2,"enter-transition-duration"],"exitTransitionDuration":[2,"exit-transition-duration"],"footerExpanded":[4,"footer-expanded"],"footerTransitionDuration":[2,"footer-transition-duration"],"noOverlay":[4,"no-overlay"],"open":[4],"hasFooter":[32]},null,{"footerExpanded":["toggleHeight"],"open":["toggleModal"]}],[1,"cpsl-slide-button",{"disabled":[4],"endIcon":[1,"end-icon"],"endText":[1,"end-text"],"startIcon":[1,"start-icon"],"startText":[1,"start-text"]}],[1,"cpsl-tile-button",{"src":[1],"icon":[1]}],[1,"cpsl-alert",{"type":[1],"icon":[1]}],[1,"cpsl-button",{"disabled":[516],"variant":[513]}],[1,"cpsl-divider"],[1,"cpsl-dropdown",{"width":[1],"hasCpslSearch":[4,"has-cpsl-search"],"items":[16],"selectedItem":[1040],"isOpen":[32],"searchQuery":[32],"filteredItems":[32]},[[9,"resize","handleResize"]],{"selectedItem":["handleSelectedItemChange"],"isOpen":["handleOpenChange"]}],[1,"cpsl-pill",{"text":[1]}],[1,"cpsl-progress-indicator",{"totalSteps":[2,"total-steps"],"step":[2]}],[1,"cpsl-qr-code",{"url":[1],"imageSrc":[1,"image-src"],"size":[2]}],[1,"cpsl-spinner",{"size":[2],"speed":[2]}],[1,"cpsl-tab",{"selected":[4],"tab":[1]},[[8,"cpslTabsChanged","onTabsChanged"],[8,"cpslTabsInit","onTabsInit"]]],[1,"cpsl-tabs",{"fullWidth":[4,"full-width"],"selectedTab":[1,"selected-tab"],"selectedTabRect":[32],"loaded":[32]},null,{"fullWidth":["updateSlider"],"selectedTab":["updateTab"]}],[1,"cpsl-text",{"color":[1],"variant":[1],"weight":[1]}],[1,"cpsl-overlay",{"open":[4],"enterTransitionDuration":[2,"enter-transition-duration"],"exitTransitionDuration":[2,"exit-transition-duration"]},null,{"open":["toggleHeight"]}],[1,"cpsl-icon",{"src":[1],"icon":[1]}]]]], options);
|
23
23
|
});
|
24
24
|
|
25
25
|
exports.setNonce = index.setNonce;
|
@@ -4799,10 +4799,12 @@ const CpslDropdown = class {
|
|
4799
4799
|
this.toggleDropdown = () => {
|
4800
4800
|
this.isOpen = !this.isOpen;
|
4801
4801
|
};
|
4802
|
-
this.selectItem = (item) => {
|
4802
|
+
this.selectItem = (item, emitEvent = true) => {
|
4803
4803
|
this.selectedItem = item;
|
4804
|
-
this.
|
4805
|
-
|
4804
|
+
this.isOpen = false;
|
4805
|
+
if (emitEvent) {
|
4806
|
+
this.selectedItemChange.emit(this.selectedItem);
|
4807
|
+
}
|
4806
4808
|
};
|
4807
4809
|
this.handleItemSelect = (item) => () => {
|
4808
4810
|
this.selectItem(item);
|
@@ -4820,10 +4822,15 @@ const CpslDropdown = class {
|
|
4820
4822
|
this.width = '100%';
|
4821
4823
|
this.hasCpslSearch = false;
|
4822
4824
|
this.isOpen = false;
|
4823
|
-
this.selectedItem = undefined;
|
4824
4825
|
this.searchQuery = '';
|
4825
4826
|
this.filteredItems = [];
|
4826
4827
|
this.items = [];
|
4828
|
+
this.selectedItem = null;
|
4829
|
+
}
|
4830
|
+
handleSelectedItemChange(newValue) {
|
4831
|
+
if (newValue !== null) {
|
4832
|
+
this.selectItem(newValue, false);
|
4833
|
+
}
|
4827
4834
|
}
|
4828
4835
|
handleOpenChange() {
|
4829
4836
|
if (this.isOpen) {
|
@@ -4843,10 +4850,17 @@ const CpslDropdown = class {
|
|
4843
4850
|
var _a;
|
4844
4851
|
const dropdownOptions = this.el.shadowRoot.querySelector('.dropdown-options');
|
4845
4852
|
const parentRect = (_a = this.el.parentElement) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
4853
|
+
const searchBar = this.el.shadowRoot.querySelector('.search-bar');
|
4846
4854
|
const viewportHeight = window.innerHeight;
|
4847
4855
|
if (parentRect) {
|
4848
4856
|
this.width = `${parentRect.width}px`;
|
4849
4857
|
dropdownOptions.style.left = `${parentRect.x}px`;
|
4858
|
+
if (window.innerWidth <= 480) {
|
4859
|
+
searchBar.style.maxHeight = `30px`;
|
4860
|
+
dropdownOptions.style.top = `425px`;
|
4861
|
+
dropdownOptions.style.maxHeight = '110px';
|
4862
|
+
return;
|
4863
|
+
}
|
4850
4864
|
dropdownOptions.style.top = `${parentRect.y + parentRect.height}px`;
|
4851
4865
|
const availableHeight = viewportHeight - parentRect.bottom;
|
4852
4866
|
dropdownOptions.style.maxHeight = `${availableHeight - 8}px`;
|
@@ -4860,8 +4874,13 @@ const CpslDropdown = class {
|
|
4860
4874
|
}
|
4861
4875
|
componentWillLoad() {
|
4862
4876
|
if (this.items.length > 0) {
|
4863
|
-
this.selectedItem = this.items[0];
|
4864
4877
|
this.filteredItems = [...this.items];
|
4878
|
+
if (this.selectedItem !== null) {
|
4879
|
+
this.selectItem(this.selectedItem, false);
|
4880
|
+
}
|
4881
|
+
else {
|
4882
|
+
this.selectedItem = this.items[0];
|
4883
|
+
}
|
4865
4884
|
}
|
4866
4885
|
}
|
4867
4886
|
disconnectedCallback() {
|
@@ -4869,10 +4888,11 @@ const CpslDropdown = class {
|
|
4869
4888
|
}
|
4870
4889
|
render() {
|
4871
4890
|
var _a, _b, _c;
|
4872
|
-
return (index.h(index.Host, { key: '
|
4891
|
+
return (index.h(index.Host, { key: 'b09375bb984f79e458832b5a95a0936ae59d9397', style: { width: this.width } }, index.h("button", { key: 'b8d01f1afa93e2981cb28a6de227581a2513b1d1', class: "dropdown-button", onClick: this.toggleDropdown }, `${((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.selectedLabel) || ((_b = this.selectedItem) === null || _b === void 0 ? void 0 : _b.label)} ${(_c = this.selectedItem) === null || _c === void 0 ? void 0 : _c.value}`, index.h("div", { key: '51b57ee33ac92e945f4ce8111dc70063a60b15f3', class: `chevron ${this.isOpen ? '' : 'closed'}`, innerHTML: Icons['chevronUp'] })), index.h("ul", { key: '7335ad8d095f9af981d62a4c89463a3e2dd48ebd', class: { 'dropdown-options': true, 'open': this.isOpen }, style: { width: this.width } }, this.hasCpslSearch && (index.h("li", { class: "search-bar" }, index.h("input", { type: "text", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchQueryChange }))), this.filteredItems.map(item => index.h("li", { onClick: this.handleItemSelect(item) }, index.h("span", { innerHTML: Icons[item.icon] }), item.label, " ", index.h("span", { class: "dropdown-value" }, item.value))))));
|
4873
4892
|
}
|
4874
4893
|
get el() { return index.getElement(this); }
|
4875
4894
|
static get watchers() { return {
|
4895
|
+
"selectedItem": ["handleSelectedItemChange"],
|
4876
4896
|
"isOpen": ["handleOpenChange"]
|
4877
4897
|
}; }
|
4878
4898
|
};
|
@@ -4903,6 +4923,7 @@ const CpslInput = class {
|
|
4903
4923
|
this.cpslChange = index.createEvent(this, "cpslChange", 7);
|
4904
4924
|
this.cpslBlur = index.createEvent(this, "cpslBlur", 7);
|
4905
4925
|
this.cpslFocus = index.createEvent(this, "cpslFocus", 7);
|
4926
|
+
this.cpslPaste = index.createEvent(this, "cpslPaste", 7);
|
4906
4927
|
this.inputId = `cpsl-input-${inputIds++}`;
|
4907
4928
|
this.onInput = (ev) => {
|
4908
4929
|
const input = ev.target;
|
@@ -4927,6 +4948,18 @@ const CpslInput = class {
|
|
4927
4948
|
this.focusedValue = this.value;
|
4928
4949
|
this.cpslFocus.emit(ev);
|
4929
4950
|
};
|
4951
|
+
this.onPaste = (ev) => {
|
4952
|
+
var _a;
|
4953
|
+
ev.stopPropagation();
|
4954
|
+
ev.preventDefault();
|
4955
|
+
const input = ev.target;
|
4956
|
+
const pasteData = ((_a = ev.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) || '';
|
4957
|
+
input.value = pasteData;
|
4958
|
+
this.value = pasteData;
|
4959
|
+
pasteData === '' ? this.disableSlots() : this.enableSlots();
|
4960
|
+
this.cpslPaste.emit(ev);
|
4961
|
+
this.emitValueChange(ev);
|
4962
|
+
};
|
4930
4963
|
this.focusInput = () => {
|
4931
4964
|
this.nativeInput.focus();
|
4932
4965
|
};
|
@@ -5003,7 +5036,7 @@ const CpslInput = class {
|
|
5003
5036
|
}
|
5004
5037
|
render() {
|
5005
5038
|
var _a;
|
5006
|
-
return (index.h(index.Host, { key: '
|
5039
|
+
return (index.h(index.Host, { key: 'd056945f2cfe5bff44af5987d2a9591fb1a3cd4c', class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.focusedValue) || Boolean(this.value) } }, this.label && (index.h("label", { class: "label", htmlFor: this.inputId }, this.label)), index.h("div", { key: '4599fe40c9ebbaf3c0e21c1cc365325163a1054d', class: { 'input-container': true, 'error-container': Boolean(this.errorText) } }, index.h("slot", { key: '5404baae8ccc419431f88379e1266fd69ca41670', name: "start" }), index.h("input", { key: '9cab32fee2375ac5e65f41140674275b1c18c039', class: "native-input", id: this.inputId, disabled: this.disabled, autoCapitalize: this.autocapitalize, autoComplete: this.autocomplete, autoCorrect: this.autocorrect, autoFocus: this.autofocus, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, min: this.min, max: this.max, minLength: this.minlength, maxLength: this.maxlength, multiple: this.multiple, name: this.name, pattern: this.pattern, placeholder: this.placeholder || '', readOnly: this.readonly, required: this.required, spellcheck: this.spellcheck, type: this.type, value: this.value, onInput: this.onInput, onChange: this.onChange, onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.focusInput, onPaste: this.onPaste }), index.h("slot", { key: '75ab014ee4e8b87375b67dfda539b59833168b46', name: "end" })), (this.errorText || this.helperText) && (index.h("div", { class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, index.h("cpsl-icon", { icon: Boolean(this.errorText) ? 'alertCircle' : 'infoCircle' }), index.h("span", null, (_a = this.errorText) !== null && _a !== void 0 ? _a : this.helperText)))));
|
5007
5040
|
}
|
5008
5041
|
get el() { return index.getElement(this); }
|
5009
5042
|
static get watchers() { return {
|