@yamada-ui/radio
Version:
Yamada UI radio component
93 lines (90 loc) • 3.28 kB
JavaScript
"use client"
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/radio-card-label.tsx
var radio_card_label_exports = {};
__export(radio_card_label_exports, {
RadioCardLabel: () => RadioCardLabel
});
module.exports = __toCommonJS(radio_card_label_exports);
var import_core = require("@yamada-ui/core");
var import_core2 = require("@yamada-ui/core");
var import_utils2 = require("@yamada-ui/utils");
// src/radio-context.ts
var import_utils = require("@yamada-ui/utils");
var [RadioGroupProvider, useRadioGroupContext] = (0, import_utils.createContext)({
name: "RadioGroupContext",
strict: false
});
var [RadioCardGroupProvider, useRadioCardGroupContext] = (0, import_utils.createContext)({
name: "RadioCardGroupContext",
strict: false
});
var [RadioCardProvider, useRadioCardContext] = (0, import_utils.createContext)({
name: "RadioCardContext",
errorMessage: `useRadioCardContext returned is 'undefined'. Seems you forgot to wrap the components in "<RadioCard />"`
});
// src/radio-card-label.tsx
var import_jsx_runtime = require("react/jsx-runtime");
var RadioCardLabel = (0, import_core.forwardRef)(
({ className, children, withIcon, contentProps, iconProps, ...rest }, ref) => {
const {
styles,
withIcon: defaultWithIcon,
getIconProps,
iconProps: defaultIconProps
} = useRadioCardContext();
withIcon != null ? withIcon : withIcon = defaultWithIcon;
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
import_core2.ui.div,
{
ref,
className: (0, import_utils2.cx)("ui-radio-card__label", className),
__css: { ...styles.label },
...rest,
children: [
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_core2.ui.span,
{
className: "ui-radio-card__label-content",
__css: { ...styles.labelContent },
...contentProps,
children
}
),
withIcon ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
import_core2.ui.div,
{
className: "ui-radio-card__icon",
__css: { ...styles.icon },
...getIconProps({ ...defaultIconProps, ...iconProps })
}
) : null
]
}
);
}
);
RadioCardLabel.displayName = "RadioCardLabel";
RadioCardLabel.__ui__ = "RadioCardLabel";
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
RadioCardLabel
});
//# sourceMappingURL=radio-card-label.js.map