@unbxd-ui/unbxd-react-components 0.2.145 → 0.2.146
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 +1 -2
- package/components/Accordian/Accordian.stories.js +140 -117
- package/components/Button/Button.stories.js +167 -61
- package/components/Button/DropdownButton.js +1 -2
- package/components/Button/index.js +1 -2
- package/components/DataLoader/DataLoader.js +1 -2
- package/components/DataLoader/DataLoader.stories.js +239 -53
- package/components/Form/Checkbox.js +5 -4
- package/components/Form/DragDropFileUploader.js +1 -2
- package/components/Form/Dropdown.js +1 -2
- package/components/Form/FileUploader.js +1 -2
- package/components/Form/Form.js +1 -2
- package/components/Form/Input.js +1 -2
- package/components/Form/RadioList.js +1 -2
- package/components/Form/RangeSlider.js +1 -2
- package/components/Form/SearchableDropdown.js +563 -0
- package/components/Form/ServerPaginatedDDList.js +17 -11
- package/components/Form/Textarea.js +1 -2
- package/components/Form/Toggle.js +1 -2
- package/components/Form/formCore.css +1 -1
- package/components/Form/formTheme.css +1 -1
- package/components/Form/index.js +7 -0
- package/components/Form/stories/Checkbox.stories.js +138 -39
- package/components/Form/stories/Dropdown.stories.js +322 -91
- package/components/Form/stories/FileUploader.stories.js +177 -18
- package/components/Form/stories/Input.stories.js +115 -0
- package/components/Form/stories/RangeSlider.stories.js +161 -63
- 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 +112 -33
- package/components/Form/stories/Toggle.stories.js +192 -13
- package/components/Form/variables.css +0 -0
- package/components/InlineModal/InlineModal.js +1 -2
- package/components/InlineModal/InlineModal.stories.js +239 -45
- package/components/InlineModal/index.js +1 -2
- package/components/InlineModal/inlineModalCore.css +1 -1
- package/components/List/List.stories.js +238 -0
- package/components/Modal/Modal.js +1 -2
- package/components/Modal/Modal.stories.js +256 -37
- package/components/Modal/modalCore.css +1 -1
- package/components/NotificationComponent/NotificationComponent.js +1 -2
- package/components/NotificationComponent/NotificationComponent.stories.js +170 -18
- 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.stories.js +202 -9
- package/components/ProgressBar/progressBarCore.css +1 -1
- package/components/Table/BaseTable.js +84 -354
- package/components/Table/Table.js +6 -359
- package/components/Table/Table.stories.js +2109 -150
- 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 +13 -0
- 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 +1 -2
- package/components/TabsComponent/TabsComponent.stories.js +290 -52
- 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 +221 -83
- package/components/Tooltip/Tooltip.stories.js +379 -14
- package/components/Tooltip/tooltipCore.css +1 -1
- package/components/Tooltip/tooltipTheme.css +1 -1
- package/components/core.css +2 -3
- package/components/core.scss +17 -0
- package/components/index.js +58 -2
- package/components/theme.css +2 -3
- package/core/dataLoader.js +5 -2
- package/index.js +54 -0
- package/package.json +31 -20
- 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
|
@@ -3,59 +3,297 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.VerticalTabs = exports.
|
|
6
|
+
exports["default"] = exports.WithEventHandling = exports.WithDisabledTabs = exports.VerticalTabs = exports.DisabledWithStaticContent = exports.Default = exports.CustomTabTitle = exports.CustomStyling = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _TabsComponent = _interopRequireDefault(require("./TabsComponent"));
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
10
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
11
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
13
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
14
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
15
|
+
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."); }
|
|
16
|
+
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; } }
|
|
17
|
+
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; }
|
|
18
|
+
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; } }
|
|
19
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
20
|
+
var meta = {
|
|
21
|
+
title: 'Components/TabsComponent',
|
|
22
|
+
component: _TabsComponent["default"],
|
|
23
|
+
parameters: {
|
|
24
|
+
layout: 'centered'
|
|
25
|
+
},
|
|
26
|
+
tags: ['autodocs'],
|
|
27
|
+
argTypes: {
|
|
28
|
+
appearance: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: ['HORIZONTAL', 'VERTICAL'],
|
|
31
|
+
description: 'Orientation of the tabs'
|
|
32
|
+
},
|
|
33
|
+
className: {
|
|
34
|
+
control: 'text',
|
|
35
|
+
description: 'Additional CSS classes'
|
|
36
|
+
},
|
|
37
|
+
disabled: {
|
|
38
|
+
control: 'boolean',
|
|
39
|
+
description: 'Whether all tabs are disabled'
|
|
40
|
+
},
|
|
41
|
+
selectedTab: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
description: 'ID of the initially selected tab'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var _default = exports["default"] = meta;
|
|
48
|
+
var Tab1Content = function Tab1Content() {
|
|
49
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
50
|
+
style: {
|
|
51
|
+
padding: '20px'
|
|
52
|
+
}
|
|
53
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "First Tab Content"), /*#__PURE__*/_react["default"].createElement("p", null, "This is the content of the first tab."));
|
|
54
|
+
};
|
|
55
|
+
var Tab2Content = function Tab2Content() {
|
|
56
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
57
|
+
style: {
|
|
58
|
+
padding: '20px'
|
|
59
|
+
}
|
|
60
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Second Tab Content"), /*#__PURE__*/_react["default"].createElement("p", null, "This is the content of the second tab."));
|
|
61
|
+
};
|
|
62
|
+
var Tab3Content = function Tab3Content() {
|
|
63
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
64
|
+
style: {
|
|
65
|
+
padding: '20px'
|
|
66
|
+
}
|
|
67
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Third Tab Content"), /*#__PURE__*/_react["default"].createElement("p", null, "This is the content of the third tab."));
|
|
68
|
+
};
|
|
69
|
+
var Default = exports.Default = {
|
|
70
|
+
render: function render() {
|
|
71
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
72
|
+
items: [{
|
|
73
|
+
id: 'tab1',
|
|
74
|
+
label: 'Tab 1',
|
|
75
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
76
|
+
}, {
|
|
77
|
+
id: 'tab2',
|
|
78
|
+
label: 'Tab 2',
|
|
79
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null)
|
|
80
|
+
}, {
|
|
81
|
+
id: 'tab3',
|
|
82
|
+
label: 'Tab 3',
|
|
83
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
84
|
+
}],
|
|
85
|
+
appearance: "HORIZONTAL"
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var VerticalTabs = exports.VerticalTabs = {
|
|
90
|
+
render: function render() {
|
|
91
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
92
|
+
items: [{
|
|
93
|
+
id: 'tab1',
|
|
94
|
+
label: 'Tab 1',
|
|
95
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
96
|
+
}, {
|
|
97
|
+
id: 'tab2',
|
|
98
|
+
label: 'Tab 2',
|
|
99
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null)
|
|
100
|
+
}, {
|
|
101
|
+
id: 'tab3',
|
|
102
|
+
label: 'Tab 3',
|
|
103
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
104
|
+
}],
|
|
105
|
+
appearance: "VERTICAL"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var WithDisabledTabs = exports.WithDisabledTabs = {
|
|
110
|
+
render: function render() {
|
|
111
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
112
|
+
items: [{
|
|
113
|
+
id: 'tab1',
|
|
114
|
+
label: 'Enabled Tab',
|
|
115
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
116
|
+
}, {
|
|
117
|
+
id: 'tab2',
|
|
118
|
+
label: 'Disabled Tab',
|
|
119
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null),
|
|
120
|
+
disabled: true
|
|
121
|
+
}, {
|
|
122
|
+
id: 'tab3',
|
|
123
|
+
label: 'Enabled Tab',
|
|
124
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
125
|
+
}],
|
|
126
|
+
appearance: "HORIZONTAL"
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
var CustomStyling = exports.CustomStyling = {
|
|
131
|
+
render: function render() {
|
|
132
|
+
var customItems = [{
|
|
133
|
+
id: 'success',
|
|
134
|
+
label: /*#__PURE__*/_react["default"].createElement("span", {
|
|
135
|
+
style: {
|
|
136
|
+
color: '#4CAF50'
|
|
137
|
+
}
|
|
138
|
+
}, "\u2713 Success"),
|
|
139
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
140
|
+
style: {
|
|
141
|
+
padding: '20px',
|
|
142
|
+
color: '#4CAF50'
|
|
143
|
+
}
|
|
144
|
+
}, "Success content")
|
|
145
|
+
}, {
|
|
146
|
+
id: 'warning',
|
|
147
|
+
label: /*#__PURE__*/_react["default"].createElement("span", {
|
|
148
|
+
style: {
|
|
149
|
+
color: '#FFC107'
|
|
150
|
+
}
|
|
151
|
+
}, "\u26A0 Warning"),
|
|
152
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
153
|
+
style: {
|
|
154
|
+
padding: '20px',
|
|
155
|
+
color: '#FFC107'
|
|
156
|
+
}
|
|
157
|
+
}, "Warning content")
|
|
158
|
+
}, {
|
|
159
|
+
id: 'error',
|
|
160
|
+
label: /*#__PURE__*/_react["default"].createElement("span", {
|
|
161
|
+
style: {
|
|
162
|
+
color: '#F44336'
|
|
163
|
+
}
|
|
164
|
+
}, "\u2715 Error"),
|
|
165
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
166
|
+
style: {
|
|
167
|
+
padding: '20px',
|
|
168
|
+
color: '#F44336'
|
|
169
|
+
}
|
|
170
|
+
}, "Error content")
|
|
171
|
+
}];
|
|
172
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
173
|
+
items: customItems,
|
|
174
|
+
appearance: "HORIZONTAL",
|
|
175
|
+
className: "custom-tabs"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
var WithEventHandling = exports.WithEventHandling = {
|
|
180
|
+
render: function render() {
|
|
181
|
+
var _React$useState = _react["default"].useState('tab1'),
|
|
182
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
183
|
+
activeTab = _React$useState2[0],
|
|
184
|
+
setActiveTab = _React$useState2[1];
|
|
185
|
+
var _React$useState3 = _react["default"].useState([]),
|
|
186
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
187
|
+
log = _React$useState4[0],
|
|
188
|
+
setLog = _React$useState4[1];
|
|
189
|
+
var handleTabChange = function handleTabChange(tabId) {
|
|
190
|
+
setLog(function (prev) {
|
|
191
|
+
return [].concat(_toConsumableArray(prev), ["Tab change requested: ".concat(tabId)]);
|
|
192
|
+
});
|
|
193
|
+
return tabId !== 'tab3';
|
|
194
|
+
};
|
|
195
|
+
var handleTabChanged = function handleTabChanged(tabId) {
|
|
196
|
+
setLog(function (prev) {
|
|
197
|
+
return [].concat(_toConsumableArray(prev), ["Tab changed to: ".concat(tabId)]);
|
|
198
|
+
});
|
|
199
|
+
setActiveTab(tabId);
|
|
200
|
+
};
|
|
201
|
+
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
202
|
+
items: [{
|
|
203
|
+
id: 'tab1',
|
|
204
|
+
label: 'Tab 1',
|
|
205
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
206
|
+
}, {
|
|
207
|
+
id: 'tab2',
|
|
208
|
+
label: 'Tab 2',
|
|
209
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null)
|
|
210
|
+
}, {
|
|
211
|
+
id: 'tab3',
|
|
212
|
+
label: 'Tab 3 (Blocked)',
|
|
213
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
214
|
+
}],
|
|
215
|
+
selectedTab: activeTab,
|
|
216
|
+
onTabChange: handleTabChange,
|
|
217
|
+
onTabChanged: handleTabChanged
|
|
218
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
219
|
+
style: {
|
|
220
|
+
marginTop: '20px',
|
|
221
|
+
padding: '10px',
|
|
222
|
+
background: '#f5f5f5'
|
|
223
|
+
}
|
|
224
|
+
}, /*#__PURE__*/_react["default"].createElement("h4", null, "Event Log:"), log.map(function (entry, index) {
|
|
225
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
226
|
+
key: index
|
|
227
|
+
}, entry);
|
|
228
|
+
})));
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
var DisabledWithStaticContent = exports.DisabledWithStaticContent = {
|
|
232
|
+
render: function render() {
|
|
233
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
234
|
+
items: [{
|
|
235
|
+
id: 'tab1',
|
|
236
|
+
label: 'Tab 1',
|
|
237
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
238
|
+
}, {
|
|
239
|
+
id: 'tab2',
|
|
240
|
+
label: 'Tab 2',
|
|
241
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null)
|
|
242
|
+
}, {
|
|
243
|
+
id: 'tab3',
|
|
244
|
+
label: 'Tab 3',
|
|
245
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
246
|
+
}],
|
|
247
|
+
disabled: true,
|
|
248
|
+
staticTabContent: /*#__PURE__*/_react["default"].createElement("div", {
|
|
249
|
+
style: {
|
|
250
|
+
padding: '20px',
|
|
251
|
+
textAlign: 'center',
|
|
252
|
+
color: '#666'
|
|
253
|
+
}
|
|
254
|
+
}, /*#__PURE__*/_react["default"].createElement("h3", null, "Tabs are currently disabled"), /*#__PURE__*/_react["default"].createElement("p", null, "This content is shown when all tabs are disabled."))
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
var CustomTabTitle = exports.CustomTabTitle = {
|
|
259
|
+
render: function render() {
|
|
260
|
+
var CustomTitle = function CustomTitle(props) {
|
|
261
|
+
var itemData = props.itemData,
|
|
262
|
+
selected = props.selected,
|
|
263
|
+
changeTab = props.changeTab;
|
|
264
|
+
var id = itemData.id,
|
|
265
|
+
label = itemData.label;
|
|
266
|
+
var isSelected = id === selected;
|
|
267
|
+
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
268
|
+
onClick: function onClick() {
|
|
269
|
+
return changeTab(id);
|
|
270
|
+
},
|
|
271
|
+
style: {
|
|
272
|
+
padding: '10px 20px',
|
|
273
|
+
cursor: 'pointer',
|
|
274
|
+
backgroundColor: isSelected ? '#3E71F2' : '#fff',
|
|
275
|
+
color: isSelected ? '#fff' : '#000',
|
|
276
|
+
borderRadius: '20px',
|
|
277
|
+
margin: '0 5px',
|
|
278
|
+
listStyle: 'none'
|
|
279
|
+
}
|
|
280
|
+
}, label);
|
|
281
|
+
};
|
|
282
|
+
return /*#__PURE__*/_react["default"].createElement(_TabsComponent["default"], {
|
|
283
|
+
items: [{
|
|
284
|
+
id: 'tab1',
|
|
285
|
+
label: 'Custom Tab 1',
|
|
286
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab1Content, null)
|
|
287
|
+
}, {
|
|
288
|
+
id: 'tab2',
|
|
289
|
+
label: 'Custom Tab 2',
|
|
290
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab2Content, null)
|
|
291
|
+
}, {
|
|
292
|
+
id: 'tab3',
|
|
293
|
+
label: 'Custom Tab 3',
|
|
294
|
+
bodyComponent: /*#__PURE__*/_react["default"].createElement(Tab3Content, null)
|
|
295
|
+
}],
|
|
296
|
+
TabTitleItem: CustomTitle
|
|
297
|
+
});
|
|
298
|
+
}
|
|
61
299
|
};
|
|
@@ -0,0 +1,212 @@
|
|
|
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.warningToast = exports.successToast = exports.resetToast = exports.infoToast = exports.errorToast = exports["default"] = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
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 ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
18
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
19
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
20
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
21
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
22
|
+
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."); }
|
|
23
|
+
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; } }
|
|
24
|
+
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; }
|
|
25
|
+
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; } }
|
|
26
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
27
|
+
var TOAST_ICON_MAP = {
|
|
28
|
+
success: "toast-success",
|
|
29
|
+
error: "toast-error",
|
|
30
|
+
warning: "toast-warn",
|
|
31
|
+
info: "toast-info"
|
|
32
|
+
};
|
|
33
|
+
var addToastExternal;
|
|
34
|
+
var resetToastExternal;
|
|
35
|
+
var removeToastExternal;
|
|
36
|
+
var ToastNotificationWrapper = function ToastNotificationWrapper() {
|
|
37
|
+
var _useState = (0, _react.useState)([]),
|
|
38
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
39
|
+
toasts = _useState2[0],
|
|
40
|
+
setToasts = _useState2[1];
|
|
41
|
+
addToastExternal = function addToastExternal(toast) {
|
|
42
|
+
var _toast$appearance = toast.appearance,
|
|
43
|
+
appearance = _toast$appearance === void 0 ? "info" : _toast$appearance,
|
|
44
|
+
message = toast.message,
|
|
45
|
+
_toast$fadeOutTime = toast.fadeOutTime,
|
|
46
|
+
fadeOutTime = _toast$fadeOutTime === void 0 ? 6000 : _toast$fadeOutTime,
|
|
47
|
+
_toast$toastPosition = toast.toastPosition,
|
|
48
|
+
toastPosition = _toast$toastPosition === void 0 ? "bottom-left" : _toast$toastPosition,
|
|
49
|
+
_toast$autoClose = toast.autoClose,
|
|
50
|
+
autoClose = _toast$autoClose === void 0 ? appearance !== "error" : _toast$autoClose;
|
|
51
|
+
var newToast = {
|
|
52
|
+
id: Date.now(),
|
|
53
|
+
appearance: appearance,
|
|
54
|
+
message: message,
|
|
55
|
+
fadeOutTime: fadeOutTime,
|
|
56
|
+
position: toastPosition,
|
|
57
|
+
autoClose: autoClose
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
// Use functional setState to avoid stale closure
|
|
61
|
+
setToasts(function (prevToasts) {
|
|
62
|
+
var filterToast = prevToasts.filter(function (toast) {
|
|
63
|
+
return toast.message !== newToast.message;
|
|
64
|
+
});
|
|
65
|
+
return [newToast].concat(_toConsumableArray(filterToast));
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
resetToastExternal = function resetToastExternal() {
|
|
69
|
+
setToasts([]);
|
|
70
|
+
};
|
|
71
|
+
removeToastExternal = function removeToastExternal(id) {
|
|
72
|
+
setToasts(function (prevToasts) {
|
|
73
|
+
return prevToasts.filter(function (toast) {
|
|
74
|
+
return toast.id !== id;
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// Group toasts by position for proper stacking
|
|
80
|
+
var toastsByPosition = toasts.reduce(function (acc, toast) {
|
|
81
|
+
if (!acc[toast.position]) {
|
|
82
|
+
acc[toast.position] = [];
|
|
83
|
+
}
|
|
84
|
+
acc[toast.position].push(toast);
|
|
85
|
+
return acc;
|
|
86
|
+
}, {});
|
|
87
|
+
|
|
88
|
+
// Helper function to determine stacking order
|
|
89
|
+
var getStackedToasts = function getStackedToasts(positionToasts, position) {
|
|
90
|
+
// For top positions, newest toasts should appear below existing ones
|
|
91
|
+
// For bottom positions, newest toasts should appear above existing ones
|
|
92
|
+
if (position.startsWith('top-')) {
|
|
93
|
+
return _toConsumableArray(positionToasts).reverse(); // Reverse for top positions
|
|
94
|
+
}
|
|
95
|
+
return positionToasts; // Keep original order for bottom positions
|
|
96
|
+
};
|
|
97
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, Object.entries(toastsByPosition).map(function (_ref) {
|
|
98
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
99
|
+
position = _ref2[0],
|
|
100
|
+
positionToasts = _ref2[1];
|
|
101
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
102
|
+
key: position,
|
|
103
|
+
className: "notification-outer-wrapper ".concat(position)
|
|
104
|
+
}, getStackedToasts(positionToasts, position).map(function (toast) {
|
|
105
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
106
|
+
className: "toast ".concat(toast.appearance, " ").concat(toast.appearance === "success" ? "unx-qa-toastsucess" : "unx-qa-toasterror"),
|
|
107
|
+
key: toast.id
|
|
108
|
+
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
109
|
+
className: "message-icon-box"
|
|
110
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
111
|
+
className: TOAST_ICON_MAP[toast.appearance]
|
|
112
|
+
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
113
|
+
className: "message"
|
|
114
|
+
}, toast.message)), /*#__PURE__*/_react["default"].createElement("button", {
|
|
115
|
+
className: "toast-close",
|
|
116
|
+
onClick: function onClick() {
|
|
117
|
+
return removeToastExternal(toast.id);
|
|
118
|
+
}
|
|
119
|
+
}, "\xD7"), /*#__PURE__*/_react["default"].createElement(ProgressBar, {
|
|
120
|
+
id: toast.id,
|
|
121
|
+
autoClose: toast.autoClose,
|
|
122
|
+
fadeOutTime: toast.fadeOutTime,
|
|
123
|
+
appearance: toast.appearance
|
|
124
|
+
}));
|
|
125
|
+
}));
|
|
126
|
+
}));
|
|
127
|
+
};
|
|
128
|
+
var ProgressBar = function ProgressBar(_ref3) {
|
|
129
|
+
var id = _ref3.id,
|
|
130
|
+
fadeOutTime = _ref3.fadeOutTime,
|
|
131
|
+
autoClose = _ref3.autoClose,
|
|
132
|
+
appearance = _ref3.appearance;
|
|
133
|
+
var _useState3 = (0, _react.useState)(100),
|
|
134
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
135
|
+
progress = _useState4[0],
|
|
136
|
+
setProgress = _useState4[1];
|
|
137
|
+
(0, _react.useEffect)(function () {
|
|
138
|
+
if (!autoClose) return;
|
|
139
|
+
var decrement = 100 / (fadeOutTime / 100);
|
|
140
|
+
var interval = setInterval(function () {
|
|
141
|
+
setProgress(function (prev) {
|
|
142
|
+
var newProgress = prev - decrement;
|
|
143
|
+
if (newProgress <= 0) {
|
|
144
|
+
// Schedule removal on next tick to avoid state updates during render
|
|
145
|
+
setTimeout(function () {
|
|
146
|
+
return removeToastExternal(id);
|
|
147
|
+
}, 0);
|
|
148
|
+
return 0;
|
|
149
|
+
}
|
|
150
|
+
return newProgress;
|
|
151
|
+
});
|
|
152
|
+
}, 100);
|
|
153
|
+
|
|
154
|
+
// Cleanup function
|
|
155
|
+
return function () {
|
|
156
|
+
clearInterval(interval);
|
|
157
|
+
};
|
|
158
|
+
}, [id, fadeOutTime, autoClose]);
|
|
159
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
160
|
+
className: "toast-progress ".concat(appearance),
|
|
161
|
+
style: {
|
|
162
|
+
width: "".concat(progress, "%")
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
ProgressBar.propTypes = {
|
|
167
|
+
/** Unique identifier for the toast */
|
|
168
|
+
id: _propTypes["default"].number.isRequired,
|
|
169
|
+
/** Time in milliseconds before toast auto-closes */
|
|
170
|
+
fadeOutTime: _propTypes["default"].number,
|
|
171
|
+
/** Whether the toast should auto-close */
|
|
172
|
+
autoClose: _propTypes["default"].bool,
|
|
173
|
+
/** Visual appearance of the toast */
|
|
174
|
+
appearance: _propTypes["default"].oneOf(['success', 'error', 'warning', 'info'])
|
|
175
|
+
};
|
|
176
|
+
var successToast = exports.successToast = function successToast(message) {
|
|
177
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
178
|
+
if (!addToastExternal) throw new Error("ToastNotificationWrapper not initialized");
|
|
179
|
+
addToastExternal(_objectSpread(_objectSpread({}, options), {}, {
|
|
180
|
+
appearance: "success",
|
|
181
|
+
message: message
|
|
182
|
+
}));
|
|
183
|
+
};
|
|
184
|
+
var errorToast = exports.errorToast = function errorToast(message) {
|
|
185
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
186
|
+
if (!addToastExternal) throw new Error("ToastNotificationWrapper not initialized");
|
|
187
|
+
addToastExternal(_objectSpread(_objectSpread({}, options), {}, {
|
|
188
|
+
appearance: "error",
|
|
189
|
+
message: message
|
|
190
|
+
}));
|
|
191
|
+
};
|
|
192
|
+
var warningToast = exports.warningToast = function warningToast(message) {
|
|
193
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
194
|
+
if (!addToastExternal) throw new Error("ToastNotificationWrapper not initialized");
|
|
195
|
+
addToastExternal(_objectSpread(_objectSpread({}, options), {}, {
|
|
196
|
+
appearance: "warning",
|
|
197
|
+
message: message
|
|
198
|
+
}));
|
|
199
|
+
};
|
|
200
|
+
var infoToast = exports.infoToast = function infoToast(message) {
|
|
201
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
202
|
+
if (!addToastExternal) throw new Error("ToastNotificationWrapper not initialized");
|
|
203
|
+
addToastExternal(_objectSpread(_objectSpread({}, options), {}, {
|
|
204
|
+
appearance: "info",
|
|
205
|
+
message: message
|
|
206
|
+
}));
|
|
207
|
+
};
|
|
208
|
+
var resetToast = exports.resetToast = function resetToast() {
|
|
209
|
+
if (!resetToastExternal) throw new Error("ToastNotificationWrapper not initialized");
|
|
210
|
+
resetToastExternal();
|
|
211
|
+
};
|
|
212
|
+
var _default = exports["default"] = ToastNotificationWrapper;
|