@lanaco/lnc-react-ui
Version:
React component library
59 lines (58 loc) • 1.27 kB
JavaScript
import { jsx as g } from "react/jsx-runtime";
import { forwardRef as v, useState as j, Children as i, cloneElement as k } from "react";
import { s as A } from "./emotion-styled.browser.esm-DfbrHHed.js";
import { u as C } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const I = A.div`
background: transparent;
display: flex;
justify-content: ${(e) => e.fullWidth ? "space-evenly" : "none"};
gap: ${(e) => e.type == "pill" ? "10px" : "0"};
box-sizing: border-box;
`, P = v((e, c) => {
const {
type: r = "regular",
fullWidth: l = !1,
//----------------
className: m = "",
style: d = {},
color: o = "primary",
size: a = "small",
children: n,
...p
} = e, f = C(), [h, u] = j(), y = {
theme: f,
color: o,
size: a,
style: d,
className: "lnc-ui-tabs " + m
}, b = (t) => {
u(t);
}, x = i.map(
n,
(t, s) => k(t, {
type: r,
first: s == 0,
last: s == i.toArray(n).length - 1,
fullWidth: l,
index: s,
itemClick: b,
activeIndex: h,
color: o,
size: a
})
);
return /* @__PURE__ */ g(
I,
{
ref: c,
type: r,
fullWidth: l,
...y,
...p,
children: x
}
);
});
export {
P as default
};