GoScrobble/web/node_modules/react-bootstrap/esm/Accordion.js

39 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-04-25 02:47:15 +00:00
import _extends from "@babel/runtime/helpers/esm/extends";
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
var _excluded = ["as", "activeKey", "bsPrefix", "children", "className", "onSelect"];
import classNames from 'classnames';
import React from 'react';
import { useUncontrolled } from 'uncontrollable';
import { useBootstrapPrefix } from './ThemeProvider';
import AccordionToggle from './AccordionToggle';
import SelectableContext from './SelectableContext';
import AccordionCollapse from './AccordionCollapse';
import AccordionContext from './AccordionContext';
var Accordion = /*#__PURE__*/React.forwardRef(function (props, ref) {
var _useUncontrolled = useUncontrolled(props, {
activeKey: 'onSelect'
}),
_useUncontrolled$as = _useUncontrolled.as,
Component = _useUncontrolled$as === void 0 ? 'div' : _useUncontrolled$as,
activeKey = _useUncontrolled.activeKey,
bsPrefix = _useUncontrolled.bsPrefix,
children = _useUncontrolled.children,
className = _useUncontrolled.className,
onSelect = _useUncontrolled.onSelect,
controlledProps = _objectWithoutPropertiesLoose(_useUncontrolled, _excluded);
var finalClassName = classNames(className, useBootstrapPrefix(bsPrefix, 'accordion'));
return /*#__PURE__*/React.createElement(AccordionContext.Provider, {
value: activeKey || null
}, /*#__PURE__*/React.createElement(SelectableContext.Provider, {
value: onSelect || null
}, /*#__PURE__*/React.createElement(Component, _extends({
ref: ref
}, controlledProps, {
className: finalClassName
}), children)));
});
Accordion.displayName = 'Accordion';
Accordion.Toggle = AccordionToggle;
Accordion.Collapse = AccordionCollapse;
export default Accordion;