@harvest-profit/npk
Version:
NPK UI Design System
16 lines • 1.96 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const jsx_runtime_1 = require("react/jsx-runtime");
const Table_module_css_1 = __importDefault(require("./Table.module.css"));
const Placeholder_1 = __importDefault(require("../Placeholder"));
const Table = ({ children, layout = 'auto', truncate = false, height = null, minHeight = null, maxHeight = null, className = '', ...props }) => {
return ((0, jsx_runtime_1.jsx)("div", { "data-component": "table", style: { height, minHeight, maxHeight, overflow: (height || minHeight || maxHeight) ? 'auto' : 'initial' }, children: (0, jsx_runtime_1.jsx)("table", { "data-layout": layout, "data-truncate": truncate, className: `${Table_module_css_1.default.Table} ${className}`, ...props, children: children }) }));
};
Table.Td = ({ children, type = null, truncate = false, ...props }) => ((0, jsx_runtime_1.jsx)("td", { "data-type": type, "data-truncate": truncate, ...props, children: children }));
Table.Loading = ({ rows = 4, columns = 5, ...props }) => ((0, jsx_runtime_1.jsxs)(Table, { ...props, children: [(0, jsx_runtime_1.jsx)("thead", { children: (0, jsx_runtime_1.jsx)("tr", { children: Array.from({ length: columns }, (_, i) => (0, jsx_runtime_1.jsx)("th", { children: (0, jsx_runtime_1.jsx)(Placeholder_1.default, {}) }, i)) }) }), (0, jsx_runtime_1.jsx)("tbody", { children: Array.from({ length: rows }, (_, i) => ((0, jsx_runtime_1.jsx)("tr", { children: Array.from({ length: columns }, (_, j) => ((0, jsx_runtime_1.jsx)("td", { children: (0, jsx_runtime_1.jsx)(Placeholder_1.default, {}) }, j))) }, i))) })] }));
Table.Metrics = ({ children, ...props }) => ((0, jsx_runtime_1.jsx)("label", { className: Table_module_css_1.default.TableMetrics, ...props, children: children }));
exports.default = Table;
//# sourceMappingURL=Table.js.map