siam-ui-utils 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/dist/CustomBootstrap.js +9 -9
  2. package/dist/_virtual/_commonjsHelpers.js +7 -7
  3. package/dist/_virtual/events.js +6 -6
  4. package/dist/_virtual/events2.js +5 -5
  5. package/dist/_virtual/index.js +8 -8
  6. package/dist/_virtual/index2.js +5 -5
  7. package/dist/assets/img/copiar.png.js +5 -5
  8. package/dist/assets/img/take-photo.jpg.js +5 -5
  9. package/dist/constants.js +9 -9
  10. package/dist/copy-link/index.js +60 -60
  11. package/dist/copy-link/styles.css +37 -37
  12. package/dist/custom-input/CustomInputCheckbox.js +37 -37
  13. package/dist/custom-input/CustomInputCurrency.js +84 -84
  14. package/dist/custom-input/CustomInputFile.js +47 -47
  15. package/dist/custom-input/CustomInputRadio.js +68 -68
  16. package/dist/custom-input/constant.js +5 -5
  17. package/dist/custom-input/index.js +12 -12
  18. package/dist/drag-and-dropzone/DropzoneComponent.js +83 -83
  19. package/dist/drag-and-dropzone/config.js +59 -59
  20. package/dist/drag-and-dropzone/index.js +39 -39
  21. package/dist/dropzone/Input.js +77 -77
  22. package/dist/dropzone/Layout.js +50 -50
  23. package/dist/dropzone/Preview.js +117 -117
  24. package/dist/dropzone/SubmitButton.js +34 -34
  25. package/dist/dropzone/assets/cancel.svg.js +5 -5
  26. package/dist/dropzone/assets/remove.svg.js +5 -5
  27. package/dist/dropzone/assets/restart.svg.js +5 -5
  28. package/dist/dropzone/index.js +514 -514
  29. package/dist/dropzone/utils.js +93 -93
  30. package/dist/dropzone-uploader/base/index.js +135 -135
  31. package/dist/dropzone-uploader/index.js +7 -7
  32. package/dist/dropzone-uploader/styled/index.js +148 -148
  33. package/dist/iconos/constants-svg.js +666 -666
  34. package/dist/iconos/icon-button-svg.js +50 -50
  35. package/dist/iconos/index.js +24 -24
  36. package/dist/iconos/styled-icon.js +26 -26
  37. package/dist/index.js +4 -4
  38. package/dist/intl-messages/index.js +11 -11
  39. package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -8
  40. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -13
  41. package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -8
  42. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +13 -13
  43. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -9
  44. package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +111 -111
  45. package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +106 -106
  46. package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +125 -125
  47. package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +75 -75
  48. package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +225 -225
  49. package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +122 -122
  50. package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +83 -83
  51. package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +68 -68
  52. package/dist/node_modules/classnames/index.js +62 -62
  53. package/dist/node_modules/dom-helpers/esm/addClass.js +10 -10
  54. package/dist/node_modules/dom-helpers/esm/hasClass.js +8 -8
  55. package/dist/node_modules/dom-helpers/esm/removeClass.js +16 -16
  56. package/dist/node_modules/dropzone/dist/dropzone.js +1968 -1968
  57. package/dist/node_modules/events/events.js +372 -372
  58. package/dist/node_modules/just-extend/index.esm.js +43 -43
  59. package/dist/node_modules/react-transition-group/esm/CSSTransition.js +275 -275
  60. package/dist/node_modules/react-transition-group/esm/Transition.js +441 -441
  61. package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +146 -146
  62. package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -6
  63. package/dist/node_modules/react-transition-group/esm/config.js +7 -7
  64. package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +100 -100
  65. package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -24
  66. package/dist/node_modules/react-transition-group/esm/utils/reflow.js +7 -7
  67. package/dist/react-notifications/Notification.js +73 -73
  68. package/dist/react-notifications/NotificationContainer.js +59 -59
  69. package/dist/react-notifications/NotificationManager.js +174 -174
  70. package/dist/react-notifications/Notifications.js +72 -72
  71. package/dist/react-notifications/constants.js +26 -26
  72. package/dist/react-notifications/index.js +11 -11
  73. package/dist/select/custom-select/constants.js +8 -8
  74. package/dist/select/custom-select/index.js +89 -89
  75. package/dist/select/custom-select-input/index.js +12 -12
  76. package/dist/select/index.js +9 -9
  77. package/dist/select/multi-select/badge-label-multi-select.js +29 -29
  78. package/dist/select/multi-select/index.css +36 -36
  79. package/dist/select/multi-select/index.js +170 -171
  80. package/dist/select/multi-select/index.js.map +1 -1
  81. package/dist/select/multi-select/styled-component.js +23 -23
  82. package/dist/timer/index.js +60 -60
  83. package/dist/timer/styles.css +58 -58
  84. package/dist/tomar-foto/index.js +62 -62
  85. package/dist/view-layout/button-editor.js +14 -14
  86. package/dist/view-layout/constants.js +11 -11
  87. package/dist/view-layout/editor-layer.js +28 -28
  88. package/dist/view-layout/index.js +53 -53
  89. package/dist/view-layout/slot-wrapper.js +39 -39
  90. package/dist/view-layout/styles.css +126 -126
  91. package/dist/where-by-room/index.js +20 -20
  92. package/dist/where-by-room/room.js +78 -78
  93. package/package.json +1 -4
