@yamada-ui/react
Version:
React UI components of the Yamada, by the Yamada, for the Yamada built with React and Emotion
86 lines (82 loc) • 2.54 kB
JavaScript
"use client";
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
const require_group = require('../group/group.cjs');
const require_use_radio_group = require('../radio/use-radio-group.cjs');
const require_radio_card = require('./radio-card.cjs');
let react = require("react");
react = require_rolldown_runtime.__toESM(react);
let react_jsx_runtime = require("react/jsx-runtime");
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
//#region src/components/radio-card/radio-card-group.tsx
/**
* `RadioCardGroup` is a component that groups `RadioCard` components.
*
* @see https://yamada-ui.com/docs/components/radio-card
*/
const RadioCardGroupRoot = require_radio_card.component((props) => {
const [, { colorScheme, size, variant, children, disabled, errorBorderColor, focusBorderColor, invalid, items = [], justify, readOnly, shape, withIndicator,...rest }] = require_radio_card.useRootComponentProps(props, "group", { transferProps: [
"variant",
"colorScheme",
"size",
"shape",
"justify",
"withIndicator"
] });
const { name, value, getInputProps, getLabelProps, getRootProps, onChange } = require_use_radio_group.useRadioGroup(rest);
const computedChildren = (0, react.useMemo)(() => {
if (children) return children;
return items.map(({ value: value$1,...rest$1 }, index) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_radio_card.RadioCardRoot, {
value: value$1,
...rest$1
}, value$1 ?? index));
}, [items, children]);
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_radio_card.RadioCardPropsContext, {
value: (0, react.useMemo)(() => ({
colorScheme,
size,
variant,
disabled,
errorBorderColor,
focusBorderColor,
invalid,
justify,
readOnly,
shape,
withIndicator
}), [
colorScheme,
size,
variant,
disabled,
justify,
withIndicator,
errorBorderColor,
focusBorderColor,
invalid,
readOnly,
shape
]),
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_radio_group.RadioGroupContext, {
value: (0, react.useMemo)(() => ({
name,
value,
getInputProps,
getLabelProps,
onChange
}), [
name,
value,
getInputProps,
getLabelProps,
onChange
]),
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_group.Group, {
...getRootProps(),
children: computedChildren
})
})
});
}, "group")();
//#endregion
exports.RadioCardGroupRoot = RadioCardGroupRoot;
//# sourceMappingURL=radio-card-group.cjs.map