@react-md/divider
Version:
This package is used to create horizontal or vertical dividers in your application.
44 lines • 1.98 kB
JavaScript
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;
};
import { jsx as _jsx } from "react/jsx-runtime";
import { forwardRef } from "react";
import { Divider } from "./Divider";
import { useVerticalDividerHeight } from "./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.
*/
export var VerticalDivider = 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 = useVerticalDividerHeight({
ref: ref,
style: style,
maxHeight: maxHeight,
});
return _jsx(Divider, __assign({}, props, heightProps, { vertical: true }));
});
//# sourceMappingURL=VerticalDivider.js.map