@@ -1,50 +1,50 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState, useRef, useEffect } from "react";
3
- import { withTheme } from "styled-components";
4
- import { Icon } from "./styled-icon.js";
5
- const useSvgToReactEncoded = (svg) => {
6
- const svgWrapperRef = useRef();
7
- useEffect(() => {
8
- svgWrapperRef.current.innerHTML = svg;
9
- }, [svg]);
10
- return svgWrapperRef;
11
- };
12
- const IconButtonSvg = (props) => {
13
- const {
14
- sublabel = "",
15
- onClick = () => {
16
- },
17
- onTouchStart = () => {
18
- },
19
- svg,
20
- svgOver,
21
- height = "3rem",
22
- width = "3rem",
23
- title
24
- } = props || {};
25
- const [svgActive, setSvgActive] = useState(svg);
26
- const svgWrapperRef = useSvgToReactEncoded(svgActive);
27
- return /* @__PURE__ */ jsxs(
28
- Icon,
29
- {
30
- title,
31
- display: sublabel !== "" ? "block" : "none",
32
- onClick,
33
- onTouchStart,
34
- onMouseOver: () => setSvgActive(svgOver || svg),
35
- onMouseOut: () => setSvgActive(svg),
36
- width,
37
- height,
38
- children: [
39
- /* @__PURE__ */ jsx("div", { ref: svgWrapperRef }),
40
- /* @__PURE__ */ jsx("label", { children: sublabel })
41
- ]
42
- }
43
- );
44
- };
45
- IconButtonSvg.defaultProps = { theme: {} };
46
- const _t = withTheme(IconButtonSvg);
47
- export {
48
- _t as IconButtonSvg
49
- };
50
- //# sourceMappingURL=icon-button-svg.js.map
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState, useRef, useEffect } from "react";
3
+ import { withTheme } from "styled-components";
4
+ import { Icon } from "./styled-icon.js";
5
+ const useSvgToReactEncoded = (svg) => {
6
+ const svgWrapperRef = useRef();
7
+ useEffect(() => {
8
+ svgWrapperRef.current.innerHTML = svg;
9
+ }, [svg]);
10
+ return svgWrapperRef;
11
+ };
12
+ const IconButtonSvg = (props) => {
13
+ const {
14
+ sublabel = "",
15
+ onClick = () => {
16
+ },
17
+ onTouchStart = () => {
18
+ },
19
+ svg,
20
+ svgOver,
21
+ height = "3rem",
22
+ width = "3rem",
23
+ title
24
+ } = props || {};
25
+ const [svgActive, setSvgActive] = useState(svg);
26
+ const svgWrapperRef = useSvgToReactEncoded(svgActive);
27
+ return /* @__PURE__ */ jsxs(
28
+ Icon,
29
+ {
30
+ title,
31
+ display: sublabel !== "" ? "block" : "none",
32
+ onClick,
33
+ onTouchStart,
34
+ onMouseOver: () => setSvgActive(svgOver || svg),
35
+ onMouseOut: () => setSvgActive(svg),
36
+ width,
37
+ height,
38
+ children: [
39
+ /* @__PURE__ */ jsx("div", { ref: svgWrapperRef }),
40
+ /* @__PURE__ */ jsx("label", { children: sublabel })
41
+ ]
42
+ }
43
+ );
44
+ };
45
+ IconButtonSvg.defaultProps = { theme: {} };
46
+ const _t = withTheme(IconButtonSvg);
47
+ export {
48
+ _t as IconButtonSvg
49
+ };
50
+ //# sourceMappingURL=icon-button-svg.js.map
@@ -1,24 +1,24 @@
1
- import { anularAyuda, contactoBarraSup, continuar, delegacionMenuLateral, delegacionesVerde, descarga, descargaOver, mailRojo, pagosMenuLateral, passwordEyeOpenSvg, passwordEyeSvg, pdfImage, telefonoCeleste, telefonoConsulta, telefonoEmergencia, telefonoExequial, telefonoSalud, whatAppIcon } from "./constants-svg.js";
2
- import { IconButtonSvg } from "./icon-button-svg.js";
3
- export {
4
- IconButtonSvg,
5
- anularAyuda,
6
- contactoBarraSup,
7
- continuar,
8
- delegacionMenuLateral,
9
- delegacionesVerde,
10
- descarga,
11
- descargaOver,
12
- mailRojo,
13
- pagosMenuLateral,
14
- passwordEyeOpenSvg,
15
- passwordEyeSvg,
16
- pdfImage,
17
- telefonoCeleste,
18
- telefonoConsulta,
19
- telefonoEmergencia,
20
- telefonoExequial,
21
- telefonoSalud,
22
- whatAppIcon
23
- };
24
- //# sourceMappingURL=index.js.map
1
+ import { anularAyuda, contactoBarraSup, continuar, delegacionMenuLateral, delegacionesVerde, descarga, descargaOver, mailRojo, pagosMenuLateral, passwordEyeOpenSvg, passwordEyeSvg, pdfImage, telefonoCeleste, telefonoConsulta, telefonoEmergencia, telefonoExequial, telefonoSalud, whatAppIcon } from "./constants-svg.js";
2
+ import { IconButtonSvg } from "./icon-button-svg.js";
3
+ export {
4
+ IconButtonSvg,
5
+ anularAyuda,
6
+ contactoBarraSup,
7
+ continuar,
8
+ delegacionMenuLateral,
9
+ delegacionesVerde,
10
+ descarga,
11
+ descargaOver,
12
+ mailRojo,
13
+ pagosMenuLateral,
14
+ passwordEyeOpenSvg,
15
+ passwordEyeSvg,
16
+ pdfImage,
17
+ telefonoCeleste,
18
+ telefonoConsulta,
19
+ telefonoEmergencia,
20
+ telefonoExequial,
21
+ telefonoSalud,
22
+ whatAppIcon
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -1,26 +1,26 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { styled } from "styled-components";
3
- const IconDiv = (props) => /* @__PURE__ */ jsx("div", { ...props });
4
- const Icon = styled(IconDiv)`
5
- display: flex;
6
- flex-direction: column;
7
- justify-content: center;
8
- align-items: center;
9
- svg {
10
- margin: 0.1rem;
11
- margin-right: 0.1rem;
12
- margin-top: 0.1rem;
13
- justify-content: center;
14
- color: red;
15
- width: ${(props) => props.width || "3rem"};
16
- height: ${(props) => props.height || props.width || "3rem"};
17
- cursor: pointer;
18
- }
19
- label {
20
- display: ${(props) => props.display || "none"};
21
- }
22
- `;
23
- export {
24
- Icon
25
- };
26
- //# sourceMappingURL=styled-icon.js.map
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { styled } from "styled-components";
3
+ const IconDiv = (props) => /* @__PURE__ */ jsx("div", { ...props });
4
+ const Icon = styled(IconDiv)`
5
+ display: flex;
6
+ flex-direction: column;
7
+ justify-content: center;
8
+ align-items: center;
9
+ svg {
10
+ margin: 0.1rem;
11
+ margin-right: 0.1rem;
12
+ margin-top: 0.1rem;
13
+ justify-content: center;
14
+ color: red;
15
+ width: ${(props) => props.width || "3rem"};
16
+ height: ${(props) => props.height || props.width || "3rem"};
17
+ cursor: pointer;
18
+ }
19
+ label {
20
+ display: ${(props) => props.display || "none"};
21
+ }
22
+ `;
23
+ export {
24
+ Icon
25
+ };
26
+ //# sourceMappingURL=styled-icon.js.map
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- console.error(
2
- '\n⚠️ ERROR: Import desde "siam-ui-utils" no está permitido.\n Usa imports modulares como:\n import { createField } from "siam-ui-utils/custom-input"\n'
3
- );
4
- //# sourceMappingURL=index.js.map
1
+ console.error(
2
+ '\n⚠️ ERROR: Import desde "siam-ui-utils" no está permitido.\n Usa imports modulares como:\n import { createField } from "siam-ui-utils/custom-input"\n'
3
+ );
4
+ //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { injectIntl, FormattedMessage } from "react-intl";
3
- const InjectMessage = (props) => /* @__PURE__ */ jsx(FormattedMessage, { ...props });
4
- const IntlMessages = injectIntl(InjectMessage, {
5
- withRef: false
6
- });
7
- export {
8
- IntlMessages,
9
- IntlMessages as default
10
- };
11
- //# sourceMappingURL=index.js.map
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { injectIntl, FormattedMessage } from "react-intl";
3
+ const InjectMessage = (props) => /* @__PURE__ */ jsx(FormattedMessage, { ...props });
4
+ const IntlMessages = injectIntl(InjectMessage, {
5
+ withRef: false
6
+ });
7
+ export {
8
+ IntlMessages,
9
+ IntlMessages as default
10
+ };
11
+ //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- function _assertThisInitialized(e) {
2
- if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3
- return e;
4
- }
5
- export {
6
- _assertThisInitialized as default
7
- };
8
- //# sourceMappingURL=assertThisInitialized.js.map
1
+ function _assertThisInitialized(e) {
2
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3
+ return e;
4
+ }
5
+ export {
6
+ _assertThisInitialized as default
7
+ };
8
+ //# sourceMappingURL=assertThisInitialized.js.map
@@ -1,13 +1,13 @@
1
- function _extends() {
2
- return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
- for (var e = 1; e < arguments.length; e++) {
4
- var t = arguments[e];
5
- for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
- }
7
- return n;
8
- }, _extends.apply(null, arguments);
9
- }
10
- export {
11
- _extends as default
12
- };
13
- //# sourceMappingURL=extends.js.map
1
+ function _extends() {
2
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var e = 1; e < arguments.length; e++) {
4
+ var t = arguments[e];
5
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ export {
11
+ _extends as default
12
+ };
13
+ //# sourceMappingURL=extends.js.map
@@ -1,8 +1,8 @@
1
- import _setPrototypeOf from "./setPrototypeOf.js";
2
- function _inheritsLoose(t, o) {
3
- t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
4
- }
5
- export {
6
- _inheritsLoose as default
7
- };
8
- //# sourceMappingURL=inheritsLoose.js.map
1
+ import _setPrototypeOf from "./setPrototypeOf.js";
2
+ function _inheritsLoose(t, o) {
3
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
4
+ }
5
+ export {
6
+ _inheritsLoose as default
7
+ };
8
+ //# sourceMappingURL=inheritsLoose.js.map
@@ -1,13 +1,13 @@
1
- function _objectWithoutPropertiesLoose(r, e) {
2
- if (null == r) return {};
3
- var t = {};
4
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
5
- if (-1 !== e.indexOf(n)) continue;
6
- t[n] = r[n];
7
- }
8
- return t;
9
- }
10
- export {
11
- _objectWithoutPropertiesLoose as default
12
- };
13
- //# sourceMappingURL=objectWithoutPropertiesLoose.js.map
1
+ function _objectWithoutPropertiesLoose(r, e) {
2
+ if (null == r) return {};
3
+ var t = {};
4
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
5
+ if (-1 !== e.indexOf(n)) continue;
6
+ t[n] = r[n];
7
+ }
8
+ return t;
9
+ }
10
+ export {
11
+ _objectWithoutPropertiesLoose as default
12
+ };
13
+ //# sourceMappingURL=objectWithoutPropertiesLoose.js.map
@@ -1,9 +1,9 @@
1
- function _setPrototypeOf(t, e) {
2
- return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
3
- return t2.__proto__ = e2, t2;
4
- }, _setPrototypeOf(t, e);
5
- }
6
- export {
7
- _setPrototypeOf as default
8
- };
9
- //# sourceMappingURL=setPrototypeOf.js.map
1
+ function _setPrototypeOf(t, e) {
2
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
3
+ return t2.__proto__ = e2, t2;
4
+ }, _setPrototypeOf(t, e);
5
+ }
6
+ export {
7
+ _setPrototypeOf as default
8
+ };
9
+ //# sourceMappingURL=setPrototypeOf.js.map
@@ -1,111 +1,111 @@
1
- import React, { useCallback } from "react";
2
- import PropTypes from "prop-types";
3
- import classnames from "../../../../_virtual/index.js";
4
- import { mapToCssModules, tagPropType } from "./utils.js";
5
- import CloseButton from "./CloseButton.js";
6
- var _excluded = ["active", "aria-label", "block", "className", "close", "cssModule", "color", "outline", "size", "tag", "innerRef"];
7
- function _extends() {
8
- _extends = Object.assign ? Object.assign.bind() : function(target) {
9
- for (var i = 1; i < arguments.length; i++) {
10
- var source = arguments[i];
11
- for (var key in source) {
12
- if (Object.prototype.hasOwnProperty.call(source, key)) {
13
- target[key] = source[key];
14
- }
15
- }
16
- }
17
- return target;
18
- };
19
- return _extends.apply(this, arguments);
20
- }
21
- function _objectWithoutProperties(source, excluded) {
22
- if (source == null) return {};
23
- var target = _objectWithoutPropertiesLoose(source, excluded);
24
- var key, i;
25
- if (Object.getOwnPropertySymbols) {
26
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
27
- for (i = 0; i < sourceSymbolKeys.length; i++) {
28
- key = sourceSymbolKeys[i];
29
- if (excluded.indexOf(key) >= 0) continue;
30
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
31
- target[key] = source[key];
32
- }
33
- }
34
- return target;
35
- }
36
- function _objectWithoutPropertiesLoose(source, excluded) {
37
- if (source == null) return {};
38
- var target = {};
39
- var sourceKeys = Object.keys(source);
40
- var key, i;
41
- for (i = 0; i < sourceKeys.length; i++) {
42
- key = sourceKeys[i];
43
- if (excluded.indexOf(key) >= 0) continue;
44
- target[key] = source[key];
45
- }
46
- return target;
47
- }
48
- var propTypes = {
49
- /** Manually set the visual state of the button to active */
50
- active: PropTypes.bool,
51
- /** Aria label */
52
- "aria-label": PropTypes.string,
53
- block: PropTypes.bool,
54
- /** Pass children so this component can wrap them */
55
- children: PropTypes.node,
56
- /** Add custom class */
57
- className: PropTypes.string,
58
- /** Change existing className with a new className */
59
- cssModule: PropTypes.object,
60
- /** Use the button as a close button */
61
- close: PropTypes.bool,
62
- /** Change color of Button to one of the available colors */
63
- color: PropTypes.string,
64
- /** Disables the button */
65
- disabled: PropTypes.bool,
66
- innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
67
- /** Function to be triggered on click */
68
- onClick: PropTypes.func,
69
- /** Adds outline to the button */
70
- outline: PropTypes.bool,
71
- /** Make the button bigger or smaller */
72
- size: PropTypes.string,
73
- /** Set a custom element for this component */
74
- tag: tagPropType
75
- };
76
- function Button(props) {
77
- var onClick = useCallback(function(e) {
78
- if (props.disabled) {
79
- e.preventDefault();
80
- return;
81
- }
82
- if (props.onClick) {
83
- return props.onClick(e);
84
- }
85
- }, [props.onClick, props.disabled]);
86
- var active = props.active, ariaLabel = props["aria-label"], block = props.block, className = props.className, close = props.close, cssModule = props.cssModule, _props$color = props.color, color = _props$color === void 0 ? "secondary" : _props$color, outline = props.outline, size = props.size, _props$tag = props.tag, Tag = _props$tag === void 0 ? "button" : _props$tag, innerRef = props.innerRef, attributes = _objectWithoutProperties(props, _excluded);
87
- if (close) {
88
- return /* @__PURE__ */ React.createElement(CloseButton, attributes);
89
- }
90
- var btnOutlineColor = "btn".concat(outline ? "-outline" : "", "-").concat(color);
91
- var classes = mapToCssModules(classnames(className, "btn", btnOutlineColor, size ? "btn-".concat(size) : false, block ? "d-block w-100" : false, {
92
- active,
93
- disabled: props.disabled
94
- }), cssModule);
95
- if (attributes.href && Tag === "button") {
96
- Tag = "a";
97
- }
98
- return /* @__PURE__ */ React.createElement(Tag, _extends({
99
- type: Tag === "button" && attributes.onClick ? "button" : void 0
100
- }, attributes, {
101
- className: classes,
102
- ref: innerRef,
103
- onClick,
104
- "aria-label": ariaLabel
105
- }));
106
- }
107
- Button.propTypes = propTypes;
108
- export {
109
- Button as default
110
- };
111
- //# sourceMappingURL=Button.js.map
1
+ import React, { useCallback } from "react";
2
+ import PropTypes from "prop-types";
3
+ import classnames from "../../../../_virtual/index.js";
4
+ import { mapToCssModules, tagPropType } from "./utils.js";
5
+ import CloseButton from "./CloseButton.js";
6
+ var _excluded = ["active", "aria-label", "block", "className", "close", "cssModule", "color", "outline", "size", "tag", "innerRef"];
7
+ function _extends() {
8
+ _extends = Object.assign ? Object.assign.bind() : function(target) {
9
+ for (var i = 1; i < arguments.length; i++) {
10
+ var source = arguments[i];
11
+ for (var key in source) {
12
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
13
+ target[key] = source[key];
14
+ }
15
+ }
16
+ }
17
+ return target;
18
+ };
19
+ return _extends.apply(this, arguments);
20
+ }
21
+ function _objectWithoutProperties(source, excluded) {
22
+ if (source == null) return {};
23
+ var target = _objectWithoutPropertiesLoose(source, excluded);
24
+ var key, i;
25
+ if (Object.getOwnPropertySymbols) {
26
+ var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
27
+ for (i = 0; i < sourceSymbolKeys.length; i++) {
28
+ key = sourceSymbolKeys[i];
29
+ if (excluded.indexOf(key) >= 0) continue;
30
+ if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
31
+ target[key] = source[key];
32
+ }
33
+ }
34
+ return target;
35
+ }
36
+ function _objectWithoutPropertiesLoose(source, excluded) {
37
+ if (source == null) return {};
38
+ var target = {};
39
+ var sourceKeys = Object.keys(source);
40
+ var key, i;
41
+ for (i = 0; i < sourceKeys.length; i++) {
42
+ key = sourceKeys[i];
43
+ if (excluded.indexOf(key) >= 0) continue;
44
+ target[key] = source[key];
45
+ }
46
+ return target;
47
+ }
48
+ var propTypes = {
49
+ /** Manually set the visual state of the button to active */
50
+ active: PropTypes.bool,
51
+ /** Aria label */
52
+ "aria-label": PropTypes.string,
53
+ block: PropTypes.bool,
54
+ /** Pass children so this component can wrap them */
55
+ children: PropTypes.node,
56
+ /** Add custom class */
57
+ className: PropTypes.string,
58
+ /** Change existing className with a new className */
59
+ cssModule: PropTypes.object,
60
+ /** Use the button as a close button */
61
+ close: PropTypes.bool,
62
+ /** Change color of Button to one of the available colors */
63
+ color: PropTypes.string,
64
+ /** Disables the button */
65
+ disabled: PropTypes.bool,
66
+ innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
67
+ /** Function to be triggered on click */
68
+ onClick: PropTypes.func,
69
+ /** Adds outline to the button */
70
+ outline: PropTypes.bool,
71
+ /** Make the button bigger or smaller */
72
+ size: PropTypes.string,
73
+ /** Set a custom element for this component */
74
+ tag: tagPropType
75
+ };
76
+ function Button(props) {
77
+ var onClick = useCallback(function(e) {
78
+ if (props.disabled) {
79
+ e.preventDefault();
80
+ return;
81
+ }
82
+ if (props.onClick) {
83
+ return props.onClick(e);
84
+ }
85
+ }, [props.onClick, props.disabled]);
86
+ var active = props.active, ariaLabel = props["aria-label"], block = props.block, className = props.className, close = props.close, cssModule = props.cssModule, _props$color = props.color, color = _props$color === void 0 ? "secondary" : _props$color, outline = props.outline, size = props.size, _props$tag = props.tag, Tag = _props$tag === void 0 ? "button" : _props$tag, innerRef = props.innerRef, attributes = _objectWithoutProperties(props, _excluded);
87
+ if (close) {
88
+ return /* @__PURE__ */ React.createElement(CloseButton, attributes);
89
+ }
90
+ var btnOutlineColor = "btn".concat(outline ? "-outline" : "", "-").concat(color);
91
+ var classes = mapToCssModules(classnames(className, "btn", btnOutlineColor, size ? "btn-".concat(size) : false, block ? "d-block w-100" : false, {
92
+ active,
93
+ disabled: props.disabled
94
+ }), cssModule);
95
+ if (attributes.href && Tag === "button") {
96
+ Tag = "a";
97
+ }
98
+ return /* @__PURE__ */ React.createElement(Tag, _extends({
99
+ type: Tag === "button" && attributes.onClick ? "button" : void 0
100
+ }, attributes, {
101
+ className: classes,
102
+ ref: innerRef,
103
+ onClick,
104
+ "aria-label": ariaLabel
105
+ }));
106
+ }
107
+ Button.propTypes = propTypes;
108
+ export {
109
+ Button as default
110
+ };
111
+ //# sourceMappingURL=Button.js.map