UNPKG

@payfit/unity-components

Version:

42 lines (41 loc) 1.93 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 { useUnityTheme as l } from "@payfit/unity-themes"; import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime"; import { RadioButton as p, RadioField as m, RadioGroupStateContext as h } from "react-aria-components/RadioGroup"; //#region src/components/selectable-card/selectable-card-radio-group/parts/SelectableCardRadio.tsx var g = ({ title: g, description: _, illustration: v, isDisabled: y, ...b }) => { let x = c(), { theme: S } = l(), { base: C } = o(), w = s(h), T = w?.isReadOnly ? "readonly" : w?.isDisabled || y ? "disabled" : w?.isInvalid ? "invalid" : "enabled", E = `selectable-card-radio-${x}__title`; return /* @__PURE__ */ d(m, { "aria-labelledby": E, isDisabled: y, className: "uy:contents", ...b, children: /* @__PURE__ */ d(p, { className: ({ isFocusVisible: e }) => C({ isFocusVisible: e }), children: ({ isSelected: o }) => /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(a, { children: /* @__PURE__ */ d(t, { isSelected: o, state: T, theme: S }) }), /* @__PURE__ */ f(n, { children: [ v && /* @__PURE__ */ d(i, { children: v }), /* @__PURE__ */ d(e, { asElement: "h3", variant: "bodyLargeStrong", id: E, children: g }), _ && /* @__PURE__ */ d(r, { children: _ }) ] })] }) }) }); }; g.displayName = "SelectableCardRadio"; //#endregion export { g as SelectableCardRadio };