@sula-tech/webcomponents 0.14.0 → 0.14.1
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/cjs/loader.cjs.js +1 -1
- package/dist/cjs/sula-avatar_21.cjs.entry.js +18 -15
- package/dist/cjs/sula-avatar_21.cjs.entry.js.map +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.js +39 -17
- package/dist/collection/components/sula-dropdown/sula-dropdown.js.map +1 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.stories.js +16 -1
- package/dist/collection/components/sula-dropdown/sula-dropdown.stories.js.map +1 -1
- package/dist/components/sula-dropdown.js +20 -17
- package/dist/components/sula-dropdown.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/sula-avatar_21.entry.js +18 -15
- package/dist/esm/sula-avatar_21.entry.js.map +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/types/components/sula-dropdown/sula-dropdown.d.ts +5 -2
- package/dist/types/components/sula-dropdown/sula-dropdown.stories.d.ts +8 -0
- package/dist/types/components.d.ts +10 -0
- package/dist/webcomponents/{p-01cb6887.entry.js → p-a7141407.entry.js} +24 -22
- package/dist/webcomponents/p-a7141407.entry.js.map +1 -0
- package/dist/webcomponents/webcomponents.esm.js +3 -3
- package/package.json +1 -1
- package/dist/webcomponents/p-01cb6887.entry.js.map +0 -1
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -5,7 +5,7 @@ var index = require('./index-C19aFtyq.js');
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await index.globalScripts();
|
|
8
|
-
return index.bootstrapLazy([["sula-avatar_21.cjs",[[1,"sula-modal",{"opened":[1028],"blockBodyScroll":[1028,"block-body-scroll"],"closeOnClickOutside":[1028,"close-on-click-outside"],"type":[1],"headerIcon":[1,"header-icon"],"modalTitle":[1,"modal-title"],"promoImage":[1,"promo-image"],"subTitle":[1,"sub-title"],"primaryButtonText":[1,"primary-button-text"],"secondaryButtonText":[1,"secondary-button-text"],"slotOverflow":[1,"slot-overflow"],"isAnimating":[32],"shouldRender":[32]},null,{"opened":["handleOpenedChange"]}],[1,"sula-chip",{"text":[1025],"appearance":[1025],"disabled":[1028],"items":[1040],"selected":[1028],"isFocused":[32],"showItems":[32]},[[4,"click","handleDocumentClick"]]],[1,"sula-dropdown",{"label":[1025],"disabled":[1028],"items":[1040],"value":[1040],"searchable":[516],"menuMaxHeight":[2,"menu-max-height"],"contentMaxHeight":[2,"content-max-height"],"customContent":[516,"custom-content"],"closeOnSelect":[4,"close-on-select"],"
|
|
8
|
+
return index.bootstrapLazy([["sula-avatar_21.cjs",[[1,"sula-modal",{"opened":[1028],"blockBodyScroll":[1028,"block-body-scroll"],"closeOnClickOutside":[1028,"close-on-click-outside"],"type":[1],"headerIcon":[1,"header-icon"],"modalTitle":[1,"modal-title"],"promoImage":[1,"promo-image"],"subTitle":[1,"sub-title"],"primaryButtonText":[1,"primary-button-text"],"secondaryButtonText":[1,"secondary-button-text"],"slotOverflow":[1,"slot-overflow"],"isAnimating":[32],"shouldRender":[32]},null,{"opened":["handleOpenedChange"]}],[1,"sula-chip",{"text":[1025],"appearance":[1025],"disabled":[1028],"items":[1040],"selected":[1028],"isFocused":[32],"showItems":[32]},[[4,"click","handleDocumentClick"]]],[1,"sula-dropdown",{"label":[1025],"disabled":[1028],"items":[1040],"value":[1040],"searchable":[516],"menuMaxHeight":[2,"menu-max-height"],"contentMaxHeight":[2,"content-max-height"],"customContent":[516,"custom-content"],"closeOnSelect":[4,"close-on-select"],"showContent":[1540,"show-content"],"selectedItem":[32],"isFocused":[32],"searchTerm":[32],"filteredItems":[32],"openUpward":[32]},[[4,"click","handleDocumentClick"],[9,"resize","handleWindowResize"]],{"value":["handleValueChange"],"showContent":["handleShowContentChange"]}],[1,"sula-avatar",{"size":[1],"imageUrl":[1,"image-url"],"text":[1],"icon":[1]}],[1,"sula-badge",{"status":[1025],"size":[1025],"type":[1025],"text":[1025],"icon":[1025],"hasSlotContent":[32]}],[1,"sula-breadcrumb",{"items":[1040]}],[1,"sula-checkbox",{"type":[1025],"label":[1025],"subTitle":[1025,"sub-title"],"disabled":[1028],"checked":[1028],"isFocus":[32]}],[1,"sula-progress-bar",{"appearance":[1025],"state":[1025],"topLabel":[1025,"top-label"],"bottomLabel":[1025,"bottom-label"],"progress":[1026],"showProgress":[1028,"show-progress"]},null,{"progress":["validateProgress"]}],[1,"sula-search-bar",{"value":[1025],"searchBarStyle":[1025,"search-bar-style"],"placeholder":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"isFocused":[32],"textValue":[32]}],[1,"sula-segmented-control",{"items":[1040],"type":[1025],"size":[1025],"color":[1025]}],[1,"sula-tag",{"label":[1025],"icon":[1025],"iconStatus":[1025,"icon-status"],"size":[1025],"appearance":[1025],"fontWeight":[1025,"font-weight"]}],[1,"sula-textfield",{"value":[1025],"type":[1],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"icon":[1],"maskPattern":[1,"mask-pattern"],"maskPatternSwitchMaxLength":[2,"mask-pattern-switch-max-length"],"inputIsOpen":[32],"textValue":[32],"showPassword":[32],"inputIsFocused":[32]},[[4,"click","handleClick"]],{"value":["watchValueHandler"],"maskPattern":["watchMaskPatternHandler"],"maskPatternSwitchMaxLength":["watchMaskPatternSwitchMaxLengthHandler"]}],[1,"sula-tiles",{"type":[1],"size":[1],"ellipsis":[4],"icon":[1],"text":[1],"subText":[1,"sub-text"],"disabled":[4]}],[1,"sula-timeline-list",{"sulaTimelineList":[1040,"sula-timeline-list"]}],[1,"sula-radio-button",{"checked":[1028],"label":[1025],"disabled":[1028],"radioIsFocus":[32]}],[1,"sula-switch",{"type":[1025],"active":[1028],"disabled":[1028],"label":[1025],"subTitle":[1025,"sub-title"],"responsive":[4],"isFocus":[32]}],[1,"sula-textarea",{"value":[1025],"status":[1025],"label":[1],"placeholder":[1],"disabled":[1028],"helpText":[1,"help-text"],"maxLength":[2,"max-length"],"rows":[2],"isActive":[32],"textValue":[32],"textareaIsFocused":[32],"labelPadding":[32]},[[4,"click","handleClick"]],{"value":["watchValueHandler"]}],[1,"sula-button",{"text":[1025],"icon":[1025],"leftIcon":[1025,"left-icon"],"rightIcon":[1025,"right-icon"],"appearance":[1025],"type":[1025],"size":[1025],"status":[1025],"loading":[1028],"buttonDisabled":[1028,"button-disabled"],"fullWidth":[1028,"full-width"]}],[1,"sula-loader",{"size":[1],"animationInstance":[32]}],[1,"sula-menu-select-list",{"items":[1040],"fullWidth":[4,"full-width"],"maxHeight":[2,"max-height"],"selectedValue":[16,"selected-value"]}],[0,"sula-icon",{"icon":[1],"customClass":[1,"custom-class"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.setNonce = index.setNonce;
|
|
@@ -575,7 +575,10 @@ const SulaDropdown = class {
|
|
|
575
575
|
* Close dropdown when an item is selected or content is clicked
|
|
576
576
|
*/
|
|
577
577
|
this.closeOnSelect = true;
|
|
578
|
-
|
|
578
|
+
/**
|
|
579
|
+
* Show or hide dropdown content
|
|
580
|
+
*/
|
|
581
|
+
this.showContent = false;
|
|
579
582
|
this.isFocused = false;
|
|
580
583
|
this.searchTerm = '';
|
|
581
584
|
this.filteredItems = [];
|
|
@@ -585,9 +588,9 @@ const SulaDropdown = class {
|
|
|
585
588
|
return;
|
|
586
589
|
this.dropdownClicked.emit();
|
|
587
590
|
if (this.customContent || this.items.length > 0) {
|
|
588
|
-
this.
|
|
591
|
+
this.showContent = !this.showContent;
|
|
589
592
|
}
|
|
590
|
-
if (this.searchable && this.
|
|
593
|
+
if (this.searchable && this.showContent && this.searchInputRef) {
|
|
591
594
|
this.searchInputRef.focus();
|
|
592
595
|
}
|
|
593
596
|
};
|
|
@@ -597,7 +600,7 @@ const SulaDropdown = class {
|
|
|
597
600
|
this.menuItemSelected.emit(item.detail);
|
|
598
601
|
if (this.closeOnSelect) {
|
|
599
602
|
setTimeout(() => {
|
|
600
|
-
this.
|
|
603
|
+
this.showContent = false;
|
|
601
604
|
}, 0);
|
|
602
605
|
}
|
|
603
606
|
};
|
|
@@ -631,7 +634,7 @@ const SulaDropdown = class {
|
|
|
631
634
|
this.selectedItem = this.value;
|
|
632
635
|
}
|
|
633
636
|
}
|
|
634
|
-
|
|
637
|
+
handleShowContentChange(newValue) {
|
|
635
638
|
if (!newValue) {
|
|
636
639
|
this.searchTerm = '';
|
|
637
640
|
this.filteredItems = [];
|
|
@@ -643,11 +646,11 @@ const SulaDropdown = class {
|
|
|
643
646
|
const path = event.composedPath();
|
|
644
647
|
const clickInside = path.some(el => el === this.node);
|
|
645
648
|
if (!clickInside) {
|
|
646
|
-
this.
|
|
649
|
+
this.showContent = false;
|
|
647
650
|
}
|
|
648
651
|
}
|
|
649
652
|
handleWindowResize() {
|
|
650
|
-
if (this.
|
|
653
|
+
if (this.showContent) {
|
|
651
654
|
this.calculateMenuPosition();
|
|
652
655
|
}
|
|
653
656
|
}
|
|
@@ -668,7 +671,7 @@ const SulaDropdown = class {
|
|
|
668
671
|
}
|
|
669
672
|
}
|
|
670
673
|
componentDidRender() {
|
|
671
|
-
if (this.
|
|
674
|
+
if (this.showContent) {
|
|
672
675
|
this.calculateMenuPosition();
|
|
673
676
|
if (this.searchable && this.searchInputRef) {
|
|
674
677
|
this.searchInputRef.focus();
|
|
@@ -682,21 +685,21 @@ const SulaDropdown = class {
|
|
|
682
685
|
}
|
|
683
686
|
render() {
|
|
684
687
|
var _a;
|
|
685
|
-
return (index.h(index.Host, { key: '
|
|
688
|
+
return (index.h(index.Host, { key: '812029af9121bf2f6b10b426b93dc0095796d66d', ref: node => (this.node = node) }, index.h("div", { key: '24e4b075470cd3ac8311374d0eebbc9d62bc248e', class: {
|
|
686
689
|
'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,
|
|
687
690
|
'bg-surface-body cursor-pointer': !this.disabled,
|
|
688
691
|
'bg-states-bg-disabled': this.disabled,
|
|
689
692
|
'dropdown-focus': this.isFocused,
|
|
690
|
-
}, onClick: this.handleClick, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("div", { key: '
|
|
691
|
-
'text-base leading-4': !this.selectedItem && !(this.searchable && this.
|
|
692
|
-
'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.
|
|
693
|
+
}, onClick: this.handleClick, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, index.h("div", { key: '10bb402bb063b83a66996c3b21e345045779fea6', class: "flex flex-col w-full" }, index.h("label", { key: '9e6013e76bd927d9cf50bccfe542205b2db5ad3c', class: {
|
|
694
|
+
'text-base leading-4': !this.selectedItem && !(this.searchable && this.showContent),
|
|
695
|
+
'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.showContent),
|
|
693
696
|
'text-text-primary': !this.disabled,
|
|
694
697
|
'text-text-disabled': this.disabled,
|
|
695
|
-
} }, this.label), this.searchable && this.
|
|
698
|
+
} }, this.label), this.searchable && this.showContent ? (index.h("input", { ref: el => (this.searchInputRef = el), type: "text", value: this.searchTerm, onInput: this.handleSearchInput, placeholder: ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.title) || '', class: "w-full text-base text-text-primary bg-transparent border-none outline-none placeholder:text-text-secondary p-0 m-0 leading-4 pt-4" })) : (!!this.selectedItem && (index.h("span", { class: {
|
|
696
699
|
'text-base leading-4 pt-4': true,
|
|
697
700
|
'text-text-primary': !this.disabled,
|
|
698
701
|
'text-text-disabled': this.disabled,
|
|
699
|
-
} }, this.selectedItem.title)))), index.h("div", { key: '
|
|
702
|
+
} }, this.selectedItem.title)))), index.h("div", { key: '9c570fe666a9e400882728dd6cc7375efc6fd9c3', class: "flex items-center justify-center ml-8 leading-6 text-2xl" }, index.h("sula-icon", { key: 'c33165aec78c9d227a645d5a5390caa5f5580e48', icon: `ph ph-caret-${this.showContent ? 'up' : 'down'}`, customClass: `${this.getIconClass()} text-2xl` })), this.showContent && (index.h("div", { key: 'a5f4c9c26cfc64bb39300474e8efb52174b538ab', class: {
|
|
700
703
|
'absolute z-50 left-0 w-full transition-all duration-200 ease-in-out': true,
|
|
701
704
|
'bottom-[72px]': this.openUpward,
|
|
702
705
|
'top-[72px]': !this.openUpward,
|
|
@@ -711,7 +714,7 @@ const SulaDropdown = class {
|
|
|
711
714
|
}
|
|
712
715
|
static get watchers() { return {
|
|
713
716
|
"value": ["handleValueChange"],
|
|
714
|
-
"
|
|
717
|
+
"showContent": ["handleShowContentChange"]
|
|
715
718
|
}; }
|
|
716
719
|
};
|
|
717
720
|
SulaDropdown.style = sulaDropdownCss;
|