@esri/calcite-components 5.1.1-next.5 → 5.1.1
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/README.md +1 -1
- package/dist/cdn/{6URRYJJC.js → 25SUELBY.js} +1 -1
- package/dist/cdn/{QKYRWKTU.js → 2J4U5E4U.js} +1 -1
- package/dist/cdn/{5UM2PD3Y.js → 2JJ5YBBT.js} +1 -1
- package/dist/cdn/{6JJSMJ5O.js → 2P3LOGHK.js} +1 -1
- package/dist/cdn/{6OQ7N7VS.js → 34ENIUR5.js} +1 -1
- package/dist/cdn/{V4PO6GRD.js → 3KWJQXAT.js} +1 -1
- package/dist/cdn/{MUUP34X3.js → 3RRY5HHA.js} +1 -1
- package/dist/cdn/{HHH7H3RQ.js → 3TYJSBP3.js} +1 -1
- package/dist/cdn/{7UQ4BXIA.js → 44HFP2I6.js} +1 -1
- package/dist/cdn/44VCOKJX.js +2 -0
- package/dist/cdn/{SY4OTCR3.js → 47Q2AE5B.js} +1 -1
- package/dist/cdn/{GLRM5ZT5.js → 4NUFBGFK.js} +1 -1
- package/dist/cdn/{7MDIWERA.js → 4UHTWXNV.js} +1 -1
- package/dist/cdn/{VG7NP4T6.js → 524MMG22.js} +1 -1
- package/dist/cdn/{5VR5L3IN.js → 5D7IEY6J.js} +1 -1
- package/dist/cdn/{EV4D2B4G.js → 5O6YGOJE.js} +1 -1
- package/dist/cdn/{ZD2AZI2C.js → 5VAPN2S2.js} +1 -1
- package/dist/cdn/5X2CR2NN.js +2 -0
- package/dist/cdn/{ZRMUXK2V.js → 6HRHKHF5.js} +1 -1
- package/dist/cdn/{IPV6SRQB.js → 6S3G75WP.js} +1 -1
- package/dist/cdn/6SZY5PY7.js +2 -0
- package/dist/cdn/{BJ4ABCUP.js → 6V3FX2W2.js} +1 -1
- package/dist/cdn/{6PNEL3GY.js → 6VDGKXTH.js} +1 -1
- package/dist/cdn/{L3DV3PDZ.js → 6VP3K6WL.js} +1 -1
- package/dist/cdn/{VPAYQE3N.js → 6X3QWKZL.js} +1 -1
- package/dist/cdn/{KLK5B7QV.js → 6XMUSNRS.js} +1 -1
- package/dist/cdn/{ZYP2R6KW.js → 7B4FOF3S.js} +1 -1
- package/dist/cdn/{ACHU3T7F.js → 7QS3Z4ZJ.js} +1 -1
- package/dist/cdn/{V4P7PWKU.js → 7SDGC2RW.js} +1 -1
- package/dist/cdn/A6V4I2J3.js +2 -0
- package/dist/cdn/{TR3GWZR3.js → ALLL4LZ4.js} +1 -1
- package/dist/cdn/{LW32DABQ.js → BCRYMNH7.js} +1 -1
- package/dist/cdn/{ZCF63ZNP.js → BSMPD6VA.js} +1 -1
- package/dist/cdn/{V7UCH3LL.js → C462ZIJD.js} +1 -1
- package/dist/cdn/{QJNZ4DGE.js → C4DW27AP.js} +1 -1
- package/dist/cdn/C4OX3FC4.js +2 -0
- package/dist/cdn/{QGJMSJYV.js → CDNETLLO.js} +1 -1
- package/dist/cdn/{5X5GP5QD.js → CENYPZ3Y.js} +1 -1
- package/dist/cdn/{YENIJIGH.js → CEWOZ7LP.js} +1 -1
- package/dist/cdn/{AQ3IFEKN.js → CM45J66U.js} +1 -1
- package/dist/cdn/{MUEVO64B.js → COXLBEPM.js} +1 -1
- package/dist/cdn/CVJBK7K3.js +2 -0
- package/dist/cdn/{LBC3QOSD.js → DDUIHGBF.js} +1 -1
- package/dist/cdn/{56OUAFHZ.js → DK3SDSZL.js} +1 -1
- package/dist/cdn/{U54ZTDU5.js → DP2TY4KH.js} +1 -1
- package/dist/cdn/{GKHYTKRX.js → E6X6BQLH.js} +1 -1
- package/dist/cdn/{7TWNW2BD.js → E7GXKIIO.js} +1 -1
- package/dist/cdn/{5KHTOS43.js → ECVX7SVS.js} +1 -1
- package/dist/cdn/{CY2QEKCK.js → ELXBBUY5.js} +1 -1
- package/dist/cdn/{GATVDTCX.js → EQKCU4NC.js} +1 -1
- package/dist/cdn/{7YW5YF3W.js → ETEMG44R.js} +1 -1
- package/dist/cdn/{JCCTCJBT.js → G2G6FHMB.js} +1 -1
- package/dist/cdn/{26TKJ45G.js → GCAYSD7G.js} +1 -1
- package/dist/cdn/{K3J3HP3C.js → GDFQSWZ7.js} +1 -1
- package/dist/cdn/{ZFON2VHB.js → GDYGEN45.js} +1 -1
- package/dist/cdn/{CISWZLPM.js → GTH6QFMV.js} +1 -1
- package/dist/cdn/{6HZDBIQR.js → HA65OOQD.js} +1 -1
- package/dist/cdn/HYIVUAZU.js +2 -0
- package/dist/cdn/{VOJ3FHN7.js → I4IDQ735.js} +1 -1
- package/dist/cdn/{YL72ZNRG.js → ICGT7C6U.js} +1 -1
- package/dist/cdn/{3WWVPHTN.js → ID2LCYSN.js} +1 -1
- package/dist/cdn/{M3IE6HID.js → IEWVQCQW.js} +1 -1
- package/dist/cdn/{FIDNERXC.js → IHYNJVS4.js} +1 -1
- package/dist/cdn/{SKUVMTOE.js → IMUM436K.js} +1 -1
- package/dist/cdn/{QAQYS3BO.js → IRANNKJ2.js} +1 -1
- package/dist/cdn/{4OKNI2ME.js → JCVLN6XL.js} +1 -1
- package/dist/cdn/{TQ74DQDG.js → JDVSVNSE.js} +1 -1
- package/dist/cdn/{HETBUMGG.js → JGCJVDJA.js} +1 -1
- package/dist/cdn/{UWMTXTYU.js → JPPCKAMD.js} +1 -1
- package/dist/cdn/{EOXVTTON.js → JSXQ6NFN.js} +1 -1
- package/dist/cdn/KCN4PBFZ.js +2 -0
- package/dist/cdn/{APBFB6S3.js → KJCVGOXF.js} +1 -1
- package/dist/cdn/{6PA56XE3.js → KLNQGCK2.js} +1 -1
- package/dist/cdn/KOWFGIAY.js +2 -0
- package/dist/cdn/{MKMBDYHE.js → KXD6O3ZI.js} +1 -1
- package/dist/cdn/{BZ2ZKLD7.js → L3D2OBOR.js} +1 -1
- package/dist/cdn/L5IKT3WY.js +2 -0
- package/dist/cdn/LGB6OAXT.js +2 -0
- package/dist/cdn/{KC4N5X3R.js → LI2CATYC.js} +1 -1
- package/dist/cdn/{5CZT7ZF2.js → LJSR66HF.js} +1 -1
- package/dist/cdn/{FMGMUK7H.js → LKYA2H2B.js} +1 -1
- package/dist/cdn/{GLODC255.js → LOJBKHVF.js} +1 -1
- package/dist/cdn/{4ZARBNVE.js → MHE72N53.js} +1 -1
- package/dist/cdn/{2UXB22NZ.js → MW5MGBT4.js} +1 -1
- package/dist/cdn/{ANS7V4RO.js → NBAYHB3K.js} +1 -1
- package/dist/cdn/{YHXTGLCG.js → NCSMOKFP.js} +1 -1
- package/dist/cdn/{ISATMK3J.js → ND7KY7GE.js} +1 -1
- package/dist/cdn/{4U2T5QCF.js → NG7BG3QY.js} +1 -1
- package/dist/cdn/NL77UDLL.js +2 -0
- package/dist/cdn/{WY23ABPE.js → NTD2BJWG.js} +1 -1
- package/dist/cdn/{2B22J6N7.js → ODGJXDZK.js} +1 -1
- package/dist/cdn/{YIUURHN4.js → ORIGVFX7.js} +1 -1
- package/dist/cdn/{AXVF2756.js → OWIJSXYV.js} +1 -1
- package/dist/cdn/{HWD5HVPG.js → OXCL3M4W.js} +1 -1
- package/dist/cdn/{FNQJGIT5.js → PB3LTBSS.js} +1 -1
- package/dist/cdn/{BTFUTGOB.js → PHEMAFCT.js} +1 -1
- package/dist/cdn/{ARP32LFE.js → PIR7PWBO.js} +1 -1
- package/dist/cdn/PM5MZR4Z.js +2 -0
- package/dist/cdn/{D5H6K3NA.js → Q4V5DVKS.js} +1 -1
- package/dist/cdn/{VWXOBCBN.js → Q56UST3A.js} +1 -1
- package/dist/cdn/{ZD5WXZ5Y.js → QC5NB4VL.js} +1 -1
- package/dist/cdn/{W3FK3ZCB.js → QEJBAQOY.js} +1 -1
- package/dist/cdn/{7P74AKWI.js → QGF4JJQO.js} +1 -1
- package/dist/cdn/{F7DJCE7J.js → QZJ7GLQ3.js} +1 -1
- package/dist/cdn/RK2LH73E.js +2 -0
- package/dist/cdn/{YDF4DHQ3.js → ROJYTRK6.js} +1 -1
- package/dist/cdn/{HIUFMP4S.js → RRKFBHMW.js} +1 -1
- package/dist/cdn/{H4DJFHRD.js → RUUD543Z.js} +1 -1
- package/dist/cdn/{J4CNKBKA.js → S2BIRHQ7.js} +1 -1
- package/dist/cdn/{T6AQWGKD.js → SJCWFQNF.js} +1 -1
- package/dist/cdn/SNJLHXVG.js +2 -0
- package/dist/cdn/{G2GTTVSE.js → SNY2QKQJ.js} +1 -1
- package/dist/cdn/{ZACTCZNT.js → ST6WRTR2.js} +1 -1
- package/dist/cdn/{FIIPI4TO.js → SW5TNX5V.js} +1 -1
- package/dist/cdn/SXXFODM6.js +2 -0
- package/dist/cdn/{ONJA74QA.js → TKK3AWQJ.js} +1 -1
- package/dist/cdn/{ZG5BEBIM.js → TTCZVBEF.js} +1 -1
- package/dist/cdn/{A7T3VN2V.js → TV47CRME.js} +1 -1
- package/dist/cdn/{KU7JKZKM.js → TVU7KEKM.js} +1 -1
- package/dist/cdn/{3BFO4M6M.js → TVYIJRI2.js} +1 -1
- package/dist/cdn/{KOB2L5OF.js → TWVXE232.js} +1 -1
- package/dist/cdn/{LYU2H6SF.js → TYQB2FN4.js} +1 -1
- package/dist/cdn/{RQWRV3MX.js → U4GRIQVY.js} +1 -1
- package/dist/cdn/{YWOGIBVU.js → U7OJQ4EC.js} +1 -1
- package/dist/cdn/{FGLX24UP.js → UCWB5EGV.js} +1 -1
- package/dist/cdn/{ODZLYUK3.js → UTVGUMUM.js} +1 -1
- package/dist/cdn/{WA2S45EI.js → V3X47NBI.js} +1 -1
- package/dist/cdn/{L4PX2B5Q.js → V7PYDILT.js} +1 -1
- package/dist/cdn/{27CKMD4S.js → V7YPIVAX.js} +1 -1
- package/dist/cdn/{WCQV2FD5.js → VDJMOKVP.js} +1 -1
- package/dist/cdn/{VOXGCDBD.js → VEZBAZZG.js} +1 -1
- package/dist/cdn/VXBJOP6X.js +2 -0
- package/dist/cdn/{OORT75JS.js → VZ2YR2UG.js} +1 -1
- package/dist/cdn/{WTNLCUMG.js → W57IL7KF.js} +1 -1
- package/dist/cdn/{F5LUOXQA.js → WCUO6JQN.js} +1 -1
- package/dist/cdn/{DBQJQXU6.js → WER7FADP.js} +1 -1
- package/dist/cdn/{3NAS4Q4X.js → WQCT4VLB.js} +1 -1
- package/dist/cdn/X3HV2NYH.js +2 -0
- package/dist/cdn/{JZQC7UCN.js → XRUJ4D7O.js} +1 -1
- package/dist/cdn/{LTTOM2CS.js → XT4GLBAQ.js} +1 -1
- package/dist/cdn/{D2VTJOPM.js → Y7O6UR4T.js} +1 -1
- package/dist/cdn/{LLESMANM.js → YHAJICJ2.js} +1 -1
- package/dist/cdn/{PWME5N37.js → YKL7MIG5.js} +1 -1
- package/dist/cdn/YYAYEKGB.js +2 -0
- package/dist/cdn/{2TUMH7BJ.js → Z3IP3JBL.js} +1 -1
- package/dist/cdn/ZK2W2KJX.js +2 -0
- package/dist/cdn/{QER5D477.js → ZOEJDQXA.js} +1 -1
- package/dist/cdn/{D2NNUCFT.js → ZRMTOZ3B.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/ExpandToggle.js +1 -1
- package/dist/chunks/date.js +3 -3
- package/dist/chunks/dom.js +3 -15
- package/dist/chunks/floating-ui.js +1 -1
- package/dist/chunks/label.js +6 -6
- package/dist/chunks/locale.js +6 -3
- package/dist/chunks/manager.js +5 -5
- package/dist/chunks/resources10.js +63 -0
- package/dist/chunks/resources5.js +27 -52
- package/dist/chunks/resources6.js +48 -45
- package/dist/chunks/resources7.js +49 -7
- package/dist/chunks/resources8.js +9 -11
- package/dist/chunks/resources9.js +4 -48
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/utils2.js +59 -6
- package/dist/components/calcite-accordion-item/customElement.d.ts +6 -6
- package/dist/components/calcite-accordion-item/customElement.js +1 -1
- package/dist/components/calcite-alert/customElement.d.ts +2 -2
- package/dist/components/calcite-alert/customElement.js +4 -6
- package/dist/components/calcite-autocomplete/customElement.d.ts +16 -16
- package/dist/components/calcite-autocomplete/customElement.js +4 -4
- package/dist/components/calcite-autocomplete-item/customElement.d.ts +5 -5
- package/dist/components/calcite-avatar/customElement.d.ts +5 -5
- package/dist/components/calcite-card/customElement.d.ts +1 -1
- package/dist/components/calcite-carousel/customElement.js +6 -5
- package/dist/components/calcite-checkbox/customElement.d.ts +4 -4
- package/dist/components/calcite-checkbox/customElement.js +1 -1
- package/dist/components/calcite-chip/customElement.js +1 -27
- package/dist/components/calcite-chip-group/customElement.js +1 -1
- package/dist/components/calcite-color-picker/customElement.js +1 -1
- package/dist/components/calcite-color-picker-hex-input/customElement.js +1 -1
- package/dist/components/calcite-combobox/customElement.js +286 -132
- package/dist/components/calcite-combobox-item/customElement.js +1 -1
- package/dist/components/calcite-combobox-item-group/customElement.js +1 -1
- package/dist/components/calcite-date-picker/customElement.js +1 -1
- package/dist/components/calcite-date-picker-day/customElement.js +1 -1
- package/dist/components/calcite-date-picker-month/customElement.js +11 -2
- package/dist/components/calcite-dialog/customElement.js +8 -8
- package/dist/components/calcite-dropdown-group/customElement.js +1 -1
- package/dist/components/calcite-dropdown-item/customElement.js +1 -1
- package/dist/components/calcite-flow/customElement.d.ts +2 -2
- package/dist/components/calcite-flow/customElement.js +1 -1
- package/dist/components/calcite-flow-item/customElement.js +2 -2
- package/dist/components/calcite-input/customElement.js +5 -2
- package/dist/components/calcite-input-date-picker/customElement.js +5 -10
- package/dist/components/calcite-input-text/customElement.js +2 -2
- package/dist/components/calcite-input-time-zone/customElement.js +1 -1
- package/dist/components/calcite-list/customElement.d.ts +4 -4
- package/dist/components/calcite-list/customElement.js +6 -5
- package/dist/components/calcite-list-item/customElement.d.ts +6 -6
- package/dist/components/calcite-list-item/customElement.js +21 -14
- package/dist/components/calcite-list-item-group/customElement.d.ts +1 -1
- package/dist/components/calcite-list-item-group/customElement.js +1 -1
- package/dist/components/calcite-loader/customElement.js +3 -3
- package/dist/components/calcite-menu-item/customElement.d.ts +7 -7
- package/dist/components/calcite-menu-item/customElement.js +0 -3
- package/dist/components/calcite-meter/customElement.d.ts +6 -6
- package/dist/components/calcite-meter/customElement.js +7 -14
- package/dist/components/calcite-pagination/customElement.d.ts +1 -1
- package/dist/components/calcite-pagination/customElement.js +0 -3
- package/dist/components/calcite-panel/customElement.d.ts +6 -6
- package/dist/components/calcite-panel/customElement.js +1 -1
- package/dist/components/calcite-popover/customElement.d.ts +4 -4
- package/dist/components/calcite-popover/customElement.js +1 -1
- package/dist/components/calcite-progress/customElement.d.ts +2 -2
- package/dist/components/calcite-radio-button/customElement.d.ts +5 -5
- package/dist/components/calcite-radio-button/customElement.js +1 -1
- package/dist/components/calcite-radio-button-group/customElement.d.ts +4 -4
- package/dist/components/calcite-radio-button-group/customElement.js +3 -3
- package/dist/components/calcite-rating/customElement.d.ts +7 -7
- package/dist/components/calcite-rating/customElement.js +9 -13
- package/dist/components/calcite-sheet/customElement.js +27 -32
- package/dist/components/calcite-stack/customElement.js +1 -1
- package/dist/controllers/useSortable.d.ts +2 -2
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/supported-browsers.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +2 -2
- package/dist/utils/dom.d.ts +1 -1
- package/package.json +9 -8
- package/dist/cdn/4YU7KVLN.js +0 -2
- package/dist/cdn/AJKRULVQ.js +0 -2
- package/dist/cdn/AP2LDRUV.js +0 -2
- package/dist/cdn/BDZQSO2J.js +0 -2
- package/dist/cdn/BQES6LWB.js +0 -2
- package/dist/cdn/DYWNKQ25.js +0 -2
- package/dist/cdn/ECNYDS76.js +0 -2
- package/dist/cdn/H4MCSFNA.js +0 -2
- package/dist/cdn/H4QDWLO2.js +0 -2
- package/dist/cdn/KNKMPJAL.js +0 -2
- package/dist/cdn/M47XC6PF.js +0 -2
- package/dist/cdn/MR5GODA3.js +0 -2
- package/dist/cdn/P3CJF65O.js +0 -2
- package/dist/cdn/RX6W4SRU.js +0 -2
- package/dist/cdn/SB5RUV2I.js +0 -2
- package/dist/cdn/SSDV2Z4W.js +0 -2
- package/dist/cdn/TL7FQYNH.js +0 -2
- package/dist/cdn/VNLB6ONW.js +0 -2
- package/dist/cdn/VPGSTQTT.js +0 -2
- package/dist/cdn/assets/icon/orientedImageryFullSuperimpose16.json +0 -1
- package/dist/cdn/assets/icon/orientedImageryFullSuperimpose24.json +0 -1
- package/dist/cdn/assets/icon/orientedImageryFullSuperimpose32.json +0 -1
- package/dist/cdn/assets/icon/orientedImageryHalfSuperimpose16.json +0 -1
- package/dist/cdn/assets/icon/orientedImageryHalfSuperimpose24.json +0 -1
- package/dist/cdn/assets/icon/orientedImageryHalfSuperimpose32.json +0 -1
- package/dist/cdn/assets/icon/orientedImagerySceneOnly16.json +0 -1
- package/dist/cdn/assets/icon/orientedImagerySceneOnly24.json +0 -1
- package/dist/cdn/assets/icon/orientedImagerySceneOnly32.json +0 -1
- package/dist/cdn/assets/icon/parquetFeatureLayer16.json +0 -1
- package/dist/cdn/assets/icon/parquetFeatureLayer24.json +0 -1
- package/dist/cdn/assets/icon/parquetFeatureLayer32.json +0 -1
- /package/dist/cdn/{IYGANVDT.js → 72YUATHS.js} +0 -0
- /package/dist/cdn/{MYDCGCGV.js → IIA2H2SU.js} +0 -0
- /package/dist/cdn/{DCWL5FUH.js → LKL63VXR.js} +0 -0
- /package/dist/cdn/{UM6KICQF.js → MO64UYDH.js} +0 -0
- /package/dist/cdn/{R6HABYRV.js → Q55YTOMB.js} +0 -0
|
@@ -27,8 +27,9 @@ import { u as useCancelable } from "../../chunks/useCancelable.js";
|
|
|
27
27
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
28
28
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
29
29
|
import { u as useForm } from "../../chunks/useForm.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
30
|
+
import { i as isChip } from "../../chunks/resources5.js";
|
|
31
|
+
import { I as IDS, C as CSS, a as ComboboxItemSelector, b as ComboboxItemGroupSelector, c as ICONS } from "../../chunks/resources6.js";
|
|
32
|
+
import { h as hasActiveChildren, i as isSingleLike, o as orderValuesByPrevious, a as orderByPrevious, g as getLabel, b as getItemAncestors, c as getItemChildren } from "../../chunks/utils2.js";
|
|
32
33
|
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))}`;
|
|
33
34
|
class Combobox extends LitElement {
|
|
34
35
|
constructor() {
|
|
@@ -77,32 +78,38 @@ class Combobox extends LitElement {
|
|
|
77
78
|
this._filterText = "";
|
|
78
79
|
this.getSelectedItems = () => {
|
|
79
80
|
if (!this.isMulti()) {
|
|
80
|
-
const match = this.
|
|
81
|
+
const match = this.allItems.find(({ selected }) => selected);
|
|
81
82
|
return match ? [match] : [];
|
|
82
83
|
}
|
|
83
|
-
return this.
|
|
84
|
-
const aIdx = this.selectedItems.indexOf(a);
|
|
85
|
-
const bIdx = this.selectedItems.indexOf(b);
|
|
86
|
-
if (aIdx > -1 && bIdx > -1) {
|
|
87
|
-
return aIdx - bIdx;
|
|
88
|
-
}
|
|
89
|
-
return bIdx - aIdx;
|
|
90
|
-
});
|
|
84
|
+
return this.allItems.filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)));
|
|
91
85
|
};
|
|
92
86
|
this.groupItems = [];
|
|
93
87
|
this.guid = guid();
|
|
94
88
|
this.ignoreSelectedEventsFlag = false;
|
|
95
89
|
this.internalValueChangeFlag = false;
|
|
90
|
+
this.previousAllSelected = false;
|
|
91
|
+
this.refreshingSelectionDisplay = false;
|
|
96
92
|
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
|
97
93
|
this.onLabelClick = () => {
|
|
98
94
|
this.setFocus();
|
|
99
95
|
};
|
|
100
96
|
this.transitionProp = "opacity";
|
|
101
|
-
this.resizeObserver =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
this.resizeObserver = (() => {
|
|
98
|
+
let resizeWorkQueued = false;
|
|
99
|
+
return createObserver("resize", () => {
|
|
100
|
+
if (resizeWorkQueued) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
resizeWorkQueued = true;
|
|
104
|
+
requestAnimationFrame(() => {
|
|
105
|
+
resizeWorkQueued = false;
|
|
106
|
+
this.setMaxScrollerHeight();
|
|
107
|
+
this.refreshSelectionDisplay();
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
})();
|
|
105
111
|
this.selectedIndicatorChipRef = createRef();
|
|
112
|
+
this.selectedChipCountRef = createRef();
|
|
106
113
|
this.clearButtonRef = createRef();
|
|
107
114
|
this._selectedItems = [];
|
|
108
115
|
this.textInputRef = createRef();
|
|
@@ -120,8 +127,10 @@ class Combobox extends LitElement {
|
|
|
120
127
|
this.activeDescendant = "";
|
|
121
128
|
this.activeItemIndex = -1;
|
|
122
129
|
this.compactSelectionDisplay = false;
|
|
130
|
+
this.deferFitChipCountRender = false;
|
|
123
131
|
this.selectedHiddenChipsCount = 0;
|
|
124
132
|
this.selectedVisibleChipsCount = 0;
|
|
133
|
+
this.fitUsingCompactCountLabel = false;
|
|
125
134
|
this.allItems = [];
|
|
126
135
|
this.items = [];
|
|
127
136
|
this.clearDisabled = false;
|
|
@@ -153,7 +162,7 @@ class Combobox extends LitElement {
|
|
|
153
162
|
this.listen("click", this.comboboxFocusHandler);
|
|
154
163
|
}
|
|
155
164
|
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 }], allItems: [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 };
|
|
165
|
+
this.properties = { activeChipIndex: [16, {}, { state: true }], activeDescendant: [16, {}, { state: true }], activeItemIndex: [16, {}, { state: true }], compactSelectionDisplay: [16, {}, { state: true }], deferFitChipCountRender: [16, {}, { state: true }], selectedHiddenChipsCount: [16, {}, { state: true }], selectedVisibleChipsCount: [16, {}, { state: true }], fitUsingCompactCountLabel: [16, {}, { state: true }], allItems: [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
166
|
}
|
|
158
167
|
static {
|
|
159
168
|
this.formAssociated = true;
|
|
@@ -178,9 +187,6 @@ class Combobox extends LitElement {
|
|
|
178
187
|
const enabledItems = this.allItems.filter((item) => !item.disabled);
|
|
179
188
|
return enabledItems.length > 0 && enabledItems.every((item) => item.selected);
|
|
180
189
|
}
|
|
181
|
-
get hasDisabledItems() {
|
|
182
|
-
return this.allItems.some((item) => item.disabled);
|
|
183
|
-
}
|
|
184
190
|
get hasDisabledSelected() {
|
|
185
191
|
return this.allItems.some((item) => item.disabled && item.selected);
|
|
186
192
|
}
|
|
@@ -325,11 +331,33 @@ class Combobox extends LitElement {
|
|
|
325
331
|
this.reposition(true);
|
|
326
332
|
}
|
|
327
333
|
selectedItemsHandler() {
|
|
334
|
+
const wasAllSelected = this.previousAllSelected;
|
|
335
|
+
const isAllSelected = this.allSelected;
|
|
336
|
+
this.previousAllSelected = isAllSelected;
|
|
328
337
|
this.internalValueChangeFlag = true;
|
|
329
338
|
this.value = this.getValue();
|
|
330
339
|
this.internalValueChangeFlag = false;
|
|
331
340
|
if (this.selectionDisplay === "fit" && this.isMulti()) {
|
|
332
|
-
|
|
341
|
+
const transitioningFromAllSelected = wasAllSelected && !isAllSelected;
|
|
342
|
+
if (wasAllSelected && !isAllSelected) {
|
|
343
|
+
this.selectedHiddenChipsCount = 0;
|
|
344
|
+
this.selectedItems.forEach((item) => {
|
|
345
|
+
const chipEl = this.referenceEl?.querySelector(`#${IDS.chip(item.guid)}`);
|
|
346
|
+
if (chipEl) {
|
|
347
|
+
this.showChip(chipEl);
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
this.updateComplete.then(async () => {
|
|
352
|
+
if (transitioningFromAllSelected) {
|
|
353
|
+
await this.updateComplete;
|
|
354
|
+
}
|
|
355
|
+
await this.refreshSelectionDisplay();
|
|
356
|
+
if (this.fitFollowUpRefreshPromise) {
|
|
357
|
+
await this.fitFollowUpRefreshPromise;
|
|
358
|
+
}
|
|
359
|
+
this.deferFitChipCountRender = false;
|
|
360
|
+
});
|
|
333
361
|
}
|
|
334
362
|
}
|
|
335
363
|
async documentClickHandler(event) {
|
|
@@ -348,10 +376,11 @@ class Combobox extends LitElement {
|
|
|
348
376
|
this.open = false;
|
|
349
377
|
}
|
|
350
378
|
handleSelectAll(isSelectAllTarget) {
|
|
351
|
-
if (isSelectAllTarget) {
|
|
352
|
-
|
|
379
|
+
if (!isSelectAllTarget) {
|
|
380
|
+
return;
|
|
353
381
|
}
|
|
354
|
-
|
|
382
|
+
this.toggleSelectAll();
|
|
383
|
+
if (this.selectionDisplay !== "fit" && this.allSelected) {
|
|
355
384
|
this.selectedItems.forEach((item) => {
|
|
356
385
|
const chipEl = this.referenceEl.querySelector(`#${IDS.chip(item.guid)}`);
|
|
357
386
|
if (chipEl) {
|
|
@@ -360,6 +389,9 @@ class Combobox extends LitElement {
|
|
|
360
389
|
});
|
|
361
390
|
}
|
|
362
391
|
}
|
|
392
|
+
updateSelectedItems() {
|
|
393
|
+
this.selectedItems = this.getOrderedSelectedItems(this.getSelectedItems());
|
|
394
|
+
}
|
|
363
395
|
calciteComboboxItemChangeHandler(event) {
|
|
364
396
|
if (this.ignoreSelectedEventsFlag) {
|
|
365
397
|
return;
|
|
@@ -372,7 +404,6 @@ class Combobox extends LitElement {
|
|
|
372
404
|
const newIndex = this.keyboardNavItems.indexOf(isSelectAllTarget ? this.selectAllComboboxItemRef.value : target);
|
|
373
405
|
this.updateActiveItemIndex(newIndex);
|
|
374
406
|
this.toggleSelection(target, target.selected);
|
|
375
|
-
this.selectedItems = this.getSelectedItems();
|
|
376
407
|
}
|
|
377
408
|
calciteInternalComboboxItemChangeHandler(event) {
|
|
378
409
|
event.stopPropagation();
|
|
@@ -381,11 +412,14 @@ class Combobox extends LitElement {
|
|
|
381
412
|
}
|
|
382
413
|
}
|
|
383
414
|
clearValue() {
|
|
384
|
-
this.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
415
|
+
const enabledSelectedItems = this.items.filter((item) => item.selected && !item.disabled);
|
|
416
|
+
if (enabledSelectedItems.length) {
|
|
417
|
+
this.ignoreSelectedEventsFlag = true;
|
|
418
|
+
enabledSelectedItems.forEach((el) => el.selected = false);
|
|
419
|
+
this.ignoreSelectedEventsFlag = false;
|
|
420
|
+
this.updateSelectedItems();
|
|
421
|
+
this.emitComboboxChange();
|
|
422
|
+
}
|
|
389
423
|
this.open = false;
|
|
390
424
|
this.updateActiveItemIndex(-1);
|
|
391
425
|
this.resetText();
|
|
@@ -403,9 +437,19 @@ class Combobox extends LitElement {
|
|
|
403
437
|
this.filteredFlipPlacements = flipPlacements ? filterValidFlipPlacements(flipPlacements, el) : null;
|
|
404
438
|
}
|
|
405
439
|
getValue() {
|
|
406
|
-
const items = this.selectedItems.map((item) => item.value?.toString());
|
|
440
|
+
const items = this.getOrderedSelectedValues(this.selectedItems.map((item) => item.value?.toString()));
|
|
407
441
|
return items.length ? items.length > 1 ? items : items[0] : "";
|
|
408
442
|
}
|
|
443
|
+
getOrderedSelectedValues(selectedValues) {
|
|
444
|
+
if (!this.isMulti()) {
|
|
445
|
+
return selectedValues;
|
|
446
|
+
}
|
|
447
|
+
const previousValues = Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
448
|
+
return orderValuesByPrevious(selectedValues, previousValues);
|
|
449
|
+
}
|
|
450
|
+
getOrderedSelectedItems(selectedItems) {
|
|
451
|
+
return this.isMulti() ? orderByPrevious(selectedItems, this.selectedItems) : selectedItems;
|
|
452
|
+
}
|
|
409
453
|
comboboxInViewport() {
|
|
410
454
|
const bounding = this.el.getBoundingClientRect();
|
|
411
455
|
return bounding.top >= 0 && bounding.left >= 0 && bounding.right <= (window.innerWidth || document.documentElement.clientWidth) && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight);
|
|
@@ -418,9 +462,16 @@ class Combobox extends LitElement {
|
|
|
418
462
|
}
|
|
419
463
|
item.selected = toggledValue;
|
|
420
464
|
});
|
|
421
|
-
this.
|
|
465
|
+
this.updateSelectedItems();
|
|
422
466
|
this.emitComboboxChange();
|
|
423
467
|
}
|
|
468
|
+
hasHiddenSelectedFitChips() {
|
|
469
|
+
if (this.selectionDisplay !== "fit" || !this.isMulti()) {
|
|
470
|
+
return false;
|
|
471
|
+
}
|
|
472
|
+
const hiddenCountChip = this.selectedChipCountRef.value;
|
|
473
|
+
return !!hiddenCountChip && !hiddenCountChip.classList.contains(CSS.chipInvisible);
|
|
474
|
+
}
|
|
424
475
|
keyDownHandler(event) {
|
|
425
476
|
if (this.readOnly) {
|
|
426
477
|
return;
|
|
@@ -547,13 +598,16 @@ class Combobox extends LitElement {
|
|
|
547
598
|
break;
|
|
548
599
|
case "Delete":
|
|
549
600
|
case "Backspace": {
|
|
550
|
-
const
|
|
601
|
+
const fitDeleteBlockedByOverflow = this.hasHiddenSelectedFitChips();
|
|
602
|
+
const overflowDeleteBlocked = fitDeleteBlockedByOverflow && this.activeChipIndex === -1;
|
|
603
|
+
const notDeletable = this.selectionDisplay === "single" || overflowDeleteBlocked;
|
|
551
604
|
if (notDeletable) {
|
|
552
605
|
return;
|
|
553
606
|
}
|
|
554
|
-
|
|
607
|
+
const deleteTargetChip = event.composedPath().find((node) => isChip(node));
|
|
608
|
+
if (this.activeChipIndex > -1 && deleteTargetChip) {
|
|
555
609
|
event.preventDefault();
|
|
556
|
-
this.removeActiveChip(
|
|
610
|
+
this.removeActiveChip(deleteTargetChip);
|
|
557
611
|
} else if (!this.filterText && this.isMulti()) {
|
|
558
612
|
event.preventDefault();
|
|
559
613
|
this.removeLastChip();
|
|
@@ -601,7 +655,7 @@ class Combobox extends LitElement {
|
|
|
601
655
|
return;
|
|
602
656
|
}
|
|
603
657
|
const composedPath = event.composedPath();
|
|
604
|
-
if (composedPath.some((node) => node
|
|
658
|
+
if (composedPath.some((node) => isChip(node))) {
|
|
605
659
|
this.open = false;
|
|
606
660
|
event.preventDefault();
|
|
607
661
|
return;
|
|
@@ -625,35 +679,63 @@ class Combobox extends LitElement {
|
|
|
625
679
|
showChip(chipEl) {
|
|
626
680
|
chipEl.classList.remove(CSS.chipInvisible);
|
|
627
681
|
}
|
|
628
|
-
refreshChipDisplay({ chipEls, availableHorizontalChipElSpace, chipContainerElGap }) {
|
|
682
|
+
refreshChipDisplay({ chipEls, availableHorizontalChipElSpace, chipContainerElGap, hideSelectedChips }) {
|
|
683
|
+
const selectedChipEls = chipEls.filter((chipEl) => chipEl.selected);
|
|
684
|
+
const enabledSelectedChipEls = selectedChipEls.filter((chipEl) => !chipEl.disabled);
|
|
685
|
+
const disabledSelectedChipEls = selectedChipEls.filter((chipEl) => chipEl.disabled);
|
|
686
|
+
const getChipWidth = (chipEl) => {
|
|
687
|
+
const computedWidth = getElementWidth(chipEl);
|
|
688
|
+
const fallbackWidth = chipEl.getBoundingClientRect().width;
|
|
689
|
+
return Number.isFinite(computedWidth) && computedWidth > 0 ? computedWidth : fallbackWidth;
|
|
690
|
+
};
|
|
691
|
+
selectedChipEls.forEach((chipEl) => getChipWidth(chipEl));
|
|
629
692
|
chipEls.forEach((chipEl) => {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
693
|
+
this.hideChip(chipEl);
|
|
694
|
+
});
|
|
695
|
+
if (hideSelectedChips) {
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const renderFittingChips = (chips) => {
|
|
699
|
+
let visibleChipsCount = 0;
|
|
700
|
+
chips.forEach((chipEl) => {
|
|
701
|
+
const chipElWidth = getChipWidth(chipEl);
|
|
702
|
+
if (chipElWidth && chipElWidth <= availableHorizontalChipElSpace) {
|
|
635
703
|
availableHorizontalChipElSpace -= chipElWidth + chipContainerElGap;
|
|
636
704
|
this.showChip(chipEl);
|
|
637
|
-
|
|
705
|
+
visibleChipsCount++;
|
|
638
706
|
}
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
}
|
|
707
|
+
});
|
|
708
|
+
return visibleChipsCount;
|
|
709
|
+
};
|
|
710
|
+
const visibleEnabledChipsCount = renderFittingChips(enabledSelectedChipEls);
|
|
711
|
+
if (visibleEnabledChipsCount <= 1) {
|
|
712
|
+
renderFittingChips(disabledSelectedChipEls);
|
|
713
|
+
}
|
|
642
714
|
}
|
|
643
|
-
async refreshSelectionDisplay() {
|
|
644
|
-
this.
|
|
715
|
+
async refreshSelectionDisplay(followUpRefresh = true) {
|
|
716
|
+
if (this.refreshingSelectionDisplay) {
|
|
717
|
+
return;
|
|
718
|
+
}
|
|
719
|
+
this.refreshingSelectionDisplay = true;
|
|
720
|
+
await this.componentOnReady();
|
|
645
721
|
if (isSingleLike(this.selectionMode)) {
|
|
722
|
+
this.refreshingSelectionDisplay = false;
|
|
646
723
|
return;
|
|
647
724
|
}
|
|
648
725
|
if (!this.textInputRef.value || !this.chipContainerEl) {
|
|
726
|
+
this.refreshingSelectionDisplay = false;
|
|
649
727
|
return;
|
|
650
728
|
}
|
|
651
729
|
const { allSelectedIndicatorChipRef, chipContainerEl, selectionDisplay, placeholder, selectedIndicatorChipRef, textInputRef } = this;
|
|
652
|
-
const chipContainerElGap = parseInt(getComputedStyle(chipContainerEl).gap
|
|
730
|
+
const chipContainerElGap = parseInt(getComputedStyle(chipContainerEl).gap);
|
|
653
731
|
const chipContainerElWidth = getElementWidth(chipContainerEl);
|
|
654
|
-
const { fontSize, fontFamily } = getComputedStyle(textInputRef.value);
|
|
655
|
-
const
|
|
656
|
-
const
|
|
732
|
+
const { fontSize, fontFamily, minInlineSize } = getComputedStyle(textInputRef.value);
|
|
733
|
+
const placeholderWidthMultiplier = 0.55;
|
|
734
|
+
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48);
|
|
735
|
+
const measuredPlaceholderWidth = getTextWidth(placeholder, `${fontSize} ${fontFamily}`);
|
|
736
|
+
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48)) * placeholderWidthMultiplier));
|
|
737
|
+
const fitInputWidth = Math.max(inputMinWidth, placeholderWidth);
|
|
738
|
+
const inputWidth = (selectionDisplay === "fit" ? fitInputWidth : placeholderWidth) + chipContainerElGap;
|
|
657
739
|
const allSelectedIndicatorChipElWidth = getElementWidth(allSelectedIndicatorChipRef.value);
|
|
658
740
|
const selectedIndicatorChipElWidth = getElementWidth(selectedIndicatorChipRef.value);
|
|
659
741
|
const largestSelectedIndicatorChipWidth = Math.max(allSelectedIndicatorChipElWidth, selectedIndicatorChipElWidth);
|
|
@@ -663,7 +745,7 @@ class Combobox extends LitElement {
|
|
|
663
745
|
inputWidth,
|
|
664
746
|
largestSelectedIndicatorChipWidth
|
|
665
747
|
});
|
|
666
|
-
if (
|
|
748
|
+
if (selectionDisplay !== "fit" && this.allSelected && this.selectAllEnabled) {
|
|
667
749
|
this.selectedItems.forEach((item) => {
|
|
668
750
|
const chipEl = this.referenceEl.querySelector(`#${IDS.chip(item.guid)}`);
|
|
669
751
|
if (chipEl) {
|
|
@@ -680,16 +762,64 @@ class Combobox extends LitElement {
|
|
|
680
762
|
});
|
|
681
763
|
}
|
|
682
764
|
if (selectionDisplay === "fit") {
|
|
683
|
-
const chipEls = Array.from(this.el.shadowRoot.querySelectorAll("calcite-chip")).filter((chipEl) =>
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
765
|
+
const chipEls = Array.from(this.el.shadowRoot.querySelectorAll("calcite-chip")).filter((chipEl) => {
|
|
766
|
+
const chipValue = chipEl.value;
|
|
767
|
+
const hasValue = chipValue != null && `${chipValue}` !== "";
|
|
768
|
+
return chipEl.disabled || hasValue;
|
|
769
|
+
});
|
|
770
|
+
const { hiddenChipIndicatorWidth, hideSelectedChips, reservedPlaceholderInputWidth } = this.getFitCompactDisplayState({
|
|
771
|
+
chipContainerElGap,
|
|
772
|
+
chipContainerElWidth,
|
|
773
|
+
inputMinWidth,
|
|
774
|
+
placeholderWidth,
|
|
775
|
+
selectedIndicatorChipElWidth
|
|
776
|
+
});
|
|
777
|
+
this.fitUsingCompactCountLabel = hideSelectedChips;
|
|
778
|
+
const availableHorizontalChipElSpace = Math.round(chipContainerElWidth - (hiddenChipIndicatorWidth + chipContainerElGap + reservedPlaceholderInputWidth + chipContainerElGap));
|
|
779
|
+
this.refreshChipDisplay({
|
|
780
|
+
availableHorizontalChipElSpace,
|
|
781
|
+
chipContainerElGap,
|
|
782
|
+
chipEls,
|
|
783
|
+
hideSelectedChips
|
|
784
|
+
});
|
|
785
|
+
const previousHiddenChipsCount = this.selectedHiddenChipsCount;
|
|
786
|
+
this.syncChipVisibilityCounts(chipEls);
|
|
787
|
+
const didHiddenCountChange = previousHiddenChipsCount !== this.selectedHiddenChipsCount;
|
|
788
|
+
if (didHiddenCountChange && followUpRefresh) {
|
|
789
|
+
this.fitFollowUpRefreshPromise = this.updateComplete.then(() => this.refreshSelectionDisplay(false)).then(() => {
|
|
790
|
+
this.fitFollowUpRefreshPromise = null;
|
|
791
|
+
});
|
|
792
|
+
}
|
|
687
793
|
}
|
|
794
|
+
this.refreshingSelectionDisplay = false;
|
|
688
795
|
}
|
|
689
796
|
setFloatingEl(el) {
|
|
690
797
|
this.floatingEl = el;
|
|
691
798
|
connectFloatingUI(this);
|
|
692
799
|
}
|
|
800
|
+
shouldUseFitCompactDisplay({ chipContainerElGap, chipContainerElWidth, hiddenChipIndicatorWidth, inputMinWidth, placeholderWidth, reservedPlaceholderInputWidth }) {
|
|
801
|
+
const availableHorizontalChipElSpaceWithPlaceholder = Math.round(chipContainerElWidth - (hiddenChipIndicatorWidth + chipContainerElGap + reservedPlaceholderInputWidth + chipContainerElGap));
|
|
802
|
+
const placeholderIsReallyLong = placeholderWidth > inputMinWidth * 2;
|
|
803
|
+
return placeholderIsReallyLong && availableHorizontalChipElSpaceWithPlaceholder <= 0;
|
|
804
|
+
}
|
|
805
|
+
getFitCompactDisplayState({ chipContainerElGap, chipContainerElWidth, inputMinWidth, placeholderWidth, selectedIndicatorChipElWidth }) {
|
|
806
|
+
const selectedChipCountElWidth = getElementWidth(this.selectedChipCountRef.value);
|
|
807
|
+
const hiddenChipIndicatorWidth = this.deferFitChipCountRender || this.selectedHiddenChipsCount <= 0 ? 0 : selectedChipCountElWidth || selectedIndicatorChipElWidth;
|
|
808
|
+
const reservedPlaceholderInputWidth = Math.max(inputMinWidth, placeholderWidth);
|
|
809
|
+
const hideSelectedChips = this.shouldUseFitCompactDisplay({
|
|
810
|
+
chipContainerElGap,
|
|
811
|
+
chipContainerElWidth,
|
|
812
|
+
hiddenChipIndicatorWidth,
|
|
813
|
+
inputMinWidth,
|
|
814
|
+
placeholderWidth,
|
|
815
|
+
reservedPlaceholderInputWidth
|
|
816
|
+
});
|
|
817
|
+
return {
|
|
818
|
+
hiddenChipIndicatorWidth,
|
|
819
|
+
hideSelectedChips,
|
|
820
|
+
reservedPlaceholderInputWidth
|
|
821
|
+
};
|
|
822
|
+
}
|
|
693
823
|
setCompactSelectionDisplay({ chipContainerElGap, chipContainerElWidth, inputWidth, largestSelectedIndicatorChipWidth }) {
|
|
694
824
|
const newCompactBreakpoint = Math.round(largestSelectedIndicatorChipWidth + chipContainerElGap + inputWidth);
|
|
695
825
|
if (!this.maxCompactBreakpoint || this.maxCompactBreakpoint < newCompactBreakpoint) {
|
|
@@ -710,17 +840,21 @@ class Combobox extends LitElement {
|
|
|
710
840
|
this.referenceEl = el;
|
|
711
841
|
connectFloatingUI(this);
|
|
712
842
|
}
|
|
713
|
-
|
|
843
|
+
syncChipVisibilityCounts(chipEls) {
|
|
714
844
|
let newSelectedVisibleChipsCount = 0;
|
|
845
|
+
let selectedChipCount = 0;
|
|
715
846
|
chipEls.forEach((chipEl) => {
|
|
716
|
-
if (chipEl.selected
|
|
717
|
-
|
|
847
|
+
if (chipEl.selected) {
|
|
848
|
+
selectedChipCount++;
|
|
849
|
+
if (!chipEl.classList.contains(CSS.chipInvisible)) {
|
|
850
|
+
newSelectedVisibleChipsCount++;
|
|
851
|
+
}
|
|
718
852
|
}
|
|
719
853
|
});
|
|
720
854
|
if (newSelectedVisibleChipsCount !== this.selectedVisibleChipsCount) {
|
|
721
855
|
this.selectedVisibleChipsCount = newSelectedVisibleChipsCount;
|
|
722
856
|
}
|
|
723
|
-
const newSelectedHiddenChipsCount = Math.max(0,
|
|
857
|
+
const newSelectedHiddenChipsCount = Math.max(0, selectedChipCount - newSelectedVisibleChipsCount);
|
|
724
858
|
if (newSelectedHiddenChipsCount !== this.selectedHiddenChipsCount) {
|
|
725
859
|
this.selectedHiddenChipsCount = newSelectedHiddenChipsCount;
|
|
726
860
|
}
|
|
@@ -765,6 +899,9 @@ class Combobox extends LitElement {
|
|
|
765
899
|
if (!item || this.selectionMode === "single-persist" && item.selected && item.value === this.value && !value) {
|
|
766
900
|
return;
|
|
767
901
|
}
|
|
902
|
+
if (this.selectionDisplay === "fit" && this.isMulti()) {
|
|
903
|
+
this.deferFitChipCountRender = true;
|
|
904
|
+
}
|
|
768
905
|
if (this.isMulti()) {
|
|
769
906
|
this.handleMultiSelection(item, value);
|
|
770
907
|
} else {
|
|
@@ -774,7 +911,7 @@ class Combobox extends LitElement {
|
|
|
774
911
|
handleMultiSelection(item, value) {
|
|
775
912
|
item.selected = value;
|
|
776
913
|
this.updateAncestors(item);
|
|
777
|
-
this.
|
|
914
|
+
this.updateSelectedItems();
|
|
778
915
|
this.emitComboboxChange();
|
|
779
916
|
this.resetText();
|
|
780
917
|
this.filterItems("");
|
|
@@ -783,7 +920,7 @@ class Combobox extends LitElement {
|
|
|
783
920
|
this.ignoreSelectedEventsFlag = true;
|
|
784
921
|
this.items.forEach((el) => el.selected = el === item ? value : false);
|
|
785
922
|
this.ignoreSelectedEventsFlag = false;
|
|
786
|
-
this.
|
|
923
|
+
this.updateSelectedItems();
|
|
787
924
|
this.emitComboboxChange();
|
|
788
925
|
if (this.textInputRef.value) {
|
|
789
926
|
this.textInputRef.value.value = getLabel(item);
|
|
@@ -800,11 +937,14 @@ class Combobox extends LitElement {
|
|
|
800
937
|
const ancestors = getItemAncestors(item);
|
|
801
938
|
const children = getItemChildren(item);
|
|
802
939
|
if (item.selected) {
|
|
803
|
-
ancestors.forEach((el) => {
|
|
940
|
+
[...children, ...ancestors].forEach((el) => {
|
|
941
|
+
if (el.disabled) {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
804
944
|
el.selected = true;
|
|
805
945
|
});
|
|
806
946
|
} else {
|
|
807
|
-
children.forEach((el) => {
|
|
947
|
+
[...children].forEach((el) => {
|
|
808
948
|
if (el.disabled) {
|
|
809
949
|
return;
|
|
810
950
|
}
|
|
@@ -824,7 +964,8 @@ class Combobox extends LitElement {
|
|
|
824
964
|
this.data = this.getData();
|
|
825
965
|
this.groupData = this.getGroupData();
|
|
826
966
|
this.updateItemProps();
|
|
827
|
-
this.
|
|
967
|
+
this.updateSelectedItems();
|
|
968
|
+
this.previousAllSelected = this.allSelected;
|
|
828
969
|
}
|
|
829
970
|
updateItemProps() {
|
|
830
971
|
this.allItems.forEach((item) => {
|
|
@@ -898,13 +1039,17 @@ class Combobox extends LitElement {
|
|
|
898
1039
|
}
|
|
899
1040
|
removeActiveChip(chip) {
|
|
900
1041
|
const activeItem = this.selectedItems[this.activeChipIndex];
|
|
901
|
-
if (activeItem && `${IDS.chip(activeItem.guid)}` === chip.id) {
|
|
1042
|
+
if (activeItem && !activeItem.disabled && `${IDS.chip(activeItem.guid)}` === chip.id) {
|
|
902
1043
|
this.toggleSelection(activeItem, false);
|
|
903
1044
|
}
|
|
904
1045
|
this.setFocus();
|
|
905
1046
|
}
|
|
906
1047
|
removeLastChip() {
|
|
907
|
-
this.
|
|
1048
|
+
const lastEnabledSelectedItem = this.selectedItems.findLast((item) => !item.disabled);
|
|
1049
|
+
if (!lastEnabledSelectedItem) {
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
this.toggleSelection(lastEnabledSelectedItem, false);
|
|
908
1053
|
this.setFocus();
|
|
909
1054
|
}
|
|
910
1055
|
previousChip() {
|
|
@@ -975,7 +1120,11 @@ class Combobox extends LitElement {
|
|
|
975
1120
|
if (this.disabled) {
|
|
976
1121
|
return;
|
|
977
1122
|
}
|
|
1123
|
+
this.activeChipIndex = -1;
|
|
978
1124
|
this.textInputRef.value.focus();
|
|
1125
|
+
if (this.open && this.selectionDisplay === "fit" && this.isMulti()) {
|
|
1126
|
+
void this.refreshSelectionDisplay();
|
|
1127
|
+
}
|
|
979
1128
|
}
|
|
980
1129
|
createScreenReaderItem({ ariaLabel, ariaSelected, id, textContent }) {
|
|
981
1130
|
return html`<li aria-label=${ariaLabel ?? nothing} aria-selected=${ariaSelected ?? nothing} id=${id ?? nothing} role=option tabindex=-1>${textContent}</li>`;
|
|
@@ -1001,64 +1150,58 @@ class Combobox extends LitElement {
|
|
|
1001
1150
|
return keyed(item.guid || item.value || label, html`<calcite-chip .appearance=${readOnly ? "outline" : "solid"} class=${safeClassMap({
|
|
1002
1151
|
[CSS.chip]: true,
|
|
1003
1152
|
[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>`);
|
|
1153
|
+
})} .closable=${!disabled && !readOnly} data-testid=${`${disabled ? "disabled-chip" : "chip"}-${index}`} .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
1154
|
}
|
|
1006
1155
|
renderChipCount(count, scale) {
|
|
1007
|
-
const label = this.messages.disabledSelectedCount?.replace("{count}", `${count}`) ?? `+${count}`;
|
|
1156
|
+
const label = this.fitUsingCompactCountLabel ? `${count}` : this.messages.disabledSelectedCount?.replace("{count}", `${count}`) ?? `+${count}`;
|
|
1008
1157
|
return html`<calcite-chip appearance=solid class=${safeClassMap({
|
|
1009
1158
|
[CSS.chip]: true
|
|
1010
|
-
})} .label=${label} .scale=${scale} tabindex=-1 title=${label ?? nothing}>${label}</calcite-chip>`;
|
|
1159
|
+
})} data-testid=selected-chip-count id=selected-chip-count .label=${label} .scale=${scale} tabindex=-1 title=${label ?? nothing} ${ref(this.selectedChipCountRef)}>${label}</calcite-chip>`;
|
|
1011
1160
|
}
|
|
1012
1161
|
renderChips() {
|
|
1013
1162
|
const { activeChipIndex, readOnly, scale, selectionDisplay, selectionMode, messages } = this;
|
|
1014
1163
|
const chips = [];
|
|
1015
1164
|
const isAncestors = selectionMode === "ancestors";
|
|
1016
|
-
const
|
|
1017
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
1018
|
-
const disabledItems = this.allItems.filter((item) => item.disabled && item.selected && (!isAncestors || !hasActiveChildren(item)));
|
|
1165
|
+
const hideSelectedChipsForSelectAll = this.selectAllEnabled && this.allSelected;
|
|
1019
1166
|
const preserveOrder = selectionDisplay === "all";
|
|
1020
|
-
if (
|
|
1167
|
+
if (hideSelectedChipsForSelectAll) {
|
|
1021
1168
|
return null;
|
|
1022
1169
|
}
|
|
1023
1170
|
let selectedIndex = 0;
|
|
1024
1171
|
let disabledIndex = 0;
|
|
1025
1172
|
if (preserveOrder) {
|
|
1026
|
-
this.allItems.
|
|
1173
|
+
const selectedChipItems = this.allItems.filter((item) => item.selected && (!isAncestors || !hasActiveChildren(item)));
|
|
1174
|
+
const orderedSelectedChipItems = orderByPrevious(selectedChipItems, this.selectedItems);
|
|
1175
|
+
orderedSelectedChipItems.forEach((item) => {
|
|
1027
1176
|
if (item.disabled) {
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
}));
|
|
1039
|
-
}
|
|
1177
|
+
chips.push(this.renderChip({
|
|
1178
|
+
activeChipIndex,
|
|
1179
|
+
disabled: true,
|
|
1180
|
+
index: disabledIndex++,
|
|
1181
|
+
item,
|
|
1182
|
+
messages,
|
|
1183
|
+
readOnly,
|
|
1184
|
+
scale,
|
|
1185
|
+
isAncestors
|
|
1186
|
+
}));
|
|
1040
1187
|
return;
|
|
1041
1188
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
isAncestors
|
|
1053
|
-
}));
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1189
|
+
chips.push(this.renderChip({
|
|
1190
|
+
activeChipIndex,
|
|
1191
|
+
disabled: false,
|
|
1192
|
+
index: selectedIndex++,
|
|
1193
|
+
item,
|
|
1194
|
+
messages,
|
|
1195
|
+
readOnly,
|
|
1196
|
+
scale,
|
|
1197
|
+
isAncestors
|
|
1198
|
+
}));
|
|
1056
1199
|
});
|
|
1057
|
-
} else if (!
|
|
1200
|
+
} else if (!hideSelectedChipsForSelectAll) {
|
|
1058
1201
|
this.selectedItems.forEach((item) => {
|
|
1059
1202
|
chips.push(this.renderChip({
|
|
1060
1203
|
activeChipIndex,
|
|
1061
|
-
disabled:
|
|
1204
|
+
disabled: item.disabled,
|
|
1062
1205
|
index: selectedIndex++,
|
|
1063
1206
|
item,
|
|
1064
1207
|
messages,
|
|
@@ -1068,32 +1211,53 @@ class Combobox extends LitElement {
|
|
|
1068
1211
|
}));
|
|
1069
1212
|
});
|
|
1070
1213
|
}
|
|
1071
|
-
if (selectionDisplay === "fit"
|
|
1072
|
-
|
|
1214
|
+
if (selectionDisplay === "fit") {
|
|
1215
|
+
const hiddenSelectedCount = this.selectedHiddenChipsCount;
|
|
1216
|
+
const countChipValue = this.selectedVisibleChipsCount === 0 ? this.selectedItems.length : hiddenSelectedCount;
|
|
1217
|
+
if (hiddenSelectedCount > 0 && !this.deferFitChipCountRender) {
|
|
1218
|
+
chips.push(this.renderChipCount(countChipValue, scale));
|
|
1219
|
+
}
|
|
1073
1220
|
}
|
|
1074
1221
|
return chips.length ? chips : null;
|
|
1075
1222
|
}
|
|
1076
1223
|
renderAllSelectedIndicatorChip() {
|
|
1077
1224
|
const { allSelectedIndicatorChipRef, compactSelectionDisplay, scale, selectedVisibleChipsCount } = this;
|
|
1078
|
-
|
|
1079
|
-
|
|
1225
|
+
let useFitCompactLabel = false;
|
|
1226
|
+
if (this.selectionDisplay === "fit" && this.textInputRef.value && this.chipContainerEl) {
|
|
1227
|
+
const chipContainerElGap = parseInt(getComputedStyle(this.chipContainerEl).gap);
|
|
1228
|
+
const chipContainerElWidth = getElementWidth(this.chipContainerEl);
|
|
1229
|
+
const { fontSize, fontFamily, minInlineSize } = getComputedStyle(this.textInputRef.value);
|
|
1230
|
+
const placeholderWidthMultiplier = 0.55;
|
|
1231
|
+
const inputMinWidth = parseFloat(minInlineSize) || parseInt(calciteSize48);
|
|
1232
|
+
const measuredPlaceholderWidth = getTextWidth(this.placeholder, `${fontSize} ${fontFamily}`);
|
|
1233
|
+
const placeholderWidth = measuredPlaceholderWidth > 0 ? measuredPlaceholderWidth : Math.max(inputMinWidth, Math.round((this.placeholder?.length || 0) * (parseFloat(fontSize) || parseInt(calciteSize48)) * placeholderWidthMultiplier));
|
|
1234
|
+
const selectedIndicatorChipElWidth = getElementWidth(this.selectedIndicatorChipRef.value);
|
|
1235
|
+
useFitCompactLabel = this.getFitCompactDisplayState({
|
|
1236
|
+
chipContainerElGap,
|
|
1237
|
+
chipContainerElWidth,
|
|
1238
|
+
inputMinWidth,
|
|
1239
|
+
placeholderWidth,
|
|
1240
|
+
selectedIndicatorChipElWidth
|
|
1241
|
+
}).hideSelectedChips;
|
|
1242
|
+
}
|
|
1243
|
+
const useCompactAllLabel = compactSelectionDisplay || useFitCompactLabel;
|
|
1244
|
+
const label = useCompactAllLabel ? this.messages.all : this.messages.allSelected;
|
|
1245
|
+
const showAllSelectedChip = this.allSelected && (this.selectionDisplay === "single" || !selectedVisibleChipsCount || this.selectionDisplay === "all");
|
|
1080
1246
|
return html`<calcite-chip class=${safeClassMap({
|
|
1081
1247
|
[CSS.chip]: true,
|
|
1082
1248
|
[CSS.chipInvisible]: !showAllSelectedChip,
|
|
1083
1249
|
[CSS.allSelected]: true
|
|
1084
|
-
})} .label=${label} .scale=${scale} title=${label ?? nothing} value ${ref(allSelectedIndicatorChipRef)}>${label}</calcite-chip>`;
|
|
1250
|
+
})} data-testid=all-selected-indicator-chip .label=${label} .scale=${scale} title=${label ?? nothing} value ${ref(allSelectedIndicatorChipRef)}>${label}</calcite-chip>`;
|
|
1085
1251
|
}
|
|
1086
1252
|
renderSelectedIndicatorChip() {
|
|
1087
|
-
const { compactSelectionDisplay, selectionDisplay, scale,
|
|
1088
|
-
const allSelectedNoDisabled = this.allSelected && !this.hasDisabledItems;
|
|
1089
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
1253
|
+
const { compactSelectionDisplay, selectionDisplay, scale, selectedIndicatorChipRef } = this;
|
|
1090
1254
|
let chipInvisible;
|
|
1091
1255
|
let label;
|
|
1256
|
+
const selectedItemsCount = this.getSelectedItems().length;
|
|
1092
1257
|
if (compactSelectionDisplay) {
|
|
1093
1258
|
chipInvisible = true;
|
|
1094
1259
|
} else {
|
|
1095
1260
|
if (selectionDisplay === "single") {
|
|
1096
|
-
const selectedItemsCount = this.allItems.filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item))).length;
|
|
1097
1261
|
if (this.allSelected) {
|
|
1098
1262
|
chipInvisible = true;
|
|
1099
1263
|
} else if (selectedItemsCount > 0) {
|
|
@@ -1102,9 +1266,6 @@ class Combobox extends LitElement {
|
|
|
1102
1266
|
chipInvisible = true;
|
|
1103
1267
|
}
|
|
1104
1268
|
label = `${selectedItemsCount} ${this.messages.selected}`;
|
|
1105
|
-
} else if (selectionDisplay === "fit") {
|
|
1106
|
-
chipInvisible = !!((allSelectedNoDisabled || allSelectedWithDisabledSelected) && selectedVisibleChipsCount === 0 || selectedHiddenChipsCount === 0);
|
|
1107
|
-
label = selectedVisibleChipsCount > 0 ? `+${selectedHiddenChipsCount}` : `${selectedHiddenChipsCount} ${this.messages.selected}`;
|
|
1108
1269
|
}
|
|
1109
1270
|
}
|
|
1110
1271
|
return html`<calcite-chip class=${safeClassMap({
|
|
@@ -1113,18 +1274,13 @@ class Combobox extends LitElement {
|
|
|
1113
1274
|
})} .label=${label} .scale=${scale} title=${label ?? nothing} value ${ref(selectedIndicatorChipRef)}>${label}</calcite-chip>`;
|
|
1114
1275
|
}
|
|
1115
1276
|
renderSelectedIndicatorChipCompact() {
|
|
1116
|
-
const { compactSelectionDisplay, selectionDisplay, scale
|
|
1117
|
-
const allSelectedNoDisabled = this.allSelected && !this.hasDisabledItems;
|
|
1118
|
-
const allSelectedWithDisabledSelected = this.allSelected && this.hasDisabledSelected;
|
|
1277
|
+
const { compactSelectionDisplay, selectionDisplay, scale } = this;
|
|
1119
1278
|
let chipInvisible;
|
|
1120
1279
|
let label;
|
|
1280
|
+
const selectedItemsCount = this.getSelectedItems().length;
|
|
1121
1281
|
if (compactSelectionDisplay) {
|
|
1122
|
-
|
|
1123
|
-
if (allSelectedNoDisabled || allSelectedWithDisabledSelected || selectionDisplay === "single" && this.allSelected) {
|
|
1282
|
+
if (this.allSelected) {
|
|
1124
1283
|
chipInvisible = true;
|
|
1125
|
-
} else if (selectionDisplay === "fit") {
|
|
1126
|
-
chipInvisible = !(selectedHiddenChipsCount > 0);
|
|
1127
|
-
label = `${selectedHiddenChipsCount || 0}`;
|
|
1128
1284
|
} else if (selectionDisplay === "single") {
|
|
1129
1285
|
chipInvisible = !(selectedItemsCount > 0);
|
|
1130
1286
|
label = `${selectedItemsCount}`;
|
|
@@ -1153,7 +1309,7 @@ class Combobox extends LitElement {
|
|
|
1153
1309
|
[CSS.inputSingle]: true,
|
|
1154
1310
|
[CSS.inputHidden]: showLabel,
|
|
1155
1311
|
[CSS.inputIcon]: this.showingInlineIcon && !!this.placeholderIcon
|
|
1156
|
-
})} .disabled=${disabled} .id=${`${IDS.input(guid2)}`} @focus=${this.comboboxFocusHandler} @input=${this.inputHandler} placeholder=${placeholder ?? nothing} .readOnly=${this.readOnly} .required=${this.required} role=combobox .tabIndex=${this.activeChipIndex === -1 ? 0 : -1} type=text .value=${live(this.filterText ?? "")} ${ref(this.textInputRef)}>`)}</span>`;
|
|
1312
|
+
})} data-testid=input .disabled=${disabled} .id=${`${IDS.input(guid2)}`} @focus=${this.comboboxFocusHandler} @input=${this.inputHandler} placeholder=${placeholder ?? nothing} .readOnly=${this.readOnly} .required=${this.required} role=combobox .tabIndex=${this.activeChipIndex === -1 ? 0 : -1} type=text .value=${live(this.filterText ?? "")} ${ref(this.textInputRef)}>`)}</span>`;
|
|
1157
1313
|
}
|
|
1158
1314
|
renderListBoxOptions() {
|
|
1159
1315
|
const mappedListBoxOptions = this.keyboardNavItems.map((item) => this.createScreenReaderItem({
|
|
@@ -1182,7 +1338,7 @@ class Combobox extends LitElement {
|
|
|
1182
1338
|
[FloatingCSS.animationActive]: open
|
|
1183
1339
|
};
|
|
1184
1340
|
const label = (this.filterText && messages.add?.replace("{text}", `${this.filterText}`)) ?? "";
|
|
1185
|
-
return html`<div aria-hidden=true class=${safeClassMap(CSS.floatingUIContainer)} popover=manual ${ref(setFloatingEl)}><div class=${safeClassMap(classes)} ${ref(setContainerEl)}><ul class=${safeClassMap({ [CSS.list]: true, [CSS.listHide]: !open })}>${this.selectAllEnabled && this.selectionMode !== "single" && this.selectionMode !== "single-persist" && html`<calcite-combobox-item class=${safeClassMap(CSS.selectAll)} .heading=${messages.selectAll} .id=${`${this.guid}-select-all-enabled-interactive`} .indeterminate=${this.indeterminate} .label=${messages.selectAll} .scale=${scale} .selected=${this.allSelected} tabindex=-1 value=select-all ${ref(this.selectAllComboboxItemRef)}></calcite-combobox-item>` || ""}<slot></slot>${this.noMatchesFound && (this.allowCustomValues ? html`<li aria-label=${label ?? nothing} class=${safeClassMap(CSS.noMatches)} @click=${this.customChipAddHandler} role=option tabindex=0>${highlightText({
|
|
1341
|
+
return html`<div aria-hidden=true class=${safeClassMap(CSS.floatingUIContainer)} popover=manual ${ref(setFloatingEl)}><div class=${safeClassMap(classes)} ${ref(setContainerEl)}><ul class=${safeClassMap({ [CSS.list]: true, [CSS.listHide]: !open })}>${this.selectAllEnabled && this.selectionMode !== "single" && this.selectionMode !== "single-persist" && html`<calcite-combobox-item class=${safeClassMap(CSS.selectAll)} data-testid=select-all-item .heading=${messages.selectAll} .id=${`${this.guid}-select-all-enabled-interactive`} .indeterminate=${this.indeterminate} .label=${messages.selectAll} .scale=${scale} .selected=${this.allSelected} tabindex=-1 value=select-all ${ref(this.selectAllComboboxItemRef)}></calcite-combobox-item>` || ""}<slot></slot>${this.noMatchesFound && (this.allowCustomValues ? html`<li aria-label=${label ?? nothing} class=${safeClassMap(CSS.noMatches)} @click=${this.customChipAddHandler} role=option tabindex=0>${highlightText({
|
|
1186
1342
|
text: label,
|
|
1187
1343
|
pattern: new RegExp(`(${escapeRegExp(this.filterText)})`, "i")
|
|
1188
1344
|
})}</li>` : html`<li class=${safeClassMap({ [CSS.noMatchesPlaceholder]: true, [CSS.noMatches]: true })}>${messages.noMatches}</li>`) || ""}</ul></div></div>`;
|
|
@@ -1207,8 +1363,10 @@ class Combobox extends LitElement {
|
|
|
1207
1363
|
const allSelectionDisplay = selectionDisplay === "all";
|
|
1208
1364
|
const singleSelectionDisplay = selectionDisplay === "single";
|
|
1209
1365
|
const fitSelectionDisplay = !singleSelectionMode && selectionDisplay === "fit";
|
|
1210
|
-
const
|
|
1211
|
-
const
|
|
1366
|
+
const showIndicatorChips = !singleSelectionMode && !allSelectionDisplay;
|
|
1367
|
+
const showSingleIndicatorChips = showIndicatorChips && !fitSelectionDisplay;
|
|
1368
|
+
const hasClearableSelection = this.items.some((item) => item.selected && !item.disabled);
|
|
1369
|
+
const isClearable = !this.clearDisabled && this.selectionMode !== "single-persist" && !!this.value?.length && hasClearableSelection;
|
|
1212
1370
|
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
1371
|
[CSS.wrapper]: true,
|
|
1214
1372
|
[CSS.wrapperSingle]: singleSelectionMode || !this.selectedItems.length,
|
|
@@ -1217,11 +1375,7 @@ class Combobox extends LitElement {
|
|
|
1217
1375
|
[CSS.gridInput]: true,
|
|
1218
1376
|
[CSS.selectionDisplayFit]: fitSelectionDisplay,
|
|
1219
1377
|
[CSS.selectionDisplaySingle]: singleSelectionDisplay
|
|
1220
|
-
})} ${ref(this.setChipContainerEl)}>${!singleSelectionMode && !singleSelectionDisplay && this.renderChips() || ""}${!singleSelectionMode && !singleSelectionDisplay && this.selectAllEnabled && allSelectionDisplay && (
|
|
1221
|
-
this.renderSelectedIndicatorChip(),
|
|
1222
|
-
this.renderSelectedIndicatorChipCompact(),
|
|
1223
|
-
this.renderAllSelectedIndicatorChip()
|
|
1224
|
-
] || ""}<label class=${safeClassMap(CSS.screenReadersOnly)} .htmlFor=${`${IDS.input(guid2)}`} .id=${`${IDS.label(guid2)}`}>${label}</label>${this.renderInput()}</div>`)}${!readOnly && isClearable ? ClearButton({ ariaLabel: this.messages.clear, disabled: this.disabled, ref: this.clearButtonRef, scale: this.scale, title: this.messages.clear }) : null}${!readOnly && this.renderChevronIcon() || ""}</div><ul aria-labelledby=${`${IDS.label(guid2)}`} aria-multiselectable=true class=${safeClassMap(CSS.screenReadersOnly)} .id=${`${IDS.listbox(guid2)}`} role=listbox tabindex=-1>${this.renderListBoxOptions()}</ul>${this.renderFloatingUIContainer()}${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
1378
|
+
})} ${ref(this.setChipContainerEl)}>${!singleSelectionMode && !singleSelectionDisplay && this.renderChips() || ""}${!singleSelectionMode && !singleSelectionDisplay && this.selectAllEnabled && allSelectionDisplay && this.renderAllSelectedIndicatorChip() || ""}${showSingleIndicatorChips && this.renderSelectedIndicatorChip() || ""}${showSingleIndicatorChips && this.renderSelectedIndicatorChipCompact() || ""}${showIndicatorChips && this.renderAllSelectedIndicatorChip() || ""}<label class=${safeClassMap(CSS.screenReadersOnly)} .htmlFor=${`${IDS.input(guid2)}`} .id=${`${IDS.label(guid2)}`}>${label}</label>${this.renderInput()}</div>`)}${!readOnly && isClearable ? ClearButton({ ariaLabel: this.messages.clear, disabled: this.disabled, ref: this.clearButtonRef, scale: this.scale, title: this.messages.clear }) : null}${!readOnly && this.renderChevronIcon() || ""}</div><ul aria-labelledby=${`${IDS.label(guid2)}`} aria-multiselectable=true class=${safeClassMap(CSS.screenReadersOnly)} .id=${`${IDS.listbox(guid2)}`} role=listbox tabindex=-1>${this.renderListBoxOptions()}</ul>${this.renderFloatingUIContainer()}${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
1225
1379
|
}
|
|
1226
1380
|
}
|
|
1227
1381
|
customElement("calcite-combobox", Combobox);
|