1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4 | exports.__esModule = true;
|
5 | exports.default = void 0;
|
6 | var React = _interopRequireWildcard(require("react"));
|
7 | var _propTypes = _interopRequireDefault(require("prop-types"));
|
8 | var _Button = _interopRequireDefault(require("./Button"));
|
9 | var _ButtonGroup = _interopRequireDefault(require("./ButtonGroup"));
|
10 | var _Dropdown = _interopRequireDefault(require("./Dropdown"));
|
11 | var _types = require("./types");
|
12 | var _jsxRuntime = require("react/jsx-runtime");
|
13 | function _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); }
|
14 | function _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 | const propTypes = {
|
16 | |
17 |
|
18 |
|
19 |
|
20 |
|
21 | id: _propTypes.default.string,
|
22 | |
23 |
|
24 |
|
25 | toggleLabel: _propTypes.default.string,
|
26 |
|
27 | href: _propTypes.default.string,
|
28 |
|
29 | target: _propTypes.default.string,
|
30 |
|
31 | onClick: _propTypes.default.func,
|
32 |
|
33 | title: _propTypes.default.node.isRequired,
|
34 |
|
35 | type: _propTypes.default.string,
|
36 |
|
37 | disabled: _propTypes.default.bool,
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 | align: _types.alignPropType,
|
46 |
|
47 | menuRole: _propTypes.default.string,
|
48 |
|
49 | renderMenuOnMount: _propTypes.default.bool,
|
50 | |
51 |
|
52 |
|
53 |
|
54 |
|
55 | rootCloseEvent: _propTypes.default.string,
|
56 | |
57 |
|
58 |
|
59 |
|
60 |
|
61 | flip: _propTypes.default.bool,
|
62 |
|
63 | bsPrefix: _propTypes.default.string,
|
64 |
|
65 | variant: _propTypes.default.string,
|
66 |
|
67 | size: _propTypes.default.string
|
68 | };
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | const SplitButton = React.forwardRef(({
|
81 | id,
|
82 | bsPrefix,
|
83 | size,
|
84 | variant,
|
85 | title,
|
86 | type = 'button',
|
87 | toggleLabel = 'Toggle dropdown',
|
88 | children,
|
89 | onClick,
|
90 | href,
|
91 | target,
|
92 | menuRole,
|
93 | renderMenuOnMount,
|
94 | rootCloseEvent,
|
95 | flip,
|
96 | ...props
|
97 | }, ref) => (0, _jsxRuntime.jsxs)(_Dropdown.default, {
|
98 | ref: ref,
|
99 | ...props,
|
100 | as: _ButtonGroup.default,
|
101 | children: [(0, _jsxRuntime.jsx)(_Button.default, {
|
102 | size: size,
|
103 | variant: variant,
|
104 | disabled: props.disabled,
|
105 | bsPrefix: bsPrefix,
|
106 | href: href,
|
107 | target: target,
|
108 | onClick: onClick,
|
109 | type: type,
|
110 | children: title
|
111 | }), (0, _jsxRuntime.jsx)(_Dropdown.default.Toggle, {
|
112 | split: true,
|
113 | id: id,
|
114 | size: size,
|
115 | variant: variant,
|
116 | disabled: props.disabled,
|
117 | childBsPrefix: bsPrefix,
|
118 | children: (0, _jsxRuntime.jsx)("span", {
|
119 | className: "visually-hidden",
|
120 | children: toggleLabel
|
121 | })
|
122 | }), (0, _jsxRuntime.jsx)(_Dropdown.default.Menu, {
|
123 | role: menuRole,
|
124 | renderOnMount: renderMenuOnMount,
|
125 | rootCloseEvent: rootCloseEvent,
|
126 | flip: flip,
|
127 | children: children
|
128 | })]
|
129 | }));
|
130 | SplitButton.propTypes = propTypes;
|
131 | SplitButton.displayName = 'SplitButton';
|
132 | var _default = SplitButton;
|
133 | exports.default = _default;
|
134 | module.exports = exports.default; |
\ | No newline at end of file |