@crossed/ui
Version:
A universal & performant styling library for React Native, Next.js & React
38 lines (37 loc) • 918 B
JavaScript
import { jsx } from "react/jsx-runtime";
import { useMemo } from "react";
import { YBox } from "../../layout/YBox";
import { useTabs } from "./useTabs";
import { useMedia } from "../../useMedia";
const createRoot = (TabsProvider) => ({
children,
value: valueProps,
defaultValue,
finalValue,
onChange,
variant = "rounded",
size,
...props
}) => {
const tabsInstance = useTabs({
value: valueProps,
defaultValue,
finalValue,
onChange
});
const { md, lg } = useMedia();
const tmpSize = useMemo(() => {
if (typeof size !== "undefined")
return size;
if (lg)
return "lg";
if (md)
return "md";
return "sm";
}, [lg, size, md]);
return /* @__PURE__ */ jsx(TabsProvider, { ...tabsInstance, variant, size: tmpSize, children: /* @__PURE__ */ jsx(YBox, { space: "lg", ...props, children }) });
};
export {
createRoot
};
//# sourceMappingURL=Root.js.map