@watermarkinsights/ripple 5.6.0-8 → 5.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{chartFunctions-995023b1.js → chartFunctions-6fd43417.js} +1 -1
- package/dist/cjs/{functions-e24249e6.js → functions-04149f6d.js} +0 -6
- package/dist/cjs/{global-9662b435.js → global-4a315ae6.js} +1 -1
- package/dist/cjs/index-e86c28b6.js +0 -12
- package/dist/cjs/{intl-5aeba788.js → intl-b1e99809.js} +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/priv-calendar.cjs.entry.js +1 -1
- package/dist/cjs/priv-chart-popover.cjs.entry.js +1 -1
- package/dist/cjs/ripple.cjs.js +2 -2
- package/dist/cjs/wm-action-menu_2.cjs.entry.js +1 -1
- package/dist/cjs/wm-button.cjs.entry.js +1 -1
- package/dist/cjs/wm-chart.cjs.entry.js +3 -3
- package/dist/cjs/wm-date-range.cjs.entry.js +1 -1
- package/dist/cjs/wm-datepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-file.cjs.entry.js +1 -1
- package/dist/cjs/wm-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-line-chart.cjs.entry.js +10 -25
- package/dist/cjs/wm-modal-header.cjs.entry.js +2 -2
- package/dist/cjs/wm-modal.cjs.entry.js +1 -1
- package/dist/cjs/wm-navigation_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-navigator.cjs.entry.js +1 -1
- package/dist/cjs/wm-option_2.cjs.entry.js +338 -33
- package/dist/cjs/wm-pagination.cjs.entry.js +1 -1
- package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +2 -2
- package/dist/cjs/wm-search.cjs.entry.js +2 -2
- package/dist/cjs/wm-snackbar.cjs.entry.js +2 -2
- package/dist/cjs/wm-tab-item_3.cjs.entry.js +1 -1
- package/dist/cjs/wm-tag-input.cjs.entry.js +2 -2
- package/dist/cjs/wm-tag-option.cjs.entry.js +1 -1
- package/dist/cjs/wm-textarea.cjs.entry.js +2 -2
- package/dist/cjs/wm-timepicker.cjs.entry.js +1 -1
- package/dist/cjs/wm-toggletip.cjs.entry.js +1 -1
- package/dist/cjs/wm-uploader.cjs.entry.js +2 -2
- package/dist/collection/collection-manifest.json +2 -5
- package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +7 -22
- package/dist/collection/components/wm-option/wm-option.js +9 -35
- package/dist/collection/components/wm-option/wm-option.spec.js +1 -1
- package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.css +74 -0
- package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.js +383 -16
- package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.spec.js +62 -62
- package/dist/collection/global/functions.js +0 -5
- package/dist/esm/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
- package/dist/esm/{functions-b791a892.js → functions-cf37f81f.js} +1 -6
- package/dist/esm/{global-f1582c2f.js → global-016b76a8.js} +1 -1
- package/dist/esm/index-558b5a82.js +0 -12
- package/dist/esm/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
- package/dist/esm/loader.js +2 -2
- package/dist/esm/priv-calendar.entry.js +1 -1
- package/dist/esm/priv-chart-popover.entry.js +1 -1
- package/dist/esm/ripple.js +2 -2
- package/dist/esm/wm-action-menu_2.entry.js +1 -1
- package/dist/esm/wm-button.entry.js +1 -1
- package/dist/esm/wm-chart.entry.js +3 -3
- package/dist/esm/wm-date-range.entry.js +1 -1
- package/dist/esm/wm-datepicker.entry.js +1 -1
- package/dist/esm/wm-file.entry.js +1 -1
- package/dist/esm/wm-input.entry.js +2 -2
- package/dist/esm/wm-line-chart.entry.js +10 -25
- package/dist/esm/wm-modal-header.entry.js +2 -2
- package/dist/esm/wm-modal.entry.js +1 -1
- package/dist/esm/wm-navigation_3.entry.js +2 -2
- package/dist/esm/wm-navigator.entry.js +1 -1
- package/dist/esm/wm-option_2.entry.js +338 -33
- package/dist/esm/wm-pagination.entry.js +1 -1
- package/dist/esm/wm-progress-indicator_3.entry.js +2 -2
- package/dist/esm/wm-search.entry.js +2 -2
- package/dist/esm/wm-snackbar.entry.js +2 -2
- package/dist/esm/wm-tab-item_3.entry.js +1 -1
- package/dist/esm/wm-tag-input.entry.js +2 -2
- package/dist/esm/wm-tag-option.entry.js +1 -1
- package/dist/esm/wm-textarea.entry.js +2 -2
- package/dist/esm/wm-timepicker.entry.js +1 -1
- package/dist/esm/wm-toggletip.entry.js +1 -1
- package/dist/esm/wm-uploader.entry.js +2 -2
- package/dist/esm-es5/{chartFunctions-dfcb1edf.js → chartFunctions-f5eb7f59.js} +1 -1
- package/dist/esm-es5/{functions-b791a892.js → functions-cf37f81f.js} +1 -1
- package/dist/esm-es5/global-016b76a8.js +1 -0
- package/dist/esm-es5/index-558b5a82.js +1 -1
- package/dist/esm-es5/{intl-f2f7ce8b.js → intl-c72b75dc.js} +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/priv-calendar.entry.js +1 -1
- package/dist/esm-es5/priv-chart-popover.entry.js +1 -1
- package/dist/esm-es5/ripple.js +1 -1
- package/dist/esm-es5/wm-action-menu_2.entry.js +1 -1
- package/dist/esm-es5/wm-button.entry.js +1 -1
- package/dist/esm-es5/wm-chart.entry.js +1 -1
- package/dist/esm-es5/wm-date-range.entry.js +1 -1
- package/dist/esm-es5/wm-datepicker.entry.js +1 -1
- package/dist/esm-es5/wm-file.entry.js +1 -1
- package/dist/esm-es5/wm-input.entry.js +1 -1
- package/dist/esm-es5/wm-line-chart.entry.js +1 -1
- package/dist/esm-es5/wm-modal-header.entry.js +1 -1
- package/dist/esm-es5/wm-modal.entry.js +1 -1
- package/dist/esm-es5/wm-navigation_3.entry.js +1 -1
- package/dist/esm-es5/wm-navigator.entry.js +1 -1
- package/dist/esm-es5/wm-option_2.entry.js +1 -1
- package/dist/esm-es5/wm-pagination.entry.js +1 -1
- package/dist/esm-es5/wm-progress-indicator_3.entry.js +1 -1
- package/dist/esm-es5/wm-search.entry.js +1 -1
- package/dist/esm-es5/wm-snackbar.entry.js +1 -1
- package/dist/esm-es5/wm-tab-item_3.entry.js +1 -1
- package/dist/esm-es5/wm-tag-input.entry.js +1 -1
- package/dist/esm-es5/wm-tag-option.entry.js +1 -1
- package/dist/esm-es5/wm-textarea.entry.js +1 -1
- package/dist/esm-es5/wm-timepicker.entry.js +1 -1
- package/dist/esm-es5/wm-toggletip.entry.js +1 -1
- package/dist/esm-es5/wm-uploader.entry.js +1 -1
- package/dist/ripple/{p-c1e3c2fb.entry.js → p-04f9a60a.entry.js} +1 -1
- package/dist/ripple/{p-41550baa.entry.js → p-0b570b66.entry.js} +1 -1
- package/dist/ripple/{p-5300b15d.entry.js → p-0d05b4a9.entry.js} +1 -1
- package/dist/ripple/p-11aaef56.system.entry.js +1 -0
- package/dist/ripple/{p-b01f9998.system.entry.js → p-120dbdc8.system.entry.js} +1 -1
- package/dist/ripple/{p-f24572f5.entry.js → p-1aef4b40.entry.js} +1 -1
- package/dist/ripple/{p-13f51c06.entry.js → p-20a800a7.entry.js} +1 -1
- package/dist/ripple/{p-236af552.entry.js → p-24103be5.entry.js} +1 -1
- package/dist/ripple/{p-1389302e.system.entry.js → p-2ccf8450.system.entry.js} +1 -1
- package/dist/ripple/{p-6cc07645.system.entry.js → p-2d0bcc88.system.entry.js} +1 -1
- package/dist/ripple/{p-0b1c6965.system.entry.js → p-2d0e4020.system.entry.js} +1 -1
- package/dist/ripple/{p-215793a4.entry.js → p-31094930.entry.js} +1 -1
- package/dist/ripple/{p-1e625a5e.entry.js → p-3ea0e27c.entry.js} +1 -1
- package/dist/ripple/{p-db9657eb.system.entry.js → p-446e0b2c.system.entry.js} +1 -1
- package/dist/ripple/{p-72165bd2.entry.js → p-451433a6.entry.js} +1 -1
- package/dist/ripple/p-481a9e2f.system.js +1 -0
- package/dist/ripple/{p-45f9ad09.entry.js → p-508362c5.entry.js} +1 -1
- package/dist/ripple/{p-3deaf4d9.system.entry.js → p-53519eed.system.entry.js} +1 -1
- package/dist/ripple/p-55668879.system.js +1 -0
- package/dist/ripple/p-5967bd2a.system.entry.js +1 -0
- package/dist/ripple/{p-5a9e3108.system.entry.js → p-5db92638.system.entry.js} +1 -1
- package/dist/ripple/{p-3e415c49.system.entry.js → p-5f793375.system.entry.js} +1 -1
- package/dist/ripple/p-6636a40b.system.entry.js +1 -0
- package/dist/ripple/{p-f90e4094.entry.js → p-6f4c4231.entry.js} +1 -1
- package/dist/ripple/{p-828adbf1.system.js → p-74032162.system.js} +1 -1
- package/dist/ripple/{p-5284791c.entry.js → p-762429a8.entry.js} +1 -1
- package/dist/ripple/{p-16f65bf4.js → p-76825602.js} +1 -1
- package/dist/ripple/{p-c47fab48.entry.js → p-76d53189.entry.js} +1 -1
- package/dist/ripple/{p-fa4f1030.system.entry.js → p-7f483c55.system.entry.js} +1 -1
- package/dist/ripple/{p-a3c01e10.system.entry.js → p-7fdcce90.system.entry.js} +1 -1
- package/dist/ripple/{p-cad0c5f9.system.entry.js → p-8008f0f2.system.entry.js} +1 -1
- package/dist/ripple/{p-3d50db36.entry.js → p-86d81e42.entry.js} +1 -1
- package/dist/ripple/{p-f2101a0d.entry.js → p-8a11ee6f.entry.js} +1 -1
- package/dist/ripple/{p-c2e00d4a.system.entry.js → p-8b272d80.system.entry.js} +1 -1
- package/dist/ripple/{p-885c3527.entry.js → p-9603168d.entry.js} +1 -1
- package/dist/ripple/{p-f40e1468.system.entry.js → p-97f276aa.system.entry.js} +1 -1
- package/dist/ripple/{p-749597da.system.entry.js → p-984287f7.system.entry.js} +1 -1
- package/dist/ripple/{p-ff1ed90f.entry.js → p-9b75d56c.entry.js} +1 -1
- package/dist/ripple/{p-a0ecb6d7.system.entry.js → p-9df3574d.system.entry.js} +1 -1
- package/dist/ripple/p-a40b0af9.system.js +1 -0
- package/dist/ripple/p-a895f1ef.entry.js +1 -0
- package/dist/ripple/{p-e081fdc2.system.entry.js → p-ae4460f2.system.entry.js} +1 -1
- package/dist/ripple/{p-b9dbf1f4.entry.js → p-bd142645.entry.js} +1 -1
- package/dist/ripple/{p-aea13873.entry.js → p-c61366fd.entry.js} +1 -1
- package/dist/ripple/{p-ca971eac.system.entry.js → p-c9200deb.system.entry.js} +1 -1
- package/dist/ripple/{p-6d129ef8.system.entry.js → p-cd51ee87.system.entry.js} +1 -1
- package/dist/ripple/{p-465d44f0.system.entry.js → p-ce8c6180.system.entry.js} +1 -1
- package/dist/ripple/{p-84ba5b74.entry.js → p-d0387d35.entry.js} +1 -1
- package/dist/ripple/{p-ed1f6b8d.system.entry.js → p-d8994408.system.entry.js} +1 -1
- package/dist/ripple/{p-eddbcb21.js → p-db190563.js} +1 -1
- package/dist/ripple/{p-83be63f6.entry.js → p-db8917e4.entry.js} +1 -1
- package/dist/ripple/{p-505eca1c.system.entry.js → p-dc7a6037.system.entry.js} +1 -1
- package/dist/ripple/p-dfd1b720.entry.js +1 -0
- package/dist/ripple/{p-df157138.entry.js → p-e3899e1f.entry.js} +1 -1
- package/dist/ripple/{p-30b905eb.system.entry.js → p-ed1971ff.system.entry.js} +1 -1
- package/dist/ripple/{p-2e79fa49.entry.js → p-f177d841.entry.js} +1 -1
- package/dist/ripple/{p-149a22bf.entry.js → p-f4b64ded.entry.js} +1 -1
- package/dist/ripple/p-f9494a9d.js +1 -0
- package/dist/ripple/{p-21d372ed.js → p-fb229776.js} +1 -1
- package/dist/ripple/{p-81c2df85.system.js → p-fb751343.system.js} +1 -1
- package/dist/ripple/{p-c853e185.system.entry.js → p-ffa15c47.system.entry.js} +1 -1
- package/dist/ripple/ripple.esm.js +1 -1
- package/dist/ripple/ripple.js +1 -1
- package/dist/types/components/charts/wm-line-chart/wm-line-chart.d.ts +1 -1
- package/dist/types/components/wm-option/wm-option.d.ts +39 -0
- package/dist/types/components/wm-select/wm-select.d.ts +96 -0
- package/dist/types/components.d.ts +2 -148
- package/dist/types/global/functions.d.ts +0 -1
- package/package.json +2 -2
- package/dist/cjs/priv-option-list.cjs.entry.js +0 -384
- package/dist/cjs/wm-nested-select.cjs.entry.js +0 -295
- package/dist/cjs/wm-optgroup.cjs.entry.js +0 -56
- package/dist/collection/components/selects/priv-option-list/priv-option-list.css +0 -104
- package/dist/collection/components/selects/priv-option-list/priv-option-list.js +0 -714
- package/dist/collection/components/selects/wm-nested-select/wm-nested-select.css +0 -378
- package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +0 -581
- package/dist/collection/components/selects/wm-optgroup/wm-optgroup.css +0 -77
- package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +0 -197
- package/dist/collection/dev/nested-select.js +0 -62
- package/dist/esm/priv-option-list.entry.js +0 -380
- package/dist/esm/wm-nested-select.entry.js +0 -291
- package/dist/esm/wm-optgroup.entry.js +0 -52
- package/dist/esm-es5/global-f1582c2f.js +0 -1
- package/dist/esm-es5/priv-option-list.entry.js +0 -1
- package/dist/esm-es5/wm-nested-select.entry.js +0 -1
- package/dist/esm-es5/wm-optgroup.entry.js +0 -1
- package/dist/ripple/p-104c0e9b.system.entry.js +0 -1
- package/dist/ripple/p-17c8aac1.system.entry.js +0 -1
- package/dist/ripple/p-24ba754f.entry.js +0 -1
- package/dist/ripple/p-2fb58947.entry.js +0 -1
- package/dist/ripple/p-4564a101.system.entry.js +0 -1
- package/dist/ripple/p-4ca5ed96.entry.js +0 -1
- package/dist/ripple/p-50388b6f.system.entry.js +0 -1
- package/dist/ripple/p-5b9babd9.system.entry.js +0 -1
- package/dist/ripple/p-8835adfb.entry.js +0 -1
- package/dist/ripple/p-ae82b3d2.system.js +0 -1
- package/dist/ripple/p-ba422994.entry.js +0 -1
- package/dist/ripple/p-bfeb6ef8.system.js +0 -1
- package/dist/ripple/p-cf2121f3.system.entry.js +0 -1
- package/dist/ripple/p-cf55659f.js +0 -1
- package/dist/ripple/p-f6fd623f.system.js +0 -1
- package/dist/types/components/selects/wm-select/wm-select.d.ts +0 -53
- /package/dist/collection/components/{selects/wm-select → wm-select}/wm-select.e2e.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as e,f as i,h as r,g as o}from"./p-568c595f.js";import{i as a,d as s,u as n,m as l,h,v as d,w as c,s as p,k as g,x as u}from"./p-16f65bf4.js";import{g as m}from"./p-21d372ed.js";const w=class{constructor(r){t(this,r),this.wmTagInputTagAdded=e(this,"wmTagInputTagAdded",7),this.addNewHelpText=a.formatMessage({id:"tagInput.addNewHelpText",defaultMessage:"Press the Enter or Comma key to add a new tag.",description:"Help text appearing in a dropdown. Use imperative"}),this.selectionHelpText=a.formatMessage({id:"tagInput.selectionHelpText",defaultMessage:"Search and select a tag.",description:"Help text appearing in a dropdown. Use imperative"}),this.maxTagsReachedMessage=a.formatMessage({id:"tagInput.maxTagsReached",defaultMessage:"No more tags can be added because the limit has been reached."}),this.tagAreaInstructions=a.formatMessage({id:"tagInput.tagAreaInstructions",defaultMessage:"tag selection. Press Backspace or Delete to remove a tag."}),this.tagsAddedMessage=a.formatMessage({id:"tagInput.tagsAdded",defaultMessage:"Tags added",description:"Full message for context: 'Tags added: x/y"}),this.openUp=!1,this.inModal=!1,this.debouncedUpdate=s((()=>i(this.el)),30),this.label=void 0,this.errorMessage=void 0,this.info=void 0,this.labelPosition="top",this.maxTags=void 0,this.placeholder=void 0,this.requiredField=!1,this.tagInputType="dropdown",this.helpText=void 0,this.addNew=!0,this.characterLimit=50,this.colHeaders=void 0,this.colWidths=void 0,this.colWrap=void 0,this.isKeying=!1,this.isExpanded=!1,this.liveRegionMessage="",this.focusedOption=void 0,this.focusedColumn=0,this.focusedTagIndex=void 0,this.tagsList=[]}toggleKeyingOn(){this.isKeying=!0}toggleKeyingOff(){this.isKeying=!1}get isDropdown(){return"dropdown"===this.tagInputType}get isTable(){return"table"===this.tagInputType}get charCount(){return this.inputEl?this.inputEl.value.length:0}get tooltipVisible(){return document.getElementById("wm-tooltip").classList.contains("show")}get optionEls(){return Array.from(this.el.querySelectorAll("wm-tag-option"))}get filteredOptionEls(){const t=this.inputEl?this.inputEl.value.toLowerCase():"";return Array.from(this.optionEls).filter((e=>{let i="";return this.isDropdown?i=e.textContent.toLowerCase():this.isTable&&(i=[e.col1,e.col2,e.col3,e.col4].join("").toLowerCase()),i.includes(t)}))}get taggedOptions(){return this.optionEls.filter((t=>t.selected||t.locked))}get _tagEls(){return this.tagAreaEl?Array.from(this.tagAreaEl.querySelectorAll(".tag")):[]}get focusedTag(){if(void 0!==this.focusedTagIndex&&this.focusedTagIndex>=0)return this._tagEls[this.focusedTagIndex]}tagOptionFromEl(t){return"add-new-btn"===t.id?void 0:this.el.querySelector("#"+t.id)}tagOptionFromTag(t){const e=t.id.replace("tag-","");return this.el.querySelector("#"+e)}elFromTagOption(t){return this.el.shadowRoot.querySelector("#"+t.id)}get _focusedOption(){return this.focusedOption?this.elFromTagOption(this.focusedOption):this.addNewButton&&this.addNewButton.classList.contains("focused")?this.addNewButton:void 0}get _focusedCell(){if(this._focusedOption)return Array.from(this._focusedOption.querySelectorAll("td"))[this.focusedColumn||0]}get inputActiveDescendantId(){return this._focusedOption?this.isTable?Array.from(this._focusedOption.querySelectorAll("td"))[this.focusedColumn].id:this._focusedOption.id:null}get tagLimitReached(){return!!(this.maxTags&&this.taggedOptions.length>=this.maxTags)}get noResultsMessage(){return a.formatMessage({id:"tagInput.noResults",defaultMessage:"No results match your search.",description:"Message displayed when a user's search returns empty."})}get inputMinimumWidth(){if(this._tagEls){const t=getComputedStyle(this.inputEl),e=getComputedStyle(this._tagEls[this._tagEls.length-1]),i=[t.paddingLeft,t.paddingRight,t.marginLeft,t.marginRight,e.marginRight].reduce(((t,e)=>t+parseInt(e.replace("px",""))),0);return Math.max(150,n(this.inputEl,this.placeholder).width+i)}return 150}getTagName(t){return this.isDropdown?t.textContent:t.col1}isExistingTag(t){return this.optionEls.map((t=>this.getTagName(t).toLowerCase())).includes(t.toLowerCase())}tagAddedMessage(t){return a.formatMessage({id:"tagInput.tagAdded",defaultMessage:"{tagName} added.",description:"A confirmation for adding a tag."},{tagName:t})}tagRemovedMessage(t){return a.formatMessage({id:"tagInput.tagRemoved",defaultMessage:"{tagName} removed.",description:"A confirmation for removing a tag."},{tagName:t})}tagAlreadyAddedMessage(t){return a.formatMessage({id:"tagInput.tagAlreadyAdded",defaultMessage:"{tagName} has already been added.",description:"An alert for adding a tag that is already present."},{tagName:t})}tagLockedMessage(t){return a.formatMessage({id:"tagInput.tagLocked",defaultMessage:"{tagName} is locked and cannot be removed.",description:"An alert for when a user tries to remove a tag that is locked."},{tagName:t})}isElOrChild(t){return t===this.el||this.el.shadowRoot.contains(t)||this.el.contains(t)}componentWillLoad(){this.placeholder||(this.placeholder=this.createPlaceholderDefault(this.addNew,this.optionEls.length>0)),this.label||console.error("wm-tag-input must have a label property"),this.el.focus=()=>{const t=this._tagEls[0];t?(this.tagAreaEl.focus(),this.focusTag(t)):this.inputEl.focus()},new ResizeObserver((()=>this.debouncedUpdate())).observe(this.el),this.el.closest("wm-modal")&&(this.inModal=!0);const t=[],e=[];this.optionEls.forEach((i=>{i.locked?t.push(i):i.selected&&e.push(i)})),this.tagsList=[...t,...e]}componentDidLoad(){new MutationObserver((t=>t.forEach((t=>this.handleChangeAnnouncement(t))))).observe(this.el,{subtree:!0,attributes:!0,attributeFilter:["selected"],childList:!0}),new MutationObserver((t=>t.forEach((t=>this.handleOptionListChange(t))))).observe(this.el,{childList:!0}),this.tagAreaEl&&new MutationObserver((t=>t.forEach((t=>this.handleTagListChange(t))))).observe(this.tagAreaEl,{childList:!0})}handleChangeAnnouncement(t){const e=t.target;if("childList"==t.type&&t.removedNodes.length>0)this.announce(this.tagRemovedMessage(t.removedNodes[0].textContent));else if("attributes"==t.type){const t=this.getTagName(e);if(e.selected){let e=this.tagAddedMessage(t);this.tagLimitReached&&(e+=` ${this.maxTagsReachedMessage}`),this.announce(e)}else this.announce(this.tagRemovedMessage(t))}}handleOptionListChange(t){const e=Array.from(t.addedNodes);e.length>0&&e.forEach((t=>!this.tagsList.includes(t)&&this.tagsList.push(t)));const i=Array.from(t.removedNodes);i.length>0&&(this.tagsList=this.tagsList.filter((t=>!i.includes(t))))}handleTagOptionSelected(t){this.tagsList=this.tagsList.concat(t.target)}handleTagOptionDeselected(t){const e=t.target;this.tagsList=this.tagsList.filter((t=>t!=e))}handleTagListChange(t){const e=Array.from(t.addedNodes);e&&e.forEach((t=>{t.classList.add("highlight")}));const i=t.removedNodes[0];i&&(i.classList.remove("highlight"),this.focusedTag?this.focusTag(this.focusedTag):this._tagEls.length>0?this.focusTag(this._tagEls[this._tagEls.length-1]):this.inputEl.focus())}componentDidRender(){this.positionInput(),this._tagEls.forEach((t=>{const e=t.querySelector(".tag-text"),i=this.el.shadowRoot.querySelector(".tags-and-input-wrapper"),r=e.getBoundingClientRect().left,o=i.getBoundingClientRect().right-10-8-28,a=t.id.replace("tag-",""),s=a&&this.el.querySelector("#"+a);s&&(e.textContent=l(e,this.getTagName(s),o-r,5))}))}createPlaceholderDefault(t,e){const i=a.formatMessage({id:"tagInput.placeholderAddAndSearch",defaultMessage:"Add or search for a tag",description:"Placeholder text. Use imperative"}),r=a.formatMessage({id:"tagInput.placeholderSearch",defaultMessage:"Search and select a tag",description:"Placeholder text. Use imperative"}),o=a.formatMessage({id:"tagInput.placeholderAdd",defaultMessage:"Add a new tag",description:"Placeholder text. Use imperative"});let s="";return t&&e?s=i:!t&&e?s=r:t&&(s=o),s}handleClick(t){this.isDropdown&&!this.el.contains(t.target)&&this.isExpanded&&this.closeDropdown()}announceError(){this.errorMessage&&setTimeout((()=>this.announce(this.errorMessage)),100)}handleOptionClick(t){let e;t.preventDefault(),this.resetInput(),this.isTable?(e=t.target,e=this.tagOptionFromEl(e.closest("tr"))):e=this.tagOptionFromEl(t.target),e.click(),e.locked?this.announce(this.tagLockedMessage(this.getTagName(e))):e.selected?this.isTable&&e.emitDeselectedEvent():e.emitSelectedEvent()}dismissTooltip(){this.tooltipVisible&&h()}handleInputKeyDown(t){switch(/^.$/.test(t.key)&&this.charCount>=this.characterLimit&&this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit)),t.key){case"Enter":t.preventDefault(),this.handleInputEnter();break;case"ArrowDown":t.preventDefault(),this.handleInputArrowDown();break;case"ArrowUp":t.preventDefault(),this.handleInputArrowUp();break;case"ArrowLeft":this.isTable&&(t.preventDefault(),this.focusPrevCell());break;case"ArrowRight":this.isTable&&(t.preventDefault(),this.focusNextCell());break;case"Escape":this.isDropdown&&this.isExpanded&&(t.preventDefault(),this.closeDropdown());break;case"ArrowLeft":case"Backspace":this.handleInputBackspace()}}handleInputFocus(){this.isDropdown&&(this.openDropdown(),this.clearOptionFocus())}handleInputChanged(t){this.clearOptionFocus(),this.isDropdown&&(this.charCount>=this.characterLimit-5&&this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit)),this.isExpanded||this.openDropdown());const e=t.target.value;e.includes(",")&&this.addNew?this.addTags(e):this.announceExistingOptions()}handleInputEnter(){if(this.focusedOption)this.focusedOption.locked?this.announce(this.tagLockedMessage(this.getTagName(this.focusedOption))):(this.focusedOption.click(),this.focusedOption.selected?this.isTable&&this.focusedOption.emitDeselectedEvent():this.focusedOption.emitSelectedEvent(),this.resetInput());else if(this.isDropdown){const t=this.inputEl.value;t&&(this.isExistingTag(t)?this.announce(this.tagAlreadyAddedMessage(t)):this.addTags(t),this.resetInput())}}handleInputArrowDown(){if(this.isDropdown)if(this.isExpanded){let t=[];this.addNewButton&&"add-new-btn"===this.addNewButton.id&&t.push(this.addNewButton),this.filteredOptionEls.forEach((e=>{t.push(this.elFromTagOption(e))}));const e=d(t,this._focusedOption,!0);this.focusOption(e)}else this.openDropdown();else{const t=this.filteredOptionEls.map((t=>this.elFromTagOption(t))),e=d(t,this._focusedOption,!0);this.focusOption(e)}}handleInputArrowUp(){if(this.isDropdown)if(this.isExpanded){let t=[];this.addNewButton&&t.push(this.addNewButton),this.filteredOptionEls.forEach((e=>{t.push(this.elFromTagOption(e))}));const e=c(t,this._focusedOption,!0);this.focusOption(e)}else this.openDropdown();else{const t=this.filteredOptionEls.map((t=>this.elFromTagOption(t))),e=c(t,this._focusedOption,!0);this.focusOption(e)}}handleInputBackspace(){""===this.inputEl.value&&this._tagEls.length>0&&(this.isKeying=!0,window.requestAnimationFrame((()=>{this.tagAreaEl.focus(),this.focusTag(this._tagEls[this._tagEls.length-1])})))}handleTagAreaKeyDown(t){switch(t.key){case"ArrowLeft":case"ArrowUp":if(t.preventDefault(),this.focusedTag){const t=c(this._tagEls,this.focusedTag,!0);this.focusTag(t)}break;case"ArrowRight":case"ArrowDown":if(t.preventDefault(),this.focusedTag){const t=d(this._tagEls,this.focusedTag,!0);this.focusTag(t)}break;case"Backspace":case"Delete":if(this.focusedTag){const t=this.tagOptionFromTag(this.focusedTag);t.locked?this.announce(this.tagLockedMessage(this.getTagName(t))):t.emitDeselectedEvent()}}}handleBlur(t){this.dismissTooltip(),this.clearOptionFocus(),this.isElOrChild(t.relatedTarget)||(this.fieldWrapperEl.classList.remove("focused"),this.isDropdown&&this.closeDropdown())}handleTagAreaFocus(t){if(this.isDropdown&&this.closeDropdown(),this._tagEls.length>0){const e=t.relatedTarget;this.focusTag(e&&"input"===e.id?this._tagEls[this._tagEls.length-1]:this._tagEls[0])}}focusPrevCell(){this.focusedOption&&this.focusedColumn>0&&(this.focusedColumn-=1)}focusNextCell(){if(this._focusedOption){const t=this._focusedOption.querySelectorAll("td").length-1;this.focusedColumn<t&&(this.focusedColumn+=1)}}focusOption(t){if(t){if(this.focusedOption=this.tagOptionFromEl(t),t===this.addNewButton?this.addNewButton.classList.add("focused"):this.addNewButton&&this.addNewButton.classList.remove("focused"),this.isTable){const t=this._focusedOption.querySelector(".cell-content-wrapper"),e=t.scrollWidth>t.clientWidth;this.dismissTooltip(),e&&p("bottom",this._focusedOption,this._focusedOption.innerText)}t.scrollIntoView({block:"nearest"})}}showTooltipIfTruncated(t){const e=t.querySelector(".tag-text").textContent,i=t.id.replace("tag-","");if(i){const r=this.el.querySelector("#"+i),o=this.getTagName(r);e!==o&&e.includes("...")&&p("bottom",t,o)}}focusTag(t){this.focusedTagIndex=this._tagEls.indexOf(t),t.scrollIntoView({block:"nearest"}),window.requestAnimationFrame((()=>{h(),this.showTooltipIfTruncated(t)}))}clearOptionFocus(){this.focusedOption=void 0,this.focusedColumn=0}openDropdown(){this.openUp=g(this.el,this.dropdownEl.clientHeight,this.el.clientHeight,-2),this.isExpanded=!0}closeDropdown(){this.clearOptionFocus(),this.isExpanded=!1}resetInput(){this.inputEl.value=""}announce(t){this.liveRegionEl.textContent===t&&(t+=" "),this.liveRegionMessage=t}addTags(t){const e=t.split(",").filter((t=>t.match(/\S/)));e.forEach((t=>{this.wmTagInputTagAdded.emit(t)})),this.announce(this.tagAddedMessage(e.join(", "))),this.resetInput()}announceExistingOptions(){window.requestAnimationFrame((()=>{const t=a.formatMessage({id:"tagInput.existingOptions",defaultMessage:"{num, plural, one {1 existing option.} other {# existing options.}}"},{num:this.filteredOptionEls.length});this.announce(t)}))}generateCharacterLimitWarning(t,e){let i=m.getCharactersEntered(t,e);return t>=e&&(i+=` ${m.characterLimitReached}`),i}positionInput(){if(this.tagAreaEl){const t=this._tagEls[this._tagEls.length-1];if(this.inputEl.style.position="static",this.inputEl.style.width="100%",this.inputEl.classList.add("extended"),t){const e=this.tagAreaEl.getBoundingClientRect().right-t.getBoundingClientRect().right;e>=this.inputMinimumWidth&&(this.inputEl.style.position="absolute",this.inputEl.style.top=t.offsetTop.toString()+"px",this.inputEl.style.width=(e-8).toString()+"px",this.inputEl.classList.remove("extended"))}}}handleTagMouseEnter(t){this.showTooltipIfTruncated(t.target)}renderDropdown(){return r("div",{class:`dropdown-wrapper ${this.isExpanded?"open":""} ${this.openUp?"upwards":""}`,ref:t=>this.dropdownEl=t},r("div",{id:"help-text",class:"help-text"},this.renderHelpText()),r("ul",{class:"dropdown",id:"dropdown",role:"listbox","aria-multiselectable":"true","aria-expanded":this.isExpanded?"true":"false","aria-label":this.label,tabindex:-1},this.inputEl&&this.renderAddNewButton(),this.filteredOptionEls.map((t=>this.renderListItem(t)))))}renderHelpText(){if(this.helpText)return this.helpText;let t="";return this.optionEls.length>0&&(t=this.selectionHelpText),this.addNew&&(t+=" "+this.addNewHelpText),t}renderAddNewButton(){const t=this.inputEl.value.trim(),e=this.inputEl.value.match(/\S/),i=this.isExistingTag(this.inputEl.value.trim());return this.addNew&&e&&!i&&r("li",{ref:t=>this.addNewButton=t,id:"add-new-btn",class:"add-new-btn",onClick:()=>this.addTags(t)},"Add "+t)}renderTable(){return r("div",{class:"table-wrapper",onScroll:()=>this.dismissTooltip()},r("table",{id:"table",role:"grid",class:this.colWidths?"fixed-widths":"","aria-label":this.label,"aria-multiselectable":"true"},this.renderTableHeaders(),this.filteredOptionEls.length?this.filteredOptionEls.map((t=>this.renderTableRow(t))):r("div",{class:"no-results"},this.noResultsMessage)))}renderTableHeaders(){return r("tr",{class:"headers",role:"row"},u(this.colHeaders).map(((t,e)=>{let i="wrap";return this.colWrap&&u(this.colWrap)[e]&&(i=u(this.colWrap)[e]),r("th",{class:`header-cell ${i}`,role:"columnheader",width:this.colWidths?u(this.colWidths)[e]:""},t)})))}renderTag(t){const e=this.focusedTag&&this.focusedTag.id==="tag-"+t.id?"focused":"",i=this.getTagName(t);return r("li",{id:"tag-"+t.id,role:"option",class:`tag ${e} ${t.locked?"locked":""}`,"aria-describedby":`tag-${t.id}-description`,onMouseEnter:t=>this.handleTagMouseEnter(t),onMouseLeave:h},r("span",{class:"sr-only"},i),r("div",{class:"description",id:`tag-${t.id}-description`},t.locked?"locked":""),r("span",{class:"tag-text","aria-hidden":"true"},i),t.locked?r("div",{class:"icon lock"}):r("button",{class:"icon remove-btn",tabIndex:-1,onClick:()=>t.emitDeselectedEvent()}))}renderTags(){return this.tagsList.map((t=>this.renderTag(t)))}renderTagCounter(){if(this.maxTags)return r("div",{class:"lower-row"},r("div",{id:"max-tags"},this.renderMaxTags()))}renderMaxTags(){if(this.helpText)return this.helpText;{let t=`${this.tagsAddedMessage}: ${this.taggedOptions.length}/${this.maxTags}`;return this.tagLimitReached&&(t+=`- ${this.maxTagsReachedMessage}`),t}}handleCellMouseEnter(t){const e=t.target,i=e.querySelector(".cell-content-wrapper");i.scrollWidth>i.clientWidth&&p("bottom",e,e.innerText)}renderTableCells(t){return[t.col1,t.col2,t.col3,t.col4].filter((t=>!!t)).map(((e,i)=>{const o=`${t.id}-col${i+1}`;let a="wrap";return this.colWrap&&u(this.colWrap)[i]&&(a=u(this.colWrap)[i]),r("td",{id:o,class:{focused:!!this._focusedCell&&o===this._focusedCell.id},role:"gridcell","aria-describedby":`${o}-description`,"aria-selected":t.selected?"true":"false","aria-readonly":t.locked?"true":null,onMouseEnter:t=>this.handleCellMouseEnter(t),onMouseLeave:()=>h()},r("div",{class:`cell-content-wrapper ${a}`},e),r("div",{class:"description",id:`${o}-description`},t.locked?"locked":""))}))}renderTableRow(t){return r("tr",{id:t.id,class:{selected:t.selected,locked:t.locked,focused:!(!this.focusedOption||t!==this.focusedOption)},onClick:t=>this.handleOptionClick(t)},this.renderTableCells(t))}renderListItem(t){if(this.inputEl)return r("li",{id:t.id,role:"option",class:"option "+(this.focusedOption&&t===this.focusedOption?"focused":""),"aria-selected":t.selected?"true":"false",onClick:t=>this.handleOptionClick(t)},t.textContent)}render(){return r("div",{class:`wrapper label-${this.labelPosition} ${this.errorMessage?"invalid":""}`},r("div",{class:"label-wrapper"},r("label",{class:"label",htmlFor:"input"},this.label,this.requiredField&&r("span",{class:"required","aria-hidden":"true"},"*"))),r("div",{class:`field-wrapper ${this.el.shadowRoot.activeElement===this.inputEl?"focused":""} ${this.errorMessage?"invalid":""}`,ref:t=>this.fieldWrapperEl=t},r("div",{class:"upper-row"},r("div",{class:"tags-and-input-wrapper "+(this.inModal?"in-modal":"")},r("ul",{ref:t=>this.tagAreaEl=t,class:`tag-area ${0===this.taggedOptions.length&&"empty"} ${this.isKeying?"user-is-keying":""}`,role:"listbox","aria-activedescendant":this.focusedTag?this.focusedTag.id:null,"aria-orientation":"horizontal","aria-label":`${this.label} ${this.tagAreaInstructions}`,tabindex:this._tagEls.length>0?0:-1,"aria-describedby":"info max-tags",onFocus:t=>this.handleTagAreaFocus(t),onBlur:t=>{this.focusedTagIndex=void 0,this.handleBlur(t)},onKeyDown:t=>this.handleTagAreaKeyDown(t)},this.renderTags()),r("input",{id:"input",class:"input",role:"combobox",ref:t=>this.inputEl=t,autocomplete:"off","aria-required":this.requiredField?"true":null,"aria-controls":this.tagInputType,"aria-describedby":`help-text${this.errorMessage?" error ":""} max-tags`,"aria-label":`${this.label} ${this.isDropdown?m.getCharacterLimit(this.characterLimit):""}`,"aria-expanded":this.isDropdown?this.isExpanded.toString():null,"aria-activedescendant":this.inputActiveDescendantId,placeholder:this.placeholder,maxLength:this.isDropdown?this.characterLimit:void 0,onInput:t=>this.handleInputChanged(t),onBlur:t=>{this.handleBlur(t)},onFocus:()=>this.handleInputFocus(),onKeyDown:t=>this.handleInputKeyDown(t)})),this.isDropdown&&r("div",{class:"character-count"},this.charCount,"/",this.characterLimit)),this.renderTagCounter(),this.isDropdown&&this.renderDropdown()),this.info&&r("div",{id:"info",class:"info-text"},this.info),r("div",{id:"error"},this.errorMessage),r("div",{class:"sr-only","aria-live":"polite",ref:t=>this.liveRegionEl=t,"aria-atomic":"true"},this.liveRegionMessage),this.isTable&&this.renderTable())}static get delegatesFocus(){return!0}get el(){return o(this)}static get watchers(){return{errorMessage:["announceError"]}}};w.style=':host{--wmcolor-taginput-altrow-background-table:var(--wmcolor-table-altrow-background);--wmcolor-taginput-border:var(--wmcolor-input-border);--wmcolor-taginput-charcount-background:var(--wmcolor-input-charcount-background);--wmcolor-taginput-header-background-table:var(--wmcolor-table-header-background);--wmcolor-taginput-help-text:var(--wmcolor-text);--wmcolor-taginput-icon:var(--wmcolor-icon-accent);--wmcolor-taginput-maxtags-background:var(--wmcolor-background-readonly);--wmcolor-taginput-maxtags-border:var(--wmcolor-input-border);--wmcolor-taginput-maxtags-text:var(--wmcolor-text);--wmcolor-taginput-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-taginput-option-background:var(--wmcolor-option-background);--wmcolor-taginput-option-border:var(--wmcolor-option-border);--wmcolor-taginput-option-text-selected:var(--wmcolor-option-text-disabled);--wmcolor-taginput-option-text:var(--wmcolor-interactive);--wmcolor-taginput-row-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-taginput-row-background-selected:var(--wmcolor-table-row-background-selected);--wmcolor-taginput-row-background-table:var(--wmcolor-table-row-background);--wmcolor-taginput-row-border-selected:var(--wmcolor-table-row-border-selected);--wmcolor-taginput-tag-background-focus:var(--wmcolor-palelilacgray-dark);--wmcolor-taginput-tag-background-highlight:var(--wmcolor-interactive-background-highlight);--wmcolor-taginput-tag-background-locked:var(--wmcolor-interactive-disabled);--wmcolor-taginput-tag-background:var(--wmcolor-palelilacgray);--wmcolor-taginput-tag-text-locked:var(--wmcolor-text-ondark);--wmcolor-taginput-tag-text:var(--wmcolor-text);--wmcolor-taginput-tagbutton-background-hover:var(--wmcolor-button-background-icononly-hover);--wmcolor-taginput-tagbutton-border:var(--wmcolor-button-border-icononly);--wmcolor-taginput-tagbutton-icon-hover:var(--wmcolor-button-icon-icononly-hover);--wmcolor-taginput-tagbutton-icon:var(--wmcolor-button-icon-icononly);font-family:inherit;width:100%;display:block;max-height:80vh}:host *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{width:100%;height:100%;max-height:inherit;min-height:inherit;position:relative}:host .field-wrapper{position:relative;width:100%;border:1px solid;border-color:var(--wmcolor-taginput-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused{outline:2px solid var(--wmcolor-input-border-focus);border-color:var(--wmcolor-input-border-focus)}:host .field-wrapper.invalid{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper:not(.label-left) .field-wrapper{-ms-flex-negative:0;flex-shrink:0}:host .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-taginput-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper{position:relative;width:100%;padding:8px 8px 8px 6px;overflow:auto;max-height:200px}:host .tags-and-input-wrapper.in-modal{max-height:20vh}:host .upper-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:justify;justify-content:space-between}:host .upper-row:before{-ms-flex-item-align:start;align-self:flex-start;display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f349";color:var(--wmcolor-taginput-icon);padding:0.75rem 0.5rem 0.75rem 0.75rem;line-height:normal;font-size:1.12rem}:host .lower-row{width:100%;min-height:1.875rem}:host #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:1.875rem;background-color:var(--wmcolor-taginput-maxtags-background);padding:0.5rem 1rem;color:var(--wmcolor-taginput-maxtags-text);font-size:0.875rem;border-top:1px solid var(--wmcolor-taginput-maxtags-border);border-radius:0 0 3px 3px}:host .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:0;margin:0;gap:8px}:host .tag-area:focus{outline:none}:host .tag-area li{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;height:1.75rem;list-style:none;color:var(--wmcolor-taginput-tag-text);background-color:var(--wmcolor-taginput-tag-background);padding:0.5rem 0.625rem;-webkit-transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);white-space:pre}:host .tag-area li.highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}@keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}:host .tag-area li.locked{background-color:var(--wmcolor-taginput-tag-background-locked);color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:1.25rem;width:1.25rem;padding:0;margin-left:0.5rem}:host .tag-area li .icon.remove-btn{border:1px solid var(--wmcolor-taginput-tagbutton-border);color:var(--wmcolor-taginput-tagbutton-icon);border-radius:50%;cursor:pointer;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1)}:host .tag-area li .icon.remove-btn:hover{color:var(--wmcolor-taginput-tagbutton-icon-hover);background-color:var(--wmcolor-taginput-tagbutton-background-hover)}:host .tag-area li .icon.remove-btn:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f156"}:host .tag-area li .icon.lock{color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon.lock:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f341"}:host .tag-area.user-is-keying:focus-visible li.focused{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:3px}:host .input{font-family:inherit;border:none;height:1.75rem;padding:0;margin:0;right:8px}:host .input:focus{outline:none}:host .tag-area:not(.empty)+.input.extended{-webkit-margin-before:8px;margin-block-start:8px}:host .dropdown-wrapper{margin:0;padding:0;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:calc(100% + 2px);right:0;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .dropdown-wrapper.upwards{top:unset;bottom:calc(100% + 2px);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .dropdown-wrapper li,:host .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:var(--wmcolor-taginput-option-background);list-style:none;min-height:2.6875rem;white-space:pre-wrap;overflow-wrap:anywhere}:host .dropdown-wrapper li.option,:host .dropdown-wrapper li.add-new-btn,:host .dropdown-wrapper div.option,:host .dropdown-wrapper div.add-new-btn{cursor:pointer;color:var(--wmcolor-taginput-option-text);font-weight:bold;width:100%;border:none}:host .dropdown-wrapper li.option[aria-selected=true],:host .dropdown-wrapper li.add-new-btn[aria-selected=true],:host .dropdown-wrapper div.option[aria-selected=true],:host .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:var(--wmcolor-taginput-option-text-selected);font-style:italic;font-weight:normal;cursor:unset}:host .dropdown-wrapper li.option:hover:not([aria-selected=true]),:host .dropdown-wrapper li.option.focused,:host .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper li.add-new-btn.focused,:host .dropdown-wrapper div.option:hover:not([aria-selected=true]),:host .dropdown-wrapper div.option.focused,:host .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper div.add-new-btn.focused{outline:none;background:var(--wmcolor-taginput-option-background-hover)}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text{color:var(--wmcolor-taginput-help-text);height:auto;min-height:2.6875rem;padding-top:0.25rem;padding-bottom:0.25rem;white-space:normal}:host .dropdown-wrapper li:not(:last-child),:host .dropdown-wrapper div:not(:last-child){border-bottom:2px solid var(--wmcolor-taginput-option-border)}:host .info-text{font-style:italic;margin-top:0.25rem}:host .table-wrapper{overflow:auto;margin-top:1.5rem}:host .table-wrapper #table{width:100%;border-spacing:0px}:host .table-wrapper #table.fixed-widths{table-layout:fixed}:host .table-wrapper #table .headers{height:2.5rem;background-color:var(--wmcolor-taginput-header-background-table)}:host .table-wrapper #table .headers th{text-align:left;font-size:0.75rem;font-weight:700;text-transform:uppercase;padding:0 1.5rem}:host .table-wrapper tr:nth-child(even){background-color:var(--wmcolor-taginput-altrow-background-table)}:host .table-wrapper tr.selected,:host .table-wrapper tr.locked{background-color:var(--wmcolor-taginput-row-background-selected);-webkit-box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);font-weight:500}:host .table-wrapper tr.focused,:host .table-wrapper tr:hover:not(.locked){background-color:var(--wmcolor-taginput-row-background-hover);-webkit-box-shadow:none;box-shadow:none}:host .table-wrapper tr.locked td{cursor:auto}:host .table-wrapper tr.locked td:first-child .cell-content-wrapper:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f33e";margin-right:0.5rem;color:var(--wmcolor-taginput-tag-text)}:host .table-wrapper td{height:3.75rem;vertical-align:middle;padding:0 1.5rem;cursor:pointer}:host .table-wrapper td.focused{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}:host .table-wrapper td .cell-content-wrapper.trunc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .description{display:none}:host .no-results{padding:1.25rem 1.5rem}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host #error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem}:host #error:not(:empty){margin-top:0.25rem}';export{w as wm_tag_input}
|
|
1
|
+
import{r as t,c as e,f as i,h as r,g as o}from"./p-568c595f.js";import{i as a,d as s,u as n,m as l,h,v as d,w as c,s as p,k as g,x as u}from"./p-76825602.js";import{g as m}from"./p-fb229776.js";const w=class{constructor(r){t(this,r),this.wmTagInputTagAdded=e(this,"wmTagInputTagAdded",7),this.addNewHelpText=a.formatMessage({id:"tagInput.addNewHelpText",defaultMessage:"Press the Enter or Comma key to add a new tag.",description:"Help text appearing in a dropdown. Use imperative"}),this.selectionHelpText=a.formatMessage({id:"tagInput.selectionHelpText",defaultMessage:"Search and select a tag.",description:"Help text appearing in a dropdown. Use imperative"}),this.maxTagsReachedMessage=a.formatMessage({id:"tagInput.maxTagsReached",defaultMessage:"No more tags can be added because the limit has been reached."}),this.tagAreaInstructions=a.formatMessage({id:"tagInput.tagAreaInstructions",defaultMessage:"tag selection. Press Backspace or Delete to remove a tag."}),this.tagsAddedMessage=a.formatMessage({id:"tagInput.tagsAdded",defaultMessage:"Tags added",description:"Full message for context: 'Tags added: x/y"}),this.openUp=!1,this.inModal=!1,this.debouncedUpdate=s((()=>i(this.el)),30),this.label=void 0,this.errorMessage=void 0,this.info=void 0,this.labelPosition="top",this.maxTags=void 0,this.placeholder=void 0,this.requiredField=!1,this.tagInputType="dropdown",this.helpText=void 0,this.addNew=!0,this.characterLimit=50,this.colHeaders=void 0,this.colWidths=void 0,this.colWrap=void 0,this.isKeying=!1,this.isExpanded=!1,this.liveRegionMessage="",this.focusedOption=void 0,this.focusedColumn=0,this.focusedTagIndex=void 0,this.tagsList=[]}toggleKeyingOn(){this.isKeying=!0}toggleKeyingOff(){this.isKeying=!1}get isDropdown(){return"dropdown"===this.tagInputType}get isTable(){return"table"===this.tagInputType}get charCount(){return this.inputEl?this.inputEl.value.length:0}get tooltipVisible(){return document.getElementById("wm-tooltip").classList.contains("show")}get optionEls(){return Array.from(this.el.querySelectorAll("wm-tag-option"))}get filteredOptionEls(){const t=this.inputEl?this.inputEl.value.toLowerCase():"";return Array.from(this.optionEls).filter((e=>{let i="";return this.isDropdown?i=e.textContent.toLowerCase():this.isTable&&(i=[e.col1,e.col2,e.col3,e.col4].join("").toLowerCase()),i.includes(t)}))}get taggedOptions(){return this.optionEls.filter((t=>t.selected||t.locked))}get _tagEls(){return this.tagAreaEl?Array.from(this.tagAreaEl.querySelectorAll(".tag")):[]}get focusedTag(){if(void 0!==this.focusedTagIndex&&this.focusedTagIndex>=0)return this._tagEls[this.focusedTagIndex]}tagOptionFromEl(t){return"add-new-btn"===t.id?void 0:this.el.querySelector("#"+t.id)}tagOptionFromTag(t){const e=t.id.replace("tag-","");return this.el.querySelector("#"+e)}elFromTagOption(t){return this.el.shadowRoot.querySelector("#"+t.id)}get _focusedOption(){return this.focusedOption?this.elFromTagOption(this.focusedOption):this.addNewButton&&this.addNewButton.classList.contains("focused")?this.addNewButton:void 0}get _focusedCell(){if(this._focusedOption)return Array.from(this._focusedOption.querySelectorAll("td"))[this.focusedColumn||0]}get inputActiveDescendantId(){return this._focusedOption?this.isTable?Array.from(this._focusedOption.querySelectorAll("td"))[this.focusedColumn].id:this._focusedOption.id:null}get tagLimitReached(){return!!(this.maxTags&&this.taggedOptions.length>=this.maxTags)}get noResultsMessage(){return a.formatMessage({id:"tagInput.noResults",defaultMessage:"No results match your search.",description:"Message displayed when a user's search returns empty."})}get inputMinimumWidth(){if(this._tagEls){const t=getComputedStyle(this.inputEl),e=getComputedStyle(this._tagEls[this._tagEls.length-1]),i=[t.paddingLeft,t.paddingRight,t.marginLeft,t.marginRight,e.marginRight].reduce(((t,e)=>t+parseInt(e.replace("px",""))),0);return Math.max(150,n(this.inputEl,this.placeholder).width+i)}return 150}getTagName(t){return this.isDropdown?t.textContent:t.col1}isExistingTag(t){return this.optionEls.map((t=>this.getTagName(t).toLowerCase())).includes(t.toLowerCase())}tagAddedMessage(t){return a.formatMessage({id:"tagInput.tagAdded",defaultMessage:"{tagName} added.",description:"A confirmation for adding a tag."},{tagName:t})}tagRemovedMessage(t){return a.formatMessage({id:"tagInput.tagRemoved",defaultMessage:"{tagName} removed.",description:"A confirmation for removing a tag."},{tagName:t})}tagAlreadyAddedMessage(t){return a.formatMessage({id:"tagInput.tagAlreadyAdded",defaultMessage:"{tagName} has already been added.",description:"An alert for adding a tag that is already present."},{tagName:t})}tagLockedMessage(t){return a.formatMessage({id:"tagInput.tagLocked",defaultMessage:"{tagName} is locked and cannot be removed.",description:"An alert for when a user tries to remove a tag that is locked."},{tagName:t})}isElOrChild(t){return t===this.el||this.el.shadowRoot.contains(t)||this.el.contains(t)}componentWillLoad(){this.placeholder||(this.placeholder=this.createPlaceholderDefault(this.addNew,this.optionEls.length>0)),this.label||console.error("wm-tag-input must have a label property"),this.el.focus=()=>{const t=this._tagEls[0];t?(this.tagAreaEl.focus(),this.focusTag(t)):this.inputEl.focus()},new ResizeObserver((()=>this.debouncedUpdate())).observe(this.el),this.el.closest("wm-modal")&&(this.inModal=!0);const t=[],e=[];this.optionEls.forEach((i=>{i.locked?t.push(i):i.selected&&e.push(i)})),this.tagsList=[...t,...e]}componentDidLoad(){new MutationObserver((t=>t.forEach((t=>this.handleChangeAnnouncement(t))))).observe(this.el,{subtree:!0,attributes:!0,attributeFilter:["selected"],childList:!0}),new MutationObserver((t=>t.forEach((t=>this.handleOptionListChange(t))))).observe(this.el,{childList:!0}),this.tagAreaEl&&new MutationObserver((t=>t.forEach((t=>this.handleTagListChange(t))))).observe(this.tagAreaEl,{childList:!0})}handleChangeAnnouncement(t){const e=t.target;if("childList"==t.type&&t.removedNodes.length>0)this.announce(this.tagRemovedMessage(t.removedNodes[0].textContent));else if("attributes"==t.type){const t=this.getTagName(e);if(e.selected){let e=this.tagAddedMessage(t);this.tagLimitReached&&(e+=` ${this.maxTagsReachedMessage}`),this.announce(e)}else this.announce(this.tagRemovedMessage(t))}}handleOptionListChange(t){const e=Array.from(t.addedNodes);e.length>0&&e.forEach((t=>!this.tagsList.includes(t)&&this.tagsList.push(t)));const i=Array.from(t.removedNodes);i.length>0&&(this.tagsList=this.tagsList.filter((t=>!i.includes(t))))}handleTagOptionSelected(t){this.tagsList=this.tagsList.concat(t.target)}handleTagOptionDeselected(t){const e=t.target;this.tagsList=this.tagsList.filter((t=>t!=e))}handleTagListChange(t){const e=Array.from(t.addedNodes);e&&e.forEach((t=>{t.classList.add("highlight")}));const i=t.removedNodes[0];i&&(i.classList.remove("highlight"),this.focusedTag?this.focusTag(this.focusedTag):this._tagEls.length>0?this.focusTag(this._tagEls[this._tagEls.length-1]):this.inputEl.focus())}componentDidRender(){this.positionInput(),this._tagEls.forEach((t=>{const e=t.querySelector(".tag-text"),i=this.el.shadowRoot.querySelector(".tags-and-input-wrapper"),r=e.getBoundingClientRect().left,o=i.getBoundingClientRect().right-10-8-28,a=t.id.replace("tag-",""),s=a&&this.el.querySelector("#"+a);s&&(e.textContent=l(e,this.getTagName(s),o-r,5))}))}createPlaceholderDefault(t,e){const i=a.formatMessage({id:"tagInput.placeholderAddAndSearch",defaultMessage:"Add or search for a tag",description:"Placeholder text. Use imperative"}),r=a.formatMessage({id:"tagInput.placeholderSearch",defaultMessage:"Search and select a tag",description:"Placeholder text. Use imperative"}),o=a.formatMessage({id:"tagInput.placeholderAdd",defaultMessage:"Add a new tag",description:"Placeholder text. Use imperative"});let s="";return t&&e?s=i:!t&&e?s=r:t&&(s=o),s}handleClick(t){this.isDropdown&&!this.el.contains(t.target)&&this.isExpanded&&this.closeDropdown()}announceError(){this.errorMessage&&setTimeout((()=>this.announce(this.errorMessage)),100)}handleOptionClick(t){let e;t.preventDefault(),this.resetInput(),this.isTable?(e=t.target,e=this.tagOptionFromEl(e.closest("tr"))):e=this.tagOptionFromEl(t.target),e.click(),e.locked?this.announce(this.tagLockedMessage(this.getTagName(e))):e.selected?this.isTable&&e.emitDeselectedEvent():e.emitSelectedEvent()}dismissTooltip(){this.tooltipVisible&&h()}handleInputKeyDown(t){switch(/^.$/.test(t.key)&&this.charCount>=this.characterLimit&&this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit)),t.key){case"Enter":t.preventDefault(),this.handleInputEnter();break;case"ArrowDown":t.preventDefault(),this.handleInputArrowDown();break;case"ArrowUp":t.preventDefault(),this.handleInputArrowUp();break;case"ArrowLeft":this.isTable&&(t.preventDefault(),this.focusPrevCell());break;case"ArrowRight":this.isTable&&(t.preventDefault(),this.focusNextCell());break;case"Escape":this.isDropdown&&this.isExpanded&&(t.preventDefault(),this.closeDropdown());break;case"ArrowLeft":case"Backspace":this.handleInputBackspace()}}handleInputFocus(){this.isDropdown&&(this.openDropdown(),this.clearOptionFocus())}handleInputChanged(t){this.clearOptionFocus(),this.isDropdown&&(this.charCount>=this.characterLimit-5&&this.announce(this.generateCharacterLimitWarning(this.charCount,this.characterLimit)),this.isExpanded||this.openDropdown());const e=t.target.value;e.includes(",")&&this.addNew?this.addTags(e):this.announceExistingOptions()}handleInputEnter(){if(this.focusedOption)this.focusedOption.locked?this.announce(this.tagLockedMessage(this.getTagName(this.focusedOption))):(this.focusedOption.click(),this.focusedOption.selected?this.isTable&&this.focusedOption.emitDeselectedEvent():this.focusedOption.emitSelectedEvent(),this.resetInput());else if(this.isDropdown){const t=this.inputEl.value;t&&(this.isExistingTag(t)?this.announce(this.tagAlreadyAddedMessage(t)):this.addTags(t),this.resetInput())}}handleInputArrowDown(){if(this.isDropdown)if(this.isExpanded){let t=[];this.addNewButton&&"add-new-btn"===this.addNewButton.id&&t.push(this.addNewButton),this.filteredOptionEls.forEach((e=>{t.push(this.elFromTagOption(e))}));const e=d(t,this._focusedOption,!0);this.focusOption(e)}else this.openDropdown();else{const t=this.filteredOptionEls.map((t=>this.elFromTagOption(t))),e=d(t,this._focusedOption,!0);this.focusOption(e)}}handleInputArrowUp(){if(this.isDropdown)if(this.isExpanded){let t=[];this.addNewButton&&t.push(this.addNewButton),this.filteredOptionEls.forEach((e=>{t.push(this.elFromTagOption(e))}));const e=c(t,this._focusedOption,!0);this.focusOption(e)}else this.openDropdown();else{const t=this.filteredOptionEls.map((t=>this.elFromTagOption(t))),e=c(t,this._focusedOption,!0);this.focusOption(e)}}handleInputBackspace(){""===this.inputEl.value&&this._tagEls.length>0&&(this.isKeying=!0,window.requestAnimationFrame((()=>{this.tagAreaEl.focus(),this.focusTag(this._tagEls[this._tagEls.length-1])})))}handleTagAreaKeyDown(t){switch(t.key){case"ArrowLeft":case"ArrowUp":if(t.preventDefault(),this.focusedTag){const t=c(this._tagEls,this.focusedTag,!0);this.focusTag(t)}break;case"ArrowRight":case"ArrowDown":if(t.preventDefault(),this.focusedTag){const t=d(this._tagEls,this.focusedTag,!0);this.focusTag(t)}break;case"Backspace":case"Delete":if(this.focusedTag){const t=this.tagOptionFromTag(this.focusedTag);t.locked?this.announce(this.tagLockedMessage(this.getTagName(t))):t.emitDeselectedEvent()}}}handleBlur(t){this.dismissTooltip(),this.clearOptionFocus(),this.isElOrChild(t.relatedTarget)||(this.fieldWrapperEl.classList.remove("focused"),this.isDropdown&&this.closeDropdown())}handleTagAreaFocus(t){if(this.isDropdown&&this.closeDropdown(),this._tagEls.length>0){const e=t.relatedTarget;this.focusTag(e&&"input"===e.id?this._tagEls[this._tagEls.length-1]:this._tagEls[0])}}focusPrevCell(){this.focusedOption&&this.focusedColumn>0&&(this.focusedColumn-=1)}focusNextCell(){if(this._focusedOption){const t=this._focusedOption.querySelectorAll("td").length-1;this.focusedColumn<t&&(this.focusedColumn+=1)}}focusOption(t){if(t){if(this.focusedOption=this.tagOptionFromEl(t),t===this.addNewButton?this.addNewButton.classList.add("focused"):this.addNewButton&&this.addNewButton.classList.remove("focused"),this.isTable){const t=this._focusedOption.querySelector(".cell-content-wrapper"),e=t.scrollWidth>t.clientWidth;this.dismissTooltip(),e&&p("bottom",this._focusedOption,this._focusedOption.innerText)}t.scrollIntoView({block:"nearest"})}}showTooltipIfTruncated(t){const e=t.querySelector(".tag-text").textContent,i=t.id.replace("tag-","");if(i){const r=this.el.querySelector("#"+i),o=this.getTagName(r);e!==o&&e.includes("...")&&p("bottom",t,o)}}focusTag(t){this.focusedTagIndex=this._tagEls.indexOf(t),t.scrollIntoView({block:"nearest"}),window.requestAnimationFrame((()=>{h(),this.showTooltipIfTruncated(t)}))}clearOptionFocus(){this.focusedOption=void 0,this.focusedColumn=0}openDropdown(){this.openUp=g(this.el,this.dropdownEl.clientHeight,this.el.clientHeight,-2),this.isExpanded=!0}closeDropdown(){this.clearOptionFocus(),this.isExpanded=!1}resetInput(){this.inputEl.value=""}announce(t){this.liveRegionEl.textContent===t&&(t+=" "),this.liveRegionMessage=t}addTags(t){const e=t.split(",").filter((t=>t.match(/\S/)));e.forEach((t=>{this.wmTagInputTagAdded.emit(t)})),this.announce(this.tagAddedMessage(e.join(", "))),this.resetInput()}announceExistingOptions(){window.requestAnimationFrame((()=>{const t=a.formatMessage({id:"tagInput.existingOptions",defaultMessage:"{num, plural, one {1 existing option.} other {# existing options.}}"},{num:this.filteredOptionEls.length});this.announce(t)}))}generateCharacterLimitWarning(t,e){let i=m.getCharactersEntered(t,e);return t>=e&&(i+=` ${m.characterLimitReached}`),i}positionInput(){if(this.tagAreaEl){const t=this._tagEls[this._tagEls.length-1];if(this.inputEl.style.position="static",this.inputEl.style.width="100%",this.inputEl.classList.add("extended"),t){const e=this.tagAreaEl.getBoundingClientRect().right-t.getBoundingClientRect().right;e>=this.inputMinimumWidth&&(this.inputEl.style.position="absolute",this.inputEl.style.top=t.offsetTop.toString()+"px",this.inputEl.style.width=(e-8).toString()+"px",this.inputEl.classList.remove("extended"))}}}handleTagMouseEnter(t){this.showTooltipIfTruncated(t.target)}renderDropdown(){return r("div",{class:`dropdown-wrapper ${this.isExpanded?"open":""} ${this.openUp?"upwards":""}`,ref:t=>this.dropdownEl=t},r("div",{id:"help-text",class:"help-text"},this.renderHelpText()),r("ul",{class:"dropdown",id:"dropdown",role:"listbox","aria-multiselectable":"true","aria-expanded":this.isExpanded?"true":"false","aria-label":this.label,tabindex:-1},this.inputEl&&this.renderAddNewButton(),this.filteredOptionEls.map((t=>this.renderListItem(t)))))}renderHelpText(){if(this.helpText)return this.helpText;let t="";return this.optionEls.length>0&&(t=this.selectionHelpText),this.addNew&&(t+=" "+this.addNewHelpText),t}renderAddNewButton(){const t=this.inputEl.value.trim(),e=this.inputEl.value.match(/\S/),i=this.isExistingTag(this.inputEl.value.trim());return this.addNew&&e&&!i&&r("li",{ref:t=>this.addNewButton=t,id:"add-new-btn",class:"add-new-btn",onClick:()=>this.addTags(t)},"Add "+t)}renderTable(){return r("div",{class:"table-wrapper",onScroll:()=>this.dismissTooltip()},r("table",{id:"table",role:"grid",class:this.colWidths?"fixed-widths":"","aria-label":this.label,"aria-multiselectable":"true"},this.renderTableHeaders(),this.filteredOptionEls.length?this.filteredOptionEls.map((t=>this.renderTableRow(t))):r("div",{class:"no-results"},this.noResultsMessage)))}renderTableHeaders(){return r("tr",{class:"headers",role:"row"},u(this.colHeaders).map(((t,e)=>{let i="wrap";return this.colWrap&&u(this.colWrap)[e]&&(i=u(this.colWrap)[e]),r("th",{class:`header-cell ${i}`,role:"columnheader",width:this.colWidths?u(this.colWidths)[e]:""},t)})))}renderTag(t){const e=this.focusedTag&&this.focusedTag.id==="tag-"+t.id?"focused":"",i=this.getTagName(t);return r("li",{id:"tag-"+t.id,role:"option",class:`tag ${e} ${t.locked?"locked":""}`,"aria-describedby":`tag-${t.id}-description`,onMouseEnter:t=>this.handleTagMouseEnter(t),onMouseLeave:h},r("span",{class:"sr-only"},i),r("div",{class:"description",id:`tag-${t.id}-description`},t.locked?"locked":""),r("span",{class:"tag-text","aria-hidden":"true"},i),t.locked?r("div",{class:"icon lock"}):r("button",{class:"icon remove-btn",tabIndex:-1,onClick:()=>t.emitDeselectedEvent()}))}renderTags(){return this.tagsList.map((t=>this.renderTag(t)))}renderTagCounter(){if(this.maxTags)return r("div",{class:"lower-row"},r("div",{id:"max-tags"},this.renderMaxTags()))}renderMaxTags(){if(this.helpText)return this.helpText;{let t=`${this.tagsAddedMessage}: ${this.taggedOptions.length}/${this.maxTags}`;return this.tagLimitReached&&(t+=`- ${this.maxTagsReachedMessage}`),t}}handleCellMouseEnter(t){const e=t.target,i=e.querySelector(".cell-content-wrapper");i.scrollWidth>i.clientWidth&&p("bottom",e,e.innerText)}renderTableCells(t){return[t.col1,t.col2,t.col3,t.col4].filter((t=>!!t)).map(((e,i)=>{const o=`${t.id}-col${i+1}`;let a="wrap";return this.colWrap&&u(this.colWrap)[i]&&(a=u(this.colWrap)[i]),r("td",{id:o,class:{focused:!!this._focusedCell&&o===this._focusedCell.id},role:"gridcell","aria-describedby":`${o}-description`,"aria-selected":t.selected?"true":"false","aria-readonly":t.locked?"true":null,onMouseEnter:t=>this.handleCellMouseEnter(t),onMouseLeave:()=>h()},r("div",{class:`cell-content-wrapper ${a}`},e),r("div",{class:"description",id:`${o}-description`},t.locked?"locked":""))}))}renderTableRow(t){return r("tr",{id:t.id,class:{selected:t.selected,locked:t.locked,focused:!(!this.focusedOption||t!==this.focusedOption)},onClick:t=>this.handleOptionClick(t)},this.renderTableCells(t))}renderListItem(t){if(this.inputEl)return r("li",{id:t.id,role:"option",class:"option "+(this.focusedOption&&t===this.focusedOption?"focused":""),"aria-selected":t.selected?"true":"false",onClick:t=>this.handleOptionClick(t)},t.textContent)}render(){return r("div",{class:`wrapper label-${this.labelPosition} ${this.errorMessage?"invalid":""}`},r("div",{class:"label-wrapper"},r("label",{class:"label",htmlFor:"input"},this.label,this.requiredField&&r("span",{class:"required","aria-hidden":"true"},"*"))),r("div",{class:`field-wrapper ${this.el.shadowRoot.activeElement===this.inputEl?"focused":""} ${this.errorMessage?"invalid":""}`,ref:t=>this.fieldWrapperEl=t},r("div",{class:"upper-row"},r("div",{class:"tags-and-input-wrapper "+(this.inModal?"in-modal":"")},r("ul",{ref:t=>this.tagAreaEl=t,class:`tag-area ${0===this.taggedOptions.length&&"empty"} ${this.isKeying?"user-is-keying":""}`,role:"listbox","aria-activedescendant":this.focusedTag?this.focusedTag.id:null,"aria-orientation":"horizontal","aria-label":`${this.label} ${this.tagAreaInstructions}`,tabindex:this._tagEls.length>0?0:-1,"aria-describedby":"info max-tags",onFocus:t=>this.handleTagAreaFocus(t),onBlur:t=>{this.focusedTagIndex=void 0,this.handleBlur(t)},onKeyDown:t=>this.handleTagAreaKeyDown(t)},this.renderTags()),r("input",{id:"input",class:"input",role:"combobox",ref:t=>this.inputEl=t,autocomplete:"off","aria-required":this.requiredField?"true":null,"aria-controls":this.tagInputType,"aria-describedby":`help-text${this.errorMessage?" error ":""} max-tags`,"aria-label":`${this.label} ${this.isDropdown?m.getCharacterLimit(this.characterLimit):""}`,"aria-expanded":this.isDropdown?this.isExpanded.toString():null,"aria-activedescendant":this.inputActiveDescendantId,placeholder:this.placeholder,maxLength:this.isDropdown?this.characterLimit:void 0,onInput:t=>this.handleInputChanged(t),onBlur:t=>{this.handleBlur(t)},onFocus:()=>this.handleInputFocus(),onKeyDown:t=>this.handleInputKeyDown(t)})),this.isDropdown&&r("div",{class:"character-count"},this.charCount,"/",this.characterLimit)),this.renderTagCounter(),this.isDropdown&&this.renderDropdown()),this.info&&r("div",{id:"info",class:"info-text"},this.info),r("div",{id:"error"},this.errorMessage),r("div",{class:"sr-only","aria-live":"polite",ref:t=>this.liveRegionEl=t,"aria-atomic":"true"},this.liveRegionMessage),this.isTable&&this.renderTable())}static get delegatesFocus(){return!0}get el(){return o(this)}static get watchers(){return{errorMessage:["announceError"]}}};w.style=':host{--wmcolor-taginput-altrow-background-table:var(--wmcolor-table-altrow-background);--wmcolor-taginput-border:var(--wmcolor-input-border);--wmcolor-taginput-charcount-background:var(--wmcolor-input-charcount-background);--wmcolor-taginput-header-background-table:var(--wmcolor-table-header-background);--wmcolor-taginput-help-text:var(--wmcolor-text);--wmcolor-taginput-icon:var(--wmcolor-icon-accent);--wmcolor-taginput-maxtags-background:var(--wmcolor-background-readonly);--wmcolor-taginput-maxtags-border:var(--wmcolor-input-border);--wmcolor-taginput-maxtags-text:var(--wmcolor-text);--wmcolor-taginput-option-background-hover:var(--wmcolor-option-background-hover);--wmcolor-taginput-option-background:var(--wmcolor-option-background);--wmcolor-taginput-option-border:var(--wmcolor-option-border);--wmcolor-taginput-option-text-selected:var(--wmcolor-option-text-disabled);--wmcolor-taginput-option-text:var(--wmcolor-interactive);--wmcolor-taginput-row-background-hover:var(--wmcolor-interactive-background-hover);--wmcolor-taginput-row-background-selected:var(--wmcolor-table-row-background-selected);--wmcolor-taginput-row-background-table:var(--wmcolor-table-row-background);--wmcolor-taginput-row-border-selected:var(--wmcolor-table-row-border-selected);--wmcolor-taginput-tag-background-focus:var(--wmcolor-palelilacgray-dark);--wmcolor-taginput-tag-background-highlight:var(--wmcolor-interactive-background-highlight);--wmcolor-taginput-tag-background-locked:var(--wmcolor-interactive-disabled);--wmcolor-taginput-tag-background:var(--wmcolor-palelilacgray);--wmcolor-taginput-tag-text-locked:var(--wmcolor-text-ondark);--wmcolor-taginput-tag-text:var(--wmcolor-text);--wmcolor-taginput-tagbutton-background-hover:var(--wmcolor-button-background-icononly-hover);--wmcolor-taginput-tagbutton-border:var(--wmcolor-button-border-icononly);--wmcolor-taginput-tagbutton-icon-hover:var(--wmcolor-button-icon-icononly-hover);--wmcolor-taginput-tagbutton-icon:var(--wmcolor-button-icon-icononly);font-family:inherit;width:100%;display:block;max-height:80vh}:host *{-webkit-box-sizing:border-box;box-sizing:border-box;font-size:14px}:host .wrapper{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;font-size:0.875rem}:host .wrapper .label{display:block;line-height:normal;font-weight:600;white-space:nowrap;margin-bottom:0.25rem}:host .wrapper .label .required{color:var(--wmcolor-text-required)}:host .wrapper.label-left{-ms-flex-direction:row;flex-direction:row}:host .wrapper.label-left .label-wrapper{line-height:2.5rem}:host .wrapper.label-left .label-wrapper .label{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:2.5rem;white-space:normal;margin-bottom:0;margin-right:0.75rem}:host .wrapper.label-none label{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host .wrapper.invalid .label{color:var(--wmcolor-text-error)}:host .wrapper.invalid .label:after{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f026";margin-left:0.3125rem}[dir=RTL] :host .wrapper.invalid .label:after{margin-left:0;margin-right:0.3125rem}:host .wrapper.rtl.label-left .label{margin-right:0;margin-left:0.75rem}:host .wrapper{width:100%;height:100%;max-height:inherit;min-height:inherit;position:relative}:host .field-wrapper{position:relative;width:100%;border:1px solid;border-color:var(--wmcolor-taginput-border);-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px}:host .field-wrapper.focused{outline:2px solid var(--wmcolor-input-border-focus);border-color:var(--wmcolor-input-border-focus)}:host .field-wrapper.invalid{-webkit-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);-moz-box-shadow:0 0 0 1px var(--wmcolor-input-border-error);box-shadow:0 0 0 1px var(--wmcolor-input-border-error);border-color:var(--wmcolor-input-border-error)}:host .wrapper:not(.label-left) .field-wrapper{-ms-flex-negative:0;flex-shrink:0}:host .character-count{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;min-width:5rem;background-color:var(--wmcolor-taginput-charcount-background);font-size:0.875rem;font-weight:500;-ms-flex-item-align:stretch;align-self:stretch}:host .tags-and-input-wrapper{position:relative;width:100%;padding:8px 8px 8px 6px;overflow:auto;max-height:200px}:host .tags-and-input-wrapper.in-modal{max-height:20vh}:host .upper-row{width:100%;display:-ms-flexbox;display:flex;-ms-flex:1;flex:1;-ms-flex-pack:justify;justify-content:space-between}:host .upper-row:before{-ms-flex-item-align:start;align-self:flex-start;display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f349";color:var(--wmcolor-taginput-icon);padding:0.75rem 0.5rem 0.75rem 0.75rem;line-height:normal;font-size:1.12rem}:host .lower-row{width:100%;min-height:1.875rem}:host #max-tags{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;min-height:1.875rem;background-color:var(--wmcolor-taginput-maxtags-background);padding:0.5rem 1rem;color:var(--wmcolor-taginput-maxtags-text);font-size:0.875rem;border-top:1px solid var(--wmcolor-taginput-maxtags-border);border-radius:0 0 3px 3px}:host .tag-area{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:0;margin:0;gap:8px}:host .tag-area:focus{outline:none}:host .tag-area li{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;height:1.75rem;list-style:none;color:var(--wmcolor-taginput-tag-text);background-color:var(--wmcolor-taginput-tag-background);padding:0.5rem 0.625rem;-webkit-transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1);white-space:pre}:host .tag-area li.highlight{-webkit-animation:fadeIn 1s;animation:fadeIn 1s}@-webkit-keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}@keyframes fadeIn{0%{background-color:var(--wmcolor-taginput-tag-background)}50%{background-color:var(--wmcolor-taginput-tag-background-highlight)}100%{background-color:var(--wmcolor-taginput-tag-background)}}:host .tag-area li.locked{background-color:var(--wmcolor-taginput-tag-background-locked);color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon{display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;-ms-flex-align:center;align-items:center;height:1.25rem;width:1.25rem;padding:0;margin-left:0.5rem}:host .tag-area li .icon.remove-btn{border:1px solid var(--wmcolor-taginput-tagbutton-border);color:var(--wmcolor-taginput-tagbutton-icon);border-radius:50%;cursor:pointer;-webkit-transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1);transition:background-color 500ms cubic-bezier(0.4, 0, 0.2, 1), color 500ms cubic-bezier(0.4, 0, 0.2, 1)}:host .tag-area li .icon.remove-btn:hover{color:var(--wmcolor-taginput-tagbutton-icon-hover);background-color:var(--wmcolor-taginput-tagbutton-background-hover)}:host .tag-area li .icon.remove-btn:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f156"}:host .tag-area li .icon.lock{color:var(--wmcolor-taginput-tag-text-locked)}:host .tag-area li .icon.lock:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f341"}:host .tag-area.user-is-keying:focus-visible li.focused{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:3px}:host .input{font-family:inherit;border:none;height:1.75rem;padding:0;margin:0;right:8px}:host .input:focus{outline:none}:host .tag-area:not(.empty)+.input.extended{-webkit-margin-before:8px;margin-block-start:8px}:host .dropdown-wrapper{margin:0;padding:0;-webkit-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-moz-box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);box-shadow:0 4px 15px 0 rgba(0, 0, 0, 0.2);-ms-transition:transform 0.25s ease;-webkit-transition:transform 0.25s ease;-moz-transition:transform 0.25s ease;-webkit-transition:-webkit-transform 0.25s ease;transition:-webkit-transform 0.25s ease;transition:transform 0.25s ease;transition:transform 0.25s ease, -webkit-transform 0.25s ease;-ms-transform:scale(1, 0);-webkit-transform:scale(1, 0);-moz-transform:scale(1, 0);transform:scale(1, 0);-ms-transform-origin:center top;-webkit-transform-origin:center top;-moz-transform-origin:center top;transform-origin:center top;-webkit-border-radius:3px;-moz-border-radius:3px;-ms-border-radius:3px;border-radius:3px;position:absolute;top:calc(100% + 2px);right:0;z-index:100;width:100%;font-size:0.875rem}:host .dropdown-wrapper .dropdown{-webkit-overflow-scrolling:touch;overflow:auto;max-height:12.5rem;margin:0;padding:0}:host .dropdown-wrapper.open{-ms-transform:scale(1, 1);-webkit-transform:scale(1, 1);-moz-transform:scale(1, 1);transform:scale(1, 1)}:host .dropdown-wrapper.upwards{top:unset;bottom:calc(100% + 2px);-ms-transform-origin:center bottom;-webkit-transform-origin:center bottom;-moz-transform-origin:center bottom;transform-origin:center bottom}:host .dropdown-wrapper li,:host .dropdown-wrapper div{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;padding:0 1rem;background:var(--wmcolor-taginput-option-background);list-style:none;min-height:2.6875rem;white-space:pre-wrap;overflow-wrap:anywhere}:host .dropdown-wrapper li.option,:host .dropdown-wrapper li.add-new-btn,:host .dropdown-wrapper div.option,:host .dropdown-wrapper div.add-new-btn{cursor:pointer;color:var(--wmcolor-taginput-option-text);font-weight:bold;width:100%;border:none}:host .dropdown-wrapper li.option[aria-selected=true],:host .dropdown-wrapper li.add-new-btn[aria-selected=true],:host .dropdown-wrapper div.option[aria-selected=true],:host .dropdown-wrapper div.add-new-btn[aria-selected=true]{color:var(--wmcolor-taginput-option-text-selected);font-style:italic;font-weight:normal;cursor:unset}:host .dropdown-wrapper li.option:hover:not([aria-selected=true]),:host .dropdown-wrapper li.option.focused,:host .dropdown-wrapper li.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper li.add-new-btn.focused,:host .dropdown-wrapper div.option:hover:not([aria-selected=true]),:host .dropdown-wrapper div.option.focused,:host .dropdown-wrapper div.add-new-btn:hover:not([aria-selected=true]),:host .dropdown-wrapper div.add-new-btn.focused{outline:none;background:var(--wmcolor-taginput-option-background-hover)}:host .dropdown-wrapper li.help-text,:host .dropdown-wrapper div.help-text{color:var(--wmcolor-taginput-help-text);height:auto;min-height:2.6875rem;padding-top:0.25rem;padding-bottom:0.25rem;white-space:normal}:host .dropdown-wrapper li:not(:last-child),:host .dropdown-wrapper div:not(:last-child){border-bottom:2px solid var(--wmcolor-taginput-option-border)}:host .info-text{font-style:italic;margin-top:0.25rem}:host .table-wrapper{overflow:auto;margin-top:1.5rem}:host .table-wrapper #table{width:100%;border-spacing:0px}:host .table-wrapper #table.fixed-widths{table-layout:fixed}:host .table-wrapper #table .headers{height:2.5rem;background-color:var(--wmcolor-taginput-header-background-table)}:host .table-wrapper #table .headers th{text-align:left;font-size:0.75rem;font-weight:700;text-transform:uppercase;padding:0 1.5rem}:host .table-wrapper tr:nth-child(even){background-color:var(--wmcolor-taginput-altrow-background-table)}:host .table-wrapper tr.selected,:host .table-wrapper tr.locked{background-color:var(--wmcolor-taginput-row-background-selected);-webkit-box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);box-shadow:inset 0 0 0 1px var(--wmcolor-taginput-row-border-selected);font-weight:500}:host .table-wrapper tr.focused,:host .table-wrapper tr:hover:not(.locked){background-color:var(--wmcolor-taginput-row-background-hover);-webkit-box-shadow:none;box-shadow:none}:host .table-wrapper tr.locked td{cursor:auto}:host .table-wrapper tr.locked td:first-child .cell-content-wrapper:before{display:inline-block;font:normal normal normal 24px/1 "Material Design Icons";font-size:inherit;text-rendering:auto;line-height:inherit;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;content:"\\f33e";margin-right:0.5rem;color:var(--wmcolor-taginput-tag-text)}:host .table-wrapper td{height:3.75rem;vertical-align:middle;padding:0 1.5rem;cursor:pointer}:host .table-wrapper td.focused{outline:3px solid var(--wmcolor-interactive-focus);outline-offset:-3px}:host .table-wrapper td .cell-content-wrapper.trunc{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}:host .description{display:none}:host .no-results{padding:1.25rem 1.5rem}:host .sr-only{position:absolute !important;width:1px !important;height:1px !important;padding:0 !important;border:0 !important;overflow:hidden !important;clip:rect(0, 0, 0, 0) !important;-webkit-clip-path:inset(50%) !important;clip-path:inset(50%) !important;white-space:nowrap !important;margin:-1px !important}:host #error{display:block;font-style:italic;color:var(--wmcolor-text-error);font-size:0.875rem}:host #error:not(:empty){margin-top:0.25rem}';export{w as wm_tag_input}
|