@esri/calcite-components 5.1.0-next.60 → 5.1.0-next.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{P62ELMRK.js → 2456UMRT.js} +1 -1
- package/dist/cdn/{NSGUDIUD.js → 2KTMYHAW.js} +1 -1
- package/dist/cdn/{JG5UHKQX.js → 2LF53GB4.js} +1 -1
- package/dist/cdn/{4C4TYQBB.js → 2P632G2E.js} +1 -1
- package/dist/cdn/{HYNLQ4YH.js → 3267GWQD.js} +1 -1
- package/dist/cdn/{Q77UTH6Y.js → 3G3CIXEX.js} +1 -1
- package/dist/cdn/{MYDCGCGV.js → 3GV45XL7.js} +1 -1
- package/dist/cdn/{VEM5ZVQY.js → 3ICV5SHE.js} +1 -1
- package/dist/cdn/{CE6T3SFL.js → 3JBKSYIS.js} +1 -1
- package/dist/cdn/{6N2EIPRN.js → 3LQM4AAW.js} +1 -1
- package/dist/cdn/{KJBAHESF.js → 4N52UXP2.js} +1 -1
- package/dist/cdn/{GAAMXPVO.js → 4UDQDHK5.js} +1 -1
- package/dist/cdn/{4X7777BM.js → 5LCZW2JQ.js} +1 -1
- package/dist/cdn/{BM5NT2QG.js → 5PKID2AH.js} +1 -1
- package/dist/cdn/{VT6TY3DQ.js → 5U6ATQG2.js} +1 -1
- package/dist/cdn/{DOAP6WCZ.js → 66VJLV4W.js} +1 -1
- package/dist/cdn/{6KAHTFCR.js → 6PFKKSZI.js} +1 -1
- package/dist/cdn/{QR33PARD.js → 7H6OSVSN.js} +1 -1
- package/dist/cdn/{OPPGSVL7.js → A2DIOMIO.js} +1 -1
- package/dist/cdn/{OJFAV7QX.js → AEJJ7V3Q.js} +1 -1
- package/dist/cdn/{WAYYJNXJ.js → AFENOOWR.js} +1 -1
- package/dist/cdn/{RLASUYQO.js → AHFXAGCE.js} +3 -3
- package/dist/cdn/{MBCDO7AO.js → ASB2P36T.js} +1 -1
- package/dist/cdn/{XVXDBX77.js → AVBTCVUC.js} +1 -1
- package/dist/cdn/{LY62ZB2S.js → AZBS776X.js} +1 -1
- package/dist/cdn/{36V2SAYV.js → B3FW2QQG.js} +1 -1
- package/dist/cdn/{KAQIINQ5.js → B47INK6Q.js} +1 -1
- package/dist/cdn/{IFEA2KUL.js → B6MITN2K.js} +1 -1
- package/dist/cdn/{EGAAH6TG.js → B7C6K5PT.js} +1 -1
- package/dist/cdn/{SE3IOYSI.js → BGDVANS5.js} +1 -1
- package/dist/cdn/{RDN36IJS.js → BL6QXAIV.js} +1 -1
- package/dist/cdn/{N4CKEM5T.js → C5PHBALC.js} +1 -1
- package/dist/cdn/{EYD2BXTW.js → C7TKNMVD.js} +1 -1
- package/dist/cdn/{KBWDP7P5.js → CZW6Z5FA.js} +1 -1
- package/dist/cdn/{GZJW26MB.js → DJ4O4DWV.js} +1 -1
- package/dist/cdn/{M7SC44EX.js → DLSWM3OM.js} +1 -1
- package/dist/cdn/{5TGQPSUE.js → DOSMWYGZ.js} +1 -1
- package/dist/cdn/{AXYMVOBP.js → E5MESPLW.js} +1 -1
- package/dist/cdn/{7XXNWTI2.js → EJXO3S2W.js} +1 -1
- package/dist/cdn/{IU5CF77N.js → EN6ZD5OF.js} +1 -1
- package/dist/cdn/{ZK2T6DXD.js → EPRMGB6L.js} +1 -1
- package/dist/cdn/{AWVSUBJI.js → FBXFQU7S.js} +1 -1
- package/dist/cdn/{5IEGYEGX.js → FFCH7PVK.js} +1 -1
- package/dist/cdn/{6ULZKAI4.js → FMIJ6OQV.js} +1 -1
- package/dist/cdn/{KZTXVBNL.js → FTWL27SP.js} +1 -1
- package/dist/cdn/{53ELH3LP.js → FWXQAY43.js} +1 -1
- package/dist/cdn/G23XNOBO.js +2 -0
- package/dist/cdn/{LUT36ST7.js → GBN3633U.js} +1 -1
- package/dist/cdn/{MEBYN4KS.js → GHOEAWCM.js} +1 -1
- package/dist/cdn/{MYBWQ74T.js → GLU53ZGB.js} +1 -1
- package/dist/cdn/{UFPOH4DH.js → GMICWUSH.js} +1 -1
- package/dist/cdn/{ACPNEYIL.js → GMRRH74L.js} +1 -1
- package/dist/cdn/{U75VROWX.js → GPMTIDBR.js} +1 -1
- package/dist/cdn/{QIACXKZX.js → GZGT4GLG.js} +1 -1
- package/dist/cdn/{UX7WP7OG.js → HCXIF3OP.js} +1 -1
- package/dist/cdn/{KVPCYSF3.js → HNFET2H6.js} +1 -1
- package/dist/cdn/{CXYCOZWQ.js → HTB7GYZQ.js} +1 -1
- package/dist/cdn/{IHLWEKHE.js → HWWLSUZX.js} +1 -1
- package/dist/cdn/{4DTIKF3X.js → I5C45WH2.js} +1 -1
- package/dist/cdn/{UJIEG7DT.js → I6TNSRCR.js} +1 -1
- package/dist/cdn/{IR5JNEWB.js → I7CKEJAQ.js} +1 -1
- package/dist/cdn/{2JC63UBS.js → IHKBCO4P.js} +1 -1
- package/dist/cdn/{BCQGOHCH.js → IUSDNEJY.js} +1 -1
- package/dist/cdn/{DJNFR4QI.js → J3F7PUOE.js} +1 -1
- package/dist/cdn/{LQAE2SIH.js → J6IE5RA5.js} +1 -1
- package/dist/cdn/{ETIRLUPQ.js → JA6HLFQV.js} +1 -1
- package/dist/cdn/{FE5OXGG4.js → JFB67ZZQ.js} +1 -1
- package/dist/cdn/{PZ2LNZ7Q.js → JGOENALN.js} +1 -1
- package/dist/cdn/{33NBRPD5.js → JJGSG6YO.js} +1 -1
- package/dist/cdn/{QTQYMKX6.js → K7XDIX5M.js} +1 -1
- package/dist/cdn/{PIKQITD7.js → KBPGN6ZH.js} +1 -1
- package/dist/cdn/{ZHJNYGAU.js → L3SPHSWD.js} +1 -1
- package/dist/cdn/L3Y6BWR5.js +2 -0
- package/dist/cdn/{IYHZBXVJ.js → L6MIVBMM.js} +1 -1
- package/dist/cdn/{HBUIHCQ3.js → LY7K6SCT.js} +1 -1
- package/dist/cdn/{7JEZPJH4.js → MBJOKQR6.js} +1 -1
- package/dist/cdn/{ESARDC6W.js → MRCKTLRG.js} +1 -1
- package/dist/cdn/{L7NZTBLE.js → MWUSBIC2.js} +1 -1
- package/dist/cdn/{NKP6IMXA.js → N3HAQCT6.js} +1 -1
- package/dist/cdn/{ROENLRQS.js → NG5VUKCT.js} +1 -1
- package/dist/cdn/{QAP4EE6I.js → NGYSVNFH.js} +1 -1
- package/dist/cdn/{BXB2IHL5.js → NHH2NEOP.js} +1 -1
- package/dist/cdn/{WWBUXJER.js → NNO62MLH.js} +1 -1
- package/dist/cdn/{DYDCVPOI.js → NXNOIDYZ.js} +1 -1
- package/dist/cdn/{SJYIDE3P.js → OHQNMVVO.js} +1 -1
- package/dist/cdn/{YH26LJXE.js → OISCWGNR.js} +1 -1
- package/dist/cdn/{6FN7HUWQ.js → OJZLHJNK.js} +1 -1
- package/dist/cdn/{DRJLGXXO.js → OQ4Z2SCH.js} +1 -1
- package/dist/cdn/OQQJLO2I.js +2 -0
- package/dist/cdn/{NOF5PWPK.js → P5HAUIOI.js} +1 -1
- package/dist/cdn/{DN3KX247.js → PFLVX7RA.js} +1 -1
- package/dist/cdn/{KNF3VDEF.js → PGZHXJMQ.js} +1 -1
- package/dist/cdn/{G4U3PZ4V.js → PJ33FI62.js} +1 -1
- package/dist/cdn/{5GPET3LM.js → PJXZACOR.js} +1 -1
- package/dist/cdn/{YSS6A2ND.js → PNIYH7XD.js} +1 -1
- package/dist/cdn/{CHD3ILKJ.js → PY6PVTN6.js} +1 -1
- package/dist/cdn/{WUYBJO7J.js → QBAAXS5L.js} +1 -1
- package/dist/cdn/{5NQFTJZK.js → QH46LW6S.js} +1 -1
- package/dist/cdn/{VWG4LTDM.js → QHNNYEVQ.js} +1 -1
- package/dist/cdn/{QY422VCO.js → QQXTZJLP.js} +1 -1
- package/dist/cdn/{DLTF566J.js → QVQEDT6H.js} +1 -1
- package/dist/cdn/{5ICBDVRX.js → QVQVNGVA.js} +1 -1
- package/dist/cdn/{PPIX3XNI.js → R7MSRSPB.js} +1 -1
- package/dist/cdn/{WFBKZENT.js → RC3RB2VW.js} +1 -1
- package/dist/cdn/{G2HH5QEA.js → RD6THAYH.js} +1 -1
- package/dist/cdn/{2W7I2RRR.js → RE33LTVM.js} +1 -1
- package/dist/cdn/{YMO6IP7V.js → RL2KYS5O.js} +1 -1
- package/dist/cdn/{HH2LOAD2.js → RLNHANC2.js} +1 -1
- package/dist/cdn/{6EKA77FA.js → RTG7EPX3.js} +1 -1
- package/dist/cdn/{ZANCD4RO.js → SA4YRMIE.js} +1 -1
- package/dist/cdn/{IZ5V7N6A.js → SD36U6CI.js} +1 -1
- package/dist/cdn/{KME5K4QX.js → SGUS5ZQV.js} +1 -1
- package/dist/cdn/{XKU4UAGF.js → SIZZ7WQ4.js} +1 -1
- package/dist/cdn/SJNDQ7TC.js +2 -0
- package/dist/cdn/{SZS6IBW7.js → SLL3ELBW.js} +1 -1
- package/dist/cdn/{QEDFI5NC.js → SMFSZPV5.js} +1 -1
- package/dist/cdn/{SNGWW3DM.js → SXJ7IEBH.js} +1 -1
- package/dist/cdn/{EQU5P7SN.js → TB6XPCPQ.js} +1 -1
- package/dist/cdn/{DXY4C23A.js → TBJB7W5S.js} +1 -1
- package/dist/cdn/{KTZXSDRQ.js → TRY7YNZT.js} +1 -1
- package/dist/cdn/{2PQRUWNS.js → TSCLVZQM.js} +1 -1
- package/dist/cdn/{34NMNGJX.js → TTAONSUU.js} +1 -1
- package/dist/cdn/UIUVKU2D.js +2 -0
- package/dist/cdn/V2ZWESGR.js +2 -0
- package/dist/cdn/{B5A5VFJH.js → VEZNGDUO.js} +1 -1
- package/dist/cdn/{DDV63NHR.js → VKHCA6NQ.js} +1 -1
- package/dist/cdn/{CEDX246E.js → VM3QUD5F.js} +1 -1
- package/dist/cdn/{77KENABW.js → VQVA24SC.js} +1 -1
- package/dist/cdn/{PSCB2XXW.js → VSUNQZ5W.js} +1 -1
- package/dist/cdn/{ENVIXFZU.js → VW6XUMIE.js} +1 -1
- package/dist/cdn/{PZ32GCPB.js → W7GPI4BG.js} +1 -1
- package/dist/cdn/{YLYJ5GXE.js → WCQUYGWM.js} +1 -1
- package/dist/cdn/{Q3D6A7JD.js → WIRFNL6Q.js} +1 -1
- package/dist/cdn/{IJVKNIVS.js → WOES5LWQ.js} +1 -1
- package/dist/cdn/{3RKYV4EU.js → WWS67KOX.js} +1 -1
- package/dist/cdn/{6REHHP67.js → WXKFFPLR.js} +1 -1
- package/dist/cdn/{TGMGVOQH.js → XC7SC3HR.js} +1 -1
- package/dist/cdn/{77N34KNA.js → XKG3LNT2.js} +1 -1
- package/dist/cdn/{JYLOZBNI.js → YIX6JSV2.js} +1 -1
- package/dist/cdn/{XFDDRAT2.js → YKW3TVW3.js} +1 -1
- package/dist/cdn/{G56X4IMP.js → YOPS33PA.js} +1 -1
- package/dist/cdn/{S2ICXQXT.js → YSQVHYFC.js} +1 -1
- package/dist/cdn/{ABV5DIAC.js → Z2QLYWHS.js} +1 -1
- package/dist/cdn/{7QL3YAQN.js → ZGTGVG23.js} +1 -1
- package/dist/cdn/{HSZGLDOY.js → ZZDA66AR.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/resources5.js +1 -2
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useFocusTrap.js +45 -28
- package/dist/chunks/useForm.js +33 -14
- package/dist/components/calcite-combobox/customElement.js +33 -133
- package/dist/components/calcite-focus-trap/customElement.d.ts +46 -0
- package/dist/components/calcite-focus-trap/customElement.js +56 -0
- package/dist/components/calcite-focus-trap/index.d.ts +1 -0
- package/dist/components/calcite-focus-trap/index.js +1 -0
- package/dist/components/calcite-list/customElement.js +1 -0
- package/dist/components/calcite-radio-button/customElement.d.ts +14 -1
- package/dist/components/calcite-radio-button/customElement.js +4 -3
- package/dist/components/calcite-radio-button-group/customElement.js +20 -1
- package/dist/components/calcite-tabs/customElement.js +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/loader.js +2 -1
- package/dist/types/lumina.d.ts +7 -1
- package/dist/types/preact.d.ts +8 -1
- package/dist/types/react.d.ts +9 -1
- package/dist/types/stencil.d.ts +7 -1
- package/package.json +4 -4
- package/dist/cdn/ADSGKQWL.js +0 -2
- package/dist/cdn/CHZZ2RYJ.js +0 -2
- package/dist/cdn/EJJQX4ML.js +0 -2
- package/dist/cdn/M3HCHRLK.js +0 -2
- package/dist/cdn/XP2EMBHK.js +0 -2
|
@@ -29,7 +29,7 @@ import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
|
29
29
|
import { u as useForm } from "../../chunks/useForm.js";
|
|
30
30
|
import { I as IDS, C as CSS, a as ComboboxItemSelector, b as ComboboxItemGroupSelector, c as ICONS } from "../../chunks/resources5.js";
|
|
31
31
|
import { h as hasActiveChildren, i as isSingleLike, g as getLabel, a as getItemAncestors, b as getItemChildren } from "../../chunks/utils2.js";
|
|
32
|
-
const styles = css`: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{position:relative;display:block}:host([scale=s]){font-size:var(--calcite-font-size-relative-sm);--calcite-internal-combobox-spacing-unit-l: .5rem;--calcite-internal-combobox-spacing-unit-s: .25rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-2xs);--calcite-internal-combobox-no-matches-spacing-unit-s: .25rem;--calcite-combobox-input-height: 1rem;--calcite-internal-combobox-input-margin-block: calc(.25rem - 1px) ;--calcite-internal-close-size: 1rem}:host([scale=m]){font-size:var(--calcite-font-size-relative-base);--calcite-internal-combobox-spacing-unit-l: .75rem;--calcite-internal-combobox-spacing-unit-s: .5rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-sm);--calcite-internal-combobox-no-matches-spacing-unit-s: .375rem;--calcite-combobox-input-height: 1rem;--calcite-internal-combobox-input-margin-block: calc(.5rem - 1px) ;--calcite-internal-close-size: 1.5rem}:host([scale=l]){font-size:var(--calcite-font-size-relative-md);--calcite-internal-combobox-spacing-unit-l: 1rem;--calcite-internal-combobox-spacing-unit-s: .75rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-sm-plus);--calcite-internal-combobox-no-matches-spacing-unit-s: var(--calcite-space-sm-plus);--calcite-combobox-input-height: 1.5rem;--calcite-internal-combobox-input-margin-block: calc(var(--calcite-space-sm-plus) - 1px);--calcite-internal-close-size: 2rem}.wrapper{display:flex;border-width:1px;border-style:solid;outline-color:transparent;padding-block:calc(var(--calcite-internal-combobox-spacing-unit-s) / 4);padding-inline:var(--calcite-internal-combobox-spacing-unit-l) var(--calcite-internal-combobox-padding-inline-end);background-color:var(--calcite-combobox-input-background-color, var(--calcite-color-foreground-1));color:var(--calcite-combobox-input-text-color, var(--calcite-color-text-1));border-color:var(--calcite-combobox-input-border-color, var(--calcite-color-border-input))}.wrapper:hover .icon{color:var(--calcite-combobox-icon-color-hover, var(--calcite-color-text-1))}:host(:focus-within) .wrapper,.wrapper--active{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}:host([read-only]) .wrapper{background-color:var(--calcite-color-background)}:host([read-only]) .label{font-weight:var(--calcite-font-weight-medium)}:host([status=invalid]) .wrapper{border-color:var(--calcite-color-status-danger)}:host([status=invalid]:focus-within) .wrapper{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.wrapper--single{padding-block:0;padding-inline:var(--calcite-internal-combobox-spacing-unit-l) var(--calcite-internal-combobox-padding-inline-end);cursor:pointer;flex-wrap:nowrap}.grid-input{position:relative;display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;gap:var(--calcite-internal-combobox-spacing-unit-s);margin-inline-end:var(--calcite-internal-combobox-spacing-unit-s)}.grid-input.selection-display--fit,.grid-input.selection-display--single{flex-wrap:nowrap;overflow:hidden}.input{flex-grow:1;appearance:none;overflow:hidden;text-overflow:ellipsis;border-style:none;background-color:transparent;padding:0;font-family:inherit;color:var(--calcite-color-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);inline-size:100%;margin-block-end:var(--calcite-internal-combobox-spacing-unit-s);min-inline-size:4.8125rem}.input:focus{outline:2px solid transparent;outline-offset:2px}.input:placeholder-shown{text-overflow:ellipsis}.input--single{padding:0;margin-block:var(--calcite-internal-combobox-input-margin-block)}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;width:0px;min-width:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-internal-combobox-spacing-unit-l)}.placeholder-icon{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3))}.input-wrap{display:flex;flex-grow:1;align-items:center}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;max-width:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-internal-combobox-spacing-unit-l)}.icon-end,.icon-start{display:flex;cursor:pointer;align-items:center}.icon-end{flex:none}.icon-end .icon{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3))}.floating-ui-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.floating-ui-container{opacity:0;inset-block-start:0;left:0}}:host([top-layer-disabled]) .floating-ui-container{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown)}.floating-ui-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.floating-ui-container:popover-open{display:block}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.floating-ui-container .calcite-floating-ui-anim{box-shadow:var(--calcite-shadow-md)}@media(forced-colors:active){.wrapper,.floating-ui-container{border:1px solid canvasText}}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.list-container{max-height:45vh;overflow-y:auto;inline-size:var(--calcite-dropdown-width, 100%);background-color:var(--calcite-combobox-background-color, var(--calcite-color-foreground-1))}.list{margin:0;display:block;padding:0;line-height:var(--calcite-font-line-height-relative-snug)}.list--hide{height:0px;overflow:hidden}calcite-chip{--calcite-animation-timing: 0}.chip{margin-block:calc(var(--calcite-internal-combobox-spacing-unit-s) / 4);max-inline-size:100%}.chip--invisible{visibility:hidden;position:absolute}.item{display:block}.select-all{background-color:var(--calcite-combobox-item-background-color-active, var(--calcite-color-foreground-1));border-block-end-color:var(--calcite-combobox-divider-color, var(--calcite-combobox-item-border-color, var(--calcite-color-border-3)));border-block-end-style:solid;border-block-end-width:var(--calcite-border-width-sm);inset-block-start:0;position:sticky;z-index:var(--calcite-z-index-sticky)}.no-matches{padding-block:var(--calcite-internal-combobox-no-matches-spacing-unit-s);padding-inline:var(--calcite-internal-combobox-spacing-unit-l);color:var(--calcite-combobox-input-text-color, var(--calcite-color-text-1));background:var(--calcite-combobox-background-color, var(--calcite-color-foreground-1));cursor:pointer}.no-matches-placeholder{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3));cursor:default}.disabled{opacity:.5}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.clear-button--container{display:flex;cursor:pointer;align-items:center}.clear-button--container:hover calcite-action{--calcite-action-background-color: var(--calcite-clear-button-background-color-hover, var(--calcite-color-foreground-3));--calcite-action-text-color: var(--calcite-clear-button-icon-color-hover, var(--calcite-color-text-1))}.clear-button--container:active calcite-action{--calcite-action-background-color: var(--calcite-clear-button-background-color-press, var(--calcite-color-border-2));--calcite-action-text-color: var(--calcite-clear-button-icon-color-press, var(--calcite-color-text-1))}.clear-button--container calcite-action{--calcite-internal-action-height: 100%;--calcite-internal-action-padding-inline: var(--calcite-spacing-none);--calcite-internal-action-padding-block: var(--calcite-spacing-none);--calcite-action-background-color: var(--calcite-clear-button-background-color, var(--calcite-color-foreground-2));--calcite-action-text-color: var(--calcite-clear-button-icon-color)}.clear-button--container calcite-action:hover{--calcite-action-background-color-hover: var(--calcite-clear-button-background-color-hover, var(--calcite-color-foreground-3));--calcite-action-text-color-press: var(--calcite-clear-button-icon-color-hover)}.clear-button--container calcite-action:active{--calcite-action-background-color-press: var(--calcite-clear-button-background-color-press, var(--calcite-color-border-2));--calcite-action-text-color-press: var(--calcite-clear-button-icon-color-press)}:host([scale=s]) .clear-button--container{padding:var(--calcite-spacing-xxs)}:host([scale=m]) .clear-button--container{padding:var(--calcite-spacing-xxs);padding-inline-end:var(--calcite-space-sm)}:host([scale=l]) .clear-button--container{padding-inline-end:var(--calcite-spacing-sm-plus)}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:.5rem}:host([scale=s]) .validation-container{padding-block-start:.25rem}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}:host([hidden]){display:none}[hidden]{display:none}.text-match{background-color:transparent;color:inherit;font-weight:var(--calcite-font-weight-bold)}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}::placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-input-placeholder-text-color, var(--calcite-color-text-3))}`;
|
|
32
|
+
const styles = css`: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{position:relative;display:block}:host([scale=s]){font-size:var(--calcite-font-size-relative-sm);--calcite-internal-combobox-spacing-unit-l: .5rem;--calcite-internal-combobox-spacing-unit-s: .25rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-2xs);--calcite-internal-combobox-no-matches-spacing-unit-s: .25rem;--calcite-combobox-input-height: 1rem;--calcite-internal-combobox-input-margin-block: calc(.25rem - 1px) ;--calcite-internal-close-size: 1rem}:host([scale=m]){font-size:var(--calcite-font-size-relative-base);--calcite-internal-combobox-spacing-unit-l: .75rem;--calcite-internal-combobox-spacing-unit-s: .5rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-sm);--calcite-internal-combobox-no-matches-spacing-unit-s: .375rem;--calcite-combobox-input-height: 1rem;--calcite-internal-combobox-input-margin-block: calc(.5rem - 1px) ;--calcite-internal-close-size: 1.5rem}:host([scale=l]){font-size:var(--calcite-font-size-relative-md);--calcite-internal-combobox-spacing-unit-l: 1rem;--calcite-internal-combobox-spacing-unit-s: .75rem;--calcite-internal-combobox-padding-inline-end: var(--calcite-space-sm-plus);--calcite-internal-combobox-no-matches-spacing-unit-s: var(--calcite-space-sm-plus);--calcite-combobox-input-height: 1.5rem;--calcite-internal-combobox-input-margin-block: calc(var(--calcite-space-sm-plus) - 1px);--calcite-internal-close-size: 2rem}.wrapper{display:flex;border-width:1px;border-style:solid;outline-color:transparent;padding-block:calc(var(--calcite-internal-combobox-spacing-unit-s) / 4);padding-inline:var(--calcite-internal-combobox-spacing-unit-l) var(--calcite-internal-combobox-padding-inline-end);background-color:var(--calcite-combobox-input-background-color, var(--calcite-color-foreground-1));color:var(--calcite-combobox-input-text-color, var(--calcite-color-text-1));border-color:var(--calcite-combobox-input-border-color, var(--calcite-color-border-input))}.wrapper:hover .icon{color:var(--calcite-combobox-icon-color-hover, var(--calcite-color-text-1))}:host(:focus-within) .wrapper,.wrapper--active{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}:host([read-only]) .wrapper{background-color:var(--calcite-color-background)}:host([read-only]) .label{font-weight:var(--calcite-font-weight-medium)}:host([status=invalid]) .wrapper{border-color:var(--calcite-color-status-danger)}:host([status=invalid]:focus-within) .wrapper{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.wrapper--single{padding-block:0;padding-inline:var(--calcite-internal-combobox-spacing-unit-l) var(--calcite-internal-combobox-padding-inline-end);cursor:pointer;flex-wrap:nowrap}.grid-input{position:relative;display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;gap:var(--calcite-internal-combobox-spacing-unit-s);margin-inline-end:var(--calcite-internal-combobox-spacing-unit-s)}.grid-input.selection-display--fit,.grid-input.selection-display--single{flex-wrap:nowrap;overflow:hidden}.input{flex-grow:1;appearance:none;overflow:hidden;text-overflow:ellipsis;border-style:none;background-color:transparent;padding:0;font-family:inherit;color:var(--calcite-color-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);inline-size:100%;margin-block-end:var(--calcite-internal-combobox-spacing-unit-s);min-inline-size:4.8125rem}.input:focus{outline:2px solid transparent;outline-offset:2px}.input:placeholder-shown{text-overflow:ellipsis}.input--single{padding:0;margin-block:var(--calcite-internal-combobox-input-margin-block)}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;width:0px;min-width:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-internal-combobox-spacing-unit-l)}.placeholder-icon{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3))}.input-wrap{display:flex;flex-grow:1;align-items:center}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;max-width:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-internal-combobox-spacing-unit-l)}.icon-end,.icon-start{display:flex;cursor:pointer;align-items:center}.icon-end{flex:none}.icon-end .icon{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3))}.floating-ui-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.floating-ui-container{opacity:0;inset-block-start:0;left:0}}:host([top-layer-disabled]) .floating-ui-container{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown)}.floating-ui-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.floating-ui-container:popover-open{display:block}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.floating-ui-container .calcite-floating-ui-anim{box-shadow:var(--calcite-shadow-md)}@media(forced-colors:active){.wrapper,.floating-ui-container{border:1px solid canvasText}}.screen-readers-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.list-container{max-height:45vh;overflow-y:auto;inline-size:var(--calcite-dropdown-width, 100%);background-color:var(--calcite-combobox-background-color, var(--calcite-color-foreground-1))}.list{margin:0;display:block;padding:0;line-height:var(--calcite-font-line-height-relative-snug)}.list--hide{height:0px;overflow:hidden}calcite-chip{--calcite-animation-timing: 0}.chip{margin-block:calc(var(--calcite-internal-combobox-spacing-unit-s) / 4);max-inline-size:100%}.chip--invisible{visibility:hidden;position:absolute}.item{display:block}.select-all{background-color:var(--calcite-combobox-item-background-color-active, var(--calcite-color-foreground-1));border-block-end-color:var(--calcite-combobox-divider-color, var(--calcite-combobox-item-border-color, var(--calcite-color-border-3)));border-block-end-style:solid;border-block-end-width:var(--calcite-border-width-sm);inset-block-start:0;position:sticky;z-index:var(--calcite-z-index-sticky)}.no-matches{padding-block:var(--calcite-internal-combobox-no-matches-spacing-unit-s);padding-inline:var(--calcite-internal-combobox-spacing-unit-l);color:var(--calcite-combobox-input-text-color, var(--calcite-color-text-1));background:var(--calcite-combobox-background-color, var(--calcite-color-foreground-1));cursor:pointer}.no-matches-placeholder{color:var(--calcite-combobox-icon-color, var(--calcite-color-text-3));cursor:default}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.clear-button--container{display:flex;cursor:pointer;align-items:center}.clear-button--container:hover calcite-action{--calcite-action-background-color: var(--calcite-clear-button-background-color-hover, var(--calcite-color-foreground-3));--calcite-action-text-color: var(--calcite-clear-button-icon-color-hover, var(--calcite-color-text-1))}.clear-button--container:active calcite-action{--calcite-action-background-color: var(--calcite-clear-button-background-color-press, var(--calcite-color-border-2));--calcite-action-text-color: var(--calcite-clear-button-icon-color-press, var(--calcite-color-text-1))}.clear-button--container calcite-action{--calcite-internal-action-height: 100%;--calcite-internal-action-padding-inline: var(--calcite-spacing-none);--calcite-internal-action-padding-block: var(--calcite-spacing-none);--calcite-action-background-color: var(--calcite-clear-button-background-color, var(--calcite-color-foreground-2));--calcite-action-text-color: var(--calcite-clear-button-icon-color)}.clear-button--container calcite-action:hover{--calcite-action-background-color-hover: var(--calcite-clear-button-background-color-hover, var(--calcite-color-foreground-3));--calcite-action-text-color-press: var(--calcite-clear-button-icon-color-hover)}.clear-button--container calcite-action:active{--calcite-action-background-color-press: var(--calcite-clear-button-background-color-press, var(--calcite-color-border-2));--calcite-action-text-color-press: var(--calcite-clear-button-icon-color-press)}:host([scale=s]) .clear-button--container{padding:var(--calcite-spacing-xxs)}:host([scale=m]) .clear-button--container{padding:var(--calcite-spacing-xxs);padding-inline-end:var(--calcite-space-sm)}:host([scale=l]) .clear-button--container{padding-inline-end:var(--calcite-spacing-sm-plus)}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:.5rem}:host([scale=s]) .validation-container{padding-block-start:.25rem}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}:host([hidden]){display:none}[hidden]{display:none}.text-match{background-color:transparent;color:inherit;font-weight:var(--calcite-font-weight-bold)}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}::placeholder{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-input-placeholder-text-color, var(--calcite-color-text-3))}`;
|
|
33
33
|
class Combobox extends LitElement {
|
|
34
34
|
constructor() {
|
|
35
35
|
super();
|
|
@@ -122,7 +122,6 @@ class Combobox extends LitElement {
|
|
|
122
122
|
this.compactSelectionDisplay = false;
|
|
123
123
|
this.selectedHiddenChipsCount = 0;
|
|
124
124
|
this.selectedVisibleChipsCount = 0;
|
|
125
|
-
this.allItems = [];
|
|
126
125
|
this.items = [];
|
|
127
126
|
this.clearDisabled = false;
|
|
128
127
|
this.disabled = false;
|
|
@@ -153,7 +152,7 @@ class Combobox extends LitElement {
|
|
|
153
152
|
this.listen("click", this.comboboxFocusHandler);
|
|
154
153
|
}
|
|
155
154
|
static {
|
|
156
|
-
this.properties = { activeChipIndex: [16, {}, { state: true }], activeDescendant: [16, {}, { state: true }], activeItemIndex: [16, {}, { state: true }], compactSelectionDisplay: [16, {}, { state: true }], selectedHiddenChipsCount: [16, {}, { state: true }], selectedVisibleChipsCount: [16, {}, { state: true }],
|
|
155
|
+
this.properties = { activeChipIndex: [16, {}, { state: true }], activeDescendant: [16, {}, { state: true }], activeItemIndex: [16, {}, { state: true }], compactSelectionDisplay: [16, {}, { state: true }], selectedHiddenChipsCount: [16, {}, { state: true }], selectedVisibleChipsCount: [16, {}, { state: true }], items: [16, {}, { state: true }], noMatchesFound: [16, {}, { state: true }], allowCustomValues: [7, {}, { reflect: true, type: Boolean }], clearDisabled: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], filterText: [3, {}, { reflect: true }], filterProps: [0, {}, { attribute: false }], filteredItems: [32, {}, { attribute: false, readOnly: true }], flipPlacements: [0, {}, { attribute: false }], form: [3, {}, { reflect: true }], label: 1, labelText: 1, maxItems: [11, {}, { reflect: true, type: Number }], messageOverrides: [0, {}, { attribute: false }], name: [3, {}, { reflect: true }], open: [7, {}, { reflect: true, type: Boolean }], overlayPositioning: [3, {}, { reflect: true }], placeholder: 1, placeholderIcon: [3, { type: String }, { reflect: true }], placeholderIconFlipRtl: [7, {}, { reflect: true, type: Boolean }], placement: [3, {}, { reflect: true }], readOnly: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], selectAllEnabled: [7, {}, { reflect: true, type: Boolean }], selectedItems: [0, {}, { attribute: false }], selectionDisplay: [3, {}, { reflect: true }], selectionAppearance: [3, {}, { reflect: true }], selectionMode: [3, {}, { reflect: true }], status: [3, {}, { reflect: true }], topLayerDisabled: [7, {}, { reflect: true, type: Boolean }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [32, {}, { readOnly: true, attribute: false }], value: 1 };
|
|
157
156
|
}
|
|
158
157
|
static {
|
|
159
158
|
this.formAssociated = true;
|
|
@@ -175,21 +174,10 @@ class Combobox extends LitElement {
|
|
|
175
174
|
return !open && selectedItem ? !!selectedIcon && singleSelectionMode : !!placeholderIcon && (!selectedItem || singleSelectionMode);
|
|
176
175
|
}
|
|
177
176
|
get allSelected() {
|
|
178
|
-
|
|
179
|
-
return enabledItems.length > 0 && enabledItems.every((item) => item.selected);
|
|
180
|
-
}
|
|
181
|
-
get hasDisabledItems() {
|
|
182
|
-
return this.allItems.some((item) => item.disabled);
|
|
183
|
-
}
|
|
184
|
-
get hasDisabledSelected() {
|
|
185
|
-
return this.allItems.some((item) => item.disabled && item.selected);
|
|
177
|
+
return this.selectedItems.length === this.items.length;
|
|
186
178
|
}
|
|
187
179
|
get indeterminate() {
|
|
188
|
-
|
|
189
|
-
if (!this.selectAllEnabled) {
|
|
190
|
-
return this.selectedItems.length > 0 && !this.allSelected;
|
|
191
|
-
}
|
|
192
|
-
return !this.allSelected && hasAnySelected;
|
|
180
|
+
return this.selectedItems.length > 0 && !this.allSelected;
|
|
193
181
|
}
|
|
194
182
|
get keyboardNavItems() {
|
|
195
183
|
const { selectAllComboboxItemRef } = this;
|
|
@@ -314,7 +302,7 @@ class Combobox extends LitElement {
|
|
|
314
302
|
}
|
|
315
303
|
valueHandler(value) {
|
|
316
304
|
if (!this.internalValueChangeFlag) {
|
|
317
|
-
this.
|
|
305
|
+
this.getItems().forEach((item) => {
|
|
318
306
|
item.selected = Array.isArray(value) ? value.includes(item.value) : value === item.value;
|
|
319
307
|
});
|
|
320
308
|
this.updateItems();
|
|
@@ -328,9 +316,6 @@ class Combobox extends LitElement {
|
|
|
328
316
|
this.internalValueChangeFlag = true;
|
|
329
317
|
this.value = this.getValue();
|
|
330
318
|
this.internalValueChangeFlag = false;
|
|
331
|
-
if (this.selectionDisplay === "fit" && this.isMulti()) {
|
|
332
|
-
this.refreshSelectionDisplay();
|
|
333
|
-
}
|
|
334
319
|
}
|
|
335
320
|
async documentClickHandler(event) {
|
|
336
321
|
if (this.disabled || event.composedPath().includes(this.el)) {
|
|
@@ -351,7 +336,7 @@ class Combobox extends LitElement {
|
|
|
351
336
|
if (isSelectAllTarget) {
|
|
352
337
|
this.toggleSelectAll();
|
|
353
338
|
}
|
|
354
|
-
if (this.allSelected
|
|
339
|
+
if (this.allSelected) {
|
|
355
340
|
this.selectedItems.forEach((item) => {
|
|
356
341
|
const chipEl = this.referenceEl.querySelector(`#${IDS.chip(item.guid)}`);
|
|
357
342
|
if (chipEl) {
|
|
@@ -412,13 +397,8 @@ class Combobox extends LitElement {
|
|
|
412
397
|
}
|
|
413
398
|
toggleSelectAll() {
|
|
414
399
|
const toggledValue = !this.allSelected;
|
|
415
|
-
this.
|
|
416
|
-
|
|
417
|
-
return;
|
|
418
|
-
}
|
|
419
|
-
item.selected = toggledValue;
|
|
420
|
-
});
|
|
421
|
-
this.selectedItems = this.getSelectedItems();
|
|
400
|
+
this.items.forEach((item) => item.selected = toggledValue);
|
|
401
|
+
this.selectedItems = toggledValue ? this.items : [];
|
|
422
402
|
this.emitComboboxChange();
|
|
423
403
|
}
|
|
424
404
|
keyDownHandler(event) {
|
|
@@ -663,7 +643,7 @@ class Combobox extends LitElement {
|
|
|
663
643
|
inputWidth,
|
|
664
644
|
largestSelectedIndicatorChipWidth
|
|
665
645
|
});
|
|
666
|
-
if (this.allSelected && this.selectAllEnabled
|
|
646
|
+
if (this.allSelected && this.selectAllEnabled) {
|
|
667
647
|
this.selectedItems.forEach((item) => {
|
|
668
648
|
const chipEl = this.referenceEl.querySelector(`#${IDS.chip(item.guid)}`);
|
|
669
649
|
if (chipEl) {
|
|
@@ -720,7 +700,7 @@ class Combobox extends LitElement {
|
|
|
720
700
|
if (newSelectedVisibleChipsCount !== this.selectedVisibleChipsCount) {
|
|
721
701
|
this.selectedVisibleChipsCount = newSelectedVisibleChipsCount;
|
|
722
702
|
}
|
|
723
|
-
const newSelectedHiddenChipsCount =
|
|
703
|
+
const newSelectedHiddenChipsCount = this.getSelectedItems().length - newSelectedVisibleChipsCount;
|
|
724
704
|
if (newSelectedHiddenChipsCount !== this.selectedHiddenChipsCount) {
|
|
725
705
|
this.selectedHiddenChipsCount = newSelectedHiddenChipsCount;
|
|
726
706
|
}
|
|
@@ -804,12 +784,7 @@ class Combobox extends LitElement {
|
|
|
804
784
|
el.selected = true;
|
|
805
785
|
});
|
|
806
786
|
} else {
|
|
807
|
-
children.forEach((el) =>
|
|
808
|
-
if (el.disabled) {
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
el.selected = false;
|
|
812
|
-
});
|
|
787
|
+
children.forEach((el) => el.selected = false);
|
|
813
788
|
[...ancestors].forEach((el) => {
|
|
814
789
|
if (!hasActiveChildren(el)) {
|
|
815
790
|
el.selected = false;
|
|
@@ -818,8 +793,7 @@ class Combobox extends LitElement {
|
|
|
818
793
|
}
|
|
819
794
|
}
|
|
820
795
|
updateItems() {
|
|
821
|
-
this.
|
|
822
|
-
this.items = this.allItems.filter((item) => !item.disabled);
|
|
796
|
+
this.items = this.getItems();
|
|
823
797
|
this.groupItems = this.getGroupItems();
|
|
824
798
|
this.data = this.getData();
|
|
825
799
|
this.groupData = this.getGroupData();
|
|
@@ -827,7 +801,7 @@ class Combobox extends LitElement {
|
|
|
827
801
|
this.selectedItems = this.getSelectedItems();
|
|
828
802
|
}
|
|
829
803
|
updateItemProps() {
|
|
830
|
-
this.
|
|
804
|
+
this.getItems(true).forEach((item) => {
|
|
831
805
|
item.selectionMode = this.selectionMode;
|
|
832
806
|
item.selectionAppearance = this.selectionAppearance;
|
|
833
807
|
item.scale = this.scale;
|
|
@@ -989,111 +963,40 @@ class Combobox extends LitElement {
|
|
|
989
963
|
const value = Array.isArray(this.value) ? this.value.join(", ") : this.value;
|
|
990
964
|
return this.readOnly ? this.messages.nonEditable?.replace("{value}", `${value}`) : value;
|
|
991
965
|
}
|
|
992
|
-
getChipLabel(item, isAncestors) {
|
|
993
|
-
if (!isAncestors) {
|
|
994
|
-
return getLabel(item);
|
|
995
|
-
}
|
|
996
|
-
const ancestors = [...getItemAncestors(item)].reverse();
|
|
997
|
-
return [...ancestors, item].map((el) => getLabel(el)).join(" / ");
|
|
998
|
-
}
|
|
999
|
-
renderChip({ activeChipIndex, disabled, index, item, messages, readOnly, scale, isAncestors }) {
|
|
1000
|
-
const label = this.getChipLabel(item, isAncestors);
|
|
1001
|
-
return keyed(item.guid || item.value || label, html`<calcite-chip .appearance=${readOnly ? "outline" : "solid"} class=${safeClassMap({
|
|
1002
|
-
[CSS.chip]: true,
|
|
1003
|
-
[CSS.disabled]: disabled
|
|
1004
|
-
})} .closable=${!disabled && !readOnly} .disabled=${disabled} .icon=${item.icon} .iconFlipRtl=${item.iconFlipRtl} id=${(!disabled && item.guid ? `${IDS.chip(item.guid)}` : null) ?? nothing} .label=${label} .messageOverrides=${!disabled ? { dismissLabel: messages.removeTag } : null} @calciteChipClose=${!disabled ? () => this.calciteChipCloseHandler(item) : null} @focusin=${!disabled ? () => this.activeChipIndex = index : null} .scale=${scale} .selected=${item.selected} .tabIndex=${!disabled && activeChipIndex === index ? 0 : -1} title=${label ?? nothing} .value=${item.value}>${label}</calcite-chip>`);
|
|
1005
|
-
}
|
|
1006
|
-
renderChipCount(count, scale) {
|
|
1007
|
-
const label = this.messages.disabledSelectedCount?.replace("{count}", `${count}`) ?? `+${count}`;
|
|
1008
|
-
return html`<calcite-chip appearance=solid class=${safeClassMap({
|
|
1009
|
-
[CSS.chip]: true
|
|
1010
|
-
})} .label=${label} .scale=${scale} tabindex=-1 title=${label ?? nothing}>${label}</calcite-chip>`;
|
|
1011
|
-
}
|
|
1012
966
|
renderChips() {
|
|
1013
|
-
const { activeChipIndex, readOnly, scale,
|
|
1014
|
-
|
|
1015
|
-
const isAncestors = selectionMode === "ancestors";
|
|
1016
|
-
const allSelectedNoDisabled = this.allSelected && !this.hasDisabledItems;
|
|
1017
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
1018
|
-
const disabledItems = this.allItems.filter((item) => item.disabled && item.selected && (!isAncestors || !hasActiveChildren(item)));
|
|
1019
|
-
const preserveOrder = selectionDisplay === "all";
|
|
1020
|
-
if (selectionDisplay === "fit" && (allSelectedNoDisabled || allSelectedWithDisabledSelected) || selectionDisplay === "all" && this.selectAllEnabled && allSelectedWithDisabledSelected || this.selectAllEnabled && this.allSelected && !this.hasDisabledItems) {
|
|
967
|
+
const { activeChipIndex, readOnly, scale, selectionMode, messages } = this;
|
|
968
|
+
if (this.selectAllEnabled && this.allSelected) {
|
|
1021
969
|
return null;
|
|
1022
970
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
item,
|
|
1034
|
-
messages,
|
|
1035
|
-
readOnly,
|
|
1036
|
-
scale,
|
|
1037
|
-
isAncestors
|
|
1038
|
-
}));
|
|
1039
|
-
}
|
|
1040
|
-
return;
|
|
1041
|
-
}
|
|
1042
|
-
if (!this.selectAllEnabled || !this.allSelected || this.hasDisabledItems) {
|
|
1043
|
-
if (item.selected && (!isAncestors || !hasActiveChildren(item))) {
|
|
1044
|
-
chips.push(this.renderChip({
|
|
1045
|
-
activeChipIndex,
|
|
1046
|
-
disabled: false,
|
|
1047
|
-
index: selectedIndex++,
|
|
1048
|
-
item,
|
|
1049
|
-
messages,
|
|
1050
|
-
readOnly,
|
|
1051
|
-
scale,
|
|
1052
|
-
isAncestors
|
|
1053
|
-
}));
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
});
|
|
1057
|
-
} else if (!this.selectAllEnabled || !this.allSelected || this.hasDisabledItems) {
|
|
1058
|
-
this.selectedItems.forEach((item) => {
|
|
1059
|
-
chips.push(this.renderChip({
|
|
1060
|
-
activeChipIndex,
|
|
1061
|
-
disabled: false,
|
|
1062
|
-
index: selectedIndex++,
|
|
1063
|
-
item,
|
|
1064
|
-
messages,
|
|
1065
|
-
readOnly,
|
|
1066
|
-
scale,
|
|
1067
|
-
isAncestors
|
|
1068
|
-
}));
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
if (selectionDisplay === "fit" && disabledItems.length) {
|
|
1072
|
-
chips.push(this.renderChipCount(disabledItems.length, scale));
|
|
1073
|
-
}
|
|
1074
|
-
return chips.length ? chips : null;
|
|
971
|
+
return this.selectedItems.map((item, i) => {
|
|
972
|
+
const chipClasses = {
|
|
973
|
+
[CSS.chip]: true
|
|
974
|
+
};
|
|
975
|
+
const ancestors = [...getItemAncestors(item)].reverse();
|
|
976
|
+
const itemLabel = getLabel(item);
|
|
977
|
+
const pathLabel = [...ancestors, item].map((el) => getLabel(el));
|
|
978
|
+
const label = selectionMode !== "ancestors" ? itemLabel : pathLabel.join(" / ");
|
|
979
|
+
return keyed(itemLabel, html`<calcite-chip .appearance=${readOnly ? "outline" : "solid"} class=${safeClassMap(chipClasses)} .closable=${!readOnly} .icon=${item.icon} .iconFlipRtl=${item.iconFlipRtl} id=${(item.guid ? `${IDS.chip(item.guid)}` : null) ?? nothing} .label=${label} .messageOverrides=${{ dismissLabel: messages.removeTag }} @calciteChipClose=${() => this.calciteChipCloseHandler(item)} @focusin=${() => this.activeChipIndex = i} .scale=${scale} .selected=${item.selected} .tabIndex=${activeChipIndex === i ? 0 : -1} title=${label ?? nothing} .value=${item.value}>${label}</calcite-chip>`);
|
|
980
|
+
});
|
|
1075
981
|
}
|
|
1076
982
|
renderAllSelectedIndicatorChip() {
|
|
1077
983
|
const { allSelectedIndicatorChipRef, compactSelectionDisplay, scale, selectedVisibleChipsCount } = this;
|
|
1078
984
|
const label = compactSelectionDisplay ? this.messages.all : this.messages.allSelected;
|
|
1079
|
-
const showAllSelectedChip = this.allSelected && (this.selectionDisplay === "single" || !selectedVisibleChipsCount || this.selectionDisplay === "fit" && this.hasDisabledSelected || this.selectionDisplay === "all" && this.hasDisabledSelected);
|
|
1080
985
|
return html`<calcite-chip class=${safeClassMap({
|
|
1081
986
|
[CSS.chip]: true,
|
|
1082
|
-
[CSS.chipInvisible]: !
|
|
987
|
+
[CSS.chipInvisible]: !(this.allSelected && !selectedVisibleChipsCount),
|
|
1083
988
|
[CSS.allSelected]: true
|
|
1084
989
|
})} .label=${label} .scale=${scale} title=${label ?? nothing} value ${ref(allSelectedIndicatorChipRef)}>${label}</calcite-chip>`;
|
|
1085
990
|
}
|
|
1086
991
|
renderSelectedIndicatorChip() {
|
|
1087
|
-
const { compactSelectionDisplay, selectionDisplay, scale, selectedHiddenChipsCount, selectedVisibleChipsCount, selectedIndicatorChipRef } = this;
|
|
1088
|
-
const allSelectedNoDisabled = this.allSelected && !this.hasDisabledItems;
|
|
1089
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
992
|
+
const { compactSelectionDisplay, selectionDisplay, getSelectedItems, scale, selectedHiddenChipsCount, selectedVisibleChipsCount, selectedIndicatorChipRef } = this;
|
|
1090
993
|
let chipInvisible;
|
|
1091
994
|
let label;
|
|
1092
995
|
if (compactSelectionDisplay) {
|
|
1093
996
|
chipInvisible = true;
|
|
1094
997
|
} else {
|
|
1095
998
|
if (selectionDisplay === "single") {
|
|
1096
|
-
const selectedItemsCount =
|
|
999
|
+
const selectedItemsCount = getSelectedItems().length;
|
|
1097
1000
|
if (this.allSelected) {
|
|
1098
1001
|
chipInvisible = true;
|
|
1099
1002
|
} else if (selectedItemsCount > 0) {
|
|
@@ -1103,7 +1006,7 @@ class Combobox extends LitElement {
|
|
|
1103
1006
|
}
|
|
1104
1007
|
label = `${selectedItemsCount} ${this.messages.selected}`;
|
|
1105
1008
|
} else if (selectionDisplay === "fit") {
|
|
1106
|
-
chipInvisible = !!(
|
|
1009
|
+
chipInvisible = !!(this.allSelected && selectedVisibleChipsCount === 0 || selectedHiddenChipsCount === 0);
|
|
1107
1010
|
label = selectedVisibleChipsCount > 0 ? `+${selectedHiddenChipsCount}` : `${selectedHiddenChipsCount} ${this.messages.selected}`;
|
|
1108
1011
|
}
|
|
1109
1012
|
}
|
|
@@ -1113,14 +1016,12 @@ class Combobox extends LitElement {
|
|
|
1113
1016
|
})} .label=${label} .scale=${scale} title=${label ?? nothing} value ${ref(selectedIndicatorChipRef)}>${label}</calcite-chip>`;
|
|
1114
1017
|
}
|
|
1115
1018
|
renderSelectedIndicatorChipCompact() {
|
|
1116
|
-
const { compactSelectionDisplay, selectionDisplay, scale, selectedHiddenChipsCount } = this;
|
|
1117
|
-
const allSelectedNoDisabled = this.allSelected && !this.hasDisabledItems;
|
|
1118
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
1019
|
+
const { compactSelectionDisplay, selectionDisplay, getSelectedItems, scale, selectedHiddenChipsCount } = this;
|
|
1119
1020
|
let chipInvisible;
|
|
1120
1021
|
let label;
|
|
1121
1022
|
if (compactSelectionDisplay) {
|
|
1122
|
-
const selectedItemsCount =
|
|
1123
|
-
if (
|
|
1023
|
+
const selectedItemsCount = getSelectedItems().length;
|
|
1024
|
+
if (this.allSelected) {
|
|
1124
1025
|
chipInvisible = true;
|
|
1125
1026
|
} else if (selectionDisplay === "fit") {
|
|
1126
1027
|
chipInvisible = !(selectedHiddenChipsCount > 0);
|
|
@@ -1208,7 +1109,6 @@ class Combobox extends LitElement {
|
|
|
1208
1109
|
const singleSelectionDisplay = selectionDisplay === "single";
|
|
1209
1110
|
const fitSelectionDisplay = !singleSelectionMode && selectionDisplay === "fit";
|
|
1210
1111
|
const isClearable = !this.clearDisabled && this.selectionMode !== "single-persist" && !!this.value?.length;
|
|
1211
|
-
const hasDisabledItems = this.hasDisabledItems;
|
|
1212
1112
|
return this.interactiveContainer({ disabled: this.disabled, children: html`${this.labelText && InternalLabel({ labelText: this.labelText, onClick: this.onLabelClick, required: this.required, tooltipText: this.messages.required }) || ""}<div aria-live=polite class=${safeClassMap({
|
|
1213
1113
|
[CSS.wrapper]: true,
|
|
1214
1114
|
[CSS.wrapperSingle]: singleSelectionMode || !this.selectedItems.length,
|
|
@@ -1217,7 +1117,7 @@ class Combobox extends LitElement {
|
|
|
1217
1117
|
[CSS.gridInput]: true,
|
|
1218
1118
|
[CSS.selectionDisplayFit]: fitSelectionDisplay,
|
|
1219
1119
|
[CSS.selectionDisplaySingle]: singleSelectionDisplay
|
|
1220
|
-
})} ${ref(this.setChipContainerEl)}>${!singleSelectionMode && !singleSelectionDisplay && this.renderChips() || ""}${!singleSelectionMode && !singleSelectionDisplay && this.selectAllEnabled &&
|
|
1120
|
+
})} ${ref(this.setChipContainerEl)}>${!singleSelectionMode && !singleSelectionDisplay && this.renderChips() || ""}${!singleSelectionMode && !singleSelectionDisplay && this.selectAllEnabled && this.renderAllSelectedIndicatorChip() || ""}${!singleSelectionMode && !allSelectionDisplay && [
|
|
1221
1121
|
this.renderSelectedIndicatorChip(),
|
|
1222
1122
|
this.renderSelectedIndicatorChipCompact(),
|
|
1223
1123
|
this.renderAllSelectedIndicatorChip()
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference path="../../index.d.ts" />
|
|
2
|
+
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
+
import type { FocusTrapOptions } from "../../controllers/useFocusTrap.js";
|
|
4
|
+
|
|
5
|
+
/** @slot - A slot for adding focus-trapped content. */
|
|
6
|
+
export abstract class FocusTrap extends LitElement {
|
|
7
|
+
/**
|
|
8
|
+
* Indicates whether the component's focus trap is currently active.
|
|
9
|
+
*
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
get active(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* When `true`, prevents focus trapping.
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
accessor focusTrapDisabled: boolean;
|
|
19
|
+
/** When defined, provides a condition to disable focus trapping. When `true`, prevents focus trapping. */
|
|
20
|
+
accessor focusTrapDisabledOverride: (() => boolean) | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies custom focus trap configuration on the component, where
|
|
23
|
+
*
|
|
24
|
+
* `"allowOutsideClick"` allows outside clicks,
|
|
25
|
+
* `"initialFocus"` enables initial focus,
|
|
26
|
+
* `"returnFocusOnDeactivate"` returns focus when not active,
|
|
27
|
+
* `"extraContainers"` specifies additional focusable elements external to the trap, and
|
|
28
|
+
* `"setReturnFocus"` customizes the element to which focus is returned when the trap is deactivated.
|
|
29
|
+
*/
|
|
30
|
+
accessor focusTrapOptions: Partial<FocusTrapOptions> | undefined;
|
|
31
|
+
/** Activates the component's focus trap. */
|
|
32
|
+
activate(): Promise<void>;
|
|
33
|
+
/** Deactivates the component's focus trap. */
|
|
34
|
+
deactivate(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Updates the element(s) that are included in the focus-trap of the component.
|
|
37
|
+
*
|
|
38
|
+
* @param extraContainers - Additional elements to include in the focus trap. This is useful for including elements that may have related parts rendered outside the main focus trapping element.
|
|
39
|
+
*/
|
|
40
|
+
updateFocusTrapElements(extraContainers?: FocusTrapOptions["extraContainers"]): Promise<void>;
|
|
41
|
+
/** Fires when the focus-trap active state has changed. */
|
|
42
|
+
readonly calciteFocusTrapActiveChange: import("@arcgis/lumina").TargetedEvent<this, void>;
|
|
43
|
+
readonly "@eventTypes": {
|
|
44
|
+
calciteFocusTrapActiveChange: FocusTrap["calciteFocusTrapActiveChange"]["detail"];
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
+
import { css, html } from "lit";
|
|
4
|
+
import { LitElement, createEvent } from "@arcgis/lumina";
|
|
5
|
+
import { u as useFocusTrap } from "../../chunks/useFocusTrap.js";
|
|
6
|
+
const styles = css`:host{display:contents}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
7
|
+
class FocusTrap extends LitElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(...arguments);
|
|
10
|
+
this._active = false;
|
|
11
|
+
this.focusTrapController = useFocusTrap({
|
|
12
|
+
focusTrapOptions: {
|
|
13
|
+
onActivate: () => {
|
|
14
|
+
this.setActive(true);
|
|
15
|
+
},
|
|
16
|
+
onDeactivate: () => {
|
|
17
|
+
this.setActive(false);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
})(this);
|
|
21
|
+
this.focusTrapDisabled = false;
|
|
22
|
+
this.calciteFocusTrapActiveChange = createEvent({ cancelable: false });
|
|
23
|
+
}
|
|
24
|
+
static {
|
|
25
|
+
this.properties = { focusTrapDisabled: [7, {}, { reflect: true, type: Boolean }], active: [32, {}, { attribute: false, readOnly: true }], focusTrapDisabledOverride: [0, {}, { attribute: false }], focusTrapOptions: [0, {}, { attribute: false }] };
|
|
26
|
+
}
|
|
27
|
+
static {
|
|
28
|
+
this.styles = styles;
|
|
29
|
+
}
|
|
30
|
+
get active() {
|
|
31
|
+
return this._active;
|
|
32
|
+
}
|
|
33
|
+
async activate() {
|
|
34
|
+
this.focusTrapController.activate();
|
|
35
|
+
}
|
|
36
|
+
async deactivate() {
|
|
37
|
+
this.focusTrapController.deactivate();
|
|
38
|
+
}
|
|
39
|
+
async updateFocusTrapElements(extraContainers) {
|
|
40
|
+
this.focusTrapController.setExtraContainers(extraContainers);
|
|
41
|
+
this.focusTrapController.updateContainerElements();
|
|
42
|
+
}
|
|
43
|
+
setActive(active) {
|
|
44
|
+
const oldActive = this._active;
|
|
45
|
+
this._active = active;
|
|
46
|
+
this.requestUpdate("active", oldActive);
|
|
47
|
+
this.calciteFocusTrapActiveChange.emit();
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
return html`<slot></slot>`;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
customElement("calcite-focus-trap", FocusTrap);
|
|
54
|
+
export {
|
|
55
|
+
FocusTrap
|
|
56
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./customElement.js";
|
|
@@ -158,6 +158,7 @@ class List extends LitElement {
|
|
|
158
158
|
this.unobserveFilterRow();
|
|
159
159
|
}
|
|
160
160
|
updateListItems() {
|
|
161
|
+
this.updateFilterRowHeight();
|
|
161
162
|
this.updateGroupItems();
|
|
162
163
|
const { selectionAppearance, selectionMode, interactionMode, dragEnabled, el, filterEl, displayMode, scale, sortDisabled, sortHandleMenuItems } = this;
|
|
163
164
|
const items = Array.from(this.el.querySelectorAll(listItemSelector));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
-
import type { Scale } from "../interfaces.js";
|
|
3
|
+
import type { Scale, Status } from "../interfaces.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @cssproperty [--calcite-radio-button-background-color] - Specifies the component's background color.
|
|
@@ -44,6 +44,19 @@ export abstract class RadioButton extends LitElement {
|
|
|
44
44
|
* @default "m"
|
|
45
45
|
*/
|
|
46
46
|
accessor scale: Scale;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies the status of the input field, which determines message and icons.
|
|
49
|
+
*
|
|
50
|
+
* @default "idle"
|
|
51
|
+
*/
|
|
52
|
+
accessor status: Status;
|
|
53
|
+
/**
|
|
54
|
+
* The component's validation message.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
* @mdn [validationMessage](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/validationMessage)
|
|
58
|
+
*/
|
|
59
|
+
accessor validationMessage: string;
|
|
47
60
|
/**
|
|
48
61
|
* The component's current validation state.
|
|
49
62
|
*
|
|
@@ -14,7 +14,7 @@ const CSS = {
|
|
|
14
14
|
container: "container",
|
|
15
15
|
radio: "radio"
|
|
16
16
|
};
|
|
17
|
-
const styles = css`: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:block;cursor:pointer}:host .container{position:relative;outline:2px solid transparent;outline-offset:2px;display:flex}:host .radio{cursor:pointer;outline-color:transparent;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;border-radius:var(--calcite-radio-button-corner-radius, var(--calcite-corner-radius-pill));background-color:var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1));box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([hovered]) .radio,:host(:not([checked])[focused]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-radio-button-border-color, var(--calcite-color-brand-hover))}:host([hovered]) .radio:active,:host(:not([checked])[focused]:not([disabled])) .radio:active{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-color-brand-press)}:host([focused]) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}:host([disabled]) .radio{cursor:default;opacity:var(--calcite-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([hovered][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([scale=s]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md))}:host([scale=m]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md-plus))}:host([scale=l]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-lg))}.radio{block-size:var(--calcite-internal-radio-size);inline-size:var(--calcite-internal-radio-size);size:var(--calcite-internal-radio-size)}:host([scale=s][checked]) .radio,:host([hovered][scale=s][checked][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=s][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}:host([scale=m][checked]) .radio,:host([hovered][scale=m][checked][disabled]) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=m][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}:host([scale=l][checked]) .radio,:host([hovered][scale=l][checked][disabled]) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=l][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}@media(forced-colors:active){:host([checked]) .radio:after,:host([checked][disabled]) .radio:after{content:"";inline-size:var(--calcite-internal-radio-size);block-size:var(--calcite-internal-radio-size);background-color:CanvasText;display:block}}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
17
|
+
const styles = css`: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:block;cursor:pointer}:host .container{position:relative;outline:2px solid transparent;outline-offset:2px;display:flex}:host .radio{cursor:pointer;outline-color:transparent;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;border-radius:var(--calcite-radio-button-corner-radius, var(--calcite-corner-radius-pill));background-color:var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1));box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([hovered]) .radio,:host(:not([checked])[focused]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-radio-button-border-color, var(--calcite-color-brand-hover))}:host([hovered]) .radio:active,:host(:not([checked])[focused]:not([disabled])) .radio:active{box-shadow:inset 0 0 0 var(--calcite-border-width-md) var(--calcite-color-brand-press)}:host([focused]) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}:host([disabled]) .radio{cursor:default;opacity:var(--calcite-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([hovered][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-sm) var(--calcite-radio-button-border-color, var(--calcite-color-border-input))}:host([scale=s]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md))}:host([scale=m]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-md-plus))}:host([scale=l]){--calcite-internal-radio-size: var(--calcite-radio-button-size, var(--calcite-size-fixed-lg))}.radio{block-size:var(--calcite-internal-radio-size);inline-size:var(--calcite-internal-radio-size);size:var(--calcite-internal-radio-size)}:host([scale=s][checked]) .radio,:host([hovered][scale=s][checked][disabled]) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=s][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 var(--calcite-border-width-lg) var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}:host([scale=m][checked]) .radio,:host([hovered][scale=m][checked][disabled]) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=m][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 5px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}:host([scale=l][checked]) .radio,:host([hovered][scale=l][checked][disabled]) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand))}:host([scale=l][focused][checked]:not([disabled])) .radio{box-shadow:inset 0 0 0 6px var(--calcite-radio-button-border-color, var(--calcite-color-brand)),0 0 0 2px var(--calcite-radio-button-background-color, var(--calcite-color-foreground-1))}:host([status=invalid]:not([checked])){--calcite-radio-button-border-color: var(--calcite-color-status-danger)}:host([status=invalid]:not([checked]):focus) .radio{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(var(--calcite-spacing-base) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}@media(forced-colors:active){:host([checked]) .radio:after,:host([checked][disabled]) .radio:after{content:"";inline-size:var(--calcite-internal-radio-size);block-size:var(--calcite-internal-radio-size);background-color:CanvasText;display:block}}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
18
18
|
class RadioButton extends LitElement {
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
@@ -29,6 +29,7 @@ class RadioButton extends LitElement {
|
|
|
29
29
|
this.hovered = false;
|
|
30
30
|
this.required = false;
|
|
31
31
|
this.scale = "m";
|
|
32
|
+
this.status = "idle";
|
|
32
33
|
this.calciteInternalRadioButtonBlur = createEvent({ cancelable: false });
|
|
33
34
|
this.calciteInternalRadioButtonCheckedChange = createEvent({ cancelable: false });
|
|
34
35
|
this.calciteInternalRadioButtonFocus = createEvent({ cancelable: false });
|
|
@@ -39,7 +40,7 @@ class RadioButton extends LitElement {
|
|
|
39
40
|
this.listen("keydown", this.handleKeyDown);
|
|
40
41
|
}
|
|
41
42
|
static {
|
|
42
|
-
this.properties = { checked: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], focused: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], hovered: [7, {}, { reflect: true, type: Boolean }], label: 1, labelText: 1, name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], validity: [32, {}, { readOnly: true, attribute: false }], value: 1 };
|
|
43
|
+
this.properties = { checked: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], focused: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], hovered: [7, {}, { reflect: true, type: Boolean }], label: 1, labelText: 1, name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], status: [3, {}, { reflect: true }], validationMessage: 1, validity: [32, {}, { readOnly: true, attribute: false }], value: 1 };
|
|
43
44
|
}
|
|
44
45
|
static {
|
|
45
46
|
this.formAssociated = true;
|
|
@@ -53,7 +54,7 @@ class RadioButton extends LitElement {
|
|
|
53
54
|
async setFocus(options) {
|
|
54
55
|
return this.focusSetter(() => this.containerRef.value, options);
|
|
55
56
|
}
|
|
56
|
-
async setValidity(validity, validationMessage =
|
|
57
|
+
async setValidity(validity, validationMessage = this.validationMessage) {
|
|
57
58
|
this.elementInternals.setValidity(validity, validationMessage);
|
|
58
59
|
}
|
|
59
60
|
connectedCallback() {
|
|
@@ -7,6 +7,7 @@ import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
|
7
7
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
8
8
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
9
9
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
10
|
+
import { c as clearValidationMessage, d as displayValidationMessage } from "../../chunks/useForm.js";
|
|
10
11
|
const CSS = {
|
|
11
12
|
itemWrapper: "item-wrapper"
|
|
12
13
|
};
|
|
@@ -29,6 +30,12 @@ class RadioButtonGroup extends LitElement {
|
|
|
29
30
|
this.status = "idle";
|
|
30
31
|
this.calciteRadioButtonGroupChange = createEvent({ cancelable: false });
|
|
31
32
|
this.listen("calciteRadioButtonChange", this.radioButtonChangeHandler);
|
|
33
|
+
this.listen("calciteInvalid", this.handleInvalidFormEvent);
|
|
34
|
+
this.listen("luminaFormResetCallback", () => {
|
|
35
|
+
if (this.status === "invalid") {
|
|
36
|
+
clearValidationMessage(this);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
32
39
|
}
|
|
33
40
|
static {
|
|
34
41
|
this.properties = { radioButtons: [16, {}, { state: true }], disabled: [7, {}, { reflect: true, type: Boolean }], labelText: 1, layout: [3, {}, { reflect: true }], messageOverrides: [0, {}, { attribute: false }], name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], selectedItem: [0, {}, { attribute: false }], status: [3, {}, { reflect: true }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1 };
|
|
@@ -45,7 +52,7 @@ class RadioButtonGroup extends LitElement {
|
|
|
45
52
|
this.mutationObserver?.observe(this.el, { childList: true, subtree: true });
|
|
46
53
|
}
|
|
47
54
|
willUpdate(changes) {
|
|
48
|
-
if (changes.has("disabled") && (this.hasUpdated || this.disabled !== false) || changes.has("layout") && (this.hasUpdated || this.layout !== "horizontal") || changes.has("scale") && (this.hasUpdated || this.scale !== "m")) {
|
|
55
|
+
if (changes.has("disabled") && (this.hasUpdated || this.disabled !== false) || changes.has("layout") && (this.hasUpdated || this.layout !== "horizontal") || changes.has("scale") && (this.hasUpdated || this.scale !== "m") || changes.has("status") && this.hasUpdated) {
|
|
49
56
|
this.passPropsToRadioButtons();
|
|
50
57
|
}
|
|
51
58
|
}
|
|
@@ -56,6 +63,14 @@ class RadioButtonGroup extends LitElement {
|
|
|
56
63
|
super.disconnectedCallback();
|
|
57
64
|
this.mutationObserver?.disconnect();
|
|
58
65
|
}
|
|
66
|
+
handleInvalidFormEvent(event) {
|
|
67
|
+
const message = this.validationMessage || event.target.validationMessage;
|
|
68
|
+
displayValidationMessage(this, {
|
|
69
|
+
message,
|
|
70
|
+
icon: true,
|
|
71
|
+
status: "invalid"
|
|
72
|
+
});
|
|
73
|
+
}
|
|
59
74
|
passPropsToRadioButtons() {
|
|
60
75
|
this.radioButtons = Array.from(this.el.querySelectorAll("calcite-radio-button"));
|
|
61
76
|
this.selectedItem = Array.from(this.radioButtons).reverse().find((radioButton) => radioButton.checked) || null;
|
|
@@ -67,6 +82,7 @@ class RadioButtonGroup extends LitElement {
|
|
|
67
82
|
radioButton.name = this.name;
|
|
68
83
|
radioButton.required = this.required;
|
|
69
84
|
radioButton.scale = this.scale;
|
|
85
|
+
radioButton.status = this.status;
|
|
70
86
|
});
|
|
71
87
|
}
|
|
72
88
|
}
|
|
@@ -75,6 +91,9 @@ class RadioButtonGroup extends LitElement {
|
|
|
75
91
|
}
|
|
76
92
|
radioButtonChangeHandler(event) {
|
|
77
93
|
this.selectedItem = event.target;
|
|
94
|
+
if (this.required && this.selectedItem && this.status === "invalid") {
|
|
95
|
+
clearValidationMessage(this);
|
|
96
|
+
}
|
|
78
97
|
this.calciteRadioButtonGroupChange.emit();
|
|
79
98
|
}
|
|
80
99
|
render() {
|