UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

86 lines (85 loc) 4.38 kB
"use client"; import { jsx as L } from "react/jsx-runtime"; import { d as H } from "./index.cKLI89Eg.js"; import { c as O } from "./index.DQOqod3i.js"; import { D as T } from "./Fieldset.BBMuLKps.js"; import P from "react"; import { D as V } from "./Checkbox.BxOGR1bR.js"; import { g as x, r as $ } from "./helpers.CexwVao7.js"; import '../assets/CheckboxGroup.Dd-Huo7x.css';const j = "ds-checkbox-group_root_12fot_1", M = "ds-checkbox-group_root--horizontal_12fot_9", R = "ds-checkbox-group_root--invalid_12fot_12", I = { root: j, rootHorizontal: M, rootInvalid: R }, A = ({ children: k, description: e, hideLegend: p, id: t, legend: s, popoverContent: r, systemFeedback: i }) => { if (!t && (e || i)) 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", $("legend", "DSCheckboxGroup"))); if (!k) 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.")); p && r && console.warn(x("DSCheckboxGroup", 'Setting "hideLegend" and "popoverContent" at the same time is not supported. The popover info button is part of the legend and will be hidden along with it. Please remove either "hideLegend" or "popoverContent".')), P.Children.forEach(k, (o) => { if (!P.isValidElement(o) || // Object.keys(child.type)[1] !== '_payload' checks if the object is currently in a hydration phase o.type !== V && Object.keys(o.type)[1] !== "_payload") { const n = P.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. ${n} Ensure that you include individual DSCheckbox components within the DSCheckboxGroup to create a cohesive checkbox group.`)); } }); }, Y = (k) => { const e = H.c(39), p = k; let t, s, r, i, o, n, l, a, c, h, u, m, f, b, v; e[0] !== p ? ({ children: t, legend: o, className: s, description: r, direction: h, disabled: u, hideLegend: m, id: i, invalid: f, popoverContent: n, popoverInfoButtonProps: l, required: b, systemFeedback: c, theme: v, ...a } = p, e[0] = p, e[1] = t, e[2] = s, e[3] = r, e[4] = i, e[5] = o, e[6] = n, e[7] = l, e[8] = a, e[9] = c, e[10] = h, e[11] = u, e[12] = m, e[13] = f, e[14] = b, e[15] = v) : (t = e[1], s = e[2], r = e[3], i = e[4], o = e[5], n = e[6], l = e[7], a = e[8], c = e[9], h = e[10], u = e[11], m = e[12], f = e[13], b = e[14], v = e[15]); const F = h === void 0 ? "vertical" : h, w = u === void 0 ? !1 : u, g = m === void 0 ? !1 : m, C = f === void 0 ? !1 : f, _ = b === void 0 ? !1 : b, E = v === void 0 ? "light" : v; process.env.NODE_ENV !== "production" && A({ children: t, description: r, hideLegend: g, id: i, legend: o, popoverContent: n, systemFeedback: c }); const G = F === "horizontal", q = C && !!c; let D; e[16] !== G || e[17] !== q ? (D = O(I.root, { [I.rootHorizontal]: G, [I.rootInvalid]: q }), e[16] = G, e[17] = q, e[18] = D) : D = e[18]; const N = D; let S; e[19] !== E ? (S = { theme: E }, e[19] = E, e[20] = S) : S = e[20]; const z = S; let d; e[21] !== t || e[22] !== N ? (d = /* @__PURE__ */ L("div", { className: N, children: t }), e[21] = t, e[22] = N, e[23] = d) : d = e[23]; let y; return e[24] !== s || e[25] !== r || e[26] !== w || e[27] !== g || e[28] !== i || e[29] !== C || e[30] !== o || e[31] !== n || e[32] !== l || e[33] !== _ || e[34] !== a || e[35] !== c || e[36] !== z || e[37] !== d ? (y = /* @__PURE__ */ L(T, { id: i, legend: o, className: s, description: r, disabled: w, hideLegend: g, required: _, invalid: C, systemFeedback: c, popoverContent: n, popoverInfoButtonProps: l, ...z, ...a, children: d }), e[24] = s, e[25] = r, e[26] = w, e[27] = g, e[28] = i, e[29] = C, e[30] = o, e[31] = n, e[32] = l, e[33] = _, e[34] = a, e[35] = c, e[36] = z, e[37] = d, e[38] = y) : y = e[38], y; }; export { Y as D, A as v };