@lanaco/lnc-react-ui
Version:
React component library
128 lines (126 loc) • 3.25 kB
JavaScript
import { jsxs as N, jsx as l } from "react/jsx-runtime";
import { memo as w, forwardRef as E } from "react";
import { n as T } from "./emotion-styled.browser.esm-CjCaF13H.js";
import { P as e } from "./index-S5Cd7WrG.js";
import k from "./DropdownMenu.js";
import v from "./DropdownItem.js";
import D from "./Icon.js";
import { u as H } from "./emotion-element-f0de968e.browser.esm-CkCiQliQ.js";
const P = T.div`
font-family: ${(n) => {
var i, o;
return (o = (i = n.theme) == null ? void 0 : i.typography) == null ? void 0 : o.fontFamily;
}};
position: relative;
width: 100%;
& .column-action-lnc {
position: absolute;
right: 0;
top: 0;
cursor: pointer;
}
& > span {
${(n) => n.clickable && "cursor: pointer;"}
}
`, t = w(
E(
({
__TYPE__: n = "KANBAN_HEADER",
id: i,
item: o,
column: s,
actionsMenu: p = !1,
actions: a = [],
onDetails: m = () => {
},
color: c = "primary",
size: f = "small",
className: d = "",
style: u = {},
children: y,
...g
}, h) => {
const b = H();
return /* @__PURE__ */ N(
P,
{
ref: h,
theme: b,
className: d,
style: u,
clickable: !!m,
...g,
children: [
/* @__PURE__ */ l("span", { onClick: (r) => m(r, o, s), children: y }),
p && /* @__PURE__ */ l(
k,
{
className: "column-action-lnc",
horizontalAlignment: "right",
verticalAlignment: "bottom",
color: c,
size: f,
control: /* @__PURE__ */ l(
D,
{
color: "neutral",
className: "column-action-lnc",
icon: "ellipsis-v"
}
),
children: a == null ? void 0 : a.map((r, _) => {
if ((r == null ? void 0 : r.show) != !1)
return /* @__PURE__ */ l(
v,
{
icon: r.icon,
disabled: r.enable == !1,
onClick: (A) => {
r.onAction(A, o, s);
},
children: r.name
},
_
);
})
}
)
]
}
);
}
)
);
t.propTypes = {
__TYPE__: e.string,
id: e.oneOfType([e.string, e.number]),
/**
* Show actions menu on Card
*/
actionsMenu: e.bool,
/**
* type of: [{ name: `<string>`, show: `<bool>`, enable: `<bool>`, onAction: `<func>`, icon: `<string>`}]
* show and enable are true by default
*/
actions: e.array,
//---------------------------------
onDetails: e.func,
//---------------------------------
className: e.string,
style: e.object,
color: e.oneOf([
"primary",
"secondary",
"success",
"warning",
"danger",
"information",
"neutral",
"gray"
]),
size: e.oneOf(["small", "medium", "large"])
};
t.displayName = "KANBAN_HEADER";
export {
t as default
};