UNPKG

@uifabric/experiments

Version:

Experimental React components for building experiences for Office 365.

36 lines 1.67 kB
define(["require", "exports", "tslib", "react", "../../Foundation", "../../Foundation", "../../CollapsibleSection", "./Accordion.styles"], function (require, exports, tslib_1, React, Foundation_1, Foundation_2, CollapsibleSection_1, Accordion_styles_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var AccordionItemType = Foundation_1.withSlots(CollapsibleSection_1.CollapsibleSection, null).type; var view = function (props) { var collapseItems = props.collapseItems; var children = React.Children.map(props.children, function (child, index) { var defaultItemProps = { defaultCollapsed: collapseItems }; if (child.type === AccordionItemType) { return React.cloneElement(child, tslib_1.__assign({}, defaultItemProps, child.props)); } return Foundation_1.withSlots(CollapsibleSection_1.CollapsibleSection, tslib_1.__assign({}, defaultItemProps), " ", child, " "); }); var Slots = Foundation_1.getSlots(props, { root: 'div' }); return Foundation_1.withSlots(Slots.root, null, children); }; var AccordionStatics = { Item: CollapsibleSection_1.CollapsibleSection, defaultProps: {} }; exports.Accordion = Foundation_2.createComponent({ displayName: 'Accordion', styles: Accordion_styles_1.styles, view: view, statics: AccordionStatics }); exports.default = exports.Accordion; }); //# sourceMappingURL=Accordion.js.map