@esri/calcite-components 5.1.0-next.44 → 5.1.0-next.45
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/{W55WURJZ.js → 2CUW6SVU.js} +1 -1
- package/dist/cdn/{YJHGC4YC.js → 2Q3FDO3O.js} +1 -1
- package/dist/cdn/{AS2FYX5B.js → 2RHWA4LK.js} +1 -1
- package/dist/cdn/{MNCOI6AY.js → 3IT2UDER.js} +1 -1
- package/dist/cdn/{CCI2KCT7.js → 437Z4DGO.js} +1 -1
- package/dist/cdn/{CQJH2ZR6.js → 4L26OPTQ.js} +1 -1
- package/dist/cdn/{6UMQ4AJ3.js → 4RISXHDQ.js} +1 -1
- package/dist/cdn/{YDCWCJUH.js → 4RVGHVAH.js} +1 -1
- package/dist/cdn/{4XORBVCM.js → 4UUEKTY6.js} +1 -1
- package/dist/cdn/{JHS4XZ6R.js → 5BWQ6FCI.js} +1 -1
- package/dist/cdn/{GK26A6EO.js → 5DUIUSD4.js} +1 -1
- package/dist/cdn/{45QCU53I.js → 5GRSM5NK.js} +1 -1
- package/dist/cdn/{WMOURVJF.js → 5ZXZ2AZ5.js} +1 -1
- package/dist/cdn/{M4R4MUEE.js → 63C6E7P2.js} +1 -1
- package/dist/cdn/{IYI7TRCK.js → 63Q6MJSO.js} +1 -1
- package/dist/cdn/{PFIN3NUQ.js → 6G4H6ZSG.js} +1 -1
- package/dist/cdn/{U3XNFZ7Y.js → 6HV6NM3H.js} +1 -1
- package/dist/cdn/{7BFBAJI4.js → 6WBV6QA5.js} +1 -1
- package/dist/cdn/{5UHBWXOQ.js → 6XCMWDXL.js} +1 -1
- package/dist/cdn/{ANEHX5FZ.js → 7DS6EOBS.js} +1 -1
- package/dist/cdn/{DWDNTGTX.js → AC7F4FLS.js} +1 -1
- package/dist/cdn/{GMNC4R2E.js → B7LXG6P4.js} +1 -1
- package/dist/cdn/{7R65VUEZ.js → BGSPDXNV.js} +1 -1
- package/dist/cdn/{QXZMZL54.js → BKQLR2AD.js} +1 -1
- package/dist/cdn/{PROHWX4S.js → BO7LMIWD.js} +1 -1
- package/dist/cdn/{RZGN4APS.js → BTUBFZMZ.js} +1 -1
- package/dist/cdn/{KKYUSOAK.js → BUEHQXFW.js} +1 -1
- package/dist/cdn/{GDQHBDMH.js → CI3X5SUP.js} +1 -1
- package/dist/cdn/{H76JSRAO.js → CL3QBCWQ.js} +1 -1
- package/dist/cdn/{52JQBTSB.js → COILRLRR.js} +1 -1
- package/dist/cdn/{AYPUZCRQ.js → CRIZUXS5.js} +1 -1
- package/dist/cdn/{ZTW5YOZY.js → CXCZS4UL.js} +1 -1
- package/dist/cdn/{3R2X2KI2.js → DBFO4FYK.js} +1 -1
- package/dist/cdn/{T3AM6WWD.js → DXXITGPA.js} +1 -1
- package/dist/cdn/{BDQGRKAD.js → EHTAKCBT.js} +1 -1
- package/dist/cdn/{RVOYZ2QR.js → EJ3YAHEF.js} +1 -1
- package/dist/cdn/{6LWZDZB6.js → EZNQLVJI.js} +1 -1
- package/dist/cdn/{IE5XKTTF.js → FAO7C3JZ.js} +1 -1
- package/dist/cdn/{QXMZT7DC.js → FWSAYX7I.js} +1 -1
- package/dist/cdn/{M4VUOJ7W.js → FZO3ZMEF.js} +1 -1
- package/dist/cdn/{OO4TPFER.js → GJ7W74HI.js} +1 -1
- package/dist/cdn/{2SPYWGFB.js → GS3UCA7F.js} +1 -1
- package/dist/cdn/{NXO3ANCO.js → GUIHI3BV.js} +1 -1
- package/dist/cdn/{SOVWIBBH.js → H5TBQCW7.js} +1 -1
- package/dist/cdn/{F6BNQTW5.js → HDZ4UEAD.js} +1 -1
- package/dist/cdn/{E62KCKDK.js → HFWC5L6L.js} +1 -1
- package/dist/cdn/{7ODSLEQC.js → HMSWFUBJ.js} +1 -1
- package/dist/cdn/{5RPMO7ZN.js → HV5WXCUR.js} +1 -1
- package/dist/cdn/{GJEVB3L7.js → HY2CJOFB.js} +1 -1
- package/dist/cdn/{ANWCPQKQ.js → IE7F4MCU.js} +1 -1
- package/dist/cdn/{2E4FIHBE.js → IJ6FNT5M.js} +1 -1
- package/dist/cdn/{66SG5IJS.js → IJBYXHVY.js} +1 -1
- package/dist/cdn/{VMLCAC4B.js → IKGQDME6.js} +1 -1
- package/dist/cdn/{P77QKA4Y.js → IPM4QVYT.js} +1 -1
- package/dist/cdn/{R47PYSQL.js → IQTVLPAV.js} +1 -1
- package/dist/cdn/{MWO2EHEM.js → JAENSPF6.js} +1 -1
- package/dist/cdn/{2NADES6F.js → JEENJP36.js} +1 -1
- package/dist/cdn/{3IEKKHVM.js → JESAMKYH.js} +1 -1
- package/dist/cdn/{VKR7FKAQ.js → JP6KG2GJ.js} +1 -1
- package/dist/cdn/{IRJ2OHZR.js → JQUSJNDG.js} +1 -1
- package/dist/cdn/{ZPU3AGU5.js → JTKFGT4G.js} +1 -1
- package/dist/cdn/{7CQSY4M5.js → K3635UG6.js} +1 -1
- package/dist/cdn/{U7S6R7KB.js → KRD5C6LV.js} +1 -1
- package/dist/cdn/{BUPSOUMI.js → KWJN7BVY.js} +1 -1
- package/dist/cdn/{5MEXEC6B.js → L467PTZK.js} +1 -1
- package/dist/cdn/{6VGG3446.js → LJUN3ZYA.js} +1 -1
- package/dist/cdn/{XQIK4HBW.js → LLCQTFCY.js} +1 -1
- package/dist/cdn/{4YEALEL7.js → LS2PO7F3.js} +1 -1
- package/dist/cdn/{TUX3JZDW.js → MK3U3JKC.js} +1 -1
- package/dist/cdn/{D23USH25.js → MMHRNEUB.js} +1 -1
- package/dist/cdn/{6SR5PVW3.js → MP4YHUFX.js} +1 -1
- package/dist/cdn/{7Q33SP3T.js → MQXWWFWL.js} +1 -1
- package/dist/cdn/NFSOZ2HG.js +2 -0
- package/dist/cdn/{BJY5DSTS.js → NYNHXURV.js} +1 -1
- package/dist/cdn/{NLANVAL6.js → OICRMLHL.js} +1 -1
- package/dist/cdn/{CSKXBS5O.js → OLY26YYG.js} +1 -1
- package/dist/cdn/{F7SGGMJS.js → OQ44KHDI.js} +1 -1
- package/dist/cdn/{NL6KYBDD.js → OWTUIHHK.js} +1 -1
- package/dist/cdn/{R7JNWZLX.js → P56DFFWS.js} +1 -1
- package/dist/cdn/{4H5IAVAV.js → PCRY4SDG.js} +1 -1
- package/dist/cdn/{CNTMDW7V.js → PNQYAJKD.js} +1 -1
- package/dist/cdn/{LZMB6G3Q.js → PNRDC5FL.js} +1 -1
- package/dist/cdn/{FN4BRXTG.js → PSSYLN5H.js} +1 -1
- package/dist/cdn/{XJVYBIHK.js → PSWMMAXH.js} +1 -1
- package/dist/cdn/{WWHA4Z5P.js → PSXVEGZF.js} +1 -1
- package/dist/cdn/{P2OG22JG.js → PZWBMV4V.js} +1 -1
- package/dist/cdn/{I23VPYZT.js → Q23UYGG4.js} +1 -1
- package/dist/cdn/{Y72OQ5WN.js → Q2IPANQM.js} +1 -1
- package/dist/cdn/{6WASQCCE.js → Q47DXAH2.js} +1 -1
- package/dist/cdn/{JPPAO6PE.js → Q624L2G5.js} +1 -1
- package/dist/cdn/{F4PC2OXL.js → QHYWK37R.js} +1 -1
- package/dist/cdn/{SOT7JNUV.js → QKSXNG7X.js} +1 -1
- package/dist/cdn/{4PO6VOS7.js → QNAY3CT6.js} +1 -1
- package/dist/cdn/{SAPSSPEU.js → QZOFR4RG.js} +1 -1
- package/dist/cdn/{URISNP45.js → R5PSADRO.js} +1 -1
- package/dist/cdn/{P2UT4MU3.js → RCKKZWUV.js} +1 -1
- package/dist/cdn/{D5VIOHLS.js → RGDL46ZL.js} +1 -1
- package/dist/cdn/{XW776J74.js → RISZAKI3.js} +1 -1
- package/dist/cdn/{J6MTJKWT.js → RQ5D7JEX.js} +1 -1
- package/dist/cdn/{YLDNLCEQ.js → RTE3F4BJ.js} +1 -1
- package/dist/cdn/{LUPVJX5T.js → SN5MB356.js} +1 -1
- package/dist/cdn/{D55T7U4Q.js → SOVE3ZOA.js} +1 -1
- package/dist/cdn/{43V6LMLL.js → SYN7K75A.js} +1 -1
- package/dist/cdn/{556EVNDN.js → TF5B3J57.js} +1 -1
- package/dist/cdn/{4UIBU3VM.js → TGYGLTUZ.js} +1 -1
- package/dist/cdn/{KOZKT4IM.js → TI5NDBVM.js} +1 -1
- package/dist/cdn/{YZXV5WFJ.js → TNXW7AEV.js} +1 -1
- package/dist/cdn/{I5V2R6BN.js → TQPSWTJT.js} +1 -1
- package/dist/cdn/{RVREWDBC.js → TSPOULLO.js} +1 -1
- package/dist/cdn/{UIJOA2G3.js → TVFF5BW6.js} +1 -1
- package/dist/cdn/{ZY4GFPUN.js → TWXXLOEA.js} +1 -1
- package/dist/cdn/{77CKEYVD.js → U4MTKQJV.js} +1 -1
- package/dist/cdn/{MRHORN25.js → URIX3IB2.js} +1 -1
- package/dist/cdn/{VTSVAJGL.js → UWO4JZZH.js} +1 -1
- package/dist/cdn/{AEESFQRC.js → V6GUDGYG.js} +1 -1
- package/dist/cdn/{XS5BAKSN.js → V7JISHYK.js} +1 -1
- package/dist/cdn/{IPNTBVG7.js → VCJIPATY.js} +1 -1
- package/dist/cdn/{VK7DDCJI.js → VE2SY3NU.js} +1 -1
- package/dist/cdn/{2W5ZYYC4.js → VHK3JMNS.js} +1 -1
- package/dist/cdn/{7J6ZTRK2.js → VNR4RRJB.js} +1 -1
- package/dist/cdn/{7KCPAUW3.js → VOBUQWID.js} +1 -1
- package/dist/cdn/{KSXRKOXS.js → VUDMYZCP.js} +1 -1
- package/dist/cdn/{W27FKWM6.js → VWX3UX7Q.js} +1 -1
- package/dist/cdn/{AADF3GZ4.js → VYEDSQAV.js} +1 -1
- package/dist/cdn/{DKZJMKUK.js → W4LSPOQH.js} +1 -1
- package/dist/cdn/{JYDQMBDS.js → WMMDDESG.js} +1 -1
- package/dist/cdn/{Q6YZEHLR.js → WW6MXNHB.js} +1 -1
- package/dist/cdn/{BX2G7IU3.js → WYZ2NRQC.js} +1 -1
- package/dist/cdn/{HC64PJ5A.js → X2YVGXOR.js} +1 -1
- package/dist/cdn/{MKXLCJ4Q.js → XJTP3YA2.js} +1 -1
- package/dist/cdn/{N6M4YH3W.js → XLVMVXPQ.js} +1 -1
- package/dist/cdn/{EITOCIZW.js → XSH2B7JO.js} +1 -1
- package/dist/cdn/{3XG6L35T.js → XZWWOTIE.js} +1 -1
- package/dist/cdn/{7DRAYNE2.js → YEFJK6GB.js} +1 -1
- package/dist/cdn/YINW32VB.js +2 -0
- package/dist/cdn/{J5OBW66S.js → YSWGRIK3.js} +1 -1
- package/dist/cdn/{P3UMTGII.js → YWSDLKEM.js} +1 -1
- package/dist/cdn/{AO3U7TKD.js → YY6WQEZD.js} +1 -1
- package/dist/cdn/{TDKLR2ZM.js → ZBY2YI72.js} +1 -1
- package/dist/cdn/{U6XEQI6Z.js → ZCD56OLL.js} +1 -1
- package/dist/cdn/{4XK4RC62.js → ZMSMDBV4.js} +1 -1
- package/dist/cdn/{FBH4WDIE.js → ZNYS4SM3.js} +1 -1
- package/dist/cdn/{KU5E5MLT.js → ZXPMERYO.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/runtime.js +3 -3
- package/dist/chunks/useForm.js +34 -4
- package/dist/components/calcite-flow-item/customElement.d.ts +2 -1
- package/dist/components/calcite-flow-item/customElement.js +2 -2
- package/dist/components/calcite-radio-button/customElement.d.ts +15 -0
- package/dist/components/calcite-radio-button/customElement.js +11 -187
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/package.json +2 -2
- package/dist/cdn/MDLN5YTF.js +0 -2
- package/dist/cdn/PUEIK6ZR.js +0 -2
|
@@ -1,183 +1,15 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as customElement } from "../../chunks/runtime.js";
|
|
3
|
-
import {
|
|
3
|
+
import { css, nothing, html } 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 { q as queryElementRoots, c as closestElementCrossShadowBoundary } from "../../chunks/dom.js";
|
|
9
8
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from "../../chunks/label.js";
|
|
10
9
|
import { I as InternalLabel } from "../../chunks/InternalLabel.js";
|
|
11
10
|
import { u as useSetFocus } from "../../chunks/useSetFocus.js";
|
|
12
11
|
import { u as useInteractive } from "../../chunks/useInteractive.js";
|
|
13
|
-
|
|
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
|
-
};
|
|
12
|
+
import { u as useForm } from "../../chunks/useForm.js";
|
|
181
13
|
const CSS = {
|
|
182
14
|
container: "container",
|
|
183
15
|
radio: "radio"
|
|
@@ -188,6 +20,7 @@ class RadioButton extends LitElement {
|
|
|
188
20
|
super();
|
|
189
21
|
this.containerRef = createRef();
|
|
190
22
|
this.direction = useDirection();
|
|
23
|
+
this.formSupport = useForm({ inputType: "radio" })(this);
|
|
191
24
|
this.focusSetter = useSetFocus()(this);
|
|
192
25
|
this.interactiveContainer = useInteractive(this);
|
|
193
26
|
this.checked = false;
|
|
@@ -206,7 +39,10 @@ class RadioButton extends LitElement {
|
|
|
206
39
|
this.listen("keydown", this.handleKeyDown);
|
|
207
40
|
}
|
|
208
41
|
static {
|
|
209
|
-
this.properties = { checked: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], focused: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], hovered: [7, {}, { reflect: true, type: Boolean }], label: 1, labelText: 1, name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], value: 1 };
|
|
42
|
+
this.properties = { checked: [7, {}, { reflect: true, type: Boolean }], disabled: [7, {}, { reflect: true, type: Boolean }], focused: [7, {}, { reflect: true, type: Boolean }], form: [3, {}, { reflect: true }], hovered: [7, {}, { reflect: true, type: Boolean }], label: 1, labelText: 1, name: [3, {}, { reflect: true }], required: [7, {}, { reflect: true, type: Boolean }], scale: [3, {}, { reflect: true }], validity: [32, {}, { readOnly: true, attribute: false }], value: 1 };
|
|
43
|
+
}
|
|
44
|
+
static {
|
|
45
|
+
this.formAssociated = true;
|
|
210
46
|
}
|
|
211
47
|
static {
|
|
212
48
|
this.styles = styles;
|
|
@@ -217,13 +53,15 @@ class RadioButton extends LitElement {
|
|
|
217
53
|
async setFocus(options) {
|
|
218
54
|
return this.focusSetter(() => this.containerRef.value, options);
|
|
219
55
|
}
|
|
56
|
+
async setValidity(validity, validationMessage = "") {
|
|
57
|
+
this.elementInternals.setValidity(validity, validationMessage);
|
|
58
|
+
}
|
|
220
59
|
connectedCallback() {
|
|
221
60
|
this.rootNode = this.el.getRootNode();
|
|
222
61
|
if (this.name) {
|
|
223
62
|
this.checkLastRadioButton();
|
|
224
63
|
}
|
|
225
64
|
connectLabel(this);
|
|
226
|
-
connectForm(this);
|
|
227
65
|
this.updateTabIndexOfOtherRadioButtonsInGroup();
|
|
228
66
|
super.connectedCallback();
|
|
229
67
|
}
|
|
@@ -246,7 +84,6 @@ class RadioButton extends LitElement {
|
|
|
246
84
|
disconnectedCallback() {
|
|
247
85
|
super.disconnectedCallback();
|
|
248
86
|
disconnectLabel(this);
|
|
249
|
-
disconnectForm(this);
|
|
250
87
|
this.updateTabIndexOfOtherRadioButtonsInGroup();
|
|
251
88
|
}
|
|
252
89
|
checkedChanged(newChecked) {
|
|
@@ -255,9 +92,6 @@ class RadioButton extends LitElement {
|
|
|
255
92
|
}
|
|
256
93
|
this.calciteInternalRadioButtonCheckedChange.emit();
|
|
257
94
|
}
|
|
258
|
-
syncHiddenFormInput(input) {
|
|
259
|
-
input.type = "radio";
|
|
260
|
-
}
|
|
261
95
|
selectItem(items, selectedIndex) {
|
|
262
96
|
items[selectedIndex].click();
|
|
263
97
|
}
|
|
@@ -279,7 +113,6 @@ class RadioButton extends LitElement {
|
|
|
279
113
|
if (this.checked) {
|
|
280
114
|
return;
|
|
281
115
|
}
|
|
282
|
-
this.uncheckAllRadioButtonsInGroup();
|
|
283
116
|
this.checked = true;
|
|
284
117
|
this.calciteRadioButtonChange.emit();
|
|
285
118
|
}
|
|
@@ -318,15 +151,6 @@ class RadioButton extends LitElement {
|
|
|
318
151
|
});
|
|
319
152
|
}
|
|
320
153
|
}
|
|
321
|
-
uncheckAllRadioButtonsInGroup() {
|
|
322
|
-
const radioButtons = this.queryButtons();
|
|
323
|
-
radioButtons.forEach((radioButton) => {
|
|
324
|
-
if (radioButton.checked) {
|
|
325
|
-
radioButton.checked = false;
|
|
326
|
-
radioButton.focused = false;
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
154
|
uncheckOtherRadioButtonsInGroup() {
|
|
331
155
|
const radioButtons = this.queryButtons();
|
|
332
156
|
const otherRadioButtons = radioButtons.filter((radioButton) => radioButton !== this.el);
|
|
@@ -426,7 +250,7 @@ class RadioButton extends LitElement {
|
|
|
426
250
|
}
|
|
427
251
|
render() {
|
|
428
252
|
const tabIndex = this.getTabIndex();
|
|
429
|
-
return this.interactiveContainer({ disabled: this.disabled, children: html`<div .ariaChecked=${this.checked} .ariaLabel=${getLabelText(this)} class=${safeClassMap(CSS.container)} @blur=${this.onContainerBlur} @focus=${this.onContainerFocus} role=radio tabindex=${tabIndex ?? nothing} ${ref(this.containerRef)}><div class=${safeClassMap(CSS.radio)}></div>${this.labelText && InternalLabel({ labelText: this.labelText, spacingInlineStart: true }) || ""}</div
|
|
253
|
+
return this.interactiveContainer({ disabled: this.disabled, children: html`<div .ariaChecked=${this.checked} .ariaLabel=${getLabelText(this)} class=${safeClassMap(CSS.container)} @blur=${this.onContainerBlur} @focus=${this.onContainerFocus} role=radio tabindex=${tabIndex ?? nothing} ${ref(this.containerRef)}><div class=${safeClassMap(CSS.radio)}></div>${this.labelText && InternalLabel({ labelText: this.labelText, spacingInlineStart: true }) || ""}</div>` });
|
|
430
254
|
}
|
|
431
255
|
}
|
|
432
256
|
customElement("calcite-radio-button", RadioButton);
|