@db-ux/wc-core-components 4.3.0 → 4.3.2-consolidation-7549d9f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +10 -5
- package/dist/cjs/db-custom-select.cjs.entry.js +14 -6
- package/dist/cjs/db-drawer.cjs.entry.js +13 -9
- package/dist/cjs/db-select.cjs.entry.js +6 -3
- package/dist/cjs/db-textarea.cjs.entry.js +9 -4
- package/dist/collection/components/brand/brand.js +1 -1
- package/dist/collection/components/button/button.js +3 -3
- package/dist/collection/components/checkbox/checkbox.js +1 -1
- package/dist/collection/components/custom-select/custom-select.js +16 -8
- package/dist/collection/components/custom-select-list-item/custom-select-list-item.js +1 -1
- package/dist/collection/components/drawer/drawer.js +13 -9
- package/dist/collection/components/icon/icon.js +1 -1
- package/dist/collection/components/infotext/infotext.js +1 -1
- package/dist/collection/components/input/input.js +14 -9
- package/dist/collection/components/navigation-item/navigation-item.js +1 -1
- package/dist/collection/components/notification/notification.js +1 -1
- package/dist/collection/components/select/select.js +8 -5
- package/dist/collection/components/switch/switch.js +4 -4
- package/dist/collection/components/tab-item/tab-item.js +3 -3
- package/dist/collection/components/tag/tag.js +1 -1
- package/dist/collection/components/textarea/textarea.js +10 -5
- package/dist/custom-elements.json +4 -1
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/p-39d22a0f.entry.js +1 -0
- package/dist/db-ux/p-44f2f09d.entry.js +1 -0
- package/dist/db-ux/p-75ae0fd9.entry.js +1 -0
- package/dist/db-ux/{p-40ce182c.entry.js → p-b729b29f.entry.js} +1 -1
- package/dist/db-ux/p-e7e35164.entry.js +1 -0
- package/dist/esm/db-custom-select-dropdown_5.entry.js +10 -5
- package/dist/esm/db-custom-select.entry.js +14 -6
- package/dist/esm/db-drawer.entry.js +13 -9
- package/dist/esm/db-select.entry.js +6 -3
- package/dist/esm/db-textarea.entry.js +9 -4
- package/dist/types/components/input/input.d.ts +1 -1
- package/dist/web-types.json +2 -2
- package/package.json +3 -3
- package/dist/db-ux/p-23834011.entry.js +0 -1
- package/dist/db-ux/p-3622f7e7.entry.js +0 -1
- package/dist/db-ux/p-5426dbd3.entry.js +0 -1
- package/dist/db-ux/p-86414acd.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as s,c as i}from"./p-9pYJFapZ.js";import{c as a,e as h,u as e,g as d,h as o,d as l,s as c,i as n,k as r,f as u,j as b,b as f,l as v}from"./p-BwBkekqp.js";import{l as m,g as p,h as y,j as k,f as w,k as g,b as x,a as $,m as _}from"./p-BdL-nI5y.js";import{c as F}from"./p-Cb-k135w.js";const C=class{constructor(s){t(this,s),this.width="fixed"}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-custom-select-dropdown")}render(){return s("article",{key:"98087cc1db985bbb2e2578cb9e2c78bc3a0c3b23",class:a("db-custom-select-dropdown db-card",this.className),"data-spacing":"none",ref:t=>{this._ref=t},id:this.id,"data-width":this.width},s("slot",{key:"25bcaa79bdf8168feffce0a59c0adbc656023e64"}))}},L=class{constructor(s){t(this,s)}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-custom-select-list")}render(){return s("div",{key:"f47e219aac45d07e958a94969205260af981bcf1",class:a("db-custom-select-list",this.className),role:this.multiple?"group":"radiogroup","aria-label":this.label,ref:t=>{this._ref=t},id:this.id},s("ul",{key:"adca0d159ec4cd5d2dc46f11fe41006276dba94f"},s("slot",{key:"abb6edfb683a3e4a42512b2185854099c66f1f3c"})))}},A=class{constructor(s){t(this,s),this.change=i(this,"change"),this._id=void 0,this.hasDivider=!1}handleChange(t){t.stopPropagation(),this.change&&this.change.emit(t)}getIconTrailing(){if(!this.isGroupTitle&&"checkbox"!==this.type)return h(this.checked,"checked")?"check":"x_placeholder"}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}watch0Fn(){this.hasDivider=Boolean(this.isGroupTitle||this.showDivider)}watch0(){this.watch0Fn()}componentDidLoad(){var t;this.enableAttributePassing(this._ref,"db-custom-select-list-item"),this._id=null!==(t=this.id)&&void 0!==t?t:`custom-select-list-item-${e()}`,this.watch0Fn()}render(){return s("li",{key:"d94821da8bf1842933f6518079c9e463459bed2b",class:a("db-custom-select-list-item",this.className,{"db-checkbox":"checkbox"===this.type&&!this.isGroupTitle,"db-radio":"checkbox"!==this.type&&!this.isGroupTitle}),ref:t=>{this._ref=t},id:this._id,"data-divider":d(this.hasDivider)},this.isGroupTitle?s("span",null,this.groupTitle):s("label",{"data-icon":"checkbox"!==this.type&&this.icon?this.icon:void 0,"data-show-icon":d(this.showIcon),"data-icon-trailing":this.getIconTrailing()},s("input",{class:"db-custom-select-list-item-checkbox","data-disable-focus":"true",type:this.type,name:this.name,form:this.name,checked:h(this.checked,"checked"),disabled:h(this.disabled,"disabled"),value:this.value,onChange:t=>this.handleChange(t)}),this.label?this.label:s("slot",null)))}static get watchers(){return{isGroupTitle:[{watch0:0}],showDivider:[{watch0:0}]}}},B=class{constructor(s){t(this,s),this.input=i(this,"input"),this.change=i(this,"change"),this.blur=i(this,"blur"),this.focus=i(this,"focus"),this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._dataListId=void 0,this._descByIds=void 0,this._value="",this._voiceOverFallback="",this.abortController=void 0}hasValidState(){var t;return!!(null!==(t=this.validMessage)&&void 0!==t?t:"valid"===this.validation)}handleValidation(){var t,s,i,a;(null===(t=this._ref)||void 0===t?void 0:t.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(i=this._ref)||void 0===i?void 0:i.validity.valid)&&(this.required||this.minLength||this.maxLength||this.pattern)?(this._descByIds=this._validMessageId,o()&&(this._voiceOverFallback=null!==(a=this.validMessage)&&void 0!==a?a:g,l((()=>this._voiceOverFallback=""),1e3))):this._descByIds=c(this.message,this.showMessage)?this._messageId:void 0:(this._descByIds=this._invalidMessageId,this._invalidMessage=this.invalidMessage||(null===(s=this._ref)||void 0===s?void 0:s.validationMessage)||m,o()&&(this._voiceOverFallback=this._invalidMessage,l((()=>this._voiceOverFallback=""),1e3)))}handleInput(t,s){this.input&&this.input.emit(t),this.handleValidation()}handleChange(t,s){this.change&&this.change.emit(t),this.handleValidation()}handleBlur(t){this.blur&&this.blur.emit(t)}handleFocus(t){this.focus&&this.focus.emit(t)}getDataList(){const t=this.dataList;return Array.from((n(t)?null==t?void 0:t.map((t=>({value:t,label:void 0}))):t)||[])}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}watch0Fn(){var t;this._invalidMessage=this.invalidMessage||(null===(t=this._ref)||void 0===t?void 0:t.validationMessage)||m}watch0(){this.watch0Fn()}watch1Fn(){var t;if(this._id){const s=this._id+w;this._messageId=s,this._validMessageId=this._id+p,this._invalidMessageId=this._id+y,this._dataListId=null!==(t=this.dataListId)&&void 0!==t?t:this._id+k,c(this.message,this.showMessage)&&(this._descByIds=s),this.handleValidation()}}watch1(){this.watch1Fn()}watch2Fn(){void 0!==this.value&&(this._value=this.value)}watch2(){this.watch2Fn()}watch3Fn(){if(this._ref){const t=void 0;let s=this.abortController;s||(s=new AbortController,this.abortController=s),F(this._ref,{value:this.value,defaultValue:t},(t=>{this.handleChange(t,!0),this.handleInput(t,!0)}),s.signal)}}watch3(){this.watch3Fn()}componentDidLoad(){var t;this.enableAttributePassing(this._ref,"db-input");const s=null!==(t=this.id)&&void 0!==t?t:`input-${e()}`;this._id=s,this._messageId=s+w,this._validMessageId=s+p,this._invalidMessageId=s+y,this._dataListId=s+k,this._invalidMessage=this.invalidMessage||m,this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn()}disconnectedCallback(){var t;null===(t=this.abortController)||void 0===t||t.abort()}render(){var t,i,e,o,l,n,m,p;return s("div",{key:"2783a6e0005baac376a9cd75d0f468c3f55c5f0c",class:a("db-input",this.className),"data-variant":this.variant,"data-hide-label":v(this.showLabel),"data-show-icon":d(null!==(t=this.showIconLeading)&&void 0!==t?t:this.showIcon),"data-icon":null!==(i=this.iconLeading)&&void 0!==i?i:this.icon,"data-icon-trailing":this.iconTrailing,"data-hide-asterisk":v(this.showRequiredAsterisk),"data-show-icon-trailing":d(this.showIconTrailing)},s("label",{key:"0a1b84ca8f479e931f7f2a3506fd158dfaeb5396",htmlFor:this._id},null!==(e=this.label)&&void 0!==e?e:$),s("input",{key:"a30aadb4b840d8b31b9484a2401160469301b6cf","aria-invalid":"invalid"===this.validation,"data-custom-validity":this.validation,"data-field-sizing":this.fieldSizing,ref:t=>{this._ref=t},id:this._id,name:this.name,type:this.type||"text",multiple:h(this.multiple,"multiple"),placeholder:null!==(o=this.placeholder)&&void 0!==o?o:x,disabled:h(this.disabled,"disabled"),required:h(this.required,"required"),step:b(this.step),value:null!==(l=this.value)&&void 0!==l?l:this._value,maxLength:u(this.maxLength,this.maxlength),minLength:u(this.minLength,this.minlength),max:r(this.max,this.type),min:r(this.min,this.type),readOnly:h(this.readOnly,"readOnly")||h(this.readonly,"readonly"),form:this.form,pattern:this.pattern,size:this.size,autoComplete:this.autocomplete,autoFocus:h(this.autofocus,"autofocus"),enterKeyHint:this.enterkeyhint,inputMode:this.inputmode,onInput:t=>this.handleInput(t),onChange:t=>this.handleChange(t),onBlur:t=>this.handleBlur(t),onFocus:t=>this.handleFocus(t),list:this.dataList&&this._dataListId,"aria-describedby":null!==(n=this.ariaDescribedBy)&&void 0!==n?n:this._descByIds,role:["datetime-local","date","time","week","month","color"].includes(null!==(m=this.type)&&void 0!==m?m:"")&&f()?"textbox":void 0}),this.dataList?s("datalist",{id:this._dataListId},null===(p=this.getDataList())||void 0===p?void 0:p.map((t=>s("option",{key:this._dataListId+"-option-"+t.value,value:t.value},t.label)))):null,s("slot",{key:"8a188730a5219b5611c55ce3527165223e080492"}),c(this.message,this.showMessage)?s("db-infotext",{size:this.messageSize||"small",icon:this.messageIcon,id:this._messageId},this.message):null,this.hasValidState()?s("db-infotext",{semantic:"successful",id:this._validMessageId,size:this.validMessageSize||"small"},this.validMessage||g):null,s("db-infotext",{key:"f8782431777d7a7af3c6e6069ad87b5e933686ba",semantic:"critical",id:this._invalidMessageId,size:this.invalidMessageSize||"small"},this._invalidMessage),s("span",{key:"651068b04f3f87c7129782c212eebbfca027cda6","data-visually-hidden":"true",role:"status"},this._voiceOverFallback))}static get watchers(){return{_ref:[{watch0:0},{watch3:0}],invalidMessage:[{watch0:0}],_id:[{watch1:0}],value:[{watch2:0}]}}},D=class{constructor(s){t(this,s),this.remove=i(this,"remove")}handleRemove(t){t&&(t.stopPropagation(),this.remove&&this.remove.emit(t))}getRemoveButtonText(){return this.removeButton?this.removeButton:_}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-tag")}render(){var t;return s("div",{key:"db86fabfde3f9d1e41a863f58db34eb88d067440",class:a("db-tag",this.className),ref:t=>{this._ref=t},id:this.id,"data-semantic":this.semantic,"data-emphasis":this.emphasis,"data-icon":this.icon,"data-show-check-state":d(null===(t=this.showCheckState)||void 0===t||t),"data-show-icon":d(this.showIcon),"data-no-text":d(this.noText),"data-overflow":d(this.overflow)},s("slot",{key:"1bef11e30ca670fa5bf1d438cd12c43e233cded4",name:"content"}),s("slot",{key:"3f94141f60688d0730478711748fa9dbb194f810"}),this.text?this.text:null,"removable"===this.behavior?s("button",{class:"db-button db-tab-remove-button","data-icon":"cross","data-size":"small","data-no-text":"true","data-variant":"ghost",type:"button",onClick:t=>this.handleRemove(t)},s("db-tooltip",{variant:"label"},this.getRemoveButtonText())):null)}};export{C as db_custom_select_dropdown,L as db_custom_select_list,A as db_custom_select_list_item,B as db_input,D as db_tag}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,c as t,h as s,F as h}from"./p-9pYJFapZ.js";import{l as a,g as l,h as e,f as d,i as o,k as n,a as c}from"./p-BdL-nI5y.js";import{h as r,d as v,s as u,u as b,e as f,g as p,l as m,c as w}from"./p-BwBkekqp.js";import{c as k}from"./p-Cb-k135w.js";const y=class{constructor(s){i(this,s),this.click=t(this,"click"),this.input=t(this,"input"),this.change=t(this,"change"),this.blur=t(this,"blur"),this.focus=t(this,"focus"),this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._placeholderId="",this._descByIds=void 0,this._value="",this.initialized=!1,this._voiceOverFallback="",this.abortController=void 0}hasValidState(){var i;return!!(null!==(i=this.validMessage)&&void 0!==i?i:"valid"===this.validation)}handleValidation(){var i,t,s,h;(null===(i=this._ref)||void 0===i?void 0:i.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(s=this._ref)||void 0===s?void 0:s.validity.valid)&&this.required?(this._descByIds=this._validMessageId,r()&&(this._voiceOverFallback=null!==(h=this.validMessage)&&void 0!==h?h:n,v((()=>this._voiceOverFallback=""),1e3))):this._descByIds=u(this.message,this.showMessage)?this._messageId:this.placeholder?this._placeholderId:void 0:(this._descByIds=this._invalidMessageId,this._invalidMessage=this.invalidMessage||(null===(t=this._ref)||void 0===t?void 0:t.validationMessage)||a,r()&&(this._voiceOverFallback=this._invalidMessage,v((()=>this._voiceOverFallback=""),1e3)))}handleClick(i){this.click&&this.click.emit(i)}handleInput(i,t){this.input&&this.input.emit(i),this.handleValidation()}handleChange(i,t){this.change&&this.change.emit(i),this.handleValidation()}handleBlur(i){this.blur&&this.blur.emit(i)}handleFocus(i){this.focus&&this.focus.emit(i)}getOptionLabel(i){var t,s;return null!==(t=i.label)&&void 0!==t?t:null===(s=i.value)||void 0===s?void 0:s.toString()}enableAttributePassing(i,t){const s=null==i?void 0:i.closest(t);if(i&&s){const t=s.attributes;for(let h=0;h<t.length;h++){const a=t.item(h);if(a&&(a.name.startsWith("data-")||a.name.startsWith("aria-"))&&(i.setAttribute(a.name,a.value),s.removeAttribute(a.name)),a&&"class"===a.name){const t=a.value.includes("hydrated"),h=a.value.replace("hydrated","").trim(),l=i.getAttribute("class");i.setAttribute(a.name,`${l?`${l} `:""}${h}`),t?s.setAttribute("class","hydrated"):s.removeAttribute(a.name)}}}}watch0Fn(){var i;this._invalidMessage=this.invalidMessage||(null===(i=this._ref)||void 0===i?void 0:i.validationMessage)||a}watch0(){this.watch0Fn()}watch1Fn(){if(this._id&&this.initialized){const i=this._id+d,t=this._id+o;this._messageId=i,this._validMessageId=this._id+l,this._invalidMessageId=this._id+e,this._placeholderId=t,this._descByIds=u(this.message,this.showMessage)?i:this.placeholder?t:void 0,this.handleValidation(),this.initialized=!1}}watch1(){this.watch1Fn()}watch2Fn(){this._value=this.value}watch2(){this.watch2Fn()}watch3Fn(){if(this._ref){const i=void 0;let t=this.abortController;t||(t=new AbortController,this.abortController=t),k(this._ref,{value:this.value,defaultValue:i},(i=>{this.handleChange(i,!0),this.handleInput(i,!0)}),t.signal)}}watch3(){this.watch3Fn()}componentDidLoad(){var i;this.enableAttributePassing(this._ref,"db-select"),this.initialized=!0;const t=null!==(i=this.id)&&void 0!==i?i:`select-${b()}`;this._id=t,this._messageId=t+d,this._validMessageId=t+l,this._invalidMessageId=t+e,this._placeholderId=t+o,this._invalidMessage=this.invalidMessage||a,this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn()}disconnectedCallback(){var i;null===(i=this.abortController)||void 0===i||i.abort()}render(){var i,t,a,l,e;return s("div",{key:"
|
|
1
|
+
import{r as i,c as t,h as s,F as h}from"./p-9pYJFapZ.js";import{l as a,g as l,h as e,f as d,i as o,k as n,a as c}from"./p-BdL-nI5y.js";import{h as r,d as v,s as u,u as b,e as f,g as p,l as m,c as w}from"./p-BwBkekqp.js";import{c as k}from"./p-Cb-k135w.js";const y=class{constructor(s){i(this,s),this.click=t(this,"click"),this.input=t(this,"input"),this.change=t(this,"change"),this.blur=t(this,"blur"),this.focus=t(this,"focus"),this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._placeholderId="",this._descByIds=void 0,this._value="",this.initialized=!1,this._voiceOverFallback="",this.abortController=void 0}hasValidState(){var i;return!!(null!==(i=this.validMessage)&&void 0!==i?i:"valid"===this.validation)}handleValidation(){var i,t,s,h;(null===(i=this._ref)||void 0===i?void 0:i.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(s=this._ref)||void 0===s?void 0:s.validity.valid)&&this.required?(this._descByIds=this._validMessageId,r()&&(this._voiceOverFallback=null!==(h=this.validMessage)&&void 0!==h?h:n,v((()=>this._voiceOverFallback=""),1e3))):this._descByIds=u(this.message,this.showMessage)?this._messageId:this.placeholder?this._placeholderId:void 0:(this._descByIds=this._invalidMessageId,this._invalidMessage=this.invalidMessage||(null===(t=this._ref)||void 0===t?void 0:t.validationMessage)||a,r()&&(this._voiceOverFallback=this._invalidMessage,v((()=>this._voiceOverFallback=""),1e3)))}handleClick(i){this.click&&this.click.emit(i)}handleInput(i,t){this.input&&this.input.emit(i),this.handleValidation()}handleChange(i,t){this.change&&this.change.emit(i),this.handleValidation()}handleBlur(i){this.blur&&this.blur.emit(i)}handleFocus(i){this.focus&&this.focus.emit(i)}getOptionLabel(i){var t,s;return null!==(t=i.label)&&void 0!==t?t:null===(s=i.value)||void 0===s?void 0:s.toString()}enableAttributePassing(i,t){const s=null==i?void 0:i.closest(t);if(i&&s){const t=s.attributes;for(let h=0;h<t.length;h++){const a=t.item(h);if(a&&(a.name.startsWith("data-")||a.name.startsWith("aria-"))&&(i.setAttribute(a.name,a.value),s.removeAttribute(a.name)),a&&"class"===a.name){const t=a.value.includes("hydrated"),h=a.value.replace("hydrated","").trim(),l=i.getAttribute("class");i.setAttribute(a.name,`${l?`${l} `:""}${h}`),t?s.setAttribute("class","hydrated"):s.removeAttribute(a.name)}}}}watch0Fn(){var i;this._invalidMessage=this.invalidMessage||(null===(i=this._ref)||void 0===i?void 0:i.validationMessage)||a}watch0(){this.watch0Fn()}watch1Fn(){if(this._id&&this.initialized){const i=this._id+d,t=this._id+o;this._messageId=i,this._validMessageId=this._id+l,this._invalidMessageId=this._id+e,this._placeholderId=t,this._descByIds=u(this.message,this.showMessage)?i:this.placeholder?t:void 0,this.handleValidation(),this.initialized=!1}}watch1(){this.watch1Fn()}watch2Fn(){this._value=this.value}watch2(){this.watch2Fn()}watch3Fn(){if(this._ref){const i=void 0;let t=this.abortController;t||(t=new AbortController,this.abortController=t),k(this._ref,{value:this.value,defaultValue:i},(i=>{this.handleChange(i,!0),this.handleInput(i,!0)}),t.signal)}}watch3(){this.watch3Fn()}componentDidLoad(){var i;this.enableAttributePassing(this._ref,"db-select"),this.initialized=!0;const t=null!==(i=this.id)&&void 0!==i?i:`select-${b()}`;this._id=t,this._messageId=t+d,this._validMessageId=t+l,this._invalidMessageId=t+e,this._placeholderId=t+o,this._invalidMessage=this.invalidMessage||a,this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn()}disconnectedCallback(){var i;null===(i=this.abortController)||void 0===i||i.abort()}render(){var i,t,a,l,e;return s("div",{key:"0139805ef7af1df0231794b1214fb861e6564247",class:w("db-select",this.className),"data-variant":this.variant,"data-hide-label":m(this.showLabel),"data-hide-asterisk":m(this.showRequiredAsterisk),"data-icon":this.icon,"data-show-icon":p(this.showIcon)},s("label",{key:"32f2bbc5b919c3450c33f6e18a5da5826da7aa11",htmlFor:this._id},null!==(i=this.label)&&void 0!==i?i:c),s("select",{key:"b5f973899ce6d4dd1d1de822a41dd4035cc08757","aria-invalid":"invalid"===this.validation,"data-custom-validity":this.validation,ref:i=>{this._ref=i},required:f(this.required,"required"),disabled:f(this.disabled,"disabled"),id:this._id,name:this.name,size:this.size,value:null!==(t=this.value)&&void 0!==t?t:this._value,autocomplete:this.autocomplete,multiple:this.multiple,onInput:i=>this.handleInput(i),onClick:i=>this.handleClick(i),onChange:i=>this.handleChange(i),onBlur:i=>this.handleBlur(i),onFocus:i=>this.handleFocus(i),"aria-describedby":null!==(a=this.ariaDescribedBy)&&void 0!==a?a:this._descByIds},"floating"===this.variant||this.placeholder?s("option",{class:"placeholder",value:""}):null,(null===(l=this.options)||void 0===l?void 0:l.length)?null===(e=this.options)||void 0===e?void 0:e.map((i=>{var t;return s(h,null,i.options?s("optgroup",{label:this.getOptionLabel(i),key:void 0},null===(t=i.options)||void 0===t?void 0:t.map((i=>s("option",{value:i.value,selected:i.selected,disabled:i.disabled,key:void 0},this.getOptionLabel(i))))):s("option",{value:i.value,disabled:i.disabled,selected:i.selected,key:void 0},this.getOptionLabel(i)))})):s("slot",null)),this.placeholder?s("span",{class:"db-select-placeholder",id:this._placeholderId},this.placeholder):null,u(this.message,this.showMessage)?s("db-infotext",{size:"small",icon:this.messageIcon,id:this._messageId},this.message):null,this.hasValidState()?s("db-infotext",{size:"small",semantic:"successful",id:this._validMessageId},this.validMessage||n):null,s("db-infotext",{key:"8b6c170210a55708f2539f46bd599a47a9e81781",size:"small",semantic:"critical",id:this._invalidMessageId},this._invalidMessage),s("span",{key:"17de2c472570dce406b18eeac924c0c88446ce6d","data-visually-hidden":"true",role:"status"},this._voiceOverFallback))}static get watchers(){return{_ref:[{watch0:0},{watch3:0}],invalidMessage:[{watch0:0}],_id:[{watch1:0}],initialized:[{watch1:0}],value:[{watch2:0}]}}};export{y as db_select}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as s,h as a}from"./p-9pYJFapZ.js";import{s as i}from"./p-BdL-nI5y.js";import{o as e,d,g as h,c}from"./p-BwBkekqp.js";const o=class{constructor(a){t(this,a),this.close=s(this,"close"),this.initialized=!1}handleClose(t,s){var a;t&&(e(t)?"Escape"===t.key&&(t.preventDefault(),this.close&&this.close.emit(t)):(s&&(t.stopPropagation(),this.close&&this.close.emit(t)),"DIALOG"===(null===(a=t.target)||void 0===a?void 0:a.nodeName)&&"click"===t.type&&"none"!==this.backdrop&&this.close&&this.close.emit(t)))}handleDialogOpen(){if(this._ref){const t=Boolean(this.open);t&&!this._ref.open&&(this.dialogContainerRef&&this.dialogContainerRef.removeAttribute("data-transition"),"absolute"===this.position||"none"===this.backdrop||"inside"===this.variant?this._ref.show():this._ref.showModal(),d((()=>{this.dialogContainerRef&&(this.dialogContainerRef.dataset.transition="open")}),1)),!t&&this._ref.open&&(this.dialogContainerRef&&(this.dialogContainerRef.dataset.transition="close"),d((()=>{var t;null===(t=this._ref)||void 0===t||t.close()}),401))}}enableAttributePassing(t,s){const a=null==t?void 0:t.closest(s);if(t&&a){const s=a.attributes;for(let i=0;i<s.length;i++){const e=s.item(i);if(e&&(e.name.startsWith("data-")||e.name.startsWith("aria-"))&&(t.setAttribute(e.name,e.value),a.removeAttribute(e.name)),e&&"class"===e.name){const s=e.value.includes("hydrated"),i=e.value.replace("hydrated","").trim(),d=t.getAttribute("class");t.setAttribute(e.name,`${d?`${d} `:""}${i}`),s?a.setAttribute("class","hydrated"):a.removeAttribute(e.name)}}}}watch0Fn(){this.handleDialogOpen()}watch0(){this.watch0Fn()}watch1Fn(){if(this._ref&&this.initialized&&"absolute"===this.position){const t=this._ref.parentElement;t&&(t.style.position="relative")}}watch1(){this.watch1Fn()}componentDidLoad(){this.enableAttributePassing(this._ref,"db-drawer"),this.handleDialogOpen(),this.initialized=!0,this.watch0Fn(),this.watch1Fn()}render(){var t;return a("dialog",{key:"171c5580c99bbe2d2ea0a6e8e5962e4132d9b07f",class:"db-drawer",id:this.id,ref:t=>{this._ref=t},onClick:t=>this.handleClose(t),onKeyDown:t=>this.handleClose(t),"data-position":this.position,"data-backdrop":this.backdrop,"data-direction":this.direction,"data-variant":this.variant},a("article",{key:"e9fad39beff3e642ad13be4950bb64fd15896f80",class:c("db-drawer-container",this.className),ref:t=>{this.dialogContainerRef=t},"data-spacing":this.spacing,"data-width":this.width,"data-direction":this.direction,"data-rounded":h(this.rounded)},a("header",{key:"cb9f374f26ebca0f11d02081c28e856cc87107c3",class:"db-drawer-header"},a("div",{key:"7fca8037c16e16d909bcede75e223f38ae019453",class:"db-drawer-header-text"},a("slot",{key:"85159cc4d260fa992bfe8b933920ae286b9ab09c",name:"drawerHeader"})),a("db-button",{key:"4a9ad6ba576480b154614da72752421a8ff81df6",class:"button-close-drawer",icon:"cross",variant:"ghost",id:this.closeButtonId,noText:!0,onClick:t=>this.handleClose(t,!0)},null!==(t=this.closeButtonText)&&void 0!==t?t:i)),a("div",{key:"9dbbd6a3835dad60dea79a9b2fbed6a62dd6b837",class:"db-drawer-content"},a("slot",{key:"1bc4b88266e6d7250d0075e2405b725ad38b950e"}))))}static get watchers(){return{open:[{watch0:0}],_ref:[{watch1:0}],initialized:[{watch1:0}],position:[{watch1:0}]}}};export{o as db_drawer}
|
|
@@ -191,7 +191,7 @@ const DBInput = class {
|
|
|
191
191
|
this._invalidMessage = undefined;
|
|
192
192
|
this._dataListId = undefined;
|
|
193
193
|
this._descByIds = undefined;
|
|
194
|
-
this._value =
|
|
194
|
+
this._value = "";
|
|
195
195
|
this._voiceOverFallback = "";
|
|
196
196
|
this.abortController = undefined;
|
|
197
197
|
}
|
|
@@ -321,13 +321,18 @@ const DBInput = class {
|
|
|
321
321
|
this.watch1Fn();
|
|
322
322
|
}
|
|
323
323
|
watch2Fn() {
|
|
324
|
-
this.
|
|
324
|
+
if (this.value !== undefined) {
|
|
325
|
+
this._value = this.value;
|
|
326
|
+
}
|
|
325
327
|
}
|
|
326
328
|
watch2() {
|
|
327
329
|
this.watch2Fn();
|
|
328
330
|
}
|
|
329
331
|
watch3Fn() {
|
|
330
|
-
|
|
332
|
+
// If angular uses ngModel value and _value are null
|
|
333
|
+
// then the value will be set afterward and the _ref will be refreshed
|
|
334
|
+
const addResetListener = true;
|
|
335
|
+
if (this._ref && addResetListener) {
|
|
331
336
|
const defaultValue = undefined;
|
|
332
337
|
let controller = this.abortController;
|
|
333
338
|
if (!controller) {
|
|
@@ -367,7 +372,7 @@ const DBInput = class {
|
|
|
367
372
|
}
|
|
368
373
|
render() {
|
|
369
374
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
370
|
-
return (h("div", { key: '
|
|
375
|
+
return (h("div", { key: '2783a6e0005baac376a9cd75d0f468c3f55c5f0c', class: cls("db-input", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-show-icon": getBooleanAsString((_a = this.showIconLeading) !== null && _a !== void 0 ? _a : this.showIcon), "data-icon": (_b = this.iconLeading) !== null && _b !== void 0 ? _b : this.icon, "data-icon-trailing": this.iconTrailing, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing) }, h("label", { key: '0a1b84ca8f479e931f7f2a3506fd158dfaeb5396', htmlFor: this._id }, (_c = this.label) !== null && _c !== void 0 ? _c : DEFAULT_LABEL), h("input", { key: 'a30aadb4b840d8b31b9484a2401160469301b6cf', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
|
|
371
376
|
this._ref = el;
|
|
372
377
|
}, id: this._id, name: this.name, type: this.type || "text", multiple: getBoolean(this.multiple, "multiple"), placeholder: (_d = this.placeholder) !== null && _d !== void 0 ? _d : DEFAULT_PLACEHOLDER, disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), step: getStep(this.step), value: (_e = this.value) !== null && _e !== void 0 ? _e : this._value, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), max: getInputValue(this.max, this.type), min: getInputValue(this.min, this.type), readOnly: getBoolean(this.readOnly, "readOnly") ||
|
|
373
378
|
getBoolean(this.readonly, "readonly"), form: this.form, pattern: this.pattern, size: this.size, autoComplete: this.autocomplete, autoFocus: getBoolean(this.autofocus, "autofocus"), enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), list: this.dataList && this._dataListId, "aria-describedby": (_f = this.ariaDescribedBy) !== null && _f !== void 0 ? _f : this._descByIds, role: [
|
|
@@ -379,7 +384,7 @@ const DBInput = class {
|
|
|
379
384
|
"color",
|
|
380
385
|
].includes((_g = this.type) !== null && _g !== void 0 ? _g : "") && isIOSSafari()
|
|
381
386
|
? "textbox"
|
|
382
|
-
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: '
|
|
387
|
+
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: '8a188730a5219b5611c55ce3527165223e080492' }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: this.messageSize || "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { semantic: "successful", id: this._validMessageId, size: this.validMessageSize || "small" }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: 'f8782431777d7a7af3c6e6069ad87b5e933686ba', semantic: "critical", id: this._invalidMessageId, size: this.invalidMessageSize || "small" }, this._invalidMessage), h("span", { key: '651068b04f3f87c7129782c212eebbfca027cda6', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
383
388
|
}
|
|
384
389
|
static get watchers() { return {
|
|
385
390
|
"_ref": [{
|
|
@@ -284,7 +284,7 @@ const DBCustomSelect = class {
|
|
|
284
284
|
event.preventDefault();
|
|
285
285
|
}
|
|
286
286
|
handleKeyboardPress(event) {
|
|
287
|
-
var _a, _b;
|
|
287
|
+
var _a, _b, _c;
|
|
288
288
|
event.stopPropagation();
|
|
289
289
|
if (event.key === "Escape" && ((_a = this.detailsRef) === null || _a === void 0 ? void 0 : _a.open)) {
|
|
290
290
|
this.handleClose(undefined, true);
|
|
@@ -299,6 +299,14 @@ const DBCustomSelect = class {
|
|
|
299
299
|
activeElement.click();
|
|
300
300
|
event.preventDefault();
|
|
301
301
|
}
|
|
302
|
+
else if (activeElement.getAttribute("type") === "search") {
|
|
303
|
+
// When Enter is pressed in search field, select the first available option
|
|
304
|
+
const firstOption = (_c = this._options) === null || _c === void 0 ? void 0 : _c.find((opt) => !opt.isGroupTitle && !opt.disabled);
|
|
305
|
+
if (firstOption === null || firstOption === void 0 ? void 0 : firstOption.value) {
|
|
306
|
+
this.handleSelect(firstOption.value);
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
302
310
|
}
|
|
303
311
|
}
|
|
304
312
|
else if (event.key === "ArrowDown" ||
|
|
@@ -763,19 +771,19 @@ const DBCustomSelect = class {
|
|
|
763
771
|
}
|
|
764
772
|
render() {
|
|
765
773
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
766
|
-
return (h("div", { key: '
|
|
774
|
+
return (h("div", { key: '5ab3c80f3af53b7795e709feaea160e4aa26f281', class: cls("db-custom-select", this.className), id: this._id, ref: (el) => {
|
|
767
775
|
this._ref = el;
|
|
768
776
|
}, "aria-invalid": this._validity === "invalid", "data-custom-validity": this._validity, "data-width": this.formFieldWidth, "data-variant": this.variant === "floating" &&
|
|
769
777
|
this.selectedType === "tag" &&
|
|
770
778
|
this.multiple
|
|
771
779
|
? "above"
|
|
772
|
-
: this.variant, "data-required": getBooleanAsString(this.required), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon) }, h("label", { key: '
|
|
780
|
+
: this.variant, "data-required": getBooleanAsString(this.required), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon) }, h("label", { key: '281d6b75a9ae62b6e2f59c04876603988366952d', id: this._labelId }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL, h("select", { key: '26029a01c106666155c40cac98a7f67739145491', role: "none", hidden: true, id: this._selectId, tabIndex: -1, ref: (el) => {
|
|
773
781
|
this.selectRef = el;
|
|
774
782
|
}, form: this.form, name: this.name, multiple: getBoolean(this.multiple, "multiple"), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), onChange: (event) => this.satisfyReact(event) }, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.length)
|
|
775
783
|
? (_c = this.options) === null || _c === void 0 ? void 0 : _c.map((option) => (h("option", { disabled: option.disabled, value: option.value, key: undefined }, this.getOptionLabel(option))))
|
|
776
|
-
: null)), h("details", { key: '
|
|
784
|
+
: null)), h("details", { key: '60f50d851ebf3b180094bdbd1c9acb3c6e1069af', ref: (el) => {
|
|
777
785
|
this.detailsRef = el;
|
|
778
|
-
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '
|
|
786
|
+
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '369ba87529acc1e3b2d12869174eff0a824c0176' }), this.options ? (h(Fragment, null, h("summary", { class: "db-custom-select-form-field", id: this._summaryId, "aria-disabled": getBooleanAsString(this.disabled), "aria-labelledby": this._labelId }, ((_d = this._selectedLabels) === null || _d === void 0 ? void 0 : _d.length) ? (h("span", { "data-visually-hidden": getBooleanAsString(this.selectedType === "tag"), id: this._selectedLabelsId }, this.selectedPrefix ? (h("span", { "data-visually-hidden": "true" }, this.selectedPrefix)) : null, this._selectedLabels)) : null, this.selectedType === "tag" ? (h("div", null, (_e = this._selectedOptions) === null || _e === void 0 ? void 0 : _e.map((option, index) => (h("db-tag", { emphasis: "strong", behavior: "removable", removeButton: this.getTagRemoveLabel(option), onRemove: (event) => this.handleTagRemove(option, event), key: undefined }, this.getOptionLabel(option)))))) : null), h("db-custom-select-dropdown", { width: this.dropdownWidth }, this.searchEnabled ? (h("div", null, h("db-input", { type: "search", ref: (el) => {
|
|
779
787
|
this.searchInputRef = el;
|
|
780
788
|
}, name: this._id, form: this._id, showLabel: false, value: this._searchValue, label: (_f = this.searchLabel) !== null && _f !== void 0 ? _f : DEFAULT_LABEL, placeholder: (_g = this.searchPlaceholder) !== null && _g !== void 0 ? _g : this.searchLabel, ariaDescribedBy: this._hasNoOptions || this.showLoading
|
|
781
789
|
? this._infoTextId
|
|
@@ -785,7 +793,7 @@ const DBCustomSelect = class {
|
|
|
785
793
|
this.selectAllRef = el;
|
|
786
794
|
}, form: this._id, checked: this.selectAllChecked, onChange: (event) => this.handleSelectAll(event) }), this.getSelectAllLabel())))) : null, h("db-custom-select-list", { multiple: getBoolean(this.multiple, "multiple"), label: (_k = (_j = this.listLabel) !== null && _j !== void 0 ? _j : this.label) !== null && _k !== void 0 ? _k : DEFAULT_LABEL }, (_l = this._options) === null || _l === void 0 ? void 0 : _l.map((option) => (h("db-custom-select-list-item", { type: this.multiple ? "checkbox" : "radio", showDivider: option.showDivider, icon: option.icon, isGroupTitle: option.isGroupTitle, groupTitle: this.getOptionLabel(option), name: this._id, checked: this.getOptionChecked(option.value), disabled: option.disabled, value: option.value, onChange: () => this.handleSelect(option.value), key: undefined }, !option.isGroupTitle
|
|
787
795
|
? this.getOptionLabel(option)
|
|
788
|
-
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose(undefined, true) }, (_m = this.mobileCloseButtonText) !== null && _m !== void 0 ? _m : DEFAULT_CLOSE_BUTTON))))) : null), ((_o = this.showClearSelection) !== null && _o !== void 0 ? _o : true) && ((_p = this._values) === null || _p === void 0 ? void 0 : _p.length) ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", noText: true, name: this._id, form: this._id, onClick: (event) => this.handleClearAll(event) }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: '
|
|
796
|
+
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose(undefined, true) }, (_m = this.mobileCloseButtonText) !== null && _m !== void 0 ? _m : DEFAULT_CLOSE_BUTTON))))) : null), ((_o = this.showClearSelection) !== null && _o !== void 0 ? _o : true) && ((_p = this._values) === null || _p === void 0 ? void 0 : _p.length) ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", noText: true, name: this._id, form: this._id, onClick: (event) => this.handleClearAll(event) }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: 'b4a9cebfe1db06422f428bac4d04d581bcadbb95', class: "db-custom-select-placeholder", "aria-hidden": getBooleanAsString(true), id: this._placeholderId }, (_q = this.placeholder) !== null && _q !== void 0 ? _q : this.label), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: 'a407a98afeecf7634770f34e2f427a09d657419a', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '4465c3745c21e5333c8498927416fd0f244673dd', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
789
797
|
}
|
|
790
798
|
static get watchers() { return {
|
|
791
799
|
"detailsRef": [{
|
|
@@ -41,7 +41,7 @@ const DBDrawer = class {
|
|
|
41
41
|
const open = Boolean(this.open);
|
|
42
42
|
if (open && !this._ref.open) {
|
|
43
43
|
if (this.dialogContainerRef) {
|
|
44
|
-
this.dialogContainerRef.
|
|
44
|
+
this.dialogContainerRef.removeAttribute("data-transition");
|
|
45
45
|
}
|
|
46
46
|
if (this.position === "absolute" ||
|
|
47
47
|
this.backdrop === "none" ||
|
|
@@ -51,16 +51,20 @@ const DBDrawer = class {
|
|
|
51
51
|
else {
|
|
52
52
|
this._ref.showModal();
|
|
53
53
|
}
|
|
54
|
+
void delay(() => {
|
|
55
|
+
if (this.dialogContainerRef) {
|
|
56
|
+
this.dialogContainerRef.dataset["transition"] =
|
|
57
|
+
"open";
|
|
58
|
+
}
|
|
59
|
+
}, 1);
|
|
54
60
|
}
|
|
55
61
|
if (!open && this._ref.open) {
|
|
56
62
|
if (this.dialogContainerRef) {
|
|
57
|
-
this.dialogContainerRef.
|
|
63
|
+
this.dialogContainerRef.dataset["transition"] =
|
|
64
|
+
"close";
|
|
58
65
|
}
|
|
59
|
-
delay(() => {
|
|
66
|
+
void delay(() => {
|
|
60
67
|
var _a;
|
|
61
|
-
if (this.dialogContainerRef) {
|
|
62
|
-
this.dialogContainerRef.hidden = false;
|
|
63
|
-
}
|
|
64
68
|
(_a = this._ref) === null || _a === void 0 ? void 0 : _a.close();
|
|
65
69
|
}, 401);
|
|
66
70
|
}
|
|
@@ -125,11 +129,11 @@ const DBDrawer = class {
|
|
|
125
129
|
}
|
|
126
130
|
render() {
|
|
127
131
|
var _a;
|
|
128
|
-
return (h("dialog", { key: '
|
|
132
|
+
return (h("dialog", { key: '171c5580c99bbe2d2ea0a6e8e5962e4132d9b07f', class: "db-drawer", id: this.id, ref: (el) => {
|
|
129
133
|
this._ref = el;
|
|
130
|
-
}, onClick: (event) => this.handleClose(event), onKeyDown: (event) => this.handleClose(event), "data-position": this.position, "data-backdrop": this.backdrop, "data-direction": this.direction, "data-variant": this.variant }, h("article", { key: '
|
|
134
|
+
}, onClick: (event) => this.handleClose(event), onKeyDown: (event) => this.handleClose(event), "data-position": this.position, "data-backdrop": this.backdrop, "data-direction": this.direction, "data-variant": this.variant }, h("article", { key: 'e9fad39beff3e642ad13be4950bb64fd15896f80', class: cls("db-drawer-container", this.className), ref: (el) => {
|
|
131
135
|
this.dialogContainerRef = el;
|
|
132
|
-
}, "data-spacing": this.spacing, "data-width": this.width, "data-direction": this.direction, "data-rounded": getBooleanAsString(this.rounded) }, h("header", { key: '
|
|
136
|
+
}, "data-spacing": this.spacing, "data-width": this.width, "data-direction": this.direction, "data-rounded": getBooleanAsString(this.rounded) }, h("header", { key: 'cb9f374f26ebca0f11d02081c28e856cc87107c3', class: "db-drawer-header" }, h("div", { key: '7fca8037c16e16d909bcede75e223f38ae019453', class: "db-drawer-header-text" }, h("slot", { key: '85159cc4d260fa992bfe8b933920ae286b9ab09c', name: "drawerHeader" })), h("db-button", { key: '4a9ad6ba576480b154614da72752421a8ff81df6', class: "button-close-drawer", icon: "cross", variant: "ghost", id: this.closeButtonId, noText: true, onClick: (event) => this.handleClose(event, true) }, (_a = this.closeButtonText) !== null && _a !== void 0 ? _a : DEFAULT_CLOSE_BUTTON)), h("div", { key: '9dbbd6a3835dad60dea79a9b2fbed6a62dd6b837', class: "db-drawer-content" }, h("slot", { key: '1bc4b88266e6d7250d0075e2405b725ad38b950e' })))));
|
|
133
137
|
}
|
|
134
138
|
static get watchers() { return {
|
|
135
139
|
"open": [{
|
|
@@ -164,7 +164,10 @@ const DBSelect = class {
|
|
|
164
164
|
this.watch2Fn();
|
|
165
165
|
}
|
|
166
166
|
watch3Fn() {
|
|
167
|
-
|
|
167
|
+
// If angular uses ngModel value and _value are null
|
|
168
|
+
// then the value will be set afterward and the _ref will be refreshed
|
|
169
|
+
const addResetListener = true;
|
|
170
|
+
if (this._ref && addResetListener) {
|
|
168
171
|
const defaultValue = undefined;
|
|
169
172
|
let controller = this.abortController;
|
|
170
173
|
if (!controller) {
|
|
@@ -205,14 +208,14 @@ const DBSelect = class {
|
|
|
205
208
|
}
|
|
206
209
|
render() {
|
|
207
210
|
var _a, _b, _c, _d, _e;
|
|
208
|
-
return (h("div", { key: '
|
|
211
|
+
return (h("div", { key: '0139805ef7af1df0231794b1214fb861e6564247', class: cls("db-select", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon) }, h("label", { key: '32f2bbc5b919c3450c33f6e18a5da5826da7aa11', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("select", { key: 'b5f973899ce6d4dd1d1de822a41dd4035cc08757', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
209
212
|
this._ref = el;
|
|
210
213
|
}, required: getBoolean(this.required, "required"), disabled: getBoolean(this.disabled, "disabled"), id: this._id, name: this.name, size: this.size,
|
|
211
214
|
/* @ts-ignore */
|
|
212
215
|
value: (_b = this.value) !== null && _b !== void 0 ? _b : this._value, autocomplete: this.autocomplete, multiple: this.multiple, onInput: (event) => this.handleInput(event), onClick: (event) => this.handleClick(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_c = this.ariaDescribedBy) !== null && _c !== void 0 ? _c : this._descByIds }, this.variant === "floating" || this.placeholder ? (h("option", { class: "placeholder", value: "" })) : null, ((_d = this.options) === null || _d === void 0 ? void 0 : _d.length) ? ((_e = this.options) === null || _e === void 0 ? void 0 : _e.map((option) => {
|
|
213
216
|
var _a;
|
|
214
217
|
return (h(Fragment, null, option.options ? (h("optgroup", { label: this.getOptionLabel(option), key: undefined }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (h("option", { value: optgroupOption.value, selected: optgroupOption.selected, disabled: optgroupOption.disabled, key: undefined }, this.getOptionLabel(optgroupOption)))))) : (h("option", { value: option.value, disabled: option.disabled, selected: option.selected, key: undefined }, this.getOptionLabel(option)))));
|
|
215
|
-
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
218
|
+
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '8b6c170210a55708f2539f46bd599a47a9e81781', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '17de2c472570dce406b18eeac924c0c88446ce6d', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
216
219
|
}
|
|
217
220
|
static get watchers() { return {
|
|
218
221
|
"_ref": [{
|
|
@@ -134,13 +134,18 @@ const DBTextarea = class {
|
|
|
134
134
|
this.watch1Fn();
|
|
135
135
|
}
|
|
136
136
|
watch2Fn() {
|
|
137
|
-
this.
|
|
137
|
+
if (this.value !== undefined) {
|
|
138
|
+
this._value = this.value;
|
|
139
|
+
}
|
|
138
140
|
}
|
|
139
141
|
watch2() {
|
|
140
142
|
this.watch2Fn();
|
|
141
143
|
}
|
|
142
144
|
watch3Fn() {
|
|
143
|
-
|
|
145
|
+
// If angular uses ngModel value and _value are null
|
|
146
|
+
// then the value will be set afterward and the _ref will be refreshed
|
|
147
|
+
const addResetListener = true;
|
|
148
|
+
if (this._ref && addResetListener) {
|
|
144
149
|
const defaultValue = undefined;
|
|
145
150
|
let controller = this.abortController;
|
|
146
151
|
if (!controller) {
|
|
@@ -179,10 +184,10 @@ const DBTextarea = class {
|
|
|
179
184
|
}
|
|
180
185
|
render() {
|
|
181
186
|
var _a, _b, _c, _d, _e;
|
|
182
|
-
return (h("div", { key: '
|
|
187
|
+
return (h("div", { key: '3ac7e870ca2c9d8f366f07797fc15c238ddeab50', class: cls("db-textarea", this.className), "data-variant": this.variant, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: 'd3d0e209d0a14a54975cce835e50e4f57d09d1bd', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("textarea", { key: '7e7dce4db9a84230a9c736039eefd58022944cf8', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
|
|
183
188
|
this._ref = el;
|
|
184
189
|
}, id: this._id, "data-resize": this.resize, "data-hide-resizer": getHideProp((_b = this.showResizer) !== null && _b !== void 0 ? _b : true), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), readOnly: getBoolean(this.readOnly, "readOnly") ||
|
|
185
|
-
getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_c = this.value) !== null && _c !== void 0 ? _c : this._value, "aria-describedby": (_d = this.ariaDescribedBy) !== null && _d !== void 0 ? _d : this._descByIds, placeholder: (_e = this.placeholder) !== null && _e !== void 0 ? _e : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
190
|
+
getBoolean(this.readonly, "readonly"), form: this.form, maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), name: this.name, wrap: this.wrap, spellcheck: this.spellCheck, autocomplete: this.autocomplete, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), value: (_c = this.value) !== null && _c !== void 0 ? _c : this._value, "aria-describedby": (_d = this.ariaDescribedBy) !== null && _d !== void 0 ? _d : this._descByIds, placeholder: (_e = this.placeholder) !== null && _e !== void 0 ? _e : DEFAULT_PLACEHOLDER, rows: getNumber(this.rows, DEFAULT_ROWS), cols: getNumber(this.cols) }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: 'dc153c224d3acafa0a8d7f3ad37317b76cba01b8', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '21cd2120d06ec2891979d7a7fc0f1041031dabf2', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
186
191
|
}
|
|
187
192
|
static get watchers() { return {
|
|
188
193
|
"_ref": [{
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@db-ux/wc-core-components",
|
|
4
|
-
"version": "4.3.
|
|
4
|
+
"version": "4.3.1",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -1732,7 +1732,7 @@
|
|
|
1732
1732
|
{ "name": "_invalidMessage" },
|
|
1733
1733
|
{ "name": "_dataListId" },
|
|
1734
1734
|
{ "name": "_descByIds" },
|
|
1735
|
-
{ "name": "_value" },
|
|
1735
|
+
{ "name": "_value", "type": "string" },
|
|
1736
1736
|
{ "name": "_voiceOverFallback", "type": "string" },
|
|
1737
1737
|
{ "name": "abortController" }
|
|
1738
1738
|
],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/wc-core-components",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.2-consolidation-7549d9f",
|
|
4
4
|
"description": "Stencil components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"web-types": "./dist/web-types.json",
|
|
49
49
|
"customElements": "dist/custom-elements.json",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@db-ux/core-components": "4.3.
|
|
52
|
-
"@db-ux/core-foundations": "4.3.
|
|
51
|
+
"@db-ux/core-components": "4.3.2-consolidation-7549d9f",
|
|
52
|
+
"@db-ux/core-foundations": "4.3.2-consolidation-7549d9f"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as s}from"./p-9pYJFapZ.js";import{l as h,g as a,h as e,f as d,k as l,b as n,r as o,a as r}from"./p-BdL-nI5y.js";import{h as c,d as u,s as v,u as b,f,e as m,l as p,c as w}from"./p-BwBkekqp.js";import{c as y}from"./p-Cb-k135w.js";const k=class{constructor(s){t(this,s),this.input=i(this,"input"),this.change=i(this,"change"),this.blur=i(this,"blur"),this.focus=i(this,"focus"),this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._descByIds=void 0,this._value="",this._voiceOverFallback="",this.abortController=void 0}hasValidState(){var t;return!!(null!==(t=this.validMessage)&&void 0!==t?t:"valid"===this.validation)}handleValidation(){var t,i,s,a;(null===(t=this._ref)||void 0===t?void 0:t.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(s=this._ref)||void 0===s?void 0:s.validity.valid)&&(this.required||this.minLength||this.maxLength)?(this._descByIds=this._validMessageId,c()&&(this._voiceOverFallback=null!==(a=this.validMessage)&&void 0!==a?a:l,u((()=>this._voiceOverFallback=""),1e3))):this._descByIds=v(this.message,this.showMessage)?this._messageId:void 0:(this._descByIds=this._invalidMessageId,this._invalidMessage=this.invalidMessage||(null===(i=this._ref)||void 0===i?void 0:i.validationMessage)||h,c()&&(this._voiceOverFallback=this._invalidMessage,u((()=>this._voiceOverFallback=""),1e3)))}handleInput(t,i){this.input&&this.input.emit(t),this.handleValidation()}handleChange(t,i){this.change&&this.change.emit(t),this.handleValidation()}handleBlur(t){this.blur&&this.blur.emit(t)}handleFocus(t){this.focus&&this.focus.emit(t)}enableAttributePassing(t,i){const s=null==t?void 0:t.closest(i);if(t&&s){const i=s.attributes;for(let h=0;h<i.length;h++){const a=i.item(h);if(a&&(a.name.startsWith("data-")||a.name.startsWith("aria-"))&&(t.setAttribute(a.name,a.value),s.removeAttribute(a.name)),a&&"class"===a.name){const i=a.value.includes("hydrated"),h=a.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(a.name,`${e?`${e} `:""}${h}`),i?s.setAttribute("class","hydrated"):s.removeAttribute(a.name)}}}}watch0Fn(){var t;this._invalidMessage=this.invalidMessage||(null===(t=this._ref)||void 0===t?void 0:t.validationMessage)||h}watch0(){this.watch0Fn()}watch1Fn(){if(this._id){const t=this._id+d;this._messageId=t,this._validMessageId=this._id+a,this._invalidMessageId=this._id+e,v(this.message,this.showMessage)&&(this._descByIds=t),this.handleValidation()}}watch1(){this.watch1Fn()}watch2Fn(){this._value=this.value}watch2(){this.watch2Fn()}watch3Fn(){if(this._ref){const t=void 0;let i=this.abortController;i||(i=new AbortController,this.abortController=i),y(this._ref,{value:this.value,defaultValue:t},(t=>{this.handleChange(t,!0),this.handleInput(t,!0)}),i.signal)}}watch3(){this.watch3Fn()}componentDidLoad(){var t;this.enableAttributePassing(this._ref,"db-textarea");const i=null!==(t=this.id)&&void 0!==t?t:`textarea-${b()}`;this._id=i,this._messageId=i+d,this._validMessageId=i+a,this._invalidMessageId=i+e,this._invalidMessage=this.invalidMessage||h,this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn()}disconnectedCallback(){var t;null===(t=this.abortController)||void 0===t||t.abort()}render(){var t,i,h,a,e;return s("div",{key:"9255fc80e1688243e518a6e109e9114dc146423e",class:w("db-textarea",this.className),"data-variant":this.variant,"data-hide-asterisk":p(this.showRequiredAsterisk),"data-hide-label":p(this.showLabel)},s("label",{key:"b6b329b9e0f27286df0d1bb905fb9b717ee9fe19",htmlFor:this._id},null!==(t=this.label)&&void 0!==t?t:r),s("textarea",{key:"7a8a0f97d2348dd5b4d47a2dc8c7ff1530e094df","aria-invalid":"invalid"===this.validation,"data-custom-validity":this.validation,"data-field-sizing":this.fieldSizing,ref:t=>{this._ref=t},id:this._id,"data-resize":this.resize,"data-hide-resizer":p(null===(i=this.showResizer)||void 0===i||i),disabled:m(this.disabled,"disabled"),required:m(this.required,"required"),readOnly:m(this.readOnly,"readOnly")||m(this.readonly,"readonly"),form:this.form,maxLength:f(this.maxLength,this.maxlength),minLength:f(this.minLength,this.minlength),name:this.name,wrap:this.wrap,spellcheck:this.spellCheck,autocomplete:this.autocomplete,onInput:t=>this.handleInput(t),onChange:t=>this.handleChange(t),onBlur:t=>this.handleBlur(t),onFocus:t=>this.handleFocus(t),value:null!==(h=this.value)&&void 0!==h?h:this._value,"aria-describedby":null!==(a=this.ariaDescribedBy)&&void 0!==a?a:this._descByIds,placeholder:null!==(e=this.placeholder)&&void 0!==e?e:n,rows:f(this.rows,o),cols:f(this.cols)}),v(this.message,this.showMessage)?s("db-infotext",{size:"small",icon:this.messageIcon,id:this._messageId},this.message):null,this.hasValidState()?s("db-infotext",{size:"small",semantic:"successful",id:this._validMessageId},this.validMessage||l):null,s("db-infotext",{key:"f291ebb55cc437ba56ed5fb01e4c261037ce453c",size:"small",semantic:"critical",id:this._invalidMessageId},this._invalidMessage),s("span",{key:"2b2079f8e31da8800bd00e4e5b41d71bcde3ab95","data-visually-hidden":"true",role:"status"},this._voiceOverFallback))}static get watchers(){return{_ref:[{watch0:0},{watch3:0}],invalidMessage:[{watch0:0}],_id:[{watch1:0}],value:[{watch2:0}]}}};export{k as db_textarea}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as s,c as i}from"./p-9pYJFapZ.js";import{c as a,e as h,u as e,g as d,h as o,d as l,s as c,i as n,k as r,f as u,j as b,b as f,l as v}from"./p-BwBkekqp.js";import{l as m,g as p,h as y,j as k,f as w,k as g,b as x,a as $,m as _}from"./p-BdL-nI5y.js";import{c as F}from"./p-Cb-k135w.js";const C=class{constructor(s){t(this,s),this.width="fixed"}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-custom-select-dropdown")}render(){return s("article",{key:"98087cc1db985bbb2e2578cb9e2c78bc3a0c3b23",class:a("db-custom-select-dropdown db-card",this.className),"data-spacing":"none",ref:t=>{this._ref=t},id:this.id,"data-width":this.width},s("slot",{key:"25bcaa79bdf8168feffce0a59c0adbc656023e64"}))}},L=class{constructor(s){t(this,s)}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-custom-select-list")}render(){return s("div",{key:"f47e219aac45d07e958a94969205260af981bcf1",class:a("db-custom-select-list",this.className),role:this.multiple?"group":"radiogroup","aria-label":this.label,ref:t=>{this._ref=t},id:this.id},s("ul",{key:"adca0d159ec4cd5d2dc46f11fe41006276dba94f"},s("slot",{key:"abb6edfb683a3e4a42512b2185854099c66f1f3c"})))}},A=class{constructor(s){t(this,s),this.change=i(this,"change"),this._id=void 0,this.hasDivider=!1}handleChange(t){t.stopPropagation(),this.change&&this.change.emit(t)}getIconTrailing(){if(!this.isGroupTitle&&"checkbox"!==this.type)return h(this.checked,"checked")?"check":"x_placeholder"}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}watch0Fn(){this.hasDivider=Boolean(this.isGroupTitle||this.showDivider)}watch0(){this.watch0Fn()}componentDidLoad(){var t;this.enableAttributePassing(this._ref,"db-custom-select-list-item"),this._id=null!==(t=this.id)&&void 0!==t?t:`custom-select-list-item-${e()}`,this.watch0Fn()}render(){return s("li",{key:"d94821da8bf1842933f6518079c9e463459bed2b",class:a("db-custom-select-list-item",this.className,{"db-checkbox":"checkbox"===this.type&&!this.isGroupTitle,"db-radio":"checkbox"!==this.type&&!this.isGroupTitle}),ref:t=>{this._ref=t},id:this._id,"data-divider":d(this.hasDivider)},this.isGroupTitle?s("span",null,this.groupTitle):s("label",{"data-icon":"checkbox"!==this.type&&this.icon?this.icon:void 0,"data-show-icon":d(this.showIcon),"data-icon-trailing":this.getIconTrailing()},s("input",{class:"db-custom-select-list-item-checkbox","data-disable-focus":"true",type:this.type,name:this.name,form:this.name,checked:h(this.checked,"checked"),disabled:h(this.disabled,"disabled"),value:this.value,onChange:t=>this.handleChange(t)}),this.label?this.label:s("slot",null)))}static get watchers(){return{isGroupTitle:[{watch0:0}],showDivider:[{watch0:0}]}}},B=class{constructor(s){t(this,s),this.input=i(this,"input"),this.change=i(this,"change"),this.blur=i(this,"blur"),this.focus=i(this,"focus"),this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._dataListId=void 0,this._descByIds=void 0,this._value=void 0,this._voiceOverFallback="",this.abortController=void 0}hasValidState(){var t;return!!(null!==(t=this.validMessage)&&void 0!==t?t:"valid"===this.validation)}handleValidation(){var t,s,i,a;(null===(t=this._ref)||void 0===t?void 0:t.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(i=this._ref)||void 0===i?void 0:i.validity.valid)&&(this.required||this.minLength||this.maxLength||this.pattern)?(this._descByIds=this._validMessageId,o()&&(this._voiceOverFallback=null!==(a=this.validMessage)&&void 0!==a?a:g,l((()=>this._voiceOverFallback=""),1e3))):this._descByIds=c(this.message,this.showMessage)?this._messageId:void 0:(this._descByIds=this._invalidMessageId,this._invalidMessage=this.invalidMessage||(null===(s=this._ref)||void 0===s?void 0:s.validationMessage)||m,o()&&(this._voiceOverFallback=this._invalidMessage,l((()=>this._voiceOverFallback=""),1e3)))}handleInput(t,s){this.input&&this.input.emit(t),this.handleValidation()}handleChange(t,s){this.change&&this.change.emit(t),this.handleValidation()}handleBlur(t){this.blur&&this.blur.emit(t)}handleFocus(t){this.focus&&this.focus.emit(t)}getDataList(){const t=this.dataList;return Array.from((n(t)?null==t?void 0:t.map((t=>({value:t,label:void 0}))):t)||[])}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}watch0Fn(){var t;this._invalidMessage=this.invalidMessage||(null===(t=this._ref)||void 0===t?void 0:t.validationMessage)||m}watch0(){this.watch0Fn()}watch1Fn(){var t;if(this._id){const s=this._id+w;this._messageId=s,this._validMessageId=this._id+p,this._invalidMessageId=this._id+y,this._dataListId=null!==(t=this.dataListId)&&void 0!==t?t:this._id+k,c(this.message,this.showMessage)&&(this._descByIds=s),this.handleValidation()}}watch1(){this.watch1Fn()}watch2Fn(){this._value=this.value}watch2(){this.watch2Fn()}watch3Fn(){if(this._ref){const t=void 0;let s=this.abortController;s||(s=new AbortController,this.abortController=s),F(this._ref,{value:this.value,defaultValue:t},(t=>{this.handleChange(t,!0),this.handleInput(t,!0)}),s.signal)}}watch3(){this.watch3Fn()}componentDidLoad(){var t;this.enableAttributePassing(this._ref,"db-input");const s=null!==(t=this.id)&&void 0!==t?t:`input-${e()}`;this._id=s,this._messageId=s+w,this._validMessageId=s+p,this._invalidMessageId=s+y,this._dataListId=s+k,this._invalidMessage=this.invalidMessage||m,this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn()}disconnectedCallback(){var t;null===(t=this.abortController)||void 0===t||t.abort()}render(){var t,i,e,o,l,n,m,p;return s("div",{key:"67eb319a65364be7bb4bba4f0fac864e8b12f1d3",class:a("db-input",this.className),"data-variant":this.variant,"data-hide-label":v(this.showLabel),"data-show-icon":d(null!==(t=this.showIconLeading)&&void 0!==t?t:this.showIcon),"data-icon":null!==(i=this.iconLeading)&&void 0!==i?i:this.icon,"data-icon-trailing":this.iconTrailing,"data-hide-asterisk":v(this.showRequiredAsterisk),"data-show-icon-trailing":d(this.showIconTrailing)},s("label",{key:"d305e5bcf15985ae7c287db6b93971c02f525fbd",htmlFor:this._id},null!==(e=this.label)&&void 0!==e?e:$),s("input",{key:"1951499d2ab18789993eafac4d3c6b5a711e4b58","aria-invalid":"invalid"===this.validation,"data-custom-validity":this.validation,"data-field-sizing":this.fieldSizing,ref:t=>{this._ref=t},id:this._id,name:this.name,type:this.type||"text",multiple:h(this.multiple,"multiple"),placeholder:null!==(o=this.placeholder)&&void 0!==o?o:x,disabled:h(this.disabled,"disabled"),required:h(this.required,"required"),step:b(this.step),value:null!==(l=this.value)&&void 0!==l?l:this._value,maxLength:u(this.maxLength,this.maxlength),minLength:u(this.minLength,this.minlength),max:r(this.max,this.type),min:r(this.min,this.type),readOnly:h(this.readOnly,"readOnly")||h(this.readonly,"readonly"),form:this.form,pattern:this.pattern,size:this.size,autoComplete:this.autocomplete,autoFocus:h(this.autofocus,"autofocus"),enterKeyHint:this.enterkeyhint,inputMode:this.inputmode,onInput:t=>this.handleInput(t),onChange:t=>this.handleChange(t),onBlur:t=>this.handleBlur(t),onFocus:t=>this.handleFocus(t),list:this.dataList&&this._dataListId,"aria-describedby":null!==(n=this.ariaDescribedBy)&&void 0!==n?n:this._descByIds,role:["datetime-local","date","time","week","month","color"].includes(null!==(m=this.type)&&void 0!==m?m:"")&&f()?"textbox":void 0}),this.dataList?s("datalist",{id:this._dataListId},null===(p=this.getDataList())||void 0===p?void 0:p.map((t=>s("option",{key:this._dataListId+"-option-"+t.value,value:t.value},t.label)))):null,s("slot",{key:"90c59c82c57e5189693b954d999493372af62970"}),c(this.message,this.showMessage)?s("db-infotext",{size:this.messageSize||"small",icon:this.messageIcon,id:this._messageId},this.message):null,this.hasValidState()?s("db-infotext",{semantic:"successful",id:this._validMessageId,size:this.validMessageSize||"small"},this.validMessage||g):null,s("db-infotext",{key:"aa671024bc3badc32ee4bf59528878e4ef91a581",semantic:"critical",id:this._invalidMessageId,size:this.invalidMessageSize||"small"},this._invalidMessage),s("span",{key:"215d6ace4fc3da52ad43afd52dbcf03347056958","data-visually-hidden":"true",role:"status"},this._voiceOverFallback))}static get watchers(){return{_ref:[{watch0:0},{watch3:0}],invalidMessage:[{watch0:0}],_id:[{watch1:0}],value:[{watch2:0}]}}},D=class{constructor(s){t(this,s),this.remove=i(this,"remove")}handleRemove(t){t&&(t.stopPropagation(),this.remove&&this.remove.emit(t))}getRemoveButtonText(){return this.removeButton?this.removeButton:_}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const h=s.item(a);if(h&&(h.name.startsWith("data-")||h.name.startsWith("aria-"))&&(t.setAttribute(h.name,h.value),i.removeAttribute(h.name)),h&&"class"===h.name){const s=h.value.includes("hydrated"),a=h.value.replace("hydrated","").trim(),e=t.getAttribute("class");t.setAttribute(h.name,`${e?`${e} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(h.name)}}}}componentDidLoad(){this.enableAttributePassing(this._ref,"db-tag")}render(){var t;return s("div",{key:"db86fabfde3f9d1e41a863f58db34eb88d067440",class:a("db-tag",this.className),ref:t=>{this._ref=t},id:this.id,"data-semantic":this.semantic,"data-emphasis":this.emphasis,"data-icon":this.icon,"data-show-check-state":d(null===(t=this.showCheckState)||void 0===t||t),"data-show-icon":d(this.showIcon),"data-no-text":d(this.noText),"data-overflow":d(this.overflow)},s("slot",{key:"1bef11e30ca670fa5bf1d438cd12c43e233cded4",name:"content"}),s("slot",{key:"3f94141f60688d0730478711748fa9dbb194f810"}),this.text?this.text:null,"removable"===this.behavior?s("button",{class:"db-button db-tab-remove-button","data-icon":"cross","data-size":"small","data-no-text":"true","data-variant":"ghost",type:"button",onClick:t=>this.handleRemove(t)},s("db-tooltip",{variant:"label"},this.getRemoveButtonText())):null)}};export{C as db_custom_select_dropdown,L as db_custom_select_list,A as db_custom_select_list_item,B as db_input,D as db_tag}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,c as t,h as s,F as h}from"./p-9pYJFapZ.js";import{l,a as e,m as a,d as o,e as d,g as n,h as c,i as v,o as r,f as u,k as w,c as f,s as b}from"./p-BdL-nI5y.js";import{h as m,d as p,s as y,m as g,u as k,g as F,e as A,l as x,c as D}from"./p-BwBkekqp.js";import{D as C}from"./p-cqrM3KjS.js";import{D as S}from"./p-EqlW5Wqf.js";import{a as L}from"./p-G-TursYV.js";import{b as T}from"./p-Cb-k135w.js";const B=class{constructor(s){i(this,s),this.amountChange=t(this,"amountChange"),this.dropdownToggle=t(this,"dropdownToggle"),this.optionSelected=t(this,"optionSelected"),this.search=t(this,"search"),this.showClearSelection=!0,this.clearSelectionText="Clear selection",this._id=void 0,this._messageId=void 0,this._validMessageId=void 0,this._invalidMessageId=void 0,this._invalidMessage=void 0,this._selectId=void 0,this._labelId=void 0,this._summaryId=void 0,this._placeholderId=void 0,this._infoTextId=void 0,this._validity="no-validation",this._userInteraction=!1,this.abortController=void 0,this._descByIds=void 0,this._selectedLabels="",this._selectedLabelsId=void 0,this._voiceOverFallback="",this._selectedOptions=[],this.selectAllEnabled=!1,this.searchEnabled=!1,this.amountOptions=0,this._values=[],this._options=[],this._hasNoOptions=!1,this._documentClickListenerCallbackId=void 0,this._internalChangeTimestamp=0,this._documentScrollListenerCallbackId=void 0,this._observer=void 0,this._searchValue=void 0,this.selectAllChecked=!1,this.selectAllIndeterminate=!1,this.satisfyReact=function(i){i.stopPropagation()}}handleDocumentScroll(i){var t,s;(null===(t=null==i?void 0:i.target)||void 0===t?void 0:t.contains)&&(null===(s=null==i?void 0:i.target)||void 0===s?void 0:s.contains(this.detailsRef))&&this.handleAutoPlacement()}hasValidState(){var i;return!!(null!==(i=this.validMessage)&&void 0!==i?i:"valid"===this.validation)}handleValidation(){var i,t,s,h,e,a,o,d;this.selectRef&&(this.selectRef.value=this.getNativeSelectValue()),(null===(i=this.selectRef)||void 0===i?void 0:i.validity.valid)&&"invalid"!==this.validation?this.hasValidState()&&(null===(h=this.selectRef)||void 0===h?void 0:h.validity.valid)&&this.required?(this.setDescById(this._validMessageId),m()&&(this._voiceOverFallback=null!==(e=this.validMessage)&&void 0!==e?e:w,p((()=>this._voiceOverFallback=""),1e3)),this._validity=null!==(a=this.validation)&&void 0!==a?a:"valid"):y(this.message,this.showMessage)?(this.setDescById(this._messageId),this._validity=null!==(o=this.validation)&&void 0!==o?o:"no-validation"):(this.setDescById(this._placeholderId),this._validity=null!==(d=this.validation)&&void 0!==d?d:"no-validation"):(this.setDescById(this._invalidMessageId),this._invalidMessage=this.invalidMessage||(null===(t=this.selectRef)||void 0===t?void 0:t.validationMessage)||l,m()&&(this._voiceOverFallback=this._invalidMessage,p((()=>this._voiceOverFallback=""),1e3)),this._userInteraction&&(this._validity=null!==(s=this.validation)&&void 0!==s?s:"invalid"))}handleDropdownToggle(i){var t,s;this.dropdownToggle&&(i.stopPropagation(),this.dropdownToggle.emit(i)),i.target instanceof HTMLDetailsElement&&i.target.open?(this._documentClickListenerCallbackId=(new C).addCallback((i=>this.handleDocumentClose(i))),this._documentScrollListenerCallbackId=(new S).addCallback((i=>this.handleDocumentScroll(i))),this.handleAutoPlacement(),null===(t=this._observer)||void 0===t||t.observe(this.detailsRef),i.target.dataset.test||this.handleOpenByKeyboardFocus()):(this._documentClickListenerCallbackId&&(new C).removeCallback(this._documentClickListenerCallbackId),this._documentScrollListenerCallbackId&&(new S).removeCallback(this._documentScrollListenerCallbackId),null===(s=this._observer)||void 0===s||s.unobserve(this.detailsRef))}getNativeSelectValue(){var i,t;return(null===(i=this._values)||void 0===i?void 0:i.length)&&null!==(t=this._values.at(0))&&void 0!==t?t:""}setDescById(i){var t;const s=[];i&&s.push(i),this._selectedLabelsId&&(null===(t=this._selectedLabels)||void 0===t?void 0:t.length)&&s.push(this._selectedLabelsId),this._descByIds=s.join(" ")}getSelectAllLabel(){var i;return null!==(i=this.selectAllLabel)&&void 0!==i?i:e}getOptionLabel(i){var t,s,h;return null!==(h=null!==(t=i.label)&&void 0!==t?t:null===(s=i.value)||void 0===s?void 0:s.toString())&&void 0!==h?h:""}getOptionChecked(i){var t,s;return!(!i||!(null===(t=this._values)||void 0===t?void 0:t.includes))&&(null===(s=this._values)||void 0===s?void 0:s.includes(i))}getTagRemoveLabel(i){const t=this.removeTagsTexts,s=this.options;if(t&&s){const h=s.findIndex((t=>t.value===i.value));if(h>=0&&h<t.length)return t[h]}return`${a} ${this.getOptionLabel(i)}`}handleTagRemove(i,t){t&&t.stopPropagation(),this.handleSelect(i.value),this.handleSummaryFocus()}handleAutoPlacement(){if(this.detailsRef){const i=this.detailsRef.querySelector("article");i&&p((()=>{var t;L(i,this.detailsRef,null!==(t=this.placement)&&void 0!==t?t:"bottom")}),1)}}handleArrowDownUp(i){var t,s,h;if(null===(t=this.detailsRef)||void 0===t?void 0:t.open){if(self.document){const t=self.document.activeElement;if(t)if("checkbox"===t.getAttribute("type")||"radio"===t.getAttribute("type")){const l=null==t?void 0:t.closest("li");if("ArrowDown"===i.key||"ArrowRight"===i.key){let i=null==l?void 0:l.nextElementSibling;for(;i;){const t=i.querySelector("input");if(t){t.focus();break}i=i.nextElementSibling}i||this.handleFocusFirstDropdownCheckbox(t)}else{let i=null==l?void 0:l.previousElementSibling;for(;i;){const t=i.querySelector("input");if(t){t.focus();break}i=i.previousElementSibling}if(!i){const i=this.detailsRef.querySelector('input[type="checkbox"]');if(i&&i!==t)this.handleFocusFirstDropdownCheckbox(t);else{const i=g(this.detailsRef);if(i)p((()=>{i.focus()}),100);else{const i=Array.from(null===(s=this.detailsRef)||void 0===s?void 0:s.querySelectorAll('input[type="checkbox"],input[type="radio"]'));i.length&&(null===(h=i.at(-1))||void 0===h||h.focus())}}}}}else"search"!==t.getAttribute("type")||"ArrowUp"!==i.key&&"ArrowLeft"!==i.key?this.handleFocusFirstDropdownCheckbox(t):(this.handleClose(void 0,!0),this.handleSummaryFocus())}}else"ArrowDown"!==i.key&&"ArrowRight"!==i.key||(this.handleAutoPlacement(),this.detailsRef&&(this.detailsRef.open=!0),this.handleOpenByKeyboardFocus());i.stopPropagation(),i.preventDefault()}handleKeyboardPress(i){var t,s;if(i.stopPropagation(),"Escape"===i.key&&(null===(t=this.detailsRef)||void 0===t?void 0:t.open))this.handleClose(void 0,!0),this.handleSummaryFocus();else if("Enter"===i.key&&(null===(s=this.detailsRef)||void 0===s?void 0:s.open)){if(self.document){const t=self.document.activeElement;["checkbox","radio"].includes(t.getAttribute("type")||"")&&(t.click(),i.preventDefault())}}else"ArrowDown"!==i.key&&"ArrowUp"!==i.key&&"ArrowLeft"!==i.key&&"ArrowRight"!==i.key||this.handleArrowDownUp(i)}handleClose(i,t){this.detailsRef&&(t?(this.detailsRef.open=!1,this.handleSummaryFocus()):this.detailsRef.open&&i&&i.relatedTarget&&(this.detailsRef.contains(i.relatedTarget)||p((()=>this.detailsRef.open=!1),1)))}handleDocumentClose(i){var t,s;if(i){const h="number"==typeof i.detail?i.target:null===(t=i.detail)||void 0===t?void 0:t.target;(null===(s=this.detailsRef)||void 0===s?void 0:s.open)&&!this.detailsRef.contains(h)&&(this.detailsRef.open=!1)}}handleOptionSelected(i){(new Date).getTime()-this._internalChangeTimestamp<200||(this._values=i,this._userInteraction=!0,this.optionSelected&&this.optionSelected.emit(null!=i?i:[]),this._internalChangeTimestamp=(new Date).getTime())}handleSelect(i){var t;i&&(this.multiple?(null===(t=this._values)||void 0===t?void 0:t.includes(i))?this.handleOptionSelected(this._values.filter((t=>t!==i))):this.handleOptionSelected([...this._values||[],i]):(this.handleOptionSelected([i]),this.handleClose(void 0,!0)))}handleSelectAll(i){var t;if(i.stopPropagation(),(null===(t=this._values)||void 0===t?void 0:t.length)===this.amountOptions)this.handleOptionSelected([]);else{const i=this.searchEnabled&&this.searchInputRef?this.searchInputRef.value:void 0;this.handleOptionSelected(this.options?this.options.filter((t=>{var s;return!t.isGroupTitle&&(!i||(null===(s=t.value)||void 0===s?void 0:s.toLowerCase().includes(i.toLowerCase())))})).map((i=>{var t;return null!==(t=i.value)&&void 0!==t?t:""})):[])}}handleFocusFirstDropdownCheckbox(i){if(this.detailsRef){const t=Array.from(this.detailsRef.querySelectorAll('input[type="checkbox"],input[type="radio"]'));if(t.length){const s=t.at(0),h=s===i&&t.length>1?t.at(1):s;h&&p((()=>{h.focus()}),1)}}}handleOpenByKeyboardFocus(){if(this.detailsRef){const i=g(this.detailsRef);i?p((()=>{i.focus()}),1):this.handleFocusFirstDropdownCheckbox()}}handleSearch(i){if(void 0===i)return;let t;if("string"==typeof i)t=i;else{const s=i;s.stopPropagation(),this.search&&this.search.emit(s),t=s.target.value,this._searchValue=t}this._options=this.options&&t&&0!==t.length?this.options.filter(this.searchFilter?i=>this.searchFilter(i,t):i=>!i.isGroupTitle&&this.getOptionLabel(i).toLowerCase().includes(t.toLowerCase())):this.options}handleClearAll(i){i.stopPropagation(),this.handleOptionSelected([]),this.handleSummaryFocus()}handleSummaryFocus(){var i;this.detailsRef&&(null===(i=this.detailsRef.querySelector("summary"))||void 0===i||i.focus())}enableAttributePassing(i,t){const s=null==i?void 0:i.closest(t);if(i&&s){const t=s.attributes;for(let h=0;h<t.length;h++){const l=t.item(h);if(l&&(l.name.startsWith("data-")||l.name.startsWith("aria-"))&&(i.setAttribute(l.name,l.value),s.removeAttribute(l.name)),l&&"class"===l.name){const t=l.value.includes("hydrated"),h=l.value.replace("hydrated","").trim(),e=i.getAttribute("class");i.setAttribute(l.name,`${e?`${e} `:""}${h}`),t?s.setAttribute("class","hydrated"):s.removeAttribute(l.name)}}}}watch0Fn(){this.detailsRef&&this.detailsRef.addEventListener("focusout",(i=>this.handleClose(i)))}watch0(){this.watch0Fn()}watch1Fn(){if(this._id){const i=this._id+u;this._labelId=this._id+o,this._selectId=this._id+d,this._validMessageId=this._id+n,this._invalidMessageId=this._id+c,this._placeholderId=this._id+v,y(this.message,this.showMessage)?this.setDescById(i):this.setDescById()}}watch1(){this.watch1Fn()}watch2Fn(){var i;if(this.detailsRef){const t=this.detailsRef.querySelector("summary");t&&t.setAttribute("aria-describedby",null!==(i=this.ariaDescribedBy)&&void 0!==i?i:this._descByIds||"")}}watch2(){this.watch2Fn()}watch3Fn(){void 0!==this.showNoResults?this._hasNoOptions=this.showNoResults:this._options&&(this._hasNoOptions=0===this._options.length)}watch3(){this.watch3Fn()}watch4Fn(){var i;this.selectAllEnabled=Boolean(this.multiple&&(null!==(i=this.showSelectAll)&&void 0!==i?i:this.amountOptions>5))}watch4(){this.watch4Fn()}watch5Fn(){var i;this.searchEnabled=null!==(i=this.showSearch)&&void 0!==i?i:this.amountOptions>9}watch5(){this.watch5Fn()}watch6Fn(){var i;const t=this.values;Array.isArray(t)?this._values!==t&&(this._values=t):null==t&&0!==(null===(i=this._values)||void 0===i?void 0:i.length)&&(this._values=[])}watch6(){this.watch6Fn()}watch7Fn(){this.selectRef&&this.handleValidation()}watch7(){this.watch7Fn()}watch8Fn(){if(this.selectRef){let i=this.abortController;i||(i=new AbortController,this.abortController=i);const t=this.values;T(this.selectRef,(()=>{this.handleOptionSelected(t||(this.selectRef.value?[this.selectRef.value]:[])),this.handleValidation()}),i.signal)}}watch8(){this.watch8Fn()}watch9Fn(){this._validity=this.validation}watch9(){this.watch9Fn()}watch10Fn(){var i,t;0===(null===(i=this._values)||void 0===i?void 0:i.length)?(this.selectAllChecked=!1,this.selectAllIndeterminate=!1):(null===(t=this._values)||void 0===t?void 0:t.length)===this.amountOptions?(this.selectAllIndeterminate=!1,this.selectAllChecked=!0):this._values&&(this.selectAllIndeterminate=!0)}watch10(){this.watch10Fn()}watch11Fn(){var i,t;this._options=this.options,this.amountOptions=null!==(t=null===(i=this.options)||void 0===i?void 0:i.filter((i=>!i.isGroupTitle)).length)&&void 0!==t?t:0}watch11(){this.watch11Fn()}watch12Fn(){this._searchValue=this.searchValue,this.searchValue&&this.handleSearch(this.searchValue)}watch12(){this.watch12Fn()}watch13Fn(){var i,t;(null===(i=this.options)||void 0===i?void 0:i.length)&&(this._selectedOptions=null===(t=this.options)||void 0===t?void 0:t.filter((i=>{var t,s;return!(!i.value||!(null===(t=this._values)||void 0===t?void 0:t.includes))&&!i.isGroupTitle&&(null===(s=this._values)||void 0===s?void 0:s.includes(i.value))})))}watch13(){this.watch13Fn()}watch14Fn(){var i,t,s;if(this.selectedLabels)this._selectedLabels=this.selectedLabels;else if(null===(i=this._selectedOptions)||void 0===i?void 0:i.length){if(this.transformSelectedLabels)return void(this._selectedLabels=(0,this.transformSelectedLabels)(this._selectedOptions));this._selectedLabels="amount"===this.selectedType?this.amountText?this.amountText:`${null===(t=this._selectedOptions)||void 0===t?void 0:t.length} ${r}`:null===(s=this._selectedOptions)||void 0===s?void 0:s.map((i=>this.getOptionLabel(i))).join(", ")}else this._selectedLabels=""}watch14(){this.watch14Fn()}watch15Fn(){var i,t;this.amountChange&&this.amountChange.emit(null!==(t=null===(i=this._selectedOptions)||void 0===i?void 0:i.length)&&void 0!==t?t:0)}watch15(){this.watch15Fn()}watch16Fn(){this.selectAllRef&&(this.selectAllRef.indeterminate=Boolean(this.selectAllIndeterminate))}watch16(){this.watch16Fn()}watch17Fn(){var i;this._invalidMessage=this.invalidMessage||(null===(i=this.selectRef)||void 0===i?void 0:i.validationMessage)||l}watch17(){this.watch17Fn()}componentDidLoad(){var i;this.enableAttributePassing(this._ref,"db-custom-select");const t=null!==(i=this.id)&&void 0!==i?i:`custom-select-${k()}`;this._id=t,this._messageId=t+u,this._validMessageId=t+n,this._invalidMessageId=t+c,this._selectId=t+d,this._labelId=t+o,this._summaryId=t+"-summary",this._placeholderId=t+v,this._selectedLabelsId=t+"-selected-labels",this._infoTextId=t+"-info",this._invalidMessage=this.invalidMessage||l,"undefined"!=typeof window&&"IntersectionObserver"in window&&(this._observer=new IntersectionObserver((i=>{if(this.detailsRef){const t=i.find((({target:i})=>i===this.detailsRef));t&&!t.isIntersecting&&this.detailsRef.open&&(this.detailsRef.open=!1)}}))),this.watch0Fn(),this.watch1Fn(),this.watch2Fn(),this.watch3Fn(),this.watch4Fn(),this.watch5Fn(),this.watch6Fn(),this.watch7Fn(),this.watch8Fn(),this.watch9Fn(),this.watch10Fn(),this.watch11Fn(),this.watch12Fn(),this.watch13Fn(),this.watch14Fn(),this.watch15Fn(),this.watch16Fn(),this.watch17Fn()}disconnectedCallback(){var i;null===(i=this.abortController)||void 0===i||i.abort()}render(){var i,t,l,a,o,d,n,c,v,r,u,m,p,g,k;return s("div",{key:"e3c88fad9a69c3a3f55084c42eaa18dd0b328fcb",class:D("db-custom-select",this.className),id:this._id,ref:i=>{this._ref=i},"aria-invalid":"invalid"===this._validity,"data-custom-validity":this._validity,"data-width":this.formFieldWidth,"data-variant":"floating"===this.variant&&"tag"===this.selectedType&&this.multiple?"above":this.variant,"data-required":F(this.required),"data-hide-asterisk":x(this.showRequiredAsterisk),"data-placement":this.placement,"data-selected-type":this.multiple?this.selectedType:"text","data-hide-label":x(this.showLabel),"data-icon":this.icon,"data-show-icon":F(this.showIcon)},s("label",{key:"8761c16255c8722f01008536cefbaac50677095b",id:this._labelId},null!==(i=this.label)&&void 0!==i?i:e,s("select",{key:"d750bdd188427d5fc4e15a53d5640a7b55a360cd",role:"none",hidden:!0,id:this._selectId,tabIndex:-1,ref:i=>{this.selectRef=i},form:this.form,name:this.name,multiple:A(this.multiple,"multiple"),disabled:A(this.disabled,"disabled"),required:A(this.required,"required"),onChange:i=>this.satisfyReact(i)},(null===(t=this.options)||void 0===t?void 0:t.length)?null===(l=this.options)||void 0===l?void 0:l.map((i=>s("option",{disabled:i.disabled,value:i.value,key:void 0},this.getOptionLabel(i)))):null)),s("details",{key:"4554ef5982957f7202f0109f0d081f6dde2d078c",ref:i=>{this.detailsRef=i},open:this.open,onToggle:i=>this.handleDropdownToggle(i),onKeyDown:i=>this.handleKeyboardPress(i)},s("slot",{key:"3ee9982ab7ea04516f50b6ad7ba68da802e6df20"}),this.options?s(h,null,s("summary",{class:"db-custom-select-form-field",id:this._summaryId,"aria-disabled":F(this.disabled),"aria-labelledby":this._labelId},(null===(a=this._selectedLabels)||void 0===a?void 0:a.length)?s("span",{"data-visually-hidden":F("tag"===this.selectedType),id:this._selectedLabelsId},this.selectedPrefix?s("span",{"data-visually-hidden":"true"},this.selectedPrefix):null,this._selectedLabels):null,"tag"===this.selectedType?s("div",null,null===(o=this._selectedOptions)||void 0===o?void 0:o.map((i=>s("db-tag",{emphasis:"strong",behavior:"removable",removeButton:this.getTagRemoveLabel(i),onRemove:t=>this.handleTagRemove(i,t),key:void 0},this.getOptionLabel(i))))):null),s("db-custom-select-dropdown",{width:this.dropdownWidth},this.searchEnabled?s("div",null,s("db-input",{type:"search",ref:i=>{this.searchInputRef=i},name:this._id,form:this._id,showLabel:!1,value:this._searchValue,label:null!==(d=this.searchLabel)&&void 0!==d?d:e,placeholder:null!==(n=this.searchPlaceholder)&&void 0!==n?n:this.searchLabel,ariaDescribedBy:this._hasNoOptions||this.showLoading?this._infoTextId:void 0,onInput:i=>this.handleSearch(i)})):null,this._hasNoOptions||this.showLoading?s("db-infotext",{id:this._infoTextId,icon:this.showLoading?"circular_arrows":void 0,semantic:this.showLoading?"informational":"warning"},null!==(c=this.showLoading?this.loadingText:this.noResultsText)&&void 0!==c?c:f):s(h,null,this.selectAllEnabled?s("div",null,s("div",{class:"db-checkbox db-custom-select-list-item"},s("label",null,s("input",{type:"checkbox",value:"select-all",ref:i=>{this.selectAllRef=i},form:this._id,checked:this.selectAllChecked,onChange:i=>this.handleSelectAll(i)}),this.getSelectAllLabel()))):null,s("db-custom-select-list",{multiple:A(this.multiple,"multiple"),label:null!==(r=null!==(v=this.listLabel)&&void 0!==v?v:this.label)&&void 0!==r?r:e},null===(u=this._options)||void 0===u?void 0:u.map((i=>s("db-custom-select-list-item",{type:this.multiple?"checkbox":"radio",showDivider:i.showDivider,icon:i.icon,isGroupTitle:i.isGroupTitle,groupTitle:this.getOptionLabel(i),name:this._id,checked:this.getOptionChecked(i.value),disabled:i.disabled,value:i.value,onChange:()=>this.handleSelect(i.value),key:void 0},i.isGroupTitle?null:this.getOptionLabel(i)))))),s("div",null,s("db-button",{variant:"ghost",width:"full",icon:"cross",size:"small",name:this._id,form:this._id,onClick:()=>this.handleClose(void 0,!0)},null!==(m=this.mobileCloseButtonText)&&void 0!==m?m:b)))):null),(null===(p=this.showClearSelection)||void 0===p||p)&&(null===(g=this._values)||void 0===g?void 0:g.length)?s("db-button",{icon:"cross",variant:"ghost",size:"small",noText:!0,name:this._id,form:this._id,onClick:i=>this.handleClearAll(i)},this.clearSelectionText,s("db-tooltip",{placement:"top"},this.clearSelectionText)):null,s("span",{key:"0294aea948930da94ffda5cc9c2a06439d284dca",class:"db-custom-select-placeholder","aria-hidden":F(!0),id:this._placeholderId},null!==(k=this.placeholder)&&void 0!==k?k:this.label),y(this.message,this.showMessage)?s("db-infotext",{size:"small",icon:this.messageIcon,id:this._messageId},this.message):null,this.hasValidState()?s("db-infotext",{size:"small",semantic:"successful",id:this._validMessageId},this.validMessage||w):null,s("db-infotext",{key:"36d6fb52fc71e38c2fae07741b489bbcad2cd1f8",size:"small",semantic:"critical",id:this._invalidMessageId},this._invalidMessage),s("span",{key:"bb1406432ebb877e25f5cfc2ea90a3719d0c50aa","data-visually-hidden":"true",role:"status"},this._voiceOverFallback))}static get watchers(){return{detailsRef:[{watch0:0},{watch2:0}],_id:[{watch1:0}],_descByIds:[{watch2:0}],showNoResults:[{watch3:0}],showLoading:[{watch3:0}],_options:[{watch3:0}],showSelectAll:[{watch4:0}],amountOptions:[{watch4:0},{watch5:0},{watch10:0}],multiple:[{watch4:0}],showSearch:[{watch5:0}],values:[{watch6:0}],_values:[{watch7:0},{watch10:0},{watch13:0}],selectRef:[{watch7:0},{watch8:0},{watch17:0}],validation:[{watch9:0}],options:[{watch11:0},{watch13:0}],searchValue:[{watch12:0}],_selectedOptions:[{watch14:0},{watch15:0}],selectedType:[{watch14:0}],amountText:[{watch14:0}],selectedLabels:[{watch14:0}],transformSelectedLabels:[{watch14:0}],selectAllIndeterminate:[{watch16:0}],selectAllRef:[{watch16:0}],invalidMessage:[{watch17:0}]}}};export{B as db_custom_select}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as i}from"./p-9pYJFapZ.js";import{s as a}from"./p-BdL-nI5y.js";import{o as e,d,g as h,c}from"./p-BwBkekqp.js";const r=class{constructor(i){t(this,i),this.close=s(this,"close"),this.initialized=!1}handleClose(t,s){var i;t&&(e(t)?"Escape"===t.key&&(t.preventDefault(),this.close&&this.close.emit(t)):(s&&(t.stopPropagation(),this.close&&this.close.emit(t)),"DIALOG"===(null===(i=t.target)||void 0===i?void 0:i.nodeName)&&"click"===t.type&&"none"!==this.backdrop&&this.close&&this.close.emit(t)))}handleDialogOpen(){if(this._ref){const t=Boolean(this.open);t&&!this._ref.open&&(this.dialogContainerRef&&(this.dialogContainerRef.hidden=!1),"absolute"===this.position||"none"===this.backdrop||"inside"===this.variant?this._ref.show():this._ref.showModal()),!t&&this._ref.open&&(this.dialogContainerRef&&(this.dialogContainerRef.hidden=!0),d((()=>{var t;this.dialogContainerRef&&(this.dialogContainerRef.hidden=!1),null===(t=this._ref)||void 0===t||t.close()}),401))}}enableAttributePassing(t,s){const i=null==t?void 0:t.closest(s);if(t&&i){const s=i.attributes;for(let a=0;a<s.length;a++){const e=s.item(a);if(e&&(e.name.startsWith("data-")||e.name.startsWith("aria-"))&&(t.setAttribute(e.name,e.value),i.removeAttribute(e.name)),e&&"class"===e.name){const s=e.value.includes("hydrated"),a=e.value.replace("hydrated","").trim(),d=t.getAttribute("class");t.setAttribute(e.name,`${d?`${d} `:""}${a}`),s?i.setAttribute("class","hydrated"):i.removeAttribute(e.name)}}}}watch0Fn(){this.handleDialogOpen()}watch0(){this.watch0Fn()}watch1Fn(){if(this._ref&&this.initialized&&"absolute"===this.position){const t=this._ref.parentElement;t&&(t.style.position="relative")}}watch1(){this.watch1Fn()}componentDidLoad(){this.enableAttributePassing(this._ref,"db-drawer"),this.handleDialogOpen(),this.initialized=!0,this.watch0Fn(),this.watch1Fn()}render(){var t;return i("dialog",{key:"bde9fb000bc000b3371ab4e7333ec0b7e802a1d5",class:"db-drawer",id:this.id,ref:t=>{this._ref=t},onClick:t=>this.handleClose(t),onKeyDown:t=>this.handleClose(t),"data-position":this.position,"data-backdrop":this.backdrop,"data-direction":this.direction,"data-variant":this.variant},i("article",{key:"62fb34f827d93c6a52e6dc79fb0970879b07dd72",class:c("db-drawer-container",this.className),ref:t=>{this.dialogContainerRef=t},"data-spacing":this.spacing,"data-width":this.width,"data-direction":this.direction,"data-rounded":h(this.rounded)},i("header",{key:"81567140972ebb1f244c46227f688f017b2d74da",class:"db-drawer-header"},i("div",{key:"14fe9424f88dd71bedc5b670edf7d776639ad65f",class:"db-drawer-header-text"},i("slot",{key:"e8f703b2d8c81c9e64996f6c8214ae004484698c",name:"drawerHeader"})),i("db-button",{key:"7f18727c2550a75ed735d11b8983b9b6bca0f1d4",class:"button-close-drawer",icon:"cross",variant:"ghost",id:this.closeButtonId,noText:!0,onClick:t=>this.handleClose(t,!0)},null!==(t=this.closeButtonText)&&void 0!==t?t:a)),i("div",{key:"e2b7f182c9f321f5477ee4669451e10935cae010",class:"db-drawer-content"},i("slot",{key:"23bb4b8cf2c617757379637fab20361b6d4943f2"}))))}static get watchers(){return{open:[{watch0:0}],_ref:[{watch1:0}],initialized:[{watch1:0}],position:[{watch1:0}]}}};export{r as db_drawer}
|