blip-ds 1.243.0 → 1.243.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blip-ds/bds-input-chips.entry.js +8 -1
- package/dist/blip-ds/bds-input-chips.system.entry.js +1 -1
- package/dist/blip-ds/bds-list.entry.js +1 -1
- package/dist/blip-ds/bds-list.system.entry.js +1 -1
- package/dist/blip-ds/bds-select-chips.entry.js +8 -1
- package/dist/blip-ds/bds-select-chips.system.entry.js +1 -1
- package/dist/blip-ds/p-3f37ab7a.entry.js +1 -0
- package/dist/blip-ds/{p-476accc7.system.entry.js → p-49ed3a93.system.entry.js} +1 -1
- package/dist/blip-ds/{p-d0a41b5a.system.entry.js → p-4de2072b.system.entry.js} +1 -1
- package/dist/blip-ds/p-9493d791.system.js +1 -1
- package/dist/blip-ds/{p-1a4f5ff9.entry.js → p-acdc4b94.entry.js} +1 -1
- package/dist/blip-ds/p-bb988d88.entry.js +1 -0
- package/dist/blip-ds/{p-d2b34f46.system.entry.js → p-c41c829b.system.entry.js} +1 -1
- package/dist/cjs/bds-input-chips.cjs.entry.js +8 -1
- package/dist/cjs/bds-list.cjs.entry.js +1 -1
- package/dist/cjs/bds-select-chips.cjs.entry.js +8 -1
- package/dist/collection/components/input-chips/input-chips.js +8 -1
- package/dist/collection/components/list/list.js +2 -2
- package/dist/collection/components/selects/select-chips/select-chips.js +8 -1
- package/dist/esm/bds-input-chips.entry.js +8 -1
- package/dist/esm/bds-list.entry.js +1 -1
- package/dist/esm/bds-select-chips.entry.js +8 -1
- package/dist/esm-es5/bds-input-chips.entry.js +1 -1
- package/dist/esm-es5/bds-list.entry.js +1 -1
- package/dist/esm-es5/bds-select-chips.entry.js +1 -1
- package/dist/types/components/list/list-interface.d.ts +1 -0
- package/dist/types/components/list/list.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/dist/blip-ds/p-6ffad198.entry.js +0 -1
- package/dist/blip-ds/p-d71d30cf.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as e,H as s,g as l}from"./p-bfbc9769.js";const a=class{constructor(e){t(this,e),this.bdsListCheckboxChange=i(this,"bdsListCheckboxChange",7),this.bdsListRadioChange=i(this,"bdsListRadioChange",7),this.bdsListSwitchChange=i(this,"bdsListSwitchChange",7),this.bdsClickActionsButtons=i(this,"bdsClickActionsButtons",7),this.itemListElement=null,this.chagedOptions=t=>{const{detail:i}=t;"radio"==i.typeList&&1==i.checked&&(this.value=i),"checkbox"==i.typeList&&this.setSelectedCheckbox(),"switch"==i.typeList&&this.setSelectedSwitch()},this.onClickActionsButtons=t=>{const{detail:i}=t;this.bdsClickActionsButtons.emit(i)},this.internalData=void 0,this.typeList=null,this.value=void 0,this.data=void 0}componentWillLoad(){this.data&&this.dataChanged()}componentWillRender(){this.data&&this.updateData(),this.data||this.setitemListElement()}componentDidRender(){this.data&&this.internalDataChanged()}dataChanged(){this.updateData()}valueChanged(t){this.setSelectedRadio(t)}internalDataChanged(){this.itemListElement=this.element.shadowRoot.querySelectorAll("bds-list-item")}setitemListElement(){this.itemListElement=this.element.getElementsByTagName("bds-list-item");for(let t=0;t<this.itemListElement.length;t++)this.itemListElement[t].typeList=this.typeList,this.itemListElement[t].addEventListener("bdsChecked",(t=>this.chagedOptions(t)))}updateData(){this.data&&(this.internalData="string"==typeof this.data?JSON.parse(this.data):this.data)}setSelectedRadio(t){var i,e,s,l,a;const o=Array.from(this.itemListElement).filter((t=>"radio"==t.typeList));for(let n=0;n<o.length;n++)if(o[n].value!=t.value)o[n].checked=!1;else{const t={value:o[n].value,text:null===(i=o[n])||void 0===i?void 0:i.text,secondaryText:null===(e=o[n])||void 0===e?void 0:e.secondaryText,avatarName:null===(s=o[n])||void 0===s?void 0:s.avatarName,avatarThumbnail:null===(l=o[n])||void 0===l?void 0:l.avatarThumbnail,typeList:null===(a=o[n])||void 0===a?void 0:a.typeList};this.bdsListRadioChange.emit(t)}}setSelectedCheckbox(){const t=Array.from(this.itemListElement).filter((t=>"checkbox"==t.typeList)).filter((t=>t.checked)).map((t=>({value:t.value,text:null==t?void 0:t.text,secondaryText:null==t?void 0:t.secondaryText,avatarName:null==t?void 0:t.avatarName,avatarThumbnail:null==t?void 0:t.avatarThumbnail,typeList:null==t?void 0:t.typeList})));this.bdsListCheckboxChange.emit(t)}setSelectedSwitch(){const t=Array.from(this.itemListElement).filter((t=>"switch"==t.typeList)).filter((t=>t.checked)).map((t=>({value:t.value,text:null==t?void 0:t.text,secondaryText:null==t?void 0:t.secondaryText,avatarName:null==t?void 0:t.avatarName,avatarThumbnail:null==t?void 0:t.avatarThumbnail,typeList:null==t?void 0:t.typeList})));this.bdsListSwitchChange.emit(t)}render(){return e(s,null,e("div",{class:{list:!0}},this.internalData?this.internalData.map(((t,i)=>e("bds-list-item",{key:i,value:t.value,text:t.text,"type-list":this.typeList?this.typeList:t.typeList,"secondary-text":t.secondaryText,"avatar-name":t.avatarName,"avatar-thumbnail":t.avatarThumbnail,icon:t.icon,chips:t.chips,actionsButtons:t.actionsButtons,onBdsChecked:t=>this.chagedOptions(t),onBdsClickActionButtom:t=>this.onClickActionsButtons(t)}))):e("slot",null)))}get element(){return l(this)}static get watchers(){return{data:["dataChanged"],value:["valueChanged"],internalData:["internalDataChanged"]}}};a.style=":host{display:block;width:100%}.list_item{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;padding:10px 16px}.list_item .avatar-item{display:block}.list_item .icon-item{color:#505f79}.list_item .grow-up{-ms-flex-positive:2;flex-grow:2}.list_item .content-item{display:-ms-flexbox;display:flex;gap:2px;-ms-flex-direction:column;flex-direction:column}.list_item .content-item .title-item{color:#0a0f1a}.list_item .content-item .subtitle-item{color:#6e7b91}.list_item .content-area{-ms-flex-positive:2;flex-grow:2}.list_item .content-area .internal-chips,.list_item .content-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px}.list_item .action-area .internal-actions-buttons,.list_item .action-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;color:#505f79}.clickable{cursor:pointer}.clickable:hover{background-color:#f3f6fa;mix-blend-mode:multiply}";export{a as bds_list}
|
|
1
|
+
import{r as t,c as i,h as e,H as s,g as l}from"./p-bfbc9769.js";const a=class{constructor(e){t(this,e),this.bdsListCheckboxChange=i(this,"bdsListCheckboxChange",7),this.bdsListRadioChange=i(this,"bdsListRadioChange",7),this.bdsListSwitchChange=i(this,"bdsListSwitchChange",7),this.bdsClickActionsButtons=i(this,"bdsClickActionsButtons",7),this.itemListElement=null,this.chagedOptions=t=>{const{detail:i}=t;"radio"==i.typeList&&1==i.checked&&(this.value=i),"checkbox"==i.typeList&&this.setSelectedCheckbox(),"switch"==i.typeList&&this.setSelectedSwitch()},this.onClickActionsButtons=t=>{const{detail:i}=t;this.bdsClickActionsButtons.emit(i)},this.internalData=void 0,this.typeList=null,this.value=void 0,this.data=void 0}componentWillLoad(){this.data&&this.dataChanged()}componentWillRender(){this.data&&this.updateData(),this.data||this.setitemListElement()}componentDidRender(){this.data&&this.internalDataChanged()}dataChanged(){this.updateData()}valueChanged(t){this.setSelectedRadio(t)}internalDataChanged(){this.itemListElement=this.element.shadowRoot.querySelectorAll("bds-list-item")}setitemListElement(){this.itemListElement=this.element.getElementsByTagName("bds-list-item");for(let t=0;t<this.itemListElement.length;t++)this.itemListElement[t].typeList=this.typeList,this.itemListElement[t].addEventListener("bdsChecked",(t=>this.chagedOptions(t)))}updateData(){this.data&&(this.internalData="string"==typeof this.data?JSON.parse(this.data):this.data)}setSelectedRadio(t){var i,e,s,l,a;const o=Array.from(this.itemListElement).filter((t=>"radio"==t.typeList));for(let n=0;n<o.length;n++)if(o[n].value!=t.value)o[n].checked=!1;else{const t={value:o[n].value,text:null===(i=o[n])||void 0===i?void 0:i.text,secondaryText:null===(e=o[n])||void 0===e?void 0:e.secondaryText,avatarName:null===(s=o[n])||void 0===s?void 0:s.avatarName,avatarThumbnail:null===(l=o[n])||void 0===l?void 0:l.avatarThumbnail,typeList:null===(a=o[n])||void 0===a?void 0:a.typeList};this.bdsListRadioChange.emit(t)}}setSelectedCheckbox(){const t=Array.from(this.itemListElement).filter((t=>"checkbox"==t.typeList)).filter((t=>t.checked)).map((t=>({value:t.value,text:null==t?void 0:t.text,secondaryText:null==t?void 0:t.secondaryText,avatarName:null==t?void 0:t.avatarName,avatarThumbnail:null==t?void 0:t.avatarThumbnail,typeList:null==t?void 0:t.typeList})));this.bdsListCheckboxChange.emit(t)}setSelectedSwitch(){const t=Array.from(this.itemListElement).filter((t=>"switch"==t.typeList)).filter((t=>t.checked)).map((t=>({value:t.value,text:null==t?void 0:t.text,secondaryText:null==t?void 0:t.secondaryText,avatarName:null==t?void 0:t.avatarName,avatarThumbnail:null==t?void 0:t.avatarThumbnail,typeList:null==t?void 0:t.typeList})));this.bdsListSwitchChange.emit(t)}render(){return e(s,null,e("div",{class:{list:!0}},this.internalData?this.internalData.map(((t,i)=>e("bds-list-item",{key:i,value:t.value,text:t.text,"type-list":this.typeList?this.typeList:t.typeList,"secondary-text":t.secondaryText,"avatar-name":t.avatarName,"avatar-thumbnail":t.avatarThumbnail,checked:t.checked,icon:t.icon,chips:t.chips,actionsButtons:t.actionsButtons,onBdsChecked:t=>this.chagedOptions(t),onBdsClickActionButtom:t=>this.onClickActionsButtons(t)}))):e("slot",null)))}get element(){return l(this)}static get watchers(){return{data:["dataChanged"],value:["valueChanged"],internalData:["internalDataChanged"]}}};a.style=":host{display:block;width:100%}.list_item{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;padding:10px 16px}.list_item .avatar-item{display:block}.list_item .icon-item{color:#505f79}.list_item .grow-up{-ms-flex-positive:2;flex-grow:2}.list_item .content-item{display:-ms-flexbox;display:flex;gap:2px;-ms-flex-direction:column;flex-direction:column}.list_item .content-item .title-item{color:#0a0f1a}.list_item .content-item .subtitle-item{color:#6e7b91}.list_item .content-area{-ms-flex-positive:2;flex-grow:2}.list_item .content-area .internal-chips,.list_item .content-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px}.list_item .action-area .internal-actions-buttons,.list_item .action-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;color:#505f79}.clickable{cursor:pointer}.clickable:hover{background-color:#f3f6fa;mix-blend-mode:multiply}";export{a as bds_list}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as i,h as t,g as e}from"./p-bfbc9769.js";import{w as c,e as n}from"./p-7d00c003.js";const o=class{constructor(t){s(this,t),this.bdsChange=i(this,"bdsChange",7),this.bdsCancel=i(this,"bdsCancel",7),this.bdsFocus=i(this,"bdsFocus",7),this.bdsBlur=i(this,"bdsBlur",7),this.bdsChangeChips=i(this,"bdsChangeChips",7),this.bdsSelectChipsInput=i(this,"bdsSelectChipsInput",7),this.bdsSubmit=i(this,"bdsSubmit",7),this.handleChangeChipsValue=async()=>{await this.resetFilterOptions()},this.toggle=()=>{this.disabled||(this.isOpen=!this.isOpen)},this.handler=async s=>{const{detail:{value:i}}=s,t=this.getText(i);await this.addChip(t),this.toggle()},this.handlerNewOption=async s=>{await this.addChip(s),this.toggle()},this.getText=s=>{const i=this.childOptions.find((i=>i.value===s));return this.getTextFromOption(i)},this.getTextFromOption=s=>{var i,t;if((null==s?void 0:s.status)||(null==s?void 0:s.bulkOption)){if(this.internalOptions){const i=this.internalOptions.find((i=>i.value==s.value));if(i)return i.label}return s.querySelector(`#bds-typo-label-${s.value}`).textContent}return(null==s?void 0:s.titleText)?s.titleText:null!==(t=null===(i=null==s?void 0:s.textContent)||void 0===i?void 0:i.trim())&&void 0!==t?t:""},this.setFocusWrapper=()=>{this.nativeInput&&this.nativeInput.focus()},this.removeFocusWrapper=()=>{this.nativeInput.blur()},this.onClickWrapper=()=>{this.onFocus(),this.nativeInput&&this.nativeInput.focus()},this.onFocus=()=>{this.bdsFocus.emit(),this.isPressed=!0},this.onInput=s=>{const i=s.target;i&&(this.value=i.value||""),this.bdsSelectChipsInput.emit(s),this.changedInputValue()},this.keyPressWrapper=s=>{switch(s.key){case"Enter":!1!==this.canAddNew&&(this.handleDelimiters(),this.setChip(this.value),this.value="");break;case"Backspace":(null===this.value||this.value.length<=0)&&this.internalChips.length&&(this.removeLastChip(),this.bdsChangeChips.emit({data:this.internalChips}))}},this.changedInputValue=async()=>{this.value=this.nativeInput.value,this.nativeInput.value?await this.filterOptions(this.nativeInput.value):await this.resetFilterOptions(),this.value&&!1===this.isOpen&&(this.isOpen=!0)},this.internalOptions=void 0,this.isOpen=!1,this.validationDanger=!1,this.isPressed=!1,this.validationMesage="",this.internalChips=[],this.options=[],this.chips=[],this.newPrefix="",this.value="",this.danger=!1,this.maxlength=void 0,this.errorMessage="",this.disabled=!1,this.label="",this.icon="",this.duplicated=!1,this.canAddNew=!0,this.notFoundMessage="No results found",this.type="text",this.delimiters=/,|;/,this.disableSubmit=!1,this.helperMessage="",this.inputName="",this.placeholder="",this.dataTest=null}handleWindow(s){this.el.contains(s.target)||(this.isOpen=!1)}valueChanged(){if(this.chips)if("string"==typeof this.chips)try{this.internalChips=JSON.parse(this.chips)}catch(s){this.internalChips=[]}else this.internalChips=this.chips;else this.internalChips=[]}internalValueChanged(){this.handleChangeChipsValue(),this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})}async isValid(){return this.validateChips()}async getChips(){return this.internalChips}async clear(){this.internalChips=[],this.value=""}async add(s){this.handleDelimiters(),this.setChip(s||this.value),this.value=""}async setFocus(){this.nativeInput.focus()}async removeFocus(){this.nativeInput.blur()}componentWillLoad(){this.valueChanged()}async componentDidLoad(){await this.resetFilterOptions()}async connectedCallback(){for(const s of this.childOptions)s.addEventListener("optionSelected",this.handler)}get childOptionsEnabled(){return Array.from(this.el.querySelectorAll("bds-select-option:not([invisible]):not(#option-add):not(#no-option)"))}get childOptions(){return Array.from(this.el.querySelectorAll("bds-select-option:not(#option-add):not(#no-option)"))}async filterOptions(s){if(s)for(const i of this.childOptions){const t=this.existsChip(i.textContent,await this.getChips()),e=i.textContent.toLowerCase(),c=s.toLowerCase();t&&i.setAttribute("invisible","invisible"),s&&e.includes(c)&&!t&&i.removeAttribute("invisible"),!s||e.includes(c)||t||i.setAttribute("invisible","invisible")}else await this.resetFilterOptions()}async resetFilterOptions(){var s;for(const i of this.childOptions){const t=null===(s=i.querySelector("bds-typo"))||void 0===s?void 0:s.textContent;this.existsChip(t,await this.getChips())?i.setAttribute("invisible","invisible"):i.removeAttribute("invisible")}}existsChip(s,i){return i.some((i=>s===i))}enableCreateOption(){return!(0!==this.childOptionsEnabled.length||!this.nativeInput||!this.nativeInput.value)}async addChip(s){await this.setChip(s),this.nativeInput.value=""}validateChips(){return"email"!==this.type||!this.internalChips.some((s=>!this.validateChip(s)))}handleOnBlur(){this.bdsBlur.emit(),this.isPressed=!1}getLastChip(){return this.internalChips[this.internalChips.length-1]}verifyAndSubstituteDelimiters(s){if(1===s.length&&s[0].match(this.delimiters))return"";let i=s.replace(/;/g,",").replace(/\,+|;+/g,",");return i[0].match(this.delimiters)&&(i=i.substring(1)),i}handleDelimiters(){const s=this.nativeInput.value;if(this.value=s?s.trim():"",0===s.length)return;if(!s.match(this.delimiters))return;const i=this.verifyAndSubstituteDelimiters(s);i?(i.split(this.delimiters).forEach((s=>{this.setChip(s)})),this.clearInputValues()):this.clearInputValues()}async handleChange(s){const{detail:{value:i}}=s;if(this.value=i?i.trim():"",0===i.length)return;if(!i.match(this.delimiters))return;const t=this.verifyAndSubstituteDelimiters(i);t?(t.split(this.delimiters).forEach((s=>{this.setChip(s)})),this.clearInputValues()):this.clearInputValues()}clearInputValues(s=""){this.nativeInput.value=s,this.value=s}setChip(s){!this.duplicated&&this.internalChips.some((i=>i.toLowerCase()===s.toLowerCase()))||c(s)&&(this.internalChips=[...this.internalChips,s])}validateChip(s){const i=s.trim();return"email"!==this.type||!n(i)}removeLastChip(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)}removeChip(s){const{detail:{id:i}}=s;this.internalChips=this.internalChips.filter(((s,t)=>t.toString()!==i))}renderChips(){return this.internalChips.length?this.internalChips.map(((s,i)=>{const e=i.toString();return s.length<=30?t("bds-chip-clickable",{id:e,key:e,color:"default",close:!this.disabled,onChipClickableClose:s=>this.removeChip(s)},s):t("bds-tooltip",{key:e,position:"top-center","tooltip-text":s},t("bds-chip-clickable",{id:e,key:e,color:"default",close:!this.disabled,onChipClickableClose:s=>this.removeChip(s)},`${s.slice(0,30)} ...`))})):[]}renderIcon(){return this.icon&&t("div",{class:{input__icon:!0,"input__icon--large":!!this.label}},t("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))}renderLabel(){return this.label&&t("label",{class:{input__container__label:!0,"input__container__label--pressed":this.isPressed&&!this.disabled}},t("bds-typo",{variant:"fs-12",bold:"bold"},this.label))}renderMessage(){let s=this.danger?this.errorMessage:this.helperMessage;if(!s&&this.validationDanger&&(s=this.validationMesage),s)return t("div",{class:this.danger||this.validationDanger?"input__message input__message--danger":"input__message",part:"input__message"},t("div",{class:"input__message__icon"},t("bds-icon",{size:"x-small",name:this.danger?"error":"info",theme:"solid",color:"inherit"})),t("bds-typo",{variant:"fs-12"},s))}generateKey(s){return s.toLowerCase().replace(/ /g,"-")}render(){const s=this.isOpen?"arrow-up":"arrow-down",i=this.isPressed&&!this.disabled;let e=[];if(this.options)if("string"==typeof this.options)try{e=JSON.parse(this.options)}catch(c){}else e=this.options;return t("div",{class:"select",tabindex:"0",onFocus:this.setFocusWrapper,onBlur:this.removeFocusWrapper,onKeyPress:this.keyPressWrapper},t("div",{class:{element_input:!0},"aria-disabled":this.disabled?"true":null,onClick:this.toggle},t("div",{class:{input:!0,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":i},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper},this.renderIcon(),t("div",{class:"input__container"},this.renderLabel(),t("div",{class:{input__container__wrapper:!0}},this.internalChips.length>0&&t("span",{class:"inside-input-left"},this.renderChips()),t("input",{ref:s=>this.nativeInput=s,class:{input__container__text:!0},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:()=>this.handleOnBlur(),onChange:()=>this.handleChange,value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),t("div",{class:"select__icon"},t("bds-icon",{size:"small",name:s,color:"inherit"}))),this.renderMessage()),t("div",{class:{select__options:!0,"select__options--open":this.isOpen}},e.map((s=>t("bds-select-option",{key:this.generateKey(s.value),onOptionSelected:this.handler,value:s.value,status:s.status},s.label))),t("slot",null),!0===this.canAddNew&&this.enableCreateOption()&&t("bds-select-option",{id:"option-add",value:"add",onClick:()=>this.handlerNewOption(this.nativeInput.value)},this.newPrefix,this.nativeInput.value),!this.canAddNew&&this.enableCreateOption()&&t("bds-select-option",{id:"no-option",value:"add"},this.notFoundMessage)))}get el(){return e(this)}static get watchers(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}}};o.style='.sc-bds-select-chips-h{display:block}.element_input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-select-chips input.sc-bds-select-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-moz-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips:-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary.sc-bds-select-chips{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-select-chips:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-select-chips{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#3f7de8;background-color:#e8f2ff}.input--state-primary.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-primary.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#3f7de8}.input--state-primary.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#3f7de8;color:#202c44}.input--state-danger.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-select-chips:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-danger.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#ff4c4c}.input--state-danger.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#ff4c4c;color:#202c44}.input--state-disabled.sc-bds-select-chips{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled.sc-bds-select-chips:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-select-chips{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#b9cbd3;color:#b9cbd3}.input--label.sc-bds-select-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-select-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-select-chips{padding:4px}.input__container.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-select-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-select-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text.sc-bds-select-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-select-chips,.input__container__text[type=radio].sc-bds-select-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-select-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-select-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-select-chips,.input__container__text[type=button].sc-bds-select-chips,.input__container__text[type=submit].sc-bds-select-chips{overflow:visible}.input__container__text.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-select-chips bds-typo.sc-bds-select-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-select-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-select-chips{color:#ff4c4c}.select.sc-bds-select-chips{position:relative;outline:none}.select__icon.sc-bds-select-chips{color:#8ca0b3;display:-ms-flexbox;display:flex}.select__options.sc-bds-select-chips{background:#f8fbfb;width:100%;max-height:250px;position:absolute;top:99%;left:0;border-radius:8px;-webkit-box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);overflow-y:auto;z-index:2;margin-top:4px;-webkit-transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:scaleY(0);transform:scaleY(0);visibility:hidden;opacity:0;-webkit-box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4);box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4)}.select__options.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.select__options.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.select__options--open.sc-bds-select-chips{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.select__options--position-top.sc-bds-select-chips{top:auto;bottom:100%;-webkit-transform-origin:bottom left;transform-origin:bottom left}.inside-input-left.sc-bds-select-chips{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-select-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-select-chips{-ms-flex:1;flex:1}';export{o as bds_select_chips}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,i,s){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(t){r(t)}}function a(e){try{c(s["throw"](e))}catch(t){r(t)}}function c(e){e.done?i(e.value):n(e.value).then(o,a)}c((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,n,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(s)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(s=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c];n=0}finally{s=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var s=0,n=t.length,r;s<n;s++){if(r||!(s in t)){if(!r)r=Array.prototype.slice.call(t,0,s);r[s]=t[s]}}return e.concat(r||Array.prototype.slice.call(t))};System.register(["./p-a4b7f12e.system.js","./p-c5060283.system.js"],(function(e){"use strict";var t,i,s,n,r,o;return{setters:[function(e){t=e.r;i=e.c;s=e.h;n=e.g},function(e){r=e.w;o=e.e}],execute:function(){var a='.sc-bds-select-chips-h{display:block}.element_input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-select-chips input.sc-bds-select-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-moz-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips:-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary.sc-bds-select-chips{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-select-chips:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-select-chips{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#3f7de8;background-color:#e8f2ff}.input--state-primary.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-primary.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#3f7de8}.input--state-primary.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#3f7de8;color:#202c44}.input--state-danger.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-select-chips:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-danger.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#ff4c4c}.input--state-danger.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#ff4c4c;color:#202c44}.input--state-disabled.sc-bds-select-chips{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled.sc-bds-select-chips:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-select-chips{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#b9cbd3;color:#b9cbd3}.input--label.sc-bds-select-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-select-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-select-chips{padding:4px}.input__container.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-select-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-select-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text.sc-bds-select-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-select-chips,.input__container__text[type=radio].sc-bds-select-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-select-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-select-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-select-chips,.input__container__text[type=button].sc-bds-select-chips,.input__container__text[type=submit].sc-bds-select-chips{overflow:visible}.input__container__text.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-select-chips bds-typo.sc-bds-select-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-select-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-select-chips{color:#ff4c4c}.select.sc-bds-select-chips{position:relative;outline:none}.select__icon.sc-bds-select-chips{color:#8ca0b3;display:-ms-flexbox;display:flex}.select__options.sc-bds-select-chips{background:#f8fbfb;width:100%;max-height:250px;position:absolute;top:99%;left:0;border-radius:8px;-webkit-box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);overflow-y:auto;z-index:2;margin-top:4px;-webkit-transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:scaleY(0);transform:scaleY(0);visibility:hidden;opacity:0;-webkit-box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4);box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4)}.select__options.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.select__options.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.select__options--open.sc-bds-select-chips{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.select__options--position-top.sc-bds-select-chips{top:auto;bottom:100%;-webkit-transform-origin:bottom left;transform-origin:bottom left}.inside-input-left.sc-bds-select-chips{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-select-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-select-chips{-ms-flex:1;flex:1}';var c=e("bds_select_chips",function(){function e(e){var s=this;t(this,e);this.bdsChange=i(this,"bdsChange",7);this.bdsCancel=i(this,"bdsCancel",7);this.bdsFocus=i(this,"bdsFocus",7);this.bdsBlur=i(this,"bdsBlur",7);this.bdsChangeChips=i(this,"bdsChangeChips",7);this.bdsSelectChipsInput=i(this,"bdsSelectChipsInput",7);this.bdsSubmit=i(this,"bdsSubmit",7);this.handleChangeChipsValue=function(){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};this.toggle=function(){if(!s.disabled){s.isOpen=!s.isOpen}};this.handler=function(e){return __awaiter(s,void 0,void 0,(function(){var t,i;return __generator(this,(function(s){switch(s.label){case 0:t=e.detail.value;i=this.getText(t);return[4,this.addChip(i)];case 1:s.sent();this.toggle();return[2]}}))}))};this.handlerNewOption=function(e){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.addChip(e)];case 1:t.sent();this.toggle();return[2]}}))}))};this.getText=function(e){var t=s.childOptions.find((function(t){return t.value===e}));return s.getTextFromOption(t)};this.getTextFromOption=function(e){var t,i;if((e===null||e===void 0?void 0:e.status)||(e===null||e===void 0?void 0:e.bulkOption)){if(s.internalOptions){var n=s.internalOptions.find((function(t){return t.value==e.value}));if(n){return n.label}}return e.querySelector("#bds-typo-label-".concat(e.value)).textContent}return(e===null||e===void 0?void 0:e.titleText)?e.titleText:(i=(t=e===null||e===void 0?void 0:e.textContent)===null||t===void 0?void 0:t.trim())!==null&&i!==void 0?i:""};this.setFocusWrapper=function(){if(s.nativeInput){s.nativeInput.focus()}};this.removeFocusWrapper=function(){s.nativeInput.blur()};this.onClickWrapper=function(){s.onFocus();if(s.nativeInput){s.nativeInput.focus()}};this.onFocus=function(){s.bdsFocus.emit();s.isPressed=true};this.onInput=function(e){var t=e.target;if(t){s.value=t.value||""}s.bdsSelectChipsInput.emit(e);s.changedInputValue()};this.keyPressWrapper=function(e){switch(e.key){case"Enter":if(s.canAddNew!==false){s.handleDelimiters();s.setChip(s.value);s.value=""}break;case"Backspace":if((s.value===null||s.value.length<=0)&&s.internalChips.length){s.removeLastChip();s.bdsChangeChips.emit({data:s.internalChips})}break}};this.changedInputValue=function(){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.value=this.nativeInput.value;if(!this.nativeInput.value)return[3,2];return[4,this.filterOptions(this.nativeInput.value)];case 1:e.sent();return[3,4];case 2:return[4,this.resetFilterOptions()];case 3:e.sent();e.label=4;case 4:if(this.value&&this.isOpen===false){this.isOpen=true}return[2]}}))}))};this.internalOptions=undefined;this.isOpen=false;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.options=[];this.chips=[];this.newPrefix="";this.value="";this.danger=false;this.maxlength=undefined;this.errorMessage="";this.disabled=false;this.label="";this.icon="";this.duplicated=false;this.canAddNew=true;this.notFoundMessage="No results found";this.type="text";this.delimiters=/,|;/;this.disableSubmit=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}e.prototype.handleWindow=function(e){if(!this.el.contains(e.target)){this.isOpen=false}};e.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(e){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};e.prototype.internalValueChanged=function(){this.handleChangeChipsValue();this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};e.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.validateChips()]}))}))};e.prototype.getChips=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.internalChips]}))}))};e.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.internalChips=[];this.value="";return[2]}))}))};e.prototype.add=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.setChip(e);return[2]}))}))};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.focus();return[2]}))}))};e.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.blur();return[2]}))}))};e.prototype.componentWillLoad=function(){this.valueChanged()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};e.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(s){for(e=0,t=this.childOptions;e<t.length;e++){i=t[e];i.addEventListener("optionSelected",this.handler)}return[2]}))}))};Object.defineProperty(e.prototype,"childOptionsEnabled",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not([invisible]):not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});e.prototype.filterOptions=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n,r,o,a,c;return __generator(this,(function(l){switch(l.label){case 0:if(!!e)return[3,2];return[4,this.resetFilterOptions()];case 1:l.sent();return[2];case 2:t=0,i=this.childOptions;l.label=3;case 3:if(!(t<i.length))return[3,6];s=i[t];r=this.existsChip;o=[s.textContent];return[4,this.getChips()];case 4:n=r.apply(this,o.concat([l.sent()]));a=s.textContent.toLowerCase();c=e.toLowerCase();if(n){s.setAttribute("invisible","invisible")}if(e&&a.includes(c)&&!n){s.removeAttribute("invisible")}if(e&&!a.includes(c)&&!n){s.setAttribute("invisible","invisible")}l.label=5;case 5:t++;return[3,3];case 6:return[2]}}))}))};e.prototype.resetFilterOptions=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,s,n,r,o;return __generator(this,(function(a){switch(a.label){case 0:t=0,i=this.childOptions;a.label=1;case 1:if(!(t<i.length))return[3,4];s=i[t];n=(e=s.querySelector("bds-typo"))===null||e===void 0?void 0:e.textContent;r=this.existsChip;o=[n];return[4,this.getChips()];case 2:if(r.apply(this,o.concat([a.sent()]))){s.setAttribute("invisible","invisible")}else{s.removeAttribute("invisible")}a.label=3;case 3:t++;return[3,1];case 4:return[2]}}))}))};e.prototype.existsChip=function(e,t){return t.some((function(t){return e===t}))};e.prototype.enableCreateOption=function(){return!!(this.childOptionsEnabled.length===0&&this.nativeInput&&this.nativeInput.value)};e.prototype.addChip=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.setChip(e)];case 1:t.sent();this.nativeInput.value="";return[2]}}))}))};e.prototype.validateChips=function(){var e=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!e.validateChip(t)}))}else{return true}};e.prototype.handleOnBlur=function(){this.bdsBlur.emit();this.isPressed=false};e.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};e.prototype.verifyAndSubstituteDelimiters=function(e){if(e.length===1&&e[0].match(this.delimiters)){return""}var t=e.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};e.prototype.handleDelimiters=function(){var e=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var i=t.match(this.delimiters);if(!i)return;var s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return}var n=s.split(this.delimiters);n.forEach((function(t){e.setChip(t)}));this.clearInputValues()};e.prototype.handleChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n;var r=this;return __generator(this,(function(o){t=e.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];i=t.match(this.delimiters);if(!i)return[2];s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return[2]}n=s.split(this.delimiters);n.forEach((function(e){r.setChip(e)}));this.clearInputValues();return[2]}))}))};e.prototype.clearInputValues=function(e){if(e===void 0){e=""}this.nativeInput.value=e;this.value=e};e.prototype.setChip=function(e){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===e.toLowerCase()}));if(t)return}if(!r(e)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[e],false)};e.prototype.validateChip=function(e){var t=e.trim();if(this.type==="email"&&o(t)){return false}return true};e.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};e.prototype.removeChip=function(e){var t=e.detail.id;this.internalChips=this.internalChips.filter((function(e,i){return i.toString()!==t}))};e.prototype.renderChips=function(){var e=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,i){var n=i.toString();var r=30;if(t.length<=r){return s("bds-chip-clickable",{id:n,key:n,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},t)}else{return s("bds-tooltip",{key:n,position:"top-center","tooltip-text":t},s("bds-chip-clickable",{id:n,key:n,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},"".concat(t.slice(0,r)," ...")))}}))};e.prototype.renderIcon=function(){return this.icon&&s("div",{class:{input__icon:true,"input__icon--large":!!this.label}},s("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};e.prototype.renderLabel=function(){return this.label&&s("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},s("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};e.prototype.renderMessage=function(){var e=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var i=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return s("div",{class:i,part:"input__message"},s("div",{class:"input__message__icon"},s("bds-icon",{size:"x-small",name:e,theme:"solid",color:"inherit"})),s("bds-typo",{variant:"fs-12"},t))}return undefined};e.prototype.generateKey=function(e){return e.toLowerCase().replace(/ /g,"-")};e.prototype.render=function(){var e=this;var t=this.isOpen?"arrow-up":"arrow-down";var i=this.isPressed&&!this.disabled;var n=[];if(this.options){if(typeof this.options==="string"){try{n=JSON.parse(this.options)}catch(r){}}else{n=this.options}}return s("div",{class:"select",tabindex:"0",onFocus:this.setFocusWrapper,onBlur:this.removeFocusWrapper,onKeyPress:this.keyPressWrapper},s("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null,onClick:this.toggle},s("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":i},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper},this.renderIcon(),s("div",{class:"input__container"},this.renderLabel(),s("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&s("span",{class:"inside-input-left"},this.renderChips()),s("input",{ref:function(t){return e.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return e.handleOnBlur()},onChange:function(){return e.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),s("div",{class:"select__icon"},s("bds-icon",{size:"small",name:t,color:"inherit"}))),this.renderMessage()),s("div",{class:{select__options:true,"select__options--open":this.isOpen}},n.map((function(t){return s("bds-select-option",{key:e.generateKey(t.value),onOptionSelected:e.handler,value:t.value,status:t.status},t.label)})),s("slot",null),this.canAddNew===true&&this.enableCreateOption()&&s("bds-select-option",{id:"option-add",value:"add",onClick:function(){return e.handlerNewOption(e.nativeInput.value)}},this.newPrefix,this.nativeInput.value),!this.canAddNew&&this.enableCreateOption()&&s("bds-select-option",{id:"no-option",value:"add"},this.notFoundMessage)))};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return e}());c.style=a}}}));
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,i,s){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(t){r(t)}}function a(e){try{c(s["throw"](e))}catch(t){r(t)}}function c(e){e.done?i(e.value):n(e.value).then(o,a)}c((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,n,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(s)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(s=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c];n=0}finally{s=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var s=0,n=t.length,r;s<n;s++){if(r||!(s in t)){if(!r)r=Array.prototype.slice.call(t,0,s);r[s]=t[s]}}return e.concat(r||Array.prototype.slice.call(t))};System.register(["./p-a4b7f12e.system.js","./p-c5060283.system.js"],(function(e){"use strict";var t,i,s,n,r,o;return{setters:[function(e){t=e.r;i=e.c;s=e.h;n=e.g},function(e){r=e.w;o=e.e}],execute:function(){var a='.sc-bds-select-chips-h{display:block}.element_input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-select-chips input.sc-bds-select-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-moz-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips:-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary.sc-bds-select-chips{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-select-chips:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-select-chips{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#3f7de8;background-color:#e8f2ff}.input--state-primary.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-primary.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#3f7de8}.input--state-primary.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#3f7de8;color:#202c44}.input--state-danger.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-select-chips:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-danger.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#ff4c4c}.input--state-danger.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#ff4c4c;color:#202c44}.input--state-disabled.sc-bds-select-chips{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled.sc-bds-select-chips:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-select-chips{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#b9cbd3;color:#b9cbd3}.input--label.sc-bds-select-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-select-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-select-chips{padding:4px}.input__container.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-select-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-select-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text.sc-bds-select-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-select-chips,.input__container__text[type=radio].sc-bds-select-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-select-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-select-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-select-chips,.input__container__text[type=button].sc-bds-select-chips,.input__container__text[type=submit].sc-bds-select-chips{overflow:visible}.input__container__text.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-select-chips bds-typo.sc-bds-select-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-select-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-select-chips{color:#ff4c4c}.select.sc-bds-select-chips{position:relative;outline:none}.select__icon.sc-bds-select-chips{color:#8ca0b3;display:-ms-flexbox;display:flex}.select__options.sc-bds-select-chips{background:#f8fbfb;width:100%;max-height:250px;position:absolute;top:99%;left:0;border-radius:8px;-webkit-box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);overflow-y:auto;z-index:2;margin-top:4px;-webkit-transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:scaleY(0);transform:scaleY(0);visibility:hidden;opacity:0;-webkit-box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4);box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4)}.select__options.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.select__options.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.select__options--open.sc-bds-select-chips{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.select__options--position-top.sc-bds-select-chips{top:auto;bottom:100%;-webkit-transform-origin:bottom left;transform-origin:bottom left}.inside-input-left.sc-bds-select-chips{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-select-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-select-chips{-ms-flex:1;flex:1}';var c=e("bds_select_chips",function(){function e(e){var s=this;t(this,e);this.bdsChange=i(this,"bdsChange",7);this.bdsCancel=i(this,"bdsCancel",7);this.bdsFocus=i(this,"bdsFocus",7);this.bdsBlur=i(this,"bdsBlur",7);this.bdsChangeChips=i(this,"bdsChangeChips",7);this.bdsSelectChipsInput=i(this,"bdsSelectChipsInput",7);this.bdsSubmit=i(this,"bdsSubmit",7);this.handleChangeChipsValue=function(){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};this.toggle=function(){if(!s.disabled){s.isOpen=!s.isOpen}};this.handler=function(e){return __awaiter(s,void 0,void 0,(function(){var t,i;return __generator(this,(function(s){switch(s.label){case 0:t=e.detail.value;i=this.getText(t);return[4,this.addChip(i)];case 1:s.sent();this.toggle();return[2]}}))}))};this.handlerNewOption=function(e){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.addChip(e)];case 1:t.sent();this.toggle();return[2]}}))}))};this.getText=function(e){var t=s.childOptions.find((function(t){return t.value===e}));return s.getTextFromOption(t)};this.getTextFromOption=function(e){var t,i;if((e===null||e===void 0?void 0:e.status)||(e===null||e===void 0?void 0:e.bulkOption)){if(s.internalOptions){var n=s.internalOptions.find((function(t){return t.value==e.value}));if(n){return n.label}}return e.querySelector("#bds-typo-label-".concat(e.value)).textContent}return(e===null||e===void 0?void 0:e.titleText)?e.titleText:(i=(t=e===null||e===void 0?void 0:e.textContent)===null||t===void 0?void 0:t.trim())!==null&&i!==void 0?i:""};this.setFocusWrapper=function(){if(s.nativeInput){s.nativeInput.focus()}};this.removeFocusWrapper=function(){s.nativeInput.blur()};this.onClickWrapper=function(){s.onFocus();if(s.nativeInput){s.nativeInput.focus()}};this.onFocus=function(){s.bdsFocus.emit();s.isPressed=true};this.onInput=function(e){var t=e.target;if(t){s.value=t.value||""}s.bdsSelectChipsInput.emit(e);s.changedInputValue()};this.keyPressWrapper=function(e){switch(e.key){case"Enter":if(s.canAddNew!==false){s.handleDelimiters();s.setChip(s.value);s.value=""}break;case"Backspace":if((s.value===null||s.value.length<=0)&&s.internalChips.length){s.removeLastChip();s.bdsChangeChips.emit({data:s.internalChips})}break}};this.changedInputValue=function(){return __awaiter(s,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.value=this.nativeInput.value;if(!this.nativeInput.value)return[3,2];return[4,this.filterOptions(this.nativeInput.value)];case 1:e.sent();return[3,4];case 2:return[4,this.resetFilterOptions()];case 3:e.sent();e.label=4;case 4:if(this.value&&this.isOpen===false){this.isOpen=true}return[2]}}))}))};this.internalOptions=undefined;this.isOpen=false;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.options=[];this.chips=[];this.newPrefix="";this.value="";this.danger=false;this.maxlength=undefined;this.errorMessage="";this.disabled=false;this.label="";this.icon="";this.duplicated=false;this.canAddNew=true;this.notFoundMessage="No results found";this.type="text";this.delimiters=/,|;/;this.disableSubmit=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}e.prototype.handleWindow=function(e){if(!this.el.contains(e.target)){this.isOpen=false}};e.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(e){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};e.prototype.internalValueChanged=function(){this.handleChangeChipsValue();this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};e.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.validateChips()]}))}))};e.prototype.getChips=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.internalChips]}))}))};e.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.internalChips=[];this.value="";return[2]}))}))};e.prototype.add=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.handleDelimiters();if(e){this.setChip(e)}else{this.setChip(this.value)}this.value="";return[2]}))}))};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.focus();return[2]}))}))};e.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.blur();return[2]}))}))};e.prototype.componentWillLoad=function(){this.valueChanged()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};e.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(s){for(e=0,t=this.childOptions;e<t.length;e++){i=t[e];i.addEventListener("optionSelected",this.handler)}return[2]}))}))};Object.defineProperty(e.prototype,"childOptionsEnabled",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not([invisible]):not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});e.prototype.filterOptions=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n,r,o,a,c;return __generator(this,(function(l){switch(l.label){case 0:if(!!e)return[3,2];return[4,this.resetFilterOptions()];case 1:l.sent();return[2];case 2:t=0,i=this.childOptions;l.label=3;case 3:if(!(t<i.length))return[3,6];s=i[t];r=this.existsChip;o=[s.textContent];return[4,this.getChips()];case 4:n=r.apply(this,o.concat([l.sent()]));a=s.textContent.toLowerCase();c=e.toLowerCase();if(n){s.setAttribute("invisible","invisible")}if(e&&a.includes(c)&&!n){s.removeAttribute("invisible")}if(e&&!a.includes(c)&&!n){s.setAttribute("invisible","invisible")}l.label=5;case 5:t++;return[3,3];case 6:return[2]}}))}))};e.prototype.resetFilterOptions=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,s,n,r,o;return __generator(this,(function(a){switch(a.label){case 0:t=0,i=this.childOptions;a.label=1;case 1:if(!(t<i.length))return[3,4];s=i[t];n=(e=s.querySelector("bds-typo"))===null||e===void 0?void 0:e.textContent;r=this.existsChip;o=[n];return[4,this.getChips()];case 2:if(r.apply(this,o.concat([a.sent()]))){s.setAttribute("invisible","invisible")}else{s.removeAttribute("invisible")}a.label=3;case 3:t++;return[3,1];case 4:return[2]}}))}))};e.prototype.existsChip=function(e,t){return t.some((function(t){return e===t}))};e.prototype.enableCreateOption=function(){return!!(this.childOptionsEnabled.length===0&&this.nativeInput&&this.nativeInput.value)};e.prototype.addChip=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.setChip(e)];case 1:t.sent();this.nativeInput.value="";return[2]}}))}))};e.prototype.validateChips=function(){var e=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!e.validateChip(t)}))}else{return true}};e.prototype.handleOnBlur=function(){this.bdsBlur.emit();this.isPressed=false};e.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};e.prototype.verifyAndSubstituteDelimiters=function(e){if(e.length===1&&e[0].match(this.delimiters)){return""}var t=e.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};e.prototype.handleDelimiters=function(){var e=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var i=t.match(this.delimiters);if(!i)return;var s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return}var n=s.split(this.delimiters);n.forEach((function(t){e.setChip(t)}));this.clearInputValues()};e.prototype.handleChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n;var r=this;return __generator(this,(function(o){t=e.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];i=t.match(this.delimiters);if(!i)return[2];s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return[2]}n=s.split(this.delimiters);n.forEach((function(e){r.setChip(e)}));this.clearInputValues();return[2]}))}))};e.prototype.clearInputValues=function(e){if(e===void 0){e=""}this.nativeInput.value=e;this.value=e};e.prototype.setChip=function(e){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===e.toLowerCase()}));if(t)return}if(!r(e)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[e],false)};e.prototype.validateChip=function(e){var t=e.trim();if(this.type==="email"&&o(t)){return false}return true};e.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};e.prototype.removeChip=function(e){var t=e.detail.id;this.internalChips=this.internalChips.filter((function(e,i){return i.toString()!==t}))};e.prototype.renderChips=function(){var e=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,i){var n=i.toString();var r=30;if(t.length<=r){return s("bds-chip-clickable",{id:n,key:n,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},t)}else{return s("bds-tooltip",{key:n,position:"top-center","tooltip-text":t},s("bds-chip-clickable",{id:n,key:n,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},"".concat(t.slice(0,r)," ...")))}}))};e.prototype.renderIcon=function(){return this.icon&&s("div",{class:{input__icon:true,"input__icon--large":!!this.label}},s("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};e.prototype.renderLabel=function(){return this.label&&s("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},s("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};e.prototype.renderMessage=function(){var e=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var i=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return s("div",{class:i,part:"input__message"},s("div",{class:"input__message__icon"},s("bds-icon",{size:"x-small",name:e,theme:"solid",color:"inherit"})),s("bds-typo",{variant:"fs-12"},t))}return undefined};e.prototype.generateKey=function(e){return e.toLowerCase().replace(/ /g,"-")};e.prototype.render=function(){var e=this;var t=this.isOpen?"arrow-up":"arrow-down";var i=this.isPressed&&!this.disabled;var n=[];if(this.options){if(typeof this.options==="string"){try{n=JSON.parse(this.options)}catch(r){}}else{n=this.options}}return s("div",{class:"select",tabindex:"0",onFocus:this.setFocusWrapper,onBlur:this.removeFocusWrapper,onKeyPress:this.keyPressWrapper},s("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null,onClick:this.toggle},s("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":i},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper},this.renderIcon(),s("div",{class:"input__container"},this.renderLabel(),s("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&s("span",{class:"inside-input-left"},this.renderChips()),s("input",{ref:function(t){return e.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return e.handleOnBlur()},onChange:function(){return e.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),s("div",{class:"select__icon"},s("bds-icon",{size:"small",name:t,color:"inherit"}))),this.renderMessage()),s("div",{class:{select__options:true,"select__options--open":this.isOpen}},n.map((function(t){return s("bds-select-option",{key:e.generateKey(t.value),onOptionSelected:e.handler,value:t.value,status:t.status},t.label)})),s("slot",null),this.canAddNew===true&&this.enableCreateOption()&&s("bds-select-option",{id:"option-add",value:"add",onClick:function(){return e.handlerNewOption(e.nativeInput.value)}},this.newPrefix,this.nativeInput.value),!this.canAddNew&&this.enableCreateOption()&&s("bds-select-option",{id:"no-option",value:"add"},this.notFoundMessage)))};Object.defineProperty(e.prototype,"el",{get:function(){return n(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return e}());c.style=a}}}));
|
|
@@ -114,7 +114,14 @@ const InputChips = class {
|
|
|
114
114
|
this.value = '';
|
|
115
115
|
}
|
|
116
116
|
async add(value) {
|
|
117
|
-
this.
|
|
117
|
+
this.handleDelimiters();
|
|
118
|
+
if (value) {
|
|
119
|
+
this.setChip(value);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.setChip(this.value);
|
|
123
|
+
}
|
|
124
|
+
this.value = '';
|
|
118
125
|
}
|
|
119
126
|
async setFocus() {
|
|
120
127
|
this.nativeInput.focus();
|
|
@@ -131,7 +131,7 @@ const List = class {
|
|
|
131
131
|
render() {
|
|
132
132
|
return (index.h(index.Host, null, index.h("div", { class: {
|
|
133
133
|
list: true,
|
|
134
|
-
} }, this.internalData ? (this.internalData.map((item, idx) => (index.h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (index.h("slot", null)))));
|
|
134
|
+
} }, this.internalData ? (this.internalData.map((item, idx) => (index.h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, checked: item.checked, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (index.h("slot", null)))));
|
|
135
135
|
}
|
|
136
136
|
get element() { return index.getElement(this); }
|
|
137
137
|
static get watchers() { return {
|
|
@@ -185,7 +185,14 @@ const SelectChips = class {
|
|
|
185
185
|
this.value = '';
|
|
186
186
|
}
|
|
187
187
|
async add(value) {
|
|
188
|
-
this.
|
|
188
|
+
this.handleDelimiters();
|
|
189
|
+
if (value) {
|
|
190
|
+
this.setChip(value);
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.setChip(this.value);
|
|
194
|
+
}
|
|
195
|
+
this.value = '';
|
|
189
196
|
}
|
|
190
197
|
async setFocus() {
|
|
191
198
|
this.nativeInput.focus();
|
|
@@ -100,7 +100,14 @@ export class InputChips {
|
|
|
100
100
|
this.value = '';
|
|
101
101
|
}
|
|
102
102
|
async add(value) {
|
|
103
|
-
this.
|
|
103
|
+
this.handleDelimiters();
|
|
104
|
+
if (value) {
|
|
105
|
+
this.setChip(value);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
this.setChip(this.value);
|
|
109
|
+
}
|
|
110
|
+
this.value = '';
|
|
104
111
|
}
|
|
105
112
|
async setFocus() {
|
|
106
113
|
this.nativeInput.focus();
|
|
@@ -119,7 +119,7 @@ export class List {
|
|
|
119
119
|
render() {
|
|
120
120
|
return (h(Host, null, h("div", { class: {
|
|
121
121
|
list: true,
|
|
122
|
-
} }, this.internalData ? (this.internalData.map((item, idx) => (h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (h("slot", null)))));
|
|
122
|
+
} }, this.internalData ? (this.internalData.map((item, idx) => (h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, checked: item.checked, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (h("slot", null)))));
|
|
123
123
|
}
|
|
124
124
|
static get is() { return "bds-list"; }
|
|
125
125
|
static get encapsulation() { return "shadow"; }
|
|
@@ -191,7 +191,7 @@ export class List {
|
|
|
191
191
|
"optional": true,
|
|
192
192
|
"docs": {
|
|
193
193
|
"tags": [],
|
|
194
|
-
"text": "The Data of the list\nShould be passed this way:\ndata='[{\"value\": \"01\",\"text\": \"Text\",\"secondaryText\": \"Secondary Text\",\"avatarName\": \"\",\"avatarThumbnail\": \"\",\"icon\": \"settings-builder\"}, {\"value\": \"02\",\"text\": \"Text\",\"secondaryText\": \"Secondary Text\",\"avatarName\": \"\",\"avatarThumbnail\": \"\",\"icon\": \"settings-builder\",}]'\nData can also be passed as child by using bds-list-item component, but passing as a child you may have some compatibility problems with Angular."
|
|
194
|
+
"text": "The Data of the list\nShould be passed this way:\ndata='[{\"value\": \"01\",\"text\": \"Text\",\"secondaryText\": \"Secondary Text\",\"avatarName\": \"\",\"avatarThumbnail\": \"\",\"checked\"=\"true\",\"icon\": \"settings-builder\"}, {\"value\": \"02\",\"text\": \"Text\",\"secondaryText\": \"Secondary Text\",\"avatarName\": \"\",\"avatarThumbnail\": \"\",\"checked\"=\"false\",\"icon\": \"settings-builder\",}]'\nData can also be passed as child by using bds-list-item component, but passing as a child you may have some compatibility problems with Angular."
|
|
195
195
|
},
|
|
196
196
|
"attribute": "data",
|
|
197
197
|
"reflect": true
|
|
@@ -170,7 +170,14 @@ export class SelectChips {
|
|
|
170
170
|
this.value = '';
|
|
171
171
|
}
|
|
172
172
|
async add(value) {
|
|
173
|
-
this.
|
|
173
|
+
this.handleDelimiters();
|
|
174
|
+
if (value) {
|
|
175
|
+
this.setChip(value);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
this.setChip(this.value);
|
|
179
|
+
}
|
|
180
|
+
this.value = '';
|
|
174
181
|
}
|
|
175
182
|
async setFocus() {
|
|
176
183
|
this.nativeInput.focus();
|
|
@@ -110,7 +110,14 @@ const InputChips = class {
|
|
|
110
110
|
this.value = '';
|
|
111
111
|
}
|
|
112
112
|
async add(value) {
|
|
113
|
-
this.
|
|
113
|
+
this.handleDelimiters();
|
|
114
|
+
if (value) {
|
|
115
|
+
this.setChip(value);
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
this.setChip(this.value);
|
|
119
|
+
}
|
|
120
|
+
this.value = '';
|
|
114
121
|
}
|
|
115
122
|
async setFocus() {
|
|
116
123
|
this.nativeInput.focus();
|
|
@@ -127,7 +127,7 @@ const List = class {
|
|
|
127
127
|
render() {
|
|
128
128
|
return (h(Host, null, h("div", { class: {
|
|
129
129
|
list: true,
|
|
130
|
-
} }, this.internalData ? (this.internalData.map((item, idx) => (h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (h("slot", null)))));
|
|
130
|
+
} }, this.internalData ? (this.internalData.map((item, idx) => (h("bds-list-item", { key: idx, value: item.value, text: item.text, "type-list": this.typeList ? this.typeList : item.typeList, "secondary-text": item.secondaryText, "avatar-name": item.avatarName, "avatar-thumbnail": item.avatarThumbnail, checked: item.checked, icon: item.icon, chips: item.chips, actionsButtons: item.actionsButtons, onBdsChecked: (ev) => this.chagedOptions(ev), onBdsClickActionButtom: (ev) => this.onClickActionsButtons(ev) })))) : (h("slot", null)))));
|
|
131
131
|
}
|
|
132
132
|
get element() { return getElement(this); }
|
|
133
133
|
static get watchers() { return {
|
|
@@ -181,7 +181,14 @@ const SelectChips = class {
|
|
|
181
181
|
this.value = '';
|
|
182
182
|
}
|
|
183
183
|
async add(value) {
|
|
184
|
-
this.
|
|
184
|
+
this.handleDelimiters();
|
|
185
|
+
if (value) {
|
|
186
|
+
this.setChip(value);
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
this.setChip(this.value);
|
|
190
|
+
}
|
|
191
|
+
this.value = '';
|
|
185
192
|
}
|
|
186
193
|
async setFocus() {
|
|
187
194
|
this.nativeInput.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(i,t,e,n){function s(i){return i instanceof e?i:new e((function(t){t(i)}))}return new(e||(e=Promise))((function(e,r){function o(i){try{p(n.next(i))}catch(t){r(t)}}function a(i){try{p(n["throw"](i))}catch(t){r(t)}}function p(i){i.done?e(i.value):s(i.value).then(o,a)}p((n=n.apply(i,t||[])).next())}))};var __generator=this&&this.__generator||function(i,t){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(i){return function(t){return p([i,t])}}function p(a){if(n)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(e=0)),e)try{if(n=1,s&&(r=a[0]&2?s["return"]:a[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,a[1])).done)return r;if(s=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:e.label++;return{value:a[1],done:false};case 5:e.label++;s=a[1];a=[0];continue;case 7:a=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){e=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){e.label=a[1];break}if(a[0]===6&&e.label<r[1]){e.label=r[1];r=a;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(a);break}if(r[2])e.ops.pop();e.trys.pop();continue}a=t.call(i,e)}catch(p){a=[6,p];s=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(i,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++){if(r||!(n in t)){if(!r)r=Array.prototype.slice.call(t,0,n);r[n]=t[n]}}return i.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-cbe64994.js";import{w as whitespaceValidation,e as emailValidation}from"./validations-6d914b78.js";var inputChipsCss='.sc-bds-input-chips-h{display:display}.element_input.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-input-chips input.sc-bds-input-chips,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-webkit-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-webkit-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-moz-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-moz-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips:-ms-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips:-ms-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-ms-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-ms-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-webkit-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-webkit-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.input.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:var(--color-surface-1, #ffffff)}.input--state-primary.sc-bds-input-chips{border:1px solid var(--color-surface-3, #e7edf4);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-input-chips:hover{border:1px solid var(--color-primary, #3f7de8);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-input-chips{border:1px solid var(--color-primary, #3f7de8);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-info, #80e3eb);box-shadow:0 0 0 2px var(--color-info, #80e3eb)}.input--state-primary.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-primary, #3f7de8);background-color:var(--color-surface-3, #e7edf4)}.input--state-primary.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-content-default, #202c44)}.input--state-primary.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-primary, #3f7de8)}.input--state-primary.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-primary, #3f7de8);color:var(--color-content-default, #202c44)}.input--state-danger.sc-bds-input-chips{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-input-chips:hover{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-input-chips{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-error, #ffa5a5);box-shadow:0 0 0 2px var(--color-error, #ffa5a5)}.input--state-danger.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-delete, #ff4c4c);background-color:var(--color-error, #ffa5a5)}.input--state-danger.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.input--state-danger.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.input--state-danger.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-delete, #ff4c4c);color:var(--color-delete, #ff4c4c)}.input--state-disabled.sc-bds-input-chips{cursor:not-allowed;border:1px solid var(--color-surface-3, #e7edf4);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips:hover{border:1px solid var(--color-content-disable, #505f79);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid var(--color-surface-3, #e7edf4);box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-input-chips{border:1px solid var(--color-content-disable, #505f79);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-surface-3, #e7edf4);box-shadow:0 0 0 2px var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-content-disable, #505f79);background-color:var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-content-disable, #505f79)}.input--state-disabled.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-content-disable, #505f79)}.input--state-disabled.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-content-disable, #505f79);color:var(--color-content-disable, #505f79)}.input--label.sc-bds-input-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-input-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-input-chips{padding:4px}.input__container.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-input-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-input-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-input-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-input-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-input-chips:focus{outline:0}.input__container__text.sc-bds-input-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-input-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-input-chips,.input__container__text[type=radio].sc-bds-input-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-input-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-input-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-input-chips,.input__container__text[type=button].sc-bds-input-chips,.input__container__text[type=submit].sc-bds-input-chips{overflow:visible}.input__container__text.sc-bds-input-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-input-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:var(--color-content-disable, #505f79);word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-input-chips bds-typo.sc-bds-input-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-input-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.inside-input-left.sc-bds-input-chips{position:relative;display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-input-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-input-chips{-ms-flex:1;flex:1}';var InputChips=function(){function i(i){var t=this;registerInstance(this,i);this.bdsChange=createEvent(this,"bdsChange",7);this.bdsChangeChips=createEvent(this,"bdsChangeChips",7);this.bdsInputChipsFocus=createEvent(this,"bdsInputChipsFocus",7);this.bdsBlur=createEvent(this,"bdsBlur",7);this.bdsInputChipsInput=createEvent(this,"bdsInputChipsInput",7);this.bdsSubmit=createEvent(this,"bdsSubmit",7);this.onClickWrapper=function(){t.onFocus();if(t.nativeInput){t.nativeInput.focus()}};this.onFocus=function(){t.bdsInputChipsFocus.emit();t.isPressed=true};this.onInput=function(i){var e=i.target;if(e){t.value=e.value||""}t.bdsInputChipsInput.emit(i)};this.keyPressWrapper=function(i){switch(i.key){case"Enter":t.handleDelimiters();t.setChip(t.value);t.value="";break;case"Backspace":if((t.value===null||t.value.length<=0)&&t.internalChips.length){t.removeLastChip();t.bdsChangeChips.emit({data:t.internalChips})}break}};this.InputSize=null;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.chips=[];this.type="text";this.label="";this.maxlength=undefined;this.icon="";this.delimiters=/,|;/;this.errorMessage="";this.danger=false;this.value="";this.duplicated=false;this.disableSubmit=false;this.disabled=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}i.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(i){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};i.prototype.internalValueChanged=function(){this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};i.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this.validateChips()]}))}))};i.prototype.get=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this.internalChips]}))}))};i.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.internalChips=[];this.value="";return[2]}))}))};i.prototype.add=function(i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.setChip(i);return[2]}))}))};i.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.nativeInput.focus();return[2]}))}))};i.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.nativeInput.blur();return[2]}))}))};i.prototype.componentWillLoad=function(){this.valueChanged()};i.prototype.validateChips=function(){var i=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!i.validateChip(t)}))}else{return true}};i.prototype.handleOnBlur=function(){this.bdsBlur.emit(this.internalChips);this.isPressed=false};i.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};i.prototype.handleDelimiters=function(){var i=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var e=t.match(this.delimiters);if(!e)return;var n=this.verifyAndSubstituteDelimiters(t);if(!n){this.clearInputValues();return}var s=n.split(this.delimiters);s.forEach((function(t){i.setChip(t)}));this.clearInputValues()};i.prototype.verifyAndSubstituteDelimiters=function(i){if(i.length===1&&i[0].match(this.delimiters)){return""}var t=i.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};i.prototype.handleChange=function(i){return __awaiter(this,void 0,void 0,(function(){var t,e,n,s;var r=this;return __generator(this,(function(o){t=i.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];e=t.match(this.delimiters);if(!e)return[2];n=this.verifyAndSubstituteDelimiters(t);if(!n){this.clearInputValues();return[2]}s=n.split(this.delimiters);s.forEach((function(i){r.setChip(i)}));this.clearInputValues();return[2]}))}))};i.prototype.clearInputValues=function(i){if(i===void 0){i=""}this.nativeInput.value=i;this.value=i};i.prototype.setChip=function(i){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===i.toLowerCase()}));if(t)return}if(!whitespaceValidation(i)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[i],false)};i.prototype.validateChip=function(i){var t=i.trim();if(this.type==="email"&&emailValidation(t)){return false}return true};i.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};i.prototype.removeChip=function(i){var t=i.detail.id;this.internalChips=this.internalChips.filter((function(i,e){return e.toString()!==t}))};i.prototype.renderChips=function(){var i=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,e){var n=e.toString();var s=30;if(t.length<=s){return h("bds-chip-clickable",{id:n,key:n,color:"default",close:!i.disabled,onChipClickableClose:function(t){return i.removeChip(t)}},t)}else{return h("bds-tooltip",{key:n,position:"top-center","tooltip-text":t},h("bds-chip-clickable",{id:n,key:n,color:"default",close:!i.disabled,onChipClickableClose:function(t){return i.removeChip(t)}},"".concat(t.slice(0,s)," ...")))}}))};i.prototype.renderIcon=function(){return this.icon&&h("div",{class:{input__icon:true,"input__icon--large":!!this.label}},h("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};i.prototype.renderLabel=function(){return this.label&&h("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},h("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};i.prototype.renderMessage=function(){var i=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var e=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return h("div",{class:e,part:"input__message"},h("div",{class:"input__message__icon"},h("bds-icon",{size:"x-small",name:i,theme:"solid",color:"inherit"})),h("bds-typo",{variant:"fs-12"},t))}return undefined};i.prototype.render=function(){var i=this;var t=this.isPressed&&!this.disabled;return h(Host,null,h("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null},h("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":t},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper,part:"input-container"},this.renderIcon(),h("div",{class:"input__container"},this.renderLabel(),h("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&h("span",{class:"inside-input-left"},this.renderChips()),h("input",{ref:function(t){return i.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return i.handleOnBlur()},onChange:function(){return i.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),h("slot",{name:"input-right"})),this.renderMessage()))};Object.defineProperty(i,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return i}();InputChips.style=inputChipsCss;export{InputChips as bds_input_chips};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(i,t,e,n){function s(i){return i instanceof e?i:new e((function(t){t(i)}))}return new(e||(e=Promise))((function(e,r){function a(i){try{p(n.next(i))}catch(t){r(t)}}function o(i){try{p(n["throw"](i))}catch(t){r(t)}}function p(i){i.done?e(i.value):s(i.value).then(a,o)}p((n=n.apply(i,t||[])).next())}))};var __generator=this&&this.__generator||function(i,t){var e={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,s,r,a;return a={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function o(i){return function(t){return p([i,t])}}function p(o){if(n)throw new TypeError("Generator is already executing.");while(a&&(a=0,o[0]&&(e=0)),e)try{if(n=1,s&&(r=o[0]&2?s["return"]:o[0]?s["throw"]||((r=s["return"])&&r.call(s),0):s.next)&&!(r=r.call(s,o[1])).done)return r;if(s=0,r)o=[o[0]&2,r.value];switch(o[0]){case 0:case 1:r=o;break;case 4:e.label++;return{value:o[1],done:false};case 5:e.label++;s=o[1];o=[0];continue;case 7:o=e.ops.pop();e.trys.pop();continue;default:if(!(r=e.trys,r=r.length>0&&r[r.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!r||o[1]>r[0]&&o[1]<r[3])){e.label=o[1];break}if(o[0]===6&&e.label<r[1]){e.label=r[1];r=o;break}if(r&&e.label<r[2]){e.label=r[2];e.ops.push(o);break}if(r[2])e.ops.pop();e.trys.pop();continue}o=t.call(i,e)}catch(p){o=[6,p];s=0}finally{n=r=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(i,t,e){if(e||arguments.length===2)for(var n=0,s=t.length,r;n<s;n++){if(r||!(n in t)){if(!r)r=Array.prototype.slice.call(t,0,n);r[n]=t[n]}}return i.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host}from"./index-cbe64994.js";import{w as whitespaceValidation,e as emailValidation}from"./validations-6d914b78.js";var inputChipsCss='.sc-bds-input-chips-h{display:display}.element_input.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-input-chips input.sc-bds-input-chips,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-webkit-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-webkit-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-moz-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-moz-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips:-ms-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips:-ms-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-ms-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-ms-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.element_input.sc-bds-input-chips input.sc-bds-input-chips::-webkit-input-placeholder,.element_input.sc-bds-input-chips textarea.sc-bds-input-chips::-webkit-input-placeholder{color:var(--color-content-ghost, #6e7b91);opacity:1}.input.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:var(--color-surface-1, #ffffff)}.input--state-primary.sc-bds-input-chips{border:1px solid var(--color-surface-3, #e7edf4);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-input-chips:hover{border:1px solid var(--color-primary, #3f7de8);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-input-chips{border:1px solid var(--color-primary, #3f7de8);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-info, #80e3eb);box-shadow:0 0 0 2px var(--color-info, #80e3eb)}.input--state-primary.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-primary, #3f7de8);background-color:var(--color-surface-3, #e7edf4)}.input--state-primary.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-content-default, #202c44)}.input--state-primary.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-primary, #3f7de8)}.input--state-primary.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-primary, #3f7de8);color:var(--color-content-default, #202c44)}.input--state-danger.sc-bds-input-chips{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-input-chips:hover{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-input-chips{border:1px solid var(--color-delete, #ff4c4c);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-error, #ffa5a5);box-shadow:0 0 0 2px var(--color-error, #ffa5a5)}.input--state-danger.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-delete, #ff4c4c);background-color:var(--color-error, #ffa5a5)}.input--state-danger.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.input--state-danger.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.input--state-danger.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-delete, #ff4c4c);color:var(--color-delete, #ff4c4c)}.input--state-disabled.sc-bds-input-chips{cursor:not-allowed;border:1px solid var(--color-surface-3, #e7edf4);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips:hover{border:1px solid var(--color-content-disable, #505f79);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid var(--color-surface-3, #e7edf4);box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-input-chips{border:1px solid var(--color-content-disable, #505f79);-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px var(--color-surface-3, #e7edf4);box-shadow:0 0 0 2px var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips .input__icon.sc-bds-input-chips{color:var(--color-content-disable, #505f79);background-color:var(--color-surface-3, #e7edf4)}.input--state-disabled.sc-bds-input-chips .input__container__label.sc-bds-input-chips{color:var(--color-content-disable, #505f79)}.input--state-disabled.sc-bds-input-chips .input__container__label--pressed.sc-bds-input-chips{color:var(--color-content-disable, #505f79)}.input--state-disabled.sc-bds-input-chips .input__container__text.sc-bds-input-chips{caret-color:var(--color-content-disable, #505f79);color:var(--color-content-disable, #505f79)}.input--label.sc-bds-input-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-input-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-input-chips{padding:4px}.input__container.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-input-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-input-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-input-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-input-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-input-chips:focus{outline:0}.input__container__text.sc-bds-input-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-input-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-input-chips,.input__container__text[type=radio].sc-bds-input-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-input-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-input-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-input-chips,.input__container__text[type=button].sc-bds-input-chips,.input__container__text[type=submit].sc-bds-input-chips{overflow:visible}.input__container__text.sc-bds-input-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-input-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-input-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:var(--color-content-disable, #505f79);word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-input-chips bds-typo.sc-bds-input-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-input-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-input-chips{color:var(--color-delete, #ff4c4c)}.inside-input-left.sc-bds-input-chips{position:relative;display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-input-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-input-chips{-ms-flex:1;flex:1}';var InputChips=function(){function i(i){var t=this;registerInstance(this,i);this.bdsChange=createEvent(this,"bdsChange",7);this.bdsChangeChips=createEvent(this,"bdsChangeChips",7);this.bdsInputChipsFocus=createEvent(this,"bdsInputChipsFocus",7);this.bdsBlur=createEvent(this,"bdsBlur",7);this.bdsInputChipsInput=createEvent(this,"bdsInputChipsInput",7);this.bdsSubmit=createEvent(this,"bdsSubmit",7);this.onClickWrapper=function(){t.onFocus();if(t.nativeInput){t.nativeInput.focus()}};this.onFocus=function(){t.bdsInputChipsFocus.emit();t.isPressed=true};this.onInput=function(i){var e=i.target;if(e){t.value=e.value||""}t.bdsInputChipsInput.emit(i)};this.keyPressWrapper=function(i){switch(i.key){case"Enter":t.handleDelimiters();t.setChip(t.value);t.value="";break;case"Backspace":if((t.value===null||t.value.length<=0)&&t.internalChips.length){t.removeLastChip();t.bdsChangeChips.emit({data:t.internalChips})}break}};this.InputSize=null;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.chips=[];this.type="text";this.label="";this.maxlength=undefined;this.icon="";this.delimiters=/,|;/;this.errorMessage="";this.danger=false;this.value="";this.duplicated=false;this.disableSubmit=false;this.disabled=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}i.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(i){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};i.prototype.internalValueChanged=function(){this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};i.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this.validateChips()]}))}))};i.prototype.get=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){return[2,this.internalChips]}))}))};i.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.internalChips=[];this.value="";return[2]}))}))};i.prototype.add=function(i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.handleDelimiters();if(i){this.setChip(i)}else{this.setChip(this.value)}this.value="";return[2]}))}))};i.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.nativeInput.focus();return[2]}))}))};i.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(i){this.nativeInput.blur();return[2]}))}))};i.prototype.componentWillLoad=function(){this.valueChanged()};i.prototype.validateChips=function(){var i=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!i.validateChip(t)}))}else{return true}};i.prototype.handleOnBlur=function(){this.bdsBlur.emit(this.internalChips);this.isPressed=false};i.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};i.prototype.handleDelimiters=function(){var i=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var e=t.match(this.delimiters);if(!e)return;var n=this.verifyAndSubstituteDelimiters(t);if(!n){this.clearInputValues();return}var s=n.split(this.delimiters);s.forEach((function(t){i.setChip(t)}));this.clearInputValues()};i.prototype.verifyAndSubstituteDelimiters=function(i){if(i.length===1&&i[0].match(this.delimiters)){return""}var t=i.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};i.prototype.handleChange=function(i){return __awaiter(this,void 0,void 0,(function(){var t,e,n,s;var r=this;return __generator(this,(function(a){t=i.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];e=t.match(this.delimiters);if(!e)return[2];n=this.verifyAndSubstituteDelimiters(t);if(!n){this.clearInputValues();return[2]}s=n.split(this.delimiters);s.forEach((function(i){r.setChip(i)}));this.clearInputValues();return[2]}))}))};i.prototype.clearInputValues=function(i){if(i===void 0){i=""}this.nativeInput.value=i;this.value=i};i.prototype.setChip=function(i){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===i.toLowerCase()}));if(t)return}if(!whitespaceValidation(i)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[i],false)};i.prototype.validateChip=function(i){var t=i.trim();if(this.type==="email"&&emailValidation(t)){return false}return true};i.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};i.prototype.removeChip=function(i){var t=i.detail.id;this.internalChips=this.internalChips.filter((function(i,e){return e.toString()!==t}))};i.prototype.renderChips=function(){var i=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,e){var n=e.toString();var s=30;if(t.length<=s){return h("bds-chip-clickable",{id:n,key:n,color:"default",close:!i.disabled,onChipClickableClose:function(t){return i.removeChip(t)}},t)}else{return h("bds-tooltip",{key:n,position:"top-center","tooltip-text":t},h("bds-chip-clickable",{id:n,key:n,color:"default",close:!i.disabled,onChipClickableClose:function(t){return i.removeChip(t)}},"".concat(t.slice(0,s)," ...")))}}))};i.prototype.renderIcon=function(){return this.icon&&h("div",{class:{input__icon:true,"input__icon--large":!!this.label}},h("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};i.prototype.renderLabel=function(){return this.label&&h("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},h("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};i.prototype.renderMessage=function(){var i=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var e=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return h("div",{class:e,part:"input__message"},h("div",{class:"input__message__icon"},h("bds-icon",{size:"x-small",name:i,theme:"solid",color:"inherit"})),h("bds-typo",{variant:"fs-12"},t))}return undefined};i.prototype.render=function(){var i=this;var t=this.isPressed&&!this.disabled;return h(Host,null,h("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null},h("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":t},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper,part:"input-container"},this.renderIcon(),h("div",{class:"input__container"},this.renderLabel(),h("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&h("span",{class:"inside-input-left"},this.renderChips()),h("input",{ref:function(t){return i.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return i.handleOnBlur()},onChange:function(){return i.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),h("slot",{name:"input-right"})),this.renderMessage()))};Object.defineProperty(i,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return i}();InputChips.style=inputChipsCss;export{InputChips as bds_input_chips};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-cbe64994.js";var listCss=":host{display:block;width:100%}.list_item{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;padding:10px 16px}.list_item .avatar-item{display:block}.list_item .icon-item{color:#505f79}.list_item .grow-up{-ms-flex-positive:2;flex-grow:2}.list_item .content-item{display:-ms-flexbox;display:flex;gap:2px;-ms-flex-direction:column;flex-direction:column}.list_item .content-item .title-item{color:#0a0f1a}.list_item .content-item .subtitle-item{color:#6e7b91}.list_item .content-area{-ms-flex-positive:2;flex-grow:2}.list_item .content-area .internal-chips,.list_item .content-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px}.list_item .action-area .internal-actions-buttons,.list_item .action-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;color:#505f79}.clickable{cursor:pointer}.clickable:hover{background-color:#f3f6fa;mix-blend-mode:multiply}";var List=function(){function t(t){var e=this;registerInstance(this,t);this.bdsListCheckboxChange=createEvent(this,"bdsListCheckboxChange",7);this.bdsListRadioChange=createEvent(this,"bdsListRadioChange",7);this.bdsListSwitchChange=createEvent(this,"bdsListSwitchChange",7);this.bdsClickActionsButtons=createEvent(this,"bdsClickActionsButtons",7);this.itemListElement=null;this.chagedOptions=function(t){var i=t.detail;if(i.typeList=="radio"){if(i.checked==true){e.value=i}}if(i.typeList=="checkbox"){e.setSelectedCheckbox()}if(i.typeList=="switch"){e.setSelectedSwitch()}};this.onClickActionsButtons=function(t){var i=t.detail;e.bdsClickActionsButtons.emit(i)};this.internalData=undefined;this.typeList=null;this.value=undefined;this.data=undefined}t.prototype.componentWillLoad=function(){this.data&&this.dataChanged()};t.prototype.componentWillRender=function(){this.data&&this.updateData();if(!this.data){this.setitemListElement()}};t.prototype.componentDidRender=function(){if(this.data){this.internalDataChanged()}};t.prototype.dataChanged=function(){this.updateData()};t.prototype.valueChanged=function(t){this.setSelectedRadio(t)};t.prototype.internalDataChanged=function(){this.itemListElement=this.element.shadowRoot.querySelectorAll("bds-list-item")};t.prototype.setitemListElement=function(){var t=this;this.itemListElement=this.element.getElementsByTagName("bds-list-item");for(var e=0;e<this.itemListElement.length;e++){this.itemListElement[e].typeList=this.typeList;this.itemListElement[e].addEventListener("bdsChecked",(function(e){return t.chagedOptions(e)}))}};t.prototype.updateData=function(){if(this.data){if(typeof this.data==="string"){this.internalData=JSON.parse(this.data)}else{this.internalData=this.data}}};t.prototype.setSelectedRadio=function(t){var e,i,a,n,s;var o=Array.from(this.itemListElement);var l=o.filter((function(t){return t.typeList=="radio"}));for(var r=0;r<l.length;r++){if(l[r].value!=t.value){l[r].checked=false}else{var d={value:l[r].value,text:(e=l[r])===null||e===void 0?void 0:e.text,secondaryText:(i=l[r])===null||i===void 0?void 0:i.secondaryText,avatarName:(a=l[r])===null||a===void 0?void 0:a.avatarName,avatarThumbnail:(n=l[r])===null||n===void 0?void 0:n.avatarThumbnail,typeList:(s=l[r])===null||s===void 0?void 0:s.typeList};this.bdsListRadioChange.emit(d)}}};t.prototype.setSelectedCheckbox=function(){var t=this.itemListElement;var e=Array.from(t).filter((function(t){return t.typeList=="checkbox"}));var i=e.filter((function(t){return t.checked})).map((function(t){return{value:t.value,text:t===null||t===void 0?void 0:t.text,secondaryText:t===null||t===void 0?void 0:t.secondaryText,avatarName:t===null||t===void 0?void 0:t.avatarName,avatarThumbnail:t===null||t===void 0?void 0:t.avatarThumbnail,typeList:t===null||t===void 0?void 0:t.typeList}}));this.bdsListCheckboxChange.emit(i)};t.prototype.setSelectedSwitch=function(){var t=this.itemListElement;var e=Array.from(t).filter((function(t){return t.typeList=="switch"}));var i=e.filter((function(t){return t.checked})).map((function(t){return{value:t.value,text:t===null||t===void 0?void 0:t.text,secondaryText:t===null||t===void 0?void 0:t.secondaryText,avatarName:t===null||t===void 0?void 0:t.avatarName,avatarThumbnail:t===null||t===void 0?void 0:t.avatarThumbnail,typeList:t===null||t===void 0?void 0:t.typeList}}));this.bdsListSwitchChange.emit(i)};t.prototype.render=function(){var t=this;return h(Host,null,h("div",{class:{list:true}},this.internalData?this.internalData.map((function(e,i){return h("bds-list-item",{key:i,value:e.value,text:e.text,"type-list":t.typeList?t.typeList:e.typeList,"secondary-text":e.secondaryText,"avatar-name":e.avatarName,"avatar-thumbnail":e.avatarThumbnail,icon:e.icon,chips:e.chips,actionsButtons:e.actionsButtons,onBdsChecked:function(e){return t.chagedOptions(e)},onBdsClickActionButtom:function(e){return t.onClickActionsButtons(e)}})})):h("slot",null)))};Object.defineProperty(t.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{data:["dataChanged"],value:["valueChanged"],internalData:["internalDataChanged"]}},enumerable:false,configurable:true});return t}();List.style=listCss;export{List as bds_list};
|
|
1
|
+
import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-cbe64994.js";var listCss=":host{display:block;width:100%}.list_item{display:-ms-flexbox;display:flex;gap:16px;-ms-flex-align:center;align-items:center;padding:10px 16px}.list_item .avatar-item{display:block}.list_item .icon-item{color:#505f79}.list_item .grow-up{-ms-flex-positive:2;flex-grow:2}.list_item .content-item{display:-ms-flexbox;display:flex;gap:2px;-ms-flex-direction:column;flex-direction:column}.list_item .content-item .title-item{color:#0a0f1a}.list_item .content-item .subtitle-item{color:#6e7b91}.list_item .content-area{-ms-flex-positive:2;flex-grow:2}.list_item .content-area .internal-chips,.list_item .content-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px}.list_item .action-area .internal-actions-buttons,.list_item .action-area ::slotted(*){display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;color:#505f79}.clickable{cursor:pointer}.clickable:hover{background-color:#f3f6fa;mix-blend-mode:multiply}";var List=function(){function t(t){var e=this;registerInstance(this,t);this.bdsListCheckboxChange=createEvent(this,"bdsListCheckboxChange",7);this.bdsListRadioChange=createEvent(this,"bdsListRadioChange",7);this.bdsListSwitchChange=createEvent(this,"bdsListSwitchChange",7);this.bdsClickActionsButtons=createEvent(this,"bdsClickActionsButtons",7);this.itemListElement=null;this.chagedOptions=function(t){var i=t.detail;if(i.typeList=="radio"){if(i.checked==true){e.value=i}}if(i.typeList=="checkbox"){e.setSelectedCheckbox()}if(i.typeList=="switch"){e.setSelectedSwitch()}};this.onClickActionsButtons=function(t){var i=t.detail;e.bdsClickActionsButtons.emit(i)};this.internalData=undefined;this.typeList=null;this.value=undefined;this.data=undefined}t.prototype.componentWillLoad=function(){this.data&&this.dataChanged()};t.prototype.componentWillRender=function(){this.data&&this.updateData();if(!this.data){this.setitemListElement()}};t.prototype.componentDidRender=function(){if(this.data){this.internalDataChanged()}};t.prototype.dataChanged=function(){this.updateData()};t.prototype.valueChanged=function(t){this.setSelectedRadio(t)};t.prototype.internalDataChanged=function(){this.itemListElement=this.element.shadowRoot.querySelectorAll("bds-list-item")};t.prototype.setitemListElement=function(){var t=this;this.itemListElement=this.element.getElementsByTagName("bds-list-item");for(var e=0;e<this.itemListElement.length;e++){this.itemListElement[e].typeList=this.typeList;this.itemListElement[e].addEventListener("bdsChecked",(function(e){return t.chagedOptions(e)}))}};t.prototype.updateData=function(){if(this.data){if(typeof this.data==="string"){this.internalData=JSON.parse(this.data)}else{this.internalData=this.data}}};t.prototype.setSelectedRadio=function(t){var e,i,a,n,s;var o=Array.from(this.itemListElement);var l=o.filter((function(t){return t.typeList=="radio"}));for(var r=0;r<l.length;r++){if(l[r].value!=t.value){l[r].checked=false}else{var d={value:l[r].value,text:(e=l[r])===null||e===void 0?void 0:e.text,secondaryText:(i=l[r])===null||i===void 0?void 0:i.secondaryText,avatarName:(a=l[r])===null||a===void 0?void 0:a.avatarName,avatarThumbnail:(n=l[r])===null||n===void 0?void 0:n.avatarThumbnail,typeList:(s=l[r])===null||s===void 0?void 0:s.typeList};this.bdsListRadioChange.emit(d)}}};t.prototype.setSelectedCheckbox=function(){var t=this.itemListElement;var e=Array.from(t).filter((function(t){return t.typeList=="checkbox"}));var i=e.filter((function(t){return t.checked})).map((function(t){return{value:t.value,text:t===null||t===void 0?void 0:t.text,secondaryText:t===null||t===void 0?void 0:t.secondaryText,avatarName:t===null||t===void 0?void 0:t.avatarName,avatarThumbnail:t===null||t===void 0?void 0:t.avatarThumbnail,typeList:t===null||t===void 0?void 0:t.typeList}}));this.bdsListCheckboxChange.emit(i)};t.prototype.setSelectedSwitch=function(){var t=this.itemListElement;var e=Array.from(t).filter((function(t){return t.typeList=="switch"}));var i=e.filter((function(t){return t.checked})).map((function(t){return{value:t.value,text:t===null||t===void 0?void 0:t.text,secondaryText:t===null||t===void 0?void 0:t.secondaryText,avatarName:t===null||t===void 0?void 0:t.avatarName,avatarThumbnail:t===null||t===void 0?void 0:t.avatarThumbnail,typeList:t===null||t===void 0?void 0:t.typeList}}));this.bdsListSwitchChange.emit(i)};t.prototype.render=function(){var t=this;return h(Host,null,h("div",{class:{list:true}},this.internalData?this.internalData.map((function(e,i){return h("bds-list-item",{key:i,value:e.value,text:e.text,"type-list":t.typeList?t.typeList:e.typeList,"secondary-text":e.secondaryText,"avatar-name":e.avatarName,"avatar-thumbnail":e.avatarThumbnail,checked:e.checked,icon:e.icon,chips:e.chips,actionsButtons:e.actionsButtons,onBdsChecked:function(e){return t.chagedOptions(e)},onBdsClickActionButtom:function(e){return t.onClickActionsButtons(e)}})})):h("slot",null)))};Object.defineProperty(t.prototype,"element",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(t,"watchers",{get:function(){return{data:["dataChanged"],value:["valueChanged"],internalData:["internalDataChanged"]}},enumerable:false,configurable:true});return t}();List.style=listCss;export{List as bds_list};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __awaiter=this&&this.__awaiter||function(e,t,i,s){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(t){r(t)}}function a(e){try{c(s["throw"](e))}catch(t){r(t)}}function c(e){e.done?i(e.value):n(e.value).then(o,a)}c((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,n,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(s)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(s=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c];n=0}finally{s=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var s=0,n=t.length,r;s<n;s++){if(r||!(s in t)){if(!r)r=Array.prototype.slice.call(t,0,s);r[s]=t[s]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-cbe64994.js";import{w as whitespaceValidation,e as emailValidation}from"./validations-6d914b78.js";var selectCss='.sc-bds-select-chips-h{display:block}.element_input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-select-chips input.sc-bds-select-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-moz-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips:-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary.sc-bds-select-chips{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-select-chips:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-select-chips{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#3f7de8;background-color:#e8f2ff}.input--state-primary.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-primary.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#3f7de8}.input--state-primary.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#3f7de8;color:#202c44}.input--state-danger.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-select-chips:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-danger.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#ff4c4c}.input--state-danger.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#ff4c4c;color:#202c44}.input--state-disabled.sc-bds-select-chips{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled.sc-bds-select-chips:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-select-chips{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#b9cbd3;color:#b9cbd3}.input--label.sc-bds-select-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-select-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-select-chips{padding:4px}.input__container.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-select-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-select-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text.sc-bds-select-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-select-chips,.input__container__text[type=radio].sc-bds-select-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-select-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-select-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-select-chips,.input__container__text[type=button].sc-bds-select-chips,.input__container__text[type=submit].sc-bds-select-chips{overflow:visible}.input__container__text.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-select-chips bds-typo.sc-bds-select-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-select-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-select-chips{color:#ff4c4c}.select.sc-bds-select-chips{position:relative;outline:none}.select__icon.sc-bds-select-chips{color:#8ca0b3;display:-ms-flexbox;display:flex}.select__options.sc-bds-select-chips{background:#f8fbfb;width:100%;max-height:250px;position:absolute;top:99%;left:0;border-radius:8px;-webkit-box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);overflow-y:auto;z-index:2;margin-top:4px;-webkit-transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:scaleY(0);transform:scaleY(0);visibility:hidden;opacity:0;-webkit-box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4);box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4)}.select__options.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.select__options.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.select__options--open.sc-bds-select-chips{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.select__options--position-top.sc-bds-select-chips{top:auto;bottom:100%;-webkit-transform-origin:bottom left;transform-origin:bottom left}.inside-input-left.sc-bds-select-chips{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-select-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-select-chips{-ms-flex:1;flex:1}';var SelectChips=function(){function e(e){var t=this;registerInstance(this,e);this.bdsChange=createEvent(this,"bdsChange",7);this.bdsCancel=createEvent(this,"bdsCancel",7);this.bdsFocus=createEvent(this,"bdsFocus",7);this.bdsBlur=createEvent(this,"bdsBlur",7);this.bdsChangeChips=createEvent(this,"bdsChangeChips",7);this.bdsSelectChipsInput=createEvent(this,"bdsSelectChipsInput",7);this.bdsSubmit=createEvent(this,"bdsSubmit",7);this.handleChangeChipsValue=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};this.toggle=function(){if(!t.disabled){t.isOpen=!t.isOpen}};this.handler=function(e){return __awaiter(t,void 0,void 0,(function(){var t,i;return __generator(this,(function(s){switch(s.label){case 0:t=e.detail.value;i=this.getText(t);return[4,this.addChip(i)];case 1:s.sent();this.toggle();return[2]}}))}))};this.handlerNewOption=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.addChip(e)];case 1:t.sent();this.toggle();return[2]}}))}))};this.getText=function(e){var i=t.childOptions.find((function(t){return t.value===e}));return t.getTextFromOption(i)};this.getTextFromOption=function(e){var i,s;if((e===null||e===void 0?void 0:e.status)||(e===null||e===void 0?void 0:e.bulkOption)){if(t.internalOptions){var n=t.internalOptions.find((function(t){return t.value==e.value}));if(n){return n.label}}return e.querySelector("#bds-typo-label-".concat(e.value)).textContent}return(e===null||e===void 0?void 0:e.titleText)?e.titleText:(s=(i=e===null||e===void 0?void 0:e.textContent)===null||i===void 0?void 0:i.trim())!==null&&s!==void 0?s:""};this.setFocusWrapper=function(){if(t.nativeInput){t.nativeInput.focus()}};this.removeFocusWrapper=function(){t.nativeInput.blur()};this.onClickWrapper=function(){t.onFocus();if(t.nativeInput){t.nativeInput.focus()}};this.onFocus=function(){t.bdsFocus.emit();t.isPressed=true};this.onInput=function(e){var i=e.target;if(i){t.value=i.value||""}t.bdsSelectChipsInput.emit(e);t.changedInputValue()};this.keyPressWrapper=function(e){switch(e.key){case"Enter":if(t.canAddNew!==false){t.handleDelimiters();t.setChip(t.value);t.value=""}break;case"Backspace":if((t.value===null||t.value.length<=0)&&t.internalChips.length){t.removeLastChip();t.bdsChangeChips.emit({data:t.internalChips})}break}};this.changedInputValue=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.value=this.nativeInput.value;if(!this.nativeInput.value)return[3,2];return[4,this.filterOptions(this.nativeInput.value)];case 1:e.sent();return[3,4];case 2:return[4,this.resetFilterOptions()];case 3:e.sent();e.label=4;case 4:if(this.value&&this.isOpen===false){this.isOpen=true}return[2]}}))}))};this.internalOptions=undefined;this.isOpen=false;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.options=[];this.chips=[];this.newPrefix="";this.value="";this.danger=false;this.maxlength=undefined;this.errorMessage="";this.disabled=false;this.label="";this.icon="";this.duplicated=false;this.canAddNew=true;this.notFoundMessage="No results found";this.type="text";this.delimiters=/,|;/;this.disableSubmit=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}e.prototype.handleWindow=function(e){if(!this.el.contains(e.target)){this.isOpen=false}};e.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(e){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};e.prototype.internalValueChanged=function(){this.handleChangeChipsValue();this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};e.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.validateChips()]}))}))};e.prototype.getChips=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.internalChips]}))}))};e.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.internalChips=[];this.value="";return[2]}))}))};e.prototype.add=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.setChip(e);return[2]}))}))};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.focus();return[2]}))}))};e.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.blur();return[2]}))}))};e.prototype.componentWillLoad=function(){this.valueChanged()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};e.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(s){for(e=0,t=this.childOptions;e<t.length;e++){i=t[e];i.addEventListener("optionSelected",this.handler)}return[2]}))}))};Object.defineProperty(e.prototype,"childOptionsEnabled",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not([invisible]):not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});e.prototype.filterOptions=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n,r,o,a,c;return __generator(this,(function(l){switch(l.label){case 0:if(!!e)return[3,2];return[4,this.resetFilterOptions()];case 1:l.sent();return[2];case 2:t=0,i=this.childOptions;l.label=3;case 3:if(!(t<i.length))return[3,6];s=i[t];r=this.existsChip;o=[s.textContent];return[4,this.getChips()];case 4:n=r.apply(this,o.concat([l.sent()]));a=s.textContent.toLowerCase();c=e.toLowerCase();if(n){s.setAttribute("invisible","invisible")}if(e&&a.includes(c)&&!n){s.removeAttribute("invisible")}if(e&&!a.includes(c)&&!n){s.setAttribute("invisible","invisible")}l.label=5;case 5:t++;return[3,3];case 6:return[2]}}))}))};e.prototype.resetFilterOptions=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,s,n,r,o;return __generator(this,(function(a){switch(a.label){case 0:t=0,i=this.childOptions;a.label=1;case 1:if(!(t<i.length))return[3,4];s=i[t];n=(e=s.querySelector("bds-typo"))===null||e===void 0?void 0:e.textContent;r=this.existsChip;o=[n];return[4,this.getChips()];case 2:if(r.apply(this,o.concat([a.sent()]))){s.setAttribute("invisible","invisible")}else{s.removeAttribute("invisible")}a.label=3;case 3:t++;return[3,1];case 4:return[2]}}))}))};e.prototype.existsChip=function(e,t){return t.some((function(t){return e===t}))};e.prototype.enableCreateOption=function(){return!!(this.childOptionsEnabled.length===0&&this.nativeInput&&this.nativeInput.value)};e.prototype.addChip=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.setChip(e)];case 1:t.sent();this.nativeInput.value="";return[2]}}))}))};e.prototype.validateChips=function(){var e=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!e.validateChip(t)}))}else{return true}};e.prototype.handleOnBlur=function(){this.bdsBlur.emit();this.isPressed=false};e.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};e.prototype.verifyAndSubstituteDelimiters=function(e){if(e.length===1&&e[0].match(this.delimiters)){return""}var t=e.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};e.prototype.handleDelimiters=function(){var e=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var i=t.match(this.delimiters);if(!i)return;var s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return}var n=s.split(this.delimiters);n.forEach((function(t){e.setChip(t)}));this.clearInputValues()};e.prototype.handleChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n;var r=this;return __generator(this,(function(o){t=e.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];i=t.match(this.delimiters);if(!i)return[2];s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return[2]}n=s.split(this.delimiters);n.forEach((function(e){r.setChip(e)}));this.clearInputValues();return[2]}))}))};e.prototype.clearInputValues=function(e){if(e===void 0){e=""}this.nativeInput.value=e;this.value=e};e.prototype.setChip=function(e){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===e.toLowerCase()}));if(t)return}if(!whitespaceValidation(e)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[e],false)};e.prototype.validateChip=function(e){var t=e.trim();if(this.type==="email"&&emailValidation(t)){return false}return true};e.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};e.prototype.removeChip=function(e){var t=e.detail.id;this.internalChips=this.internalChips.filter((function(e,i){return i.toString()!==t}))};e.prototype.renderChips=function(){var e=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,i){var s=i.toString();var n=30;if(t.length<=n){return h("bds-chip-clickable",{id:s,key:s,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},t)}else{return h("bds-tooltip",{key:s,position:"top-center","tooltip-text":t},h("bds-chip-clickable",{id:s,key:s,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},"".concat(t.slice(0,n)," ...")))}}))};e.prototype.renderIcon=function(){return this.icon&&h("div",{class:{input__icon:true,"input__icon--large":!!this.label}},h("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};e.prototype.renderLabel=function(){return this.label&&h("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},h("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};e.prototype.renderMessage=function(){var e=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var i=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return h("div",{class:i,part:"input__message"},h("div",{class:"input__message__icon"},h("bds-icon",{size:"x-small",name:e,theme:"solid",color:"inherit"})),h("bds-typo",{variant:"fs-12"},t))}return undefined};e.prototype.generateKey=function(e){return e.toLowerCase().replace(/ /g,"-")};e.prototype.render=function(){var e=this;var t=this.isOpen?"arrow-up":"arrow-down";var i=this.isPressed&&!this.disabled;var s=[];if(this.options){if(typeof this.options==="string"){try{s=JSON.parse(this.options)}catch(n){}}else{s=this.options}}return h("div",{class:"select",tabindex:"0",onFocus:this.setFocusWrapper,onBlur:this.removeFocusWrapper,onKeyPress:this.keyPressWrapper},h("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null,onClick:this.toggle},h("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":i},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper},this.renderIcon(),h("div",{class:"input__container"},this.renderLabel(),h("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&h("span",{class:"inside-input-left"},this.renderChips()),h("input",{ref:function(t){return e.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return e.handleOnBlur()},onChange:function(){return e.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),h("div",{class:"select__icon"},h("bds-icon",{size:"small",name:t,color:"inherit"}))),this.renderMessage()),h("div",{class:{select__options:true,"select__options--open":this.isOpen}},s.map((function(t){return h("bds-select-option",{key:e.generateKey(t.value),onOptionSelected:e.handler,value:t.value,status:t.status},t.label)})),h("slot",null),this.canAddNew===true&&this.enableCreateOption()&&h("bds-select-option",{id:"option-add",value:"add",onClick:function(){return e.handlerNewOption(e.nativeInput.value)}},this.newPrefix,this.nativeInput.value),!this.canAddNew&&this.enableCreateOption()&&h("bds-select-option",{id:"no-option",value:"add"},this.notFoundMessage)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return e}();SelectChips.style=selectCss;export{SelectChips as bds_select_chips};
|
|
1
|
+
var __awaiter=this&&this.__awaiter||function(e,t,i,s){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,r){function o(e){try{c(s.next(e))}catch(t){r(t)}}function a(e){try{c(s["throw"](e))}catch(t){r(t)}}function c(e){e.done?i(e.value):n(e.value).then(o,a)}c((s=s.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},s,n,r,o;return o={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(a){if(s)throw new TypeError("Generator is already executing.");while(o&&(o=0,a[0]&&(i=0)),i)try{if(s=1,n&&(r=a[0]&2?n["return"]:a[0]?n["throw"]||((r=n["return"])&&r.call(n),0):n.next)&&!(r=r.call(n,a[1])).done)return r;if(n=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;n=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(r=i.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){i.label=a[1];break}if(a[0]===6&&i.label<r[1]){i.label=r[1];r=a;break}if(r&&i.label<r[2]){i.label=r[2];i.ops.push(a);break}if(r[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(c){a=[6,c];n=0}finally{s=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var s=0,n=t.length,r;s<n;s++){if(r||!(s in t)){if(!r)r=Array.prototype.slice.call(t,0,s);r[s]=t[s]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,g as getElement}from"./index-cbe64994.js";import{w as whitespaceValidation,e as emailValidation}from"./validations-6d914b78.js";var selectCss='.sc-bds-select-chips-h{display:block}.element_input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;position:relative;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%}.element_input.sc-bds-select-chips input.sc-bds-select-chips{-webkit-box-shadow:inherit;box-shadow:inherit}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-moz-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips:-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-ms-input-placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::placeholder{color:#b9cbd3;opacity:1}.element_input.sc-bds-select-chips input.sc-bds-select-chips::-webkit-input-placeholder{color:#b9cbd3;opacity:1}.input.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;-ms-flex-align:center;align-items:center;padding:8px 4px 9px 12px;-ms-flex:1;flex:1;width:100%;max-width:100%;max-height:100%;background:#ffffff}.input--state-primary.sc-bds-select-chips{border:1px solid #d2dfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.sc-bds-select-chips:hover{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-primary.input--pressed.sc-bds-select-chips{border:1px solid #3f7de8;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4);box-shadow:0 0 0 2px rgba(63, 125, 232, 0.4)}.input--state-primary.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#3f7de8;background-color:#e8f2ff}.input--state-primary.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-primary.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#3f7de8}.input--state-primary.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#3f7de8;color:#202c44}.input--state-danger.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.sc-bds-select-chips:hover{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px}.input--state-danger.input--pressed.sc-bds-select-chips{border:1px solid #ff4c4c;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #ffa5a5;box-shadow:0 0 0 2px #ffa5a5}.input--state-danger.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#ff4c4c;background-color:#ffa5a5}.input--state-danger.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#8ca0b3}.input--state-danger.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#ff4c4c}.input--state-danger.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#ff4c4c;color:#202c44}.input--state-disabled.sc-bds-select-chips{cursor:not-allowed;border:1px solid #e7edf4;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;background:#f3f6fa}.input--state-disabled.sc-bds-select-chips:hover{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;border:1px solid #e7edf4;box-sizing:border-box;border-radius:8px}.input--state-disabled.input--pressed.sc-bds-select-chips{border:1px solid #b9cbd3;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:8px;-webkit-box-shadow:0 0 0 2px #e7edf4;box-shadow:0 0 0 2px #e7edf4}.input--state-disabled.sc-bds-select-chips .input__icon.sc-bds-select-chips{color:#b9cbd3;background-color:#f8fbfb}.input--state-disabled.sc-bds-select-chips .input__container__label.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__label--pressed.sc-bds-select-chips{color:#b9cbd3}.input--state-disabled.sc-bds-select-chips .input__container__text.sc-bds-select-chips{caret-color:#b9cbd3;color:#b9cbd3}.input--label.sc-bds-select-chips{padding:7px 4px 8px 12px}.input__icon.sc-bds-select-chips{cursor:inherit;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;border-radius:8px;margin-right:8px;padding:2.5px}.input__icon--large.sc-bds-select-chips{padding:4px}.input__container.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:center;justify-content:center;width:100%}.input__container__wrapper.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap}.input__container__wrapper__chips.sc-bds-select-chips{display:inline;max-height:100px;overflow:auto}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__wrapper__chips.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__container__label.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.input__container__text.sc-bds-select-chips{display:inline-block;margin:0;border:0;padding:0;width:auto;vertical-align:middle;white-space:normal;line-height:inherit;background:none;color:inherit;font-size:inherit;font-family:inherit;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;width:100%;font-family:"Nunito Sans", "Tahoma", "Helvetica", "Arial", sans-serif;font-size:0.875rem;line-height:150%;resize:none;cursor:inherit}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text.sc-bds-select-chips::-webkit-file-upload-button{padding:0;border:0;background:none}.input__container__text.sc-bds-select-chips:focus{outline:0}.input__container__text[type=checkbox].sc-bds-select-chips,.input__container__text[type=radio].sc-bds-select-chips{width:13px;height:13px}.input__container__text[type=search].sc-bds-select-chips{-webkit-appearance:textfield;-webkit-box-sizing:content-box}.sc-bds-select-chips::-webkit-search-decoration{display:none}.input__container__text[type=reset].sc-bds-select-chips,.input__container__text[type=button].sc-bds-select-chips,.input__container__text[type=submit].sc-bds-select-chips{overflow:visible}.input__container__text.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.input__container__text.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.input__message.sc-bds-select-chips{display:-ms-flexbox;display:flex;-ms-flex-align:baseline;align-items:baseline;height:20px;margin:3.7px 2.5px;-webkit-transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:0.3s cubic-bezier(0.4, 0, 0.2, 1);color:#8ca0b3;word-break:break-word;height:auto;min-height:20px}.input__message.sc-bds-select-chips bds-typo.sc-bds-select-chips{margin-top:0px;-ms-flex-item-align:self-start;align-self:self-start}.input__message__icon.sc-bds-select-chips{display:-ms-flexbox;display:flex;padding-right:4px;margin-top:0px;padding-top:2px}.input__message--danger.sc-bds-select-chips{color:#ff4c4c}.select.sc-bds-select-chips{position:relative;outline:none}.select__icon.sc-bds-select-chips{color:#8ca0b3;display:-ms-flexbox;display:flex}.select__options.sc-bds-select-chips{background:#f8fbfb;width:100%;max-height:250px;position:absolute;top:99%;left:0;border-radius:8px;-webkit-box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);box-shadow:0px 2px 8px rgba(96, 123, 153, 0.3);overflow-y:auto;z-index:2;margin-top:4px;-webkit-transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s;transition:transform 0.25s, opacity 0.75s, visibility 0.75s, -webkit-transform 0.25s;-webkit-transform-origin:top left;transform-origin:top left;-webkit-transform:scaleY(0);transform:scaleY(0);visibility:hidden;opacity:0;-webkit-box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4);box-shadow:0px 2px 12px 0 2px 8px rgba(96, 123, 153, 0.4)}.select__options.sc-bds-select-chips::-webkit-scrollbar{width:16px;background-color:transparent}.select__options.sc-bds-select-chips::-webkit-scrollbar-thumb{border-radius:10px;border:4px solid transparent;border-radius:10px;background-clip:content-box;background-color:#b9cbd3}.select__options--open.sc-bds-select-chips{visibility:visible;-webkit-transform:scale(1);transform:scale(1);opacity:1}.select__options--position-top.sc-bds-select-chips{top:auto;bottom:100%;-webkit-transform-origin:bottom left;transform-origin:bottom left}.inside-input-left.sc-bds-select-chips{display:-ms-inline-flexbox;display:inline-flex;gap:8px;-ms-flex-wrap:wrap;flex-wrap:wrap;margin-right:8px}.input-chips__chip.sc-bds-select-chips{margin:2px 4px 2px 0px}.input-chips__chips.sc-bds-select-chips{-ms-flex:1;flex:1}';var SelectChips=function(){function e(e){var t=this;registerInstance(this,e);this.bdsChange=createEvent(this,"bdsChange",7);this.bdsCancel=createEvent(this,"bdsCancel",7);this.bdsFocus=createEvent(this,"bdsFocus",7);this.bdsBlur=createEvent(this,"bdsBlur",7);this.bdsChangeChips=createEvent(this,"bdsChangeChips",7);this.bdsSelectChipsInput=createEvent(this,"bdsSelectChipsInput",7);this.bdsSubmit=createEvent(this,"bdsSubmit",7);this.handleChangeChipsValue=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};this.toggle=function(){if(!t.disabled){t.isOpen=!t.isOpen}};this.handler=function(e){return __awaiter(t,void 0,void 0,(function(){var t,i;return __generator(this,(function(s){switch(s.label){case 0:t=e.detail.value;i=this.getText(t);return[4,this.addChip(i)];case 1:s.sent();this.toggle();return[2]}}))}))};this.handlerNewOption=function(e){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.addChip(e)];case 1:t.sent();this.toggle();return[2]}}))}))};this.getText=function(e){var i=t.childOptions.find((function(t){return t.value===e}));return t.getTextFromOption(i)};this.getTextFromOption=function(e){var i,s;if((e===null||e===void 0?void 0:e.status)||(e===null||e===void 0?void 0:e.bulkOption)){if(t.internalOptions){var n=t.internalOptions.find((function(t){return t.value==e.value}));if(n){return n.label}}return e.querySelector("#bds-typo-label-".concat(e.value)).textContent}return(e===null||e===void 0?void 0:e.titleText)?e.titleText:(s=(i=e===null||e===void 0?void 0:e.textContent)===null||i===void 0?void 0:i.trim())!==null&&s!==void 0?s:""};this.setFocusWrapper=function(){if(t.nativeInput){t.nativeInput.focus()}};this.removeFocusWrapper=function(){t.nativeInput.blur()};this.onClickWrapper=function(){t.onFocus();if(t.nativeInput){t.nativeInput.focus()}};this.onFocus=function(){t.bdsFocus.emit();t.isPressed=true};this.onInput=function(e){var i=e.target;if(i){t.value=i.value||""}t.bdsSelectChipsInput.emit(e);t.changedInputValue()};this.keyPressWrapper=function(e){switch(e.key){case"Enter":if(t.canAddNew!==false){t.handleDelimiters();t.setChip(t.value);t.value=""}break;case"Backspace":if((t.value===null||t.value.length<=0)&&t.internalChips.length){t.removeLastChip();t.bdsChangeChips.emit({data:t.internalChips})}break}};this.changedInputValue=function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:this.value=this.nativeInput.value;if(!this.nativeInput.value)return[3,2];return[4,this.filterOptions(this.nativeInput.value)];case 1:e.sent();return[3,4];case 2:return[4,this.resetFilterOptions()];case 3:e.sent();e.label=4;case 4:if(this.value&&this.isOpen===false){this.isOpen=true}return[2]}}))}))};this.internalOptions=undefined;this.isOpen=false;this.validationDanger=false;this.isPressed=false;this.validationMesage="";this.internalChips=[];this.options=[];this.chips=[];this.newPrefix="";this.value="";this.danger=false;this.maxlength=undefined;this.errorMessage="";this.disabled=false;this.label="";this.icon="";this.duplicated=false;this.canAddNew=true;this.notFoundMessage="No results found";this.type="text";this.delimiters=/,|;/;this.disableSubmit=false;this.helperMessage="";this.inputName="";this.placeholder="";this.dataTest=null}e.prototype.handleWindow=function(e){if(!this.el.contains(e.target)){this.isOpen=false}};e.prototype.valueChanged=function(){if(this.chips){if(typeof this.chips==="string"){try{this.internalChips=JSON.parse(this.chips)}catch(e){this.internalChips=[]}}else{this.internalChips=this.chips}}else{this.internalChips=[]}};e.prototype.internalValueChanged=function(){this.handleChangeChipsValue();this.bdsChangeChips.emit({data:this.internalChips,value:this.getLastChip()})};e.prototype.isValid=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.validateChips()]}))}))};e.prototype.getChips=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){return[2,this.internalChips]}))}))};e.prototype.clear=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.internalChips=[];this.value="";return[2]}))}))};e.prototype.add=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){this.handleDelimiters();if(e){this.setChip(e)}else{this.setChip(this.value)}this.value="";return[2]}))}))};e.prototype.setFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.focus();return[2]}))}))};e.prototype.removeFocus=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.nativeInput.blur();return[2]}))}))};e.prototype.componentWillLoad=function(){this.valueChanged()};e.prototype.componentDidLoad=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.resetFilterOptions()];case 1:e.sent();return[2]}}))}))};e.prototype.connectedCallback=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(s){for(e=0,t=this.childOptions;e<t.length;e++){i=t[e];i.addEventListener("optionSelected",this.handler)}return[2]}))}))};Object.defineProperty(e.prototype,"childOptionsEnabled",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not([invisible]):not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"childOptions",{get:function(){return Array.from(this.el.querySelectorAll("bds-select-option:not(#option-add):not(#no-option)"))},enumerable:false,configurable:true});e.prototype.filterOptions=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n,r,o,a,c;return __generator(this,(function(l){switch(l.label){case 0:if(!!e)return[3,2];return[4,this.resetFilterOptions()];case 1:l.sent();return[2];case 2:t=0,i=this.childOptions;l.label=3;case 3:if(!(t<i.length))return[3,6];s=i[t];r=this.existsChip;o=[s.textContent];return[4,this.getChips()];case 4:n=r.apply(this,o.concat([l.sent()]));a=s.textContent.toLowerCase();c=e.toLowerCase();if(n){s.setAttribute("invisible","invisible")}if(e&&a.includes(c)&&!n){s.removeAttribute("invisible")}if(e&&!a.includes(c)&&!n){s.setAttribute("invisible","invisible")}l.label=5;case 5:t++;return[3,3];case 6:return[2]}}))}))};e.prototype.resetFilterOptions=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,s,n,r,o;return __generator(this,(function(a){switch(a.label){case 0:t=0,i=this.childOptions;a.label=1;case 1:if(!(t<i.length))return[3,4];s=i[t];n=(e=s.querySelector("bds-typo"))===null||e===void 0?void 0:e.textContent;r=this.existsChip;o=[n];return[4,this.getChips()];case 2:if(r.apply(this,o.concat([a.sent()]))){s.setAttribute("invisible","invisible")}else{s.removeAttribute("invisible")}a.label=3;case 3:t++;return[3,1];case 4:return[2]}}))}))};e.prototype.existsChip=function(e,t){return t.some((function(t){return e===t}))};e.prototype.enableCreateOption=function(){return!!(this.childOptionsEnabled.length===0&&this.nativeInput&&this.nativeInput.value)};e.prototype.addChip=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.setChip(e)];case 1:t.sent();this.nativeInput.value="";return[2]}}))}))};e.prototype.validateChips=function(){var e=this;if(this.type==="email"){return!this.internalChips.some((function(t){return!e.validateChip(t)}))}else{return true}};e.prototype.handleOnBlur=function(){this.bdsBlur.emit();this.isPressed=false};e.prototype.getLastChip=function(){return this.internalChips[this.internalChips.length-1]};e.prototype.verifyAndSubstituteDelimiters=function(e){if(e.length===1&&e[0].match(this.delimiters)){return""}var t=e.replace(/;/g,",").replace(/\,+|;+/g,",");if(t[0].match(this.delimiters)){t=t.substring(1)}return t};e.prototype.handleDelimiters=function(){var e=this;var t=this.nativeInput.value;this.value=t?t.trim():"";if(t.length===0)return;var i=t.match(this.delimiters);if(!i)return;var s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return}var n=s.split(this.delimiters);n.forEach((function(t){e.setChip(t)}));this.clearInputValues()};e.prototype.handleChange=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,s,n;var r=this;return __generator(this,(function(o){t=e.detail.value;this.value=t?t.trim():"";if(t.length===0)return[2];i=t.match(this.delimiters);if(!i)return[2];s=this.verifyAndSubstituteDelimiters(t);if(!s){this.clearInputValues();return[2]}n=s.split(this.delimiters);n.forEach((function(e){r.setChip(e)}));this.clearInputValues();return[2]}))}))};e.prototype.clearInputValues=function(e){if(e===void 0){e=""}this.nativeInput.value=e;this.value=e};e.prototype.setChip=function(e){if(!this.duplicated){var t=this.internalChips.some((function(t){return t.toLowerCase()===e.toLowerCase()}));if(t)return}if(!whitespaceValidation(e)){return}this.internalChips=__spreadArray(__spreadArray([],this.internalChips,true),[e],false)};e.prototype.validateChip=function(e){var t=e.trim();if(this.type==="email"&&emailValidation(t)){return false}return true};e.prototype.removeLastChip=function(){this.internalChips=this.internalChips.slice(0,this.internalChips.length-1)};e.prototype.removeChip=function(e){var t=e.detail.id;this.internalChips=this.internalChips.filter((function(e,i){return i.toString()!==t}))};e.prototype.renderChips=function(){var e=this;if(!this.internalChips.length){return[]}return this.internalChips.map((function(t,i){var s=i.toString();var n=30;if(t.length<=n){return h("bds-chip-clickable",{id:s,key:s,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},t)}else{return h("bds-tooltip",{key:s,position:"top-center","tooltip-text":t},h("bds-chip-clickable",{id:s,key:s,color:"default",close:!e.disabled,onChipClickableClose:function(t){return e.removeChip(t)}},"".concat(t.slice(0,n)," ...")))}}))};e.prototype.renderIcon=function(){return this.icon&&h("div",{class:{input__icon:true,"input__icon--large":!!this.label}},h("bds-icon",{size:this.label?"medium":"small",name:this.icon,color:"inherit"}))};e.prototype.renderLabel=function(){return this.label&&h("label",{class:{input__container__label:true,"input__container__label--pressed":this.isPressed&&!this.disabled}},h("bds-typo",{variant:"fs-12",bold:"bold"},this.label))};e.prototype.renderMessage=function(){var e=this.danger?"error":"info";var t=this.danger?this.errorMessage:this.helperMessage;if(!t&&this.validationDanger)t=this.validationMesage;var i=this.danger||this.validationDanger?"input__message input__message--danger":"input__message";if(t){return h("div",{class:i,part:"input__message"},h("div",{class:"input__message__icon"},h("bds-icon",{size:"x-small",name:e,theme:"solid",color:"inherit"})),h("bds-typo",{variant:"fs-12"},t))}return undefined};e.prototype.generateKey=function(e){return e.toLowerCase().replace(/ /g,"-")};e.prototype.render=function(){var e=this;var t=this.isOpen?"arrow-up":"arrow-down";var i=this.isPressed&&!this.disabled;var s=[];if(this.options){if(typeof this.options==="string"){try{s=JSON.parse(this.options)}catch(n){}}else{s=this.options}}return h("div",{class:"select",tabindex:"0",onFocus:this.setFocusWrapper,onBlur:this.removeFocusWrapper,onKeyPress:this.keyPressWrapper},h("div",{class:{element_input:true},"aria-disabled":this.disabled?"true":null,onClick:this.toggle},h("div",{class:{input:true,"input--state-primary":!this.danger&&!this.validationDanger,"input--state-danger":this.danger||this.validationDanger,"input--state-disabled":this.disabled,"input--label":!!this.label,"input--pressed":i},onClick:this.onClickWrapper,onKeyDown:this.keyPressWrapper},this.renderIcon(),h("div",{class:"input__container"},this.renderLabel(),h("div",{class:{input__container__wrapper:true}},this.internalChips.length>0&&h("span",{class:"inside-input-left"},this.renderChips()),h("input",{ref:function(t){return e.nativeInput=t},class:{input__container__text:true},name:this.inputName,maxlength:this.maxlength,placeholder:this.placeholder,onInput:this.onInput,onFocus:this.onFocus,onBlur:function(){return e.handleOnBlur()},onChange:function(){return e.handleChange},value:this.value,disabled:this.disabled,"data-test":this.dataTest}))),h("div",{class:"select__icon"},h("bds-icon",{size:"small",name:t,color:"inherit"}))),this.renderMessage()),h("div",{class:{select__options:true,"select__options--open":this.isOpen}},s.map((function(t){return h("bds-select-option",{key:e.generateKey(t.value),onOptionSelected:e.handler,value:t.value,status:t.status},t.label)})),h("slot",null),this.canAddNew===true&&this.enableCreateOption()&&h("bds-select-option",{id:"option-add",value:"add",onClick:function(){return e.handlerNewOption(e.nativeInput.value)}},this.newPrefix,this.nativeInput.value),!this.canAddNew&&this.enableCreateOption()&&h("bds-select-option",{id:"no-option",value:"add"},this.notFoundMessage)))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{chips:["valueChanged"],internalChips:["internalValueChanged"]}},enumerable:false,configurable:true});return e}();SelectChips.style=selectCss;export{SelectChips as bds_select_chips};
|