@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,124 +1,117 @@
|
|
|
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("./IconButton.css");
|
|
15
|
-
|
|
16
12
|
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
17
|
-
|
|
18
13
|
var _useRipple3 = _interopRequireDefault(require("../../HOCs/useRipple"));
|
|
19
|
-
|
|
20
14
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
21
|
-
|
|
22
15
|
var _Tooltip = _interopRequireDefault(require("../Tooltip/Tooltip"));
|
|
23
|
-
|
|
24
|
-
var _excluded = ["id", "className", "onClick", "icon", "backgroundColor", "styles", "style", "badge", "classNameBadge", "rounded", "tooltip", "placementTooltip", "disabled", "hoverColor", "type", "inModal", "prefixClass", "sx", "active", "text", "variant", "fontWeight", "textVisibleMenuMobile", "stylesText", "progress", "progressAuto", "colorProgress", "secondaryFont", "colorActive", "color", "ringing", "animateRinging"];
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function
|
|
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 _useA11yGuard2 = require("../../HOCs/useA11yGuard");
|
|
17
|
+
var _excluded = ["id", "className", "onClick", "icon", "backgroundColor", "styles", "style", "badge", "classNameBadge", "rounded", "tooltip", "placementTooltip", "disabled", "hoverColor", "type", "inModal", "prefixClass", "sx", "active", "text", "variant", "fontWeight", "textVisibleMenuMobile", "stylesText", "progress", "progressAuto", "colorProgress", "secondaryFont", "colorActive", "color", "ringing", "animateRinging", "aria-label", "badgeAriaLabel", "component"];
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
19
|
+
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); }
|
|
20
|
+
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; }
|
|
21
|
+
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; }
|
|
22
|
+
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; }
|
|
23
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
24
|
+
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); }
|
|
25
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
38
26
|
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
|
-
|
|
27
|
+
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; } }
|
|
28
|
+
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; }
|
|
29
|
+
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; } }
|
|
30
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
31
|
+
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; }
|
|
32
|
+
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; }
|
|
52
33
|
var IconButton = function IconButton(_ref) {
|
|
53
34
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
35
|
+
className = _ref.className,
|
|
36
|
+
onClick = _ref.onClick,
|
|
37
|
+
icon = _ref.icon,
|
|
38
|
+
backgroundColor = _ref.backgroundColor,
|
|
39
|
+
styles = _ref.styles,
|
|
40
|
+
style = _ref.style,
|
|
41
|
+
badge = _ref.badge,
|
|
42
|
+
classNameBadge = _ref.classNameBadge,
|
|
43
|
+
rounded = _ref.rounded,
|
|
44
|
+
tooltip = _ref.tooltip,
|
|
45
|
+
placementTooltip = _ref.placementTooltip,
|
|
46
|
+
disabled = _ref.disabled,
|
|
47
|
+
hoverColor = _ref.hoverColor,
|
|
48
|
+
type = _ref.type,
|
|
49
|
+
inModal = _ref.inModal,
|
|
50
|
+
propPrefixClass = _ref.prefixClass,
|
|
51
|
+
sx = _ref.sx,
|
|
52
|
+
active = _ref.active,
|
|
53
|
+
text = _ref.text,
|
|
54
|
+
variant = _ref.variant,
|
|
55
|
+
fontWeight = _ref.fontWeight,
|
|
56
|
+
textVisibleMenuMobile = _ref.textVisibleMenuMobile,
|
|
57
|
+
stylesText = _ref.stylesText,
|
|
58
|
+
progress = _ref.progress,
|
|
59
|
+
progressAuto = _ref.progressAuto,
|
|
60
|
+
colorProgress = _ref.colorProgress,
|
|
61
|
+
secondaryFont = _ref.secondaryFont,
|
|
62
|
+
colorActive = _ref.colorActive,
|
|
63
|
+
color = _ref.color,
|
|
64
|
+
ringing = _ref.ringing,
|
|
65
|
+
animateRinging = _ref.animateRinging,
|
|
66
|
+
ariaLabel = _ref['aria-label'],
|
|
67
|
+
badgeAriaLabel = _ref.badgeAriaLabel,
|
|
68
|
+
component = _ref.component,
|
|
69
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
70
|
+
var _useDynamicStyles = (0, _useDynamicStyles2["default"])(sx),
|
|
71
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
72
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
91
73
|
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
92
|
-
|
|
74
|
+
var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
|
|
75
|
+
requireAccessibleText = _useA11yGuard.requireAccessibleText;
|
|
76
|
+
var accessibleText = ariaLabel || tooltip || text;
|
|
77
|
+
requireAccessibleText(accessibleText, {
|
|
78
|
+
component: 'IconButton',
|
|
79
|
+
prop: '"aria-label", "tooltip" o "text"',
|
|
80
|
+
hint: 'Un botón de icono debe contar con un texto accesible (vía "aria-label", "tooltip" o "text") para ser identificado por los lectores de pantalla.',
|
|
81
|
+
receivedProps: {
|
|
82
|
+
ariaLabel: ariaLabel,
|
|
83
|
+
tooltip: tooltip,
|
|
84
|
+
text: text,
|
|
85
|
+
disabled: disabled,
|
|
86
|
+
id: id
|
|
87
|
+
}
|
|
88
|
+
});
|
|
93
89
|
var variantRipples = function variantRipples() {
|
|
94
90
|
if (type === 'rounded' || rounded) {
|
|
95
91
|
return '#38398c38';
|
|
96
92
|
}
|
|
97
|
-
|
|
98
93
|
return 'rgb(0 0 0 / 10%)';
|
|
99
94
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
ripples = _useRipple2[1];
|
|
107
|
-
|
|
95
|
+
var _useRipple = (0, _useRipple3["default"])({
|
|
96
|
+
backgroundColor: variantRipples()
|
|
97
|
+
}, 'center'),
|
|
98
|
+
_useRipple2 = _slicedToArray(_useRipple, 2),
|
|
99
|
+
addRipple = _useRipple2[0],
|
|
100
|
+
ripples = _useRipple2[1];
|
|
108
101
|
var onClickButton = function onClickButton(e) {
|
|
109
102
|
if (!disabled) {
|
|
110
103
|
addRipple(e);
|
|
111
104
|
onClick(e);
|
|
112
105
|
}
|
|
113
106
|
};
|
|
114
|
-
|
|
115
107
|
var getText = function getText() {
|
|
116
|
-
return /*#__PURE__*/_react
|
|
108
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
117
109
|
style: {
|
|
118
110
|
width: '100%'
|
|
119
111
|
}
|
|
120
|
-
}, /*#__PURE__*/_react
|
|
112
|
+
}, /*#__PURE__*/_react["default"].createElement(_Typography["default"], {
|
|
121
113
|
variant: variant || 'XS',
|
|
114
|
+
component: component,
|
|
122
115
|
color: active ? colorActive || 'var(--primary)' : color || 'var(--gray3)',
|
|
123
116
|
fontWeight: fontWeight,
|
|
124
117
|
secondaryFont: secondaryFont,
|
|
@@ -130,58 +123,57 @@ var IconButton = function IconButton(_ref) {
|
|
|
130
123
|
}, stylesText)
|
|
131
124
|
}, text));
|
|
132
125
|
};
|
|
133
|
-
|
|
134
126
|
var circleRadius = 20;
|
|
135
127
|
var circumference = 2 * Math.PI * circleRadius;
|
|
136
128
|
var progressValue = Math.max(0, Math.min(progress || 0, 100));
|
|
137
129
|
var dashOffset = circumference - progressValue / 100 * circumference;
|
|
138
|
-
|
|
139
130
|
var getProgressAuto = function getProgressAuto() {
|
|
140
|
-
return /*#__PURE__*/_react
|
|
131
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
141
132
|
className: prefixClass('cbx-IconButton-progressCircle cbx-IconButton-animatedCircle'),
|
|
142
133
|
width: "100%",
|
|
143
134
|
height: "100%",
|
|
144
135
|
viewBox: "0 0 200 202",
|
|
145
136
|
color: colorProgress || 'var(--primary)',
|
|
146
137
|
fill: "none",
|
|
147
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
148
|
-
|
|
138
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
139
|
+
role: "status",
|
|
140
|
+
"aria-label": "Cargando"
|
|
141
|
+
}, /*#__PURE__*/_react["default"].createElement("defs", null, /*#__PURE__*/_react["default"].createElement("linearGradient", {
|
|
149
142
|
id: "spinner-secondHalf"
|
|
150
|
-
}, /*#__PURE__*/_react
|
|
143
|
+
}, /*#__PURE__*/_react["default"].createElement("stop", {
|
|
151
144
|
offset: "0%",
|
|
152
145
|
stopOpacity: "0",
|
|
153
146
|
stopColor: "currentColor"
|
|
154
|
-
}), /*#__PURE__*/_react
|
|
147
|
+
}), /*#__PURE__*/_react["default"].createElement("stop", {
|
|
155
148
|
offset: "100%",
|
|
156
149
|
stopOpacity: "0.5",
|
|
157
150
|
stopColor: "currentColor"
|
|
158
|
-
})), /*#__PURE__*/_react
|
|
151
|
+
})), /*#__PURE__*/_react["default"].createElement("linearGradient", {
|
|
159
152
|
id: "spinner-firstHalf"
|
|
160
|
-
}, /*#__PURE__*/_react
|
|
153
|
+
}, /*#__PURE__*/_react["default"].createElement("stop", {
|
|
161
154
|
offset: "0%",
|
|
162
155
|
stopOpacity: "1",
|
|
163
156
|
stopColor: "currentColor"
|
|
164
|
-
}), /*#__PURE__*/_react
|
|
157
|
+
}), /*#__PURE__*/_react["default"].createElement("stop", {
|
|
165
158
|
offset: "100%",
|
|
166
159
|
stopOpacity: "0.5",
|
|
167
160
|
stopColor: "currentColor"
|
|
168
|
-
}))), /*#__PURE__*/_react
|
|
161
|
+
}))), /*#__PURE__*/_react["default"].createElement("g", {
|
|
169
162
|
strokeWidth: "10"
|
|
170
|
-
}, /*#__PURE__*/_react
|
|
163
|
+
}, /*#__PURE__*/_react["default"].createElement("path", {
|
|
171
164
|
stroke: "url(#spinner-secondHalf)",
|
|
172
165
|
d: "M 4 100 A 96 96 0 0 1 196 100"
|
|
173
|
-
}), /*#__PURE__*/_react
|
|
166
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
174
167
|
stroke: "url(#spinner-firstHalf)",
|
|
175
168
|
d: "M 196 100 A 96 96 0 0 1 4 100"
|
|
176
|
-
}), /*#__PURE__*/_react
|
|
169
|
+
}), /*#__PURE__*/_react["default"].createElement("path", {
|
|
177
170
|
stroke: "currentColor",
|
|
178
171
|
strokeLinecap: "round",
|
|
179
172
|
d: "M 4 100 A 96 96 0 0 1 4 98"
|
|
180
173
|
})));
|
|
181
174
|
};
|
|
182
|
-
|
|
183
175
|
var getProgress = function getProgress() {
|
|
184
|
-
return /*#__PURE__*/_react
|
|
176
|
+
return /*#__PURE__*/_react["default"].createElement("svg", {
|
|
185
177
|
className: prefixClass('cbx-IconButton-progressCircle'),
|
|
186
178
|
width: "48",
|
|
187
179
|
height: "48",
|
|
@@ -191,8 +183,13 @@ var IconButton = function IconButton(_ref) {
|
|
|
191
183
|
top: '-4px',
|
|
192
184
|
left: '-4px',
|
|
193
185
|
zIndex: 1
|
|
194
|
-
}
|
|
195
|
-
|
|
186
|
+
},
|
|
187
|
+
role: "progressbar",
|
|
188
|
+
"aria-valuenow": progressValue,
|
|
189
|
+
"aria-valuemin": 0,
|
|
190
|
+
"aria-valuemax": 100,
|
|
191
|
+
"aria-label": "Progreso"
|
|
192
|
+
}, /*#__PURE__*/_react["default"].createElement("circle", {
|
|
196
193
|
cx: "24",
|
|
197
194
|
cy: "24",
|
|
198
195
|
r: circleRadius,
|
|
@@ -206,27 +203,23 @@ var IconButton = function IconButton(_ref) {
|
|
|
206
203
|
}
|
|
207
204
|
}));
|
|
208
205
|
};
|
|
209
|
-
|
|
210
206
|
var iconClass = '';
|
|
211
|
-
|
|
212
|
-
if ( /*#__PURE__*/_react.default.isValidElement(icon)) {
|
|
207
|
+
if (/*#__PURE__*/_react["default"].isValidElement(icon)) {
|
|
213
208
|
var _icon$props$className, _icon$props;
|
|
214
|
-
|
|
215
209
|
iconClass = (_icon$props$className = icon === null || icon === void 0 ? void 0 : (_icon$props = icon.props) === null || _icon$props === void 0 ? void 0 : _icon$props.className) !== null && _icon$props$className !== void 0 ? _icon$props$className : '';
|
|
216
210
|
}
|
|
217
|
-
|
|
218
211
|
var getIconRinging = function getIconRinging() {
|
|
219
|
-
return /*#__PURE__*/_react
|
|
220
|
-
className: !animateRinging ? '' : 'cbx-ringing'
|
|
221
|
-
|
|
212
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
213
|
+
className: !animateRinging ? '' : 'cbx-ringing',
|
|
214
|
+
"aria-hidden": "true"
|
|
215
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
222
216
|
className: !animateRinging ? '' : 'cbx-ringing-border'
|
|
223
|
-
}), /*#__PURE__*/_react
|
|
217
|
+
}), /*#__PURE__*/_react["default"].createElement("i", {
|
|
224
218
|
className: "".concat(iconClass, " cbx-ringing-btn ").concat(animateRinging ? 'cbx-ringing-animate' : '')
|
|
225
219
|
}));
|
|
226
220
|
};
|
|
227
|
-
|
|
228
221
|
var getButton = function getButton() {
|
|
229
|
-
return /*#__PURE__*/_react
|
|
222
|
+
return /*#__PURE__*/_react["default"].createElement("button", _extends({
|
|
230
223
|
id: id,
|
|
231
224
|
disabled: disabled,
|
|
232
225
|
className: prefixClass("cbx-IconButton ".concat(className || '', " ").concat(type === 'fab' ? 'cbx-IconButton-fabButton' : '', " ").concat(type === 'square' ? 'cbx-IconButton-squareButton' : '', " ").concat(type === 'rounded' || rounded ? 'cbx-IconButton-rounded' : '', " ").concat(disabled ? 'cbx-IconButton-disabled' : '', " ").concat(active ? 'cbx-IconButton-active' : '', " ").concat(hoverColor ? 'cbx-IconButton-hoverColor' : '')),
|
|
@@ -238,39 +231,40 @@ var IconButton = function IconButton(_ref) {
|
|
|
238
231
|
backgroundColor: backgroundColor,
|
|
239
232
|
position: 'relative',
|
|
240
233
|
'--hover-color': hoverColor
|
|
241
|
-
}, styles), style), stylesInLine)
|
|
242
|
-
|
|
243
|
-
|
|
234
|
+
}, styles), style), stylesInLine)
|
|
235
|
+
}, props, {
|
|
236
|
+
"aria-label": ariaLabel || props['aria-label'] || tooltip || 'Botón'
|
|
237
|
+
}), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
244
238
|
className: prefixClass('cbx-IconButton-containerBadge')
|
|
245
|
-
}, /*#__PURE__*/_react
|
|
246
|
-
className: prefixClass("cbx-IconButton-badge ".concat(ringing ? 'cbx-IconButton-badge-ringing' : ''))
|
|
247
|
-
|
|
239
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
240
|
+
className: prefixClass("cbx-IconButton-badge ".concat(ringing ? 'cbx-IconButton-badge-ringing' : '')),
|
|
241
|
+
role: "status"
|
|
242
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
243
|
+
className: "sr-only"
|
|
244
|
+
}, badgeAriaLabel || 'You have pending notifications.')), ringing ? getIconRinging() : icon || '', text && getText()) : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, icon || '', text && getText()), !disabled && ripples.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
248
245
|
className: prefixClass('cbx-ripple cbx-IconButton-containerRipple')
|
|
249
246
|
}, ripples));
|
|
250
247
|
};
|
|
251
|
-
|
|
252
248
|
var getTooltip = function getTooltip() {
|
|
253
|
-
return /*#__PURE__*/_react
|
|
249
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
254
250
|
title: tooltip || '',
|
|
255
251
|
placement: placementTooltip
|
|
256
252
|
}, getButton());
|
|
257
253
|
};
|
|
258
|
-
|
|
259
254
|
return tooltip ? getTooltip() : getButton();
|
|
260
255
|
};
|
|
261
|
-
|
|
262
256
|
IconButton.propTypes = {
|
|
263
|
-
id: _propTypes
|
|
264
|
-
className: _propTypes
|
|
265
|
-
onClick: _propTypes
|
|
266
|
-
icon: _propTypes
|
|
267
|
-
backgroundColor: _propTypes
|
|
268
|
-
badge: _propTypes
|
|
269
|
-
tooltip: _propTypes
|
|
270
|
-
placementTooltip: _propTypes
|
|
271
|
-
type: _propTypes
|
|
272
|
-
hoverColor: _propTypes
|
|
273
|
-
disabled: _propTypes
|
|
257
|
+
id: _propTypes["default"].string,
|
|
258
|
+
className: _propTypes["default"].string,
|
|
259
|
+
onClick: _propTypes["default"].func,
|
|
260
|
+
icon: _propTypes["default"].node,
|
|
261
|
+
backgroundColor: _propTypes["default"].string,
|
|
262
|
+
badge: _propTypes["default"].any,
|
|
263
|
+
tooltip: _propTypes["default"].string,
|
|
264
|
+
placementTooltip: _propTypes["default"].string,
|
|
265
|
+
type: _propTypes["default"].string,
|
|
266
|
+
hoverColor: _propTypes["default"].string,
|
|
267
|
+
disabled: _propTypes["default"].bool
|
|
274
268
|
};
|
|
275
269
|
IconButton.defaultProps = {
|
|
276
270
|
id: '',
|
|
@@ -286,4 +280,4 @@ IconButton.defaultProps = {
|
|
|
286
280
|
disabled: false
|
|
287
281
|
};
|
|
288
282
|
var _default = IconButton;
|
|
289
|
-
exports
|
|
283
|
+
exports["default"] = _default;
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
6
|
+
exports["default"] = exports.DesignIconButtonTemplate = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _IconButton = _interopRequireDefault(require("./IconButton"));
|
|
11
|
-
|
|
12
9
|
var _DesignIconButton = _interopRequireDefault(require("./DesignIconButton.stories"));
|
|
13
|
-
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
16
11
|
var _default = {
|
|
17
12
|
title: 'Components/IconButton',
|
|
18
|
-
component: _IconButton
|
|
13
|
+
component: _IconButton["default"],
|
|
19
14
|
parameters: {
|
|
15
|
+
docs: {
|
|
16
|
+
description: {
|
|
17
|
+
component: "\n## IconButton\n\nComponente de bot\xF3n enfocado en la presentaci\xF3n de elementos gr\xE1ficos (iconos), con soporte opcional para texto complementario, indicadores de notificaci\xF3n (*badge*), barra de progreso y ayuda contextual mediante *tooltip*.\n\nEl componente garantiza la presencia de alternativas textuales mediante etiquetas expl\xEDcitas para evitar controles an\xF3nimos en lectores de pantalla.\n\n## Accesibilidad\n\n### Etiqueta y nombre accesible\n\n- Al tratarse de un bot\xF3n basado en un icono visual, el componente exige una etiqueta accesible para describir su acci\xF3n al usuario.\n- Eval\xFAa de forma priorizada las siguientes propiedades para construir el nombre accesible (`accessibleText`):\n 1. Atributo expl\xEDcito `aria-label`.\n 2. Texto del `tooltip` de ayuda.\n 3. Texto secundario visible en la propiedad `text`.\n- Si no se proporciona ninguna de las opciones anteriores, se utiliza una etiqueta gen\xE9rica de respaldo (\"Bot\xF3n\").\n\n### Control de accesibilidad mediante `useA11yGuard`\n\n- Integra la guardia `useA11yGuard` para prevenir la renderizaci\xF3n de botones mudos o an\xF3nimos en el \xE1rbol accesible.\n- Exige la presencia obligatoria de al menos una de las propiedades: `aria-label`, `tooltip` o `text`.\n- En caso de omisi\xF3n, la guardia lanza una excepci\xF3n detallada en modo desarrollo especificando los atributos faltantes.\n\n### Indicadores de progreso y carga\n\n- **Progreso determinado (`progress`)**:\n - Renderiza un SVG con `role=\"progressbar\"`, notificando din\xE1micamente el porcentaje actual mediante `aria-valuenow`, `aria-valuemin=\"0\"` y `aria-valuemax=\"100\"`.\n- **Progreso indeterminado o autom\xE1tico (`progressAuto`)**:\n - Incluye un spinner animado con `role=\"status\"` y la etiqueta accesible `aria-label=\"Cargando\"`.\n\n### Notificaciones y efectos visuales (*Badge* y *Ringing*)\n\n- **Indicaciones de notificaci\xF3n (`badge`)**:\n - Incluye un contenedor con `role=\"status\"` que aloja un texto oculto para lectores de pantalla (`sr-only`).\n - La propiedad `badgeAriaLabel` permite personalizar la lectura de las notificaciones (por defecto: \"You have pending notifications.\").\n- **Iconograf\xEDa con animaci\xF3n (`ringing`)**:\n - El contenedor visual de la animaci\xF3n se marca con `aria-hidden=\"true\"` para evitar lecturas duplicadas en tecnolog\xEDas asistivas.\n\n### Navegaci\xF3n mediante teclado\n\n- Al utilizar un elemento `button` nativo:\n - Permite recibir el foco mediante la tecla **Tab**.\n - Permite la activaci\xF3n mediante las teclas **Enter** y **Espacio**.\n - Impide la interacci\xF3n cuando la propiedad `disabled` se encuentra activa.\n\n## Recomendaciones de uso\n\n- Proporcionar siempre un texto descriptivo en `aria-label` o `tooltip` que indique claramente la funci\xF3n del bot\xF3n (por ejemplo, \"Eliminar elemento\" en lugar de solo \"Eliminar\").\n- Utilizar la propiedad `badgeAriaLabel` para traducir el mensaje de notificaciones pendientes al idioma del usuario.\n\n## Consideraciones\n\nEl componente gestiona autom\xE1ticamente la asignaci\xF3n de roles ARIA para barras de progreso y notificaciones de estado.\nNo es necesario a\xF1adir atributos de bot\xF3n adicionales salvo personalizaciones avanzadas en la jerarqu\xEDa de foco."
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
20
|
storybookCodePanel: {
|
|
21
21
|
disabled: false,
|
|
22
22
|
files: [{
|
|
@@ -27,15 +27,14 @@ var _default = {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
exports
|
|
31
|
-
|
|
30
|
+
exports["default"] = _default;
|
|
32
31
|
var TemplateIconButton = function TemplateIconButton(args) {
|
|
33
|
-
return /*#__PURE__*/_react
|
|
32
|
+
return /*#__PURE__*/_react["default"].createElement(_DesignIconButton["default"], args);
|
|
34
33
|
};
|
|
35
|
-
|
|
36
34
|
TemplateIconButton.displayName = "TemplateIconButton";
|
|
37
35
|
var DesignIconButtonTemplate = TemplateIconButton.bind({});
|
|
38
36
|
exports.DesignIconButtonTemplate = DesignIconButtonTemplate;
|
|
39
|
-
DesignIconButtonTemplate.parameters = {
|
|
37
|
+
DesignIconButtonTemplate.parameters = {
|
|
38
|
+
// controls: { disable: true },
|
|
40
39
|
};
|
|
41
40
|
DesignIconButtonTemplate.args = {};
|
|
@@ -1,66 +1,51 @@
|
|
|
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 _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
-
|
|
14
11
|
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
15
|
-
|
|
16
12
|
require("../../styles/main.css");
|
|
17
|
-
|
|
18
13
|
require("./IconButtonOld.css");
|
|
19
|
-
|
|
20
14
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
21
|
-
|
|
22
15
|
var _excluded = ["id", "className", "onClick", "icon", "backgroundColor", "styles", "badge", "classNameBadge", "rounded", "tooltip", "placementTooltip", "disabled", "hoverColor", "type", "inModal"];
|
|
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 IconButton = function IconButton(_ref) {
|
|
39
26
|
var id = _ref.id,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
onClick = _ref.onClick,
|
|
29
|
+
icon = _ref.icon,
|
|
30
|
+
backgroundColor = _ref.backgroundColor,
|
|
31
|
+
styles = _ref.styles,
|
|
32
|
+
badge = _ref.badge,
|
|
33
|
+
classNameBadge = _ref.classNameBadge,
|
|
34
|
+
rounded = _ref.rounded,
|
|
35
|
+
tooltip = _ref.tooltip,
|
|
36
|
+
placementTooltip = _ref.placementTooltip,
|
|
37
|
+
disabled = _ref.disabled,
|
|
38
|
+
hoverColor = _ref.hoverColor,
|
|
39
|
+
type = _ref.type,
|
|
40
|
+
inModal = _ref.inModal,
|
|
41
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
56
42
|
var getIcon = function getIcon() {
|
|
57
|
-
return /*#__PURE__*/_react
|
|
43
|
+
return /*#__PURE__*/_react["default"].createElement(_Tooltip["default"], {
|
|
58
44
|
title: tooltip || '',
|
|
59
45
|
placement: placementTooltip
|
|
60
46
|
}, icon);
|
|
61
47
|
};
|
|
62
|
-
|
|
63
|
-
return /*#__PURE__*/_react.default.createElement(_IconButton.default, _extends({
|
|
48
|
+
return /*#__PURE__*/_react["default"].createElement(_IconButton["default"], _extends({
|
|
64
49
|
id: id,
|
|
65
50
|
className: "".concat(className || '', " ").concat(type === 'fab' ? 'cbx-fabButton' : ''),
|
|
66
51
|
onClick: onClick,
|
|
@@ -90,7 +75,7 @@ var IconButton = function IconButton(_ref) {
|
|
|
90
75
|
background: type === 'fab' && 'var(--gray3)'
|
|
91
76
|
}
|
|
92
77
|
}, styles)
|
|
93
|
-
}, props), badge ? /*#__PURE__*/_react
|
|
78
|
+
}, props), badge ? /*#__PURE__*/_react["default"].createElement(_Badge["default"], {
|
|
94
79
|
badgeContent: Number.parseInt(badge, 10) || ' ',
|
|
95
80
|
variant: !Number.parseInt(badge, 10) && 'dot',
|
|
96
81
|
className: classNameBadge,
|
|
@@ -106,20 +91,19 @@ var IconButton = function IconButton(_ref) {
|
|
|
106
91
|
}
|
|
107
92
|
}, getIcon()) : getIcon());
|
|
108
93
|
};
|
|
109
|
-
|
|
110
94
|
IconButton.displayName = "IconButton";
|
|
111
95
|
IconButton.propTypes = {
|
|
112
|
-
id: _propTypes
|
|
113
|
-
className: _propTypes
|
|
114
|
-
onClick: _propTypes
|
|
115
|
-
icon: _propTypes
|
|
116
|
-
backgroundColor: _propTypes
|
|
117
|
-
badge: _propTypes
|
|
118
|
-
tooltip: _propTypes
|
|
119
|
-
placementTooltip: _propTypes
|
|
120
|
-
type: _propTypes
|
|
121
|
-
hoverColor: _propTypes
|
|
122
|
-
disabled: _propTypes
|
|
96
|
+
id: _propTypes["default"].string,
|
|
97
|
+
className: _propTypes["default"].string,
|
|
98
|
+
onClick: _propTypes["default"].func,
|
|
99
|
+
icon: _propTypes["default"].node,
|
|
100
|
+
backgroundColor: _propTypes["default"].string,
|
|
101
|
+
badge: _propTypes["default"].any,
|
|
102
|
+
tooltip: _propTypes["default"].string,
|
|
103
|
+
placementTooltip: _propTypes["default"].string,
|
|
104
|
+
type: _propTypes["default"].string,
|
|
105
|
+
hoverColor: _propTypes["default"].string,
|
|
106
|
+
disabled: _propTypes["default"].bool
|
|
123
107
|
};
|
|
124
108
|
IconButton.defaultProps = {
|
|
125
109
|
id: '',
|
|
@@ -135,4 +119,4 @@ IconButton.defaultProps = {
|
|
|
135
119
|
disabled: false
|
|
136
120
|
};
|
|
137
121
|
var _default = IconButton;
|
|
138
|
-
exports
|
|
122
|
+
exports["default"] = _default;
|