@esri/calcite-components 6.0.0-next.23 → 6.0.0-next.25
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/{LE4XAY62.js → 24X2HHFL.js} +1 -1
- package/dist/cdn/2FTZ3O5Y.js +2 -0
- package/dist/cdn/2HWT5SFS.js +2 -0
- package/dist/cdn/{WIYWU67R.js → 2MMQHRSO.js} +1 -1
- package/dist/cdn/{NTCYR54O.js → 2OPTI7DM.js} +1 -1
- package/dist/cdn/{ND4AQF37.js → 2Q3LQWBY.js} +1 -1
- package/dist/cdn/{HN3F362O.js → 2VO6QWHK.js} +1 -1
- package/dist/cdn/2VVANUBK.js +2 -0
- package/dist/cdn/3JY7VQED.js +2 -0
- package/dist/cdn/{PVAZKAVN.js → 3MSYHFOJ.js} +1 -1
- package/dist/cdn/3UQXG57G.js +2 -0
- package/dist/cdn/{Y4EGMODW.js → 3WUL3D3Q.js} +1 -1
- package/dist/cdn/3XB2SJ24.js +2 -0
- package/dist/cdn/{36TVFMZ2.js → 3YMGHYHG.js} +1 -1
- package/dist/cdn/42H5PGCQ.js +2 -0
- package/dist/cdn/4F5FOGY7.js +2 -0
- package/dist/cdn/4IEEOYVA.js +2 -0
- package/dist/cdn/4KUT3SQG.js +2 -0
- package/dist/cdn/52HNVKZH.js +2 -0
- package/dist/cdn/56BPQEBR.js +2 -0
- package/dist/cdn/5DM43O3V.js +2 -0
- package/dist/cdn/{ZVR7MIG2.js → 5EQTYPWY.js} +1 -1
- package/dist/cdn/{GF44QNGR.js → 5TNTX4IP.js} +1 -1
- package/dist/cdn/{HWZRFEOT.js → 5TQPXISD.js} +1 -1
- package/dist/cdn/{4IFGZ472.js → 5XCXOSWL.js} +1 -1
- package/dist/cdn/{XSXP45C6.js → 65M23I26.js} +1 -1
- package/dist/cdn/6KEKFFMN.js +2 -0
- package/dist/cdn/{MM4MYL2C.js → 6TKCW6Y6.js} +1 -1
- package/dist/cdn/{GCBI2B23.js → 6ZA3MV5M.js} +1 -1
- package/dist/cdn/7DMKCZ7U.js +2 -0
- package/dist/cdn/7GLVPVS5.js +2 -0
- package/dist/cdn/{TMJLAWB7.js → 7TYT2ZSG.js} +1 -1
- package/dist/cdn/{LH7PTR4P.js → 7X4HKAV4.js} +1 -1
- package/dist/cdn/{OIW66NWY.js → 7XQVNF6L.js} +1 -1
- package/dist/cdn/A4QFGFF5.js +2 -0
- package/dist/cdn/A52YDTZ6.js +2 -0
- package/dist/cdn/{HJBVATIW.js → AQQLVGAO.js} +1 -1
- package/dist/cdn/{WPIUNHO2.js → AYPJVTAP.js} +1 -1
- package/dist/cdn/B6UNMY4X.js +2 -0
- package/dist/cdn/BA26VMOD.js +2 -0
- package/dist/cdn/{64X5RASH.js → BPQITHOF.js} +1 -1
- package/dist/cdn/{P7BKWCKS.js → BXKVEQPR.js} +1 -1
- package/dist/cdn/{FHJSNGVE.js → CFJUDT7H.js} +1 -1
- package/dist/cdn/{5VUNVKYE.js → CGDDFFL3.js} +1 -1
- package/dist/cdn/{F3VMM64Y.js → CNNZUX2A.js} +1 -1
- package/dist/cdn/CXXKYFZ2.js +2 -0
- package/dist/cdn/EU6YN6WI.js +2 -0
- package/dist/cdn/F56EQIFE.js +2 -0
- package/dist/cdn/FCO4XPEO.js +2 -0
- package/dist/cdn/{HKXJXU7S.js → FQF5KOVN.js} +1 -1
- package/dist/cdn/FVZC2NPE.js +2 -0
- package/dist/cdn/G3ZSNARG.js +2 -0
- package/dist/cdn/GAIVXZ2M.js +2 -0
- package/dist/cdn/{TNJZQWZY.js → GGFW5RDL.js} +1 -1
- package/dist/cdn/{JOYCUDXN.js → GVHFHBNY.js} +1 -1
- package/dist/cdn/{NXW3DKGZ.js → HBNKGFSC.js} +1 -1
- package/dist/cdn/{SZCBKSZH.js → HMJNZHVV.js} +1 -1
- package/dist/cdn/{D65XY45A.js → HN76DYF7.js} +1 -1
- package/dist/cdn/{DD2TPVON.js → HNNEJQ35.js} +1 -1
- package/dist/cdn/{LQIAZTUY.js → HSOPTC2N.js} +1 -1
- package/dist/cdn/{KBPKOHKQ.js → I4L2AE24.js} +1 -1
- package/dist/cdn/IAIH6NNP.js +2 -0
- package/dist/cdn/{VCREVPYB.js → IFLMRWAR.js} +1 -1
- package/dist/cdn/ISOKTYOI.js +2 -0
- package/dist/cdn/JOG5PNOA.js +2 -0
- package/dist/cdn/{2GHAQGBJ.js → JYSJNURC.js} +1 -1
- package/dist/cdn/{OHC6ZI2I.js → K2CUTBE3.js} +1 -1
- package/dist/cdn/KAWIRTEH.js +2 -0
- package/dist/cdn/{MYN7STXS.js → KKTKG6RU.js} +1 -1
- package/dist/cdn/{USUQ23K2.js → KLSBECY5.js} +1 -1
- package/dist/cdn/{2SHFZFC4.js → KNALNVSF.js} +1 -1
- package/dist/cdn/{IWJWPQVK.js → KPE44ZHJ.js} +1 -1
- package/dist/cdn/LEEJW4WV.js +2 -0
- package/dist/cdn/{ZLRW2HKU.js → LMQ6DASS.js} +1 -1
- package/dist/cdn/{2WTWLYON.js → LQK2IQ5N.js} +1 -1
- package/dist/cdn/{EBN7HY2V.js → LRVMZJZZ.js} +1 -1
- package/dist/cdn/{AG4OXXM5.js → LUH5KJFS.js} +1 -1
- package/dist/cdn/{LQZ4IQ7E.js → M2QF4XY7.js} +1 -1
- package/dist/cdn/M5NZ7QW6.js +2 -0
- package/dist/cdn/M7NP2F3X.js +2 -0
- package/dist/cdn/{K4DIWVOI.js → M7WETBBT.js} +1 -1
- package/dist/cdn/{6FCZ7O75.js → MEYWLBXH.js} +1 -1
- package/dist/cdn/MJMYXMSS.js +2 -0
- package/dist/cdn/{KNIC7DPX.js → MSVKJ6XU.js} +1 -1
- package/dist/cdn/{O5BJMGAU.js → MZNTLOT7.js} +1 -1
- package/dist/cdn/{6D42D4BU.js → NETTU2AP.js} +1 -1
- package/dist/cdn/NJFM3V6R.js +2 -0
- package/dist/cdn/NNIKOXDF.js +2 -0
- package/dist/cdn/{ROCB5ZZM.js → NQY5HZEC.js} +1 -1
- package/dist/cdn/{YZLHZ3FX.js → NSFC4QLG.js} +1 -1
- package/dist/cdn/NXWGQPCQ.js +2 -0
- package/dist/cdn/OCHSY6ZY.js +2 -0
- package/dist/cdn/{U2TW6JQM.js → OG7EHBNH.js} +1 -1
- package/dist/cdn/{ZLROXMNB.js → OGN5NQTK.js} +1 -1
- package/dist/cdn/OTEUDIDR.js +2 -0
- package/dist/cdn/{JIFMZGBO.js → P3IXFQZH.js} +1 -1
- package/dist/cdn/P6PXMBLM.js +2 -0
- package/dist/cdn/{PAPN4MGG.js → PEP3OAKB.js} +1 -1
- package/dist/cdn/{CSVF7NXU.js → PO7NUJYU.js} +1 -1
- package/dist/cdn/QGAHANJF.js +2 -0
- package/dist/cdn/QMSFV4DC.js +2 -0
- package/dist/cdn/{IRIVULD3.js → QURHYRAL.js} +1 -1
- package/dist/cdn/QYGAMD7I.js +2 -0
- package/dist/cdn/{POBLJC25.js → RGQ27QXZ.js} +1 -1
- package/dist/cdn/ROD4F5SG.js +2 -0
- package/dist/cdn/RQFVWNFJ.js +2 -0
- package/dist/cdn/RRBGCYLX.js +2 -0
- package/dist/cdn/S354ORFF.js +2 -0
- package/dist/cdn/S6D5JMP5.js +2 -0
- package/dist/cdn/{MSPXUC2U.js → SBBTNOZ7.js} +1 -1
- package/dist/cdn/SOOTE5HZ.js +2 -0
- package/dist/cdn/{3BYOCG65.js → SP7DCKBX.js} +1 -1
- package/dist/cdn/{CVZ2ONIH.js → SU35BD5D.js} +1 -1
- package/dist/cdn/{R52X4VPL.js → SVBXBU4Y.js} +1 -1
- package/dist/cdn/{4WWUXGLG.js → TGPCTLAR.js} +1 -1
- package/dist/cdn/TGWHDNDE.js +2 -0
- package/dist/cdn/TL6APYKB.js +2 -0
- package/dist/cdn/{IEMKFMPR.js → TT5GOLXX.js} +1 -1
- package/dist/cdn/{QUT7DCUL.js → TV3ASB45.js} +1 -1
- package/dist/cdn/{ZQD5SQLO.js → TV4JPEDN.js} +1 -1
- package/dist/cdn/TXBKWV4W.js +2 -0
- package/dist/cdn/TYA262ZQ.js +2 -0
- package/dist/cdn/U36R2PAA.js +2 -0
- package/dist/cdn/U7MLKSGR.js +2 -0
- package/dist/cdn/UP24SIUC.js +2 -0
- package/dist/cdn/{U6ILPLLQ.js → UYZRIEJ7.js} +1 -1
- package/dist/cdn/VGLVE6YX.js +2 -0
- package/dist/cdn/{4KTTEUCX.js → VTRSI4YB.js} +1 -1
- package/dist/cdn/VYU77KVV.js +2 -0
- package/dist/cdn/{RIHMS3V2.js → W4F25ICX.js} +1 -1
- package/dist/cdn/{P6LG3KEY.js → W6QZRTC6.js} +1 -1
- package/dist/cdn/{KW3QT5FB.js → W6RBIAP2.js} +1 -1
- package/dist/cdn/WLVTSN52.js +2 -0
- package/dist/cdn/WSS3PNJH.js +2 -0
- package/dist/cdn/WZN6A6R6.js +2 -0
- package/dist/cdn/{GJEFB3M5.js → X325XBCW.js} +1 -1
- package/dist/cdn/XZ2R3TJN.js +2 -0
- package/dist/cdn/{ORFENRJN.js → Y2DB43CD.js} +1 -1
- package/dist/cdn/{3CLMXCDN.js → YNSTNJES.js} +1 -1
- package/dist/cdn/ZLCBVEV3.js +2 -0
- package/dist/cdn/assets/icon/filterX16.json +1 -0
- package/dist/cdn/assets/icon/filterX24.json +1 -0
- package/dist/cdn/assets/icon/filterX32.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/dom.js +30 -19
- package/dist/chunks/header.js +1 -1
- package/dist/chunks/manager.js +13 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/sortable.js +1 -1
- package/dist/chunks/useFocusable.js +25 -2
- package/dist/chunks/useForm.js +1 -1
- package/dist/components/calcite-accordion-item/customElement.js +1 -1
- package/dist/components/calcite-action/customElement.js +2 -2
- package/dist/components/calcite-action-bar/customElement.js +2 -2
- package/dist/components/calcite-action-group/customElement.js +2 -2
- package/dist/components/calcite-action-menu/customElement.js +2 -2
- package/dist/components/calcite-alert/customElement.js +2 -2
- package/dist/components/calcite-autocomplete/customElement.js +3 -3
- package/dist/components/calcite-autocomplete-item/customElement.js +1 -1
- package/dist/components/calcite-autocomplete-item-group/customElement.js +1 -1
- package/dist/components/calcite-block/customElement.js +3 -3
- package/dist/components/calcite-block-group/customElement.js +3 -3
- package/dist/components/calcite-block-section/customElement.js +1 -1
- package/dist/components/calcite-button/customElement.js +3 -3
- package/dist/components/calcite-card/customElement.js +2 -2
- package/dist/components/calcite-card-group/customElement.js +3 -3
- package/dist/components/calcite-carousel/customElement.js +3 -3
- package/dist/components/calcite-checkbox/customElement.js +2 -2
- package/dist/components/calcite-chip/customElement.js +2 -2
- package/dist/components/calcite-chip-group/customElement.js +3 -3
- package/dist/components/calcite-color-picker/customElement.js +3 -3
- package/dist/components/calcite-color-picker-hex-input/customElement.js +2 -2
- package/dist/components/calcite-combobox/customElement.js +3 -3
- package/dist/components/calcite-combobox-item/customElement.js +2 -2
- package/dist/components/calcite-date-picker/customElement.js +1 -1
- package/dist/components/calcite-date-picker-day/customElement.js +2 -2
- package/dist/components/calcite-date-picker-month-header/customElement.js +1 -1
- package/dist/components/calcite-dialog/customElement.js +2 -2
- package/dist/components/calcite-dropdown/customElement.js +378 -103
- package/dist/components/calcite-dropdown-item/customElement.d.ts +1 -0
- package/dist/components/calcite-dropdown-item/customElement.js +13 -9
- package/dist/components/calcite-fab/customElement.js +2 -2
- package/dist/components/calcite-filter/customElement.js +2 -2
- package/dist/components/calcite-flow/customElement.js +2 -2
- package/dist/components/calcite-flow-item/customElement.js +1 -1
- package/dist/components/calcite-inline-editable/customElement.js +3 -3
- package/dist/components/calcite-input/customElement.js +3 -3
- package/dist/components/calcite-input-date-picker/customElement.js +2 -2
- package/dist/components/calcite-input-message/customElement.js +1 -1
- package/dist/components/calcite-input-number/customElement.js +3 -3
- package/dist/components/calcite-input-text/customElement.js +3 -3
- package/dist/components/calcite-input-time-picker/customElement.js +2 -2
- package/dist/components/calcite-input-time-zone/customElement.js +2 -2
- package/dist/components/calcite-link/customElement.js +2 -2
- package/dist/components/calcite-list/customElement.d.ts +1 -2
- package/dist/components/calcite-list/customElement.js +3 -3
- package/dist/components/calcite-list-item/customElement.d.ts +11 -1
- package/dist/components/calcite-list-item/customElement.js +3 -3
- package/dist/components/calcite-list-item-group/customElement.js +1 -1
- package/dist/components/calcite-menu/customElement.js +2 -2
- package/dist/components/calcite-menu-item/customElement.js +2 -2
- package/dist/components/calcite-meter/customElement.js +1 -1
- package/dist/components/calcite-navigation/customElement.js +1 -1
- package/dist/components/calcite-navigation-logo/customElement.js +1 -1
- package/dist/components/calcite-navigation-user/customElement.js +1 -1
- package/dist/components/calcite-notice/customElement.js +2 -2
- package/dist/components/calcite-pagination/customElement.js +1 -1
- package/dist/components/calcite-panel/customElement.js +3 -3
- package/dist/components/calcite-popover/customElement.js +2 -2
- package/dist/components/calcite-radio-button/customElement.js +2 -2
- package/dist/components/calcite-radio-button-group/customElement.js +1 -1
- package/dist/components/calcite-rating/customElement.js +2 -2
- package/dist/components/calcite-scrim/customElement.js +1 -1
- package/dist/components/calcite-segmented-control/customElement.js +3 -3
- package/dist/components/calcite-segmented-control-item/customElement.js +1 -1
- package/dist/components/calcite-select/customElement.js +2 -2
- package/dist/components/calcite-sheet/customElement.js +2 -2
- package/dist/components/calcite-shell/customElement.js +1 -1
- package/dist/components/calcite-shell-panel/customElement.js +1 -1
- package/dist/components/calcite-slider/customElement.js +3 -3
- package/dist/components/calcite-sort-handle/customElement.js +2 -2
- package/dist/components/calcite-split-button/customElement.js +2 -2
- package/dist/components/calcite-stack/customElement.js +1 -1
- package/dist/components/calcite-stepper/customElement.js +1 -1
- package/dist/components/calcite-stepper-item/customElement.js +3 -3
- package/dist/components/calcite-swatch/customElement.js +1 -1
- package/dist/components/calcite-swatch-group/customElement.js +3 -3
- package/dist/components/calcite-switch/customElement.js +2 -2
- package/dist/components/calcite-tab-nav/customElement.js +1 -1
- package/dist/components/calcite-tab-title/customElement.js +1 -1
- package/dist/components/calcite-table-cell/customElement.js +2 -2
- package/dist/components/calcite-table-header/customElement.js +1 -1
- package/dist/components/calcite-table-row/customElement.js +2 -2
- package/dist/components/calcite-tabs/customElement.js +1 -1
- package/dist/components/calcite-text/customElement.js +7 -7
- package/dist/components/calcite-text-area/customElement.js +2 -2
- package/dist/components/calcite-tile/customElement.js +2 -2
- package/dist/components/calcite-tile-group/customElement.js +2 -2
- package/dist/components/calcite-time-picker/customElement.js +1 -1
- package/dist/components/calcite-tooltip/customElement.js +1 -1
- package/dist/components/calcite-tree/customElement.js +1 -1
- package/dist/components/calcite-tree-item/customElement.js +2 -2
- 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/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +2 -2
- package/dist/cdn/27KHPANF.js +0 -2
- package/dist/cdn/2Q4MR4LB.js +0 -2
- package/dist/cdn/2Q6A3OGW.js +0 -2
- package/dist/cdn/5M6OCVQ5.js +0 -2
- package/dist/cdn/6DRFMMAS.js +0 -2
- package/dist/cdn/6LXVWCKH.js +0 -2
- package/dist/cdn/6RXH7PI6.js +0 -2
- package/dist/cdn/72QP3F6U.js +0 -2
- package/dist/cdn/77GDZ2YC.js +0 -2
- package/dist/cdn/7DPOZ5VU.js +0 -2
- package/dist/cdn/7XM4TQ4T.js +0 -2
- package/dist/cdn/A4YMFDZA.js +0 -2
- package/dist/cdn/A5A4IM7C.js +0 -2
- package/dist/cdn/AB5QOMEP.js +0 -2
- package/dist/cdn/AI7RD3EE.js +0 -2
- package/dist/cdn/B35WZADV.js +0 -2
- package/dist/cdn/B6IAHLUU.js +0 -2
- package/dist/cdn/CDNN2EBQ.js +0 -2
- package/dist/cdn/CUEYKB6A.js +0 -2
- package/dist/cdn/D5Z54YHG.js +0 -2
- package/dist/cdn/DJQUQXEC.js +0 -2
- package/dist/cdn/DOOAI4XA.js +0 -2
- package/dist/cdn/DU6NT7EA.js +0 -2
- package/dist/cdn/E2D5QII3.js +0 -2
- package/dist/cdn/ESM3WMGC.js +0 -2
- package/dist/cdn/F2VMBBYG.js +0 -2
- package/dist/cdn/G4SOANDF.js +0 -2
- package/dist/cdn/HJK5MV5Y.js +0 -2
- package/dist/cdn/HXZGBNJV.js +0 -2
- package/dist/cdn/IH3II2CX.js +0 -2
- package/dist/cdn/IN2P3T5D.js +0 -2
- package/dist/cdn/IROPVRR6.js +0 -2
- package/dist/cdn/IYMDDB55.js +0 -2
- package/dist/cdn/J3XD7MNX.js +0 -2
- package/dist/cdn/JCBUEZL4.js +0 -2
- package/dist/cdn/JCZE7J2Z.js +0 -2
- package/dist/cdn/KDH35JXO.js +0 -2
- package/dist/cdn/KNUXB3PZ.js +0 -2
- package/dist/cdn/KVTFU23W.js +0 -2
- package/dist/cdn/L7YMR357.js +0 -2
- package/dist/cdn/MDQO2UDR.js +0 -2
- package/dist/cdn/MVF3NU4Z.js +0 -2
- package/dist/cdn/NWHQYG6E.js +0 -2
- package/dist/cdn/OH5S23TJ.js +0 -2
- package/dist/cdn/OJM2DPFA.js +0 -2
- package/dist/cdn/PDYEZ5SY.js +0 -2
- package/dist/cdn/PI4W7EKO.js +0 -2
- package/dist/cdn/Q2KTXRMZ.js +0 -2
- package/dist/cdn/Q3TBBRNQ.js +0 -2
- package/dist/cdn/QHGVDAPM.js +0 -2
- package/dist/cdn/QU46WREB.js +0 -2
- package/dist/cdn/R5RU66Y3.js +0 -2
- package/dist/cdn/R7DFCT6L.js +0 -2
- package/dist/cdn/REUDPL2D.js +0 -2
- package/dist/cdn/SHHQJMGY.js +0 -2
- package/dist/cdn/WTRIYWDM.js +0 -2
- package/dist/cdn/WUMYNFMA.js +0 -2
- package/dist/cdn/WUUQP4W4.js +0 -2
- package/dist/cdn/WY67LJWF.js +0 -2
- package/dist/cdn/WYTRIRU5.js +0 -2
- package/dist/cdn/XD5D4DJI.js +0 -2
- package/dist/cdn/XHL7IFYU.js +0 -2
- package/dist/cdn/XYWXH6EF.js +0 -2
- package/dist/cdn/Z6BFALSQ.js +0 -2
- package/dist/components/calcite-list/resources.d.ts +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
2
|
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
+
import { ref } from "lit/directives/ref.js";
|
|
3
4
|
import { css, html } from "lit";
|
|
4
|
-
import { createRef, ref } from "lit/directives/ref.js";
|
|
5
5
|
import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
|
|
6
|
-
import { useDirection } from "@arcgis/lumina/controllers";
|
|
7
|
-
import {
|
|
6
|
+
import { makeGenericController, useDirection } from "@arcgis/lumina/controllers";
|
|
7
|
+
import { a as getRootNode, t as tabbableOptions, E as isFocusableElement, F as nextFrame } from "../../chunks/dom.js";
|
|
8
8
|
import { a as defaultMenuPlacement, r as reposition, c as connectFloatingUI, b as disconnectFloatingUI, f as filterValidFlipPlacements, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
|
|
9
9
|
import { i as isActivationKey } from "../../chunks/key.js";
|
|
10
10
|
import { c as createObserver, u as updateRefObserver } from "../../chunks/observers.js";
|
|
@@ -12,9 +12,236 @@ import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
|
|
|
12
12
|
import { g as getDimensionClass } from "../../chunks/dynamicClasses.js";
|
|
13
13
|
import { i as isDropdownGroup } from "../../chunks/resources17.js";
|
|
14
14
|
import { u as useFocusable } from "../../chunks/useFocusable.js";
|
|
15
|
+
import { tabbable } from "tabbable";
|
|
15
16
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
16
17
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
17
18
|
import { u as useReferenceElement, r as referenceElementManager } from "../../chunks/manager.js";
|
|
19
|
+
const managedTabIndexes = /* @__PURE__ */ new WeakMap();
|
|
20
|
+
function getTabbableEntryElements(entryElement, focusableElements) {
|
|
21
|
+
if (!entryElement) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const tabbableElements = tabbable(entryElement, { ...tabbableOptions, includeContainer: true }).filter(
|
|
25
|
+
isFocusableElement
|
|
26
|
+
);
|
|
27
|
+
tabbableElements.push(
|
|
28
|
+
...focusableElements.filter((element) => (managedTabIndexes.get(element)?.tabIndex ?? -1) >= 0)
|
|
29
|
+
);
|
|
30
|
+
if (isFocusableElement(entryElement) && entryElement.tabIndex >= 0) {
|
|
31
|
+
tabbableElements.push(entryElement);
|
|
32
|
+
}
|
|
33
|
+
return [...new Set(tabbableElements)];
|
|
34
|
+
}
|
|
35
|
+
const useRovingTabIndex = (options = {}) => makeGenericController((component, controller) => {
|
|
36
|
+
const focusable = useFocusable()(component);
|
|
37
|
+
const trackedElements = /* @__PURE__ */ new Set();
|
|
38
|
+
let itemElements = [];
|
|
39
|
+
let activeElement = null;
|
|
40
|
+
let activeIndex = -1;
|
|
41
|
+
let entryTabStops = [];
|
|
42
|
+
let entryFocusTarget;
|
|
43
|
+
let isRestoringFocus = false;
|
|
44
|
+
let focusedItem;
|
|
45
|
+
let itemFocusOutTarget = null;
|
|
46
|
+
const focusEventsFromItems = /* @__PURE__ */ new WeakSet();
|
|
47
|
+
function getTraversableElements() {
|
|
48
|
+
return options.getTraversableElements?.() ?? options.getElements?.() ?? itemElements;
|
|
49
|
+
}
|
|
50
|
+
function restoreElement(element) {
|
|
51
|
+
const managedTabIndex = managedTabIndexes.get(element);
|
|
52
|
+
if (!managedTabIndex || !trackedElements.delete(element)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
managedTabIndex.referenceCount--;
|
|
56
|
+
if (managedTabIndex.referenceCount > 0) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (managedTabIndex.attribute === null) {
|
|
60
|
+
element.removeAttribute("tabindex");
|
|
61
|
+
} else {
|
|
62
|
+
element.setAttribute("tabindex", managedTabIndex.attribute);
|
|
63
|
+
}
|
|
64
|
+
managedTabIndexes.delete(element);
|
|
65
|
+
}
|
|
66
|
+
function handleFocusIn(event) {
|
|
67
|
+
const elements = getTraversableElements();
|
|
68
|
+
const path = event.composedPath();
|
|
69
|
+
const item = elements.find((element) => path.includes(element));
|
|
70
|
+
if (item) {
|
|
71
|
+
focusedItem = item;
|
|
72
|
+
rovingTabIndex.setActiveIndex(elements.indexOf(item));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
function handleFocusOut(event) {
|
|
76
|
+
const path = event.composedPath();
|
|
77
|
+
if (!itemElements.some((element) => path.includes(element))) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const relatedTarget = event.relatedTarget;
|
|
81
|
+
itemFocusOutTarget = relatedTarget;
|
|
82
|
+
if (relatedTarget instanceof Node && getTraversableElements().some((element) => element.contains(relatedTarget))) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (relatedTarget instanceof Element) {
|
|
86
|
+
focusedItem = void 0;
|
|
87
|
+
} else if (focusedItem) {
|
|
88
|
+
const previousFocusedItem = focusedItem;
|
|
89
|
+
queueMicrotask(() => {
|
|
90
|
+
if (focusedItem === previousFocusedItem && previousFocusedItem.isConnected && !previousFocusedItem.matches(":focus-within") && getTraversableElements().includes(previousFocusedItem)) {
|
|
91
|
+
focusedItem = void 0;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
controller.onLoaded(() => {
|
|
97
|
+
component.listenOn(component.renderRoot, "focusin", handleFocusIn);
|
|
98
|
+
component.listenOn(component.renderRoot, "focusout", handleFocusOut, { capture: true });
|
|
99
|
+
});
|
|
100
|
+
component.listenOn(
|
|
101
|
+
component.el.ownerDocument,
|
|
102
|
+
"focusin",
|
|
103
|
+
(event) => {
|
|
104
|
+
if (!focusedItem && !itemFocusOutTarget) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const path = event.composedPath();
|
|
108
|
+
if (itemFocusOutTarget && path.includes(itemFocusOutTarget)) {
|
|
109
|
+
focusEventsFromItems.add(event);
|
|
110
|
+
}
|
|
111
|
+
itemFocusOutTarget = null;
|
|
112
|
+
if (focusedItem && !path.includes(focusedItem)) {
|
|
113
|
+
focusedItem = void 0;
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{ capture: true }
|
|
117
|
+
);
|
|
118
|
+
controller.onDisconnected(() => {
|
|
119
|
+
focusedItem = void 0;
|
|
120
|
+
itemFocusOutTarget = null;
|
|
121
|
+
trackedElements.forEach(restoreElement);
|
|
122
|
+
});
|
|
123
|
+
const rovingTabIndex = {
|
|
124
|
+
get activeElement() {
|
|
125
|
+
return activeElement;
|
|
126
|
+
},
|
|
127
|
+
get activeIndex() {
|
|
128
|
+
return activeIndex;
|
|
129
|
+
},
|
|
130
|
+
get hasFocus() {
|
|
131
|
+
return focusable.hasFocus || (options.getEntryElement?.()?.matches(":focus-within") ?? false);
|
|
132
|
+
},
|
|
133
|
+
isFocusFromItem(event) {
|
|
134
|
+
return focusEventsFromItems.has(event);
|
|
135
|
+
},
|
|
136
|
+
get isRestoringFocus() {
|
|
137
|
+
return isRestoringFocus;
|
|
138
|
+
},
|
|
139
|
+
get shouldRecoverFocus() {
|
|
140
|
+
if (!focusedItem) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
const rootNode = getRootNode(component.el);
|
|
144
|
+
const focusWasLost = component.el.ownerDocument.activeElement === component.el.ownerDocument.body || rootNode instanceof ShadowRoot && !rootNode.activeElement && rootNode.host.matches(":focus-within");
|
|
145
|
+
if (!focusWasLost && !focusedItem.matches(":focus-within")) {
|
|
146
|
+
focusedItem = void 0;
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
return !focusedItem.isConnected || !getTraversableElements().includes(focusedItem);
|
|
150
|
+
},
|
|
151
|
+
update(elements, nextActiveElement) {
|
|
152
|
+
const entryElement = options.getEntryElement?.();
|
|
153
|
+
entryTabStops.forEach(restoreElement);
|
|
154
|
+
const entryFocusCandidates = focusable.getFocusableElements(entryElement);
|
|
155
|
+
const nextEntryTabStops = getTabbableEntryElements(entryElement, entryFocusCandidates);
|
|
156
|
+
const managedEntryTabStops = nextEntryTabStops.length > 0 ? nextEntryTabStops : entryTabStops.filter((element) => element.isConnected && entryElement?.contains(element));
|
|
157
|
+
itemElements = elements;
|
|
158
|
+
const traversableElements = options.getTraversableElements?.() ?? elements;
|
|
159
|
+
activeIndex = nextActiveElement && options.isActive?.() !== false && elements.includes(nextActiveElement) ? traversableElements.indexOf(nextActiveElement) : -1;
|
|
160
|
+
activeElement = activeIndex >= 0 ? nextActiveElement : null;
|
|
161
|
+
const focusedElement = focusable.getDeepActiveElement();
|
|
162
|
+
entryFocusTarget = entryFocusCandidates.find((element) => element === focusedElement) ?? (entryFocusTarget && entryFocusCandidates.includes(entryFocusTarget) ? entryFocusTarget : entryFocusCandidates[0]);
|
|
163
|
+
entryTabStops = managedEntryTabStops;
|
|
164
|
+
const managedElements = activeElement ? [...elements, ...entryTabStops] : elements;
|
|
165
|
+
const currentElements = new Set(managedElements);
|
|
166
|
+
trackedElements.forEach((element) => {
|
|
167
|
+
if (!currentElements.has(element)) {
|
|
168
|
+
restoreElement(element);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
managedElements.forEach((element) => {
|
|
172
|
+
if (!trackedElements.has(element)) {
|
|
173
|
+
const managedTabIndex = managedTabIndexes.get(element);
|
|
174
|
+
if (managedTabIndex) {
|
|
175
|
+
managedTabIndex.referenceCount++;
|
|
176
|
+
} else {
|
|
177
|
+
managedTabIndexes.set(element, {
|
|
178
|
+
attribute: element.getAttribute("tabindex"),
|
|
179
|
+
tabIndex: element.tabIndex,
|
|
180
|
+
referenceCount: 1
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
trackedElements.add(element);
|
|
184
|
+
}
|
|
185
|
+
const tabIndex = element === activeElement ? 0 : -1;
|
|
186
|
+
if (element.getAttribute("tabindex") !== String(tabIndex)) {
|
|
187
|
+
element.tabIndex = tabIndex;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
setActiveIndex(index) {
|
|
192
|
+
const elements = options.getElements?.() ?? itemElements;
|
|
193
|
+
const traversableElements = options.getTraversableElements?.() ?? elements;
|
|
194
|
+
const nextActiveElement = index >= 0 ? traversableElements[index] ?? null : null;
|
|
195
|
+
rovingTabIndex.update(elements, nextActiveElement);
|
|
196
|
+
},
|
|
197
|
+
navigate(direction) {
|
|
198
|
+
const traversableElements = getTraversableElements();
|
|
199
|
+
const totalElements = traversableElements.length;
|
|
200
|
+
if (!totalElements) {
|
|
201
|
+
rovingTabIndex.setActiveIndex(-1);
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
let index = activeIndex;
|
|
205
|
+
if (index < 0 || index >= totalElements) {
|
|
206
|
+
index = direction === "previous" || direction === "last" ? totalElements - 1 : 0;
|
|
207
|
+
} else if (direction === "next") {
|
|
208
|
+
index = (index + 1) % totalElements;
|
|
209
|
+
} else if (direction === "previous") {
|
|
210
|
+
index = (index - 1 + totalElements) % totalElements;
|
|
211
|
+
} else if (direction === "first") {
|
|
212
|
+
index = 0;
|
|
213
|
+
} else if (direction === "last") {
|
|
214
|
+
index = totalElements - 1;
|
|
215
|
+
}
|
|
216
|
+
rovingTabIndex.update(options.getElements?.() ?? itemElements, traversableElements[index]);
|
|
217
|
+
return activeElement;
|
|
218
|
+
},
|
|
219
|
+
reconcile() {
|
|
220
|
+
const traversableElements = getTraversableElements();
|
|
221
|
+
const previousIndex = activeElement ? traversableElements.indexOf(activeElement) : -1;
|
|
222
|
+
const preservedIndex = previousIndex >= 0 ? previousIndex : traversableElements.findIndex((element) => element.matches(":focus-within"));
|
|
223
|
+
rovingTabIndex.setActiveIndex(
|
|
224
|
+
preservedIndex >= 0 ? preservedIndex : Math.min(Math.max(activeIndex, 0), traversableElements.length - 1)
|
|
225
|
+
);
|
|
226
|
+
return activeElement;
|
|
227
|
+
},
|
|
228
|
+
restoreFocus(mode = "within") {
|
|
229
|
+
const focusIsWithinManagedControls = itemElements.some(focusable.isFocusedWithin) || entryTabStops.some(focusable.isFocusedWithin) || entryFocusTarget !== void 0 && focusable.isFocusedWithin(entryFocusTarget);
|
|
230
|
+
const shouldRestoreFocus = mode === "force" || focusIsWithinManagedControls || mode === "recover" && rovingTabIndex.shouldRecoverFocus;
|
|
231
|
+
if (!shouldRestoreFocus || !entryFocusTarget || !entryFocusTarget.isConnected) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
isRestoringFocus = true;
|
|
235
|
+
try {
|
|
236
|
+
entryFocusTarget.focus();
|
|
237
|
+
focusedItem = void 0;
|
|
238
|
+
} finally {
|
|
239
|
+
isRestoringFocus = false;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
return rovingTabIndex;
|
|
244
|
+
});
|
|
18
245
|
const SLOTS = {
|
|
19
246
|
trigger: "trigger"
|
|
20
247
|
};
|
|
@@ -23,7 +250,7 @@ const CSS = {
|
|
|
23
250
|
wrapper: "wrapper",
|
|
24
251
|
triggerContainer: "trigger-container"
|
|
25
252
|
};
|
|
26
|
-
const styles = css`:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none
|
|
253
|
+
const styles = css`:host([disabled]){opacity:var(--calcite-opacity-disabled);cursor:default;-webkit-user-select:none;user-select:none}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:inline-block}.wrapper{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.wrapper{opacity:0;inset-block-start:0;left:0}}:host([top-layer-disabled]) .wrapper{--calcite-floating-ui-z-index: var(--calcite-z-index-dropdown)}.wrapper[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.wrapper:popover-open{display:block}.wrapper .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;border-radius:var(--calcite-corner-radius-sm);z-index:var(--calcite-z-index)}.wrapper[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.wrapper[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.wrapper[data-placement^=left] .calcite-floating-ui-anim{left:5px}.wrapper[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.wrapper .calcite-floating-ui-anim{box-shadow:var(--calcite-shadow-md)}.content{overflow-y:auto;overflow-x:hidden;inline-size:var(--calcite-dropdown-width, var(--calcite-internal-dropdown-width));background-color:var(--calcite-dropdown-background-color, var(--calcite-theme-color-surface-2, var(--calcite-color-foreground-1)));max-block-size:var(--calcite-dropdown-max-height, 45vh)}.trigger-container{position:relative;display:flex;flex:1 1 auto;block-size:100%;overflow-wrap:break-word;word-break:break-word}.width-s{--calcite-internal-dropdown-width: 12rem}.width-m{--calcite-internal-dropdown-width: 14rem}.width-l{--calcite-internal-dropdown-width: 16rem}@media(forced-colors:active){:host([open]) .wrapper{border:var(--calcite-border-width-sm) solid canvasText}}:host([hidden]){display:none}[hidden]{display:none}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:var(--calcite-opacity-full)}.interaction-container{display:contents}`;
|
|
27
254
|
const manager = referenceElementManager({ click: true, hover: true });
|
|
28
255
|
class Dropdown extends LitElement {
|
|
29
256
|
constructor() {
|
|
@@ -31,15 +258,28 @@ class Dropdown extends LitElement {
|
|
|
31
258
|
this.referenceElementController = useReferenceElement({ manager })(this);
|
|
32
259
|
this.direction = useDirection();
|
|
33
260
|
this.focusLastDropdownItem = false;
|
|
34
|
-
this.
|
|
261
|
+
this.focusActiveItemOnOpen = true;
|
|
262
|
+
this.focusedElementOnOpen = null;
|
|
263
|
+
this._open = false;
|
|
35
264
|
this.groups = [];
|
|
36
265
|
this.items = [];
|
|
37
266
|
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
|
38
267
|
this.transitionProp = "opacity";
|
|
39
268
|
this.resizeObserver = createObserver("resize", (entries) => this.resizeObserverCallback(entries));
|
|
40
|
-
this.triggerSlotRef = createRef();
|
|
41
269
|
this.onReferenceElementKeyDown = (event) => this.keyDownHandler(event);
|
|
42
|
-
this.
|
|
270
|
+
this.onReferenceElementFocusIn = (event) => this.openHoverDropdown(event);
|
|
271
|
+
this.onReferenceElementPointerOpen = () => {
|
|
272
|
+
if (!this.open) {
|
|
273
|
+
this.focusActiveItemOnOpen = false;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
this.focusable = useFocusable()(this);
|
|
277
|
+
this.rovingTabIndex = useRovingTabIndex({
|
|
278
|
+
getElements: () => this.items,
|
|
279
|
+
getEntryElement: () => this.referenceEl instanceof Element ? this.referenceEl : void 0,
|
|
280
|
+
getTraversableElements: () => this.getTraversableItems(),
|
|
281
|
+
isActive: () => this.open && !this.disabled && this.focusActiveItemOnOpen
|
|
282
|
+
})(this);
|
|
43
283
|
this.interactiveContainer = useInteractive(this);
|
|
44
284
|
this.topLayer = useTopLayer({
|
|
45
285
|
target: () => this.floatingEl
|
|
@@ -49,7 +289,6 @@ class Dropdown extends LitElement {
|
|
|
49
289
|
this.maxItems = 0;
|
|
50
290
|
this.offsetDistance = 0;
|
|
51
291
|
this.offsetSkidding = 0;
|
|
52
|
-
this.open = false;
|
|
53
292
|
this.overlayPositioning = "absolute";
|
|
54
293
|
this.placement = defaultMenuPlacement;
|
|
55
294
|
this.scale = "m";
|
|
@@ -66,7 +305,7 @@ class Dropdown extends LitElement {
|
|
|
66
305
|
this.listen("calciteInternalDropdownItemSelect", this.handleItemSelect);
|
|
67
306
|
}
|
|
68
307
|
static {
|
|
69
|
-
this.properties = {
|
|
308
|
+
this.properties = { referenceEl: [16, {}, { state: true }], closeOnSelectDisabled: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], flipPlacements: [0, {}, { attribute: false }], maxItems: [11, {}, { reflect: true, type: Number }], offsetDistance: [11, {}, { type: Number, reflect: true }], offsetSkidding: [11, {}, { reflect: true, type: Number }], open: [7, {}, { reflect: true, type: Boolean }], overlayPositioning: [3, {}, { reflect: true }], placement: [3, {}, { reflect: true }], referenceElement: 1, scale: [3, {}, { reflect: true }], selectedItems: [0, {}, { attribute: false }], topLayerDisabled: [7, {}, { reflect: true, type: Boolean }], type: [3, {}, { reflect: true }], widthScale: [3, {}, { reflect: true }], width: [3, {}, { reflect: true }] };
|
|
70
309
|
}
|
|
71
310
|
static {
|
|
72
311
|
this.shadowRootOptions = { mode: "open", delegatesFocus: true };
|
|
@@ -80,6 +319,18 @@ class Dropdown extends LitElement {
|
|
|
80
319
|
get autoClose() {
|
|
81
320
|
return true;
|
|
82
321
|
}
|
|
322
|
+
get isRestoringFocus() {
|
|
323
|
+
return this.rovingTabIndex.isRestoringFocus;
|
|
324
|
+
}
|
|
325
|
+
get open() {
|
|
326
|
+
return this._open;
|
|
327
|
+
}
|
|
328
|
+
set open(value) {
|
|
329
|
+
if (value && !this._open) {
|
|
330
|
+
this.focusedElementOnOpen = this.focusable.getDeepActiveElement();
|
|
331
|
+
}
|
|
332
|
+
this._open = value;
|
|
333
|
+
}
|
|
83
334
|
async reposition(delayed = false) {
|
|
84
335
|
const { filteredFlipPlacements, floatingEl, offsetDistance, offsetSkidding, overlayPositioning, placement, referenceEl } = this;
|
|
85
336
|
return reposition(this, {
|
|
@@ -95,11 +346,19 @@ class Dropdown extends LitElement {
|
|
|
95
346
|
}, delayed);
|
|
96
347
|
}
|
|
97
348
|
async setFocus(options) {
|
|
98
|
-
return this.
|
|
349
|
+
return this.focusable.setFocus(() => {
|
|
350
|
+
const target = this.referenceEl instanceof HTMLElement ? this.referenceEl : this.floatingEl;
|
|
351
|
+
return target ? { target, strategy: "focusable" } : void 0;
|
|
352
|
+
}, options);
|
|
99
353
|
}
|
|
100
354
|
connectedCallback() {
|
|
101
355
|
super.connectedCallback();
|
|
102
|
-
this.mutationObserver?.observe(this.el, {
|
|
356
|
+
this.mutationObserver?.observe(this.el, {
|
|
357
|
+
attributeFilter: ["disabled", "hidden", "inert"],
|
|
358
|
+
attributes: true,
|
|
359
|
+
childList: true,
|
|
360
|
+
subtree: true
|
|
361
|
+
});
|
|
103
362
|
this.setFilteredPlacements();
|
|
104
363
|
this.updateItems();
|
|
105
364
|
connectFloatingUI(this);
|
|
@@ -109,12 +368,12 @@ class Dropdown extends LitElement {
|
|
|
109
368
|
this.listenOn(document, "calciteDropdownOpen", this.closeCalciteDropdownOnOpenEvent);
|
|
110
369
|
}
|
|
111
370
|
willUpdate(changes) {
|
|
112
|
-
if (changes.has("open") && (this.hasUpdated || this.open !== false)) {
|
|
113
|
-
this.openHandler();
|
|
114
|
-
}
|
|
115
371
|
if (changes.has("disabled") && (this.hasUpdated || this.disabled !== false)) {
|
|
116
372
|
this.handleDisabledChange(this.disabled);
|
|
117
373
|
}
|
|
374
|
+
if (changes.has("open") && (this.hasUpdated || this.open !== false)) {
|
|
375
|
+
this.openHandler();
|
|
376
|
+
}
|
|
118
377
|
if (changes.has("flipPlacements")) {
|
|
119
378
|
this.flipPlacementsHandler();
|
|
120
379
|
}
|
|
@@ -133,11 +392,7 @@ class Dropdown extends LitElement {
|
|
|
133
392
|
}
|
|
134
393
|
updated(changes) {
|
|
135
394
|
if (changes.has("referenceEl") && this.referenceElementType) {
|
|
136
|
-
|
|
137
|
-
if (previousReferenceEl instanceof HTMLElement) {
|
|
138
|
-
previousReferenceEl.ariaActiveDescendantElement = null;
|
|
139
|
-
}
|
|
140
|
-
this.syncActiveDescendantOwnerElement();
|
|
395
|
+
this.syncTabStops();
|
|
141
396
|
connectFloatingUI(this);
|
|
142
397
|
}
|
|
143
398
|
}
|
|
@@ -147,27 +402,30 @@ class Dropdown extends LitElement {
|
|
|
147
402
|
}
|
|
148
403
|
disconnectedCallback() {
|
|
149
404
|
super.disconnectedCallback();
|
|
150
|
-
const triggerSlotEl = this.triggerSlotRef.value;
|
|
151
|
-
if (triggerSlotEl) {
|
|
152
|
-
triggerSlotEl.ariaActiveDescendantElement = null;
|
|
153
|
-
}
|
|
154
|
-
if (this.referenceEl instanceof HTMLElement) {
|
|
155
|
-
this.referenceEl.ariaActiveDescendantElement = null;
|
|
156
|
-
}
|
|
157
405
|
this.mutationObserver?.disconnect();
|
|
158
406
|
this.resizeObserver?.disconnect();
|
|
159
407
|
disconnectFloatingUI(this);
|
|
160
408
|
}
|
|
161
409
|
openHandler() {
|
|
162
|
-
if (this.disabled) {
|
|
410
|
+
if (this.disabled && this.open) {
|
|
411
|
+
this.open = false;
|
|
412
|
+
this.focusActiveItemOnOpen = true;
|
|
413
|
+
this.rovingTabIndex.setActiveIndex(-1);
|
|
163
414
|
return;
|
|
164
415
|
}
|
|
416
|
+
if (!this.open) {
|
|
417
|
+
this.focusActiveItemOnOpen = true;
|
|
418
|
+
}
|
|
165
419
|
toggleOpenClose(this);
|
|
420
|
+
if (!this.open) {
|
|
421
|
+
this.rovingTabIndex.setActiveIndex(-1);
|
|
422
|
+
}
|
|
166
423
|
this.reposition(true);
|
|
167
424
|
}
|
|
168
425
|
handleDisabledChange(value) {
|
|
169
|
-
if (
|
|
426
|
+
if (value) {
|
|
170
427
|
this.open = false;
|
|
428
|
+
this.rovingTabIndex.setActiveIndex(-1);
|
|
171
429
|
}
|
|
172
430
|
}
|
|
173
431
|
flipPlacementsHandler() {
|
|
@@ -194,6 +452,9 @@ class Dropdown extends LitElement {
|
|
|
194
452
|
if (this.referenceElementType || this.disabled || this.type !== "hover") {
|
|
195
453
|
return;
|
|
196
454
|
}
|
|
455
|
+
if (!this.open) {
|
|
456
|
+
this.focusActiveItemOnOpen = false;
|
|
457
|
+
}
|
|
197
458
|
this.open = true;
|
|
198
459
|
}
|
|
199
460
|
pointerLeaveHandler() {
|
|
@@ -203,16 +464,28 @@ class Dropdown extends LitElement {
|
|
|
203
464
|
this.closeCalciteDropdown();
|
|
204
465
|
}
|
|
205
466
|
getTraversableItems() {
|
|
206
|
-
return this.items.filter((item) => !item.disabled && !item.hidden);
|
|
467
|
+
return this.items.filter((item) => !item.disabled && !item.closest("[hidden], [inert]"));
|
|
207
468
|
}
|
|
208
469
|
async handleItemSelect(event) {
|
|
209
470
|
this.updateSelectedItems();
|
|
210
471
|
this.syncActiveItemFromTraversableItems();
|
|
472
|
+
const focusedElement = this.focusable.getDeepActiveElement();
|
|
211
473
|
event.stopPropagation();
|
|
212
474
|
this.calciteDropdownSelect.emit();
|
|
213
|
-
await this.setFocus();
|
|
214
475
|
if (!this.closeOnSelectDisabled) {
|
|
215
476
|
this.closeCalciteDropdown();
|
|
477
|
+
this.rovingTabIndex.restoreFocus("recover");
|
|
478
|
+
} else {
|
|
479
|
+
const { requestedDropdownItem } = event.detail;
|
|
480
|
+
const index = this.getTraversableItems().indexOf(requestedDropdownItem);
|
|
481
|
+
if (index < 0 || !requestedDropdownItem.isConnected) {
|
|
482
|
+
this.updateItems();
|
|
483
|
+
return;
|
|
484
|
+
}
|
|
485
|
+
if (requestedDropdownItem.matches(":focus-within") && this.focusable.isFocusUnchanged(focusedElement)) {
|
|
486
|
+
this.rovingTabIndex.setActiveIndex(index);
|
|
487
|
+
await this.scrollActiveItemIntoView(requestedDropdownItem, focusedElement);
|
|
488
|
+
}
|
|
216
489
|
}
|
|
217
490
|
}
|
|
218
491
|
setFilteredPlacements() {
|
|
@@ -220,7 +493,7 @@ class Dropdown extends LitElement {
|
|
|
220
493
|
this.filteredFlipPlacements = flipPlacements ? filterValidFlipPlacements(flipPlacements, el) : void 0;
|
|
221
494
|
}
|
|
222
495
|
updateItems() {
|
|
223
|
-
this.items = this.groups.
|
|
496
|
+
this.items = this.groups.flatMap((group) => Array.from(group.querySelectorAll("calcite-dropdown-item")));
|
|
224
497
|
this.updateSelectedItems();
|
|
225
498
|
this.syncActiveItemFromTraversableItems();
|
|
226
499
|
this.reposition(true);
|
|
@@ -271,17 +544,16 @@ class Dropdown extends LitElement {
|
|
|
271
544
|
onBeforeOpen() {
|
|
272
545
|
this.setInitialActiveItem();
|
|
273
546
|
this.calciteDropdownBeforeOpen.emit();
|
|
274
|
-
this.topLayer.show();
|
|
275
547
|
}
|
|
276
548
|
onOpen() {
|
|
277
549
|
this.calciteDropdownOpen.emit();
|
|
278
550
|
}
|
|
279
551
|
onBeforeClose() {
|
|
552
|
+
this.rovingTabIndex.restoreFocus("recover");
|
|
280
553
|
this.calciteDropdownBeforeClose.emit();
|
|
281
554
|
}
|
|
282
555
|
onClose() {
|
|
283
556
|
this.calciteDropdownClose.emit();
|
|
284
|
-
this.syncActiveDescendantOwnerElement();
|
|
285
557
|
hideFloatingUI(this);
|
|
286
558
|
this.topLayer.hide();
|
|
287
559
|
}
|
|
@@ -293,7 +565,7 @@ class Dropdown extends LitElement {
|
|
|
293
565
|
return;
|
|
294
566
|
}
|
|
295
567
|
this.referenceEl = el;
|
|
296
|
-
this.
|
|
568
|
+
this.syncTabStops();
|
|
297
569
|
connectFloatingUI(this);
|
|
298
570
|
}
|
|
299
571
|
setFloatingEl(el) {
|
|
@@ -301,10 +573,11 @@ class Dropdown extends LitElement {
|
|
|
301
573
|
connectFloatingUI(this);
|
|
302
574
|
}
|
|
303
575
|
handleTriggerSlotChange() {
|
|
304
|
-
this.
|
|
576
|
+
this.syncTabStops();
|
|
305
577
|
}
|
|
306
578
|
keyDownHandler(event) {
|
|
307
|
-
|
|
579
|
+
const path = event.composedPath();
|
|
580
|
+
if (this.disabled || !path.includes(this.floatingEl) && (!(this.referenceEl instanceof Element) || !path.includes(this.referenceEl))) {
|
|
308
581
|
return;
|
|
309
582
|
}
|
|
310
583
|
const { defaultPrevented, key } = event;
|
|
@@ -313,16 +586,19 @@ class Dropdown extends LitElement {
|
|
|
313
586
|
}
|
|
314
587
|
if (this.open && key === "Escape") {
|
|
315
588
|
this.closeCalciteDropdown();
|
|
589
|
+
this.rovingTabIndex.restoreFocus();
|
|
316
590
|
event.preventDefault();
|
|
317
591
|
return;
|
|
318
592
|
}
|
|
319
593
|
if (!this.open && isActivationKey(key)) {
|
|
594
|
+
this.focusActiveItemOnOpen = true;
|
|
320
595
|
this.open = true;
|
|
321
596
|
event.preventDefault();
|
|
322
597
|
return;
|
|
323
598
|
}
|
|
324
599
|
if (!this.open && (key === "ArrowDown" || key === "ArrowUp")) {
|
|
325
600
|
event.preventDefault();
|
|
601
|
+
this.focusActiveItemOnOpen = true;
|
|
326
602
|
this.focusLastDropdownItem = key === "ArrowUp";
|
|
327
603
|
this.open = true;
|
|
328
604
|
return;
|
|
@@ -331,6 +607,7 @@ class Dropdown extends LitElement {
|
|
|
331
607
|
return;
|
|
332
608
|
}
|
|
333
609
|
if (key === "Tab") {
|
|
610
|
+
this.rovingTabIndex.restoreFocus();
|
|
334
611
|
this.closeCalciteDropdown();
|
|
335
612
|
return;
|
|
336
613
|
}
|
|
@@ -371,127 +648,125 @@ class Dropdown extends LitElement {
|
|
|
371
648
|
}
|
|
372
649
|
closeCalciteDropdown() {
|
|
373
650
|
this.open = false;
|
|
374
|
-
this.
|
|
651
|
+
this.rovingTabIndex.setActiveIndex(-1);
|
|
375
652
|
}
|
|
376
653
|
async setInitialActiveItem() {
|
|
377
654
|
const traversableItems = this.getTraversableItems();
|
|
378
|
-
const
|
|
655
|
+
const targetIndex = this.focusLastDropdownItem ? traversableItems.length - 1 : 0;
|
|
656
|
+
const deferredFocusDirection = !traversableItems.length && this.focusLastDropdownItem ? "last" : void 0;
|
|
379
657
|
this.focusLastDropdownItem = false;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
658
|
+
this.rovingTabIndex.setActiveIndex(traversableItems.length ? targetIndex : -1);
|
|
659
|
+
await this.topLayer.show();
|
|
660
|
+
if (this.focusActiveItemOnOpen) {
|
|
661
|
+
await this.scrollActiveItemIntoView(void 0, this.focusedElementOnOpen, deferredFocusDirection);
|
|
383
662
|
}
|
|
384
|
-
const targetIndex = traversableItems.findIndex((item) => item === target);
|
|
385
|
-
this.setActiveItemByIndex(targetIndex);
|
|
386
|
-
await this.scrollActiveItemIntoView(target);
|
|
387
663
|
}
|
|
388
664
|
syncActiveItemFromTraversableItems() {
|
|
389
665
|
const traversableItems = this.getTraversableItems();
|
|
390
|
-
|
|
391
|
-
|
|
666
|
+
const previousActiveItem = this.rovingTabIndex.activeElement;
|
|
667
|
+
const shouldRecoverFocus = this.rovingTabIndex.shouldRecoverFocus;
|
|
668
|
+
if (!this.open || !traversableItems.length) {
|
|
669
|
+
this.rovingTabIndex.setActiveIndex(-1);
|
|
670
|
+
if (this.open && previousActiveItem && shouldRecoverFocus) {
|
|
671
|
+
this.rovingTabIndex.restoreFocus("force");
|
|
672
|
+
}
|
|
392
673
|
return;
|
|
393
674
|
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
675
|
+
const activeItem = this.rovingTabIndex.reconcile();
|
|
676
|
+
if (previousActiveItem && activeItem && shouldRecoverFocus) {
|
|
677
|
+
void this.scrollActiveItemIntoView(activeItem);
|
|
397
678
|
}
|
|
398
|
-
this.updateActiveDescendantElement(traversableItems[this.activeItemIndex]);
|
|
399
679
|
}
|
|
400
|
-
|
|
401
|
-
this.
|
|
402
|
-
const traversableItems = this.getTraversableItems();
|
|
403
|
-
const activeItem = index >= 0 ? traversableItems[index] : null;
|
|
404
|
-
this.updateActiveDescendantElement(activeItem);
|
|
680
|
+
syncTabStops() {
|
|
681
|
+
this.rovingTabIndex.update(this.items, this.rovingTabIndex.activeElement);
|
|
405
682
|
}
|
|
406
|
-
|
|
407
|
-
this.
|
|
408
|
-
item.activeDescendant = item === activeItem;
|
|
409
|
-
});
|
|
410
|
-
this.activeDescendantElement = activeItem ?? void 0;
|
|
411
|
-
this.syncActiveDescendantOwnerElement();
|
|
683
|
+
handleItemFocus() {
|
|
684
|
+
this.focusActiveItemOnOpen = true;
|
|
412
685
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const triggerSlotEl = this.triggerSlotRef.value;
|
|
416
|
-
const activeDescendantEl = this.open ? this.activeDescendantElement ?? null : null;
|
|
417
|
-
const referenceOwnerEl = referenceEl instanceof HTMLElement ? referenceEl : null;
|
|
418
|
-
const isReferenceMode = Boolean(referenceElementType);
|
|
419
|
-
if (triggerSlotEl) {
|
|
420
|
-
triggerSlotEl.ariaActiveDescendantElement = isReferenceMode ? null : activeDescendantEl;
|
|
421
|
-
}
|
|
422
|
-
if (!referenceOwnerEl) {
|
|
686
|
+
handleItemFocusOut(event) {
|
|
687
|
+
if (!event.relatedTarget && this.rovingTabIndex.shouldRecoverFocus) {
|
|
423
688
|
return;
|
|
424
689
|
}
|
|
425
|
-
|
|
690
|
+
void this.closeHoverDropdown(event);
|
|
426
691
|
}
|
|
427
692
|
navigateActiveItem(direction) {
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
const totalItems = traversableItems.length;
|
|
433
|
-
let index = this.activeItemIndex;
|
|
434
|
-
if (index < 0 || index >= totalItems) {
|
|
435
|
-
index = direction === "previous" || direction === "last" ? totalItems - 1 : 0;
|
|
436
|
-
} else if (direction === "next") {
|
|
437
|
-
index = (index + 1) % totalItems;
|
|
438
|
-
} else if (direction === "previous") {
|
|
439
|
-
index = (index - 1 + totalItems) % totalItems;
|
|
440
|
-
} else if (direction === "first") {
|
|
441
|
-
index = 0;
|
|
442
|
-
} else if (direction === "last") {
|
|
443
|
-
index = totalItems - 1;
|
|
693
|
+
this.focusActiveItemOnOpen = true;
|
|
694
|
+
const activeItem = this.rovingTabIndex.navigate(direction);
|
|
695
|
+
if (activeItem) {
|
|
696
|
+
void this.scrollActiveItemIntoView(activeItem);
|
|
444
697
|
}
|
|
445
|
-
const activeItem = traversableItems[index];
|
|
446
|
-
this.setActiveItemByIndex(index);
|
|
447
|
-
void this.scrollActiveItemIntoView(activeItem);
|
|
448
698
|
}
|
|
449
|
-
async scrollActiveItemIntoView(target) {
|
|
450
|
-
if (!target) {
|
|
451
|
-
return;
|
|
452
|
-
}
|
|
699
|
+
async scrollActiveItemIntoView(target, focusedElement = this.focusable.getDeepActiveElement(), deferredFocusDirection) {
|
|
453
700
|
await this.updateComplete;
|
|
454
701
|
await nextFrame();
|
|
455
702
|
await nextFrame();
|
|
703
|
+
target ??= this.rovingTabIndex.activeElement ?? void 0;
|
|
704
|
+
if (!target || !this.open || this.rovingTabIndex.activeElement !== target || !target.isConnected || !this.focusable.isFocusUnchanged(focusedElement)) {
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
if (deferredFocusDirection) {
|
|
708
|
+
target = this.rovingTabIndex.navigate(deferredFocusDirection) ?? target;
|
|
709
|
+
}
|
|
710
|
+
await target.setFocus({ preventScroll: true });
|
|
456
711
|
target.scrollIntoView({ block: "nearest" });
|
|
457
712
|
}
|
|
458
713
|
activateActiveItem() {
|
|
459
714
|
const traversableItems = this.getTraversableItems();
|
|
460
|
-
const
|
|
715
|
+
const activeIndex = this.rovingTabIndex.activeIndex;
|
|
716
|
+
const targetIndex = activeIndex >= 0 && activeIndex < traversableItems.length ? activeIndex : 0;
|
|
717
|
+
const activeItem = traversableItems[targetIndex];
|
|
461
718
|
if (!activeItem) {
|
|
462
719
|
return;
|
|
463
720
|
}
|
|
464
|
-
this.
|
|
721
|
+
this.rovingTabIndex.setActiveIndex(targetIndex);
|
|
465
722
|
activeItem.activateItem();
|
|
466
723
|
}
|
|
467
|
-
openHoverDropdown() {
|
|
468
|
-
if (this.
|
|
724
|
+
openHoverDropdown(event) {
|
|
725
|
+
if (this.disabled || this.type !== "hover" || this.isRestoringFocus) {
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (this.rovingTabIndex.isFocusFromItem(event) || event.relatedTarget instanceof Node && this.el.contains(event.relatedTarget)) {
|
|
729
|
+
return;
|
|
730
|
+
}
|
|
731
|
+
this.focusActiveItemOnOpen = true;
|
|
732
|
+
if (this.open) {
|
|
733
|
+
if (!this.rovingTabIndex.activeElement) {
|
|
734
|
+
this.rovingTabIndex.setActiveIndex(0);
|
|
735
|
+
}
|
|
736
|
+
void this.scrollActiveItemIntoView(this.rovingTabIndex.activeElement ?? void 0);
|
|
469
737
|
return;
|
|
470
738
|
}
|
|
471
739
|
this.open = true;
|
|
472
740
|
}
|
|
473
|
-
closeHoverDropdown(event) {
|
|
741
|
+
async closeHoverDropdown(event) {
|
|
474
742
|
if (!this.open || this.disabled || this.type !== "hover") {
|
|
475
743
|
return;
|
|
476
744
|
}
|
|
477
745
|
const relatedTarget = event.relatedTarget;
|
|
478
|
-
if (relatedTarget && (this.el.contains(relatedTarget) || this.referenceEl
|
|
746
|
+
if (relatedTarget && (this.el.contains(relatedTarget) || this.referenceEl instanceof Element && this.referenceEl.contains(relatedTarget))) {
|
|
479
747
|
return;
|
|
480
748
|
}
|
|
749
|
+
if (relatedTarget instanceof Element && relatedTarget.shadowRoot) {
|
|
750
|
+
await nextFrame();
|
|
751
|
+
if (!this.open || this.rovingTabIndex.hasFocus) {
|
|
752
|
+
return;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
481
755
|
this.closeCalciteDropdown();
|
|
482
756
|
}
|
|
483
757
|
toggleClickDropdown() {
|
|
484
758
|
if (this.disabled || this.type !== "click") {
|
|
485
759
|
return;
|
|
486
760
|
}
|
|
761
|
+
this.focusActiveItemOnOpen = true;
|
|
487
762
|
this.open = !this.open;
|
|
488
763
|
}
|
|
489
764
|
render() {
|
|
490
765
|
const { open } = this;
|
|
491
|
-
return this.interactiveContainer({ disabled: this.disabled, children: html`${!this.referenceElementType ? html`<div class=${safeClassMap(CSS.triggerContainer)} @click=${this.toggleClickDropdown} @focusin=${this.openHoverDropdown} @focusout=${this.closeHoverDropdown} @keydown=${this.keyDownHandler} ${ref(this.setReferenceEl)}><slot .ariaControlsElements=${this.scrollerEl ? [this.scrollerEl] : void 0} .ariaExpanded=${open} aria-haspopup=menu name=${SLOTS.trigger} @slotchange=${this.handleTriggerSlotChange}
|
|
766
|
+
return this.interactiveContainer({ disabled: this.disabled, children: html`${!this.referenceElementType ? html`<div class=${safeClassMap(CSS.triggerContainer)} @click=${this.toggleClickDropdown} @focusin=${this.openHoverDropdown} @focusout=${this.closeHoverDropdown} @keydown=${this.keyDownHandler} ${ref(this.setReferenceEl)}><slot .ariaControlsElements=${this.scrollerEl ? [this.scrollerEl] : void 0} .ariaExpanded=${open} aria-haspopup=menu name=${SLOTS.trigger} @slotchange=${this.handleTriggerSlotChange}></slot></div>` : null}<div class=${safeClassMap({
|
|
492
767
|
[CSS.wrapper]: true,
|
|
493
768
|
[getDimensionClass("width", this.width, this.widthScale)]: !!(this.width || this.widthScale)
|
|
494
|
-
})} .inert=${!open} popover=manual ${ref(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl instanceof HTMLElement ? [this.referenceEl] : void 0} class=${safeClassMap({
|
|
769
|
+
})} .inert=${!open} @focusin=${this.handleItemFocus} @focusout=${this.handleItemFocusOut} @keydown=${this.keyDownHandler} popover=manual ${ref(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl instanceof HTMLElement ? [this.referenceEl] : void 0} class=${safeClassMap({
|
|
495
770
|
[CSS.content]: true,
|
|
496
771
|
[FloatingCSS.animation]: true,
|
|
497
772
|
[FloatingCSS.animationActive]: open
|