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

60 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

2022-04-25 02:47:15 +00:00
"use strict";
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.default = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _classnames = _interopRequireDefault(require("classnames"));
var _react = _interopRequireDefault(require("react"));
var _uncontrollable = require("uncontrollable");
var _ThemeProvider = require("./ThemeProvider");
var _AccordionToggle = _interopRequireDefault(require("./AccordionToggle"));
var _SelectableContext = _interopRequireDefault(require("./SelectableContext"));
var _AccordionCollapse = _interopRequireDefault(require("./AccordionCollapse"));
var _AccordionContext = _interopRequireDefault(require("./AccordionContext"));
var _excluded = ["as", "activeKey", "bsPrefix", "children", "className", "onSelect"];
var Accordion = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
var _useUncontrolled = (0, _uncontrollable.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 = (0, _objectWithoutPropertiesLoose2.default)(_useUncontrolled, _excluded);
var finalClassName = (0, _classnames.default)(className, (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'accordion'));
return /*#__PURE__*/_react.default.createElement(_AccordionContext.default.Provider, {
value: activeKey || null
}, /*#__PURE__*/_react.default.createElement(_SelectableContext.default.Provider, {
value: onSelect || null
}, /*#__PURE__*/_react.default.createElement(Component, (0, _extends2.default)({
ref: ref
}, controlledProps, {
className: finalClassName
}), children)));
});
Accordion.displayName = 'Accordion';
Accordion.Toggle = _AccordionToggle.default;
Accordion.Collapse = _AccordionCollapse.default;
var _default = Accordion;
exports.default = _default;
module.exports = exports["default"];