@esri/calcite-components 6.0.0-next.25 → 6.0.0-next.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{3YMGHYHG.js → 2AM5TL6A.js} +1 -1
- package/dist/cdn/{W4F25ICX.js → 2DDIOIZ3.js} +1 -1
- package/dist/cdn/{TV4JPEDN.js → 2HO4UVTV.js} +1 -1
- package/dist/cdn/{Y2DB43CD.js → 2IR26YUZ.js} +1 -1
- package/dist/cdn/{HMJNZHVV.js → 2SHSOWHR.js} +1 -1
- package/dist/cdn/{2Q3LQWBY.js → 2TBTDQ4L.js} +1 -1
- package/dist/cdn/{2VVANUBK.js → 2TF2QOBI.js} +1 -1
- package/dist/cdn/{6TKCW6Y6.js → 2WEMFWFI.js} +1 -1
- package/dist/cdn/{3XB2SJ24.js → 322KZZKN.js} +1 -1
- package/dist/cdn/{P3IXFQZH.js → 3AOCZKRK.js} +1 -1
- package/dist/cdn/{NXWGQPCQ.js → 3BFTU74H.js} +1 -1
- package/dist/cdn/{52HNVKZH.js → 3QL6O3JZ.js} +1 -1
- package/dist/cdn/{LUH5KJFS.js → 3VFGU62D.js} +1 -1
- package/dist/cdn/{VTRSI4YB.js → 3WUPWL77.js} +1 -1
- package/dist/cdn/{LQK2IQ5N.js → 425RKZBZ.js} +1 -1
- package/dist/cdn/{OTEUDIDR.js → 4GIDRFXP.js} +1 -1
- package/dist/cdn/{JYSJNURC.js → 4GNWOJEI.js} +1 -1
- package/dist/cdn/{TGWHDNDE.js → 4JTOOBMN.js} +1 -1
- package/dist/cdn/{WZN6A6R6.js → 4Q7YK37X.js} +1 -1
- package/dist/cdn/{M7WETBBT.js → 4ZRNZGGA.js} +1 -1
- package/dist/cdn/{SOOTE5HZ.js → 4ZU6FC6R.js} +1 -1
- package/dist/cdn/{PO7NUJYU.js → 53K6DAU3.js} +1 -1
- package/dist/cdn/{RGQ27QXZ.js → 5BRVG4DI.js} +1 -1
- package/dist/cdn/{QURHYRAL.js → 5K666AV7.js} +1 -1
- package/dist/cdn/{65M23I26.js → 5L3BG5TC.js} +1 -1
- package/dist/cdn/{2VO6QWHK.js → 5LRDLI4U.js} +1 -1
- package/dist/cdn/{M5NZ7QW6.js → 5RLPMI6W.js} +1 -1
- package/dist/cdn/{FVZC2NPE.js → 63JSRMYO.js} +1 -1
- package/dist/cdn/{TYA262ZQ.js → 6YKZTUU7.js} +1 -1
- package/dist/cdn/{4IEEOYVA.js → 74A4XCV5.js} +1 -1
- package/dist/cdn/{7TYT2ZSG.js → 74SSQMLK.js} +1 -1
- package/dist/cdn/{CXXKYFZ2.js → 7LI4SWQS.js} +1 -1
- package/dist/cdn/{SVBXBU4Y.js → 7NPLTL4O.js} +1 -1
- package/dist/cdn/{TV3ASB45.js → 7Y5OCV5A.js} +1 -1
- package/dist/cdn/{6KEKFFMN.js → A4SLM4CF.js} +1 -1
- package/dist/cdn/{M2QF4XY7.js → A7KOEAGK.js} +1 -1
- package/dist/cdn/{ZLCBVEV3.js → ACFY3CJE.js} +1 -1
- package/dist/cdn/{HNNEJQ35.js → BFHY4DVN.js} +1 -1
- package/dist/cdn/{IFLMRWAR.js → BMDVKUBF.js} +1 -1
- package/dist/cdn/{6ZA3MV5M.js → BOPWFVNA.js} +1 -1
- package/dist/cdn/{SBBTNOZ7.js → BQQ4LU6A.js} +1 -1
- package/dist/cdn/{MSVKJ6XU.js → BR4RLRT5.js} +1 -1
- package/dist/cdn/{AQQLVGAO.js → BWKPFHWW.js} +1 -1
- package/dist/cdn/{ISOKTYOI.js → CIQKFYPY.js} +1 -1
- package/dist/cdn/{JOG5PNOA.js → CKEGMNLJ.js} +1 -1
- package/dist/cdn/{GGFW5RDL.js → CPCTKXVX.js} +1 -1
- package/dist/cdn/{U7MLKSGR.js → D7AEHU3G.js} +1 -1
- package/dist/cdn/{NETTU2AP.js → DUEMYI26.js} +1 -1
- package/dist/cdn/{3JY7VQED.js → DX23DRQT.js} +1 -1
- package/dist/cdn/{MEYWLBXH.js → E5EZVF2V.js} +1 -1
- package/dist/cdn/{3MSYHFOJ.js → EPWZ7QTA.js} +1 -1
- package/dist/cdn/{MZNTLOT7.js → F2BJVH7K.js} +1 -1
- package/dist/cdn/{NQY5HZEC.js → F47NDRCD.js} +1 -1
- package/dist/cdn/{K2CUTBE3.js → F4QWXB2P.js} +1 -1
- package/dist/cdn/{TXBKWV4W.js → F7NZUPU7.js} +1 -1
- package/dist/cdn/{UYZRIEJ7.js → FHZPH6UD.js} +1 -1
- package/dist/cdn/{RQFVWNFJ.js → G7362L7O.js} +1 -1
- package/dist/cdn/{TGPCTLAR.js → GL4DZIJF.js} +1 -1
- package/dist/cdn/{5TNTX4IP.js → GMNF4AK7.js} +1 -1
- package/dist/cdn/{3WUL3D3Q.js → GNHQSQ3X.js} +1 -1
- package/dist/cdn/{KAWIRTEH.js → GUDOUF7L.js} +1 -1
- package/dist/cdn/{S6D5JMP5.js → GZWUJN62.js} +1 -1
- package/dist/cdn/{CFJUDT7H.js → H3X4KOU4.js} +1 -1
- package/dist/cdn/{7GLVPVS5.js → H4HWFBS4.js} +1 -1
- package/dist/cdn/{G3ZSNARG.js → HA2VH343.js} +1 -1
- package/dist/cdn/{I4L2AE24.js → HSQMTWN6.js} +1 -1
- package/dist/cdn/{WSS3PNJH.js → HU36HLZ6.js} +1 -1
- package/dist/cdn/{MJMYXMSS.js → IC2RIZKW.js} +1 -1
- package/dist/cdn/{7DMKCZ7U.js → ICLJCPWO.js} +1 -1
- package/dist/cdn/{GVHFHBNY.js → IPZK3PGK.js} +1 -1
- package/dist/cdn/{B6UNMY4X.js → IRD63EKG.js} +1 -1
- package/dist/cdn/{KKTKG6RU.js → IW3UX4FW.js} +1 -1
- package/dist/cdn/{KPE44ZHJ.js → J4TKET4V.js} +1 -1
- package/dist/cdn/{YNSTNJES.js → JDDH3HBC.js} +1 -1
- package/dist/cdn/{AYPJVTAP.js → JDZTFYPZ.js} +1 -1
- package/dist/cdn/{5DM43O3V.js → JILNBALR.js} +1 -1
- package/dist/cdn/{4F5FOGY7.js → JJ5Z5SVL.js} +1 -1
- package/dist/cdn/{EU6YN6WI.js → JVTZFVM4.js} +1 -1
- package/dist/cdn/{UP24SIUC.js → KG2KYFTR.js} +1 -1
- package/dist/cdn/{XZ2R3TJN.js → L72I2RWV.js} +1 -1
- package/dist/cdn/{PEP3OAKB.js → LFNWI265.js} +1 -1
- package/dist/cdn/{OCHSY6ZY.js → LI6TJFGB.js} +1 -1
- package/dist/cdn/{ROD4F5SG.js → LS53JANR.js} +1 -1
- package/dist/cdn/{OG7EHBNH.js → LSOXNHCR.js} +1 -1
- package/dist/cdn/{LRVMZJZZ.js → MDB6YW54.js} +1 -1
- package/dist/cdn/{F56EQIFE.js → MLJKR2J2.js} +1 -1
- package/dist/cdn/{WLVTSN52.js → MRPZCM7T.js} +1 -1
- package/dist/cdn/{7X4HKAV4.js → MW5NCUZL.js} +1 -1
- package/dist/cdn/{IAIH6NNP.js → MWVDSP3I.js} +1 -1
- package/dist/cdn/{KNALNVSF.js → N2Q76J7H.js} +1 -1
- package/dist/cdn/{2OPTI7DM.js → NPDOSJK6.js} +1 -1
- package/dist/cdn/{TL6APYKB.js → NYIKRDUB.js} +1 -1
- package/dist/cdn/{KLSBECY5.js → NZ6WBP3Q.js} +1 -1
- package/dist/cdn/{HSOPTC2N.js → O5PQ42SX.js} +1 -1
- package/dist/cdn/{HN76DYF7.js → O5XYR2XD.js} +1 -1
- package/dist/cdn/{BA26VMOD.js → OX55PQ3Q.js} +1 -1
- package/dist/cdn/{2FTZ3O5Y.js → P4ETSSOP.js} +1 -1
- package/dist/cdn/{A52YDTZ6.js → PDUBFXO5.js} +1 -1
- package/dist/cdn/{LEEJW4WV.js → PSG6VZ3V.js} +1 -1
- package/dist/cdn/{42H5PGCQ.js → QOE2S7WN.js} +1 -1
- package/dist/cdn/{5TQPXISD.js → QUE7WDOC.js} +1 -1
- package/dist/cdn/{QGAHANJF.js → QYEBOVIV.js} +1 -1
- package/dist/cdn/{TT5GOLXX.js → R4QF7CP3.js} +1 -1
- package/dist/cdn/{NNIKOXDF.js → ROPYVWCB.js} +1 -1
- package/dist/cdn/RXSJYGTZ.js +2 -0
- package/dist/cdn/{3UQXG57G.js → SJWNBBMZ.js} +1 -1
- package/dist/cdn/{QMSFV4DC.js → SJXUTROD.js} +1 -1
- package/dist/cdn/{NJFM3V6R.js → SOUNTDET.js} +1 -1
- package/dist/cdn/{QYGAMD7I.js → SRMVWG4Z.js} +1 -1
- package/dist/cdn/{BXKVEQPR.js → SXMKKV3X.js} +1 -1
- package/dist/cdn/{LMQ6DASS.js → TE6ZWYIX.js} +1 -1
- package/dist/cdn/{SP7DCKBX.js → TG7UK7F3.js} +1 -1
- package/dist/cdn/{4KUT3SQG.js → TJHXVV3F.js} +1 -1
- package/dist/cdn/{FCO4XPEO.js → TKE4LNR5.js} +1 -1
- package/dist/cdn/{VYU77KVV.js → TNVZ6ZJL.js} +1 -1
- package/dist/cdn/{S354ORFF.js → TQP3NGUZ.js} +1 -1
- package/dist/cdn/{2MMQHRSO.js → U2KCT7TL.js} +1 -1
- package/dist/cdn/{HBNKGFSC.js → UQ5RPDZI.js} +1 -1
- package/dist/cdn/{5XCXOSWL.js → UX44QRQ5.js} +1 -1
- package/dist/cdn/{W6QZRTC6.js → UYZ6CMLU.js} +1 -1
- package/dist/cdn/{NSFC4QLG.js → W46EESYA.js} +1 -1
- package/dist/cdn/{5EQTYPWY.js → W5B23ZWS.js} +1 -1
- package/dist/cdn/{GAIVXZ2M.js → W6P7MJLT.js} +1 -1
- package/dist/cdn/{W6RBIAP2.js → WKK5XCER.js} +1 -1
- package/dist/cdn/{X325XBCW.js → WLBTCU66.js} +1 -1
- package/dist/cdn/{SU35BD5D.js → WY6LXWNT.js} +1 -1
- package/dist/cdn/{U36R2PAA.js → YBXMHFKE.js} +1 -1
- package/dist/cdn/{2HWT5SFS.js → YCJPETBS.js} +1 -1
- package/dist/cdn/{M7NP2F3X.js → YUAE2VTS.js} +1 -1
- package/dist/cdn/{BPQITHOF.js → YWFAYVKE.js} +1 -1
- package/dist/cdn/{7XQVNF6L.js → Z46O64ZE.js} +1 -1
- package/dist/cdn/{A4QFGFF5.js → ZBUM4I4I.js} +1 -1
- package/dist/cdn/{56BPQEBR.js → ZMSTI3V5.js} +1 -1
- package/dist/cdn/{OGN5NQTK.js → ZNZLVH2R.js} +1 -1
- package/dist/cdn/{CGDDFFL3.js → ZRF26RQK.js} +1 -1
- package/dist/cdn/{P6PXMBLM.js → ZTNNY2LN.js} +1 -1
- package/dist/cdn/{24X2HHFL.js → ZWR4O2UJ.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/components/calcite-block/customElement.d.ts +0 -18
- package/dist/components/calcite-block/customElement.js +1 -1
- package/dist/components/calcite-date-picker-month-header/customElement.js +5 -2
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +1 -1
- package/dist/cdn/VGLVE6YX.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as x,h as y,l as E,n as g,o as b,p,q as I,r as d,s as r,t as h,u as B}from"./F5ITNV4F.js";import"./6MDH7C4R.js";import"./5K4OZJAZ.js";import{a as O}from"./
|
|
2
|
+
import{a as x,h as y,l as E,n as g,o as b,p,q as I,r as d,s as r,t as h,u as B}from"./F5ITNV4F.js";import"./6MDH7C4R.js";import"./5K4OZJAZ.js";import{a as O}from"./W46EESYA.js";import{a as T}from"./JILNBALR.js";import"./VMHJHFFS.js";import"./F2BJVH7K.js";import"./2TBTDQ4L.js";import"./RRBGCYLX.js";import{E as C,F as v,G as F,H as f,T as D,g as S,h as m,p as R}from"./ZRF26RQK.js";var $={container:"container",hexInput:"hex-input",opacityInput:"opacity-input"},U=S`:host{display:block}.container{display:flex;inline-size:100%;align-items:center;flex-wrap:nowrap}.hex-input{--calcite-input-text-background-color: var(--calcite-color-picker-input-background-color);--calcite-input-text-border-color: var(--calcite-color-picker-input-border-color);--calcite-input-text-text-color: var(--calcite-color-picker-input-text-color);--calcite-input-prefix-text-color: var(--calcite-color-picker-input-prefix-text-color)}.opacity-input{--calcite-input-number-background-color: var(--calcite-color-picker-input-background-color);--calcite-input-number-border-color: var(--calcite-color-picker-input-border-color);--calcite-input-number-text-color: var(--calcite-color-picker-input-text-color);--calcite-input-suffix-text-color: var(--calcite-color-picker-input-suffix-text-color)}.hex-input{flex-grow:1;text-transform:uppercase}.opacity-input{inline-size:100px;margin-inline-start:-1px}:host([hidden]){display:none}[hidden]{display:none}`,V=x(),w=class extends F{constructor(){super(...arguments),this.hexInputRef=C(),this.opacityInputRef=C(),this.focusSetter=T()(this).setFocus,this.internalColor=V,this.alphaChannel=!1,this.allowEmpty=!1,this.hexLabel="Hex",this.scale="m",this.value=r(h(V,this.alphaChannel),this.alphaChannel,!0),this.calciteColorPickerHexInputChange=R({cancelable:!1})}static{this.properties={internalColor:[16,{},{state:!0}],alphaChannel:[5,{},{type:Boolean}],allowEmpty:[5,{},{type:Boolean}],hexLabel:1,messages:[0,{},{attribute:!1}],numberingSystem:1,scale:[3,{},{reflect:!0}],value:[3,{},{reflect:!0}]}}static{this.styles=U}async setFocus(t){return this.focusSetter(()=>this.hexInputRef.value,t)}connectedCallback(){super.connectedCallback(),this.previousDefinedValue=this.value;let{allowEmpty:t,alphaChannel:e,value:a}=this;if(a){let n=r(a,e);p(n,e)&&this.internalSetValue(n,n,!1);return}t&&this.internalSetValue(void 0,void 0,!1)}willUpdate(t){t.has("value")&&(this.hasUpdated||this.value!==r(h(V,this.alphaChannel),this.alphaChannel,!0))&&this.internalSetValue(this.value,t.get("value"),!1)}onHexInputBlur(){let t=this.hexInputRef.value,e=t.value,a=`#${e}`,{allowEmpty:n,internalColor:l}=this,o=n&&!e,i=d(a);(I(a,!0)||I(a,!1))&&this.onHexInputChange(),!(o||p(a)&&i)&&(t.value=n&&!l?"":this.formatHexForInternalInput(B(l.object())))}onOpacityInputBlur(){let t=this.opacityInputRef.value,e=t.value,{allowEmpty:a,internalColor:n}=this;a&&!e||(t.value=a&&!n?"":this.formatOpacityForInternalInput(n))}onOpacityInputInput(){this.onOpacityInputChange()}onHexInputChange(){let e=this.hexInputRef.value.value;if(e){let a=r(e,!1);if(p(a)&&this.alphaChannel&&this.internalColor){let l=r(this.internalColor.hexa(),!0).slice(-2);e=`${a+l}`}}this.internalSetValue(e,this.value)}onOpacityInputChange(){let t=this.opacityInputRef.value,e;if(!t.value)e=t.value;else{let a=b(Number(t.value));e=this.internalColor?.alpha(a).hexa()}this.internalSetValue(e,this.value)}onInputFocus(t){(t.type==="calciteInternalInputTextFocus"?this.hexInputRef:this.opacityInputRef).value.selectText()}onHexInputInput(){let t=`#${this.hexInputRef.value.value}`,e=this.value;p(t,this.alphaChannel)&&d(t,this.alphaChannel)&&this.internalSetValue(t,e)}onInputKeyDown(t){let{altKey:e,ctrlKey:a,metaKey:n,shiftKey:l}=t,{alphaChannel:o,hexInputRef:i,internalColor:s,value:c}=this,{key:u}=t,H=t.composedPath();if(u==="Tab"&&I(c,this.alphaChannel)||u==="Enter"){H.includes(i.value)?this.onHexInputChange():this.onOpacityInputChange(),u==="Enter"&&t.preventDefault();return}let L=u==="ArrowDown"||u==="ArrowUp",k=this.value;if(L){if(!c){this.internalSetValue(this.previousDefinedValue,k),t.preventDefault();return}let P=u==="ArrowUp"?1:-1,N=l?10:1;this.internalSetValue(h(this.nudgeRGBChannels(s,N*P,H.includes(i.value)?"rgb":"a"),o),k),t.preventDefault();return}let A=e||a||n,K=u.length===1,z=E.test(u);K&&!A&&!z&&t.preventDefault()}onHexInputPaste(t){let e=t.clipboardData?.getData("text");p(e,this.alphaChannel)&&d(e,this.alphaChannel)&&(t.preventDefault(),this.hexInputRef.value.value=e.slice(1),this.internalSetValue(e,this.value))}internalSetValue(t,e,a=!0){if(t){let{alphaChannel:n}=this,l=r(t,n,n);if(p(l,n)){let{internalColor:o}=this,i=x(l),s=r(h(i,n),n),c=!o||s!==r(h(o,n),n);this.internalColor=i,this.previousDefinedValue=s,this.value=s,c&&a&&this.calciteColorPickerHexInputChange.emit();return}}else if(this.allowEmpty){this.internalColor=void 0,this.value=void 0,a&&this.calciteColorPickerHexInputChange.emit();return}this.value=e}formatHexForInternalInput(t){return t?t.replace("#","").slice(0,6):""}formatOpacityForInternalInput(t){return t?`${g(t.alpha())}`:""}nudgeRGBChannels(t,e,a){let n,l=t.array(),o=l.slice(0,3);if(a==="rgb")n=[...o.map(s=>s+e),this.alphaChannel?l[3]:void 0];else{let i=b(g(t.alpha())+e);n=[...o,i]}return x(n)}render(){let{alphaChannel:t,hexLabel:e,internalColor:a,messages:n,scale:l,value:o}=this,i=this.formatHexForInternalInput(o),s=this.formatOpacityForInternalInput(a),c=l==="l"?"m":"s";return m`<div class=${f($.container)}><calcite-input-text class=${f($.hexInput)} .label=${n?.hex||e} .maxLength=${this.alphaChannel?8:6} @calciteInputTextChange=${this.onHexInputChange} @calciteInputTextInput=${this.onHexInputInput} @calciteInternalInputTextBlur=${this.onHexInputBlur} @calciteInternalInputTextFocus=${this.onInputFocus} @keydown=${this.onInputKeyDown} @paste=${this.onHexInputPaste} prefix-text=# .scale=${c} .value=${i} ${v(this.hexInputRef)}></calcite-input-text>${t?O("opacity-input",m`<calcite-input-number class=${f($.opacityInput)} .label=${n?.opacity} .max=${y.max} max-length=3 .min=${y.min} number-button-type=none .numberingSystem=${this.numberingSystem} @calciteInputNumberInput=${this.onOpacityInputInput} @calciteInternalInputNumberBlur=${this.onOpacityInputBlur} @calciteInternalInputNumberFocus=${this.onInputFocus} @keydown=${this.onInputKeyDown} .scale=${c} suffix-text=% .value=${s} ${v(this.opacityInputRef)}></calcite-input-number>`):null}</div>`}};D("calcite-color-picker-hex-input",w);export{w as ColorPickerHexInput};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{b as C}from"./
|
|
2
|
+
import{b as C}from"./F2BJVH7K.js";import{F as g,l as h,m as v}from"./RRBGCYLX.js";var W=C((e,t)=>{t.onConnected(()=>{L(e)}),t.onDisconnected(()=>{O(e)})}),w="calciteInternalLabelClick",E="calciteInternalLabelConnected",f="calciteInternalLabelDisconnected",k="calcite-label",i=new WeakMap,r=new WeakMap,c=new WeakMap,o=new WeakMap,s=new Set,D=e=>{let{id:t}=e,l=t&&h(e,{selector:`${k}[for="${t}"]`});if(l)return l;let a=v(e,k);return!a||M(a,e)?null:a};function M(e,t){let l,a="custom-element-ancestor-check",d=(n=>{n.stopImmediatePropagation();let u=n.composedPath();l=u.slice(u.indexOf(t),u.indexOf(e))});return e.addEventListener(a,d,{once:!0}),t.dispatchEvent(new CustomEvent(a,{composed:!0,bubbles:!0})),e.removeEventListener(a,d),l.filter(n=>n!==t&&n!==e).filter(n=>n.tagName?.includes("-")).length>0}function L(e){if(!e)return;let t=D(e.el);if(t&&r.has(t)&&t===e.labelEl||!t&&s.has(e))return;let l=T.bind(e);if(t){e.labelEl=t;let a=i.get(t)||[];a.push(e),i.set(t,a.sort(y)),r.has(e.labelEl)||(r.set(e.labelEl,m),e.labelEl.addEventListener(w,m)),s.delete(e),document.removeEventListener(E,c.get(e)),o.set(e,l),document.addEventListener(f,l)}else s.has(e)||(l(),document.removeEventListener(f,o.get(e)))}function O(e){if(!e||(s.delete(e),document.removeEventListener(E,c.get(e)),document.removeEventListener(f,o.get(e)),c.delete(e),o.delete(e),!e.labelEl))return;let t=i.get(e.labelEl);t.length===1&&(e.labelEl.removeEventListener(w,r.get(e.labelEl)),r.delete(e.labelEl)),i.set(e.labelEl,t.filter(l=>l!==e).sort(y)),e.labelEl=void 0}function y(e,t){return g(e.el,t.el)?-1:1}function m(e){let t=e.detail.sourceEvent.target,l=i.get(this),a=l.find(n=>n.el===t);if(a&&l.includes(a))return;let b=l[0];b.disabled||b.onLabelClick(e)}function I(){s.has(this)&&L(this)}function T(){s.add(this);let e=c.get(this)||I.bind(this);c.set(this,e),document.addEventListener(E,e)}async function q(e){if(await e.componentOnReady(),i.has(e))return;let l=e.for&&e.ownerDocument?.getElementById(e.for);l&&requestAnimationFrame(()=>{for(let a of s)if(a.el===l){L(a);break}})}export{W as a,E as b,f as c,q as d};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{d as B}from"./DOIHMBBW.js";import{d as g}from"./4F4R7KYO.js";import{e as x}from"./OUGIMZJ3.js";import{d as C}from"./J2OH4U4P.js";import{a as i}from"./
|
|
2
|
+
import{d as B}from"./DOIHMBBW.js";import{d as g}from"./4F4R7KYO.js";import{e as x}from"./OUGIMZJ3.js";import{d as C}from"./J2OH4U4P.js";import{a as i}from"./W46EESYA.js";import"./2IM7ZZ7U.js";import{e as y}from"./F2BJVH7K.js";import"./2TBTDQ4L.js";import{A as d,J as u,z as c}from"./RRBGCYLX.js";import{E as f,F as m,G as P,H as h,T as w,g as z,h as l}from"./ZRF26RQK.js";var E=z`:host{box-sizing:border-box;background-color:var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1));color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:absolute;inset:var(--calcite-space-none);display:flex;block-size:100%;inline-size:100%;flex-direction:column;overflow:hidden;border-radius:var(--calcite-shell-corner-radius);box-shadow:var(--calcite-shell-shadow)}.main{position:relative;display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;flex-direction:row;justify-content:space-between;overflow:hidden}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;overflow:auto;justify-content:space-between}.content ::slotted(calcite-panel),.content ::slotted(calcite-flow){flex:1 1 auto;align-self:stretch;max-block-size:unset}.content--behind{position:absolute;inset:var(--calcite-space-none);border-width:var(--calcite-space-none);z-index:calc(var(--calcite-z-index) - 1);display:initial}.content--non-interactive{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;pointer-events:none}::slotted(calcite-shell-panel){inline-size:unset}::slotted(.header .heading){font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal))}slot[name=panel-start]::slotted(calcite-shell-panel),slot[name=panel-end]::slotted(calcite-shell-panel){position:relative;z-index:calc(var(--calcite-z-index) + 1)}slot[name=panel-end]::slotted(calcite-shell-panel){margin-inline-start:auto}::slotted(calcite-panel),::slotted(calcite-flow){border-width:var(--calcite-border-width-sm);border-color:var(--calcite-shell-border-color, var(--calcite-color-border-3));border-inline-start-width:var(--calcite-border-width-none);border-inline-end-width:var(--calcite-border-width-none);border-style:solid}slot[name=panel-top]::slotted(calcite-shell-panel:not([display-mode^=float])),slot[name=panel-bottom]::slotted(calcite-shell-panel:not([display-mode^=float])){border-color:var(--calcite-shell-border-color, var(--calcite-color-border-3));border-inline-start-width:var(--calcite-border-width-sm);border-inline-end-width:var(--calcite-border-width-sm)}.center-content{display:flex;flex-direction:column;justify-content:space-between;block-size:100%;inline-size:100%;min-inline-size:0}.content-bottom{justify-content:flex-end}::slotted(calcite-shell-panel){flex:none;align-self:stretch}@keyframes in-up{0%{opacity:0;transform:translate3D(0,5px,0)}to{opacity:var(--calcite-opacity-full);transform:translateZ(0)}}::slotted(calcite-tip-manager){animation:in-up var(--calcite-internal-animation-timing-slow) ease-in-out;box-shadow:var(--calcite-shadow-md);position:absolute;box-sizing:border-box;border-radius:var(--calcite-corner-radius-sm);z-index:var(--calcite-z-index-toast);inset-block-end:.5rem;inset-inline:var(--calcite-shell-tip-spacing, 26vw)}slot[name=panel-bottom]::slotted(calcite-shell-panel){margin-block-start:auto}slot[name=panel-top]::slotted(calcite-shell-panel){margin-block-end:auto}.position-wrapper{position:absolute;pointer-events:none;inset:0}:host([hidden]){display:none}[hidden]{display:none}`,s={main:"main",content:"content",contentBehind:"content--behind",contentBottom:"content-bottom",contentNonInteractive:"content--non-interactive",footer:"footer",positionedSlotWrapper:"positioned-slot-wrapper",contentBehindCenterContent:"center-content"},r={panelStart:"panel-start",panelEnd:"panel-end",panelTop:"panel-top",panelBottom:"panel-bottom",header:"header",footer:"footer",alerts:"alerts",sheets:"sheets",dialogs:"dialogs"},v=class extends P{constructor(){super(),this.direction=y(),this.defaultSlotRef=f(),this.panelBottomSlotRef=f(),this.panelEndSlotRef=f(),this.panelStartSlotRef=f(),this.panelTopSlotRef=f(),this.hasAlerts=!1,this.hasDialogs=!1,this.hasFooter=!1,this.hasHeader=!1,this.hasOnlyPanelBottom=!1,this.hasPanelBottom=!1,this.hasPanelTop=!1,this.hasSheets=!1,this.panelIsResizing=!1,this.contentBehind=!1,this.listen("calciteInternalShellPanelResizeStart",this.handleCalciteInternalShellPanelResizeStart),this.listen("calciteInternalShellPanelResizeEnd",this.handleCalciteInternalShellPanelResizeEnd)}static{this.properties={hasAlerts:[16,{},{state:!0}],hasDialogs:[16,{},{state:!0}],hasFooter:[16,{},{state:!0}],hasHeader:[16,{},{state:!0}],hasOnlyPanelBottom:[16,{},{state:!0}],hasPanelBottom:[16,{},{state:!0}],hasPanelTop:[16,{},{state:!0}],hasSheets:[16,{},{state:!0}],panelIsResizing:[16,{},{state:!0}],contentBehind:[7,{},{reflect:!0,type:Boolean}]}}static{this.styles=E}willUpdate(e){(e.has("hasPanelTop")&&(this.hasUpdated||this.hasPanelTop!==!1)||e.has("hasPanelBottom")&&(this.hasUpdated||this.hasPanelBottom!==!1))&&(this.hasOnlyPanelBottom=!this.hasPanelTop&&this.hasPanelBottom)}handleCalciteInternalShellPanelResizeStart(e){this.panelIsResizing=!0,e.stopPropagation()}handleCalciteInternalShellPanelResizeEnd(e){this.panelIsResizing=!1,e.stopPropagation()}handleHeaderSlotChange(e){this.hasHeader=!!c(e)}handleFooterSlotChange(e){this.hasFooter=!!c(e)}handleAlertsSlotChange(e){this.hasAlerts=!!c(e),d(e).filter(C).forEach(t=>{t.embedded=!0})}handleSheetsSlotChange(e){this.hasSheets=!!c(e),d(e).filter(B).forEach(t=>{t.embedded=!0})}configurePanels(e,t,o){e.forEach(n=>{let a=n;n.layout=t,n.position=o,a.shellSizingDataProvider=p=>this.getShellPanelSizingData(n,p)})}getDefaultSlotMinSize(e){return this.defaultSlotRef.value?.assignedElements({flatten:!0}).reduce((t,o)=>{let n=window.getComputedStyle(o);return e==="inline"?t+u(n.borderInlineStartWidth)+u(n.borderInlineEndWidth):t+u(n.borderBlockStartWidth)+u(n.borderBlockEndWidth)},0)??0}getDefaultSlotBounds(){let e=this.defaultSlotRef.value?.assignedElements({flatten:!0})??[];return e.length?e.reduce((t,o)=>{let n=o.getBoundingClientRect();return t?{bottom:Math.max(t.bottom,n.bottom),left:Math.min(t.left,n.left),right:Math.max(t.right,n.right),top:Math.min(t.top,n.top)}:{bottom:n.bottom,left:n.left,right:n.right,top:n.top}},null):null}getShellPanelSizingData(e,t){let o=e.assignedSlot?.parentElement;if(!o)return null;let n=o.getBoundingClientRect(),a=this.getDefaultSlotBounds();if(!a)return{availableSize:t==="inline"?n.width:n.height};let p=this.getDefaultSlotMinSize(t),b=this.direction==="rtl",S;if(t==="inline"){let $=e.position==="start";S=b?$?n.right-a.left:a.right-n.left:$?a.right-n.left:n.right-a.left}else S=e.position==="start"?a.bottom-n.top:n.bottom-a.top;return{availableSize:Math.max(Math.floor(S)-Math.ceil(p),0)}}handlePanelTopChange(e){let t=d(e).filter(g);this.hasPanelTop=c(e),this.configurePanels(t,"horizontal","start"),t.forEach(o=>{o.layout="horizontal",o.position="start"})}handlePanelBottomChange(e){let t=d(e).filter(g);this.hasPanelBottom=c(e),this.configurePanels(t,"horizontal","end"),t.forEach(o=>{o.layout="horizontal",o.position="end"})}handlePanelStartChange(e){let t=d(e).filter(g);this.configurePanels(t,"vertical","start"),t.forEach(o=>{o.layout="vertical",o.position="start"})}handlePanelEndChange(e){let t=d(e).filter(g);this.configurePanels(t,"vertical","end"),t.forEach(o=>{o.layout="vertical",o.position="end"})}handleDialogsSlotChange(e){this.hasDialogs=!!c(e),d(e).filter(x).forEach(t=>{t.embedded=!0})}renderHeader(){return l`<div .hidden=${!this.hasHeader}>${i("header",l`<slot name=${r.header} @slotchange=${this.handleHeaderSlotChange}></slot>`)}</div>`}renderFooter(){return i("footer",l`<div class=${h(s.footer)} .hidden=${!this.hasFooter}><slot name=${r.footer} @slotchange=${this.handleFooterSlotChange}></slot></div>`)}renderAlerts(){return l`<div .hidden=${!this.hasAlerts}>${i("alerts",l`<slot name=${r.alerts} @slotchange=${this.handleAlertsSlotChange}></slot>`)}</div>`}renderSheets(){return l`<div .hidden=${!this.hasSheets}>${i("sheets",l`<slot name=${r.sheets} @slotchange=${this.handleSheetsSlotChange}></slot>`)}</div>`}renderDialogs(){return l`<div .hidden=${!this.hasDialogs}>${i("dialogs",l`<slot name=${r.dialogs} @slotchange=${this.handleDialogsSlotChange}></slot>`)}</div>`}renderContent(){let{panelIsResizing:e}=this,t=i("default-slot",l`<slot ${m(this.defaultSlotRef)}></slot>`),o=e?l`<div class=${h(s.contentNonInteractive)}>${t}</div>`:t,n=i("panel-bottom-slot",l`<slot name=${r.panelBottom} @slotchange=${this.handlePanelBottomChange} ${m(this.panelBottomSlotRef)}></slot>`),a=i("panel-top-slot",l`<slot name=${r.panelTop} @slotchange=${this.handlePanelTopChange} ${m(this.panelTopSlotRef)}></slot>`),p="content-container";return this.contentBehind?[i(p,l`<div class=${h({[s.content]:!0,[s.contentBehind]:!0})}>${o}</div>`),l`<div class=${h({[s.contentBehindCenterContent]:!0,[s.contentBottom]:this.hasOnlyPanelBottom})}>${a}${n}</div>`]:[i(p,l`<div class=${h({[s.content]:!0,[s.contentBottom]:this.hasOnlyPanelBottom})}>${a}${o}${n}</div>`)]}renderMain(){return l`<div class=${h(s.main)}><slot name=${r.panelStart} @slotchange=${this.handlePanelStartChange} ${m(this.panelStartSlotRef)}></slot>${this.renderContent()}<slot name=${r.panelEnd} @slotchange=${this.handlePanelEndChange} ${m(this.panelEndSlotRef)}></slot></div>`}renderPositionedSlots(){return l`<div class=${h(s.positionedSlotWrapper)}>${this.renderAlerts()}${this.renderDialogs()}${this.renderSheets()}</div>`}render(){return l`${this.renderHeader()}${this.renderMain()}${this.renderFooter()}${this.renderPositionedSlots()}`}};w("calcite-shell",v);export{v as Shell};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as i,b as o}from"./2ZG5MX5W.js";import{a as x}from"./5TNTX4IP.js";import{a as z}from"./MSVKJ6XU.js";import{j as l}from"./SU35BD5D.js";import{a as y}from"./M7WETBBT.js";import{a as I}from"./JN6YLTUP.js";import"./2IM7ZZ7U.js";import{a as f}from"./5DM43O3V.js";import{b as g}from"./VMHJHFFS.js";import"./MZNTLOT7.js";import"./2Q3LQWBY.js";import{v as b}from"./RRBGCYLX.js";import{E as p,F as d,G as h,H as t,K as m,M as u,T as v,g as c,h as r,l as n,p as a}from"./CGDDFFL3.js";var k=c`:host([disabled]),:host([layout=horizontal][disabled]) .stepper-item-header,:host([layout=horizontal-single][disabled]) .stepper-item-header{opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([layout=horizontal][disabled]) .stepper-item-header *,:host([layout=horizontal-single][disabled]) .stepper-item-header *,:host([disabled]) ::slotted(*),:host([layout=horizontal][disabled]) .stepper-item-header ::slotted(*),:host([layout=horizontal-single][disabled]) .stepper-item-header ::slotted(*){pointer-events:none}:host([scale=s]){--calcite-internal-stepper-item-spacing-unit-s: .25rem;--calcite-internal-stepper-item-spacing-unit-m: .75rem;--calcite-internal-stepper-item-spacing-unit-l: 1rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-md, var(--calcite-spacing-md));--calcite-internal-stepper-action-inline-size: 2rem;font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-base);margin-inline-end:.25rem}:host([scale=s]) .stepper-item-description{font-size:var(--calcite-font-size-relative-sm)}:host([scale=m]){--calcite-internal-stepper-item-spacing-unit-s: .5rem;--calcite-internal-stepper-item-spacing-unit-m: 1rem;--calcite-internal-stepper-item-spacing-unit-l: 1.25rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-lg, var(--calcite-spacing-lg));--calcite-internal-stepper-action-inline-size: 2.5rem;font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-md);margin-inline-end:.5rem}:host([scale=m]) .stepper-item-description{font-size:var(--calcite-font-size-relative-base)}:host([scale=l]){--calcite-internal-stepper-item-spacing-unit-s: .75rem;--calcite-internal-stepper-item-spacing-unit-m: 1.25rem;--calcite-internal-stepper-item-spacing-unit-l: 1.5rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-xl, var(--calcite-spacing-xl));--calcite-internal-stepper-action-inline-size: 3rem;font-size:var(--calcite-font-size-relative-lg);line-height:var(--calcite-font-line-height-lg);margin-inline-end:.75rem}:host([scale=l]) .stepper-item-description{font-size:var(--calcite-font-size-relative-md)}:host{position:relative;display:flex;flex-grow:1;flex-direction:column;align-self:flex-start;margin-block-end:var(--calcite-stepper-bar-gap, var(--calcite-internal-stepper-item-spacing-unit-s))}:host .container{outline:var(--calcite-border-width-md) solid transparent;outline-offset:var(--calcite-border-width-md);color:var(--calcite-color-text-3);border-color:var(--calcite-color-border-3);position:relative;display:flex;flex-grow:1;cursor:pointer;flex-direction:column;border-width:var(--calcite-border-width-none);border-block-start-width:var(--calcite-border-width-md);border-style:solid;text-decoration-line:none}:host .container:active{background-color:var(--calcite-stepper-item-background-color-press, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)))}:host{outline-color:var(--calcite-color-transparent)}:host(:focus){outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host .stepper-item-content,:host .stepper-item-header{box-sizing:border-box;padding-block:var(--calcite-internal-stepper-item-spacing-unit-l);padding-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);text-align:start}:host .stepper-item-header{display:flex;cursor:pointer;align-items:flex-start;padding-block:var(--calcite-internal-stepper-item-header-padding)}:host .stepper-item-header:active{background-color:var(--calcite-stepper-item-background-color-press, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)))}:host .stepper-item-header *{display:inline-flex;align-items:center}:host .stepper-item-content{font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);display:none;inline-size:100%;flex-direction:column}:host .stepper-item-icon{margin-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);display:inline-flex;block-size:var(--calcite-space-md);flex-shrink:0;align-self:flex-start;margin-block-start:var(--calcite-theme-space-base, var(--calcite-spacing-base));color:var(--calcite-stepper-item-icon-color, var(--calcite-color-border-input))}:host([complete]) .stepper-item-icon{opacity:var(--calcite-opacity-disabled)}:host .stepper-item-header-text{flex-direction:column;text-align:initial;margin-inline-end:auto}:host .stepper-item-heading,:host .stepper-item-description{display:flex;inline-size:100%}.stepper-item-heading,.stepper-item-description,.stepper-item-number{line-height:var(--calcite-font-line-height-relative-snug)}:host .stepper-item-heading{font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal));color:var(--calcite-stepper-item-header-text-color, var(--calcite-color-text-1))}:host .stepper-item-description{color:var(--calcite-stepper-item-description-text-color, var(--calcite-color-text-3))}:host .stepper-item-number{font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal));margin-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);color:var(--calcite-stepper-item-description-text-color, var(--calcite-color-text-1))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}:host([complete]) .container{border-color:#007ac280}:host([complete]) .container .stepper-item-icon{color:var(--calcite-stepper-item-complete-icon-color, var(--calcite-color-brand))}:host([error]) .container{border-block-start-color:var(--calcite-color-status-danger)}:host([error]) .container .stepper-item-number{color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([error]) .container .stepper-item-icon{opacity:var(--calcite-opacity-full);color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host(:hover:not([disabled]):not([selected])) .container,:host(:focus:not([disabled]):not([selected])) .container{border-block-start-color:var(--calcite-color-brand)}:host(:hover:not([disabled]):not([selected])) .container .stepper-item-heading,:host(:focus:not([disabled]):not([selected])) .container .stepper-item-heading{color:var(--calcite-stepper-item-header-text-color-hover, var(--calcite-color-text-1))}:host(:hover:not([disabled]):not([selected])) .container .stepper-item-description,:host(:focus:not([disabled]):not([selected])) .container .stepper-item-description{color:var(--calcite-stepper-item-description-text-color-hover, var(--calcite-color-text-2))}:host([error]:hover:not([disabled]):not([selected])) .container,:host([error]:focus:not([disabled]):not([selected])) .container{border-block-start-color:var(--calcite-color-status-danger-hover)}:host([selected]) .container{border-block-start-color:var(--calcite-color-brand)}:host([selected]) .container .stepper-item-heading{color:var(--calcite-stepper-item-selected-header-text-color, var(--calcite-color-text-1));font-weight:var(--calcite-font-weight-medium)}:host([selected]) .container .stepper-item-description{color:var(--calcite-stepper-item-description-text-color-hover, var(--calcite-color-text-2))}:host([selected]) .container .stepper-item-number{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-brand));font-weight:var(--calcite-font-weight-medium)}:host([selected]) .container .stepper-item-icon{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-brand));opacity:var(--calcite-opacity-full)}:host([selected]) .container .stepper-item-content{display:flex}:host([layout=vertical]){inline-size:100%}:host([layout=vertical]) .container{margin-inline:var(--calcite-space-none);margin-block-start:var(--calcite-space-none);flex:1 1 auto;border-block-start-width:var(--calcite-border-width-none);border-style:solid;padding-block:var(--calcite-space-none);border-inline-start-width:2px;padding-inline-start:var(--calcite-internal-stepper-item-spacing-unit-l);border-color:var(--calcite-stepper-bar-fill-color, var(--calcite-color-border-2))}:host([layout=vertical]) .container .stepper-item-icon{order:3;margin-block:var(--calcite-space-px) var(--calcite-space-none);padding-inline-start:var(--calcite-internal-stepper-item-spacing-unit-s);margin-inline-start:auto}:host([layout=vertical]) .container .stepper-item-header{padding-inline-end:0px}:host([layout=vertical]) .container .stepper-item-content{padding:var(--calcite-space-none)}:host([layout=vertical][complete]) .container{border-color:var(--calcite-stepper-bar-complete-fill-color, rgba(0, 122, 194, .5))}:host([layout=vertical][complete]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical][complete]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-complete-fill-color-hover, var(--calcite-color-brand))}:host([layout=vertical][error]) .container{border-color:var(--calcite-stepper-bar-error-fill-color, var(--calcite-color-status-danger))}:host([layout=vertical][selected]) .container{border-color:var(--calcite-stepper-bar-selected-fill-color, var(--calcite-color-brand))}:host([layout=vertical][selected]) .container .stepper-item-content.has-slotted-content{margin-block-end:var(--calcite-internal-stepper-item-spacing-unit-l)}:host([layout=vertical]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-fill-color-hover, rgba(0, 122, 194, .5))}:host([layout=vertical][error]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical][error]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-error-fill-color-hover, var(--calcite-color-status-danger-hover))}:host([layout=horizontal]),:host([layout=horizontal-single]){display:contents}:host([layout=horizontal]) .container,:host([layout=horizontal-single]) .container{display:contents}:host([layout=horizontal]) .stepper-item-header,:host([layout=horizontal-single]) .stepper-item-header{border-width:var(--calcite-border-width-none);border-style:solid;border-block-start-width:var(--calcite-border-width-md);outline-color:var(--calcite-color-transparent);grid-row:items;border-color:var(--calcite-stepper-bar-fill-color, var(--calcite-color-border-2))}:host([layout=horizontal]) .stepper-item-header:focus,:host([layout=horizontal-single]) .stepper-item-header:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host([layout=horizontal]) .stepper-item-content,:host([layout=horizontal-single]) .stepper-item-content{cursor:auto;transition-timing-function:var(--calcite-animation-easing-function);padding-block:0;padding-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);text-align:start}:host([layout=horizontal-single]) .stepper-item-header{grid-area:1/1/1/-1}:host([layout=horizontal]) .stepper-item-content,:host([layout=horizontal-single]) .stepper-item-content{grid-area:2/1/2/-1}:host([layout=horizontal][complete]) .stepper-item-header,:host([layout=horizontal-single][complete]) .stepper-item-header{border-color:var(--calcite-stepper-bar-complete-fill-color, rgba(0, 122, 194, .5))}:host([layout=horizontal][complete]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal][complete]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][complete]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][complete]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-complete-fill-color-hover, var(--calcite-color-brand))}:host([layout=horizontal][error]) .stepper-item-header,:host([layout=horizontal-single][error]) .stepper-item-header{border-color:var(--calcite-stepper-bar-error-fill-color, var(--calcite-color-status-danger))}:host([layout=horizontal][selected]) .stepper-item-header,:host([layout=horizontal-single][selected]) .stepper-item-header{border-color:var(--calcite-stepper-bar-selected-fill-color, var(--calcite-color-brand))}:host([layout=horizontal]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-fill-color-hover, rgba(0, 122, 194, .5))}:host([layout=horizontal][error]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal][error]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][error]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][error]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-error-fill-color-hover, var(--calcite-color-status-danger-hover))}@media(forced-colors:active){:host .container{outline-width:0;outline-offset:0}:host(:focus),:host(:focus-visible){outline-color:canvasText}:host([selected]) .container{border-block-start-color:highlight}:host([selected]) .container .stepper-item-number{color:highlight}:host([selected]) .container .stepper-item-icon{color:highlight}:host([layout=vertical][selected]) .container{border-color:highlight}}:host([layout=horizontal-single]) .stepper-item-header{border-style:none;margin-inline-end:var(--calcite-space-none);inline-size:100%;padding-inline:calc(var(--calcite-internal-stepper-action-inline-size) + .5rem)}:host([layout=horizontal-single][error]) .container .stepper-item-number{color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([layout=horizontal-single][error]) .container .stepper-item-icon{opacity:var(--calcite-opacity-full);color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([layout=horizontal-single][error][selected]),:host([layout=horizontal-single][complete][selected]) .container{color:var(--calcite-color-text-3)}:host([layout=horizontal-single][error][selected]) .stepper-item-heading,:host([layout=horizontal-single][complete][selected]) .container .stepper-item-heading{color:var(--calcite-stepper-item-header-text-color, var(--calcite-color-text-2))}:host([layout=horizontal-single][complete][selected]) .container .stepper-item-icon{opacity:var(--calcite-opacity-disabled)}:host([layout=horizontal-single][complete][selected]) .container .stepper-item-number{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-text-3))}:host([hidden]){display:none}[hidden]{display:none}:host([item-hidden]){display:none}`,s=class extends h{constructor(){super(),this.headerRef=p(),this.itemPosition=0,this.selectedPosition=0,this.messages=y(),this.focusSetter=f()(this).setFocus,this.interactiveContainer=z(this),this.stepperItemHasContent=!1,this.complete=!1,this.disabled=!1,this.error=!1,this.icon=!1,this.iconFlipRtl=!1,this.itemHidden=!1,this.numbered=!1,this.scale="m",this.selected=!1,this.calciteInternalStepperItemSelect=a({cancelable:!1}),this.calciteInternalStepperItemUpdate=a({cancelable:!1}),this.calciteStepperItemSelect=a({cancelable:!1}),this.listenOn(document.body,"calciteInternalStepperItemChange",this.updateActiveItemOnChange),this.listen("click",this.handleItemClick),this.listen("keydown",this.keyDownHandler)}static{this.properties={stepperItemHasContent:[16,{},{state:!0}],complete:[7,{},{reflect:!0,type:Boolean}],description:1,disabled:[7,{},{reflect:!0,type:Boolean}],error:[7,{},{reflect:!0,type:Boolean}],heading:1,icon:[5,{},{type:Boolean}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],itemHidden:[7,{},{reflect:!0,type:Boolean}],layout:[3,{},{reflect:!0}],messageOverrides:[0,{},{attribute:!1}],numbered:[5,{},{type:Boolean}],numberingSystem:1,scale:[3,{},{reflect:!0}],selected:[7,{},{reflect:!0,type:Boolean}]}}static{this.styles=[k,x]}async setFocus(e){return this.focusSetter(()=>this.layout==="vertical"?this.el:this.headerRef.value,e)}async load(){this.parentStepperEl=this.el.parentElement,this.itemPosition=this.getItemPosition(),this.selected&&this.emitRequestedItem()}willUpdate(e){e.has("selected")&&(this.hasUpdated||this.selected!==!1)&&this.selectedHandler(),e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.calciteInternalStepperItemUpdate.emit(),e.has("messages")&&this.effectiveLocaleWatcher(this.messages._lang)}updated(){m(this.el,"tabindex",this.disabled||this.layout==="horizontal"?null:0)}selectedHandler(){this.selected&&this.emitRequestedItem()}effectiveLocaleWatcher(e){l.numberFormatOptions={locale:e,numberingSystem:this.numberingSystem,useGrouping:!1}}updateActiveItemOnChange(e){(e.target===this.parentStepperEl||e.composedPath().includes(this.parentStepperEl))&&(this.selectedPosition=e.detail.position,this.determineSelectedItem())}keyDownHandler(e){!this.disabled&&e.target===this.el&&I(e.key)&&(this.emitUserRequestedItem(),e.preventDefault())}determineSelectedItem(){this.selected=!this.disabled&&this.itemPosition===this.selectedPosition}handleItemClick(e){this.disabled||g(this.el)||this.layout==="horizontal"&&e.composedPath().some(w=>w.classList?.contains("stepper-item-content"))||this.emitUserRequestedItem()}emitUserRequestedItem(){this.emitRequestedItem(),this.disabled||this.calciteStepperItemSelect.emit()}emitRequestedItem(){if(!this.disabled){let e=this.itemPosition;this.calciteInternalStepperItemSelect.emit({position:e})}}getItemPosition(){let e=this.parentStepperEl?.querySelectorAll("calcite-stepper-item:not([hidden]):not([item-hidden])");return e?Array.from(e).indexOf(this.el):-1}render(){return this.el.ariaCurrent=this.selected?"step":"false",this.interactiveContainer({disabled:this.disabled,children:r`<div class=${t(i.container)}>${this.complete&&r`<span aria-live=polite class=${t(u.screenReaderText)}>${this.messages.complete}</span>`||""}<div class=${t(i.stepperItemHeader)} tabindex=${(this.layout==="horizontal"&&!this.disabled?0:void 0)??n} ${d(this.headerRef)}>${this.icon?this.renderIcon():null}${this.numbered?r`<div class=${t(i.stepperItemNumber)}>${this.renderNumbers()}.</div>`:null}<div class=${t(i.stepperItemHeaderText)}><span class=${t(i.stepperItemHeading)}>${this.heading}</span><span class=${t(i.stepperItemDescription)}>${this.description}</span></div></div><div class=${t({[i.stepperItemContent]:!0,[i.hasSlottedContent]:this.stepperItemHasContent})}><slot @slotchange=${e=>this.stepperItemHasContent=b(e)}></slot></div></div>`})}renderIcon(){let e=o.circle;return this.selected&&(this.layout!=="horizontal-single"||!this.error&&!this.complete)?e=o.circleF:this.error?e=o.exclamationMarkCircleF:this.complete&&(e=o.checkCircleF),r`<calcite-icon class=${t(i.stepperItemIcon)} .flipRtl=${this.iconFlipRtl} .icon=${e} scale=s></calcite-icon>`}renderNumbers(){return l.numberFormatOptions={locale:this.messages._lang,numberingSystem:this.numberingSystem,useGrouping:!1},l.numberFormatter.format(this.itemPosition+1)}};v("calcite-stepper-item",s);export{s as StepperItem};
|
|
2
|
+
import{a as i,b as o}from"./2ZG5MX5W.js";import{a as x}from"./GMNF4AK7.js";import{a as z}from"./BR4RLRT5.js";import{j as l}from"./WY6LXWNT.js";import{a as y}from"./4ZRNZGGA.js";import{a as I}from"./JN6YLTUP.js";import"./2IM7ZZ7U.js";import{a as f}from"./JILNBALR.js";import{b as g}from"./VMHJHFFS.js";import"./F2BJVH7K.js";import"./2TBTDQ4L.js";import{v as b}from"./RRBGCYLX.js";import{E as p,F as d,G as h,H as t,K as m,M as u,T as v,g as c,h as r,l as n,p as a}from"./ZRF26RQK.js";var k=c`:host([disabled]),:host([layout=horizontal][disabled]) .stepper-item-header,:host([layout=horizontal-single][disabled]) .stepper-item-header{opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([layout=horizontal][disabled]) .stepper-item-header *,:host([layout=horizontal-single][disabled]) .stepper-item-header *,:host([disabled]) ::slotted(*),:host([layout=horizontal][disabled]) .stepper-item-header ::slotted(*),:host([layout=horizontal-single][disabled]) .stepper-item-header ::slotted(*){pointer-events:none}:host([scale=s]){--calcite-internal-stepper-item-spacing-unit-s: .25rem;--calcite-internal-stepper-item-spacing-unit-m: .75rem;--calcite-internal-stepper-item-spacing-unit-l: 1rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-md, var(--calcite-spacing-md));--calcite-internal-stepper-action-inline-size: 2rem;font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-base);margin-inline-end:.25rem}:host([scale=s]) .stepper-item-description{font-size:var(--calcite-font-size-relative-sm)}:host([scale=m]){--calcite-internal-stepper-item-spacing-unit-s: .5rem;--calcite-internal-stepper-item-spacing-unit-m: 1rem;--calcite-internal-stepper-item-spacing-unit-l: 1.25rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-lg, var(--calcite-spacing-lg));--calcite-internal-stepper-action-inline-size: 2.5rem;font-size:var(--calcite-font-size-relative-md);line-height:var(--calcite-font-line-height-md);margin-inline-end:.5rem}:host([scale=m]) .stepper-item-description{font-size:var(--calcite-font-size-relative-base)}:host([scale=l]){--calcite-internal-stepper-item-spacing-unit-s: .75rem;--calcite-internal-stepper-item-spacing-unit-m: 1.25rem;--calcite-internal-stepper-item-spacing-unit-l: 1.5rem;--calcite-internal-stepper-item-header-padding: var(--calcite-theme-space-xl, var(--calcite-spacing-xl));--calcite-internal-stepper-action-inline-size: 3rem;font-size:var(--calcite-font-size-relative-lg);line-height:var(--calcite-font-line-height-lg);margin-inline-end:.75rem}:host([scale=l]) .stepper-item-description{font-size:var(--calcite-font-size-relative-md)}:host{position:relative;display:flex;flex-grow:1;flex-direction:column;align-self:flex-start;margin-block-end:var(--calcite-stepper-bar-gap, var(--calcite-internal-stepper-item-spacing-unit-s))}:host .container{outline:var(--calcite-border-width-md) solid transparent;outline-offset:var(--calcite-border-width-md);color:var(--calcite-color-text-3);border-color:var(--calcite-color-border-3);position:relative;display:flex;flex-grow:1;cursor:pointer;flex-direction:column;border-width:var(--calcite-border-width-none);border-block-start-width:var(--calcite-border-width-md);border-style:solid;text-decoration-line:none}:host .container:active{background-color:var(--calcite-stepper-item-background-color-press, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)))}:host{outline-color:var(--calcite-color-transparent)}:host(:focus){outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host .stepper-item-content,:host .stepper-item-header{box-sizing:border-box;padding-block:var(--calcite-internal-stepper-item-spacing-unit-l);padding-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);text-align:start}:host .stepper-item-header{display:flex;cursor:pointer;align-items:flex-start;padding-block:var(--calcite-internal-stepper-item-header-padding)}:host .stepper-item-header:active{background-color:var(--calcite-stepper-item-background-color-press, var(--calcite-theme-color-surface-4, var(--calcite-color-foreground-3)))}:host .stepper-item-header *{display:inline-flex;align-items:center}:host .stepper-item-content{font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);display:none;inline-size:100%;flex-direction:column}:host .stepper-item-icon{margin-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);display:inline-flex;block-size:var(--calcite-space-md);flex-shrink:0;align-self:flex-start;margin-block-start:var(--calcite-theme-space-base, var(--calcite-spacing-base));color:var(--calcite-stepper-item-icon-color, var(--calcite-color-border-input))}:host([complete]) .stepper-item-icon{opacity:var(--calcite-opacity-disabled)}:host .stepper-item-header-text{flex-direction:column;text-align:initial;margin-inline-end:auto}:host .stepper-item-heading,:host .stepper-item-description{display:flex;inline-size:100%}.stepper-item-heading,.stepper-item-description,.stepper-item-number{line-height:var(--calcite-font-line-height-relative-snug)}:host .stepper-item-heading{font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal));color:var(--calcite-stepper-item-header-text-color, var(--calcite-color-text-1))}:host .stepper-item-description{color:var(--calcite-stepper-item-description-text-color, var(--calcite-color-text-3))}:host .stepper-item-number{font-weight:var(--calcite-theme-font-weight-regular, var(--calcite-font-weight-normal));margin-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);color:var(--calcite-stepper-item-description-text-color, var(--calcite-color-text-1))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}:host([complete]) .container{border-color:#007ac280}:host([complete]) .container .stepper-item-icon{color:var(--calcite-stepper-item-complete-icon-color, var(--calcite-color-brand))}:host([error]) .container{border-block-start-color:var(--calcite-color-status-danger)}:host([error]) .container .stepper-item-number{color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([error]) .container .stepper-item-icon{opacity:var(--calcite-opacity-full);color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host(:hover:not([disabled]):not([selected])) .container,:host(:focus:not([disabled]):not([selected])) .container{border-block-start-color:var(--calcite-color-brand)}:host(:hover:not([disabled]):not([selected])) .container .stepper-item-heading,:host(:focus:not([disabled]):not([selected])) .container .stepper-item-heading{color:var(--calcite-stepper-item-header-text-color-hover, var(--calcite-color-text-1))}:host(:hover:not([disabled]):not([selected])) .container .stepper-item-description,:host(:focus:not([disabled]):not([selected])) .container .stepper-item-description{color:var(--calcite-stepper-item-description-text-color-hover, var(--calcite-color-text-2))}:host([error]:hover:not([disabled]):not([selected])) .container,:host([error]:focus:not([disabled]):not([selected])) .container{border-block-start-color:var(--calcite-color-status-danger-hover)}:host([selected]) .container{border-block-start-color:var(--calcite-color-brand)}:host([selected]) .container .stepper-item-heading{color:var(--calcite-stepper-item-selected-header-text-color, var(--calcite-color-text-1));font-weight:var(--calcite-font-weight-medium)}:host([selected]) .container .stepper-item-description{color:var(--calcite-stepper-item-description-text-color-hover, var(--calcite-color-text-2))}:host([selected]) .container .stepper-item-number{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-brand));font-weight:var(--calcite-font-weight-medium)}:host([selected]) .container .stepper-item-icon{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-brand));opacity:var(--calcite-opacity-full)}:host([selected]) .container .stepper-item-content{display:flex}:host([layout=vertical]){inline-size:100%}:host([layout=vertical]) .container{margin-inline:var(--calcite-space-none);margin-block-start:var(--calcite-space-none);flex:1 1 auto;border-block-start-width:var(--calcite-border-width-none);border-style:solid;padding-block:var(--calcite-space-none);border-inline-start-width:2px;padding-inline-start:var(--calcite-internal-stepper-item-spacing-unit-l);border-color:var(--calcite-stepper-bar-fill-color, var(--calcite-color-border-2))}:host([layout=vertical]) .container .stepper-item-icon{order:3;margin-block:var(--calcite-space-px) var(--calcite-space-none);padding-inline-start:var(--calcite-internal-stepper-item-spacing-unit-s);margin-inline-start:auto}:host([layout=vertical]) .container .stepper-item-header{padding-inline-end:0px}:host([layout=vertical]) .container .stepper-item-content{padding:var(--calcite-space-none)}:host([layout=vertical][complete]) .container{border-color:var(--calcite-stepper-bar-complete-fill-color, rgba(0, 122, 194, .5))}:host([layout=vertical][complete]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical][complete]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-complete-fill-color-hover, var(--calcite-color-brand))}:host([layout=vertical][error]) .container{border-color:var(--calcite-stepper-bar-error-fill-color, var(--calcite-color-status-danger))}:host([layout=vertical][selected]) .container{border-color:var(--calcite-stepper-bar-selected-fill-color, var(--calcite-color-brand))}:host([layout=vertical][selected]) .container .stepper-item-content.has-slotted-content{margin-block-end:var(--calcite-internal-stepper-item-spacing-unit-l)}:host([layout=vertical]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-fill-color-hover, rgba(0, 122, 194, .5))}:host([layout=vertical][error]:hover:not([disabled]):not([selected])) .container,:host([layout=vertical][error]:focus:not([disabled]):not([selected])) .container{border-color:var(--calcite-stepper-bar-error-fill-color-hover, var(--calcite-color-status-danger-hover))}:host([layout=horizontal]),:host([layout=horizontal-single]){display:contents}:host([layout=horizontal]) .container,:host([layout=horizontal-single]) .container{display:contents}:host([layout=horizontal]) .stepper-item-header,:host([layout=horizontal-single]) .stepper-item-header{border-width:var(--calcite-border-width-none);border-style:solid;border-block-start-width:var(--calcite-border-width-md);outline-color:var(--calcite-color-transparent);grid-row:items;border-color:var(--calcite-stepper-bar-fill-color, var(--calcite-color-border-2))}:host([layout=horizontal]) .stepper-item-header:focus,:host([layout=horizontal-single]) .stepper-item-header:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host([layout=horizontal]) .stepper-item-content,:host([layout=horizontal-single]) .stepper-item-content{cursor:auto;transition-timing-function:var(--calcite-animation-easing-function);padding-block:0;padding-inline-end:var(--calcite-internal-stepper-item-spacing-unit-m);text-align:start}:host([layout=horizontal-single]) .stepper-item-header{grid-area:1/1/1/-1}:host([layout=horizontal]) .stepper-item-content,:host([layout=horizontal-single]) .stepper-item-content{grid-area:2/1/2/-1}:host([layout=horizontal][complete]) .stepper-item-header,:host([layout=horizontal-single][complete]) .stepper-item-header{border-color:var(--calcite-stepper-bar-complete-fill-color, rgba(0, 122, 194, .5))}:host([layout=horizontal][complete]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal][complete]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][complete]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][complete]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-complete-fill-color-hover, var(--calcite-color-brand))}:host([layout=horizontal][error]) .stepper-item-header,:host([layout=horizontal-single][error]) .stepper-item-header{border-color:var(--calcite-stepper-bar-error-fill-color, var(--calcite-color-status-danger))}:host([layout=horizontal][selected]) .stepper-item-header,:host([layout=horizontal-single][selected]) .stepper-item-header{border-color:var(--calcite-stepper-bar-selected-fill-color, var(--calcite-color-brand))}:host([layout=horizontal]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-fill-color-hover, rgba(0, 122, 194, .5))}:host([layout=horizontal][error]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal][error]:focus:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][error]:hover:not([disabled]):not([selected])) .stepper-item-header,:host([layout=horizontal-single][error]:focus:not([disabled]):not([selected])) .stepper-item-header{border-color:var(--calcite-stepper-bar-error-fill-color-hover, var(--calcite-color-status-danger-hover))}@media(forced-colors:active){:host .container{outline-width:0;outline-offset:0}:host(:focus),:host(:focus-visible){outline-color:canvasText}:host([selected]) .container{border-block-start-color:highlight}:host([selected]) .container .stepper-item-number{color:highlight}:host([selected]) .container .stepper-item-icon{color:highlight}:host([layout=vertical][selected]) .container{border-color:highlight}}:host([layout=horizontal-single]) .stepper-item-header{border-style:none;margin-inline-end:var(--calcite-space-none);inline-size:100%;padding-inline:calc(var(--calcite-internal-stepper-action-inline-size) + .5rem)}:host([layout=horizontal-single][error]) .container .stepper-item-number{color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([layout=horizontal-single][error]) .container .stepper-item-icon{opacity:var(--calcite-opacity-full);color:var(--calcite-stepper-item-error-icon-color, var(--calcite-color-status-danger))}:host([layout=horizontal-single][error][selected]),:host([layout=horizontal-single][complete][selected]) .container{color:var(--calcite-color-text-3)}:host([layout=horizontal-single][error][selected]) .stepper-item-heading,:host([layout=horizontal-single][complete][selected]) .container .stepper-item-heading{color:var(--calcite-stepper-item-header-text-color, var(--calcite-color-text-2))}:host([layout=horizontal-single][complete][selected]) .container .stepper-item-icon{opacity:var(--calcite-opacity-disabled)}:host([layout=horizontal-single][complete][selected]) .container .stepper-item-number{color:var(--calcite-stepper-item-selected-icon-color, var(--calcite-color-text-3))}:host([hidden]){display:none}[hidden]{display:none}:host([item-hidden]){display:none}`,s=class extends h{constructor(){super(),this.headerRef=p(),this.itemPosition=0,this.selectedPosition=0,this.messages=y(),this.focusSetter=f()(this).setFocus,this.interactiveContainer=z(this),this.stepperItemHasContent=!1,this.complete=!1,this.disabled=!1,this.error=!1,this.icon=!1,this.iconFlipRtl=!1,this.itemHidden=!1,this.numbered=!1,this.scale="m",this.selected=!1,this.calciteInternalStepperItemSelect=a({cancelable:!1}),this.calciteInternalStepperItemUpdate=a({cancelable:!1}),this.calciteStepperItemSelect=a({cancelable:!1}),this.listenOn(document.body,"calciteInternalStepperItemChange",this.updateActiveItemOnChange),this.listen("click",this.handleItemClick),this.listen("keydown",this.keyDownHandler)}static{this.properties={stepperItemHasContent:[16,{},{state:!0}],complete:[7,{},{reflect:!0,type:Boolean}],description:1,disabled:[7,{},{reflect:!0,type:Boolean}],error:[7,{},{reflect:!0,type:Boolean}],heading:1,icon:[5,{},{type:Boolean}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],itemHidden:[7,{},{reflect:!0,type:Boolean}],layout:[3,{},{reflect:!0}],messageOverrides:[0,{},{attribute:!1}],numbered:[5,{},{type:Boolean}],numberingSystem:1,scale:[3,{},{reflect:!0}],selected:[7,{},{reflect:!0,type:Boolean}]}}static{this.styles=[k,x]}async setFocus(e){return this.focusSetter(()=>this.layout==="vertical"?this.el:this.headerRef.value,e)}async load(){this.parentStepperEl=this.el.parentElement,this.itemPosition=this.getItemPosition(),this.selected&&this.emitRequestedItem()}willUpdate(e){e.has("selected")&&(this.hasUpdated||this.selected!==!1)&&this.selectedHandler(),e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.calciteInternalStepperItemUpdate.emit(),e.has("messages")&&this.effectiveLocaleWatcher(this.messages._lang)}updated(){m(this.el,"tabindex",this.disabled||this.layout==="horizontal"?null:0)}selectedHandler(){this.selected&&this.emitRequestedItem()}effectiveLocaleWatcher(e){l.numberFormatOptions={locale:e,numberingSystem:this.numberingSystem,useGrouping:!1}}updateActiveItemOnChange(e){(e.target===this.parentStepperEl||e.composedPath().includes(this.parentStepperEl))&&(this.selectedPosition=e.detail.position,this.determineSelectedItem())}keyDownHandler(e){!this.disabled&&e.target===this.el&&I(e.key)&&(this.emitUserRequestedItem(),e.preventDefault())}determineSelectedItem(){this.selected=!this.disabled&&this.itemPosition===this.selectedPosition}handleItemClick(e){this.disabled||g(this.el)||this.layout==="horizontal"&&e.composedPath().some(w=>w.classList?.contains("stepper-item-content"))||this.emitUserRequestedItem()}emitUserRequestedItem(){this.emitRequestedItem(),this.disabled||this.calciteStepperItemSelect.emit()}emitRequestedItem(){if(!this.disabled){let e=this.itemPosition;this.calciteInternalStepperItemSelect.emit({position:e})}}getItemPosition(){let e=this.parentStepperEl?.querySelectorAll("calcite-stepper-item:not([hidden]):not([item-hidden])");return e?Array.from(e).indexOf(this.el):-1}render(){return this.el.ariaCurrent=this.selected?"step":"false",this.interactiveContainer({disabled:this.disabled,children:r`<div class=${t(i.container)}>${this.complete&&r`<span aria-live=polite class=${t(u.screenReaderText)}>${this.messages.complete}</span>`||""}<div class=${t(i.stepperItemHeader)} tabindex=${(this.layout==="horizontal"&&!this.disabled?0:void 0)??n} ${d(this.headerRef)}>${this.icon?this.renderIcon():null}${this.numbered?r`<div class=${t(i.stepperItemNumber)}>${this.renderNumbers()}.</div>`:null}<div class=${t(i.stepperItemHeaderText)}><span class=${t(i.stepperItemHeading)}>${this.heading}</span><span class=${t(i.stepperItemDescription)}>${this.description}</span></div></div><div class=${t({[i.stepperItemContent]:!0,[i.hasSlottedContent]:this.stepperItemHasContent})}><slot @slotchange=${e=>this.stepperItemHasContent=b(e)}></slot></div></div>`})}renderIcon(){let e=o.circle;return this.selected&&(this.layout!=="horizontal-single"||!this.error&&!this.complete)?e=o.circleF:this.error?e=o.exclamationMarkCircleF:this.complete&&(e=o.checkCircleF),r`<calcite-icon class=${t(i.stepperItemIcon)} .flipRtl=${this.iconFlipRtl} .icon=${e} scale=s></calcite-icon>`}renderNumbers(){return l.numberFormatOptions={locale:this.messages._lang,numberingSystem:this.numberingSystem,useGrouping:!1},l.numberFormatter.format(this.itemPosition+1)}};v("calcite-stepper-item",s);export{s as StepperItem};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as w}from"./5TQPXISD.js";import{c as B}from"./LUH5KJFS.js";import{a as y}from"./XN5GTOTE.js";import{a as I}from"./OG7EHBNH.js";import{a as x}from"./MSVKJ6XU.js";import{a as n}from"./BBZC3BBE.js";import{a as k}from"./5DM43O3V.js";import"./VMHJHFFS.js";import{e as g}from"./MZNTLOT7.js";import"./2Q3LQWBY.js";import"./RRBGCYLX.js";import{E as f,F as v,G as m,H as l,T as p,g as h,h as u,l as b,p as c}from"./CGDDFFL3.js";var R={container:"container",radio:"radio"},z=h`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:block;cursor:pointer}:host .container{outline:var(--calcite-border-width-md) solid transparent;outline-offset:var(--calcite-border-width-md);position:relative;display:flex}:host .radio{transition-property:background-color,block-size,border-color,box-shadow,color,inset-block-end,inset-block-start,inset-inline-end,inset-inline-start,inset-size,opacity,outline-color,transform;transition-duration:var(--calcite-animation-timing);transition-timing-function:ease-in-out;cursor:pointer;outline-color:var(--calcite-color-transparent);border-radius:var(--calcite-radio-button-corner-radius, var(--calcite-corner-radius-pill));background-color:var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([hovered]) .radio,:host(:not([checked])[focused]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-radio-button-border-color, var(--calcite-color-brand-hover))}:host([hovered]) .radio:active,:host(:not([checked])[focused]:not([disabled])) .radio:active{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-color-brand-press)}:host([focused]) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host([disabled]) .radio{opacity:var(--calcite-opacity-disabled);cursor:default}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}:host([hovered][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([scale=s]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md))}:host([scale=m]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md-plus))}:host([scale=l]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-lg))}.radio{block-size:var(--calcite-internal-radio-size);inline-size:var(--calcite-internal-radio-size);size:var(--calcite-internal-radio-size)}:host([scale=s][checked]) .radio,:host([hovered][scale=s][checked][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=s][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([scale=m][checked]) .radio,:host([hovered][scale=m][checked][disabled]) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=m][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([scale=l][checked]) .radio,:host([hovered][scale=l][checked][disabled]) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=l][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([status=invalid]:not([checked])){--calcite-radio-button-border-color: var(--calcite-color-status-danger)}:host([status=invalid]:not([checked]):focus) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(var(--calcite-theme-space-base, var(--calcite-spacing-base)) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}@media(forced-colors:active){:host([checked]) .radio:after,:host([checked][disabled]) .radio:after{content:"";inline-size:var(--calcite-internal-radio-size);block-size:var(--calcite-internal-radio-size);background-color:CanvasText;display:block}}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-theme-space-base, var(--calcite-spacing-base))}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-2xs, var(--calcite-spacing-xxs))}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-md, var(--calcite-spacing-md))}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-md, var(--calcite-spacing-md))}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}:host([hidden]){display:none}[hidden]{display:none}`,d=class extends m{constructor(){super(),this.containerRef=f(),this.direction=g(),this.formSupport=B({inputType:"radio"})(this),this.focusSetter=k()(this).setFocus,this.interactiveContainer=x(this),this.checked=!1,this.disabled=!1,this.focused=!1,this.hovered=!1,this.required=!1,this.scale="m",this.status="idle",this.calciteInternalRadioButtonBlur=c({cancelable:!1}),this.calciteInternalRadioButtonCheckedChange=c({cancelable:!1}),this.calciteInternalRadioButtonFocus=c({cancelable:!1}),this.calciteRadioButtonChange=c({cancelable:!1}),I(this),this.listen("pointerenter",this.pointerEnterHandler),this.listen("pointerleave",this.pointerLeaveHandler),this.listen("click",this.clickHandler),this.listen("keydown",this.handleKeyDown)}static{this.properties={checked:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],focused:[7,{},{reflect:!0,type:Boolean}],form:[3,{},{reflect:!0}],hovered:[7,{},{reflect:!0,type:Boolean}],label:1,labelText:1,name:[3,{},{reflect:!0}],required:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],status:[3,{},{reflect:!0}],validationMessage:1,validity:[32,{},{readOnly:!0,attribute:!1}],value:1}}static{this.formAssociated=!0}static{this.styles=z}async emitCheckedChange(){this.calciteInternalRadioButtonCheckedChange.emit()}async setFocus(e){return this.focusSetter(()=>this.containerRef.value,e)}async setValidity(e,a=this.validationMessage){this.elementInternals.setValidity(e,a||"")}connectedCallback(){this.rootNode=this.el.getRootNode(),this.name&&this.checkLastRadioButton(),this.updateTabIndexOfOtherRadioButtonsInGroup(),super.connectedCallback()}willUpdate(e){this.hasUpdated&&e.has("checked")&&this.checkedChanged(this.checked),e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.updateTabIndexOfOtherRadioButtonsInGroup(),e.has("name")&&this.checkLastRadioButton()}loaded(){this.focused&&!this.disabled&&this.setFocus()}disconnectedCallback(){super.disconnectedCallback(),this.updateTabIndexOfOtherRadioButtonsInGroup()}checkedChanged(e){e&&this.uncheckOtherRadioButtonsInGroup(),this.calciteInternalRadioButtonCheckedChange.emit()}selectItem(e,a){e[a].click()}queryButtons(){return Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter(e=>e.name===this.name)}isFocusable(){let e=this.queryButtons(),a=e.find(i=>!i.disabled),t=e.find(i=>i.checked);return a===this.el&&!t}check(){this.disabled||(this.focused=!0,this.setFocus(),!this.checked&&(this.checked=!0,this.calciteRadioButtonChange.emit()))}clickHandler(){this.disabled||this.check()}onLabelClick(e){if(this.disabled||this.el.hidden)return;let a=e.currentTarget,t=a.for?this.rootNode.querySelector(`calcite-radio-button[id="${a.for}"]`):a.querySelector(`calcite-radio-button[name="${this.name}"]`);t&&(t.focused=!0,this.setFocus(),!t.checked&&(this.uncheckOtherRadioButtonsInGroup(),t.checked=!0,this.calciteRadioButtonChange.emit()))}checkLastRadioButton(){let a=this.queryButtons().filter(t=>t.checked);if(a?.length>1){let t=a[a.length-1];a.filter(i=>i!==t).forEach(i=>{i.checked=!1,i.emitCheckedChange()})}}uncheckOtherRadioButtonsInGroup(){this.queryButtons().filter(t=>t!==this.el).forEach(t=>{t.checked&&(t.checked=!1,t.focused=!1)})}updateTabIndexOfOtherRadioButtonsInGroup(){this.queryButtons().filter(t=>t!==this.el&&!t.disabled).forEach(t=>{t.manager?.component.requestUpdate()})}getTabIndex(){if(!this.disabled)return this.checked||this.isFocusable()?0:-1}pointerEnterHandler(){this.disabled||(this.hovered=!0)}pointerLeaveHandler(){this.disabled||(this.hovered=!1)}handleKeyDown(e){let a=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"," "],{key:t}=e;if(a.indexOf(t)===-1)return;if(t===" "){this.check(),e.preventDefault();return}let i=t;this.direction==="rtl"&&(t==="ArrowRight"&&(i="ArrowLeft"),t==="ArrowLeft"&&(i="ArrowRight"));let r=Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter(s=>s.name===this.name),o=0;switch(r.some((s,C)=>s.checked?(o=C,!0):!1),i){case"ArrowLeft":case"ArrowUp":e.preventDefault(),this.selectItem(r,this.getNextNonDisabledIndex(r,o,"left"));return;case"ArrowRight":case"ArrowDown":e.preventDefault(),this.selectItem(r,this.getNextNonDisabledIndex(r,o,"right"));return;default:return}}getNextNonDisabledIndex(e,a,t){let i=e.length,r=t==="left"?-1:1,o=n(a+r,i);for(;e[o].disabled;)o=n(o+r,i);return o}onContainerBlur(){this.focused=!1,this.calciteInternalRadioButtonBlur.emit()}onContainerFocus(){this.disabled||(this.focused=!0,this.calciteInternalRadioButtonFocus.emit())}render(){let e=this.getTabIndex();return this.interactiveContainer({disabled:this.disabled,children:u`<div .ariaChecked=${this.checked} .ariaLabel=${y(this)} class=${l(R.container)} @blur=${this.onContainerBlur} @focus=${this.onContainerFocus} role=radio tabindex=${e??b} ${v(this.containerRef)}><div class=${l(R.radio)}></div>${this.labelText&&w({labelText:this.labelText,spacingInlineStart:!0})||""}</div>`})}};p("calcite-radio-button",d);export{d as RadioButton};
|
|
2
|
+
import{a as w}from"./QUE7WDOC.js";import{c as B}from"./3VFGU62D.js";import{a as y}from"./XN5GTOTE.js";import{a as I}from"./LSOXNHCR.js";import{a as x}from"./BR4RLRT5.js";import{a as n}from"./BBZC3BBE.js";import{a as k}from"./JILNBALR.js";import"./VMHJHFFS.js";import{e as g}from"./F2BJVH7K.js";import"./2TBTDQ4L.js";import"./RRBGCYLX.js";import{E as f,F as v,G as m,H as l,T as p,g as h,h as u,l as b,p as c}from"./ZRF26RQK.js";var R={container:"container",radio:"radio"},z=h`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:block;cursor:pointer}:host .container{outline:var(--calcite-border-width-md) solid transparent;outline-offset:var(--calcite-border-width-md);position:relative;display:flex}:host .radio{transition-property:background-color,block-size,border-color,box-shadow,color,inset-block-end,inset-block-start,inset-inline-end,inset-inline-start,inset-size,opacity,outline-color,transform;transition-duration:var(--calcite-animation-timing);transition-timing-function:ease-in-out;cursor:pointer;outline-color:var(--calcite-color-transparent);border-radius:var(--calcite-radio-button-corner-radius, var(--calcite-corner-radius-pill));background-color:var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([hovered]) .radio,:host(:not([checked])[focused]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-radio-button-border-color, var(--calcite-color-brand-hover))}:host([hovered]) .radio:active,:host(:not([checked])[focused]:not([disabled])) .radio:active{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-color-brand-press)}:host([focused]) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-space-base) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}:host([disabled]) .radio{opacity:var(--calcite-opacity-disabled);cursor:default}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}:host([hovered][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([scale=s]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md))}:host([scale=m]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md-plus))}:host([scale=l]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-lg))}.radio{block-size:var(--calcite-internal-radio-size);inline-size:var(--calcite-internal-radio-size);size:var(--calcite-internal-radio-size)}:host([scale=s][checked]) .radio,:host([hovered][scale=s][checked][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=s][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([scale=m][checked]) .radio,:host([hovered][scale=m][checked][disabled]) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=m][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([scale=l][checked]) .radio,:host([hovered][scale=l][checked][disabled]) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=l][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)))}:host([status=invalid]:not([checked])){--calcite-radio-button-border-color: var(--calcite-color-status-danger)}:host([status=invalid]:not([checked]):focus) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(var(--calcite-theme-space-base, var(--calcite-spacing-base)) * (1 - 2 * clamp(0,var(--calcite-offset-invert-focus),1)))}@media(forced-colors:active){:host([checked]) .radio:after,:host([checked][disabled]) .radio:after{content:"";inline-size:var(--calcite-internal-radio-size);block-size:var(--calcite-internal-radio-size);background-color:CanvasText;display:block}}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-theme-space-base, var(--calcite-spacing-base))}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-2xs, var(--calcite-spacing-xxs))}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-theme-space-sm, var(--calcite-spacing-sm))}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-theme-space-md, var(--calcite-spacing-md))}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-theme-space-md, var(--calcite-spacing-md))}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}:host([hidden]){display:none}[hidden]{display:none}`,d=class extends m{constructor(){super(),this.containerRef=f(),this.direction=g(),this.formSupport=B({inputType:"radio"})(this),this.focusSetter=k()(this).setFocus,this.interactiveContainer=x(this),this.checked=!1,this.disabled=!1,this.focused=!1,this.hovered=!1,this.required=!1,this.scale="m",this.status="idle",this.calciteInternalRadioButtonBlur=c({cancelable:!1}),this.calciteInternalRadioButtonCheckedChange=c({cancelable:!1}),this.calciteInternalRadioButtonFocus=c({cancelable:!1}),this.calciteRadioButtonChange=c({cancelable:!1}),I(this),this.listen("pointerenter",this.pointerEnterHandler),this.listen("pointerleave",this.pointerLeaveHandler),this.listen("click",this.clickHandler),this.listen("keydown",this.handleKeyDown)}static{this.properties={checked:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],focused:[7,{},{reflect:!0,type:Boolean}],form:[3,{},{reflect:!0}],hovered:[7,{},{reflect:!0,type:Boolean}],label:1,labelText:1,name:[3,{},{reflect:!0}],required:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],status:[3,{},{reflect:!0}],validationMessage:1,validity:[32,{},{readOnly:!0,attribute:!1}],value:1}}static{this.formAssociated=!0}static{this.styles=z}async emitCheckedChange(){this.calciteInternalRadioButtonCheckedChange.emit()}async setFocus(e){return this.focusSetter(()=>this.containerRef.value,e)}async setValidity(e,a=this.validationMessage){this.elementInternals.setValidity(e,a||"")}connectedCallback(){this.rootNode=this.el.getRootNode(),this.name&&this.checkLastRadioButton(),this.updateTabIndexOfOtherRadioButtonsInGroup(),super.connectedCallback()}willUpdate(e){this.hasUpdated&&e.has("checked")&&this.checkedChanged(this.checked),e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.updateTabIndexOfOtherRadioButtonsInGroup(),e.has("name")&&this.checkLastRadioButton()}loaded(){this.focused&&!this.disabled&&this.setFocus()}disconnectedCallback(){super.disconnectedCallback(),this.updateTabIndexOfOtherRadioButtonsInGroup()}checkedChanged(e){e&&this.uncheckOtherRadioButtonsInGroup(),this.calciteInternalRadioButtonCheckedChange.emit()}selectItem(e,a){e[a].click()}queryButtons(){return Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter(e=>e.name===this.name)}isFocusable(){let e=this.queryButtons(),a=e.find(i=>!i.disabled),t=e.find(i=>i.checked);return a===this.el&&!t}check(){this.disabled||(this.focused=!0,this.setFocus(),!this.checked&&(this.checked=!0,this.calciteRadioButtonChange.emit()))}clickHandler(){this.disabled||this.check()}onLabelClick(e){if(this.disabled||this.el.hidden)return;let a=e.currentTarget,t=a.for?this.rootNode.querySelector(`calcite-radio-button[id="${a.for}"]`):a.querySelector(`calcite-radio-button[name="${this.name}"]`);t&&(t.focused=!0,this.setFocus(),!t.checked&&(this.uncheckOtherRadioButtonsInGroup(),t.checked=!0,this.calciteRadioButtonChange.emit()))}checkLastRadioButton(){let a=this.queryButtons().filter(t=>t.checked);if(a?.length>1){let t=a[a.length-1];a.filter(i=>i!==t).forEach(i=>{i.checked=!1,i.emitCheckedChange()})}}uncheckOtherRadioButtonsInGroup(){this.queryButtons().filter(t=>t!==this.el).forEach(t=>{t.checked&&(t.checked=!1,t.focused=!1)})}updateTabIndexOfOtherRadioButtonsInGroup(){this.queryButtons().filter(t=>t!==this.el&&!t.disabled).forEach(t=>{t.manager?.component.requestUpdate()})}getTabIndex(){if(!this.disabled)return this.checked||this.isFocusable()?0:-1}pointerEnterHandler(){this.disabled||(this.hovered=!0)}pointerLeaveHandler(){this.disabled||(this.hovered=!1)}handleKeyDown(e){let a=["ArrowLeft","ArrowUp","ArrowRight","ArrowDown"," "],{key:t}=e;if(a.indexOf(t)===-1)return;if(t===" "){this.check(),e.preventDefault();return}let i=t;this.direction==="rtl"&&(t==="ArrowRight"&&(i="ArrowLeft"),t==="ArrowLeft"&&(i="ArrowRight"));let r=Array.from(this.rootNode.querySelectorAll("calcite-radio-button:not([hidden])")).filter(s=>s.name===this.name),o=0;switch(r.some((s,C)=>s.checked?(o=C,!0):!1),i){case"ArrowLeft":case"ArrowUp":e.preventDefault(),this.selectItem(r,this.getNextNonDisabledIndex(r,o,"left"));return;case"ArrowRight":case"ArrowDown":e.preventDefault(),this.selectItem(r,this.getNextNonDisabledIndex(r,o,"right"));return;default:return}}getNextNonDisabledIndex(e,a,t){let i=e.length,r=t==="left"?-1:1,o=n(a+r,i);for(;e[o].disabled;)o=n(o+r,i);return o}onContainerBlur(){this.focused=!1,this.calciteInternalRadioButtonBlur.emit()}onContainerFocus(){this.disabled||(this.focused=!0,this.calciteInternalRadioButtonFocus.emit())}render(){let e=this.getTabIndex();return this.interactiveContainer({disabled:this.disabled,children:u`<div .ariaChecked=${this.checked} .ariaLabel=${y(this)} class=${l(R.container)} @blur=${this.onContainerBlur} @focus=${this.onContainerFocus} role=radio tabindex=${e??b} ${v(this.containerRef)}><div class=${l(R.radio)}></div>${this.labelText&&w({labelText:this.labelText,spacingInlineStart:!0})||""}</div>`})}};p("calcite-radio-button",d);export{d as RadioButton};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{j as f}from"./
|
|
2
|
+
import{j as f}from"./WY6LXWNT.js";function m(t,e,n){if(!t)return!1;let r=t.getTime(),a=!(e instanceof Date)||r>=e.getTime(),o=!(n instanceof Date)||r<=n.getTime();return a&&o}function p(t,e,n){if(!(t instanceof Date))return;let r=t.getTime(),a=e instanceof Date&&r<e.getTime(),o=n instanceof Date&&r>n.getTime();return a?e:o?n:t}function O(t,e=!1){if(t instanceof Date)return t;if(!t||typeof t!="string")return;let n=t.split(/[: T-]/).map(parseFloat),r=new Date(n[0],(n[1]||1)-1,n[2]||1);if(r.setFullYear(n[0]),isNaN(r.getTime()))throw new Error(`Invalid ISO 8601 date: "${t}"`);return e?T(r):r}function w(t,e){if(!e)return;let{separator:n}=e,r=y(t,e),{day:a,month:o}=r,s=M(r.year,e),i=new Date(s,o,a);i.setFullYear(s);let c=a>0,u=o>-1,l=!isNaN(i.getTime()),D=t.split(n).filter(h=>h).length>2,d=s.toString().length>0;if(c&&u&&l&&D&&d)return i}function M(t,e){return g(t,e,"read")}function v(t,e){return g(t,e,"write")}function g(t,e,n){if(e["default-calendar"]!=="buddhist")return t;let a=543*(n==="read"?-1:1);return t+a}function F(t,e){let{separator:n,unitOrder:r}=e,a=S(r),o=t.split(n).map(u=>f.delocalize(u)),s=o[a.indexOf("d")],i=o[a.indexOf("m")],c=o[a.indexOf("y")];return{day:s,month:i,year:c}}function I(t){if(t instanceof Date){let e=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${e}-${n}`}return""}function x(t){let e=t.split("-");return{day:e[2],month:e[1],year:e[0]}}function E(t,e){return t instanceof Date&&e instanceof Date&&t.getDate()===e.getDate()&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}function A(t){let e=t.getMonth(),n=new Date(t);return n.setMonth(e-1),e===n.getMonth()?new Date(t.getFullYear(),e,0):n}function C(t,e){let n=new Date(t);return n.setMonth(e),n}function L(t,e,n){if(!t)return;let r=new Date(t);return r.setDate(1),m(r,e,n)?r:p(r,e,n)}function N(t){let e=t.getMonth(),n=new Date(t);return n.setMonth(e+1),(e+2)%7===n.getMonth()%7?new Date(t.getFullYear(),e+2,0):n}function y(t,e){let{day:n,month:r,year:a}=F(t,e);return{day:parseInt(n,10),month:parseInt(r,10)-1,year:parseInt(a,10)}}function S(t){let e=["d","m","y"],n=t.toLowerCase();return e.sort((r,a)=>n.indexOf(r)-n.indexOf(a))}function R(t,e){let n=t.getTime(),r=e.getTime();return(n-r)/(1e3*3600*24)}function T(t){return t.setHours(23,59,59,999),t}function _(t,e){return!!(t&&e&&t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear())}export{m as a,p as b,O as c,w as d,M as e,v as f,F as g,I as h,x as i,E as j,A as k,C as l,L as m,N as n,S as o,R as p,_ as q};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{e as g}from"./XY2NGASJ.js";import{a as S}from"./
|
|
2
|
+
import{e as g}from"./XY2NGASJ.js";import{a as S}from"./BR4RLRT5.js";import"./2IM7ZZ7U.js";import{a as f}from"./JILNBALR.js";import"./VMHJHFFS.js";import"./F2BJVH7K.js";import"./2TBTDQ4L.js";import{A as u,E as a}from"./RRBGCYLX.js";import{E as n,F as h,G as d,H as p,T as m,g as l,h as o,p as r}from"./ZRF26RQK.js";var w={container:"container"},b=l`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:flex}.container{display:flex;flex-wrap:wrap;gap:var(--calcite-swatch-group-space, var(--calcite-theme-space-sm, var(--calcite-spacing-sm)))}:host([scale=s]) .container{gap:var(--calcite-swatch-group-space, var(--calcite-theme-space-xs, var(--calcite-spacing-xs)))}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}`,c=class extends d{constructor(){super(),this.items=[],this.slotRef=n(),this.focusSetter=f()(this).setFocus,this.interactiveContainer=S(this),this.disabled=!1,this.scale="m",this.selectedItems=[],this.selectionMode="none",this.calciteSwatchGroupSelect=r({cancelable:!1}),this.listen("keydown",this.keyDownHandler),this.listen("calciteSwatchSelect",this.calciteSwatchSelectListener),this.listen("calciteInternalSwatchSelect",this.calciteInternalSwatchSelectListener),this.listen("calciteInternalSyncSelectedSwatches",this.calciteInternalSyncSelectedSwatches)}static{this.properties={disabled:[7,{},{reflect:!0,type:Boolean}],label:1,scale:[3,{},{reflect:!0}],selectedItems:[0,{},{attribute:!1}],selectionMode:[3,{},{reflect:!0}]}}static{this.styles=b}async setFocus(e){return this.focusSetter(()=>this.el,e)}willUpdate(e){(e.has("scale")||e.has("selectionMode"))&&(this.hasUpdated||this.selectionMode!=="none")&&this.updateItems()}keyDownHandler(e){let t=e.composedPath().find(g);if(e.defaultPrevented||!t||!this.el.contains(t))return;let s=this.items.filter(i=>!i.disabled);if(s.includes(t))switch(e.key){case"ArrowRight":a(s,t,"next"),e.preventDefault();break;case"ArrowLeft":a(s,t,"previous"),e.preventDefault();break;case"Home":a(s,t,"first"),e.preventDefault();break;case"End":a(s,t,"last"),e.preventDefault();break}}calciteSwatchSelectListener(e){e.composedPath().includes(this.el)&&this.setSelectedItems(!0,e.target),e.stopPropagation()}calciteInternalSwatchSelectListener(e){e.composedPath().includes(this.el)&&this.setSelectedItems(!1,e.target),e.stopPropagation()}calciteInternalSyncSelectedSwatches(e){e.composedPath().includes(this.el)&&(this.updateSelectedItems(),this.selectionMode==="single"&&this.selectedItems.length>1&&this.setSelectedItems(!1,e.target)),e.stopPropagation()}handleSlotChange(e){this.updateItems(u(e,"calcite-swatch"))}updateItems(e=this.items){this.items=e,!(this.items.length<1)&&(this.items.forEach(t=>{t.interactive=!0,t.scale=this.scale,t.selectionMode=this.selectionMode,t.parentSwatchGroup=this.el}),this.setSelectedItems(!1))}updateSelectedItems(){this.selectedItems=this.items.filter(e=>e.selected)}setSelectedItems(e,t){t&&this.items.forEach(s=>{let i=t===s;switch(this.selectionMode){case"multiple":i&&(s.selected=!s.selected);break;case"single":s.selected=i?!s.selected:!1;break;case"single-persist":s.selected=!!i;break}}),this.updateSelectedItems(),e&&this.calciteSwatchGroupSelect.emit()}render(){let e=this.selectionMode==="none"||this.selectionMode==="multiple"?"group":"radiogroup",{disabled:t}=this;return this.interactiveContainer({disabled:t,children:o`<div .ariaLabel=${this.label} class=${p(w.container)} .role=${e}><slot @slotchange=${this.handleSlotChange} ${h(this.slotRef)}></slot></div>`})}};m("calcite-swatch-group",c);export{c as SwatchGroup};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{b as l}from"./
|
|
2
|
+
import{b as l}from"./F2BJVH7K.js";var d=s=>l(e=>{function i(r){let{form:t}=e.elementInternals;if(!(r.defaultPrevented||e.disabled||s?.disabled?.()||!t||e.type==="button")){if(e.type==="submit"){t.requestSubmit();return}t.reset()}}e.listen("luminaFormAssociatedCallback",({detail:[r]})=>{r?e.el.addEventListener("click",i):e.el.removeEventListener("click",i)})});export{d as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as m}from"./FDHY2TZA.js";import{a as V}from"./NSFC4QLG.js";import{a as $}from"./M7WETBBT.js";import{e as k}from"./MZNTLOT7.js";import"./2Q3LQWBY.js";import{E as L,q as E,s as I}from"./RRBGCYLX.js";import{F as x,G as y,H as f,M as B,T as O,g as S,h as C,p as g}from"./CGDDFFL3.js";var z={chevronRight:"chevron-right",chevronLeft:"chevron-left"},c={container:"container",scrollButton:"scroll-button",scrollButtonContainer:"scroll-button-container",scrollBackwardButton:"scroll-button--backward",scrollForwardButton:"scroll-button--forward",tabTitleSlotWrapper:"tab-titles-slot-wrapper",scale:u=>`scale-${u}`,position:u=>`position-${u}`},d=1,N=S`:host{position:relative;display:flex}:host([bordered]) .scroll-button--forward calcite-button{--calcite-internal-button-border-inline-end-color: var(--calcite-tab-border-color, var(--calcite-color-border-1))}:host([bordered]) .scroll-button--backward calcite-button{--calcite-internal-button-border-inline-start-color: var( --calcite-tab-border-color, var(--calcite-color-border-1) )}.scale-s{--calcite-internal-tab-nav-button-width: 24px;min-block-size:1.5rem}.scale-m{--calcite-internal-tab-nav-button-width: 32px;min-block-size:2rem}.scale-l{--calcite-internal-tab-nav-button-width: 44px;min-block-size:2.75rem}.container::-webkit-scrollbar{display:none;-ms-overflow-style:none;scrollbar-width:none}:host([layout=center]) ::slotted(calcite-tab-title){display:flex;flex-grow:1;flex-shrink:0;min-inline-size:auto;white-space:nowrap}:host([layout=center]) ::slotted(calcite-tab-title[selected]){overflow:unset}:host(:not([bordered])) .scale-l{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-2xl, var(--calcite-spacing-xxl))}:host(:not([bordered])) .scale-m{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-xl, var(--calcite-spacing-xl))}:host(:not([bordered])) .scale-s{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-lg, var(--calcite-spacing-lg))}:host(:not([bordered])) .tab-titles-slot-wrapper{gap:var(--calcite-internal-tab-nav-gap)}:host([layout=center]:not([bordered])) .tab-titles-slot-wrapper{padding-inline:var(--calcite-theme-space-xl, var(--calcite-spacing-xl))}.tab-titles-slot-wrapper{flex:1 1 0%}.container,.tab-titles-slot-wrapper{display:flex;inline-size:100%;justify-content:flex-start;white-space:nowrap;overflow:hidden}.scroll-button{position:absolute;inset-block:0}.scroll-button calcite-button{--calcite-button-text-color: var(--calcite-tab-text-color, var(--calcite-color-text-3));--calcite-button-background-color: var(--calcite-color-transparent);--calcite-offset-invert-focus: 1;block-size:var(--calcite-container-size-content-fluid)}.scroll-button-container{display:flex;inset-block-start:var(--calcite-border-width-md);inset-block-end:var(--calcite-border-width-md);inset-inline-end:0;inline-size:calc(2 * var(--calcite-internal-tab-nav-button-width))}.scroll-button--forward{inset-inline-end:0;z-index:var(--calcite-z-index)}.scroll-button--backward{inset-inline-end:var(--calcite-internal-tab-nav-button-width);z-index:var(--calcite-z-index)}:host(:not([bordered])) .scroll-button--backward:before{background-color:var(--calcite-tab-border-color, var(--calcite-color-border-3));content:"";inline-size:var(--calcite-border-width-sm);inset-block-start:var(--calcite-border-width-md);inset-block-end:var(--calcite-border-width-md);position:absolute;inset-inline-start:0}:host([hidden]){display:none}[hidden]{display:none}`,w=class extends y{constructor(){super(),this.direction=k(),this.effectiveDir="ltr",this.lastScrollWheelAxis="x",this.resizeObserver=m("resize",()=>{this.updateScrollingState()}),this.messages=$(),this.hasOverflowingEndTabTitle=!1,this.hasOverflowingStartTabTitle=!1,this.hasVisibleTabTitles=!0,this.bordered=!1,this.layout="inline",this.lastTabClosable=!1,this.position="bottom",this.scale="m",this.selectedTitle=null,this.calciteInternalTabChange=g({cancelable:!1}),this.calciteInternalTabNavSlotChange=g(),this.calciteTabChange=g({cancelable:!1}),this.listen("calciteInternalTabsFocusPrevious",this.focusPreviousTabHandler),this.listen("calciteInternalTabsFocusNext",this.focusNextTabHandler),this.listen("calciteInternalTabsFocusFirst",this.focusFirstTabHandler),this.listen("calciteInternalTabsFocusLast",this.focusLastTabHandler),this.listen("calciteInternalTabTitleCloseChange",this.syncVisibleTabTitlesState),this.listen("calciteInternalTabTitleRegister",this.updateTabTitles),this.listen("calciteInternalTabsActivate",this.internalActivateTabHandler),this.listen("calciteInternalTabsClose",this.internalCloseTabHandler),this.listenOn(document.body,"calciteInternalTabChange",this.globalInternalTabChangeHandler)}static{this.properties={hasOverflowingEndTabTitle:[16,{},{state:!0}],hasOverflowingStartTabTitle:[16,{},{state:!0}],hasVisibleTabTitles:[16,{},{state:!0}],selectedTabId:[16,{},{state:!0}],bordered:[7,{},{reflect:!0,type:Boolean}],layout:[3,{},{reflect:!0}],lastTabClosable:[5,{},{type:Boolean}],messageOverrides:[0,{},{attribute:!1}],position:1,scale:1,selectedTitle:[0,{},{attribute:!1}],storageId:[3,{},{reflect:!0}],syncId:[3,{},{reflect:!0}]}}static{this.styles=N}get enabledTabTitles(){return I(this.el,"calcite-tab-title:not([disabled])").filter(t=>!t.closed)}get tabTitles(){return I(this.el,"calcite-tab-title")}connectedCallback(){super.connectedCallback(),this.parentTabsEl=this.el.closest("calcite-tabs")??void 0,this.resizeObserver?.observe(this.el)}async load(){let t=`calcite-tab-nav-${this.storageId}`;if(localStorage&&this.storageId){let e=localStorage.getItem(t);if(e){let i=JSON.parse(e);this.selectedTabId=i}}}willUpdate(t){t.has("selectedTitle")&&(this.hasUpdated||this.selectedTitle!==null)&&this.selectedTabId!==void 0&&this.calciteInternalTabChange.emit({tab:this.selectedTabId}),t.has("selectedTabId")&&this.selectedTabIdChanged(),t.has("lastTabClosable")&&this.hasUpdated&&this.updateLastVisibleTabClosable();let{parentTabsEl:e}=this;e&&(this.layout=e.layout,this.bordered=e.bordered),this.effectiveDir=this.direction}loaded(){this.scrollTabTitleIntoView(this.selectedTitle,"instant"),this.tabTitles.length&&this.tabTitles.every(t=>!t.selected)&&this.selectedTabId===void 0&&this.tabTitles[0].getTabIdentifier().then(t=>{this.calciteInternalTabChange.emit({tab:t})})}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}focusPreviousTabHandler(t){this.handleTabFocus(t,t.target,"previous")}focusNextTabHandler(t){this.handleTabFocus(t,t.target,"next")}focusFirstTabHandler(t){this.handleTabFocus(t,t.target,"first")}focusLastTabHandler(t){this.handleTabFocus(t,t.target,"last")}internalActivateTabHandler(t){let e=t.target,i=this.selectedTitle;this.selectedTabId=t.detail.tab?t.detail.tab:this.getIndexOfTabTitle(e),t.stopPropagation(),this.selectedTitle=e,i?.id!==e.id&&t.detail.userTriggered&&this.calciteTabChange.emit(),this.scrollTabTitleIntoView(e)}scrollTabTitleIntoView(t,e="smooth"){t&&requestAnimationFrame(()=>{let i=this.tabTitleContainerEl;if(!i)return;let s=i.getBoundingClientRect(),n=t.getBoundingClientRect(),l=i.scrollLeft,a=n.left-s.left;if(a<0){let o=l+a;i.scrollTo({left:o,behavior:e})}else if(n.right>s.right){let o=l+Math.min(n.right-s.right,a);i.scrollTo({left:o,behavior:e})}})}internalCloseTabHandler(t){let e=t.target;this.handleTabTitleClose(e),t.stopPropagation()}async updateTabTitles(t){t.target.selected&&(this.selectedTabId=t.detail,this.selectedTitle=await this.getTabTitleById(this.selectedTabId)),this.syncVisibleTabTitlesState()}globalInternalTabChangeHandler(t){this.syncId&&t.target!==this.el&&t.target.syncId===this.syncId&&this.selectedTabId!==t.detail.tab&&(this.selectedTabId=t.detail.tab),t.stopPropagation()}async selectedTabIdChanged(){await this.componentOnReady(),this.selectedTabId!==void 0&&(localStorage&&this.storageId&&localStorage.setItem(`calcite-tab-nav-${this.storageId}`,JSON.stringify(this.selectedTabId)),this.calciteInternalTabChange.emit({tab:this.selectedTabId}))}onTabTitleWheel(t){let e=t.currentTarget;if(e.scrollWidth<=e.clientWidth)return;t.preventDefault();let{deltaX:i,deltaY:s}=t,n=Math.abs(i),l=Math.abs(s),a;n===l?a=this.lastScrollWheelAxis==="x"?i:s:n>l?(a=i,this.lastScrollWheelAxis="x"):(a=s,this.lastScrollWheelAxis="y");let o=(this.effectiveDir==="rtl"?-1:1)*a;e.scrollBy(o,0)}onSlotChange(){this.intersectionObserver?.disconnect(),this.tabTitles.forEach(e=>{this.intersectionObserver?.observe(e)}),this.syncVisibleTabTitlesState()}syncVisibleTabTitlesState(){this.updateLastVisibleTabClosable(),this.hasVisibleTabTitles=this.getVisibleTabTitlesIndices(this.tabTitles).length>0,this.calciteInternalTabNavSlotChange.emit([...this.tabTitles])}updateLastVisibleTabClosable(){let{tabTitles:t}=this,e=this.getVisibleTabTitlesIndices(t),i=e.length;if(i===0)return;let s=t[e[0]];if(!this.lastTabClosable&&i===1){s.closable&&(this.firstVisibleTabMadeNonClosable=s,s.closable=!1);return}this.firstVisibleTabMadeNonClosable&&!this.firstVisibleTabMadeNonClosable.closed&&(this.firstVisibleTabMadeNonClosable.closable=!0),this.firstVisibleTabMadeNonClosable=void 0}setTabTitleContainerEl(t){this.tabTitleContainerEl=t,this.intersectionObserver?.disconnect(),t&&(this.intersectionObserver=m("intersection",()=>this.updateScrollingState(),{root:t,threshold:[0,.5,1]}))}updateScrollingState(){let t=this.tabTitleContainerEl;if(!t)return;let e,i,s=t.scrollLeft,n=t.clientWidth,l=t.scrollWidth;this.effectiveDir==="ltr"?(e=s>d,i=l-(s+n)>d):(e=s<-d,i=l-n+s>d),this.hasOverflowingStartTabTitle=e,this.hasOverflowingEndTabTitle=i}scrollToTabTitles(t){requestAnimationFrame(()=>{let e=this.tabTitleContainerEl;if(!e)return;let i=e.getBoundingClientRect(),{effectiveDir:s}=this,n=t==="forward"&&s==="ltr"||t==="backward"&&s==="rtl",l,a=t==="forward"?[...this.tabTitles].reverse():this.tabTitles;if(!a.length)return;if(n){let h;l=a.find(T=>{let r=T.getBoundingClientRect(),p=r.left>=i.right,v=r.left<i.right&&r.right>i.right&&r.right-i.right>d;return p&&(h=T),v})??h}else{let h;l=a.find(T=>{let r=T.getBoundingClientRect(),p=r.right<=i.left,v=r.left<i.left&&r.right>i.left&&i.left-r.left>d;return p&&(h=T),v})??h}if(!l)return;let o=l.getBoundingClientRect(),b=e.scrollLeft,F=n?b+(o.right-i.right):b+(o.left-i.left);e.scrollTo({left:Math.round(F),behavior:"smooth"})})}scrollToNextTabTitles(){this.scrollToTabTitles("forward")}scrollToPreviousTabTitles(){this.scrollToTabTitles("backward")}handleTabFocus(t,e,i){let s=L(this.enabledTabTitles,e,i);this.scrollTabTitleIntoView(s,"instant"),t.stopPropagation()}getIndexOfTabTitle(t,e=this.tabTitles){return e.indexOf(t)}onTabTitleScroll(){this.updateScrollingState()}async getTabTitleById(t){return Promise.all(this.tabTitles.map(e=>e.getTabIdentifier())).then(e=>this.tabTitles[e.indexOf(t)])}getVisibleTabTitlesIndices(t){return t.reduce((e,i,s)=>i.closed?e:[...e,s],[])}handleTabTitleClose(t){let{tabTitles:e}=this,i=e.filter(a=>!a.closed),s=this.enabledTabTitles,n=i.length,l=t.selected;if(this.hasVisibleTabTitles=n>0,this.calciteInternalTabNavSlotChange.emit([...e]),n===0){this.selectedTitle=null,this.selectedTabId=void 0;return}if(l){let a=e.findIndex(b=>b===t),o=s.find(b=>e.indexOf(b)>a)||s.at(-1);if(!o){this.selectedTitle=null,this.selectedTabId=void 0,this.updateLastVisibleTabClosable();return}o.activateTab()}this.updateLastVisibleTabClosable(),requestAnimationFrame(()=>{let a=this.selectedTitle;a&&E(a)})}render(){return this.el.role="tablist",C`<div class=${f({[c.container]:!0,[c.scale(this.scale)]:!0,[c.position(this.position)]:!0,[B.rtl]:this.effectiveDir==="rtl"})} .hidden=${!this.hasVisibleTabTitles}><div class=${f({[c.tabTitleSlotWrapper]:!0})} @scroll=${this.onTabTitleScroll} @wheel=${this.onTabTitleWheel} ${x(this.setTabTitleContainerEl)}><slot @slotchange=${this.onSlotChange}></slot></div><div class=${f(c.scrollButtonContainer)} .hidden=${!this.hasOverflowingEndTabTitle&&!this.hasOverflowingStartTabTitle}>${this.renderScrollButton("start")}${this.renderScrollButton("end")}</div></div>`}renderScrollButton(t){let{messages:e,scale:i,hasOverflowingEndTabTitle:s,hasOverflowingStartTabTitle:n}=this,l=t==="end";return V(t,C`<div class=${f({[c.scrollButton]:!0,[c.scrollBackwardButton]:!l,[c.scrollForwardButton]:l})}><calcite-button .ariaLabel=${l?e.nextTabTitles:e.previousTabTitles} .disabled=${l?!s:!n} icon-flip-rtl=both .iconStart=${l?z.chevronRight:z.chevronLeft} kind=neutral @click=${l?this.scrollToNextTabTitles:this.scrollToPreviousTabTitles} .scale=${i} tabindex=-1></calcite-button></div>`)}};O("calcite-tab-nav",w);export{w as TabNav};
|
|
2
|
+
import{a as m}from"./FDHY2TZA.js";import{a as V}from"./W46EESYA.js";import{a as $}from"./4ZRNZGGA.js";import{e as k}from"./F2BJVH7K.js";import"./2TBTDQ4L.js";import{E as L,q as E,s as I}from"./RRBGCYLX.js";import{F as x,G as y,H as f,M as B,T as O,g as S,h as C,p as g}from"./ZRF26RQK.js";var z={chevronRight:"chevron-right",chevronLeft:"chevron-left"},c={container:"container",scrollButton:"scroll-button",scrollButtonContainer:"scroll-button-container",scrollBackwardButton:"scroll-button--backward",scrollForwardButton:"scroll-button--forward",tabTitleSlotWrapper:"tab-titles-slot-wrapper",scale:u=>`scale-${u}`,position:u=>`position-${u}`},d=1,N=S`:host{position:relative;display:flex}:host([bordered]) .scroll-button--forward calcite-button{--calcite-internal-button-border-inline-end-color: var(--calcite-tab-border-color, var(--calcite-color-border-1))}:host([bordered]) .scroll-button--backward calcite-button{--calcite-internal-button-border-inline-start-color: var( --calcite-tab-border-color, var(--calcite-color-border-1) )}.scale-s{--calcite-internal-tab-nav-button-width: 24px;min-block-size:1.5rem}.scale-m{--calcite-internal-tab-nav-button-width: 32px;min-block-size:2rem}.scale-l{--calcite-internal-tab-nav-button-width: 44px;min-block-size:2.75rem}.container::-webkit-scrollbar{display:none;-ms-overflow-style:none;scrollbar-width:none}:host([layout=center]) ::slotted(calcite-tab-title){display:flex;flex-grow:1;flex-shrink:0;min-inline-size:auto;white-space:nowrap}:host([layout=center]) ::slotted(calcite-tab-title[selected]){overflow:unset}:host(:not([bordered])) .scale-l{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-2xl, var(--calcite-spacing-xxl))}:host(:not([bordered])) .scale-m{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-xl, var(--calcite-spacing-xl))}:host(:not([bordered])) .scale-s{--calcite-internal-tab-nav-gap: var(--calcite-theme-space-lg, var(--calcite-spacing-lg))}:host(:not([bordered])) .tab-titles-slot-wrapper{gap:var(--calcite-internal-tab-nav-gap)}:host([layout=center]:not([bordered])) .tab-titles-slot-wrapper{padding-inline:var(--calcite-theme-space-xl, var(--calcite-spacing-xl))}.tab-titles-slot-wrapper{flex:1 1 0%}.container,.tab-titles-slot-wrapper{display:flex;inline-size:100%;justify-content:flex-start;white-space:nowrap;overflow:hidden}.scroll-button{position:absolute;inset-block:0}.scroll-button calcite-button{--calcite-button-text-color: var(--calcite-tab-text-color, var(--calcite-color-text-3));--calcite-button-background-color: var(--calcite-color-transparent);--calcite-offset-invert-focus: 1;block-size:var(--calcite-container-size-content-fluid)}.scroll-button-container{display:flex;inset-block-start:var(--calcite-border-width-md);inset-block-end:var(--calcite-border-width-md);inset-inline-end:0;inline-size:calc(2 * var(--calcite-internal-tab-nav-button-width))}.scroll-button--forward{inset-inline-end:0;z-index:var(--calcite-z-index)}.scroll-button--backward{inset-inline-end:var(--calcite-internal-tab-nav-button-width);z-index:var(--calcite-z-index)}:host(:not([bordered])) .scroll-button--backward:before{background-color:var(--calcite-tab-border-color, var(--calcite-color-border-3));content:"";inline-size:var(--calcite-border-width-sm);inset-block-start:var(--calcite-border-width-md);inset-block-end:var(--calcite-border-width-md);position:absolute;inset-inline-start:0}:host([hidden]){display:none}[hidden]{display:none}`,w=class extends y{constructor(){super(),this.direction=k(),this.effectiveDir="ltr",this.lastScrollWheelAxis="x",this.resizeObserver=m("resize",()=>{this.updateScrollingState()}),this.messages=$(),this.hasOverflowingEndTabTitle=!1,this.hasOverflowingStartTabTitle=!1,this.hasVisibleTabTitles=!0,this.bordered=!1,this.layout="inline",this.lastTabClosable=!1,this.position="bottom",this.scale="m",this.selectedTitle=null,this.calciteInternalTabChange=g({cancelable:!1}),this.calciteInternalTabNavSlotChange=g(),this.calciteTabChange=g({cancelable:!1}),this.listen("calciteInternalTabsFocusPrevious",this.focusPreviousTabHandler),this.listen("calciteInternalTabsFocusNext",this.focusNextTabHandler),this.listen("calciteInternalTabsFocusFirst",this.focusFirstTabHandler),this.listen("calciteInternalTabsFocusLast",this.focusLastTabHandler),this.listen("calciteInternalTabTitleCloseChange",this.syncVisibleTabTitlesState),this.listen("calciteInternalTabTitleRegister",this.updateTabTitles),this.listen("calciteInternalTabsActivate",this.internalActivateTabHandler),this.listen("calciteInternalTabsClose",this.internalCloseTabHandler),this.listenOn(document.body,"calciteInternalTabChange",this.globalInternalTabChangeHandler)}static{this.properties={hasOverflowingEndTabTitle:[16,{},{state:!0}],hasOverflowingStartTabTitle:[16,{},{state:!0}],hasVisibleTabTitles:[16,{},{state:!0}],selectedTabId:[16,{},{state:!0}],bordered:[7,{},{reflect:!0,type:Boolean}],layout:[3,{},{reflect:!0}],lastTabClosable:[5,{},{type:Boolean}],messageOverrides:[0,{},{attribute:!1}],position:1,scale:1,selectedTitle:[0,{},{attribute:!1}],storageId:[3,{},{reflect:!0}],syncId:[3,{},{reflect:!0}]}}static{this.styles=N}get enabledTabTitles(){return I(this.el,"calcite-tab-title:not([disabled])").filter(t=>!t.closed)}get tabTitles(){return I(this.el,"calcite-tab-title")}connectedCallback(){super.connectedCallback(),this.parentTabsEl=this.el.closest("calcite-tabs")??void 0,this.resizeObserver?.observe(this.el)}async load(){let t=`calcite-tab-nav-${this.storageId}`;if(localStorage&&this.storageId){let e=localStorage.getItem(t);if(e){let i=JSON.parse(e);this.selectedTabId=i}}}willUpdate(t){t.has("selectedTitle")&&(this.hasUpdated||this.selectedTitle!==null)&&this.selectedTabId!==void 0&&this.calciteInternalTabChange.emit({tab:this.selectedTabId}),t.has("selectedTabId")&&this.selectedTabIdChanged(),t.has("lastTabClosable")&&this.hasUpdated&&this.updateLastVisibleTabClosable();let{parentTabsEl:e}=this;e&&(this.layout=e.layout,this.bordered=e.bordered),this.effectiveDir=this.direction}loaded(){this.scrollTabTitleIntoView(this.selectedTitle,"instant"),this.tabTitles.length&&this.tabTitles.every(t=>!t.selected)&&this.selectedTabId===void 0&&this.tabTitles[0].getTabIdentifier().then(t=>{this.calciteInternalTabChange.emit({tab:t})})}disconnectedCallback(){super.disconnectedCallback(),this.resizeObserver?.disconnect()}focusPreviousTabHandler(t){this.handleTabFocus(t,t.target,"previous")}focusNextTabHandler(t){this.handleTabFocus(t,t.target,"next")}focusFirstTabHandler(t){this.handleTabFocus(t,t.target,"first")}focusLastTabHandler(t){this.handleTabFocus(t,t.target,"last")}internalActivateTabHandler(t){let e=t.target,i=this.selectedTitle;this.selectedTabId=t.detail.tab?t.detail.tab:this.getIndexOfTabTitle(e),t.stopPropagation(),this.selectedTitle=e,i?.id!==e.id&&t.detail.userTriggered&&this.calciteTabChange.emit(),this.scrollTabTitleIntoView(e)}scrollTabTitleIntoView(t,e="smooth"){t&&requestAnimationFrame(()=>{let i=this.tabTitleContainerEl;if(!i)return;let s=i.getBoundingClientRect(),n=t.getBoundingClientRect(),l=i.scrollLeft,a=n.left-s.left;if(a<0){let o=l+a;i.scrollTo({left:o,behavior:e})}else if(n.right>s.right){let o=l+Math.min(n.right-s.right,a);i.scrollTo({left:o,behavior:e})}})}internalCloseTabHandler(t){let e=t.target;this.handleTabTitleClose(e),t.stopPropagation()}async updateTabTitles(t){t.target.selected&&(this.selectedTabId=t.detail,this.selectedTitle=await this.getTabTitleById(this.selectedTabId)),this.syncVisibleTabTitlesState()}globalInternalTabChangeHandler(t){this.syncId&&t.target!==this.el&&t.target.syncId===this.syncId&&this.selectedTabId!==t.detail.tab&&(this.selectedTabId=t.detail.tab),t.stopPropagation()}async selectedTabIdChanged(){await this.componentOnReady(),this.selectedTabId!==void 0&&(localStorage&&this.storageId&&localStorage.setItem(`calcite-tab-nav-${this.storageId}`,JSON.stringify(this.selectedTabId)),this.calciteInternalTabChange.emit({tab:this.selectedTabId}))}onTabTitleWheel(t){let e=t.currentTarget;if(e.scrollWidth<=e.clientWidth)return;t.preventDefault();let{deltaX:i,deltaY:s}=t,n=Math.abs(i),l=Math.abs(s),a;n===l?a=this.lastScrollWheelAxis==="x"?i:s:n>l?(a=i,this.lastScrollWheelAxis="x"):(a=s,this.lastScrollWheelAxis="y");let o=(this.effectiveDir==="rtl"?-1:1)*a;e.scrollBy(o,0)}onSlotChange(){this.intersectionObserver?.disconnect(),this.tabTitles.forEach(e=>{this.intersectionObserver?.observe(e)}),this.syncVisibleTabTitlesState()}syncVisibleTabTitlesState(){this.updateLastVisibleTabClosable(),this.hasVisibleTabTitles=this.getVisibleTabTitlesIndices(this.tabTitles).length>0,this.calciteInternalTabNavSlotChange.emit([...this.tabTitles])}updateLastVisibleTabClosable(){let{tabTitles:t}=this,e=this.getVisibleTabTitlesIndices(t),i=e.length;if(i===0)return;let s=t[e[0]];if(!this.lastTabClosable&&i===1){s.closable&&(this.firstVisibleTabMadeNonClosable=s,s.closable=!1);return}this.firstVisibleTabMadeNonClosable&&!this.firstVisibleTabMadeNonClosable.closed&&(this.firstVisibleTabMadeNonClosable.closable=!0),this.firstVisibleTabMadeNonClosable=void 0}setTabTitleContainerEl(t){this.tabTitleContainerEl=t,this.intersectionObserver?.disconnect(),t&&(this.intersectionObserver=m("intersection",()=>this.updateScrollingState(),{root:t,threshold:[0,.5,1]}))}updateScrollingState(){let t=this.tabTitleContainerEl;if(!t)return;let e,i,s=t.scrollLeft,n=t.clientWidth,l=t.scrollWidth;this.effectiveDir==="ltr"?(e=s>d,i=l-(s+n)>d):(e=s<-d,i=l-n+s>d),this.hasOverflowingStartTabTitle=e,this.hasOverflowingEndTabTitle=i}scrollToTabTitles(t){requestAnimationFrame(()=>{let e=this.tabTitleContainerEl;if(!e)return;let i=e.getBoundingClientRect(),{effectiveDir:s}=this,n=t==="forward"&&s==="ltr"||t==="backward"&&s==="rtl",l,a=t==="forward"?[...this.tabTitles].reverse():this.tabTitles;if(!a.length)return;if(n){let h;l=a.find(T=>{let r=T.getBoundingClientRect(),p=r.left>=i.right,v=r.left<i.right&&r.right>i.right&&r.right-i.right>d;return p&&(h=T),v})??h}else{let h;l=a.find(T=>{let r=T.getBoundingClientRect(),p=r.right<=i.left,v=r.left<i.left&&r.right>i.left&&i.left-r.left>d;return p&&(h=T),v})??h}if(!l)return;let o=l.getBoundingClientRect(),b=e.scrollLeft,F=n?b+(o.right-i.right):b+(o.left-i.left);e.scrollTo({left:Math.round(F),behavior:"smooth"})})}scrollToNextTabTitles(){this.scrollToTabTitles("forward")}scrollToPreviousTabTitles(){this.scrollToTabTitles("backward")}handleTabFocus(t,e,i){let s=L(this.enabledTabTitles,e,i);this.scrollTabTitleIntoView(s,"instant"),t.stopPropagation()}getIndexOfTabTitle(t,e=this.tabTitles){return e.indexOf(t)}onTabTitleScroll(){this.updateScrollingState()}async getTabTitleById(t){return Promise.all(this.tabTitles.map(e=>e.getTabIdentifier())).then(e=>this.tabTitles[e.indexOf(t)])}getVisibleTabTitlesIndices(t){return t.reduce((e,i,s)=>i.closed?e:[...e,s],[])}handleTabTitleClose(t){let{tabTitles:e}=this,i=e.filter(a=>!a.closed),s=this.enabledTabTitles,n=i.length,l=t.selected;if(this.hasVisibleTabTitles=n>0,this.calciteInternalTabNavSlotChange.emit([...e]),n===0){this.selectedTitle=null,this.selectedTabId=void 0;return}if(l){let a=e.findIndex(b=>b===t),o=s.find(b=>e.indexOf(b)>a)||s.at(-1);if(!o){this.selectedTitle=null,this.selectedTabId=void 0,this.updateLastVisibleTabClosable();return}o.activateTab()}this.updateLastVisibleTabClosable(),requestAnimationFrame(()=>{let a=this.selectedTitle;a&&E(a)})}render(){return this.el.role="tablist",C`<div class=${f({[c.container]:!0,[c.scale(this.scale)]:!0,[c.position(this.position)]:!0,[B.rtl]:this.effectiveDir==="rtl"})} .hidden=${!this.hasVisibleTabTitles}><div class=${f({[c.tabTitleSlotWrapper]:!0})} @scroll=${this.onTabTitleScroll} @wheel=${this.onTabTitleWheel} ${x(this.setTabTitleContainerEl)}><slot @slotchange=${this.onSlotChange}></slot></div><div class=${f(c.scrollButtonContainer)} .hidden=${!this.hasOverflowingEndTabTitle&&!this.hasOverflowingStartTabTitle}>${this.renderScrollButton("start")}${this.renderScrollButton("end")}</div></div>`}renderScrollButton(t){let{messages:e,scale:i,hasOverflowingEndTabTitle:s,hasOverflowingStartTabTitle:n}=this,l=t==="end";return V(t,C`<div class=${f({[c.scrollButton]:!0,[c.scrollBackwardButton]:!l,[c.scrollForwardButton]:l})}><calcite-button .ariaLabel=${l?e.nextTabTitles:e.previousTabTitles} .disabled=${l?!s:!n} icon-flip-rtl=both .iconStart=${l?z.chevronRight:z.chevronLeft} kind=neutral @click=${l?this.scrollToNextTabTitles:this.scrollToPreviousTabTitles} .scale=${i} tabindex=-1></calcite-button></div>`)}};O("calcite-tab-nav",w);export{w as TabNav};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{a as re,b as oe}from"./QYGAMD7I.js";import{a as se}from"./6O654SMC.js";import{b as ne}from"./DQIUIZK3.js";import{a as H,c as L,d as Z,e as ee,f as te,g as w,h as ie}from"./24X2HHFL.js";import{a as J}from"./MSVKJ6XU.js";import"./5K4OZJAZ.js";import{a as C,b as k}from"./FDHY2TZA.js";import"./WTNYMVTD.js";import{a as X}from"./3MSYHFOJ.js";import{a as Q}from"./CNNZUX2A.js";import{a as R}from"./JN6YLTUP.js";import"./2IM7ZZ7U.js";import{a as P}from"./5DM43O3V.js";import"./VMHJHFFS.js";import{b as _,e as q}from"./MZNTLOT7.js";import"./2Q3LQWBY.js";import{I as D,b as K,f as Y,i as j,n as S}from"./RRBGCYLX.js";import{F as y,G as V,H as T,T as G,g as N,h as A,p as I}from"./CGDDFFL3.js";var E=new WeakMap;function pe(d,e){if(!d)return[];let t=K(d,{...Y,includeContainer:!0}).filter(S);return t.push(...e.filter(s=>(E.get(s)?.tabIndex??-1)>=0)),S(d)&&d.tabIndex>=0&&t.push(d),[...new Set(t)]}var fe=(d={})=>_((e,t)=>{let s=P()(e),r=new Set,p=[],h=null,f=-1,m=[],u,O=!1,l,b=null,M=new WeakSet;function g(){return d.getTraversableElements?.()??d.getElements?.()??p}function F(i){let o=E.get(i);!o||!r.delete(i)||(o.referenceCount--,!(o.referenceCount>0)&&(o.attribute===null?i.removeAttribute("tabindex"):i.setAttribute("tabindex",o.attribute),E.delete(i)))}function ae(i){let o=g(),a=i.composedPath(),n=o.find(x=>a.includes(x));n&&(l=n,v.setActiveIndex(o.indexOf(n)))}function le(i){let o=i.composedPath();if(!p.some(n=>o.includes(n)))return;let a=i.relatedTarget;if(b=a,!(a instanceof Node&&g().some(n=>n.contains(a)))){if(a instanceof Element)l=void 0;else if(l){let n=l;queueMicrotask(()=>{l===n&&n.isConnected&&!n.matches(":focus-within")&&g().includes(n)&&(l=void 0)})}}}t.onLoaded(()=>{e.listenOn(e.renderRoot,"focusin",ae),e.listenOn(e.renderRoot,"focusout",le,{capture:!0})}),e.listenOn(e.el.ownerDocument,"focusin",i=>{if(!l&&!b)return;let o=i.composedPath();b&&o.includes(b)&&M.add(i),b=null,l&&!o.includes(l)&&(l=void 0)},{capture:!0}),t.onDisconnected(()=>{l=void 0,b=null,r.forEach(F)});let v={get activeElement(){return h},get activeIndex(){return f},get hasFocus(){return s.hasFocus||(d.getEntryElement?.()?.matches(":focus-within")??!1)},isFocusFromItem(i){return M.has(i)},get isRestoringFocus(){return O},get shouldRecoverFocus(){if(!l)return!1;let i=j(e.el);return!(e.el.ownerDocument.activeElement===e.el.ownerDocument.body||i instanceof ShadowRoot&&!i.activeElement&&i.host.matches(":focus-within"))&&!l.matches(":focus-within")?(l=void 0,!1):!l.isConnected||!g().includes(l)},update(i,o){let a=d.getEntryElement?.();m.forEach(F);let n=s.getFocusableElements(a),x=pe(a,n),ce=x.length>0?x:m.filter(c=>c.isConnected&&a?.contains(c));p=i;let de=d.getTraversableElements?.()??i;f=o&&d.isActive?.()!==!1&&i.includes(o)?de.indexOf(o):-1,h=f>=0?o:null;let he=s.getDeepActiveElement();u=n.find(c=>c===he)??(u&&n.includes(u)?u:n[0]),m=ce;let B=h?[...i,...m]:i,ue=new Set(B);r.forEach(c=>{ue.has(c)||F(c)}),B.forEach(c=>{if(!r.has(c)){let W=E.get(c);W?W.referenceCount++:E.set(c,{attribute:c.getAttribute("tabindex"),tabIndex:c.tabIndex,referenceCount:1}),r.add(c)}let U=c===h?0:-1;c.getAttribute("tabindex")!==String(U)&&(c.tabIndex=U)})},setActiveIndex(i){let o=d.getElements?.()??p,a=d.getTraversableElements?.()??o,n=i>=0?a[i]??null:null;v.update(o,n)},navigate(i){let o=g(),a=o.length;if(!a)return v.setActiveIndex(-1),null;let n=f;return n<0||n>=a?n=i==="previous"||i==="last"?a-1:0:i==="next"?n=(n+1)%a:i==="previous"?n=(n-1+a)%a:i==="first"?n=0:i==="last"&&(n=a-1),v.update(d.getElements?.()??p,o[n]),h},reconcile(){let i=g(),o=h?i.indexOf(h):-1,a=o>=0?o:i.findIndex(n=>n.matches(":focus-within"));return v.setActiveIndex(a>=0?a:Math.min(Math.max(f,0),i.length-1)),h},restoreFocus(i="within"){let o=p.some(s.isFocusedWithin)||m.some(s.isFocusedWithin)||u!==void 0&&s.isFocusedWithin(u);if(!(!(i==="force"||o||i==="recover"&&v.shouldRecoverFocus)||!u||!u.isConnected)){O=!0;try{u.focus(),l=void 0}finally{O=!1}}}};return v}),me={trigger:"trigger"},$={content:"content",wrapper:"wrapper",triggerContainer:"trigger-container"},ve=N`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block}.wrapper{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.wrapper{opacity:0;inset-block-start:0;left:0}}:host([top-layer-disabled]) .wrapper{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown)}.wrapper[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.wrapper:popover-open{display:block}.wrapper .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;border-radius:var(--calcite-corner-radius-sm);z-index:var(--calcite-z-index)}.wrapper[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.wrapper[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.wrapper[data-placement^=left] .calcite-floating-ui-anim{left:5px}.wrapper[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.wrapper .calcite-floating-ui-anim{box-shadow:var(--calcite-shadow-md)}.content{overflow-y:auto;overflow-x:hidden;inline-size:var(--calcite-dropdown-width, var(--calcite-internal-dropdown-width));background-color:var(--calcite-dropdown-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));max-block-size:var(--calcite-dropdown-max-height, 45vh)}.trigger-container{position:relative;display:flex;flex:1 1 auto;block-size:100%;overflow-wrap:break-word;word-break:break-word}.width-s{--calcite-internal-dropdown-width: 12rem}.width-m{--calcite-internal-dropdown-width: 14rem}.width-l{--calcite-internal-dropdown-width: 16rem}@media(forced-colors:active){:host([open]) .wrapper{border:var(--calcite-border-width-sm) solid canvasText}}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}`,be=oe({click:!0,hover:!0}),z=class extends V{constructor(){super(),this.referenceElementController=re({manager:be})(this),this.direction=q(),this.focusLastDropdownItem=!1,this.focusActiveItemOnOpen=!0,this.focusedElementOnOpen=null,this._open=!1,this.groups=[],this.items=[],this.mutationObserver=C("mutation",()=>this.updateItems()),this.transitionProp="opacity",this.resizeObserver=C("resize",e=>this.resizeObserverCallback(e)),this.onReferenceElementKeyDown=e=>this.keyDownHandler(e),this.onReferenceElementFocusIn=e=>this.openHoverDropdown(e),this.onReferenceElementPointerOpen=()=>{this.open||(this.focusActiveItemOnOpen=!1)},this.focusable=P()(this),this.rovingTabIndex=fe({getElements:()=>this.items,getEntryElement:()=>this.referenceEl instanceof Element?this.referenceEl:void 0,getTraversableElements:()=>this.getTraversableItems(),isActive:()=>this.open&&!this.disabled&&this.focusActiveItemOnOpen})(this),this.interactiveContainer=J(this),this.topLayer=X({target:()=>this.floatingEl})(this),this.closeOnSelectDisabled=!1,this.disabled=!1,this.maxItems=0,this.offsetDistance=0,this.offsetSkidding=0,this.overlayPositioning="absolute",this.placement=H,this.scale="m",this.selectedItems=[],this.topLayerDisabled=!1,this.type="click",this.calciteDropdownBeforeClose=I({cancelable:!1}),this.calciteDropdownBeforeOpen=I({cancelable:!1}),this.calciteDropdownClose=I({cancelable:!1}),this.calciteDropdownOpen=I({cancelable:!1}),this.calciteDropdownSelect=I({cancelable:!1}),this.listen("pointerenter",this.pointerEnterHandler),this.listen("pointerleave",this.pointerLeaveHandler),this.listen("calciteInternalDropdownItemSelect",this.handleItemSelect)}static{this.properties={referenceEl:[16,{},{state:!0}],closeOnSelectDisabled:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],flipPlacements:[0,{},{attribute:!1}],maxItems:[11,{},{reflect:!0,type:Number}],offsetDistance:[11,{},{type:Number,reflect:!0}],offsetSkidding:[11,{},{reflect:!0,type:Number}],open:[7,{},{reflect:!0,type:Boolean}],overlayPositioning:[3,{},{reflect:!0}],placement:[3,{},{reflect:!0}],referenceElement:1,scale:[3,{},{reflect:!0}],selectedItems:[0,{},{attribute:!1}],topLayerDisabled:[7,{},{reflect:!0,type:Boolean}],type:[3,{},{reflect:!0}],widthScale:[3,{},{reflect:!0}],width:[3,{},{reflect:!0}]}}static{this.shadowRootOptions={mode:"open",delegatesFocus:!0}}static{this.styles=ve}get referenceElementType(){return this.referenceElement?this.type:void 0}get autoClose(){return!0}get isRestoringFocus(){return this.rovingTabIndex.isRestoringFocus}get open(){return this._open}set open(e){e&&!this._open&&(this.focusedElementOnOpen=this.focusable.getDeepActiveElement()),this._open=e}async reposition(e=!1){let{filteredFlipPlacements:t,floatingEl:s,offsetDistance:r,offsetSkidding:p,overlayPositioning:h,placement:f,referenceEl:m}=this;return ee(this,{direction:this.direction,floatingEl:s,referenceEl:m,offsetDistance:r,offsetSkidding:p,overlayPositioning:h,placement:f,flipPlacements:t,type:"menu"},e)}async setFocus(e){return this.focusable.setFocus(()=>{let t=this.referenceEl instanceof HTMLElement?this.referenceEl:this.floatingEl;return t?{target:t,strategy:"focusable"}:void 0},e)}connectedCallback(){super.connectedCallback(),this.mutationObserver?.observe(this.el,{attributeFilter:["disabled","hidden","inert"],attributes:!0,childList:!0,subtree:!0}),this.setFilteredPlacements(),this.updateItems(),w(this)}load(){this.listenOn(document,"click",this.closeCalciteDropdownOnClick),this.listenOn(document,"calciteDropdownOpen",this.closeCalciteDropdownOnOpenEvent)}willUpdate(e){e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.handleDisabledChange(this.disabled),e.has("open")&&(this.hasUpdated||this.open!==!1)&&this.openHandler(),e.has("flipPlacements")&&this.flipPlacementsHandler(),e.has("maxItems")&&this.hasUpdated&&this.setMaxScrollerHeight(),this.hasUpdated&&(e.has("offsetDistance")&&this.offsetDistance!==0||e.has("offsetSkidding")&&this.offsetSkidding!==0||e.has("overlayPositioning")&&this.overlayPositioning!=="absolute"||e.has("placement")&&this.placement!==H)&&this.reposition(!0),e.has("scale")&&(this.hasUpdated||this.scale!=="m")&&this.handlePropsChange(),e.has("referenceElement")&&!this.referenceElement&&this.open&&this.topLayer.hide()}updated(e){e.has("referenceEl")&&this.referenceElementType&&(this.syncTabStops(),w(this))}loaded(){this.updateSelectedItems(),w(this)}disconnectedCallback(){super.disconnectedCallback(),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect(),ie(this)}openHandler(){if(this.disabled&&this.open){this.open=!1,this.focusActiveItemOnOpen=!0,this.rovingTabIndex.setActiveIndex(-1);return}this.open||(this.focusActiveItemOnOpen=!0),Q(this),this.open||this.rovingTabIndex.setActiveIndex(-1),this.reposition(!0)}handleDisabledChange(e){e&&(this.open=!1,this.rovingTabIndex.setActiveIndex(-1))}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}handlePropsChange(){this.updateItems(),this.updateGroupProps()}closeCalciteDropdownOnClick(e){this.referenceElementType||this.disabled||!this.open||e.composedPath().includes(this.el)||this.closeCalciteDropdown()}closeCalciteDropdownOnOpenEvent(e){this.referenceElementType||e.composedPath().includes(this.el)||this.closeCalciteDropdown()}pointerEnterHandler(){this.referenceElementType||this.disabled||this.type!=="hover"||(this.open||(this.focusActiveItemOnOpen=!1),this.open=!0)}pointerLeaveHandler(){this.referenceElementType||this.disabled||this.type!=="hover"||this.closeCalciteDropdown()}getTraversableItems(){return this.items.filter(e=>!e.disabled&&!e.closest("[hidden], [inert]"))}async handleItemSelect(e){this.updateSelectedItems(),this.syncActiveItemFromTraversableItems();let t=this.focusable.getDeepActiveElement();if(e.stopPropagation(),this.calciteDropdownSelect.emit(),!this.closeOnSelectDisabled)this.closeCalciteDropdown(),this.rovingTabIndex.restoreFocus("recover");else{let{requestedDropdownItem:s}=e.detail,r=this.getTraversableItems().indexOf(s);if(r<0||!s.isConnected){this.updateItems();return}s.matches(":focus-within")&&this.focusable.isFocusUnchanged(t)&&(this.rovingTabIndex.setActiveIndex(r),await this.scrollActiveItemIntoView(s,t))}}setFilteredPlacements(){let{el:e,flipPlacements:t}=this;this.filteredFlipPlacements=t?Z(t,e):void 0}updateItems(){this.items=this.groups.flatMap(e=>Array.from(e.querySelectorAll("calcite-dropdown-item"))),this.updateSelectedItems(),this.syncActiveItemFromTraversableItems(),this.reposition(!0),this.items.forEach(e=>e.scale=this.scale)}updateGroups(e){let t=e.target.assignedElements({flatten:!0}).filter(ne);this.groups=t,this.updateItems(),this.updateGroupProps()}updateGroupProps(){this.groups.forEach((e,t)=>{e.scale=this.scale,e.position=t})}resizeObserverCallback(e){e.forEach(({target:t})=>{t===this.referenceEl?this.setDropdownWidth():t===this.scrollerEl&&this.setMaxScrollerHeight()})}setDropdownWidth(){let{referenceEl:e,scrollerEl:t}=this;!t||!(e instanceof HTMLElement)||(t.style.minWidth=`${e.clientWidth}px`)}setMaxScrollerHeight(){let{maxItems:e,items:t,scrollerEl:s}=this;if(!s)return;let r=t.length>=e&&e>0?this.getYDistanceFromScroller(t.at(e-1)):0;s.style.maxBlockSize=r>0?`${r}px`:"",this.reposition(!0)}setScrollerAndTransitionEl(e){k(this.resizeObserver,this.scrollerEl,e),this.scrollerEl=e,this.transitionEl=e}onBeforeOpen(){this.setInitialActiveItem(),this.calciteDropdownBeforeOpen.emit()}onOpen(){this.calciteDropdownOpen.emit()}onBeforeClose(){this.rovingTabIndex.restoreFocus("recover"),this.calciteDropdownBeforeClose.emit()}onClose(){this.calciteDropdownClose.emit(),te(this),this.topLayer.hide()}setReferenceEl(e){let t=this.referenceEl instanceof HTMLElement?this.referenceEl:void 0,s=e instanceof HTMLElement?e:void 0;k(this.resizeObserver,t,s),!(this.referenceElementType||!s)&&(this.referenceEl=e,this.syncTabStops(),w(this))}setFloatingEl(e){this.floatingEl=e,w(this)}handleTriggerSlotChange(){this.syncTabStops()}keyDownHandler(e){let t=e.composedPath();if(this.disabled||!t.includes(this.floatingEl)&&(!(this.referenceEl instanceof Element)||!t.includes(this.referenceEl)))return;let{defaultPrevented:s,key:r}=e;if(!s){if(this.open&&r==="Escape"){this.closeCalciteDropdown(),this.rovingTabIndex.restoreFocus(),e.preventDefault();return}if(!this.open&&R(r)){this.focusActiveItemOnOpen=!0,this.open=!0,e.preventDefault();return}if(!this.open&&(r==="ArrowDown"||r==="ArrowUp")){e.preventDefault(),this.focusActiveItemOnOpen=!0,this.focusLastDropdownItem=r==="ArrowUp",this.open=!0;return}if(this.open){if(r==="Tab"){this.rovingTabIndex.restoreFocus(),this.closeCalciteDropdown();return}if(r==="ArrowDown"){e.preventDefault(),this.navigateActiveItem("next");return}if(r==="ArrowUp"){e.preventDefault(),this.navigateActiveItem("previous");return}if(r==="Home"){e.preventDefault(),this.navigateActiveItem("first");return}if(r==="End"){e.preventDefault(),this.navigateActiveItem("last");return}R(r)&&(e.preventDefault(),this.activateActiveItem())}}}updateSelectedItems(){this.selectedItems=this.items.filter(e=>e.selected)}getYDistanceFromScroller(e){let{scrollerEl:t}=this;return!e||!t?NaN:e.getBoundingClientRect().bottom-t.getBoundingClientRect().top+t.scrollTop}closeCalciteDropdown(){this.open=!1,this.rovingTabIndex.setActiveIndex(-1)}async setInitialActiveItem(){let e=this.getTraversableItems(),t=this.focusLastDropdownItem?e.length-1:0,s=!e.length&&this.focusLastDropdownItem?"last":void 0;this.focusLastDropdownItem=!1,this.rovingTabIndex.setActiveIndex(e.length?t:-1),await this.topLayer.show(),this.focusActiveItemOnOpen&&await this.scrollActiveItemIntoView(void 0,this.focusedElementOnOpen,s)}syncActiveItemFromTraversableItems(){let e=this.getTraversableItems(),t=this.rovingTabIndex.activeElement,s=this.rovingTabIndex.shouldRecoverFocus;if(!this.open||!e.length){this.rovingTabIndex.setActiveIndex(-1),this.open&&t&&s&&this.rovingTabIndex.restoreFocus("force");return}let r=this.rovingTabIndex.reconcile();t&&r&&s&&this.scrollActiveItemIntoView(r)}syncTabStops(){this.rovingTabIndex.update(this.items,this.rovingTabIndex.activeElement)}handleItemFocus(){this.focusActiveItemOnOpen=!0}handleItemFocusOut(e){!e.relatedTarget&&this.rovingTabIndex.shouldRecoverFocus||this.closeHoverDropdown(e)}navigateActiveItem(e){this.focusActiveItemOnOpen=!0;let t=this.rovingTabIndex.navigate(e);t&&this.scrollActiveItemIntoView(t)}async scrollActiveItemIntoView(e,t=this.focusable.getDeepActiveElement(),s){await this.updateComplete,await D(),await D(),e??=this.rovingTabIndex.activeElement??void 0,!(!e||!this.open||this.rovingTabIndex.activeElement!==e||!e.isConnected||!this.focusable.isFocusUnchanged(t))&&(s&&(e=this.rovingTabIndex.navigate(s)??e),await e.setFocus({preventScroll:!0}),e.scrollIntoView({block:"nearest"}))}activateActiveItem(){let e=this.getTraversableItems(),t=this.rovingTabIndex.activeIndex,s=t>=0&&t<e.length?t:0,r=e[s];r&&(this.rovingTabIndex.setActiveIndex(s),r.activateItem())}openHoverDropdown(e){if(!(this.disabled||this.type!=="hover"||this.isRestoringFocus)&&!(this.rovingTabIndex.isFocusFromItem(e)||e.relatedTarget instanceof Node&&this.el.contains(e.relatedTarget))){if(this.focusActiveItemOnOpen=!0,this.open){this.rovingTabIndex.activeElement||this.rovingTabIndex.setActiveIndex(0),this.scrollActiveItemIntoView(this.rovingTabIndex.activeElement??void 0);return}this.open=!0}}async closeHoverDropdown(e){if(!this.open||this.disabled||this.type!=="hover")return;let t=e.relatedTarget;t&&(this.el.contains(t)||this.referenceEl instanceof Element&&this.referenceEl.contains(t))||t instanceof Element&&t.shadowRoot&&(await D(),!this.open||this.rovingTabIndex.hasFocus)||this.closeCalciteDropdown()}toggleClickDropdown(){this.disabled||this.type!=="click"||(this.focusActiveItemOnOpen=!0,this.open=!this.open)}render(){let{open:e}=this;return this.interactiveContainer({disabled:this.disabled,children:A`${this.referenceElementType?null:A`<div class=${T($.triggerContainer)} @click=${this.toggleClickDropdown} @focusin=${this.openHoverDropdown} @focusout=${this.closeHoverDropdown} @keydown=${this.keyDownHandler} ${y(this.setReferenceEl)}><slot .ariaControlsElements=${this.scrollerEl?[this.scrollerEl]:void 0} .ariaExpanded=${e} aria-haspopup=menu name=${me.trigger} @slotchange=${this.handleTriggerSlotChange}></slot></div>`}<div class=${T({[$.wrapper]:!0,[se("width",this.width,this.widthScale)]:!!(this.width||this.widthScale)})} .inert=${!e} @focusin=${this.handleItemFocus} @focusout=${this.handleItemFocusOut} @keydown=${this.keyDownHandler} popover=manual ${y(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl instanceof HTMLElement?[this.referenceEl]:void 0} class=${T({[$.content]:!0,[L.animation]:!0,[L.animationActive]:e})} role=menu ${y(this.setScrollerAndTransitionEl)}><slot @slotchange=${this.updateGroups}></slot></div></div>`})}};G("calcite-dropdown",z);export{z as Dropdown};
|
|
2
|
+
import{a as re,b as oe}from"./SRMVWG4Z.js";import{a as se}from"./6O654SMC.js";import{b as ne}from"./DQIUIZK3.js";import{a as H,c as L,d as Z,e as ee,f as te,g as w,h as ie}from"./ZWR4O2UJ.js";import{a as J}from"./BR4RLRT5.js";import"./5K4OZJAZ.js";import{a as C,b as k}from"./FDHY2TZA.js";import"./WTNYMVTD.js";import{a as X}from"./EPWZ7QTA.js";import{a as Q}from"./CNNZUX2A.js";import{a as R}from"./JN6YLTUP.js";import"./2IM7ZZ7U.js";import{a as P}from"./JILNBALR.js";import"./VMHJHFFS.js";import{b as _,e as q}from"./F2BJVH7K.js";import"./2TBTDQ4L.js";import{I as D,b as K,f as Y,i as j,n as S}from"./RRBGCYLX.js";import{F as y,G as V,H as T,T as G,g as N,h as A,p as I}from"./ZRF26RQK.js";var E=new WeakMap;function pe(d,e){if(!d)return[];let t=K(d,{...Y,includeContainer:!0}).filter(S);return t.push(...e.filter(s=>(E.get(s)?.tabIndex??-1)>=0)),S(d)&&d.tabIndex>=0&&t.push(d),[...new Set(t)]}var fe=(d={})=>_((e,t)=>{let s=P()(e),r=new Set,p=[],h=null,f=-1,m=[],u,O=!1,l,b=null,M=new WeakSet;function g(){return d.getTraversableElements?.()??d.getElements?.()??p}function F(i){let o=E.get(i);!o||!r.delete(i)||(o.referenceCount--,!(o.referenceCount>0)&&(o.attribute===null?i.removeAttribute("tabindex"):i.setAttribute("tabindex",o.attribute),E.delete(i)))}function ae(i){let o=g(),a=i.composedPath(),n=o.find(x=>a.includes(x));n&&(l=n,v.setActiveIndex(o.indexOf(n)))}function le(i){let o=i.composedPath();if(!p.some(n=>o.includes(n)))return;let a=i.relatedTarget;if(b=a,!(a instanceof Node&&g().some(n=>n.contains(a)))){if(a instanceof Element)l=void 0;else if(l){let n=l;queueMicrotask(()=>{l===n&&n.isConnected&&!n.matches(":focus-within")&&g().includes(n)&&(l=void 0)})}}}t.onLoaded(()=>{e.listenOn(e.renderRoot,"focusin",ae),e.listenOn(e.renderRoot,"focusout",le,{capture:!0})}),e.listenOn(e.el.ownerDocument,"focusin",i=>{if(!l&&!b)return;let o=i.composedPath();b&&o.includes(b)&&M.add(i),b=null,l&&!o.includes(l)&&(l=void 0)},{capture:!0}),t.onDisconnected(()=>{l=void 0,b=null,r.forEach(F)});let v={get activeElement(){return h},get activeIndex(){return f},get hasFocus(){return s.hasFocus||(d.getEntryElement?.()?.matches(":focus-within")??!1)},isFocusFromItem(i){return M.has(i)},get isRestoringFocus(){return O},get shouldRecoverFocus(){if(!l)return!1;let i=j(e.el);return!(e.el.ownerDocument.activeElement===e.el.ownerDocument.body||i instanceof ShadowRoot&&!i.activeElement&&i.host.matches(":focus-within"))&&!l.matches(":focus-within")?(l=void 0,!1):!l.isConnected||!g().includes(l)},update(i,o){let a=d.getEntryElement?.();m.forEach(F);let n=s.getFocusableElements(a),x=pe(a,n),ce=x.length>0?x:m.filter(c=>c.isConnected&&a?.contains(c));p=i;let de=d.getTraversableElements?.()??i;f=o&&d.isActive?.()!==!1&&i.includes(o)?de.indexOf(o):-1,h=f>=0?o:null;let he=s.getDeepActiveElement();u=n.find(c=>c===he)??(u&&n.includes(u)?u:n[0]),m=ce;let B=h?[...i,...m]:i,ue=new Set(B);r.forEach(c=>{ue.has(c)||F(c)}),B.forEach(c=>{if(!r.has(c)){let W=E.get(c);W?W.referenceCount++:E.set(c,{attribute:c.getAttribute("tabindex"),tabIndex:c.tabIndex,referenceCount:1}),r.add(c)}let U=c===h?0:-1;c.getAttribute("tabindex")!==String(U)&&(c.tabIndex=U)})},setActiveIndex(i){let o=d.getElements?.()??p,a=d.getTraversableElements?.()??o,n=i>=0?a[i]??null:null;v.update(o,n)},navigate(i){let o=g(),a=o.length;if(!a)return v.setActiveIndex(-1),null;let n=f;return n<0||n>=a?n=i==="previous"||i==="last"?a-1:0:i==="next"?n=(n+1)%a:i==="previous"?n=(n-1+a)%a:i==="first"?n=0:i==="last"&&(n=a-1),v.update(d.getElements?.()??p,o[n]),h},reconcile(){let i=g(),o=h?i.indexOf(h):-1,a=o>=0?o:i.findIndex(n=>n.matches(":focus-within"));return v.setActiveIndex(a>=0?a:Math.min(Math.max(f,0),i.length-1)),h},restoreFocus(i="within"){let o=p.some(s.isFocusedWithin)||m.some(s.isFocusedWithin)||u!==void 0&&s.isFocusedWithin(u);if(!(!(i==="force"||o||i==="recover"&&v.shouldRecoverFocus)||!u||!u.isConnected)){O=!0;try{u.focus(),l=void 0}finally{O=!1}}}};return v}),me={trigger:"trigger"},$={content:"content",wrapper:"wrapper",triggerContainer:"trigger-container"},ve=N`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block}.wrapper{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.wrapper{opacity:0;inset-block-start:0;left:0}}:host([top-layer-disabled]) .wrapper{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown)}.wrapper[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.wrapper:popover-open{display:block}.wrapper .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;border-radius:var(--calcite-corner-radius-sm);z-index:var(--calcite-z-index)}.wrapper[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.wrapper[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.wrapper[data-placement^=left] .calcite-floating-ui-anim{left:5px}.wrapper[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.wrapper .calcite-floating-ui-anim{box-shadow:var(--calcite-shadow-md)}.content{overflow-y:auto;overflow-x:hidden;inline-size:var(--calcite-dropdown-width, var(--calcite-internal-dropdown-width));background-color:var(--calcite-dropdown-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));max-block-size:var(--calcite-dropdown-max-height, 45vh)}.trigger-container{position:relative;display:flex;flex:1 1 auto;block-size:100%;overflow-wrap:break-word;word-break:break-word}.width-s{--calcite-internal-dropdown-width: 12rem}.width-m{--calcite-internal-dropdown-width: 14rem}.width-l{--calcite-internal-dropdown-width: 16rem}@media(forced-colors:active){:host([open]) .wrapper{border:var(--calcite-border-width-sm) solid canvasText}}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}`,be=oe({click:!0,hover:!0}),z=class extends V{constructor(){super(),this.referenceElementController=re({manager:be})(this),this.direction=q(),this.focusLastDropdownItem=!1,this.focusActiveItemOnOpen=!0,this.focusedElementOnOpen=null,this._open=!1,this.groups=[],this.items=[],this.mutationObserver=C("mutation",()=>this.updateItems()),this.transitionProp="opacity",this.resizeObserver=C("resize",e=>this.resizeObserverCallback(e)),this.onReferenceElementKeyDown=e=>this.keyDownHandler(e),this.onReferenceElementFocusIn=e=>this.openHoverDropdown(e),this.onReferenceElementPointerOpen=()=>{this.open||(this.focusActiveItemOnOpen=!1)},this.focusable=P()(this),this.rovingTabIndex=fe({getElements:()=>this.items,getEntryElement:()=>this.referenceEl instanceof Element?this.referenceEl:void 0,getTraversableElements:()=>this.getTraversableItems(),isActive:()=>this.open&&!this.disabled&&this.focusActiveItemOnOpen})(this),this.interactiveContainer=J(this),this.topLayer=X({target:()=>this.floatingEl})(this),this.closeOnSelectDisabled=!1,this.disabled=!1,this.maxItems=0,this.offsetDistance=0,this.offsetSkidding=0,this.overlayPositioning="absolute",this.placement=H,this.scale="m",this.selectedItems=[],this.topLayerDisabled=!1,this.type="click",this.calciteDropdownBeforeClose=I({cancelable:!1}),this.calciteDropdownBeforeOpen=I({cancelable:!1}),this.calciteDropdownClose=I({cancelable:!1}),this.calciteDropdownOpen=I({cancelable:!1}),this.calciteDropdownSelect=I({cancelable:!1}),this.listen("pointerenter",this.pointerEnterHandler),this.listen("pointerleave",this.pointerLeaveHandler),this.listen("calciteInternalDropdownItemSelect",this.handleItemSelect)}static{this.properties={referenceEl:[16,{},{state:!0}],closeOnSelectDisabled:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],flipPlacements:[0,{},{attribute:!1}],maxItems:[11,{},{reflect:!0,type:Number}],offsetDistance:[11,{},{type:Number,reflect:!0}],offsetSkidding:[11,{},{reflect:!0,type:Number}],open:[7,{},{reflect:!0,type:Boolean}],overlayPositioning:[3,{},{reflect:!0}],placement:[3,{},{reflect:!0}],referenceElement:1,scale:[3,{},{reflect:!0}],selectedItems:[0,{},{attribute:!1}],topLayerDisabled:[7,{},{reflect:!0,type:Boolean}],type:[3,{},{reflect:!0}],widthScale:[3,{},{reflect:!0}],width:[3,{},{reflect:!0}]}}static{this.shadowRootOptions={mode:"open",delegatesFocus:!0}}static{this.styles=ve}get referenceElementType(){return this.referenceElement?this.type:void 0}get autoClose(){return!0}get isRestoringFocus(){return this.rovingTabIndex.isRestoringFocus}get open(){return this._open}set open(e){e&&!this._open&&(this.focusedElementOnOpen=this.focusable.getDeepActiveElement()),this._open=e}async reposition(e=!1){let{filteredFlipPlacements:t,floatingEl:s,offsetDistance:r,offsetSkidding:p,overlayPositioning:h,placement:f,referenceEl:m}=this;return ee(this,{direction:this.direction,floatingEl:s,referenceEl:m,offsetDistance:r,offsetSkidding:p,overlayPositioning:h,placement:f,flipPlacements:t,type:"menu"},e)}async setFocus(e){return this.focusable.setFocus(()=>{let t=this.referenceEl instanceof HTMLElement?this.referenceEl:this.floatingEl;return t?{target:t,strategy:"focusable"}:void 0},e)}connectedCallback(){super.connectedCallback(),this.mutationObserver?.observe(this.el,{attributeFilter:["disabled","hidden","inert"],attributes:!0,childList:!0,subtree:!0}),this.setFilteredPlacements(),this.updateItems(),w(this)}load(){this.listenOn(document,"click",this.closeCalciteDropdownOnClick),this.listenOn(document,"calciteDropdownOpen",this.closeCalciteDropdownOnOpenEvent)}willUpdate(e){e.has("disabled")&&(this.hasUpdated||this.disabled!==!1)&&this.handleDisabledChange(this.disabled),e.has("open")&&(this.hasUpdated||this.open!==!1)&&this.openHandler(),e.has("flipPlacements")&&this.flipPlacementsHandler(),e.has("maxItems")&&this.hasUpdated&&this.setMaxScrollerHeight(),this.hasUpdated&&(e.has("offsetDistance")&&this.offsetDistance!==0||e.has("offsetSkidding")&&this.offsetSkidding!==0||e.has("overlayPositioning")&&this.overlayPositioning!=="absolute"||e.has("placement")&&this.placement!==H)&&this.reposition(!0),e.has("scale")&&(this.hasUpdated||this.scale!=="m")&&this.handlePropsChange(),e.has("referenceElement")&&!this.referenceElement&&this.open&&this.topLayer.hide()}updated(e){e.has("referenceEl")&&this.referenceElementType&&(this.syncTabStops(),w(this))}loaded(){this.updateSelectedItems(),w(this)}disconnectedCallback(){super.disconnectedCallback(),this.mutationObserver?.disconnect(),this.resizeObserver?.disconnect(),ie(this)}openHandler(){if(this.disabled&&this.open){this.open=!1,this.focusActiveItemOnOpen=!0,this.rovingTabIndex.setActiveIndex(-1);return}this.open||(this.focusActiveItemOnOpen=!0),Q(this),this.open||this.rovingTabIndex.setActiveIndex(-1),this.reposition(!0)}handleDisabledChange(e){e&&(this.open=!1,this.rovingTabIndex.setActiveIndex(-1))}flipPlacementsHandler(){this.setFilteredPlacements(),this.reposition(!0)}handlePropsChange(){this.updateItems(),this.updateGroupProps()}closeCalciteDropdownOnClick(e){this.referenceElementType||this.disabled||!this.open||e.composedPath().includes(this.el)||this.closeCalciteDropdown()}closeCalciteDropdownOnOpenEvent(e){this.referenceElementType||e.composedPath().includes(this.el)||this.closeCalciteDropdown()}pointerEnterHandler(){this.referenceElementType||this.disabled||this.type!=="hover"||(this.open||(this.focusActiveItemOnOpen=!1),this.open=!0)}pointerLeaveHandler(){this.referenceElementType||this.disabled||this.type!=="hover"||this.closeCalciteDropdown()}getTraversableItems(){return this.items.filter(e=>!e.disabled&&!e.closest("[hidden], [inert]"))}async handleItemSelect(e){this.updateSelectedItems(),this.syncActiveItemFromTraversableItems();let t=this.focusable.getDeepActiveElement();if(e.stopPropagation(),this.calciteDropdownSelect.emit(),!this.closeOnSelectDisabled)this.closeCalciteDropdown(),this.rovingTabIndex.restoreFocus("recover");else{let{requestedDropdownItem:s}=e.detail,r=this.getTraversableItems().indexOf(s);if(r<0||!s.isConnected){this.updateItems();return}s.matches(":focus-within")&&this.focusable.isFocusUnchanged(t)&&(this.rovingTabIndex.setActiveIndex(r),await this.scrollActiveItemIntoView(s,t))}}setFilteredPlacements(){let{el:e,flipPlacements:t}=this;this.filteredFlipPlacements=t?Z(t,e):void 0}updateItems(){this.items=this.groups.flatMap(e=>Array.from(e.querySelectorAll("calcite-dropdown-item"))),this.updateSelectedItems(),this.syncActiveItemFromTraversableItems(),this.reposition(!0),this.items.forEach(e=>e.scale=this.scale)}updateGroups(e){let t=e.target.assignedElements({flatten:!0}).filter(ne);this.groups=t,this.updateItems(),this.updateGroupProps()}updateGroupProps(){this.groups.forEach((e,t)=>{e.scale=this.scale,e.position=t})}resizeObserverCallback(e){e.forEach(({target:t})=>{t===this.referenceEl?this.setDropdownWidth():t===this.scrollerEl&&this.setMaxScrollerHeight()})}setDropdownWidth(){let{referenceEl:e,scrollerEl:t}=this;!t||!(e instanceof HTMLElement)||(t.style.minWidth=`${e.clientWidth}px`)}setMaxScrollerHeight(){let{maxItems:e,items:t,scrollerEl:s}=this;if(!s)return;let r=t.length>=e&&e>0?this.getYDistanceFromScroller(t.at(e-1)):0;s.style.maxBlockSize=r>0?`${r}px`:"",this.reposition(!0)}setScrollerAndTransitionEl(e){k(this.resizeObserver,this.scrollerEl,e),this.scrollerEl=e,this.transitionEl=e}onBeforeOpen(){this.setInitialActiveItem(),this.calciteDropdownBeforeOpen.emit()}onOpen(){this.calciteDropdownOpen.emit()}onBeforeClose(){this.rovingTabIndex.restoreFocus("recover"),this.calciteDropdownBeforeClose.emit()}onClose(){this.calciteDropdownClose.emit(),te(this),this.topLayer.hide()}setReferenceEl(e){let t=this.referenceEl instanceof HTMLElement?this.referenceEl:void 0,s=e instanceof HTMLElement?e:void 0;k(this.resizeObserver,t,s),!(this.referenceElementType||!s)&&(this.referenceEl=e,this.syncTabStops(),w(this))}setFloatingEl(e){this.floatingEl=e,w(this)}handleTriggerSlotChange(){this.syncTabStops()}keyDownHandler(e){let t=e.composedPath();if(this.disabled||!t.includes(this.floatingEl)&&(!(this.referenceEl instanceof Element)||!t.includes(this.referenceEl)))return;let{defaultPrevented:s,key:r}=e;if(!s){if(this.open&&r==="Escape"){this.closeCalciteDropdown(),this.rovingTabIndex.restoreFocus(),e.preventDefault();return}if(!this.open&&R(r)){this.focusActiveItemOnOpen=!0,this.open=!0,e.preventDefault();return}if(!this.open&&(r==="ArrowDown"||r==="ArrowUp")){e.preventDefault(),this.focusActiveItemOnOpen=!0,this.focusLastDropdownItem=r==="ArrowUp",this.open=!0;return}if(this.open){if(r==="Tab"){this.rovingTabIndex.restoreFocus(),this.closeCalciteDropdown();return}if(r==="ArrowDown"){e.preventDefault(),this.navigateActiveItem("next");return}if(r==="ArrowUp"){e.preventDefault(),this.navigateActiveItem("previous");return}if(r==="Home"){e.preventDefault(),this.navigateActiveItem("first");return}if(r==="End"){e.preventDefault(),this.navigateActiveItem("last");return}R(r)&&(e.preventDefault(),this.activateActiveItem())}}}updateSelectedItems(){this.selectedItems=this.items.filter(e=>e.selected)}getYDistanceFromScroller(e){let{scrollerEl:t}=this;return!e||!t?NaN:e.getBoundingClientRect().bottom-t.getBoundingClientRect().top+t.scrollTop}closeCalciteDropdown(){this.open=!1,this.rovingTabIndex.setActiveIndex(-1)}async setInitialActiveItem(){let e=this.getTraversableItems(),t=this.focusLastDropdownItem?e.length-1:0,s=!e.length&&this.focusLastDropdownItem?"last":void 0;this.focusLastDropdownItem=!1,this.rovingTabIndex.setActiveIndex(e.length?t:-1),await this.topLayer.show(),this.focusActiveItemOnOpen&&await this.scrollActiveItemIntoView(void 0,this.focusedElementOnOpen,s)}syncActiveItemFromTraversableItems(){let e=this.getTraversableItems(),t=this.rovingTabIndex.activeElement,s=this.rovingTabIndex.shouldRecoverFocus;if(!this.open||!e.length){this.rovingTabIndex.setActiveIndex(-1),this.open&&t&&s&&this.rovingTabIndex.restoreFocus("force");return}let r=this.rovingTabIndex.reconcile();t&&r&&s&&this.scrollActiveItemIntoView(r)}syncTabStops(){this.rovingTabIndex.update(this.items,this.rovingTabIndex.activeElement)}handleItemFocus(){this.focusActiveItemOnOpen=!0}handleItemFocusOut(e){!e.relatedTarget&&this.rovingTabIndex.shouldRecoverFocus||this.closeHoverDropdown(e)}navigateActiveItem(e){this.focusActiveItemOnOpen=!0;let t=this.rovingTabIndex.navigate(e);t&&this.scrollActiveItemIntoView(t)}async scrollActiveItemIntoView(e,t=this.focusable.getDeepActiveElement(),s){await this.updateComplete,await D(),await D(),e??=this.rovingTabIndex.activeElement??void 0,!(!e||!this.open||this.rovingTabIndex.activeElement!==e||!e.isConnected||!this.focusable.isFocusUnchanged(t))&&(s&&(e=this.rovingTabIndex.navigate(s)??e),await e.setFocus({preventScroll:!0}),e.scrollIntoView({block:"nearest"}))}activateActiveItem(){let e=this.getTraversableItems(),t=this.rovingTabIndex.activeIndex,s=t>=0&&t<e.length?t:0,r=e[s];r&&(this.rovingTabIndex.setActiveIndex(s),r.activateItem())}openHoverDropdown(e){if(!(this.disabled||this.type!=="hover"||this.isRestoringFocus)&&!(this.rovingTabIndex.isFocusFromItem(e)||e.relatedTarget instanceof Node&&this.el.contains(e.relatedTarget))){if(this.focusActiveItemOnOpen=!0,this.open){this.rovingTabIndex.activeElement||this.rovingTabIndex.setActiveIndex(0),this.scrollActiveItemIntoView(this.rovingTabIndex.activeElement??void 0);return}this.open=!0}}async closeHoverDropdown(e){if(!this.open||this.disabled||this.type!=="hover")return;let t=e.relatedTarget;t&&(this.el.contains(t)||this.referenceEl instanceof Element&&this.referenceEl.contains(t))||t instanceof Element&&t.shadowRoot&&(await D(),!this.open||this.rovingTabIndex.hasFocus)||this.closeCalciteDropdown()}toggleClickDropdown(){this.disabled||this.type!=="click"||(this.focusActiveItemOnOpen=!0,this.open=!this.open)}render(){let{open:e}=this;return this.interactiveContainer({disabled:this.disabled,children:A`${this.referenceElementType?null:A`<div class=${T($.triggerContainer)} @click=${this.toggleClickDropdown} @focusin=${this.openHoverDropdown} @focusout=${this.closeHoverDropdown} @keydown=${this.keyDownHandler} ${y(this.setReferenceEl)}><slot .ariaControlsElements=${this.scrollerEl?[this.scrollerEl]:void 0} .ariaExpanded=${e} aria-haspopup=menu name=${me.trigger} @slotchange=${this.handleTriggerSlotChange}></slot></div>`}<div class=${T({[$.wrapper]:!0,[se("width",this.width,this.widthScale)]:!!(this.width||this.widthScale)})} .inert=${!e} @focusin=${this.handleItemFocus} @focusout=${this.handleItemFocusOut} @keydown=${this.keyDownHandler} popover=manual ${y(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl instanceof HTMLElement?[this.referenceEl]:void 0} class=${T({[$.content]:!0,[L.animation]:!0,[L.animationActive]:e})} role=menu ${y(this.setScrollerAndTransitionEl)}><slot @slotchange=${this.updateGroups}></slot></div></div>`})}};G("calcite-dropdown",z);export{z as Dropdown};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{d as I}from"./BBSSYLOF.js";import{b as D}from"./WTNYMVTD.js";import"./2IM7ZZ7U.js";import{A as w,g as m,q as T}from"./RRBGCYLX.js";import{G as A,K as C,T as M,g as b,h as S,p as E}from"./
|
|
2
|
+
import{d as I}from"./BBSSYLOF.js";import{b as D}from"./WTNYMVTD.js";import"./2IM7ZZ7U.js";import{A as w,g as m,q as T}from"./RRBGCYLX.js";import{G as A,K as C,T as M,g as b,h as S,p as E}from"./ZRF26RQK.js";function k(g){return Array.from(g.querySelectorAll("calcite-tree-item:not([disabled])")).filter(e=>{let t=e;for(;t!==g&&t!==null;){let s=t.parentElement;if(!(!I(s)||!s.hasChildren||s.expanded))return!1;t=t.parentElement}return!0})}var O=b`:host{display:block}:host(:focus){outline:var(--calcite-border-width-md) solid transparent;outline-offset:var(--calcite-border-width-md)}:host([hidden]){display:none}[hidden]{display:none}`,y=class extends A{constructor(){super(),this.items=[],this.child=!1,this.lines=!1,this.parentExpanded=!1,this.scale="m",this.selectedItems=[],this.selectionMode="single",this.calciteTreeSelect=E({cancelable:!1}),this.listen("focus",this.onFocus),this.listen("focusin",this.onFocusIn),this.listen("focusout",this.onFocusOut),this.listen("calciteInternalTreeItemSelect",this.onInternalTreeItemSelect),this.listen("keydown",this.keyDownHandler)}static{this.properties={child:[7,{},{reflect:!0,type:Boolean}],lines:[7,{},{reflect:!0,type:Boolean}],parentExpanded:[5,{},{type:Boolean}],scale:[3,{},{reflect:!0}],selectedItems:[0,{},{attribute:!1}],selectionMode:[3,{},{reflect:!0}]}}static{this.styles=O}willUpdate(e){e.has("parentExpanded")&&(this.hasUpdated||this.parentExpanded!==!1)&&this.updateItems();let t=this.el.parentElement?.closest("calcite-tree")??void 0;this.lines=t?t.lines:this.lines,this.scale=t?t.scale:this.scale,this.selectionMode=t?t.selectionMode:this.selectionMode,this.child=!!t}onFocus(){if(!this.child){let e=(this.el.querySelector("calcite-tree-item[selected]:not([disabled])")||this.el.querySelector("calcite-tree-item:not([disabled])"))??void 0;T(e,!0,"focusable")}}onFocusIn(e){(e.relatedTarget===this.el||!this.el.contains(e.relatedTarget))&&this.el.removeAttribute("tabindex")}onFocusOut(e){!this.el.contains(e.relatedTarget)&&(this.el.tabIndex=this.getRootTabIndex())}onInternalTreeItemSelect(e){if(this.child)return;let t=e.target,s=m(t.querySelectorAll("calcite-tree-item")),r=this.selectionMode==="none",n=r?[]:this.getSelectedItems();if(e.preventDefault(),e.stopPropagation(),this.selectionMode==="ancestors"){this.updateAncestorTree(e,n);return}let l=this.selectionMode!==null&&(!t.hasChildren||t.hasChildren&&(this.selectionMode==="children"||this.selectionMode==="multichildren")),c=this.selectionMode==="multichildren"&&t.hasChildren,d=!r&&e.detail.modifyCurrentSelection&&(this.selectionMode==="multiple"||this.selectionMode==="multichildren"),x=!d&&((this.selectionMode==="single"||this.selectionMode==="multiple")&&s.length<=0||this.selectionMode==="children"||this.selectionMode==="multichildren"||this.selectionMode==="single-persist"&&!t.hasChildren),h=["multiple","none","single","single-persist"].includes(this.selectionMode)&&t.hasChildren,a=[];l&&a.push(t),x&&m(this.el.querySelectorAll("calcite-tree-item[selected]")).forEach(o=>{a.includes(o)||(o.selected=!1)}),h&&["multiple","none","single","single-persist"].includes(this.selectionMode)&&(t.expanded=!t.expanded),c&&s.forEach(i=>{i.selected=!1,i.hasChildren&&(i.expanded=!1)}),d&&window.getSelection().removeAllRanges(),d&&t.selected?a.forEach(i=>{i.disabled||(i.selected=!1)}):r||a.forEach(i=>{i.disabled||(i.selected=this.selectionMode!=="single"||!i.selected)}),this.selectedItems=r?[]:this.getSelectedItems(),this.selectionChanged(n)&&this.calciteTreeSelect.emit(),e.stopPropagation()}keyDownHandler(e){if(this.child)return;let t=this.el,s=e.target,r=["ArrowRight","ArrowDown","ArrowLeft","ArrowUp","Home","End","Tab"];if(!(I(s)&&this.el.contains(s))||!r.includes(e.key))return;let n=k(t);if(e.key==="Tab"){n.forEach(l=>l.tabIndex=-1);return}if(e.key==="ArrowDown"){let l=n.indexOf(s);n[l+1]?.focus(),e.preventDefault();return}if(e.key==="ArrowUp"){let l=n.indexOf(s);n[l-1]?.focus(),e.preventDefault();return}if(e.key==="ArrowLeft"){if(s.hasChildren&&s.expanded){s.expanded=!1,e.preventDefault();return}n.slice(0,n.indexOf(s)).reverse().find(d=>d.depth===s.depth-1)?.focus(),e.preventDefault();return}if(e.key==="ArrowRight"){if(!s.disabled&&s.hasChildren)if(!s.expanded)s.expanded=!0,e.preventDefault();else{let l=n.indexOf(s);n[l+1]?.focus(),e.preventDefault()}return}if(e.key==="Home"){let l=n.shift();l&&(l.focus(),e.preventDefault());return}if(e.key==="End"){let l=n.pop();l&&(l.focus(),e.preventDefault());return}}updateAncestorTree(e,t){let s=e.target,r=e.detail.updateItem;if(s.disabled||s.indeterminate&&!r)return;let n=[],l=s.parentElement.closest("calcite-tree-item");for(;l;)n.push(l),l=l.parentElement.closest("calcite-tree-item");let c=Array.from(s.querySelectorAll("calcite-tree-item:not([disabled])")),d=c.filter(i=>!i.hasChildren),x=c.filter(i=>i.hasChildren),h;r?h=s.hasChildren?!(s.selected||s.indeterminate):!s.selected:h=s.selected,d.forEach(i=>{i.selected=h,i.indeterminate=!1});function a(i,o){let u=i.filter(f=>f.selected),p=i.filter(f=>!f.selected);o.selected=u.length===i.length,o.indeterminate=u.length>0&&p.length>0}x.reverse().forEach(i=>{let o=Array.from(i.querySelectorAll(":scope > calcite-tree > calcite-tree-item"));a(o,i)}),r&&(s.hasChildren?a(c,s):(s.selected=h,s.indeterminate=!1)),n.forEach(i=>{let o=m(i.querySelectorAll("calcite-tree-item")),u=o.filter(f=>f.selected);if(u.length===0){i.selected=!1,i.indeterminate=!1;return}let p=u.length<o.length;i.indeterminate=p,i.selected=!p}),this.selectedItems=this.getSelectedItems(),r&&this.selectionChanged(t)&&this.calciteTreeSelect.emit()}getSelectedItems(){return m(this.el.querySelectorAll("calcite-tree-item")).filter(e=>e.selected)}selectionChanged(e){return e.length!==this.selectedItems.length||this.selectedItems.some(t=>!e.includes(t))}updateItems(){this.items.forEach(e=>e.parentExpanded=this.parentExpanded)}handleDefaultSlotChange(e){let t=w(e).filter(I);this.items=t,this.updateItems()}getRootTabIndex(){return this.child?-1:0}render(){let e=!this.child,t=this.selectionMode==="multiple"||this.selectionMode==="multichildren";return this.el.ariaMultiSelectable=D(e&&t,e?"false":null),this.el.role=this.child?null:"tree",C(this.el,"tabIndex",this.getRootTabIndex()),S`<slot @slotchange=${this.handleDefaultSlotChange}></slot>`}};M("calcite-tree",y);export{y as Tree};
|