fui-fancyui
Version:
FancyUI Libary
75 lines (74 loc) • 1.88 kB
JavaScript
"use client";
import { jsxs as l, jsx as a } from "react/jsx-runtime";
import $, { useId as z } from "react";
import C from "../../atoms/Typography/Typography.js";
import c from "../FancyContent/FancyContent.js";
import { SwitchButtonStyle as b } from "./FancyTabSwitchButton.style.js";
import { sizeSettings as s } from "./sizeSettings.js";
const v = $.forwardRef((y, p) => {
const {
sizeC: n = "sm",
layer: f = 0,
themeType: o = "secondary",
disabled: u,
selected: d,
onClick: h,
iconAlign: m,
activeTextThemeType: S,
itemKey: i,
label: e,
icon: t,
children: T,
externalStyle: x,
...g
} = y, r = z();
return /* @__PURE__ */ l(
b,
{
ref: p,
role: "radio",
$sizeC: n,
$textColor: o,
$layer: f,
$iconAlign: m,
$hasIcon: !!t,
$hasLabel: !!e,
$externalStyle: x,
...g,
children: [
/* @__PURE__ */ a(
"input",
{
id: r + "_" + i,
disabled: u,
name: "FancyButtonSwitcher" + r,
type: "radio",
checked: d,
"aria-hidden": "true",
onChange: () => h && h(i)
}
),
/* @__PURE__ */ l(
C,
{
htmlFor: r + "_" + i,
elType: "label",
themeType: d && S || o,
variant: s[n].fontSize,
externalStyle: { zIndex: 1 },
children: [
(t || e) && /* @__PURE__ */ l(c, { layoutMode: "normal", alignIcon: m === "right" ? "right" : "left", children: [
t && /* @__PURE__ */ a(c.Icon, { children: t }),
e && /* @__PURE__ */ a(c.Title, { fontVariant: s[n].fontSize, children: e })
] }),
T
]
}
)
]
}
);
});
export {
v as default
};