lucid-ui
Version:
A UI component library from AppNexus.
77 lines • 4.98 kB
JavaScript
"use strict";
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __rest = (this && this.__rest) || function (s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScrollTable = void 0;
var lodash_1 = __importDefault(require("lodash"));
var react_1 = __importDefault(require("react"));
var prop_types_1 = __importDefault(require("react-peek/prop-types"));
var component_types_1 = require("../../util/component-types");
var style_helpers_1 = require("../../util/style-helpers");
var Table_1 = __importDefault(require("../Table/Table"));
var cx = style_helpers_1.lucidClassNames.bind('&-ScrollTable');
var object = prop_types_1.default.object, string = prop_types_1.default.string, bool = prop_types_1.default.bool, node = prop_types_1.default.node, number = prop_types_1.default.number, oneOfType = prop_types_1.default.oneOfType;
var defaultProps = {
hasWordWrap: false,
hasBorder: false,
};
var ScrollTable = function (props) {
var children = props.children, className = props.className, style = props.style, tableWidth = props.tableWidth, hasWordWrap = props.hasWordWrap, hasBorder = props.hasBorder, passThroughs = __rest(props, ["children", "className", "style", "tableWidth", "hasWordWrap", "hasBorder"]);
return (react_1.default.createElement("div", { className: cx('&', {
'&-has-border': hasBorder,
}, className), style: style },
react_1.default.createElement(Table_1.default, __assign({}, component_types_1.omitProps(passThroughs, undefined, lodash_1.default.keys(exports.ScrollTable.propTypes), false), { style: {
width: tableWidth,
}, hasWordWrap: hasWordWrap }), children)));
};
exports.ScrollTable = ScrollTable;
exports.ScrollTable.defaultProps = defaultProps;
exports.ScrollTable.displayName = 'ScrollTable';
exports.ScrollTable.peek = {
description: "\n\t\tTable in a scrollable container.\n\t",
categories: ['table'],
madeFrom: ['Table'],
};
exports.ScrollTable.Thead = Table_1.default.Thead;
exports.ScrollTable.Tbody = Table_1.default.Tbody;
exports.ScrollTable.Tr = Table_1.default.Tr;
exports.ScrollTable.Th = Table_1.default.Th;
exports.ScrollTable.Td = Table_1.default.Td;
exports.ScrollTable.propTypes = {
children: node(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n\t\t{Thead, Tbody, Tr, Th, Td} are the child components of Scrolltable, same\n\t\tas Table.\n\t"], ["\n\t\t{Thead, Tbody, Tr, Th, Td} are the child components of Scrolltable, same\n\t\tas Table.\n\t"]))),
className: string(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n\t\tClass names that are appended to the defaults.\n\t"], ["\n\t\tClass names that are appended to the defaults.\n\t"]))),
style: object(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n\t\tStyles that are passed through to the root container.\n\t"], ["\n\t\tStyles that are passed through to the root container.\n\t"]))),
tableWidth: oneOfType([number, string])(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n\t\tSet the width of the Table inside the scrollable container.\n\t"], ["\n\t\tSet the width of the Table inside the scrollable container.\n\t"]))),
hasWordWrap: bool(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n\t\tSet the Table contents to not allow word wrapping.\n\t"], ["\n\t\tSet the Table contents to not allow word wrapping.\n\t"]))),
hasBorder: bool(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n\t\trender the table with borders on the outer edge.\n\t"], ["\n\t\trender the table with borders on the outer edge.\n\t"]))),
};
exports.default = exports.ScrollTable;
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
//# sourceMappingURL=ScrollTable.js.map