@lanaco/lnc-react-ui
Version:
React component library
118 lines (117 loc) • 2.73 kB
JavaScript
import { jsxs as y, jsx as t } from "react/jsx-runtime";
import { forwardRef as T } from "react";
import { s as w } from "./emotion-styled.browser.esm-DfbrHHed.js";
import C from "./DropdownMenu.js";
import A from "./DropdownItem.js";
import i from "./Button.js";
import { c as d } from "./utils-BUdHa0nB.js";
import { useTheme as N } from "./ThemeProvider.js";
const k = w.div`
display: flex;
align-items: center;
border-radius: 8px;
padding: 6px;
margin-bottom: 12px;
font-weight: 700;
font-size: 0.875rem;
color: rgba(15, 23, 42, 100%);
background-color: ${(e) => d(
e.theme,
"Toolbar",
e.color,
"enabled",
"background",
"backgroundOpacity"
)};
border: ${(e) => `1px solid ${d(
e.theme,
"Toolbar",
e.color,
"enabled",
"border",
"borderOpacity"
)}`};
gap: 6px;
justify-content: space-between;
& > div {
display: flex;
gap: 0.5rem;
}
`, I = T((e, m) => {
const {
showCreate: s = !0,
enableCreate: p = !0,
createText: a = "Create New item",
actionsText: c = "Actions",
actions: o = [],
//----------------
onCreate: b = () => {
},
//-------------------
className: f = "",
style: u = {},
color: l = "primary",
size: n = "small",
...g
} = e, { theme: x } = N();
return /* @__PURE__ */ y(
k,
{
ref: m,
theme: x,
color: l,
className: f,
style: u,
...g,
children: [
/* @__PURE__ */ t("div", { children: s && /* @__PURE__ */ t(
i,
{
leadingIcon: "plus",
btnType: "outline",
color: l,
size: n,
title: a,
disabled: !p,
onClick: b,
text: a
}
) }),
(o == null ? void 0 : o.length) > 0 && /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
C,
{
color: l,
size: n,
control: /* @__PURE__ */ t(
i,
{
text: c,
btnType: "outline",
trailingIcon: "angle-down",
color: l,
size: n
}
),
children: o == null ? void 0 : o.map((r, h) => {
if ((r == null ? void 0 : r.show) != !1)
return /* @__PURE__ */ t(
A,
{
icon: r.icon,
disabled: !r.enable,
onClick: r.onAction,
children: r.name
},
h
);
})
}
) })
]
}
);
});
I.displayName = "KANBAN_VIEW_ACTIONS_TOOLBAR";
export {
I as default
};