@navinc/base-react-components
Version:
Nav's Pattern Library
66 lines (63 loc) • 2.82 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LabelOverValueContainer = exports.LabelOverValue = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const styled_components_1 = __importDefault(require("styled-components"));
const copy_js_1 = require("./copy.js");
const header_js_1 = require("./header.js");
const Label = (0, styled_components_1.default)(copy_js_1.Copy).withConfig({ displayName: "brc-sc-Label", componentId: "brc-sc-1wlhkim" }) ``;
const LabelAlignmentWrapper = styled_components_1.default.div.withConfig({ displayName: "brc-sc-LabelAlignmentWrapper", componentId: "brc-sc-8oap77" }) `
display: flex;
height: 30px;
align-items: flex-end;
`;
const Value = (0, styled_components_1.default)(header_js_1.Header).attrs(() => ({ size: 'md', as: copy_js_1.Copy })).withConfig({ displayName: "brc-sc-Value", componentId: "brc-sc-a2umut" }) `
min-height: 30px;
word-break: break-word;
font-weight: 800;
`;
const Wrapper = styled_components_1.default.div.withConfig({ displayName: "brc-sc-Wrapper", componentId: "brc-sc-19v3wgr" }) `
width: 122px;
max-width: 270px;
display: flex;
flex-flow: column nowrap;
border-bottom: solid 1px none;
border-top: solid 1px none;
padding-bottom: 16px;
padding-top: 16px;
flex-grow: 1;
`;
const Container = styled_components_1.default.div.withConfig({ displayName: "brc-sc-Container", componentId: "brc-sc-zkg2rl" }) `
display: flex;
flex-flow: row wrap;
align-items: stretch;
${({ borderColor }) => (borderColor ? `border: 1px solid ${borderColor}` : '')};
border-radius: 4px;
padding: 16px;
flex-grow: ${({ length = 1 }) => length};
flex-shrink: ${({ length = 1 }) => length};
margin-top: -16px; /* these margin-tops are to give space between rows when they wrap */
margin-right: -16px;
& > * {
margin-right: 16px;
margin-top: 16px;
}
& > & {
margin-top: 16px;
margin-right: 16px;
& > ${Wrapper} {
margin-top: 0;
border: none;
padding-bottom: 0;
padding-top: 0;
}
}
`;
const LabelOverValue = ({ value = '', label = '' }) => ((0, jsx_runtime_1.jsxs)(Wrapper, { children: [(0, jsx_runtime_1.jsx)(LabelAlignmentWrapper, { children: (0, jsx_runtime_1.jsx)(Label, { size: "md", children: label }) }), (0, jsx_runtime_1.jsx)(Value, { children: value })] }));
exports.LabelOverValue = LabelOverValue;
const LabelOverValueContainer = ({ children = [], borderColor }) => ((0, jsx_runtime_1.jsx)(Container, { length: children.length, borderColor: borderColor, children: children }));
exports.LabelOverValueContainer = LabelOverValueContainer;
//# sourceMappingURL=label-over-value.js.map