UNPKG

2.58 kBJavaScriptView Raw
1"use strict";
2"use client";
3
4var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5exports.__esModule = true;
6exports.default = void 0;
7var _classnames = _interopRequireDefault(require("classnames"));
8var React = _interopRequireWildcard(require("react"));
9var _ThemeProvider = require("./ThemeProvider");
10var _Collapse = _interopRequireDefault(require("./Collapse"));
11var _AccordionContext = _interopRequireWildcard(require("./AccordionContext"));
12var _jsxRuntime = require("react/jsx-runtime");
13function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15/**
16 * This component accepts all of [`Collapse`'s props](/docs/utilities/transitions#collapse-1).
17 */
18const AccordionCollapse = /*#__PURE__*/React.forwardRef(({
19 as: Component = 'div',
20 bsPrefix,
21 className,
22 children,
23 eventKey,
24 ...props
25}, ref) => {
26 const {
27 activeEventKey
28 } = (0, React.useContext)(_AccordionContext.default);
29 bsPrefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'accordion-collapse');
30 return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Collapse.default, {
31 ref: ref,
32 in: (0, _AccordionContext.isAccordionItemSelected)(activeEventKey, eventKey),
33 ...props,
34 className: (0, _classnames.default)(className, bsPrefix),
35 children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
36 children: React.Children.only(children)
37 })
38 });
39});
40AccordionCollapse.displayName = 'AccordionCollapse';
41var _default = AccordionCollapse;
42exports.default = _default;
43module.exports = exports.default;
\No newline at end of file