@esri/calcite-components 5.1.0-next.16 → 5.1.0-next.18
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/{MXTI6FSG.js → 22PQT263.js} +1 -1
- package/dist/cdn/{3FL52ZND.js → 24C3KHYK.js} +1 -1
- package/dist/cdn/{CUSVTTUR.js → 26GDRJ2L.js} +1 -1
- package/dist/cdn/{GRBSTFCZ.js → 2HK44IRU.js} +1 -1
- package/dist/cdn/{LPD3GVQK.js → 32KAH62F.js} +1 -1
- package/dist/cdn/{XBMNTFUD.js → 35OURK5J.js} +1 -1
- package/dist/cdn/{R7QJ22GZ.js → 3UTOYDRU.js} +1 -1
- package/dist/cdn/42NWEV6Z.js +2 -0
- package/dist/cdn/{HQ4VQSWC.js → 4H4BZCL6.js} +1 -1
- package/dist/cdn/{BUFDX74V.js → 4OQITOGB.js} +1 -1
- package/dist/cdn/{GIHSUITL.js → 4TKTULYX.js} +1 -1
- package/dist/cdn/{VN6ZIHNO.js → 5AIKSJ2S.js} +1 -1
- package/dist/cdn/{CT6Q7KSN.js → 5BDXHQGH.js} +1 -1
- package/dist/cdn/{D7HRC4ZF.js → 5OENNBKE.js} +1 -1
- package/dist/cdn/{UMCWAM6U.js → 5TV76YXX.js} +1 -1
- package/dist/cdn/{RTQEH2GI.js → 623SRMWS.js} +1 -1
- package/dist/cdn/{SJDETR7P.js → 6DKVHOPA.js} +1 -1
- package/dist/cdn/{TM56DVXI.js → 736DRHW4.js} +1 -1
- package/dist/cdn/{VRN5P5H2.js → 77DSC2EX.js} +1 -1
- package/dist/cdn/{Q4EAVGXD.js → 7HYWLV2S.js} +1 -1
- package/dist/cdn/{VJPJSN5X.js → A6C4FF2U.js} +1 -1
- package/dist/cdn/{ROFUINHU.js → AHTEBJ5Z.js} +1 -1
- package/dist/cdn/{2I7SUD7B.js → AMXNQ3QU.js} +1 -1
- package/dist/cdn/{IDSCNNKO.js → AQHPEIUH.js} +1 -1
- package/dist/cdn/{DJU6QGEO.js → ASSK7AZ6.js} +1 -1
- package/dist/cdn/{XOSVBL4Q.js → B6CFL6NY.js} +1 -1
- package/dist/cdn/BB7S45XD.js +2 -0
- package/dist/cdn/BD3RMGKQ.js +2 -0
- package/dist/cdn/{FMBWQGBD.js → BEZFHBHG.js} +1 -1
- package/dist/cdn/{E4DUTEUJ.js → BI7YRL2Q.js} +1 -1
- package/dist/cdn/{Z4MO3QA3.js → BNICLT4M.js} +1 -1
- package/dist/cdn/{UUMSMAKL.js → C3DVAPZA.js} +1 -1
- package/dist/cdn/{FTZQSPJV.js → C6PEZF4U.js} +1 -1
- package/dist/cdn/{CCLZ2M6Y.js → CK3VYCGZ.js} +1 -1
- package/dist/cdn/{W3RPQ6MS.js → DDQGXVLN.js} +1 -1
- package/dist/cdn/{HJUPDBFP.js → DGAU5AKL.js} +1 -1
- package/dist/cdn/{IXGB4XHR.js → DHWDS2CM.js} +1 -1
- package/dist/cdn/{6JHQQFOY.js → DNXXRTLM.js} +1 -1
- package/dist/cdn/{FFHJEWMN.js → DO6MO2UO.js} +1 -1
- package/dist/cdn/{HNMZXQBU.js → DRIV3K36.js} +1 -1
- package/dist/cdn/{JAVQLJ7T.js → DUDSRKRT.js} +1 -1
- package/dist/cdn/{IXSYQNSX.js → DUVDJGX7.js} +1 -1
- package/dist/cdn/{QTKB6HQJ.js → EAEYA67W.js} +1 -1
- package/dist/cdn/{FOK55KL6.js → EMPXMHPJ.js} +1 -1
- package/dist/cdn/{WILNR5SN.js → ETSFQFNX.js} +1 -1
- package/dist/cdn/{7CFYSRPL.js → EXD4VLQ6.js} +1 -1
- package/dist/cdn/{IFMDATQK.js → F3VCECBU.js} +1 -1
- package/dist/cdn/{2RA3BQML.js → FC3BH35C.js} +1 -1
- package/dist/cdn/{JNUWJXXR.js → FH3PFJUY.js} +1 -1
- package/dist/cdn/{FA6DCP2J.js → FOMDWSQE.js} +1 -1
- package/dist/cdn/{PD2L5MT6.js → FWP7F6DX.js} +1 -1
- package/dist/cdn/{U26JLQXM.js → GZDBGP7N.js} +1 -1
- package/dist/cdn/{PQQ4547C.js → H5LBDYG7.js} +1 -1
- package/dist/cdn/{3IWXK4DE.js → H6WUBDPK.js} +1 -1
- package/dist/cdn/{4JPWYI6P.js → H73ZP5LD.js} +1 -1
- package/dist/cdn/{I2XVC2LX.js → H7QT3HBJ.js} +1 -1
- package/dist/cdn/{QF337ROB.js → HPJ5T73I.js} +1 -1
- package/dist/cdn/{X55DE45N.js → HXXXF7KO.js} +1 -1
- package/dist/cdn/{TPQ3ZNST.js → HZF3S4QF.js} +1 -1
- package/dist/cdn/{VRMSWTOS.js → I6LNGTRO.js} +1 -1
- package/dist/cdn/ILI77CFP.js +2 -0
- package/dist/cdn/{I7537AYI.js → IQ6JMSND.js} +1 -1
- package/dist/cdn/{4XY5BWMS.js → ISFW56FZ.js} +1 -1
- package/dist/cdn/{UZD5E73A.js → ITHCW3QL.js} +1 -1
- package/dist/cdn/{TG6GRZTK.js → IXW27ENW.js} +1 -1
- package/dist/cdn/{GKYHDFSD.js → JEMWDE6Y.js} +1 -1
- package/dist/cdn/JWSAQOVT.js +2 -0
- package/dist/cdn/{4OY5PUW5.js → K3PVB3LV.js} +1 -1
- package/dist/cdn/{3TX4PFQ2.js → KBBM67ZB.js} +1 -1
- package/dist/cdn/KL3A4A2N.js +2 -0
- package/dist/cdn/{3I42BHHS.js → KVPUYHTQ.js} +1 -1
- package/dist/cdn/{JAGBFPZN.js → L32WVMMX.js} +1 -1
- package/dist/cdn/{LTKLSUME.js → L6VY4IZH.js} +1 -1
- package/dist/cdn/{RGVVXWMZ.js → LA52VQPT.js} +1 -1
- package/dist/cdn/{IIIJEPLQ.js → LIHQ7PVA.js} +1 -1
- package/dist/cdn/{6YSO45WO.js → LN3LSI7S.js} +1 -1
- package/dist/cdn/{B3Q5JTJB.js → M3INYSTO.js} +1 -1
- package/dist/cdn/{BYL555XX.js → M6IUO6IZ.js} +1 -1
- package/dist/cdn/{XGLG45LP.js → MD6FZLNP.js} +1 -1
- package/dist/cdn/{BEHY4WA4.js → MENCU452.js} +1 -1
- package/dist/cdn/MQKGBGA3.js +2 -0
- package/dist/cdn/{QVP4MNIF.js → MV5ECLMR.js} +1 -1
- package/dist/cdn/{DJP5SNBS.js → MYGJ52YN.js} +1 -1
- package/dist/cdn/{VTWFWWDW.js → MZJKKFFI.js} +1 -1
- package/dist/cdn/NCMBGHKV.js +2 -0
- package/dist/cdn/{ISWH2HSE.js → NRVQA6UD.js} +1 -1
- package/dist/cdn/OPRN5CRW.js +2 -0
- package/dist/cdn/{4LH6SHX6.js → OQFMYWF3.js} +1 -1
- package/dist/cdn/{ZMUMATIQ.js → OT7XFDEB.js} +1 -1
- package/dist/cdn/{NGNFE76P.js → OVH566HY.js} +1 -1
- package/dist/cdn/{4EA4NN3Y.js → OWLHEGYR.js} +1 -1
- package/dist/cdn/{AMBA2EUA.js → P3EJMK3K.js} +1 -1
- package/dist/cdn/{LQ7KQDLQ.js → P64PZE5S.js} +1 -1
- package/dist/cdn/PEW5RZYH.js +2 -0
- package/dist/cdn/{WZMGO7LL.js → PFJV42H6.js} +1 -1
- package/dist/cdn/{AXJTRFKH.js → PJ6E2WWQ.js} +1 -1
- package/dist/cdn/{KNWNPJJO.js → PKL4RJ3I.js} +1 -1
- package/dist/cdn/Q2M6DFTT.js +2 -0
- package/dist/cdn/{KWDM6JLE.js → Q7KREJDD.js} +1 -1
- package/dist/cdn/{U7QOHO34.js → Q7N7YE7C.js} +1 -1
- package/dist/cdn/QI7OFLTX.js +2 -0
- package/dist/cdn/{JLF2KDUL.js → QLZHCTZM.js} +1 -1
- package/dist/cdn/{LTGUCBSN.js → QPIVL4MU.js} +1 -1
- package/dist/cdn/{TT7IUW6H.js → QVGQ7FVR.js} +1 -1
- package/dist/cdn/{SUABQCPU.js → R5KY2VYM.js} +1 -1
- package/dist/cdn/{LJVVEOJW.js → RLVITQ7L.js} +1 -1
- package/dist/cdn/{DBSSYOP5.js → ROWZY3RC.js} +1 -1
- package/dist/cdn/{HIIBFQXO.js → RPU52HDN.js} +1 -1
- package/dist/cdn/{EGC32ZE3.js → RYSRTRF6.js} +1 -1
- package/dist/cdn/{R6IKEF36.js → RZI54MXM.js} +1 -1
- package/dist/cdn/{YM7GNJYN.js → SFDWMTKC.js} +1 -1
- package/dist/cdn/{UHF5WWSO.js → SMMAGIIC.js} +1 -1
- package/dist/cdn/{Y2IQY2EY.js → SPL63LN5.js} +1 -1
- package/dist/cdn/{PX6D64G5.js → SPQ334F6.js} +1 -1
- package/dist/cdn/{3PS6ZCOJ.js → SV2D6WTU.js} +1 -1
- package/dist/cdn/{AA3DXSPP.js → U4DMH6YM.js} +1 -1
- package/dist/cdn/{QBBSIVGA.js → U75BL3NA.js} +1 -1
- package/dist/cdn/{KGUBLLAN.js → UA2MCESW.js} +1 -1
- package/dist/cdn/{XLHOSPQ5.js → UHRY64O3.js} +1 -1
- package/dist/cdn/{F5W7XT2Q.js → UNIPTT3B.js} +1 -1
- package/dist/cdn/UTQQM2LE.js +2 -0
- package/dist/cdn/UZCIMYHE.js +2 -0
- package/dist/cdn/{VXTK2DRE.js → VCI4KAKP.js} +1 -1
- package/dist/cdn/{M2RE5X5G.js → VQQFVMF2.js} +1 -1
- package/dist/cdn/{5KNJIBXU.js → W6SF2A6M.js} +1 -1
- package/dist/cdn/{N6H5WSS3.js → WCMZB7U6.js} +1 -1
- package/dist/cdn/{BI6N6OLG.js → WMP2DMFI.js} +1 -1
- package/dist/cdn/{OE3CTVMS.js → WP5WOQU7.js} +1 -1
- package/dist/cdn/{47OK73UM.js → WQZYQVVZ.js} +1 -1
- package/dist/cdn/{TCCEP2M6.js → X2CB6Q6Y.js} +1 -1
- package/dist/cdn/{EQ5QN55S.js → X5X3IQSE.js} +1 -1
- package/dist/cdn/{JM5ZQSHH.js → XGYIUMH7.js} +1 -1
- package/dist/cdn/{62BPSIAC.js → XVDGWRYO.js} +1 -1
- package/dist/cdn/{7TFAWSUU.js → Y745AXFT.js} +1 -1
- package/dist/cdn/{4DGEDSH7.js → YAELQLY3.js} +1 -1
- package/dist/cdn/{5CS4ZHWG.js → YIJUVWIX.js} +1 -1
- package/dist/cdn/{WSPCGNXA.js → YLSQ25XM.js} +1 -1
- package/dist/cdn/YSRNKW53.js +2 -0
- package/dist/cdn/{F6NYDGX3.js → YUM22OLS.js} +1 -1
- package/dist/cdn/{7OS36S45.js → ZJH2BJA2.js} +1 -1
- package/dist/cdn/assets/icon/layerStreamSetting16.json +1 -0
- package/dist/cdn/assets/icon/layerStreamSetting24.json +1 -0
- package/dist/cdn/assets/icon/layerStreamSetting32.json +1 -0
- package/dist/cdn/assets/icon/velocityServer16.json +1 -0
- package/dist/cdn/assets/icon/velocityServer24.json +1 -0
- package/dist/cdn/assets/icon/velocityServer32.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/form.js +0 -1
- package/dist/chunks/runtime.js +4 -4
- package/dist/chunks/useForm.js +98 -25
- package/dist/components/calcite-input-date-picker/customElement.d.ts +1 -1
- package/dist/components/calcite-input-date-picker/customElement.js +30 -14
- package/dist/components/calcite-input-number/customElement.d.ts +1 -1
- package/dist/components/calcite-input-number/customElement.js +11 -24
- package/dist/components/calcite-input-time-picker/customElement.d.ts +1 -1
- package/dist/components/calcite-input-time-picker/customElement.js +10 -9
- package/dist/components/calcite-rating/customElement.d.ts +1 -1
- package/dist/components/calcite-rating/customElement.js +11 -4
- package/dist/components/calcite-segmented-control/customElement.js +7 -5
- package/dist/components/calcite-select/customElement.js +2 -2
- package/dist/components/calcite-slider/customElement.d.ts +1 -1
- package/dist/components/calcite-slider/customElement.js +8 -5
- package/dist/components/calcite-switch/customElement.js +8 -7
- package/dist/components/calcite-tooltip/customElement.d.ts +14 -1
- package/dist/components/calcite-tooltip/customElement.js +14 -7
- 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 +8 -8
- 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/25QNIXKR.js +0 -2
- package/dist/cdn/5IQZAMQB.js +0 -2
- package/dist/cdn/5MAX4LZ7.js +0 -2
- package/dist/cdn/7S2GCYMV.js +0 -2
- package/dist/cdn/7UOYXJ3K.js +0 -2
- package/dist/cdn/BHL2FDAW.js +0 -2
- package/dist/cdn/DID6SDT2.js +0 -2
- package/dist/cdn/EYYSCPVS.js +0 -2
- package/dist/cdn/JUOU7S4Z.js +0 -2
- package/dist/cdn/LGJMKX4S.js +0 -2
- package/dist/cdn/NGCSOSFT.js +0 -2
- package/dist/cdn/OPS2PPMB.js +0 -2
- package/dist/cdn/Q3YSVBG2.js +0 -2
- package/dist/cdn/W6BPLQNJ.js +0 -2
- package/dist/cdn/XCK6T2FY.js +0 -2
- package/dist/cdn/XP2AJQ56.js +0 -2
- package/dist/chunks/input.js +0 -40
|
@@ -3,7 +3,6 @@ import { c as customElement } from "../../chunks/runtime.js";
|
|
|
3
3
|
import { live } from "lit/directives/live.js";
|
|
4
4
|
import { html, css } from "lit";
|
|
5
5
|
import { safeClassMap, LitElement, createEvent, stringOrBoolean, nothing, safeStyleMap } from "@arcgis/lumina";
|
|
6
|
-
import { c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
7
6
|
import { g as guid } from "../../chunks/guid.js";
|
|
8
7
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
9
8
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
@@ -11,6 +10,7 @@ import { V as Validation } from "../../chunks/Validation.js";
|
|
|
11
10
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
12
11
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
13
12
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
13
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
14
14
|
const StarIcon = ({ full, scale, partial }) => html`<calcite-icon class=${safeClassMap(partial ? void 0 : "icon")} .icon=${full ? "star-f" : "star"} .scale=${scale}></calcite-icon>`;
|
|
15
15
|
const CSS = {
|
|
16
16
|
fieldSet: "fieldset",
|
|
@@ -31,6 +31,12 @@ class Rating extends LitElement {
|
|
|
31
31
|
constructor() {
|
|
32
32
|
super();
|
|
33
33
|
this.emit = false;
|
|
34
|
+
this.formSupport = useForm({
|
|
35
|
+
inputType: "number",
|
|
36
|
+
getValue: () => {
|
|
37
|
+
return this.value === 0 ? "" : this.value;
|
|
38
|
+
}
|
|
39
|
+
})(this);
|
|
34
40
|
this.guid = IDS.host(guid());
|
|
35
41
|
this.isKeyboardInteraction = true;
|
|
36
42
|
this.labelElements = [];
|
|
@@ -66,6 +72,9 @@ class Rating extends LitElement {
|
|
|
66
72
|
static {
|
|
67
73
|
this.properties = { hoverValue: [16, {}, { state: true }], average: [11, {}, { reflect: true, type: Number }], count: [11, {}, { reflect: true, type: Number }], disabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], labelText: 1, messageOverrides: [0, {}, { attribute: false }], name: [3, {}, { reflect: true }], readOnly: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], showChip: [7, {}, { reflect: true, type: Boolean }], status: [3, {}, { reflect: true }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: [11, {}, { reflect: true, type: Number }] };
|
|
68
74
|
}
|
|
75
|
+
static {
|
|
76
|
+
this.formAssociated = true;
|
|
77
|
+
}
|
|
69
78
|
static {
|
|
70
79
|
this.styles = styles;
|
|
71
80
|
}
|
|
@@ -87,7 +96,6 @@ class Rating extends LitElement {
|
|
|
87
96
|
connectedCallback() {
|
|
88
97
|
super.connectedCallback();
|
|
89
98
|
connectLabel(this);
|
|
90
|
-
connectForm(this);
|
|
91
99
|
}
|
|
92
100
|
async load() {
|
|
93
101
|
this.requestUpdate("value");
|
|
@@ -122,7 +130,6 @@ class Rating extends LitElement {
|
|
|
122
130
|
disconnectedCallback() {
|
|
123
131
|
super.disconnectedCallback();
|
|
124
132
|
disconnectLabel(this);
|
|
125
|
-
disconnectForm(this);
|
|
126
133
|
}
|
|
127
134
|
handleValueUpdate(newValue) {
|
|
128
135
|
this.hoverValue = newValue;
|
|
@@ -233,7 +240,7 @@ class Rating extends LitElement {
|
|
|
233
240
|
average,
|
|
234
241
|
partial
|
|
235
242
|
})} data-value=${value ?? nothing} for=${id ?? nothing} @click=${this.handleLabelClick} @focus=${this.handleLabelFocus} @keydown=${this.handleLabelKeyDown} @pointerdown=${this.handleLabelPointerDown} @pointerover=${this.handleLabelPointerOver} tabindex=${tabIndex ?? nothing}><input aria-errormessage=${IDS.validationMessage} .ariaInvalid=${this.status === "invalid"} .ariaLabel=${getLabelText(this)} .ariaRequired=${this.required} .checked=${checked} class=${safeClassMap(CSS.visuallyHidden)} .disabled=${this.disabled || this.readOnly} id=${id ?? nothing} name=${this.guid ?? nothing} @change=${this.handleInputChange} tabindex=-1 type=radio .value=${live(value ?? "")}>${StarIcon({ full: selected || average || hovered, scale: this.scale })}${partial && html`<div class=${safeClassMap(CSS.fraction)} style=${safeStyleMap({ width: `${fraction * 100}%` })}>${StarIcon({ full: true, partial: true, scale: this.scale })}</div>` || ""}<span class=${safeClassMap(CSS.visuallyHidden)}>${this.messages.stars.replace("{num}", `${value}`)}</span></label>`;
|
|
236
|
-
})}${(this.count || this.average) && this.showChip ? html`<calcite-chip .label=${countString} .scale=${this.scale} .value=${countString}>${!!this.average && html`<span class=${safeClassMap(CSS.numberAverage)}>${this.average.toString()}</span>` || ""}${!!this.count && html`<span class=${safeClassMap(CSS.numberCount)}>(${countString})</span>` || ""}</calcite-chip>` : null}</fieldset>${
|
|
243
|
+
})}${(this.count || this.average) && this.showChip ? html`<calcite-chip .label=${countString} .scale=${this.scale} .value=${countString}>${!!this.average && html`<span class=${safeClassMap(CSS.numberAverage)}>${this.average.toString()}</span>` || ""}${!!this.count && html`<span class=${safeClassMap(CSS.numberCount)}>(${countString})</span>` || ""}</calcite-chip>` : null}</fieldset>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}</span>` });
|
|
237
244
|
}
|
|
238
245
|
}
|
|
239
246
|
customElement("calcite-rating", Rating);
|
|
@@ -4,13 +4,13 @@ import { css, isServer, nothing, html } from "lit";
|
|
|
4
4
|
import { LitElement, createEvent, stringOrBoolean, safeClassMap } from "@arcgis/lumina";
|
|
5
5
|
import { useDirection } from "@arcgis/lumina/controllers";
|
|
6
6
|
import { a as slotChangeGetAssignedElements } from "../../chunks/dom.js";
|
|
7
|
-
import { c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
8
7
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
9
8
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
10
9
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
11
10
|
import { u as useT9n } from "../../chunks/useT9n.js";
|
|
12
11
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
13
12
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
13
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
14
14
|
const CSS = {
|
|
15
15
|
itemWrapper: "item-wrapper"
|
|
16
16
|
};
|
|
@@ -22,6 +22,7 @@ class SegmentedControl extends LitElement {
|
|
|
22
22
|
constructor() {
|
|
23
23
|
super();
|
|
24
24
|
this.direction = useDirection();
|
|
25
|
+
this.formSupport = useForm({ inputType: "text" })(this);
|
|
25
26
|
this.items = [];
|
|
26
27
|
this.messages = useT9n();
|
|
27
28
|
this.focusSetter = useSetFocus()(this);
|
|
@@ -55,6 +56,9 @@ class SegmentedControl extends LitElement {
|
|
|
55
56
|
static {
|
|
56
57
|
this.properties = { appearance: [3, {}, { reflect: true }], disabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], layout: [3, {}, { reflect: true }], labelText: 1, messageOverrides: [0, {}, { attribute: false }], name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], selectedItem: [0, {}, { attribute: false }], status: [3, {}, { reflect: true }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: 1, width: [3, {}, { reflect: true }] };
|
|
57
58
|
}
|
|
59
|
+
static {
|
|
60
|
+
this.formAssociated = true;
|
|
61
|
+
}
|
|
58
62
|
static {
|
|
59
63
|
this.styles = styles;
|
|
60
64
|
}
|
|
@@ -64,7 +68,6 @@ class SegmentedControl extends LitElement {
|
|
|
64
68
|
connectedCallback() {
|
|
65
69
|
super.connectedCallback();
|
|
66
70
|
connectLabel(this);
|
|
67
|
-
connectForm(this);
|
|
68
71
|
}
|
|
69
72
|
willUpdate(changes) {
|
|
70
73
|
if (changes.has("appearance") && (this.hasUpdated || this.appearance !== "solid") || changes.has("layout") && (this.hasUpdated || this.layout !== "horizontal") || changes.has("scale") && (this.hasUpdated || this.scale !== "m")) {
|
|
@@ -78,12 +81,11 @@ class SegmentedControl extends LitElement {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
loaded() {
|
|
81
|
-
|
|
84
|
+
this.formSupport.overrideDefaultValue(this.value);
|
|
82
85
|
}
|
|
83
86
|
disconnectedCallback() {
|
|
84
87
|
super.disconnectedCallback();
|
|
85
88
|
disconnectLabel(this);
|
|
86
|
-
disconnectForm(this);
|
|
87
89
|
}
|
|
88
90
|
valueHandler(value) {
|
|
89
91
|
const { items } = this;
|
|
@@ -218,7 +220,7 @@ class SegmentedControl extends LitElement {
|
|
|
218
220
|
}
|
|
219
221
|
render() {
|
|
220
222
|
this.el.role = "radiogroup";
|
|
221
|
-
return html`${this.labelText && InternalLabel({ labelText: this.labelText, onClick: this.onLabelClick, required: this.required, tooltipText: this.messages.required }) || ""}<div aria-errormessage=${IDS.validationMessage} aria-label=${getLabelText(this) ?? nothing} .ariaInvalid=${this.status === "invalid"} .ariaRequired=${this.required} class=${safeClassMap(CSS.itemWrapper)}>${this.interactiveContainer({ disabled: this.disabled, children: html`<slot @slotchange=${this.handleDefaultSlotChange}></slot
|
|
223
|
+
return html`${this.labelText && InternalLabel({ labelText: this.labelText, onClick: this.onLabelClick, required: this.required, tooltipText: this.messages.required }) || ""}<div aria-errormessage=${IDS.validationMessage} aria-label=${getLabelText(this) ?? nothing} .ariaInvalid=${this.status === "invalid"} .ariaRequired=${this.required} class=${safeClassMap(CSS.itemWrapper)}>${this.interactiveContainer({ disabled: this.disabled, children: html`<slot @slotchange=${this.handleDefaultSlotChange}></slot>` })}</div>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}`;
|
|
222
224
|
}
|
|
223
225
|
}
|
|
224
226
|
customElement("calcite-segmented-control", SegmentedControl);
|
|
@@ -11,7 +11,7 @@ import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
|
11
11
|
import { V as Validation } from "../../chunks/Validation.js";
|
|
12
12
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
13
13
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
14
|
-
import { u as useForm
|
|
14
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
15
15
|
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:flex;flex-direction:column;font-size:var(--calcite-select-font-size);font-weight:var(--calcite-internal-select-font-weight, var(--calcite-font-weight-regular))}.wrapper{position:relative;display:flex;align-items:stretch;inline-size:var(--select-width);block-size:var(--calcite-internal-select-block-size, 32px)}.wrapper:focus-within .icon,.wrapper:active .icon,.wrapper:hover .icon{color:var(--calcite-select-icon-color-hover, var(--calcite-color-text-1))}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}:host([scale=s]){--calcite-internal-select-font-size: var(--calcite-font-size-relative-sm);--calcite-select-spacing-inline: .5rem 2rem;--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-sm);--calcite-internal-select-block-size: 24px}:host([scale=m]){--calcite-internal-select-font-size: var(--calcite-font-size-relative-base);--calcite-select-spacing-inline: .75rem 2.5rem;--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-md)}:host([scale=l]){--calcite-internal-select-font-size: var(--calcite-font-size-relative-md);--calcite-select-spacing-inline: 1rem 3rem;--calcite-internal-select-icon-container-padding-inline: var(--calcite-spacing-lg);--calcite-internal-select-block-size: 44px}:host([width=auto]){inline-size:auto}:host([width=half]){inline-size:50%}:host([width=full]){inline-size:100%}.select{margin:0;box-sizing:border-box;inline-size:100%;cursor:pointer;appearance:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-style:solid;font-family:inherit;outline-color:transparent;font-weight:inherit;font-size:var(--calcite-select-font-size, var(--calcite-internal-select-font-size));color:var(--calcite-select-text-color, var(--calcite-color-text-2));border-color:var(--calcite-select-border-color, var(--calcite-color-border-input));border-width:var(--calcite-select-internal-border-width, var(--calcite-border-width-sm));padding-inline:var(--calcite-select-spacing-inline);padding-block:var(--calcite-internal-select-spacing-block);border-inline-end-width:0;line-height:var(--calcite-internal-select-line-height, normal);background-color:var(--calcite-select-background-color, var(--calcite-color-foreground-1));border-radius:var(--calcite-select-corner-radius, var(--calcite-corner-radius-none));box-shadow:var(--calcite-select-shadow, var(--calcite-shadow-small))}.select:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-focus, var(--calcite-ui-focus-color, var(--calcite-color-brand)));outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}select:disabled{border-color:var(--calcite-color-border-input);--tw-bg-opacity: 1}.icon-container{pointer-events:none;position:absolute;inset-block:0px;display:flex;align-items:center;border-width:0px;border-style:solid;border-color:var(--calcite-color-border-input);background-color:transparent;color:var(--calcite-color-text-2);inset-inline-end:0px;border-start-start-radius:var(--calcite-select-corner-radius, var(--calcite-corner-radius-none));border-start-end-radius:var(--calcite-select-corner-radius, var(--calcite-corner-radius-none));border-end-start-radius:var(--calcite-select-corner-radius, var(--calcite-corner-radius-none));border-end-end-radius:var(--calcite-select-corner-radius, var(--calcite-corner-radius-none));border-color:var(--calcite-select-border-color, var(--calcite-color-border-input));border-inline-width:0 var(--calcite-select-internal-icon-border-inline-end-width, var(--calcite-border-width-sm));padding-inline:var(--calcite-internal-select-icon-container-padding-inline)}.icon-container .icon{color:var(--calcite-select-icon-color, var(--calcite-color-text-3))}:host([status=invalid]) select,:host([status=invalid]) .icon-container{border-color:var(--calcite-color-status-danger)}:host([status=invalid]) select:focus,:host([status=invalid]) .icon-container:focus{outline:var(--calcite-border-width-md) solid var(--calcite-color-status-danger);outline-offset:calc(calc(-1 * var(--calcite-spacing-base)) * calc(1 - (2*clamp(0,var(--calcite-offset-invert-focus),1))))}.select:focus~.icon-container{border-color:transparent}.internal-label-alignment--center{align-items:center}.internal-label-alignment--end{align-items:end}.internal-label--container{display:flex;justify-content:space-between;color:var(--calcite-color-text-1)}.internal-label-required--indicator{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-color-status-danger);padding-inline:var(--calcite-spacing-base)}.internal-label-required--indicator:hover{cursor:help}.internal-label--text{line-height:1}:host([scale=s]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-xxs)}:host([scale=s]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=s]) .internal-label--text{font-size:var(--calcite-font-size--2)}:host([scale=m]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-sm)}:host([scale=m]) .internal-label--text{font-size:var(--calcite-font-size--1)}:host([scale=l]) .internal-label-spacing--bottom{margin-block-end:var(--calcite-spacing-sm)}:host([scale=l]) .internal-label-spacing-inline--end{margin-inline-end:var(--calcite-spacing-md)}:host([scale=l]) .internal-label-spacing-inline--start{margin-inline-start:var(--calcite-spacing-md)}:host([scale=l]) .internal-label--text{font-size:var(--calcite-font-size-0)}.validation-container{display:flex;flex-direction:column;align-items:flex-start;align-self:stretch}:host([scale=m]) .validation-container,:host([scale=l]) .validation-container{padding-block-start:.5rem}:host([scale=s]) .validation-container{padding-block-start:.25rem}::slotted(input[slot=hidden-form-input]){margin:0!important;opacity:0!important;outline:none!important;padding:0!important;position:absolute!important;inset:0!important;transform:none!important;-webkit-appearance:none!important;z-index:-1!important}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
16
16
|
const CSS = {
|
|
17
17
|
icon: "icon",
|
|
@@ -96,7 +96,7 @@ class Select extends LitElement {
|
|
|
96
96
|
this.populateInternalSelect();
|
|
97
97
|
const selected = this.selectRef.value?.selectedOptions[0];
|
|
98
98
|
this.selectFromNativeOption(selected);
|
|
99
|
-
overrideDefaultValue(this
|
|
99
|
+
this.formSupport.overrideDefaultValue(this.selectedOption?.value ?? "");
|
|
100
100
|
}
|
|
101
101
|
disconnectedCallback() {
|
|
102
102
|
super.disconnectedCallback();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
|
-
import type { MutableValidityState } from "../../utils/form.js";
|
|
4
3
|
import type { NumberingSystem } from "../../utils/locale.js";
|
|
5
4
|
import type { ColorStop, DataSeries } from "../calcite-graph/interfaces.js";
|
|
6
5
|
import type { Scale, Status } from "../interfaces.js";
|
|
7
6
|
import type { IconName } from "../calcite-icon/interfaces.js";
|
|
7
|
+
import type { MutableValidityState } from "../../controllers/useForm.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @cssproperty [--calcite-slider-text-color] - Specifies the component's text color.
|
|
@@ -8,7 +8,6 @@ import { g as guid } from "../../chunks/guid.js";
|
|
|
8
8
|
import { j as isPrimaryPointerButton, x 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
|
-
import { c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
12
11
|
import { i as isActivationKey } from "../../chunks/key.js";
|
|
13
12
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
14
13
|
import { n as numberStringFormatter, B as BigDecimal } from "../../chunks/locale.js";
|
|
@@ -16,6 +15,7 @@ import { d as decimalPlaces, c as clamp } from "../../chunks/math.js";
|
|
|
16
15
|
import { u as useT9n } from "../../chunks/useT9n.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 useForm } from "../../chunks/useForm.js";
|
|
19
19
|
const CSS = {
|
|
20
20
|
container: "container",
|
|
21
21
|
containerRange: "container--range",
|
|
@@ -117,6 +117,9 @@ class Slider extends LitElement {
|
|
|
117
117
|
};
|
|
118
118
|
return numberStringFormatter.localize(value.toString());
|
|
119
119
|
};
|
|
120
|
+
this.formSupport = useForm({
|
|
121
|
+
inputType: "range"
|
|
122
|
+
})(this);
|
|
120
123
|
this.guid = IDS.host(guid());
|
|
121
124
|
this.messages = useT9n();
|
|
122
125
|
this.pointerUpDragEnd = (event) => {
|
|
@@ -171,6 +174,9 @@ class Slider extends LitElement {
|
|
|
171
174
|
static {
|
|
172
175
|
this.properties = { activeProp: [16, {}, { state: true }], maxValueDragRange: [16, {}, { state: true }], minMaxValueRange: [16, {}, { state: true }], minValueDragRange: [16, {}, { state: true }], tickValues: [16, {}, { state: true }], disabled: [7, {}, { reflect: true, type: Boolean }], fillPlacement: [3, {}, { reflect: true }], form: [3, {}, { reflect: true }], groupSeparator: [7, {}, { reflect: true, type: Boolean }], hasHistogram: [7, {}, { reflect: true, type: Boolean }], histogram: [0, {}, { attribute: false }], histogramStops: [0, {}, { attribute: false }], labelFormatter: [0, {}, { attribute: false }], labelHandles: [7, {}, { reflect: true, type: Boolean }], labelTicks: [7, {}, { reflect: true, type: Boolean }], max: [11, {}, { reflect: true, type: Number }], maxLabel: 1, maxValue: [9, {}, { type: Number }], min: [11, {}, { reflect: true, type: Number }], minLabel: 1, labelText: 1, messageOverrides: [0, {}, { attribute: false }], minValue: [9, {}, { type: Number }], mirrored: [7, {}, { reflect: true, type: Boolean }], name: [3, {}, { reflect: true }], numberingSystem: 1, pageStep: [11, {}, { reflect: true, type: Number }], precise: [7, {}, { reflect: true, type: Boolean }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], snap: [7, {}, { reflect: true, type: Boolean }], status: [3, {}, { reflect: true }], step: [11, {}, { reflect: true, type: Number }], ticks: [11, {}, { reflect: true, type: Number }], validationIcon: [3, { converter: stringOrBoolean, type: String }, { reflect: true }], validationMessage: 1, validity: [0, {}, { attribute: false }], value: [11, {}, { reflect: true, type: Number }] };
|
|
173
176
|
}
|
|
177
|
+
static {
|
|
178
|
+
this.formAssociated = true;
|
|
179
|
+
}
|
|
174
180
|
static {
|
|
175
181
|
this.shadowRootOptions = { mode: "open", delegatesFocus: true };
|
|
176
182
|
}
|
|
@@ -202,12 +208,10 @@ class Slider extends LitElement {
|
|
|
202
208
|
this.setMinMaxFromValue();
|
|
203
209
|
this.setValueFromMinMax();
|
|
204
210
|
connectLabel(this);
|
|
205
|
-
connectForm(this);
|
|
206
211
|
this.previousEmittedValue = this.value;
|
|
207
212
|
}
|
|
208
213
|
load() {
|
|
209
214
|
this.setInitialValue();
|
|
210
|
-
afterConnectDefaultValueSet(this, this.value);
|
|
211
215
|
}
|
|
212
216
|
willUpdate(changes) {
|
|
213
217
|
if (changes.has("histogram")) {
|
|
@@ -238,7 +242,6 @@ class Slider extends LitElement {
|
|
|
238
242
|
disconnectedCallback() {
|
|
239
243
|
super.disconnectedCallback();
|
|
240
244
|
disconnectLabel(this);
|
|
241
|
-
disconnectForm(this);
|
|
242
245
|
this.removeDragListeners();
|
|
243
246
|
}
|
|
244
247
|
setInitialValue() {
|
|
@@ -690,7 +693,7 @@ class Slider extends LitElement {
|
|
|
690
693
|
left: mirror ? "" : tickOffset,
|
|
691
694
|
right: mirror ? tickOffset : ""
|
|
692
695
|
})}>${this.renderTickLabel(tick)}</span>`;
|
|
693
|
-
})}</div></div><div class=${safeClassMap(CSS.thumbContainer)}>${minThumb}${thumb}
|
|
696
|
+
})}</div></div><div class=${safeClassMap(CSS.thumbContainer)}>${minThumb}${thumb}</div></div>${this.validationMessage && this.status === "invalid" ? Validation({ icon: this.validationIcon, id: IDS.validationMessage, message: this.validationMessage, scale: this.scale, status: this.status }) : null}` });
|
|
694
697
|
}
|
|
695
698
|
renderThumb({ type, mirror, thumbPlacement, minInterval, maxInterval }) {
|
|
696
699
|
const isLabeled = type.includes("labeled");
|
|
@@ -3,12 +3,12 @@ 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 { createRef, ref } from "lit/directives/ref.js";
|
|
6
|
-
import { c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from "../../chunks/form.js";
|
|
7
6
|
import { i as isActivationKey } from "../../chunks/key.js";
|
|
8
7
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
9
8
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
10
9
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
11
10
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
11
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
12
12
|
const CSS = {
|
|
13
13
|
container: "container",
|
|
14
14
|
track: "track",
|
|
@@ -18,6 +18,9 @@ const styles = css`:host([disabled]){cursor:default;-webkit-user-select:none;use
|
|
|
18
18
|
class Switch extends LitElement {
|
|
19
19
|
constructor() {
|
|
20
20
|
super();
|
|
21
|
+
this.formSupport = useForm({
|
|
22
|
+
inputType: "checkbox"
|
|
23
|
+
})(this);
|
|
21
24
|
this.switchRef = createRef();
|
|
22
25
|
this.focusSetter = useSetFocus()(this);
|
|
23
26
|
this.interactiveContainer = useInteractive(this);
|
|
@@ -31,6 +34,9 @@ class Switch extends LitElement {
|
|
|
31
34
|
static {
|
|
32
35
|
this.properties = { checked: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], label: 1, labelTextEnd: 1, labelTextStart: 1, name: [3, {}, { reflect: true }], scale: [3, {}, { reflect: true }], value: 1 };
|
|
33
36
|
}
|
|
37
|
+
static {
|
|
38
|
+
this.formAssociated = true;
|
|
39
|
+
}
|
|
34
40
|
static {
|
|
35
41
|
this.styles = styles;
|
|
36
42
|
}
|
|
@@ -40,15 +46,10 @@ class Switch extends LitElement {
|
|
|
40
46
|
connectedCallback() {
|
|
41
47
|
super.connectedCallback();
|
|
42
48
|
connectLabel(this);
|
|
43
|
-
connectForm(this);
|
|
44
49
|
}
|
|
45
50
|
disconnectedCallback() {
|
|
46
51
|
super.disconnectedCallback();
|
|
47
52
|
disconnectLabel(this);
|
|
48
|
-
disconnectForm(this);
|
|
49
|
-
}
|
|
50
|
-
syncHiddenFormInput(input) {
|
|
51
|
-
input.type = "checkbox";
|
|
52
53
|
}
|
|
53
54
|
keyDownHandler(event) {
|
|
54
55
|
if (!this.disabled && isActivationKey(event.key)) {
|
|
@@ -73,7 +74,7 @@ class Switch extends LitElement {
|
|
|
73
74
|
this.toggle();
|
|
74
75
|
}
|
|
75
76
|
render() {
|
|
76
|
-
return this.interactiveContainer({ disabled: this.disabled, children: html`<div .ariaChecked=${this.checked} .ariaLabel=${getLabelText(this)} class=${safeClassMap(CSS.container)} role=switch tabindex=0 ${ref(this.switchRef)}>${this.labelTextStart && InternalLabel({ alignmentCenter: true, bottomSpacingDisabled: true, labelText: this.labelTextStart, spacingInlineEnd: true }) || ""}<div class=${safeClassMap(CSS.track)}><div class=${safeClassMap(CSS.handle)}></div></div>${this.labelTextEnd && InternalLabel({ alignmentCenter: true, bottomSpacingDisabled: true, labelText: this.labelTextEnd, spacingInlineStart: true }) || ""}
|
|
77
|
+
return this.interactiveContainer({ disabled: this.disabled, children: html`<div .ariaChecked=${this.checked} .ariaLabel=${getLabelText(this)} class=${safeClassMap(CSS.container)} role=switch tabindex=0 ${ref(this.switchRef)}>${this.labelTextStart && InternalLabel({ alignmentCenter: true, bottomSpacingDisabled: true, labelText: this.labelTextStart, spacingInlineEnd: true }) || ""}<div class=${safeClassMap(CSS.track)}><div class=${safeClassMap(CSS.handle)}></div></div>${this.labelTextEnd && InternalLabel({ alignmentCenter: true, bottomSpacingDisabled: true, labelText: this.labelTextEnd, spacingInlineStart: true }) || ""}</div>` });
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
customElement("calcite-switch", Switch);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference path="../../index.d.ts" />
|
|
2
2
|
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
3
3
|
import type { LogicalPlacement, OverlayPositioning, ReferenceElement } from "../../utils/floating-ui.js";
|
|
4
|
+
import type { Scale } from "../interfaces.js";
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @cssproperty [--calcite-tooltip-background-color] - Specifies the component's background color.
|
|
@@ -53,6 +54,12 @@ export abstract class Tooltip extends LitElement {
|
|
|
53
54
|
* @default "auto"
|
|
54
55
|
*/
|
|
55
56
|
accessor placement: LogicalPlacement;
|
|
57
|
+
/**
|
|
58
|
+
* When `true`, removes the caret pointer.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
accessor pointerDisabled: boolean;
|
|
56
63
|
/**
|
|
57
64
|
* The `referenceElement` is used to position the component according to its `placement` value.
|
|
58
65
|
*
|
|
@@ -62,7 +69,13 @@ export abstract class Tooltip extends LitElement {
|
|
|
62
69
|
*
|
|
63
70
|
* The component should not be placed within its own `referenceElement` to avoid unintended behavior.
|
|
64
71
|
*/
|
|
65
|
-
accessor referenceElement: ReferenceElement | string;
|
|
72
|
+
accessor referenceElement: ReferenceElement | string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Specifies the size of the component.
|
|
75
|
+
*
|
|
76
|
+
* @default "m"
|
|
77
|
+
*/
|
|
78
|
+
accessor scale: Scale;
|
|
66
79
|
/**
|
|
67
80
|
* When `true` and the component is `open`, disables top layer placement.
|
|
68
81
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
+
import { keyed } from "lit/directives/keyed.js";
|
|
3
4
|
import { css, html } from "lit";
|
|
4
5
|
import { LitElement, createEvent, safeClassMap } from "@arcgis/lumina";
|
|
5
6
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
@@ -12,12 +13,11 @@ const CSS = {
|
|
|
12
13
|
positionContainer: "position-container",
|
|
13
14
|
container: "container"
|
|
14
15
|
};
|
|
15
|
-
const styles = css`:host{display:contents}:host([top-layer-disabled]){--calcite-floating-ui-z-index: var(--calcite-z-index-tooltip)}.position-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.position-container{opacity:0;inset-block-start:0;left:0}}.position-container{max-inline-size:var(--calcite-tooltip-max-size-x, 20rem);max-block-size:20rem}.position-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.position-container:popover-open{display:block}.position-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.position-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.position-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.position-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.position-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-z-index) * -1);fill:var(--calcite-color-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-color-border-3)}.container{position:relative;overflow:hidden;
|
|
16
|
+
const styles = css`:host{display:contents;--calcite-internal-tooltip-padding-block: var(--calcite-spacing-sm);--calcite-internal-tooltip-padding-inline: var(--calcite-spacing-md)}:host([top-layer-disabled]){--calcite-floating-ui-z-index: var(--calcite-z-index-tooltip)}.position-container{inline-size:max-content;display:none;max-inline-size:100vw;max-block-size:100vh;inset-block-start:0;left:0;z-index:var(--calcite-floating-ui-z-index)}@starting-style{.position-container{opacity:0;inset-block-start:0;left:0}}.position-container{max-inline-size:var(--calcite-tooltip-max-size-x, 20rem);max-block-size:20rem}.position-container[popover]{padding:0;margin:0;border:none;background-color:transparent;overflow:visible;display:none}.position-container:popover-open{display:block}.position-container .calcite-floating-ui-anim{position:relative;transition-duration:var(--calcite-floating-ui-transition);transition-property:inset-block-start,left,opacity,display;transition-behavior:allow-discrete;opacity:0;box-shadow:0 0 16px #00000029;z-index:var(--calcite-z-index);border-radius:.25rem}.position-container[data-placement^=bottom] .calcite-floating-ui-anim{inset-block-start:-5px}.position-container[data-placement^=top] .calcite-floating-ui-anim{inset-block-start:5px}.position-container[data-placement^=left] .calcite-floating-ui-anim{left:5px}.position-container[data-placement^=right] .calcite-floating-ui-anim{left:-5px}.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;inset-block-start:0;left:0}@starting-style{.position-container[data-placement] .calcite-floating-ui-anim--active{opacity:0}}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-z-index) * -1);fill:var(--calcite-color-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-color-border-3)}:host([scale=s]){--calcite-internal-tooltip-padding-block: var(--calcite-spacing-xxs);--calcite-internal-tooltip-padding-inline: var(--calcite-spacing-sm)}:host([scale=s]) .container{font-size:var(--calcite-font-size-relative-xs);line-height:var(--calcite-font-line-height-relative-snug)}:host([scale=l]) .container{font-size:var(--calcite-font-size-relative-base);line-height:var(--calcite-font-line-height-relative-snug)}.container{position:relative;overflow:hidden;font-size:var(--calcite-font-size-relative-sm);line-height:var(--calcite-font-line-height-relative-snug);font-weight:var(--calcite-font-weight-medium);word-wrap:break-word;word-break:break-word;padding-block:var(--calcite-internal-tooltip-padding-block);padding-inline:var(--calcite-internal-tooltip-padding-inline);border-radius:var(--calcite-tooltip-corner-radius, var(--calcite-corner-radius-round));color:var(--calcite-tooltip-text-color, var(--calcite-color-text-1));text-align:start}.position-container .calcite-floating-ui-anim{border-width:1px;border-style:solid;background-color:var(--calcite-tooltip-background-color, var(--calcite-color-foreground-1));border-color:var(--calcite-tooltip-border-color, var(--calcite-color-border-3));border-radius:var(--calcite-tooltip-corner-radius, var(--calcite-corner-radius-round))}.calcite-floating-ui-arrow{fill:var(--calcite-tooltip-background-color, var(--calcite-color-foreground-1))}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-tooltip-border-color, var(--calcite-color-border-3))}:host([hidden]){display:none}[hidden]{display:none}`;
|
|
16
17
|
const manager = referenceElementManager({ hover: true });
|
|
17
18
|
class Tooltip extends LitElement {
|
|
18
19
|
constructor() {
|
|
19
20
|
super(...arguments);
|
|
20
|
-
this.arrowRef = createRef();
|
|
21
21
|
this.direction = useDirection();
|
|
22
22
|
this.referenceElementType = "hover";
|
|
23
23
|
this.referenceElementController = useReferenceElement({ manager })(this);
|
|
@@ -34,6 +34,8 @@ class Tooltip extends LitElement {
|
|
|
34
34
|
this.open = false;
|
|
35
35
|
this.overlayPositioning = "absolute";
|
|
36
36
|
this.placement = "auto";
|
|
37
|
+
this.pointerDisabled = false;
|
|
38
|
+
this.scale = "m";
|
|
37
39
|
this.topLayerDisabled = false;
|
|
38
40
|
this.calciteTooltipBeforeClose = createEvent({ cancelable: false });
|
|
39
41
|
this.calciteTooltipBeforeOpen = createEvent({ cancelable: false });
|
|
@@ -41,13 +43,13 @@ class Tooltip extends LitElement {
|
|
|
41
43
|
this.calciteTooltipOpen = createEvent({ cancelable: false });
|
|
42
44
|
}
|
|
43
45
|
static {
|
|
44
|
-
this.properties = { floatingLayout: [16, {}, { state: true }], referenceEl: [16, {}, { state: true }], closeOnClick: [7, {}, { reflect: true, type: Boolean }], label: 1, 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, topLayerDisabled: [7, {}, { reflect: true, type: Boolean }] };
|
|
46
|
+
this.properties = { floatingLayout: [16, {}, { state: true }], referenceEl: [16, {}, { state: true }], closeOnClick: [7, {}, { reflect: true, type: Boolean }], label: 1, 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 }], pointerDisabled: [7, {}, { reflect: true, type: Boolean }], referenceElement: 1, scale: [3, {}, { reflect: true }], topLayerDisabled: [7, {}, { reflect: true, type: Boolean }] };
|
|
45
47
|
}
|
|
46
48
|
static {
|
|
47
49
|
this.styles = styles;
|
|
48
50
|
}
|
|
49
51
|
async reposition(delayed = false) {
|
|
50
|
-
const { referenceEl, placement, overlayPositioning, offsetDistance, offsetSkidding,
|
|
52
|
+
const { referenceEl, placement, overlayPositioning, offsetDistance, offsetSkidding, arrowEl, floatingEl } = this;
|
|
51
53
|
return reposition(this, {
|
|
52
54
|
direction: this.direction,
|
|
53
55
|
floatingEl,
|
|
@@ -56,7 +58,7 @@ class Tooltip extends LitElement {
|
|
|
56
58
|
placement,
|
|
57
59
|
offsetDistance,
|
|
58
60
|
offsetSkidding,
|
|
59
|
-
arrowEl
|
|
61
|
+
arrowEl,
|
|
60
62
|
type: "tooltip"
|
|
61
63
|
}, delayed);
|
|
62
64
|
}
|
|
@@ -102,10 +104,15 @@ class Tooltip extends LitElement {
|
|
|
102
104
|
setFloatingEl(el) {
|
|
103
105
|
this.floatingEl = el;
|
|
104
106
|
}
|
|
107
|
+
setArrowEl(el) {
|
|
108
|
+
this.arrowEl = el;
|
|
109
|
+
this.reposition(true);
|
|
110
|
+
}
|
|
105
111
|
render() {
|
|
106
|
-
const { referenceEl, label, open, floatingLayout } = this;
|
|
112
|
+
const { referenceEl, label, open, pointerDisabled, floatingLayout } = this;
|
|
107
113
|
const displayed = referenceEl && open;
|
|
108
114
|
const hidden = !displayed;
|
|
115
|
+
const arrowNode = !pointerDisabled ? keyed("floating-arrow", FloatingArrow({ floatingLayout, ref: this.setArrowEl })) : null;
|
|
109
116
|
this.el.inert = hidden;
|
|
110
117
|
this.el.ariaLabel = label;
|
|
111
118
|
this.el.ariaLive = "polite";
|
|
@@ -113,7 +120,7 @@ class Tooltip extends LitElement {
|
|
|
113
120
|
return html`<div class=${safeClassMap(CSS.positionContainer)} popover=manual ${ref(this.setFloatingEl)}><div class=${safeClassMap({
|
|
114
121
|
[FloatingCSS.animation]: true,
|
|
115
122
|
[FloatingCSS.animationActive]: displayed
|
|
116
|
-
})} ${ref(this.transitionRef)}>${
|
|
123
|
+
})} ${ref(this.transitionRef)}>${arrowNode}<div class=${safeClassMap(CSS.container)}><slot></slot></div></div></div>`;
|
|
117
124
|
}
|
|
118
125
|
}
|
|
119
126
|
customElement("calcite-tooltip", Tooltip);
|