1 | "use strict";
|
2 | "use client";
|
3 |
|
4 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
5 | exports.__esModule = true;
|
6 | exports.default = void 0;
|
7 | var _classnames = _interopRequireDefault(require("classnames"));
|
8 | var React = _interopRequireWildcard(require("react"));
|
9 | var _Button = require("@restart/ui/Button");
|
10 | var _ThemeProvider = require("./ThemeProvider");
|
11 | var _jsxRuntime = require("react/jsx-runtime");
|
12 | 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); }
|
13 | 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; }
|
14 | const Button = React.forwardRef(({
|
15 | as,
|
16 | bsPrefix,
|
17 | variant = 'primary',
|
18 | size,
|
19 | active = false,
|
20 | disabled = false,
|
21 | className,
|
22 | ...props
|
23 | }, ref) => {
|
24 | const prefix = (0, _ThemeProvider.useBootstrapPrefix)(bsPrefix, 'btn');
|
25 | const [buttonProps, {
|
26 | tagName
|
27 | }] = (0, _Button.useButtonProps)({
|
28 | tagName: as,
|
29 | disabled,
|
30 | ...props
|
31 | });
|
32 | const Component = tagName;
|
33 | return (0, _jsxRuntime.jsx)(Component, {
|
34 | ...buttonProps,
|
35 | ...props,
|
36 | ref: ref,
|
37 | disabled: disabled,
|
38 | className: (0, _classnames.default)(className, prefix, active && 'active', variant && `${prefix}-${variant}`, size && `${prefix}-${size}`, props.href && disabled && 'disabled')
|
39 | });
|
40 | });
|
41 | Button.displayName = 'Button';
|
42 | var _default = Button;
|
43 | exports.default = _default;
|
44 | module.exports = exports.default; |
\ | No newline at end of file |