UNPKG

@react-md/divider

Version:

This package is used to create horizontal or vertical dividers in your application.

47 lines 2.16 kB
"use strict"; 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.VerticalDivider = void 0; var jsx_runtime_1 = require("react/jsx-runtime"); var react_1 = require("react"); var Divider_1 = require("./Divider"); var useVerticalDividerHeight_1 = require("./useVerticalDividerHeight"); /** * This component is used to create a vertical divider based on a parent * element's height. This is really only needed when the parent element **has no * defined height**. If there is a defined height, this component is not worth * much as the height can be computed in css as normal. This really just fixes * the issue that the height would be set to `auto` (which computes to 0 most of * the time) when it is not set on a parent element. */ exports.VerticalDivider = (0, react_1.forwardRef)(function VerticalDivider(_a, ref) { var style = _a.style, _b = _a.maxHeight, maxHeight = _b === void 0 ? 1 : _b, props = __rest(_a, ["style", "maxHeight"]); var heightProps = (0, useVerticalDividerHeight_1.useVerticalDividerHeight)({ ref: ref, style: style, maxHeight: maxHeight, }); return (0, jsx_runtime_1.jsx)(Divider_1.Divider, __assign({}, props, heightProps, { vertical: true })); }); //# sourceMappingURL=VerticalDivider.js.map