UNPKG

@cerberus-design/react

Version:

The Cerberus Design React component library.

49 lines (44 loc) 1.43 kB
'use client'; 'use strict'; Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const jsxRuntime = require('react/jsx-runtime'); const css = require('styled-system/css'); const recipes = require('styled-system/recipes'); const patterns = require('styled-system/patterns'); const show = require('../show/show.cjs'); const useFieldContext = require('../../node_modules/.pnpm/@ark-ui_react@5.29.1_react-dom@19.2.1_react@19.2.1__react@19.2.1/node_modules/@ark-ui/react/dist/components/field/use-field-context.cjs'); function Legend(props) { const { size, ...nativeProps } = props; const { invalid, required } = useFieldContext.useFieldContext(); return /* @__PURE__ */ jsxRuntime.jsxs( "legend", { ...nativeProps, ...invalid && { "aria-invalid": true }, className: css.cx( nativeProps.className, patterns.hstack({ justify: "space-between", w: "full" }), recipes.label({ size }) ), children: [ nativeProps.children, /* @__PURE__ */ jsxRuntime.jsx(show.Show, { when: required, children: /* @__PURE__ */ jsxRuntime.jsx( "span", { className: css.css({ color: "page.text.100", fontSize: "inherit" }), children: "(required)" } ) }) ] } ); } exports.Legend = Legend;