PageSourceSearch

https://lanekassen.no/dist/assets/RadioButtonsStegComponent-CYlGkh5i.js

js lanekassen.no collected 2026-10-02 03:04:24 UTC 5,120 bytes, 131 lines download raw bytes

1import { c as __toESM, r as require_react, t as require_jsx_runtime } from "./jsx-runtime-d1SSMKUy.js";
2import { o as connect_default } from "./redux-Bu-O7gKu.js";
3import { n as resolve } from "./EpiMessages-BFZ5w9EU.js";
4import { n as setCollapsed, t as VeilederStegComponent_default } from "./VeilederStegComponent-kjJbWOki.js";
5//#region Features/Shared/Scripts/Components/RadioButtonValg.tsx
6var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
7var import_jsx_runtime = require_jsx_runtime();
8function RadioButtonValg(group, id, value, tekst, isChecked, epiContext) {
9	return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
10		className: "c-radio-input",
11		children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
12			type: "radio",
13			name: group,
14			value,
15			id,
16			checked: isChecked,
17			"aria-checked": isChecked,
18			onChange: () => {}
19		}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", {
20			htmlFor: id,
21			children: resolve(epiContext, tekst)
22		})]
23	}, id);
24}
25//#endregion
26//#region Features/Shared/Scripts/Components/ValgDisplayFunctions.tsx
27function RadioButtonDisplay(gruppe, value) {
28	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
29		className: "c-veileder__valgt-item",
30		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
31			className: "c-veileder__tekst c-veileder__tekst--valg",
32			id: `${gruppe}-svar-visning`,
33			children: value.displayValue
34		})
35	});
36}
37function NumberInputDisplay(gruppe, value) {
38	return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
39		className: "c-veileder__valgt-item",
40		children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
41			className: "c-veileder__tekst c-veileder__tekst--valg",
42			id: `${gruppe}-svar-visning`,
43			children: value.displayValue
44		})
45	});
46}
47//#endregion
48//#region Features/Shared/Scripts/Utilities/InputUtilities.ts
49function getLabelValue(inputElement) {
50	const parent = inputElement.parentElement;
51	if (parent != null) {
52		const labels = parent.getElementsByTagName("label");
53		const firstLabel = Array.from(labels).find(() => true);
54		if (firstLabel && firstLabel.textContent != null) return firstLabel.textContent;
55	}
56}
57//#endregion
58//#region Features/Shared/Scripts/Utilities/ElementUtilies.ts
59var hasParentWithClass = (element, parentClass) => {
60	const parent = element.parentElement;
61	if (parent != null) return parent.classList.contains(parentClass) ? true : hasParentWithClass(parent, parentClass);
62	return false;
63};
64//#endregion
65//#region Features/Shared/Scripts/Components/RadioButtonsStegComponent.tsx
66var RadioButtonsStegComponent = class extends import_react.PureComponent {
67	static {
68		this.defaultProps = { neverCollapse: false };
69	}
70	constructor(props) {
71		super(props);
72		this.onMouseUp = (event) => {
73			const { neverCollapse, sporsmalId, stegVisningSetCollapsed } = this.props;
74			if (neverCollapse !== true && event.target != null && hasParentWithClass(event.target, "c-radio-input")) stegVisningSetCollapsed({
75				id: sporsmalId,
76				isCollapsed: true
77			});
78		};
79		this.onInputChange = (e) => {
80			const { onInputChange } = this.props;
81			const inputSource = e.target;
82			onInputChange({
83				displayValue: getLabelValue(inputSource),
84				value: inputSource.value,
85				id: inputSource.id
86			});
87		};
88		this.onInputChange = this.onInputChange.bind(this);
89		this.onMouseUp = this.onMouseUp.bind(this);
90	}
91	render() {
92		const { sporsmalId, valg, tittel, forklaring, sporsmal, neverCollapse, classModifier, customBottomRow, value, epiContext } = this.props;
93		const gruppe = sporsmalId;
94		const radioValg = valg.map((v) => RadioButtonValg(gruppe, v.id, v.value, v.tekst, value ? value.id === v.id : false, epiContext));
95		const display = value ? RadioButtonDisplay(gruppe, value) : null;
96		return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(VeilederStegComponent_default, {
97			sporsmalId,
98			tittel,
99			forklaring,
100			inputArea: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
101				className: "c-veileder__inputomrade",
102				children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("fieldset", {
103					className: "c-veileder__fieldset",
104					children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("legend", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
105						className: "c-veileder__undersporsmal",
106						children: resolve(epiContext, sporsmal)
107					}) }
107), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
108						className: "c-veileder__radioknapper-container",
109						onMouseUp: this.onMouseUp,
110						onChange: this.onInputChange,
111						children: radioValg
112					})]
113				})
114			}),
115			displayElement: display,
116			canCollapse: value !== void 0,
117			neverCollapse,
118			classModifier,
119			customBottomRow
120		});
121	}
122};
123function RadioButtonsStegContainer() {
124	return connect_default((state) => {
125		return { epiContext: state.epiContext };
126	}, { stegVisningSetCollapsed: setCollapsed })(RadioButtonsStegComponent);
127}
128//#endregion
129export { RadioButtonDisplay as a, NumberInputDisplay as i, hasParentWithClass as n, RadioButtonValg as o, getLabelValue as r, RadioButtonsStegContainer as t };
130
131//# sourceMappingURL=RadioButtonsStegComponent-CYlGkh5i.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.