@esri/solutions-components 0.6.13 → 0.6.14
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/layer-table/resources.json +1 -1
- package/dist/assets/t9n/layer-table/resources_en.json +1 -1
- package/dist/assets/t9n/map-layer-picker/resources.json +4 -0
- package/dist/assets/t9n/map-layer-picker/resources_en.json +4 -0
- package/dist/cjs/basemap-gallery_6.cjs.entry.js +20 -5
- package/dist/cjs/buffer-tools_4.cjs.entry.js +1 -1
- package/dist/cjs/calcite-chip_3.cjs.entry.js +803 -0
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +76 -28
- package/dist/cjs/card-manager_3.cjs.entry.js +112 -54
- package/dist/cjs/crowdsource-manager.cjs.entry.js +18 -5
- package/dist/cjs/{downloadUtils-fb4744e0.js → downloadUtils-34a515ad.js} +2 -2
- package/dist/cjs/edit-card_2.cjs.entry.js +5 -0
- package/dist/cjs/{index.es-372e33de.js → index.es-0ba11065.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
- package/dist/cjs/{mapViewUtils-a4dd36ec.js → mapViewUtils-a2884698.js} +39 -55
- package/dist/cjs/public-notification.cjs.entry.js +3 -3
- package/dist/cjs/{publicNotificationStore-b69862af.js → publicNotificationStore-610bd880.js} +0 -4
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/basemap-gallery/basemap-gallery.js +23 -1
- package/dist/collection/components/card-manager/card-manager.js +2 -2
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +171 -5
- package/dist/collection/components/edit-card/edit-card.js +19 -0
- package/dist/collection/components/layer-table/layer-table.js +127 -47
- package/dist/collection/components/map-card/map-card.js +115 -5
- package/dist/collection/components/map-layer-picker/map-layer-picker.css +4 -0
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +107 -27
- package/dist/collection/components/map-picker/map-picker.css +5 -1
- package/dist/collection/components/map-picker/map-picker.js +3 -3
- package/dist/collection/components/map-tools/map-tools.js +104 -1
- package/dist/collection/utils/interfaces.ts +12 -1
- package/dist/collection/utils/mapViewUtils.js +38 -52
- package/dist/collection/utils/mapViewUtils.ts +41 -57
- package/dist/collection/utils/publicNotificationStore.js +0 -4
- package/dist/collection/utils/publicNotificationStore.ts +0 -4
- package/dist/components/basemap-gallery2.js +2 -0
- package/dist/components/card-manager2.js +2 -2
- package/dist/components/crowdsource-manager.js +27 -6
- package/dist/components/edit-card2.js +5 -0
- package/dist/components/layer-table2.js +136 -78
- package/dist/components/map-card2.js +17 -5
- package/dist/components/map-layer-picker2.js +114 -52
- package/dist/components/map-picker2.js +4 -4
- package/dist/components/map-select-tools2.js +55 -43
- package/dist/components/map-tools2.js +20 -1
- package/dist/components/mapViewUtils.js +39 -53
- package/dist/components/public-notification.js +1 -1
- package/dist/components/publicNotificationStore.js +0 -4
- package/dist/components/refine-selection2.js +61 -49
- package/dist/esm/basemap-gallery_6.entry.js +20 -5
- package/dist/esm/buffer-tools_4.entry.js +1 -1
- package/dist/esm/calcite-chip_3.entry.js +797 -0
- package/dist/esm/calcite-combobox_6.entry.js +76 -28
- package/dist/esm/card-manager_3.entry.js +112 -54
- package/dist/esm/crowdsource-manager.entry.js +18 -5
- package/dist/esm/{downloadUtils-67c7a6c8.js → downloadUtils-ac67a786.js} +2 -2
- package/dist/esm/edit-card_2.entry.js +5 -0
- package/dist/esm/{index.es-59a67d3d.js → index.es-f553598f.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +3 -3
- package/dist/esm/{mapViewUtils-00a04d52.js → mapViewUtils-8141d8c1.js} +39 -53
- package/dist/esm/public-notification.entry.js +3 -3
- package/dist/esm/{publicNotificationStore-90a6a274.js → publicNotificationStore-dcf39a55.js} +0 -4
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/p-08b52ed8.entry.js +6 -0
- package/dist/solutions-components/p-16362eb4.js +36 -0
- package/dist/solutions-components/{p-3691a072.js → p-1ab414e0.js} +2 -2
- package/dist/solutions-components/{p-73ab9d9a.entry.js → p-3d7aa1b2.entry.js} +1 -1
- package/dist/solutions-components/{p-9a8c51bf.entry.js → p-57cf6784.entry.js} +1 -1
- package/dist/solutions-components/p-64b22d57.entry.js +6 -0
- package/dist/solutions-components/p-654dd5df.entry.js +6 -0
- package/dist/solutions-components/{p-f9166fcb.js → p-a26711e8.js} +1 -1
- package/dist/solutions-components/p-b1c8c6d7.entry.js +6 -0
- package/dist/solutions-components/{p-b892e595.entry.js → p-b9d29f30.entry.js} +1 -1
- package/dist/solutions-components/{p-1b41181b.js → p-c8d0ce92.js} +2 -2
- package/dist/solutions-components/{p-0219a1a9.entry.js → p-e76949eb.entry.js} +6 -6
- package/dist/solutions-components/p-ee7e2f00.entry.js +34 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +12 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +41 -57
- package/dist/solutions-components/utils/publicNotificationStore.ts +0 -4
- package/dist/types/components/basemap-gallery/basemap-gallery.d.ts +5 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +37 -1
- package/dist/types/components/edit-card/edit-card.d.ts +8 -0
- package/dist/types/components/layer-table/layer-table.d.ts +40 -0
- package/dist/types/components/map-card/map-card.d.ts +25 -1
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +50 -3
- package/dist/types/components/map-picker/map-picker.d.ts +2 -2
- package/dist/types/components/map-tools/map-tools.d.ts +21 -1
- package/dist/types/components.d.ts +182 -2
- package/dist/types/preact.d.ts +6 -3
- package/dist/types/utils/interfaces.d.ts +10 -1
- package/dist/types/utils/mapViewUtils.d.ts +8 -24
- package/dist/types/utils/publicNotificationStore.d.ts +0 -2
- package/package.json +1 -1
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -259
- package/dist/cjs/calcite-notice.cjs.entry.js +0 -139
- package/dist/cjs/calcite-tooltip.cjs.entry.js +0 -439
- package/dist/esm/calcite-chip.entry.js +0 -255
- package/dist/esm/calcite-notice.entry.js +0 -135
- package/dist/esm/calcite-tooltip.entry.js +0 -435
- package/dist/solutions-components/p-2cff8331.entry.js +0 -6
- package/dist/solutions-components/p-3a6c8fc3.entry.js +0 -6
- package/dist/solutions-components/p-3b1fc7a2.entry.js +0 -6
- package/dist/solutions-components/p-767002cd.js +0 -36
- package/dist/solutions-components/p-a776b7e6.entry.js +0 -6
- package/dist/solutions-components/p-be36d5ed.entry.js +0 -22
- package/dist/solutions-components/p-c644edf5.entry.js +0 -11
- package/dist/solutions-components/p-cfd88a2f.entry.js +0 -11
@@ -3,33 +3,33 @@
|
|
3
3
|
* Licensed under the Apache License, Version 2.0
|
4
4
|
* http://www.apache.org/licenses/LICENSE-2.0
|
5
5
|
*/
|
6
|
-
import{h as i,r as t,c as e,H as s,g as n}from"./p-33613993.js";import{f as o}from"./p-3a844a72.js";import{i as a,t as r,e as c,g as l,d as h,h as d}from"./p-e4f9b782.js";import{d as p,f as m,c as u,r as b,a as g,F as v}from"./p-2ee21e9d.js";import{s as f,c as x,a as w,d as y,H as k}from"./p-49e9e4e3.js";import{g as z}from"./p-8b448a5b.js";import{c as C,u as I,d as D}from"./p-ad75b9bb.js";import{c as H,d as E,g as $}from"./p-72f34a0a.js";import{c as j,s as O,a as
|
6
|
+
import{h as i,r as t,c as e,H as s,g as n}from"./p-33613993.js";import{f as o}from"./p-3a844a72.js";import{i as a,t as r,e as c,g as l,d as h,h as d}from"./p-e4f9b782.js";import{d as p,f as m,c as u,r as b,a as g,F as v}from"./p-2ee21e9d.js";import{s as f,c as x,a as w,d as y,H as k}from"./p-49e9e4e3.js";import{g as z}from"./p-8b448a5b.js";import{c as C,u as I,d as D}from"./p-ad75b9bb.js";import{c as H,d as E,g as $}from"./p-72f34a0a.js";import{c as j,s as O,a as L}from"./p-d74e95e5.js";import{c as P,d as A}from"./p-11550b3c.js";import{c as S}from"./p-588bc0c0.js";import{o as _}from"./p-a097edf0.js";import{c as F,s as R,d as T,u as B}from"./p-79cc0531.js";import{C as M,b as W,c as q,h as N,d as U,e as V,f as G,g as K,a as X}from"./p-dedc167c.js";import{d as Y}from"./p-a82f35c9.js";import{c as J,d as Q}from"./p-bfc78840.js";import{i as Z}from"./p-43ba7a04.js";import{g as ii}from"./p-22833bd3.js";import{k as ti,l as ei}from"./p-16362eb4.js";import{s as si}from"./p-1ab414e0.js";import"./p-e3525c00.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";import"./p-cc462e38.js";
|
7
7
|
/*!
|
8
8
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
9
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
10
|
* v1.6.1
|
11
|
-
*/const oi="x-button";function ai({disabled:t,key:e,label:s,onClick:n,ref:o,scale:a}){return i("button",{"aria-label":s,class:oi,disabled:t,key:e,onClick:n,tabIndex:-1,type:"button",ref:o},i("calcite-icon",{icon:"x",scale:"l"===a?"m":"s"}))}const ri="combobox-item-",ci="combobox-chip-",li="combobox-label-",hi="combobox-listbox-",di="combobox-input-",pi=class{constructor(i){t(this,i),this.calciteComboboxChange=e(this,"calciteComboboxChange",6),this.calciteComboboxFilterChange=e(this,"calciteComboboxFilterChange",6),this.calciteComboboxChipClose=e(this,"calciteComboboxChipClose",6),this.calciteComboboxBeforeClose=e(this,"calciteComboboxBeforeClose",6),this.calciteComboboxClose=e(this,"calciteComboboxClose",6),this.calciteComboboxBeforeOpen=e(this,"calciteComboboxBeforeOpen",6),this.calciteComboboxOpen=e(this,"calciteComboboxOpen",6),this.placement=p,this.internalValueChangeFlag=!1,this.textInput=null,this.mutationObserver=S("mutation",(()=>this.updateItems())),this.resizeObserver=S("resize",(()=>this.setMaxScrollerHeight())),this.guid=z(),this.inputHeight=0,this.ignoreSelectedEventsFlag=!1,this.openTransitionProp="opacity",this.setFilteredPlacements=()=>{const{el:i,flipPlacements:t}=this;this.filteredFlipPlacements=t?m(t,i):null},this.getValue=()=>{const i=this.selectedItems.map((i=>{var t;return null===(t=null==i?void 0:i.value)||void 0===t?void 0:t.toString()}));return(null==i?void 0:i.length)?i.length>1?i:i[0]:""},this.onLabelClick=()=>{this.setFocus()},this.keyDownHandler=i=>{const{key:t}=i;switch(t){case"Tab":this.activeChipIndex=-1,this.activeItemIndex=-1,this.allowCustomValues&&this.text?(this.addCustomChip(this.text,!0),i.preventDefault()):this.open&&(this.open=!1,i.preventDefault());break;case"ArrowLeft":this.previousChip(),i.preventDefault();break;case"ArrowRight":this.nextChip(),i.preventDefault();break;case"ArrowUp":i.preventDefault(),this.open&&this.shiftActiveItemIndex(-1),this.comboboxInViewport()||this.el.scrollIntoView();break;case"ArrowDown":i.preventDefault(),this.open?this.shiftActiveItemIndex(1):(this.open=!0,this.ensureRecentSelectedItemIsActive()),this.comboboxInViewport()||this.el.scrollIntoView();break;case" ":this.textInput.value||(this.open||(this.open=!0,this.shiftActiveItemIndex(1)),i.preventDefault());break;case"Home":if(!this.open)return;i.preventDefault(),this.updateActiveItemIndex(0),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"End":if(!this.open)return;i.preventDefault(),this.updateActiveItemIndex(this.filteredItems.length-1),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"Escape":this.clearDisabled||this.open||this.clearValue(),this.open=!1,i.preventDefault();break;case"Enter":this.activeItemIndex>-1?(this.toggleSelection(this.filteredItems[this.activeItemIndex]),i.preventDefault()):this.activeChipIndex>-1?(this.removeActiveChip(),i.preventDefault()):this.allowCustomValues&&this.text?(this.addCustomChip(this.text,!0),i.preventDefault()):i.defaultPrevented||f(this)&&i.preventDefault();break;case"Delete":case"Backspace":this.activeChipIndex>-1?(i.preventDefault(),this.removeActiveChip()):!this.text&&this.isMulti()&&(i.preventDefault(),this.removeLastChip())}},this.toggleCloseEnd=()=>{this.open=!1,this.el.removeEventListener("calciteComboboxClose",this.toggleCloseEnd)},this.toggleOpenEnd=()=>{this.open=!1,this.el.removeEventListener("calciteComboboxOpen",this.toggleOpenEnd)},this.setMaxScrollerHeight=async()=>{const{listContainerEl:i,open:t,referenceEl:e}=this;if(!i||!t)return;await this.reposition(!0);const s=this.getMaxScrollerHeight();i.style.maxHeight=s>0?`${s}px`:"",i.style.minWidth=`${e.clientWidth}px`,await this.reposition(!0)},this.calciteChipCloseHandler=i=>{this.open=!1;const t=this.items.find((t=>t===i));t&&this.toggleSelection(t,!1),this.calciteComboboxChipClose.emit()},this.clickHandler=i=>{const t=i.composedPath();return t.some((i=>"CALCITE-CHIP"===i.tagName))?(this.open=!1,void i.preventDefault()):t.some((i=>{var t;return null===(t=i.classList)||void 0===t?void 0:t.contains(oi)}))?(this.clearValue(),void i.preventDefault()):(this.open=!this.open,void this.ensureRecentSelectedItemIsActive())},this.setInactiveIfNotContained=i=>{const t=i.composedPath();!this.open||t.includes(this.el)||t.includes(this.referenceEl)||(this.allowCustomValues&&this.text.trim().length&&this.addCustomChip(this.text),"single"===this.selectionMode&&(this.textInput&&(this.textInput.value=""),this.text="",this.filterItems(""),this.updateActiveItemIndex(-1)),this.open=!1)},this.setFloatingEl=i=>{this.floatingEl=i,u(this,this.referenceEl,this.floatingEl)},this.setContainerEl=i=>{this.resizeObserver.observe(i),this.listContainerEl=i,this.transitionEl=i},this.setReferenceEl=i=>{this.referenceEl=i,u(this,this.referenceEl,this.floatingEl)},this.inputHandler=i=>{const t=i.target.value;this.text=t,this.filterItems(t),t&&(this.activeChipIndex=-1)},this.filterItems=(()=>{const i=(i,t)=>i&&t.some((({label:t,value:e})=>i.tagName===V?e===i.label:e===i.textLabel||e===i.value||t===i.textLabel||t===i.value));return Y((t=>{const e=o(this.data,t);this.getCombinedItems().forEach((t=>{const s=!i(t,e);t.hidden=s;const[n,o]=t.ancestors;(i(n,e)||i(o,e))&&(t.hidden=!1),s||t.ancestors.forEach((i=>i.hidden=!1))})),this.filteredItems=this.getFilteredItems(),this.calciteComboboxFilterChange.emit()}),100)})(),this.internalComboboxChangeEvent=()=>{this.calciteComboboxChange.emit()},this.emitComboboxChange=Y(this.internalComboboxChangeEvent,0),this.updateItems=()=>{this.items=this.getItems(),this.groupItems=this.getGroupItems(),this.data=this.getData(),this.selectedItems=this.getSelectedItems(),this.filteredItems=this.getFilteredItems(),this.needsIcon=this.getNeedsIcon(),this.allowCustomValues||this.setMaxScrollerHeight(),this.groupItems.forEach(((i,t,e)=>{0===t&&(i.afterEmptyGroup=!1);const s=e[t+1];s&&(s.afterEmptyGroup=0===i.children.length)}))},this.scrollToActiveItem=()=>{const i=this.filteredItems[this.activeItemIndex];if(!i)return;const t=this.calculateSingleItemHeight(i),{offsetHeight:e,scrollTop:s}=this.listContainerEl;e+s<i.offsetTop+t?this.listContainerEl.scrollTop=i.offsetTop-e+t:i.offsetTop<s&&(this.listContainerEl.scrollTop=i.offsetTop)},this.comboboxFocusHandler=()=>{var i;this.disabled||null===(i=this.textInput)||void 0===i||i.focus()},this.comboboxBlurHandler=i=>{this.setInactiveIfNotContained(i)},this.clearDisabled=!1,this.open=!1,this.disabled=!1,this.form=void 0,this.label=void 0,this.placeholder=void 0,this.placeholderIcon=void 0,this.placeholderIconFlipRtl=!1,this.maxItems=0,this.name=void 0,this.allowCustomValues=void 0,this.overlayPositioning="absolute",this.required=!1,this.selectionMode="multiple",this.scale="m",this.value=null,this.flipPlacements=void 0,this.messages=void 0,this.messageOverrides=void 0,this.selectedItems=[],this.filteredItems=[],this.items=[],this.groupItems=[],this.needsIcon=void 0,this.activeItemIndex=-1,this.activeChipIndex=-1,this.activeDescendant="",this.text="",this.effectiveLocale=void 0,this.defaultMessages=void 0}openHandler(){_(this),this.disabled?this.open=!1:this.setMaxScrollerHeight()}handleDisabledChange(i){i||(this.open=!1)}maxItemsHandler(){this.setMaxScrollerHeight()}overlayPositioningHandler(){this.reposition(!0)}valueHandler(i){if(!this.internalValueChangeFlag){const t=this.getItems();Array.isArray(i)?t.forEach((t=>t.selected=i.includes(t.value))):t.forEach(i?t=>t.selected=i===t.value:i=>i.selected=!1),this.updateItems()}}onMessagesChange(){}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}selectedItemsHandler(){this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1}documentClickHandler(i){!this.disabled&&a(i)&&this.setInactiveIfNotContained(i)}calciteComboboxItemChangeHandler(i){if(this.ignoreSelectedEventsFlag)return;const t=i.target,e=this.filteredItems.indexOf(t);this.updateActiveItemIndex(e),this.toggleSelection(t,t.selected)}async reposition(i=!1){const{floatingEl:t,referenceEl:e,placement:s,overlayPositioning:n,filteredFlipPlacements:o}=this;return b(this,{floatingEl:t,referenceEl:e,overlayPositioning:n,placement:s,flipPlacements:o,type:"menu"},i)}async setFocus(){var i;await j(this),null===(i=this.textInput)||void 0===i||i.focus(),this.activeChipIndex=-1,this.activeItemIndex=-1}connectedCallback(){var i;C(this),L(this),F(this),this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1,null===(i=this.mutationObserver)||void 0===i||i.observe(this.el,{childList:!0,subtree:!0}),H(this),x(this),this.setFilteredPlacements(),this.reposition(!0),this.open&&(this.openHandler(),_(this))}async componentWillLoad(){O(this),this.updateItems(),await R(this)}componentDidLoad(){w(this,this.getValue()),this.reposition(!0),A(this)}componentDidRender(){this.el.offsetHeight!==this.inputHeight&&(this.reposition(!0),this.inputHeight=this.el.offsetHeight),I(this)}disconnectedCallback(){var i,t;null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),D(this),E(this),y(this),g(this,this.referenceEl,this.floatingEl),P(this),B(this)}textHandler(){this.updateActiveItemIndex(-1)}effectiveLocaleChange(){M(this,this.effectiveLocale)}clearValue(){this.ignoreSelectedEventsFlag=!0,this.items.forEach((i=>i.selected=!1)),this.ignoreSelectedEventsFlag=!1,this.selectedItems=[],this.emitComboboxChange(),this.open=!1,this.updateActiveItemIndex(-1),this.resetText(),this.filterItems(""),this.setFocus()}comboboxInViewport(){const i=this.el.getBoundingClientRect();return i.top>=0&&i.left>=0&&i.right<=(window.innerWidth||document.documentElement.clientWidth)&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)}onBeforeOpen(){this.scrollToActiveItem(),this.calciteComboboxBeforeOpen.emit()}onOpen(){this.calciteComboboxOpen.emit()}onBeforeClose(){this.calciteComboboxBeforeClose.emit()}onClose(){this.calciteComboboxClose.emit()}ensureRecentSelectedItemIsActive(){const{selectedItems:i}=this,t=0===i.length?0:this.items.indexOf(i[i.length-1]);this.updateActiveItemIndex(t)}getMaxScrollerHeight(){const i=this.getCombinedItems().filter((i=>!i.hidden)),{maxItems:t}=this;let e=0,s=0;return i.length>t&&i.forEach((i=>{if(e<t&&t>0){const t=this.calculateSingleItemHeight(i);t>0&&(s+=t,e++)}})),s}calculateSingleItemHeight(i){if(!i)return;let t=i.offsetHeight;return Array.from(i.querySelectorAll(T)).map((i=>null==i?void 0:i.offsetHeight)).forEach((i=>{t-=i})),t}getCombinedItems(){return[...this.groupItems,...this.items]}toggleSelection(i,t=!i.selected){i&&(this.isMulti()?(i.selected=t,this.updateAncestors(i),this.selectedItems=this.getSelectedItems(),this.emitComboboxChange(),this.resetText(),this.filterItems("")):(this.ignoreSelectedEventsFlag=!0,this.items.forEach((e=>e.selected=e===i&&t)),this.ignoreSelectedEventsFlag=!1,this.selectedItems=this.getSelectedItems(),this.emitComboboxChange(),this.textInput&&(this.textInput.value=i.textLabel),this.open=!1,this.updateActiveItemIndex(-1),this.resetText(),this.filterItems("")))}updateAncestors(i){if("ancestors"!==this.selectionMode)return;const t=W(i),e=q(i);i.selected?t.forEach((i=>{i.selected=!0})):(e.forEach((i=>i.selected=!1)),[...t].forEach((i=>{N(i)||(i.selected=!1)})))}getFilteredItems(){return this.items.filter((i=>!i.hidden))}getSelectedItems(){if(!this.isMulti()){const i=this.items.find((({selected:i})=>i));return i?[i]:[]}return this.items.filter((i=>i.selected&&("ancestors"!==this.selectionMode||!N(i)))).sort(((i,t)=>{const e=this.selectedItems.indexOf(i),s=this.selectedItems.indexOf(t);return e>-1&&s>-1?e-s:s-e}))}getData(){return this.items.map((i=>({filterDisabled:i.filterDisabled,value:i.value,label:i.textLabel})))}getNeedsIcon(){return"single"===this.selectionMode&&this.items.some((i=>i.icon))}resetText(){this.textInput&&(this.textInput.value=""),this.text=""}getItems(){return Array.from(this.el.querySelectorAll(U)).filter((i=>!i.disabled))}getGroupItems(){return Array.from(this.el.querySelectorAll(V))}addCustomChip(i,t){const e=this.items.find((t=>t.textLabel===i));if(e)this.toggleSelection(e,!0);else{this.isMulti()||this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1);const e=document.createElement(U);e.value=i,e.textLabel=i,e.selected=!0,this.el.appendChild(e),this.resetText(),t&&this.setFocus(),this.updateItems(),this.filterItems(""),this.emitComboboxChange()}}removeActiveChip(){this.toggleSelection(this.selectedItems[this.activeChipIndex],!1),this.setFocus()}removeLastChip(){this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1),this.setFocus()}previousChip(){if(this.text)return;const i=this.activeChipIndex;this.activeChipIndex=-1===i?this.selectedItems.length-1:Math.max(i-1,0),this.updateActiveItemIndex(-1),this.focusChip()}nextChip(){if(this.text||-1===this.activeChipIndex)return;const i=this.activeChipIndex+1;i>this.selectedItems.length-1?(this.activeChipIndex=-1,this.setFocus()):(this.activeChipIndex=i,this.focusChip()),this.updateActiveItemIndex(-1)}focusChip(){var i;const t=null===(i=this.selectedItems[this.activeChipIndex])||void 0===i?void 0:i.guid,e=t?this.referenceEl.querySelector(`#${ci}${t}`):null;null==e||e.setFocus()}shiftActiveItemIndex(i){const{length:t}=this.filteredItems;this.updateActiveItemIndex((this.activeItemIndex+t+i)%t),this.scrollToActiveItem()}updateActiveItemIndex(i){this.activeItemIndex=i;let t=null;this.filteredItems.forEach(((e,s)=>{s===i?(e.active=!0,t=`${ri}${e.guid}`):e.active=!1})),this.activeDescendant=t,this.activeItemIndex>-1&&(this.activeChipIndex=-1)}isMulti(){return"single"!==this.selectionMode}renderChips(){const{activeChipIndex:t,scale:e,selectionMode:s,messages:n}=this;return this.selectedItems.map(((o,a)=>{const r={chip:!0,"chip--active":t===a},c=[...[...W(o)].reverse(),o].map((i=>i.textLabel)),l="ancestors"!==s?o.textLabel:c.join(" / ");return i("calcite-chip",{class:r,closable:!0,icon:o.icon,iconFlipRtl:o.iconFlipRtl,id:o.guid?`${ci}${o.guid}`:null,key:o.textLabel,messageOverrides:{dismissLabel:n.removeTag},onCalciteChipClose:()=>this.calciteChipCloseHandler(o),scale:e,title:l,value:o.value},l)}))}renderInput(){const{guid:t,disabled:e,placeholder:s,selectionMode:n,selectedItems:o,open:a}=this,r="single"===n,c=o[0],l=!a&&r&&!!c;return i("span",{class:{"input-wrap":!0,"input-wrap--single":r}},l&&i("span",{class:{label:!0,"label--icon":!!(null==c?void 0:c.icon)},key:"label"},c.textLabel),i("input",{"aria-activedescendant":this.activeDescendant,"aria-autocomplete":"list","aria-controls":`${hi}${t}`,"aria-label":$(this),class:{input:!0,"input--single":!0,"input--transparent":this.activeChipIndex>-1,"input--hidden":l,"input--icon":!!this.placeholderIcon},disabled:e,id:`${di}${t}`,key:"input",onBlur:this.comboboxBlurHandler,onFocus:this.comboboxFocusHandler,onInput:this.inputHandler,placeholder:s,type:"text",ref:i=>this.textInput=i}))}renderListBoxOptions(){return this.filteredItems.map((t=>i("li",{"aria-selected":r(t.selected),id:t.guid?`${ri}${t.guid}`:null,role:"option",tabindex:"-1"},t.textLabel)))}renderFloatingUIContainer(){const{setFloatingEl:t,setContainerEl:e,open:s}=this;return i("div",{"aria-hidden":"true",class:{"floating-ui-container":!0,"floating-ui-container--active":s},ref:t},i("div",{class:{[G.listContainer]:!0,[v.animation]:!0,[v.animationActive]:s},ref:e},i("ul",{class:{list:!0,"list--hide":!s}},i("slot",null))))}renderIconStart(){const{selectedItems:t,placeholderIcon:e,selectionMode:s,placeholderIconFlipRtl:n}=this,o=t[0],a=null==o?void 0:o.icon,r="single"===s;return(!this.open&&o?!!a&&r:!!this.placeholderIcon&&(!o||r))&&i("span",{class:"icon-start"},i("calcite-icon",{class:"selected-icon",flipRtl:this.open&&o?o.iconFlipRtl:n,icon:!this.open&&o?a:e,scale:"s"}))}renderIconEnd(){const{open:t}=this;return i("span",{class:"icon-end"},i("calcite-icon",{icon:t?"chevron-up":"chevron-down",scale:"s"}))}render(){var t;const{guid:e,label:n,open:o}=this,a="single"===this.selectionMode,c=!this.clearDisabled&&(null===(t=this.value)||void 0===t?void 0:t.length)>0;return i(s,{onClick:this.comboboxFocusHandler},i("div",{"aria-autocomplete":"list","aria-controls":`${hi}${e}`,"aria-expanded":r(o),"aria-haspopup":"listbox","aria-label":$(this),"aria-live":"polite","aria-owns":`${hi}${e}`,class:{wrapper:!0,"wrapper--single":a||!this.selectedItems.length,"wrapper--active":o},onClick:this.clickHandler,onKeyDown:this.keyDownHandler,role:"combobox",ref:this.setReferenceEl},i("div",{class:"grid-input"},this.renderIconStart(),!a&&this.renderChips(),i("label",{class:"screen-readers-only",htmlFor:`${di}${e}`,id:`${li}${e}`},n),this.renderInput()),c?i(ai,{disabled:this.disabled,key:"close-button",label:this.messages.clear,scale:this.scale}):null,this.renderIconEnd()),i("ul",{"aria-labelledby":`${li}${e}`,"aria-multiselectable":"true",class:"screen-readers-only",id:`${hi}${e}`,role:"listbox",tabIndex:-1},this.renderListBoxOptions()),this.renderFloatingUIContainer(),i(k,{component:this}))}static get assetsDirs(){return["assets"]}get el(){return n(this)}static get watchers(){return{open:["openHandler"],disabled:["handleDisabledChange"],maxItems:["maxItemsHandler"],overlayPositioning:["overlayPositioningHandler"],value:["valueHandler"],messageOverrides:["onMessagesChange"],flipPlacements:["flipPlacementsHandler"],selectedItems:["selectedItemsHandler"],text:["textHandler"],effectiveLocale:["effectiveLocaleChange"]}}};pi.style=":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]) .x-button{inline-size:1rem;block-size:1rem}:host([scale=m]) .x-button{inline-size:1.5rem;block-size:1.5rem}:host([scale=l]) .x-button{inline-size:2rem;block-size:2rem}.x-button{margin:0px;display:flex;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-content:center;align-items:center;justify-content:center;align-self:center;border-width:2px;background-color:transparent;color:var(--calcite-ui-text-3);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-radius:50%;border-color:transparent;background-color:var(--calcite-ui-foreground-2)}.x-button:active,.x-button:hover{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-3)}.x-button:active{border-style:solid;border-color:var(--calcite-ui-brand)}.x-button calcite-icon{color:inherit}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=s]) .x-button{margin-inline-end:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=m]) .x-button{margin-inline-end:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}:host([scale=l]) .x-button{margin-inline-end:1rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;margin-block-end:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-block:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;inline-size:1rem;cursor:pointer;align-items:center}.icon-end{flex:none}.floating-ui-container{--calcite-floating-ui-z-index:var(--calcite-app-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}.floating-ui-container--active{visibility:visible}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-inline-size:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}::slotted(calcite-combobox-item-group:not(:first-child)){padding-block-start:var(--calcite-combobox-item-spacing-unit-l)}";
|
11
|
+
*/const ni="x-button";function oi({disabled:t,key:e,label:s,onClick:n,ref:o,scale:a}){return i("button",{"aria-label":s,class:ni,disabled:t,key:e,onClick:n,tabIndex:-1,type:"button",ref:o},i("calcite-icon",{icon:"x",scale:"l"===a?"m":"s"}))}const ai="combobox-item-",ri="combobox-chip-",ci="combobox-label-",li="combobox-listbox-",hi="combobox-input-",di=class{constructor(i){t(this,i),this.calciteComboboxChange=e(this,"calciteComboboxChange",6),this.calciteComboboxFilterChange=e(this,"calciteComboboxFilterChange",6),this.calciteComboboxChipClose=e(this,"calciteComboboxChipClose",6),this.calciteComboboxBeforeClose=e(this,"calciteComboboxBeforeClose",6),this.calciteComboboxClose=e(this,"calciteComboboxClose",6),this.calciteComboboxBeforeOpen=e(this,"calciteComboboxBeforeOpen",6),this.calciteComboboxOpen=e(this,"calciteComboboxOpen",6),this.placement=p,this.internalValueChangeFlag=!1,this.textInput=null,this.mutationObserver=S("mutation",(()=>this.updateItems())),this.resizeObserver=S("resize",(()=>this.setMaxScrollerHeight())),this.guid=z(),this.inputHeight=0,this.ignoreSelectedEventsFlag=!1,this.openTransitionProp="opacity",this.setFilteredPlacements=()=>{const{el:i,flipPlacements:t}=this;this.filteredFlipPlacements=t?m(t,i):null},this.getValue=()=>{const i=this.selectedItems.map((i=>{var t;return null===(t=null==i?void 0:i.value)||void 0===t?void 0:t.toString()}));return(null==i?void 0:i.length)?i.length>1?i:i[0]:""},this.onLabelClick=()=>{this.setFocus()},this.keyDownHandler=i=>{const{key:t}=i;switch(t){case"Tab":this.activeChipIndex=-1,this.activeItemIndex=-1,this.allowCustomValues&&this.text?(this.addCustomChip(this.text,!0),i.preventDefault()):this.open&&(this.open=!1,i.preventDefault());break;case"ArrowLeft":this.previousChip(),i.preventDefault();break;case"ArrowRight":this.nextChip(),i.preventDefault();break;case"ArrowUp":i.preventDefault(),this.open&&this.shiftActiveItemIndex(-1),this.comboboxInViewport()||this.el.scrollIntoView();break;case"ArrowDown":i.preventDefault(),this.open?this.shiftActiveItemIndex(1):(this.open=!0,this.ensureRecentSelectedItemIsActive()),this.comboboxInViewport()||this.el.scrollIntoView();break;case" ":this.textInput.value||(this.open||(this.open=!0,this.shiftActiveItemIndex(1)),i.preventDefault());break;case"Home":if(!this.open)return;i.preventDefault(),this.updateActiveItemIndex(0),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"End":if(!this.open)return;i.preventDefault(),this.updateActiveItemIndex(this.filteredItems.length-1),this.scrollToActiveItem(),this.comboboxInViewport()||this.el.scrollIntoView();break;case"Escape":this.clearDisabled||this.open||this.clearValue(),this.open=!1,i.preventDefault();break;case"Enter":this.activeItemIndex>-1?(this.toggleSelection(this.filteredItems[this.activeItemIndex]),i.preventDefault()):this.activeChipIndex>-1?(this.removeActiveChip(),i.preventDefault()):this.allowCustomValues&&this.text?(this.addCustomChip(this.text,!0),i.preventDefault()):i.defaultPrevented||f(this)&&i.preventDefault();break;case"Delete":case"Backspace":this.activeChipIndex>-1?(i.preventDefault(),this.removeActiveChip()):!this.text&&this.isMulti()&&(i.preventDefault(),this.removeLastChip())}},this.toggleCloseEnd=()=>{this.open=!1,this.el.removeEventListener("calciteComboboxClose",this.toggleCloseEnd)},this.toggleOpenEnd=()=>{this.open=!1,this.el.removeEventListener("calciteComboboxOpen",this.toggleOpenEnd)},this.setMaxScrollerHeight=async()=>{const{listContainerEl:i,open:t,referenceEl:e}=this;if(!i||!t)return;await this.reposition(!0);const s=this.getMaxScrollerHeight();i.style.maxHeight=s>0?`${s}px`:"",i.style.minWidth=`${e.clientWidth}px`,await this.reposition(!0)},this.calciteChipCloseHandler=i=>{this.open=!1;const t=this.items.find((t=>t===i));t&&this.toggleSelection(t,!1),this.calciteComboboxChipClose.emit()},this.clickHandler=i=>{const t=i.composedPath();return t.some((i=>"CALCITE-CHIP"===i.tagName))?(this.open=!1,void i.preventDefault()):t.some((i=>{var t;return null===(t=i.classList)||void 0===t?void 0:t.contains(ni)}))?(this.clearValue(),void i.preventDefault()):(this.open=!this.open,void this.ensureRecentSelectedItemIsActive())},this.setInactiveIfNotContained=i=>{const t=i.composedPath();!this.open||t.includes(this.el)||t.includes(this.referenceEl)||(this.allowCustomValues&&this.text.trim().length&&this.addCustomChip(this.text),"single"===this.selectionMode&&(this.textInput&&(this.textInput.value=""),this.text="",this.filterItems(""),this.updateActiveItemIndex(-1)),this.open=!1)},this.setFloatingEl=i=>{this.floatingEl=i,u(this,this.referenceEl,this.floatingEl)},this.setContainerEl=i=>{this.resizeObserver.observe(i),this.listContainerEl=i,this.transitionEl=i},this.setReferenceEl=i=>{this.referenceEl=i,u(this,this.referenceEl,this.floatingEl)},this.inputHandler=i=>{const t=i.target.value;this.text=t,this.filterItems(t),t&&(this.activeChipIndex=-1)},this.filterItems=(()=>{const i=(i,t)=>i&&t.some((({label:t,value:e})=>i.tagName===V?e===i.label:e===i.textLabel||e===i.value||t===i.textLabel||t===i.value));return Y((t=>{const e=o(this.data,t);this.getCombinedItems().forEach((t=>{const s=!i(t,e);t.hidden=s;const[n,o]=t.ancestors;(i(n,e)||i(o,e))&&(t.hidden=!1),s||t.ancestors.forEach((i=>i.hidden=!1))})),this.filteredItems=this.getFilteredItems(),this.calciteComboboxFilterChange.emit()}),100)})(),this.internalComboboxChangeEvent=()=>{this.calciteComboboxChange.emit()},this.emitComboboxChange=Y(this.internalComboboxChangeEvent,0),this.updateItems=()=>{this.items=this.getItems(),this.groupItems=this.getGroupItems(),this.data=this.getData(),this.selectedItems=this.getSelectedItems(),this.filteredItems=this.getFilteredItems(),this.needsIcon=this.getNeedsIcon(),this.allowCustomValues||this.setMaxScrollerHeight(),this.groupItems.forEach(((i,t,e)=>{0===t&&(i.afterEmptyGroup=!1);const s=e[t+1];s&&(s.afterEmptyGroup=0===i.children.length)}))},this.scrollToActiveItem=()=>{const i=this.filteredItems[this.activeItemIndex];if(!i)return;const t=this.calculateSingleItemHeight(i),{offsetHeight:e,scrollTop:s}=this.listContainerEl;e+s<i.offsetTop+t?this.listContainerEl.scrollTop=i.offsetTop-e+t:i.offsetTop<s&&(this.listContainerEl.scrollTop=i.offsetTop)},this.comboboxFocusHandler=()=>{var i;this.disabled||null===(i=this.textInput)||void 0===i||i.focus()},this.comboboxBlurHandler=i=>{this.setInactiveIfNotContained(i)},this.clearDisabled=!1,this.open=!1,this.disabled=!1,this.form=void 0,this.label=void 0,this.placeholder=void 0,this.placeholderIcon=void 0,this.placeholderIconFlipRtl=!1,this.maxItems=0,this.name=void 0,this.allowCustomValues=void 0,this.overlayPositioning="absolute",this.required=!1,this.selectionMode="multiple",this.scale="m",this.value=null,this.flipPlacements=void 0,this.messages=void 0,this.messageOverrides=void 0,this.selectedItems=[],this.filteredItems=[],this.items=[],this.groupItems=[],this.needsIcon=void 0,this.activeItemIndex=-1,this.activeChipIndex=-1,this.activeDescendant="",this.text="",this.effectiveLocale=void 0,this.defaultMessages=void 0}openHandler(){_(this),this.disabled?this.open=!1:this.setMaxScrollerHeight()}handleDisabledChange(i){i||(this.open=!1)}maxItemsHandler(){this.setMaxScrollerHeight()}overlayPositioningHandler(){this.reposition(!0)}valueHandler(i){if(!this.internalValueChangeFlag){const t=this.getItems();Array.isArray(i)?t.forEach((t=>t.selected=i.includes(t.value))):t.forEach(i?t=>t.selected=i===t.value:i=>i.selected=!1),this.updateItems()}}onMessagesChange(){}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}selectedItemsHandler(){this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1}documentClickHandler(i){!this.disabled&&a(i)&&this.setInactiveIfNotContained(i)}calciteComboboxItemChangeHandler(i){if(this.ignoreSelectedEventsFlag)return;const t=i.target,e=this.filteredItems.indexOf(t);this.updateActiveItemIndex(e),this.toggleSelection(t,t.selected)}async reposition(i=!1){const{floatingEl:t,referenceEl:e,placement:s,overlayPositioning:n,filteredFlipPlacements:o}=this;return b(this,{floatingEl:t,referenceEl:e,overlayPositioning:n,placement:s,flipPlacements:o,type:"menu"},i)}async setFocus(){var i;await j(this),null===(i=this.textInput)||void 0===i||i.focus(),this.activeChipIndex=-1,this.activeItemIndex=-1}connectedCallback(){var i;C(this),P(this),F(this),this.internalValueChangeFlag=!0,this.value=this.getValue(),this.internalValueChangeFlag=!1,null===(i=this.mutationObserver)||void 0===i||i.observe(this.el,{childList:!0,subtree:!0}),H(this),x(this),this.setFilteredPlacements(),this.reposition(!0),this.open&&(this.openHandler(),_(this))}async componentWillLoad(){O(this),this.updateItems(),await R(this)}componentDidLoad(){w(this,this.getValue()),this.reposition(!0),L(this)}componentDidRender(){this.el.offsetHeight!==this.inputHeight&&(this.reposition(!0),this.inputHeight=this.el.offsetHeight),I(this)}disconnectedCallback(){var i,t;null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),D(this),E(this),y(this),g(this,this.referenceEl,this.floatingEl),A(this),T(this)}textHandler(){this.updateActiveItemIndex(-1)}effectiveLocaleChange(){B(this,this.effectiveLocale)}clearValue(){this.ignoreSelectedEventsFlag=!0,this.items.forEach((i=>i.selected=!1)),this.ignoreSelectedEventsFlag=!1,this.selectedItems=[],this.emitComboboxChange(),this.open=!1,this.updateActiveItemIndex(-1),this.resetText(),this.filterItems(""),this.setFocus()}comboboxInViewport(){const i=this.el.getBoundingClientRect();return i.top>=0&&i.left>=0&&i.right<=(window.innerWidth||document.documentElement.clientWidth)&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)}onBeforeOpen(){this.scrollToActiveItem(),this.calciteComboboxBeforeOpen.emit()}onOpen(){this.calciteComboboxOpen.emit()}onBeforeClose(){this.calciteComboboxBeforeClose.emit()}onClose(){this.calciteComboboxClose.emit()}ensureRecentSelectedItemIsActive(){const{selectedItems:i}=this,t=0===i.length?0:this.items.indexOf(i[i.length-1]);this.updateActiveItemIndex(t)}getMaxScrollerHeight(){const i=this.getCombinedItems().filter((i=>!i.hidden)),{maxItems:t}=this;let e=0,s=0;return i.length>t&&i.forEach((i=>{if(e<t&&t>0){const t=this.calculateSingleItemHeight(i);t>0&&(s+=t,e++)}})),s}calculateSingleItemHeight(i){if(!i)return;let t=i.offsetHeight;return Array.from(i.querySelectorAll(M)).map((i=>null==i?void 0:i.offsetHeight)).forEach((i=>{t-=i})),t}getCombinedItems(){return[...this.groupItems,...this.items]}toggleSelection(i,t=!i.selected){i&&(this.isMulti()?(i.selected=t,this.updateAncestors(i),this.selectedItems=this.getSelectedItems(),this.emitComboboxChange(),this.resetText(),this.filterItems("")):(this.ignoreSelectedEventsFlag=!0,this.items.forEach((e=>e.selected=e===i&&t)),this.ignoreSelectedEventsFlag=!1,this.selectedItems=this.getSelectedItems(),this.emitComboboxChange(),this.textInput&&(this.textInput.value=i.textLabel),this.open=!1,this.updateActiveItemIndex(-1),this.resetText(),this.filterItems("")))}updateAncestors(i){if("ancestors"!==this.selectionMode)return;const t=W(i),e=q(i);i.selected?t.forEach((i=>{i.selected=!0})):(e.forEach((i=>i.selected=!1)),[...t].forEach((i=>{N(i)||(i.selected=!1)})))}getFilteredItems(){return this.items.filter((i=>!i.hidden))}getSelectedItems(){if(!this.isMulti()){const i=this.items.find((({selected:i})=>i));return i?[i]:[]}return this.items.filter((i=>i.selected&&("ancestors"!==this.selectionMode||!N(i)))).sort(((i,t)=>{const e=this.selectedItems.indexOf(i),s=this.selectedItems.indexOf(t);return e>-1&&s>-1?e-s:s-e}))}getData(){return this.items.map((i=>({filterDisabled:i.filterDisabled,value:i.value,label:i.textLabel})))}getNeedsIcon(){return"single"===this.selectionMode&&this.items.some((i=>i.icon))}resetText(){this.textInput&&(this.textInput.value=""),this.text=""}getItems(){return Array.from(this.el.querySelectorAll(U)).filter((i=>!i.disabled))}getGroupItems(){return Array.from(this.el.querySelectorAll(V))}addCustomChip(i,t){const e=this.items.find((t=>t.textLabel===i));if(e)this.toggleSelection(e,!0);else{this.isMulti()||this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1);const e=document.createElement(U);e.value=i,e.textLabel=i,e.selected=!0,this.el.appendChild(e),this.resetText(),t&&this.setFocus(),this.updateItems(),this.filterItems(""),this.emitComboboxChange()}}removeActiveChip(){this.toggleSelection(this.selectedItems[this.activeChipIndex],!1),this.setFocus()}removeLastChip(){this.toggleSelection(this.selectedItems[this.selectedItems.length-1],!1),this.setFocus()}previousChip(){if(this.text)return;const i=this.activeChipIndex;this.activeChipIndex=-1===i?this.selectedItems.length-1:Math.max(i-1,0),this.updateActiveItemIndex(-1),this.focusChip()}nextChip(){if(this.text||-1===this.activeChipIndex)return;const i=this.activeChipIndex+1;i>this.selectedItems.length-1?(this.activeChipIndex=-1,this.setFocus()):(this.activeChipIndex=i,this.focusChip()),this.updateActiveItemIndex(-1)}focusChip(){var i;const t=null===(i=this.selectedItems[this.activeChipIndex])||void 0===i?void 0:i.guid,e=t?this.referenceEl.querySelector(`#${ri}${t}`):null;null==e||e.setFocus()}shiftActiveItemIndex(i){const{length:t}=this.filteredItems;this.updateActiveItemIndex((this.activeItemIndex+t+i)%t),this.scrollToActiveItem()}updateActiveItemIndex(i){this.activeItemIndex=i;let t=null;this.filteredItems.forEach(((e,s)=>{s===i?(e.active=!0,t=`${ai}${e.guid}`):e.active=!1})),this.activeDescendant=t,this.activeItemIndex>-1&&(this.activeChipIndex=-1)}isMulti(){return"single"!==this.selectionMode}renderChips(){const{activeChipIndex:t,scale:e,selectionMode:s,messages:n}=this;return this.selectedItems.map(((o,a)=>{const r={chip:!0,"chip--active":t===a},c=[...[...W(o)].reverse(),o].map((i=>i.textLabel)),l="ancestors"!==s?o.textLabel:c.join(" / ");return i("calcite-chip",{class:r,closable:!0,icon:o.icon,iconFlipRtl:o.iconFlipRtl,id:o.guid?`${ri}${o.guid}`:null,key:o.textLabel,messageOverrides:{dismissLabel:n.removeTag},onCalciteChipClose:()=>this.calciteChipCloseHandler(o),scale:e,title:l,value:o.value},l)}))}renderInput(){const{guid:t,disabled:e,placeholder:s,selectionMode:n,selectedItems:o,open:a}=this,r="single"===n,c=o[0],l=!a&&r&&!!c;return i("span",{class:{"input-wrap":!0,"input-wrap--single":r}},l&&i("span",{class:{label:!0,"label--icon":!!(null==c?void 0:c.icon)},key:"label"},c.textLabel),i("input",{"aria-activedescendant":this.activeDescendant,"aria-autocomplete":"list","aria-controls":`${li}${t}`,"aria-label":$(this),class:{input:!0,"input--single":!0,"input--transparent":this.activeChipIndex>-1,"input--hidden":l,"input--icon":!!this.placeholderIcon},disabled:e,id:`${hi}${t}`,key:"input",onBlur:this.comboboxBlurHandler,onFocus:this.comboboxFocusHandler,onInput:this.inputHandler,placeholder:s,type:"text",ref:i=>this.textInput=i}))}renderListBoxOptions(){return this.filteredItems.map((t=>i("li",{"aria-selected":r(t.selected),id:t.guid?`${ai}${t.guid}`:null,role:"option",tabindex:"-1"},t.textLabel)))}renderFloatingUIContainer(){const{setFloatingEl:t,setContainerEl:e,open:s}=this;return i("div",{"aria-hidden":"true",class:{"floating-ui-container":!0,"floating-ui-container--active":s},ref:t},i("div",{class:{[G.listContainer]:!0,[v.animation]:!0,[v.animationActive]:s},ref:e},i("ul",{class:{list:!0,"list--hide":!s}},i("slot",null))))}renderIconStart(){const{selectedItems:t,placeholderIcon:e,selectionMode:s,placeholderIconFlipRtl:n}=this,o=t[0],a=null==o?void 0:o.icon,r="single"===s;return(!this.open&&o?!!a&&r:!!this.placeholderIcon&&(!o||r))&&i("span",{class:"icon-start"},i("calcite-icon",{class:"selected-icon",flipRtl:this.open&&o?o.iconFlipRtl:n,icon:!this.open&&o?a:e,scale:"s"}))}renderIconEnd(){const{open:t}=this;return i("span",{class:"icon-end"},i("calcite-icon",{icon:t?"chevron-up":"chevron-down",scale:"s"}))}render(){var t;const{guid:e,label:n,open:o}=this,a="single"===this.selectionMode,c=!this.clearDisabled&&(null===(t=this.value)||void 0===t?void 0:t.length)>0;return i(s,{onClick:this.comboboxFocusHandler},i("div",{"aria-autocomplete":"list","aria-controls":`${li}${e}`,"aria-expanded":r(o),"aria-haspopup":"listbox","aria-label":$(this),"aria-live":"polite","aria-owns":`${li}${e}`,class:{wrapper:!0,"wrapper--single":a||!this.selectedItems.length,"wrapper--active":o},onClick:this.clickHandler,onKeyDown:this.keyDownHandler,role:"combobox",ref:this.setReferenceEl},i("div",{class:"grid-input"},this.renderIconStart(),!a&&this.renderChips(),i("label",{class:"screen-readers-only",htmlFor:`${hi}${e}`,id:`${ci}${e}`},n),this.renderInput()),c?i(oi,{disabled:this.disabled,key:"close-button",label:this.messages.clear,scale:this.scale}):null,this.renderIconEnd()),i("ul",{"aria-labelledby":`${ci}${e}`,"aria-multiselectable":"true",class:"screen-readers-only",id:`${li}${e}`,role:"listbox",tabIndex:-1},this.renderListBoxOptions()),this.renderFloatingUIContainer(),i(k,{component:this}))}static get assetsDirs(){return["assets"]}get el(){return n(this)}static get watchers(){return{open:["openHandler"],disabled:["handleDisabledChange"],maxItems:["maxItemsHandler"],overlayPositioning:["overlayPositioningHandler"],value:["valueHandler"],messageOverrides:["onMessagesChange"],flipPlacements:["flipPlacementsHandler"],selectedItems:["selectedItemsHandler"],text:["textHandler"],effectiveLocale:["effectiveLocaleChange"]}}};di.style=":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]) .x-button{inline-size:1rem;block-size:1rem}:host([scale=m]) .x-button{inline-size:1.5rem;block-size:1.5rem}:host([scale=l]) .x-button{inline-size:2rem;block-size:2rem}.x-button{margin:0px;display:flex;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;align-content:center;align-items:center;justify-content:center;align-self:center;border-width:2px;background-color:transparent;color:var(--calcite-ui-text-3);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;border-radius:50%;border-color:transparent;background-color:var(--calcite-ui-foreground-2)}.x-button:active,.x-button:hover{color:var(--calcite-ui-text-1);background-color:var(--calcite-ui-foreground-3)}.x-button:active{border-style:solid;border-color:var(--calcite-ui-brand)}.x-button calcite-icon{color:inherit}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=s]) .x-button{margin-inline-end:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=m]) .x-button{margin-inline-end:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}:host([scale=l]) .x-button{margin-inline-end:1rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;margin-block-end:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-block:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;inline-size:1rem;cursor:pointer;align-items:center}.icon-end{flex:none}.floating-ui-container{--calcite-floating-ui-z-index:var(--calcite-app-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}.floating-ui-container--active{visibility:visible}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-inline-size:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}:host([hidden]){display:none}[hidden]{display:none}::slotted(calcite-combobox-item-group:not(:first-child)){padding-block-start:var(--calcite-combobox-item-spacing-unit-l)}";
|
12
12
|
/*!
|
13
13
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
14
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
15
|
* v1.6.1
|
16
16
|
*/
|
17
|
-
const
|
17
|
+
const pi="icon",mi="icon--active",ui="icon--indent",bi=class{constructor(i){t(this,i),this.calciteComboboxItemChange=e(this,"calciteComboboxItemChange",6),this.scale="m",this.itemClickHandler=i=>{i.preventDefault(),this.toggleSelected()},this.disabled=!1,this.selected=!1,this.active=!1,this.ancestors=void 0,this.guid=z(),this.icon=void 0,this.iconFlipRtl=!1,this.textLabel=void 0,this.value=void 0,this.filterDisabled=void 0}selectedWatchHandler(){this.calciteComboboxItemChange.emit()}connectedCallback(){this.ancestors=K(this.el),this.scale=c(this.el,"scale",this.scale),J(this),C(this)}disconnectedCallback(){Q(this),D(this)}componentDidRender(){I(this)}toggleSelected(){this.disabled||(this.selected=!this.selected)}renderIcon(t){return this.icon?i("calcite-icon",{class:{"icon--custom":!!this.icon,[mi]:this.icon&&this.selected,[ui]:!0},flipRtl:this.iconFlipRtl,icon:this.icon||t,key:"icon",scale:"l"===this.scale?"m":"s"}):null}renderSelectIndicator(t,e){return t?i("span",{class:{[pi]:!0,"icon--dot":!0,[ui]:!0}}):i("calcite-icon",{class:{[pi]:!0,[mi]:this.selected,[ui]:!0},flipRtl:this.iconFlipRtl,icon:e,key:"indicator",scale:"l"===this.scale?"m":"s"})}renderChildren(){return l(this.el)?i("ul",{key:"default-slot-container"},i("slot",null)):null}render(){const t="single"===c(this.el,"selection-mode","multiple"),e=t&&!this.disabled,n=this.disabled?"circle-disallowed":t?"dot":"check",o={label:!0,"label--selected":this.selected,"label--active":this.active,"label--single":t},a=X(this.el);return i(s,{"aria-hidden":"true"},i("div",{class:`container scale--${this.scale}`,style:{"--calcite-combobox-item-spacing-indent-multiplier":`${a}`}},i("li",{class:o,id:this.guid,onClick:this.itemClickHandler},this.renderSelectIndicator(e,n),this.renderIcon(n),i("span",{class:"title"},this.textLabel)),this.renderChildren()))}get el(){return n(this)}static get watchers(){return{selected:["selectedWatchHandler"]}}};bi.style='@charset "UTF-8";:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([hidden]){display:none}[hidden]{display:none}.scale--s{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent:0.5rem;--calcite-combobox-item-selector-icon-size:1rem}.scale--m{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent:0.75rem;--calcite-combobox-item-selector-icon-size:1rem}.scale--l{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.625rem;--calcite-combobox-item-spacing-indent:1rem;--calcite-combobox-item-selector-icon-size:1.5rem}.container{--calcite-combobox-item-indent-value:calc(\n var(--calcite-combobox-item-spacing-indent) * var(--calcite-combobox-item-spacing-indent-multiplier)\n )}:host(:focus){--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host,ul{margin:0px;display:flex;flex-direction:column;padding:0px}:host(:focus),ul:focus{outline:2px solid transparent;outline-offset:2px}.label{position:relative;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:100%;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-color:transparent;word-wrap:break-word;word-break:break-word;padding-block:var(--calcite-combobox-item-spacing-unit-s);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host([disabled]) .label{cursor:default}.label--selected{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.label--active{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.label:hover,.label:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.title{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon{display:inline-flex;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);color:var(--calcite-ui-border-1)}.icon--indent{padding-inline-start:var(--calcite-combobox-item-indent-value)}.icon--custom{margin-block-start:-1px;padding-inline-start:var(--calcite-combobox-item-spacing-unit-l);color:var(--calcite-ui-text-3)}.icon--active{color:var(--calcite-ui-text-1)}.icon--dot{display:flex;justify-content:center;min-inline-size:var(--calcite-combobox-item-selector-icon-size)}.icon--dot:before{text-align:start;content:"•"}.label--active .icon{opacity:1}.label--selected .icon{opacity:1;color:var(--calcite-ui-brand)}:host(:hover[disabled]) .icon{opacity:1}';
|
18
18
|
/*!
|
19
19
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
20
20
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
21
21
|
* v1.6.1
|
22
22
|
*/
|
23
|
-
const
|
23
|
+
const gi=class{constructor(i){t(this,i),this.calciteDropdownSelect=e(this,"calciteDropdownSelect",6),this.calciteDropdownBeforeClose=e(this,"calciteDropdownBeforeClose",6),this.calciteDropdownClose=e(this,"calciteDropdownClose",6),this.calciteDropdownBeforeOpen=e(this,"calciteDropdownBeforeOpen",6),this.calciteDropdownOpen=e(this,"calciteDropdownOpen",6),this.items=[],this.groups=[],this.mutationObserver=S("mutation",(()=>this.updateItems())),this.resizeObserver=S("resize",(i=>this.resizeObserverCallback(i))),this.openTransitionProp="opacity",this.guid=`calcite-dropdown-${z()}`,this.defaultAssignedElements=[],this.slotChangeHandler=i=>{this.defaultAssignedElements=i.target.assignedElements({flatten:!0}),this.updateItems()},this.setFilteredPlacements=()=>{const{el:i,flipPlacements:t}=this;this.filteredFlipPlacements=t?m(t,i):null},this.updateTriggers=i=>{this.triggers=i.target.assignedElements({flatten:!0}),this.reposition(!0)},this.updateItems=()=>{this.items=this.groups.map((i=>Array.from(null==i?void 0:i.querySelectorAll("calcite-dropdown-item")))).reduce(((i,t)=>[...i,...t]),[]),this.updateSelectedItems(),this.reposition(!0)},this.updateGroups=i=>{const t=i.target.assignedElements({flatten:!0}).filter((i=>null==i?void 0:i.matches("calcite-dropdown-group")));this.groups=t,this.updateItems()},this.resizeObserverCallback=i=>{i.forEach((i=>{const{target:t}=i;t===this.referenceEl?this.setDropdownWidth():t===this.scrollerEl&&this.setMaxScrollerHeight()}))},this.setDropdownWidth=()=>{const{referenceEl:i,scrollerEl:t}=this,e=null==i?void 0:i.clientWidth;e&&t&&(t.style.minWidth=`${e}px`)},this.setMaxScrollerHeight=()=>{const{scrollerEl:i}=this;if(!i)return;this.reposition(!0);const t=this.getMaxScrollerHeight();i.style.maxHeight=t>0?`${t}px`:"",this.reposition(!0)},this.setScrollerAndTransitionEl=i=>{this.resizeObserver.observe(i),this.scrollerEl=i,this.transitionEl=i},this.setReferenceEl=i=>{this.referenceEl=i,u(this,this.referenceEl,this.floatingEl),this.resizeObserver.observe(i)},this.setFloatingEl=i=>{this.floatingEl=i,u(this,this.referenceEl,this.floatingEl)},this.keyDownHandler=i=>{if(i.target!==this.referenceEl)return;const{defaultPrevented:t,key:e}=i;if(!t){if(this.open){if("Escape"===e)return this.closeCalciteDropdown(),void i.preventDefault();if(i.shiftKey&&"Tab"===e)return this.closeCalciteDropdown(),void i.preventDefault()}Z(e)?(this.openCalciteDropdown(),i.preventDefault()):"Escape"===e&&(this.closeCalciteDropdown(),i.preventDefault())}},this.focusOnFirstActiveOrFirstItem=()=>{this.getFocusableElement(this.items.find((i=>i.selected))||this.items[0])},this.toggleOpenEnd=()=>{this.focusOnFirstActiveOrFirstItem(),this.el.removeEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.openCalciteDropdown=()=>{this.open=!this.open,this.open&&this.el.addEventListener("calciteDropdownOpen",this.toggleOpenEnd)},this.open=!1,this.closeOnSelectDisabled=!1,this.disabled=!1,this.flipPlacements=void 0,this.maxItems=0,this.overlayPositioning="absolute",this.placement=p,this.scale="m",this.selectedItems=[],this.type="click",this.width=void 0}openHandler(i){if(!this.disabled)return i&&this.reposition(!0),void _(this);this.open=!1}handleDisabledChange(i){i||(this.open=!1)}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}maxItemsHandler(){this.setMaxScrollerHeight()}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}async setFocus(){await j(this),this.el.focus()}connectedCallback(){var i;null===(i=this.mutationObserver)||void 0===i||i.observe(this.el,{childList:!0,subtree:!0}),this.setFilteredPlacements(),this.reposition(!0),this.open&&(this.openHandler(this.open),_(this)),C(this)}componentWillLoad(){O(this)}componentDidLoad(){L(this),this.reposition(!0)}componentDidRender(){I(this)}disconnectedCallback(){var i,t;null===(i=this.mutationObserver)||void 0===i||i.disconnect(),null===(t=this.resizeObserver)||void 0===t||t.disconnect(),D(this),g(this,this.referenceEl,this.floatingEl)}render(){const{open:t,guid:e}=this;return i(s,null,i("div",{class:"calcite-trigger-container",id:`${e}-menubutton`,onClick:this.openCalciteDropdown,onKeyDown:this.keyDownHandler,ref:this.setReferenceEl},i("slot",{"aria-controls":`${e}-menu`,"aria-expanded":r(t),"aria-haspopup":"menu",name:"trigger",onSlotchange:this.updateTriggers})),i("div",{"aria-hidden":r(!t),class:"calcite-dropdown-wrapper",ref:this.setFloatingEl},i("div",{"aria-labelledby":`${e}-menubutton`,class:{"calcite-dropdown-content":!0,[v.animation]:!0,[v.animationActive]:t},id:`${e}-menu`,role:"menu",ref:this.setScrollerAndTransitionEl},i("slot",{onSlotchange:this.updateGroups}))))}async reposition(i=!1){const{floatingEl:t,referenceEl:e,placement:s,overlayPositioning:n,filteredFlipPlacements:o}=this;return b(this,{floatingEl:t,referenceEl:e,overlayPositioning:n,placement:s,flipPlacements:o,type:"menu"},i)}closeCalciteDropdownOnClick(i){!this.disabled&&a(i)&&this.open&&!i.composedPath().includes(this.el)&&this.closeCalciteDropdown(!1)}closeCalciteDropdownOnEvent(i){this.closeCalciteDropdown(),i.stopPropagation()}closeCalciteDropdownOnOpenEvent(i){i.composedPath().includes(this.el)||(this.open=!1)}pointerEnterHandler(){this.disabled||"hover"!==this.type||this.openCalciteDropdown()}pointerLeaveHandler(){this.disabled||"hover"!==this.type||this.closeCalciteDropdown()}calciteInternalDropdownItemKeyEvent(i){const{keyboardEvent:t}=i.detail,e=t.target;switch(t.key){case"Tab":this.items.indexOf(e)!==this.items.length-1||t.shiftKey?0===this.items.indexOf(e)&&t.shiftKey&&this.closeCalciteDropdown():this.closeCalciteDropdown();break;case"ArrowDown":h(this.items,e,"next");break;case"ArrowUp":h(this.items,e,"previous");break;case"Home":h(this.items,e,"first");break;case"End":h(this.items,e,"last")}i.stopPropagation()}handleItemSelect(i){this.updateSelectedItems(),i.stopPropagation(),this.calciteDropdownSelect.emit(),this.closeOnSelectDisabled&&"none"!==i.detail.requestedDropdownGroup.selectionMode||this.closeCalciteDropdown(),i.stopPropagation()}onBeforeOpen(){this.calciteDropdownBeforeOpen.emit()}onOpen(){this.calciteDropdownOpen.emit()}onBeforeClose(){this.calciteDropdownBeforeClose.emit()}onClose(){this.calciteDropdownClose.emit()}updateSelectedItems(){this.selectedItems=this.items.filter((i=>i.selected))}getMaxScrollerHeight(){const{maxItems:i,items:t}=this;let e,s=0,n=0;return this.groups.forEach((t=>{i>0&&s<i&&Array.from(t.children).forEach(((t,o)=>{0===o&&(isNaN(e)&&(e=t.offsetTop),n+=e),s<i&&(n+=t.offsetHeight,s+=1)}))})),t.length>i?n:0}closeCalciteDropdown(i=!0){this.open=!1,i&&d(this.triggers[0])}getFocusableElement(i){if(!i)return;const t=i.attributes.isLink?i.shadowRoot.querySelector("a"):i;d(t)}static get delegatesFocus(){return!0}get el(){return n(this)}static get watchers(){return{open:["openHandler"],disabled:["handleDisabledChange"],flipPlacements:["flipPlacementsHandler"],maxItems:["maxItemsHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"]}}};gi.style=":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-flex;flex:0 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host .calcite-dropdown-wrapper{--calcite-floating-ui-z-index:var(--calcite-app-z-index-dropdown);display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index);visibility:hidden}.calcite-dropdown-wrapper .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([open]) .calcite-dropdown-wrapper{visibility:visible}:host .calcite-dropdown-content{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.calcite-trigger-container{position:relative;display:flex;flex:1 1 auto;word-wrap:break-word;word-break:break-word}@media (forced-colors: active){:host([open]) .calcite-dropdown-wrapper{border:1px solid canvasText}}:host([width=s]){--calcite-dropdown-width:12rem}:host([width=m]){--calcite-dropdown-width:14rem}:host([width=l]){--calcite-dropdown-width:16rem}:host([hidden]){display:none}[hidden]{display:none}";
|
24
24
|
/*!
|
25
25
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
26
26
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
27
27
|
* v1.6.1
|
28
28
|
*/
|
29
|
-
const
|
29
|
+
const vi=class{constructor(i){t(this,i),this.calciteInternalDropdownItemChange=e(this,"calciteInternalDropdownItemChange",6),this.groupTitle=void 0,this.selectionMode="single",this.scale=void 0}componentWillLoad(){this.groupPosition=this.getGroupPosition()}render(){const t=this.scale||c(this.el,"scale","m"),e=this.groupTitle?i("span",{"aria-hidden":"true",class:"dropdown-title"},this.groupTitle):null,n=this.groupPosition>0?i("div",{class:"dropdown-separator",role:"separator"}):null;return i(s,{"aria-label":this.groupTitle,role:"group"},i("div",{class:{container:!0,"container--s":"s"===t,"container--m":"m"===t,"container--l":"l"===t},title:this.groupTitle},n,e,i("slot",null)))}updateActiveItemOnChange(i){this.requestedDropdownGroup=i.detail.requestedDropdownGroup,this.requestedDropdownItem=i.detail.requestedDropdownItem,this.calciteInternalDropdownItemChange.emit({requestedDropdownGroup:this.requestedDropdownGroup,requestedDropdownItem:this.requestedDropdownItem})}getGroupPosition(){return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"),this.el)}static get delegatesFocus(){return!0}get el(){return n(this)}};vi.style=":host{position:relative;display:block}.container{text-align:start}.container--s{font-size:var(--calcite-font-size--2);line-height:1rem}.container--s .dropdown-title{padding:0.5rem}.container--m{font-size:var(--calcite-font-size--1);line-height:1rem}.container--m .dropdown-title{padding:0.75rem}.container--l{font-size:var(--calcite-font-size-0);line-height:1.25rem}.container--l .dropdown-title{padding:1rem}.dropdown-title{margin-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-ui-text-2)}.dropdown-separator{display:block;block-size:1px;background-color:var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}";
|
30
30
|
/*!
|
31
31
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
32
32
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
33
33
|
* v1.6.1
|
34
34
|
*/
|
35
|
-
const xi=class{constructor(i){t(this,i),this.calciteDropdownItemSelect=e(this,"calciteDropdownItemSelect",6),this.calciteInternalDropdownItemSelect=e(this,"calciteInternalDropdownItemSelect",6),this.calciteInternalDropdownItemKeyEvent=e(this,"calciteInternalDropdownItemKeyEvent",6),this.calciteInternalDropdownCloseRequest=e(this,"calciteInternalDropdownCloseRequest",6),this.scale="m",this.selected=!1,this.iconFlipRtl=void 0,this.iconStart=void 0,this.iconEnd=void 0,this.href=void 0,this.label=void 0,this.rel=void 0,this.target=void 0}async setFocus(){var i;await j(this),null===(i=this.el)||void 0===i||i.focus()}componentWillLoad(){O(this),this.initialize()}componentDidLoad(){A(this)}connectedCallback(){this.initialize()}render(){const t=c(this.el,"scale",this.scale),{href:e,selectionMode:n,label:o,iconFlipRtl:a}=this,l=i("calcite-icon",{class:"dropdown-item-icon-start",flipRtl:"start"===a||"both"===a,icon:this.iconStart,scale:"l"===t?"m":"s"}),h=i("span",{class:"dropdown-item-content"},i("slot",null)),d=i("calcite-icon",{class:"dropdown-item-icon-end",flipRtl:"end"===a||"both"===a,icon:this.iconEnd,scale:"l"===t?"m":"s"}),p=this.iconStart&&this.iconEnd?[l,h,d]:this.iconStart?[l,h]:this.iconEnd?[h,d]:h,m=e?i("a",{"aria-label":o,class:"dropdown-link",href:e,rel:this.rel,tabIndex:-1,target:this.target,ref:i=>this.childLink=i},p):p,u=e?null:"single"===n?"menuitemradio":"multiple"===n?"menuitemcheckbox":"menuitem",b="none"!==n?r(this.selected):null;return i(s,{"aria-checked":b,"aria-label":e?"":o,role:u,tabindex:"0"},i("div",{class:{container:!0,"container--link":!!e,"container--s":"s"===t,"container--m":"m"===t,"container--l":"l"===t,"container--multi-selection":"multiple"===n,"container--single-selection":"single"===n,"container--none-selection":"none"===n}},"none"!==n?i("calcite-icon",{class:"dropdown-item-icon",icon:"multiple"===n?"check":"bullet-point",scale:"l"===t?"m":"s"}):null,m))}onClick(){this.emitRequestedItem()}keyDownHandler(i){switch(i.key){case" ":case"Enter":this.emitRequestedItem(),this.href&&this.childLink.click(),i.preventDefault();break;case"Escape":this.calciteInternalDropdownCloseRequest.emit(),i.preventDefault();break;case"Tab":this.calciteInternalDropdownItemKeyEvent.emit({keyboardEvent:i});break;case"ArrowUp":case"ArrowDown":case"Home":case"End":i.preventDefault(),this.calciteInternalDropdownItemKeyEvent.emit({keyboardEvent:i})}}updateActiveItemOnChange(i){i.composedPath().includes(this.parentDropdownGroupEl)&&(this.requestedDropdownGroup=i.detail.requestedDropdownGroup,this.requestedDropdownItem=i.detail.requestedDropdownItem,this.determineActiveItem()),i.stopPropagation()}initialize(){this.selectionMode=c(this.el,"selection-mode","single"),this.parentDropdownGroupEl=this.el.closest("calcite-dropdown-group"),"none"===this.selectionMode&&(this.selected=!1)}determineActiveItem(){switch(this.selectionMode){case"multiple":this.el===this.requestedDropdownItem&&(this.selected=!this.selected);break;case"single":this.el===this.requestedDropdownItem?this.selected=!0:this.requestedDropdownGroup===this.parentDropdownGroupEl&&(this.selected=!1);break;case"none":this.selected=!1}}emitRequestedItem(){this.calciteDropdownItemSelect.emit(),this.calciteInternalDropdownItemSelect.emit({requestedDropdownItem:this.el,requestedDropdownGroup:this.parentDropdownGroupEl})}get el(){return n(this)}};xi.style=".container--s{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}.container--m{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}.container--l{padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}.container--s.container--none-selection{padding-inline-start:0.25rem}.container--s.container--none-selection .dropdown-link{padding-inline-start:0px}.container--m.container--none-selection{padding-inline-start:0.5rem}.container--m.container--none-selection .dropdown-link{padding-inline-start:0px}.container--l.container--none-selection{padding-inline-start:0.75rem}.container--l.container--none-selection .dropdown-link{padding-inline-start:0px}:host{position:relative;display:flex;flex-grow:1;align-items:center}.container{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);text-align:start}.dropdown-item-content{flex:1 1 auto;padding-block:0.125rem;padding-inline-end:auto;padding-inline-start:0.25rem}:host,.container--link a{outline-color:transparent}:host(:focus){outline:2px solid transparent;outline-offset:2px;outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.container--link{padding:0px}.container--link a{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.container--s .dropdown-link{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}.container--m .dropdown-link{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}.container--l .dropdown-link{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}:host(:hover) .container,:host(:active) .container{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}:host(:hover) .container--link .dropdown-link,:host(:active) .container--link .dropdown-link{color:var(--calcite-ui-text-1)}:host(:focus) .container{color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}:host(:active) .container{background-color:var(--calcite-ui-foreground-3)}:host(:hover) .container:before,:host(:active) .container:before,:host(:focus) .container:before{opacity:1}:host([selected]) .container:not(.container--none-selection),:host([selected]) .container--link .dropdown-link{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}:host([selected]) .container:not(.container--none-selection):before,:host([selected]) .container--link .dropdown-link:before{opacity:1;color:var(--calcite-ui-brand)}:host([selected]) .container:not(.container--none-selection) calcite-icon,:host([selected]) .container--link .dropdown-link calcite-icon{color:var(--calcite-ui-brand)}.container--multi-selection:before,.container--none-selection:before{display:none}.container--s:before{inset-inline-start:0.5rem}.container--m:before{inset-inline-start:0.75rem}.container--l:before{inset-inline-start:1rem}.dropdown-item-icon{position:absolute;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(0.9)}.container--s .dropdown-item-icon{inset-inline-start:0.25rem}.container--m .dropdown-item-icon{inset-inline-start:0.5rem}.container--l .dropdown-item-icon{inset-inline-start:0.75rem}:host(:hover) .dropdown-item-icon{color:var(--calcite-ui-border-1);opacity:1}:host([selected]) .dropdown-item-icon{color:var(--calcite-ui-brand);opacity:1}.container--s .dropdown-item-icon-start{margin-inline-end:0.5rem;margin-inline-start:0.25rem}.container--s .dropdown-item-icon-end{margin-inline-start:0.5rem}.container--m .dropdown-item-icon-start{margin-inline-end:0.75rem;margin-inline-start:0.25rem}.container--m .dropdown-item-icon-end{margin-inline-start:0.75rem}.container--l .dropdown-item-icon-start{margin-inline-end:1rem;margin-inline-start:0.25rem}.container--l .dropdown-item-icon-end{margin-inline-start:1rem}:host([hidden]){display:none}[hidden]{display:none}";const wi=class{constructor(i){t(this,i),this.layerSelectionChange=e(this,"layerSelectionChange",7),this.appearance="transparent",this.enabledLayerIds=[],this.enabledTableIds=[],this.mapView=void 0,this.placeholderIcon="",this.selectedIds=[],this.scale="m",this.showTables=!0,this.type="select",this.ids=[],this.selectedName=""}async mapViewWatchHandler(){await this._setLayers();const i=Object.keys(ni.layerNameHash).length>0,t=Object.keys(ni.tableNameHash).length>0&&this.showTables;(i||t)&&this._setSelectedLayer(this.ids[0],i?"layer":"table")}async componentWillLoad(){await this._setLayers(),(this.ids.length>0||1===this.selectedIds.length)&&this.layerSelectionChange.emit(1===this.selectedIds.length?[this.selectedIds[0]]:[this.ids[0]])}render(){return i(s,null,i("div",{class:"map-layer-picker-container"},i("div",{class:"map-layer-picker"},"combobox"===this.type?this._getCombobox():"select"===this.type?this._getSelect():this._getDropdown())))}async componentDidLoad(){if(this.ids.length>0||1===this.selectedIds.length){const i=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];"select"===this.type?this._layerElement.value=i:"dropdown"===this.type&&(this.selectedName=Object.keys(ni.layerNameHash).indexOf(i)>-1?ni.layerNameHash[i]:Object.keys(ni.tableNameHash).indexOf(i)>-1?ni.tableNameHash[i]:"")}}_getSelect(){return i("calcite-select",{label:"",onCalciteSelectChange:()=>this._layerSelectionChange(),ref:i=>{this._layerElement=i},scale:this.scale},this._getMapLayerOptions())}_getCombobox(){return i("calcite-combobox",{clearDisabled:!0,label:"",onCalciteComboboxChange:()=>this._layerSelectionChange(),"placeholder-icon":this.placeholderIcon,ref:i=>{this._layerElement=i},scale:this.scale,"selection-mode":"single"},this._getMapLayerOptions())}_getDropdown(){return i("calcite-dropdown",{class:"layer-picker-dropdown"},i("calcite-action",{slot:"trigger",text:""},i("calcite-button",{alignment:"icon-end-space-between",appearance:this.appearance,class:"max-width-350",iconEnd:"chevron-down",iconStart:"layers",kind:"neutral",width:"full"},i("div",null,this.selectedName))),i("calcite-dropdown-group",{"selection-mode":"single"},this._getMapLayerOptions()))}_getMapLayerOptions(){return this.ids.reduce(((i,t)=>(this._validLayer(t)?i.push(this._getItem(t,"layer")):this._validTable(t)&&i.push(this._getItem(t,"table")),i)),[])}_getItem(t,e){const s="layer"===e?ni.layerNameHash[t]:ni.tableNameHash[t];return"combobox"===this.type?i("calcite-combobox-item",{textLabel:s,value:t}):"select"===this.type?i("calcite-option",{label:s,value:t}):i("calcite-dropdown-item",{onClick:()=>{this._setSelectedLayer(t,e)}},s)}_setSelectedLayer(i,t){this.selectedName="layer"===t?ni.layerNameHash[i]:ni.tableNameHash[i],this.selectedIds=[i],this.layerSelectionChange.emit(this.selectedIds)}async _setLayers(){if(this.mapView){const i=await ii(this.mapView),t=this.showTables?await ti(this.mapView):[];this.ids=[...i.filter((i=>{var t;return!((null===(t=this.enabledLayerIds)||void 0===t?void 0:t.length)>0)||this.enabledLayerIds.indexOf(i)>-1})),...t.filter((i=>{var t;return!((null===(t=this.enabledTableIds)||void 0===t?void 0:t.length)>0)||this.enabledTableIds.indexOf(i)>-1}))],await this._initStateHash()}}async _initStateHash(){this.mapView&&(ni.layerNameHash=await ei(this.mapView),ni.tableNameHash=this.showTables?await si(this.mapView):{})}_validLayer(i){const t=ni.layerNameHash[i];return t&&ni.managedLayers.indexOf(t)<0&&(this.enabledLayerIds.length>0?this.enabledLayerIds.indexOf(i)>-1:t)}_validTable(i){const t=ni.tableNameHash[i],e=t&&this.showTables;return e?ni.managedTables.indexOf(t)<0&&(!(this.enabledTableIds.length>0)||this.enabledTableIds.indexOf(i)>-1):e}_layerSelectionChange(){const i=Array.isArray(this._layerElement.value)?this._layerElement.value:[this._layerElement.value];JSON.stringify(i)!==JSON.stringify([""])&&(this.selectedIds=i,this.layerSelectionChange.emit(this.selectedIds))}get el(){return n(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};wi.style=":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}";export{pi as calcite_combobox,gi as calcite_combobox_item,vi as calcite_dropdown,fi as calcite_dropdown_group,xi as calcite_dropdown_item,wi as map_layer_picker}
|
35
|
+
const fi=class{constructor(i){t(this,i),this.calciteDropdownItemSelect=e(this,"calciteDropdownItemSelect",6),this.calciteInternalDropdownItemSelect=e(this,"calciteInternalDropdownItemSelect",6),this.calciteInternalDropdownItemKeyEvent=e(this,"calciteInternalDropdownItemKeyEvent",6),this.calciteInternalDropdownCloseRequest=e(this,"calciteInternalDropdownCloseRequest",6),this.scale="m",this.selected=!1,this.iconFlipRtl=void 0,this.iconStart=void 0,this.iconEnd=void 0,this.href=void 0,this.label=void 0,this.rel=void 0,this.target=void 0}async setFocus(){var i;await j(this),null===(i=this.el)||void 0===i||i.focus()}componentWillLoad(){O(this),this.initialize()}componentDidLoad(){L(this)}connectedCallback(){this.initialize()}render(){const t=c(this.el,"scale",this.scale),{href:e,selectionMode:n,label:o,iconFlipRtl:a}=this,l=i("calcite-icon",{class:"dropdown-item-icon-start",flipRtl:"start"===a||"both"===a,icon:this.iconStart,scale:"l"===t?"m":"s"}),h=i("span",{class:"dropdown-item-content"},i("slot",null)),d=i("calcite-icon",{class:"dropdown-item-icon-end",flipRtl:"end"===a||"both"===a,icon:this.iconEnd,scale:"l"===t?"m":"s"}),p=this.iconStart&&this.iconEnd?[l,h,d]:this.iconStart?[l,h]:this.iconEnd?[h,d]:h,m=e?i("a",{"aria-label":o,class:"dropdown-link",href:e,rel:this.rel,tabIndex:-1,target:this.target,ref:i=>this.childLink=i},p):p,u=e?null:"single"===n?"menuitemradio":"multiple"===n?"menuitemcheckbox":"menuitem",b="none"!==n?r(this.selected):null;return i(s,{"aria-checked":b,"aria-label":e?"":o,role:u,tabindex:"0"},i("div",{class:{container:!0,"container--link":!!e,"container--s":"s"===t,"container--m":"m"===t,"container--l":"l"===t,"container--multi-selection":"multiple"===n,"container--single-selection":"single"===n,"container--none-selection":"none"===n}},"none"!==n?i("calcite-icon",{class:"dropdown-item-icon",icon:"multiple"===n?"check":"bullet-point",scale:"l"===t?"m":"s"}):null,m))}onClick(){this.emitRequestedItem()}keyDownHandler(i){switch(i.key){case" ":case"Enter":this.emitRequestedItem(),this.href&&this.childLink.click(),i.preventDefault();break;case"Escape":this.calciteInternalDropdownCloseRequest.emit(),i.preventDefault();break;case"Tab":this.calciteInternalDropdownItemKeyEvent.emit({keyboardEvent:i});break;case"ArrowUp":case"ArrowDown":case"Home":case"End":i.preventDefault(),this.calciteInternalDropdownItemKeyEvent.emit({keyboardEvent:i})}}updateActiveItemOnChange(i){i.composedPath().includes(this.parentDropdownGroupEl)&&(this.requestedDropdownGroup=i.detail.requestedDropdownGroup,this.requestedDropdownItem=i.detail.requestedDropdownItem,this.determineActiveItem()),i.stopPropagation()}initialize(){this.selectionMode=c(this.el,"selection-mode","single"),this.parentDropdownGroupEl=this.el.closest("calcite-dropdown-group"),"none"===this.selectionMode&&(this.selected=!1)}determineActiveItem(){switch(this.selectionMode){case"multiple":this.el===this.requestedDropdownItem&&(this.selected=!this.selected);break;case"single":this.el===this.requestedDropdownItem?this.selected=!0:this.requestedDropdownGroup===this.parentDropdownGroupEl&&(this.selected=!1);break;case"none":this.selected=!1}}emitRequestedItem(){this.calciteDropdownItemSelect.emit(),this.calciteInternalDropdownItemSelect.emit({requestedDropdownItem:this.el,requestedDropdownGroup:this.parentDropdownGroupEl})}get el(){return n(this)}};fi.style=".container--s{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}.container--m{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}.container--l{padding-block:0.625rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}.container--s.container--none-selection{padding-inline-start:0.25rem}.container--s.container--none-selection .dropdown-link{padding-inline-start:0px}.container--m.container--none-selection{padding-inline-start:0.5rem}.container--m.container--none-selection .dropdown-link{padding-inline-start:0px}.container--l.container--none-selection{padding-inline-start:0.75rem}.container--l.container--none-selection .dropdown-link{padding-inline-start:0px}:host{position:relative;display:flex;flex-grow:1;align-items:center}.container{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);text-align:start}.dropdown-item-content{flex:1 1 auto;padding-block:0.125rem;padding-inline-end:auto;padding-inline-start:0.25rem}:host,.container--link a{outline-color:transparent}:host(:focus){outline:2px solid transparent;outline-offset:2px;outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.container--link{padding:0px}.container--link a{position:relative;display:flex;flex-grow:1;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1)}.container--s .dropdown-link{padding-block:0.25rem;font-size:var(--calcite-font-size--2);line-height:1rem;padding-inline-end:0.5rem;padding-inline-start:1.5rem}.container--m .dropdown-link{padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1rem;padding-inline-end:0.75rem;padding-inline-start:2rem}.container--l .dropdown-link{padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.25rem;padding-inline-end:1rem;padding-inline-start:2.5rem}:host(:hover) .container,:host(:active) .container{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}:host(:hover) .container--link .dropdown-link,:host(:active) .container--link .dropdown-link{color:var(--calcite-ui-text-1)}:host(:focus) .container{color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none}:host(:active) .container{background-color:var(--calcite-ui-foreground-3)}:host(:hover) .container:before,:host(:active) .container:before,:host(:focus) .container:before{opacity:1}:host([selected]) .container:not(.container--none-selection),:host([selected]) .container--link .dropdown-link{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}:host([selected]) .container:not(.container--none-selection):before,:host([selected]) .container--link .dropdown-link:before{opacity:1;color:var(--calcite-ui-brand)}:host([selected]) .container:not(.container--none-selection) calcite-icon,:host([selected]) .container--link .dropdown-link calcite-icon{color:var(--calcite-ui-brand)}.container--multi-selection:before,.container--none-selection:before{display:none}.container--s:before{inset-inline-start:0.5rem}.container--m:before{inset-inline-start:0.75rem}.container--l:before{inset-inline-start:1rem}.dropdown-item-icon{position:absolute;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:scale(0.9)}.container--s .dropdown-item-icon{inset-inline-start:0.25rem}.container--m .dropdown-item-icon{inset-inline-start:0.5rem}.container--l .dropdown-item-icon{inset-inline-start:0.75rem}:host(:hover) .dropdown-item-icon{color:var(--calcite-ui-border-1);opacity:1}:host([selected]) .dropdown-item-icon{color:var(--calcite-ui-brand);opacity:1}.container--s .dropdown-item-icon-start{margin-inline-end:0.5rem;margin-inline-start:0.25rem}.container--s .dropdown-item-icon-end{margin-inline-start:0.5rem}.container--m .dropdown-item-icon-start{margin-inline-end:0.75rem;margin-inline-start:0.25rem}.container--m .dropdown-item-icon-end{margin-inline-start:0.75rem}.container--l .dropdown-item-icon-start{margin-inline-end:1rem;margin-inline-start:0.25rem}.container--l .dropdown-item-icon-end{margin-inline-start:1rem}:host([hidden]){display:none}[hidden]{display:none}";const xi=class{constructor(i){t(this,i),this.noLayersFound=e(this,"noLayersFound",7),this.layerSelectionChange=e(this,"layerSelectionChange",7),this.appearance="transparent",this.enabledLayerIds=[],this.enabledTableIds=[],this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.placeholderIcon="",this.selectedIds=[],this.scale="m",this.showTables=!0,this.type="select",this._hasValidLayers=!0,this.ids=[],this.selectedName="",this._translations=void 0}async mapViewWatchHandler(){await this._setLayers(),this.ids.length>0?(this._hasValidLayers=!0,this._setSelectedLayer(this.ids[0])):(this._hasValidLayers=!1,this.noLayersFound.emit())}async componentWillLoad(){await this._getTranslations(),await this._setLayers(),(this.ids.length>0||1===this.selectedIds.length)&&this.layerSelectionChange.emit(1===this.selectedIds.length?[this.selectedIds[0]]:[this.ids[0]])}render(){return i(s,null,i("div",{class:"map-layer-picker-container"},i("div",{class:"map-layer-picker"},this._hasValidLayers?"combobox"===this.type?this._getCombobox():"select"===this.type?this._getSelect():this._getDropdown():this._getInvalidPlaceholder())))}async componentDidLoad(){if(this.ids.length>0||1===this.selectedIds.length){const i=1===this.selectedIds.length?this.selectedIds[0]:this.ids[0];"select"===this.type?this._layerElement.value=i:"dropdown"===this.type&&(this.selectedName=Object.keys(this._layerNameHash).indexOf(i)>-1?this._layerNameHash[i].name:Object.keys(this._tableNameHash).indexOf(i)>-1?this._tableNameHash[i].name:"")}}_getInvalidPlaceholder(){return i("div",null,i("calcite-notice",{class:"height-100",icon:"exclamation-mark-triangle",id:"no-valid-layers",kind:"danger",open:!0},i("div",{slot:"message"},this._translations.noLayersFound)),i("calcite-tooltip",{label:this._translations.enableEditUpdate,placement:"bottom","reference-element":"no-valid-layers"},i("span",null,this._translations.enableEditUpdate)))}_getSelect(){return i("calcite-select",{label:"",onCalciteSelectChange:()=>this._layerSelectionChange(),ref:i=>{this._layerElement=i},scale:this.scale},this._getMapLayerOptions())}_getCombobox(){return i("calcite-combobox",{clearDisabled:!0,label:"",onCalciteComboboxChange:()=>this._layerSelectionChange(),"placeholder-icon":this.placeholderIcon,ref:i=>{this._layerElement=i},scale:this.scale,"selection-mode":"single"},this._getMapLayerOptions())}_getDropdown(){return i("calcite-dropdown",{class:"layer-picker-dropdown"},i("calcite-action",{slot:"trigger",text:""},i("calcite-button",{alignment:"icon-end-space-between",appearance:this.appearance,class:"max-width-350",iconEnd:"chevron-down",iconStart:"layers",kind:"neutral",width:"full"},i("div",null,this.selectedName))),i("calcite-dropdown-group",{"selection-mode":"single"},this._getMapLayerOptions()))}_getMapLayerOptions(){return this.ids.reduce(((i,t)=>(this._validLayer(t)?i.push(this._getItem(t,"layer")):this._validTable(t)&&i.push(this._getItem(t,"table")),i)),[])}_getItem(t,e){const s="layer"===e?this._layerNameHash[t]:this._tableNameHash[t],n=!!this.onlyShowUpdatableLayers&&!s.supportsUpdate,o=s.name;return"combobox"===this.type?i("calcite-combobox-item",{disabled:n,textLabel:o,value:t}):"select"===this.type?i("calcite-option",{disabled:n,label:o,value:t}):i("calcite-dropdown-item",{disabled:n,onClick:n?void 0:()=>{this._setSelectedLayer(t)}},o)}_setSelectedLayer(i){const t=Object.keys(this._layerNameHash).indexOf(i)>-1?this._layerNameHash[i]:Object.keys(this._tableNameHash).indexOf(i)>-1?this._tableNameHash[i]:void 0;this.selectedName=null==t?void 0:t.name,this.selectedIds=[i],this.layerSelectionChange.emit(this.selectedIds)}async _setLayers(){if(this.mapView){await this._initLayerTableHash();const i=this.onlyShowUpdatableLayers?this._getEditableIds(this._layerNameHash):Object.keys(this._layerNameHash),t=this.showTables?this.onlyShowUpdatableLayers?this._getEditableIds(this._tableNameHash):Object.keys(this._tableNameHash):[];this.ids=[...i.filter((i=>{var t;return!((null===(t=this.enabledLayerIds)||void 0===t?void 0:t.length)>0)||this.enabledLayerIds.indexOf(i)>-1})),...t.filter((i=>{var t;return!((null===(t=this.enabledTableIds)||void 0===t?void 0:t.length)>0)||this.enabledTableIds.indexOf(i)>-1}))]}}_getEditableIds(i){return Object.keys(i).reduce(((t,e)=>(i[e].supportsUpdate&&t.push(e),t)),[])}async _initLayerTableHash(){this._layerNameHash=await ti(this.mapView,this.onlyShowUpdatableLayers),this._tableNameHash=this.showTables?await ei(this.mapView,this.onlyShowUpdatableLayers):{}}_validLayer(i){var t;const e=null===(t=this._layerNameHash[i])||void 0===t?void 0:t.name;return e&&si.managedLayers.indexOf(e)<0&&(!(this.enabledLayerIds.length>0)||this.enabledLayerIds.indexOf(i)>-1)}_validTable(i){var t;const e=null===(t=this._tableNameHash[i])||void 0===t?void 0:t.name,s=e&&this.showTables;return s?si.managedTables.indexOf(e)<0&&(!(this.enabledTableIds.length>0)||this.enabledTableIds.indexOf(i)>-1):s}_layerSelectionChange(){const i=Array.isArray(this._layerElement.value)?this._layerElement.value:[this._layerElement.value];JSON.stringify(i)!==JSON.stringify([""])&&(this.selectedIds=i,this.layerSelectionChange.emit(this.selectedIds))}async _getTranslations(){const i=await ii(this.el);this._translations=i[0]}get el(){return n(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};xi.style=":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}";export{di as calcite_combobox,bi as calcite_combobox_item,gi as calcite_dropdown,vi as calcite_dropdown_group,fi as calcite_dropdown_item,xi as map_layer_picker}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import{r as i,c as t,h as e,H as n,g as s}from"./p-33613993.js";import{r as o,t as a,v as c,g as l,q as r,i as h,A as d}from"./p-e4f9b782.js";import{c as p,d as u}from"./p-bfc78840.js";import{a as m,s as g,c as f}from"./p-d74e95e5.js";import{u as v,c as b,d as k,s as x}from"./p-79cc0531.js";import{c as w,u as y,d as z}from"./p-ad75b9bb.js";import{c as C,d as E}from"./p-11550b3c.js";import{c as j}from"./p-588bc0c0.js";import{i as H}from"./p-43ba7a04.js";import{K as L}from"./p-c6e55b32.js";import{c as R,b as T,a as S,r as D,F as O}from"./p-2ee21e9d.js";import{g as I}from"./p-8b448a5b.js";import{o as A}from"./p-a097edf0.js";import{F}from"./p-2723beaa.js";import"./p-e3525c00.js";import"./p-a82f35c9.js";
|
7
|
+
/*!
|
8
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
+
* v1.6.1
|
11
|
+
*/const M=class{constructor(e){i(this,e),this.calciteChipClose=t(this,"calciteChipClose",6),this.calciteChipSelect=t(this,"calciteChipSelect",6),this.calciteInternalChipKeyEvent=t(this,"calciteInternalChipKeyEvent",6),this.mutationObserver=j("mutation",(()=>this.updateHasText())),this.close=()=>{this.calciteChipClose.emit(),this.selected=!1,this.closed=!0},this.closeButtonKeyDownHandler=i=>{H(i.key)&&(i.preventDefault(),this.close())},this.handleSlotImageChange=i=>{this.hasImage=o(i)},this.handleEmittingEvent=()=>{this.interactive&&this.calciteChipSelect.emit()},this.disabled=!1,this.appearance="solid",this.kind="neutral",this.closable=!1,this.icon=void 0,this.iconFlipRtl=!1,this.scale="m",this.label=void 0,this.value=void 0,this.closed=!1,this.selectionMode="none",this.selected=!1,this.messageOverrides=void 0,this.messages=void 0,this.interactive=!1,this.defaultMessages=void 0,this.effectiveLocale=void 0,this.hasText=!1,this.hasImage=!1}onMessagesChange(){}effectiveLocaleChange(){v(this,this.effectiveLocale)}connectedCallback(){var i;p(this),w(this),C(this),b(this),null===(i=this.mutationObserver)||void 0===i||i.observe(this.el,{childList:!0,subtree:!0})}componentDidLoad(){m(this)}componentDidRender(){y(this)}disconnectedCallback(){var i;u(this),z(this),E(this),k(this),null===(i=this.mutationObserver)||void 0===i||i.disconnect()}async componentWillLoad(){g(this),await x(this),this.updateHasText()}keyDownHandler(i){if(i.target===this.el)switch(i.key){case" ":case"Enter":this.handleEmittingEvent(),i.preventDefault();break;case"ArrowRight":case"ArrowLeft":case"Home":case"End":this.calciteInternalChipKeyEvent.emit(i),i.preventDefault()}}clickHandler(){!this.interactive&&this.closable&&this.closeButtonEl.focus()}async setFocus(){var i,t;await f(this),!this.disabled&&this.interactive?null===(i=this.containerEl)||void 0===i||i.focus():!this.disabled&&this.closable&&(null===(t=this.closeButtonEl)||void 0===t||t.focus())}updateHasText(){this.hasText=this.el.textContent.trim().length>0}renderChipImage(){return e("div",{class:"image-container"},e("slot",{name:"image",onSlotchange:this.handleSlotImageChange}))}renderSelectionIcon(){return e("div",{class:{"select-icon":!0,"select-icon--active":"multiple"===this.selectionMode||this.selected}},e("calcite-icon",{icon:"multiple"===this.selectionMode&&this.selected?"check-circle-f":"multiple"===this.selectionMode?"circle":this.selected?"circle-f":void 0,scale:"l"===this.scale?"m":"s"}))}renderCloseButton(){return e("button",{"aria-label":this.messages.dismissLabel,class:"close",onClick:this.close,onKeyDown:this.closeButtonKeyDownHandler,tabIndex:this.disabled?-1:0,ref:i=>this.closeButtonEl=i},e("calcite-icon",{icon:"x",scale:"l"===this.scale?"m":"s"}))}renderIcon(){return e("calcite-icon",{class:"chip-icon",flipRtl:this.iconFlipRtl,icon:this.icon,scale:"l"===this.scale?"m":"s"})}render(){const i=this.disabled||!this.disabled&&!this.interactive,t="multiple"===this.selectionMode&&this.interactive?"checkbox":"none"!==this.selectionMode&&this.interactive?"radio":this.interactive?"button":void 0;return e(n,null,e("div",{"aria-checked":"none"!==this.selectionMode&&this.interactive?a(this.selected):void 0,"aria-disabled":i?a(this.disabled):void 0,"aria-label":this.label,class:{container:!0,"text--slotted":this.hasText,"image--slotted":this.hasImage,selectable:"none"!==this.selectionMode,multiple:"multiple"===this.selectionMode,closable:this.closable,"non-interactive":!this.interactive,"is-circle":!(this.closable||this.hasText||this.icon&&this.hasImage||"none"!==this.selectionMode&&(!this.selectionMode||"multiple"===this.selectionMode||this.selected))},onClick:this.handleEmittingEvent,role:t,tabIndex:i?-1:0,ref:i=>this.containerEl=i},"none"!==this.selectionMode&&this.renderSelectionIcon(),this.renderChipImage(),this.icon&&this.renderIcon(),e("span",{class:"title"},e("slot",null)),this.closable&&this.renderCloseButton()))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};M.style=":host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([scale=s]){block-size:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-s-internal:0.25rem;--calcite-chip-spacing-l-internal:0.5rem}:host([scale=s]) .close,:host([scale=s]) .select-icon--active{block-size:1rem;inline-size:1rem}:host([scale=s]) .image-container{block-size:1.25rem;inline-size:1.25rem}:host([scale=s]) .container.is-circle{block-size:1.5rem;inline-size:1.5rem}:host([scale=m]){block-size:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-s-internal:0.375rem;--calcite-chip-spacing-l-internal:0.5rem}:host([scale=m]) .close,:host([scale=m]) .image-container,:host([scale=m]) .select-icon--active{block-size:1.5rem;inline-size:1.5rem}:host([scale=m]) .container.is-circle{block-size:2rem;inline-size:2rem}:host([scale=l]){block-size:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-s-internal:0.5rem;--calcite-chip-spacing-l-internal:0.75rem}:host([scale=l]) .image-container,:host([scale=l]) .close,:host([scale=l]) .select-icon--active{block-size:2rem;inline-size:2rem}:host([scale=l]) .container.is-circle{block-size:2.75rem;inline-size:2.75rem}:host{display:inline-flex;cursor:default;border-radius:9999px}.container{box-sizing:border-box;display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center;justify-content:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);outline-color:transparent}.container:not(.is-circle){padding-inline:var(--calcite-chip-spacing-s-internal)}.container.selectable{cursor:pointer}.container:not(.non-interactive):focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n 2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}:host([scale=s]) .container.image--slotted{padding-inline-start:calc(0.125rem / 2)}:host([scale=s]) .container.is-circle{padding-inline:0}.container.text--slotted .title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding-inline:var(--calcite-chip-spacing-s-internal)}.container:not(.text--slotted) .title{display:none}.container:not(.image--slotted) .image-container{display:none}.container.closable{padding-inline-end:calc(var(--calcite-chip-spacing-l-internal) / 2)}.container:not(.is-circle).image--slotted{padding-inline-start:calc(var(--calcite-chip-spacing-l-internal) / 2)}.container:not(.is-circle).image--slotted .image-container{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle).image--slotted .image-container~.chip-icon{margin-inline-start:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle).selectable:not(.text--slotted) .chip-icon{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.selectable):not(.text--slotted) .chip-icon{margin-inline-start:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.text--slotted) .chip-icon{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.text-slotted).image--slotted .image-container{margin-inline-end:var(--calcite-chip-spacing-s-internal)}.container:not(.is-circle):not(.closable):not(.text--slotted).image--slotted.selectable .image-container{margin-inline-end:0}.container:not(.is-circle):not(.closable):not(.text--slotted).image--slotted.selectable .image-container~.chip-icon{margin-inline-start:calc(var(--calcite-chip-spacing-s-internal) * 2)}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline:var(--calcite-chip-spacing-s-internal)}.image-container{display:inline-flex;overflow:hidden;align-items:center;justify-content:center;pointer-events:none}.close{margin:0px;cursor:pointer;align-items:center;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-appearance:none;display:flex;border-radius:50%;align-content:center;justify-content:center;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}.close:hover{background-color:var(--calcite-chip-transparent-hover)}.close:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}.close:active{background-color:var(--calcite-chip-transparent-press)}.close calcite-icon{color:inherit}.select-icon{align-self:center;justify-content:center;align-items:center;display:flex;inset-block-start:-1px;position:relative;visibility:hidden;inline-size:0;opacity:0;transition:opacity 0.15s ease-in-out, inline-size 0.15s ease-in-out}.select-icon.select-icon--active{visibility:visible;opacity:0.5}.container:not(.is-circle).image--slotted .select-icon.select-icon--active{margin-inline-end:var(--calcite-chip-spacing-s-internal)}:host([selected]) .select-icon{opacity:1}.container:hover .select-icon--active{opacity:1}slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}:host([kind=neutral]){background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host([kind=neutral]) .container{border-color:transparent}:host([kind=neutral]) .close{color:var(--calcite-ui-text-3)}:host([kind=neutral]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([kind=inverse]){background-color:var(--calcite-ui-inverse);color:var(--calcite-ui-text-inverse)}:host([kind=inverse]) .container{border-color:transparent}:host([kind=inverse]) .close{color:var(--calcite-ui-text-inverse)}:host([kind=inverse]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-inverse))}:host([kind=brand]){background-color:var(--calcite-ui-brand);color:var(--calcite-ui-text-inverse)}:host([kind=brand]) .container{border-color:transparent}:host([kind=brand]) .close{color:var(--calcite-ui-text-inverse)}:host([kind=brand]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-inverse))}:host([appearance=outline-fill]),:host([appearance=outline]){background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1)}:host([appearance=outline-fill]) .close,:host([appearance=outline]) .close{color:var(--calcite-ui-text-3)}:host([appearance=outline-fill]) .chip-icon,:host([appearance=outline]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([appearance=outline-fill]){background-color:var(--calcite-ui-foreground-1)}:host([appearance=outline]){background-color:transparent}:host([kind=neutral][appearance=outline-fill]) .container,:host([kind=neutral][appearance=outline]) .container{border-color:var(--calcite-ui-border-1)}:host([kind=inverse][appearance=outline-fill]) .container,:host([kind=inverse][appearance=outline]) .container{border-color:var(--calcite-ui-border-inverse)}:host([kind=brand][appearance=outline-fill]) .container,:host([kind=brand][appearance=outline]) .container{border-color:var(--calcite-ui-brand)}:host([kind=brand][appearance=solid]) button,:host([kind=inverse][appearance=solid]) button{outline-color:var(--calcite-ui-text-inverse)}:host([closed]){display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([hidden]){display:none}[hidden]{display:none}";
|
12
|
+
/*!
|
13
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
|
+
* v1.6.1
|
16
|
+
*/
|
17
|
+
const q="actions-end",B=class{constructor(e){i(this,e),this.calciteNoticeClose=t(this,"calciteNoticeClose",6),this.calciteNoticeOpen=t(this,"calciteNoticeOpen",6),this.close=()=>{this.open=!1,this.calciteNoticeClose.emit()},this.open=!1,this.kind="brand",this.closable=!1,this.icon=void 0,this.iconFlipRtl=!1,this.scale="m",this.width="auto",this.messages=void 0,this.messageOverrides=void 0,this.effectiveLocale=void 0,this.defaultMessages=void 0}onMessagesChange(){}updateRequestedIcon(){this.requestedIcon=c(L,this.icon,this.kind)}connectedCallback(){p(this),C(this),b(this)}disconnectedCallback(){u(this),E(this),k(this)}async componentWillLoad(){g(this),this.requestedIcon=c(L,this.icon,this.kind),await x(this)}componentDidLoad(){m(this)}render(){const{el:i}=this,t=e("button",{"aria-label":this.messages.close,class:"notice-close",onClick:this.close,ref:i=>this.closeButton=i},e("calcite-icon",{icon:"x",scale:"l"===this.scale?"m":"s"})),n=l(i,q);return e("div",{class:"container"},this.requestedIcon?e("div",{class:"notice-icon"},e("calcite-icon",{flipRtl:this.iconFlipRtl,icon:this.requestedIcon,scale:"l"===this.scale?"m":"s"})):null,e("div",{class:"notice-content"},e("slot",{name:"title"}),e("slot",{name:"message"}),e("slot",{name:"link"})),n?e("div",{class:"actions-end"},e("slot",{name:q})):null,this.closable?t:null)}async setFocus(){await f(this);const i=this.el.querySelector("calcite-link");if(this.closeButton||i)return i?i.setFocus():void(this.closeButton&&this.closeButton.focus())}effectiveLocaleChange(){v(this,this.effectiveLocale)}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],icon:["updateRequestedIcon"],kind:["updateRequestedIcon"],effectiveLocale:["effectiveLocaleChange"]}}};B.style=":host([scale=s]){--calcite-notice-spacing-token-small:0.5rem;--calcite-notice-spacing-token-large:0.75rem}:host([scale=s]) .container slot[name=title]::slotted(*),:host([scale=s]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=s]) .container slot[name=message]::slotted(*),:host([scale=s]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--2);line-height:1.375}:host([scale=s]) .notice-close{padding:0.5rem}:host([scale=m]){--calcite-notice-spacing-token-small:0.75rem;--calcite-notice-spacing-token-large:1rem}:host([scale=m]) .container slot[name=title]::slotted(*),:host([scale=m]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=m]) .container slot[name=message]::slotted(*),:host([scale=m]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=l]){--calcite-notice-spacing-token-small:1rem;--calcite-notice-spacing-token-large:1.25rem}:host([scale=l]) .container slot[name=title]::slotted(*),:host([scale=l]) .container *::slotted([slot=title]){margin-block:0.125rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host([scale=l]) .container slot[name=message]::slotted(*),:host([scale=l]) .container *::slotted([slot=message]){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) ::slotted(calcite-link){margin-block:0.125rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([width=auto]){--calcite-notice-width:auto}:host([width=half]){--calcite-notice-width:50%}:host([width=full]){--calcite-notice-width:100%}:host{margin-inline:auto;display:none;max-inline-size:100%;align-items:center;inline-size:var(--calcite-notice-width)}.container{pointer-events:none;margin-block:0px;box-sizing:border-box;display:none;inline-size:100%;background-color:var(--calcite-ui-foreground-1);opacity:0;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;max-block-size:0;text-align:start;border-inline-start:0px solid;box-shadow:0 0 0 0 transparent}.notice-close{outline-color:transparent}.notice-close:focus{outline:2px solid var(--calcite-ui-focus-color, var(--calcite-ui-brand));outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-ui-focus-offset-invert),\n 1\n )\n )\n )}:host{display:flex}:host([open]) .container{pointer-events:auto;display:flex;max-block-size:100%;align-items:center;border-width:2px;opacity:1;--tw-shadow:0 4px 8px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);--tw-shadow-colored:0 4px 8px -1px var(--tw-shadow-color), 0 2px 4px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.container slot[name=title]::slotted(*),.container *::slotted([slot=title]){margin:0px;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container slot[name=message]::slotted(*),.container *::slotted([slot=message]){margin:0px;display:inline;font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-2);margin-inline-end:var(--calcite-notice-spacing-token-small)}.notice-content{box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;display:flex;min-inline-size:0px;flex-direction:column;overflow-wrap:break-word;flex:1 1 0;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:0 var(--calcite-notice-spacing-token-small)}.notice-content:first-of-type:not(:only-child){padding-inline-start:var(--calcite-notice-spacing-token-large)}.notice-content:only-of-type{padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large)}.notice-icon{display:flex;align-items:center;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto}.notice-close{display:flex;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-3);outline:2px solid transparent;outline-offset:2px;box-sizing:border-box;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;padding-block:var(--calcite-notice-spacing-token-small);padding-inline:var(--calcite-notice-spacing-token-large);flex:0 0 auto;-webkit-appearance:none}.notice-close:hover,.notice-close:focus{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}.notice-close:active{background-color:var(--calcite-ui-foreground-3)}.actions-end{display:flex;align-self:stretch}:host([kind=brand]) .container{border-color:var(--calcite-ui-brand)}:host([kind=brand]) .container .notice-icon{color:var(--calcite-ui-brand)}:host([kind=info]) .container{border-color:var(--calcite-ui-info)}:host([kind=info]) .container .notice-icon{color:var(--calcite-ui-info)}:host([kind=danger]) .container{border-color:var(--calcite-ui-danger)}:host([kind=danger]) .container .notice-icon{color:var(--calcite-ui-danger)}:host([kind=success]) .container{border-color:var(--calcite-ui-success)}:host([kind=success]) .container .notice-icon{color:var(--calcite-ui-success)}:host([kind=warning]) .container{border-color:var(--calcite-ui-warning)}:host([kind=warning]) .container .notice-icon{color:var(--calcite-ui-warning)}:host([hidden]){display:none}[hidden]{display:none}";
|
18
|
+
/*!
|
19
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
20
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
21
|
+
* v1.6.1
|
22
|
+
*/
|
23
|
+
const P="aria-describedby";
|
24
|
+
/*!
|
25
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
26
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
27
|
+
* v1.6.1
|
28
|
+
*/
|
29
|
+
function W(i){const{referenceElement:t}=i;return("string"==typeof t?r(i,{id:t}):t)||null}
|
30
|
+
/*!
|
31
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
32
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
33
|
+
* v1.6.1
|
34
|
+
*/const _=new class{constructor(){this.registeredElements=new WeakMap,this.registeredShadowRootCounts=new WeakMap,this.hoverOpenTimeout=null,this.hoverCloseTimeout=null,this.hoveredTooltip=null,this.clickedTooltip=null,this.activeTooltip=null,this.registeredElementCount=0,this.queryTooltip=i=>{const{registeredElements:t}=this,e=i.find((i=>t.has(i)));return t.get(e)},this.keyDownHandler=i=>{if("Escape"===i.key&&!i.defaultPrevented){const{activeTooltip:t}=this;if(t?.open){this.clearHoverTimeout(),this.closeActiveTooltip();const e=W(t);e instanceof Element&&e.contains(i.target)&&i.preventDefault()}}},this.pointerMoveHandler=i=>{const t=i.composedPath(),{activeTooltip:e}=this;if(e?.open&&t.includes(e))return void this.clearHoverTimeout();const n=this.queryTooltip(t);this.hoveredTooltip=n,this.isClosableClickedTooltip(n)||(this.clickedTooltip=null,n?this.openHoveredTooltip(n):e&&this.closeHoveredTooltip())},this.pointerDownHandler=i=>{if(!h(i))return;const t=this.queryTooltip(i.composedPath());this.clickedTooltip=t,t?.closeOnClick&&(this.toggleTooltip(t,!1),this.clearHoverTimeout())},this.focusInHandler=i=>{this.queryFocusedTooltip(i,!0)},this.focusOutHandler=i=>{this.queryFocusedTooltip(i,!1)},this.openHoveredTooltip=i=>{this.hoverOpenTimeout=window.setTimeout((()=>{null!==this.hoverOpenTimeout&&(this.clearHoverCloseTimeout(),this.activeTooltip!==this.hoveredTooltip&&(this.closeActiveTooltip(),i===this.hoveredTooltip&&this.toggleTooltip(i,!0)))}),this.activeTooltip?0:300)},this.closeHoveredTooltip=()=>{this.hoverCloseTimeout=window.setTimeout((()=>{null!==this.hoverCloseTimeout&&this.closeActiveTooltip()}),500)}}registerElement(i,t){this.registeredElementCount++,this.registeredElements.set(i,t);const e=this.getReferenceElShadowRootNode(i);e&&this.registerShadowRoot(e),1===this.registeredElementCount&&this.addListeners()}unregisterElement(i){const t=this.getReferenceElShadowRootNode(i);t&&this.unregisterShadowRoot(t),this.registeredElements.delete(i)&&this.registeredElementCount--,0===this.registeredElementCount&&this.removeListeners()}addShadowListeners(i){i.addEventListener("focusin",this.focusInHandler,{capture:!0}),i.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeShadowListeners(i){i.removeEventListener("focusin",this.focusInHandler,{capture:!0}),i.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}addListeners(){document.addEventListener("keydown",this.keyDownHandler,{capture:!0}),document.addEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.addEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.addEventListener("focusin",this.focusInHandler,{capture:!0}),document.addEventListener("focusout",this.focusOutHandler,{capture:!0})}removeListeners(){document.removeEventListener("keydown",this.keyDownHandler,{capture:!0}),document.removeEventListener("pointermove",this.pointerMoveHandler,{capture:!0}),document.removeEventListener("pointerdown",this.pointerDownHandler,{capture:!0}),document.removeEventListener("focusin",this.focusInHandler,{capture:!0}),document.removeEventListener("focusout",this.focusOutHandler,{capture:!0})}clearHoverOpenTimeout(){window.clearTimeout(this.hoverOpenTimeout),this.hoverOpenTimeout=null}clearHoverCloseTimeout(){window.clearTimeout(this.hoverCloseTimeout),this.hoverCloseTimeout=null}clearHoverTimeout(){this.clearHoverOpenTimeout(),this.clearHoverCloseTimeout()}closeActiveTooltip(){const{activeTooltip:i}=this;i?.open&&this.toggleTooltip(i,!1)}toggleFocusedTooltip(i,t){this.closeActiveTooltip(),t&&this.clearHoverTimeout(),this.toggleTooltip(i,t)}toggleTooltip(i,t){i.open=t,this.activeTooltip=t?i:null}queryFocusedTooltip(i,t){const e=this.queryTooltip(i.composedPath());e&&!this.isClosableClickedTooltip(e)&&this.toggleFocusedTooltip(e,t)}isClosableClickedTooltip(i){return i?.closeOnClick&&i===this.clickedTooltip}registerShadowRoot(i){const{registeredShadowRootCounts:t}=this,e=(t.get(i)??0)+1;1===e&&this.addShadowListeners(i),t.set(i,e)}unregisterShadowRoot(i){const{registeredShadowRootCounts:t}=this,e=t.get(i)-1;0===e&&this.removeShadowListeners(i),t.set(i,e)}getReferenceElShadowRootNode(i){return i instanceof Element?d(i):null}},K=class{constructor(e){i(this,e),this.calciteTooltipBeforeClose=t(this,"calciteTooltipBeforeClose",6),this.calciteTooltipClose=t(this,"calciteTooltipClose",6),this.calciteTooltipBeforeOpen=t(this,"calciteTooltipBeforeOpen",6),this.calciteTooltipOpen=t(this,"calciteTooltipOpen",6),this.guid=`calcite-tooltip-${I()}`,this.hasLoaded=!1,this.openTransitionProp="opacity",this.setTransitionEl=i=>{this.transitionEl=i},this.setUpReferenceElement=(i=!0)=>{this.removeReferences(),this.effectiveReferenceElement=W(this.el),R(this,this.effectiveReferenceElement,this.el);const{el:t,referenceElement:e,effectiveReferenceElement:n}=this;i&&e&&!n&&console.warn(`${t.tagName}: reference-element id "${e}" was not found.`,{el:t}),this.addReferences()},this.getId=()=>this.el.id||this.guid,this.addReferences=()=>{const{effectiveReferenceElement:i}=this;if(!i)return;const t=this.getId();"setAttribute"in i&&i.setAttribute(P,t),_.registerElement(i,this.el)},this.removeReferences=()=>{const{effectiveReferenceElement:i}=this;i&&("removeAttribute"in i&&i.removeAttribute(P),_.unregisterElement(i))},this.closeOnClick=!1,this.label=void 0,this.offsetDistance=T,this.offsetSkidding=0,this.open=!1,this.overlayPositioning="absolute",this.placement="auto",this.referenceElement=void 0,this.effectiveReferenceElement=void 0,this.floatingLayout="vertical"}offsetDistanceOffsetHandler(){this.reposition(!0)}offsetSkiddingHandler(){this.reposition(!0)}openHandler(i){A(this),i&&this.reposition(!0)}overlayPositioningHandler(){this.reposition(!0)}placementHandler(){this.reposition(!0)}referenceElementHandler(){this.setUpReferenceElement()}connectedCallback(){this.setUpReferenceElement(this.hasLoaded),this.open&&A(this)}async componentWillLoad(){this.open&&A(this)}componentDidLoad(){this.referenceElement&&!this.effectiveReferenceElement&&this.setUpReferenceElement(),this.reposition(!0),this.hasLoaded=!0}disconnectedCallback(){this.removeReferences(),S(this,this.effectiveReferenceElement,this.el)}async reposition(i=!1){const{el:t,effectiveReferenceElement:e,placement:n,overlayPositioning:s,offsetDistance:o,offsetSkidding:a,arrowEl:c}=this;return D(this,{floatingEl:t,referenceEl:e,overlayPositioning:s,placement:n,offsetDistance:o,offsetSkidding:a,arrowEl:c,type:"tooltip"},i)}onBeforeOpen(){this.calciteTooltipBeforeOpen.emit()}onOpen(){this.calciteTooltipOpen.emit()}onBeforeClose(){this.calciteTooltipBeforeClose.emit()}onClose(){this.calciteTooltipClose.emit()}render(){const{effectiveReferenceElement:i,label:t,open:s,floatingLayout:o}=this,c=i&&s,l=!c;return e(n,{"aria-hidden":a(l),"aria-label":t,"aria-live":"polite","calcite-hydrated-hidden":l,id:this.getId(),role:"tooltip"},e("div",{class:{[O.animation]:!0,[O.animationActive]:c},ref:this.setTransitionEl},e(F,{floatingLayout:o,ref:i=>this.arrowEl=i}),e("div",{class:"container"},e("slot",null))))}get el(){return s(this)}static get watchers(){return{offsetDistance:["offsetDistanceOffsetHandler"],offsetSkidding:["offsetSkiddingHandler"],open:["openHandler"],overlayPositioning:["overlayPositioningHandler"],placement:["placementHandler"],referenceElement:["referenceElementHandler"]}}};K.style=":host{--calcite-floating-ui-z-index:var(--calcite-tooltip-z-index, var(--calcite-app-z-index-tooltip));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}.container{position:relative;overflow:hidden;border-radius:0.25rem;padding-block:0.75rem;padding-inline:1rem;font-size:var(--calcite-font-size--2);line-height:1.375;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);max-inline-size:20rem;max-block-size:20rem;text-align:start}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}:host([hidden]){display:none}[hidden]{display:none}";export{M as calcite_chip,B as calcite_notice,K as calcite_tooltip}
|