@unbxd-ui/unbxd-react-components 0.2.221 → 0.3.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/README.md +17 -1
- package/components/Accordian/Accordian.js +14 -11
- package/components/Accordian/Accordian.stories.js +141 -118
- package/components/Accordian/index.js +1 -1
- package/components/Button/Button.js +8 -6
- package/components/Button/Button.stories.js +181 -62
- package/components/Button/DropdownButton.js +5 -6
- package/components/Button/buttonTheme.css +1 -1
- package/components/Button/index.js +2 -3
- package/components/DataLoader/DataLoader.js +6 -7
- package/components/DataLoader/DataLoader.stories.js +244 -58
- package/components/DataLoader/index.js +1 -1
- package/components/Form/Checkbox.js +12 -11
- package/components/Form/DragDropFileUploader.js +6 -7
- package/components/Form/Dropdown.js +14 -12
- package/components/Form/FileUploader.js +3 -4
- package/components/Form/Form.js +6 -7
- package/components/Form/FormElementWrapper.js +1 -1
- package/components/Form/Input.js +24 -15
- package/components/Form/RadioList.js +8 -9
- package/components/Form/RangeSlider.js +12 -13
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +53 -44
- package/components/Form/Textarea.js +26 -10
- package/components/Form/Toggle.js +6 -7
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +8 -1
- package/components/Form/stories/Checkbox.stories.js +139 -40
- package/components/Form/stories/Dropdown.stories.js +323 -92
- package/components/Form/stories/FileUploader.stories.js +178 -19
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +162 -64
- package/components/Form/stories/SearchableDropdown.stories.js +189 -0
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +365 -0
- package/components/Form/stories/Textarea.stories.js +113 -34
- package/components/Form/stories/Toggle.stories.js +193 -14
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +119 -21
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/Link/Link.js +139 -0
- package/components/Link/Link.stories.js +489 -0
- package/components/Link/index.js +28 -0
- package/components/Link/linkCore.css +1 -0
- package/components/Link/linkTheme.css +1 -0
- package/components/List/List.js +11 -8
- package/components/List/List.stories.js +238 -0
- package/components/List/index.js +1 -1
- package/components/Modal/Modal.js +67 -20
- package/components/Modal/Modal.stories.js +257 -38
- package/components/Modal/index.js +1 -1
- package/components/Modal/modalCore.css +1 -1
- package/components/NoDataPlaceholder/NoDataPlaceholder.js +41 -0
- package/components/NoDataPlaceholder/NoDataPlaceholder.stories.js +42 -0
- package/components/NoDataPlaceholder/index.js +9 -0
- package/components/NoDataPlaceholder/noDataPlaceholderCore.css +1 -0
- package/components/NotificationComponent/NotificationComponent.js +20 -10
- package/components/NotificationComponent/NotificationComponent.stories.js +171 -19
- package/components/NotificationComponent/index.js +1 -1
- package/components/NotificationComponent/notificationTheme.css +1 -1
- package/components/PageLoader/PageLoader.js +84 -0
- package/components/PageLoader/PageLoader.stories.js +276 -0
- package/components/PageLoader/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.css +1 -0
- package/components/ProgressBar/ProgressBar.css +0 -0
- package/components/ProgressBar/ProgressBar.js +1 -1
- package/components/ProgressBar/ProgressBar.stories.js +203 -10
- package/components/ProgressBar/index.js +1 -1
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +86 -342
- package/components/Table/PaginationComponent.js +4 -4
- package/components/Table/Table.js +7 -326
- package/components/Table/Table.stories.js +2117 -158
- package/components/Table/TableChild.js +383 -0
- package/components/Table/TableConstants.js +15 -0
- package/components/Table/hooks/usePrevious.js +14 -0
- package/components/Table/index.js +14 -1
- package/components/Table/tableCore.css +1 -1
- package/components/TableOld/BaseTable.js +373 -0
- package/components/TableOld/PaginationComponent.js +86 -0
- package/components/TableOld/TableOld.js +367 -0
- package/components/TableOld/index.js +15 -0
- package/components/TabsComponent/TabsComponent.js +6 -7
- package/components/TabsComponent/TabsComponent.stories.js +291 -53
- package/components/TabsComponent/index.js +1 -1
- package/components/ToastNotification/ToastNotificationWrapper.js +212 -0
- package/components/ToastNotification/ToastNotificationWrapper.stories.js +554 -0
- package/components/ToastNotification/index.js +40 -0
- package/components/ToastNotification/toastNotificationCore.css +1 -0
- package/components/Tooltip/Tooltip.js +231 -56
- package/components/Tooltip/Tooltip.stories.js +380 -15
- package/components/Tooltip/index.js +1 -1
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/common/NoDataDropdown.js +50 -0
- package/components/common/common.css +1 -0
- package/components/core.css +2 -3
- package/components/core.scss +21 -1
- package/components/index.js +91 -3
- package/components/theme.css +2 -3
- package/components/theme.scss +2 -1
- package/core/Validators.js +1 -1
- package/core/customHooks.js +4 -4
- package/core/dataLoader.js +58 -17
- package/core/index.js +1 -1
- package/core/utils.js +15 -4
- package/index.js +54 -0
- package/package.json +41 -28
- package/components/Button/DropdownButton.stories.js +0 -49
- package/components/Form/stories/DragDropFileUploader.stories.js +0 -25
- package/components/Form/stories/FormDefault.stories.js +0 -115
- package/components/Form/stories/RadioList.stories.js +0 -53
- package/components/Form/stories/TextInput.stories.js +0 -76
- package/components/Form/stories/form.stories.js +0 -233
- package/components/List/list.stories.js +0 -35
- package/core/dataLoader.stories.js +0 -119
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
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); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports["default"] = exports.WithCustomListItem = exports.Interactive = exports.EmptyList = exports.Default = exports.CustomStyling = exports.ComplexList = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _List = _interopRequireDefault(require("./List"));
|
|
10
|
+
var _Button = _interopRequireWildcard(require("../Button/Button"));
|
|
11
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
13
|
+
var meta = {
|
|
14
|
+
title: 'Components/List',
|
|
15
|
+
component: _List["default"],
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: 'centered'
|
|
18
|
+
},
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
argTypes: {
|
|
21
|
+
className: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Additional CSS classes for the list'
|
|
24
|
+
},
|
|
25
|
+
items: {
|
|
26
|
+
control: 'object',
|
|
27
|
+
description: 'Array of items to display in the list'
|
|
28
|
+
},
|
|
29
|
+
idAttribute: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'The attribute to use as the unique identifier for items'
|
|
32
|
+
},
|
|
33
|
+
showNoDataMsg: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Whether to show a message when there are no items'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var _default = exports["default"] = meta; // Sample data
|
|
40
|
+
var sampleItems = [{
|
|
41
|
+
id: '1',
|
|
42
|
+
name: 'Item 1'
|
|
43
|
+
}, {
|
|
44
|
+
id: '2',
|
|
45
|
+
name: 'Item 2'
|
|
46
|
+
}, {
|
|
47
|
+
id: '3',
|
|
48
|
+
name: 'Item 3'
|
|
49
|
+
}, {
|
|
50
|
+
id: '4',
|
|
51
|
+
name: 'Item 4'
|
|
52
|
+
}, {
|
|
53
|
+
id: '5',
|
|
54
|
+
name: 'Item 5'
|
|
55
|
+
}];
|
|
56
|
+
|
|
57
|
+
// Basic list
|
|
58
|
+
var Default = exports.Default = {
|
|
59
|
+
render: function render() {
|
|
60
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
61
|
+
style: {
|
|
62
|
+
width: '300px',
|
|
63
|
+
border: '1px solid #eee',
|
|
64
|
+
borderRadius: '4px'
|
|
65
|
+
}
|
|
66
|
+
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
67
|
+
items: sampleItems
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// Empty list with no data message
|
|
73
|
+
var EmptyList = exports.EmptyList = {
|
|
74
|
+
render: function render() {
|
|
75
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
76
|
+
style: {
|
|
77
|
+
width: '300px',
|
|
78
|
+
border: '1px solid #eee',
|
|
79
|
+
borderRadius: '4px'
|
|
80
|
+
}
|
|
81
|
+
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
82
|
+
items: [],
|
|
83
|
+
showNoDataMsg: true
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
// Custom list item component
|
|
89
|
+
var CustomListItem = function CustomListItem(_ref) {
|
|
90
|
+
var itemData = _ref.itemData;
|
|
91
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
92
|
+
className: "RCB-list-item",
|
|
93
|
+
style: {
|
|
94
|
+
display: 'flex',
|
|
95
|
+
justifyContent: 'space-between',
|
|
96
|
+
alignItems: 'center',
|
|
97
|
+
padding: '10px',
|
|
98
|
+
borderBottom: '1px solid #eee'
|
|
99
|
+
}
|
|
100
|
+
}, /*#__PURE__*/_react["default"].createElement("span", null, itemData.name), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
101
|
+
appearance: _Button.ButtonAppearance.SECONDARY,
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return console.log('Clicked:', itemData);
|
|
104
|
+
},
|
|
105
|
+
size: "small"
|
|
106
|
+
}, "View"));
|
|
107
|
+
};
|
|
108
|
+
var WithCustomListItem = exports.WithCustomListItem = {
|
|
109
|
+
render: function render() {
|
|
110
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
111
|
+
style: {
|
|
112
|
+
width: '300px',
|
|
113
|
+
border: '1px solid #eee',
|
|
114
|
+
borderRadius: '4px'
|
|
115
|
+
}
|
|
116
|
+
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
117
|
+
items: sampleItems,
|
|
118
|
+
ListItem: CustomListItem
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
// List with custom styling
|
|
124
|
+
var CustomStyling = exports.CustomStyling = {
|
|
125
|
+
render: function render() {
|
|
126
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
127
|
+
style: {
|
|
128
|
+
width: '300px'
|
|
129
|
+
}
|
|
130
|
+
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
131
|
+
items: sampleItems,
|
|
132
|
+
className: "custom-list",
|
|
133
|
+
ListItem: function ListItem(_ref2) {
|
|
134
|
+
var itemData = _ref2.itemData;
|
|
135
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
136
|
+
style: {
|
|
137
|
+
padding: '12px',
|
|
138
|
+
margin: '8px',
|
|
139
|
+
backgroundColor: '#f5f5f5',
|
|
140
|
+
borderRadius: '8px',
|
|
141
|
+
boxShadow: '0 2px 4px rgba(0,0,0,0.05)',
|
|
142
|
+
transition: 'all 0.2s ease',
|
|
143
|
+
cursor: 'pointer',
|
|
144
|
+
':hover': {
|
|
145
|
+
backgroundColor: '#e9e9e9'
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, itemData.name);
|
|
149
|
+
}
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// List with complex items
|
|
155
|
+
var complexItems = [{
|
|
156
|
+
id: '1',
|
|
157
|
+
name: 'John Doe',
|
|
158
|
+
email: 'john@example.com',
|
|
159
|
+
role: 'Admin',
|
|
160
|
+
status: 'Active'
|
|
161
|
+
}, {
|
|
162
|
+
id: '2',
|
|
163
|
+
name: 'Jane Smith',
|
|
164
|
+
email: 'jane@example.com',
|
|
165
|
+
role: 'User',
|
|
166
|
+
status: 'Inactive'
|
|
167
|
+
}, {
|
|
168
|
+
id: '3',
|
|
169
|
+
name: 'Bob Johnson',
|
|
170
|
+
email: 'bob@example.com',
|
|
171
|
+
role: 'Editor',
|
|
172
|
+
status: 'Active'
|
|
173
|
+
}];
|
|
174
|
+
var ComplexListItem = function ComplexListItem(_ref3) {
|
|
175
|
+
var itemData = _ref3.itemData;
|
|
176
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
177
|
+
className: "RCB-list-item",
|
|
178
|
+
style: {
|
|
179
|
+
padding: '15px',
|
|
180
|
+
borderBottom: '1px solid #eee',
|
|
181
|
+
display: 'grid',
|
|
182
|
+
gridTemplateColumns: 'repeat(4, 1fr)',
|
|
183
|
+
gap: '10px',
|
|
184
|
+
alignItems: 'center'
|
|
185
|
+
}
|
|
186
|
+
}, /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
187
|
+
style: {
|
|
188
|
+
fontWeight: 'bold'
|
|
189
|
+
}
|
|
190
|
+
}, itemData.name), /*#__PURE__*/_react["default"].createElement("div", {
|
|
191
|
+
style: {
|
|
192
|
+
fontSize: '0.9em',
|
|
193
|
+
color: '#666'
|
|
194
|
+
}
|
|
195
|
+
}, itemData.email)), /*#__PURE__*/_react["default"].createElement("div", null, itemData.role), /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", {
|
|
196
|
+
style: {
|
|
197
|
+
padding: '4px 8px',
|
|
198
|
+
borderRadius: '12px',
|
|
199
|
+
backgroundColor: itemData.status === 'Active' ? '#e6f4ea' : '#fce8e6',
|
|
200
|
+
color: itemData.status === 'Active' ? '#137333' : '#c5221f',
|
|
201
|
+
fontSize: '0.9em'
|
|
202
|
+
}
|
|
203
|
+
}, itemData.status)), /*#__PURE__*/_react["default"].createElement("div", {
|
|
204
|
+
style: {
|
|
205
|
+
justifySelf: 'end'
|
|
206
|
+
}
|
|
207
|
+
}, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
208
|
+
appearance: _Button.ButtonAppearance.PRIMARY,
|
|
209
|
+
onClick: function onClick() {
|
|
210
|
+
return console.log('Edit:', itemData);
|
|
211
|
+
}
|
|
212
|
+
}, "Edit")));
|
|
213
|
+
};
|
|
214
|
+
var ComplexList = exports.ComplexList = {
|
|
215
|
+
render: function render() {
|
|
216
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
217
|
+
style: {
|
|
218
|
+
width: '800px',
|
|
219
|
+
border: '1px solid #eee',
|
|
220
|
+
borderRadius: '4px',
|
|
221
|
+
backgroundColor: 'white'
|
|
222
|
+
}
|
|
223
|
+
}, /*#__PURE__*/_react["default"].createElement(_List["default"], {
|
|
224
|
+
items: complexItems,
|
|
225
|
+
ListItem: ComplexListItem
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// Interactive example
|
|
231
|
+
var Interactive = exports.Interactive = {
|
|
232
|
+
args: {
|
|
233
|
+
items: sampleItems,
|
|
234
|
+
showNoDataMsg: true,
|
|
235
|
+
idAttribute: 'id',
|
|
236
|
+
className: ''
|
|
237
|
+
}
|
|
238
|
+
};
|
package/components/List/index.js
CHANGED
|
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _List = _interopRequireDefault(require("./List"));
|
|
8
|
-
function _interopRequireDefault(
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
9
9
|
var _default = exports["default"] = _List["default"];
|
|
@@ -8,19 +8,45 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _react2 = require("motion/react");
|
|
11
12
|
var _excluded = ["isOpen", "onClose", "isConditionalHideEnabled"];
|
|
12
|
-
function _interopRequireDefault(
|
|
13
|
-
function
|
|
14
|
-
function
|
|
15
|
-
function
|
|
16
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
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); }
|
|
16
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
17
17
|
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."); }
|
|
18
|
-
function _unsupportedIterableToArray(
|
|
19
|
-
function _arrayLikeToArray(
|
|
18
|
+
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; } }
|
|
19
|
+
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; }
|
|
20
20
|
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; } }
|
|
21
|
-
function _arrayWithHoles(
|
|
22
|
-
function _objectWithoutProperties(
|
|
23
|
-
function _objectWithoutPropertiesLoose(
|
|
21
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
22
|
+
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; }
|
|
23
|
+
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; }
|
|
24
|
+
var fadeInScaleVariants = {
|
|
25
|
+
hidden: {
|
|
26
|
+
opacity: 0,
|
|
27
|
+
scale: .9,
|
|
28
|
+
transition: {
|
|
29
|
+
ease: "easeInOut",
|
|
30
|
+
duration: 0.2
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
visible: {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
scale: 1,
|
|
36
|
+
transition: {
|
|
37
|
+
ease: "easeInOut",
|
|
38
|
+
duration: 0.2
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
exit: {
|
|
42
|
+
opacity: 0,
|
|
43
|
+
scale: 0.8,
|
|
44
|
+
transition: {
|
|
45
|
+
ease: "easeInOut",
|
|
46
|
+
duration: 0.2
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
24
50
|
var ModalContent = function ModalContent(props) {
|
|
25
51
|
var className = props.className,
|
|
26
52
|
children = props.children,
|
|
@@ -28,11 +54,29 @@ var ModalContent = function ModalContent(props) {
|
|
|
28
54
|
titleComponent = props.titleComponent,
|
|
29
55
|
showClose = props.showClose,
|
|
30
56
|
showHeader = props.showHeader,
|
|
31
|
-
hideModal = props.hideModal
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
57
|
+
hideModal = props.hideModal,
|
|
58
|
+
animateBody = props.animateBody;
|
|
59
|
+
return /*#__PURE__*/_react["default"].createElement(_react2.motion.div, {
|
|
60
|
+
className: "RCB-modal ".concat(className),
|
|
61
|
+
initial: {
|
|
62
|
+
opacity: 0.6
|
|
63
|
+
},
|
|
64
|
+
animate: {
|
|
65
|
+
opacity: 1
|
|
66
|
+
},
|
|
67
|
+
exit: {
|
|
68
|
+
opacity: 0
|
|
69
|
+
},
|
|
70
|
+
transition: {
|
|
71
|
+
duration: 0.2,
|
|
72
|
+
ease: "easeInOut"
|
|
73
|
+
}
|
|
74
|
+
}, /*#__PURE__*/_react["default"].createElement(_react2.motion.div, {
|
|
75
|
+
className: "RCB-modal-body",
|
|
76
|
+
variants: animateBody ? animateBody : fadeInScaleVariants,
|
|
77
|
+
initial: "hidden",
|
|
78
|
+
animate: "visible",
|
|
79
|
+
exit: "exit"
|
|
36
80
|
}, showHeader && /*#__PURE__*/_react["default"].createElement("div", {
|
|
37
81
|
className: "RCB-modal-header"
|
|
38
82
|
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
@@ -56,7 +100,8 @@ ModalContent.propTypes = {
|
|
|
56
100
|
|
|
57
101
|
/** Displays a full screen modal */
|
|
58
102
|
var Modal = function Modal(props, ref) {
|
|
59
|
-
var isOpen = props.isOpen,
|
|
103
|
+
var _props$isOpen = props.isOpen,
|
|
104
|
+
isOpen = _props$isOpen === void 0 ? null : _props$isOpen,
|
|
60
105
|
onClose = props.onClose,
|
|
61
106
|
_props$isConditionalH = props.isConditionalHideEnabled,
|
|
62
107
|
isConditionalHideEnabled = _props$isConditionalH === void 0 ? false : _props$isConditionalH,
|
|
@@ -78,7 +123,9 @@ var Modal = function Modal(props, ref) {
|
|
|
78
123
|
}
|
|
79
124
|
};
|
|
80
125
|
(0, _react.useEffect)(function () {
|
|
81
|
-
|
|
126
|
+
if (isOpen !== null) {
|
|
127
|
+
setIsModalOpen(isOpen);
|
|
128
|
+
}
|
|
82
129
|
}, [isOpen]);
|
|
83
130
|
|
|
84
131
|
/* add methods that can be accessed via this component's ref */
|
|
@@ -88,9 +135,9 @@ var Modal = function Modal(props, ref) {
|
|
|
88
135
|
hideModal: hideModal
|
|
89
136
|
};
|
|
90
137
|
});
|
|
91
|
-
return
|
|
138
|
+
return /*#__PURE__*/_reactDom["default"].createPortal(/*#__PURE__*/_react["default"].createElement(_react2.AnimatePresence, null, isModalOpen ? /*#__PURE__*/_react["default"].createElement(ModalContent, _extends({}, restProps, {
|
|
92
139
|
hideModal: hideModal
|
|
93
|
-
})), bodyElement)
|
|
140
|
+
})) : null), bodyElement);
|
|
94
141
|
};
|
|
95
142
|
Modal = /*#__PURE__*/(0, _react.forwardRef)(Modal);
|
|
96
143
|
Modal.propTypes = {
|
|
@@ -114,7 +161,7 @@ Modal.propTypes = {
|
|
|
114
161
|
Modal.defaultProps = {
|
|
115
162
|
className: "",
|
|
116
163
|
title: "",
|
|
117
|
-
isOpen:
|
|
164
|
+
isOpen: null,
|
|
118
165
|
showClose: true,
|
|
119
166
|
showHeader: true,
|
|
120
167
|
isConditionalHideEnabled: false
|