@braineet/ui
Version:
Braineet design system
22 lines • 1.35 kB
JavaScript
var _excluded = ["label", "children"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
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
}));
});