@paperless/core 2.14.14 → 2.14.15
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/CHANGELOG.md +11 -0
- package/dist/build/p-11df525e.entry.js +2 -0
- package/dist/build/p-11df525e.entry.js.map +1 -0
- package/dist/build/{p-2ea4c8d2.js → p-f1c48ded.js} +1 -1
- package/dist/build/p-select.entry.esm.js.map +1 -1
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/p-select.cjs.entry.js +4 -16
- package/dist/cjs/p-select.cjs.entry.js.map +1 -1
- package/dist/cjs/p-select.entry.cjs.js.map +1 -1
- package/dist/collection/components/molecules/select/select.component.js +4 -16
- package/dist/collection/components/molecules/select/select.component.js.map +1 -1
- package/dist/components/p-select.js +4 -16
- package/dist/components/p-select.js.map +1 -1
- package/dist/esm/p-select.entry.js +4 -16
- package/dist/esm/p-select.entry.js.map +1 -1
- package/dist/index.html +1 -1
- package/dist/paperless/p-11df525e.entry.js +2 -0
- package/dist/paperless/p-11df525e.entry.js.map +1 -0
- package/dist/paperless/p-select.entry.esm.js.map +1 -1
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/package.json +1 -1
- package/dist/build/p-acc09f05.entry.js +0 -2
- package/dist/build/p-acc09f05.entry.js.map +0 -1
- package/dist/paperless/p-acc09f05.entry.js +0 -2
- package/dist/paperless/p-acc09f05.entry.js.map +0 -1
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,g as i,h as s}from"./p-Dpmiv2da.js";import{a as r}from"./p-BFSNj6hu.js";import{c as a}from"./p-CBWjHURv.js";import{c as o}from"./p-CT54OXR2.js";import{S as n}from"./p-vyRrSf5s.js";import{T as h}from"./p-C1iNEsnH.js";import"./p-ChV9xqsO.js";import"./p-BIwGgs9f.js";const l="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none!important}.pointer-events-auto{pointer-events:auto!important}.static{position:static!important}.absolute{position:absolute!important}.relative{position:relative!important}.sticky{position:sticky!important}.top-0{top:0!important}.z-10{z-index:10!important}.mb-3{margin-bottom:.75rem!important}.block{display:block!important}.flex{display:flex!important}.hidden{display:none!important}.h-6{height:1.5rem!important}.h-8{height:2rem!important}.h-\\[1\\.625rem\\]{height:1.625rem!important}.h-full{height:100%!important}.w-6{width:1.5rem!important}.w-full{width:100%!important}.min-w-0{min-width:0!important}.flex-1{flex:1 1 0%!important}.cursor-pointer{cursor:pointer!important}.items-center{align-items:center!important}.justify-center{justify-content:center!important}.gap-1{gap:.25rem!important}.gap-2{gap:.5rem!important}.overflow-hidden{overflow:hidden!important}.text-ellipsis{text-overflow:ellipsis!important}.whitespace-nowrap{white-space:nowrap!important}.rounded{border-radius:.25rem!important}.rounded-lg{border-radius:.5rem!important}.bg-indigo-100{--tw-bg-opacity:1!important;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))!important}.p-2{padding:.5rem!important}.px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-center{text-align:center!important}.text-start{text-align:start!important}.text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.font-semibold{font-weight:600!important}.text-indigo-500{--tw-text-opacity:1!important;color:rgb(142 179 251/var(--tw-text-opacity,1))!important}.text-indigo-600{--tw-text-opacity:1!important;color:rgb(82 138 250/var(--tw-text-opacity,1))!important}.text-negative-red-700{--tw-text-opacity:1!important;color:rgb(147 16 16/var(--tw-text-opacity,1))!important}.text-storm-100{--tw-text-opacity:1!important;color:rgb(209 210 212/var(--tw-text-opacity,1))!important}.text-storm-300{--tw-text-opacity:1!important;color:rgb(116 120 127/var(--tw-text-opacity,1))!important}.text-storm-400{--tw-text-opacity:1!important;color:rgb(70 75 84/var(--tw-text-opacity,1))!important}.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)!important}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1!important;color:rgb(141 16 16/var(--tw-text-opacity,1))!important}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1!important;color:rgb(27 88 210/var(--tw-text-opacity,1))!important}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)!important}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(163 165 169/var(--tw-text-opacity,1))!important}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 92 92/var(--tw-text-opacity,1))!important}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)!important}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)!important}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(163 165 169/var(--tw-text-opacity,1))!important}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 92 92/var(--tw-text-opacity,1))!important}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)!important}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}";const p=a(["flex items-center gap-2","flex-1 min-w-0 h-full","pointer-events-none overflow-hidden"]);const c=a(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","text-sm font-semibold whitespace-nowrap","rounded-lg","bg-indigo-100","dark:bg-white/15"]);const m=a("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"text-storm-400 dark:text-white",default:null},enableTextWrap:{true:false,false:"text-ellipsis whitespace-nowrap"},error:{true:"text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800",false:null}}});const d=class{constructor(i){t(this,i);this.queryChange=e(this,"queryChange",3);this.valueChange=e(this,"valueChange",3);this.selectAllChange=e(this,"selectAllChange",3);this.dropdownShown=e(this,"dropdownShown",3);this.add=e(this,"add",3);if(i.$hostElement$["s-ei"]){this._internals=i.$hostElement$["s-ei"]}else{this._internals=i.$hostElement$.attachInternals();i.$hostElement$["s-ei"]=this._internals}}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=true;showChevron=true;maxDisplayedItems=n;enableAutocomplete=true;enableTextWrap=false;asyncFilter=false;loading=false;enableSelectAll=false;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=true;showOptional=true;error;disabled=false;showAddItem=false;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=false;_selectedItem=null;_allSelected=false;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:m({variant:"placeholder"})},this.placeholder);if(!this._selectedItem){return t}if(this.multi){if(this._selectedItem?.length===0){return t}return s("div",{class:p(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:c(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden))}return this._getDisplay(this._selectedItem,true)}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey){throw new Error("You must provide a valueKey or identifierKey")}if(this.multi){this._setMultiContainerMaxWidth();this._resizeObserver=new ResizeObserver((()=>{if(this._resizeDebounceTimer){clearTimeout(this._resizeDebounceTimer);this._resizeDebounceTimer=null}this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth();this._setCheckSelectedItemsTimeout()}),200)}));this._resizeObserver.observe(this._el)}if(this.value){console.log("On load",this.value);this._valueChange(this.value,null);return}this.itemChanges()}componentDidRender(){if(this.multi){this._setMultiContainerMaxWidth()}}disconnectedCallback(){if(this.multi){this._resizeObserver.disconnect()}}render(){let t=this.icon;if(this._selectedItem&&!this.avatarKey&&!!this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem){t=this._selectedItem[this.iconKey]}if(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey]){t=null}if(this.error?.length){t="warning"}return s(h,{key:"a41991f924c400f2427ff11f455edbbc9f0dfe89"},s("p-field-container",{key:"964bba52127d2379e6a3f00260f791d559bcaedc",variant:"write",prefix:this.prefix,label:this.label,helper:this.helper,required:this.required,showOptional:this.showOptional,error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown},s("p-dropdown",{key:"a85a4fdd71d520033554156ee693b2befab5d9c3",applyFullWidth:true,applyMaxWidth:false,slot:"content",insideClick:true,manual:true,scrollable:this.enableAutocomplete?"large":true,"disable-trigger-click":this.disabled,show:this._showDropdown,onIsOpen:t=>this._onDropdownOpen(t),strategy:this.strategy},s("p-button",{key:"4e795615150e184a00ff2912dd80bb58780cfc30",slot:"trigger",class:"w-full",variant:"secondary",size:this.size,chevron:this.showChevron?this._showDropdown?"up":"down":false,active:this._showDropdown,error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],onClick:t=>this._onClick(t)},s("div",{key:"371c51e120888c7837486ac5974e9da069aa8ce2",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){if(!this._showDropdown||r(t,this._el)){return}this._showDropdown=false}_valueChange(t,e){console.log("value change",t,e);setTimeout((()=>{this._preselectItem();this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){if(this._selectedItem&&!Array.isArray(this._selectedItem)){this._selectedItem=[]}}_preselectItem(){console.log("Preselect start",this.value);let t=typeof this.value==="string"&&this.multi?JSON.parse(this.value):this.value;console.log("Post",t);if(this.multi){if(!Array.isArray(t)){this.value=[];this.valueChange.emit(this.value);return}this.value=t;if(!t.length){this._selectedItem=[];return}this._selectedItem=!!this.valueKey&&this.valueKey!=="false"?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t];return}if(!this._selectedItem&&!t&&this.autoSelectFirst){t=this._items[0]}console.log("post !this._selectedItem check",t);const e=typeof t==="object"&&t!==null?t[this._identifierKey]:t;const i=typeof e==="string"||typeof e==="number"?e:JSON.stringify(e);const s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null;const r=typeof s==="string"||typeof s==="number"?s:JSON.stringify(s);console.log("parsedValue",i);console.log("currentParsedValue",r);if(this._selectedItem&&r===i){return}if(!this._items?.length&&t){console.log("No length",t);this._selectValue(t,false);return}const a=this._getParsedItems(false);const o=a.find((t=>{const e=t?.[this._identifierKey];const s=typeof e==="string"||typeof e==="number"?e:JSON.stringify(e);return s===i}));console.log("Found item",o,t);this._selectValue(!!o?o:t,false)}_selectValue(t,e=true){console.log("Start",t,this.valueKey,this.loading);let i=!!this.valueKey&&this.valueKey!=="false"&&t!==null&&!this.loading?t?.[this.valueKey]:t;console.log("Start",t);if(this.multi){if(!this._selectedItem||!Array.isArray(this._selectedItem)){this._selectedItem=[]}if(!this.value||!Array.isArray(this.value)){this.value=[]}const e=[...this._selectedItem];const s=[...this.value];const r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));if(r===-1){e.push(t);s.push(i)}else{e.splice(r,1);s.splice(r,1)}this._selectedItem=e;this.value=s;this.valueChange.emit(s);return}this._selectedItem=t;this._onBlur(e);if(i===this.value){return}console.log("Setting value",i);this.value=i;this.valueChange.emit(i)}_onClick(t){const e=t?.composedPath();for(const t of e){if(t.nodeName.toLowerCase()==="p-button"){break}if(t.classList?.contains("item")){return}}this._showDropdown=!this._showDropdown}_onBlur(t=false){if(this.enableAutocomplete&&!t){return}this._showDropdown=false}_onAutoComplete(t){if(!this.enableAutocomplete){return}this._showDropdown=true;this.query=t.detail;this.queryChange.emit(t.detail)}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&!!this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]))>=0:t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{enableTextWrap:this.enableTextWrap,useContainer:false,onClick:()=>this._selectValue(t),active:e,checkbox:this.multi?true:false,slot:"items"},this._getDisplay(t,false,e))}));if(!this._items.length){t=[s("p",{class:"w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200",slot:"items"},this.emptyStateText)]}if(this.enableSelectAll&&this._items.length){t.unshift(s("p-dropdown-menu-item",{slot:"items",useContainer:false,checkbox:true,onClick:()=>this._selectAllChange(),active:this._allSelected},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText))}if(this.enableAutocomplete){t.unshift(this._getAutoCompleteItem())}return t}_getAddItem(){return s("p-dropdown-menu-item",{onClick:()=>this.add.emit(),useContainer:false,slot:"items"},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"})))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:false,slot:"items"},s("p-loader",{variant:"ghost",class:"h-6 w-full rounded"}))));if(this.enableAutocomplete){t.unshift(this._getAutoCompleteItem())}return t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,onValueChange:t=>this._onAutoComplete(t),onInputRefChange:t=>this.autocompleteInputRef=t.detail,value:this.query}))}_setMultiContainerMaxWidth(){if(!this._inputRef||!this._multiContainerRef){return}const t=this._inputRef.clientWidth-16;this._multiContainerRef.style.maxWidth=`${t>=16?t:16}px`}_setCheckSelectedItemsTimeout(){if(this._checkSelectedItemsTimeout){clearTimeout(this._checkSelectedItemsTimeout)}this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef){return}const t=this._multiContainerRef.getBoundingClientRect();const e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e){s.classList.remove("hidden");s.classList.add("flex");const e=s.getBoundingClientRect();if(e.right>t.right){s.classList.remove("flex");s.classList.add("hidden");i++;continue}}this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");if(!s){return}if(!s.classList.contains("hidden")){s.classList.add("hidden")}if(i>0){s.classList.remove("hidden")}}_onDropdownOpen(t){if(!t.detail||!this.autocompleteInputRef){return}setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected;this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=false,i=false){let r=s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);if(this.avatarKey){r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{size:"sm",src:t[this.avatarKey],letters:t[this.avatarLettersKey]}),s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))}if(this.iconKey&&(!e||this.showIconOnSelectedItem)){r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:o("text-storm-300 dark:text-hurricane-200",(!e||!!this.applyClassOnSelectedItem)&&(!i||!!this.applyClassOnSelectedItemInMenu)?t?.[this.iconClassKey]??"":""),variant:t[this.iconKey]}),s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))}if((!e||!!this.applyClassOnSelectedItem)&&(!i||!!this.applyClassOnSelectedItemInMenu)&&!!t?.[this.classKey]?.length){return s("div",{class:t[this.classKey]},r)}return r}_getParsedItems(t=true){if(!this.items||this.loading){return[]}let e=typeof this.items==="string"?JSON.parse(this.items):this.items;if(typeof e?.[0]==="string"){this.displayKey="text";this.valueKey="value";e=e.map((t=>({value:t,text:t})))}if(this.query?.length&&!this.asyncFilter){e=e.filter((t=>{if(this.queryKey){return this._checkvalue(this.queryKey,t)}return this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)}))}if(!t){return e}return e?.slice(0,this.maxDisplayedItems)}static get formAssociated(){return true}static get watchers(){return{value:["_valueChange"],items:["itemChanges"],_showDropdown:["_showDropdownChanges"],multi:["multiChanges"]}}};d.style=l;export{d as p_select};
|
|
2
|
-
//# sourceMappingURL=p-acc09f05.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["selectComponentCss","multiContainer","cva","multiItem","textContainer","variants","variant","placeholder","default","enableTextWrap","true","false","error","Select","items","multi","strategy","icon","query","autocompletePlaceholder","value","displayKey","dropdownDisplayKey","selectionDisplayKey","valueKey","avatarKey","iconKey","iconClassKey","showIconOnSelectedItem","classKey","applyClassOnSelectedItem","applyClassOnSelectedItemInMenu","avatarLettersKey","identifierKey","queryKey","autoSelectFirst","showChevron","maxDisplayedItems","SELECT_DEFAULT_MAX_DISPLAYED_ITEMS","enableAutocomplete","asyncFilter","loading","enableSelectAll","selectAllText","selectAllIcon","queryChange","valueChange","selectAllChange","dropdownShown","size","prefix","label","helper","required","showOptional","disabled","showAddItem","addItemText","add","emptyStateText","_showDropdown","_selectedItem","_allSelected","_amountHidden","_internals","_inputRef","autocompleteInputRef","_multiContainerRef","_resizeObserver","_resizeDebounceTimer","_checkSelectedItemsTimeout","_items","this","_getParsedItems","_displayValue","h","class","length","ref","map","item","onClick","_selectValue","_getDisplay","_identifierKey","formResetCallback","componentDidLoad","Error","_setMultiContainerMaxWidth","ResizeObserver","clearTimeout","setTimeout","_setCheckSelectedItemsTimeout","observe","_el","console","log","_valueChange","itemChanges","componentDidRender","disconnectedCallback","disconnect","render","buttonIcon","ThemedHost","key","forceShowTooltip","applyFullWidth","applyMaxWidth","slot","insideClick","manual","scrollable","show","onIsOpen","ev","_onDropdownOpen","chevron","active","iconClass","_onClick","_getLoadingItems","_getItems","_getAddItem","documentClickHandler","event","childOfComposed","oldVal","_preselectItem","_showDropdownChanges","emit","multiChanges","Array","isArray","JSON","parse","filter","i","includes","identifier","parsedValue","stringify","currentValue","currentParsedValue","find","itemIdentifier","parsedItemIdentifier","forceBlur","selectedItem","valueArray","includesIndex","findIndex","push","splice","_onBlur","composed","composedPath","nodeName","toLowerCase","classList","contains","force","_onAutoComplete","detail","_checkvalue","toString","indexOf","isSelected","useContainer","checkbox","unshift","_selectAllChange","_getAutoCompleteItem","enableHover","onValueChange","onInputRefChange","calced","clientWidth","style","maxWidth","_checkSelectedItems","containerRect","getBoundingClientRect","querySelectorAll","amountHidden","child","remove","childRect","right","extra","querySelector","focus","isSelection","isSelectedInMenu","content","src","letters","cn","applyPagination","str","text","slice"],"sources":["src/components/molecules/select/select.component.css?tag=p-select","src/components/molecules/select/select.component.tsx"],"sourcesContent":[":host {\n\t--tw-translate-y: 0px !important;\n\t--tw-translate-x: 0px !important;\n}\n","import { Strategy } from '@floating-ui/dom';\nimport {\n\tAttachInternals,\n\tComponent,\n\tElement,\n\tEvent,\n\tEventEmitter,\n\th,\n\tListen,\n\tProp,\n\tState,\n\tWatch,\n} from '@stencil/core';\nimport { childOfComposed, cn } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\nimport { cva } from 'class-variance-authority';\nimport { ThemedHost } from '../../../internal/themed-host.component';\nimport { SELECT_DEFAULT_MAX_DISPLAYED_ITEMS } from '../../../utils/constants';\n\nconst multiContainer = cva([\n\t'flex items-center gap-2',\n\t'flex-1 min-w-0 h-full',\n\t'pointer-events-none overflow-hidden',\n]);\n\nconst multiItem = cva([\n\t'item group/item',\n\t'pointer-events-auto cursor-pointer',\n\t'flex h-[1.625rem] items-center gap-2',\n\t'h-[1.625rem] px-2',\n\t'text-sm font-semibold whitespace-nowrap',\n\t'rounded-lg',\n\t'bg-indigo-100',\n\t'dark:bg-white/15',\n]);\n\nconst textContainer = cva('block w-full overflow-hidden text-start', {\n\tvariants: {\n\t\tvariant: {\n\t\t\tplaceholder: 'text-storm-400 dark:text-white',\n\t\t\tdefault: null,\n\t\t},\n\t\tenableTextWrap: {\n\t\t\ttrue: false,\n\t\t\tfalse: 'text-ellipsis whitespace-nowrap',\n\t\t},\n\t\terror: {\n\t\t\ttrue: 'text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800',\n\t\t\tfalse: null,\n\t\t},\n\t},\n});\n\n@Component({\n\ttag: 'p-select',\n\tstyleUrl: 'select.component.css',\n\tformAssociated: true,\n})\nexport class Select {\n\t/**\n\t * The items to show in the dropdown\n\t */\n\t@Prop() items: string | any[];\n\n\t/**\n\t * Wether to enable multi select\n\t */\n\t@Prop({ reflect: true }) multi: boolean;\n\n\t/**\n\t * The strategy to use for the dropdown placement\n\t */\n\t@Prop() strategy: Strategy = 'absolute';\n\n\t/**\n\t * Icon of the select box\n\t */\n\t@Prop() icon: IconVariant;\n\n\t/**\n\t * The current query\n\t */\n\t@Prop() query: string;\n\n\t/**\n\t * The placeholder of the input\n\t */\n\t@Prop() placeholder: string;\n\n\t/**\n\t * The placeholder of the input used for auto complete\n\t */\n\t@Prop() autocompletePlaceholder: string = 'Search...';\n\n\t/**\n\t * The current value\n\t */\n\t@Prop() value: any;\n\n\t/**\n\t * The key of the object to display\n\t */\n\t@Prop() displayKey: string = 'text';\n\n\t/**\n\t * The key of the object to display in the dropdown (overwrites displayKey)\n\t */\n\t@Prop() dropdownDisplayKey: string | undefined;\n\n\t/**\n\t * The key of the object to display in the input (overwrites displayKey)\n\t */\n\t@Prop() selectionDisplayKey: string | undefined;\n\n\t/**\n\t * The key of the object to return\n\t */\n\t@Prop() valueKey: string;\n\n\t/**\n\t * The key of avatar within an item to show\n\t */\n\t@Prop() avatarKey: string;\n\n\t/**\n\t * The key of icon variant within an item to show\n\t */\n\t@Prop() iconKey: string = 'icon';\n\n\t/**\n\t * The key of the class we can apploy to the icon\n\t */\n\t@Prop() iconClassKey: string = 'iconClass';\n\n\t/**\n\t * Wether to apply the item's icon on the selected item display\n\t */\n\t@Prop() showIconOnSelectedItem: string;\n\n\t/**\n\t * The key of a class in an item to apply\n\t */\n\t@Prop() classKey: string = 'class';\n\n\t/**\n\t * Wether to apply the item's class also on the selected item\n\t */\n\t@Prop() applyClassOnSelectedItem: boolean;\n\n\t/**\n\t * Wether to apply the item's class also on the selected item within the menu\n\t */\n\t@Prop() applyClassOnSelectedItemInMenu: boolean;\n\n\t/**\n\t * The key of avatar letters within an item to show when the avatar url doesn't work\n\t */\n\t@Prop() avatarLettersKey: string;\n\n\t/**\n\t * The key to identify an object\n\t */\n\t@Prop() identifierKey: string;\n\n\t/**\n\t * The key of the object to display\n\t */\n\t@Prop() queryKey?: string;\n\n\t/**\n\t * Wether to automatically select the first item\n\t */\n\t@Prop() autoSelectFirst: boolean = true;\n\n\t/**\n\t * Wether to show the chevron or not\n\t */\n\t@Prop() showChevron: boolean = true;\n\n\t/**\n\t * The maximum amount of items to display\n\t */\n\t@Prop() maxDisplayedItems: number = SELECT_DEFAULT_MAX_DISPLAYED_ITEMS;\n\n\t/**\n\t * Wether to enable autocomplete\n\t */\n\t@Prop() enableAutocomplete: boolean = true;\n\n\t/**\n\t * Wether to enable wrapping the text to a new line in the dropdown menu\n\t */\n\t@Prop() enableTextWrap?: boolean = false;\n\n\t/**\n\t * Wether the input uses async filtering\n\t */\n\t@Prop() asyncFilter: boolean = false;\n\n\t/**\n\t * Wether to show loading items\n\t */\n\t@Prop() loading: boolean = false;\n\n\t/**\n\t * Wether to show the select all item with multi select\n\t */\n\t@Prop() enableSelectAll: boolean = false;\n\n\t/**\n\t * The text of the select all item\n\t */\n\t@Prop() selectAllText: string = 'Select all';\n\n\t/**\n\t * The icon to prefix for select all\n\t */\n\t@Prop() selectAllIcon: IconVariant | undefined;\n\n\t/**\n\t * Event when the query of the autocomplete changes\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tqueryChange: EventEmitter<string>;\n\n\t/**\n\t * Event when the value changes\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tvalueChange: EventEmitter<any>;\n\n\t/**\n\t * Event when the select all item has been selected or not\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tselectAllChange: EventEmitter<any>;\n\n\t/**\n\t * Event when the dropdown shows\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tdropdownShown: EventEmitter<any>;\n\n\t/**\n\t * The size of the input group used by the select\n\t */\n\t@Prop() size: 'sm' | 'base' = 'base';\n\n\t/**\n\t * The prefix of the input group used by the select\n\t */\n\t@Prop() prefix: string;\n\n\t/**\n\t * The label of the input group used by the select\n\t */\n\t@Prop() label: string;\n\n\t/**\n\t * The helper of the input group used by the select\n\t */\n\t@Prop() helper: string;\n\n\t/**\n\t * Wether the field is required\n\t */\n\t@Prop({ reflect: true }) required: boolean = true;\n\n\t/**\n\t * Wether to show optional when not required\n\t */\n\t@Prop({ reflect: true }) showOptional: boolean = true;\n\n\t/**\n\t * The helper of the input group used by the select\n\t */\n\t@Prop({ reflect: true }) error: string;\n\n\t/**\n\t * Wether the input group is disabled used by the select\n\t */\n\t@Prop({ reflect: true }) disabled: boolean = false;\n\n\t/**\n\t * Wether to show a \"add\" item\n\t */\n\t@Prop() showAddItem: boolean = false;\n\n\t/**\n\t * The text to show when add item is being shown\n\t */\n\t@Prop() addItemText: string = 'Add item';\n\n\t/**\n\t * Event when the add item is clicked\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tadd: EventEmitter;\n\n\t/**\n\t * The text to show when items is empty\n\t */\n\t@Prop() emptyStateText: string = 'No items available';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _showDropdown: any = false;\n\t@State() private _selectedItem: any = null;\n\n\t@State() private _allSelected: boolean = false;\n\n\t@State() private _amountHidden = 0;\n\n\t@AttachInternals() _internals: ElementInternals;\n\n\tprivate _inputRef: HTMLDivElement;\n\tprivate autocompleteInputRef: HTMLInputElement | HTMLTextAreaElement;\n\tprivate _multiContainerRef: HTMLElement;\n\n\tprivate _resizeObserver: ResizeObserver;\n\tprivate _resizeDebounceTimer: NodeJS.Timeout | undefined;\n\tprivate _checkSelectedItemsTimeout: NodeJS.Timeout | undefined;\n\n\tget _items() {\n\t\treturn this._getParsedItems();\n\t}\n\n\tget _displayValue() {\n\t\tconst placeholder = (\n\t\t\t<div class={textContainer({ variant: 'placeholder' })}>\n\t\t\t\t{this.placeholder}\n\t\t\t</div>\n\t\t);\n\n\t\tif (!this._selectedItem) {\n\t\t\treturn placeholder;\n\t\t}\n\n\t\tif (this.multi) {\n\t\t\tif (this._selectedItem?.length === 0) {\n\t\t\t\treturn placeholder;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclass={multiContainer()}\n\t\t\t\t\tref={ref => (this._multiContainerRef = ref)}\n\t\t\t\t>\n\t\t\t\t\t{this._selectedItem.map(item => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass={multiItem()}\n\t\t\t\t\t\t\tonClick={() => this._selectValue(item)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item[this.selectionDisplayKey ?? this.displayKey]}\n\t\t\t\t\t\t\t<p-icon\n\t\t\t\t\t\t\t\tclass='text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white'\n\t\t\t\t\t\t\t\tvariant='negative'\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\n\t\t\t\t\t<div class='extra pointer-events-none hidden text-sm text-storm-100'>\n\t\t\t\t\t\t+{this._amountHidden}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn this._getDisplay(this._selectedItem, true);\n\t}\n\n\tget _identifierKey() {\n\t\treturn this.identifierKey ?? this.valueKey ?? 'value';\n\t}\n\n\tformResetCallback() {\n\t\tthis._selectValue(null);\n\t}\n\n\t// formDisabledCallback(disabled: boolean) {\n\t// \tif (!this._internals.form) {\n\t// \t\treturn;\n\t// \t}\n\t//\n\t// \t//this.disabled = disabled;\n\t// }\n\t//\n\tcomponentDidLoad() {\n\t\tif (!this.valueKey && !this.identifierKey) {\n\t\t\tthrow new Error('You must provide a valueKey or identifierKey');\n\t\t}\n\n\t\tif (this.multi) {\n\t\t\tthis._setMultiContainerMaxWidth();\n\n\t\t\tthis._resizeObserver = new ResizeObserver(() => {\n\t\t\t\tif (this._resizeDebounceTimer) {\n\t\t\t\t\tclearTimeout(this._resizeDebounceTimer);\n\t\t\t\t\tthis._resizeDebounceTimer = null;\n\t\t\t\t}\n\n\t\t\t\tthis._resizeDebounceTimer = setTimeout(() => {\n\t\t\t\t\tthis._setMultiContainerMaxWidth();\n\t\t\t\t\tthis._setCheckSelectedItemsTimeout();\n\t\t\t\t}, 200);\n\t\t\t});\n\t\t\tthis._resizeObserver.observe(this._el);\n\t\t}\n\n\t\tif (this.value) {\n\t\t\tconsole.log('On load', this.value);\n\t\t\tthis._valueChange(this.value, null);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.itemChanges();\n\t}\n\n\tcomponentDidRender() {\n\t\tif (this.multi) {\n\t\t\tthis._setMultiContainerMaxWidth();\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tif (this.multi) {\n\t\t\tthis._resizeObserver.disconnect();\n\t\t}\n\t}\n\n\trender() {\n\t\tlet buttonIcon = this.icon;\n\n\t\tif (\n\t\t\tthis._selectedItem &&\n\t\t\t!this.avatarKey &&\n\t\t\t!!this.iconKey &&\n\t\t\tthis._selectedItem?.[this.iconKey] &&\n\t\t\t!this.showIconOnSelectedItem\n\t\t) {\n\t\t\tbuttonIcon = this._selectedItem[this.iconKey];\n\t\t}\n\n\t\tif (\n\t\t\t(this.avatarKey && this._selectedItem?.[this.avatarKey]) ||\n\t\t\t(this.avatarLettersKey && this._selectedItem?.[this.avatarLettersKey])\n\t\t) {\n\t\t\tbuttonIcon = null;\n\t\t}\n\n\t\tif (this.error?.length) {\n\t\t\tbuttonIcon = 'warning';\n\t\t}\n\n\t\treturn (\n\t\t\t<ThemedHost>\n\t\t\t\t<p-field-container\n\t\t\t\t\tvariant='write'\n\t\t\t\t\tprefix={this.prefix}\n\t\t\t\t\tlabel={this.label}\n\t\t\t\t\thelper={this.helper}\n\t\t\t\t\trequired={this.required}\n\t\t\t\t\tshowOptional={this.showOptional}\n\t\t\t\t\terror={this.error}\n\t\t\t\t\tforceShowTooltip={!!this.error?.length && !this._showDropdown}\n\t\t\t\t>\n\t\t\t\t\t<p-dropdown\n\t\t\t\t\t\tapplyFullWidth={true}\n\t\t\t\t\t\tapplyMaxWidth={false}\n\t\t\t\t\t\tslot='content'\n\t\t\t\t\t\tinsideClick={true}\n\t\t\t\t\t\tmanual={true}\n\t\t\t\t\t\tscrollable={this.enableAutocomplete ? 'large' : true}\n\t\t\t\t\t\tdisable-trigger-click={this.disabled}\n\t\t\t\t\t\tshow={this._showDropdown}\n\t\t\t\t\t\tonIsOpen={ev => this._onDropdownOpen(ev)}\n\t\t\t\t\t\tstrategy={this.strategy}\n\t\t\t\t\t>\n\t\t\t\t\t\t<p-button\n\t\t\t\t\t\t\tslot='trigger'\n\t\t\t\t\t\t\tclass='w-full'\n\t\t\t\t\t\t\tvariant='secondary'\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tchevron={\n\t\t\t\t\t\t\t\tthis.showChevron ? (this._showDropdown ? 'up' : 'down') : false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactive={this._showDropdown}\n\t\t\t\t\t\t\terror={!!this.error?.length}\n\t\t\t\t\t\t\ticon={buttonIcon}\n\t\t\t\t\t\t\ticonClass={\n\t\t\t\t\t\t\t\tthis.applyClassOnSelectedItem &&\n\t\t\t\t\t\t\t\tthis._selectedItem?.[this.iconClassKey]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ev => this._onClick(ev)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclass='relative min-w-0 flex-1'\n\t\t\t\t\t\t\t\tref={ref => (this._inputRef = ref)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{this._displayValue}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</p-button>\n\t\t\t\t\t\t{this.loading ? this._getLoadingItems() : this._getItems()}\n\t\t\t\t\t\t{this.showAddItem && this._getAddItem()}\n\t\t\t\t\t</p-dropdown>\n\t\t\t\t</p-field-container>\n\t\t\t</ThemedHost>\n\t\t);\n\t}\n\n\t@Listen('click', { target: 'document', capture: true })\n\tprotected documentClickHandler(event) {\n\t\tif (!this._showDropdown || childOfComposed(event, this._el)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = false;\n\t}\n\n\t@Watch('value')\n\tprivate _valueChange(value, oldVal) {\n\t\tconsole.log('value change', value, oldVal);\n\t\tsetTimeout(() => {\n\t\t\tthis._preselectItem();\n\t\t\tthis._setCheckSelectedItemsTimeout();\n\t\t});\n\t}\n\n\t@Watch('items')\n\tpublic itemChanges() {\n\t\tsetTimeout(() => this._preselectItem());\n\t}\n\n\t@Watch('_showDropdown')\n\tpublic _showDropdownChanges() {\n\t\tthis.dropdownShown.emit({\n\t\t\tvalue: this._showDropdown,\n\t\t\tquery: this.query,\n\t\t});\n\t}\n\n\t@Watch('multi')\n\tpublic multiChanges() {\n\t\tif (this._selectedItem && !Array.isArray(this._selectedItem)) {\n\t\t\tthis._selectedItem = [];\n\t\t}\n\t}\n\n\tprivate _preselectItem() {\n\t\tconsole.log('Preselect start', this.value);\n\t\tlet value =\n\t\t\ttypeof this.value === 'string' && this.multi\n\t\t\t\t? JSON.parse(this.value)\n\t\t\t\t: this.value;\n\n\t\tconsole.log('Post', value);\n\n\t\tif (this.multi) {\n\t\t\tif (!Array.isArray(value)) {\n\t\t\t\tthis.value = [];\n\t\t\t\tthis.valueChange.emit(this.value);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.value = value;\n\t\t\tif (!value.length) {\n\t\t\t\tthis._selectedItem = [];\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._selectedItem =\n\t\t\t\t!!this.valueKey && this.valueKey !== 'false'\n\t\t\t\t\t? this._items.filter(i => value.includes(i?.[this.valueKey]))\n\t\t\t\t\t: [...value];\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._selectedItem && !value && this.autoSelectFirst) {\n\t\t\tvalue = this._items[0];\n\t\t}\n\n\t\tconsole.log('post !this._selectedItem check', value);\n\n\t\tconst identifier =\n\t\t\ttypeof value === 'object' && value !== null\n\t\t\t\t? value[this._identifierKey]\n\t\t\t\t: value;\n\t\tconst parsedValue =\n\t\t\ttypeof identifier === 'string' || typeof identifier === 'number'\n\t\t\t\t? identifier\n\t\t\t\t: JSON.stringify(identifier);\n\n\t\tconst currentValue = this._selectedItem\n\t\t\t? this._selectedItem?.[this._identifierKey]\n\t\t\t: null;\n\t\tconst currentParsedValue =\n\t\t\ttypeof currentValue === 'string' || typeof currentValue === 'number'\n\t\t\t\t? currentValue\n\t\t\t\t: JSON.stringify(currentValue);\n\n\t\tconsole.log('parsedValue', parsedValue);\n\t\tconsole.log('currentParsedValue', currentParsedValue);\n\t\tif (this._selectedItem && currentParsedValue === parsedValue) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._items?.length && value) {\n\t\t\tconsole.log('No length', value);\n\t\t\tthis._selectValue(value, false);\n\t\t\treturn;\n\t\t}\n\n\t\tconst items = this._getParsedItems(false);\n\t\tconst item = items.find(i => {\n\t\t\tconst itemIdentifier = i?.[this._identifierKey];\n\t\t\tconst parsedItemIdentifier =\n\t\t\t\ttypeof itemIdentifier === 'string' || typeof itemIdentifier === 'number'\n\t\t\t\t\t? itemIdentifier\n\t\t\t\t\t: JSON.stringify(itemIdentifier);\n\n\t\t\treturn parsedItemIdentifier === parsedValue;\n\t\t});\n\n\t\tconsole.log('Found item', item, value);\n\t\tthis._selectValue(!!item ? item : value, false);\n\t}\n\n\tprivate _selectValue(item, forceBlur = true) {\n\t\tconsole.log('Start', item, this.valueKey, this.loading);\n\t\tlet value =\n\t\t\t!!this.valueKey &&\n\t\t\tthis.valueKey !== 'false' &&\n\t\t\titem !== null &&\n\t\t\t!this.loading\n\t\t\t\t? item?.[this.valueKey]\n\t\t\t\t: item;\n\t\tconsole.log('Start', item);\n\n\t\tif (this.multi) {\n\t\t\tif (!this._selectedItem || !Array.isArray(this._selectedItem)) {\n\t\t\t\tthis._selectedItem = [];\n\t\t\t}\n\n\t\t\tif (!this.value || !Array.isArray(this.value)) {\n\t\t\t\tthis.value = [];\n\t\t\t}\n\n\t\t\tconst selectedItem = [...this._selectedItem];\n\t\t\tconst valueArray = [...this.value];\n\n\t\t\tconst includesIndex = selectedItem.findIndex(\n\t\t\t\ti => i[this._identifierKey] === item[this._identifierKey]\n\t\t\t);\n\t\t\tif (includesIndex === -1) {\n\t\t\t\tselectedItem.push(item);\n\t\t\t\tvalueArray.push(value);\n\t\t\t} else {\n\t\t\t\tselectedItem.splice(includesIndex, 1);\n\t\t\t\tvalueArray.splice(includesIndex, 1);\n\t\t\t}\n\n\t\t\tthis._selectedItem = selectedItem;\n\t\t\tthis.value = valueArray;\n\t\t\tthis.valueChange.emit(valueArray);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._selectedItem = item;\n\t\tthis._onBlur(forceBlur);\n\n\t\tif (value === this.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log('Setting value', value);\n\t\tthis.value = value;\n\t\tthis.valueChange.emit(value);\n\t}\n\n\tprivate _onClick(event) {\n\t\tconst composed = event?.composedPath();\n\n\t\tfor (const item of composed) {\n\t\t\tif (item.nodeName.toLowerCase() === 'p-button') {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (item.classList?.contains('item')) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis._showDropdown = !this._showDropdown;\n\t}\n\n\tprivate _onBlur(force = false) {\n\t\tif (this.enableAutocomplete && !force) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = false;\n\t}\n\n\tprivate _onAutoComplete(ev) {\n\t\tif (!this.enableAutocomplete) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = true;\n\n\t\tthis.query = ev.detail;\n\t\tthis.queryChange.emit(ev.detail);\n\t}\n\n\tprivate _checkvalue(key, item) {\n\t\treturn (\n\t\t\titem?.[key]\n\t\t\t\t?.toString()\n\t\t\t\t?.toLowerCase()\n\t\t\t\t.indexOf(this.query?.toLowerCase()) >= 0\n\t\t);\n\t}\n\n\tprivate _getItems() {\n\t\tlet items = this._items.map(item => {\n\t\t\tconst isSelected =\n\t\t\t\tthis.multi && !!this._selectedItem && Array.isArray(this._selectedItem)\n\t\t\t\t\t? this._selectedItem.findIndex(\n\t\t\t\t\t\t\ti => i[this._identifierKey] === item[this._identifierKey]\n\t\t\t\t\t ) >= 0\n\t\t\t\t\t: item[this._identifierKey] ===\n\t\t\t\t\t this._selectedItem?.[this._identifierKey];\n\t\t\treturn (\n\t\t\t\t<p-dropdown-menu-item\n\t\t\t\t\tenableTextWrap={this.enableTextWrap}\n\t\t\t\t\tuseContainer={false}\n\t\t\t\t\tonClick={() => this._selectValue(item)}\n\t\t\t\t\tactive={isSelected}\n\t\t\t\t\tcheckbox={this.multi ? true : false}\n\t\t\t\t\tslot='items'\n\t\t\t\t>\n\t\t\t\t\t{this._getDisplay(item, false, isSelected)}\n\t\t\t\t</p-dropdown-menu-item>\n\t\t\t);\n\t\t});\n\n\t\tif (!this._items.length) {\n\t\t\titems = [\n\t\t\t\t<p\n\t\t\t\t\tclass='w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200'\n\t\t\t\t\tslot='items'\n\t\t\t\t>\n\t\t\t\t\t{this.emptyStateText}\n\t\t\t\t</p>,\n\t\t\t];\n\t\t}\n\n\t\tif (this.enableSelectAll && this._items.length) {\n\t\t\titems.unshift(\n\t\t\t\t<p-dropdown-menu-item\n\t\t\t\t\tslot='items'\n\t\t\t\t\tuseContainer={false}\n\t\t\t\t\tcheckbox\n\t\t\t\t\tonClick={() => this._selectAllChange()}\n\t\t\t\t\tactive={this._allSelected}\n\t\t\t\t>\n\t\t\t\t\t{this.selectAllIcon?.length ? (\n\t\t\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t\t\t<div class='flex w-6 justify-center text-lg'>\n\t\t\t\t\t\t\t\t<p-icon variant={this.selectAllIcon} />\n\t\t\t\t\t\t\t</div>{' '}\n\t\t\t\t\t\t\t{this.selectAllText}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tthis.selectAllText\n\t\t\t\t\t)}\n\t\t\t\t</p-dropdown-menu-item>\n\t\t\t);\n\t\t}\n\n\t\tif (this.enableAutocomplete) {\n\t\t\titems.unshift(this._getAutoCompleteItem());\n\t\t}\n\n\t\treturn items;\n\t}\n\n\tprivate _getAddItem() {\n\t\treturn (\n\t\t\t<p-dropdown-menu-item\n\t\t\t\tonClick={() => this.add.emit()}\n\t\t\t\tuseContainer={false}\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<span class='flex items-center gap-1 font-semibold text-indigo-600'>\n\t\t\t\t\t{this.addItemText}\n\t\t\t\t\t<p-icon variant='plus' />\n\t\t\t\t</span>\n\t\t\t</p-dropdown-menu-item>\n\t\t);\n\t}\n\n\tprivate _getLoadingItems() {\n\t\tconst items = [0, 0, 0].map(() => (\n\t\t\t<p-dropdown-menu-item\n\t\t\t\tenableHover={false}\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<p-loader\n\t\t\t\t\tvariant='ghost'\n\t\t\t\t\tclass='h-6 w-full rounded'\n\t\t\t\t/>\n\t\t\t</p-dropdown-menu-item>\n\t\t));\n\n\t\tif (this.enableAutocomplete) {\n\t\t\titems.unshift(this._getAutoCompleteItem());\n\t\t}\n\n\t\treturn items;\n\t}\n\n\tprivate _getAutoCompleteItem() {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclass='sticky top-0 z-10 mb-3 h-8'\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<p-field\n\t\t\t\t\tclass='block'\n\t\t\t\t\tplaceholder={this.autocompletePlaceholder}\n\t\t\t\t\tonValueChange={ev => this._onAutoComplete(ev)}\n\t\t\t\t\tonInputRefChange={ev => (this.autocompleteInputRef = ev.detail)}\n\t\t\t\t\tvalue={this.query}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tprivate _setMultiContainerMaxWidth() {\n\t\tif (!this._inputRef || !this._multiContainerRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst calced = this._inputRef.clientWidth - 16;\n\t\tthis._multiContainerRef.style.maxWidth = `${calced >= 16 ? calced : 16}px`;\n\t}\n\n\tprivate _setCheckSelectedItemsTimeout() {\n\t\tif (this._checkSelectedItemsTimeout) {\n\t\t\tclearTimeout(this._checkSelectedItemsTimeout);\n\t\t}\n\n\t\tthis._checkSelectedItemsTimeout = setTimeout(\n\t\t\t() => this._checkSelectedItems(),\n\t\t\t50\n\t\t);\n\t}\n\n\tprivate _checkSelectedItems() {\n\t\tif (!this._multiContainerRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst containerRect = this._multiContainerRef.getBoundingClientRect();\n\t\tconst items = this._multiContainerRef.querySelectorAll('.item');\n\n\t\tlet amountHidden = 0;\n\n\t\tfor (const child of items) {\n\t\t\tchild.classList.remove('hidden');\n\t\t\tchild.classList.add('flex');\n\n\t\t\tconst childRect = child.getBoundingClientRect();\n\t\t\tif (childRect.right > containerRect.right) {\n\t\t\t\tchild.classList.remove('flex');\n\t\t\t\tchild.classList.add('hidden');\n\t\t\t\tamountHidden++;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tthis._amountHidden = amountHidden;\n\t\tconst extra = this._multiContainerRef.querySelector('.extra');\n\t\tif (!extra) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!extra.classList.contains('hidden')) {\n\t\t\textra.classList.add('hidden');\n\t\t}\n\n\t\tif (amountHidden > 0) {\n\t\t\textra.classList.remove('hidden');\n\t\t}\n\t}\n\n\tprivate _onDropdownOpen(ev) {\n\t\tif (!ev.detail || !this.autocompleteInputRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimeout(() => this.autocompleteInputRef.focus(), 100);\n\t}\n\n\tprivate _selectAllChange() {\n\t\tthis._allSelected = !this._allSelected;\n\t\tthis.selectAllChange.emit(this._allSelected);\n\t}\n\n\tprivate _getDisplay(item, isSelection = false, isSelectedInMenu = false) {\n\t\tlet content = (\n\t\t\t<div\n\t\t\t\tclass={textContainer({\n\t\t\t\t\tvariant: 'default',\n\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\titem[\n\t\t\t\t\t\tisSelection\n\t\t\t\t\t\t\t? this.selectionDisplayKey ?? this.displayKey\n\t\t\t\t\t\t\t: this.displayKey\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\n\t\tif (this.avatarKey) {\n\t\t\tcontent = (\n\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t<p-avatar\n\t\t\t\t\t\tsize='sm'\n\t\t\t\t\t\tsrc={item[this.avatarKey]}\n\t\t\t\t\t\tletters={item[this.avatarLettersKey]}\n\t\t\t\t\t></p-avatar>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={textContainer({\n\t\t\t\t\t\t\tvariant: 'default',\n\t\t\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item[this.dropdownDisplayKey ?? this.displayKey]}\n\t\t\t\t\t</div>\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\n\t\tif (this.iconKey && (!isSelection || this.showIconOnSelectedItem)) {\n\t\t\tcontent = (\n\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t{item[this.iconKey] && (\n\t\t\t\t\t\t<p-icon\n\t\t\t\t\t\t\tclass={cn(\n\t\t\t\t\t\t\t\t'text-storm-300 dark:text-hurricane-200',\n\t\t\t\t\t\t\t\t(!isSelection || !!this.applyClassOnSelectedItem) &&\n\t\t\t\t\t\t\t\t\t(!isSelectedInMenu || !!this.applyClassOnSelectedItemInMenu)\n\t\t\t\t\t\t\t\t\t? item?.[this.iconClassKey] ?? ''\n\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tvariant={item[this.iconKey] as IconVariant}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={textContainer({\n\t\t\t\t\t\t\tvariant: 'default',\n\t\t\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item[this.dropdownDisplayKey ?? this.displayKey]}\n\t\t\t\t\t</div>\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t(!isSelection || !!this.applyClassOnSelectedItem) &&\n\t\t\t(!isSelectedInMenu || !!this.applyClassOnSelectedItemInMenu) &&\n\t\t\t!!item?.[this.classKey]?.length\n\t\t) {\n\t\t\treturn <div class={item[this.classKey]}>{content}</div>;\n\t\t}\n\n\t\treturn content;\n\t}\n\n\tprivate _getParsedItems(applyPagination = true) {\n\t\tif (!this.items || this.loading) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet items =\n\t\t\ttypeof this.items === 'string' ? JSON.parse(this.items) : this.items;\n\n\t\tif (typeof items?.[0] === 'string') {\n\t\t\tthis.displayKey = 'text';\n\t\t\tthis.valueKey = 'value';\n\n\t\t\titems = items.map(str => ({\n\t\t\t\tvalue: str,\n\t\t\t\ttext: str,\n\t\t\t}));\n\t\t}\n\n\t\tif (this.query?.length && !this.asyncFilter) {\n\t\t\titems = items.filter(item => {\n\t\t\t\tif (this.queryKey) {\n\t\t\t\t\treturn this._checkvalue(this.queryKey, item);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tthis._checkvalue(this._identifierKey, item) ||\n\t\t\t\t\tthis._checkvalue(this.displayKey, item)\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\tif (!applyPagination) {\n\t\t\treturn items;\n\t\t}\n\n\t\treturn items?.slice(0, this.maxDisplayedItems);\n\t}\n}\n"],"mappings":"6RAAA,MAAMA,EAAqB,mlJCoB3B,MAAMC,EAAiBC,EAAI,CAC1B,0BACA,wBACA,wCAGD,MAAMC,EAAYD,EAAI,CACrB,kBACA,qCACA,uCACA,oBACA,0CACA,aACA,gBACA,qBAGD,MAAME,EAAgBF,EAAI,0CAA2C,CACpEG,SAAU,CACTC,QAAS,CACRC,YAAa,iCACbC,QAAS,MAEVC,eAAgB,CACfC,KAAM,MACNC,MAAO,mCAERC,MAAO,CACNF,KAAM,oGACNC,MAAO,S,MAUGE,EAAM,M,sYAIVC,MAKiBC,MAKjBC,SAAqB,WAKrBC,KAKAC,MAKAX,YAKAY,wBAAkC,YAKlCC,MAKAC,WAAqB,OAKrBC,mBAKAC,oBAKAC,SAKAC,UAKAC,QAAkB,OAKlBC,aAAuB,YAKvBC,uBAKAC,SAAmB,QAKnBC,yBAKAC,+BAKAC,iBAKAC,cAKAC,SAKAC,gBAA2B,KAK3BC,YAAuB,KAKvBC,kBAA4BC,EAK5BC,mBAA8B,KAK9B9B,eAA2B,MAK3B+B,YAAuB,MAKvBC,QAAmB,MAKnBC,gBAA2B,MAK3BC,cAAwB,aAKxBC,cAQRC,YAQAC,YAQAC,gBAQAC,cAKQC,KAAsB,OAKtBC,OAKAC,MAKAC,OAKiBC,SAAoB,KAKpBC,aAAwB,KAKxB1C,MAKA2C,SAAoB,MAKrCC,YAAuB,MAKvBC,YAAsB,WAQ9BC,IAKQC,eAAyB,qB,yBAOhBC,cAAqB,MACrBC,cAAqB,KAErBC,aAAwB,MAExBC,c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1C,IAAKsH,EAAiB,CACrB,OAAOxL,C,CAGR,OAAOA,GAAO2L,MAAM,EAAGjI,KAAKnC,kB","ignoreList":[]}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,g as i,h as s}from"./p-Dpmiv2da.js";import{a as r}from"./p-BFSNj6hu.js";import{c as a}from"./p-CBWjHURv.js";import{c as o}from"./p-CT54OXR2.js";import{S as n}from"./p-vyRrSf5s.js";import{T as h}from"./p-C1iNEsnH.js";import"./p-ChV9xqsO.js";import"./p-BIwGgs9f.js";const l="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none!important}.pointer-events-auto{pointer-events:auto!important}.static{position:static!important}.absolute{position:absolute!important}.relative{position:relative!important}.sticky{position:sticky!important}.top-0{top:0!important}.z-10{z-index:10!important}.mb-3{margin-bottom:.75rem!important}.block{display:block!important}.flex{display:flex!important}.hidden{display:none!important}.h-6{height:1.5rem!important}.h-8{height:2rem!important}.h-\\[1\\.625rem\\]{height:1.625rem!important}.h-full{height:100%!important}.w-6{width:1.5rem!important}.w-full{width:100%!important}.min-w-0{min-width:0!important}.flex-1{flex:1 1 0%!important}.cursor-pointer{cursor:pointer!important}.items-center{align-items:center!important}.justify-center{justify-content:center!important}.gap-1{gap:.25rem!important}.gap-2{gap:.5rem!important}.overflow-hidden{overflow:hidden!important}.text-ellipsis{text-overflow:ellipsis!important}.whitespace-nowrap{white-space:nowrap!important}.rounded{border-radius:.25rem!important}.rounded-lg{border-radius:.5rem!important}.bg-indigo-100{--tw-bg-opacity:1!important;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))!important}.p-2{padding:.5rem!important}.px-2{padding-left:.5rem!important;padding-right:.5rem!important}.text-center{text-align:center!important}.text-start{text-align:start!important}.text-lg{font-size:1.125rem!important;line-height:1.75rem!important}.text-sm{font-size:.875rem!important;line-height:1.25rem!important}.text-xs{font-size:.75rem!important;line-height:1rem!important}.font-semibold{font-weight:600!important}.text-indigo-500{--tw-text-opacity:1!important;color:rgb(142 179 251/var(--tw-text-opacity,1))!important}.text-indigo-600{--tw-text-opacity:1!important;color:rgb(82 138 250/var(--tw-text-opacity,1))!important}.text-negative-red-700{--tw-text-opacity:1!important;color:rgb(147 16 16/var(--tw-text-opacity,1))!important}.text-storm-100{--tw-text-opacity:1!important;color:rgb(209 210 212/var(--tw-text-opacity,1))!important}.text-storm-300{--tw-text-opacity:1!important;color:rgb(116 120 127/var(--tw-text-opacity,1))!important}.text-storm-400{--tw-text-opacity:1!important;color:rgb(70 75 84/var(--tw-text-opacity,1))!important}.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)!important}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1!important;color:rgb(141 16 16/var(--tw-text-opacity,1))!important}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1!important;color:rgb(27 88 210/var(--tw-text-opacity,1))!important}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)!important}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(163 165 169/var(--tw-text-opacity,1))!important}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 92 92/var(--tw-text-opacity,1))!important}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)!important}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)!important}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(163 165 169/var(--tw-text-opacity,1))!important}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 92 92/var(--tw-text-opacity,1))!important}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)!important}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1!important;color:rgb(255 255 255/var(--tw-text-opacity,1))!important}";const p=a(["flex items-center gap-2","flex-1 min-w-0 h-full","pointer-events-none overflow-hidden"]);const c=a(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","text-sm font-semibold whitespace-nowrap","rounded-lg","bg-indigo-100","dark:bg-white/15"]);const m=a("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"text-storm-400 dark:text-white",default:null},enableTextWrap:{true:false,false:"text-ellipsis whitespace-nowrap"},error:{true:"text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800",false:null}}});const d=class{constructor(i){t(this,i);this.queryChange=e(this,"queryChange",3);this.valueChange=e(this,"valueChange",3);this.selectAllChange=e(this,"selectAllChange",3);this.dropdownShown=e(this,"dropdownShown",3);this.add=e(this,"add",3);if(i.$hostElement$["s-ei"]){this._internals=i.$hostElement$["s-ei"]}else{this._internals=i.$hostElement$.attachInternals();i.$hostElement$["s-ei"]=this._internals}}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=true;showChevron=true;maxDisplayedItems=n;enableAutocomplete=true;enableTextWrap=false;asyncFilter=false;loading=false;enableSelectAll=false;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=true;showOptional=true;error;disabled=false;showAddItem=false;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=false;_selectedItem=null;_allSelected=false;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:m({variant:"placeholder"})},this.placeholder);if(!this._selectedItem){return t}if(this.multi){if(this._selectedItem?.length===0){return t}return s("div",{class:p(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:c(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden))}return this._getDisplay(this._selectedItem,true)}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey){throw new Error("You must provide a valueKey or identifierKey")}if(this.multi){this._setMultiContainerMaxWidth();this._resizeObserver=new ResizeObserver((()=>{if(this._resizeDebounceTimer){clearTimeout(this._resizeDebounceTimer);this._resizeDebounceTimer=null}this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth();this._setCheckSelectedItemsTimeout()}),200)}));this._resizeObserver.observe(this._el)}if(this.value){console.log("On load",this.value);this._valueChange(this.value,null);return}this.itemChanges()}componentDidRender(){if(this.multi){this._setMultiContainerMaxWidth()}}disconnectedCallback(){if(this.multi){this._resizeObserver.disconnect()}}render(){let t=this.icon;if(this._selectedItem&&!this.avatarKey&&!!this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem){t=this._selectedItem[this.iconKey]}if(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey]){t=null}if(this.error?.length){t="warning"}return s(h,{key:"a41991f924c400f2427ff11f455edbbc9f0dfe89"},s("p-field-container",{key:"964bba52127d2379e6a3f00260f791d559bcaedc",variant:"write",prefix:this.prefix,label:this.label,helper:this.helper,required:this.required,showOptional:this.showOptional,error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown},s("p-dropdown",{key:"a85a4fdd71d520033554156ee693b2befab5d9c3",applyFullWidth:true,applyMaxWidth:false,slot:"content",insideClick:true,manual:true,scrollable:this.enableAutocomplete?"large":true,"disable-trigger-click":this.disabled,show:this._showDropdown,onIsOpen:t=>this._onDropdownOpen(t),strategy:this.strategy},s("p-button",{key:"4e795615150e184a00ff2912dd80bb58780cfc30",slot:"trigger",class:"w-full",variant:"secondary",size:this.size,chevron:this.showChevron?this._showDropdown?"up":"down":false,active:this._showDropdown,error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],onClick:t=>this._onClick(t)},s("div",{key:"371c51e120888c7837486ac5974e9da069aa8ce2",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){if(!this._showDropdown||r(t,this._el)){return}this._showDropdown=false}_valueChange(t,e){console.log("value change",t,e);setTimeout((()=>{this._preselectItem();this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){if(this._selectedItem&&!Array.isArray(this._selectedItem)){this._selectedItem=[]}}_preselectItem(){console.log("Preselect start",this.value);let t=typeof this.value==="string"&&this.multi?JSON.parse(this.value):this.value;console.log("Post",t);if(this.multi){if(!Array.isArray(t)){this.value=[];this.valueChange.emit(this.value);return}this.value=t;if(!t.length){this._selectedItem=[];return}this._selectedItem=!!this.valueKey&&this.valueKey!=="false"?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t];return}if(!this._selectedItem&&!t&&this.autoSelectFirst){t=this._items[0]}console.log("post !this._selectedItem check",t);const e=typeof t==="object"&&t!==null?t[this._identifierKey]:t;const i=typeof e==="string"||typeof e==="number"?e:JSON.stringify(e);const s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null;const r=typeof s==="string"||typeof s==="number"?s:JSON.stringify(s);console.log("parsedValue",i);console.log("currentParsedValue",r);if(this._selectedItem&&r===i){return}if(!this._items?.length&&t){console.log("No length",t);this._selectValue(t,false);return}const a=this._getParsedItems(false);const o=a.find((t=>{const e=t?.[this._identifierKey];const s=typeof e==="string"||typeof e==="number"?e:JSON.stringify(e);return s===i}));console.log("Found item",o,t);this._selectValue(!!o?o:t,false)}_selectValue(t,e=true){console.log("Start",t,this.valueKey,this.loading);let i=!!this.valueKey&&this.valueKey!=="false"&&t!==null&&!this.loading?t?.[this.valueKey]:t;console.log("Start",t);if(this.multi){if(!this._selectedItem||!Array.isArray(this._selectedItem)){this._selectedItem=[]}if(!this.value||!Array.isArray(this.value)){this.value=[]}const e=[...this._selectedItem];const s=[...this.value];const r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));if(r===-1){e.push(t);s.push(i)}else{e.splice(r,1);s.splice(r,1)}this._selectedItem=e;this.value=s;this.valueChange.emit(s);return}this._selectedItem=t;this._onBlur(e);if(i===this.value){return}console.log("Setting value",i);this.value=i;this.valueChange.emit(i)}_onClick(t){const e=t?.composedPath();for(const t of e){if(t.nodeName.toLowerCase()==="p-button"){break}if(t.classList?.contains("item")){return}}this._showDropdown=!this._showDropdown}_onBlur(t=false){if(this.enableAutocomplete&&!t){return}this._showDropdown=false}_onAutoComplete(t){if(!this.enableAutocomplete){return}this._showDropdown=true;this.query=t.detail;this.queryChange.emit(t.detail)}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&!!this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]))>=0:t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{enableTextWrap:this.enableTextWrap,useContainer:false,onClick:()=>this._selectValue(t),active:e,checkbox:this.multi?true:false,slot:"items"},this._getDisplay(t,false,e))}));if(!this._items.length){t=[s("p",{class:"w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200",slot:"items"},this.emptyStateText)]}if(this.enableSelectAll&&this._items.length){t.unshift(s("p-dropdown-menu-item",{slot:"items",useContainer:false,checkbox:true,onClick:()=>this._selectAllChange(),active:this._allSelected},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText))}if(this.enableAutocomplete){t.unshift(this._getAutoCompleteItem())}return t}_getAddItem(){return s("p-dropdown-menu-item",{onClick:()=>this.add.emit(),useContainer:false,slot:"items"},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"})))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:false,slot:"items"},s("p-loader",{variant:"ghost",class:"h-6 w-full rounded"}))));if(this.enableAutocomplete){t.unshift(this._getAutoCompleteItem())}return t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,onValueChange:t=>this._onAutoComplete(t),onInputRefChange:t=>this.autocompleteInputRef=t.detail,value:this.query}))}_setMultiContainerMaxWidth(){if(!this._inputRef||!this._multiContainerRef){return}const t=this._inputRef.clientWidth-16;this._multiContainerRef.style.maxWidth=`${t>=16?t:16}px`}_setCheckSelectedItemsTimeout(){if(this._checkSelectedItemsTimeout){clearTimeout(this._checkSelectedItemsTimeout)}this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef){return}const t=this._multiContainerRef.getBoundingClientRect();const e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e){s.classList.remove("hidden");s.classList.add("flex");const e=s.getBoundingClientRect();if(e.right>t.right){s.classList.remove("flex");s.classList.add("hidden");i++;continue}}this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");if(!s){return}if(!s.classList.contains("hidden")){s.classList.add("hidden")}if(i>0){s.classList.remove("hidden")}}_onDropdownOpen(t){if(!t.detail||!this.autocompleteInputRef){return}setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected;this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=false,i=false){let r=s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);if(this.avatarKey){r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{size:"sm",src:t[this.avatarKey],letters:t[this.avatarLettersKey]}),s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))}if(this.iconKey&&(!e||this.showIconOnSelectedItem)){r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:o("text-storm-300 dark:text-hurricane-200",(!e||!!this.applyClassOnSelectedItem)&&(!i||!!this.applyClassOnSelectedItemInMenu)?t?.[this.iconClassKey]??"":""),variant:t[this.iconKey]}),s("div",{class:m({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))}if((!e||!!this.applyClassOnSelectedItem)&&(!i||!!this.applyClassOnSelectedItemInMenu)&&!!t?.[this.classKey]?.length){return s("div",{class:t[this.classKey]},r)}return r}_getParsedItems(t=true){if(!this.items||this.loading){return[]}let e=typeof this.items==="string"?JSON.parse(this.items):this.items;if(typeof e?.[0]==="string"){this.displayKey="text";this.valueKey="value";e=e.map((t=>({value:t,text:t})))}if(this.query?.length&&!this.asyncFilter){e=e.filter((t=>{if(this.queryKey){return this._checkvalue(this.queryKey,t)}return this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)}))}if(!t){return e}return e?.slice(0,this.maxDisplayedItems)}static get formAssociated(){return true}static get watchers(){return{value:["_valueChange"],items:["itemChanges"],_showDropdown:["_showDropdownChanges"],multi:["multiChanges"]}}};d.style=l;export{d as p_select};
|
|
2
|
-
//# sourceMappingURL=p-acc09f05.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["selectComponentCss","multiContainer","cva","multiItem","textContainer","variants","variant","placeholder","default","enableTextWrap","true","false","error","Select","items","multi","strategy","icon","query","autocompletePlaceholder","value","displayKey","dropdownDisplayKey","selectionDisplayKey","valueKey","avatarKey","iconKey","iconClassKey","showIconOnSelectedItem","classKey","applyClassOnSelectedItem","applyClassOnSelectedItemInMenu","avatarLettersKey","identifierKey","queryKey","autoSelectFirst","showChevron","maxDisplayedItems","SELECT_DEFAULT_MAX_DISPLAYED_ITEMS","enableAutocomplete","asyncFilter","loading","enableSelectAll","selectAllText","selectAllIcon","queryChange","valueChange","selectAllChange","dropdownShown","size","prefix","label","helper","required","showOptional","disabled","showAddItem","addItemText","add","emptyStateText","_showDropdown","_selectedItem","_allSelected","_amountHidden","_internals","_inputRef","autocompleteInputRef","_multiContainerRef","_resizeObserver","_resizeDebounceTimer","_checkSelectedItemsTimeout","_items","this","_getParsedItems","_displayValue","h","class","length","ref","map","item","onClick","_selectValue","_getDisplay","_identifierKey","formResetCallback","componentDidLoad","Error","_setMultiContainerMaxWidth","ResizeObserver","clearTimeout","setTimeout","_setCheckSelectedItemsTimeout","observe","_el","console","log","_valueChange","itemChanges","componentDidRender","disconnectedCallback","disconnect","render","buttonIcon","ThemedHost","key","forceShowTooltip","applyFullWidth","applyMaxWidth","slot","insideClick","manual","scrollable","show","onIsOpen","ev","_onDropdownOpen","chevron","active","iconClass","_onClick","_getLoadingItems","_getItems","_getAddItem","documentClickHandler","event","childOfComposed","oldVal","_preselectItem","_showDropdownChanges","emit","multiChanges","Array","isArray","JSON","parse","filter","i","includes","identifier","parsedValue","stringify","currentValue","currentParsedValue","find","itemIdentifier","parsedItemIdentifier","forceBlur","selectedItem","valueArray","includesIndex","findIndex","push","splice","_onBlur","composed","composedPath","nodeName","toLowerCase","classList","contains","force","_onAutoComplete","detail","_checkvalue","toString","indexOf","isSelected","useContainer","checkbox","unshift","_selectAllChange","_getAutoCompleteItem","enableHover","onValueChange","onInputRefChange","calced","clientWidth","style","maxWidth","_checkSelectedItems","containerRect","getBoundingClientRect","querySelectorAll","amountHidden","child","remove","childRect","right","extra","querySelector","focus","isSelection","isSelectedInMenu","content","src","letters","cn","applyPagination","str","text","slice"],"sources":["src/components/molecules/select/select.component.css?tag=p-select","src/components/molecules/select/select.component.tsx"],"sourcesContent":[":host {\n\t--tw-translate-y: 0px !important;\n\t--tw-translate-x: 0px !important;\n}\n","import { Strategy } from '@floating-ui/dom';\nimport {\n\tAttachInternals,\n\tComponent,\n\tElement,\n\tEvent,\n\tEventEmitter,\n\th,\n\tListen,\n\tProp,\n\tState,\n\tWatch,\n} from '@stencil/core';\nimport { childOfComposed, cn } from '../../../utils';\nimport { IconVariant } from '../../atoms/icon/icon.component';\n\nimport { cva } from 'class-variance-authority';\nimport { ThemedHost } from '../../../internal/themed-host.component';\nimport { SELECT_DEFAULT_MAX_DISPLAYED_ITEMS } from '../../../utils/constants';\n\nconst multiContainer = cva([\n\t'flex items-center gap-2',\n\t'flex-1 min-w-0 h-full',\n\t'pointer-events-none overflow-hidden',\n]);\n\nconst multiItem = cva([\n\t'item group/item',\n\t'pointer-events-auto cursor-pointer',\n\t'flex h-[1.625rem] items-center gap-2',\n\t'h-[1.625rem] px-2',\n\t'text-sm font-semibold whitespace-nowrap',\n\t'rounded-lg',\n\t'bg-indigo-100',\n\t'dark:bg-white/15',\n]);\n\nconst textContainer = cva('block w-full overflow-hidden text-start', {\n\tvariants: {\n\t\tvariant: {\n\t\t\tplaceholder: 'text-storm-400 dark:text-white',\n\t\t\tdefault: null,\n\t\t},\n\t\tenableTextWrap: {\n\t\t\ttrue: false,\n\t\t\tfalse: 'text-ellipsis whitespace-nowrap',\n\t\t},\n\t\terror: {\n\t\t\ttrue: 'text-negative-red-700 dark:text-negative-red-alternative group-hover/button:text-negative-red-800',\n\t\t\tfalse: null,\n\t\t},\n\t},\n});\n\n@Component({\n\ttag: 'p-select',\n\tstyleUrl: 'select.component.css',\n\tformAssociated: true,\n})\nexport class Select {\n\t/**\n\t * The items to show in the dropdown\n\t */\n\t@Prop() items: string | any[];\n\n\t/**\n\t * Wether to enable multi select\n\t */\n\t@Prop({ reflect: true }) multi: boolean;\n\n\t/**\n\t * The strategy to use for the dropdown placement\n\t */\n\t@Prop() strategy: Strategy = 'absolute';\n\n\t/**\n\t * Icon of the select box\n\t */\n\t@Prop() icon: IconVariant;\n\n\t/**\n\t * The current query\n\t */\n\t@Prop() query: string;\n\n\t/**\n\t * The placeholder of the input\n\t */\n\t@Prop() placeholder: string;\n\n\t/**\n\t * The placeholder of the input used for auto complete\n\t */\n\t@Prop() autocompletePlaceholder: string = 'Search...';\n\n\t/**\n\t * The current value\n\t */\n\t@Prop() value: any;\n\n\t/**\n\t * The key of the object to display\n\t */\n\t@Prop() displayKey: string = 'text';\n\n\t/**\n\t * The key of the object to display in the dropdown (overwrites displayKey)\n\t */\n\t@Prop() dropdownDisplayKey: string | undefined;\n\n\t/**\n\t * The key of the object to display in the input (overwrites displayKey)\n\t */\n\t@Prop() selectionDisplayKey: string | undefined;\n\n\t/**\n\t * The key of the object to return\n\t */\n\t@Prop() valueKey: string;\n\n\t/**\n\t * The key of avatar within an item to show\n\t */\n\t@Prop() avatarKey: string;\n\n\t/**\n\t * The key of icon variant within an item to show\n\t */\n\t@Prop() iconKey: string = 'icon';\n\n\t/**\n\t * The key of the class we can apploy to the icon\n\t */\n\t@Prop() iconClassKey: string = 'iconClass';\n\n\t/**\n\t * Wether to apply the item's icon on the selected item display\n\t */\n\t@Prop() showIconOnSelectedItem: string;\n\n\t/**\n\t * The key of a class in an item to apply\n\t */\n\t@Prop() classKey: string = 'class';\n\n\t/**\n\t * Wether to apply the item's class also on the selected item\n\t */\n\t@Prop() applyClassOnSelectedItem: boolean;\n\n\t/**\n\t * Wether to apply the item's class also on the selected item within the menu\n\t */\n\t@Prop() applyClassOnSelectedItemInMenu: boolean;\n\n\t/**\n\t * The key of avatar letters within an item to show when the avatar url doesn't work\n\t */\n\t@Prop() avatarLettersKey: string;\n\n\t/**\n\t * The key to identify an object\n\t */\n\t@Prop() identifierKey: string;\n\n\t/**\n\t * The key of the object to display\n\t */\n\t@Prop() queryKey?: string;\n\n\t/**\n\t * Wether to automatically select the first item\n\t */\n\t@Prop() autoSelectFirst: boolean = true;\n\n\t/**\n\t * Wether to show the chevron or not\n\t */\n\t@Prop() showChevron: boolean = true;\n\n\t/**\n\t * The maximum amount of items to display\n\t */\n\t@Prop() maxDisplayedItems: number = SELECT_DEFAULT_MAX_DISPLAYED_ITEMS;\n\n\t/**\n\t * Wether to enable autocomplete\n\t */\n\t@Prop() enableAutocomplete: boolean = true;\n\n\t/**\n\t * Wether to enable wrapping the text to a new line in the dropdown menu\n\t */\n\t@Prop() enableTextWrap?: boolean = false;\n\n\t/**\n\t * Wether the input uses async filtering\n\t */\n\t@Prop() asyncFilter: boolean = false;\n\n\t/**\n\t * Wether to show loading items\n\t */\n\t@Prop() loading: boolean = false;\n\n\t/**\n\t * Wether to show the select all item with multi select\n\t */\n\t@Prop() enableSelectAll: boolean = false;\n\n\t/**\n\t * The text of the select all item\n\t */\n\t@Prop() selectAllText: string = 'Select all';\n\n\t/**\n\t * The icon to prefix for select all\n\t */\n\t@Prop() selectAllIcon: IconVariant | undefined;\n\n\t/**\n\t * Event when the query of the autocomplete changes\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tqueryChange: EventEmitter<string>;\n\n\t/**\n\t * Event when the value changes\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tvalueChange: EventEmitter<any>;\n\n\t/**\n\t * Event when the select all item has been selected or not\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tselectAllChange: EventEmitter<any>;\n\n\t/**\n\t * Event when the dropdown shows\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tdropdownShown: EventEmitter<any>;\n\n\t/**\n\t * The size of the input group used by the select\n\t */\n\t@Prop() size: 'sm' | 'base' = 'base';\n\n\t/**\n\t * The prefix of the input group used by the select\n\t */\n\t@Prop() prefix: string;\n\n\t/**\n\t * The label of the input group used by the select\n\t */\n\t@Prop() label: string;\n\n\t/**\n\t * The helper of the input group used by the select\n\t */\n\t@Prop() helper: string;\n\n\t/**\n\t * Wether the field is required\n\t */\n\t@Prop({ reflect: true }) required: boolean = true;\n\n\t/**\n\t * Wether to show optional when not required\n\t */\n\t@Prop({ reflect: true }) showOptional: boolean = true;\n\n\t/**\n\t * The helper of the input group used by the select\n\t */\n\t@Prop({ reflect: true }) error: string;\n\n\t/**\n\t * Wether the input group is disabled used by the select\n\t */\n\t@Prop({ reflect: true }) disabled: boolean = false;\n\n\t/**\n\t * Wether to show a \"add\" item\n\t */\n\t@Prop() showAddItem: boolean = false;\n\n\t/**\n\t * The text to show when add item is being shown\n\t */\n\t@Prop() addItemText: string = 'Add item';\n\n\t/**\n\t * Event when the add item is clicked\n\t */\n\t@Event({\n\t\tbubbles: false,\n\t})\n\tadd: EventEmitter;\n\n\t/**\n\t * The text to show when items is empty\n\t */\n\t@Prop() emptyStateText: string = 'No items available';\n\n\t/**\n\t * The host element\n\t */\n\t@Element() private _el: HTMLElement;\n\n\t@State() private _showDropdown: any = false;\n\t@State() private _selectedItem: any = null;\n\n\t@State() private _allSelected: boolean = false;\n\n\t@State() private _amountHidden = 0;\n\n\t@AttachInternals() _internals: ElementInternals;\n\n\tprivate _inputRef: HTMLDivElement;\n\tprivate autocompleteInputRef: HTMLInputElement | HTMLTextAreaElement;\n\tprivate _multiContainerRef: HTMLElement;\n\n\tprivate _resizeObserver: ResizeObserver;\n\tprivate _resizeDebounceTimer: NodeJS.Timeout | undefined;\n\tprivate _checkSelectedItemsTimeout: NodeJS.Timeout | undefined;\n\n\tget _items() {\n\t\treturn this._getParsedItems();\n\t}\n\n\tget _displayValue() {\n\t\tconst placeholder = (\n\t\t\t<div class={textContainer({ variant: 'placeholder' })}>\n\t\t\t\t{this.placeholder}\n\t\t\t</div>\n\t\t);\n\n\t\tif (!this._selectedItem) {\n\t\t\treturn placeholder;\n\t\t}\n\n\t\tif (this.multi) {\n\t\t\tif (this._selectedItem?.length === 0) {\n\t\t\t\treturn placeholder;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div\n\t\t\t\t\tclass={multiContainer()}\n\t\t\t\t\tref={ref => (this._multiContainerRef = ref)}\n\t\t\t\t>\n\t\t\t\t\t{this._selectedItem.map(item => (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclass={multiItem()}\n\t\t\t\t\t\t\tonClick={() => this._selectValue(item)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{item[this.selectionDisplayKey ?? this.displayKey]}\n\t\t\t\t\t\t\t<p-icon\n\t\t\t\t\t\t\t\tclass='text-xs text-indigo-500 group-hover/item:text-indigo-800 dark:text-white/15 dark:group-hover/item:text-white'\n\t\t\t\t\t\t\t\tvariant='negative'\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t))}\n\n\t\t\t\t\t<div class='extra pointer-events-none hidden text-sm text-storm-100'>\n\t\t\t\t\t\t+{this._amountHidden}\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t);\n\t\t}\n\n\t\treturn this._getDisplay(this._selectedItem, true);\n\t}\n\n\tget _identifierKey() {\n\t\treturn this.identifierKey ?? this.valueKey ?? 'value';\n\t}\n\n\tformResetCallback() {\n\t\tthis._selectValue(null);\n\t}\n\n\t// formDisabledCallback(disabled: boolean) {\n\t// \tif (!this._internals.form) {\n\t// \t\treturn;\n\t// \t}\n\t//\n\t// \t//this.disabled = disabled;\n\t// }\n\t//\n\tcomponentDidLoad() {\n\t\tif (!this.valueKey && !this.identifierKey) {\n\t\t\tthrow new Error('You must provide a valueKey or identifierKey');\n\t\t}\n\n\t\tif (this.multi) {\n\t\t\tthis._setMultiContainerMaxWidth();\n\n\t\t\tthis._resizeObserver = new ResizeObserver(() => {\n\t\t\t\tif (this._resizeDebounceTimer) {\n\t\t\t\t\tclearTimeout(this._resizeDebounceTimer);\n\t\t\t\t\tthis._resizeDebounceTimer = null;\n\t\t\t\t}\n\n\t\t\t\tthis._resizeDebounceTimer = setTimeout(() => {\n\t\t\t\t\tthis._setMultiContainerMaxWidth();\n\t\t\t\t\tthis._setCheckSelectedItemsTimeout();\n\t\t\t\t}, 200);\n\t\t\t});\n\t\t\tthis._resizeObserver.observe(this._el);\n\t\t}\n\n\t\tif (this.value) {\n\t\t\tconsole.log('On load', this.value);\n\t\t\tthis._valueChange(this.value, null);\n\t\t\treturn;\n\t\t}\n\n\t\tthis.itemChanges();\n\t}\n\n\tcomponentDidRender() {\n\t\tif (this.multi) {\n\t\t\tthis._setMultiContainerMaxWidth();\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\tif (this.multi) {\n\t\t\tthis._resizeObserver.disconnect();\n\t\t}\n\t}\n\n\trender() {\n\t\tlet buttonIcon = this.icon;\n\n\t\tif (\n\t\t\tthis._selectedItem &&\n\t\t\t!this.avatarKey &&\n\t\t\t!!this.iconKey &&\n\t\t\tthis._selectedItem?.[this.iconKey] &&\n\t\t\t!this.showIconOnSelectedItem\n\t\t) {\n\t\t\tbuttonIcon = this._selectedItem[this.iconKey];\n\t\t}\n\n\t\tif (\n\t\t\t(this.avatarKey && this._selectedItem?.[this.avatarKey]) ||\n\t\t\t(this.avatarLettersKey && this._selectedItem?.[this.avatarLettersKey])\n\t\t) {\n\t\t\tbuttonIcon = null;\n\t\t}\n\n\t\tif (this.error?.length) {\n\t\t\tbuttonIcon = 'warning';\n\t\t}\n\n\t\treturn (\n\t\t\t<ThemedHost>\n\t\t\t\t<p-field-container\n\t\t\t\t\tvariant='write'\n\t\t\t\t\tprefix={this.prefix}\n\t\t\t\t\tlabel={this.label}\n\t\t\t\t\thelper={this.helper}\n\t\t\t\t\trequired={this.required}\n\t\t\t\t\tshowOptional={this.showOptional}\n\t\t\t\t\terror={this.error}\n\t\t\t\t\tforceShowTooltip={!!this.error?.length && !this._showDropdown}\n\t\t\t\t>\n\t\t\t\t\t<p-dropdown\n\t\t\t\t\t\tapplyFullWidth={true}\n\t\t\t\t\t\tapplyMaxWidth={false}\n\t\t\t\t\t\tslot='content'\n\t\t\t\t\t\tinsideClick={true}\n\t\t\t\t\t\tmanual={true}\n\t\t\t\t\t\tscrollable={this.enableAutocomplete ? 'large' : true}\n\t\t\t\t\t\tdisable-trigger-click={this.disabled}\n\t\t\t\t\t\tshow={this._showDropdown}\n\t\t\t\t\t\tonIsOpen={ev => this._onDropdownOpen(ev)}\n\t\t\t\t\t\tstrategy={this.strategy}\n\t\t\t\t\t>\n\t\t\t\t\t\t<p-button\n\t\t\t\t\t\t\tslot='trigger'\n\t\t\t\t\t\t\tclass='w-full'\n\t\t\t\t\t\t\tvariant='secondary'\n\t\t\t\t\t\t\tsize={this.size}\n\t\t\t\t\t\t\tchevron={\n\t\t\t\t\t\t\t\tthis.showChevron ? (this._showDropdown ? 'up' : 'down') : false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tactive={this._showDropdown}\n\t\t\t\t\t\t\terror={!!this.error?.length}\n\t\t\t\t\t\t\ticon={buttonIcon}\n\t\t\t\t\t\t\ticonClass={\n\t\t\t\t\t\t\t\tthis.applyClassOnSelectedItem &&\n\t\t\t\t\t\t\t\tthis._selectedItem?.[this.iconClassKey]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tonClick={ev => this._onClick(ev)}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\tclass='relative min-w-0 flex-1'\n\t\t\t\t\t\t\t\tref={ref => (this._inputRef = ref)}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{this._displayValue}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</p-button>\n\t\t\t\t\t\t{this.loading ? this._getLoadingItems() : this._getItems()}\n\t\t\t\t\t\t{this.showAddItem && this._getAddItem()}\n\t\t\t\t\t</p-dropdown>\n\t\t\t\t</p-field-container>\n\t\t\t</ThemedHost>\n\t\t);\n\t}\n\n\t@Listen('click', { target: 'document', capture: true })\n\tprotected documentClickHandler(event) {\n\t\tif (!this._showDropdown || childOfComposed(event, this._el)) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = false;\n\t}\n\n\t@Watch('value')\n\tprivate _valueChange(value, oldVal) {\n\t\tconsole.log('value change', value, oldVal);\n\t\tsetTimeout(() => {\n\t\t\tthis._preselectItem();\n\t\t\tthis._setCheckSelectedItemsTimeout();\n\t\t});\n\t}\n\n\t@Watch('items')\n\tpublic itemChanges() {\n\t\tsetTimeout(() => this._preselectItem());\n\t}\n\n\t@Watch('_showDropdown')\n\tpublic _showDropdownChanges() {\n\t\tthis.dropdownShown.emit({\n\t\t\tvalue: this._showDropdown,\n\t\t\tquery: this.query,\n\t\t});\n\t}\n\n\t@Watch('multi')\n\tpublic multiChanges() {\n\t\tif (this._selectedItem && !Array.isArray(this._selectedItem)) {\n\t\t\tthis._selectedItem = [];\n\t\t}\n\t}\n\n\tprivate _preselectItem() {\n\t\tconsole.log('Preselect start', this.value);\n\t\tlet value =\n\t\t\ttypeof this.value === 'string' && this.multi\n\t\t\t\t? JSON.parse(this.value)\n\t\t\t\t: this.value;\n\n\t\tconsole.log('Post', value);\n\n\t\tif (this.multi) {\n\t\t\tif (!Array.isArray(value)) {\n\t\t\t\tthis.value = [];\n\t\t\t\tthis.valueChange.emit(this.value);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis.value = value;\n\t\t\tif (!value.length) {\n\t\t\t\tthis._selectedItem = [];\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._selectedItem =\n\t\t\t\t!!this.valueKey && this.valueKey !== 'false'\n\t\t\t\t\t? this._items.filter(i => value.includes(i?.[this.valueKey]))\n\t\t\t\t\t: [...value];\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._selectedItem && !value && this.autoSelectFirst) {\n\t\t\tvalue = this._items[0];\n\t\t}\n\n\t\tconsole.log('post !this._selectedItem check', value);\n\n\t\tconst identifier =\n\t\t\ttypeof value === 'object' && value !== null\n\t\t\t\t? value[this._identifierKey]\n\t\t\t\t: value;\n\t\tconst parsedValue =\n\t\t\ttypeof identifier === 'string' || typeof identifier === 'number'\n\t\t\t\t? identifier\n\t\t\t\t: JSON.stringify(identifier);\n\n\t\tconst currentValue = this._selectedItem\n\t\t\t? this._selectedItem?.[this._identifierKey]\n\t\t\t: null;\n\t\tconst currentParsedValue =\n\t\t\ttypeof currentValue === 'string' || typeof currentValue === 'number'\n\t\t\t\t? currentValue\n\t\t\t\t: JSON.stringify(currentValue);\n\n\t\tconsole.log('parsedValue', parsedValue);\n\t\tconsole.log('currentParsedValue', currentParsedValue);\n\t\tif (this._selectedItem && currentParsedValue === parsedValue) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!this._items?.length && value) {\n\t\t\tconsole.log('No length', value);\n\t\t\tthis._selectValue(value, false);\n\t\t\treturn;\n\t\t}\n\n\t\tconst items = this._getParsedItems(false);\n\t\tconst item = items.find(i => {\n\t\t\tconst itemIdentifier = i?.[this._identifierKey];\n\t\t\tconst parsedItemIdentifier =\n\t\t\t\ttypeof itemIdentifier === 'string' || typeof itemIdentifier === 'number'\n\t\t\t\t\t? itemIdentifier\n\t\t\t\t\t: JSON.stringify(itemIdentifier);\n\n\t\t\treturn parsedItemIdentifier === parsedValue;\n\t\t});\n\n\t\tconsole.log('Found item', item, value);\n\t\tthis._selectValue(!!item ? item : value, false);\n\t}\n\n\tprivate _selectValue(item, forceBlur = true) {\n\t\tconsole.log('Start', item, this.valueKey, this.loading);\n\t\tlet value =\n\t\t\t!!this.valueKey &&\n\t\t\tthis.valueKey !== 'false' &&\n\t\t\titem !== null &&\n\t\t\t!this.loading\n\t\t\t\t? item?.[this.valueKey]\n\t\t\t\t: item;\n\t\tconsole.log('Start', item);\n\n\t\tif (this.multi) {\n\t\t\tif (!this._selectedItem || !Array.isArray(this._selectedItem)) {\n\t\t\t\tthis._selectedItem = [];\n\t\t\t}\n\n\t\t\tif (!this.value || !Array.isArray(this.value)) {\n\t\t\t\tthis.value = [];\n\t\t\t}\n\n\t\t\tconst selectedItem = [...this._selectedItem];\n\t\t\tconst valueArray = [...this.value];\n\n\t\t\tconst includesIndex = selectedItem.findIndex(\n\t\t\t\ti => i[this._identifierKey] === item[this._identifierKey]\n\t\t\t);\n\t\t\tif (includesIndex === -1) {\n\t\t\t\tselectedItem.push(item);\n\t\t\t\tvalueArray.push(value);\n\t\t\t} else {\n\t\t\t\tselectedItem.splice(includesIndex, 1);\n\t\t\t\tvalueArray.splice(includesIndex, 1);\n\t\t\t}\n\n\t\t\tthis._selectedItem = selectedItem;\n\t\t\tthis.value = valueArray;\n\t\t\tthis.valueChange.emit(valueArray);\n\t\t\treturn;\n\t\t}\n\n\t\tthis._selectedItem = item;\n\t\tthis._onBlur(forceBlur);\n\n\t\tif (value === this.value) {\n\t\t\treturn;\n\t\t}\n\n\t\tconsole.log('Setting value', value);\n\t\tthis.value = value;\n\t\tthis.valueChange.emit(value);\n\t}\n\n\tprivate _onClick(event) {\n\t\tconst composed = event?.composedPath();\n\n\t\tfor (const item of composed) {\n\t\t\tif (item.nodeName.toLowerCase() === 'p-button') {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (item.classList?.contains('item')) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\tthis._showDropdown = !this._showDropdown;\n\t}\n\n\tprivate _onBlur(force = false) {\n\t\tif (this.enableAutocomplete && !force) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = false;\n\t}\n\n\tprivate _onAutoComplete(ev) {\n\t\tif (!this.enableAutocomplete) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._showDropdown = true;\n\n\t\tthis.query = ev.detail;\n\t\tthis.queryChange.emit(ev.detail);\n\t}\n\n\tprivate _checkvalue(key, item) {\n\t\treturn (\n\t\t\titem?.[key]\n\t\t\t\t?.toString()\n\t\t\t\t?.toLowerCase()\n\t\t\t\t.indexOf(this.query?.toLowerCase()) >= 0\n\t\t);\n\t}\n\n\tprivate _getItems() {\n\t\tlet items = this._items.map(item => {\n\t\t\tconst isSelected =\n\t\t\t\tthis.multi && !!this._selectedItem && Array.isArray(this._selectedItem)\n\t\t\t\t\t? this._selectedItem.findIndex(\n\t\t\t\t\t\t\ti => i[this._identifierKey] === item[this._identifierKey]\n\t\t\t\t\t ) >= 0\n\t\t\t\t\t: item[this._identifierKey] ===\n\t\t\t\t\t this._selectedItem?.[this._identifierKey];\n\t\t\treturn (\n\t\t\t\t<p-dropdown-menu-item\n\t\t\t\t\tenableTextWrap={this.enableTextWrap}\n\t\t\t\t\tuseContainer={false}\n\t\t\t\t\tonClick={() => this._selectValue(item)}\n\t\t\t\t\tactive={isSelected}\n\t\t\t\t\tcheckbox={this.multi ? true : false}\n\t\t\t\t\tslot='items'\n\t\t\t\t>\n\t\t\t\t\t{this._getDisplay(item, false, isSelected)}\n\t\t\t\t</p-dropdown-menu-item>\n\t\t\t);\n\t\t});\n\n\t\tif (!this._items.length) {\n\t\t\titems = [\n\t\t\t\t<p\n\t\t\t\t\tclass='w-full p-2 text-center text-sm text-storm-400 dark:text-hurricane-200'\n\t\t\t\t\tslot='items'\n\t\t\t\t>\n\t\t\t\t\t{this.emptyStateText}\n\t\t\t\t</p>,\n\t\t\t];\n\t\t}\n\n\t\tif (this.enableSelectAll && this._items.length) {\n\t\t\titems.unshift(\n\t\t\t\t<p-dropdown-menu-item\n\t\t\t\t\tslot='items'\n\t\t\t\t\tuseContainer={false}\n\t\t\t\t\tcheckbox\n\t\t\t\t\tonClick={() => this._selectAllChange()}\n\t\t\t\t\tactive={this._allSelected}\n\t\t\t\t>\n\t\t\t\t\t{this.selectAllIcon?.length ? (\n\t\t\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t\t\t<div class='flex w-6 justify-center text-lg'>\n\t\t\t\t\t\t\t\t<p-icon variant={this.selectAllIcon} />\n\t\t\t\t\t\t\t</div>{' '}\n\t\t\t\t\t\t\t{this.selectAllText}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) : (\n\t\t\t\t\t\tthis.selectAllText\n\t\t\t\t\t)}\n\t\t\t\t</p-dropdown-menu-item>\n\t\t\t);\n\t\t}\n\n\t\tif (this.enableAutocomplete) {\n\t\t\titems.unshift(this._getAutoCompleteItem());\n\t\t}\n\n\t\treturn items;\n\t}\n\n\tprivate _getAddItem() {\n\t\treturn (\n\t\t\t<p-dropdown-menu-item\n\t\t\t\tonClick={() => this.add.emit()}\n\t\t\t\tuseContainer={false}\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<span class='flex items-center gap-1 font-semibold text-indigo-600'>\n\t\t\t\t\t{this.addItemText}\n\t\t\t\t\t<p-icon variant='plus' />\n\t\t\t\t</span>\n\t\t\t</p-dropdown-menu-item>\n\t\t);\n\t}\n\n\tprivate _getLoadingItems() {\n\t\tconst items = [0, 0, 0].map(() => (\n\t\t\t<p-dropdown-menu-item\n\t\t\t\tenableHover={false}\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<p-loader\n\t\t\t\t\tvariant='ghost'\n\t\t\t\t\tclass='h-6 w-full rounded'\n\t\t\t\t/>\n\t\t\t</p-dropdown-menu-item>\n\t\t));\n\n\t\tif (this.enableAutocomplete) {\n\t\t\titems.unshift(this._getAutoCompleteItem());\n\t\t}\n\n\t\treturn items;\n\t}\n\n\tprivate _getAutoCompleteItem() {\n\t\treturn (\n\t\t\t<div\n\t\t\t\tclass='sticky top-0 z-10 mb-3 h-8'\n\t\t\t\tslot='items'\n\t\t\t>\n\t\t\t\t<p-field\n\t\t\t\t\tclass='block'\n\t\t\t\t\tplaceholder={this.autocompletePlaceholder}\n\t\t\t\t\tonValueChange={ev => this._onAutoComplete(ev)}\n\t\t\t\t\tonInputRefChange={ev => (this.autocompleteInputRef = ev.detail)}\n\t\t\t\t\tvalue={this.query}\n\t\t\t\t/>\n\t\t\t</div>\n\t\t);\n\t}\n\n\tprivate _setMultiContainerMaxWidth() {\n\t\tif (!this._inputRef || !this._multiContainerRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst calced = this._inputRef.clientWidth - 16;\n\t\tthis._multiContainerRef.style.maxWidth = `${calced >= 16 ? calced : 16}px`;\n\t}\n\n\tprivate _setCheckSelectedItemsTimeout() {\n\t\tif (this._checkSelectedItemsTimeout) {\n\t\t\tclearTimeout(this._checkSelectedItemsTimeout);\n\t\t}\n\n\t\tthis._checkSelectedItemsTimeout = setTimeout(\n\t\t\t() => this._checkSelectedItems(),\n\t\t\t50\n\t\t);\n\t}\n\n\tprivate _checkSelectedItems() {\n\t\tif (!this._multiContainerRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst containerRect = this._multiContainerRef.getBoundingClientRect();\n\t\tconst items = this._multiContainerRef.querySelectorAll('.item');\n\n\t\tlet amountHidden = 0;\n\n\t\tfor (const child of items) {\n\t\t\tchild.classList.remove('hidden');\n\t\t\tchild.classList.add('flex');\n\n\t\t\tconst childRect = child.getBoundingClientRect();\n\t\t\tif (childRect.right > containerRect.right) {\n\t\t\t\tchild.classList.remove('flex');\n\t\t\t\tchild.classList.add('hidden');\n\t\t\t\tamountHidden++;\n\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tthis._amountHidden = amountHidden;\n\t\tconst extra = this._multiContainerRef.querySelector('.extra');\n\t\tif (!extra) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (!extra.classList.contains('hidden')) {\n\t\t\textra.classList.add('hidden');\n\t\t}\n\n\t\tif (amountHidden > 0) {\n\t\t\textra.classList.remove('hidden');\n\t\t}\n\t}\n\n\tprivate _onDropdownOpen(ev) {\n\t\tif (!ev.detail || !this.autocompleteInputRef) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetTimeout(() => this.autocompleteInputRef.focus(), 100);\n\t}\n\n\tprivate _selectAllChange() {\n\t\tthis._allSelected = !this._allSelected;\n\t\tthis.selectAllChange.emit(this._allSelected);\n\t}\n\n\tprivate _getDisplay(item, isSelection = false, isSelectedInMenu = false) {\n\t\tlet content = (\n\t\t\t<div\n\t\t\t\tclass={textContainer({\n\t\t\t\t\tvariant: 'default',\n\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t})}\n\t\t\t>\n\t\t\t\t{\n\t\t\t\t\titem[\n\t\t\t\t\t\tisSelection\n\t\t\t\t\t\t\t? this.selectionDisplayKey ?? this.displayKey\n\t\t\t\t\t\t\t: this.displayKey\n\t\t\t\t\t]\n\t\t\t\t}\n\t\t\t</div>\n\t\t);\n\n\t\tif (this.avatarKey) {\n\t\t\tcontent = (\n\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t<p-avatar\n\t\t\t\t\t\tsize='sm'\n\t\t\t\t\t\tsrc={item[this.avatarKey]}\n\t\t\t\t\t\tletters={item[this.avatarLettersKey]}\n\t\t\t\t\t></p-avatar>\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={textContainer({\n\t\t\t\t\t\t\tvariant: 'default',\n\t\t\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item[this.dropdownDisplayKey ?? this.displayKey]}\n\t\t\t\t\t</div>\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\n\t\tif (this.iconKey && (!isSelection || this.showIconOnSelectedItem)) {\n\t\t\tcontent = (\n\t\t\t\t<span class='flex items-center gap-2'>\n\t\t\t\t\t{item[this.iconKey] && (\n\t\t\t\t\t\t<p-icon\n\t\t\t\t\t\t\tclass={cn(\n\t\t\t\t\t\t\t\t'text-storm-300 dark:text-hurricane-200',\n\t\t\t\t\t\t\t\t(!isSelection || !!this.applyClassOnSelectedItem) &&\n\t\t\t\t\t\t\t\t\t(!isSelectedInMenu || !!this.applyClassOnSelectedItemInMenu)\n\t\t\t\t\t\t\t\t\t? item?.[this.iconClassKey] ?? ''\n\t\t\t\t\t\t\t\t\t: ''\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\tvariant={item[this.iconKey] as IconVariant}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t<div\n\t\t\t\t\t\tclass={textContainer({\n\t\t\t\t\t\t\tvariant: 'default',\n\t\t\t\t\t\t\terror: !!this.error?.length,\n\t\t\t\t\t\t\tenableTextWrap: this.enableTextWrap && !isSelection,\n\t\t\t\t\t\t})}\n\t\t\t\t\t>\n\t\t\t\t\t\t{item[this.dropdownDisplayKey ?? this.displayKey]}\n\t\t\t\t\t</div>\n\t\t\t\t</span>\n\t\t\t);\n\t\t}\n\n\t\tif (\n\t\t\t(!isSelection || !!this.applyClassOnSelectedItem) &&\n\t\t\t(!isSelectedInMenu || !!this.applyClassOnSelectedItemInMenu) &&\n\t\t\t!!item?.[this.classKey]?.length\n\t\t) {\n\t\t\treturn <div class={item[this.classKey]}>{content}</div>;\n\t\t}\n\n\t\treturn content;\n\t}\n\n\tprivate _getParsedItems(applyPagination = true) {\n\t\tif (!this.items || this.loading) {\n\t\t\treturn [];\n\t\t}\n\n\t\tlet items =\n\t\t\ttypeof this.items === 'string' ? JSON.parse(this.items) : this.items;\n\n\t\tif (typeof items?.[0] === 'string') {\n\t\t\tthis.displayKey = 'text';\n\t\t\tthis.valueKey = 'value';\n\n\t\t\titems = items.map(str => ({\n\t\t\t\tvalue: str,\n\t\t\t\ttext: str,\n\t\t\t}));\n\t\t}\n\n\t\tif (this.query?.length && !this.asyncFilter) {\n\t\t\titems = items.filter(item => {\n\t\t\t\tif (this.queryKey) {\n\t\t\t\t\treturn this._checkvalue(this.queryKey, item);\n\t\t\t\t}\n\n\t\t\t\treturn (\n\t\t\t\t\tthis._checkvalue(this._identifierKey, item) ||\n\t\t\t\t\tthis._checkvalue(this.displayKey, item)\n\t\t\t\t);\n\t\t\t});\n\t\t}\n\n\t\tif (!applyPagination) {\n\t\t\treturn items;\n\t\t}\n\n\t\treturn items?.slice(0, this.maxDisplayedItems);\n\t}\n}\n"],"mappings":"6RAAA,MAAMA,EAAqB,mlJCoB3B,MAAMC,EAAiBC,EAAI,CAC1B,0BACA,wBACA,wCAGD,MAAMC,EAAYD,EAAI,CACrB,kBACA,qCACA,uCACA,oBACA,0CACA,aACA,gBACA,qBAGD,MAAME,EAAgBF,EAAI,0CAA2C,CACpEG,SAAU,CACTC,QAAS,CACRC,YAAa,iCACbC,QAAS,MAEVC,eAAgB,CACfC,KAAM,MACNC,MAAO,mCAERC,MAAO,CACNF,KAAM,oGACNC,MAAO,S,MAUGE,EAAM,M,sYAIVC,MAKiBC,MAKjBC,SAAqB,WAKrBC,KAKAC,MAKAX,YAKAY,wBAAkC,YAKlCC,MAKAC,WAAqB,OAKrBC,mBAKAC,oBAKAC,SAKAC,UAKAC,QAAkB,OAKlBC,aAAuB,YAKvBC,uBAKAC,SAAmB,QAKnBC,yBAKAC,+BAKA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