Dashboard sipadu mbip
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import _extends from "@babel/runtime/helpers/esm/extends";
  2. import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
  3. import classNames from 'classnames';
  4. import React from 'react';
  5. import { useBootstrapPrefix } from './ThemeProvider';
  6. import SafeAnchor from './SafeAnchor';
  7. var defaultProps = {
  8. variant: 'primary',
  9. active: false,
  10. disabled: false,
  11. type: 'button'
  12. };
  13. var Button = React.forwardRef(function (_ref, ref) {
  14. var bsPrefix = _ref.bsPrefix,
  15. variant = _ref.variant,
  16. size = _ref.size,
  17. active = _ref.active,
  18. className = _ref.className,
  19. block = _ref.block,
  20. type = _ref.type,
  21. as = _ref.as,
  22. props = _objectWithoutPropertiesLoose(_ref, ["bsPrefix", "variant", "size", "active", "className", "block", "type", "as"]);
  23. var prefix = useBootstrapPrefix(bsPrefix, 'btn');
  24. var classes = classNames(className, prefix, active && 'active', prefix + "-" + variant, block && prefix + "-block", size && prefix + "-" + size);
  25. if (props.href) {
  26. return React.createElement(SafeAnchor, _extends({}, props, {
  27. as: as,
  28. ref: ref,
  29. className: classNames(classes, props.disabled && 'disabled')
  30. }));
  31. }
  32. if (ref) {
  33. props.ref = ref;
  34. }
  35. if (!as) {
  36. props.type = type;
  37. }
  38. var Component = as || 'button';
  39. return React.createElement(Component, _extends({}, props, {
  40. className: classes
  41. }));
  42. });
  43. Button.displayName = 'Button';
  44. Button.defaultProps = defaultProps;
  45. export default Button;