@braineet/ui
Version:
Braineet design system
22 lines • 1.18 kB
JavaScript
var _excluded = ["label", "children"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
import React from 'react';
import { useMenuItem } from 'ariakit/menu';
import { StyledMenuItem } from './sc.Menu';
import { jsx as _jsx } from "react/jsx-runtime";
export var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
var label = _ref.label,
children = _ref.children,
props = _objectWithoutPropertiesLoose(_ref, _excluded);
var htmlProps = useMenuItem(props);
if (typeof children === 'function') return children(htmlProps);
return /*#__PURE__*/_jsx(StyledMenuItem, _extends({
color: "black",
styleType: "ghost",
ref: ref,
shouldFitContainer: true
}, htmlProps, {
children: label || children
}));
});