@councilbox/councilbox-ui 1.0.1 → 2.0.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.
- package/dist/HOCs/useDynamicStyles.js +99 -0
- package/dist/HOCs/useRipple.js +91 -0
- package/dist/build-index.js +8 -0
- package/dist/components/1.Introduction.stories.mdx +2 -1
- package/dist/components/2.Changelog.stories.mdx +3 -0
- package/dist/components/3.Guide.stories.mdx +56 -0
- package/dist/components/Accordion/Accordion.css +39 -1
- package/dist/components/Accordion/Accordion.js +84 -45
- package/dist/components/Accordion/Accordion.stories.js +4 -2
- package/dist/components/Accordion/AccordionOld.css +16 -0
- package/dist/components/Accordion/AccordionOld.js +115 -0
- package/dist/components/Accordion/DesignAccordion.stories.js +38 -0
- package/dist/components/Alert/Alert.css +5 -0
- package/dist/components/Alert/Alert.js +17 -6
- package/dist/components/Avatar/Avatar.css +3 -3
- package/dist/components/Avatar/Avatar.js +36 -20
- package/dist/components/Avatar/AvatarOld.js +138 -0
- package/dist/components/Avatar/DesignAvatar.stories.js +1 -1
- package/dist/components/Block/Block.js +17 -2
- package/dist/components/ButtonBasic/ButtonBasic.css +264 -20
- package/dist/components/ButtonBasic/ButtonBasic.js +85 -110
- package/dist/components/ButtonBasic/ButtonBasicOld.css +41 -0
- package/dist/components/ButtonBasic/ButtonBasicOld.js +231 -0
- package/dist/components/Checkbox/Checkbox.css +101 -22
- package/dist/components/Checkbox/Checkbox.js +119 -63
- package/dist/components/Checkbox/CheckboxOld.css +31 -0
- package/dist/components/Checkbox/CheckboxOld.js +112 -0
- package/dist/components/DragDrop/DragDrop.js +24 -9
- package/dist/components/DrawerPanel/DesignDrawerPanel.js +4 -2
- package/dist/components/DrawerPanel/DrawerPanel.css +76 -36
- package/dist/components/DrawerPanel/DrawerPanel.js +137 -115
- package/dist/components/DrawerPanel/DrawerPanelOld.css +56 -0
- package/dist/components/DrawerPanel/DrawerPanelOld.js +233 -0
- package/dist/components/DropDown/DesignDropDown.stories.js +146 -17
- package/dist/components/DropDown/DropDown.css +96 -1
- package/dist/components/DropDown/DropDown.js +308 -82
- package/dist/components/DropDown/DropDown.stories.js +1 -0
- package/dist/components/DropDown/DropDownOld.css +3 -0
- package/dist/components/DropDown/DropDownOld.js +186 -0
- package/dist/components/DropDown/PopoverPlayground.css +22 -0
- package/dist/components/DropDown/PopoverPlayground.js +235 -0
- package/dist/components/EnhancedTable/EnhancedTable.js +5 -6
- package/dist/components/FabButton/DesignFabButton.stories.js +3 -1
- package/dist/components/FabButton/FabButton.js +25 -5
- package/dist/components/Grid/DesignGrid.stories.js +9 -3
- package/dist/components/Grid/Grid.css +325 -0
- package/dist/components/Grid/Grid.js +57 -16
- package/dist/components/Grid/GridItem.js +31 -13
- package/dist/components/Grid/GridItemOld.js +43 -0
- package/dist/components/Grid/GridOld.css +0 -0
- package/dist/components/Grid/GridOld.js +53 -0
- package/dist/components/Header/Header.js +95 -116
- package/dist/components/IconButton/DesignIconButton.stories.js +22 -2
- package/dist/components/IconButton/IconButton.css +121 -1
- package/dist/components/IconButton/IconButton.js +98 -53
- package/dist/components/IconButton/IconButtonOld.css +0 -0
- package/dist/components/IconButton/IconButtonOld.js +138 -0
- package/dist/components/IconButtonSquare/IconButtonSquare.js +20 -90
- package/dist/components/IconButtonSquare/IconButtonSquareOld.css +43 -0
- package/dist/components/IconButtonSquare/IconButtonSquareOld.js +133 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.css +109 -0
- package/dist/components/InputAutocomplete/InputAutocomplete.js +382 -76
- package/dist/components/InputAutocomplete/InputAutocomplete.stories.js +118 -6
- package/dist/components/InputAutocomplete/InputAutocompleteOld.css +5 -0
- package/dist/components/InputAutocomplete/InputAutocompleteOld.js +178 -0
- package/dist/components/InputPassword/InputPassword.js +10 -20
- package/dist/components/InputText/InputText.css +442 -1
- package/dist/components/InputText/InputText.js +298 -239
- package/dist/components/InputText/InputText.stories.js +12 -3
- package/dist/components/InputText/InputTextOld.css +10 -0
- package/dist/components/InputText/InputTextOld.js +340 -0
- package/dist/components/InputTextArea/DesignInputTextArea.stories.js +30 -4
- package/dist/components/InputTextArea/InputTextArea.js +13 -6
- package/dist/components/LoadingSection/LoadingSection.css +44 -2
- package/dist/components/LoadingSection/LoadingSection.js +63 -9
- package/dist/components/MenuItem/DesignMenuItem.stories.js +1 -0
- package/dist/components/MenuItem/MenuItem.css +35 -6
- package/dist/components/MenuItem/MenuItem.js +99 -50
- package/dist/components/MenuItem/MenuItemOld.js +139 -0
- package/dist/components/MenuLateralLeft/MenuLateralLeft.js +60 -40
- package/dist/components/MenuLateralRight/MenuLateralRight.js +23 -8
- package/dist/components/Modal/DesignModal.stories.js +54 -0
- package/dist/components/Modal/Modal.css +81 -2
- package/dist/components/Modal/Modal.js +112 -80
- package/dist/components/Modal/Modal.stories.js +13 -2
- package/dist/components/Modal/ModalOld.css +3 -0
- package/dist/components/Modal/ModalOld.js +230 -0
- package/dist/components/PaginationFooter/DesignPaginationFooter.stories.js +9 -1
- package/dist/components/PaginationFooter/PaginationFooter.css +73 -0
- package/dist/components/PaginationFooter/PaginationFooter.js +45 -87
- package/dist/components/RadioButton/Radio.css +115 -16
- package/dist/components/RadioButton/Radio.js +70 -94
- package/dist/components/RadioButton/Radio.stories.js +42 -18
- package/dist/components/RadioButton/RadioOld.css +31 -0
- package/dist/components/RadioButton/RadioOld.js +142 -0
- package/dist/components/Ripple/DesignRipple.js +77 -0
- package/dist/components/Ripple/Ripple.stories.js +45 -0
- package/dist/components/Scrollbar/Scrollbar.js +21 -6
- package/dist/components/SelectInput/DesignSelectInput.js +62 -23
- package/dist/components/SelectInput/SelectInput.css +128 -10
- package/dist/components/SelectInput/SelectInput.js +265 -244
- package/dist/components/SelectInput/SelectInputOld.css +17 -0
- package/dist/components/SelectInput/SelectInputOld.js +325 -0
- package/dist/components/Stars/Stars.css +28 -28
- package/dist/components/Stars/Stars.js +22 -12
- package/dist/components/Stepper/Stepper.css +1 -0
- package/dist/components/Stepper/Stepper.js +81 -24
- package/dist/components/Table/DesignTable.stories.js +1 -0
- package/dist/components/Table/Table.css +56 -53
- package/dist/components/Table/Table.js +55 -75
- package/dist/components/Table/TableOld.css +79 -0
- package/dist/components/Table/TableOld.js +165 -0
- package/dist/components/Tabs/DesignTabs.js +37 -12
- package/dist/components/Tabs/Tabs.css +39 -4
- package/dist/components/Tabs/Tabs.js +194 -30
- package/dist/components/Tabs/Tabs.stories.js +8 -1
- package/dist/components/Tabs/TabsOld.js +92 -0
- package/dist/components/Tag/Tag.js +19 -9
- package/dist/components/Toggle/Toggle.css +122 -3
- package/dist/components/Toggle/Toggle.js +95 -68
- package/dist/components/Tooltip/DesignTooltip.stories.js +48 -0
- package/dist/components/Tooltip/Tooltip.css +75 -0
- package/dist/components/Tooltip/Tooltip.js +126 -0
- package/dist/components/Tooltip/Tooltip.stories.js +40 -0
- package/dist/components/Typography/Typography.css +9 -0
- package/dist/components/Typography/Typography.js +30 -21
- package/dist/components/Typography/TypographyOld.js +132 -0
- package/dist/styles/colorConsts.css +24 -0
- package/dist/styles/main.css +41 -49
- package/dist/styles/scpacingConsts.css +26 -0
- package/dist/styles/zIndexConsts.css +9 -0
- package/dist/testing/TestAutocomplete.js +369 -0
- package/dist/testing/TestComponents.js +3 -114
- package/dist/testing/TestDropdown.js +225 -0
- package/dist/utils/autoDetectScroll.js +127 -0
- package/dist/utils/index.js +141 -0
- package/package.json +2 -1
|
@@ -9,17 +9,19 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
12
|
-
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
-
|
|
14
|
-
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
15
|
-
|
|
16
12
|
require("../../styles/main.css");
|
|
17
13
|
|
|
18
14
|
require("./IconButton.css");
|
|
19
15
|
|
|
20
16
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
19
|
+
|
|
20
|
+
var _useRipple3 = _interopRequireDefault(require("../../HOCs/useRipple"));
|
|
21
|
+
|
|
22
|
+
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
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"];
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
@@ -31,6 +33,18 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
31
33
|
|
|
32
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; }
|
|
33
35
|
|
|
36
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
37
|
+
|
|
38
|
+
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 _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
41
|
+
|
|
42
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
43
|
+
|
|
44
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
45
|
+
|
|
46
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
47
|
+
|
|
34
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; }
|
|
35
49
|
|
|
36
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; }
|
|
@@ -42,6 +56,7 @@ var IconButton = function IconButton(_ref) {
|
|
|
42
56
|
icon = _ref.icon,
|
|
43
57
|
backgroundColor = _ref.backgroundColor,
|
|
44
58
|
styles = _ref.styles,
|
|
59
|
+
style = _ref.style,
|
|
45
60
|
badge = _ref.badge,
|
|
46
61
|
classNameBadge = _ref.classNameBadge,
|
|
47
62
|
rounded = _ref.rounded,
|
|
@@ -51,11 +66,47 @@ var IconButton = function IconButton(_ref) {
|
|
|
51
66
|
hoverColor = _ref.hoverColor,
|
|
52
67
|
type = _ref.type,
|
|
53
68
|
inModal = _ref.inModal,
|
|
54
|
-
|
|
69
|
+
propPrefixClass = _ref.prefixClass,
|
|
70
|
+
sx = _ref.sx,
|
|
71
|
+
active = _ref.active,
|
|
72
|
+
text = _ref.text,
|
|
73
|
+
variant = _ref.variant,
|
|
74
|
+
fontWeight = _ref.fontWeight,
|
|
75
|
+
textVisibleMenuMobile = _ref.textVisibleMenuMobile,
|
|
76
|
+
stylesText = _ref.stylesText,
|
|
55
77
|
progress = _ref.progress,
|
|
56
78
|
progressAuto = _ref.progressAuto,
|
|
79
|
+
colorProgress = _ref.colorProgress,
|
|
57
80
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
58
81
|
|
|
82
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
83
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
84
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
85
|
+
|
|
86
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
87
|
+
|
|
88
|
+
var variantRipples = function variantRipples() {
|
|
89
|
+
if (type === 'rounded' || rounded) {
|
|
90
|
+
return '#38398c38';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return 'rgb(0 0 0 / 10%)';
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var _useRipple = (0, _useRipple3.default)({
|
|
97
|
+
backgroundColor: variantRipples()
|
|
98
|
+
}, 'center'),
|
|
99
|
+
_useRipple2 = _slicedToArray(_useRipple, 2),
|
|
100
|
+
addRipple = _useRipple2[0],
|
|
101
|
+
ripples = _useRipple2[1];
|
|
102
|
+
|
|
103
|
+
var onClickButton = function onClickButton(e) {
|
|
104
|
+
if (!disabled) {
|
|
105
|
+
addRipple(e);
|
|
106
|
+
onClick(e);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
59
110
|
var getIcon = function getIcon() {
|
|
60
111
|
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
61
112
|
title: tooltip || '',
|
|
@@ -63,6 +114,23 @@ var IconButton = function IconButton(_ref) {
|
|
|
63
114
|
}, icon);
|
|
64
115
|
};
|
|
65
116
|
|
|
117
|
+
var getText = function getText() {
|
|
118
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
119
|
+
style: {
|
|
120
|
+
width: '100%'
|
|
121
|
+
}
|
|
122
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
123
|
+
variant: variant || 'XS',
|
|
124
|
+
color: active ? 'var(--primary)' : 'var(--gray3)',
|
|
125
|
+
fontWeight: fontWeight,
|
|
126
|
+
styles: _objectSpread({
|
|
127
|
+
overflow: 'hidden',
|
|
128
|
+
whiteSpace: 'nowrap',
|
|
129
|
+
textOverflow: 'ellipsis'
|
|
130
|
+
}, stylesText)
|
|
131
|
+
}, text));
|
|
132
|
+
};
|
|
133
|
+
|
|
66
134
|
var circleRadius = 20; // Ajustamos el radio para que encaje bien con el botón
|
|
67
135
|
|
|
68
136
|
var circumference = 2 * Math.PI * circleRadius; // Circunferencia del círculo
|
|
@@ -73,7 +141,7 @@ var IconButton = function IconButton(_ref) {
|
|
|
73
141
|
|
|
74
142
|
var getProgressAuto = function getProgressAuto() {
|
|
75
143
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
76
|
-
className: 'cbx-IconButton-progressCircle cbx-IconButton-animatedCircle',
|
|
144
|
+
className: prefixClass('cbx-IconButton-progressCircle cbx-IconButton-animatedCircle'),
|
|
77
145
|
width: "100%",
|
|
78
146
|
height: "100%",
|
|
79
147
|
viewBox: "0 0 200 202",
|
|
@@ -117,7 +185,7 @@ var IconButton = function IconButton(_ref) {
|
|
|
117
185
|
|
|
118
186
|
var getProgress = function getProgress() {
|
|
119
187
|
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
120
|
-
className: 'cbx-IconButton-progressCircle',
|
|
188
|
+
className: prefixClass('cbx-IconButton-progressCircle'),
|
|
121
189
|
width: "48",
|
|
122
190
|
height: "48",
|
|
123
191
|
viewBox: "0 0 48 48",
|
|
@@ -142,51 +210,26 @@ var IconButton = function IconButton(_ref) {
|
|
|
142
210
|
}));
|
|
143
211
|
};
|
|
144
212
|
|
|
145
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
213
|
+
return /*#__PURE__*/_react.default.createElement("button", _extends({
|
|
146
214
|
id: id,
|
|
147
|
-
className: "".concat(className || '', " ").concat(type === 'fab' ? 'cbx-fabButton' : ''),
|
|
148
|
-
onClick: onClick,
|
|
149
215
|
disabled: disabled,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
zIndex: inModal && '1120',
|
|
168
|
-
'&.MuiButtonBase-root.cbx-fabButton i': {
|
|
169
|
-
color: 'white'
|
|
170
|
-
},
|
|
171
|
-
'&.MuiButtonBase-root.MuiIconButton-root.Mui-disabled.cbx-fabButton': {
|
|
172
|
-
background: type === 'fab' && 'var(--gray3)'
|
|
173
|
-
}
|
|
174
|
-
}, styles)
|
|
175
|
-
}, props), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
|
176
|
-
badgeContent: Number.parseInt(badge, 10) || ' ',
|
|
177
|
-
variant: !Number.parseInt(badge, 10) && 'dot',
|
|
178
|
-
className: classNameBadge,
|
|
179
|
-
sx: {
|
|
180
|
-
'& .MuiBadge-dot': {
|
|
181
|
-
background: !Number.parseInt(badge, 10) && 'var(--error)!important',
|
|
182
|
-
right: '-0.5rem',
|
|
183
|
-
top: '-0.25rem'
|
|
184
|
-
},
|
|
185
|
-
'& .MuiBadge-badge ': {
|
|
186
|
-
background: 'var(--secondary)'
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
}, getIcon()) : getIcon());
|
|
216
|
+
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' : '')),
|
|
217
|
+
type: "button",
|
|
218
|
+
onClick: function onClick(e) {
|
|
219
|
+
return onClickButton(e);
|
|
220
|
+
},
|
|
221
|
+
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
222
|
+
backgroundColor: backgroundColor
|
|
223
|
+
}, styles), style), stylesInLine), {}, {
|
|
224
|
+
position: 'relative'
|
|
225
|
+
})
|
|
226
|
+
}, props), progressAuto ? getProgressAuto() : progress && getProgress(), badge ? /*#__PURE__*/_react.default.createElement("div", {
|
|
227
|
+
className: prefixClass('cbx-IconButton-containerBadge')
|
|
228
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
229
|
+
className: prefixClass('cbx-IconButton-badge')
|
|
230
|
+
}), icon ? getIcon() : '', text && getText()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, icon ? getIcon() : '', text && getText()), !disabled && /*#__PURE__*/_react.default.createElement("div", {
|
|
231
|
+
className: prefixClass('cbx-ripple cbx-IconButton-containerRipple')
|
|
232
|
+
}, ripples));
|
|
190
233
|
};
|
|
191
234
|
|
|
192
235
|
IconButton.displayName = "IconButton";
|
|
@@ -200,7 +243,8 @@ IconButton.propTypes = {
|
|
|
200
243
|
tooltip: _propTypes.default.string,
|
|
201
244
|
placementTooltip: _propTypes.default.string,
|
|
202
245
|
type: _propTypes.default.string,
|
|
203
|
-
hoverColor: _propTypes.default.string
|
|
246
|
+
hoverColor: _propTypes.default.string,
|
|
247
|
+
disabled: _propTypes.default.bool
|
|
204
248
|
};
|
|
205
249
|
IconButton.defaultProps = {
|
|
206
250
|
id: '',
|
|
@@ -212,7 +256,8 @@ IconButton.defaultProps = {
|
|
|
212
256
|
tooltip: '',
|
|
213
257
|
placementTooltip: 'bottom',
|
|
214
258
|
type: '',
|
|
215
|
-
hoverColor: ''
|
|
259
|
+
hoverColor: '',
|
|
260
|
+
disabled: false
|
|
216
261
|
};
|
|
217
262
|
var _default = IconButton;
|
|
218
263
|
exports.default = _default;
|
|
File without changes
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
+
|
|
14
|
+
var _Badge = _interopRequireDefault(require("@mui/material/Badge"));
|
|
15
|
+
|
|
16
|
+
require("../../styles/main.css");
|
|
17
|
+
|
|
18
|
+
require("./IconButtonOld.css");
|
|
19
|
+
|
|
20
|
+
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
21
|
+
|
|
22
|
+
var _excluded = ["id", "className", "onClick", "icon", "backgroundColor", "styles", "badge", "classNameBadge", "rounded", "tooltip", "placementTooltip", "disabled", "hoverColor", "type", "inModal"];
|
|
23
|
+
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
|
|
26
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
+
|
|
28
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
|
+
|
|
30
|
+
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; }
|
|
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
|
+
|
|
38
|
+
var IconButton = function IconButton(_ref) {
|
|
39
|
+
var id = _ref.id,
|
|
40
|
+
className = _ref.className,
|
|
41
|
+
onClick = _ref.onClick,
|
|
42
|
+
icon = _ref.icon,
|
|
43
|
+
backgroundColor = _ref.backgroundColor,
|
|
44
|
+
styles = _ref.styles,
|
|
45
|
+
badge = _ref.badge,
|
|
46
|
+
classNameBadge = _ref.classNameBadge,
|
|
47
|
+
rounded = _ref.rounded,
|
|
48
|
+
tooltip = _ref.tooltip,
|
|
49
|
+
placementTooltip = _ref.placementTooltip,
|
|
50
|
+
disabled = _ref.disabled,
|
|
51
|
+
hoverColor = _ref.hoverColor,
|
|
52
|
+
type = _ref.type,
|
|
53
|
+
inModal = _ref.inModal,
|
|
54
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
55
|
+
|
|
56
|
+
var getIcon = function getIcon() {
|
|
57
|
+
return /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
58
|
+
title: tooltip || '',
|
|
59
|
+
placement: placementTooltip
|
|
60
|
+
}, icon);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.default, _extends({
|
|
64
|
+
id: id,
|
|
65
|
+
className: "".concat(className || '', " ").concat(type === 'fab' ? 'cbx-fabButton' : ''),
|
|
66
|
+
onClick: onClick,
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
sx: _objectSpread(_objectSpread({
|
|
69
|
+
width: (type === null || type === void 0 ? void 0 : type.toLowerCase()) === 'fab' ? 'var(--spacing56)' : 'var(--spacing40)',
|
|
70
|
+
height: (type === null || type === void 0 ? void 0 : type.toLowerCase()) === 'fab' ? 'var(--spacing56)' : 'var(--spacing40)',
|
|
71
|
+
boxShadow: (type === null || type === void 0 ? void 0 : type.toLowerCase()) === 'fab' && '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
72
|
+
fontSize: 'var(--spacing24)',
|
|
73
|
+
color: 'var(--gray3)',
|
|
74
|
+
background: backgroundColor
|
|
75
|
+
}, rounded ? {
|
|
76
|
+
border: disabled ? '2px solid rgba(0,0,0,0.26)' : '2px solid var(--primary)',
|
|
77
|
+
color: 'var(--primary)'
|
|
78
|
+
} : {}), {}, {
|
|
79
|
+
'&:focus': {
|
|
80
|
+
outline: 'none!important'
|
|
81
|
+
},
|
|
82
|
+
'&&:hover': {
|
|
83
|
+
backgroundColor: hoverColor
|
|
84
|
+
},
|
|
85
|
+
zIndex: inModal && '1120',
|
|
86
|
+
'&.MuiButtonBase-root.cbx-fabButton i': {
|
|
87
|
+
color: 'white'
|
|
88
|
+
},
|
|
89
|
+
'&.MuiButtonBase-root.MuiIconButton-root.Mui-disabled.cbx-fabButton': {
|
|
90
|
+
background: type === 'fab' && 'var(--gray3)'
|
|
91
|
+
}
|
|
92
|
+
}, styles)
|
|
93
|
+
}, props), badge ? /*#__PURE__*/_react.default.createElement(_Badge.default, {
|
|
94
|
+
badgeContent: Number.parseInt(badge, 10) || ' ',
|
|
95
|
+
variant: !Number.parseInt(badge, 10) && 'dot',
|
|
96
|
+
className: classNameBadge,
|
|
97
|
+
sx: {
|
|
98
|
+
'& .MuiBadge-dot': {
|
|
99
|
+
background: !Number.parseInt(badge, 10) && 'var(--error)!important',
|
|
100
|
+
right: '-0.5rem',
|
|
101
|
+
top: '-0.25rem'
|
|
102
|
+
},
|
|
103
|
+
'& .MuiBadge-badge ': {
|
|
104
|
+
background: 'var(--secondary)'
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, getIcon()) : getIcon());
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
IconButton.displayName = "IconButton";
|
|
111
|
+
IconButton.propTypes = {
|
|
112
|
+
id: _propTypes.default.string,
|
|
113
|
+
className: _propTypes.default.string,
|
|
114
|
+
onClick: _propTypes.default.func,
|
|
115
|
+
icon: _propTypes.default.node,
|
|
116
|
+
backgroundColor: _propTypes.default.string,
|
|
117
|
+
badge: _propTypes.default.any,
|
|
118
|
+
tooltip: _propTypes.default.string,
|
|
119
|
+
placementTooltip: _propTypes.default.string,
|
|
120
|
+
type: _propTypes.default.string,
|
|
121
|
+
hoverColor: _propTypes.default.string,
|
|
122
|
+
disabled: _propTypes.default.bool
|
|
123
|
+
};
|
|
124
|
+
IconButton.defaultProps = {
|
|
125
|
+
id: '',
|
|
126
|
+
className: '',
|
|
127
|
+
onClick: Function.prototype,
|
|
128
|
+
icon: undefined,
|
|
129
|
+
backgroundColor: '',
|
|
130
|
+
badge: false,
|
|
131
|
+
tooltip: '',
|
|
132
|
+
placementTooltip: 'bottom',
|
|
133
|
+
type: '',
|
|
134
|
+
hoverColor: '',
|
|
135
|
+
disabled: false
|
|
136
|
+
};
|
|
137
|
+
var _default = IconButton;
|
|
138
|
+
exports.default = _default;
|
|
@@ -7,111 +7,41 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
-
|
|
12
|
-
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
|
13
|
-
|
|
14
10
|
require("../../styles/main.css");
|
|
15
11
|
|
|
16
12
|
require("./IconButtonSquare.css");
|
|
17
13
|
|
|
18
|
-
var
|
|
14
|
+
var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
|
|
19
15
|
|
|
20
|
-
var
|
|
16
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _excluded = ["sx", "prefixClass"];
|
|
23
19
|
|
|
24
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
21
|
|
|
26
|
-
function
|
|
22
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
23
|
|
|
28
|
-
function
|
|
24
|
+
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; }
|
|
29
25
|
|
|
30
|
-
function
|
|
26
|
+
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; }
|
|
31
27
|
|
|
32
28
|
var IconButtonSquare = function IconButtonSquare(_ref) {
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
var rippleRef = _react.default.useRef(null);
|
|
46
|
-
|
|
47
|
-
var onRippleStart = function onRippleStart(e) {
|
|
48
|
-
rippleRef.current.start(e);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
var onRippleStop = function onRippleStop(e) {
|
|
52
|
-
rippleRef.current.stop(e);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
return /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
56
|
-
onMouseDown: onRippleStart,
|
|
57
|
-
onMouseUp: onRippleStop,
|
|
58
|
-
disableRipple: true,
|
|
59
|
-
sx: _objectSpread({
|
|
60
|
-
width: '4.75rem',
|
|
61
|
-
height: '4.75rem',
|
|
62
|
-
background: active ? 'white' : 'transparent',
|
|
63
|
-
borderRadius: '0',
|
|
64
|
-
'&:focus': {
|
|
65
|
-
outline: 'none!important'
|
|
66
|
-
},
|
|
67
|
-
padding: textVisibleMenuMobile && '8px 20px'
|
|
68
|
-
}, styles),
|
|
69
|
-
onClick: onClick
|
|
70
|
-
}, /*#__PURE__*/_react.default.createElement(_TouchRipple.default, {
|
|
71
|
-
ref: rippleRef,
|
|
72
|
-
center: false
|
|
73
|
-
}), /*#__PURE__*/_react.default.createElement(_Tooltip.default, {
|
|
74
|
-
title: tooltip || '',
|
|
75
|
-
placement: placementTooltip
|
|
76
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
77
|
-
className: "cbx-iconButtonSquare-container ".concat(textVisibleMenuMobile ? 'menuMobile' : '')
|
|
78
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
79
|
-
className: "cbx-iconButtonSquare-containerIcon ".concat(active ? 'cbx-iconButtonSquare-containerIcon-active' : '')
|
|
80
|
-
}, badge && /*#__PURE__*/_react.default.createElement("div", {
|
|
81
|
-
className: "cbx-iconButtonSquare-red-dot ".concat(text ? '' : 'cbx-iconButtonSquare-red-dot-noText')
|
|
82
|
-
}), icon), text && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
83
|
-
variant: variant || 'XS',
|
|
84
|
-
color: active ? 'var(--primary)' : 'var(--gray3)',
|
|
85
|
-
fontWeight: fontWeight,
|
|
86
|
-
styles: {
|
|
87
|
-
overflow: 'hidden',
|
|
88
|
-
whiteSpace: 'nowrap',
|
|
89
|
-
textOverflow: 'ellipsis',
|
|
90
|
-
maxWidth: textVisibleMenuMobile ? '4.5rem' : '3.25rem'
|
|
91
|
-
}
|
|
92
|
-
}, text)))));
|
|
29
|
+
var sx = _ref.sx,
|
|
30
|
+
propPrefixClass = _ref.prefixClass,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
|
|
33
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
34
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
35
|
+
|
|
36
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_IconButton.default, _extends({
|
|
38
|
+
prefixClass: prefixClass,
|
|
39
|
+
type: 'square'
|
|
40
|
+
}, props));
|
|
93
41
|
};
|
|
94
42
|
|
|
95
43
|
IconButtonSquare.displayName = "IconButtonSquare";
|
|
96
|
-
IconButtonSquare.propTypes = {
|
|
97
|
-
|
|
98
|
-
icon: _propTypes.default.node,
|
|
99
|
-
active: _propTypes.default.bool,
|
|
100
|
-
badge: _propTypes.default.bool,
|
|
101
|
-
onClick: _propTypes.default.func,
|
|
102
|
-
styles: _propTypes.default.object,
|
|
103
|
-
tooltip: _propTypes.default.string,
|
|
104
|
-
placementTooltip: _propTypes.default.string
|
|
105
|
-
};
|
|
106
|
-
IconButtonSquare.defaultProps = {
|
|
107
|
-
text: '',
|
|
108
|
-
icon: undefined,
|
|
109
|
-
active: false,
|
|
110
|
-
badge: false,
|
|
111
|
-
onClick: Function.prototype,
|
|
112
|
-
styles: {},
|
|
113
|
-
tooltip: '',
|
|
114
|
-
placementTooltip: 'bottom'
|
|
115
|
-
};
|
|
44
|
+
IconButtonSquare.propTypes = {};
|
|
45
|
+
IconButtonSquare.defaultProps = {};
|
|
116
46
|
var _default = IconButtonSquare;
|
|
117
47
|
exports.default = _default;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
.cbx-iconButtonSquare-red-dot {
|
|
2
|
+
position: absolute;
|
|
3
|
+
width: var(--spacing8);
|
|
4
|
+
height: var(--spacing8);
|
|
5
|
+
right: var(--spacing4);
|
|
6
|
+
top: 0.125rem;
|
|
7
|
+
border-radius: 50rem;
|
|
8
|
+
background: var(--error);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.cbx-iconButtonSquare-container.menuMobile .cbx-iconButtonSquare-red-dot {
|
|
12
|
+
right: -.625rem;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.cbx-iconButtonSquare-red-dot-noText {
|
|
16
|
+
right: -0.813rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.cbx-iconButtonSquare-containerIcon {
|
|
20
|
+
font-size: 1.5rem;
|
|
21
|
+
position: relative;
|
|
22
|
+
color: var(--gray3);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.cbx-iconButtonSquare-containerIcon-active {
|
|
26
|
+
color: var(--primary)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.cbx-iconButtonSquare-container.menuMobile{
|
|
30
|
+
text-align: center;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: center;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
width: 100%;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.cbx-iconButtonSquare-container.menuMobile .cbx-iconButtonSquare-containerIcon {
|
|
39
|
+
display: flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
width: 1.5rem;
|
|
42
|
+
height: 1.5rem;
|
|
43
|
+
}
|