@uifabric/experiments
Version:
Experimental React components for building experiences for Office 365.
28 lines • 1.77 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
/** @jsx withSlots */
var office_ui_fabric_react_1 = require("office-ui-fabric-react");
var Foundation_1 = require("../../../Foundation");
var factoryComponents_1 = require("../../../utilities/factoryComponents");
var Button_1 = require("../Button");
exports.MenuButtonView = function (props) {
var children = props.children, disabled = props.disabled, onClick = props.onClick, expanded = props.expanded, onMenuDismiss = props.onMenuDismiss, menuTarget = props.menuTarget, rest = tslib_1.__rest(props, ["children", "disabled", "onClick", "expanded", "onMenuDismiss", "menuTarget"]);
var Slots = Foundation_1.getSlots(props, {
root: 'div',
button: Button_1.Button,
stack: office_ui_fabric_react_1.Stack,
icon: factoryComponents_1.Icon,
content: office_ui_fabric_react_1.Text,
menu: office_ui_fabric_react_1.ContextualMenu,
menuIcon: factoryComponents_1.Icon
});
return (Foundation_1.withSlots(Slots.root, { type: "button" // stack doesn't take in native button props
, role: "button", "aria-disabled": disabled },
Foundation_1.withSlots(Slots.button, tslib_1.__assign({ onClick: onClick, disabled: disabled }, rest),
children,
Foundation_1.withSlots(office_ui_fabric_react_1.Stack.Item, null,
Foundation_1.withSlots(Slots.menuIcon, { iconName: "ChevronDown" }))),
expanded && (Foundation_1.withSlots(Slots.menu, { target: menuTarget, onDismiss: onMenuDismiss, items: [], directionalHint: office_ui_fabric_react_1.DirectionalHint.bottomRightEdge }))));
};
//# sourceMappingURL=MenuButton.view.js.map