UNPKG

@payfit/unity-components

Version:

40 lines (39 loc) 1.84 kB
import { Text as e } from "../../../text/Text.js"; import { RadioIndicator as t } from "../../../radio-button-group/parts/RadioIndicator.js"; import { Content as n } from "../../internals/Content.js"; import { Description as r } from "../../internals/Description.js"; import { Illustration as i } from "../../internals/Illustration.js"; import { SelectedIndicator as a } from "../../internals/SelectedIndicator.js"; import { selectableCard as o } from "../../selectableCard.variant.js"; import { useContext as s, useId as c } from "react"; import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime"; import { RadioButton as f, RadioField as p, RadioGroupStateContext as m } from "react-aria-components/RadioGroup"; //#region src/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.tsx var h = ({ title: h, description: g, illustration: _, isDisabled: v, ...y }) => { let b = c(), { base: x } = o(), S = s(m), C = S?.isReadOnly ? "readonly" : S?.isDisabled || v ? "disabled" : S?.isInvalid ? "invalid" : "enabled", w = `selectable-card-radio-${b}__title`; return /* @__PURE__ */ u(p, { "aria-labelledby": w, isDisabled: v, className: "uy:contents", ...y, children: /* @__PURE__ */ u(f, { className: ({ isFocusVisible: e }) => x({ isFocusVisible: e }), children: ({ isSelected: o }) => /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u(a, { children: /* @__PURE__ */ u(t, { isSelected: o, state: C }) }), /* @__PURE__ */ d(n, { children: [ _ && /* @__PURE__ */ u(i, { children: _ }), /* @__PURE__ */ u(e, { asElement: "h3", variant: "bodyLargeStrong", id: w, children: h }), g && /* @__PURE__ */ u(r, { children: g }) ] })] }) }) }); }; h.displayName = "SelectableCardRadio"; //#endregion export { h as SelectableCardRadio };