UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

75 lines (74 loc) 3.72 kB
"use client"; import { jsx as w } from "react/jsx-runtime"; import { d as q } from "./index.D-sRdssb.js"; import { c as N } from "./index.DL9mof6u.js"; import { D as z } from "./Fieldset.C0RzpI-h.js"; import _ from "react"; import { g as v, r as I } from "./helpers.CexwVao7.js"; import { D as P } from "./Checkbox.D5X5T6Yg.js"; import '../assets/CheckboxGroup.Dd-Huo7x.css';const F = "ds-checkbox-group_root_12fot_1", H = "ds-checkbox-group_root--horizontal_12fot_9", O = "ds-checkbox-group_root--invalid_12fot_12", E = { root: F, rootHorizontal: H, rootInvalid: O }, V = ({ children: c, description: e, id: t, legend: s, systemFeedback: r }) => { if (!t && (e || r)) throw new Error(v("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(v("DSCheckboxGroup", I("legend", "DSCheckboxGroup"))); if (!c) throw new Error(v("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.")); _.Children.forEach(c, (o) => { if (!_.isValidElement(o) || // Object.keys(child.type)[1] !== '_payload' checks if the object is currently in a hydration phase o.type !== P && Object.keys(o.type)[1] !== "_payload") { const i = _.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(v("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.`)); } }); }, J = (c) => { const e = q.c(33); let t, s, r, o, i, a, l, p, n, h, u, m, b; e[0] !== c ? ({ children: t, legend: i, className: s, description: r, direction: h, disabled: u, id: o, invalid: m, popoverContent: a, popoverInfoButtonProps: l, required: b, systemFeedback: n, ...p } = c, e[0] = c, e[1] = t, e[2] = s, e[3] = r, e[4] = o, e[5] = i, e[6] = a, e[7] = l, e[8] = p, e[9] = n, e[10] = h, e[11] = u, e[12] = m, e[13] = b) : (t = e[1], s = e[2], r = e[3], o = e[4], i = e[5], a = e[6], l = e[7], p = e[8], n = e[9], h = e[10], u = e[11], m = e[12], b = e[13]); const G = h === void 0 ? "vertical" : h, C = u === void 0 ? !1 : u, f = m === void 0 ? !1 : m, D = b === void 0 ? !1 : b; process.env.NODE_ENV !== "production" && V({ children: t, description: r, id: o, legend: i, systemFeedback: n }); const y = G === "horizontal", S = f && !!n; let x; e[14] !== y || e[15] !== S ? (x = N(E.root, { [E.rootHorizontal]: y, [E.rootInvalid]: S }), e[14] = y, e[15] = S, e[16] = x) : x = e[16]; const g = x; let d; e[17] !== t || e[18] !== g ? (d = /* @__PURE__ */ w("div", { className: g, children: t }), e[17] = t, e[18] = g, e[19] = d) : d = e[19]; let k; return e[20] !== s || e[21] !== r || e[22] !== C || e[23] !== o || e[24] !== f || e[25] !== i || e[26] !== a || e[27] !== l || e[28] !== D || e[29] !== p || e[30] !== n || e[31] !== d ? (k = /* @__PURE__ */ w(z, { id: o, legend: i, className: s, description: r, disabled: C, required: D, invalid: f, systemFeedback: n, popoverContent: a, popoverInfoButtonProps: l, ...p, children: d }), e[20] = s, e[21] = r, e[22] = C, e[23] = o, e[24] = f, e[25] = i, e[26] = a, e[27] = l, e[28] = D, e[29] = p, e[30] = n, e[31] = d, e[32] = k) : k = e[32], k; }; export { J as D, V as v };