@usecapsule/core-components 2.0.6 → 2.0.8
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-a95ec4df.entry.js → p-415384b7.entry.js} +2 -2
- package/dist/capsule/{p-193ac141.entry.js → p-4d957466.entry.js} +2 -2
- package/dist/capsule/{p-cb8dc0a4.entry.js → p-6b02ea8d.entry.js} +2 -2
- package/dist/capsule/p-b2997f3c.js +3 -0
- package/dist/capsule/p-b2997f3c.js.map +1 -0
- package/dist/capsule/{p-d7be092d.entry.js → p-b76350fd.entry.js} +2 -2
- package/dist/capsule/{p-7c738dc5.entry.js → p-f2af4351.entry.js} +5 -5
- package/dist/capsule/p-f2af4351.entry.js.map +1 -0
- package/dist/capsule/{p-0cab90fa.entry.js → p-fa4e3c14.entry.js} +2 -2
- package/dist/cjs/capsule.cjs.js +2 -2
- package/dist/cjs/cpsl-alert_18.cjs.entry.js +63 -10
- package/dist/cjs/cpsl-alert_18.cjs.entry.js.map +1 -1
- package/dist/cjs/cpsl-animation.cjs.entry.js +1 -1
- package/dist/cjs/cpsl-col.cjs.entry.js +1 -1
- package/dist/cjs/cpsl-grid.cjs.entry.js +1 -1
- package/dist/cjs/cpsl-info-box.cjs.entry.js +1 -1
- package/dist/cjs/cpsl-row.cjs.entry.js +1 -1
- package/dist/cjs/{index-3fccb5b4.js → index-87ba56f9.js} +8 -3
- package/dist/cjs/index-87ba56f9.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.css +33 -2
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +92 -9
- 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 +3 -3
- package/dist/esm/cpsl-alert_18.entry.js +63 -10
- package/dist/esm/cpsl-alert_18.entry.js.map +1 -1
- package/dist/esm/cpsl-animation.entry.js +1 -1
- package/dist/esm/cpsl-col.entry.js +1 -1
- package/dist/esm/cpsl-grid.entry.js +1 -1
- package/dist/esm/cpsl-info-box.entry.js +1 -1
- package/dist/esm/cpsl-row.entry.js +1 -1
- package/dist/esm/{index-f00e090c.js → index-fd970ca2.js} +8 -3
- package/dist/esm/index-fd970ca2.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/cpsl-dropdown/cpsl-dropdown.d.ts +10 -1
- package/dist/types/components/cpsl-input/cpsl-input.d.ts +2 -0
- package/dist/types/components.d.ts +22 -1
- package/package.json +2 -2
- package/dist/capsule/p-6fb7c4d1.js +0 -3
- package/dist/capsule/p-6fb7c4d1.js.map +0 -1
- package/dist/capsule/p-7c738dc5.entry.js.map +0 -1
- package/dist/cjs/index-3fccb5b4.js.map +0 -1
- package/dist/esm/index-f00e090c.js.map +0 -1
- /package/dist/capsule/{p-a95ec4df.entry.js.map → p-415384b7.entry.js.map} +0 -0
- /package/dist/capsule/{p-193ac141.entry.js.map → p-4d957466.entry.js.map} +0 -0
- /package/dist/capsule/{p-cb8dc0a4.entry.js.map → p-6b02ea8d.entry.js.map} +0 -0
- /package/dist/capsule/{p-d7be092d.entry.js.map → p-b76350fd.entry.js.map} +0 -0
- /package/dist/capsule/{p-0cab90fa.entry.js.map → p-fa4e3c14.entry.js.map} +0 -0
@@ -1,4 +1,4 @@
|
|
1
|
-
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-
|
1
|
+
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-fd970ca2.js';
|
2
2
|
import { M as MOBILE_SIZE } from './constants-7b49abd5.js';
|
3
3
|
import { g as getDefaultExportFromCjs } from './_commonjsHelpers-1789f0cf.js';
|
4
4
|
|
@@ -4785,7 +4785,7 @@ const CpslDivider = class {
|
|
4785
4785
|
};
|
4786
4786
|
CpslDivider.style = CpslDividerStyle0;
|
4787
4787
|
|
4788
|
-
const cpslDropdownCss = ":host{display:block;position:relative;font-family:Arial, sans-serif;--input-color:var(--cpsl-color-text-primary);--container-background-color:var(--cpsl-color-input-surface-default);--container-border-color:var(--cpsl-color-input-border-active);--scrollbar-color:var(--cpsl-color-text-subtle);--divider-color:var(--cpsl-color-divider);--input-placeholder-color:var(--cpsl-color-text-secondary);--input-font-size:var(--cpsl-font-size-body-m);--button-hover-color:var(--cpsl-color-tile-button-surface-hover);font-family:var(--cpsl-font-family, inherit)}.input-container{position:relative;width:100%}::slotted(cpsl-dropdown){position:absolute;width:100%;top:100%;left:0;z-index:2}.dropdown-button{display:flex;width:100%;padding:0 4px;background:none;border:none;align-items:center;justify-content:space-between;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--input-color)}.dropdown-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}.dropdown-button div{margin-left:8px;display:flex;align-items:center}.dropdown-options{display:none;position:fixed;list-style:none;padding:0;margin-top:4px;border:1px solid var(--container-border-color);border-radius:8px;z-index:999999999999;overflow-y:auto;max-height:300px;box-sizing:border-box;}.dropdown-options.open{display:block}.dropdown-options li{padding:8px;cursor:pointer;display:flex;align-items:center;border-bottom:1px solid var(--cpsl-color-divider);color:var(--input-color);background:var(--container-background-color);font-size:var(--input-font-size)}.dropdown-options li:hover{background-color:var(--button-hover-color)}.dropdown-options li svg{width:24px;height:24px;margin-right:8px;padding:0 8px;vertical-align:middle;}.dropdown-options::-webkit-scrollbar{width:8px;height:8px;background-color:
|
4788
|
+
const cpslDropdownCss = ":host{display:block;position:relative;font-family:Arial, sans-serif;--input-color:var(--cpsl-color-text-primary);--container-background-color:var(--cpsl-color-input-surface-default);--container-border-color:var(--cpsl-color-input-border-active);--scrollbar-color:var(--cpsl-color-text-subtle);--divider-color:var(--cpsl-color-divider);--input-placeholder-color:var(--cpsl-color-text-secondary);--input-font-size:var(--cpsl-font-size-body-m);--button-hover-color:var(--cpsl-color-tile-button-surface-hover);font-family:var(--cpsl-font-family, inherit)}.input-container{position:relative;width:100%}::slotted(cpsl-dropdown){position:absolute;width:100%;top:100%;left:0;z-index:2}.dropdown-button{display:flex;width:100%;padding:0 4px;background:none;border:none;align-items:center;justify-content:space-between;cursor:pointer;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--input-color)}.dropdown-button span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex-grow:1}.dropdown-button div{margin-left:8px;display:flex;align-items:center}.dropdown-options{display:none;position:fixed;list-style:none;padding:0;margin-top:4px;border:1px solid var(--container-border-color);border-radius:8px;z-index:999999999999;overflow-y:auto;max-height:300px;box-sizing:border-box;background-color:var(--container-background-color);}.dropdown-options.open{display:block}.dropdown-options li{padding:8px;cursor:pointer;display:flex;align-items:center;border-bottom:1px solid var(--cpsl-color-divider);color:var(--input-color);background:var(--container-background-color);font-size:var(--input-font-size)}.dropdown-options li:hover{background-color:var(--button-hover-color)}.dropdown-options li svg{width:24px;height:24px;margin-right:8px;padding:0 8px;vertical-align:middle;}.dropdown-options::-webkit-scrollbar{width:8px;height:8px;background-color:transparent;}.dropdown-options::-webkit-scrollbar-thumb{background-color:var(--scrollbar-color);border-radius:10px;border:2px solid transparent;background-clip:content-box;height:8px}.dropdown-options::-webkit-scrollbar-track{background:transparent;}.dropdown-value{margin-left:8px;color:var(--cpsl-color-text-secondary)}.dropdown-button .chevron{transition:transform 0.3s ease}.dropdown-button .chevron.closed{transform:rotate(180deg)}.search-bar{padding:0;border-bottom:1px solid var(--cpsl-color-divider);position:sticky;top:0;background:var(--container-background-color);z-index:1;}.search-bar input{width:100%;padding:8px;border:none;box-sizing:border-box;font-size:var(--input-font-size);color:var(--input-color);background-color:var(--container-background-color);border-radius:0;}.search-bar input::placeholder{color:var(--input-placeholder-color)}.search-bar input:focus{outline:none;border-color:transparent;}";
|
4789
4789
|
const CpslDropdownStyle0 = cpslDropdownCss;
|
4790
4790
|
|
4791
4791
|
const CpslDropdown = class {
|
@@ -4795,22 +4795,46 @@ const CpslDropdown = class {
|
|
4795
4795
|
this.toggleDropdown = () => {
|
4796
4796
|
this.isOpen = !this.isOpen;
|
4797
4797
|
};
|
4798
|
-
this.selectItem = (item) => {
|
4798
|
+
this.selectItem = (item, emitEvent = true) => {
|
4799
4799
|
this.selectedItem = item;
|
4800
|
-
this.
|
4801
|
-
|
4800
|
+
this.isOpen = false;
|
4801
|
+
if (emitEvent) {
|
4802
|
+
this.selectedItemChange.emit(this.selectedItem);
|
4803
|
+
}
|
4802
4804
|
};
|
4803
4805
|
this.handleItemSelect = (item) => () => {
|
4804
4806
|
this.selectItem(item);
|
4805
4807
|
};
|
4808
|
+
this.handleSearchQueryChange = (event) => {
|
4809
|
+
const target = event.target;
|
4810
|
+
this.searchQuery = target.value;
|
4811
|
+
this.filteredItems = this.items.filter(item => item.label.toLowerCase().includes(this.searchQuery.toLowerCase()));
|
4812
|
+
};
|
4813
|
+
this.handleClickOutside = (event) => {
|
4814
|
+
if (this.isOpen && !this.el.contains(event.target)) {
|
4815
|
+
this.isOpen = false;
|
4816
|
+
}
|
4817
|
+
};
|
4806
4818
|
this.width = '100%';
|
4819
|
+
this.hasCpslSearch = false;
|
4807
4820
|
this.isOpen = false;
|
4808
|
-
this.
|
4821
|
+
this.searchQuery = '';
|
4822
|
+
this.filteredItems = [];
|
4809
4823
|
this.items = [];
|
4824
|
+
this.selectedItem = null;
|
4825
|
+
}
|
4826
|
+
handleSelectedItemChange(newValue) {
|
4827
|
+
if (newValue !== null) {
|
4828
|
+
this.selectItem(newValue, false);
|
4829
|
+
}
|
4810
4830
|
}
|
4811
4831
|
handleOpenChange() {
|
4812
4832
|
if (this.isOpen) {
|
4813
4833
|
this.adjustPosition();
|
4834
|
+
this.addClickOutsideListener();
|
4835
|
+
}
|
4836
|
+
else {
|
4837
|
+
this.removeClickOutsideListener();
|
4814
4838
|
}
|
4815
4839
|
}
|
4816
4840
|
handleResize() {
|
@@ -4828,20 +4852,36 @@ const CpslDropdown = class {
|
|
4828
4852
|
dropdownOptions.style.left = `${parentRect.x}px`;
|
4829
4853
|
dropdownOptions.style.top = `${parentRect.y + parentRect.height}px`;
|
4830
4854
|
const availableHeight = viewportHeight - parentRect.bottom;
|
4831
|
-
dropdownOptions.style.maxHeight = `${availableHeight -
|
4855
|
+
dropdownOptions.style.maxHeight = `${availableHeight - 8}px`;
|
4832
4856
|
}
|
4833
4857
|
}
|
4858
|
+
addClickOutsideListener() {
|
4859
|
+
window.addEventListener('click', this.handleClickOutside);
|
4860
|
+
}
|
4861
|
+
removeClickOutsideListener() {
|
4862
|
+
window.removeEventListener('click', this.handleClickOutside);
|
4863
|
+
}
|
4834
4864
|
componentWillLoad() {
|
4835
4865
|
if (this.items.length > 0) {
|
4836
|
-
this.
|
4866
|
+
this.filteredItems = [...this.items];
|
4867
|
+
if (this.selectedItem !== null) {
|
4868
|
+
this.selectItem(this.selectedItem, false);
|
4869
|
+
}
|
4870
|
+
else {
|
4871
|
+
this.selectedItem = this.items[0];
|
4872
|
+
}
|
4837
4873
|
}
|
4838
4874
|
}
|
4875
|
+
disconnectedCallback() {
|
4876
|
+
this.removeClickOutsideListener();
|
4877
|
+
}
|
4839
4878
|
render() {
|
4840
4879
|
var _a, _b, _c;
|
4841
|
-
return (h(Host, { key: '
|
4880
|
+
return (h(Host, { key: '93306d21ee902e6d21089a161bef7955e01ab2a1', style: { width: this.width } }, h("button", { key: 'de614383df91a5684e165f0c3a455c35686fe6de', 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}`, h("div", { key: 'd972fade95a22889977066c652ac3b092d8add58', class: `chevron ${this.isOpen ? '' : 'closed'}`, innerHTML: Icons['chevronUp'] })), h("ul", { key: 'd98ac4916d595f13f1126cc912eeaf337cdc7582', class: { 'dropdown-options': true, 'open': this.isOpen }, style: { width: this.width } }, this.hasCpslSearch && (h("li", { class: "search-bar" }, h("input", { type: "text", placeholder: "Search...", value: this.searchQuery, onInput: this.handleSearchQueryChange }))), this.filteredItems.map(item => h("li", { onClick: this.handleItemSelect(item) }, h("span", { innerHTML: Icons[item.icon] }), item.label, " ", h("span", { class: "dropdown-value" }, item.value))))));
|
4842
4881
|
}
|
4843
4882
|
get el() { return getElement(this); }
|
4844
4883
|
static get watchers() { return {
|
4884
|
+
"selectedItem": ["handleSelectedItemChange"],
|
4845
4885
|
"isOpen": ["handleOpenChange"]
|
4846
4886
|
}; }
|
4847
4887
|
};
|
@@ -4872,6 +4912,7 @@ const CpslInput = class {
|
|
4872
4912
|
this.cpslChange = createEvent(this, "cpslChange", 7);
|
4873
4913
|
this.cpslBlur = createEvent(this, "cpslBlur", 7);
|
4874
4914
|
this.cpslFocus = createEvent(this, "cpslFocus", 7);
|
4915
|
+
this.cpslPaste = createEvent(this, "cpslPaste", 7);
|
4875
4916
|
this.inputId = `cpsl-input-${inputIds++}`;
|
4876
4917
|
this.onInput = (ev) => {
|
4877
4918
|
const input = ev.target;
|
@@ -4896,6 +4937,18 @@ const CpslInput = class {
|
|
4896
4937
|
this.focusedValue = this.value;
|
4897
4938
|
this.cpslFocus.emit(ev);
|
4898
4939
|
};
|
4940
|
+
this.onPaste = (ev) => {
|
4941
|
+
var _a;
|
4942
|
+
ev.stopPropagation();
|
4943
|
+
ev.preventDefault();
|
4944
|
+
const input = ev.target;
|
4945
|
+
const pasteData = ((_a = ev.clipboardData) === null || _a === void 0 ? void 0 : _a.getData('text')) || '';
|
4946
|
+
input.value = pasteData;
|
4947
|
+
this.value = pasteData;
|
4948
|
+
pasteData === '' ? this.disableSlots() : this.enableSlots();
|
4949
|
+
this.cpslPaste.emit(ev);
|
4950
|
+
this.emitValueChange(ev);
|
4951
|
+
};
|
4899
4952
|
this.focusInput = () => {
|
4900
4953
|
this.nativeInput.focus();
|
4901
4954
|
};
|
@@ -4972,7 +5025,7 @@ const CpslInput = class {
|
|
4972
5025
|
}
|
4973
5026
|
render() {
|
4974
5027
|
var _a;
|
4975
|
-
return (h(Host, { key: '
|
5028
|
+
return (h(Host, { key: 'd056945f2cfe5bff44af5987d2a9591fb1a3cd4c', class: { 'disabled': this.disabled, 'focused': this.hasFocus, 'has-value': Boolean(this.focusedValue) || Boolean(this.value) } }, this.label && (h("label", { class: "label", htmlFor: this.inputId }, this.label)), h("div", { key: '4599fe40c9ebbaf3c0e21c1cc365325163a1054d', class: { 'input-container': true, 'error-container': Boolean(this.errorText) } }, h("slot", { key: '5404baae8ccc419431f88379e1266fd69ca41670', name: "start" }), 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 }), h("slot", { key: '75ab014ee4e8b87375b67dfda539b59833168b46', name: "end" })), (this.errorText || this.helperText) && (h("div", { class: { 'helper-text-container': true, 'error-text': Boolean(this.errorText) } }, h("cpsl-icon", { icon: Boolean(this.errorText) ? 'alertCircle' : 'infoCircle' }), h("span", null, (_a = this.errorText) !== null && _a !== void 0 ? _a : this.helperText)))));
|
4976
5029
|
}
|
4977
5030
|
get el() { return getElement(this); }
|
4978
5031
|
static get watchers() { return {
|