@councilbox/councilbox-ui 2.0.52 → 2.0.54
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.
- package/dist/HOCs/overlayA11yStack.js +47 -0
- package/dist/HOCs/useA11yGuard.js +38 -0
- package/dist/HOCs/useDynamicStyles.js +18 -38
- package/dist/HOCs/useMenuNavigation.js +110 -0
- package/dist/HOCs/useOverlay.js +87 -0
- package/dist/HOCs/usePopoverPosition.js +228 -0
- package/dist/HOCs/useRipple.js +17 -35
- package/dist/HOCs/useWindowSize.js +24 -42
- package/dist/build-index.js +49 -99
- package/dist/components/1.Introduction.stories.mdx +1 -1
- package/dist/components/2.Changelog.stories.mdx +45 -0
- package/dist/components/3.Guide.stories.mdx +1 -1
- package/dist/components/Accordion/Accordion.css +7 -0
- package/dist/components/Accordion/Accordion.js +97 -102
- package/dist/components/Accordion/Accordion.stories.js +10 -12
- package/dist/components/Accordion/AccordionOld.js +32 -56
- package/dist/components/Accordion/DesignAccordion.stories.js +10 -21
- package/dist/components/Alert/Alert.js +55 -55
- package/dist/components/Alert/Alert.stories.js +10 -11
- package/dist/components/Avatar/Avatar.js +82 -74
- package/dist/components/Avatar/Avatar.stories.js +19 -23
- package/dist/components/Avatar/AvatarOld.js +46 -60
- package/dist/components/Avatar/DesignAvatar.stories.js +18 -26
- package/dist/components/Avatar/DesignAvatarText.stories.js +31 -40
- package/dist/components/AvatarGroup/AvatarGroup.js +7 -14
- package/dist/components/AvatarGroup/AvatarGroup.stories.js +6 -13
- package/dist/components/AvatarGroup/DesignAvatarGroup.stories.js +34 -45
- package/dist/components/Block/Block.css +3 -3
- package/dist/components/Block/Block.js +31 -45
- package/dist/components/Block/Block.stories.js +5 -12
- package/dist/components/Block/DesignBlock.stories.js +7 -13
- package/dist/components/Button/Button.js +44 -66
- package/dist/components/Button/Button.stories.js +8 -14
- package/dist/components/Button/button.css +1 -1
- package/dist/components/ButtonBasic/ButtonBasic.css +6 -1
- package/dist/components/ButtonBasic/ButtonBasic.js +96 -118
- package/dist/components/ButtonBasic/ButtonBasic.stories.js +14 -15
- package/dist/components/ButtonBasic/ButtonBasicOld.js +57 -77
- package/dist/components/Checkbox/Checkbox.css +6 -0
- package/dist/components/Checkbox/Checkbox.js +81 -100
- package/dist/components/Checkbox/Checkbox.stories.js +10 -11
- package/dist/components/Checkbox/CheckboxOld.js +19 -35
- package/dist/components/DragDrop/DragDrop.css +20 -9
- package/dist/components/DragDrop/DragDrop.js +80 -76
- package/dist/components/DragDrop/DragDrop.stories.js +9 -16
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +35 -53
- package/dist/components/DrawerPanel/DrawerPanel.js +157 -146
- package/dist/components/DrawerPanel/DrawerPanel.stories.js +10 -12
- package/dist/components/DrawerPanel/DrawerPanelOld.js +76 -98
- package/dist/components/DropDown/DesignDropDown.stories.js +79 -97
- package/dist/components/DropDown/DropDown.js +168 -342
- package/dist/components/DropDown/DropDown.stories.js +6 -12
- package/dist/components/DropDown/DropDownOld.js +57 -89
- package/dist/components/DropDown/PopoverPlayground.js +68 -98
- package/dist/components/EnhancedTable/DesignEnhancedTable.stories.js +26 -36
- package/dist/components/EnhancedTable/EnhancedMyTable.js +16 -19
- package/dist/components/EnhancedTable/EnhancedTable.js +77 -136
- package/dist/components/EnhancedTable/EnhancedTable.stories.js +5 -12
- package/dist/components/EnhancedTable/EnhancedTableBody.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableCell.js +25 -34
- package/dist/components/EnhancedTable/EnhancedTableContainer.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableHead.js +11 -14
- package/dist/components/EnhancedTable/EnhancedTableRow.js +15 -18
- package/dist/components/EnhancedTable/EnhancedTableSortLabel.js +15 -18
- package/dist/components/FabButton/DesignFabButton.stories.js +9 -16
- package/dist/components/FabButton/FabButton.js +51 -54
- package/dist/components/FabButton/FabButton.stories.js +10 -12
- package/dist/components/Grid/DesignGrid.stories.js +7 -14
- package/dist/components/Grid/Grid.js +38 -46
- package/dist/components/Grid/Grid.stories.js +6 -13
- package/dist/components/Grid/GridItem.js +37 -39
- package/dist/components/Grid/GridItemOld.js +13 -18
- package/dist/components/Grid/GridOld.js +14 -21
- package/dist/components/Header/DesignHeader.stories.js +20 -24
- package/dist/components/Header/Header.js +201 -242
- package/dist/components/Header/Header.stories.js +9 -21
- package/dist/components/Header/header.css +10 -5
- package/dist/components/IconButton/DesignIconButton.stories.js +31 -36
- package/dist/components/IconButton/IconButton.css +6 -1
- package/dist/components/IconButton/IconButton.js +132 -138
- package/dist/components/IconButton/IconButton.stories.js +12 -13
- package/dist/components/IconButton/IconButtonOld.js +41 -57
- package/dist/components/IconButtonSquare/DesignIconButtonSquare.stories.js +5 -11
- package/dist/components/IconButtonSquare/IconButtonSquare.js +11 -25
- package/dist/components/IconButtonSquare/IconButtonSquare.stories.js +7 -13
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +44 -62
- package/dist/components/IconFont/IconFont.js +27 -48
- package/dist/components/IconFont/IconFont.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocomplete.css +6 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +184 -260
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +5 -11
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +43 -62
- package/dist/components/InputPassword/InputPassword.css +0 -6
- package/dist/components/InputPassword/InputPassword.js +58 -73
- package/dist/components/InputPassword/InputPassword.stories.js +5 -11
- package/dist/components/InputText/InputText.css +86 -78
- package/dist/components/InputText/InputText.js +207 -211
- package/dist/components/InputText/InputText.stories.js +11 -11
- package/dist/components/InputText/InputTextOld.js +48 -74
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +38 -51
- package/dist/components/InputTextArea/InputTextArea.js +84 -93
- package/dist/components/InputTextArea/InputTextArea.stories.js +5 -12
- package/dist/components/LoadingSection/LoadingSection.js +44 -51
- package/dist/components/LoadingSection/LoadingSection.stories.js +5 -11
- package/dist/components/MenuItem/DesignMenuItem.stories.js +20 -34
- package/dist/components/MenuItem/MenuItem.css +7 -2
- package/dist/components/MenuItem/MenuItem.js +100 -113
- package/dist/components/MenuItem/MenuItem.stories.js +6 -15
- package/dist/components/MenuItem/MenuItemOld.js +40 -56
- package/dist/components/MenuLateralLeft/MenuLateralLeft.css +24 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +123 -160
- package/dist/components/MenuLateralLeft/MenuLateralLeft.stories.js +5 -12
- package/dist/components/MenuLateralRight/MenuLateralRight.css +2 -2
- package/dist/components/MenuLateralRight/MenuLateralRight.js +73 -77
- package/dist/components/MenuLateralRight/MenuLateralRight.stories.js +5 -12
- package/dist/components/Modal/DesignModal.stories.js +15 -30
- package/dist/components/Modal/Modal.css +35 -15
- package/dist/components/Modal/Modal.js +154 -145
- package/dist/components/Modal/Modal.stories.js +7 -16
- package/dist/components/Modal/ModalOld.js +73 -90
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +4 -10
- package/dist/components/PaginationFooter/PaginationFooter.css +10 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +99 -91
- package/dist/components/PaginationFooter/PaginationFooter.stories.js +5 -12
- package/dist/components/RadioButton/Radio.css +19 -18
- package/dist/components/RadioButton/Radio.js +65 -83
- package/dist/components/RadioButton/Radio.stories.js +27 -36
- package/dist/components/RadioButton/RadioOld.js +23 -39
- package/dist/components/Ripple/DesignRipple.js +25 -41
- package/dist/components/Ripple/Ripple.stories.js +5 -11
- package/dist/components/Scrollbar/DesignScrollbar.js +5 -10
- package/dist/components/Scrollbar/Scrollbar.js +37 -56
- package/dist/components/Scrollbar/Scrollbar.stories.js +5 -12
- package/dist/components/SelectInput/DesignSelectInput.js +22 -45
- package/dist/components/SelectInput/SelectInput.js +101 -155
- package/dist/components/SelectInput/SelectInput.stories.js +6 -15
- package/dist/components/SelectInput/SelectInputOld.js +52 -81
- package/dist/components/Slider/DesignSlider.js +8 -14
- package/dist/components/Slider/Slider.css +57 -37
- package/dist/components/Slider/Slider.js +85 -84
- package/dist/components/Slider/Slider.stories.js +5 -12
- package/dist/components/Spacing/Spacing.js +38 -45
- package/dist/components/Spacing/Spacing.stories.js +5 -11
- package/dist/components/Stars/DesignStars.js +17 -30
- package/dist/components/Stars/Stars.css +55 -104
- package/dist/components/Stars/Stars.js +89 -73
- package/dist/components/Stars/Stars.stories.js +5 -12
- package/dist/components/Stepper/DesignStepper.stories.js +16 -30
- package/dist/components/Stepper/Stepper.css +46 -10
- package/dist/components/Stepper/Stepper.js +118 -134
- package/dist/components/Stepper/Stepper.stories.js +5 -12
- package/dist/components/Table/DesignTable.stories.js +200 -211
- package/dist/components/Table/Table.css +33 -2
- package/dist/components/Table/Table.js +30 -38
- package/dist/components/Table/Table.stories.js +5 -12
- package/dist/components/Table/TableBody.js +22 -34
- package/dist/components/Table/TableCell.js +71 -61
- package/dist/components/Table/TableContainer.js +22 -34
- package/dist/components/Table/TableHead.js +22 -34
- package/dist/components/Table/TableOld.js +52 -84
- package/dist/components/Table/TableRow.js +33 -37
- package/dist/components/Table/TableSortLabel.js +42 -52
- package/dist/components/Tabs/DesignTabs.js +14 -28
- package/dist/components/Tabs/Tabs.css +30 -11
- package/dist/components/Tabs/Tabs.js +151 -137
- package/dist/components/Tabs/Tabs.stories.js +5 -12
- package/dist/components/Tabs/TabsOld.js +28 -42
- package/dist/components/Tag/DesignTags.stories.js +24 -39
- package/dist/components/Tag/Tag.css +61 -42
- package/dist/components/Tag/Tag.js +93 -91
- package/dist/components/Tag/Tag.stories.js +5 -12
- package/dist/components/TextInput/TextInput.js +38 -54
- package/dist/components/TextInput/TextInput.stories.js +5 -11
- package/dist/components/ThemeProvider/Colors.js +2 -2
- package/dist/components/ThemeProvider/CouncilboxThemeContext.js +7 -10
- package/dist/components/ThemeProvider/ThemeProvider.js +34 -52
- package/dist/components/Timeline/DesignTimeline.stories.js +4 -10
- package/dist/components/Timeline/Timeline.js +66 -46
- package/dist/components/Timeline/Timeline.stories.js +5 -12
- package/dist/components/Toggle/Toggle.css +10 -0
- package/dist/components/Toggle/Toggle.js +115 -98
- package/dist/components/Toggle/Toggle.stories.js +10 -11
- package/dist/components/Tooltip/DesignTooltip.stories.js +10 -16
- package/dist/components/Tooltip/Tooltip.css +17 -1
- package/dist/components/Tooltip/Tooltip.js +190 -366
- package/dist/components/Tooltip/Tooltip.stories.js +5 -12
- package/dist/components/Typography/Typography.css +57 -6
- package/dist/components/Typography/Typography.js +44 -97
- package/dist/components/Typography/Typography.stories.js +5 -11
- package/dist/components/Typography/TypographyOld.js +29 -42
- package/dist/index.js +2 -6
- package/dist/reportWebVitals.js +8 -14
- package/dist/storybook.test.js +2 -4
- package/dist/styles/colorConsts.css +4 -4
- package/dist/styles/main.css +16 -0
- package/dist/styles/stylesheet.js +10 -22
- package/dist/testing/TestAutocomplete.js +74 -97
- package/dist/testing/TestComponents.js +5 -10
- package/dist/testing/TestDropdown.js +33 -41
- package/dist/utils/autoDetectScroll.js +12 -35
- package/dist/utils/index.js +37 -63
- package/dist/utils/useFallbackId.js +19 -0
- package/package.json +5 -2
|
@@ -1,142 +1,111 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
require("../../styles/main.css");
|
|
13
|
-
|
|
14
11
|
require("./ButtonBasic.css");
|
|
15
|
-
|
|
16
12
|
var _LoadingSection = _interopRequireDefault(require("../LoadingSection/LoadingSection"));
|
|
17
|
-
|
|
18
13
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
19
|
-
|
|
20
14
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
21
|
-
|
|
22
15
|
var _useRipple3 = _interopRequireDefault(require("../../HOCs/useRipple"));
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
|
-
|
|
34
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
35
|
-
|
|
36
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
-
|
|
16
|
+
var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "variantText", "stylesButton", "sx", "badge", "resetDelay", "reset", "error", "success", "startIcon", "endIcon", "className", "style", "prefixClass", "component", "badgeAriaLabel", "loadingAriaLabel"];
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
18
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
19
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
24
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
38
25
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
39
|
-
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
-
|
|
48
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
49
|
-
|
|
50
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
51
|
-
|
|
52
|
-
var ButtonBasic = function ButtonBasic(_ref) {
|
|
26
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
27
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) { n[e] = r[e]; } return n; }
|
|
28
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
29
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
30
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
31
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
32
|
+
var ButtonBasic = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref) {
|
|
53
33
|
var id = _ref.id,
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
34
|
+
text = _ref.text,
|
|
35
|
+
onClick = _ref.onClick,
|
|
36
|
+
disabled = _ref.disabled,
|
|
37
|
+
loading = _ref.loading,
|
|
38
|
+
variant = _ref.variant,
|
|
39
|
+
fullWidth = _ref.fullWidth,
|
|
40
|
+
icon = _ref.icon,
|
|
41
|
+
variantText = _ref.variantText,
|
|
42
|
+
stylesButton = _ref.stylesButton,
|
|
43
|
+
sx = _ref.sx,
|
|
44
|
+
badge = _ref.badge,
|
|
45
|
+
_ref$resetDelay = _ref.resetDelay,
|
|
46
|
+
resetDelay = _ref$resetDelay === void 0 ? 2700 : _ref$resetDelay,
|
|
47
|
+
reset = _ref.reset,
|
|
48
|
+
error = _ref.error,
|
|
49
|
+
success = _ref.success,
|
|
50
|
+
_ref$startIcon = _ref.startIcon,
|
|
51
|
+
startIcon = _ref$startIcon === void 0 ? icon : _ref$startIcon,
|
|
52
|
+
endIcon = _ref.endIcon,
|
|
53
|
+
className = _ref.className,
|
|
54
|
+
style = _ref.style,
|
|
55
|
+
propPrefixClass = _ref.prefixClass,
|
|
56
|
+
component = _ref.component,
|
|
57
|
+
badgeAriaLabel = _ref.badgeAriaLabel,
|
|
58
|
+
loadingAriaLabel = _ref.loadingAriaLabel,
|
|
59
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
60
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
61
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
62
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
83
63
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
84
|
-
|
|
85
64
|
var variantRipples = function variantRipples() {
|
|
86
65
|
if (variant === 'primary') {
|
|
87
66
|
return '#ffffff47';
|
|
88
67
|
}
|
|
89
|
-
|
|
90
68
|
if (variant === 'secondary') {
|
|
91
69
|
return '#38398c7a';
|
|
92
70
|
}
|
|
93
|
-
|
|
94
71
|
if (variant === 'secondaryDark') {
|
|
95
72
|
return '#38398c7a';
|
|
96
73
|
}
|
|
97
|
-
|
|
98
74
|
if (variant === 'tertiary') {
|
|
99
75
|
return '#38398c7a';
|
|
100
76
|
}
|
|
101
|
-
|
|
102
77
|
return '#ffffff47';
|
|
103
78
|
};
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
_react.default.useEffect(function () {
|
|
79
|
+
var _useRipple = (0, _useRipple3["default"])({
|
|
80
|
+
backgroundColor: variantRipples()
|
|
81
|
+
}),
|
|
82
|
+
_useRipple2 = _slicedToArray(_useRipple, 2),
|
|
83
|
+
addRipple = _useRipple2[0],
|
|
84
|
+
ripples = _useRipple2[1];
|
|
85
|
+
_react["default"].useEffect(function () {
|
|
113
86
|
var timeout;
|
|
114
|
-
|
|
115
87
|
if ((error || success) && !!reset) {
|
|
116
88
|
timeout = setTimeout(reset, resetDelay);
|
|
117
89
|
}
|
|
118
|
-
|
|
119
90
|
return function () {
|
|
120
91
|
clearTimeout(timeout);
|
|
121
92
|
};
|
|
122
93
|
}, [error, success, reset, resetDelay]);
|
|
123
|
-
|
|
124
94
|
var onClickButton = function onClickButton(e) {
|
|
125
95
|
if (!disabled && !loading) {
|
|
126
96
|
addRipple(e);
|
|
127
|
-
|
|
128
97
|
if (onClick) {
|
|
129
98
|
onClick(e);
|
|
130
99
|
}
|
|
131
100
|
}
|
|
132
101
|
};
|
|
133
|
-
|
|
134
102
|
var Component = component || 'button';
|
|
135
|
-
return /*#__PURE__*/_react
|
|
103
|
+
return /*#__PURE__*/_react["default"].createElement(Component, _extends({
|
|
104
|
+
ref: ref,
|
|
136
105
|
id: id,
|
|
137
|
-
htmlFor: id,
|
|
138
106
|
className: prefixClass("cbx-ripple cbx-buttonBasic ".concat(className || '', " ").concat(variant === 'secondaryDark' ? 'secondaryDark' : '').concat(disabled || loading ? ' cbx-buttonBasic-disabled' : '', " cbx-").concat(variant).concat(success ? ' cbx-success' : error ? ' cbx-error' : '').concat(fullWidth ? ' cbx-buttonBasic-fullWidth' : '')),
|
|
139
107
|
type: 'button',
|
|
108
|
+
"aria-busy": loading,
|
|
140
109
|
disabled: disabled || loading,
|
|
141
110
|
onClick: function onClick(e) {
|
|
142
111
|
return onClickButton(e);
|
|
@@ -145,47 +114,56 @@ var ButtonBasic = function ButtonBasic(_ref) {
|
|
|
145
114
|
paddingLeft: startIcon && endIcon ? 'var(--spacing16)' : startIcon ? 'var(--spacing16)' : 'var(--spacing24)',
|
|
146
115
|
paddingRight: startIcon && endIcon ? 'var(--spacing16)' : endIcon || loading ? 'var(--spacing16)' : 'var(--spacing24)'
|
|
147
116
|
}, style), stylesInLine)
|
|
148
|
-
}, props), /*#__PURE__*/_react
|
|
149
|
-
className: prefixClass('cbx-buttonBasic-container ')
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
117
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
118
|
+
className: prefixClass('cbx-buttonBasic-container '),
|
|
119
|
+
"aria-live": "polite"
|
|
120
|
+
}, badge && /*#__PURE__*/_react["default"].createElement("div", {
|
|
121
|
+
className: "cbx-buttonBasic-badge",
|
|
122
|
+
role: "status"
|
|
123
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
124
|
+
className: "sr-only"
|
|
125
|
+
}, badgeAriaLabel || 'You have pending notifications.')), startIcon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
126
|
+
className: 'cbx-buttonBasic-container-start-icon',
|
|
127
|
+
"aria-hidden": "true"
|
|
128
|
+
}, startIcon), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
155
129
|
variant: variantText || 'M',
|
|
156
130
|
component: 'span',
|
|
157
131
|
fontWeight: '700',
|
|
158
132
|
styles: _objectSpread({}, stylesButton)
|
|
159
|
-
}, text), loading ? /*#__PURE__*/_react
|
|
133
|
+
}, text), loading ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
160
134
|
className: prefixClass('cbx-buttonBasic-container-loading')
|
|
161
|
-
}, /*#__PURE__*/_react
|
|
135
|
+
}, /*#__PURE__*/_react["default"].createElement(_LoadingSection["default"], {
|
|
162
136
|
size: 24,
|
|
163
137
|
color: 'var(--primary50)',
|
|
164
138
|
prefixClass: prefixClass
|
|
165
|
-
})
|
|
139
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
140
|
+
className: "sr-only"
|
|
141
|
+
}, loadingAriaLabel || 'Loading')) : success || error ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
142
|
className: prefixClass('cbx-buttonBasic-container-end-icon')
|
|
167
|
-
}, /*#__PURE__*/_react
|
|
143
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
144
|
+
"aria-hidden": "true",
|
|
168
145
|
className: error ? 'ri-close-line' : 'ri-check-line'
|
|
169
|
-
})
|
|
170
|
-
className:
|
|
146
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
147
|
+
className: "sr-only"
|
|
148
|
+
}, error ? 'Ha ocurrido un error' : 'Completado con éxito')) : endIcon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
149
|
+
className: prefixClass('cbx-buttonBasic-container-end-icon'),
|
|
150
|
+
"aria-hidden": "true"
|
|
171
151
|
}, endIcon), !disabled && ripples));
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
ButtonBasic.displayName = "ButtonBasic";
|
|
152
|
+
});
|
|
175
153
|
ButtonBasic.propTypes = {
|
|
176
|
-
text: _propTypes
|
|
177
|
-
onClick: _propTypes
|
|
178
|
-
disabled: _propTypes
|
|
179
|
-
loading: _propTypes
|
|
180
|
-
variant: _propTypes
|
|
181
|
-
fullWidth: _propTypes
|
|
182
|
-
startIcon: _propTypes
|
|
183
|
-
endIcon: _propTypes
|
|
184
|
-
variantText: _propTypes
|
|
185
|
-
stylesButton: _propTypes
|
|
186
|
-
badge: _propTypes
|
|
187
|
-
success: _propTypes
|
|
188
|
-
error: _propTypes
|
|
154
|
+
text: _propTypes["default"].node,
|
|
155
|
+
onClick: _propTypes["default"].func,
|
|
156
|
+
disabled: _propTypes["default"].bool,
|
|
157
|
+
loading: _propTypes["default"].bool,
|
|
158
|
+
variant: _propTypes["default"].string,
|
|
159
|
+
fullWidth: _propTypes["default"].bool,
|
|
160
|
+
startIcon: _propTypes["default"].node,
|
|
161
|
+
endIcon: _propTypes["default"].node,
|
|
162
|
+
variantText: _propTypes["default"].string,
|
|
163
|
+
stylesButton: _propTypes["default"].object,
|
|
164
|
+
badge: _propTypes["default"].bool,
|
|
165
|
+
success: _propTypes["default"].bool,
|
|
166
|
+
error: _propTypes["default"].bool
|
|
189
167
|
};
|
|
190
168
|
ButtonBasic.defaultProps = {
|
|
191
169
|
text: null,
|
|
@@ -203,4 +181,4 @@ ButtonBasic.defaultProps = {
|
|
|
203
181
|
error: false
|
|
204
182
|
};
|
|
205
183
|
var _default = ButtonBasic;
|
|
206
|
-
exports
|
|
184
|
+
exports["default"] = _default;
|
|
@@ -3,32 +3,28 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.Default = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _ButtonBasic = _interopRequireDefault(require("./ButtonBasic"));
|
|
11
|
-
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
10
|
var ICONS = {
|
|
15
11
|
none: '',
|
|
16
|
-
arrowLeft: /*#__PURE__*/_react
|
|
12
|
+
arrowLeft: /*#__PURE__*/_react["default"].createElement("i", {
|
|
17
13
|
className: "ri-arrow-left-s-line"
|
|
18
14
|
}),
|
|
19
|
-
arrowRight: /*#__PURE__*/_react
|
|
15
|
+
arrowRight: /*#__PURE__*/_react["default"].createElement("i", {
|
|
20
16
|
className: "ri-arrow-right-s-line"
|
|
21
17
|
}),
|
|
22
|
-
save: /*#__PURE__*/_react
|
|
18
|
+
save: /*#__PURE__*/_react["default"].createElement("i", {
|
|
23
19
|
className: "ri-save-line"
|
|
24
20
|
}),
|
|
25
|
-
edit: /*#__PURE__*/_react
|
|
21
|
+
edit: /*#__PURE__*/_react["default"].createElement("i", {
|
|
26
22
|
className: "ri-pencil-line"
|
|
27
23
|
})
|
|
28
24
|
};
|
|
29
25
|
var _default = {
|
|
30
26
|
title: 'Components/ButtonBasic',
|
|
31
|
-
component: _ButtonBasic
|
|
27
|
+
component: _ButtonBasic["default"],
|
|
32
28
|
argTypes: {
|
|
33
29
|
loading: {
|
|
34
30
|
options: [true, false],
|
|
@@ -80,6 +76,11 @@ var _default = {
|
|
|
80
76
|
}
|
|
81
77
|
},
|
|
82
78
|
parameters: {
|
|
79
|
+
docs: {
|
|
80
|
+
description: {
|
|
81
|
+
component: "\n## ButtonBasic\n\nComponente de bot\xF3n b\xE1sico que permite desencadenar acciones mediante interacci\xF3n con teclado o rat\xF3n. Soporta m\xFAltiples variantes visuales, estados de carga, notificaci\xF3n (*badge*), error o \xE9xito.\n\nEl componente utiliza etiquetas HTML interactivas o elementos sem\xE1nticos personalizados garantizando compatibilidad total con lectores de pantalla.\n\n## Accesibilidad\n\n### Estructura sem\xE1ntica y rol interactivo\n\n- Por defecto, el componente se renderiza como un elemento `button` nativo.\n- Permite la personalizaci\xF3n del elemento base mediante la propiedad `component`.\n- Soporta la integraci\xF3n de referencias mediante `React.forwardRef`, facilitando la gesti\xF3n del foco de forma program\xE1tica.\n\n### Estado de carga y bloqueo\n\n- Cuando el bot\xF3n se encuentra en estado de carga (`loading`):\n - Aplica autom\xE1ticamente el atributo `aria-busy=\"true\"` al contenedor del bot\xF3n.\n - El bot\xF3n se deshabilita mediante el atributo HTML `disabled`, impidiendo interacciones secundarias.\n - Renderiza un texto alternativo din\xE1mico para lectores de pantalla (`loadingAriaLabel` con el valor por defecto \"Loading\").\n\n### Indicadores visuales y notificaciones (*Badge*)\n\n- Cuando la propiedad `badge` est\xE1 activa:\n - Se a\xF1ade un contenedor con `role=\"status\"` que comunica de forma no intrusiva al usuario la presencia de novedades.\n - Ofrece la prop `badgeAriaLabel` (por defecto \"You have pending notifications.\") para comunicar el estado de las notificaciones.\n\n### Iconograf\xEDa decorativa e indicadores de estado\n\n- Los iconos de inicio (`startIcon`) y fin (`endIcon`) se consideran elementos visuales y se marcan expl\xEDcitamente con `aria-hidden=\"true\"`.\n- Los estados de \xE9xito (`success`) o error (`error`) muestran iconos informativos marcados con `aria-hidden=\"true\"` acompa\xF1ados de un elemento con la clase `sr-only` que describe el resultado (\"Ha ocurrido un error\" o \"Completado con \xE9xito\").\n\n### Navegaci\xF3n mediante teclado\n\n- Al basarse en un elemento `button` nativo:\n - Recibe el foco navegando con la tecla **Tab**.\n - Permite la activaci\xF3n mediante las teclas **Enter** y **Espacio**.\n - Evita la interacci\xF3n cuando las propiedades `disabled` o `loading` est\xE1n activas.\n\n## Recomendaciones de uso\n\n- Asegurar que la propiedad `text` o, en su defecto, un atributo `aria-label` descriptivo est\xE9 presente para dar nombre accesible al bot\xF3n.\n- Utilizar la prop `loadingAriaLabel` para traducir o personalizar el mensaje de carga cuando el idioma de la aplicaci\xF3n no sea el predeterminado.\n- En botones que \xFAnicamente contengan iconos (sin texto visible), proporcionar obligatoriamente la propiedad `aria-label`.\n\n## Consideraciones\n\nEl componente gestiona internamente la comunicaci\xF3n de los estados din\xE1micos (`aria-busy`, `role=\"status\"` y textos ocultos para lectores de pantalla `sr-only`).\nNo es necesario a\xF1adir configuraciones extra salvo la personalizaci\xF3n de los textos de accesibilidad en proyectos multiidioma.\n\t\t\t"
|
|
82
|
+
}
|
|
83
|
+
},
|
|
83
84
|
storybookCodePanel: {
|
|
84
85
|
disabled: false,
|
|
85
86
|
files: [{
|
|
@@ -94,12 +95,10 @@ var _default = {
|
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
97
|
};
|
|
97
|
-
exports
|
|
98
|
-
|
|
98
|
+
exports["default"] = _default;
|
|
99
99
|
var Template = function Template(args) {
|
|
100
|
-
return /*#__PURE__*/_react
|
|
100
|
+
return /*#__PURE__*/_react["default"].createElement(_ButtonBasic["default"], args);
|
|
101
101
|
};
|
|
102
|
-
|
|
103
102
|
Template.displayName = "Template";
|
|
104
103
|
var Default = Template.bind({});
|
|
105
104
|
exports.Default = Default;
|
|
@@ -1,67 +1,52 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
7
|
+
exports["default"] = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
10
|
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
13
|
-
|
|
14
11
|
require("../../styles/main.css");
|
|
15
|
-
|
|
16
12
|
require("./ButtonBasicOld.css");
|
|
17
|
-
|
|
18
13
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
19
|
-
|
|
20
14
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
21
|
-
|
|
22
15
|
var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "variantText", "stylesButton", "sx", "badge", "resetDelay", "reset", "error", "success", "startIcon", "endIcon", "className"];
|
|
23
|
-
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
-
|
|
34
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
35
|
-
|
|
36
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
37
|
-
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
17
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
20
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
21
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
22
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
23
|
+
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) { o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } } return i; }
|
|
24
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) { if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } } return t; }
|
|
38
25
|
var ButtonBasicOld = function ButtonBasicOld(_ref) {
|
|
39
26
|
var id = _ref.id,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
27
|
+
text = _ref.text,
|
|
28
|
+
onClick = _ref.onClick,
|
|
29
|
+
disabled = _ref.disabled,
|
|
30
|
+
loading = _ref.loading,
|
|
31
|
+
variant = _ref.variant,
|
|
32
|
+
fullWidth = _ref.fullWidth,
|
|
33
|
+
icon = _ref.icon,
|
|
34
|
+
variantText = _ref.variantText,
|
|
35
|
+
stylesButton = _ref.stylesButton,
|
|
36
|
+
sx = _ref.sx,
|
|
37
|
+
badge = _ref.badge,
|
|
38
|
+
_ref$resetDelay = _ref.resetDelay,
|
|
39
|
+
resetDelay = _ref$resetDelay === void 0 ? 2700 : _ref$resetDelay,
|
|
40
|
+
reset = _ref.reset,
|
|
41
|
+
error = _ref.error,
|
|
42
|
+
success = _ref.success,
|
|
43
|
+
_ref$startIcon = _ref.startIcon,
|
|
44
|
+
startIcon = _ref$startIcon === void 0 ? icon : _ref$startIcon,
|
|
45
|
+
endIcon = _ref.endIcon,
|
|
46
|
+
className = _ref.className,
|
|
47
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
62
48
|
var buttonVariant;
|
|
63
49
|
var buttonColor;
|
|
64
|
-
|
|
65
50
|
if (variant === 'primary') {
|
|
66
51
|
buttonVariant = 'contained';
|
|
67
52
|
buttonColor = 'var(--white)';
|
|
@@ -75,20 +60,16 @@ var ButtonBasicOld = function ButtonBasicOld(_ref) {
|
|
|
75
60
|
buttonVariant = 'text';
|
|
76
61
|
buttonColor = 'var(--primary)';
|
|
77
62
|
}
|
|
78
|
-
|
|
79
|
-
_react.default.useEffect(function () {
|
|
63
|
+
_react["default"].useEffect(function () {
|
|
80
64
|
var timeout;
|
|
81
|
-
|
|
82
65
|
if ((error || success) && !!reset) {
|
|
83
66
|
timeout = setTimeout(reset, resetDelay);
|
|
84
67
|
}
|
|
85
|
-
|
|
86
68
|
return function () {
|
|
87
69
|
clearTimeout(timeout);
|
|
88
70
|
};
|
|
89
71
|
}, [error, success, reset, resetDelay]);
|
|
90
|
-
|
|
91
|
-
return /*#__PURE__*/_react.default.createElement(_Button.default, _extends({
|
|
72
|
+
return /*#__PURE__*/_react["default"].createElement(_Button["default"], _extends({
|
|
92
73
|
id: id,
|
|
93
74
|
className: "".concat(className || '', " ").concat(variant === 'secondaryDark' ? 'secondaryDark' : ''),
|
|
94
75
|
sx: _objectSpread(_objectSpread({}, sx), {}, {
|
|
@@ -168,49 +149,48 @@ var ButtonBasicOld = function ButtonBasicOld(_ref) {
|
|
|
168
149
|
disableFocusRipple: true,
|
|
169
150
|
fullWidth: fullWidth,
|
|
170
151
|
onClick: onClick
|
|
171
|
-
}, props), /*#__PURE__*/_react
|
|
152
|
+
}, props), /*#__PURE__*/_react["default"].createElement("div", {
|
|
172
153
|
className: 'cbx-buttonBasic-container'
|
|
173
|
-
}, badge && /*#__PURE__*/_react
|
|
154
|
+
}, badge && /*#__PURE__*/_react["default"].createElement("div", {
|
|
174
155
|
className: "cbx-buttonBasic-badge"
|
|
175
|
-
}), startIcon && /*#__PURE__*/_react
|
|
156
|
+
}), startIcon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
176
157
|
className: 'cbx-buttonBasic-container-start-icon'
|
|
177
|
-
}, startIcon), /*#__PURE__*/_react
|
|
158
|
+
}, startIcon), /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
178
159
|
color: buttonColor,
|
|
179
160
|
variant: variantText || 'M',
|
|
180
161
|
component: 'span',
|
|
181
162
|
fontWeight: '700',
|
|
182
163
|
styles: _objectSpread({}, stylesButton)
|
|
183
|
-
}, text), loading ? /*#__PURE__*/_react
|
|
164
|
+
}, text), loading ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
184
165
|
className: 'cbx-buttonBasic-container-loading'
|
|
185
|
-
}, /*#__PURE__*/_react
|
|
166
|
+
}, /*#__PURE__*/_react["default"].createElement(_CircularProgress["default"], {
|
|
186
167
|
style: {
|
|
187
168
|
width: 'var(--spacing24)',
|
|
188
169
|
height: '1.5rem'
|
|
189
170
|
}
|
|
190
|
-
})) : success || error ? /*#__PURE__*/_react
|
|
171
|
+
})) : success || error ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
191
172
|
className: 'cbx-buttonBasic-container-end-icon'
|
|
192
|
-
}, /*#__PURE__*/_react
|
|
173
|
+
}, /*#__PURE__*/_react["default"].createElement("i", {
|
|
193
174
|
className: error ? 'ri-close-line' : 'ri-check-line'
|
|
194
|
-
})) : endIcon && /*#__PURE__*/_react
|
|
175
|
+
})) : endIcon && /*#__PURE__*/_react["default"].createElement("div", {
|
|
195
176
|
className: 'cbx-buttonBasic-container-end-icon'
|
|
196
177
|
}, endIcon)));
|
|
197
178
|
};
|
|
198
|
-
|
|
199
179
|
ButtonBasicOld.displayName = "ButtonBasicOld";
|
|
200
180
|
ButtonBasicOld.propTypes = {
|
|
201
|
-
text: _propTypes
|
|
202
|
-
onClick: _propTypes
|
|
203
|
-
disabled: _propTypes
|
|
204
|
-
loading: _propTypes
|
|
205
|
-
variant: _propTypes
|
|
206
|
-
fullWidth: _propTypes
|
|
207
|
-
startIcon: _propTypes
|
|
208
|
-
endIcon: _propTypes
|
|
209
|
-
variantText: _propTypes
|
|
210
|
-
stylesButton: _propTypes
|
|
211
|
-
badge: _propTypes
|
|
212
|
-
success: _propTypes
|
|
213
|
-
error: _propTypes
|
|
181
|
+
text: _propTypes["default"].node,
|
|
182
|
+
onClick: _propTypes["default"].func,
|
|
183
|
+
disabled: _propTypes["default"].bool,
|
|
184
|
+
loading: _propTypes["default"].bool,
|
|
185
|
+
variant: _propTypes["default"].string,
|
|
186
|
+
fullWidth: _propTypes["default"].bool,
|
|
187
|
+
startIcon: _propTypes["default"].node,
|
|
188
|
+
endIcon: _propTypes["default"].node,
|
|
189
|
+
variantText: _propTypes["default"].string,
|
|
190
|
+
stylesButton: _propTypes["default"].object,
|
|
191
|
+
badge: _propTypes["default"].any,
|
|
192
|
+
success: _propTypes["default"].bool,
|
|
193
|
+
error: _propTypes["default"].bool
|
|
214
194
|
};
|
|
215
195
|
ButtonBasicOld.defaultProps = {
|
|
216
196
|
text: null,
|
|
@@ -228,4 +208,4 @@ ButtonBasicOld.defaultProps = {
|
|
|
228
208
|
error: false
|
|
229
209
|
};
|
|
230
210
|
var _default = ButtonBasicOld;
|
|
231
|
-
exports
|
|
211
|
+
exports["default"] = _default;
|