UNPKG

@stihl-design-system/components

Version:

Welcome to the STIHL Design System react component library.

82 lines (81 loc) 3.06 kB
"use client"; import { jsxs as d, jsx as r, Fragment as M } from "react/jsx-runtime"; import { c as m } from "./index.DL9mof6u.js"; import "react"; import { Asterisk as S } from "../asterisk.B2ih8VwF.js"; import { DSHeading as P } from "../heading.DHLpT4dc.js"; import { D as x } from "./Popover.D7McfVaH.js"; import { D as E } from "./SystemFeedback.CjlARKki.js"; import { g as y } from "./helpers.CexwVao7.js"; import "./index.D-sRdssb.js"; import '../assets/Fieldset.Oqu7pOBv.css';const q = "ds-fieldset_root_1rlhb_1", A = "ds-fieldset_child-wrapper_1rlhb_98", T = "ds-fieldset_legend-wrapper_1rlhb_105", U = "ds-fieldset_legend_1rlhb_105", z = "ds-fieldset_legend--utility--m_1rlhb_116", B = "ds-fieldset_description_1rlhb_128", C = "ds-fieldset_description--small_1rlhb_142", I = "ds-fieldset_system-feedback_1rlhb_146", e = { root: q, childWrapper: A, legendWrapper: T, legend: U, legendUtilityM: z, description: B, descriptionSmall: C, systemFeedback: I }, O = ({ description: a, id: s, legend: n, systemFeedback: t }) => { if (!s && (a || t)) throw new Error(y("DSFieldset", 'A unique "id" prop is required when providing the description or systemFeedback property. Please add a unique "id" prop to the DSFieldset component.')); if (!n) throw new Error(y("DSFieldset", "The legend prop is required. Please add the legend prop to the DSFieldset component.")); }, X = ({ children: a, legend: s, className: n, description: t, disabled: u = !1, id: c, invalid: p = !1, popoverContent: h, popoverInfoButtonProps: F, required: f = !1, systemFeedback: i, ...N }) => { process.env.NODE_ENV !== "production" && O({ description: t, id: c, legend: s, systemFeedback: i }); let l, g, _; const o = typeof s == "object" && s !== void 0; o && ({ headingSize: l, headingTag: g, headingText: _ } = s); const b = `${c}-feedback`, D = `${c}-description`, v = [p && i && b, t && D].filter(Boolean).join(" ") || void 0, w = !o || l === "small" || l === "small-uppercase", k = m(e.root, n), W = m(e.legend, { [e.legendUtilityM]: !o }), j = m(e.description, { [e.descriptionSmall]: w }); return /* @__PURE__ */ d("fieldset", { className: k, disabled: u, ...N, "aria-invalid": p, "aria-describedby": v, children: [ /* @__PURE__ */ d("legend", { className: W, children: [ /* @__PURE__ */ r("span", { className: e.legendWrapper, children: o ? /* @__PURE__ */ d(P, { tag: g, size: l, children: [ _, f && /* @__PURE__ */ r(S, {}) ] }) : /* @__PURE__ */ d(M, { children: [ s, f && /* @__PURE__ */ r(S, {}) ] }) }), h && /* @__PURE__ */ r(x, { placement: "top", defaultAnchorButtonProps: F, children: h }) ] }), t && /* @__PURE__ */ r("span", { id: D, className: j, children: t }), p && i && /* @__PURE__ */ r(E, { id: b, variant: "error", message: i, className: e.systemFeedback }), /* @__PURE__ */ r("div", { className: e.childWrapper, children: a }) ] }); }; export { X as D, O as v };