@lanaco/lnc-react-ui
Version:
React component library
78 lines (77 loc) • 1.71 kB
JavaScript
import { jsx as T } from "react/jsx-runtime";
import { forwardRef as j, useState as v, Children as c, cloneElement as P } from "react";
import { P as e } from "./index-S5Cd7WrG.js";
import { n as W } from "./emotion-styled.browser.esm-CjCaF13H.js";
import { u as k } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const w = W.div`
background: transparent;
display: flex;
justify-content: ${(t) => t.fullWidth ? "space-evenly" : "none"};
gap: ${(t) => t.type == "pill" ? "10px" : "0"};
box-sizing: border-box;
`, z = j((t, m) => {
const {
type: l = "regular",
fullWidth: o = !1,
//----------------
className: p = "",
style: d = {},
color: n = "primary",
size: a = "small",
children: i,
...f
} = t, u = k(), [y, h] = v(), g = {
theme: u,
color: n,
size: a,
style: d,
className: "lnc-ui-tabs " + p
}, b = (r) => {
h(r);
}, x = c.map(
i,
(r, s) => P(r, {
type: l,
first: s == 0,
last: s == c.toArray(i).length - 1,
fullWidth: o,
index: s,
itemClick: b,
activeIndex: y,
color: n,
size: a
})
);
return /* @__PURE__ */ T(
w,
{
ref: m,
type: l,
fullWidth: o,
...g,
...f,
children: x
}
);
});
z.propTypes = {
type: e.oneOf(["regular", "pill", "underline"]),
fullWidth: e.bool,
//---------------------------------------------------------------
className: e.string,
style: e.object,
color: e.oneOf([
"primary",
"secondary",
"success",
"warning",
"danger",
"information",
"neutral",
"gray"
]),
size: e.oneOf(["small", "medium", "large"])
};
export {
z as default
};