@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
|
@@ -25,6 +25,8 @@ var _IconButtonSquare = _interopRequireDefault(require("../IconButtonSquare/Icon
|
|
|
25
25
|
|
|
26
26
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
27
27
|
|
|
28
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
29
|
+
|
|
28
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
31
|
|
|
30
32
|
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; }
|
|
@@ -41,8 +43,14 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
41
43
|
buttonVideo = _ref.buttonVideo,
|
|
42
44
|
noCollapseUpperSection = _ref.noCollapseUpperSection,
|
|
43
45
|
textVisibleMenuMobile = _ref.textVisibleMenuMobile,
|
|
46
|
+
sx = _ref.sx,
|
|
47
|
+
style = _ref.style,
|
|
44
48
|
textIconButtonMore = _ref.textIconButtonMore;
|
|
45
49
|
|
|
50
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
51
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
52
|
+
prefixClass = _useDynamicStyles.prefixClass;
|
|
53
|
+
|
|
46
54
|
var _useWindowSize = (0, _useWindowSize2.default)(),
|
|
47
55
|
innerWidth = _useWindowSize.innerWidth,
|
|
48
56
|
breakpoints = _useWindowSize.breakpoints;
|
|
@@ -67,9 +75,10 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
67
75
|
|
|
68
76
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
69
77
|
id: id,
|
|
70
|
-
className: mobile ? 'cbx-menuLateralRight-block-mobile' : "cbx-menuLateralRight-block ".concat(resize() ? 'cbx-menuLateralRight-block-resize' : '')
|
|
78
|
+
className: mobile ? prefixClass('cbx-menuLateralRight-block-mobile') : prefixClass("cbx-menuLateralRight-block ".concat(resize() ? 'cbx-menuLateralRight-block-resize' : '')),
|
|
79
|
+
style: _objectSpread(_objectSpread({}, style), stylesInLine)
|
|
71
80
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
-
className: mobile ? 'cbx-menuLateralRight-block-upper-mobile' : 'cbx-menuLateralRight-block-upper'
|
|
81
|
+
className: prefixClass(mobile ? 'cbx-menuLateralRight-block-upper-mobile' : 'cbx-menuLateralRight-block-upper')
|
|
73
82
|
}, resize() ? /*#__PURE__*/_react.default.createElement("div", {
|
|
74
83
|
style: {
|
|
75
84
|
display: mobile && 'flex'
|
|
@@ -79,6 +88,7 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
79
88
|
active: buttonVideo.active,
|
|
80
89
|
onClick: buttonVideo.action,
|
|
81
90
|
badge: buttonVideo.badge,
|
|
91
|
+
sx: buttonVideo.sx,
|
|
82
92
|
text: mobile && textVisibleMenuMobile && buttonVideo.text,
|
|
83
93
|
variant: mobile && textVisibleMenuMobile && 'M',
|
|
84
94
|
fontWeight: mobile && textVisibleMenuMobile && '700',
|
|
@@ -93,6 +103,7 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
93
103
|
icon: item.icon,
|
|
94
104
|
active: buttonVideo.active ? false : item.active,
|
|
95
105
|
onClick: item.action,
|
|
106
|
+
sx: item.sx,
|
|
96
107
|
badge: item.badge,
|
|
97
108
|
text: mobile && textVisibleMenuMobile && item.text,
|
|
98
109
|
variant: mobile && textVisibleMenuMobile && 'M',
|
|
@@ -108,6 +119,7 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
108
119
|
active: buttonVideo.active ? false : iconSelectDropDown().active,
|
|
109
120
|
onClick: iconSelectDropDown().action,
|
|
110
121
|
badge: iconSelectDropDown().badge,
|
|
122
|
+
sx: iconSelectDropDown().sx,
|
|
111
123
|
text: mobile && textVisibleMenuMobile && iconSelectDropDown().text,
|
|
112
124
|
variant: mobile && textVisibleMenuMobile && 'M',
|
|
113
125
|
fontWeight: mobile && textVisibleMenuMobile && '700',
|
|
@@ -170,26 +182,28 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
170
182
|
styles: _objectSpread({}, mobile ? {
|
|
171
183
|
width: 'var(--spacing64)',
|
|
172
184
|
height: 'var(--spacing64)'
|
|
173
|
-
} : {})
|
|
185
|
+
} : {}),
|
|
186
|
+
sx: item.sx
|
|
174
187
|
}));
|
|
175
188
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
-
className: mobile ? 'cbx-menuLateralRight-block-under-mobile' : 'cbx-menuLateralRight-block-under'
|
|
189
|
+
className: prefixClass(mobile ? 'cbx-menuLateralRight-block-under-mobile' : 'cbx-menuLateralRight-block-under')
|
|
177
190
|
}, underSection === null || underSection === void 0 ? void 0 : underSection.map(function (item, index) {
|
|
178
191
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
179
192
|
key: "under-section-".concat(index),
|
|
180
|
-
className: mobile ? 'cbx-menuLateralRight-container-under-mobile' : 'cbx-menuLateralRight-container-under'
|
|
193
|
+
className: prefixClass(mobile ? 'cbx-menuLateralRight-container-under-mobile' : 'cbx-menuLateralRight-container-under')
|
|
181
194
|
}, item.actionTooltip && /*#__PURE__*/_react.default.createElement("div", {
|
|
182
|
-
className: 'cbx-menuLateralRight-block-tooltip-under',
|
|
195
|
+
className: prefixClass('cbx-menuLateralRight-block-tooltip-under'),
|
|
183
196
|
onClick: item.setActionTooltip
|
|
184
197
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
198
|
+
prefixClass: prefixClass,
|
|
185
199
|
color: 'white'
|
|
186
200
|
}, item.textTooltip), /*#__PURE__*/_react.default.createElement("div", {
|
|
187
|
-
className: 'cbx-menuLateralRight-block-tooltip-under-triangle',
|
|
201
|
+
className: prefixClass('cbx-menuLateralRight-block-tooltip-under-triangle'),
|
|
188
202
|
style: {
|
|
189
203
|
left: mobile ? '4.313rem' : '3.125rem'
|
|
190
204
|
}
|
|
191
205
|
})), item.actionDisabled && /*#__PURE__*/_react.default.createElement("div", {
|
|
192
|
-
className: 'cbx-menuLateralRight-block-action-disabled',
|
|
206
|
+
className: prefixClass('cbx-menuLateralRight-block-action-disabled'),
|
|
193
207
|
onClick: item.actionDisabled
|
|
194
208
|
}), /*#__PURE__*/_react.default.createElement(_IconButton.default, {
|
|
195
209
|
disabled: item.disabled,
|
|
@@ -205,6 +219,7 @@ var MenuLateralRight = function MenuLateralRight(_ref) {
|
|
|
205
219
|
backgroundColor: '#272762'
|
|
206
220
|
}
|
|
207
221
|
} : {}),
|
|
222
|
+
sx: item.sx,
|
|
208
223
|
rounded: true
|
|
209
224
|
}));
|
|
210
225
|
})));
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
require("../../styles/main.css");
|
|
11
|
+
|
|
12
|
+
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
17
|
+
|
|
18
|
+
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."); }
|
|
19
|
+
|
|
20
|
+
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); }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
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; }
|
|
25
|
+
|
|
26
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
27
|
+
|
|
28
|
+
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); }
|
|
29
|
+
|
|
30
|
+
var DesignModal = function DesignModal(_ref) {
|
|
31
|
+
var props = _extends({}, _ref);
|
|
32
|
+
|
|
33
|
+
var _React$useState = _react.default.useState(false),
|
|
34
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
35
|
+
open = _React$useState2[0],
|
|
36
|
+
setOpen = _React$useState2[1];
|
|
37
|
+
|
|
38
|
+
return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("button", {
|
|
39
|
+
onClick: function onClick() {
|
|
40
|
+
return setOpen(true);
|
|
41
|
+
}
|
|
42
|
+
}, "Show confirm"), /*#__PURE__*/_react.default.createElement(_Modal.default, _extends({
|
|
43
|
+
open: open,
|
|
44
|
+
title: 'title',
|
|
45
|
+
bodyText: 'hola',
|
|
46
|
+
requestClose: function requestClose() {
|
|
47
|
+
return setOpen(false);
|
|
48
|
+
}
|
|
49
|
+
}, props)));
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
DesignModal.displayName = "DesignModal";
|
|
53
|
+
var _default = DesignModal;
|
|
54
|
+
exports.default = _default;
|
|
@@ -1,3 +1,82 @@
|
|
|
1
|
-
.cbx-
|
|
2
|
-
|
|
1
|
+
.cbx-Modal-container {
|
|
2
|
+
color: #222;
|
|
3
|
+
position: fixed;
|
|
4
|
+
top: 0px;
|
|
5
|
+
left: 0px;
|
|
6
|
+
width: 100% !important;
|
|
7
|
+
height: 100%;
|
|
8
|
+
background: rgba(0, 0, 0, 0.5);
|
|
9
|
+
display: table;
|
|
10
|
+
z-index: var(--zIdxModal);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.cbx-Modal-contentCentered {
|
|
14
|
+
display: table-cell;
|
|
15
|
+
vertical-align: middle;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.cbx-Modal-content {
|
|
19
|
+
position: relative;
|
|
20
|
+
background: white;
|
|
21
|
+
margin: auto;
|
|
22
|
+
filter: drop-shadow(rgba(0, 0, 0, 0.25) 4px 4px 4px);
|
|
23
|
+
box-shadow: none;
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
border-radius: 0.25rem;
|
|
26
|
+
max-height: calc(100% - 64px);
|
|
27
|
+
max-width: 37.5rem;
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-direction: column;
|
|
30
|
+
min-width: 34.375rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.cbx-Modal-title {
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 1rem 1.5rem;
|
|
36
|
+
padding-top: 1.438rem;
|
|
37
|
+
padding-left: 2rem;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.cbx-Modal-body {
|
|
41
|
+
padding: 0 2rem;
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
flex: 1 1 auto;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.cbx-Modal-container.hide {
|
|
47
|
+
opacity: 0;
|
|
48
|
+
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.cbx-Modal-container.hide .cbx-Modal-contentCentered {
|
|
53
|
+
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.cbx-Modal-container.show {
|
|
57
|
+
opacity: 1;
|
|
58
|
+
transition: opacity 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.cbx-Modal-container.show .cbx-Modal-contentCentered {
|
|
62
|
+
transition: box-shadow 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cbx-Modal-buttons {
|
|
66
|
+
padding: 1.5rem 2rem;
|
|
67
|
+
display: flex;
|
|
68
|
+
justify-content: flex-end;
|
|
69
|
+
overflow: hidden;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.cbx-Modal-close {
|
|
73
|
+
position: absolute;
|
|
74
|
+
right: 1.625rem;
|
|
75
|
+
top: 1.125rem
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.cbx-Modal-close i {
|
|
79
|
+
font-size: 1.5rem;
|
|
80
|
+
color: var(--gray3);
|
|
81
|
+
cursor: pointer;
|
|
3
82
|
}
|
|
@@ -11,7 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
|
|
12
12
|
require("./Modal.css");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _reactDom = require("react-dom");
|
|
15
15
|
|
|
16
16
|
var _Typography = _interopRequireDefault(require("../Typography/Typography"));
|
|
17
17
|
|
|
@@ -19,7 +19,9 @@ var _ButtonBasic = _interopRequireDefault(require("../ButtonBasic/ButtonBasic"))
|
|
|
19
19
|
|
|
20
20
|
var _CouncilboxThemeContext = require("../ThemeProvider/CouncilboxThemeContext");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
|
|
23
|
+
|
|
24
|
+
var _excluded = ["title", "fullWidth", "id", "fullScreen", "buttonAccept", "buttonCancel", "open", "requestClose", "loadingAction", "acceptAction", "cancelAction", "body", "bodyText", "hideAccept", "extraActions", "classNameDialog", "PaperProps", "widthModal", "actions", "sx", "buttonCancelProps", "buttonAcceptProps", "breakpointsButtons", "hasScrollbar", "scrollbarHeight", "prefixClass", "style", "styles", "className"];
|
|
23
25
|
|
|
24
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
27
|
|
|
@@ -31,6 +33,18 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
31
33
|
|
|
32
34
|
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); }
|
|
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; }
|
|
@@ -62,12 +76,56 @@ var Modal = function Modal(_ref) {
|
|
|
62
76
|
breakpointsButtons = _ref.breakpointsButtons,
|
|
63
77
|
hasScrollbar = _ref.hasScrollbar,
|
|
64
78
|
scrollbarHeight = _ref.scrollbarHeight,
|
|
79
|
+
propPrefixClass = _ref.prefixClass,
|
|
80
|
+
style = _ref.style,
|
|
81
|
+
styles = _ref.styles,
|
|
82
|
+
className = _ref.className,
|
|
65
83
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
66
84
|
|
|
85
|
+
var _React$useState = _react.default.useState(false),
|
|
86
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
87
|
+
show = _React$useState2[0],
|
|
88
|
+
setShow = _React$useState2[1];
|
|
89
|
+
|
|
90
|
+
var _React$useState3 = _react.default.useState(open),
|
|
91
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
92
|
+
visible = _React$useState4[0],
|
|
93
|
+
setVisible = _React$useState4[1];
|
|
94
|
+
|
|
95
|
+
var _React$useState5 = _react.default.useState(false),
|
|
96
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
97
|
+
isTransitioning = _React$useState6[0],
|
|
98
|
+
setIsTransitioning = _React$useState6[1];
|
|
99
|
+
|
|
67
100
|
var _useCouncilboxTheme = (0, _CouncilboxThemeContext.useCouncilboxTheme)(),
|
|
68
101
|
size = _useCouncilboxTheme.size,
|
|
69
102
|
innerWidth = _useCouncilboxTheme.innerWidth;
|
|
70
103
|
|
|
104
|
+
var _useDynamicStyles = (0, _useDynamicStyles2.default)(sx),
|
|
105
|
+
stylesInLine = _useDynamicStyles.stylesInLine,
|
|
106
|
+
dynamicPrefixClass = _useDynamicStyles.prefixClass;
|
|
107
|
+
|
|
108
|
+
var prefixClass = propPrefixClass || dynamicPrefixClass;
|
|
109
|
+
|
|
110
|
+
_react.default.useEffect(function () {
|
|
111
|
+
if (isTransitioning) return;
|
|
112
|
+
|
|
113
|
+
if (open) {
|
|
114
|
+
setVisible(true);
|
|
115
|
+
setTimeout(function () {
|
|
116
|
+
setShow(true);
|
|
117
|
+
setIsTransitioning(false);
|
|
118
|
+
}, 10);
|
|
119
|
+
} else {
|
|
120
|
+
setShow(false);
|
|
121
|
+
setIsTransitioning(true);
|
|
122
|
+
setTimeout(function () {
|
|
123
|
+
setVisible(false);
|
|
124
|
+
setIsTransitioning(false);
|
|
125
|
+
}, 225);
|
|
126
|
+
}
|
|
127
|
+
}, [open, isTransitioning]);
|
|
128
|
+
|
|
71
129
|
var buttons = /*#__PURE__*/_react.default.createElement("div", {
|
|
72
130
|
style: {
|
|
73
131
|
display: 'flex',
|
|
@@ -81,10 +139,8 @@ var Modal = function Modal(_ref) {
|
|
|
81
139
|
id: "".concat(id, "-button-cancel"),
|
|
82
140
|
onClick: cancelAction || requestClose,
|
|
83
141
|
fullWidth: true
|
|
84
|
-
}, buttonCancelProps))), extraActions
|
|
85
|
-
/*#__PURE__*/
|
|
86
|
-
// extraActions siempre fullWidth
|
|
87
|
-
_react.default.createElement("div", null, extraActions), !hideAccept && !!buttonAccept && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_ButtonBasic.default, _extends({
|
|
142
|
+
}, buttonCancelProps))), extraActions // extraActions siempre fullWidth
|
|
143
|
+
&& /*#__PURE__*/_react.default.createElement("div", null, extraActions), !hideAccept && !!buttonAccept && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_ButtonBasic.default, _extends({
|
|
88
144
|
text: buttonAccept,
|
|
89
145
|
id: "".concat(id, "-button-accept"),
|
|
90
146
|
loading: loadingAction,
|
|
@@ -92,56 +148,42 @@ var Modal = function Modal(_ref) {
|
|
|
92
148
|
fullWidth: true
|
|
93
149
|
}, buttonAcceptProps))));
|
|
94
150
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
151
|
+
var handleBackgroundClick = function handleBackgroundClick(e) {
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
requestClose(false);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
var handleContentClick = function handleContentClick(e) {
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, visible && /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
161
|
+
className: prefixClass("cbx-Modal-container ".concat(show ? 'show' : 'hide', " ").concat(classNameDialog || '', " ").concat(className || '', " ")),
|
|
162
|
+
onClick: handleBackgroundClick,
|
|
99
163
|
id: id,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}, sx)
|
|
124
|
-
}, props), !!requestClose && /*#__PURE__*/_react.default.createElement("div", {
|
|
125
|
-
style: {
|
|
126
|
-
position: 'absolute',
|
|
127
|
-
right: '26px',
|
|
128
|
-
top: '18px'
|
|
129
|
-
},
|
|
130
|
-
id: "alert-confirm-close",
|
|
131
|
-
onClick: requestClose
|
|
132
|
-
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
133
|
-
className: "ri-close-line",
|
|
134
|
-
style: {
|
|
135
|
-
fontSize: '1.5rem',
|
|
136
|
-
color: 'var(--gray3)',
|
|
137
|
-
cursor: 'pointer'
|
|
138
|
-
}
|
|
139
|
-
})), !!title && /*#__PURE__*/_react.default.createElement(_material.DialogTitle, {
|
|
140
|
-
component: 'span',
|
|
141
|
-
sx: {
|
|
142
|
-
paddingTop: '1.438rem',
|
|
143
|
-
paddingLeft: '2rem'
|
|
144
|
-
}
|
|
164
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, styles), style), stylesInLine)
|
|
165
|
+
}, props), /*#__PURE__*/_react.default.createElement("div", {
|
|
166
|
+
className: prefixClass('cbx-Modal-contentCentered')
|
|
167
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
168
|
+
className: prefixClass('cbx-Modal-content'),
|
|
169
|
+
onClick: handleContentClick,
|
|
170
|
+
style: _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, hasScrollbar ? {
|
|
171
|
+
width: size === 'sm' || size === 'xs' ? '' : '100%',
|
|
172
|
+
height: scrollbarHeight || '100%'
|
|
173
|
+
} : {}), widthModal), PaperProps ? PaperProps.style : {}), size === 'sm' || size === 'xs' ? {
|
|
174
|
+
margin: 0
|
|
175
|
+
} : {}), size === 'sm' || size === 'xs' || fullWidth ? {
|
|
176
|
+
width: '100%',
|
|
177
|
+
maxWidth: '100%',
|
|
178
|
+
minWidth: '100%'
|
|
179
|
+
} : {}), fullScreen ? {
|
|
180
|
+
height: '100%',
|
|
181
|
+
maxHeight: '100%',
|
|
182
|
+
borderRadius: '0',
|
|
183
|
+
width: '100%'
|
|
184
|
+
} : {})
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
186
|
+
className: prefixClass('cbx-Modal-title')
|
|
145
187
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
146
188
|
variant: "L",
|
|
147
189
|
fontWeight: '700',
|
|
@@ -149,35 +191,25 @@ var Modal = function Modal(_ref) {
|
|
|
149
191
|
styles: {
|
|
150
192
|
marginRight: '1.8rem'
|
|
151
193
|
}
|
|
152
|
-
}, title)
|
|
153
|
-
|
|
194
|
+
}, title), !!requestClose && /*#__PURE__*/_react.default.createElement("div", {
|
|
195
|
+
id: "alert-confirm-close",
|
|
196
|
+
className: prefixClass('cbx-Modal-close'),
|
|
197
|
+
onClick: requestClose
|
|
198
|
+
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
199
|
+
className: "ri-close-line"
|
|
200
|
+
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
201
|
+
className: prefixClass('cbx-Modal-body'),
|
|
202
|
+
style: {
|
|
154
203
|
minWidth: size === 'sm' || size === 'xs' ? '100%' : '25rem',
|
|
155
|
-
maxWidth: size === 'sm' || size === 'xs' ? '100%' : '37.5rem'
|
|
156
|
-
padding: '0 2rem',
|
|
157
|
-
overflow: 'hidden'
|
|
158
|
-
}
|
|
159
|
-
}, body || bodyText), (!!buttonCancel || !!buttonAccept) && /*#__PURE__*/_react.default.createElement(_material.DialogActions, {
|
|
160
|
-
className: "cbx-modal-contentButtons",
|
|
161
|
-
sx: {
|
|
162
|
-
padding: '1.5rem 2rem',
|
|
163
|
-
margin: '0px',
|
|
164
|
-
minWidth: '1.563rem',
|
|
165
|
-
display: 'flex',
|
|
166
|
-
flexFlow: 'row wrap'
|
|
167
|
-
}
|
|
168
|
-
}, buttons), actions && /*#__PURE__*/_react.default.createElement(_material.DialogActions, {
|
|
169
|
-
className: "cbx-modal-contentButtons",
|
|
170
|
-
sx: {
|
|
171
|
-
padding: '1.5rem 2rem',
|
|
172
|
-
margin: '0px',
|
|
173
|
-
minWidth: '1.563rem',
|
|
174
|
-
display: 'flex',
|
|
175
|
-
flexFlow: 'row wrap'
|
|
204
|
+
maxWidth: size === 'sm' || size === 'xs' ? '100%' : '37.5rem'
|
|
176
205
|
}
|
|
177
|
-
},
|
|
206
|
+
}, body || bodyText), (!!buttonCancel || !!buttonAccept) && /*#__PURE__*/_react.default.createElement("div", {
|
|
207
|
+
className: prefixClass('cbx-Modal-buttons')
|
|
208
|
+
}, buttonCancel || buttonAccept ? buttons : null), actions && /*#__PURE__*/_react.default.createElement("div", {
|
|
209
|
+
className: prefixClass('cbx-Modal-buttons')
|
|
210
|
+
}, actions)))), document.body));
|
|
178
211
|
};
|
|
179
212
|
|
|
180
|
-
Modal.displayName = "Modal";
|
|
181
213
|
var _default = Modal;
|
|
182
214
|
exports.default = _default;
|
|
183
215
|
Modal.propTypes = {
|
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.Default = void 0;
|
|
6
|
+
exports.default = exports.DesignModalTemplate = exports.Default = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _Modal = _interopRequireDefault(require("./Modal"));
|
|
11
11
|
|
|
12
|
+
var _DesignModal = _interopRequireDefault(require("./DesignModal.stories"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
var _default = {
|
|
@@ -49,6 +51,12 @@ var Template = function Template(args) {
|
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
Template.displayName = "Template";
|
|
54
|
+
|
|
55
|
+
var TemplateModal = function TemplateModal(args) {
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_DesignModal.default, args);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
TemplateModal.displayName = "TemplateModal";
|
|
52
60
|
var Default = Template.bind({});
|
|
53
61
|
exports.Default = Default;
|
|
54
62
|
Default.args = {
|
|
@@ -62,4 +70,7 @@ Default.args = {
|
|
|
62
70
|
buttonCancel: 'Cancelar',
|
|
63
71
|
requestClose: function requestClose() {},
|
|
64
72
|
buttonAccept: 'Aceptar'
|
|
65
|
-
};
|
|
73
|
+
};
|
|
74
|
+
var DesignModalTemplate = TemplateModal.bind({});
|
|
75
|
+
exports.DesignModalTemplate = DesignModalTemplate;
|
|
76
|
+
DesignModalTemplate.parameters = {};
|