@esri/calcite-components 5.0.0-next.5 → 5.0.0-next.7
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/calcite/{SGJU36YV.js → 24UNOSYB.js} +2 -2
- package/dist/calcite/{AUIOWPFN.js → 2ECRIOED.js} +2 -2
- package/dist/calcite/{Q3MUDXRY.js → 2HYBRHEU.js} +2 -2
- package/dist/calcite/{DJVVGNTK.js → 2IQPS5BW.js} +1 -1
- package/dist/calcite/{PU5TGCQG.js → 2KVMN7YW.js} +2 -2
- package/dist/calcite/{ROWPIQLT.js → 2OCIK6EF.js} +2 -2
- package/dist/calcite/{HU4SHWE7.js → 2RX7VGW7.js} +2 -2
- package/dist/calcite/{LRKWQ3C3.js → 35ODAW6Y.js} +2 -2
- package/dist/calcite/{X374PRV7.js → 3BUYFS42.js} +2 -2
- package/dist/calcite/{RND3V33U.js → 3DKJFWNF.js} +1 -1
- package/dist/calcite/{QFT74HW3.js → 3HF47TJO.js} +2 -2
- package/dist/calcite/{LROCCBRV.js → 3I3IVUOR.js} +2 -2
- package/dist/calcite/{Q2GRCTSJ.js → 3ND3NKAM.js} +2 -2
- package/dist/calcite/{2VKJIYLT.js → 3Y3BABEA.js} +1 -1
- package/dist/calcite/{6VQ5IL36.js → 4I7T7O63.js} +2 -2
- package/dist/calcite/{YSP6WWQB.js → 4PHM5LVD.js} +1 -1
- package/dist/calcite/{7QP5BUGE.js → 4VLHPNAN.js} +2 -2
- package/dist/calcite/{BNKVQYLQ.js → 4ZGFBBWU.js} +2 -2
- package/dist/calcite/{F6EDNLSI.js → 54C7JZCX.js} +2 -2
- package/dist/calcite/{IEL7YV5C.js → 5CNBXVWP.js} +2 -2
- package/dist/calcite/{2GG4AF5T.js → 5RCYTHKP.js} +1 -1
- package/dist/calcite/{2KH3AUCG.js → 63DWWG4C.js} +2 -2
- package/dist/calcite/{4JZMONLD.js → 64ADIWEN.js} +2 -2
- package/dist/calcite/{OCT7LR2O.js → 6LFC7HO5.js} +1 -1
- package/dist/calcite/{3NOZ7M75.js → 6PCOKKOU.js} +2 -2
- package/dist/calcite/{H5DKF7F3.js → 6V5G43HO.js} +2 -2
- package/dist/calcite/{BEUZYBM5.js → 6YPBRY3A.js} +2 -2
- package/dist/calcite/{C2X6VADY.js → 76NBXXTM.js} +2 -2
- package/dist/calcite/{BHU252WA.js → 77YWD3SD.js} +2 -2
- package/dist/calcite/{VKRWRFEJ.js → 7AGPEFKM.js} +2 -2
- package/dist/calcite/{3KUVOQAL.js → 7EYTTVZ5.js} +2 -2
- package/dist/calcite/{62OUMNJ6.js → 7IYMG4ER.js} +2 -2
- package/dist/calcite/{KRHM7ACI.js → 7LUAHEOY.js} +2 -2
- package/dist/calcite/{FZIUTVKD.js → 7RLP2DKK.js} +1 -1
- package/dist/calcite/{2HKRJLBG.js → 7TMYLJNL.js} +2 -2
- package/dist/calcite/{ZAQTILTS.js → 7TUINXH2.js} +2 -2
- package/dist/calcite/{KH3UKQ2D.js → 7ZHPTFVA.js} +2 -2
- package/dist/calcite/{ALDDSDTX.js → AD2NNFBJ.js} +1 -1
- package/dist/calcite/{5K2Z2TMW.js → AK3MQKBH.js} +2 -2
- package/dist/calcite/{NU57UAAO.js → AKL3TSYT.js} +1 -1
- package/dist/calcite/{NLYYOFNV.js → ALBSZ4AH.js} +1 -1
- package/dist/calcite/{N7OO7R2S.js → ATPINFYW.js} +2 -2
- package/dist/calcite/{WBGRGCXR.js → B45OJKRH.js} +2 -2
- package/dist/calcite/{6VPACZP5.js → B7BMLZ2H.js} +2 -2
- package/dist/calcite/{VQMSSO2U.js → BAESWKYQ.js} +2 -2
- package/dist/calcite/{B5JXPZDV.js → BC4ZMTFC.js} +2 -2
- package/dist/calcite/{YV7DKMEQ.js → BES467QA.js} +2 -2
- package/dist/calcite/{PLD7OLLJ.js → BOWHKIKV.js} +2 -2
- package/dist/calcite/{IKDSO2OB.js → D54UBP4E.js} +2 -2
- package/dist/calcite/{YCLOS6NX.js → D6WKHYT4.js} +2 -2
- package/dist/calcite/{3YZG7MA3.js → DDSPVSLH.js} +2 -2
- package/dist/calcite/{AQ4DKRX6.js → DIWZOGSO.js} +2 -2
- package/dist/calcite/{HXGFAPCM.js → DQ3HNJFH.js} +2 -2
- package/dist/calcite/EFJ3XPYN.js +4 -0
- package/dist/calcite/{H2FWQITV.js → ENP5M2UC.js} +1 -1
- package/dist/calcite/{NQJMDHT5.js → EZFMZ526.js} +2 -2
- package/dist/calcite/{PSCEW76J.js → F3FMRPUL.js} +2 -2
- package/dist/calcite/{I53JH7YD.js → FJGFRFXA.js} +2 -2
- package/dist/calcite/{BYZPKQRD.js → FSBWTOKG.js} +2 -2
- package/dist/calcite/{CVLFEMH2.js → FZSVZEO4.js} +2 -2
- package/dist/calcite/{MVLJJOH2.js → G5DFRKUT.js} +2 -2
- package/dist/calcite/{7DTG5KDL.js → G6YXDPGD.js} +2 -2
- package/dist/calcite/{PFDLGOVS.js → G7Z7TBM3.js} +2 -2
- package/dist/calcite/{CF6DTFNX.js → GCM5UXYU.js} +2 -2
- package/dist/calcite/{UNJRBV2R.js → GQKPWPHX.js} +2 -2
- package/dist/calcite/{UOZDXXIF.js → GZGGTN2Z.js} +2 -2
- package/dist/calcite/{PVL2DQVP.js → H4XP55OC.js} +2 -2
- package/dist/calcite/{XRSYDXWZ.js → HIAAXHAL.js} +1 -1
- package/dist/calcite/{DOH3ZW2R.js → HIJA3ZQC.js} +2 -2
- package/dist/calcite/{YSBWKH76.js → HJDKPRY3.js} +1 -1
- package/dist/calcite/{ZLR2B6GQ.js → HWDBQK2D.js} +1 -1
- package/dist/calcite/{VYFT5EAY.js → HZH2MCFD.js} +1 -1
- package/dist/calcite/{ZZGPQLEW.js → HZPG2SWG.js} +2 -2
- package/dist/calcite/{PZL4QWV5.js → IC5WCEPX.js} +2 -2
- package/dist/calcite/{ZTOBC3PN.js → IDJNYNZL.js} +2 -2
- package/dist/calcite/{7ZNR3GNI.js → IGUWR4FW.js} +2 -2
- package/dist/calcite/{XNLWKJLM.js → ILIB7POV.js} +2 -2
- package/dist/calcite/{7IHVHMIY.js → IQOVIHRV.js} +2 -2
- package/dist/calcite/{6J5W2PAJ.js → IQROUFUT.js} +2 -2
- package/dist/calcite/{WWJXVV6U.js → IQY3P34D.js} +2 -2
- package/dist/calcite/{AHOXXRX5.js → J4UVTWRA.js} +2 -2
- package/dist/calcite/{SMRCCHJE.js → J5N7X673.js} +2 -2
- package/dist/calcite/{67HVFNHP.js → JDCUDQFO.js} +2 -2
- package/dist/calcite/{OFZACK2Y.js → JERKEE6O.js} +2 -2
- package/dist/calcite/{2IWOXJH7.js → JOGTHWSZ.js} +2 -2
- package/dist/calcite/{Q23OEAP2.js → JSFR3YQ3.js} +2 -2
- package/dist/calcite/{S5CLKCGJ.js → JVPR6YZA.js} +1 -1
- package/dist/calcite/{H5ANNFJC.js → K5KOFFWP.js} +2 -2
- package/dist/calcite/{HT5KXL4J.js → KEVLNRNX.js} +2 -2
- package/dist/calcite/{APIFFM3O.js → KINXAP24.js} +2 -2
- package/dist/calcite/{ZSMNT5VS.js → KJ6B56VZ.js} +2 -2
- package/dist/calcite/{WTY55PPZ.js → KPSSR45E.js} +2 -2
- package/dist/calcite/{GUT2GKDG.js → LDHSD3M6.js} +2 -2
- package/dist/calcite/{Y3HXK6MO.js → LHYFZTCS.js} +2 -2
- package/dist/calcite/{U3KRKTQY.js → LKORF2QC.js} +2 -2
- package/dist/calcite/{LQ3URZCB.js → LLZVI27K.js} +2 -2
- package/dist/calcite/{3HXEF55M.js → LOPTIQJU.js} +2 -2
- package/dist/calcite/{3266GV6Z.js → LZ3EBLID.js} +2 -2
- package/dist/calcite/{RI3NRBMI.js → M3RKWDE5.js} +2 -2
- package/dist/calcite/{7PFVW4JF.js → M4K4HY3K.js} +1 -1
- package/dist/calcite/{MP3OWQ2A.js → MJWAQ2DA.js} +2 -2
- package/dist/calcite/{7IYAKB7Q.js → MXNI5GI4.js} +2 -2
- package/dist/calcite/{AUF6YLAM.js → MYURWUJP.js} +2 -2
- package/dist/calcite/{A4CO6B7Z.js → N6NZ2GPW.js} +2 -2
- package/dist/calcite/{XNFJXDQ6.js → NNOPKVPT.js} +2 -2
- package/dist/calcite/{W72YZH73.js → O7MZFL34.js} +2 -2
- package/dist/calcite/{K3AHNZL7.js → OOLTKMQJ.js} +2 -2
- package/dist/calcite/{IHEW664E.js → OVNV2JKE.js} +2 -2
- package/dist/calcite/{4GHB4NY4.js → OVVNV5BW.js} +2 -2
- package/dist/calcite/{W5OJOVZY.js → OWSWQHLM.js} +1 -1
- package/dist/calcite/{LJI5SYGA.js → OZ3WSD3P.js} +1 -1
- package/dist/calcite/{C4S2BOWK.js → OZMAX3VQ.js} +2 -2
- package/dist/calcite/{DONAES6Q.js → PN64O3P6.js} +2 -2
- package/dist/calcite/{MEFMO7UB.js → POAMCSPF.js} +2 -2
- package/dist/calcite/{73LRFHS4.js → PUPMRTUL.js} +2 -2
- package/dist/calcite/{PSNA5FAF.js → PWZGTFQO.js} +2 -2
- package/dist/calcite/{HBHSBTMM.js → Q3THBLRM.js} +1 -1
- package/dist/calcite/{DDW4WTS2.js → QGI3TWNX.js} +2 -2
- package/dist/calcite/{WPTOKN7K.js → QR2HL6XI.js} +1 -1
- package/dist/calcite/{V4NPQ4WA.js → QVSPMDDW.js} +2 -2
- package/dist/calcite/{DZWPXJWV.js → QYBWEPW5.js} +2 -2
- package/dist/calcite/{W6EWFSR3.js → R7Q2LFGI.js} +2 -2
- package/dist/calcite/{45F6XOYY.js → REXSF55X.js} +2 -2
- package/dist/calcite/{VMWAAH5B.js → RHBRNWUQ.js} +2 -2
- package/dist/calcite/{CQMVTE7J.js → RIB7K6T6.js} +2 -2
- package/dist/calcite/{5IPJANUU.js → SBARVI35.js} +2 -2
- package/dist/calcite/{5LAPR75M.js → SBJ5HVNQ.js} +2 -2
- package/dist/calcite/{HVF3RXXI.js → SH7VNOTQ.js} +2 -2
- package/dist/calcite/{OMKDUGKV.js → SIVW7YY5.js} +2 -2
- package/dist/calcite/{2YBCAJSV.js → SJGZNFSY.js} +2 -2
- package/dist/calcite/{JJWGSKGI.js → T36PZDA3.js} +2 -2
- package/dist/calcite/{QF6F6CY3.js → T7VT42NJ.js} +2 -2
- package/dist/calcite/{UGI3YWJM.js → THGJ3ZD3.js} +2 -2
- package/dist/calcite/{VIWDW2WZ.js → TPQICMSC.js} +2 -2
- package/dist/calcite/{CUL3VHSD.js → TRYMHQWX.js} +2 -2
- package/dist/calcite/TSJA4LWX.js +4 -0
- package/dist/calcite/{7NUC3WBG.js → UE627G6U.js} +1 -1
- package/dist/calcite/{K5GJLIBR.js → UERWI2LS.js} +2 -2
- package/dist/calcite/{RRP2E2T3.js → UFHAJ3AG.js} +2 -2
- package/dist/calcite/{N5MSFOLW.js → UHKUQQRT.js} +2 -2
- package/dist/calcite/{CTLGVBKW.js → UIHFYOPH.js} +2 -2
- package/dist/calcite/{NULQJBCW.js → ULUKHLQN.js} +2 -2
- package/dist/calcite/{UN7GLLXI.js → USBSH7KC.js} +2 -2
- package/dist/calcite/{BE5OB2TH.js → UTWEOJW6.js} +2 -2
- package/dist/calcite/{LH7245HX.js → UVFQM6FI.js} +2 -2
- package/dist/calcite/{DDXY7TRY.js → UWREJ25T.js} +2 -2
- package/dist/calcite/{SXB76NOR.js → UWUSKJIU.js} +2 -2
- package/dist/calcite/{C3BQ4W7K.js → V6VV5MRC.js} +2 -2
- package/dist/calcite/{CJWGQETT.js → VFQAYOAN.js} +2 -2
- package/dist/calcite/{CIU4VM7X.js → W4XITGKA.js} +2 -2
- package/dist/calcite/{BFINWHLX.js → W4Y22TCR.js} +2 -2
- package/dist/calcite/{PFKUB7JD.js → WG7RY7HV.js} +2 -2
- package/dist/calcite/{R73QB7MJ.js → WR7PEL2H.js} +2 -2
- package/dist/calcite/{Y442PVMQ.js → WW6CS7FX.js} +2 -2
- package/dist/calcite/{ZV7YL7QG.js → WZGZ5PZT.js} +2 -2
- package/dist/calcite/{7XJU5OTS.js → X7OME6SM.js} +2 -2
- package/dist/calcite/{GE7SQF7S.js → XECJM3YP.js} +2 -2
- package/dist/calcite/{SZWYWOXZ.js → XGARHDI3.js} +2 -2
- package/dist/calcite/{WOTQIMPZ.js → XGPCFFL2.js} +2 -2
- package/dist/calcite/{5AL5GWRD.js → XLJGRDO4.js} +2 -2
- package/dist/calcite/{RFALVOKT.js → XU6PDNU5.js} +2 -2
- package/dist/calcite/{XZTRPLLK.js → Y3X3JA73.js} +2 -2
- package/dist/calcite/{NID6WJOW.js → YFY6OPEB.js} +2 -2
- package/dist/calcite/{BHBYSC5H.js → YHUESRZY.js} +2 -2
- package/dist/calcite/{KT4EQWT6.js → YNIG5SX5.js} +2 -2
- package/dist/calcite/{ZVWKN3G7.js → YR554YXQ.js} +2 -2
- package/dist/calcite/{DSEMLW7Z.js → YUOZM346.js} +2 -2
- package/dist/calcite/{LYDOM6VQ.js → ZIA4F7R5.js} +2 -2
- package/dist/calcite/{PJOGMC7F.js → ZIABK7KW.js} +2 -2
- package/dist/calcite/{NSBK36H4.js → ZOYJ4343.js} +2 -2
- package/dist/calcite/{4ARTWEEZ.js → ZV3IGLDE.js} +2 -2
- package/dist/calcite/{V3ZR6RFK.js → ZVCPJCBM.js} +1 -1
- package/dist/calcite/calcite.esm.js +2 -2
- package/dist/chunks/runtime.js +4 -4
- package/dist/components/calcite-card/customElement.js +1 -1
- package/dist/components/calcite-stepper/customElement.d.ts +0 -6
- package/dist/components/calcite-stepper/customElement.js +0 -2
- package/dist/docs/api.json +26 -35
- package/dist/docs/docs.json +76 -91
- package/dist/docs/supported-browsers.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +27 -37
- package/dist/index.d.ts +0 -1
- package/dist/types/lumina.d.ts +0 -1
- package/dist/types/preact.d.ts +0 -1
- package/dist/types/preact10.d.ts +0 -1
- package/dist/types/react.d.ts +0 -1
- package/dist/types/stencil.d.ts +0 -1
- package/package.json +2 -2
- package/dist/calcite/T6Y6ZTWW.js +0 -4
- package/dist/calcite/VBRBI7IU.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as oe}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as oe}from"./BC4ZMTFC.js";import{a as ne,l as ie}from"./SBARVI35.js";import{N as re}from"./2ECRIOED.js";var se=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],B=se.join(","),ce=typeof Element>"u",D=ce?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,K=!ce&&Element.prototype.getRootNode?function(a){var e;return a==null||(e=a.getRootNode)===null||e===void 0?void 0:e.call(a)}:function(a){return a?.ownerDocument},j=function a(e,t){var r;t===void 0&&(t=!0);var u=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=u===""||u==="true",n=s||t&&e&&a(e.parentNode);return n},Se=function(e){var t,r=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return r===""||r==="true"},le=function(e,t,r){if(j(e))return[];var u=Array.prototype.slice.apply(e.querySelectorAll(B));return t&&D.call(e,B)&&u.unshift(e),u=u.filter(r),u},fe=function a(e,t,r){for(var u=[],s=Array.from(e);s.length;){var n=s.shift();if(!j(n,!1))if(n.tagName==="SLOT"){var d=n.assignedElements(),l=d.length?d:n.children,y=a(l,!0,r);r.flatten?u.push.apply(u,y):u.push({scopeParent:n,candidates:y})}else{var T=D.call(n,B);T&&r.filter(n)&&(t||!e.includes(n))&&u.push(n);var w=n.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(n),S=!j(w,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(n));if(w&&S){var C=a(w===!0?n.children:w.children,!0,r);r.flatten?u.push.apply(u,C):u.push({scopeParent:n,candidates:C})}else s.unshift.apply(s,n.children)}}return u},de=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},E=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||Se(e))&&!de(e)?0:e.tabIndex},ke=function(e,t){var r=E(e);return r<0&&t&&!de(e)?0:r},De=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},ve=function(e){return e.tagName==="INPUT"},Re=function(e){return ve(e)&&e.type==="hidden"},Ce=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return t},Oe=function(e,t){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===t)return e[r]},Ae=function(e){if(!e.name)return!0;var t=e.form||K(e),r=function(d){return t.querySelectorAll('input[type="radio"][name="'+d+'"]')},u;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")u=r(window.CSS.escape(e.name));else try{u=r(e.name)}catch(n){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",n.message),!1}var s=Oe(u,e.form);return!s||s===e},Ie=function(e){return ve(e)&&e.type==="radio"},Pe=function(e){return Ie(e)&&!Ae(e)},xe=function(e){var t,r=e&&K(e),u=(t=r)===null||t===void 0?void 0:t.host,s=!1;if(r&&r!==e){var n,d,l;for(s=!!((n=u)!==null&&n!==void 0&&(d=n.ownerDocument)!==null&&d!==void 0&&d.contains(u)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&u;){var y,T,w;r=K(u),u=(y=r)===null||y===void 0?void 0:y.host,s=!!((T=u)!==null&&T!==void 0&&(w=T.ownerDocument)!==null&&w!==void 0&&w.contains(u))}}return s},ue=function(e){var t=e.getBoundingClientRect(),r=t.width,u=t.height;return r===0&&u===0},Le=function(e,t){var r=t.displayCheck,u=t.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var s=D.call(e,"details>summary:first-of-type"),n=s?e.parentElement:e;if(D.call(n,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof u=="function"){for(var d=e;e;){var l=e.parentElement,y=K(e);if(l&&!l.shadowRoot&&u(l)===!0)return ue(e);e.assignedSlot?e=e.assignedSlot:!l&&y!==e.ownerDocument?e=y.host:e=l}e=d}if(xe(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ue(e);return!1},Be=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var r=0;r<t.children.length;r++){var u=t.children.item(r);if(u.tagName==="LEGEND")return D.call(t,"fieldset[disabled] *")?!0:!u.contains(e)}return!0}t=t.parentElement}return!1},M=function(e,t){return!(t.disabled||j(t)||Re(t)||Le(t,e)||Ce(t)||Be(t))},$=function(e,t){return!(Pe(t)||E(t)<0||!M(e,t))},Ke=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},je=function a(e){var t=[],r=[];return e.forEach(function(u,s){var n=!!u.scopeParent,d=n?u.scopeParent:u,l=ke(d,n),y=n?a(u.candidates):d;l===0?n?t.push.apply(t,y):t.push(d):r.push({documentOrder:s,tabIndex:l,item:u,isScope:n,content:y})}),r.sort(De).reduce(function(u,s){return s.isScope?u.push.apply(u,s.content):u.push(s.content),u},[]).concat(t)},be=function(e,t){t=t||{};var r;return t.getShadowRoot?r=fe([e],t.includeContainer,{filter:$.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:Ke}):r=le(e,t.includeContainer,$.bind(null,t)),je(r)},he=function(e,t){t=t||{};var r;return t.getShadowRoot?r=fe([e],t.includeContainer,{filter:M.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):r=le(e,t.includeContainer,M.bind(null,t)),r},R=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,B)===!1?!1:$(t,e)},Me=se.concat("iframe").join(","),G=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return D.call(e,Me)===!1?!1:M(t,e)};function Y(a,e){(e==null||e>a.length)&&(e=a.length);for(var t=0,r=Array(e);t<e;t++)r[t]=a[t];return r}function Ge(a){if(Array.isArray(a))return Y(a)}function qe(a,e,t){return(e=$e(e))in a?Object.defineProperty(a,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[e]=t,a}function Ue(a){if(typeof Symbol<"u"&&a[Symbol.iterator]!=null||a["@@iterator"]!=null)return Array.from(a)}function Ve(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
5
5
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pe(a,e){var t=Object.keys(a);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(a);e&&(r=r.filter(function(u){return Object.getOwnPropertyDescriptor(a,u).enumerable})),t.push.apply(t,r)}return t}function ye(a){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?pe(Object(t),!0).forEach(function(r){qe(a,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(t)):pe(Object(t)).forEach(function(r){Object.defineProperty(a,r,Object.getOwnPropertyDescriptor(t,r))})}return a}function _e(a){return Ge(a)||Ue(a)||Ye(a)||Ve()}function We(a,e){if(typeof a!="object"||!a)return a;var t=a[Symbol.toPrimitive];if(t!==void 0){var r=t.call(a,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(a)}function $e(a){var e=We(a,"string");return typeof e=="symbol"?e:e+""}function Ye(a,e){if(a){if(typeof a=="string")return Y(a,e);var t={}.toString.call(a).slice(8,-1);return t==="Object"&&a.constructor&&(t=a.constructor.name),t==="Map"||t==="Set"?Array.from(a):t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?Y(a,e):void 0}}var ge={activateTrap:function(e,t){if(e.length>0){var r=e[e.length-1];r!==t&&r._setPausedState(!0)}var u=e.indexOf(t);u===-1||e.splice(u,1),e.push(t)},deactivateTrap:function(e,t){var r=e.indexOf(t);r!==-1&&e.splice(r,1),e.length>0&&!e[e.length-1]._isManuallyPaused()&&e[e.length-1]._setPausedState(!1)}},Ze=function(e){return e.tagName&&e.tagName.toLowerCase()==="input"&&typeof e.select=="function"},ze=function(e){return e?.key==="Escape"||e?.key==="Esc"||e?.keyCode===27},x=function(e){return e?.key==="Tab"||e?.keyCode===9},Xe=function(e){return x(e)&&!e.shiftKey},He=function(e){return x(e)&&e.shiftKey},me=function(e){return setTimeout(e,0)},P=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),u=1;u<t;u++)r[u-1]=arguments[u];return typeof e=="function"?e.apply(void 0,r):e},q=function(e){return e.target.shadowRoot&&typeof e.composedPath=="function"?e.composedPath()[0]:e.target},Je=[],we=function(e,t){var r=t?.document||document,u=t?.trapStack||Je,s=ye({returnFocusOnDeactivate:!0,escapeDeactivates:!0,delayInitialFocus:!0,isKeyForward:Xe,isKeyBackward:He},t),n={containers:[],containerGroups:[],tabbableGroups:[],nodeFocusedBeforeActivation:null,mostRecentlyFocusedNode:null,active:!1,paused:!1,manuallyPaused:!1,delayInitialFocusTimer:void 0,recentNavEvent:void 0},d,l=function(i,o,c){return i&&i[o]!==void 0?i[o]:s[c||o]},y=function(i,o){var c=typeof o?.composedPath=="function"?o.composedPath():void 0;return n.containerGroups.findIndex(function(v){var b=v.container,p=v.tabbableNodes;return b.contains(i)||c?.includes(b)||p.find(function(f){return f===i})})},T=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=o.hasFallback,v=c===void 0?!1:c,b=o.params,p=b===void 0?[]:b,f=s[i];if(typeof f=="function"&&(f=f.apply(void 0,_e(p))),f===!0&&(f=void 0),!f){if(f===void 0||f===!1)return f;throw new Error("`".concat(i,"` was specified but was not a node, or did not return a node"))}var g=f;if(typeof f=="string"){try{g=r.querySelector(f)}catch(m){throw new Error("`".concat(i,'` appears to be an invalid selector; error="').concat(m.message,'"'))}if(!g&&!v)throw new Error("`".concat(i,"` as selector refers to no known node"))}return g},w=function(){var i=T("initialFocus",{hasFallback:!0});if(i===!1)return!1;if(i===void 0||i&&!G(i,s.tabbableOptions))if(y(r.activeElement)>=0)i=r.activeElement;else{var o=n.tabbableGroups[0],c=o&&o.firstTabbableNode;i=c||T("fallbackFocus")}else i===null&&(i=T("fallbackFocus"));if(!i)throw new Error("Your focus-trap needs to have at least one focusable element");return i},S=function(){if(n.containerGroups=n.containers.map(function(i){var o=be(i,s.tabbableOptions),c=he(i,s.tabbableOptions),v=o.length>0?o[0]:void 0,b=o.length>0?o[o.length-1]:void 0,p=c.find(function(m){return R(m)}),f=c.slice().reverse().find(function(m){return R(m)}),g=!!o.find(function(m){return E(m)>0});return{container:i,tabbableNodes:o,focusableNodes:c,posTabIndexesFound:g,firstTabbableNode:v,lastTabbableNode:b,firstDomTabbableNode:p,lastDomTabbableNode:f,nextTabbableNode:function(k){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0,N=o.indexOf(k);return N<0?A?c.slice(c.indexOf(k)+1).find(function(I){return R(I)}):c.slice(0,c.indexOf(k)).reverse().find(function(I){return R(I)}):o[N+(A?1:-1)]}}}),n.tabbableGroups=n.containerGroups.filter(function(i){return i.tabbableNodes.length>0}),n.tabbableGroups.length<=0&&!T("fallbackFocus"))throw new Error("Your focus-trap must have at least one container with at least one tabbable node in it at all times");if(n.containerGroups.find(function(i){return i.posTabIndexesFound})&&n.containerGroups.length>1)throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.")},C=function(i){var o=i.activeElement;if(o)return o.shadowRoot&&o.shadowRoot.activeElement!==null?C(o.shadowRoot):o},F=function(i){if(i!==!1&&i!==C(document)){if(!i||!i.focus){F(w());return}i.focus({preventScroll:!!s.preventScroll}),n.mostRecentlyFocusedNode=i,Ze(i)&&i.select()}},Z=function(i){var o=T("setReturnFocus",{params:[i]});return o||(o===!1?!1:i)},z=function(i){var o=i.target,c=i.event,v=i.isBackward,b=v===void 0?!1:v;o=o||q(c),S();var p=null;if(n.tabbableGroups.length>0){var f=y(o,c),g=f>=0?n.containerGroups[f]:void 0;if(f<0)b?p=n.tabbableGroups[n.tabbableGroups.length-1].lastTabbableNode:p=n.tabbableGroups[0].firstTabbableNode;else if(b){var m=n.tabbableGroups.findIndex(function(_){var W=_.firstTabbableNode;return o===W});if(m<0&&(g.container===o||G(o,s.tabbableOptions)&&!R(o,s.tabbableOptions)&&!g.nextTabbableNode(o,!1))&&(m=f),m>=0){var k=m===0?n.tabbableGroups.length-1:m-1,A=n.tabbableGroups[k];p=E(o)>=0?A.lastTabbableNode:A.lastDomTabbableNode}else x(c)||(p=g.nextTabbableNode(o,!1))}else{var N=n.tabbableGroups.findIndex(function(_){var W=_.lastTabbableNode;return o===W});if(N<0&&(g.container===o||G(o,s.tabbableOptions)&&!R(o,s.tabbableOptions)&&!g.nextTabbableNode(o))&&(N=f),N>=0){var I=N===n.tabbableGroups.length-1?0:N+1,ae=n.tabbableGroups[I];p=E(o)>=0?ae.firstTabbableNode:ae.firstDomTabbableNode}else x(c)||(p=g.nextTabbableNode(o))}}else p=T("fallbackFocus");return p},L=function(i){var o=q(i);if(!(y(o,i)>=0)){if(P(s.clickOutsideDeactivates,i)){d.deactivate({returnFocus:s.returnFocusOnDeactivate});return}P(s.allowOutsideClick,i)||i.preventDefault()}},X=function(i){var o=q(i),c=y(o,i)>=0;if(c||o instanceof Document)c&&(n.mostRecentlyFocusedNode=o);else{i.stopImmediatePropagation();var v,b=!0;if(n.mostRecentlyFocusedNode)if(E(n.mostRecentlyFocusedNode)>0){var p=y(n.mostRecentlyFocusedNode),f=n.containerGroups[p].tabbableNodes;if(f.length>0){var g=f.findIndex(function(m){return m===n.mostRecentlyFocusedNode});g>=0&&(s.isKeyForward(n.recentNavEvent)?g+1<f.length&&(v=f[g+1],b=!1):g-1>=0&&(v=f[g-1],b=!1))}}else n.containerGroups.some(function(m){return m.tabbableNodes.some(function(k){return E(k)>0})})||(b=!1);else b=!1;b&&(v=z({target:n.mostRecentlyFocusedNode,isBackward:s.isKeyBackward(n.recentNavEvent)})),F(v||n.mostRecentlyFocusedNode||w())}n.recentNavEvent=void 0},Ne=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;n.recentNavEvent=i;var c=z({event:i,isBackward:o});c&&(x(i)&&i.preventDefault(),F(c))},H=function(i){(s.isKeyForward(i)||s.isKeyBackward(i))&&Ne(i,s.isKeyBackward(i))},J=function(i){ze(i)&&P(s.escapeDeactivates,i)!==!1&&(i.preventDefault(),d.deactivate())},Q=function(i){var o=q(i);y(o,i)>=0||P(s.clickOutsideDeactivates,i)||P(s.allowOutsideClick,i)||(i.preventDefault(),i.stopImmediatePropagation())},ee=function(){if(n.active)return ge.activateTrap(u,d),n.delayInitialFocusTimer=s.delayInitialFocus?me(function(){F(w())}):F(w()),r.addEventListener("focusin",X,!0),r.addEventListener("mousedown",L,{capture:!0,passive:!1}),r.addEventListener("touchstart",L,{capture:!0,passive:!1}),r.addEventListener("click",Q,{capture:!0,passive:!1}),r.addEventListener("keydown",H,{capture:!0,passive:!1}),r.addEventListener("keydown",J),d},te=function(){if(n.active)return r.removeEventListener("focusin",X,!0),r.removeEventListener("mousedown",L,!0),r.removeEventListener("touchstart",L,!0),r.removeEventListener("click",Q,!0),r.removeEventListener("keydown",H,!0),r.removeEventListener("keydown",J),d},Ee=function(i){var o=i.some(function(c){var v=Array.from(c.removedNodes);return v.some(function(b){return b===n.mostRecentlyFocusedNode})});o&&F(w())},V=typeof window<"u"&&"MutationObserver"in window?new MutationObserver(Ee):void 0,O=function(){V&&(V.disconnect(),n.active&&!n.paused&&n.containers.map(function(i){V.observe(i,{subtree:!0,childList:!0})}))};return d={get active(){return n.active},get paused(){return n.paused},activate:function(i){if(n.active)return this;var o=l(i,"onActivate"),c=l(i,"onPostActivate"),v=l(i,"checkCanFocusTrap");v||S(),n.active=!0,n.paused=!1,n.nodeFocusedBeforeActivation=C(r),o?.();var b=function(){v&&S(),ee(),O(),c?.()};return v?(v(n.containers.concat()).then(b,b),this):(b(),this)},deactivate:function(i){if(!n.active)return this;var o=ye({onDeactivate:s.onDeactivate,onPostDeactivate:s.onPostDeactivate,checkCanReturnFocus:s.checkCanReturnFocus},i);clearTimeout(n.delayInitialFocusTimer),n.delayInitialFocusTimer=void 0,te(),n.active=!1,n.paused=!1,O(),ge.deactivateTrap(u,d);var c=l(o,"onDeactivate"),v=l(o,"onPostDeactivate"),b=l(o,"checkCanReturnFocus"),p=l(o,"returnFocus","returnFocusOnDeactivate");c?.();var f=function(){me(function(){p&&F(Z(n.nodeFocusedBeforeActivation)),v?.()})};return p&&b?(b(Z(n.nodeFocusedBeforeActivation)).then(f,f),this):(f(),this)},pause:function(i){return n.active?(n.manuallyPaused=!0,this._setPausedState(!0,i)):this},unpause:function(i){return n.active?(n.manuallyPaused=!1,u[u.length-1]!==this?this:this._setPausedState(!1,i)):this},updateContainerElements:function(i){var o=[].concat(i).filter(Boolean);return n.containers=o.map(function(c){return typeof c=="string"?r.querySelector(c):c}),n.active&&S(),O(),this}},Object.defineProperties(d,{_isManuallyPaused:{value:function(){return n.manuallyPaused}},_setPausedState:{value:function(i,o){if(n.paused===i)return this;if(n.paused=i,i){var c=l(o,"onPause"),v=l(o,"onPostPause");c?.(),te(),O(),v?.()}else{var b=l(o,"onUnpause"),p=l(o,"onPostUnpause");b?.(),S(),ee(),O(),p?.()}return this}}}),d.updateContainerElements(e),d};var U=new WeakSet;function Qe(a,e){let t=e&&e!==document.body&&e!==document.documentElement;return!U.has(a)&&t&&ie(e),!1}function et(a,e){let t=e?.fallbackFocus||a,r=e?.clickOutsideDeactivates??!0;return{fallbackFocus:t,...e,document:a.ownerDocument,tabbableOptions:ne,trapStack:re().focusTrapStack,clickOutsideDeactivates:u=>(U.has(a)||U.add(a),typeof r=="function"?r(u):r),onPostDeactivate:()=>{U.delete(a)},setReturnFocus:u=>{let s=typeof e?.setReturnFocus=="function"?e.setReturnFocus(u):e?.setReturnFocus;return s===void 0?Qe(a,u):s}}}function Te(a,{focusTrapOptions:e},t){return!e?.extraContainers&&!t?a:[a,...Fe(e?.extraContainers),...Fe(t)]}function Fe(a=[]){return Array.isArray(a)?a:[a]}var st=a=>oe((e,t)=>{let r,u,s,n=a.focusTrapOptions;t.onConnected(()=>{e[a.triggerProp]&&r&&d.activate()}),t.onUpdate(l=>{e.hasUpdated&&l.has("focusTrapDisabled")&&(e.focusTrapDisabled?d.deactivate():d.activate())}),t.onDisconnected(()=>d.deactivate());let d={activate:()=>{let l=u||e.el;if(l.isConnected){if(!r){let y={...n,...e.focusTrapOptions};s||=Te(l,e),r=we(s,et(l,y))}(typeof e.focusTrapDisabledOverride=="function"?!e.focusTrapDisabledOverride():!e.focusTrapDisabled)&&r.activate()}},deactivate:()=>r?.deactivate(),overrideFocusTrapEl:l=>{if(r)throw new Error("Focus trap already created");u=l},setExtraContainers:l=>{let y=u||e.el;s=Te(y,e,l)},updateContainerElements:()=>r?.updateContainerElements(s)};return d});export{st as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as z,e as I,f as M}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as z,e as I,f as M}from"./G5DFRKUT.js";import"./4PHM5LVD.js";import{b as l}from"./GZGGTN2Z.js";import{a as k,b as S}from"./ZOYJ4343.js";import{a}from"./ULUKHLQN.js";import{a as h,b as y}from"./DDSPVSLH.js";import"./W4XITGKA.js";import{r as w}from"./SBARVI35.js";import{a as $}from"./HWDBQK2D.js";import{D as v,E as i,F as x,P as C,g as f,h as c,l as g,o as d}from"./2ECRIOED.js";var t={active:"label--active",centerContent:"center-content",container:"container",iconCustom:"icon--custom",description:"description",icon:"icon",label:"label",scale:b=>`scale--${b}`,shortText:"short-text",single:"label--single",textContainer:"text-container",heading:"heading"},o={checked:"check-square-f",circle:"circle",indeterminate:"minus-square-f",selectedSingle:"circle-inset-large",unchecked:"square"},H={contentEnd:"content-end",contentStart:"content-start"},_="--calcite-combobox-item-spacing-indent-multiplier",O=f`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host([hidden]){display:none}[hidden]{display:none}.scale--s{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-internal-combobox-item-spacing-unit-s: .25rem;--calcite-internal-combobox-item-spacing-unit-l: .5rem;--calcite-combobox-item-selector-icon-size: 1rem;--calcite-internal-combobox-item-description-font-size: var(--calcite-font-size-xs)}.scale--m{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-internal-combobox-item-spacing-unit-s: .375rem;--calcite-internal-combobox-item-spacing-unit-l: .75rem;--calcite-combobox-item-selector-icon-size: 1rem;--calcite-internal-combobox-item-description-font-size: var(--calcite-font-size-sm)}.scale--l{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-internal-combobox-item-spacing-unit-s: .625rem;--calcite-internal-combobox-item-spacing-unit-l: 1rem;--calcite-combobox-item-selector-icon-size: 1.5rem;--calcite-internal-combobox-item-description-font-size: var(--calcite-font-size)}.container{--calcite-combobox-item-indent-value: calc( var(--calcite-internal-combobox-item-spacing-unit-l) * var(--calcite-combobox-item-spacing-indent-multiplier) )}:host(:focus){--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host,ul{margin:0;display:flex;flex-direction:column;padding:0}:host(:focus),ul:focus{outline:2px solid transparent;outline-offset:2px}.label{position:relative;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:100%;cursor:pointer;align-items:center;text-decoration-line:none;transition-timing-function:cubic-bezier(.4,0,.2,1);outline-color:transparent;word-wrap:break-word;word-break:break-word;justify-content:space-around;gap:var(--calcite-internal-combobox-item-spacing-unit-l);padding-block:var(--calcite-internal-combobox-item-spacing-unit-s);padding-inline-end:var(--calcite-internal-combobox-item-spacing-unit-l);padding-inline-start:var(--calcite-combobox-item-indent-value);color:var(--calcite-combobox-text-color, var(--calcite-color-text-3));transition-duration:var(--calcite-animation-timing)}:host([disabled]) .label{cursor:default}.label--active{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.label:hover{background-color:var(--calcite-combobox-item-background-color-hover, var(--calcite-color-foreground-2));color:var(--calcite-combobox-text-color-hover, var(--calcite-color-text-1))}.label:active{background-color:var(--calcite-combobox-item-background-color-active, var(--calcite-color-foreground-3))}:host([selected]) .label,.label:active{color:var(--calcite-combobox-text-color-hover, var(--calcite-color-text-1))}:host([selected]) .label .description,:host([selected]) .label .short-text,.label:active .description,.label:active .short-text{color:var(--calcite-combobox-description-text-color-press, var(--calcite-color-text-2))}.icon{display:inline-flex;transition-timing-function:cubic-bezier(.4,0,.2,1);color:var(--calcite-color-border-input)}:host([selected]) .icon,:host([indeterminate]) .icon{color:var(--calcite-combobox-selected-icon-color, var(--calcite-color-brand))}.icon--custom{margin-block-start:-1px}.center-content{display:flex;flex-direction:column;flex-grow:1;padding-block:0}.description{font-size:var(--calcite-internal-combobox-item-description-font-size)}.short-text{white-space:nowrap}.heading{color:var(--calcite-combobox-heading-text-color, var(--calcite-color-text-1))}.description,.short-text{color:var(--calcite-combobox-description-text-color, var(--calcite-color-text-3))}:host([selected]) .heading{font-weight:var(--calcite-font-weight-medium)}.heading,.description,.short-text{line-height:var(--calcite-font-line-height-relative-snug)}:host([item-hidden]){display:none}.text-match{background-color:transparent;color:inherit;font-weight:var(--calcite-font-weight-bold)}`,m=class extends v{constructor(){super(...arguments),this._selected=!1,this.hasContent=!1,this.active=!1,this.disabled=!1,this.guid=$(),this.iconFlipRtl=!1,this.scale="m",this.selectionMode="multiple",this.itemHidden=!1,this.indeterminate=!1,this.calciteComboboxItemChange=d({cancelable:!1}),this.calciteInternalComboboxItemChange=d({cancelable:!1})}static{this.properties={hasContent:[16,{},{state:!0}],active:[7,{},{reflect:!0,type:Boolean}],ancestors:[0,{},{attribute:!1}],description:1,disabled:[7,{},{reflect:!0,type:Boolean}],filterDisabled:[7,{},{reflect:!0,type:Boolean}],filterTextMatchPattern:[2,{},{reflect:!0,attribute:!1}],guid:[3,{},{reflect:!0}],heading:1,icon:[3,{type:String},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],label:1,metadata:[0,{},{attribute:!1}],scale:1,selected:[7,{},{reflect:!0,type:Boolean}],selectionMode:[3,{},{reflect:!0}],shortHeading:1,textLabel:[3,{},{reflect:!0}],value:1,itemHidden:[7,{},{reflect:!0,type:Boolean}],indeterminate:[7,{},{reflect:!0,type:Boolean}]}}static{this.styles=O}get selected(){return this._selected}set selected(e){let n=this._selected;e!==n&&(this._selected=e,this.emitItemChange())}toggleSelection(){let e=this.selectionMode==="single-persist";this.disabled||e&&this.selected||(this.selected=!this.selected,this.calciteComboboxItemChange.emit())}connectedCallback(){super.connectedCallback(),this.ancestors=z(this.el)}load(){y(this,"value","textLabel")}willUpdate(e){this.hasUpdated&&(e.has("disabled")||e.has("heading")||e.has("label")||e.has("textLabel"))&&this.emitItemChange()}updated(){k(this)}emitItemChange(){this.calciteInternalComboboxItemChange.emit()}handleDefaultSlotChange(e){this.hasContent=w(e)}itemClickHandler(){this.toggleSelection()}renderIcon(e){return this.icon?a("icon",c`<calcite-icon class=${i({[t.iconCustom]:!!this.icon})} .flipRtl=${this.iconFlipRtl} .icon=${this.icon||e} .scale=${h(this.scale)}></calcite-icon>`):null}renderSelectIndicator(e){return a("indicator",c`<calcite-icon class=${i({[t.icon]:!0})} .flipRtl=${this.iconFlipRtl} .icon=${e} .scale=${h(this.scale)}></calcite-icon>`)}renderChildren(){return a("default-slot-container",c`<ul .hidden=${!this.hasContent}><slot @slotchange=${this.handleDefaultSlotChange}></slot></ul>`)}render(){let{disabled:e,heading:n,label:L,textLabel:B,value:R,filterTextMatchPattern:s,description:u,shortHeading:p}=this,r=M(this.selectionMode),T=e||r?void 0:o.checked,E=r?this.selected?o.selectedSingle:o.circle:this.indeterminate?o.indeterminate:this.selected?o.checked:o.unchecked,q=n||B,D=L||R,F={[t.label]:!0,[t.active]:this.active,[t.single]:r},P=I(this.el);return this.el.ariaHidden="true",this.el.ariaLabel=D,S({disabled:e,children:c`<div class=${i({[t.container]:!0,[t.scale(this.scale)]:!0})} style=${x({[_]:`${P}`})}><li class=${i(F)} id=${this.guid??g} @click=${this.itemClickHandler}>${this.renderSelectIndicator(E)}<slot name=${H.contentStart}></slot>${this.renderIcon(T)}<div class=${i(t.centerContent)}><div class=${i(t.heading)}>${l({text:q,pattern:s})}</div>${u?c`<div class=${i(t.description)}>${l({text:u,pattern:s})}</div>`:null}</div>${p?c`<div class=${i(t.shortText)}>${l({text:p,pattern:s})}</div>`:null}<slot name=${H.contentEnd}></slot></li>${this.renderChildren()}</div>`})}};C("calcite-combobox-item",m);export{m as ComboboxItem};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{o as e}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{o as e}from"./SBARVI35.js";import"./HWDBQK2D.js";import{D as o,E as n,H as a,I as l,P as r,g as c,h as i}from"./2ECRIOED.js";var u={valid:"check-circle",invalid:"exclamation-mark-triangle",idle:"information"},d=c`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host{box-sizing:border-box;display:flex;block-size:auto;inline-size:100%;align-items:center;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-text-1);opacity:1;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;margin-block-start:var(--calcite-input-message-spacing, var(--calcite-input-message-spacing-value, var(--calcite-spacing-xxs)))}.calcite-input-message-icon{pointer-events:none;display:inline-flex;flex-shrink:0;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;margin-inline-end:var(--calcite-spacing-sm)}:host([status=invalid]) .calcite-input-message-icon{color:var(--calcite-input-message-icon-color, var(--calcite-icon-color, var(--calcite-color-status-danger)))}:host([status=valid]) .calcite-input-message-icon{color:var(--calcite-input-message-icon-color, var(--calcite-icon-color, var(--calcite-color-status-success)))}:host([status=idle]) .calcite-input-message-icon{color:var(--calcite-input-message-icon-color, var(--calcite-icon-color, var(--calcite-color-brand)))}:host([scale=s]){font-size:var(--calcite-font-size--3);line-height:.75rem}:host([scale=m]){font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=l]){font-size:var(--calcite-font-size--1);line-height:1rem}:host([hidden]){display:none}[hidden]{display:none}`,h={inputMessageIcon:"calcite-input-message-icon"},s=class extends o{constructor(){super(...arguments),this.iconFlipRtl=!1,this.scale="m",this.status="idle"}static{this.properties={icon:[3,{converter:l,type:String},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],status:[3,{},{reflect:!0}]}}static{this.styles=d}connectedCallback(){super.connectedCallback(),this.requestedIcon=e(u,this.icon,this.status)}willUpdate(t){(t.has("status")&&(this.hasUpdated||this.status!=="idle")||t.has("icon"))&&(this.requestedIcon=e(u,this.icon,this.status))}render(){let t=this.el.hidden;return a(this.el,"calcite-hydrated-hidden",t),i`${this.renderIcon(this.requestedIcon)}<slot></slot>`}renderIcon(t){if(t)return i`<calcite-icon class=${n(h.inputMessageIcon)} .flipRtl=${this.iconFlipRtl} .icon=${t} scale=s></calcite-icon>`}};r("calcite-input-message",s);export{s as InputMessage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as I}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as I}from"./SBJ5HVNQ.js";import{a as v,b as T}from"./ZOYJ4343.js";import{a}from"./ULUKHLQN.js";import"./OWSWQHLM.js";import{a as S}from"./UVFQM6FI.js";import{a as w}from"./XGPCFFL2.js";import"./BC4ZMTFC.js";import"./DDSPVSLH.js";import"./W4XITGKA.js";import"./SBARVI35.js";import"./HWDBQK2D.js";import{C as b,D as g,E as h,P as $,g as f,h as r,l,o as i}from"./2ECRIOED.js";var y={handle:"handle",dropdown:"dropdown"},D={drag:"drag",blank:"blank"},p={label:"{label}",position:"{position}",total:"{total}"},P=["top","up","down","bottom"],C={trigger:"trigger"},m={add:"add",move:"move",reorder:"reorder"},E=f`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:flex}.dropdown{block-size:100%}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([hidden]){display:none}[hidden]{display:none}`,u=class extends g{constructor(){super(...arguments),this.focusSetter=w()(this),this.disabled=!1,this.messages=S({blocking:!0}),this.addToItems=[],this.moveToItems=[],this.open=!1,this.overlayPositioning="absolute",this.placement=I,this.scale="m",this.sortDisabled=!1,this.calciteSortHandleBeforeClose=i({cancelable:!1}),this.calciteSortHandleBeforeOpen=i({cancelable:!1}),this.calciteSortHandleClose=i({cancelable:!1}),this.calciteSortHandleMove=i({cancelable:!0}),this.calciteSortHandleAdd=i({cancelable:!0}),this.calciteSortHandleOpen=i({cancelable:!1}),this.calciteSortHandleReorder=i({cancelable:!0})}static{this.properties={disabled:[7,{},{reflect:!0,type:Boolean}],flipPlacements:[0,{},{attribute:!1}],label:1,messageOverrides:[0,{},{attribute:!1}],messages:[0,{},{attribute:!1}],addToItems:[0,{},{attribute:!1}],moveToItems:[0,{},{attribute:!1}],open:[7,{},{reflect:!0,type:Boolean}],overlayPositioning:[3,{},{reflect:!0}],placement:[3,{},{reflect:!0}],scale:[3,{},{reflect:!0}],setPosition:[9,{},{type:Number}],setSize:[9,{},{type:Number}],sortDisabled:[7,{},{reflect:!0,type:Boolean}],widthScale:[3,{},{reflect:!0}]}}static{this.styles=E}get hasSetInfo(){return typeof this.setPosition=="number"&&typeof this.setSize=="number"}get hasValidSetInfo(){return this.hasSetInfo?this.setPosition>0&&this.setSize>1:!0}get hasReorderItems(){return!this.sortDisabled&&this.hasValidSetInfo}get hasNoItems(){return!this.hasReorderItems&&this.moveToItems.length<1&&this.addToItems.length<1}async setFocus(e){return this.focusSetter(()=>this.dropdownEl,e)}willUpdate(e){e.has("open")&&(this.hasUpdated||this.open!==!1)&&this.openHandler()}updated(){v(this)}openHandler(){if(this.disabled){this.open=!1;return}this.dropdownEl&&(this.dropdownEl.open=this.open)}setDropdownEl(e){e&&(this.dropdownEl=e,this.openHandler())}getLabel(){let{label:e,messages:t,setPosition:o,setSize:s,hasSetInfo:d}=this;if(!d)return e??"";let n=e?t.repositionLabel.replace(p.label,e):t.reposition;return n=n.replace(p.position,o?o.toString():""),n.replace(p.total,s?s.toString():"")}handleBeforeOpen(e){e.stopPropagation(),this.calciteSortHandleBeforeOpen.emit()}handleOpen(e){e.stopPropagation(),this.calciteSortHandleOpen.emit(),this.open=!0}handleBeforeClose(e){e.stopPropagation(),this.calciteSortHandleBeforeClose.emit()}handleClose(e){e.stopPropagation(),this.calciteSortHandleClose.emit(),this.open=!1}handleReorder(e){this.calciteSortHandleReorder.emit({reorder:e.target.dataset.value})}handleMoveTo(e){let t=e.target.dataset.id,o=this.moveToItems.find(s=>s.id===t);this.calciteSortHandleMove.emit({moveTo:o})}handleAddTo(e){let t=e.target.dataset.id,o=this.addToItems.find(s=>s.id===t);this.calciteSortHandleAdd.emit({addTo:o})}render(){let{disabled:e,flipPlacements:t,open:o,overlayPositioning:s,placement:d,scale:n,widthScale:H,hasNoItems:B}=this,c=this.getLabel(),O=e||B;return T({disabled:e,children:r`<calcite-dropdown class=${h(y.dropdown)} .disabled=${O} .flipPlacements=${t} @calciteDropdownBeforeClose=${this.handleBeforeClose} @calciteDropdownBeforeOpen=${this.handleBeforeOpen} @calciteDropdownClose=${this.handleClose} @calciteDropdownOpen=${this.handleOpen} .overlayPositioning=${s} .placement=${d} .scale=${n} .widthScale=${H} ${b(this.setDropdownEl)}><calcite-action .active=${o} appearance=transparent .aria=${{expanded:o}} class=${h(y.handle)} .dragHandle=${!0} .icon=${e?D.blank:D.drag} .label=${c} .scale=${n} slot=${C.trigger} .text=${c} title=${c??l}></calcite-action>${this.renderReorderGroup()}${this.renderMoveToGroup()}${this.renderAddToGroup()}</calcite-dropdown>`})}renderAddToItem(e){return a(e.id,r`<calcite-dropdown-item data-id=${e.id??l} .label=${e.label} @calciteDropdownItemSelect=${this.handleAddTo}>${e.label}</calcite-dropdown-item>`)}renderMoveToItem(e){return a(e.id,r`<calcite-dropdown-item data-id=${e.id??l} .label=${e.label} @calciteDropdownItemSelect=${this.handleMoveTo}>${e.label}</calcite-dropdown-item>`)}renderReorderGroup(){return this.hasReorderItems?a("reorder",r`<calcite-dropdown-group .groupTitle=${this.messages.reorder} id=${m.reorder} .scale=${this.scale} selection-mode=none>${this.renderTop()}${this.renderUp()}${this.renderDown()}${this.renderBottom()}</calcite-dropdown-group>`):null}renderAddToGroup(){let{messages:e,addToItems:t,scale:o}=this;return t.length?a("add-to-items",r`<calcite-dropdown-group .groupTitle=${e.addTo} id=${m.add} .scale=${o} selection-mode=none>${t.map(s=>this.renderAddToItem(s))}</calcite-dropdown-group>`):null}renderMoveToGroup(){let{messages:e,moveToItems:t,scale:o}=this;return t.length?a("move-to-items",r`<calcite-dropdown-group .groupTitle=${e.moveTo} id=${m.move} .scale=${o} selection-mode=none>${t.map(s=>this.renderMoveToItem(s))}</calcite-dropdown-group>`):null}renderDropdownItem(e,t){return a(P[e],r`<calcite-dropdown-item data-value=${P[e]??l} .label=${t} @calciteDropdownItemSelect=${this.handleReorder}>${t}</calcite-dropdown-item>`)}renderTop(){let{setPosition:e}=this;return e!==1&&e!==2?this.renderDropdownItem(0,this.messages.moveToTop):null}renderUp(){return this.setPosition!==1?this.renderDropdownItem(1,this.messages.moveUp):null}renderDown(){return this.setPosition!==this.setSize?this.renderDropdownItem(2,this.messages.moveDown):null}renderBottom(){let{setPosition:e,setSize:t}=this;return e!==t&&e!==t-1?this.renderDropdownItem(3,this.messages.moveToBottom):null}};$("calcite-sort-handle",u);export{u as SortHandle};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as Ce,d as q,e as fe}from"./2VKJIYLT.js";import{a as ce}from"./AHOXXRX5.js";import{A as P,B as de,C as X,D as ue,E as pe,a as x,b as n,c as m,d as I,e as k,f as p,g as E,h as b,i as D,j as U,k as j,m as W,n as O,o as B,s as R,t as S,v as he,x as _,y as N,z as V}from"./V4NPQ4WA.js";import"./FZIUTVKD.js";import{a as le,b as se}from"./NSBK36H4.js";import{a as T}from"./NULQJBCW.js";import{a as ne}from"./PSCEW76J.js";import{c as H}from"./W5OJOVZY.js";import{a as re}from"./S5CLKCGJ.js";import{a as te}from"./ALDDSDTX.js";import{a as ae}from"./LH7245HX.js";import{a as oe}from"./WOTQIMPZ.js";import"./B5JXPZDV.js";import"./3YZG7MA3.js";import"./CIU4VM7X.js";import{e as ie,w as K}from"./5IPJANUU.js";import"./ZLR2B6GQ.js";import{B as F,C as g,D as Q,E as r,F as $,P as ee,g as Z,h as u,l as w,o as L}from"./AUIOWPFN.js";var Fe=Z`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal);inline-size:var(--calcite-internal-color-picker-min-width);min-inline-size:var(--calcite-internal-color-picker-min-width)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([scale=s]){--calcite-internal-color-picker-min-width: 200px;--calcite-color-picker-spacing: var(--calcite-spacing-sm)}:host([scale=m]){--calcite-internal-color-picker-min-width: 240px;--calcite-color-picker-spacing: var(--calcite-spacing-md)}:host([scale=l]){--calcite-internal-color-picker-min-width: 304px;--calcite-color-picker-spacing: var(--calcite-spacing-lg);font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) .section:first-of-type{padding-block-start:var(--calcite-color-picker-spacing)}:host([scale=l]) .control-section{display:flex;flex-direction:column;flex-wrap:wrap;align-items:baseline}:host([scale=l]) .color-hex-options{inline-size:100%;display:flex;flex-shrink:1;flex-direction:column;justify-content:space-around}:host([scale=l]) .color-mode-container{flex-shrink:3}calcite-input-number{--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-prefix-text-color: var(--calcite-color-picker-input-prefix-text-color);--calcite-input-suffix-text-color: var(--calcite-color-picker-input-suffix-text-color)}calcite-button{--calcite-button-text-color: var(--calcite-color-picker-action-text-color);--calcite-button-text-color-press: var(--calcite-color-picker-action-text-color-press)}calcite-button:hover,calcite-button:focus{--calcite-button-text-color: var(--calcite-color-picker-action-text-color-hover)}calcite-button:active{--calcite-button-text-color: var(--calcite-color-picker-action-text-color-press)}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-picker-tab-border-color);--calcite-tab-text-color: var(--calcite-color-picker-tab-text-color);--calcite-tab-accent-color-press: var(--calcite-color-picker-tab-accent-color);--calcite-swatch-corner-radius: var(--calcite-color-picker-swatch-corner-radius)}calcite-tab-title:hover{--calcite-color-text-1: var(--calcite-color-picker-tab-text-color-hover)}calcite-swatch{--calcite-swatch-corner-radius: var(--calcite-color-picker-swatch-corner-radius)}.container{display:flex;flex-direction:column;block-size:min-content;border:1px solid var(--calcite-color-picker-border-color, var(--calcite-color-border-3));background-color:var(--calcite-color-picker-background-color, var(--calcite-color-foreground-1));border-radius:var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none));box-shadow:var(--calcite-color-picker-shadow, var(--calcite-shadow-none))}.control-and-scope{position:relative;display:flex;cursor:pointer;touch-action:none}.color-field,.control-and-scope{-webkit-user-select:none;user-select:none;border-radius:var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none)) var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none)) var(--calcite-corner-radius-none) var(--calcite-corner-radius-none)}.scope{pointer-events:none;position:absolute;z-index:var(--calcite-z-index);block-size:1px;inline-size:1px;border-radius:9999px;background-color:transparent;font-size:var(--calcite-font-size--1);outline-color:transparent}.scope:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))));outline-offset:6px}.hex-and-channels-group{display:flex;inline-size:100%;flex-direction:column;flex-wrap:wrap}.section{padding-block:0 var(--calcite-color-picker-spacing);padding-inline:var(--calcite-color-picker-spacing)}.section:first-of-type{padding-block-start:var(--calcite-color-picker-spacing)}.sliders{display:flex;flex-direction:column;justify-content:space-between;margin-inline-start:var(--calcite-color-picker-spacing);gap:var(--calcite-spacing-xxs)}.preview-and-sliders{display:flex;align-items:center;padding:var(--calcite-color-picker-spacing)}.color-hex-options,.section--split{flex-grow:1}.header{display:flex;align-items:center;justify-content:space-between;color:var(--calcite-color-picker-text-color, var(--calcite-color-text-1))}.color-mode-container{padding-block-start:var(--calcite-color-picker-spacing)}.channels{display:flex}.channel{flex-grow:1}.channel[data-channel-index="3"]{margin-inline-start:-1px;min-inline-size:81px}:host([scale=s]) .channel[data-channel-index="3"]{min-inline-size:68px}:host([scale=l]) .channel[data-channel-index="3"]{min-inline-size:88px}.saved-colors-buttons{display:flex}.swatch-group{margin-block-start:var(--calcite-color-picker-spacing)}:host([hidden]){display:none}[hidden]{display:none}`,ve=16,G=class extends Q{constructor(){super(),this._color=m,this.colorFieldScopeRef=F(),this.hueScopeRef=F(),this.internalColorUpdateContext=null,this.isActiveChannelInputEmpty=!1,this.mode=_.HEX,this.opacityScopeRef=F(),this.resizeObserver=te("resize",e=>this.resizeCanvas(e)),this.shiftKeyChannelAdjustment=0,this.upOrDownArrowKeyTracker=null,this._valueWasSet=!1,this.messages=ae({blocking:!0}),this.captureColorFieldColor=(e,t,i=!0)=>{let{width:o,height:a}=this.dynamicDimensions.colorField,l=Math.round(p.s/o*e),s=Math.round(p.v/a*(a-t));this.internalColorSet(this.baseColorFieldColor.hsv().saturationv(l).value(s),i)},this.cancelable=ne()(this),this.drawColorControls=H((e="all")=>{(e==="all"||e==="color-field")&&this.colorFieldRenderingContext&&this.drawColorField(),(e==="all"||e==="hue-slider")&&this.hueSliderRenderingContext&&this.drawHueSlider(),this.alphaChannel&&(e==="all"||e==="opacity-slider")&&this.opacitySliderRenderingContext&&this.drawOpacitySlider()},ve),this.globalPointerMoveHandler=e=>{let{activeCanvasInfo:t,el:i}=this;if(!i.isConnected||!t)return;let{context:o,bounds:a}=t,l,s,{clientX:c,clientY:h}=e;o.canvas.matches(":hover")?(l=c-a.x,s=h-a.y):(c<a.x+a.width&&c>a.x?l=c-a.x:c<a.x?l=0:l=a.width,h<a.y+a.height&&h>a.y?s=h-a.y:h<a.y?s=0:s=a.height),o===this.colorFieldRenderingContext?this.captureColorFieldColor(l,s,!1):o===this.hueSliderRenderingContext?this.captureHueSliderColor(l):o===this.opacitySliderRenderingContext&&this.captureOpacitySliderValue(l)},this.globalPointerUpHandler=e=>{if(!K(e))return;let t=this.activeCanvasInfo;this.activeCanvasInfo=null,this.drawColorControls(),t&&this.calciteColorPickerChange.emit()},this.resizeCanvas=H(e=>{if(!this.hasUpdated)return;let[t]=e,i=Math.floor(t.contentBoxSize[0].inlineSize);this.dynamicDimensions.colorField.width!==i&&(this.updateDynamicDimensions(i),this.updateCanvasSize(),this.drawColorControls())},ve),this.updateDynamicDimensions=e=>{let t={width:ue(e,this.staticDimensions,this.alphaChannel),height:this.staticDimensions.slider.height};this.dynamicDimensions={colorField:pe(e),slider:t}},this.focusSetter=oe()(this),this.channelMode="rgb",this.channels=this.toChannels(m),this.staticDimensions=D.m,this.savedColors=[],this.alphaChannel=!1,this.channelsDisabled=!1,this.clearable=!1,this.disabled=!1,this.fieldDisabled=!1,this.format="auto",this.hexDisabled=!1,this.savedDisabled=!1,this.scale="m",this.calciteColorPickerChange=L({cancelable:!1}),this.calciteColorPickerInput=L({cancelable:!1}),this.listen("keydown",this.handleChannelKeyUpOrDown,{capture:!0}),this.listen("keyup",this.handleChannelKeyUpOrDown,{capture:!0})}static{this.properties={channelMode:[16,{},{state:!0}],channels:[16,{},{state:!0}],colorFieldScopeLeft:[16,{},{state:!0}],colorFieldScopeTop:[16,{},{state:!0}],staticDimensions:[16,{},{state:!0}],hueScopeLeft:[16,{},{state:!0}],opacityScopeLeft:[16,{},{state:!0}],savedColors:[16,{},{state:!0}],scopeOrientation:[16,{},{state:!0}],alphaChannel:[5,{},{type:Boolean}],channelsDisabled:[5,{},{type:Boolean}],clearable:[7,{},{reflect:!0,type:Boolean}],color:[0,{},{attribute:!1}],disabled:[7,{},{reflect:!0,type:Boolean}],fieldDisabled:[7,{},{reflect:!0,type:Boolean}],format:[3,{},{reflect:!0}],hexDisabled:[5,{},{type:Boolean}],messageOverrides:[0,{},{attribute:!1}],numberingSystem:[3,{},{reflect:!0}],savedDisabled:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],storageId:[3,{},{reflect:!0}],value:1}}static{this.styles=Fe}get color(){return this._color}set color(e){let t=this._color;this._color=e,this.handleColorChange(e,t)}get value(){return this._value}set value(e){let t=this._value;this._value=e,this.handleValueChange(e,t),this._valueWasSet=!0}async setFocus(e){return this.focusSetter(()=>this.el,e)}connectedCallback(){super.connectedCallback(),this.observeResize(),this.cancelable.add([this.drawColorControls,this.resizeCanvas])}async load(){this._valueWasSet||(this._value??=R(S(m,this.alphaChannel)));let{clearable:e,color:t,format:i,value:o}=this,a=e&&!o,l=N(o),s=a||i==="auto"&&l||i===l,c=s?W(o,e,l):t;s||this.showIncompatibleColorWarning(o,i),this.setMode(i,!1),this.internalColorSet(c,!1,"initial"),this.updateStaticDimensions(this.scale),this.updateDynamicDimensions(D[this.scale].minWidth);let h=`${I}${this.storageId}`;this.storageId&&localStorage.getItem(h)&&(this.savedColors=JSON.parse(localStorage.getItem(h)))}willUpdate(e){e.has("alphaChannel")&&(this.hasUpdated||this.alphaChannel!==!1)&&this.handleAlphaChannelChange(this.alphaChannel),this.hasUpdated&&(e.has("alphaChannel")&&this.alphaChannel!==!1||e.has("staticDimensions")&&this.staticDimensions!==D.m)&&this.handleAlphaChannelDimensionsChange(),(e.has("alphaChannel")&&(this.hasUpdated||this.alphaChannel!==!1)||e.has("format")&&(this.hasUpdated||this.format!=="auto"))&&this.handleFormatOrAlphaChannelChange(),e.has("scale")&&(this.hasUpdated||this.scale!=="m")&&this.handleScaleChange(this.scale)}updated(){le(this)}loaded(){this.handleAlphaChannelDimensionsChange()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("pointermove",this.globalPointerMoveHandler),window.removeEventListener("pointerup",this.globalPointerUpHandler),this.resizeObserver?.disconnect()}get baseColorFieldColor(){return this.color||this.previousColor||m}get effectiveSliderWidth(){return this.dynamicDimensions.slider.width}observeResize(){this.resizeObserver?.observe(this.el)}handleAlphaChannelChange(e){let{format:t}=this;e&&t!=="auto"&&!P(t)&&(console.warn(`ignoring alphaChannel as the current format (${t}) does not support alpha`),this.alphaChannel=!1)}handleAlphaChannelDimensionsChange(){this.drawColorControls()}handleColorChange(e,t){this.drawColorControls(),this.updateChannelsFromColor(e),this.previousColor=t}handleFormatOrAlphaChannelChange(){this.setMode(this.format),this.internalColorSet(this.color,!1,"internal")}handleScaleChange(e="m"){this.updateStaticDimensions(e),this.updateCanvasSize(),this.drawColorControls()}handleValueChange(e,t){let{clearable:i,format:o}=this,a=!i||e,l=!1;if(a){let d=N(e);if(!d||o!=="auto"&&d!==o){this.showIncompatibleColorWarning(e,o),this._value=t;return}l=this.mode!==d,this.setMode(d,this.internalColorUpdateContext===null)}let s=this.activeCanvasInfo;if(this.internalColorUpdateContext==="initial")return;if(this.internalColorUpdateContext==="user-interaction"){this.calciteColorPickerInput.emit(),s||this.calciteColorPickerChange.emit();return}let c=W(e,i,this.mode),h=!V(c,this.color);(l||h)&&this.internalColorSet(c,this.alphaChannel&&!(this.mode.endsWith("a")||this.mode.endsWith("a-css"))||this.internalColorUpdateContext==="internal","internal")}handleTabActivate(e){this.channelMode=e.currentTarget.getAttribute("data-color-mode"),this.updateChannelsFromColor(this.color)}handleColorFieldScopeKeyDown(e){let{key:t}=e,i={ArrowUp:{x:0,y:-10},ArrowRight:{x:10,y:0},ArrowDown:{x:0,y:10},ArrowLeft:{x:-10,y:0}};i[t]&&(e.preventDefault(),this.scopeOrientation=t==="ArrowDown"||t==="ArrowUp"?"vertical":"horizontal",this.captureColorFieldColor(this.colorFieldScopeLeft+i[t].x||0,this.colorFieldScopeTop+i[t].y||0,!1))}handleHueScopeKeyDown(e){let t=e.shiftKey?10:1,{key:i}=e,o={ArrowUp:1,ArrowRight:1,ArrowDown:-1,ArrowLeft:-1};if(o[i]){e.preventDefault();let a=o[i]*t,l=this.baseColorFieldColor.hue(),s=this.baseColorFieldColor.hue(l+a);this.internalColorSet(s,!1)}}handleHexInputChange(e){e.stopPropagation();let{clearable:t,color:i}=this,a=e.target.value;if(t&&!a){this.internalColorSet(null);return}let l=i&&R(S(i,P(this.mode)));a!==l&&this.internalColorSet(x(a))}handleSavedColorSelect(e){let t=e.currentTarget;this.internalColorSet(x(t.color))}handleChannelInput(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),a=i===3?b.max:this.channelMode==="rgb"?k[Object.keys(k)[i]]:p[Object.keys(p)[i]],l;if(!t.value)l="",this.isActiveChannelInputEmpty=!0,this.upOrDownArrowKeyTracker=null;else{let c=Number(t.value)+this.shiftKeyChannelAdjustment;l=Ce(c,0,a).toString()}t.value=l,l!==""&&this.shiftKeyChannelAdjustment!==0?this.handleChannelChange(e):l!==""&&this.handleChannelChange(e)}handleChannelBlur(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),o=[...this.channels];!t.value&&!this.clearable&&(t.value=o[i]?.toString())}handleChannelFocus(e){e.currentTarget.selectText()}handleChannelKeyUpOrDown(e){this.shiftKeyChannelAdjustment=0;let{key:t}=e;if(t!=="ArrowUp"&&t!=="ArrowDown"||!e.composedPath().some(a=>a.classList?.contains(n.channel)))return;let{shiftKey:i}=e;if(e.preventDefault(),!this.color){this.internalColorSet(this.previousColor),e.stopPropagation();return}let o=9;this.shiftKeyChannelAdjustment=t==="ArrowUp"&&i?o:t==="ArrowDown"&&i?-o:0,t==="ArrowUp"&&(this.upOrDownArrowKeyTracker="up"),t==="ArrowDown"&&(this.upOrDownArrowKeyTracker="down")}getChannelInputLimit(e){return this.channelMode==="rgb"?k[Object.keys(k)[e]]:p[Object.keys(p)[e]]}handleChannelChange(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),o=[...this.channels];if(this.clearable&&!t.value){this.channels=[null,null,null,null],this.internalColorSet(null);return}let l=i===3;this.isActiveChannelInputEmpty&&this.upOrDownArrowKeyTracker&&(t.value=this.upOrDownArrowKeyTracker==="up"?(o[i]+1<=this.getChannelInputLimit(i)?o[i]+1:this.getChannelInputLimit(i)).toString():(o[i]-1>=0?o[i]-1:0).toString(),this.isActiveChannelInputEmpty=!1,this.upOrDownArrowKeyTracker=null);let s=t.value?Number(t.value):o[i];o[i]=l?B(s):s,this.updateColorFromChannels(o)}handleSavedColorKeyDown(e){re(e.key)&&(e.preventDefault(),this.handleSavedColorSelect(e))}handleColorFieldPointerDown(e){this.handleCanvasControlPointerDown(e,this.colorFieldRenderingContext,this.captureColorFieldColor,this.colorFieldScopeRef.value)}focusScope(e){requestAnimationFrame(()=>{e.focus()})}handleHueSliderPointerDown(e){this.handleCanvasControlPointerDown(e,this.hueSliderRenderingContext,this.captureHueSliderColor,this.hueScopeRef.value)}handleOpacitySliderPointerDown(e){this.handleCanvasControlPointerDown(e,this.opacitySliderRenderingContext,this.captureOpacitySliderValue,this.opacityScopeRef.value)}handleCanvasControlPointerDown(e,t,i,o){K(e)&&(window.addEventListener("pointermove",this.globalPointerMoveHandler),window.addEventListener("pointerup",this.globalPointerUpHandler,{once:!0}),this.activeCanvasInfo={context:t,bounds:t.canvas.getBoundingClientRect()},i.call(this,e.offsetX,e.offsetY),this.focusScope(o))}handleKeyDown(e){e.key==="Enter"&&e.preventDefault()}showIncompatibleColorWarning(e,t){console.warn(`ignoring color value (${e}) as it is not compatible with the current format (${t})`)}setMode(e,t=!0){let i=e==="auto"?this.mode:e;this.mode=this.ensureCompatibleMode(i,t)}ensureCompatibleMode(e,t){let{alphaChannel:i}=this,o=P(e);if(i&&!o){let a=de(e);return t&&console.warn(`setting format to (${a}) as the provided one (${e}) does not support alpha`),a}if(!i&&o){let a=X(e);return t&&console.warn(`setting format to (${a}) as the provided one (${e}) does not support alpha`),a}return e}captureHueSliderColor(e){let t=E/this.effectiveSliderWidth*e;this.internalColorSet(this.baseColorFieldColor.hue(t),!1)}captureOpacitySliderValue(e){let t=B(b.max/this.effectiveSliderWidth*e);this.internalColorSet(this.baseColorFieldColor.alpha(t),!1)}internalColorSet(e,t=!0,i="user-interaction"){t&&V(e,this.color)||(this.internalColorUpdateContext=i,this.color=e,this.value=this.toValue(e),this.internalColorUpdateContext=null)}toValue(e,t=this.mode){if(!e)return null;if(t.includes("hex")){let a=t===_.HEXA;return R(S(e.round(),a),a)}if(t.includes("-css")){let a=e[t.replace("-css","").replace("a","")]().round().string();if((t.endsWith("a")||t.endsWith("a-css"))&&e.alpha()===1){let s=a.slice(0,3),c=a.slice(4,-1);return`${s}a(${c}, ${e.alpha()})`}return a}let o=e[X(t)]().round().object();return t.endsWith("a")?he(o):o}getSliderCapSpacing(){let{staticDimensions:{slider:{height:e},thumb:{radius:t}}}=this;return t*2-e}updateStaticDimensions(e="m"){this.staticDimensions=D[e]}deleteColor(){let e=S(this.color,this.alphaChannel);if(!(this.savedColors.indexOf(e)>-1))return;let i=this.savedColors.filter(a=>a!==e);this.savedColors=i;let o=`${I}${this.storageId}`;this.storageId&&localStorage.setItem(o,JSON.stringify(i))}saveColor(){let e=S(this.color,this.alphaChannel);if(this.savedColors.indexOf(e)>-1)return;let i=[...this.savedColors,e];this.savedColors=i;let o=`${I}${this.storageId}`;this.storageId&&localStorage.setItem(o,JSON.stringify(i))}drawColorField(){let e=this.colorFieldRenderingContext,{width:t,height:i}=this.dynamicDimensions.colorField;e.fillStyle=this.baseColorFieldColor.hsv().saturationv(100).value(100).alpha(1).string(),e.fillRect(0,0,t,i);let o=e.createLinearGradient(0,0,t,0);o.addColorStop(0,"rgba(255,255,255,1)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,t,i);let a=e.createLinearGradient(0,0,0,i);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),e.fillStyle=a,e.fillRect(0,0,t,i),this.drawActiveColorFieldColor()}setCanvasContextSize(e,{height:t,width:i}){if(!e)return;let o=window.devicePixelRatio||1;e.width=i*o,e.height=t*o,e.style.height=`${t}px`,e.style.width=`${i}px`,e.getContext("2d").scale(o,o)}initColorField(e){e&&(this.colorFieldRenderingContext=e.getContext("2d"),this.updateCanvasSize("color-field"),this.drawColorControls())}initHueSlider(e){e&&(this.hueSliderRenderingContext=e.getContext("2d"),this.updateCanvasSize("hue-slider"),this.drawHueSlider())}initOpacitySlider(e){e&&(this.opacitySliderRenderingContext=e.getContext("2d"),this.updateCanvasSize("opacity-slider"),this.drawOpacitySlider())}updateCanvasSize(e="all"){let{dynamicDimensions:t,staticDimensions:i}=this;(e==="all"||e==="color-field")&&this.setCanvasContextSize(this.colorFieldRenderingContext?.canvas,t.colorField);let o={width:this.effectiveSliderWidth,height:i.slider.height+(i.thumb.radius-t.slider.height/2)*2};(e==="all"||e==="hue-slider")&&this.setCanvasContextSize(this.hueSliderRenderingContext?.canvas,o),(e==="all"||e==="opacity-slider")&&this.setCanvasContextSize(this.opacitySliderRenderingContext?.canvas,o)}drawActiveColorFieldColor(){let{color:e}=this;if(!e)return;let t=e.hsv(),{staticDimensions:{thumb:{radius:i}}}=this,{width:o,height:a}=this.dynamicDimensions.colorField,l=t.saturationv()/(p.s/o),s=a-t.value()/(p.v/a);requestAnimationFrame(()=>{this.colorFieldScopeLeft=l,this.colorFieldScopeTop=s}),this.drawThumb(this.colorFieldRenderingContext,i,l,s,t,!1)}drawThumb(e,t,i,o,a,l){let c=2*Math.PI,h=1;if(e.beginPath(),e.arc(i,o,t,0,c),e.fillStyle="#fff",e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=h,e.stroke(),l&&a.alpha()<1){let f=e.createPattern(this.getCheckeredBackgroundPattern(),"repeat");e.beginPath(),e.arc(i,o,t-3,0,c),e.fillStyle=f,e.fill()}e.globalCompositeOperation="source-atop",e.beginPath(),e.arc(i,o,t-3,0,c);let d=l?a.alpha():1;e.fillStyle=a.rgb().alpha(d).string(),e.fill(),e.globalCompositeOperation="source-over"}drawActiveHueSliderColor(){let{color:e}=this;if(!e)return;let t=e.hsv().saturationv(100).value(100),{staticDimensions:{thumb:{radius:i}}}=this,o=this.effectiveSliderWidth,a=t.hue()/(E/o),l=i,s=this.getSliderBoundX(a,o,i);requestAnimationFrame(()=>{this.hueScopeLeft=s}),this.drawThumb(this.hueSliderRenderingContext,i,s,l,t,!1)}drawHueSlider(){let e=this.hueSliderRenderingContext,{staticDimensions:{slider:{height:t},thumb:{radius:i}}}=this,o=0,a=i-t/2,l=this.effectiveSliderWidth,s=e.createLinearGradient(0,0,l,0),c=["red","yellow","lime","cyan","blue","magenta","#ff0004"],h=1/(c.length-1),d=0;c.forEach(f=>{s.addColorStop(d,x(f).string()),d+=h}),e.clearRect(0,0,l,t+this.getSliderCapSpacing()*2),this.drawSliderPath(e,t,l,o,a),e.fillStyle=s,e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=1,e.stroke(),this.drawActiveHueSliderColor()}drawOpacitySlider(){let e=this.opacitySliderRenderingContext,{baseColorFieldColor:t,staticDimensions:{slider:{height:i},thumb:{radius:o}}}=this,a=0,l=o-i/2,s=this.effectiveSliderWidth;e.clearRect(0,0,s,i+this.getSliderCapSpacing()*2);let c=e.createLinearGradient(0,l,s,0),h=t.rgb().alpha(0),d=t.rgb().alpha(.5),f=t.rgb().alpha(1);c.addColorStop(0,h.string()),c.addColorStop(.5,d.string()),c.addColorStop(1,f.string()),this.drawSliderPath(e,i,s,a,l);let C=e.createPattern(this.getCheckeredBackgroundPattern(),"repeat");e.fillStyle=C,e.fill(),e.fillStyle=c,e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=1,e.stroke(),this.drawActiveOpacitySliderColor()}drawSliderPath(e,t,i,o,a){let l=t/2+1;e.beginPath(),e.moveTo(o+l,a),e.lineTo(o+i-l,a),e.quadraticCurveTo(o+i,a,o+i,a+l),e.lineTo(o+i,a+t-l),e.quadraticCurveTo(o+i,a+t,o+i-l,a+t),e.lineTo(o+l,a+t),e.quadraticCurveTo(o,a+t,o,a+t-l),e.lineTo(o,a+l),e.quadraticCurveTo(o,a,o+l,a),e.closePath()}getCheckeredBackgroundPattern(){if(this.checkerPattern)return this.checkerPattern;let e=document.createElement("canvas");e.width=10,e.height=10;let t=e.getContext("2d");return t.fillStyle="#ccc",t.fillRect(0,0,10,10),t.fillStyle="#fff",t.fillRect(0,0,5,5),t.fillRect(5,5,5,5),this.checkerPattern=e,e}drawActiveOpacitySliderColor(){let{color:e}=this;if(!e)return;let t=e,{staticDimensions:{thumb:{radius:i}}}=this,o=this.effectiveSliderWidth,a=O(t.alpha())/(b.max/o),l=i,s=this.getSliderBoundX(a,o,i);requestAnimationFrame(()=>{this.opacityScopeLeft=s}),this.drawThumb(this.opacitySliderRenderingContext,i,s,l,t,!0)}getSliderBoundX(e,t,i){let o=fe(e,t,i);return o===0?e:o===-1?q(e,0,t,i,i*2):q(e,0,t,t-i*2,t-i)}handleOpacityScopeKeyDown(e){let t=e.shiftKey?10:1,{key:i}=e,o={ArrowUp:.01,ArrowRight:.01,ArrowDown:-.01,ArrowLeft:-.01};if(o[i]){e.preventDefault();let a=o[i]*t,l=this.baseColorFieldColor.alpha(),s=this.baseColorFieldColor.alpha(l+a);this.internalColorSet(s,!1)}}updateColorFromChannels(e){this.internalColorSet(x(e,this.channelMode))}updateChannelsFromColor(e){this.channels=e?this.toChannels(e):[null,null,null,null]}toChannels(e){let{channelMode:t}=this,i=e[t]().round().array();return i.length===3&&i.push(1),i}getAdjustedScopePosition(e,t){return[e-U/2,t-U/2]}render(){let{channelsDisabled:e,color:t,colorFieldScopeLeft:i,colorFieldScopeTop:o,staticDimensions:{thumb:{radius:a}},fieldDisabled:l,hexDisabled:s,hueScopeLeft:c,messages:h,alphaChannel:d,opacityScopeLeft:f,savedColors:C,savedDisabled:y,scale:v,scopeOrientation:me}=this,Y=this.effectiveSliderWidth,M=t?S(t,d):null,ge=a,be=c??Y*m.hue()/p.h,Se=a,ye=f??Y*O(m.alpha())/b.max,J=t===void 0,z=me==="vertical",[we,$e]=this.getAdjustedScopePosition(i,o),[xe,ke]=this.getAdjustedScopePosition(be,ge),[De,Ae]=this.getAdjustedScopePosition(ye,Se);return se({disabled:this.disabled,children:u`<div class=${r(n.container)}>${l?null:u`<div class=${r(n.controlAndScope)}><canvas class=${r(n.colorField)} @pointerdown=${this.handleColorFieldPointerDown} ${g(this.initColorField)}></canvas><div .ariaLabel=${z?h.value:h.saturation} .ariaValueMax=${z?p.v:p.s} aria-valuemin=0 .ariaValueNow=${(z?t?.saturationv():t?.value())||"0"} class=${r({[n.scope]:!0,[n.colorFieldScope]:!0})} @keydown=${this.handleColorFieldScopeKeyDown} role=slider style=${$({top:`${$e||0}px`,left:`${we||0}px`})} tabindex=0 ${g(this.colorFieldScopeRef)}></div></div>`}<div class=${r(n.previewAndSliders)}><calcite-swatch class=${r(n.preview)} .color=${M} .label=${M} .scale=${this.alphaChannel?"l":this.scale}></calcite-swatch><div class=${r(n.sliders)}><div class=${r(n.controlAndScope)}><canvas class=${r({[n.slider]:!0,[n.hueSlider]:!0})} @pointerdown=${this.handleHueSliderPointerDown} ${g(this.initHueSlider)}></canvas><div .ariaLabel=${h.hue} .ariaValueMax=${p.h} aria-valuemin=0 .ariaValueNow=${t?.round().hue()||m.round().hue()} class=${r({[n.scope]:!0,[n.hueScope]:!0})} @keydown=${this.handleHueScopeKeyDown} role=slider style=${$({top:`${ke}px`,left:`${xe}px`})} tabindex=0 ${g(this.hueScopeRef)}></div></div>${d?u`<div class=${r(n.controlAndScope)}><canvas class=${r({[n.slider]:!0,[n.opacitySlider]:!0})} @pointerdown=${this.handleOpacitySliderPointerDown} ${g(this.initOpacitySlider)}></canvas><div .ariaLabel=${h.opacity} .ariaValueMax=${b.max} .ariaValueMin=${b.min} .ariaValueNow=${(t||m).round().alpha()} class=${r({[n.scope]:!0,[n.opacityScope]:!0})} @keydown=${this.handleOpacityScopeKeyDown} role=slider style=${$({top:`${Ae}px`,left:`${De}px`})} tabindex=0 ${g(this.opacityScopeRef)}></div></div>`:null}</div></div>${s&&e?null:u`<div class=${r({[n.controlSection]:!0,[n.section]:!0})}><div class=${r(n.hexAndChannelsGroup)}>${s?null:u`<div class=${r(n.hexOptions)}><calcite-color-picker-hex-input .allowEmpty=${this.clearable} .alphaChannel=${d} class=${r(n.control)} .messages=${h} .numberingSystem=${this.numberingSystem} @calciteColorPickerHexInputChange=${this.handleHexInputChange} .scale=${v} .value=${M}></calcite-color-picker-hex-input></div>`}${e?null:u`<calcite-tabs class=${r({[n.colorModeContainer]:!0,[n.splitSection]:!0})} .scale=${v==="l"?"m":"s"}><calcite-tab-nav slot=title-group>${this.renderChannelsTabTitle("rgb")}${this.renderChannelsTabTitle("hsv")}</calcite-tab-nav>${this.renderChannelsTab("rgb")}${this.renderChannelsTab("hsv")}</calcite-tabs>`}</div></div>`}${y?null:u`<div class=${r({[n.savedColorsSection]:!0,[n.section]:!0})}><div class=${r(n.header)}><label>${h.saved}</label><div class=${r(n.savedColorsButtons)}><calcite-button appearance=transparent class=${r(n.deleteColor)} .disabled=${J} .iconStart=${j.minus} kind=neutral .label=${h.deleteColor} @click=${this.deleteColor} .scale=${v} type=button></calcite-button><calcite-button appearance=transparent class=${r(n.saveColor)} .disabled=${J} .iconStart=${j.plus} kind=neutral .label=${h.saveColor} @click=${this.saveColor} .scale=${v} type=button></calcite-button></div></div>${C.length>0?u`<calcite-swatch-group class=${r(n.swatchGroup)} .label=${h.saved} .scale=${v} selection-mode=none>${ce(C,A=>A,A=>u`<calcite-swatch class=${r(n.savedColor)} .color=${A} .label=${A} @click=${this.handleSavedColorSelect} @keydown=${this.handleSavedColorKeyDown} .scale=${v} tabindex=0></calcite-swatch>`)}</calcite-swatch-group>`:null}</div>`}</div>`})}renderChannelsTabTitle(e){let{channelMode:t,messages:i}=this,o=e===t,a=e==="rgb"?i.rgb:i.hsv;return T(e,u`<calcite-tab-title class=${r(n.colorMode)} data-color-mode=${e??w} @calciteTabsActivate=${this.handleTabActivate} .selected=${o}>${a}</calcite-tab-title>`)}renderChannelsTab(e){let{clearable:t,channelMode:i,channels:o,messages:a,alphaChannel:l}=this,s=e===i,h=e==="rgb"?[a.red,a.green,a.blue]:[a.hue,a.saturation,a.value],d=ie(this.el),f=l?o:o.slice(0,3);return T(e,u`<calcite-tab class=${r(n.control)} .selected=${s}><div class=${r(n.channels)} dir=ltr>${f.map((C,y)=>{let v=y===3;return v&&(C=t&&!C?C:O(C)),this.renderChannel(C,y,h[y],d,v?"%":"")})}</div></calcite-tab>`)}renderChannel(e,t,i,o,a){return T(t,u`<calcite-input-number class=${r(n.channel)} data-channel-index=${t??w} dir=${o??w} .label=${i} lang=${this.messages._lang??w} number-button-type=none .numberingSystem=${this.numberingSystem} @keydown=${this.handleKeyDown} @calciteInputNumberChange=${this.handleChannelChange} @calciteInputNumberInput=${this.handleChannelInput} @calciteInternalInputNumberBlur=${this.handleChannelBlur} @calciteInternalInputNumberFocus=${this.handleChannelFocus} .scale=${this.scale==="l"?"m":"s"} style=${$({marginLeft:t>0&&!(this.scale==="s"&&this.alphaChannel&&t===3)?"-1px":""})} .suffixText=${a} .value=${e?.toString()}></calcite-input-number>`)}};ee("calcite-color-picker",G);export{G as ColorPicker};
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as Ce,d as q,e as fe}from"./3Y3BABEA.js";import{a as ce}from"./J4UVTWRA.js";import{A as P,B as de,C as X,D as ue,E as pe,a as x,b as n,c as m,d as I,e as k,f as p,g as E,h as b,i as D,j as U,k as j,m as W,n as O,o as B,s as R,t as S,v as he,x as _,y as N,z as V}from"./QVSPMDDW.js";import"./7RLP2DKK.js";import{a as le,b as se}from"./ZOYJ4343.js";import{a as T}from"./ULUKHLQN.js";import{a as ne}from"./F3FMRPUL.js";import{c as H}from"./OWSWQHLM.js";import{a as re}from"./JVPR6YZA.js";import{a as te}from"./AD2NNFBJ.js";import{a as ae}from"./UVFQM6FI.js";import{a as oe}from"./XGPCFFL2.js";import"./BC4ZMTFC.js";import"./DDSPVSLH.js";import"./W4XITGKA.js";import{e as ie,w as K}from"./SBARVI35.js";import"./HWDBQK2D.js";import{B as F,C as g,D as Q,E as r,F as $,P as ee,g as Z,h as u,l as w,o as L}from"./2ECRIOED.js";var Fe=Z`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block;font-size:var(--calcite-font-size--2);line-height:1rem;font-weight:var(--calcite-font-weight-normal);inline-size:var(--calcite-internal-color-picker-min-width);min-inline-size:var(--calcite-internal-color-picker-min-width)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([scale=s]){--calcite-internal-color-picker-min-width: 200px;--calcite-color-picker-spacing: var(--calcite-spacing-sm)}:host([scale=m]){--calcite-internal-color-picker-min-width: 240px;--calcite-color-picker-spacing: var(--calcite-spacing-md)}:host([scale=l]){--calcite-internal-color-picker-min-width: 304px;--calcite-color-picker-spacing: var(--calcite-spacing-lg);font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=l]) .section:first-of-type{padding-block-start:var(--calcite-color-picker-spacing)}:host([scale=l]) .control-section{display:flex;flex-direction:column;flex-wrap:wrap;align-items:baseline}:host([scale=l]) .color-hex-options{inline-size:100%;display:flex;flex-shrink:1;flex-direction:column;justify-content:space-around}:host([scale=l]) .color-mode-container{flex-shrink:3}calcite-input-number{--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-prefix-text-color: var(--calcite-color-picker-input-prefix-text-color);--calcite-input-suffix-text-color: var(--calcite-color-picker-input-suffix-text-color)}calcite-button{--calcite-button-text-color: var(--calcite-color-picker-action-text-color);--calcite-button-text-color-press: var(--calcite-color-picker-action-text-color-press)}calcite-button:hover,calcite-button:focus{--calcite-button-text-color: var(--calcite-color-picker-action-text-color-hover)}calcite-button:active{--calcite-button-text-color: var(--calcite-color-picker-action-text-color-press)}calcite-tabs{--calcite-tab-border-color: var(--calcite-color-picker-tab-border-color);--calcite-tab-text-color: var(--calcite-color-picker-tab-text-color);--calcite-tab-accent-color-press: var(--calcite-color-picker-tab-accent-color);--calcite-swatch-corner-radius: var(--calcite-color-picker-swatch-corner-radius)}calcite-tab-title:hover{--calcite-color-text-1: var(--calcite-color-picker-tab-text-color-hover)}calcite-swatch{--calcite-swatch-corner-radius: var(--calcite-color-picker-swatch-corner-radius)}.container{display:flex;flex-direction:column;block-size:min-content;border:1px solid var(--calcite-color-picker-border-color, var(--calcite-color-border-3));background-color:var(--calcite-color-picker-background-color, var(--calcite-color-foreground-1));border-radius:var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none));box-shadow:var(--calcite-color-picker-shadow, var(--calcite-shadow-none))}.control-and-scope{position:relative;display:flex;cursor:pointer;touch-action:none}.color-field,.control-and-scope{-webkit-user-select:none;user-select:none;border-radius:var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none)) var(--calcite-color-picker-corner-radius, var(--calcite-corner-radius-none)) var(--calcite-corner-radius-none) var(--calcite-corner-radius-none)}.scope{pointer-events:none;position:absolute;z-index:var(--calcite-z-index);block-size:1px;inline-size:1px;border-radius:9999px;background-color:transparent;font-size:var(--calcite-font-size--1);outline-color:transparent}.scope:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))));outline-offset:6px}.hex-and-channels-group{display:flex;inline-size:100%;flex-direction:column;flex-wrap:wrap}.section{padding-block:0 var(--calcite-color-picker-spacing);padding-inline:var(--calcite-color-picker-spacing)}.section:first-of-type{padding-block-start:var(--calcite-color-picker-spacing)}.sliders{display:flex;flex-direction:column;justify-content:space-between;margin-inline-start:var(--calcite-color-picker-spacing);gap:var(--calcite-spacing-xxs)}.preview-and-sliders{display:flex;align-items:center;padding:var(--calcite-color-picker-spacing)}.color-hex-options,.section--split{flex-grow:1}.header{display:flex;align-items:center;justify-content:space-between;color:var(--calcite-color-picker-text-color, var(--calcite-color-text-1))}.color-mode-container{padding-block-start:var(--calcite-color-picker-spacing)}.channels{display:flex}.channel{flex-grow:1}.channel[data-channel-index="3"]{margin-inline-start:-1px;min-inline-size:81px}:host([scale=s]) .channel[data-channel-index="3"]{min-inline-size:68px}:host([scale=l]) .channel[data-channel-index="3"]{min-inline-size:88px}.saved-colors-buttons{display:flex}.swatch-group{margin-block-start:var(--calcite-color-picker-spacing)}:host([hidden]){display:none}[hidden]{display:none}`,ve=16,G=class extends Q{constructor(){super(),this._color=m,this.colorFieldScopeRef=F(),this.hueScopeRef=F(),this.internalColorUpdateContext=null,this.isActiveChannelInputEmpty=!1,this.mode=_.HEX,this.opacityScopeRef=F(),this.resizeObserver=te("resize",e=>this.resizeCanvas(e)),this.shiftKeyChannelAdjustment=0,this.upOrDownArrowKeyTracker=null,this._valueWasSet=!1,this.messages=ae({blocking:!0}),this.captureColorFieldColor=(e,t,i=!0)=>{let{width:o,height:a}=this.dynamicDimensions.colorField,l=Math.round(p.s/o*e),s=Math.round(p.v/a*(a-t));this.internalColorSet(this.baseColorFieldColor.hsv().saturationv(l).value(s),i)},this.cancelable=ne()(this),this.drawColorControls=H((e="all")=>{(e==="all"||e==="color-field")&&this.colorFieldRenderingContext&&this.drawColorField(),(e==="all"||e==="hue-slider")&&this.hueSliderRenderingContext&&this.drawHueSlider(),this.alphaChannel&&(e==="all"||e==="opacity-slider")&&this.opacitySliderRenderingContext&&this.drawOpacitySlider()},ve),this.globalPointerMoveHandler=e=>{let{activeCanvasInfo:t,el:i}=this;if(!i.isConnected||!t)return;let{context:o,bounds:a}=t,l,s,{clientX:c,clientY:h}=e;o.canvas.matches(":hover")?(l=c-a.x,s=h-a.y):(c<a.x+a.width&&c>a.x?l=c-a.x:c<a.x?l=0:l=a.width,h<a.y+a.height&&h>a.y?s=h-a.y:h<a.y?s=0:s=a.height),o===this.colorFieldRenderingContext?this.captureColorFieldColor(l,s,!1):o===this.hueSliderRenderingContext?this.captureHueSliderColor(l):o===this.opacitySliderRenderingContext&&this.captureOpacitySliderValue(l)},this.globalPointerUpHandler=e=>{if(!K(e))return;let t=this.activeCanvasInfo;this.activeCanvasInfo=null,this.drawColorControls(),t&&this.calciteColorPickerChange.emit()},this.resizeCanvas=H(e=>{if(!this.hasUpdated)return;let[t]=e,i=Math.floor(t.contentBoxSize[0].inlineSize);this.dynamicDimensions.colorField.width!==i&&(this.updateDynamicDimensions(i),this.updateCanvasSize(),this.drawColorControls())},ve),this.updateDynamicDimensions=e=>{let t={width:ue(e,this.staticDimensions,this.alphaChannel),height:this.staticDimensions.slider.height};this.dynamicDimensions={colorField:pe(e),slider:t}},this.focusSetter=oe()(this),this.channelMode="rgb",this.channels=this.toChannels(m),this.staticDimensions=D.m,this.savedColors=[],this.alphaChannel=!1,this.channelsDisabled=!1,this.clearable=!1,this.disabled=!1,this.fieldDisabled=!1,this.format="auto",this.hexDisabled=!1,this.savedDisabled=!1,this.scale="m",this.calciteColorPickerChange=L({cancelable:!1}),this.calciteColorPickerInput=L({cancelable:!1}),this.listen("keydown",this.handleChannelKeyUpOrDown,{capture:!0}),this.listen("keyup",this.handleChannelKeyUpOrDown,{capture:!0})}static{this.properties={channelMode:[16,{},{state:!0}],channels:[16,{},{state:!0}],colorFieldScopeLeft:[16,{},{state:!0}],colorFieldScopeTop:[16,{},{state:!0}],staticDimensions:[16,{},{state:!0}],hueScopeLeft:[16,{},{state:!0}],opacityScopeLeft:[16,{},{state:!0}],savedColors:[16,{},{state:!0}],scopeOrientation:[16,{},{state:!0}],alphaChannel:[5,{},{type:Boolean}],channelsDisabled:[5,{},{type:Boolean}],clearable:[7,{},{reflect:!0,type:Boolean}],color:[0,{},{attribute:!1}],disabled:[7,{},{reflect:!0,type:Boolean}],fieldDisabled:[7,{},{reflect:!0,type:Boolean}],format:[3,{},{reflect:!0}],hexDisabled:[5,{},{type:Boolean}],messageOverrides:[0,{},{attribute:!1}],numberingSystem:[3,{},{reflect:!0}],savedDisabled:[7,{},{reflect:!0,type:Boolean}],scale:[3,{},{reflect:!0}],storageId:[3,{},{reflect:!0}],value:1}}static{this.styles=Fe}get color(){return this._color}set color(e){let t=this._color;this._color=e,this.handleColorChange(e,t)}get value(){return this._value}set value(e){let t=this._value;this._value=e,this.handleValueChange(e,t),this._valueWasSet=!0}async setFocus(e){return this.focusSetter(()=>this.el,e)}connectedCallback(){super.connectedCallback(),this.observeResize(),this.cancelable.add([this.drawColorControls,this.resizeCanvas])}async load(){this._valueWasSet||(this._value??=R(S(m,this.alphaChannel)));let{clearable:e,color:t,format:i,value:o}=this,a=e&&!o,l=N(o),s=a||i==="auto"&&l||i===l,c=s?W(o,e,l):t;s||this.showIncompatibleColorWarning(o,i),this.setMode(i,!1),this.internalColorSet(c,!1,"initial"),this.updateStaticDimensions(this.scale),this.updateDynamicDimensions(D[this.scale].minWidth);let h=`${I}${this.storageId}`;this.storageId&&localStorage.getItem(h)&&(this.savedColors=JSON.parse(localStorage.getItem(h)))}willUpdate(e){e.has("alphaChannel")&&(this.hasUpdated||this.alphaChannel!==!1)&&this.handleAlphaChannelChange(this.alphaChannel),this.hasUpdated&&(e.has("alphaChannel")&&this.alphaChannel!==!1||e.has("staticDimensions")&&this.staticDimensions!==D.m)&&this.handleAlphaChannelDimensionsChange(),(e.has("alphaChannel")&&(this.hasUpdated||this.alphaChannel!==!1)||e.has("format")&&(this.hasUpdated||this.format!=="auto"))&&this.handleFormatOrAlphaChannelChange(),e.has("scale")&&(this.hasUpdated||this.scale!=="m")&&this.handleScaleChange(this.scale)}updated(){le(this)}loaded(){this.handleAlphaChannelDimensionsChange()}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("pointermove",this.globalPointerMoveHandler),window.removeEventListener("pointerup",this.globalPointerUpHandler),this.resizeObserver?.disconnect()}get baseColorFieldColor(){return this.color||this.previousColor||m}get effectiveSliderWidth(){return this.dynamicDimensions.slider.width}observeResize(){this.resizeObserver?.observe(this.el)}handleAlphaChannelChange(e){let{format:t}=this;e&&t!=="auto"&&!P(t)&&(console.warn(`ignoring alphaChannel as the current format (${t}) does not support alpha`),this.alphaChannel=!1)}handleAlphaChannelDimensionsChange(){this.drawColorControls()}handleColorChange(e,t){this.drawColorControls(),this.updateChannelsFromColor(e),this.previousColor=t}handleFormatOrAlphaChannelChange(){this.setMode(this.format),this.internalColorSet(this.color,!1,"internal")}handleScaleChange(e="m"){this.updateStaticDimensions(e),this.updateCanvasSize(),this.drawColorControls()}handleValueChange(e,t){let{clearable:i,format:o}=this,a=!i||e,l=!1;if(a){let d=N(e);if(!d||o!=="auto"&&d!==o){this.showIncompatibleColorWarning(e,o),this._value=t;return}l=this.mode!==d,this.setMode(d,this.internalColorUpdateContext===null)}let s=this.activeCanvasInfo;if(this.internalColorUpdateContext==="initial")return;if(this.internalColorUpdateContext==="user-interaction"){this.calciteColorPickerInput.emit(),s||this.calciteColorPickerChange.emit();return}let c=W(e,i,this.mode),h=!V(c,this.color);(l||h)&&this.internalColorSet(c,this.alphaChannel&&!(this.mode.endsWith("a")||this.mode.endsWith("a-css"))||this.internalColorUpdateContext==="internal","internal")}handleTabActivate(e){this.channelMode=e.currentTarget.getAttribute("data-color-mode"),this.updateChannelsFromColor(this.color)}handleColorFieldScopeKeyDown(e){let{key:t}=e,i={ArrowUp:{x:0,y:-10},ArrowRight:{x:10,y:0},ArrowDown:{x:0,y:10},ArrowLeft:{x:-10,y:0}};i[t]&&(e.preventDefault(),this.scopeOrientation=t==="ArrowDown"||t==="ArrowUp"?"vertical":"horizontal",this.captureColorFieldColor(this.colorFieldScopeLeft+i[t].x||0,this.colorFieldScopeTop+i[t].y||0,!1))}handleHueScopeKeyDown(e){let t=e.shiftKey?10:1,{key:i}=e,o={ArrowUp:1,ArrowRight:1,ArrowDown:-1,ArrowLeft:-1};if(o[i]){e.preventDefault();let a=o[i]*t,l=this.baseColorFieldColor.hue(),s=this.baseColorFieldColor.hue(l+a);this.internalColorSet(s,!1)}}handleHexInputChange(e){e.stopPropagation();let{clearable:t,color:i}=this,a=e.target.value;if(t&&!a){this.internalColorSet(null);return}let l=i&&R(S(i,P(this.mode)));a!==l&&this.internalColorSet(x(a))}handleSavedColorSelect(e){let t=e.currentTarget;this.internalColorSet(x(t.color))}handleChannelInput(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),a=i===3?b.max:this.channelMode==="rgb"?k[Object.keys(k)[i]]:p[Object.keys(p)[i]],l;if(!t.value)l="",this.isActiveChannelInputEmpty=!0,this.upOrDownArrowKeyTracker=null;else{let c=Number(t.value)+this.shiftKeyChannelAdjustment;l=Ce(c,0,a).toString()}t.value=l,l!==""&&this.shiftKeyChannelAdjustment!==0?this.handleChannelChange(e):l!==""&&this.handleChannelChange(e)}handleChannelBlur(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),o=[...this.channels];!t.value&&!this.clearable&&(t.value=o[i]?.toString())}handleChannelFocus(e){e.currentTarget.selectText()}handleChannelKeyUpOrDown(e){this.shiftKeyChannelAdjustment=0;let{key:t}=e;if(t!=="ArrowUp"&&t!=="ArrowDown"||!e.composedPath().some(a=>a.classList?.contains(n.channel)))return;let{shiftKey:i}=e;if(e.preventDefault(),!this.color){this.internalColorSet(this.previousColor),e.stopPropagation();return}let o=9;this.shiftKeyChannelAdjustment=t==="ArrowUp"&&i?o:t==="ArrowDown"&&i?-o:0,t==="ArrowUp"&&(this.upOrDownArrowKeyTracker="up"),t==="ArrowDown"&&(this.upOrDownArrowKeyTracker="down")}getChannelInputLimit(e){return this.channelMode==="rgb"?k[Object.keys(k)[e]]:p[Object.keys(p)[e]]}handleChannelChange(e){let t=e.currentTarget,i=Number(t.getAttribute("data-channel-index")),o=[...this.channels];if(this.clearable&&!t.value){this.channels=[null,null,null,null],this.internalColorSet(null);return}let l=i===3;this.isActiveChannelInputEmpty&&this.upOrDownArrowKeyTracker&&(t.value=this.upOrDownArrowKeyTracker==="up"?(o[i]+1<=this.getChannelInputLimit(i)?o[i]+1:this.getChannelInputLimit(i)).toString():(o[i]-1>=0?o[i]-1:0).toString(),this.isActiveChannelInputEmpty=!1,this.upOrDownArrowKeyTracker=null);let s=t.value?Number(t.value):o[i];o[i]=l?B(s):s,this.updateColorFromChannels(o)}handleSavedColorKeyDown(e){re(e.key)&&(e.preventDefault(),this.handleSavedColorSelect(e))}handleColorFieldPointerDown(e){this.handleCanvasControlPointerDown(e,this.colorFieldRenderingContext,this.captureColorFieldColor,this.colorFieldScopeRef.value)}focusScope(e){requestAnimationFrame(()=>{e.focus()})}handleHueSliderPointerDown(e){this.handleCanvasControlPointerDown(e,this.hueSliderRenderingContext,this.captureHueSliderColor,this.hueScopeRef.value)}handleOpacitySliderPointerDown(e){this.handleCanvasControlPointerDown(e,this.opacitySliderRenderingContext,this.captureOpacitySliderValue,this.opacityScopeRef.value)}handleCanvasControlPointerDown(e,t,i,o){K(e)&&(window.addEventListener("pointermove",this.globalPointerMoveHandler),window.addEventListener("pointerup",this.globalPointerUpHandler,{once:!0}),this.activeCanvasInfo={context:t,bounds:t.canvas.getBoundingClientRect()},i.call(this,e.offsetX,e.offsetY),this.focusScope(o))}handleKeyDown(e){e.key==="Enter"&&e.preventDefault()}showIncompatibleColorWarning(e,t){console.warn(`ignoring color value (${e}) as it is not compatible with the current format (${t})`)}setMode(e,t=!0){let i=e==="auto"?this.mode:e;this.mode=this.ensureCompatibleMode(i,t)}ensureCompatibleMode(e,t){let{alphaChannel:i}=this,o=P(e);if(i&&!o){let a=de(e);return t&&console.warn(`setting format to (${a}) as the provided one (${e}) does not support alpha`),a}if(!i&&o){let a=X(e);return t&&console.warn(`setting format to (${a}) as the provided one (${e}) does not support alpha`),a}return e}captureHueSliderColor(e){let t=E/this.effectiveSliderWidth*e;this.internalColorSet(this.baseColorFieldColor.hue(t),!1)}captureOpacitySliderValue(e){let t=B(b.max/this.effectiveSliderWidth*e);this.internalColorSet(this.baseColorFieldColor.alpha(t),!1)}internalColorSet(e,t=!0,i="user-interaction"){t&&V(e,this.color)||(this.internalColorUpdateContext=i,this.color=e,this.value=this.toValue(e),this.internalColorUpdateContext=null)}toValue(e,t=this.mode){if(!e)return null;if(t.includes("hex")){let a=t===_.HEXA;return R(S(e.round(),a),a)}if(t.includes("-css")){let a=e[t.replace("-css","").replace("a","")]().round().string();if((t.endsWith("a")||t.endsWith("a-css"))&&e.alpha()===1){let s=a.slice(0,3),c=a.slice(4,-1);return`${s}a(${c}, ${e.alpha()})`}return a}let o=e[X(t)]().round().object();return t.endsWith("a")?he(o):o}getSliderCapSpacing(){let{staticDimensions:{slider:{height:e},thumb:{radius:t}}}=this;return t*2-e}updateStaticDimensions(e="m"){this.staticDimensions=D[e]}deleteColor(){let e=S(this.color,this.alphaChannel);if(!(this.savedColors.indexOf(e)>-1))return;let i=this.savedColors.filter(a=>a!==e);this.savedColors=i;let o=`${I}${this.storageId}`;this.storageId&&localStorage.setItem(o,JSON.stringify(i))}saveColor(){let e=S(this.color,this.alphaChannel);if(this.savedColors.indexOf(e)>-1)return;let i=[...this.savedColors,e];this.savedColors=i;let o=`${I}${this.storageId}`;this.storageId&&localStorage.setItem(o,JSON.stringify(i))}drawColorField(){let e=this.colorFieldRenderingContext,{width:t,height:i}=this.dynamicDimensions.colorField;e.fillStyle=this.baseColorFieldColor.hsv().saturationv(100).value(100).alpha(1).string(),e.fillRect(0,0,t,i);let o=e.createLinearGradient(0,0,t,0);o.addColorStop(0,"rgba(255,255,255,1)"),o.addColorStop(1,"rgba(255,255,255,0)"),e.fillStyle=o,e.fillRect(0,0,t,i);let a=e.createLinearGradient(0,0,0,i);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"rgba(0,0,0,1)"),e.fillStyle=a,e.fillRect(0,0,t,i),this.drawActiveColorFieldColor()}setCanvasContextSize(e,{height:t,width:i}){if(!e)return;let o=window.devicePixelRatio||1;e.width=i*o,e.height=t*o,e.style.height=`${t}px`,e.style.width=`${i}px`,e.getContext("2d").scale(o,o)}initColorField(e){e&&(this.colorFieldRenderingContext=e.getContext("2d"),this.updateCanvasSize("color-field"),this.drawColorControls())}initHueSlider(e){e&&(this.hueSliderRenderingContext=e.getContext("2d"),this.updateCanvasSize("hue-slider"),this.drawHueSlider())}initOpacitySlider(e){e&&(this.opacitySliderRenderingContext=e.getContext("2d"),this.updateCanvasSize("opacity-slider"),this.drawOpacitySlider())}updateCanvasSize(e="all"){let{dynamicDimensions:t,staticDimensions:i}=this;(e==="all"||e==="color-field")&&this.setCanvasContextSize(this.colorFieldRenderingContext?.canvas,t.colorField);let o={width:this.effectiveSliderWidth,height:i.slider.height+(i.thumb.radius-t.slider.height/2)*2};(e==="all"||e==="hue-slider")&&this.setCanvasContextSize(this.hueSliderRenderingContext?.canvas,o),(e==="all"||e==="opacity-slider")&&this.setCanvasContextSize(this.opacitySliderRenderingContext?.canvas,o)}drawActiveColorFieldColor(){let{color:e}=this;if(!e)return;let t=e.hsv(),{staticDimensions:{thumb:{radius:i}}}=this,{width:o,height:a}=this.dynamicDimensions.colorField,l=t.saturationv()/(p.s/o),s=a-t.value()/(p.v/a);requestAnimationFrame(()=>{this.colorFieldScopeLeft=l,this.colorFieldScopeTop=s}),this.drawThumb(this.colorFieldRenderingContext,i,l,s,t,!1)}drawThumb(e,t,i,o,a,l){let c=2*Math.PI,h=1;if(e.beginPath(),e.arc(i,o,t,0,c),e.fillStyle="#fff",e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=h,e.stroke(),l&&a.alpha()<1){let f=e.createPattern(this.getCheckeredBackgroundPattern(),"repeat");e.beginPath(),e.arc(i,o,t-3,0,c),e.fillStyle=f,e.fill()}e.globalCompositeOperation="source-atop",e.beginPath(),e.arc(i,o,t-3,0,c);let d=l?a.alpha():1;e.fillStyle=a.rgb().alpha(d).string(),e.fill(),e.globalCompositeOperation="source-over"}drawActiveHueSliderColor(){let{color:e}=this;if(!e)return;let t=e.hsv().saturationv(100).value(100),{staticDimensions:{thumb:{radius:i}}}=this,o=this.effectiveSliderWidth,a=t.hue()/(E/o),l=i,s=this.getSliderBoundX(a,o,i);requestAnimationFrame(()=>{this.hueScopeLeft=s}),this.drawThumb(this.hueSliderRenderingContext,i,s,l,t,!1)}drawHueSlider(){let e=this.hueSliderRenderingContext,{staticDimensions:{slider:{height:t},thumb:{radius:i}}}=this,o=0,a=i-t/2,l=this.effectiveSliderWidth,s=e.createLinearGradient(0,0,l,0),c=["red","yellow","lime","cyan","blue","magenta","#ff0004"],h=1/(c.length-1),d=0;c.forEach(f=>{s.addColorStop(d,x(f).string()),d+=h}),e.clearRect(0,0,l,t+this.getSliderCapSpacing()*2),this.drawSliderPath(e,t,l,o,a),e.fillStyle=s,e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=1,e.stroke(),this.drawActiveHueSliderColor()}drawOpacitySlider(){let e=this.opacitySliderRenderingContext,{baseColorFieldColor:t,staticDimensions:{slider:{height:i},thumb:{radius:o}}}=this,a=0,l=o-i/2,s=this.effectiveSliderWidth;e.clearRect(0,0,s,i+this.getSliderCapSpacing()*2);let c=e.createLinearGradient(0,l,s,0),h=t.rgb().alpha(0),d=t.rgb().alpha(.5),f=t.rgb().alpha(1);c.addColorStop(0,h.string()),c.addColorStop(.5,d.string()),c.addColorStop(1,f.string()),this.drawSliderPath(e,i,s,a,l);let C=e.createPattern(this.getCheckeredBackgroundPattern(),"repeat");e.fillStyle=C,e.fill(),e.fillStyle=c,e.fill(),e.strokeStyle="rgba(0,0,0,0.3)",e.lineWidth=1,e.stroke(),this.drawActiveOpacitySliderColor()}drawSliderPath(e,t,i,o,a){let l=t/2+1;e.beginPath(),e.moveTo(o+l,a),e.lineTo(o+i-l,a),e.quadraticCurveTo(o+i,a,o+i,a+l),e.lineTo(o+i,a+t-l),e.quadraticCurveTo(o+i,a+t,o+i-l,a+t),e.lineTo(o+l,a+t),e.quadraticCurveTo(o,a+t,o,a+t-l),e.lineTo(o,a+l),e.quadraticCurveTo(o,a,o+l,a),e.closePath()}getCheckeredBackgroundPattern(){if(this.checkerPattern)return this.checkerPattern;let e=document.createElement("canvas");e.width=10,e.height=10;let t=e.getContext("2d");return t.fillStyle="#ccc",t.fillRect(0,0,10,10),t.fillStyle="#fff",t.fillRect(0,0,5,5),t.fillRect(5,5,5,5),this.checkerPattern=e,e}drawActiveOpacitySliderColor(){let{color:e}=this;if(!e)return;let t=e,{staticDimensions:{thumb:{radius:i}}}=this,o=this.effectiveSliderWidth,a=O(t.alpha())/(b.max/o),l=i,s=this.getSliderBoundX(a,o,i);requestAnimationFrame(()=>{this.opacityScopeLeft=s}),this.drawThumb(this.opacitySliderRenderingContext,i,s,l,t,!0)}getSliderBoundX(e,t,i){let o=fe(e,t,i);return o===0?e:o===-1?q(e,0,t,i,i*2):q(e,0,t,t-i*2,t-i)}handleOpacityScopeKeyDown(e){let t=e.shiftKey?10:1,{key:i}=e,o={ArrowUp:.01,ArrowRight:.01,ArrowDown:-.01,ArrowLeft:-.01};if(o[i]){e.preventDefault();let a=o[i]*t,l=this.baseColorFieldColor.alpha(),s=this.baseColorFieldColor.alpha(l+a);this.internalColorSet(s,!1)}}updateColorFromChannels(e){this.internalColorSet(x(e,this.channelMode))}updateChannelsFromColor(e){this.channels=e?this.toChannels(e):[null,null,null,null]}toChannels(e){let{channelMode:t}=this,i=e[t]().round().array();return i.length===3&&i.push(1),i}getAdjustedScopePosition(e,t){return[e-U/2,t-U/2]}render(){let{channelsDisabled:e,color:t,colorFieldScopeLeft:i,colorFieldScopeTop:o,staticDimensions:{thumb:{radius:a}},fieldDisabled:l,hexDisabled:s,hueScopeLeft:c,messages:h,alphaChannel:d,opacityScopeLeft:f,savedColors:C,savedDisabled:y,scale:v,scopeOrientation:me}=this,Y=this.effectiveSliderWidth,M=t?S(t,d):null,ge=a,be=c??Y*m.hue()/p.h,Se=a,ye=f??Y*O(m.alpha())/b.max,J=t===void 0,z=me==="vertical",[we,$e]=this.getAdjustedScopePosition(i,o),[xe,ke]=this.getAdjustedScopePosition(be,ge),[De,Ae]=this.getAdjustedScopePosition(ye,Se);return se({disabled:this.disabled,children:u`<div class=${r(n.container)}>${l?null:u`<div class=${r(n.controlAndScope)}><canvas class=${r(n.colorField)} @pointerdown=${this.handleColorFieldPointerDown} ${g(this.initColorField)}></canvas><div .ariaLabel=${z?h.value:h.saturation} .ariaValueMax=${z?p.v:p.s} aria-valuemin=0 .ariaValueNow=${(z?t?.saturationv():t?.value())||"0"} class=${r({[n.scope]:!0,[n.colorFieldScope]:!0})} @keydown=${this.handleColorFieldScopeKeyDown} role=slider style=${$({top:`${$e||0}px`,left:`${we||0}px`})} tabindex=0 ${g(this.colorFieldScopeRef)}></div></div>`}<div class=${r(n.previewAndSliders)}><calcite-swatch class=${r(n.preview)} .color=${M} .label=${M} .scale=${this.alphaChannel?"l":this.scale}></calcite-swatch><div class=${r(n.sliders)}><div class=${r(n.controlAndScope)}><canvas class=${r({[n.slider]:!0,[n.hueSlider]:!0})} @pointerdown=${this.handleHueSliderPointerDown} ${g(this.initHueSlider)}></canvas><div .ariaLabel=${h.hue} .ariaValueMax=${p.h} aria-valuemin=0 .ariaValueNow=${t?.round().hue()||m.round().hue()} class=${r({[n.scope]:!0,[n.hueScope]:!0})} @keydown=${this.handleHueScopeKeyDown} role=slider style=${$({top:`${ke}px`,left:`${xe}px`})} tabindex=0 ${g(this.hueScopeRef)}></div></div>${d?u`<div class=${r(n.controlAndScope)}><canvas class=${r({[n.slider]:!0,[n.opacitySlider]:!0})} @pointerdown=${this.handleOpacitySliderPointerDown} ${g(this.initOpacitySlider)}></canvas><div .ariaLabel=${h.opacity} .ariaValueMax=${b.max} .ariaValueMin=${b.min} .ariaValueNow=${(t||m).round().alpha()} class=${r({[n.scope]:!0,[n.opacityScope]:!0})} @keydown=${this.handleOpacityScopeKeyDown} role=slider style=${$({top:`${Ae}px`,left:`${De}px`})} tabindex=0 ${g(this.opacityScopeRef)}></div></div>`:null}</div></div>${s&&e?null:u`<div class=${r({[n.controlSection]:!0,[n.section]:!0})}><div class=${r(n.hexAndChannelsGroup)}>${s?null:u`<div class=${r(n.hexOptions)}><calcite-color-picker-hex-input .allowEmpty=${this.clearable} .alphaChannel=${d} class=${r(n.control)} .messages=${h} .numberingSystem=${this.numberingSystem} @calciteColorPickerHexInputChange=${this.handleHexInputChange} .scale=${v} .value=${M}></calcite-color-picker-hex-input></div>`}${e?null:u`<calcite-tabs class=${r({[n.colorModeContainer]:!0,[n.splitSection]:!0})} .scale=${v==="l"?"m":"s"}><calcite-tab-nav slot=title-group>${this.renderChannelsTabTitle("rgb")}${this.renderChannelsTabTitle("hsv")}</calcite-tab-nav>${this.renderChannelsTab("rgb")}${this.renderChannelsTab("hsv")}</calcite-tabs>`}</div></div>`}${y?null:u`<div class=${r({[n.savedColorsSection]:!0,[n.section]:!0})}><div class=${r(n.header)}><label>${h.saved}</label><div class=${r(n.savedColorsButtons)}><calcite-button appearance=transparent class=${r(n.deleteColor)} .disabled=${J} .iconStart=${j.minus} kind=neutral .label=${h.deleteColor} @click=${this.deleteColor} .scale=${v} type=button></calcite-button><calcite-button appearance=transparent class=${r(n.saveColor)} .disabled=${J} .iconStart=${j.plus} kind=neutral .label=${h.saveColor} @click=${this.saveColor} .scale=${v} type=button></calcite-button></div></div>${C.length>0?u`<calcite-swatch-group class=${r(n.swatchGroup)} .label=${h.saved} .scale=${v} selection-mode=none>${ce(C,A=>A,A=>u`<calcite-swatch class=${r(n.savedColor)} .color=${A} .label=${A} @click=${this.handleSavedColorSelect} @keydown=${this.handleSavedColorKeyDown} .scale=${v} tabindex=0></calcite-swatch>`)}</calcite-swatch-group>`:null}</div>`}</div>`})}renderChannelsTabTitle(e){let{channelMode:t,messages:i}=this,o=e===t,a=e==="rgb"?i.rgb:i.hsv;return T(e,u`<calcite-tab-title class=${r(n.colorMode)} data-color-mode=${e??w} @calciteTabsActivate=${this.handleTabActivate} .selected=${o}>${a}</calcite-tab-title>`)}renderChannelsTab(e){let{clearable:t,channelMode:i,channels:o,messages:a,alphaChannel:l}=this,s=e===i,h=e==="rgb"?[a.red,a.green,a.blue]:[a.hue,a.saturation,a.value],d=ie(this.el),f=l?o:o.slice(0,3);return T(e,u`<calcite-tab class=${r(n.control)} .selected=${s}><div class=${r(n.channels)} dir=ltr>${f.map((C,y)=>{let v=y===3;return v&&(C=t&&!C?C:O(C)),this.renderChannel(C,y,h[y],d,v?"%":"")})}</div></calcite-tab>`)}renderChannel(e,t,i,o,a){return T(t,u`<calcite-input-number class=${r(n.channel)} data-channel-index=${t??w} dir=${o??w} .label=${i} lang=${this.messages._lang??w} number-button-type=none .numberingSystem=${this.numberingSystem} @keydown=${this.handleKeyDown} @calciteInputNumberChange=${this.handleChannelChange} @calciteInputNumberInput=${this.handleChannelInput} @calciteInternalInputNumberBlur=${this.handleChannelBlur} @calciteInternalInputNumberFocus=${this.handleChannelFocus} .scale=${this.scale==="l"?"m":"s"} style=${$({marginLeft:t>0&&!(this.scale==="s"&&this.alphaChannel&&t===3)?"-1px":""})} .suffixText=${a} .value=${e?.toString()}></calcite-input-number>`)}};ee("calcite-color-picker",G);export{G as ColorPicker};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as x,b as f}from"./NSBK36H4.js";import{a as k}from"./S5CLKCGJ.js";import{a as g}from"./LH7245HX.js";import{a as b}from"./WOTQIMPZ.js";import"./B5JXPZDV.js";import{a as l}from"./3YZG7MA3.js";import"./CIU4VM7X.js";import{l as u,t as m}from"./5IPJANUU.js";import"./ZLR2B6GQ.js";import{B as r,C as o,D as d,E as i,P as v,g as h,h as t,o as a}from"./AUIOWPFN.js";var c={title:"title",close:"close",imageContainer:"image-container",chipIcon:"chip-icon",textSlotted:"text--slotted",container:"container",imageSlotted:"image--slotted",closable:"closable",multiple:"multiple",single:"single",selectable:"selectable",selectIcon:"select-icon",selectIconActive:"select-icon--active",nonInteractive:"non-interactive",isCircle:"is-circle",selected:"selected"},C={image:"image"},n={close:"x",checkedSingle:"circle-f",uncheckedMultiple:"square",checkedMultiple:"check-square-f"},I=h`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-flex;cursor:default;border-radius:var(--calcite-chip-corner-radius, 9999px)}:host([closed]){display:none}:host([appearance=outline]) .container,:host([appearance=outline-fill]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-1))}:host([appearance=outline]) .close,:host([appearance=outline-fill]) .close{color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, var(--calcite-color-text-3)))}:host([appearance=outline]):host([kind=brand]),:host([appearance=outline-fill]):host([kind=brand]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-brand));--calcite-internal-chip-selectable-hover-border-color: var(--calcite-chip-border-color, var(--calcite-color-brand));--calcite-internal-chip-selectable-active-border-color: var( --calcite-chip-border-color, var(--calcite-color-brand) )}:host([appearance=outline]):host([kind=inverse]),:host([appearance=outline-fill]):host([kind=inverse]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-border-inverse))}:host([appearance=outline]):host([kind=neutral]),:host([appearance=outline-fill]):host([kind=neutral]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-border-1))}:host([appearance=outline]){--calcite-internal-chip-background-color: transparent}:host([appearance=outline-fill]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-foreground-1))}:host([appearance=solid]){--calcite-internal-chip-border-color: transparent;--calcite-internal-chip-selectable-hover-border-color: transparent;--calcite-internal-chip-selectable-active-border-color: transparent}:host([appearance=solid]):host([kind=brand]) .container,:host([appearance=solid]):host([kind=inverse]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-inverse))}:host([appearance=solid]):host([kind=brand]) .close,:host([appearance=solid]):host([kind=inverse]) .close{outline-color:var(--calcite-color-text-inverse)}:host([appearance=solid]):host([kind=brand]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-brand))}:host([appearance=solid]):host([kind=inverse]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-inverse))}:host([appearance=solid]):host([kind=inverse]) .close:hover{background-color:var(--calcite-color-inverse-hover)}:host([appearance=solid]):host([kind=inverse]) .close:active{background-color:var(--calcite-color-inverse-press)}:host([appearance=solid]):host([kind=neutral]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-foreground-2))}:host([kind=neutral]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-1))}:host([kind=neutral]) .close{color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, var(--calcite-color-text-3)))}:host([selected]) .select-icon{opacity:1}:host([appearance=solid]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-3);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-border-2)}:host([appearance=solid]):host([kind=inverse]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-inverse-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-inverse-press)}:host([appearance=solid]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-brand-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-brand-press)}:host([appearance=outline-fill]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-2);--calcite-internal-chip-selectable-hover-border-color: var(--calcite-color-border-input);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-foreground-3);--calcite-internal-chip-selectable-active-border-color: var(--calcite-color-text-3)}:host([appearance=outline-fill]):host([kind=inverse]),:host([appearance=outline-fill]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-2);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-foreground-3)}:host([appearance=outline]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-transparent-hover);--calcite-internal-chip-selectable-hover-border-color: var(--calcite-color-border-input);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-transparent-press);--calcite-internal-chip-selectable-active-border-color: var(--calcite-color-text-3)}:host([appearance=outline]):host([kind=inverse]),:host([appearance=outline]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-transparent-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-transparent-press)}:host([scale=s]) .container{--calcite-internal-chip-block-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-font-size: var(--calcite-font-size--2);--calcite-internal-chip-icon-size: var(--calcite-size-xs, 1rem) ;--calcite-internal-chip-icon-space: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-image-size: var(--calcite-spacing-xl, 1.25rem) ;--calcite-internal-chip-title-space: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-close-size: var(--calcite-size-xs, 1rem) }:host([scale=s]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px);--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-px)}:host([scale=s]) .container.image--slotted:has(.chip-icon),:host([scale=s]) .container.image--slotted.text--slotted,:host([scale=s]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: var(--calcite-spacing-xxs, .25rem) }:host([scale=s]) .container.image--slotted:not(.text--slotted,:has(.chip-icon)),:host([scale=s]) .container.image--slotted:not(.selectable){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=s]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: .125rem }:host([scale=s]) .container.multiple:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=s]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.multiple:not(.is-circle).image--slotted:not(.text--slotted){--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container{--calcite-internal-chip-block-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-font-size: var(--calcite-font-size--1);--calcite-internal-chip-icon-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-icon-space: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-image-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-title-space: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-close-size: var(--calcite-size-sm, 1.5rem) }:host([scale=m]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-px);--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=m]) .container.image--slotted:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.image--slotted:has(.chip-icon),:host([scale=m]) .container.image--slotted.text--slotted,:host([scale=m]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-px);--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=m]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container.multiple:not(.is-circle){--calcite-internal-chip-select-space-x-end: .125rem ;--calcite-internal-chip-select-space-x-start: .125rem }:host([scale=m]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.closable:not(.is-circle){--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container{--calcite-internal-chip-block-size: 2.75rem ;--calcite-internal-chip-container-space-x-end: .5rem ;--calcite-internal-chip-container-space-x-start: .5rem ;--calcite-internal-chip-font-size: var(--calcite-font-size-0);--calcite-internal-chip-icon-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-icon-space: .5rem ;--calcite-internal-chip-image-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-title-space: .5rem ;--calcite-internal-close-size: var(--calcite-size-md, 2rem) }:host([scale=l]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container.image--slotted:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=l]) .container.image--slotted:has(.chip-icon),:host([scale=l]) .container.image--slotted.text--slotted,:host([scale=l]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: .5rem }:host([scale=l]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=l]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=l]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-select-space-x-start: .5rem }:host([scale=l]) .container.multiple:not(.is-circle){--calcite-internal-chip-container-space-x-start: .5rem ;--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .75rem }:host([scale=l]) .container.closable:not(.is-circle){--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xs, .375rem) }.container{box-sizing:border-box;display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center;justify-content:center;font-weight:var(--calcite-font-weight-medium);outline-color:transparent;background-color:var(--calcite-internal-chip-background-color);border-color:var(--calcite-internal-chip-border-color);border-radius:var(--calcite-chip-corner-radius, 9999px);border-width:var(--calcite-border-width-sm);border-style:solid;font-size:var(--calcite-internal-chip-font-size, var(--calcite-font-size));padding-inline-start:var(--calcite-internal-chip-container-space-x-start);padding-inline-end:var(--calcite-internal-chip-container-space-x-end);block-size:var(--calcite-internal-chip-block-size, auto);inline-size:var(--calcite-internal-chip-inline-size, auto);min-inline-size:var(--calcite-internal-chip-block-size, auto)}.container:hover .select-icon--active{opacity:var(--calcite-opacity-full, 1)}.container.selectable{cursor:pointer}.container.selectable:hover{background-color:var(--calcite-internal-chip-selectable-hover-background-color);border-color:var(--calcite-internal-chip-selectable-hover-border-color)}.container.selectable:active{background-color:var(--calcite-internal-chip-selectable-active-background-color);border-color:var(--calcite-internal-chip-selectable-active-border-color)}.container:not(.non-interactive):focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.container.text--slotted .title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.container:not(.text--slotted) .title,.container:not(.image--slotted) .image-container{display:none}.container.is-circle .chip-icon,.container.is-circle .image-container{padding:var(--calcite-spacing-none, 0)}.title{padding-inline:var(--calcite-internal-chip-title-space)}.image-container{display:inline-flex;overflow:hidden;align-items:center;justify-content:center;pointer-events:none;block-size:var(--calcite-internal-chip-image-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-chip-image-size, var(--calcite-spacing-xxl, 1.5rem));padding-inline-start:var(--calcite-spacing-none, 0);padding-inline-end:var(--calcite-internal-chip-image-space-x-end, 0)}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-timing-function:cubic-bezier(.4,0,.2,1);color:var(--calcite-chip-icon-color, var(--calcite-chip-text-color, var(--calcite-icon-color, currentColor)));padding-inline:var(--calcite-internal-chip-icon-space, var(--calcite-spacing-xs, .375rem))}.select-icon{align-self:center;justify-content:center;align-items:center;display:flex;inset-block-start:-1px;position:absolute;visibility:hidden;inline-size:auto;opacity:0;transition:opacity .15s ease-in-out,inline-size .15s ease-in-out;color:var(--calcite-chip-select-icon-color, currentColor)}.select-icon.select-icon--active{position:relative;visibility:visible;opacity:var(--calcite-opacity-half, .5);color:var(--calcite-chip-select-icon-color-press, var(--calcite-chip-select-icon-color-pressed, var(--calcite-chip-select-icon-color, currentColor)))}.multiple .select-icon{display:flex;align-items:center;justify-content:center}.multiple .select-icon,.single .select-icon--active{padding-inline-start:var(--calcite-internal-chip-select-space-x-start);padding-inline-end:var(--calcite-internal-chip-select-space-x-end);block-size:var(--calcite-internal-chip-icon-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-chip-icon-size, var(--calcite-spacing-xxl, 1.5rem))}slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}.close{margin:0;cursor:pointer;align-items:center;border-radius:50%;border-style:none;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;outline-color:transparent;background-color:var(--calcite-close-background-color, var(--calcite-color-transparent));-webkit-appearance:none;display:flex;align-content:center;justify-content:center;color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, currentColor));block-size:var(--calcite-internal-close-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-close-size, var(--calcite-spacing-xxl, 1.5rem));padding:0}.close:hover,.close:focus{background-color:var(--calcite-close-background-color-hover, var(--calcite-color-transparent-hover))}.close:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.close:active{background-color:var(--calcite-close-background-color-press, var(--calcite-color-transparent-press))}.close calcite-icon{color:inherit}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([hidden]){display:none}[hidden]{display:none}`,s=class extends d{constructor(){super(),this.closeButtonRef=r(),this.containerRef=r(),this.messages=g(),this.focusSetter=b()(this),this.hasImage=!1,this.hasText=!1,this.appearance="solid",this.closable=!1,this.closed=!1,this.closeOnDelete=!1,this.disabled=!1,this.iconFlipRtl=!1,this.interactive=!1,this.kind="neutral",this.scale="m",this.selected=!1,this.selectionMode="none",this.calciteChipClose=a({cancelable:!1}),this.calciteChipSelect=a({cancelable:!1}),this.calciteInternalChipKeyEvent=a({cancelable:!1}),this.calciteInternalChipSelect=a({cancelable:!1}),this.calciteInternalSyncSelectedChips=a({cancelable:!1}),this.listen("keydown",this.keyDownHandler),this.listen("click",this.clickHandler)}static{this.properties={hasImage:[16,{},{state:!0}],hasText:[16,{},{state:!0}],appearance:[3,{},{reflect:!0}],closable:[7,{},{reflect:!0,type:Boolean}],closed:[7,{},{reflect:!0,type:Boolean}],closeOnDelete:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],icon:[3,{type:String},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],interactive:[5,{},{type:Boolean}],kind:[3,{},{reflect:!0}],label:1,messageOverrides:[0,{},{attribute:!1}],parentChipGroup:[0,{},{attribute:!1}],scale:[3,{},{reflect:!0}],selected:[7,{},{reflect:!0,type:Boolean}],selectionMode:1,value:1}}static{this.styles=I}async setFocus(e){return this.focusSetter(()=>{if(this.interactive)return this.containerRef.value;if(this.closable)return this.closeButtonRef.value},e)}async load(){this.updateHasText()}willUpdate(e){e.has("selected")&&this.hasUpdated&&this.watchSelected(this.selected)}updated(){x(this)}loaded(){this.selectionMode!=="none"&&this.interactive&&this.selected&&this.handleSelectionPropertyChange(this.selected)}watchSelected(e){this.selectionMode!=="none"&&this.handleSelectionPropertyChange(e)}keyDownHandler(e){if(e.target===this.el)switch(e.key){case" ":case"Enter":this.handleEmittingEvent(),e.preventDefault();break;case"Backspace":case"Delete":this.closable&&!this.closed&&this.closeOnDelete&&(e.preventDefault(),this.close());break;case"ArrowRight":case"ArrowLeft":case"Home":case"End":this.calciteInternalChipKeyEvent.emit(e),e.preventDefault();break}}clickHandler(){!this.interactive&&this.closable&&u(this.closeButtonRef.value)}handleDefaultSlotChange(){this.updateHasText()}close(){this.calciteChipClose.emit(),this.selected=!1,this.closed=!0}closeButtonKeyDownHandler(e){k(e.key)&&(e.preventDefault(),this.close())}updateHasText(){this.hasText=this.el.textContent.trim().length>0}handleSlotImageChange(e){this.hasImage=m(e)}handleEmittingEvent(){this.interactive&&this.calciteChipSelect.emit()}handleSelectionPropertyChange(e){this.selectionMode==="single"&&this.calciteInternalSyncSelectedChips.emit(),!this.parentChipGroup.selectedItems.includes(this.el)&&e&&this.selectionMode!=="multiple"&&this.calciteInternalChipSelect.emit(),this.selectionMode!=="single"&&this.calciteInternalSyncSelectedChips.emit()}renderChipImage(){return t`<div class=${i(c.imageContainer)}><slot name=${C.image} @slotchange=${this.handleSlotImageChange}></slot></div>`}renderSelectionIcon(){let e=this.selectionMode==="multiple"?this.selected?n.checkedMultiple:n.uncheckedMultiple:this.selected?n.checkedSingle:void 0;return t`<div class=${i({[c.selectIcon]:!0,[c.selectIconActive]:this.selectionMode==="multiple"||this.selected})}>${e?t`<calcite-icon .icon=${e} .scale=${l(this.scale)}></calcite-icon>`:null}</div>`}renderCloseButton(){return t`<button .ariaLabel=${this.messages.dismissLabel} class=${i(c.close)} @click=${this.close} @keydown=${this.closeButtonKeyDownHandler} .tabIndex=${this.disabled?-1:0} ${o(this.closeButtonRef)}><calcite-icon .icon=${n.close} .scale=${l(this.scale)}></calcite-icon></button>`}renderIcon(){return t`<calcite-icon class=${i(c.chipIcon)} .flipRtl=${this.iconFlipRtl} .icon=${this.icon} .scale=${l(this.scale)}></calcite-icon>`}render(){let{disabled:e}=this,p=e||!e&&!this.interactive,y=this.selectionMode==="multiple"&&this.interactive?"checkbox":this.selectionMode!=="none"&&this.interactive?"radio":this.interactive?"button":"img";return f({disabled:e,children:t`<div .ariaChecked=${this.selectionMode!=="none"&&this.interactive?this.selected:void 0} .ariaLabel=${this.label} class=${i({[c.container]:!0,[c.textSlotted]:this.hasText,[c.imageSlotted]:this.hasImage,[c.selectable]:this.selectionMode!=="none",[c.multiple]:this.selectionMode==="multiple",[c.single]:this.selectionMode==="single"||this.selectionMode==="single-persist",[c.selected]:this.selected,[c.closable]:this.closable,[c.nonInteractive]:!this.interactive,[c.isCircle]:!this.closable&&!this.hasText&&(!this.icon||!this.hasImage)&&(this.selectionMode==="none"||!!this.selectionMode&&this.selectionMode!=="multiple"&&!this.selected)})} @click=${this.handleEmittingEvent} .role=${y} .tabIndex=${p?-1:0} ${o(this.containerRef)}>${this.selectionMode!=="none"&&this.renderSelectionIcon()||""}${this.renderChipImage()}${this.icon&&this.renderIcon()||""}<span class=${i(c.title)}><slot @slotchange=${this.handleDefaultSlotChange}></slot></span>${this.closable&&this.renderCloseButton()||""}</div>`})}};v("calcite-chip",s);export{s as Chip};
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as x,b as f}from"./ZOYJ4343.js";import{a as k}from"./JVPR6YZA.js";import{a as g}from"./UVFQM6FI.js";import{a as b}from"./XGPCFFL2.js";import"./BC4ZMTFC.js";import{a as l}from"./DDSPVSLH.js";import"./W4XITGKA.js";import{l as u,t as m}from"./SBARVI35.js";import"./HWDBQK2D.js";import{B as r,C as o,D as d,E as i,P as v,g as h,h as t,o as a}from"./2ECRIOED.js";var c={title:"title",close:"close",imageContainer:"image-container",chipIcon:"chip-icon",textSlotted:"text--slotted",container:"container",imageSlotted:"image--slotted",closable:"closable",multiple:"multiple",single:"single",selectable:"selectable",selectIcon:"select-icon",selectIconActive:"select-icon--active",nonInteractive:"non-interactive",isCircle:"is-circle",selected:"selected"},C={image:"image"},n={close:"x",checkedSingle:"circle-f",uncheckedMultiple:"square",checkedMultiple:"check-square-f"},I=h`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-flex;cursor:default;border-radius:var(--calcite-chip-corner-radius, 9999px)}:host([closed]){display:none}:host([appearance=outline]) .container,:host([appearance=outline-fill]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-1))}:host([appearance=outline]) .close,:host([appearance=outline-fill]) .close{color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, var(--calcite-color-text-3)))}:host([appearance=outline]):host([kind=brand]),:host([appearance=outline-fill]):host([kind=brand]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-brand));--calcite-internal-chip-selectable-hover-border-color: var(--calcite-chip-border-color, var(--calcite-color-brand));--calcite-internal-chip-selectable-active-border-color: var( --calcite-chip-border-color, var(--calcite-color-brand) )}:host([appearance=outline]):host([kind=inverse]),:host([appearance=outline-fill]):host([kind=inverse]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-border-inverse))}:host([appearance=outline]):host([kind=neutral]),:host([appearance=outline-fill]):host([kind=neutral]){--calcite-internal-chip-border-color: var(--calcite-chip-border-color, var(--calcite-color-border-1))}:host([appearance=outline]){--calcite-internal-chip-background-color: transparent}:host([appearance=outline-fill]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-foreground-1))}:host([appearance=solid]){--calcite-internal-chip-border-color: transparent;--calcite-internal-chip-selectable-hover-border-color: transparent;--calcite-internal-chip-selectable-active-border-color: transparent}:host([appearance=solid]):host([kind=brand]) .container,:host([appearance=solid]):host([kind=inverse]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-inverse))}:host([appearance=solid]):host([kind=brand]) .close,:host([appearance=solid]):host([kind=inverse]) .close{outline-color:var(--calcite-color-text-inverse)}:host([appearance=solid]):host([kind=brand]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-brand))}:host([appearance=solid]):host([kind=inverse]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-inverse))}:host([appearance=solid]):host([kind=inverse]) .close:hover{background-color:var(--calcite-color-inverse-hover)}:host([appearance=solid]):host([kind=inverse]) .close:active{background-color:var(--calcite-color-inverse-press)}:host([appearance=solid]):host([kind=neutral]){--calcite-internal-chip-background-color: var(--calcite-chip-background-color, var(--calcite-color-foreground-2))}:host([kind=neutral]) .container{color:var(--calcite-chip-text-color, var(--calcite-color-text-1))}:host([kind=neutral]) .close{color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, var(--calcite-color-text-3)))}:host([selected]) .select-icon{opacity:1}:host([appearance=solid]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-3);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-border-2)}:host([appearance=solid]):host([kind=inverse]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-inverse-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-inverse-press)}:host([appearance=solid]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-brand-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-brand-press)}:host([appearance=outline-fill]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-2);--calcite-internal-chip-selectable-hover-border-color: var(--calcite-color-border-input);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-foreground-3);--calcite-internal-chip-selectable-active-border-color: var(--calcite-color-text-3)}:host([appearance=outline-fill]):host([kind=inverse]),:host([appearance=outline-fill]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-foreground-2);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-foreground-3)}:host([appearance=outline]):host([kind=neutral]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-transparent-hover);--calcite-internal-chip-selectable-hover-border-color: var(--calcite-color-border-input);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-transparent-press);--calcite-internal-chip-selectable-active-border-color: var(--calcite-color-text-3)}:host([appearance=outline]):host([kind=inverse]),:host([appearance=outline]):host([kind=brand]){--calcite-internal-chip-selectable-hover-background-color: var(--calcite-color-transparent-hover);--calcite-internal-chip-selectable-active-background-color: var(--calcite-color-transparent-press)}:host([scale=s]) .container{--calcite-internal-chip-block-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-font-size: var(--calcite-font-size--2);--calcite-internal-chip-icon-size: var(--calcite-size-xs, 1rem) ;--calcite-internal-chip-icon-space: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-image-size: var(--calcite-spacing-xl, 1.25rem) ;--calcite-internal-chip-title-space: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-close-size: var(--calcite-size-xs, 1rem) }:host([scale=s]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px);--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-px)}:host([scale=s]) .container.image--slotted:has(.chip-icon),:host([scale=s]) .container.image--slotted.text--slotted,:host([scale=s]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: var(--calcite-spacing-xxs, .25rem) }:host([scale=s]) .container.image--slotted:not(.text--slotted,:has(.chip-icon)),:host([scale=s]) .container.image--slotted:not(.selectable){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=s]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: .125rem }:host([scale=s]) .container.multiple:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=s]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=s]) .container.multiple:not(.is-circle).image--slotted:not(.text--slotted){--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container{--calcite-internal-chip-block-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-font-size: var(--calcite-font-size--1);--calcite-internal-chip-icon-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-icon-space: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-image-size: var(--calcite-size-sm, 1.5rem) ;--calcite-internal-chip-title-space: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-close-size: var(--calcite-size-sm, 1.5rem) }:host([scale=m]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-px);--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-px)}:host([scale=m]) .container.image--slotted:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.image--slotted:has(.chip-icon),:host([scale=m]) .container.image--slotted.text--slotted,:host([scale=m]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-px);--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=m]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=m]) .container.multiple:not(.is-circle){--calcite-internal-chip-select-space-x-end: .125rem ;--calcite-internal-chip-select-space-x-start: .125rem }:host([scale=m]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .5rem ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=m]) .container.closable:not(.is-circle){--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container{--calcite-internal-chip-block-size: 2.75rem ;--calcite-internal-chip-container-space-x-end: .5rem ;--calcite-internal-chip-container-space-x-start: .5rem ;--calcite-internal-chip-font-size: var(--calcite-font-size-0);--calcite-internal-chip-icon-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-icon-space: .5rem ;--calcite-internal-chip-image-size: var(--calcite-size-md, 2rem) ;--calcite-internal-chip-title-space: .5rem ;--calcite-internal-close-size: var(--calcite-size-md, 2rem) }:host([scale=l]) .container:not(.closable).is-circle{--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container.image--slotted:not(.is-circle){--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=l]) .container.image--slotted:has(.chip-icon),:host([scale=l]) .container.image--slotted.text--slotted,:host([scale=l]) .container.image--slotted.closable{--calcite-internal-chip-image-space-x-end: .5rem }:host([scale=l]) .container.selectable.single:not(.is-circle).image--slotted{--calcite-internal-chip-container-space-x-start: var(--calcite-spacing-xs, .375rem) }:host([scale=l]) .container.selectable.single:not(.is-circle).selected{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-none, 0)}:host([scale=l]) .container.selectable.single:not(.is-circle).selected.image--slotted{--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xs, .375rem) ;--calcite-internal-chip-select-space-x-start: .5rem }:host([scale=l]) .container.multiple:not(.is-circle){--calcite-internal-chip-container-space-x-start: .5rem ;--calcite-internal-chip-select-space-x-end: var(--calcite-spacing-xxs, .25rem) ;--calcite-internal-chip-select-space-x-start: var(--calcite-spacing-xxs, .25rem) }:host([scale=l]) .container.multiple:not(.is-circle).image--slotted{--calcite-internal-chip-select-space-x-end: .75rem }:host([scale=l]) .container.closable:not(.is-circle){--calcite-internal-chip-container-space-x-end: var(--calcite-spacing-xs, .375rem) }.container{box-sizing:border-box;display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center;justify-content:center;font-weight:var(--calcite-font-weight-medium);outline-color:transparent;background-color:var(--calcite-internal-chip-background-color);border-color:var(--calcite-internal-chip-border-color);border-radius:var(--calcite-chip-corner-radius, 9999px);border-width:var(--calcite-border-width-sm);border-style:solid;font-size:var(--calcite-internal-chip-font-size, var(--calcite-font-size));padding-inline-start:var(--calcite-internal-chip-container-space-x-start);padding-inline-end:var(--calcite-internal-chip-container-space-x-end);block-size:var(--calcite-internal-chip-block-size, auto);inline-size:var(--calcite-internal-chip-inline-size, auto);min-inline-size:var(--calcite-internal-chip-block-size, auto)}.container:hover .select-icon--active{opacity:var(--calcite-opacity-full, 1)}.container.selectable{cursor:pointer}.container.selectable:hover{background-color:var(--calcite-internal-chip-selectable-hover-background-color);border-color:var(--calcite-internal-chip-selectable-hover-border-color)}.container.selectable:active{background-color:var(--calcite-internal-chip-selectable-active-background-color);border-color:var(--calcite-internal-chip-selectable-active-border-color)}.container:not(.non-interactive):focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.container.text--slotted .title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.container:not(.text--slotted) .title,.container:not(.image--slotted) .image-container{display:none}.container.is-circle .chip-icon,.container.is-circle .image-container{padding:var(--calcite-spacing-none, 0)}.title{padding-inline:var(--calcite-internal-chip-title-space)}.image-container{display:inline-flex;overflow:hidden;align-items:center;justify-content:center;pointer-events:none;block-size:var(--calcite-internal-chip-image-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-chip-image-size, var(--calcite-spacing-xxl, 1.5rem));padding-inline-start:var(--calcite-spacing-none, 0);padding-inline-end:var(--calcite-internal-chip-image-space-x-end, 0)}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-timing-function:cubic-bezier(.4,0,.2,1);color:var(--calcite-chip-icon-color, var(--calcite-chip-text-color, var(--calcite-icon-color, currentColor)));padding-inline:var(--calcite-internal-chip-icon-space, var(--calcite-spacing-xs, .375rem))}.select-icon{align-self:center;justify-content:center;align-items:center;display:flex;inset-block-start:-1px;position:absolute;visibility:hidden;inline-size:auto;opacity:0;transition:opacity .15s ease-in-out,inline-size .15s ease-in-out;color:var(--calcite-chip-select-icon-color, currentColor)}.select-icon.select-icon--active{position:relative;visibility:visible;opacity:var(--calcite-opacity-half, .5);color:var(--calcite-chip-select-icon-color-press, var(--calcite-chip-select-icon-color-pressed, var(--calcite-chip-select-icon-color, currentColor)))}.multiple .select-icon{display:flex;align-items:center;justify-content:center}.multiple .select-icon,.single .select-icon--active{padding-inline-start:var(--calcite-internal-chip-select-space-x-start);padding-inline-end:var(--calcite-internal-chip-select-space-x-end);block-size:var(--calcite-internal-chip-icon-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-chip-icon-size, var(--calcite-spacing-xxl, 1.5rem))}slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}.close{margin:0;cursor:pointer;align-items:center;border-radius:50%;border-style:none;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;outline-color:transparent;background-color:var(--calcite-close-background-color, var(--calcite-color-transparent));-webkit-appearance:none;display:flex;align-content:center;justify-content:center;color:var(--calcite-chip-close-icon-color, var(--calcite-close-icon-color, currentColor));block-size:var(--calcite-internal-close-size, var(--calcite-spacing-xxl, 1.5rem));inline-size:var(--calcite-internal-close-size, var(--calcite-spacing-xxl, 1.5rem));padding:0}.close:hover,.close:focus{background-color:var(--calcite-close-background-color-hover, var(--calcite-color-transparent-hover))}.close:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.close:active{background-color:var(--calcite-close-background-color-press, var(--calcite-color-transparent-press))}.close calcite-icon{color:inherit}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([hidden]){display:none}[hidden]{display:none}`,s=class extends d{constructor(){super(),this.closeButtonRef=r(),this.containerRef=r(),this.messages=g(),this.focusSetter=b()(this),this.hasImage=!1,this.hasText=!1,this.appearance="solid",this.closable=!1,this.closed=!1,this.closeOnDelete=!1,this.disabled=!1,this.iconFlipRtl=!1,this.interactive=!1,this.kind="neutral",this.scale="m",this.selected=!1,this.selectionMode="none",this.calciteChipClose=a({cancelable:!1}),this.calciteChipSelect=a({cancelable:!1}),this.calciteInternalChipKeyEvent=a({cancelable:!1}),this.calciteInternalChipSelect=a({cancelable:!1}),this.calciteInternalSyncSelectedChips=a({cancelable:!1}),this.listen("keydown",this.keyDownHandler),this.listen("click",this.clickHandler)}static{this.properties={hasImage:[16,{},{state:!0}],hasText:[16,{},{state:!0}],appearance:[3,{},{reflect:!0}],closable:[7,{},{reflect:!0,type:Boolean}],closed:[7,{},{reflect:!0,type:Boolean}],closeOnDelete:[7,{},{reflect:!0,type:Boolean}],disabled:[7,{},{reflect:!0,type:Boolean}],icon:[3,{type:String},{reflect:!0}],iconFlipRtl:[7,{},{reflect:!0,type:Boolean}],interactive:[5,{},{type:Boolean}],kind:[3,{},{reflect:!0}],label:1,messageOverrides:[0,{},{attribute:!1}],parentChipGroup:[0,{},{attribute:!1}],scale:[3,{},{reflect:!0}],selected:[7,{},{reflect:!0,type:Boolean}],selectionMode:1,value:1}}static{this.styles=I}async setFocus(e){return this.focusSetter(()=>{if(this.interactive)return this.containerRef.value;if(this.closable)return this.closeButtonRef.value},e)}async load(){this.updateHasText()}willUpdate(e){e.has("selected")&&this.hasUpdated&&this.watchSelected(this.selected)}updated(){x(this)}loaded(){this.selectionMode!=="none"&&this.interactive&&this.selected&&this.handleSelectionPropertyChange(this.selected)}watchSelected(e){this.selectionMode!=="none"&&this.handleSelectionPropertyChange(e)}keyDownHandler(e){if(e.target===this.el)switch(e.key){case" ":case"Enter":this.handleEmittingEvent(),e.preventDefault();break;case"Backspace":case"Delete":this.closable&&!this.closed&&this.closeOnDelete&&(e.preventDefault(),this.close());break;case"ArrowRight":case"ArrowLeft":case"Home":case"End":this.calciteInternalChipKeyEvent.emit(e),e.preventDefault();break}}clickHandler(){!this.interactive&&this.closable&&u(this.closeButtonRef.value)}handleDefaultSlotChange(){this.updateHasText()}close(){this.calciteChipClose.emit(),this.selected=!1,this.closed=!0}closeButtonKeyDownHandler(e){k(e.key)&&(e.preventDefault(),this.close())}updateHasText(){this.hasText=this.el.textContent.trim().length>0}handleSlotImageChange(e){this.hasImage=m(e)}handleEmittingEvent(){this.interactive&&this.calciteChipSelect.emit()}handleSelectionPropertyChange(e){this.selectionMode==="single"&&this.calciteInternalSyncSelectedChips.emit(),!this.parentChipGroup.selectedItems.includes(this.el)&&e&&this.selectionMode!=="multiple"&&this.calciteInternalChipSelect.emit(),this.selectionMode!=="single"&&this.calciteInternalSyncSelectedChips.emit()}renderChipImage(){return t`<div class=${i(c.imageContainer)}><slot name=${C.image} @slotchange=${this.handleSlotImageChange}></slot></div>`}renderSelectionIcon(){let e=this.selectionMode==="multiple"?this.selected?n.checkedMultiple:n.uncheckedMultiple:this.selected?n.checkedSingle:void 0;return t`<div class=${i({[c.selectIcon]:!0,[c.selectIconActive]:this.selectionMode==="multiple"||this.selected})}>${e?t`<calcite-icon .icon=${e} .scale=${l(this.scale)}></calcite-icon>`:null}</div>`}renderCloseButton(){return t`<button .ariaLabel=${this.messages.dismissLabel} class=${i(c.close)} @click=${this.close} @keydown=${this.closeButtonKeyDownHandler} .tabIndex=${this.disabled?-1:0} ${o(this.closeButtonRef)}><calcite-icon .icon=${n.close} .scale=${l(this.scale)}></calcite-icon></button>`}renderIcon(){return t`<calcite-icon class=${i(c.chipIcon)} .flipRtl=${this.iconFlipRtl} .icon=${this.icon} .scale=${l(this.scale)}></calcite-icon>`}render(){let{disabled:e}=this,p=e||!e&&!this.interactive,y=this.selectionMode==="multiple"&&this.interactive?"checkbox":this.selectionMode!=="none"&&this.interactive?"radio":this.interactive?"button":"img";return f({disabled:e,children:t`<div .ariaChecked=${this.selectionMode!=="none"&&this.interactive?this.selected:void 0} .ariaLabel=${this.label} class=${i({[c.container]:!0,[c.textSlotted]:this.hasText,[c.imageSlotted]:this.hasImage,[c.selectable]:this.selectionMode!=="none",[c.multiple]:this.selectionMode==="multiple",[c.single]:this.selectionMode==="single"||this.selectionMode==="single-persist",[c.selected]:this.selected,[c.closable]:this.closable,[c.nonInteractive]:!this.interactive,[c.isCircle]:!this.closable&&!this.hasText&&(!this.icon||!this.hasImage)&&(this.selectionMode==="none"||!!this.selectionMode&&this.selectionMode!=="multiple"&&!this.selected)})} @click=${this.handleEmittingEvent} .role=${y} .tabIndex=${p?-1:0} ${o(this.containerRef)}>${this.selectionMode!=="none"&&this.renderSelectionIcon()||""}${this.renderChipImage()}${this.icon&&this.renderIcon()||""}<span class=${i(c.title)}><slot @slotchange=${this.handleDefaultSlotChange}></slot></span>${this.closable&&this.renderCloseButton()||""}</div>`})}};v("calcite-chip",s);export{s as Chip};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{E as e,h as t,l as i}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{E as e,h as t,l as i}from"./2ECRIOED.js";var n={alignmentCenter:"internal-label-alignment--center",alignmentEnd:"internal-label-alignment--end",container:"internal-label--container",requiredIndicator:"internal-label-required--indicator",spacingBottom:"internal-label-spacing--bottom",spacingInlineEnd:"internal-label-spacing-inline--end",spacingInlineStart:"internal-label-spacing-inline--start",text:"internal-label--text"},b=({alignmentCenter:a,bottomSpacingDisabled:l,labelText:r,onClick:s,required:c,spacingInlineEnd:o,spacingInlineStart:d,tooltipText:g})=>t`<div class=${e({[n.alignmentCenter]:a,[n.alignmentEnd]:!a,[n.container]:!0,[n.spacingBottom]:!l,[n.spacingInlineEnd]:o,[n.spacingInlineStart]:d})} @click=${s}><div class=${e(n.text)}>${r}${c&&t`<span aria-hidden=true class=${e(n.requiredIndicator)} title=${g??i}>*</span>`||""}</div><slot name=label-content></slot></div>`;export{b as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
4
|
var c={max:"320px"},a={max:"476px"},i={max:"768px"},t={max:"1152px"},e="8px",n="12px",s="16px",x="2px",o="0.25rem",p="0.5rem";export{c as a,a as b,i as c,t as d,e,n as f,s as g,x as h,o as i,p as j};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{k as f}from"./
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{k as f}from"./FZSVZEO4.js";function m(t,n,e){if(!t)return;let r=t.getTime(),a=!(n instanceof Date)||r>=n.getTime(),o=!(e instanceof Date)||r<=e.getTime();return a&&o}function p(t,n,e){if(!(t instanceof Date))return null;let r=t.getTime(),a=n instanceof Date&&r<n.getTime(),o=e instanceof Date&&r>e.getTime();return a?n:o?e:t}function O(t,n=!1){if(t instanceof Date)return t;if(!t||typeof t!="string")return null;let e=t.split(/[: T-]/).map(parseFloat),r=new Date(e[0],(e[1]||1)-1,e[2]||1);if(r.setFullYear(e[0]),isNaN(r.getTime()))throw new Error(`Invalid ISO 8601 date: "${t}"`);return n?T(r):r}function w(t,n){if(!n)return null;let{separator:e}=n,r=y(t,n),{day:a,month:o}=r,s=M(r.year,n),i=new Date(s,o,a);i.setFullYear(s);let c=a>0,u=o>-1,l=!isNaN(i.getTime()),D=t.split(e).filter(d=>d).length>2,h=s.toString().length>0;return c&&u&&l&&D&&h?i:null}function M(t,n){return g(t,n,"read")}function I(t,n){return g(t,n,"write")}function g(t,n,e){if(n["default-calendar"]!=="buddhist")return t;let a=543*(e==="read"?-1:1);return t+a}function F(t,n){let{separator:e,unitOrder:r}=n,a=S(r),o=t.split(e).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 x(t){if(t instanceof Date){let n=String(t.getMonth()+1).padStart(2,"0"),e=String(t.getDate()).padStart(2,"0");return`${String(t.getFullYear()).padStart(4,"0")}-${n}-${e}`}return""}function E(t){let n=t.split("-");return{day:n[2],month:n[1],year:n[0]}}function v(t,n){return t instanceof Date&&n instanceof Date&&t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()}function A(t){let n=t.getMonth(),e=new Date(t);return e.setMonth(n-1),n===e.getMonth()?new Date(t.getFullYear(),n,0):e}function C(t,n){let e=new Date(t);return e.setMonth(n),e}function L(t,n,e){let r=new Date(t);return r.setDate(1),m(r,n,e)?r:p(r,n,e)}function N(t){let n=t.getMonth(),e=new Date(t);return e.setMonth(n+1),(n+2)%7===e.getMonth()%7?new Date(t.getFullYear(),n+2,0):e}function y(t,n){let{day:e,month:r,year:a}=F(t,n);return{day:parseInt(e),month:parseInt(r)-1,year:parseInt(a)}}function S(t){let n=["d","m","y"],e=t.toLowerCase();return n.sort((r,a)=>e.indexOf(r)-e.indexOf(a))}function R(t,n){let e=t.getTime(),r=n.getTime();return(e-r)/(1e3*3600*24)}function T(t){return t.setHours(23,59,59,999),t}function _(t,n){return t&&n&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()}export{m as a,p as b,O as c,w as d,M as e,I as f,F as g,x as h,E as i,v as j,A as k,C as l,L as m,N as n,S as o,R as p,_ as q};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*! All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
2
2
|
See https://github.com/Esri/calcite-design-system/blob/dev/LICENSE.md for details.
|
|
3
|
-
v5.0.0-next.
|
|
4
|
-
import{a as g,b as h,e as O,f as W,k as x,l as b,n as y,o as F,q as p}from"./2HKRJLBG.js";import{k as d}from"./CVLFEMH2.js";import{h as I,i as P,j as A}from"./FZIUTVKD.js";import{a as u}from"./S5CLKCGJ.js";import{i as S,k as R}from"./5IPJANUU.js";import"./ZLR2B6GQ.js";import{A as z,B as m,C as v,D as Y,E as r,P as w,g as D,h as l,l as $,o as C}from"./AUIOWPFN.js";var E=D`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host{display:block}.header{display:flex;block-size:100%;align-items:center;justify-content:space-between}.chevron-container{display:flex;align-items:center}:host([scale=s]){block-size:24px;margin:var(--calcite-spacing-xs);margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .chevron-container,:host([scale=s]) .chevron{min-inline-size:24px;block-size:24px}:host([scale=m]){block-size:32px;margin:var(--calcite-spacing-sm);margin-inline-start:var(--calcite-spacing-sm-plus)}:host([scale=m]) .chevron-container,:host([scale=m]) .chevron{min-inline-size:32px;block-size:32px;--calcite-internal-action-padding-block: var(--calcite-spacing-xxs)}:host([scale=l]){block-size:44px;margin:var(--calcite-spacing-xs);margin-inline-start:var(--calcite-spacing-sm)}:host([scale=l]) .chevron-container,:host([scale=l]) .chevron{min-inline-size:44px;block-size:44px;--calcite-internal-action-padding-block: var(--calcite-spacing-sm-plus)}.chevron{box-sizing:content-box;display:flex;block-size:100%;inline-size:100%;flex-grow:0;cursor:pointer;align-items:center;justify-content:center;border-style:none;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;outline-color:transparent;--calcite-internal-action-padding-block: 0;--calcite-action-background-color: var(--calcite-date-picker-header-action-background-color);--calcite-action-background-color-hover: var(--calcite-date-picker-header-action-background-color-hover);--calcite-action-background-color-press: var(--calcite-date-picker-header-action-background-color-press);--calcite-action-text-color: var(--calcite-date-picker-header-action-text-color);--calcite-action-text-color-press: var(--calcite-date-picker-header-action-text-color-press)}.chevron:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.chevron[aria-disabled=true]{pointer-events:none}.month-year-container{display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;align-items:center;justify-content:flex-start;text-align:center;line-height:1;gap:var(--calcite-spacing-xxs)}.month-year-container.range-calendar{justify-content:center}.year-container{position:relative;display:flex;block-size:100%}.suffix{display:flex;align-items:center}.year,.suffix{margin-inline:var(--calcite-spacing-xxs);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-date-picker-year-text-color, var(--calcite-color-text-1));font-size:var(--calcite-font-size-md);line-height:var(--calcite-font-line-height-fixed-lg)}.year{position:relative;display:inline-block;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-color:transparent;inline-size:44px}.year:hover{transition-timing-function:cubic-bezier(.4,0,.2,1);transition-property:outline-color;outline:2px solid var(--calcite-color-border-2);outline-offset:-2px}.year:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.month-select{--calcite-select-internal-border-width: 0;--calcite-select-internal-icon-border-inline-end-width: 0;--calcite-select-spacing-inline: var(--calcite-spacing-xxs);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size-md));--calcite-select-text-color: var(--calcite-date-picker-month-select-text-color, var(--calcite-color-text-1));--calcite-select-icon-color: var(--calcite-date-picker-month-select-icon-color);--calcite-select-icon-color-hover: var(--calcite-date-picker-month-select-icon-color-hover);--calcite-internal-select-spacing-block: var(--calcite-spacing-xxs);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-xxs);--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-lg);--calcite-internal-select-font-weight: var(--calcite-font-weight-medium)}:host([scale=s]) .month-year-container .month-select{--calcite-select-spacing-inline: var(--calcite-spacing-base);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size));--calcite-internal-select-spacing-block: var(--calcite-spacing-base);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-base);--calcite-internal-select-block-size: 24px;--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-base)}:host([scale=s]) .month-year-container .year{inline-size:40px}:host([scale=s]) .month-year-container .year,:host([scale=s]) .month-year-container .suffix{font-size:var(--calcite-font-size);line-height:var(--calcite-font-line-height-fixed-base)}:host([scale=l]) .month-year-container .month-select{--calcite-select-spacing-inline: var(--calcite-spacing-sm);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size-lg));--calcite-internal-select-spacing-block: var(--calcite-spacing-sm);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-sm);--calcite-internal-select-block-size: 44px;--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-xl)}:host([scale=l]) .month-year-container .year{inline-size:48px}:host([scale=l]) .month-year-container .year,:host([scale=l]) .month-year-container .suffix{font-size:var(--calcite-font-size-lg);line-height:var(--calcite-font-line-height-fixed-xl)}:host([hidden]){display:none}[hidden]{display:none}`,s={header:"header",chevron:"chevron",chevronContainer:"chevron-container",monthYearContainer:"month-year-container",monthPicker:"month-select",rangeCalendar:"range-calendar",suffix:"suffix",yearContainer:"year-container",year:"year"},N={chevronLeft:"chevron-left",chevronRight:"chevron-right"},K=16,k=class extends Y{constructor(){super(...arguments),this.monthPickerRef=m(),this.nextMonthActionRef=m(),this.prevMonthActionRef=m(),this.yearInputRef=m(),this.calciteInternalDatePickerMonthHeaderSelectChange=C({cancelable:!1})}static{this.properties={nextMonthDate:[16,{},{state:!0}],prevMonthDate:[16,{},{state:!0}],activeDate:[0,{},{attribute:!1}],headingLevel:[9,{},{type:Number}],localeData:[0,{},{attribute:!1}],max:[0,{},{attribute:!1}],messages:[0,{},{attribute:!1}],min:[0,{},{attribute:!1}],monthStyle:1,position:1,scale:[3,{},{reflect:!0}],selectedDate:[0,{},{attribute:!1}]}}static{this.styles=E}connectedCallback(){super.connectedCallback(),this.setNextPrevMonthDates()}load(){this.parentDatePickerEl=R(this.el,"calcite-date-picker")}willUpdate(e){this.hasUpdated&&(e.has("activeDate")||e.has("localeData"))&&this.setYearSelectMenuWidth(),this.hasUpdated&&e.has("scale")&&this.setYearSelectWidthOffset(),(e.has("min")||e.has("max")||e.has("activeDate"))&&this.setNextPrevMonthDates()}loaded(){this.setYearSelectWidthOffset()}setNextPrevMonthDates(){this.activeDate&&(this.nextMonthDate=h(y(this.activeDate),this.min,this.max),this.prevMonthDate=h(x(this.activeDate),this.min,this.max))}onYearKey(e){let t=this.parseCalendarYear(e.target.value);switch(e.key){case"ArrowDown":e.preventDefault(),this.setYear({localizedYear:t,offset:-1});break;case"ArrowUp":e.preventDefault(),this.setYear({localizedYear:t,offset:1});break}}formatCalendarYear(e){return d.localize(`${W(e,this.localeData)}`)}parseCalendarYear(e){return d.localize(`${O(Number(d.delocalize(e)),this.localeData)}`)}onYearChange(e){this.setYear({localizedYear:this.parseCalendarYear(e.target.value)})}onYearInput(e){this.setYear({localizedYear:this.parseCalendarYear(e.target.value),commit:!1})}prevMonthClick(e){this.handleArrowClick(e,this.prevMonthDate)}prevMonthKeydown(e){u(e.key)&&this.prevMonthClick(e)}nextMonthClick(e){this.handleArrowClick(e,this.nextMonthDate)}nextMonthKeydown(e){u(e.key)&&this.nextMonthClick(e)}async handleArrowClick(e,t){e.preventDefault(),await this.handlePenultimateValidMonth(e),this.calciteInternalDatePickerMonthHeaderSelectChange.emit(t)}handleMonthChange(e){let t=e.target,{abbreviated:a,wide:n}=this.localeData.months,i=(this.monthStyle==="wide"?n:a).indexOf(t.value),o=b(this.activeDate,i);g(o,this.min,this.max)||(o=h(o,this.min,this.max)),this.calciteInternalDatePickerMonthHeaderSelectChange.emit(o),this.setYearSelectMenuWidth()}getInRangeDate({localizedYear:e,offset:t=0}){let{min:a,max:n,activeDate:c}=this,i=Number(d.delocalize(e)),o=i.toString().length,f=isNaN(i)?!1:i+t,L=f&&(!a||a.getFullYear()<=f)&&(!n||n.getFullYear()>=f);if(f&&L&&o===e.length){let M=new Date(c);return M.setFullYear(f),h(M,a,n)}}setYear({localizedYear:e,commit:t=!0,offset:a=0}){let{yearInputRef:n,activeDate:c}=this,i=this.getInRangeDate({localizedYear:e,offset:a});i&&this.calciteInternalDatePickerMonthHeaderSelectChange.emit(i),t&&(n.value.value=this.formatCalendarYear((i||c).getFullYear()))}setYearSelectWidthOffset(){this.yearSelectWidthOffset=K+3*parseInt(this.getYearSelectPadding()),this.setYearSelectMenuWidth()}setYearSelectMenuWidth(){let e=this.monthPickerRef.value;e&&requestAnimationFrame(()=>{let t=getComputedStyle(e),a=`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${t.fontSize}/${t.lineHeight} ${t.fontFamily}`,c=this.localeData.months[this.monthStyle][this.activeDate.getMonth()],i=Math.ceil(S(c,a));e.style.width=`${i+this.yearSelectWidthOffset}px`})}isMonthInRange(e){let t=b(this.activeDate,e);return!this.min&&!this.max||g(t,this.min,this.max)?!0:p(t,this.max)||p(t,this.min)}async handlePenultimateValidMonth(e){let n=e.target.getAttribute("data-direction")==="left",c;if(n&&this.min){let i=h(x(this.activeDate),this.min,this.max);c=p(i,this.min)}else if(this.max){let i=h(y(this.activeDate),this.min,this.max);c=p(i,this.max)}if(c)if(this.position)this.yearInputRef.value?.focus();else{let o=(n?this.nextMonthActionRef:this.prevMonthActionRef).value;if(!o)return;o.disabled=!1,await o.setFocus()}}getPx(e){let t=Number(e.replace(/[rem|px]/g,"")),a=16;return e.includes("rem")?`${t*a}px`:`${t}px`}getYearSelectPadding(){let e;switch(this.scale){case"l":e=A;break;case"s":e=I;break;default:e=P;break}return this.getPx(e)}render(){return l`<div class=${r(s.header)}>${this.renderContent()}</div>`}renderContent(){let{localeData:e,activeDate:t}=this;if(!t||!e)return null;if(this.parentDatePickerEl){let{numberingSystem:c,lang:i}=this.parentDatePickerEl;d.numberFormatOptions={useGrouping:!1,...c&&{numberingSystem:c},...i&&{locale:i}}}let a=F(e.unitOrder),n=a.indexOf("y")<a.indexOf("m");return l`${this.position&&l`<div class=${r({[s.chevronContainer]:!0})}>${this.position==="start"&&this.renderChevron("left")||""}</div>`||""}<div class=${r({[s.monthYearContainer]:!0,[s.rangeCalendar]:!!this.position})}>${this.renderMonthYearContainer(n)}</div>${!this.position&&l`<div class=${r({[s.chevronContainer]:!0})}>${this.renderChevron("left")}</div>`||""}<div class=${r({[s.chevronContainer]:!0})}>${this.position!=="start"&&this.renderChevron("right")||""}</div>`}renderMonthYearContainer(e){return e?[this.renderYearInput(),this.renderMonthPicker()]:[this.renderMonthPicker(),this.renderYearInput()]}renderMonthPicker(){let e=this.activeDate.getMonth(),t=this.localeData.months[this.monthStyle];return l`<calcite-select class=${r(s.monthPicker)} .label=${this.messages.monthMenu} @calciteSelectChange=${this.handleMonthChange} width=auto ${v(this.monthPickerRef)}>${t.map((a,n)=>l`<calcite-option .disabled=${!this.isMonthInRange(n)} .selected=${n===e} .value=${a}>${a}</calcite-option>`)}</calcite-select>`}renderYearInput(){let e=this.localeData.year?.suffix,t=this.formatCalendarYear(this.activeDate.getFullYear());return l`<span class=${r(s.yearContainer)}><input .ariaLabel=${this.messages.year} class=${r({[s.year]:!0})} inputmode=numeric maxlength=4 minlength=1 @change=${this.onYearChange} @input=${this.onYearInput} @keydown=${this.onYearKey} pattern=\\d* type=text .value=${z(t??"")} ${v(this.yearInputRef)}>${e&&l`<span class=${r(s.suffix)}>${e}</span>`||""}</span>`}renderChevron(e){let t=e==="right",a=p(t?this.nextMonthDate:this.prevMonthDate,this.activeDate)||!g(this.activeDate,this.min,this.max);return l`<calcite-action alignment=center .ariaDisabled=${a} .ariaLabel=${t?this.messages.nextMonth:this.messages.prevMonth} class=${r(s.chevron)} compact data-direction=${e??$} .disabled=${a} .icon=${t?N.chevronRight:N.chevronLeft} icon-flip-rtl @click=${t?this.nextMonthClick:this.prevMonthClick} @keydown=${t?this.nextMonthKeydown:this.prevMonthKeydown} role=button .scale=${this.scale==="l"?"l":"m"} .text=${t?this.messages.nextMonth:this.messages.prevMonth} ${v(t?this.nextMonthActionRef:this.prevMonthActionRef)}></calcite-action>`}};w("calcite-date-picker-month-header",k);export{k as DatePickerMonthHeader};
|
|
3
|
+
v5.0.0-next.7 */
|
|
4
|
+
import{a as g,b as h,e as O,f as W,k as x,l as b,n as y,o as F,q as p}from"./7TMYLJNL.js";import{k as d}from"./FZSVZEO4.js";import{h as I,i as P,j as A}from"./7RLP2DKK.js";import{a as u}from"./JVPR6YZA.js";import{i as S,k as R}from"./SBARVI35.js";import"./HWDBQK2D.js";import{A as z,B as m,C as v,D as Y,E as r,P as w,g as D,h as l,l as $,o as C}from"./2ECRIOED.js";var E=D`:host{--calcite-internal-color-focus: var( --calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)) )}:host{display:block}.header{display:flex;block-size:100%;align-items:center;justify-content:space-between}.chevron-container{display:flex;align-items:center}:host([scale=s]){block-size:24px;margin:var(--calcite-spacing-xs);margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .chevron-container,:host([scale=s]) .chevron{min-inline-size:24px;block-size:24px}:host([scale=m]){block-size:32px;margin:var(--calcite-spacing-sm);margin-inline-start:var(--calcite-spacing-sm-plus)}:host([scale=m]) .chevron-container,:host([scale=m]) .chevron{min-inline-size:32px;block-size:32px;--calcite-internal-action-padding-block: var(--calcite-spacing-xxs)}:host([scale=l]){block-size:44px;margin:var(--calcite-spacing-xs);margin-inline-start:var(--calcite-spacing-sm)}:host([scale=l]) .chevron-container,:host([scale=l]) .chevron{min-inline-size:44px;block-size:44px;--calcite-internal-action-padding-block: var(--calcite-spacing-sm-plus)}.chevron{box-sizing:content-box;display:flex;block-size:100%;inline-size:100%;flex-grow:0;cursor:pointer;align-items:center;justify-content:center;border-style:none;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;outline-color:transparent;--calcite-internal-action-padding-block: 0;--calcite-action-background-color: var(--calcite-date-picker-header-action-background-color);--calcite-action-background-color-hover: var(--calcite-date-picker-header-action-background-color-hover);--calcite-action-background-color-press: var(--calcite-date-picker-header-action-background-color-press);--calcite-action-text-color: var(--calcite-date-picker-header-action-text-color);--calcite-action-text-color-press: var(--calcite-date-picker-header-action-text-color-press)}.chevron:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.chevron[aria-disabled=true]{pointer-events:none}.month-year-container{display:flex;block-size:100%;inline-size:100%;flex:1 1 auto;align-items:center;justify-content:flex-start;text-align:center;line-height:1;gap:var(--calcite-spacing-xxs)}.month-year-container.range-calendar{justify-content:center}.year-container{position:relative;display:flex;block-size:100%}.suffix{display:flex;align-items:center}.year,.suffix{margin-inline:var(--calcite-spacing-xxs);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-date-picker-year-text-color, var(--calcite-color-text-1));font-size:var(--calcite-font-size-md);line-height:var(--calcite-font-line-height-fixed-lg)}.year{position:relative;display:inline-block;border-style:none;background-color:transparent;text-align:center;font-family:inherit;outline-color:transparent;inline-size:44px}.year:hover{transition-timing-function:cubic-bezier(.4,0,.2,1);transition-property:outline-color;outline:2px solid var(--calcite-color-border-2);outline-offset:-2px}.year:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline:var(--calcite-border-width-md) solid var(--calcite-internal-color-focus);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.month-select{--calcite-select-internal-border-width: 0;--calcite-select-internal-icon-border-inline-end-width: 0;--calcite-select-spacing-inline: var(--calcite-spacing-xxs);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size-md));--calcite-select-text-color: var(--calcite-date-picker-month-select-text-color, var(--calcite-color-text-1));--calcite-select-icon-color: var(--calcite-date-picker-month-select-icon-color);--calcite-select-icon-color-hover: var(--calcite-date-picker-month-select-icon-color-hover);--calcite-internal-select-spacing-block: var(--calcite-spacing-xxs);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-xxs);--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-lg);--calcite-internal-select-font-weight: var(--calcite-font-weight-medium)}:host([scale=s]) .month-year-container .month-select{--calcite-select-spacing-inline: var(--calcite-spacing-base);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size));--calcite-internal-select-spacing-block: var(--calcite-spacing-base);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-base);--calcite-internal-select-block-size: 24px;--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-base)}:host([scale=s]) .month-year-container .year{inline-size:40px}:host([scale=s]) .month-year-container .year,:host([scale=s]) .month-year-container .suffix{font-size:var(--calcite-font-size);line-height:var(--calcite-font-line-height-fixed-base)}:host([scale=l]) .month-year-container .month-select{--calcite-select-spacing-inline: var(--calcite-spacing-sm);--calcite-select-font-size: var(--calcite-date-picker-month-select-font-size, var(--calcite-font-size-lg));--calcite-internal-select-spacing-block: var(--calcite-spacing-sm);--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-sm);--calcite-internal-select-block-size: 44px;--calcite-internal-select-line-height: var(--calcite-font-line-height-fixed-xl)}:host([scale=l]) .month-year-container .year{inline-size:48px}:host([scale=l]) .month-year-container .year,:host([scale=l]) .month-year-container .suffix{font-size:var(--calcite-font-size-lg);line-height:var(--calcite-font-line-height-fixed-xl)}:host([hidden]){display:none}[hidden]{display:none}`,s={header:"header",chevron:"chevron",chevronContainer:"chevron-container",monthYearContainer:"month-year-container",monthPicker:"month-select",rangeCalendar:"range-calendar",suffix:"suffix",yearContainer:"year-container",year:"year"},N={chevronLeft:"chevron-left",chevronRight:"chevron-right"},K=16,k=class extends Y{constructor(){super(...arguments),this.monthPickerRef=m(),this.nextMonthActionRef=m(),this.prevMonthActionRef=m(),this.yearInputRef=m(),this.calciteInternalDatePickerMonthHeaderSelectChange=C({cancelable:!1})}static{this.properties={nextMonthDate:[16,{},{state:!0}],prevMonthDate:[16,{},{state:!0}],activeDate:[0,{},{attribute:!1}],headingLevel:[9,{},{type:Number}],localeData:[0,{},{attribute:!1}],max:[0,{},{attribute:!1}],messages:[0,{},{attribute:!1}],min:[0,{},{attribute:!1}],monthStyle:1,position:1,scale:[3,{},{reflect:!0}],selectedDate:[0,{},{attribute:!1}]}}static{this.styles=E}connectedCallback(){super.connectedCallback(),this.setNextPrevMonthDates()}load(){this.parentDatePickerEl=R(this.el,"calcite-date-picker")}willUpdate(e){this.hasUpdated&&(e.has("activeDate")||e.has("localeData"))&&this.setYearSelectMenuWidth(),this.hasUpdated&&e.has("scale")&&this.setYearSelectWidthOffset(),(e.has("min")||e.has("max")||e.has("activeDate"))&&this.setNextPrevMonthDates()}loaded(){this.setYearSelectWidthOffset()}setNextPrevMonthDates(){this.activeDate&&(this.nextMonthDate=h(y(this.activeDate),this.min,this.max),this.prevMonthDate=h(x(this.activeDate),this.min,this.max))}onYearKey(e){let t=this.parseCalendarYear(e.target.value);switch(e.key){case"ArrowDown":e.preventDefault(),this.setYear({localizedYear:t,offset:-1});break;case"ArrowUp":e.preventDefault(),this.setYear({localizedYear:t,offset:1});break}}formatCalendarYear(e){return d.localize(`${W(e,this.localeData)}`)}parseCalendarYear(e){return d.localize(`${O(Number(d.delocalize(e)),this.localeData)}`)}onYearChange(e){this.setYear({localizedYear:this.parseCalendarYear(e.target.value)})}onYearInput(e){this.setYear({localizedYear:this.parseCalendarYear(e.target.value),commit:!1})}prevMonthClick(e){this.handleArrowClick(e,this.prevMonthDate)}prevMonthKeydown(e){u(e.key)&&this.prevMonthClick(e)}nextMonthClick(e){this.handleArrowClick(e,this.nextMonthDate)}nextMonthKeydown(e){u(e.key)&&this.nextMonthClick(e)}async handleArrowClick(e,t){e.preventDefault(),await this.handlePenultimateValidMonth(e),this.calciteInternalDatePickerMonthHeaderSelectChange.emit(t)}handleMonthChange(e){let t=e.target,{abbreviated:a,wide:n}=this.localeData.months,i=(this.monthStyle==="wide"?n:a).indexOf(t.value),o=b(this.activeDate,i);g(o,this.min,this.max)||(o=h(o,this.min,this.max)),this.calciteInternalDatePickerMonthHeaderSelectChange.emit(o),this.setYearSelectMenuWidth()}getInRangeDate({localizedYear:e,offset:t=0}){let{min:a,max:n,activeDate:c}=this,i=Number(d.delocalize(e)),o=i.toString().length,f=isNaN(i)?!1:i+t,L=f&&(!a||a.getFullYear()<=f)&&(!n||n.getFullYear()>=f);if(f&&L&&o===e.length){let M=new Date(c);return M.setFullYear(f),h(M,a,n)}}setYear({localizedYear:e,commit:t=!0,offset:a=0}){let{yearInputRef:n,activeDate:c}=this,i=this.getInRangeDate({localizedYear:e,offset:a});i&&this.calciteInternalDatePickerMonthHeaderSelectChange.emit(i),t&&(n.value.value=this.formatCalendarYear((i||c).getFullYear()))}setYearSelectWidthOffset(){this.yearSelectWidthOffset=K+3*parseInt(this.getYearSelectPadding()),this.setYearSelectMenuWidth()}setYearSelectMenuWidth(){let e=this.monthPickerRef.value;e&&requestAnimationFrame(()=>{let t=getComputedStyle(e),a=`${t.fontStyle} ${t.fontVariant} ${t.fontWeight} ${t.fontSize}/${t.lineHeight} ${t.fontFamily}`,c=this.localeData.months[this.monthStyle][this.activeDate.getMonth()],i=Math.ceil(S(c,a));e.style.width=`${i+this.yearSelectWidthOffset}px`})}isMonthInRange(e){let t=b(this.activeDate,e);return!this.min&&!this.max||g(t,this.min,this.max)?!0:p(t,this.max)||p(t,this.min)}async handlePenultimateValidMonth(e){let n=e.target.getAttribute("data-direction")==="left",c;if(n&&this.min){let i=h(x(this.activeDate),this.min,this.max);c=p(i,this.min)}else if(this.max){let i=h(y(this.activeDate),this.min,this.max);c=p(i,this.max)}if(c)if(this.position)this.yearInputRef.value?.focus();else{let o=(n?this.nextMonthActionRef:this.prevMonthActionRef).value;if(!o)return;o.disabled=!1,await o.setFocus()}}getPx(e){let t=Number(e.replace(/[rem|px]/g,"")),a=16;return e.includes("rem")?`${t*a}px`:`${t}px`}getYearSelectPadding(){let e;switch(this.scale){case"l":e=A;break;case"s":e=I;break;default:e=P;break}return this.getPx(e)}render(){return l`<div class=${r(s.header)}>${this.renderContent()}</div>`}renderContent(){let{localeData:e,activeDate:t}=this;if(!t||!e)return null;if(this.parentDatePickerEl){let{numberingSystem:c,lang:i}=this.parentDatePickerEl;d.numberFormatOptions={useGrouping:!1,...c&&{numberingSystem:c},...i&&{locale:i}}}let a=F(e.unitOrder),n=a.indexOf("y")<a.indexOf("m");return l`${this.position&&l`<div class=${r({[s.chevronContainer]:!0})}>${this.position==="start"&&this.renderChevron("left")||""}</div>`||""}<div class=${r({[s.monthYearContainer]:!0,[s.rangeCalendar]:!!this.position})}>${this.renderMonthYearContainer(n)}</div>${!this.position&&l`<div class=${r({[s.chevronContainer]:!0})}>${this.renderChevron("left")}</div>`||""}<div class=${r({[s.chevronContainer]:!0})}>${this.position!=="start"&&this.renderChevron("right")||""}</div>`}renderMonthYearContainer(e){return e?[this.renderYearInput(),this.renderMonthPicker()]:[this.renderMonthPicker(),this.renderYearInput()]}renderMonthPicker(){let e=this.activeDate.getMonth(),t=this.localeData.months[this.monthStyle];return l`<calcite-select class=${r(s.monthPicker)} .label=${this.messages.monthMenu} @calciteSelectChange=${this.handleMonthChange} width=auto ${v(this.monthPickerRef)}>${t.map((a,n)=>l`<calcite-option .disabled=${!this.isMonthInRange(n)} .selected=${n===e} .value=${a}>${a}</calcite-option>`)}</calcite-select>`}renderYearInput(){let e=this.localeData.year?.suffix,t=this.formatCalendarYear(this.activeDate.getFullYear());return l`<span class=${r(s.yearContainer)}><input .ariaLabel=${this.messages.year} class=${r({[s.year]:!0})} inputmode=numeric maxlength=4 minlength=1 @change=${this.onYearChange} @input=${this.onYearInput} @keydown=${this.onYearKey} pattern=\\d* type=text .value=${z(t??"")} ${v(this.yearInputRef)}>${e&&l`<span class=${r(s.suffix)}>${e}</span>`||""}</span>`}renderChevron(e){let t=e==="right",a=p(t?this.nextMonthDate:this.prevMonthDate,this.activeDate)||!g(this.activeDate,this.min,this.max);return l`<calcite-action alignment=center .ariaDisabled=${a} .ariaLabel=${t?this.messages.nextMonth:this.messages.prevMonth} class=${r(s.chevron)} compact data-direction=${e??$} .disabled=${a} .icon=${t?N.chevronRight:N.chevronLeft} icon-flip-rtl @click=${t?this.nextMonthClick:this.prevMonthClick} @keydown=${t?this.nextMonthKeydown:this.prevMonthKeydown} role=button .scale=${this.scale==="l"?"l":"m"} .text=${t?this.messages.nextMonth:this.messages.prevMonth} ${v(t?this.nextMonthActionRef:this.prevMonthActionRef)}></calcite-action>`}};w("calcite-date-picker-month-header",k);export{k as DatePickerMonthHeader};
|