@sula-tech/webcomponents 0.13.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.
@@ -18,7 +18,7 @@ var patchBrowser = () => {
18
18
 
19
19
  patchBrowser().then(async (options) => {
20
20
  await index.globalScripts();
21
- 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"],"selectedItem":[32],"showItems":[32],"isFocused":[32],"searchTerm":[32],"filteredItems":[32],"openUpward":[32]},[[4,"click","handleDocumentClick"],[9,"resize","handleWindowResize"]],{"value":["handleValueChange"],"showItems":["handleShowItemsChange"]}],[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);
21
+ 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);
22
22
  });
23
23
 
24
24
  exports.setNonce = index.setNonce;
@@ -1 +1 @@
1
- *,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.outline{outline-style:solid}:host{display:block}.dropdown-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#012b15;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#330d00;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#402705;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#401204;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f3f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.static{position:static}.absolute{position:absolute}.relative{position:relative}.bottom-\[72px\]{bottom:72px}.left-0{left:0}.top-\[72px\]{top:72px}.z-50{z-index:50}.m-0{margin:0}.ml-8{margin-left:.5rem}.flex{display:flex}.h-\[72px\]{height:72px}.w-full{width:100%}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.rounded-sm,.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-none{border-style:none}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.p-0{padding:0}.px-16{padding-left:1rem;padding-right:1rem}.px-24{padding-left:1.5rem;padding-right:1.5rem}.py-16{padding-bottom:1rem;padding-top:1rem}.pt-4{padding-top:.25rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-4{line-height:1rem}.leading-6{line-height:1.5rem}.text-icon-disabled{color:var(--color-icon-disabled)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\:text-text-secondary::placeholder{color:var(--color-text-secondary)}.overflow-auto{overflow:auto}.rounded-sm{border-radius:.75rem}.py-12{padding-bottom:.75rem;padding-top:.75rem}.text-text-brand{color:var(--color-text-brand)}.hover\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}
1
+ *,:after,:before{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: ;border:0 solid #e5e7eb;box-sizing:border-box}::backdrop{--tw-ring-color:rgba(59,130,246,.5);--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/:after,:before{--tw-content:""}:host,html{-webkit-text-size-adjust:100%;font-feature-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-variation-settings:normal;line-height:1.5;-moz-tab-size:4;tab-size:4}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-feature-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{font-feature-settings:inherit;color:inherit;font-family:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}.block{display:block}.outline{outline-style:solid}:host{display:block}.dropdown-focus{outline:2px solid var(--color-feedback-informational)!important;outline-offset:2px!important}:root{--color-green-50:#f1f9f4;--color-green-100:#e6f4ed;--color-green-200:#cae7d8;--color-green-300:#a0d4b8;--color-green-400:#68bb8e;--color-green-500:#04843f;--color-green-600:#037236;--color-green-700:#03632f;--color-green-800:#035428;--color-green-900:#024521;--color-green-950:#012b15;--color-red-50:#fef6f6;--color-red-100:#fde8e8;--color-red-200:#fad1d1;--color-red-300:#f7abab;--color-red-400:#f17474;--color-red-500:#c80505;--color-red-600:#b30404;--color-red-700:#9f0404;--color-red-800:#860303;--color-red-900:#6d0303;--color-red-950:#330d00;--color-yellow-50:#fdf4e7;--color-yellow-100:#fcedd9;--color-yellow-200:#fae0bd;--color-yellow-300:#f6c788;--color-yellow-400:#f3b159;--color-yellow-500:#ef9928;--color-yellow-600:#e49226;--color-yellow-700:#d17e10;--color-yellow-800:#b46d0e;--color-yellow-900:#93590b;--color-yellow-950:#402705;--color-orange-50:#fef4f1;--color-orange-100:#fde8e2;--color-orange-200:#fbd2c6;--color-orange-300:#f8b4a0;--color-orange-400:#f58e70;--color-orange-500:#f05223;--color-orange-600:#ea4210;--color-orange-700:#d23b0e;--color-orange-800:#b5330c;--color-orange-900:#942a0a;--color-orange-950:#401204;--color-blue-50:#ecf0f9;--color-blue-100:#dde3f4;--color-blue-200:#b2c2e5;--color-blue-300:#7994d2;--color-blue-400:#4066bf;--color-blue-500:#001e64;--color-blue-600:#001c5c;--color-blue-700:#00174c;--color-blue-800:#00123d;--color-blue-900:#000f33;--color-blue-950:#000d2b;--color-ambar-50:#fff6eb;--color-ambar-100:#ffefdc;--color-ambar-200:#fedfb9;--color-ambar-300:#fdca8b;--color-ambar-400:#fdb359;--color-ambar-500:#fc9c26;--color-ambar-600:#ec8403;--color-ambar-700:#d87803;--color-ambar-800:#ba6803;--color-ambar-900:#975402;--color-ambar-950:#402301;--color-gray-50:#fff;--color-gray-100:#f3f4f4;--color-gray-200:#e5e6e6;--color-gray-300:#bfc0c0;--color-gray-400:#acaeae;--color-gray-500:#949595;--color-gray-600:#737575;--color-gray-700:#6c6e6e;--color-gray-800:#313333;--color-gray-900:#272929;--color-gray-950:#191d1d;--color-white-opacity-50:#ffffff0d;--color-white-opacity-100:#ffffff1a;--color-white-opacity-200:#ffffff26;--color-white-opacity-300:#ffffff45;--color-white-opacity-400:#ffffff5c;--color-white-opacity-500:#ffffff80;--color-white-opacity-600:#ffffff8c;--color-white-opacity-700:#ffffffa3;--color-white-opacity-800:#ffffffba;--color-white-opacity-900:#fffc;--color-white-opacity-950:#ffffffe8;--color-ciano-50:#f1f6fe;--color-ciano-100:#dfeafc;--color-ciano-200:#c3d9f9;--color-ciano-300:#90b9f4;--color-ciano-400:#5d98ee;--color-ciano-500:#1769e0;--color-ciano-600:#155fcb;--color-ciano-700:#1355b4;--color-ciano-800:#104899;--color-ciano-900:#0d3b7d;--color-ciano-950:#071e40;--color-extra-color-blue-light:#e7f0f4;--color-extra-color-blue-dark:#162931;--color-black-opacity-50:rgba(25,29,29,.02);--color-black-opacity-100:rgba(25,29,29,.05);--color-black-opacity-200:rgba(25,29,29,.11);--color-black-opacity-300:rgba(25,29,29,.28);--color-black-opacity-400:rgba(25,29,29,.36);--color-black-opacity-500:rgba(25,29,29,.44);--color-black-opacity-600:rgba(25,29,29,.62);--color-black-opacity-700:rgba(25,29,29,.64);--color-black-opacity-800:rgba(25,29,29,.72);--color-black-opacity-900:rgba(25,29,29,.8);--color-black-opacity-950:rgba(25,29,29,.96);--color-shadow-opacity-50:rgba(0,0,0,.04);--color-shadow-opacity-100:rgba(0,0,0,.06);--color-shadow-opacity-200:rgba(0,0,0,.12);--color-shadow-opacity-300:rgba(0,0,0,.2);--color-shadow-opacity-400:rgba(0,0,0,.32);--color-shadow-opacity-500:rgba(0,0,0,.5);--color-shadow-opacity-600:rgba(0,0,0,.55);--color-shadow-opacity-700:rgba(0,0,0,.64);--color-shadow-opacity-800:rgba(0,0,0,.73);--color-shadow-opacity-900:rgba(0,0,0,.8);--color-shadow-opacity-950:rgba(0,0,0,.91);--color-feedback-success:#04843f;--color-feedback-error:#c80505;--color-feedback-informational:#1355b4;--color-feedback-alert:#ef9928;--color-brand-primary:#f05223;--color-brand-secondary:#001c5c;--color-brand-tertiary-1:#1769e0;--color-brand-tertiary-2:#fc9c26;--color-surface-body:#fff;--color-surface-on-body:#f3f4f4;--color-surface-on-body-blue:#e7f0f4;--color-surface-on-body-brand:#fff6eb;--color-surface-on-body-feedback-success:#e6f4ed;--color-surface-on-body-feedback-error:#fde8e8;--color-surface-on-body-feedback-alert:#fdf4e7;--color-surface-on-body-feedback-info:#dfeafc;--color-text-brand:#f05223;--color-text-primary:#313333;--color-text-secondary:#6c6e6e;--color-text-disabled:#949595;--color-text-link:#1355b4;--color-states-empty-bg-hover:rgba(25,29,29,.05);--color-states-empty-bg-pressed:rgba(25,29,29,.11);--color-states-bg-disabled:rgba(25,29,29,.02);--color-states-bg-focus:#1355b4;--color-states-primary-hover:#ea4210;--color-states-primary-pressed:#d23b0e;--color-states-danger-hover:#b30404;--color-states-danger-pressed:#9f0404;--color-states-negative-hover:#e5e6e6;--color-states-negative-pressed:#bfc0c0;--color-icon-primary:#6c6e6e;--color-icon-secondary:#fff;--color-icon-tertiary:#b30404;--color-icon-disabled:#acaeae;--color-neutral-neutral-1:#fff;--color-neutral-neutral-2:#f3f4f4;--color-neutral-neutral-3:#acaeae;--color-neutral-neutral-4:#949595;--color-neutral-neutral-5:#737575;--color-neutral-neutral-6:#6c6e6e;--color-neutral-neutral-7:#313333;--color-neutral-neutral-8:#272929;--color-negative-negative-1:#fff;--color-negative-negative-2:#313333;--color-opacity-body:#fffc;--color-opacity-on-body:rgba(25,29,29,.02);--color-opacity-overlay:rgba(25,29,29,.62);--color-opacity-on-overlay:#ffffff1a;--color-line-input:#949595;--color-line-general-strong:#bfc0c0;--color-line-general:#e5e6e6;--color-line-hair:rgba(25,29,29,.05);--color-box-shadow-body:#fff;--color-box-shadow-shadow-color-1:rgba(0,0,0,.04);--color-box-shadow-shadow-color-2:rgba(0,0,0,.06)}.static{position:static}.absolute{position:absolute}.relative{position:relative}.bottom-\[72px\]{bottom:72px}.left-0{left:0}.top-\[72px\]{top:72px}.z-50{z-index:50}.m-0{margin:0}.ml-8{margin-left:.5rem}.flex{display:flex}.h-\[72px\]{height:72px}.w-full{width:100%}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-auto{overflow:auto}.rounded-sm,.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-none{border-style:none}.border-line-general{border-color:var(--color-line-general)}.border-line-input{border-color:var(--color-line-input)}.bg-states-bg-disabled{background-color:var(--color-states-bg-disabled)}.bg-surface-body{background-color:var(--color-surface-body)}.bg-transparent{background-color:transparent}.p-0{padding:0}.px-16{padding-left:1rem;padding-right:1rem}.px-24{padding-left:1.5rem;padding-right:1.5rem}.py-16{padding-bottom:1rem;padding-top:1rem}.pt-4{padding-top:.25rem}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.font-bold{font-weight:700}.leading-4{line-height:1rem}.leading-6{line-height:1.5rem}.text-icon-disabled{color:var(--color-icon-disabled)}.text-text-disabled{color:var(--color-text-disabled)}.text-text-primary{color:var(--color-text-primary)}.text-text-secondary{color:var(--color-text-secondary)}.shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline-none{outline:2px solid transparent;outline-offset:2px}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-200{transition-duration:.2s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.placeholder\:text-text-secondary::placeholder{color:var(--color-text-secondary)}.rounded-sm{border-radius:.75rem}.py-12{padding-bottom:.75rem;padding-top:.75rem}.text-text-brand{color:var(--color-text-brand)}.hover\:bg-states-empty-bg-hover:hover{background-color:var(--color-states-empty-bg-hover)}
@@ -13,7 +13,18 @@ export class SulaDropdown {
13
13
  * Maximum height for dropdown menu in pixels
14
14
  */
15
15
  this.menuMaxHeight = 260;
16
- this.showItems = false;
16
+ /**
17
+ * Maximum height for custom content area in pixels
18
+ */
19
+ this.contentMaxHeight = 260;
20
+ /**
21
+ * Close dropdown when an item is selected or content is clicked
22
+ */
23
+ this.closeOnSelect = true;
24
+ /**
25
+ * Show or hide dropdown content
26
+ */
27
+ this.showContent = false;
17
28
  this.isFocused = false;
18
29
  this.searchTerm = '';
19
30
  this.filteredItems = [];
@@ -22,10 +33,10 @@ export class SulaDropdown {
22
33
  if (this.disabled)
23
34
  return;
24
35
  this.dropdownClicked.emit();
25
- if (this.items.length > 0) {
26
- this.showItems = !this.showItems;
36
+ if (this.customContent || this.items.length > 0) {
37
+ this.showContent = !this.showContent;
27
38
  }
28
- if (this.searchable && this.showItems && this.searchInputRef) {
39
+ if (this.searchable && this.showContent && this.searchInputRef) {
29
40
  this.searchInputRef.focus();
30
41
  }
31
42
  };
@@ -33,9 +44,11 @@ export class SulaDropdown {
33
44
  this.selectedItem = item.detail;
34
45
  this.searchTerm = '';
35
46
  this.menuItemSelected.emit(item.detail);
36
- setTimeout(() => {
37
- this.showItems = false;
38
- }, 0);
47
+ if (this.closeOnSelect) {
48
+ setTimeout(() => {
49
+ this.showContent = false;
50
+ }, 0);
51
+ }
39
52
  };
40
53
  this.filterItems = () => {
41
54
  if (!this.searchTerm.trim()) {
@@ -67,7 +80,7 @@ export class SulaDropdown {
67
80
  this.selectedItem = this.value;
68
81
  }
69
82
  }
70
- handleShowItemsChange(newValue) {
83
+ handleShowContentChange(newValue) {
71
84
  if (!newValue) {
72
85
  this.searchTerm = '';
73
86
  this.filteredItems = [];
@@ -79,11 +92,11 @@ export class SulaDropdown {
79
92
  const path = event.composedPath();
80
93
  const clickInside = path.some(el => el === this.node);
81
94
  if (!clickInside) {
82
- this.showItems = false;
95
+ this.showContent = false;
83
96
  }
84
97
  }
85
98
  handleWindowResize() {
86
- if (this.showItems) {
99
+ if (this.showContent) {
87
100
  this.calculateMenuPosition();
88
101
  }
89
102
  }
@@ -95,7 +108,7 @@ export class SulaDropdown {
95
108
  const spaceBelow = viewportHeight - rect.bottom;
96
109
  const spaceAbove = rect.top;
97
110
  const buffer = 60;
98
- const requiredSpace = this.menuMaxHeight + buffer;
111
+ const requiredSpace = (this.customContent ? this.contentMaxHeight : this.menuMaxHeight) + buffer;
99
112
  this.openUpward = spaceBelow < requiredSpace && (spaceAbove > requiredSpace || spaceAbove > spaceBelow);
100
113
  }
101
114
  componentWillLoad() {
@@ -104,7 +117,7 @@ export class SulaDropdown {
104
117
  }
105
118
  }
106
119
  componentDidRender() {
107
- if (this.showItems) {
120
+ if (this.showContent) {
108
121
  this.calculateMenuPosition();
109
122
  if (this.searchable && this.searchInputRef) {
110
123
  this.searchInputRef.focus();
@@ -118,25 +131,25 @@ export class SulaDropdown {
118
131
  }
119
132
  render() {
120
133
  var _a;
121
- return (h(Host, { key: '146e6a1dc2c2639618a3ae0d046e14aaebb62801', ref: node => (this.node = node) }, h("div", { key: '978cf1c558165eaf6e37e90216c4bfaef2fa9b66', class: {
134
+ return (h(Host, { key: '812029af9121bf2f6b10b426b93dc0095796d66d', ref: node => (this.node = node) }, h("div", { key: '24e4b075470cd3ac8311374d0eebbc9d62bc248e', class: {
122
135
  'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,
123
136
  'bg-surface-body cursor-pointer': !this.disabled,
124
137
  'bg-states-bg-disabled': this.disabled,
125
138
  'dropdown-focus': this.isFocused,
126
- }, onClick: this.handleClick, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: '8bbbba5ab876307a16bccbc91de25769ef0e4221', class: "flex flex-col w-full" }, h("label", { key: '1964385da87ff7db0a36374c18e95fb569278dff', class: {
127
- 'text-base leading-4': !this.selectedItem && !(this.searchable && this.showItems),
128
- 'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.showItems),
139
+ }, onClick: this.handleClick, tabIndex: 0, onFocus: this.handleFocus, onBlur: this.handleBlur }, h("div", { key: '10bb402bb063b83a66996c3b21e345045779fea6', class: "flex flex-col w-full" }, h("label", { key: '9e6013e76bd927d9cf50bccfe542205b2db5ad3c', class: {
140
+ 'text-base leading-4': !this.selectedItem && !(this.searchable && this.showContent),
141
+ 'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.showContent),
129
142
  'text-text-primary': !this.disabled,
130
143
  'text-text-disabled': this.disabled,
131
- } }, this.label), this.searchable && this.showItems ? (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 && (h("span", { class: {
144
+ } }, this.label), this.searchable && this.showContent ? (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 && (h("span", { class: {
132
145
  'text-base leading-4 pt-4': true,
133
146
  'text-text-primary': !this.disabled,
134
147
  'text-text-disabled': this.disabled,
135
- } }, this.selectedItem.title)))), h("div", { key: 'e1dddd3b7123149a0fb08309614affc77003d2d2', class: "flex items-center justify-center ml-8 leading-6 text-2xl" }, h("sula-icon", { key: 'e9d5bf513fe342629801c25b95bd9ef2ee7fac50', icon: `ph ph-caret-${this.showItems ? 'up' : 'down'}`, customClass: `${this.getIconClass()} text-2xl` })), this.showItems && (h("div", { key: '0e79ca32925f98ace35f2c2d3892d2b8c46e5104', class: {
148
+ } }, this.selectedItem.title)))), h("div", { key: '9c570fe666a9e400882728dd6cc7375efc6fd9c3', class: "flex items-center justify-center ml-8 leading-6 text-2xl" }, h("sula-icon", { key: 'c33165aec78c9d227a645d5a5390caa5f5580e48', icon: `ph ph-caret-${this.showContent ? 'up' : 'down'}`, customClass: `${this.getIconClass()} text-2xl` })), this.showContent && (h("div", { key: 'a5f4c9c26cfc64bb39300474e8efb52174b538ab', class: {
136
149
  'absolute z-50 left-0 w-full transition-all duration-200 ease-in-out': true,
137
150
  'bottom-[72px]': this.openUpward,
138
151
  'top-[72px]': !this.openUpward,
139
- } }, (() => {
152
+ }, onClick: !this.closeOnSelect ? (e) => e.stopPropagation() : undefined }, this.customContent ? (h("div", { class: "bg-surface-body border border-line-general rounded-sm overflow-auto", style: { maxHeight: `${this.contentMaxHeight}px` } }, h("slot", null))) : (() => {
140
153
  const itemsToShow = this.searchable && this.searchTerm.trim() ? this.filteredItems : this.items;
141
154
  const showNoResults = this.searchable && this.searchTerm.trim() && itemsToShow.length === 0;
142
155
  if (showNoResults) {
@@ -285,13 +298,91 @@ export class SulaDropdown {
285
298
  "setter": false,
286
299
  "reflect": false,
287
300
  "defaultValue": "260"
301
+ },
302
+ "contentMaxHeight": {
303
+ "type": "number",
304
+ "attribute": "content-max-height",
305
+ "mutable": false,
306
+ "complexType": {
307
+ "original": "number",
308
+ "resolved": "number",
309
+ "references": {}
310
+ },
311
+ "required": false,
312
+ "optional": false,
313
+ "docs": {
314
+ "tags": [],
315
+ "text": "Maximum height for custom content area in pixels"
316
+ },
317
+ "getter": false,
318
+ "setter": false,
319
+ "reflect": false,
320
+ "defaultValue": "260"
321
+ },
322
+ "customContent": {
323
+ "type": "boolean",
324
+ "attribute": "custom-content",
325
+ "mutable": false,
326
+ "complexType": {
327
+ "original": "boolean",
328
+ "resolved": "boolean",
329
+ "references": {}
330
+ },
331
+ "required": false,
332
+ "optional": true,
333
+ "docs": {
334
+ "tags": [],
335
+ "text": "Enable custom content via slot instead of items list"
336
+ },
337
+ "getter": false,
338
+ "setter": false,
339
+ "reflect": true
340
+ },
341
+ "closeOnSelect": {
342
+ "type": "boolean",
343
+ "attribute": "close-on-select",
344
+ "mutable": false,
345
+ "complexType": {
346
+ "original": "boolean",
347
+ "resolved": "boolean",
348
+ "references": {}
349
+ },
350
+ "required": false,
351
+ "optional": false,
352
+ "docs": {
353
+ "tags": [],
354
+ "text": "Close dropdown when an item is selected or content is clicked"
355
+ },
356
+ "getter": false,
357
+ "setter": false,
358
+ "reflect": false,
359
+ "defaultValue": "true"
360
+ },
361
+ "showContent": {
362
+ "type": "boolean",
363
+ "attribute": "show-content",
364
+ "mutable": true,
365
+ "complexType": {
366
+ "original": "boolean",
367
+ "resolved": "boolean",
368
+ "references": {}
369
+ },
370
+ "required": false,
371
+ "optional": false,
372
+ "docs": {
373
+ "tags": [],
374
+ "text": "Show or hide dropdown content"
375
+ },
376
+ "getter": false,
377
+ "setter": false,
378
+ "reflect": true,
379
+ "defaultValue": "false"
288
380
  }
289
381
  };
290
382
  }
291
383
  static get states() {
292
384
  return {
293
385
  "selectedItem": {},
294
- "showItems": {},
295
386
  "isFocused": {},
296
387
  "searchTerm": {},
297
388
  "filteredItems": {},
@@ -372,8 +463,8 @@ export class SulaDropdown {
372
463
  "propName": "value",
373
464
  "methodName": "handleValueChange"
374
465
  }, {
375
- "propName": "showItems",
376
- "methodName": "handleShowItemsChange"
466
+ "propName": "showContent",
467
+ "methodName": "handleShowContentChange"
377
468
  }];
378
469
  }
379
470
  static get listeners() {
@@ -1 +1 @@
1
- {"version":3,"file":"sula-dropdown.js","sourceRoot":"","sources":["../../../src/components/sula-dropdown/sula-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAQpG,MAAM,OAAO,YAAY;IALzB;QAYE;;WAEG;QAEH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QAEH,UAAK,GAAuB,EAAE,CAAC;QAc/B;;WAEG;QAEH,kBAAa,GAAW,GAAG,CAAC;QA8B5B,cAAS,GAAG,KAAK,CAAC;QAGlB,cAAS,GAAG,KAAK,CAAC;QAGlB,eAAU,GAAW,EAAE,CAAC;QAGxB,kBAAa,GAAuB,EAAE,CAAC;QA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaMenuListItem, SulaMenuSelectListCustomEvent } from '../../components';\n\n@Component({\n tag: 'sula-dropdown',\n styleUrl: 'sula-dropdown.scss',\n shadow: true,\n})\nexport class SulaDropdown {\n /**\n * Dropdown label\n */\n @Prop({ mutable: true })\n label: string;\n\n /**\n * Dropdown is disabled\n */\n @Prop({ mutable: true })\n disabled: boolean = false;\n\n /**\n * Items for list\n */\n @Prop({ mutable: true })\n items: SulaMenuListItem[] = [];\n\n /**\n * Value for dropdown\n */\n @Prop({ mutable: true })\n value?: SulaMenuListItem;\n\n /**\n * Enable search/filter functionality in dropdown\n */\n @Prop({ reflect: true })\n searchable?: boolean;\n\n /**\n * Maximum height for dropdown menu in pixels\n */\n @Prop()\n menuMaxHeight: number = 260;\n\n /**\n * Event emitted when dropdown is clicked\n */\n @Event()\n dropdownClicked: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused\n */\n @Event()\n dropdownFocused: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused out\n */\n @Event()\n dropdownFocusedOut: EventEmitter<void>;\n\n /**\n * Event emitted when item is selected\n */\n @Event()\n menuItemSelected: EventEmitter<SulaMenuListItem>;\n\n @State()\n selectedItem?: SulaMenuListItem;\n\n @State()\n showItems = false;\n\n @State()\n isFocused = false;\n\n @State()\n searchTerm: string = '';\n\n @State()\n filteredItems: SulaMenuListItem[] = [];\n\n @State()\n openUpward: boolean = false;\n\n node?: HTMLElement;\n searchInputRef?: HTMLInputElement;\n\n @Watch('value')\n handleValueChange() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n @Watch('showItems')\n handleShowItemsChange(newValue: boolean) {\n if (!newValue) {\n this.searchTerm = '';\n this.filteredItems = [];\n }\n }\n\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: Event) {\n if (!this.node) return;\n\n const path = event.composedPath();\n const clickInside = path.some(el => el === this.node);\n\n if (!clickInside) {\n this.showItems = false;\n }\n }\n\n @Listen('resize', { target: 'window' })\n handleWindowResize() {\n if (this.showItems) {\n this.calculateMenuPosition();\n }\n }\n\n calculateMenuPosition() {\n if (!this.node) return;\n\n const rect = this.node.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - rect.bottom;\n const spaceAbove = rect.top;\n const buffer = 60; \n const requiredSpace = this.menuMaxHeight + buffer;\n\n this.openUpward = spaceBelow < requiredSpace && (spaceAbove > requiredSpace || spaceAbove > spaceBelow);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n componentDidRender() {\n if (this.showItems) {\n this.calculateMenuPosition();\n \n if (this.searchable && this.searchInputRef) {\n this.searchInputRef.focus();\n }\n }\n }\n\n handleClick = () => {\n if (this.disabled) return;\n\n this.dropdownClicked.emit();\n\n if (this.items.length > 0) {\n this.showItems = !this.showItems;\n }\n\n if (this.searchable && this.showItems && this.searchInputRef) {\n this.searchInputRef.focus();\n }\n };\n\n handleItemSelected = (item: SulaMenuSelectListCustomEvent<SulaMenuListItem>) => {\n this.selectedItem = item.detail;\n this.searchTerm = '';\n this.menuItemSelected.emit(item.detail);\n\n setTimeout(() => {\n this.showItems = false;\n }, 0);\n };\n\n filterItems = () => {\n if (!this.searchTerm.trim()) {\n return this.items;\n }\n const term = this.searchTerm.toLowerCase();\n return this.items.filter(item => item.title.toLowerCase().includes(term));\n };\n\n handleSearchInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.searchTerm = target.value;\n this.filteredItems = this.filterItems();\n };\n\n getIconClass() {\n if (this.disabled) return 'text-icon-disabled';\n\n return 'text-text-primary';\n }\n\n handleFocus = () => {\n if (this.disabled) return;\n\n this.isFocused = true;\n this.dropdownFocused.emit();\n };\n\n handleBlur = () => {\n if (this.disabled) return;\n\n this.isFocused = false;\n this.dropdownFocusedOut.emit();\n };\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div\n class={{\n 'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,\n 'bg-surface-body cursor-pointer': !this.disabled,\n 'bg-states-bg-disabled': this.disabled,\n 'dropdown-focus': this.isFocused,\n }}\n onClick={this.handleClick}\n tabIndex={0}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <div class=\"flex flex-col w-full\">\n <label\n class={{\n 'text-base leading-4': !this.selectedItem && !(this.searchable && this.showItems),\n 'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.showItems),\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.label}\n </label>\n\n {this.searchable && this.showItems ? (\n <input\n ref={el => (this.searchInputRef = el)}\n type=\"text\"\n value={this.searchTerm}\n onInput={this.handleSearchInput}\n placeholder={this.selectedItem?.title || ''}\n 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\"\n />\n ) : (\n !!this.selectedItem && (\n <span\n class={{\n 'text-base leading-4 pt-4': true,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.selectedItem.title}\n </span>\n )\n )}\n </div>\n <div class=\"flex items-center justify-center ml-8 leading-6 text-2xl\">\n <sula-icon icon={`ph ph-caret-${this.showItems ? 'up' : 'down'}`} customClass={`${this.getIconClass()} text-2xl`}></sula-icon>\n </div>\n\n {this.showItems && (\n <div class={{\n 'absolute z-50 left-0 w-full transition-all duration-200 ease-in-out': true,\n 'bottom-[72px]': this.openUpward,\n 'top-[72px]': !this.openUpward,\n }}>\n {(() => {\n const itemsToShow = this.searchable && this.searchTerm.trim() ? this.filteredItems : this.items;\n const showNoResults = this.searchable && this.searchTerm.trim() && itemsToShow.length === 0;\n\n if (showNoResults) {\n return (\n <div class=\"bg-surface-body border border-line-general rounded-sm py-16 px-24 text-base text-text-secondary\">\n Nenhum resultado encontrado\n </div>\n );\n }\n\n return (\n <sula-menu-select-list\n items={itemsToShow}\n fullWidth={true}\n maxHeight={this.menuMaxHeight}\n selectedValue={this.selectedItem}\n onItemSelected={this.handleItemSelected}\n ></sula-menu-select-list>\n );\n })()}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"sula-dropdown.js","sourceRoot":"","sources":["../../../src/components/sula-dropdown/sula-dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAQpG,MAAM,OAAO,YAAY;IALzB;QAYE;;WAEG;QAEH,aAAQ,GAAY,KAAK,CAAC;QAE1B;;WAEG;QAEH,UAAK,GAAuB,EAAE,CAAC;QAc/B;;WAEG;QAEH,kBAAa,GAAW,GAAG,CAAC;QAE5B;;WAEG;QAEH,qBAAgB,GAAW,GAAG,CAAC;QAQ/B;;WAEG;QAEH,kBAAa,GAAY,IAAI,CAAC;QAE9B;;WAEG;QAEH,gBAAW,GAAG,KAAK,CAAC;QA8BpB,cAAS,GAAG,KAAK,CAAC;QAGlB,eAAU,GAAW,EAAE,CAAC;QAGxB,kBAAa,GAAuB,EAAE,CAAC;QAGvC,eAAU,GAAY,KAAK,CAAC;QAoE5B,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAE1B,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;YAE5B,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,KAAK,CA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E,KAAK,EAAE,WAAW,EAClB,SAAS,EAAE,IAAI,EACf,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,aAAa,EAAE,IAAI,CAAC,YAAY,EAChC,cAAc,EAAE,IAAI,CAAC,kBAAkB,GAChB,CAC1B,CAAC;gBACJ,CAAC,CAAC,EAAE,CACA,CACP,CACG,CACD,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { SulaMenuListItem, SulaMenuSelectListCustomEvent } from '../../components';\n\n@Component({\n tag: 'sula-dropdown',\n styleUrl: 'sula-dropdown.scss',\n shadow: true,\n})\nexport class SulaDropdown {\n /**\n * Dropdown label\n */\n @Prop({ mutable: true })\n label: string;\n\n /**\n * Dropdown is disabled\n */\n @Prop({ mutable: true })\n disabled: boolean = false;\n\n /**\n * Items for list\n */\n @Prop({ mutable: true })\n items: SulaMenuListItem[] = [];\n\n /**\n * Value for dropdown\n */\n @Prop({ mutable: true })\n value?: SulaMenuListItem;\n\n /**\n * Enable search/filter functionality in dropdown\n */\n @Prop({ reflect: true })\n searchable?: boolean;\n\n /**\n * Maximum height for dropdown menu in pixels\n */\n @Prop()\n menuMaxHeight: number = 260;\n\n /**\n * Maximum height for custom content area in pixels\n */\n @Prop()\n contentMaxHeight: number = 260;\n\n /**\n * Enable custom content via slot instead of items list\n */\n @Prop({ reflect: true })\n customContent?: boolean;\n\n /**\n * Close dropdown when an item is selected or content is clicked\n */\n @Prop()\n closeOnSelect: boolean = true;\n\n /**\n * Show or hide dropdown content\n */\n @Prop({ mutable: true, reflect: true })\n showContent = false;\n \n /**\n * Event emitted when dropdown is clicked\n */\n @Event()\n dropdownClicked: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused\n */\n @Event()\n dropdownFocused: EventEmitter<void>;\n\n /**\n * Event emitted when dropdown is focused out\n */\n @Event()\n dropdownFocusedOut: EventEmitter<void>;\n\n /**\n * Event emitted when item is selected\n */\n @Event()\n menuItemSelected: EventEmitter<SulaMenuListItem>;\n\n @State()\n selectedItem?: SulaMenuListItem;\n\n @State()\n isFocused = false;\n\n @State()\n searchTerm: string = '';\n\n @State()\n filteredItems: SulaMenuListItem[] = [];\n\n @State()\n openUpward: boolean = false;\n\n node?: HTMLElement;\n searchInputRef?: HTMLInputElement;\n\n @Watch('value')\n handleValueChange() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n @Watch('showContent')\n handleShowContentChange(newValue: boolean) {\n if (!newValue) {\n this.searchTerm = '';\n this.filteredItems = [];\n }\n }\n\n @Listen('click', { target: 'document' })\n handleDocumentClick(event: Event) {\n if (!this.node) return;\n\n const path = event.composedPath();\n const clickInside = path.some(el => el === this.node);\n\n if (!clickInside) {\n this.showContent = false;\n }\n }\n\n @Listen('resize', { target: 'window' })\n handleWindowResize() {\n if (this.showContent) {\n this.calculateMenuPosition();\n }\n }\n\n calculateMenuPosition() {\n if (!this.node) return;\n\n const rect = this.node.getBoundingClientRect();\n const viewportHeight = window.innerHeight;\n const spaceBelow = viewportHeight - rect.bottom;\n const spaceAbove = rect.top;\n const buffer = 60; \n const requiredSpace = (this.customContent ? this.contentMaxHeight : this.menuMaxHeight) + buffer;\n\n this.openUpward = spaceBelow < requiredSpace && (spaceAbove > requiredSpace || spaceAbove > spaceBelow);\n }\n\n componentWillLoad() {\n if (this.value) {\n this.selectedItem = this.value;\n }\n }\n\n componentDidRender() {\n if (this.showContent) {\n this.calculateMenuPosition();\n \n if (this.searchable && this.searchInputRef) {\n this.searchInputRef.focus();\n }\n }\n }\n\n handleClick = () => {\n if (this.disabled) return;\n\n this.dropdownClicked.emit();\n\n if (this.customContent || this.items.length > 0) {\n this.showContent = !this.showContent;\n }\n\n if (this.searchable && this.showContent && this.searchInputRef) {\n this.searchInputRef.focus();\n }\n };\n\n handleItemSelected = (item: SulaMenuSelectListCustomEvent<SulaMenuListItem>) => {\n this.selectedItem = item.detail;\n this.searchTerm = '';\n this.menuItemSelected.emit(item.detail);\n\n if (this.closeOnSelect) {\n setTimeout(() => {\n this.showContent = false;\n }, 0);\n }\n };\n\n filterItems = () => {\n if (!this.searchTerm.trim()) {\n return this.items;\n }\n const term = this.searchTerm.toLowerCase();\n return this.items.filter(item => item.title.toLowerCase().includes(term));\n };\n\n handleSearchInput = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.searchTerm = target.value;\n this.filteredItems = this.filterItems();\n };\n\n getIconClass() {\n if (this.disabled) return 'text-icon-disabled';\n\n return 'text-text-primary';\n }\n\n handleFocus = () => {\n if (this.disabled) return;\n\n this.isFocused = true;\n this.dropdownFocused.emit();\n };\n\n handleBlur = () => {\n if (this.disabled) return;\n\n this.isFocused = false;\n this.dropdownFocusedOut.emit();\n };\n\n render() {\n return (\n <Host ref={node => (this.node = node)}>\n <div\n class={{\n 'flex justify-between items-center border border-line-input h-[72px] px-16 rounded-xl relative': true,\n 'bg-surface-body cursor-pointer': !this.disabled,\n 'bg-states-bg-disabled': this.disabled,\n 'dropdown-focus': this.isFocused,\n }}\n onClick={this.handleClick}\n tabIndex={0}\n onFocus={this.handleFocus}\n onBlur={this.handleBlur}\n >\n <div class=\"flex flex-col w-full\">\n <label\n class={{\n 'text-base leading-4': !this.selectedItem && !(this.searchable && this.showContent),\n 'text-sm leading-4 font-bold': !!this.selectedItem || (this.searchable && this.showContent),\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.label}\n </label>\n\n {this.searchable && this.showContent ? (\n <input\n ref={el => (this.searchInputRef = el)}\n type=\"text\"\n value={this.searchTerm}\n onInput={this.handleSearchInput}\n placeholder={this.selectedItem?.title || ''}\n 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\"\n />\n ) : (\n !!this.selectedItem && (\n <span\n class={{\n 'text-base leading-4 pt-4': true,\n 'text-text-primary': !this.disabled,\n 'text-text-disabled': this.disabled,\n }}\n >\n {this.selectedItem.title}\n </span>\n )\n )}\n </div>\n <div class=\"flex items-center justify-center ml-8 leading-6 text-2xl\">\n <sula-icon icon={`ph ph-caret-${this.showContent ? 'up' : 'down'}`} customClass={`${this.getIconClass()} text-2xl`}></sula-icon>\n </div>\n\n {this.showContent && (\n <div\n class={{\n 'absolute z-50 left-0 w-full transition-all duration-200 ease-in-out': true,\n 'bottom-[72px]': this.openUpward,\n 'top-[72px]': !this.openUpward,\n }}\n onClick={!this.closeOnSelect ? (e: Event) => e.stopPropagation() : undefined}\n >\n {this.customContent ? (\n <div class=\"bg-surface-body border border-line-general rounded-sm overflow-auto\" style={{ maxHeight: `${this.contentMaxHeight}px` }}>\n <slot></slot>\n </div>\n ) : (() => {\n const itemsToShow = this.searchable && this.searchTerm.trim() ? this.filteredItems : this.items;\n const showNoResults = this.searchable && this.searchTerm.trim() && itemsToShow.length === 0;\n\n if (showNoResults) {\n return (\n <div class=\"bg-surface-body border border-line-general rounded-sm py-16 px-24 text-base text-text-secondary\">\n Nenhum resultado encontrado\n </div>\n );\n }\n\n return (\n <sula-menu-select-list\n items={itemsToShow}\n fullWidth={true}\n maxHeight={this.menuMaxHeight}\n selectedValue={this.selectedItem}\n onItemSelected={this.handleItemSelected}\n ></sula-menu-select-list>\n );\n })()}\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -50,6 +50,38 @@ export default {
50
50
  required: false,
51
51
  },
52
52
  },
53
+ customContent: {
54
+ control: 'boolean',
55
+ defaultValue: false,
56
+ description: 'Habilita conteúdo customizado via slot ao invés da lista de itens',
57
+ type: {
58
+ required: false,
59
+ },
60
+ },
61
+ contentMaxHeight: {
62
+ control: 'number',
63
+ defaultValue: 260,
64
+ description: 'Altura máxima da área de conteúdo customizado em pixels',
65
+ type: {
66
+ required: false,
67
+ },
68
+ },
69
+ closeOnSelect: {
70
+ control: 'boolean',
71
+ defaultValue: true,
72
+ description: 'Fecha o dropdown ao selecionar um item ou clicar dentro do conteúdo',
73
+ type: {
74
+ required: false,
75
+ },
76
+ },
77
+ showContent: {
78
+ control: 'boolean',
79
+ defaultValue: false,
80
+ description: 'Controla programaticamente a abertura/fechamento do dropdown',
81
+ type: {
82
+ required: false,
83
+ },
84
+ },
53
85
  dropdownClicked: {
54
86
  action: 'dropdownClicked',
55
87
  description: 'Evento emitido quando o dropdown é clicado',
@@ -87,6 +119,14 @@ const Template = args => {
87
119
  el.setAttribute('searchable', args.searchable.toString());
88
120
  if (args.menuMaxHeight)
89
121
  el.setAttribute('menu-max-height', args.menuMaxHeight.toString());
122
+ if (args.customContent)
123
+ el.setAttribute('custom-content', args.customContent.toString());
124
+ if (args.closeOnSelect !== undefined)
125
+ el.setAttribute('close-on-select', args.closeOnSelect.toString());
126
+ if (args.customContent)
127
+ el.setAttribute('custom-content', args.customContent.toString());
128
+ if (args.closeOnSelect !== undefined)
129
+ el.setAttribute('close-on-select', args.closeOnSelect.toString());
90
130
  if (args.items && args.items.length > 0) {
91
131
  el.items = args.items;
92
132
  }
@@ -299,4 +339,109 @@ AutoPositioning.parameters = {
299
339
  },
300
340
  },
301
341
  };
342
+ const CustomContentTemplate = args => {
343
+ const container = document.createElement('div');
344
+ container.style.margin = '20px';
345
+ container.style.width = '300px';
346
+ container.style.paddingBottom = '300px';
347
+ const el = document.createElement('sula-dropdown');
348
+ el.setAttribute('label', args.label);
349
+ el.setAttribute('custom-content', 'true');
350
+ if (args.closeOnSelect !== undefined)
351
+ el.setAttribute('close-on-select', args.closeOnSelect.toString());
352
+ const slotContent = document.createElement('div');
353
+ slotContent.style.padding = '16px';
354
+ slotContent.style.background = 'white';
355
+ slotContent.style.border = '1px solid #e0e0e0';
356
+ slotContent.style.borderRadius = '8px';
357
+ slotContent.innerHTML = `
358
+ <p style="margin: 0 0 8px; font-weight: bold;">Conteúdo customizado</p>
359
+ <p style="margin: 0 0 12px; font-size: 14px; color: #666;">Este conteúdo é renderizado via slot.</p>
360
+ <button style="padding: 8px 16px; background: #0066cc; color: white; border: none; border-radius: 4px; cursor: pointer;">Ação personalizada</button>
361
+ `;
362
+ el.appendChild(slotContent);
363
+ el.addEventListener('dropdownClicked', args.dropdownClicked);
364
+ container.appendChild(el);
365
+ return container;
366
+ };
367
+ export const CustomContent = CustomContentTemplate.bind({});
368
+ CustomContent.args = {
369
+ label: 'Dropdown com conteúdo customizado',
370
+ customContent: true,
371
+ closeOnSelect: true,
372
+ };
373
+ CustomContent.parameters = {
374
+ layout: 'padded',
375
+ docs: {
376
+ description: {
377
+ story: 'Demonstra o uso do dropdown com conteúdo customizado via slot. Ao invés de renderizar uma lista de itens, o dropdown exibe o conteúdo HTML passado como filho.',
378
+ },
379
+ },
380
+ };
381
+ export const CustomContentPersistent = CustomContentTemplate.bind({});
382
+ CustomContentPersistent.args = {
383
+ label: 'Dropdown persistente',
384
+ customContent: true,
385
+ closeOnSelect: false,
386
+ };
387
+ CustomContentPersistent.parameters = {
388
+ layout: 'padded',
389
+ docs: {
390
+ description: {
391
+ story: 'Dropdown com conteúdo customizado e closeOnSelect=false. O dropdown permanece aberto ao interagir com o conteúdo interno. Só fecha ao clicar fora.',
392
+ },
393
+ },
394
+ };
395
+ const CustomContentWithCheckboxesTemplate = args => {
396
+ const container = document.createElement('div');
397
+ container.style.margin = '20px';
398
+ container.style.width = '300px';
399
+ container.style.paddingBottom = '400px';
400
+ const el = document.createElement('sula-dropdown');
401
+ el.setAttribute('label', args.label);
402
+ el.setAttribute('custom-content', 'true');
403
+ el.setAttribute('close-on-select', 'false');
404
+ if (args.contentMaxHeight)
405
+ el.setAttribute('content-max-height', args.contentMaxHeight.toString());
406
+ const slotContent = document.createElement('div');
407
+ slotContent.style.padding = '12px';
408
+ slotContent.style.display = 'flex';
409
+ slotContent.style.flexDirection = 'column';
410
+ slotContent.style.gap = '8px';
411
+ const checkboxLabels = ['Opção 1', 'Opção 2', 'Opção 3', 'Opção 4', 'Opção 5', 'Opção 6'];
412
+ checkboxLabels.forEach(label => {
413
+ const checkbox = document.createElement('sula-checkbox');
414
+ checkbox.setAttribute('label', label);
415
+ slotContent.appendChild(checkbox);
416
+ });
417
+ const divider = document.createElement('div');
418
+ divider.style.height = '1px';
419
+ divider.style.backgroundColor = '#e0e0e0';
420
+ divider.style.margin = '4px 0';
421
+ slotContent.appendChild(divider);
422
+ const button = document.createElement('sula-button');
423
+ button.setAttribute('text', 'Confirmar seleção');
424
+ button.setAttribute('full-width', 'true');
425
+ button.addEventListener('buttonClicked', () => {
426
+ el.showContent = false;
427
+ });
428
+ slotContent.appendChild(button);
429
+ el.appendChild(slotContent);
430
+ el.addEventListener('dropdownClicked', args.dropdownClicked);
431
+ container.appendChild(el);
432
+ return container;
433
+ };
434
+ export const CustomContentWithCheckboxes = CustomContentWithCheckboxesTemplate.bind({});
435
+ CustomContentWithCheckboxes.args = {
436
+ label: 'Selecione as opções',
437
+ contentMaxHeight: 500,
438
+ };
439
+ CustomContentWithCheckboxes.parameters = {
440
+ layout: 'padded',
441
+ docs: {
442
+ description: {
443
+ story: 'Demonstra o dropdown com conteúdo customizado contendo checkboxes e um botão de confirmação. O botão fecha o dropdown programaticamente via `showContent = false`. Use a prop `contentMaxHeight` para controlar a altura máxima da área de conteúdo. O dropdown permanece aberto ao interagir com os itens internos (`closeOnSelect=false`).',
444
+ },
445
+ },
446
+ };
302
447
  //# sourceMappingURL=sula-dropdown.stories.js.map