nice-ui
Version:
React design system, components, and utilities
18 lines (17 loc) • 1.03 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.ToolbarItem = void 0;
const React = require("react");
const BasicButton_1 = require("../../2-inline-block/BasicButton");
const BasicTooltip_1 = require("../BasicTooltip");
const tooltipAnchor = { center: true, gap: 8, topIf: 64 };
const ToolbarItem = ({ narrow, small, outline, autowidth, tooltip, ...rest }) => {
const size = small ? 28 : 32;
let element = (React.createElement(BasicButton_1.BasicButton, { skewed: true, width: autowidth ? 'auto' : narrow ? 20 : size, height: size, border: outline, ...rest }));
if (tooltip) {
const height = (typeof rest.height === 'number' ? rest.height : void 0) ?? size ?? 32;
element = (React.createElement(BasicTooltip_1.BasicTooltip, { anchor: height === 32 ? tooltipAnchor : { ...tooltipAnchor, gap: (tooltipAnchor.gap ?? 32) + (32 - height) / 2 }, show: rest.disabled ? false : void 0, ...tooltip }, element));
}
return element;
};
exports.ToolbarItem = ToolbarItem;
;