UNPKG

@braineet/ui

Version:

Braineet design system

27 lines 1.4 kB
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, { useContext } from 'react'; import { useMenuItemRadio } from 'ariakit/menu'; import { MenuStateContext } from './Menu'; import { StyledMenuItem } from './sc.Menu'; import { jsx as _jsx } from "react/jsx-runtime"; export var MenuItemRadio = /*#__PURE__*/React.forwardRef(function (_ref, ref) { var label = _ref.label, children = _ref.children, props = _objectWithoutPropertiesLoose(_ref, _excluded); var menu = useContext(MenuStateContext); var htmlProps = useMenuItemRadio(_extends({ state: menu }, props)); return /*#__PURE__*/_jsx(StyledMenuItem, _extends({ icon: htmlProps.checked ? 'tick' : '', styleType: htmlProps.checked ? 'subtle' : 'ghost', color: htmlProps.checked ? 'brand' : 'black', direction: "right", $justifyContent: "space-between", ref: ref }, htmlProps, { children: label || children })); });