@esri/calcite-components 5.1.0-next.23 → 5.1.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/{FZ5YFWHJ.js → 25Y7MBNX.js} +1 -1
- package/dist/cdn/{SRK5KXZ4.js → 27U37MLJ.js} +1 -1
- package/dist/cdn/{6EYS4WHO.js → 2WTHD37G.js} +1 -1
- package/dist/cdn/{RRU6XSXQ.js → 35B6PRMK.js} +1 -1
- package/dist/cdn/{NDL5DQ7U.js → 3BXVECSN.js} +1 -1
- package/dist/cdn/{N2EQV7X7.js → 3FTNGX3W.js} +1 -1
- package/dist/cdn/{ZBYGSEB5.js → 3HAUWY4Q.js} +1 -1
- package/dist/cdn/{3QGH4OWQ.js → 3NP3FX5G.js} +1 -1
- package/dist/cdn/{CKX7AUBC.js → 43ILV2UA.js} +1 -1
- package/dist/cdn/{4C46PE7D.js → 4AFV2RDV.js} +1 -1
- package/dist/cdn/{32BX4ZKG.js → 4DU3OLQM.js} +1 -1
- package/dist/cdn/4H3E7NF7.js +2 -0
- package/dist/cdn/4WCAWC2W.js +2 -0
- package/dist/cdn/{BMNVLYMU.js → 4ZMOC4CA.js} +1 -1
- package/dist/cdn/577BFHQJ.js +2 -0
- package/dist/cdn/{XGCQDCY4.js → 5AAKQUGR.js} +1 -1
- package/dist/cdn/{LZ652GKN.js → 5IEEZRVX.js} +1 -1
- package/dist/cdn/{B6Y5GTDC.js → 5KJHD3XL.js} +1 -1
- package/dist/cdn/{XK3ATTAB.js → 5LB4QUHD.js} +1 -1
- package/dist/cdn/{IKARCXYU.js → 5P6Y44BI.js} +1 -1
- package/dist/cdn/{5XEIFEPX.js → 67337RAS.js} +1 -1
- package/dist/cdn/{5AYU6SKP.js → 6IYXEF5Q.js} +1 -1
- package/dist/cdn/{XYPHGZAN.js → 6MTDJPI4.js} +1 -1
- package/dist/cdn/{7NHAZXKL.js → 6WY3IAXV.js} +1 -1
- package/dist/cdn/{XZBLGMBC.js → 7OPX2QTM.js} +1 -1
- package/dist/cdn/7PN6GY3K.js +2 -0
- package/dist/cdn/{Q3LODYXE.js → 7QJOA44W.js} +1 -1
- package/dist/cdn/{6M44ML5E.js → 7Y4MKWU4.js} +1 -1
- package/dist/cdn/7YDSLCQ7.js +2 -0
- package/dist/cdn/{UJXRXTSC.js → 7YOIWELC.js} +1 -1
- package/dist/cdn/{IYXQKSJZ.js → A75HLUMG.js} +1 -1
- package/dist/cdn/{HAK3HLDB.js → A7LUSEVG.js} +1 -1
- package/dist/cdn/{EV5IAZJW.js → ACEIJ36E.js} +1 -1
- package/dist/cdn/AHBLLAP4.js +2 -0
- package/dist/cdn/{UP4RO66F.js → ARPOHR4M.js} +1 -1
- package/dist/cdn/AVSZOCPG.js +2 -0
- package/dist/cdn/{TKOLS6UC.js → BKNFQ6RA.js} +1 -1
- package/dist/cdn/{DM4TH7JV.js → CC3VIJ62.js} +1 -1
- package/dist/cdn/{UKCMXF2C.js → CPPQU2JT.js} +1 -1
- package/dist/cdn/{WOS57WDN.js → CQWCAFVA.js} +1 -1
- package/dist/cdn/{Q5T4W67E.js → CZ2SSTBU.js} +1 -1
- package/dist/cdn/{QLGE7QVC.js → D6PGZUKV.js} +1 -1
- package/dist/cdn/{VW7K3BNN.js → DBESGPPF.js} +1 -1
- package/dist/cdn/{VL32LWYL.js → DRFU5YEH.js} +1 -1
- package/dist/cdn/{Z3MGYOYH.js → DSDZWWPD.js} +1 -1
- package/dist/cdn/{GOAROEVH.js → DVAPKNWQ.js} +1 -1
- package/dist/cdn/{CENXNB5T.js → DYKZAL43.js} +1 -1
- package/dist/cdn/{EM3EIV7J.js → E5HFZKEM.js} +1 -1
- package/dist/cdn/{ZTUQK7OW.js → ECJOMBVP.js} +1 -1
- package/dist/cdn/{AKSJJ3L5.js → EEB5YOG6.js} +1 -1
- package/dist/cdn/{K4GX3WJR.js → EKX7UIUS.js} +1 -1
- package/dist/cdn/{M3VJI4AU.js → ETP5IHZB.js} +1 -1
- package/dist/cdn/{CK4ODRJO.js → EUJPGQH5.js} +1 -1
- package/dist/cdn/{O6K7JSU6.js → FIQ3J5SW.js} +1 -1
- package/dist/cdn/{7FDTUWVI.js → FRQDF7EU.js} +1 -1
- package/dist/cdn/{2LVLEMXA.js → FRZSW2QQ.js} +1 -1
- package/dist/cdn/{UU2F5Y5T.js → G2PYJN42.js} +1 -1
- package/dist/cdn/{FJKO272G.js → G4Y3MFJY.js} +1 -1
- package/dist/cdn/{E3UU2B65.js → GPERYR4P.js} +1 -1
- package/dist/cdn/{WXA6F46V.js → GWTFOVIM.js} +1 -1
- package/dist/cdn/{7RLGTFYG.js → H3SXJY5G.js} +1 -1
- package/dist/cdn/{GPHE2H57.js → HFCHUSF7.js} +1 -1
- package/dist/cdn/{IL5Q6XJD.js → HNNL7IUM.js} +1 -1
- package/dist/cdn/{4PIHLAYB.js → HOUKB4AY.js} +1 -1
- package/dist/cdn/{PJ3Q6FOE.js → HW3LISFQ.js} +1 -1
- package/dist/cdn/{D5ZTOOXJ.js → I7D6CNIT.js} +1 -1
- package/dist/cdn/{II2BNOXX.js → IDQKV7W4.js} +1 -1
- package/dist/cdn/{46474J2D.js → IHMX6KWN.js} +1 -1
- package/dist/cdn/{O5DB7GQR.js → IPDJIOSM.js} +1 -1
- package/dist/cdn/{X37ALWDF.js → IR3ORN34.js} +1 -1
- package/dist/cdn/{TLSOT7PV.js → J5O7CVDX.js} +1 -1
- package/dist/cdn/{73PFFAQU.js → JP7WZFLP.js} +1 -1
- package/dist/cdn/{MMVIWJXC.js → K4GUJREQ.js} +1 -1
- package/dist/cdn/{BVPDASMR.js → KBKEPXPT.js} +1 -1
- package/dist/cdn/{AUWUEUOL.js → KRNJK2SE.js} +1 -1
- package/dist/cdn/{OTMEITBF.js → KTGTAI63.js} +1 -1
- package/dist/cdn/{XJQAAUIA.js → LF73E7K2.js} +1 -1
- package/dist/cdn/{IPMPOVSI.js → LZ64DG4B.js} +1 -1
- package/dist/cdn/{BPDU7XM2.js → LZFMVYHL.js} +1 -1
- package/dist/cdn/{D7EZLEGE.js → LZSNPBAN.js} +1 -1
- package/dist/cdn/{UTULQYJR.js → MLOCEBTE.js} +1 -1
- package/dist/cdn/{3Q2FOUJF.js → MWK7IIV3.js} +1 -1
- package/dist/cdn/{VYFVJDGL.js → NJ5EIGGU.js} +1 -1
- package/dist/cdn/{AWBXHXZ3.js → NJDJIG2C.js} +1 -1
- package/dist/cdn/{CY4OU4QP.js → NJYUPJQW.js} +1 -1
- package/dist/cdn/{RL7M3P73.js → NLKSDE46.js} +1 -1
- package/dist/cdn/{HBGDEADR.js → NMU35ESN.js} +1 -1
- package/dist/cdn/OMXJRVXR.js +2 -0
- package/dist/cdn/OR66TG26.js +2 -0
- package/dist/cdn/PLBFOPEP.js +2 -0
- package/dist/cdn/{QUWL454R.js → PPITNY7V.js} +1 -1
- package/dist/cdn/{35IJ7SI2.js → PS6F5KSO.js} +1 -1
- package/dist/cdn/PUCSPFSE.js +2 -0
- package/dist/cdn/{EOHCTAJJ.js → PX46XX3S.js} +1 -1
- package/dist/cdn/{2YYQKCYM.js → PYI2DQHX.js} +1 -1
- package/dist/cdn/QFZZIOMD.js +2 -0
- package/dist/cdn/{DZLRTNUI.js → QJRRZDAQ.js} +1 -1
- package/dist/cdn/{CIRH75AS.js → QL5VWWKQ.js} +1 -1
- package/dist/cdn/{XORZW6WZ.js → QWHNQJ3U.js} +1 -1
- package/dist/cdn/{FE64BZHG.js → RINCAIWE.js} +1 -1
- package/dist/cdn/{XIASL4S3.js → RTOHMI5T.js} +1 -1
- package/dist/cdn/RYA4YDJB.js +2 -0
- package/dist/cdn/{24UJQ5F4.js → SJJYYNDU.js} +1 -1
- package/dist/cdn/SYPGTFWL.js +2 -0
- package/dist/cdn/{IXP7MQFV.js → T34YET4S.js} +1 -1
- package/dist/cdn/{KUFUMKWA.js → T5BNZ27P.js} +1 -1
- package/dist/cdn/{3UDMWJSI.js → TJY5G272.js} +1 -1
- package/dist/cdn/{VJAFGTZ4.js → TQTCPELB.js} +1 -1
- package/dist/cdn/{P5CAQSCF.js → TWE5YMJV.js} +1 -1
- package/dist/cdn/{5MJM55NK.js → TYJTHC4B.js} +1 -1
- package/dist/cdn/{JNF3HAIN.js → TZFYJMOS.js} +1 -1
- package/dist/cdn/{YZOHIE2T.js → UBGOLRVO.js} +1 -1
- package/dist/cdn/UFYSR4SD.js +2 -0
- package/dist/cdn/{4VXXAV2Y.js → UNXBOQC4.js} +1 -1
- package/dist/cdn/{MIQ34MGW.js → USEKAAH6.js} +1 -1
- package/dist/cdn/{4RUU2WKF.js → V2VWVKOI.js} +1 -1
- package/dist/cdn/{THEY75YU.js → V7AE4QVT.js} +1 -1
- package/dist/cdn/{7PDPIL3D.js → V7W7KW6Z.js} +1 -1
- package/dist/cdn/{2TZAQQYP.js → VXSL3ABN.js} +1 -1
- package/dist/cdn/{5N5TDMBY.js → W4SY6HSR.js} +1 -1
- package/dist/cdn/{XBTZNNH4.js → WDAT575U.js} +1 -1
- package/dist/cdn/{2T4UKELZ.js → WEBKTCHR.js} +1 -1
- package/dist/cdn/{WKS3E5HV.js → WFIL5VUG.js} +1 -1
- package/dist/cdn/{HCU4WGN4.js → WPOYI7P3.js} +1 -1
- package/dist/cdn/{6Z2SZO66.js → WRUQJTTU.js} +1 -1
- package/dist/cdn/{IXVNWJDN.js → X6VC7UA2.js} +1 -1
- package/dist/cdn/{R7MXXSBO.js → XC246WT5.js} +1 -1
- package/dist/cdn/{PAKROU7I.js → XGNORHI6.js} +1 -1
- package/dist/cdn/{6IMEDYAP.js → XHHLBCKY.js} +1 -1
- package/dist/cdn/{D56UOJUB.js → XJ43C7FS.js} +1 -1
- package/dist/cdn/{J3BSQMJO.js → XOOKV5M5.js} +1 -1
- package/dist/cdn/{GCX72I2P.js → XTFX7SON.js} +1 -1
- package/dist/cdn/{MXZUNN6P.js → XYWLBGJE.js} +1 -1
- package/dist/cdn/{T3LQ2J7W.js → YEL53KZI.js} +1 -1
- package/dist/cdn/YNX3P2QU.js +2 -0
- package/dist/cdn/{6QKZ7UYR.js → YTZXSPVU.js} +1 -1
- package/dist/cdn/{CEUDN4HA.js → YUTLGO5O.js} +1 -1
- package/dist/cdn/{VBJZ6K4B.js → Z2ORUZGB.js} +1 -1
- package/dist/cdn/{4PGJEZ3S.js → Z7B56FPG.js} +1 -1
- package/dist/cdn/{GSMIEUGM.js → ZIAI6P6F.js} +1 -1
- package/dist/cdn/{7FSGTRF3.js → ZKJ3XVJ4.js} +1 -1
- package/dist/cdn/{2O3LPMRY.js → ZW4Z3M67.js} +1 -1
- package/dist/cdn/assets/icon/arcgisQuickcapture16.json +1 -0
- package/dist/cdn/assets/icon/arcgisQuickcapture24.json +1 -0
- package/dist/cdn/assets/icon/arcgisQuickcapture32.json +1 -0
- package/dist/cdn/assets/icon/arcgisSurvey12316.json +1 -0
- package/dist/cdn/assets/icon/arcgisSurvey12324.json +1 -0
- package/dist/cdn/assets/icon/arcgisSurvey12332.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/FloatingArrow.js +24 -0
- package/dist/chunks/dom.js +4 -4
- package/dist/chunks/{useReferenceElement.js → manager.js} +108 -108
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useFormTrigger.js +25 -0
- package/dist/chunks/{sortableComponent.js → useSortable.js} +67 -44
- package/dist/components/calcite-action/customElement.d.ts +4 -4
- package/dist/components/calcite-action/customElement.js +7 -13
- package/dist/components/calcite-action-bar/customElement.d.ts +3 -3
- package/dist/components/calcite-action-bar/customElement.js +3 -2
- package/dist/components/calcite-action-group/customElement.d.ts +4 -4
- package/dist/components/calcite-action-pad/customElement.d.ts +2 -2
- package/dist/components/calcite-action-pad/customElement.js +1 -1
- package/dist/components/calcite-autocomplete/customElement.d.ts +1 -2
- package/dist/components/calcite-autocomplete/customElement.js +11 -27
- package/dist/components/calcite-block-group/customElement.js +3 -3
- package/dist/components/calcite-block-group/interfaces.d.ts +2 -6
- package/dist/components/calcite-button/customElement.js +9 -21
- package/dist/components/calcite-dropdown/customElement.d.ts +12 -2
- package/dist/components/calcite-dropdown/customElement.js +29 -12
- package/dist/components/calcite-list/customElement.js +3 -3
- package/dist/components/calcite-list/interfaces.d.ts +2 -6
- package/dist/components/calcite-list-item/customElement.js +1 -1
- package/dist/components/calcite-meter/customElement.js +1 -1
- package/dist/components/calcite-popover/customElement.js +2 -1
- package/dist/components/calcite-radio-button/customElement.js +170 -2
- package/dist/components/calcite-slider/customElement.js +1 -1
- package/dist/components/calcite-sortable-list/customElement.d.ts +1 -1
- package/dist/components/calcite-sortable-list/customElement.js +3 -3
- package/dist/components/calcite-tooltip/customElement.js +2 -1
- package/dist/controllers/useSortable.d.ts +7 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +4 -4
- 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 +3 -3
- package/dist/cdn/2EUDKMDO.js +0 -2
- package/dist/cdn/2XNFLSUI.js +0 -2
- package/dist/cdn/3BT6RU6D.js +0 -2
- package/dist/cdn/3YJ3ACES.js +0 -2
- package/dist/cdn/CCL7PUJE.js +0 -2
- package/dist/cdn/HRUU6XJ6.js +0 -2
- package/dist/cdn/IACZ2JVP.js +0 -2
- package/dist/cdn/IUAOTROK.js +0 -2
- package/dist/cdn/KVR6J5VT.js +0 -2
- package/dist/cdn/NWJM6BJZ.js +0 -2
- package/dist/cdn/QGDBPB33.js +0 -2
- package/dist/cdn/RJ6CAOFW.js +0 -2
- package/dist/cdn/T3WOEUV6.js +0 -2
- package/dist/cdn/UWV5XSTB.js +0 -2
- package/dist/cdn/WJXZ7BPV.js +0 -2
- package/dist/chunks/form.js +0 -267
- package/dist/utils/sortableComponent.d.ts +0 -7
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
-
import { css,
|
|
3
|
+
import { css, html } from "lit";
|
|
4
4
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
5
5
|
import { literal, html as html$1 } from "lit/static-html.js";
|
|
6
|
-
import { LitElement, stringOrBoolean, safeClassMap } from "@arcgis/lumina";
|
|
6
|
+
import { LitElement, stringOrBoolean, safeClassMap, nothing } from "@arcgis/lumina";
|
|
7
7
|
import { useWatchAttributes } from "@arcgis/lumina/controllers";
|
|
8
|
-
import { f as findAssociatedForm, s as submitForm, r as resetForm } from "../../chunks/form.js";
|
|
9
8
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
10
9
|
import { c as createObserver, u as updateRefObserver } from "../../chunks/observers.js";
|
|
11
10
|
import { g as getIconScale } from "../../chunks/component.js";
|
|
@@ -13,6 +12,7 @@ import { u as useT9n } from "../../chunks/useT9n.js";
|
|
|
13
12
|
import { h as hasVisibleContent } from "../../chunks/dom.js";
|
|
14
13
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
15
14
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
15
|
+
import { u as useFormTrigger } from "../../chunks/useFormTrigger.js";
|
|
16
16
|
const CSS = {
|
|
17
17
|
buttonLoader: "calcite-button--loader",
|
|
18
18
|
content: "content",
|
|
@@ -33,6 +33,7 @@ class Button extends LitElement {
|
|
|
33
33
|
super(...arguments);
|
|
34
34
|
this.attributeWatch = useWatchAttributes(["aria-expanded"], this.handleGlobalAttributesChanged);
|
|
35
35
|
this.contentRef = createRef();
|
|
36
|
+
this.formTrigger = useFormTrigger({ disabled: () => !!this.href })(this);
|
|
36
37
|
this.mutationObserver = createObserver("mutation", () => this.updateHasContent());
|
|
37
38
|
this.resizeObserver = createObserver("resize", () => this.setTooltipText());
|
|
38
39
|
this.focusSetter = useSetFocus()(this);
|
|
@@ -54,6 +55,9 @@ class Button extends LitElement {
|
|
|
54
55
|
static {
|
|
55
56
|
this.properties = { hasContent: [16, {}, { state: true }], tooltipText: [16, {}, { state: true }], alignment: [3, {}, { reflect: true }], appearance: [3, {}, { reflect: true }], disabled: [7, {}, { reflect: true, type: Boolean }], download: [3, { converter: stringOrBoolean }, { reflect: true }], form: [3, {}, { reflect: true }], href: [3, {}, { reflect: true }], iconEnd: [3, { type: String }, { reflect: true }], iconFlipRtl: [3, {}, { reflect: true }], iconStart: [3, { type: String }, { reflect: true }], kind: [3, {}, { reflect: true }], label: 1, loading: [7, {}, { reflect: true, type: Boolean }], messageOverrides: [0, {}, { attribute: false }], name: [3, {}, { reflect: true }], rel: [3, {}, { reflect: true }], round: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], splitChild: [3, {}, { reflect: true }], target: [3, {}, { reflect: true }], type: [3, {}, { reflect: true }], width: [3, {}, { reflect: true }] };
|
|
56
57
|
}
|
|
58
|
+
static {
|
|
59
|
+
this.formAssociated = true;
|
|
60
|
+
}
|
|
57
61
|
static {
|
|
58
62
|
this.styles = styles;
|
|
59
63
|
}
|
|
@@ -64,12 +68,9 @@ class Button extends LitElement {
|
|
|
64
68
|
super.connectedCallback();
|
|
65
69
|
this.setupTextContentObserver();
|
|
66
70
|
connectLabel(this);
|
|
67
|
-
this.formEl = findAssociatedForm(this);
|
|
68
71
|
}
|
|
69
72
|
async load() {
|
|
70
|
-
|
|
71
|
-
this.updateHasContent();
|
|
72
|
-
}
|
|
73
|
+
this.updateHasContent();
|
|
73
74
|
}
|
|
74
75
|
loaded() {
|
|
75
76
|
this.setTooltipText();
|
|
@@ -79,7 +80,6 @@ class Button extends LitElement {
|
|
|
79
80
|
this.mutationObserver?.disconnect();
|
|
80
81
|
disconnectLabel(this);
|
|
81
82
|
this.resizeObserver?.disconnect();
|
|
82
|
-
this.formEl = null;
|
|
83
83
|
}
|
|
84
84
|
handleGlobalAttributesChanged() {
|
|
85
85
|
this.requestUpdate();
|
|
@@ -91,20 +91,8 @@ class Button extends LitElement {
|
|
|
91
91
|
this.mutationObserver?.observe(this.el, { childList: true, subtree: true });
|
|
92
92
|
}
|
|
93
93
|
onLabelClick() {
|
|
94
|
-
this.handleClick();
|
|
95
94
|
this.setFocus();
|
|
96
95
|
}
|
|
97
|
-
handleClick() {
|
|
98
|
-
const { type } = this;
|
|
99
|
-
if (this.href) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (type === "submit") {
|
|
103
|
-
submitForm(this);
|
|
104
|
-
} else if (type === "reset") {
|
|
105
|
-
resetForm(this);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
96
|
setTooltipText() {
|
|
109
97
|
const { contentRef: { value: contentEl } } = this;
|
|
110
98
|
if (contentEl) {
|
|
@@ -129,7 +117,7 @@ class Button extends LitElement {
|
|
|
129
117
|
[CSS.contentSlotted]: this.hasContent,
|
|
130
118
|
[CSS.iconStartEmpty]: !this.iconStart,
|
|
131
119
|
[CSS.iconEndEmpty]: !this.iconEnd
|
|
132
|
-
})} .disabled=${childElType === "button" ? this.disabled : null} download=${(childElType === "a" ? this.download === true || this.download === "" ? "" : this.download || null : null) ?? nothing} href=${(childElType === "a" && this.href) ?? nothing} name=${(childElType === "button" && this.name) ?? nothing}
|
|
120
|
+
})} .disabled=${childElType === "button" ? this.disabled : null} download=${(childElType === "a" ? this.download === true || this.download === "" ? "" : this.download || null : null) ?? nothing} href=${(childElType === "a" && this.href) ?? nothing} name=${(childElType === "button" && this.name) ?? nothing} rel=${(childElType === "a" && this.rel) ?? nothing} tabindex=${(this.disabled ? -1 : null) ?? nothing} target=${(childElType === "a" && this.target) ?? nothing} title=${this.tooltipText ?? nothing} type=${(childElType === "button" ? this.type : null) ?? nothing} ${ref(this.setChildEl)}>${loaderNode}${this.iconStart ? iconStartEl : null}${this.hasContent ? contentEl : null}${this.iconEnd ? iconEndEl : null}</${DynamicHtmlTag}>` });
|
|
133
121
|
}
|
|
134
122
|
}
|
|
135
123
|
customElement("calcite-button", Button);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
-
import type { FlipPlacement, LogicalPlacement, OverlayPositioning } from "../../utils/floating-ui.js";
|
|
3
|
+
import type { FlipPlacement, LogicalPlacement, OverlayPositioning, ReferenceElement } from "../../utils/floating-ui.js";
|
|
4
4
|
import type { Scale, Width } from "../interfaces.js";
|
|
5
5
|
import type { DropdownItem } from "../calcite-dropdown-item/customElement.js";
|
|
6
6
|
|
|
@@ -8,7 +8,7 @@ import type { DropdownItem } from "../calcite-dropdown-item/customElement.js";
|
|
|
8
8
|
* @cssproperty [--calcite-dropdown-width] - Specifies the width of the component's wrapper.
|
|
9
9
|
* @cssproperty [--calcite-dropdown-background-color] - Specifies the component's background color.
|
|
10
10
|
* @slot - A slot for adding `calcite-dropdown-group` elements. Every `calcite-dropdown-item` must have a parent `calcite-dropdown-group`, even if the `groupTitle` property is not set.
|
|
11
|
-
* @slot [trigger] - A slot for the element that triggers the component.
|
|
11
|
+
* @slot [trigger] - [deprecated] Use `referenceElement` property instead. A slot for the element that triggers the component.
|
|
12
12
|
*/
|
|
13
13
|
export abstract class Dropdown extends LitElement {
|
|
14
14
|
/**
|
|
@@ -68,6 +68,16 @@ export abstract class Dropdown extends LitElement {
|
|
|
68
68
|
* @default "bottom-start"
|
|
69
69
|
*/
|
|
70
70
|
accessor placement: LogicalPlacement;
|
|
71
|
+
/**
|
|
72
|
+
* The `referenceElement` is used to position the component according to its `placement` value.
|
|
73
|
+
*
|
|
74
|
+
* Setting the value to an `HTMLElement` is preferred so the component does not need to query the DOM.
|
|
75
|
+
*
|
|
76
|
+
* However, a string `id` of the reference element can also be used.
|
|
77
|
+
*
|
|
78
|
+
* The component should not be placed within its own `referenceElement` to avoid unintended behavior.
|
|
79
|
+
*/
|
|
80
|
+
accessor referenceElement: ReferenceElement | string | null;
|
|
71
81
|
/**
|
|
72
82
|
* Specifies the size of the component.
|
|
73
83
|
*
|
|
@@ -13,6 +13,7 @@ import { g as getDimensionClass } from "../../chunks/dynamicClasses.js";
|
|
|
13
13
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
14
14
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
15
15
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
16
|
+
import { u as useReferenceElement, r as referenceElementManager } from "../../chunks/manager.js";
|
|
16
17
|
const SLOTS = {
|
|
17
18
|
trigger: "trigger"
|
|
18
19
|
};
|
|
@@ -22,9 +23,11 @@ const CSS = {
|
|
|
22
23
|
triggerContainer: "trigger-container"
|
|
23
24
|
};
|
|
24
25
|
const styles = css`:host([disabled]){cursor:default;-webkit-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display: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;z-index:var(--calcite-z-index);border-radius:.25rem}.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}}.content{max-height:45vh;width:auto;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-color-foreground-1))}.trigger-container{position:relative;display:flex;height:100%;flex:1 1 auto;word-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:1}.interaction-container{display:contents}`;
|
|
26
|
+
const manager = referenceElementManager({ click: true, hover: true });
|
|
25
27
|
class Dropdown extends LitElement {
|
|
26
28
|
constructor() {
|
|
27
29
|
super();
|
|
30
|
+
this.referenceElementController = useReferenceElement({ manager })(this);
|
|
28
31
|
this.direction = useDirection();
|
|
29
32
|
this.focusLastDropdownItem = false;
|
|
30
33
|
this.activeItemIndex = -1;
|
|
@@ -33,6 +36,7 @@ class Dropdown extends LitElement {
|
|
|
33
36
|
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
|
34
37
|
this.transitionProp = "opacity";
|
|
35
38
|
this.resizeObserver = createObserver("resize", (entries) => this.resizeObserverCallback(entries));
|
|
39
|
+
this.onReferenceElementKeyDown = (event) => this.keyDownHandler(event);
|
|
36
40
|
this.focusSetter = useSetFocus()(this);
|
|
37
41
|
this.interactiveContainer = useInteractive(this);
|
|
38
42
|
this.topLayer = useTopLayer({
|
|
@@ -62,7 +66,7 @@ class Dropdown extends LitElement {
|
|
|
62
66
|
this.listen("calciteInternalDropdownItemSelect", this.handleItemSelect);
|
|
63
67
|
}
|
|
64
68
|
static {
|
|
65
|
-
this.properties = { activeDescendantElement: [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 }], 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 }] };
|
|
69
|
+
this.properties = { activeDescendantElement: [16, {}, { state: true }], 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 }] };
|
|
66
70
|
}
|
|
67
71
|
static {
|
|
68
72
|
this.shadowRootOptions = { mode: "open", delegatesFocus: true };
|
|
@@ -70,6 +74,9 @@ class Dropdown extends LitElement {
|
|
|
70
74
|
static {
|
|
71
75
|
this.styles = styles;
|
|
72
76
|
}
|
|
77
|
+
get referenceElementType() {
|
|
78
|
+
return this.referenceElement ? this.type : null;
|
|
79
|
+
}
|
|
73
80
|
async reposition(delayed = false) {
|
|
74
81
|
const { filteredFlipPlacements, floatingEl, offsetDistance, offsetSkidding, overlayPositioning, placement, referenceEl } = this;
|
|
75
82
|
return reposition(this, {
|
|
@@ -85,7 +92,7 @@ class Dropdown extends LitElement {
|
|
|
85
92
|
}, delayed);
|
|
86
93
|
}
|
|
87
94
|
async setFocus(options) {
|
|
88
|
-
return this.focusSetter(() => this.referenceEl, options);
|
|
95
|
+
return this.focusSetter(() => this.referenceEl instanceof HTMLElement ? this.referenceEl : this.floatingEl, options);
|
|
89
96
|
}
|
|
90
97
|
connectedCallback() {
|
|
91
98
|
super.connectedCallback();
|
|
@@ -113,6 +120,14 @@ class Dropdown extends LitElement {
|
|
|
113
120
|
if (changes.has("scale") && (this.hasUpdated || this.scale !== "m")) {
|
|
114
121
|
this.handlePropsChange();
|
|
115
122
|
}
|
|
123
|
+
if (changes.has("referenceElement") && !this.referenceElement && this.open) {
|
|
124
|
+
this.topLayer.hide();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
updated(changes) {
|
|
128
|
+
if (changes.has("referenceEl") && this.referenceElementType) {
|
|
129
|
+
connectFloatingUI(this);
|
|
130
|
+
}
|
|
116
131
|
}
|
|
117
132
|
loaded() {
|
|
118
133
|
this.updateSelectedItems();
|
|
@@ -145,25 +160,25 @@ class Dropdown extends LitElement {
|
|
|
145
160
|
this.updateGroupProps();
|
|
146
161
|
}
|
|
147
162
|
closeCalciteDropdownOnClick(event) {
|
|
148
|
-
if (this.disabled || !this.open || event.composedPath().includes(this.el)) {
|
|
163
|
+
if (this.referenceElementType || this.disabled || !this.open || event.composedPath().includes(this.el)) {
|
|
149
164
|
return;
|
|
150
165
|
}
|
|
151
166
|
this.closeCalciteDropdown();
|
|
152
167
|
}
|
|
153
168
|
closeCalciteDropdownOnOpenEvent(event) {
|
|
154
|
-
if (event.composedPath().includes(this.el)) {
|
|
169
|
+
if (this.referenceElementType || event.composedPath().includes(this.el)) {
|
|
155
170
|
return;
|
|
156
171
|
}
|
|
157
172
|
this.closeCalciteDropdown();
|
|
158
173
|
}
|
|
159
174
|
pointerEnterHandler() {
|
|
160
|
-
if (this.disabled || this.type !== "hover") {
|
|
175
|
+
if (this.referenceElementType || this.disabled || this.type !== "hover") {
|
|
161
176
|
return;
|
|
162
177
|
}
|
|
163
178
|
this.open = true;
|
|
164
179
|
}
|
|
165
180
|
pointerLeaveHandler() {
|
|
166
|
-
if (this.disabled || this.type !== "hover") {
|
|
181
|
+
if (this.referenceElementType || this.disabled || this.type !== "hover") {
|
|
167
182
|
return;
|
|
168
183
|
}
|
|
169
184
|
this.closeCalciteDropdown();
|
|
@@ -215,7 +230,7 @@ class Dropdown extends LitElement {
|
|
|
215
230
|
}
|
|
216
231
|
setDropdownWidth() {
|
|
217
232
|
const { referenceEl, scrollerEl } = this;
|
|
218
|
-
if (!scrollerEl || !referenceEl) {
|
|
233
|
+
if (!scrollerEl || !(referenceEl instanceof HTMLElement)) {
|
|
219
234
|
return;
|
|
220
235
|
}
|
|
221
236
|
scrollerEl.style.minWidth = `${referenceEl.clientWidth}px`;
|
|
@@ -251,7 +266,9 @@ class Dropdown extends LitElement {
|
|
|
251
266
|
this.topLayer.hide();
|
|
252
267
|
}
|
|
253
268
|
setReferenceEl(el) {
|
|
254
|
-
|
|
269
|
+
const previousReferenceEl = this.referenceEl instanceof HTMLElement ? this.referenceEl : null;
|
|
270
|
+
const nextReferenceEl = el instanceof HTMLElement ? el : null;
|
|
271
|
+
updateRefObserver(this.resizeObserver, previousReferenceEl, nextReferenceEl);
|
|
255
272
|
this.referenceEl = el;
|
|
256
273
|
connectFloatingUI(this);
|
|
257
274
|
}
|
|
@@ -260,7 +277,7 @@ class Dropdown extends LitElement {
|
|
|
260
277
|
connectFloatingUI(this);
|
|
261
278
|
}
|
|
262
279
|
keyDownHandler(event) {
|
|
263
|
-
if (!event.composedPath().includes(this.referenceEl)) {
|
|
280
|
+
if (!(this.referenceEl instanceof HTMLElement) || !event.composedPath().includes(this.referenceEl)) {
|
|
264
281
|
return;
|
|
265
282
|
}
|
|
266
283
|
const { defaultPrevented, key } = event;
|
|
@@ -413,7 +430,7 @@ class Dropdown extends LitElement {
|
|
|
413
430
|
return;
|
|
414
431
|
}
|
|
415
432
|
const relatedTarget = event.relatedTarget;
|
|
416
|
-
if (relatedTarget && (this.el.contains(relatedTarget) || this.referenceEl != null && this.referenceEl.contains(relatedTarget))) {
|
|
433
|
+
if (relatedTarget && (this.el.contains(relatedTarget) || this.referenceEl != null && this.referenceEl instanceof HTMLElement && this.referenceEl.contains(relatedTarget))) {
|
|
417
434
|
return;
|
|
418
435
|
}
|
|
419
436
|
this.closeCalciteDropdown();
|
|
@@ -426,10 +443,10 @@ class Dropdown extends LitElement {
|
|
|
426
443
|
}
|
|
427
444
|
render() {
|
|
428
445
|
const { open } = this;
|
|
429
|
-
return this.interactiveContainer({ disabled: this.disabled, children: html`<div class=${safeClassMap(CSS.triggerContainer)} @click=${this.toggleClickDropdown} @focusin=${this.openHoverDropdown} @focusout=${this.closeHoverDropdown} @keydown=${this.keyDownHandler} ${ref(this.setReferenceEl)}><slot .ariaActiveDescendantElement=${this.activeDescendantElement ?? null} .ariaControlsElements=${this.scrollerEl ? [this.scrollerEl] : void 0} .ariaExpanded=${open} aria-haspopup=menu name=${SLOTS.trigger}></slot></div
|
|
446
|
+
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 .ariaActiveDescendantElement=${this.activeDescendantElement ?? null} .ariaControlsElements=${this.scrollerEl ? [this.scrollerEl] : void 0} .ariaExpanded=${open} aria-haspopup=menu name=${SLOTS.trigger}></slot></div>` : null}<div class=${safeClassMap({
|
|
430
447
|
[CSS.wrapper]: true,
|
|
431
448
|
[getDimensionClass("width", this.width, this.widthScale)]: !!(this.width || this.widthScale)
|
|
432
|
-
})} .inert=${!open} popover=manual ${ref(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl ? [this.referenceEl] : void 0} class=${safeClassMap({
|
|
449
|
+
})} .inert=${!open} popover=manual ${ref(this.setFloatingEl)}><div .ariaLabelledByElements=${this.referenceEl instanceof HTMLElement ? [this.referenceEl] : void 0} class=${safeClassMap({
|
|
433
450
|
[CSS.content]: true,
|
|
434
451
|
[FloatingCSS.animation]: true,
|
|
435
452
|
[FloatingCSS.animationActive]: open
|
|
@@ -8,7 +8,6 @@ import { LitElement, createEvent, safeClassMap, safeStyleMap } from "@arcgis/lum
|
|
|
8
8
|
import { m as slotChangeHasContent, s as slotChangeHasAssignedElement, e as getRootNode } from "../../chunks/dom.js";
|
|
9
9
|
import { c as createObserver } from "../../chunks/observers.js";
|
|
10
10
|
import { l as listItemSelector, i as isListItem, a as listSelector, u as updateListItemChildren, b as listItemGroupSelector, e as expandedAncestors } from "../../chunks/utils4.js";
|
|
11
|
-
import { d as disconnectSortableComponent, c as connectSortableComponent } from "../../chunks/sortableComponent.js";
|
|
12
11
|
import { S as SLOTS$1 } from "../../chunks/resources8.js";
|
|
13
12
|
import { n as numberStringFormatter } from "../../chunks/locale.js";
|
|
14
13
|
import { g as guid } from "../../chunks/guid.js";
|
|
@@ -16,6 +15,7 @@ import { u as useT9n } from "../../chunks/useT9n.js";
|
|
|
16
15
|
import { u as useCancelable } from "../../chunks/useCancelable.js";
|
|
17
16
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
18
17
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
18
|
+
import { u as useSortable } from "../../chunks/useSortable.js";
|
|
19
19
|
const CSS = {
|
|
20
20
|
container: "container",
|
|
21
21
|
table: "table",
|
|
@@ -47,6 +47,7 @@ class List extends LitElement {
|
|
|
47
47
|
this.updateListItemsDebounced();
|
|
48
48
|
});
|
|
49
49
|
this.cancelable = useCancelable()(this);
|
|
50
|
+
this.sortable = useSortable()(this);
|
|
50
51
|
this.updateListItemsDebounced = debounce(this.updateListItems, DEBOUNCE.nextTick);
|
|
51
52
|
this.visibleItems = [];
|
|
52
53
|
this.willFilterEmit = false;
|
|
@@ -154,7 +155,6 @@ class List extends LitElement {
|
|
|
154
155
|
super.disconnectedCallback();
|
|
155
156
|
this.disconnectObserver();
|
|
156
157
|
this.unobserveFilterRow();
|
|
157
|
-
disconnectSortableComponent(this);
|
|
158
158
|
}
|
|
159
159
|
updateListItems() {
|
|
160
160
|
this.updateGroupItems();
|
|
@@ -342,7 +342,7 @@ class List extends LitElement {
|
|
|
342
342
|
if (defaultSlotEl) {
|
|
343
343
|
updateListItemChildren(defaultSlotEl);
|
|
344
344
|
}
|
|
345
|
-
|
|
345
|
+
this.sortable.reset();
|
|
346
346
|
}
|
|
347
347
|
onGlobalDragStart() {
|
|
348
348
|
this.disconnectObserver();
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import type { DragDetail } from "../../
|
|
1
|
+
import type { DragDetail } from "../../controllers/useSortable.js";
|
|
2
2
|
import type { ListItem } from "../calcite-list-item/customElement.js";
|
|
3
3
|
import type { List } from "./customElement.js";
|
|
4
4
|
|
|
5
5
|
export type ListDisplayMode = "flat" | "nested";
|
|
6
6
|
|
|
7
|
-
export
|
|
8
|
-
toEl: List;
|
|
9
|
-
fromEl: List;
|
|
10
|
-
dragEl: ListItem;
|
|
11
|
-
}
|
|
7
|
+
export type ListDragDetail = DragDetail<List, List, ListItem>;
|
|
@@ -5,7 +5,7 @@ import { css, html, nothing } from "lit";
|
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
|
|
7
7
|
import { useDirection } from "@arcgis/lumina/controllers";
|
|
8
|
-
import { s as slotChangeHasAssignedElement,
|
|
8
|
+
import { s as slotChangeHasAssignedElement, y as getFirstTabbable } from "../../chunks/dom.js";
|
|
9
9
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
10
10
|
import { g as getIconScale } from "../../chunks/component.js";
|
|
11
11
|
import { l as logger } from "../../chunks/logger.js";
|
|
@@ -5,7 +5,7 @@ import { css, html } from "lit";
|
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { LitElement, safeClassMap, safeStyleMap } from "@arcgis/lumina";
|
|
7
7
|
import { n as numberStringFormatter } from "../../chunks/locale.js";
|
|
8
|
-
import {
|
|
8
|
+
import { z as intersects } from "../../chunks/dom.js";
|
|
9
9
|
import { c as createObserver } from "../../chunks/observers.js";
|
|
10
10
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
11
11
|
const CSS = {
|
|
@@ -9,11 +9,12 @@ import { e as defaultOffsetDistance, r as reposition, c as connectFloatingUI, a
|
|
|
9
9
|
import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
|
|
10
10
|
import { H as Heading } from "../../chunks/Heading.js";
|
|
11
11
|
import { c as createObserver } from "../../chunks/observers.js";
|
|
12
|
-
import {
|
|
12
|
+
import { F as FloatingArrow } from "../../chunks/FloatingArrow.js";
|
|
13
13
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
14
14
|
import { u as useFocusTrap } from "../../chunks/useFocusTrap.js";
|
|
15
15
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
16
16
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
17
|
+
import { u as useReferenceElement, r as referenceElementManager } from "../../chunks/manager.js";
|
|
17
18
|
const CSS = {
|
|
18
19
|
positionContainer: "position-container",
|
|
19
20
|
container: "container",
|
|
@@ -1,15 +1,183 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
-
import { css, nothing
|
|
3
|
+
import { html, isServer, css, nothing } from "lit";
|
|
4
4
|
import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
|
|
5
5
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
6
6
|
import { useDirection } from "@arcgis/lumina/controllers";
|
|
7
7
|
import { g as getRoundRobinIndex } from "../../chunks/array.js";
|
|
8
|
-
import {
|
|
8
|
+
import { q as queryElementRoots, c as closestElementCrossShadowBoundary } from "../../chunks/dom.js";
|
|
9
9
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
10
10
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
11
11
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
12
12
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
13
|
+
const hiddenFormInputSlotName = "hidden-form-input";
|
|
14
|
+
function isCheckable(component) {
|
|
15
|
+
return "checked" in component;
|
|
16
|
+
}
|
|
17
|
+
const onFormResetMap = /* @__PURE__ */ new WeakMap();
|
|
18
|
+
const formComponentSet = /* @__PURE__ */ new WeakSet();
|
|
19
|
+
function hasRegisteredFormComponentParent(form, formComponentEl) {
|
|
20
|
+
const hasParentComponentWithFormIdSet = closestElementCrossShadowBoundary(formComponentEl.parentElement, "[form]");
|
|
21
|
+
if (hasParentComponentWithFormIdSet) {
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
const formComponentRegisterEventName = "calciteInternalFormComponentRegister";
|
|
25
|
+
let hasRegisteredFormComponentParent2 = false;
|
|
26
|
+
form.addEventListener(formComponentRegisterEventName, (event) => {
|
|
27
|
+
hasRegisteredFormComponentParent2 = event.composedPath().some((element) => formComponentSet.has(element));
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
}, { once: true });
|
|
30
|
+
formComponentEl.dispatchEvent(new CustomEvent(formComponentRegisterEventName, {
|
|
31
|
+
bubbles: true,
|
|
32
|
+
composed: true
|
|
33
|
+
}));
|
|
34
|
+
return hasRegisteredFormComponentParent2;
|
|
35
|
+
}
|
|
36
|
+
function getValidationComponent(el) {
|
|
37
|
+
if (el.nodeName === "CALCITE-RADIO-BUTTON") {
|
|
38
|
+
return closestElementCrossShadowBoundary(el, "calcite-radio-button-group");
|
|
39
|
+
}
|
|
40
|
+
return el;
|
|
41
|
+
}
|
|
42
|
+
function connectForm(component) {
|
|
43
|
+
const { el, value } = component;
|
|
44
|
+
const associatedForm = findAssociatedForm(component);
|
|
45
|
+
if (!associatedForm || hasRegisteredFormComponentParent(associatedForm, el)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
component.formEl = associatedForm;
|
|
49
|
+
component.defaultValue = value;
|
|
50
|
+
if (isCheckable(component)) {
|
|
51
|
+
component.defaultChecked = component.checked;
|
|
52
|
+
}
|
|
53
|
+
const boundOnFormReset = onFormReset.bind(component);
|
|
54
|
+
associatedForm.addEventListener("reset", boundOnFormReset);
|
|
55
|
+
onFormResetMap.set(component.el, boundOnFormReset);
|
|
56
|
+
formComponentSet.add(el);
|
|
57
|
+
}
|
|
58
|
+
function findAssociatedForm(component) {
|
|
59
|
+
const { el, form } = component;
|
|
60
|
+
return form ? queryElementRoots(el, { id: form }) : closestElementCrossShadowBoundary(el, "form");
|
|
61
|
+
}
|
|
62
|
+
function onFormReset() {
|
|
63
|
+
if ("status" in this) {
|
|
64
|
+
this.status = "idle";
|
|
65
|
+
}
|
|
66
|
+
if ("validationIcon" in this) {
|
|
67
|
+
this.validationIcon = false;
|
|
68
|
+
}
|
|
69
|
+
if ("validationMessage" in this) {
|
|
70
|
+
this.validationMessage = "";
|
|
71
|
+
}
|
|
72
|
+
if (isCheckable(this)) {
|
|
73
|
+
this.checked = this.defaultChecked;
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this.value = this.defaultValue;
|
|
77
|
+
this.onFormReset?.();
|
|
78
|
+
}
|
|
79
|
+
function disconnectForm(component) {
|
|
80
|
+
const { el, formEl } = component;
|
|
81
|
+
if (!formEl) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const boundOnFormReset = onFormResetMap.get(el);
|
|
85
|
+
formEl.removeEventListener("reset", boundOnFormReset);
|
|
86
|
+
onFormResetMap.delete(el);
|
|
87
|
+
component.formEl = null;
|
|
88
|
+
formComponentSet.delete(el);
|
|
89
|
+
}
|
|
90
|
+
const internalHiddenInputInputEvent = "calciteInternalHiddenInputInput";
|
|
91
|
+
const hiddenInputInputHandler = (event) => {
|
|
92
|
+
event.target.dispatchEvent(new CustomEvent(internalHiddenInputInputEvent, { bubbles: true }));
|
|
93
|
+
};
|
|
94
|
+
const removeHiddenInputChangeEventListener = (input) => input.removeEventListener("input", hiddenInputInputHandler);
|
|
95
|
+
function syncHiddenFormInput(component) {
|
|
96
|
+
const { el, formEl, name, value } = component;
|
|
97
|
+
const { ownerDocument } = el;
|
|
98
|
+
if (isServer) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
const inputs = el.querySelectorAll(`input[slot="${hiddenFormInputSlotName}"]`);
|
|
102
|
+
if (!formEl || !name) {
|
|
103
|
+
inputs.forEach((input) => {
|
|
104
|
+
removeHiddenInputChangeEventListener(input);
|
|
105
|
+
input.remove();
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
const values = Array.isArray(value) ? value : [value];
|
|
110
|
+
const extra = [];
|
|
111
|
+
const seen = /* @__PURE__ */ new Set();
|
|
112
|
+
inputs.forEach((input) => {
|
|
113
|
+
const valueMatch = values.find((val) => (
|
|
114
|
+
/* intentional non-strict equality check */
|
|
115
|
+
val == input.value
|
|
116
|
+
));
|
|
117
|
+
if (valueMatch != null) {
|
|
118
|
+
seen.add(valueMatch);
|
|
119
|
+
defaultSyncHiddenFormInput(component, input, valueMatch);
|
|
120
|
+
} else {
|
|
121
|
+
extra.push(input);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
let docFrag;
|
|
125
|
+
values.forEach((value2) => {
|
|
126
|
+
if (seen.has(value2)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
let input = extra.pop();
|
|
130
|
+
if (!input) {
|
|
131
|
+
input = ownerDocument.createElement("input");
|
|
132
|
+
input.ariaHidden = "true";
|
|
133
|
+
input.slot = hiddenFormInputSlotName;
|
|
134
|
+
}
|
|
135
|
+
if (!docFrag) {
|
|
136
|
+
docFrag = ownerDocument.createDocumentFragment();
|
|
137
|
+
}
|
|
138
|
+
docFrag.append(input);
|
|
139
|
+
input.addEventListener("input", hiddenInputInputHandler);
|
|
140
|
+
defaultSyncHiddenFormInput(component, input, value2);
|
|
141
|
+
});
|
|
142
|
+
if (docFrag) {
|
|
143
|
+
el.append(docFrag);
|
|
144
|
+
}
|
|
145
|
+
extra.forEach((input) => {
|
|
146
|
+
removeHiddenInputChangeEventListener(input);
|
|
147
|
+
input.remove();
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function defaultSyncHiddenFormInput(component, input, value) {
|
|
151
|
+
const { defaultValue, disabled, form, name, required } = component;
|
|
152
|
+
input.defaultValue = defaultValue;
|
|
153
|
+
input.disabled = disabled;
|
|
154
|
+
input.name = name;
|
|
155
|
+
input.required = required;
|
|
156
|
+
input.tabIndex = -1;
|
|
157
|
+
if (form) {
|
|
158
|
+
input.setAttribute("form", form);
|
|
159
|
+
} else {
|
|
160
|
+
input.removeAttribute("form");
|
|
161
|
+
}
|
|
162
|
+
if (isCheckable(component)) {
|
|
163
|
+
input.checked = component.checked;
|
|
164
|
+
input.defaultChecked = component.defaultChecked;
|
|
165
|
+
input.value = component.checked ? value || "on" : "";
|
|
166
|
+
} else {
|
|
167
|
+
input.value = value || "";
|
|
168
|
+
}
|
|
169
|
+
component.syncHiddenFormInput?.(input);
|
|
170
|
+
const validationComponent = getValidationComponent(component.el);
|
|
171
|
+
if (validationComponent && "validity" in validationComponent) {
|
|
172
|
+
for (const key in { ...input?.validity }) {
|
|
173
|
+
validationComponent.validity[key] = input.validity[key];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
const HiddenFormInputSlot = ({ component }) => {
|
|
178
|
+
syncHiddenFormInput(component);
|
|
179
|
+
return html`<slot name=${hiddenFormInputSlotName}></slot>`;
|
|
180
|
+
};
|
|
13
181
|
const CSS = {
|
|
14
182
|
container: "container",
|
|
15
183
|
radio: "radio"
|
|
@@ -5,7 +5,7 @@ import { css, html, nothing } from "lit";
|
|
|
5
5
|
import { LitElement, createEvent, stringOrBoolean, setAttribute, safeClassMap, safeStyleMap } from "@arcgis/lumina";
|
|
6
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
7
7
|
import { g as guid } from "../../chunks/guid.js";
|
|
8
|
-
import { j as isPrimaryPointerButton,
|
|
8
|
+
import { j as isPrimaryPointerButton, z as intersects } from "../../chunks/dom.js";
|
|
9
9
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
10
10
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
11
11
|
import { i as isActivationKey } from "../../chunks/key.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
3
|
import type { Layout } from "../interfaces.js";
|
|
4
|
-
import type { DragDetail } from "../../
|
|
4
|
+
import type { DragDetail } from "../../controllers/useSortable.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use the `calcite-block-group` component instead.
|
|
@@ -3,10 +3,10 @@ import { c as customElement } from "../../chunks/runtime.js";
|
|
|
3
3
|
import { css, html } from "lit";
|
|
4
4
|
import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
|
|
5
5
|
import { c as createObserver } from "../../chunks/observers.js";
|
|
6
|
-
import { d as disconnectSortableComponent, c as connectSortableComponent } from "../../chunks/sortableComponent.js";
|
|
7
6
|
import { i as focusElement } from "../../chunks/dom.js";
|
|
8
7
|
import { l as logger } from "../../chunks/logger.js";
|
|
9
8
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
9
|
+
import { u as useSortable } from "../../chunks/useSortable.js";
|
|
10
10
|
const CSS = {
|
|
11
11
|
container: "container",
|
|
12
12
|
containerHorizontal: "container--horizontal",
|
|
@@ -21,6 +21,7 @@ class SortableList extends LitElement {
|
|
|
21
21
|
this.mutationObserver = createObserver("mutation", () => {
|
|
22
22
|
this.setUpSorting();
|
|
23
23
|
});
|
|
24
|
+
this.sortable = useSortable()(this);
|
|
24
25
|
this.interactiveContainer = useInteractive(this);
|
|
25
26
|
this.disabled = false;
|
|
26
27
|
this.handleSelector = "calcite-handle";
|
|
@@ -50,7 +51,6 @@ class SortableList extends LitElement {
|
|
|
50
51
|
}
|
|
51
52
|
disconnectedCallback() {
|
|
52
53
|
super.disconnectedCallback();
|
|
53
|
-
disconnectSortableComponent(this);
|
|
54
54
|
this.endObserving();
|
|
55
55
|
}
|
|
56
56
|
calciteHandleNudgeNextHandler(event) {
|
|
@@ -110,7 +110,7 @@ class SortableList extends LitElement {
|
|
|
110
110
|
}
|
|
111
111
|
setUpSorting() {
|
|
112
112
|
this.items = Array.from(this.el.children);
|
|
113
|
-
|
|
113
|
+
this.sortable.reset();
|
|
114
114
|
}
|
|
115
115
|
beginObserving() {
|
|
116
116
|
this.mutationObserver?.observe(this.el, { childList: true, subtree: true });
|
|
@@ -7,8 +7,9 @@ import { createRef, ref } from "lit/directives/ref.js";
|
|
|
7
7
|
import { useDirection } from "@arcgis/lumina/controllers";
|
|
8
8
|
import { e as defaultOffsetDistance, r as reposition, c as connectFloatingUI, a as disconnectFloatingUI, h as hideFloatingUI, F as FloatingCSS } from "../../chunks/floating-ui.js";
|
|
9
9
|
import { t as toggleOpenClose } from "../../chunks/openCloseComponent.js";
|
|
10
|
-
import {
|
|
10
|
+
import { F as FloatingArrow } from "../../chunks/FloatingArrow.js";
|
|
11
11
|
import { u as useTopLayer } from "../../chunks/useTopLayer.js";
|
|
12
|
+
import { u as useReferenceElement, r as referenceElementManager } from "../../chunks/manager.js";
|
|
12
13
|
const CSS = {
|
|
13
14
|
positionContainer: "position-container",
|
|
14
15
|
container: "container"
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SortableEvent } from "sortablejs";
|
|
2
|
+
|
|
3
|
+
export interface DragDetail<To extends HTMLElement = HTMLElement, From extends HTMLElement = HTMLElement, Drag extends HTMLElement = HTMLElement> extends Pick<SortableEvent, "newIndex" | "oldIndex"> {
|
|
4
|
+
toEl: To;
|
|
5
|
+
fromEl: From;
|
|
6
|
+
dragEl: Drag;
|
|
7
|
+
}
|