@stihl-design-system/components
Version:
Welcome to the STIHL Design System react component library.
73 lines (72 loc) • 3.52 kB
JavaScript
"use client";
import { jsx as _ } from "react/jsx-runtime";
import { d as w } from "./index.CgTHIF3K.js";
import { c as G } from "./index.CEyLAtio.js";
import { D as q } from "./Fieldset.DHccz6TP.js";
import S from "react";
import { g as x, r as N } from "./helpers.CcqWV-wZ.js";
import { D as z } from "./Checkbox.Ch8DBzws.js";
import '../assets/CheckboxGroup.Dd-Huo7x.css';const F = "ds-checkbox-group_root_12fot_1", H = "ds-checkbox-group_root--horizontal_12fot_9", I = "ds-checkbox-group_root--invalid_12fot_12", g = {
root: F,
rootHorizontal: H,
rootInvalid: I
}, O = ({
children: c,
description: e,
id: t,
legend: s,
systemFeedback: r
}) => {
if (!t && (e || r))
throw new Error(x("DSCheckboxGroup", 'A unique "id" prop is required when providing the description or systemFeedback property. Please add a unique "id" prop to the DSCheckboxGroup component.'));
if (!s)
throw new Error(x("DSCheckboxGroup", N("legend", "DSCheckboxGroup")));
if (!c)
throw new Error(x("DSCheckboxGroup", "The component requires DSCheckbox components to be explicitly set as its children. Ensure that you include individual DSCheckbox components within the DSCheckboxGroup to create a cohesive checkbox group."));
S.Children.forEach(c, (o) => {
if (!S.isValidElement(o) || // Object.keys(child.type)[1] !== '_payload' checks if the object is currently in a hydration phase
o.type !== z && Object.keys(o.type)[1] !== "_payload") {
const i = S.isValidElement(o) ? `Currently you are passing a child of type: ${JSON.stringify(o.type)}.` : "Currently you are passing an invalid React element.";
throw new Error(x("DSCheckboxGroup", `The component requires the children to be DSCheckbox elements. ${i} Ensure that you include individual DSCheckbox components within the DSCheckboxGroup to create a cohesive checkbox group.`));
}
});
}, A = (c) => {
const e = w.c(29);
let t, s, r, o, i, a, n, d, p, h, u;
e[0] !== c ? ({
children: t,
legend: i,
className: s,
description: r,
direction: d,
disabled: p,
id: o,
invalid: h,
required: u,
systemFeedback: n,
...a
} = c, e[0] = c, e[1] = t, e[2] = s, e[3] = r, e[4] = o, e[5] = i, e[6] = a, e[7] = n, e[8] = d, e[9] = p, e[10] = h, e[11] = u) : (t = e[1], s = e[2], r = e[3], o = e[4], i = e[5], a = e[6], n = e[7], d = e[8], p = e[9], h = e[10], u = e[11]);
const E = d === void 0 ? "vertical" : d, k = p === void 0 ? !1 : p, m = h === void 0 ? !1 : h, v = u === void 0 ? !1 : u;
process.env.NODE_ENV !== "production" && O({
children: t,
description: r,
id: o,
legend: i,
systemFeedback: n
});
const D = E === "horizontal", C = m && !!n;
let b;
e[12] !== D || e[13] !== C ? (b = G(g.root, {
[g.rootHorizontal]: D,
[g.rootInvalid]: C
}), e[12] = D, e[13] = C, e[14] = b) : b = e[14];
const y = b;
let l;
e[15] !== t || e[16] !== y ? (l = /* @__PURE__ */ _("div", { className: y, children: t }), e[15] = t, e[16] = y, e[17] = l) : l = e[17];
let f;
return e[18] !== s || e[19] !== r || e[20] !== k || e[21] !== o || e[22] !== m || e[23] !== i || e[24] !== v || e[25] !== a || e[26] !== n || e[27] !== l ? (f = /* @__PURE__ */ _(q, { id: o, legend: i, className: s, description: r, disabled: k, required: v, invalid: m, systemFeedback: n, ...a, children: l }), e[18] = s, e[19] = r, e[20] = k, e[21] = o, e[22] = m, e[23] = i, e[24] = v, e[25] = a, e[26] = n, e[27] = l, e[28] = f) : f = e[28], f;
};
export {
A as D,
O as v
};